iclient-maplibregl-es6.js 3.3 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097640986409964100641016410264103641046410564106641076410864109641106411164112641136411464115641166411764118641196412064121641226412364124641256412664127641286412964130641316413264133641346413564136641376413864139641406414164142641436414464145641466414764148641496415064151641526415364154641556415664157641586415964160641616416264163641646416564166641676416864169641706417164172641736417464175641766417764178641796418064181641826418364184641856418664187641886418964190641916419264193641946419564196641976419864199642006420164202642036420464205642066420764208642096421064211642126421364214642156421664217642186421964220642216422264223642246422564226642276422864229642306423164232642336423464235642366423764238642396424064241642426424364244642456424664247642486424964250642516425264253642546425564256642576425864259642606426164262642636426464265642666426764268642696427064271642726427364274642756427664277642786427964280642816428264283642846428564286642876428864289642906429164292642936429464295642966429764298642996430064301643026430364304643056430664307643086430964310643116431264313643146431564316643176431864319643206432164322643236432464325643266432764328643296433064331643326433364334643356433664337643386433964340643416434264343643446434564346643476434864349643506435164352643536435464355643566435764358643596436064361643626436364364643656436664367643686436964370643716437264373643746437564376643776437864379643806438164382643836438464385643866438764388643896439064391643926439364394643956439664397643986439964400644016440264403644046440564406644076440864409644106441164412644136441464415644166441764418644196442064421644226442364424644256442664427644286442964430644316443264433644346443564436644376443864439644406444164442644436444464445644466444764448644496445064451644526445364454644556445664457644586445964460644616446264463644646446564466644676446864469644706447164472644736447464475644766447764478644796448064481644826448364484644856448664487644886448964490644916449264493644946449564496644976449864499645006450164502645036450464505645066450764508645096451064511645126451364514645156451664517645186451964520645216452264523645246452564526645276452864529645306453164532645336453464535645366453764538645396454064541645426454364544645456454664547645486454964550645516455264553645546455564556645576455864559645606456164562645636456464565645666456764568645696457064571645726457364574645756457664577645786457964580645816458264583645846458564586645876458864589645906459164592645936459464595645966459764598645996460064601646026460364604646056460664607646086460964610646116461264613646146461564616646176461864619646206462164622646236462464625646266462764628646296463064631646326463364634646356463664637646386463964640646416464264643646446464564646646476464864649646506465164652646536465464655646566465764658646596466064661646626466364664646656466664667646686466964670646716467264673646746467564676646776467864679646806468164682646836468464685646866468764688646896469064691646926469364694646956469664697646986469964700647016470264703647046470564706647076470864709647106471164712647136471464715647166471764718647196472064721647226472364724647256472664727647286472964730647316473264733647346473564736647376473864739647406474164742647436474464745647466474764748647496475064751647526475364754647556475664757647586475964760647616476264763647646476564766647676476864769647706477164772647736477464775647766477764778647796478064781647826478364784647856478664787647886478964790647916479264793647946479564796647976479864799648006480164802648036480464805648066480764808648096481064811648126481364814648156481664817648186481964820648216482264823648246482564826648276482864829648306483164832648336483464835648366483764838648396484064841648426484364844648456484664847648486484964850648516485264853648546485564856648576485864859648606486164862648636486464865648666486764868648696487064871648726487364874648756487664877648786487964880648816488264883648846488564886648876488864889648906489164892648936489464895648966489764898648996490064901649026490364904649056490664907649086490964910649116491264913649146491564916649176491864919649206492164922649236492464925649266492764928649296493064931649326493364934649356493664937649386493964940649416494264943649446494564946649476494864949649506495164952649536495464955649566495764958649596496064961649626496364964649656496664967649686496964970649716497264973649746497564976649776497864979649806498164982649836498464985649866498764988649896499064991649926499364994649956499664997649986499965000650016500265003650046500565006650076500865009650106501165012650136501465015650166501765018650196502065021650226502365024650256502665027650286502965030650316503265033650346503565036650376503865039650406504165042650436504465045650466504765048650496505065051650526505365054650556505665057650586505965060650616506265063650646506565066650676506865069650706507165072650736507465075650766507765078650796508065081650826508365084650856508665087650886508965090650916509265093650946509565096650976509865099651006510165102651036510465105651066510765108651096511065111651126511365114651156511665117651186511965120651216512265123651246512565126651276512865129651306513165132651336513465135651366513765138651396514065141651426514365144651456514665147651486514965150651516515265153651546515565156651576515865159651606516165162651636516465165651666516765168651696517065171651726517365174651756517665177651786517965180651816518265183651846518565186651876518865189651906519165192651936519465195651966519765198651996520065201652026520365204652056520665207652086520965210652116521265213652146521565216652176521865219652206522165222652236522465225652266522765228652296523065231652326523365234652356523665237652386523965240652416524265243652446524565246652476524865249652506525165252652536525465255652566525765258652596526065261652626526365264652656526665267652686526965270652716527265273652746527565276652776527865279652806528165282652836528465285652866528765288652896529065291652926529365294652956529665297652986529965300653016530265303653046530565306653076530865309653106531165312653136531465315653166531765318653196532065321653226532365324653256532665327653286532965330653316533265333653346533565336653376533865339653406534165342653436534465345653466534765348653496535065351653526535365354653556535665357653586535965360653616536265363653646536565366653676536865369653706537165372653736537465375653766537765378653796538065381653826538365384653856538665387653886538965390653916539265393653946539565396653976539865399654006540165402654036540465405654066540765408654096541065411654126541365414654156541665417654186541965420654216542265423654246542565426654276542865429654306543165432654336543465435654366543765438654396544065441654426544365444654456544665447654486544965450654516545265453654546545565456654576545865459654606546165462654636546465465654666546765468654696547065471654726547365474654756547665477654786547965480654816548265483654846548565486654876548865489654906549165492654936549465495654966549765498654996550065501655026550365504655056550665507655086550965510655116551265513655146551565516655176551865519655206552165522655236552465525655266552765528655296553065531655326553365534655356553665537655386553965540655416554265543655446554565546655476554865549655506555165552655536555465555655566555765558655596556065561655626556365564655656556665567655686556965570655716557265573655746557565576655776557865579655806558165582655836558465585655866558765588655896559065591655926559365594655956559665597655986559965600656016560265603656046560565606656076560865609656106561165612656136561465615656166561765618656196562065621656226562365624656256562665627656286562965630656316563265633656346563565636656376563865639656406564165642656436564465645656466564765648656496565065651656526565365654656556565665657656586565965660656616566265663656646566565666656676566865669656706567165672656736567465675656766567765678656796568065681656826568365684656856568665687656886568965690656916569265693656946569565696656976569865699657006570165702657036570465705657066570765708657096571065711657126571365714657156571665717657186571965720657216572265723657246572565726657276572865729657306573165732657336573465735657366573765738657396574065741657426574365744657456574665747657486574965750657516575265753657546575565756657576575865759657606576165762657636576465765657666576765768657696577065771657726577365774657756577665777657786577965780657816578265783657846578565786657876578865789657906579165792657936579465795657966579765798657996580065801658026580365804658056580665807658086580965810658116581265813658146581565816658176581865819658206582165822658236582465825658266582765828658296583065831658326583365834658356583665837658386583965840658416584265843658446584565846658476584865849658506585165852658536585465855658566585765858658596586065861658626586365864658656586665867658686586965870658716587265873658746587565876658776587865879658806588165882658836588465885658866588765888658896589065891658926589365894658956589665897658986589965900659016590265903659046590565906659076590865909659106591165912659136591465915659166591765918659196592065921659226592365924659256592665927659286592965930659316593265933659346593565936659376593865939659406594165942659436594465945659466594765948659496595065951659526595365954659556595665957659586595965960659616596265963659646596565966659676596865969659706597165972659736597465975659766597765978659796598065981659826598365984659856598665987659886598965990659916599265993659946599565996659976599865999660006600166002660036600466005660066600766008660096601066011660126601366014660156601666017660186601966020660216602266023660246602566026660276602866029660306603166032660336603466035660366603766038660396604066041660426604366044660456604666047660486604966050660516605266053660546605566056660576605866059660606606166062660636606466065660666606766068660696607066071660726607366074660756607666077660786607966080660816608266083660846608566086660876608866089660906609166092660936609466095660966609766098660996610066101661026610366104661056610666107661086610966110661116611266113661146611566116661176611866119661206612166122661236612466125661266612766128661296613066131661326613366134661356613666137661386613966140661416614266143661446614566146661476614866149661506615166152661536615466155661566615766158661596616066161661626616366164661656616666167661686616966170661716617266173661746617566176661776617866179661806618166182661836618466185661866618766188661896619066191661926619366194661956619666197661986619966200662016620266203662046620566206662076620866209662106621166212662136621466215662166621766218662196622066221662226622366224662256622666227662286622966230662316623266233662346623566236662376623866239662406624166242662436624466245662466624766248662496625066251662526625366254662556625666257662586625966260662616626266263662646626566266662676626866269662706627166272662736627466275662766627766278662796628066281662826628366284662856628666287662886628966290662916629266293662946629566296662976629866299663006630166302663036630466305663066630766308663096631066311663126631366314663156631666317663186631966320663216632266323663246632566326663276632866329663306633166332663336633466335663366633766338663396634066341663426634366344663456634666347663486634966350663516635266353663546635566356663576635866359663606636166362663636636466365663666636766368663696637066371663726637366374663756637666377663786637966380663816638266383663846638566386663876638866389663906639166392663936639466395663966639766398663996640066401664026640366404664056640666407664086640966410664116641266413664146641566416664176641866419664206642166422664236642466425664266642766428664296643066431664326643366434664356643666437664386643966440664416644266443664446644566446664476644866449664506645166452664536645466455664566645766458664596646066461664626646366464664656646666467664686646966470664716647266473664746647566476664776647866479664806648166482664836648466485664866648766488664896649066491664926649366494664956649666497664986649966500665016650266503665046650566506665076650866509665106651166512665136651466515665166651766518665196652066521665226652366524665256652666527665286652966530665316653266533665346653566536665376653866539665406654166542665436654466545665466654766548665496655066551665526655366554665556655666557665586655966560665616656266563665646656566566665676656866569665706657166572665736657466575665766657766578665796658066581665826658366584665856658666587665886658966590665916659266593665946659566596665976659866599666006660166602666036660466605666066660766608666096661066611666126661366614666156661666617666186661966620666216662266623666246662566626666276662866629666306663166632666336663466635666366663766638666396664066641666426664366644666456664666647666486664966650666516665266653666546665566656666576665866659666606666166662666636666466665666666666766668666696667066671666726667366674666756667666677666786667966680666816668266683666846668566686666876668866689666906669166692666936669466695666966669766698666996670066701667026670366704667056670666707667086670966710667116671266713667146671566716667176671866719667206672166722667236672466725667266672766728667296673066731667326673366734667356673666737667386673966740667416674266743667446674566746667476674866749667506675166752667536675466755667566675766758667596676066761667626676366764667656676666767667686676966770667716677266773667746677566776667776677866779667806678166782667836678466785667866678766788667896679066791667926679366794667956679666797667986679966800668016680266803668046680566806668076680866809668106681166812668136681466815668166681766818668196682066821668226682366824668256682666827668286682966830668316683266833668346683566836668376683866839668406684166842668436684466845668466684766848668496685066851668526685366854668556685666857668586685966860668616686266863668646686566866668676686866869668706687166872668736687466875668766687766878668796688066881668826688366884668856688666887668886688966890668916689266893668946689566896668976689866899669006690166902669036690466905669066690766908669096691066911669126691366914669156691666917669186691966920669216692266923669246692566926669276692866929669306693166932669336693466935669366693766938669396694066941669426694366944669456694666947669486694966950669516695266953669546695566956669576695866959669606696166962669636696466965669666696766968669696697066971669726697366974669756697666977669786697966980669816698266983669846698566986669876698866989669906699166992669936699466995669966699766998669996700067001670026700367004670056700667007670086700967010670116701267013670146701567016670176701867019670206702167022670236702467025670266702767028670296703067031670326703367034670356703667037670386703967040670416704267043670446704567046670476704867049670506705167052670536705467055670566705767058670596706067061670626706367064670656706667067670686706967070670716707267073670746707567076670776707867079670806708167082670836708467085670866708767088670896709067091670926709367094670956709667097670986709967100671016710267103671046710567106671076710867109671106711167112671136711467115671166711767118671196712067121671226712367124671256712667127671286712967130671316713267133671346713567136671376713867139671406714167142671436714467145671466714767148671496715067151671526715367154671556715667157671586715967160671616716267163671646716567166671676716867169671706717167172671736717467175671766717767178671796718067181671826718367184671856718667187671886718967190671916719267193671946719567196671976719867199672006720167202672036720467205672066720767208672096721067211672126721367214672156721667217672186721967220672216722267223672246722567226672276722867229672306723167232672336723467235672366723767238672396724067241672426724367244672456724667247672486724967250672516725267253672546725567256672576725867259672606726167262672636726467265672666726767268672696727067271672726727367274672756727667277672786727967280672816728267283672846728567286672876728867289672906729167292672936729467295672966729767298672996730067301673026730367304673056730667307673086730967310673116731267313673146731567316673176731867319673206732167322673236732467325673266732767328673296733067331673326733367334673356733667337673386733967340673416734267343673446734567346673476734867349673506735167352673536735467355673566735767358673596736067361673626736367364673656736667367673686736967370673716737267373673746737567376673776737867379673806738167382673836738467385673866738767388673896739067391673926739367394673956739667397673986739967400674016740267403674046740567406674076740867409674106741167412674136741467415674166741767418674196742067421674226742367424674256742667427674286742967430674316743267433674346743567436674376743867439674406744167442674436744467445674466744767448674496745067451674526745367454674556745667457674586745967460674616746267463674646746567466674676746867469674706747167472674736747467475674766747767478674796748067481674826748367484674856748667487674886748967490674916749267493674946749567496674976749867499675006750167502675036750467505675066750767508675096751067511675126751367514675156751667517675186751967520675216752267523675246752567526675276752867529675306753167532675336753467535675366753767538675396754067541675426754367544675456754667547675486754967550675516755267553675546755567556675576755867559675606756167562675636756467565675666756767568675696757067571675726757367574675756757667577675786757967580675816758267583675846758567586675876758867589675906759167592675936759467595675966759767598675996760067601676026760367604676056760667607676086760967610676116761267613676146761567616676176761867619676206762167622676236762467625676266762767628676296763067631676326763367634676356763667637676386763967640676416764267643676446764567646676476764867649676506765167652676536765467655676566765767658676596766067661676626766367664676656766667667676686766967670676716767267673676746767567676676776767867679676806768167682676836768467685676866768767688676896769067691676926769367694676956769667697676986769967700677016770267703677046770567706677076770867709677106771167712677136771467715677166771767718677196772067721677226772367724677256772667727677286772967730677316773267733677346773567736677376773867739677406774167742677436774467745677466774767748677496775067751677526775367754677556775667757677586775967760677616776267763677646776567766677676776867769677706777167772677736777467775677766777767778677796778067781677826778367784677856778667787677886778967790677916779267793677946779567796677976779867799678006780167802678036780467805678066780767808678096781067811678126781367814678156781667817678186781967820678216782267823678246782567826678276782867829678306783167832678336783467835678366783767838678396784067841678426784367844678456784667847678486784967850678516785267853678546785567856678576785867859678606786167862678636786467865678666786767868678696787067871678726787367874678756787667877678786787967880678816788267883678846788567886678876788867889678906789167892678936789467895678966789767898678996790067901679026790367904679056790667907679086790967910679116791267913679146791567916679176791867919679206792167922679236792467925679266792767928679296793067931679326793367934679356793667937679386793967940679416794267943679446794567946679476794867949679506795167952679536795467955679566795767958679596796067961679626796367964679656796667967679686796967970679716797267973679746797567976679776797867979679806798167982679836798467985679866798767988679896799067991679926799367994679956799667997679986799968000680016800268003680046800568006680076800868009680106801168012680136801468015680166801768018680196802068021680226802368024680256802668027680286802968030680316803268033680346803568036680376803868039680406804168042680436804468045680466804768048680496805068051680526805368054680556805668057680586805968060680616806268063680646806568066680676806868069680706807168072680736807468075680766807768078680796808068081680826808368084680856808668087680886808968090680916809268093680946809568096680976809868099681006810168102681036810468105681066810768108681096811068111681126811368114681156811668117681186811968120681216812268123681246812568126681276812868129681306813168132681336813468135681366813768138681396814068141681426814368144681456814668147681486814968150681516815268153681546815568156681576815868159681606816168162681636816468165681666816768168681696817068171681726817368174681756817668177681786817968180681816818268183681846818568186681876818868189681906819168192681936819468195681966819768198681996820068201682026820368204682056820668207682086820968210682116821268213682146821568216682176821868219682206822168222682236822468225682266822768228682296823068231682326823368234682356823668237682386823968240682416824268243682446824568246682476824868249682506825168252682536825468255682566825768258682596826068261682626826368264682656826668267682686826968270682716827268273682746827568276682776827868279682806828168282682836828468285682866828768288682896829068291682926829368294682956829668297682986829968300683016830268303683046830568306683076830868309683106831168312683136831468315683166831768318683196832068321683226832368324683256832668327683286832968330683316833268333683346833568336683376833868339683406834168342683436834468345683466834768348683496835068351683526835368354683556835668357683586835968360683616836268363683646836568366683676836868369683706837168372683736837468375683766837768378683796838068381683826838368384683856838668387683886838968390683916839268393683946839568396683976839868399684006840168402684036840468405684066840768408684096841068411684126841368414684156841668417684186841968420684216842268423684246842568426684276842868429684306843168432684336843468435684366843768438684396844068441684426844368444684456844668447684486844968450684516845268453684546845568456684576845868459684606846168462684636846468465684666846768468684696847068471684726847368474684756847668477684786847968480684816848268483684846848568486684876848868489684906849168492684936849468495684966849768498684996850068501685026850368504685056850668507685086850968510685116851268513685146851568516685176851868519685206852168522685236852468525685266852768528685296853068531685326853368534685356853668537685386853968540685416854268543685446854568546685476854868549685506855168552685536855468555685566855768558685596856068561685626856368564685656856668567685686856968570685716857268573685746857568576685776857868579685806858168582685836858468585685866858768588685896859068591685926859368594685956859668597685986859968600686016860268603686046860568606686076860868609686106861168612686136861468615686166861768618686196862068621686226862368624686256862668627686286862968630686316863268633686346863568636686376863868639686406864168642686436864468645686466864768648686496865068651686526865368654686556865668657686586865968660686616866268663686646866568666686676866868669686706867168672686736867468675686766867768678686796868068681686826868368684686856868668687686886868968690686916869268693686946869568696686976869868699687006870168702687036870468705687066870768708687096871068711687126871368714687156871668717687186871968720687216872268723687246872568726687276872868729687306873168732687336873468735687366873768738687396874068741687426874368744687456874668747687486874968750687516875268753687546875568756687576875868759687606876168762687636876468765687666876768768687696877068771687726877368774687756877668777687786877968780687816878268783687846878568786687876878868789687906879168792687936879468795687966879768798687996880068801688026880368804688056880668807688086880968810688116881268813688146881568816688176881868819688206882168822688236882468825688266882768828688296883068831688326883368834688356883668837688386883968840688416884268843688446884568846688476884868849688506885168852688536885468855688566885768858688596886068861688626886368864688656886668867688686886968870688716887268873688746887568876688776887868879688806888168882688836888468885688866888768888688896889068891688926889368894688956889668897688986889968900689016890268903689046890568906689076890868909689106891168912689136891468915689166891768918689196892068921689226892368924689256892668927689286892968930689316893268933689346893568936689376893868939689406894168942689436894468945689466894768948689496895068951689526895368954689556895668957689586895968960689616896268963689646896568966689676896868969689706897168972689736897468975689766897768978689796898068981689826898368984689856898668987689886898968990689916899268993689946899568996689976899868999690006900169002690036900469005690066900769008690096901069011690126901369014690156901669017690186901969020690216902269023690246902569026690276902869029690306903169032690336903469035690366903769038690396904069041690426904369044690456904669047690486904969050690516905269053690546905569056690576905869059690606906169062690636906469065690666906769068690696907069071690726907369074690756907669077690786907969080690816908269083690846908569086690876908869089690906909169092690936909469095690966909769098690996910069101691026910369104691056910669107691086910969110691116911269113691146911569116691176911869119691206912169122691236912469125691266912769128691296913069131691326913369134691356913669137691386913969140691416914269143691446914569146691476914869149691506915169152691536915469155691566915769158691596916069161691626916369164691656916669167691686916969170691716917269173691746917569176691776917869179691806918169182691836918469185691866918769188691896919069191691926919369194691956919669197691986919969200692016920269203692046920569206692076920869209692106921169212692136921469215692166921769218692196922069221692226922369224692256922669227692286922969230692316923269233692346923569236692376923869239692406924169242692436924469245692466924769248692496925069251692526925369254692556925669257692586925969260692616926269263692646926569266692676926869269692706927169272692736927469275692766927769278692796928069281692826928369284692856928669287692886928969290692916929269293692946929569296692976929869299693006930169302693036930469305693066930769308693096931069311693126931369314693156931669317693186931969320693216932269323693246932569326693276932869329693306933169332693336933469335693366933769338693396934069341693426934369344693456934669347693486934969350693516935269353693546935569356693576935869359693606936169362693636936469365693666936769368693696937069371693726937369374693756937669377693786937969380693816938269383693846938569386693876938869389693906939169392693936939469395693966939769398693996940069401694026940369404694056940669407694086940969410694116941269413694146941569416694176941869419694206942169422694236942469425694266942769428694296943069431694326943369434694356943669437694386943969440694416944269443694446944569446694476944869449694506945169452694536945469455694566945769458694596946069461694626946369464694656946669467694686946969470694716947269473694746947569476694776947869479694806948169482694836948469485694866948769488694896949069491694926949369494694956949669497694986949969500695016950269503695046950569506695076950869509695106951169512695136951469515695166951769518695196952069521695226952369524695256952669527695286952969530695316953269533695346953569536695376953869539695406954169542695436954469545695466954769548695496955069551695526955369554695556955669557695586955969560695616956269563695646956569566695676956869569695706957169572695736957469575695766957769578695796958069581695826958369584695856958669587695886958969590695916959269593695946959569596695976959869599696006960169602696036960469605696066960769608696096961069611696126961369614696156961669617696186961969620696216962269623696246962569626696276962869629696306963169632696336963469635696366963769638696396964069641696426964369644696456964669647696486964969650696516965269653696546965569656696576965869659696606966169662696636966469665696666966769668696696967069671696726967369674696756967669677696786967969680696816968269683696846968569686696876968869689696906969169692696936969469695696966969769698696996970069701697026970369704697056970669707697086970969710697116971269713697146971569716697176971869719697206972169722697236972469725697266972769728697296973069731697326973369734697356973669737697386973969740697416974269743697446974569746697476974869749697506975169752697536975469755697566975769758697596976069761697626976369764697656976669767697686976969770697716977269773697746977569776697776977869779697806978169782697836978469785697866978769788697896979069791697926979369794697956979669797697986979969800698016980269803698046980569806698076980869809698106981169812698136981469815698166981769818698196982069821698226982369824698256982669827698286982969830698316983269833698346983569836698376983869839698406984169842698436984469845698466984769848698496985069851698526985369854698556985669857698586985969860698616986269863698646986569866698676986869869698706987169872698736987469875698766987769878698796988069881698826988369884698856988669887698886988969890698916989269893698946989569896698976989869899699006990169902699036990469905699066990769908699096991069911699126991369914699156991669917699186991969920699216992269923699246992569926699276992869929699306993169932699336993469935699366993769938699396994069941699426994369944699456994669947699486994969950699516995269953699546995569956699576995869959699606996169962699636996469965699666996769968699696997069971699726997369974699756997669977699786997969980699816998269983699846998569986699876998869989699906999169992699936999469995699966999769998699997000070001700027000370004700057000670007700087000970010700117001270013700147001570016700177001870019700207002170022700237002470025700267002770028700297003070031700327003370034700357003670037700387003970040700417004270043700447004570046700477004870049700507005170052700537005470055700567005770058700597006070061700627006370064700657006670067700687006970070700717007270073700747007570076700777007870079700807008170082700837008470085700867008770088700897009070091700927009370094700957009670097700987009970100701017010270103701047010570106701077010870109701107011170112701137011470115701167011770118701197012070121701227012370124701257012670127701287012970130701317013270133701347013570136701377013870139701407014170142701437014470145701467014770148701497015070151701527015370154701557015670157701587015970160701617016270163701647016570166701677016870169701707017170172701737017470175701767017770178701797018070181701827018370184701857018670187701887018970190701917019270193701947019570196701977019870199702007020170202702037020470205702067020770208702097021070211702127021370214702157021670217702187021970220702217022270223702247022570226702277022870229702307023170232702337023470235702367023770238702397024070241702427024370244702457024670247702487024970250702517025270253702547025570256702577025870259702607026170262702637026470265702667026770268702697027070271702727027370274702757027670277702787027970280702817028270283702847028570286702877028870289702907029170292702937029470295702967029770298702997030070301703027030370304703057030670307703087030970310703117031270313703147031570316703177031870319703207032170322703237032470325703267032770328703297033070331703327033370334703357033670337703387033970340703417034270343703447034570346703477034870349703507035170352703537035470355703567035770358703597036070361703627036370364703657036670367703687036970370703717037270373703747037570376703777037870379703807038170382703837038470385703867038770388703897039070391703927039370394703957039670397703987039970400704017040270403704047040570406704077040870409704107041170412704137041470415704167041770418704197042070421704227042370424704257042670427704287042970430704317043270433704347043570436704377043870439704407044170442704437044470445704467044770448704497045070451704527045370454704557045670457704587045970460704617046270463704647046570466704677046870469704707047170472704737047470475704767047770478704797048070481704827048370484704857048670487704887048970490704917049270493704947049570496704977049870499705007050170502705037050470505705067050770508705097051070511705127051370514705157051670517705187051970520705217052270523705247052570526705277052870529705307053170532705337053470535705367053770538705397054070541705427054370544705457054670547705487054970550705517055270553705547055570556705577055870559705607056170562705637056470565705667056770568705697057070571705727057370574705757057670577705787057970580705817058270583705847058570586705877058870589705907059170592705937059470595705967059770598705997060070601706027060370604706057060670607706087060970610706117061270613706147061570616706177061870619706207062170622706237062470625706267062770628706297063070631706327063370634706357063670637706387063970640706417064270643706447064570646706477064870649706507065170652706537065470655706567065770658706597066070661706627066370664706657066670667706687066970670706717067270673706747067570676706777067870679706807068170682706837068470685706867068770688706897069070691706927069370694706957069670697706987069970700707017070270703707047070570706707077070870709707107071170712707137071470715707167071770718707197072070721707227072370724707257072670727707287072970730707317073270733707347073570736707377073870739707407074170742707437074470745707467074770748707497075070751707527075370754707557075670757707587075970760707617076270763707647076570766707677076870769707707077170772707737077470775707767077770778707797078070781707827078370784707857078670787707887078970790707917079270793707947079570796707977079870799708007080170802708037080470805708067080770808708097081070811708127081370814708157081670817708187081970820708217082270823708247082570826708277082870829708307083170832708337083470835708367083770838708397084070841708427084370844708457084670847708487084970850708517085270853708547085570856708577085870859708607086170862708637086470865708667086770868708697087070871708727087370874708757087670877708787087970880708817088270883708847088570886708877088870889708907089170892708937089470895708967089770898708997090070901709027090370904709057090670907709087090970910709117091270913709147091570916709177091870919709207092170922709237092470925709267092770928709297093070931709327093370934709357093670937709387093970940709417094270943709447094570946709477094870949709507095170952709537095470955709567095770958709597096070961709627096370964709657096670967709687096970970709717097270973709747097570976709777097870979709807098170982709837098470985709867098770988709897099070991709927099370994709957099670997709987099971000710017100271003710047100571006710077100871009710107101171012710137101471015710167101771018710197102071021710227102371024710257102671027710287102971030710317103271033710347103571036710377103871039710407104171042710437104471045710467104771048710497105071051710527105371054710557105671057710587105971060710617106271063710647106571066710677106871069710707107171072710737107471075710767107771078710797108071081710827108371084710857108671087710887108971090710917109271093710947109571096710977109871099711007110171102711037110471105711067110771108711097111071111711127111371114711157111671117711187111971120711217112271123711247112571126711277112871129711307113171132711337113471135711367113771138711397114071141711427114371144711457114671147711487114971150711517115271153711547115571156711577115871159711607116171162711637116471165711667116771168711697117071171711727117371174711757117671177711787117971180711817118271183711847118571186711877118871189711907119171192711937119471195711967119771198711997120071201712027120371204712057120671207712087120971210712117121271213712147121571216712177121871219712207122171222712237122471225712267122771228712297123071231712327123371234712357123671237712387123971240712417124271243712447124571246712477124871249712507125171252712537125471255712567125771258712597126071261712627126371264712657126671267712687126971270712717127271273712747127571276712777127871279712807128171282712837128471285712867128771288712897129071291712927129371294712957129671297712987129971300713017130271303713047130571306713077130871309713107131171312713137131471315713167131771318713197132071321713227132371324713257132671327713287132971330713317133271333713347133571336713377133871339713407134171342713437134471345713467134771348713497135071351713527135371354713557135671357713587135971360713617136271363713647136571366713677136871369713707137171372713737137471375713767137771378713797138071381713827138371384713857138671387713887138971390713917139271393713947139571396713977139871399714007140171402714037140471405714067140771408714097141071411714127141371414714157141671417714187141971420714217142271423714247142571426714277142871429714307143171432714337143471435714367143771438714397144071441714427144371444714457144671447714487144971450714517145271453714547145571456714577145871459714607146171462714637146471465714667146771468714697147071471714727147371474714757147671477714787147971480714817148271483714847148571486714877148871489714907149171492714937149471495714967149771498714997150071501715027150371504715057150671507715087150971510715117151271513715147151571516715177151871519715207152171522715237152471525715267152771528715297153071531715327153371534715357153671537715387153971540715417154271543715447154571546715477154871549715507155171552715537155471555715567155771558715597156071561715627156371564715657156671567715687156971570715717157271573715747157571576715777157871579715807158171582715837158471585715867158771588715897159071591715927159371594715957159671597715987159971600716017160271603716047160571606716077160871609716107161171612716137161471615716167161771618716197162071621716227162371624716257162671627716287162971630716317163271633716347163571636716377163871639716407164171642716437164471645716467164771648716497165071651716527165371654716557165671657716587165971660716617166271663716647166571666716677166871669716707167171672716737167471675716767167771678716797168071681716827168371684716857168671687716887168971690716917169271693716947169571696716977169871699717007170171702717037170471705717067170771708717097171071711717127171371714717157171671717717187171971720717217172271723717247172571726717277172871729717307173171732717337173471735717367173771738717397174071741717427174371744717457174671747717487174971750717517175271753717547175571756717577175871759717607176171762717637176471765717667176771768717697177071771717727177371774717757177671777717787177971780717817178271783717847178571786717877178871789717907179171792717937179471795717967179771798717997180071801718027180371804718057180671807718087180971810718117181271813718147181571816718177181871819718207182171822718237182471825718267182771828718297183071831718327183371834718357183671837718387183971840718417184271843718447184571846718477184871849718507185171852718537185471855718567185771858718597186071861718627186371864718657186671867718687186971870718717187271873718747187571876718777187871879718807188171882718837188471885718867188771888718897189071891718927189371894718957189671897718987189971900719017190271903719047190571906719077190871909719107191171912719137191471915719167191771918719197192071921719227192371924719257192671927719287192971930719317193271933719347193571936719377193871939719407194171942719437194471945719467194771948719497195071951719527195371954719557195671957719587195971960719617196271963719647196571966719677196871969719707197171972719737197471975719767197771978719797198071981719827198371984719857198671987719887198971990719917199271993719947199571996719977199871999720007200172002720037200472005720067200772008720097201072011720127201372014720157201672017720187201972020720217202272023720247202572026720277202872029720307203172032720337203472035720367203772038720397204072041720427204372044720457204672047720487204972050720517205272053720547205572056720577205872059720607206172062720637206472065720667206772068720697207072071720727207372074720757207672077720787207972080720817208272083720847208572086720877208872089720907209172092720937209472095720967209772098720997210072101721027210372104721057210672107721087210972110721117211272113721147211572116721177211872119721207212172122721237212472125721267212772128721297213072131721327213372134721357213672137721387213972140721417214272143721447214572146721477214872149721507215172152721537215472155721567215772158721597216072161721627216372164721657216672167721687216972170721717217272173721747217572176721777217872179721807218172182721837218472185721867218772188721897219072191721927219372194721957219672197721987219972200722017220272203722047220572206722077220872209722107221172212722137221472215722167221772218722197222072221722227222372224722257222672227722287222972230722317223272233722347223572236722377223872239722407224172242722437224472245722467224772248722497225072251722527225372254722557225672257722587225972260722617226272263722647226572266722677226872269722707227172272722737227472275722767227772278722797228072281722827228372284722857228672287722887228972290722917229272293722947229572296722977229872299723007230172302723037230472305723067230772308723097231072311723127231372314723157231672317723187231972320723217232272323723247232572326723277232872329723307233172332723337233472335723367233772338723397234072341723427234372344723457234672347723487234972350723517235272353723547235572356723577235872359723607236172362723637236472365723667236772368723697237072371723727237372374723757237672377723787237972380723817238272383723847238572386723877238872389723907239172392723937239472395723967239772398723997240072401724027240372404724057240672407724087240972410724117241272413724147241572416724177241872419724207242172422724237242472425724267242772428724297243072431724327243372434724357243672437724387243972440724417244272443724447244572446724477244872449724507245172452724537245472455724567245772458724597246072461724627246372464724657246672467724687246972470724717247272473724747247572476724777247872479724807248172482724837248472485724867248772488724897249072491724927249372494724957249672497724987249972500725017250272503725047250572506725077250872509725107251172512725137251472515725167251772518725197252072521725227252372524725257252672527725287252972530725317253272533725347253572536725377253872539725407254172542725437254472545725467254772548725497255072551725527255372554725557255672557725587255972560725617256272563725647256572566725677256872569725707257172572725737257472575725767257772578725797258072581725827258372584725857258672587725887258972590725917259272593725947259572596725977259872599726007260172602726037260472605726067260772608726097261072611726127261372614726157261672617726187261972620726217262272623726247262572626726277262872629726307263172632726337263472635726367263772638726397264072641726427264372644726457264672647726487264972650726517265272653726547265572656726577265872659726607266172662726637266472665726667266772668726697267072671726727267372674726757267672677726787267972680726817268272683726847268572686726877268872689726907269172692726937269472695726967269772698726997270072701727027270372704727057270672707727087270972710727117271272713727147271572716727177271872719727207272172722727237272472725727267272772728727297273072731727327273372734727357273672737727387273972740727417274272743727447274572746727477274872749727507275172752727537275472755727567275772758727597276072761727627276372764727657276672767727687276972770727717277272773727747277572776727777277872779727807278172782727837278472785727867278772788727897279072791727927279372794727957279672797727987279972800728017280272803728047280572806728077280872809728107281172812728137281472815728167281772818728197282072821728227282372824728257282672827728287282972830728317283272833728347283572836728377283872839728407284172842728437284472845728467284772848728497285072851728527285372854728557285672857728587285972860728617286272863728647286572866728677286872869728707287172872728737287472875728767287772878728797288072881728827288372884728857288672887728887288972890728917289272893728947289572896728977289872899729007290172902729037290472905729067290772908729097291072911729127291372914729157291672917729187291972920729217292272923729247292572926729277292872929729307293172932729337293472935729367293772938729397294072941729427294372944729457294672947729487294972950729517295272953729547295572956729577295872959729607296172962729637296472965729667296772968729697297072971729727297372974729757297672977729787297972980729817298272983729847298572986729877298872989729907299172992729937299472995729967299772998729997300073001730027300373004730057300673007730087300973010730117301273013730147301573016730177301873019730207302173022730237302473025730267302773028730297303073031730327303373034730357303673037730387303973040730417304273043730447304573046730477304873049730507305173052730537305473055730567305773058730597306073061730627306373064730657306673067730687306973070730717307273073730747307573076730777307873079730807308173082730837308473085730867308773088730897309073091730927309373094730957309673097730987309973100731017310273103731047310573106731077310873109731107311173112731137311473115731167311773118731197312073121731227312373124731257312673127731287312973130731317313273133731347313573136731377313873139731407314173142731437314473145731467314773148731497315073151731527315373154731557315673157731587315973160731617316273163731647316573166731677316873169731707317173172731737317473175731767317773178731797318073181731827318373184731857318673187731887318973190731917319273193731947319573196731977319873199732007320173202732037320473205732067320773208732097321073211732127321373214732157321673217732187321973220732217322273223732247322573226732277322873229732307323173232732337323473235732367323773238732397324073241732427324373244732457324673247732487324973250732517325273253732547325573256732577325873259732607326173262732637326473265732667326773268732697327073271732727327373274732757327673277732787327973280732817328273283732847328573286732877328873289732907329173292732937329473295732967329773298732997330073301733027330373304733057330673307733087330973310733117331273313733147331573316733177331873319733207332173322733237332473325733267332773328733297333073331733327333373334733357333673337733387333973340733417334273343733447334573346733477334873349733507335173352733537335473355733567335773358733597336073361733627336373364733657336673367733687336973370733717337273373733747337573376733777337873379733807338173382733837338473385733867338773388733897339073391733927339373394733957339673397733987339973400734017340273403734047340573406734077340873409734107341173412734137341473415734167341773418734197342073421734227342373424734257342673427734287342973430734317343273433734347343573436734377343873439734407344173442734437344473445734467344773448734497345073451734527345373454734557345673457734587345973460734617346273463734647346573466734677346873469734707347173472734737347473475734767347773478734797348073481734827348373484734857348673487734887348973490734917349273493734947349573496734977349873499735007350173502735037350473505735067350773508735097351073511735127351373514735157351673517735187351973520735217352273523735247352573526735277352873529735307353173532735337353473535735367353773538735397354073541735427354373544735457354673547735487354973550735517355273553735547355573556735577355873559735607356173562735637356473565735667356773568735697357073571735727357373574735757357673577735787357973580735817358273583735847358573586735877358873589735907359173592735937359473595735967359773598735997360073601736027360373604736057360673607736087360973610736117361273613736147361573616736177361873619736207362173622736237362473625736267362773628736297363073631736327363373634736357363673637736387363973640736417364273643736447364573646736477364873649736507365173652736537365473655736567365773658736597366073661736627366373664736657366673667736687366973670736717367273673736747367573676736777367873679736807368173682736837368473685736867368773688736897369073691736927369373694736957369673697736987369973700737017370273703737047370573706737077370873709737107371173712737137371473715737167371773718737197372073721737227372373724737257372673727737287372973730737317373273733737347373573736737377373873739737407374173742737437374473745737467374773748737497375073751737527375373754737557375673757737587375973760737617376273763737647376573766737677376873769737707377173772737737377473775737767377773778737797378073781737827378373784737857378673787737887378973790737917379273793737947379573796737977379873799738007380173802738037380473805738067380773808738097381073811738127381373814738157381673817738187381973820738217382273823738247382573826738277382873829738307383173832738337383473835738367383773838738397384073841738427384373844738457384673847738487384973850738517385273853738547385573856738577385873859738607386173862738637386473865738667386773868738697387073871738727387373874738757387673877738787387973880738817388273883738847388573886738877388873889738907389173892738937389473895738967389773898738997390073901739027390373904739057390673907739087390973910739117391273913739147391573916739177391873919739207392173922739237392473925739267392773928739297393073931739327393373934739357393673937739387393973940739417394273943739447394573946739477394873949739507395173952739537395473955739567395773958739597396073961739627396373964739657396673967739687396973970739717397273973739747397573976739777397873979739807398173982739837398473985739867398773988739897399073991739927399373994739957399673997739987399974000740017400274003740047400574006740077400874009740107401174012740137401474015740167401774018740197402074021740227402374024740257402674027740287402974030740317403274033740347403574036740377403874039740407404174042740437404474045740467404774048740497405074051740527405374054740557405674057740587405974060740617406274063740647406574066740677406874069740707407174072740737407474075740767407774078740797408074081740827408374084740857408674087740887408974090740917409274093740947409574096740977409874099741007410174102741037410474105741067410774108741097411074111741127411374114741157411674117741187411974120741217412274123741247412574126741277412874129741307413174132741337413474135741367413774138741397414074141741427414374144741457414674147741487414974150741517415274153741547415574156741577415874159741607416174162741637416474165741667416774168741697417074171741727417374174741757417674177741787417974180741817418274183741847418574186741877418874189741907419174192741937419474195741967419774198741997420074201742027420374204742057420674207742087420974210742117421274213742147421574216742177421874219742207422174222742237422474225742267422774228742297423074231742327423374234742357423674237742387423974240742417424274243742447424574246742477424874249742507425174252742537425474255742567425774258742597426074261742627426374264742657426674267742687426974270742717427274273742747427574276742777427874279742807428174282742837428474285742867428774288742897429074291742927429374294742957429674297742987429974300743017430274303743047430574306743077430874309743107431174312743137431474315743167431774318743197432074321743227432374324743257432674327743287432974330743317433274333743347433574336743377433874339743407434174342743437434474345743467434774348743497435074351743527435374354743557435674357743587435974360743617436274363743647436574366743677436874369743707437174372743737437474375743767437774378743797438074381743827438374384743857438674387743887438974390743917439274393743947439574396743977439874399744007440174402744037440474405744067440774408744097441074411744127441374414744157441674417744187441974420744217442274423744247442574426744277442874429744307443174432744337443474435744367443774438744397444074441744427444374444744457444674447744487444974450744517445274453744547445574456744577445874459744607446174462744637446474465744667446774468744697447074471744727447374474744757447674477744787447974480744817448274483744847448574486744877448874489744907449174492744937449474495744967449774498744997450074501745027450374504745057450674507745087450974510745117451274513745147451574516745177451874519745207452174522745237452474525745267452774528745297453074531745327453374534745357453674537745387453974540745417454274543745447454574546745477454874549745507455174552745537455474555745567455774558745597456074561745627456374564745657456674567745687456974570745717457274573745747457574576745777457874579745807458174582745837458474585745867458774588745897459074591745927459374594745957459674597745987459974600746017460274603746047460574606746077460874609746107461174612746137461474615746167461774618746197462074621746227462374624746257462674627746287462974630746317463274633746347463574636746377463874639746407464174642746437464474645746467464774648746497465074651746527465374654746557465674657746587465974660746617466274663746647466574666746677466874669746707467174672746737467474675746767467774678746797468074681746827468374684746857468674687746887468974690746917469274693746947469574696746977469874699747007470174702747037470474705747067470774708747097471074711747127471374714747157471674717747187471974720747217472274723747247472574726747277472874729747307473174732747337473474735747367473774738747397474074741747427474374744747457474674747747487474974750747517475274753747547475574756747577475874759747607476174762747637476474765747667476774768747697477074771747727477374774747757477674777747787477974780747817478274783747847478574786747877478874789747907479174792747937479474795747967479774798747997480074801748027480374804748057480674807748087480974810748117481274813748147481574816748177481874819748207482174822748237482474825748267482774828748297483074831748327483374834748357483674837748387483974840748417484274843748447484574846748477484874849748507485174852748537485474855748567485774858748597486074861748627486374864748657486674867748687486974870748717487274873748747487574876748777487874879748807488174882748837488474885748867488774888748897489074891748927489374894748957489674897748987489974900749017490274903749047490574906749077490874909749107491174912749137491474915749167491774918749197492074921749227492374924749257492674927749287492974930749317493274933749347493574936749377493874939749407494174942749437494474945749467494774948749497495074951749527495374954749557495674957749587495974960749617496274963749647496574966749677496874969749707497174972749737497474975749767497774978749797498074981749827498374984749857498674987749887498974990749917499274993749947499574996749977499874999750007500175002750037500475005750067500775008750097501075011750127501375014750157501675017750187501975020750217502275023750247502575026750277502875029750307503175032750337503475035750367503775038750397504075041750427504375044750457504675047750487504975050750517505275053750547505575056750577505875059750607506175062750637506475065750667506775068750697507075071750727507375074750757507675077750787507975080750817508275083750847508575086750877508875089750907509175092750937509475095750967509775098750997510075101751027510375104751057510675107751087510975110751117511275113751147511575116751177511875119751207512175122751237512475125751267512775128751297513075131751327513375134751357513675137751387513975140751417514275143751447514575146751477514875149751507515175152751537515475155751567515775158751597516075161751627516375164751657516675167751687516975170751717517275173751747517575176751777517875179751807518175182751837518475185751867518775188751897519075191751927519375194751957519675197751987519975200752017520275203752047520575206752077520875209752107521175212752137521475215752167521775218752197522075221752227522375224752257522675227752287522975230752317523275233752347523575236752377523875239752407524175242752437524475245752467524775248752497525075251752527525375254752557525675257752587525975260752617526275263752647526575266752677526875269752707527175272752737527475275752767527775278752797528075281752827528375284752857528675287752887528975290752917529275293752947529575296752977529875299753007530175302753037530475305753067530775308753097531075311753127531375314753157531675317753187531975320753217532275323753247532575326753277532875329753307533175332753337533475335753367533775338753397534075341753427534375344753457534675347753487534975350753517535275353753547535575356753577535875359753607536175362753637536475365753667536775368753697537075371753727537375374753757537675377753787537975380753817538275383753847538575386753877538875389753907539175392753937539475395753967539775398753997540075401754027540375404754057540675407754087540975410754117541275413754147541575416754177541875419754207542175422754237542475425754267542775428754297543075431754327543375434754357543675437754387543975440754417544275443754447544575446754477544875449754507545175452754537545475455754567545775458754597546075461754627546375464754657546675467754687546975470754717547275473754747547575476754777547875479754807548175482754837548475485754867548775488754897549075491754927549375494754957549675497754987549975500755017550275503755047550575506755077550875509755107551175512755137551475515755167551775518755197552075521755227552375524755257552675527755287552975530755317553275533755347553575536755377553875539755407554175542755437554475545755467554775548755497555075551755527555375554755557555675557755587555975560755617556275563755647556575566755677556875569755707557175572755737557475575755767557775578755797558075581755827558375584755857558675587755887558975590755917559275593755947559575596755977559875599756007560175602756037560475605756067560775608756097561075611756127561375614756157561675617756187561975620756217562275623756247562575626756277562875629756307563175632756337563475635756367563775638756397564075641756427564375644756457564675647756487564975650756517565275653756547565575656756577565875659756607566175662756637566475665756667566775668756697567075671756727567375674756757567675677756787567975680756817568275683756847568575686756877568875689756907569175692756937569475695756967569775698756997570075701757027570375704757057570675707757087570975710757117571275713757147571575716757177571875719757207572175722757237572475725757267572775728757297573075731757327573375734757357573675737757387573975740757417574275743757447574575746757477574875749757507575175752757537575475755757567575775758757597576075761757627576375764757657576675767757687576975770757717577275773757747577575776757777577875779757807578175782757837578475785757867578775788757897579075791757927579375794757957579675797757987579975800758017580275803758047580575806758077580875809758107581175812758137581475815758167581775818758197582075821758227582375824758257582675827758287582975830758317583275833758347583575836758377583875839758407584175842758437584475845758467584775848758497585075851758527585375854758557585675857758587585975860758617586275863758647586575866758677586875869758707587175872758737587475875758767587775878758797588075881758827588375884758857588675887758887588975890758917589275893758947589575896758977589875899759007590175902759037590475905759067590775908759097591075911759127591375914759157591675917759187591975920759217592275923759247592575926759277592875929759307593175932759337593475935759367593775938759397594075941759427594375944759457594675947759487594975950759517595275953759547595575956759577595875959759607596175962759637596475965759667596775968759697597075971759727597375974759757597675977759787597975980759817598275983759847598575986759877598875989759907599175992759937599475995759967599775998759997600076001760027600376004760057600676007760087600976010760117601276013760147601576016760177601876019760207602176022760237602476025760267602776028760297603076031760327603376034760357603676037760387603976040760417604276043760447604576046760477604876049760507605176052760537605476055760567605776058760597606076061760627606376064760657606676067760687606976070760717607276073760747607576076760777607876079760807608176082760837608476085760867608776088760897609076091760927609376094760957609676097760987609976100761017610276103761047610576106761077610876109761107611176112761137611476115761167611776118761197612076121761227612376124761257612676127761287612976130761317613276133761347613576136761377613876139761407614176142761437614476145761467614776148761497615076151761527615376154761557615676157761587615976160761617616276163761647616576166761677616876169761707617176172761737617476175761767617776178761797618076181761827618376184761857618676187761887618976190761917619276193761947619576196761977619876199762007620176202762037620476205762067620776208762097621076211762127621376214762157621676217762187621976220762217622276223762247622576226762277622876229762307623176232762337623476235762367623776238762397624076241762427624376244762457624676247762487624976250762517625276253762547625576256762577625876259762607626176262762637626476265762667626776268762697627076271762727627376274762757627676277762787627976280762817628276283762847628576286762877628876289762907629176292762937629476295762967629776298762997630076301763027630376304763057630676307763087630976310763117631276313763147631576316763177631876319763207632176322763237632476325763267632776328763297633076331763327633376334763357633676337763387633976340763417634276343763447634576346763477634876349763507635176352763537635476355763567635776358763597636076361763627636376364763657636676367763687636976370763717637276373763747637576376763777637876379763807638176382763837638476385763867638776388763897639076391763927639376394763957639676397763987639976400764017640276403764047640576406764077640876409764107641176412764137641476415764167641776418764197642076421764227642376424764257642676427764287642976430764317643276433764347643576436764377643876439764407644176442764437644476445764467644776448764497645076451764527645376454764557645676457764587645976460764617646276463764647646576466764677646876469764707647176472764737647476475764767647776478764797648076481764827648376484764857648676487764887648976490764917649276493764947649576496764977649876499765007650176502765037650476505765067650776508765097651076511765127651376514765157651676517765187651976520765217652276523765247652576526765277652876529765307653176532765337653476535765367653776538765397654076541765427654376544765457654676547765487654976550765517655276553765547655576556765577655876559765607656176562765637656476565765667656776568765697657076571765727657376574765757657676577765787657976580765817658276583765847658576586765877658876589765907659176592765937659476595765967659776598765997660076601766027660376604766057660676607766087660976610766117661276613766147661576616766177661876619766207662176622766237662476625766267662776628766297663076631766327663376634766357663676637766387663976640766417664276643766447664576646766477664876649766507665176652766537665476655766567665776658766597666076661766627666376664766657666676667766687666976670766717667276673766747667576676766777667876679766807668176682766837668476685766867668776688766897669076691766927669376694766957669676697766987669976700767017670276703767047670576706767077670876709767107671176712767137671476715767167671776718767197672076721767227672376724767257672676727767287672976730767317673276733767347673576736767377673876739767407674176742767437674476745767467674776748767497675076751767527675376754767557675676757767587675976760767617676276763767647676576766767677676876769767707677176772767737677476775767767677776778767797678076781767827678376784767857678676787767887678976790767917679276793767947679576796767977679876799768007680176802768037680476805768067680776808768097681076811768127681376814768157681676817768187681976820768217682276823768247682576826768277682876829768307683176832768337683476835768367683776838768397684076841768427684376844768457684676847768487684976850768517685276853768547685576856768577685876859768607686176862768637686476865768667686776868768697687076871768727687376874768757687676877768787687976880768817688276883768847688576886768877688876889768907689176892768937689476895768967689776898768997690076901769027690376904769057690676907769087690976910769117691276913769147691576916769177691876919769207692176922769237692476925769267692776928769297693076931769327693376934769357693676937769387693976940769417694276943769447694576946769477694876949769507695176952769537695476955769567695776958769597696076961769627696376964769657696676967769687696976970769717697276973769747697576976769777697876979769807698176982769837698476985769867698776988769897699076991769927699376994769957699676997769987699977000770017700277003770047700577006770077700877009770107701177012770137701477015770167701777018770197702077021770227702377024770257702677027770287702977030770317703277033770347703577036770377703877039770407704177042770437704477045770467704777048770497705077051770527705377054770557705677057770587705977060770617706277063770647706577066770677706877069770707707177072770737707477075770767707777078770797708077081770827708377084770857708677087770887708977090770917709277093770947709577096770977709877099771007710177102771037710477105771067710777108771097711077111771127711377114771157711677117771187711977120771217712277123771247712577126771277712877129771307713177132771337713477135771367713777138771397714077141771427714377144771457714677147771487714977150771517715277153771547715577156771577715877159771607716177162771637716477165771667716777168771697717077171771727717377174771757717677177771787717977180771817718277183771847718577186771877718877189771907719177192771937719477195771967719777198771997720077201772027720377204772057720677207772087720977210772117721277213772147721577216772177721877219772207722177222772237722477225772267722777228772297723077231772327723377234772357723677237772387723977240772417724277243772447724577246772477724877249772507725177252772537725477255772567725777258772597726077261772627726377264772657726677267772687726977270772717727277273772747727577276772777727877279772807728177282772837728477285772867728777288772897729077291772927729377294772957729677297772987729977300773017730277303773047730577306773077730877309773107731177312773137731477315773167731777318773197732077321773227732377324773257732677327773287732977330773317733277333773347733577336773377733877339773407734177342773437734477345773467734777348773497735077351773527735377354773557735677357773587735977360773617736277363773647736577366773677736877369773707737177372773737737477375773767737777378773797738077381773827738377384773857738677387773887738977390773917739277393773947739577396773977739877399774007740177402774037740477405774067740777408774097741077411774127741377414774157741677417774187741977420774217742277423774247742577426774277742877429774307743177432774337743477435774367743777438774397744077441774427744377444774457744677447774487744977450774517745277453774547745577456774577745877459774607746177462774637746477465774667746777468774697747077471774727747377474774757747677477774787747977480774817748277483774847748577486774877748877489774907749177492774937749477495774967749777498774997750077501775027750377504775057750677507775087750977510775117751277513775147751577516775177751877519775207752177522775237752477525775267752777528775297753077531775327753377534775357753677537775387753977540775417754277543775447754577546775477754877549775507755177552775537755477555775567755777558775597756077561775627756377564775657756677567775687756977570775717757277573775747757577576775777757877579775807758177582775837758477585775867758777588775897759077591775927759377594775957759677597775987759977600776017760277603776047760577606776077760877609776107761177612776137761477615776167761777618776197762077621776227762377624776257762677627776287762977630776317763277633776347763577636776377763877639776407764177642776437764477645776467764777648776497765077651776527765377654776557765677657776587765977660776617766277663776647766577666776677766877669776707767177672776737767477675776767767777678776797768077681776827768377684776857768677687776887768977690776917769277693776947769577696776977769877699777007770177702777037770477705777067770777708777097771077711777127771377714777157771677717777187771977720777217772277723777247772577726777277772877729777307773177732777337773477735777367773777738777397774077741777427774377744777457774677747777487774977750777517775277753777547775577756777577775877759777607776177762777637776477765777667776777768777697777077771777727777377774777757777677777777787777977780777817778277783777847778577786777877778877789777907779177792777937779477795777967779777798777997780077801778027780377804778057780677807778087780977810778117781277813778147781577816778177781877819778207782177822778237782477825778267782777828778297783077831778327783377834778357783677837778387783977840778417784277843778447784577846778477784877849778507785177852778537785477855778567785777858778597786077861778627786377864778657786677867778687786977870778717787277873778747787577876778777787877879778807788177882778837788477885778867788777888778897789077891778927789377894778957789677897778987789977900779017790277903779047790577906779077790877909779107791177912779137791477915779167791777918779197792077921779227792377924779257792677927779287792977930779317793277933779347793577936779377793877939779407794177942779437794477945779467794777948779497795077951779527795377954779557795677957779587795977960779617796277963779647796577966779677796877969779707797177972779737797477975779767797777978779797798077981779827798377984779857798677987779887798977990779917799277993779947799577996779977799877999780007800178002780037800478005780067800778008780097801078011780127801378014780157801678017780187801978020780217802278023780247802578026780277802878029780307803178032780337803478035780367803778038780397804078041780427804378044780457804678047780487804978050780517805278053780547805578056780577805878059780607806178062780637806478065780667806778068780697807078071780727807378074780757807678077780787807978080780817808278083780847808578086780877808878089780907809178092780937809478095780967809778098780997810078101781027810378104781057810678107781087810978110781117811278113781147811578116781177811878119781207812178122781237812478125781267812778128781297813078131781327813378134781357813678137781387813978140781417814278143781447814578146781477814878149781507815178152781537815478155781567815778158781597816078161781627816378164781657816678167781687816978170781717817278173781747817578176781777817878179781807818178182781837818478185781867818778188781897819078191781927819378194781957819678197781987819978200782017820278203782047820578206782077820878209782107821178212782137821478215782167821778218782197822078221782227822378224782257822678227782287822978230782317823278233782347823578236782377823878239782407824178242782437824478245782467824778248782497825078251782527825378254782557825678257782587825978260782617826278263782647826578266782677826878269782707827178272782737827478275782767827778278782797828078281782827828378284782857828678287782887828978290782917829278293782947829578296782977829878299783007830178302783037830478305783067830778308783097831078311783127831378314783157831678317783187831978320783217832278323783247832578326783277832878329783307833178332783337833478335783367833778338783397834078341783427834378344783457834678347783487834978350783517835278353783547835578356783577835878359783607836178362783637836478365783667836778368783697837078371783727837378374783757837678377783787837978380783817838278383783847838578386783877838878389783907839178392783937839478395783967839778398783997840078401784027840378404784057840678407784087840978410784117841278413784147841578416784177841878419784207842178422784237842478425784267842778428784297843078431784327843378434784357843678437784387843978440784417844278443784447844578446784477844878449784507845178452784537845478455784567845778458784597846078461784627846378464784657846678467784687846978470784717847278473784747847578476784777847878479784807848178482784837848478485784867848778488784897849078491784927849378494784957849678497784987849978500785017850278503785047850578506785077850878509785107851178512785137851478515785167851778518785197852078521785227852378524785257852678527785287852978530785317853278533785347853578536785377853878539785407854178542785437854478545785467854778548785497855078551785527855378554785557855678557785587855978560785617856278563785647856578566785677856878569785707857178572785737857478575785767857778578785797858078581785827858378584785857858678587785887858978590785917859278593785947859578596785977859878599786007860178602786037860478605786067860778608786097861078611786127861378614786157861678617786187861978620786217862278623786247862578626786277862878629786307863178632786337863478635786367863778638786397864078641786427864378644786457864678647786487864978650786517865278653786547865578656786577865878659786607866178662786637866478665786667866778668786697867078671786727867378674786757867678677786787867978680786817868278683786847868578686786877868878689786907869178692786937869478695786967869778698786997870078701787027870378704787057870678707787087870978710787117871278713787147871578716787177871878719787207872178722787237872478725787267872778728787297873078731787327873378734787357873678737787387873978740787417874278743787447874578746787477874878749787507875178752787537875478755787567875778758787597876078761787627876378764787657876678767787687876978770787717877278773787747877578776787777877878779787807878178782787837878478785787867878778788787897879078791787927879378794787957879678797787987879978800788017880278803788047880578806788077880878809788107881178812788137881478815788167881778818788197882078821788227882378824788257882678827788287882978830788317883278833788347883578836788377883878839788407884178842788437884478845788467884778848788497885078851788527885378854788557885678857788587885978860788617886278863788647886578866788677886878869788707887178872788737887478875788767887778878788797888078881788827888378884788857888678887788887888978890788917889278893788947889578896788977889878899789007890178902789037890478905789067890778908789097891078911789127891378914789157891678917789187891978920789217892278923789247892578926789277892878929789307893178932789337893478935789367893778938789397894078941789427894378944789457894678947789487894978950789517895278953789547895578956789577895878959789607896178962789637896478965789667896778968789697897078971789727897378974789757897678977789787897978980789817898278983789847898578986789877898878989789907899178992789937899478995789967899778998789997900079001790027900379004790057900679007790087900979010790117901279013790147901579016790177901879019790207902179022790237902479025790267902779028790297903079031790327903379034790357903679037790387903979040790417904279043790447904579046790477904879049790507905179052790537905479055790567905779058790597906079061790627906379064790657906679067790687906979070790717907279073790747907579076790777907879079790807908179082790837908479085790867908779088790897909079091790927909379094790957909679097790987909979100791017910279103791047910579106791077910879109791107911179112791137911479115791167911779118791197912079121791227912379124791257912679127791287912979130791317913279133791347913579136791377913879139791407914179142791437914479145791467914779148791497915079151791527915379154791557915679157791587915979160791617916279163791647916579166791677916879169791707917179172791737917479175791767917779178791797918079181791827918379184791857918679187791887918979190791917919279193791947919579196791977919879199792007920179202792037920479205792067920779208792097921079211792127921379214792157921679217792187921979220792217922279223792247922579226792277922879229792307923179232792337923479235792367923779238792397924079241792427924379244792457924679247792487924979250792517925279253792547925579256792577925879259792607926179262792637926479265792667926779268792697927079271792727927379274792757927679277792787927979280792817928279283792847928579286792877928879289792907929179292792937929479295792967929779298792997930079301793027930379304793057930679307793087930979310793117931279313793147931579316793177931879319793207932179322793237932479325793267932779328793297933079331793327933379334793357933679337793387933979340793417934279343793447934579346793477934879349793507935179352793537935479355793567935779358793597936079361793627936379364793657936679367793687936979370793717937279373793747937579376793777937879379793807938179382793837938479385793867938779388793897939079391793927939379394793957939679397793987939979400794017940279403794047940579406794077940879409794107941179412794137941479415794167941779418794197942079421794227942379424794257942679427794287942979430794317943279433794347943579436794377943879439794407944179442794437944479445794467944779448794497945079451794527945379454794557945679457794587945979460794617946279463794647946579466794677946879469794707947179472794737947479475794767947779478794797948079481794827948379484794857948679487794887948979490794917949279493794947949579496794977949879499795007950179502795037950479505795067950779508795097951079511795127951379514795157951679517795187951979520795217952279523795247952579526795277952879529795307953179532795337953479535795367953779538795397954079541795427954379544795457954679547795487954979550795517955279553795547955579556795577955879559795607956179562795637956479565795667956779568795697957079571795727957379574795757957679577795787957979580795817958279583795847958579586795877958879589795907959179592795937959479595795967959779598795997960079601796027960379604796057960679607796087960979610796117961279613796147961579616796177961879619796207962179622796237962479625796267962779628796297963079631796327963379634796357963679637796387963979640796417964279643796447964579646796477964879649796507965179652796537965479655796567965779658796597966079661796627966379664796657966679667796687966979670796717967279673796747967579676796777967879679796807968179682796837968479685796867968779688796897969079691796927969379694796957969679697796987969979700797017970279703797047970579706797077970879709797107971179712797137971479715797167971779718797197972079721797227972379724797257972679727797287972979730797317973279733797347973579736797377973879739797407974179742797437974479745797467974779748797497975079751797527975379754797557975679757797587975979760797617976279763797647976579766797677976879769797707977179772797737977479775797767977779778797797978079781797827978379784797857978679787797887978979790797917979279793797947979579796797977979879799798007980179802798037980479805798067980779808798097981079811798127981379814798157981679817798187981979820798217982279823798247982579826798277982879829798307983179832798337983479835798367983779838798397984079841798427984379844798457984679847798487984979850798517985279853798547985579856798577985879859798607986179862798637986479865798667986779868798697987079871798727987379874798757987679877798787987979880798817988279883798847988579886798877988879889798907989179892798937989479895798967989779898798997990079901799027990379904799057990679907799087990979910799117991279913799147991579916799177991879919799207992179922799237992479925799267992779928799297993079931799327993379934799357993679937799387993979940799417994279943799447994579946799477994879949799507995179952799537995479955799567995779958799597996079961799627996379964799657996679967799687996979970799717997279973799747997579976799777997879979799807998179982799837998479985799867998779988799897999079991799927999379994799957999679997799987999980000800018000280003800048000580006800078000880009800108001180012800138001480015800168001780018800198002080021800228002380024800258002680027800288002980030800318003280033800348003580036800378003880039800408004180042800438004480045800468004780048800498005080051800528005380054800558005680057800588005980060800618006280063800648006580066800678006880069800708007180072800738007480075800768007780078800798008080081800828008380084800858008680087800888008980090800918009280093800948009580096800978009880099801008010180102801038010480105801068010780108801098011080111801128011380114801158011680117801188011980120801218012280123801248012580126801278012880129801308013180132801338013480135801368013780138801398014080141801428014380144801458014680147801488014980150801518015280153801548015580156801578015880159801608016180162801638016480165801668016780168801698017080171801728017380174801758017680177801788017980180801818018280183801848018580186801878018880189801908019180192801938019480195801968019780198801998020080201802028020380204802058020680207802088020980210802118021280213802148021580216802178021880219802208022180222802238022480225802268022780228802298023080231802328023380234802358023680237802388023980240802418024280243802448024580246802478024880249802508025180252802538025480255802568025780258802598026080261802628026380264802658026680267802688026980270802718027280273802748027580276802778027880279802808028180282802838028480285802868028780288802898029080291802928029380294802958029680297802988029980300803018030280303803048030580306803078030880309803108031180312803138031480315803168031780318803198032080321803228032380324803258032680327803288032980330803318033280333803348033580336803378033880339803408034180342803438034480345803468034780348803498035080351803528035380354803558035680357803588035980360803618036280363803648036580366803678036880369803708037180372803738037480375803768037780378803798038080381803828038380384803858038680387803888038980390803918039280393803948039580396803978039880399804008040180402804038040480405804068040780408804098041080411804128041380414804158041680417804188041980420804218042280423804248042580426804278042880429804308043180432804338043480435804368043780438804398044080441804428044380444804458044680447804488044980450804518045280453804548045580456804578045880459804608046180462804638046480465804668046780468804698047080471804728047380474804758047680477804788047980480804818048280483804848048580486804878048880489804908049180492804938049480495804968049780498804998050080501805028050380504805058050680507805088050980510805118051280513805148051580516805178051880519805208052180522805238052480525805268052780528805298053080531805328053380534805358053680537805388053980540805418054280543805448054580546805478054880549805508055180552805538055480555805568055780558805598056080561805628056380564805658056680567805688056980570805718057280573805748057580576805778057880579805808058180582805838058480585805868058780588805898059080591805928059380594805958059680597805988059980600806018060280603806048060580606806078060880609806108061180612806138061480615806168061780618806198062080621806228062380624806258062680627806288062980630806318063280633806348063580636806378063880639806408064180642806438064480645806468064780648806498065080651806528065380654806558065680657806588065980660806618066280663806648066580666806678066880669806708067180672806738067480675806768067780678806798068080681806828068380684806858068680687806888068980690806918069280693806948069580696806978069880699807008070180702807038070480705807068070780708807098071080711807128071380714807158071680717807188071980720807218072280723807248072580726807278072880729807308073180732807338073480735807368073780738807398074080741807428074380744807458074680747807488074980750807518075280753807548075580756807578075880759807608076180762807638076480765807668076780768807698077080771807728077380774807758077680777807788077980780807818078280783807848078580786807878078880789807908079180792807938079480795807968079780798807998080080801808028080380804808058080680807808088080980810808118081280813808148081580816808178081880819808208082180822808238082480825808268082780828808298083080831808328083380834808358083680837808388083980840808418084280843808448084580846808478084880849808508085180852808538085480855808568085780858808598086080861808628086380864808658086680867808688086980870808718087280873808748087580876808778087880879808808088180882808838088480885808868088780888808898089080891808928089380894808958089680897808988089980900809018090280903809048090580906809078090880909809108091180912809138091480915809168091780918809198092080921809228092380924809258092680927809288092980930809318093280933809348093580936809378093880939809408094180942809438094480945809468094780948809498095080951809528095380954809558095680957809588095980960809618096280963809648096580966809678096880969809708097180972809738097480975809768097780978809798098080981809828098380984809858098680987809888098980990809918099280993809948099580996809978099880999810008100181002810038100481005810068100781008810098101081011810128101381014810158101681017810188101981020810218102281023810248102581026810278102881029810308103181032810338103481035810368103781038810398104081041810428104381044810458104681047810488104981050810518105281053810548105581056810578105881059810608106181062810638106481065810668106781068810698107081071810728107381074810758107681077810788107981080810818108281083810848108581086810878108881089810908109181092810938109481095810968109781098810998110081101811028110381104811058110681107811088110981110811118111281113811148111581116811178111881119811208112181122811238112481125811268112781128811298113081131811328113381134811358113681137811388113981140811418114281143811448114581146811478114881149811508115181152811538115481155811568115781158811598116081161811628116381164811658116681167811688116981170811718117281173811748117581176811778117881179811808118181182811838118481185811868118781188811898119081191811928119381194811958119681197811988119981200812018120281203812048120581206812078120881209812108121181212812138121481215812168121781218812198122081221812228122381224812258122681227812288122981230812318123281233812348123581236812378123881239812408124181242812438124481245812468124781248812498125081251812528125381254812558125681257812588125981260812618126281263812648126581266812678126881269812708127181272812738127481275812768127781278812798128081281812828128381284812858128681287812888128981290812918129281293812948129581296812978129881299813008130181302813038130481305813068130781308813098131081311813128131381314813158131681317813188131981320813218132281323813248132581326813278132881329813308133181332813338133481335813368133781338813398134081341813428134381344813458134681347813488134981350813518135281353813548135581356813578135881359813608136181362813638136481365813668136781368813698137081371813728137381374813758137681377813788137981380813818138281383813848138581386813878138881389813908139181392813938139481395813968139781398813998140081401814028140381404814058140681407814088140981410814118141281413814148141581416814178141881419814208142181422814238142481425814268142781428814298143081431814328143381434814358143681437814388143981440814418144281443814448144581446814478144881449814508145181452814538145481455814568145781458814598146081461814628146381464814658146681467814688146981470814718147281473814748147581476814778147881479814808148181482814838148481485814868148781488814898149081491814928149381494814958149681497814988149981500815018150281503815048150581506815078150881509815108151181512815138151481515815168151781518815198152081521815228152381524815258152681527815288152981530815318153281533815348153581536815378153881539815408154181542815438154481545815468154781548815498155081551815528155381554815558155681557815588155981560815618156281563815648156581566815678156881569815708157181572815738157481575815768157781578815798158081581815828158381584815858158681587815888158981590815918159281593815948159581596815978159881599816008160181602816038160481605816068160781608816098161081611816128161381614816158161681617816188161981620816218162281623816248162581626816278162881629816308163181632816338163481635816368163781638816398164081641816428164381644816458164681647816488164981650816518165281653816548165581656816578165881659816608166181662816638166481665816668166781668816698167081671816728167381674816758167681677816788167981680816818168281683816848168581686816878168881689816908169181692816938169481695816968169781698816998170081701817028170381704817058170681707817088170981710817118171281713817148171581716817178171881719817208172181722817238172481725817268172781728817298173081731817328173381734817358173681737817388173981740817418174281743817448174581746817478174881749817508175181752817538175481755817568175781758817598176081761817628176381764817658176681767817688176981770817718177281773817748177581776817778177881779817808178181782817838178481785817868178781788817898179081791817928179381794817958179681797817988179981800818018180281803818048180581806818078180881809818108181181812818138181481815818168181781818818198182081821818228182381824818258182681827818288182981830818318183281833818348183581836818378183881839818408184181842818438184481845818468184781848818498185081851818528185381854818558185681857818588185981860818618186281863818648186581866818678186881869818708187181872818738187481875818768187781878818798188081881818828188381884818858188681887818888188981890818918189281893818948189581896818978189881899819008190181902819038190481905819068190781908819098191081911819128191381914819158191681917819188191981920819218192281923819248192581926819278192881929819308193181932819338193481935819368193781938819398194081941819428194381944819458194681947819488194981950819518195281953819548195581956819578195881959819608196181962819638196481965819668196781968819698197081971819728197381974819758197681977819788197981980819818198281983819848198581986819878198881989819908199181992819938199481995819968199781998819998200082001820028200382004820058200682007820088200982010820118201282013820148201582016820178201882019820208202182022820238202482025820268202782028820298203082031820328203382034820358203682037820388203982040820418204282043820448204582046820478204882049820508205182052820538205482055820568205782058820598206082061820628206382064820658206682067820688206982070820718207282073820748207582076820778207882079820808208182082820838208482085820868208782088820898209082091820928209382094820958209682097820988209982100821018210282103821048210582106821078210882109821108211182112821138211482115821168211782118821198212082121821228212382124821258212682127821288212982130821318213282133821348213582136821378213882139821408214182142821438214482145821468214782148821498215082151821528215382154821558215682157821588215982160821618216282163821648216582166821678216882169821708217182172821738217482175821768217782178821798218082181821828218382184821858218682187821888218982190821918219282193821948219582196821978219882199822008220182202822038220482205822068220782208822098221082211822128221382214822158221682217822188221982220822218222282223822248222582226822278222882229822308223182232822338223482235822368223782238822398224082241822428224382244822458224682247822488224982250822518225282253822548225582256822578225882259822608226182262822638226482265822668226782268822698227082271822728227382274822758227682277822788227982280822818228282283822848228582286822878228882289822908229182292822938229482295822968229782298822998230082301823028230382304823058230682307823088230982310823118231282313823148231582316823178231882319823208232182322823238232482325823268232782328823298233082331823328233382334823358233682337823388233982340823418234282343823448234582346823478234882349823508235182352823538235482355823568235782358823598236082361823628236382364823658236682367823688236982370823718237282373823748237582376823778237882379823808238182382823838238482385823868238782388823898239082391823928239382394823958239682397823988239982400824018240282403824048240582406824078240882409824108241182412824138241482415824168241782418824198242082421824228242382424824258242682427824288242982430824318243282433824348243582436824378243882439824408244182442824438244482445824468244782448824498245082451824528245382454824558245682457824588245982460824618246282463824648246582466824678246882469824708247182472824738247482475824768247782478824798248082481824828248382484824858248682487824888248982490824918249282493824948249582496824978249882499825008250182502825038250482505825068250782508825098251082511825128251382514825158251682517825188251982520825218252282523825248252582526825278252882529825308253182532825338253482535825368253782538825398254082541825428254382544825458254682547825488254982550825518255282553825548255582556825578255882559825608256182562825638256482565825668256782568825698257082571825728257382574825758257682577825788257982580825818258282583825848258582586825878258882589825908259182592825938259482595825968259782598825998260082601826028260382604826058260682607826088260982610826118261282613826148261582616826178261882619826208262182622826238262482625826268262782628826298263082631826328263382634826358263682637826388263982640826418264282643826448264582646826478264882649826508265182652826538265482655826568265782658826598266082661826628266382664826658266682667826688266982670826718267282673826748267582676826778267882679826808268182682826838268482685826868268782688826898269082691826928269382694826958269682697826988269982700827018270282703827048270582706827078270882709827108271182712827138271482715827168271782718827198272082721827228272382724827258272682727827288272982730827318273282733827348273582736827378273882739827408274182742827438274482745827468274782748827498275082751827528275382754827558275682757827588275982760827618276282763827648276582766827678276882769827708277182772827738277482775827768277782778827798278082781827828278382784827858278682787827888278982790827918279282793827948279582796827978279882799828008280182802828038280482805828068280782808828098281082811828128281382814828158281682817828188281982820828218282282823828248282582826828278282882829828308283182832828338283482835828368283782838828398284082841828428284382844828458284682847828488284982850828518285282853828548285582856828578285882859828608286182862828638286482865828668286782868828698287082871828728287382874828758287682877828788287982880828818288282883828848288582886828878288882889828908289182892828938289482895828968289782898828998290082901829028290382904829058290682907829088290982910829118291282913829148291582916829178291882919829208292182922829238292482925829268292782928829298293082931829328293382934829358293682937829388293982940829418294282943829448294582946829478294882949829508295182952829538295482955829568295782958829598296082961829628296382964829658296682967829688296982970829718297282973829748297582976829778297882979829808298182982829838298482985829868298782988829898299082991829928299382994829958299682997829988299983000830018300283003830048300583006830078300883009830108301183012830138301483015830168301783018830198302083021830228302383024830258302683027830288302983030830318303283033830348303583036830378303883039830408304183042830438304483045830468304783048830498305083051830528305383054830558305683057830588305983060830618306283063830648306583066830678306883069830708307183072830738307483075830768307783078830798308083081830828308383084830858308683087830888308983090830918309283093830948309583096830978309883099831008310183102831038310483105831068310783108831098311083111831128311383114831158311683117831188311983120831218312283123831248312583126831278312883129831308313183132831338313483135831368313783138831398314083141831428314383144831458314683147831488314983150831518315283153831548315583156831578315883159831608316183162831638316483165831668316783168831698317083171831728317383174831758317683177831788317983180831818318283183831848318583186831878318883189831908319183192831938319483195831968319783198831998320083201832028320383204832058320683207832088320983210832118321283213832148321583216832178321883219832208322183222832238322483225832268322783228832298323083231832328323383234832358323683237832388323983240832418324283243832448324583246832478324883249832508325183252832538325483255832568325783258832598326083261832628326383264832658326683267832688326983270832718327283273832748327583276832778327883279832808328183282832838328483285832868328783288832898329083291832928329383294832958329683297832988329983300833018330283303833048330583306833078330883309833108331183312833138331483315833168331783318833198332083321833228332383324833258332683327833288332983330833318333283333833348333583336833378333883339833408334183342833438334483345833468334783348833498335083351833528335383354833558335683357833588335983360833618336283363833648336583366833678336883369833708337183372833738337483375833768337783378833798338083381833828338383384833858338683387833888338983390833918339283393833948339583396833978339883399834008340183402834038340483405834068340783408834098341083411834128341383414834158341683417834188341983420834218342283423834248342583426834278342883429834308343183432834338343483435834368343783438834398344083441834428344383444834458344683447834488344983450834518345283453834548345583456834578345883459834608346183462834638346483465834668346783468834698347083471834728347383474834758347683477834788347983480834818348283483834848348583486834878348883489834908349183492834938349483495834968349783498834998350083501835028350383504835058350683507835088350983510835118351283513835148351583516835178351883519835208352183522835238352483525835268352783528835298353083531835328353383534835358353683537835388353983540835418354283543835448354583546835478354883549835508355183552835538355483555835568355783558835598356083561835628356383564835658356683567835688356983570835718357283573835748357583576835778357883579835808358183582835838358483585835868358783588835898359083591835928359383594835958359683597835988359983600836018360283603836048360583606836078360883609836108361183612836138361483615836168361783618836198362083621836228362383624836258362683627836288362983630836318363283633836348363583636836378363883639836408364183642836438364483645836468364783648836498365083651836528365383654836558365683657836588365983660836618366283663836648366583666836678366883669836708367183672836738367483675836768367783678836798368083681836828368383684836858368683687836888368983690836918369283693836948369583696836978369883699837008370183702837038370483705837068370783708837098371083711837128371383714837158371683717837188371983720837218372283723837248372583726837278372883729837308373183732837338373483735837368373783738837398374083741837428374383744837458374683747837488374983750837518375283753837548375583756837578375883759837608376183762837638376483765837668376783768837698377083771837728377383774837758377683777837788377983780837818378283783837848378583786837878378883789837908379183792837938379483795837968379783798837998380083801838028380383804838058380683807838088380983810838118381283813838148381583816838178381883819838208382183822838238382483825838268382783828838298383083831838328383383834838358383683837838388383983840838418384283843838448384583846838478384883849838508385183852838538385483855838568385783858838598386083861838628386383864838658386683867838688386983870838718387283873838748387583876838778387883879838808388183882838838388483885838868388783888838898389083891838928389383894838958389683897838988389983900839018390283903839048390583906839078390883909839108391183912839138391483915839168391783918839198392083921839228392383924839258392683927839288392983930839318393283933839348393583936839378393883939839408394183942839438394483945839468394783948839498395083951839528395383954839558395683957839588395983960839618396283963839648396583966839678396883969839708397183972839738397483975839768397783978839798398083981839828398383984839858398683987839888398983990839918399283993839948399583996839978399883999840008400184002840038400484005840068400784008840098401084011840128401384014840158401684017840188401984020840218402284023840248402584026840278402884029840308403184032840338403484035840368403784038840398404084041840428404384044840458404684047840488404984050840518405284053840548405584056840578405884059840608406184062840638406484065840668406784068840698407084071840728407384074840758407684077840788407984080840818408284083840848408584086840878408884089840908409184092840938409484095840968409784098840998410084101841028410384104841058410684107841088410984110841118411284113841148411584116841178411884119841208412184122841238412484125841268412784128841298413084131841328413384134841358413684137841388413984140841418414284143841448414584146841478414884149841508415184152841538415484155841568415784158841598416084161841628416384164841658416684167841688416984170841718417284173841748417584176841778417884179841808418184182841838418484185841868418784188841898419084191841928419384194841958419684197841988419984200842018420284203842048420584206842078420884209842108421184212842138421484215842168421784218842198422084221842228422384224842258422684227842288422984230842318423284233842348423584236842378423884239842408424184242842438424484245842468424784248842498425084251842528425384254842558425684257842588425984260842618426284263842648426584266842678426884269842708427184272842738427484275842768427784278842798428084281842828428384284842858428684287842888428984290842918429284293842948429584296842978429884299843008430184302843038430484305843068430784308843098431084311843128431384314843158431684317843188431984320843218432284323843248432584326843278432884329843308433184332843338433484335843368433784338843398434084341843428434384344843458434684347843488434984350843518435284353843548435584356843578435884359843608436184362843638436484365843668436784368843698437084371843728437384374843758437684377843788437984380843818438284383843848438584386843878438884389843908439184392843938439484395843968439784398843998440084401844028440384404844058440684407844088440984410844118441284413844148441584416844178441884419844208442184422844238442484425844268442784428844298443084431844328443384434844358443684437844388443984440844418444284443844448444584446844478444884449844508445184452844538445484455844568445784458844598446084461844628446384464844658446684467844688446984470844718447284473844748447584476844778447884479844808448184482844838448484485844868448784488844898449084491844928449384494844958449684497844988449984500845018450284503845048450584506845078450884509845108451184512845138451484515845168451784518845198452084521845228452384524845258452684527845288452984530845318453284533845348453584536845378453884539845408454184542845438454484545845468454784548845498455084551845528455384554845558455684557845588455984560845618456284563845648456584566845678456884569845708457184572845738457484575845768457784578845798458084581845828458384584845858458684587845888458984590845918459284593845948459584596845978459884599846008460184602846038460484605846068460784608846098461084611846128461384614846158461684617846188461984620846218462284623846248462584626846278462884629846308463184632846338463484635846368463784638846398464084641846428464384644846458464684647846488464984650846518465284653846548465584656846578465884659846608466184662846638466484665846668466784668846698467084671846728467384674846758467684677846788467984680846818468284683846848468584686846878468884689846908469184692846938469484695846968469784698846998470084701847028470384704847058470684707847088470984710847118471284713847148471584716847178471884719847208472184722847238472484725847268472784728847298473084731847328473384734847358473684737847388473984740847418474284743847448474584746847478474884749847508475184752847538475484755847568475784758847598476084761847628476384764847658476684767847688476984770847718477284773847748477584776847778477884779847808478184782847838478484785847868478784788847898479084791847928479384794847958479684797847988479984800848018480284803848048480584806848078480884809848108481184812848138481484815848168481784818848198482084821848228482384824848258482684827848288482984830848318483284833848348483584836848378483884839848408484184842848438484484845848468484784848848498485084851848528485384854848558485684857848588485984860848618486284863848648486584866848678486884869848708487184872848738487484875848768487784878848798488084881848828488384884848858488684887848888488984890848918489284893848948489584896848978489884899849008490184902849038490484905849068490784908849098491084911849128491384914849158491684917849188491984920849218492284923849248492584926849278492884929849308493184932849338493484935849368493784938849398494084941849428494384944849458494684947849488494984950849518495284953849548495584956849578495884959849608496184962849638496484965849668496784968849698497084971849728497384974849758497684977849788497984980849818498284983849848498584986849878498884989849908499184992849938499484995849968499784998849998500085001850028500385004850058500685007850088500985010850118501285013850148501585016850178501885019850208502185022850238502485025850268502785028850298503085031850328503385034850358503685037850388503985040850418504285043850448504585046850478504885049850508505185052850538505485055850568505785058850598506085061850628506385064850658506685067850688506985070850718507285073850748507585076850778507885079850808508185082850838508485085850868508785088850898509085091850928509385094850958509685097850988509985100851018510285103851048510585106851078510885109851108511185112851138511485115851168511785118851198512085121851228512385124851258512685127851288512985130851318513285133851348513585136851378513885139851408514185142851438514485145851468514785148851498515085151851528515385154851558515685157851588515985160851618516285163851648516585166851678516885169851708517185172851738517485175851768517785178851798518085181851828518385184851858518685187851888518985190851918519285193851948519585196851978519885199852008520185202852038520485205852068520785208852098521085211852128521385214852158521685217852188521985220852218522285223852248522585226852278522885229852308523185232852338523485235852368523785238852398524085241852428524385244852458524685247852488524985250852518525285253852548525585256852578525885259852608526185262852638526485265852668526785268852698527085271852728527385274852758527685277852788527985280852818528285283852848528585286852878528885289852908529185292852938529485295852968529785298852998530085301853028530385304853058530685307853088530985310853118531285313853148531585316853178531885319853208532185322853238532485325853268532785328853298533085331853328533385334853358533685337853388533985340853418534285343853448534585346853478534885349853508535185352853538535485355853568535785358853598536085361853628536385364853658536685367853688536985370853718537285373853748537585376853778537885379853808538185382853838538485385853868538785388853898539085391853928539385394853958539685397853988539985400854018540285403854048540585406854078540885409854108541185412854138541485415854168541785418854198542085421854228542385424854258542685427854288542985430854318543285433854348543585436854378543885439854408544185442854438544485445854468544785448854498545085451854528545385454854558545685457854588545985460854618546285463854648546585466854678546885469854708547185472854738547485475854768547785478854798548085481854828548385484854858548685487854888548985490854918549285493854948549585496854978549885499855008550185502855038550485505855068550785508855098551085511855128551385514855158551685517855188551985520855218552285523855248552585526855278552885529855308553185532855338553485535855368553785538855398554085541855428554385544855458554685547855488554985550855518555285553855548555585556855578555885559855608556185562855638556485565855668556785568855698557085571855728557385574855758557685577855788557985580855818558285583855848558585586855878558885589855908559185592855938559485595855968559785598855998560085601856028560385604856058560685607856088560985610856118561285613856148561585616856178561885619856208562185622856238562485625856268562785628856298563085631856328563385634856358563685637856388563985640856418564285643856448564585646856478564885649856508565185652856538565485655856568565785658856598566085661856628566385664856658566685667856688566985670856718567285673856748567585676856778567885679856808568185682856838568485685856868568785688856898569085691856928569385694856958569685697856988569985700857018570285703857048570585706857078570885709857108571185712857138571485715857168571785718857198572085721857228572385724857258572685727857288572985730857318573285733857348573585736857378573885739857408574185742857438574485745857468574785748857498575085751857528575385754857558575685757857588575985760857618576285763857648576585766857678576885769857708577185772857738577485775857768577785778857798578085781857828578385784857858578685787857888578985790857918579285793857948579585796857978579885799858008580185802858038580485805858068580785808858098581085811858128581385814858158581685817858188581985820858218582285823858248582585826858278582885829858308583185832858338583485835858368583785838858398584085841858428584385844858458584685847858488584985850858518585285853858548585585856858578585885859858608586185862858638586485865858668586785868858698587085871858728587385874858758587685877858788587985880858818588285883858848588585886858878588885889858908589185892858938589485895858968589785898858998590085901859028590385904859058590685907859088590985910859118591285913859148591585916859178591885919859208592185922859238592485925859268592785928859298593085931859328593385934859358593685937859388593985940859418594285943859448594585946859478594885949859508595185952859538595485955859568595785958859598596085961859628596385964859658596685967859688596985970859718597285973859748597585976859778597885979859808598185982859838598485985859868598785988859898599085991859928599385994859958599685997859988599986000860018600286003860048600586006860078600886009860108601186012860138601486015860168601786018860198602086021860228602386024860258602686027860288602986030860318603286033860348603586036860378603886039860408604186042860438604486045860468604786048860498605086051860528605386054860558605686057860588605986060860618606286063860648606586066860678606886069860708607186072860738607486075860768607786078860798608086081860828608386084860858608686087860888608986090860918609286093860948609586096860978609886099861008610186102861038610486105861068610786108861098611086111861128611386114861158611686117861188611986120861218612286123861248612586126861278612886129861308613186132861338613486135861368613786138861398614086141861428614386144861458614686147861488614986150861518615286153861548615586156861578615886159861608616186162861638616486165861668616786168861698617086171861728617386174861758617686177861788617986180861818618286183861848618586186861878618886189861908619186192861938619486195861968619786198861998620086201862028620386204862058620686207862088620986210862118621286213862148621586216862178621886219862208622186222862238622486225862268622786228862298623086231862328623386234862358623686237862388623986240862418624286243862448624586246862478624886249862508625186252862538625486255862568625786258862598626086261862628626386264862658626686267862688626986270862718627286273862748627586276862778627886279862808628186282862838628486285862868628786288862898629086291862928629386294862958629686297862988629986300863018630286303863048630586306863078630886309863108631186312863138631486315863168631786318863198632086321863228632386324863258632686327863288632986330863318633286333863348633586336863378633886339863408634186342863438634486345863468634786348863498635086351863528635386354863558635686357863588635986360863618636286363863648636586366863678636886369863708637186372863738637486375863768637786378863798638086381863828638386384863858638686387863888638986390863918639286393863948639586396863978639886399864008640186402864038640486405864068640786408864098641086411864128641386414864158641686417864188641986420864218642286423864248642586426864278642886429864308643186432864338643486435864368643786438864398644086441864428644386444864458644686447864488644986450864518645286453864548645586456864578645886459864608646186462864638646486465864668646786468864698647086471864728647386474864758647686477864788647986480864818648286483864848648586486864878648886489864908649186492864938649486495864968649786498864998650086501865028650386504865058650686507865088650986510865118651286513865148651586516865178651886519865208652186522865238652486525865268652786528865298653086531865328653386534865358653686537865388653986540865418654286543865448654586546865478654886549865508655186552865538655486555865568655786558865598656086561865628656386564865658656686567865688656986570865718657286573865748657586576865778657886579865808658186582865838658486585865868658786588865898659086591865928659386594865958659686597865988659986600866018660286603866048660586606866078660886609866108661186612866138661486615866168661786618866198662086621866228662386624866258662686627866288662986630866318663286633866348663586636866378663886639866408664186642866438664486645866468664786648866498665086651866528665386654866558665686657866588665986660866618666286663866648666586666866678666886669866708667186672866738667486675866768667786678866798668086681866828668386684866858668686687866888668986690866918669286693866948669586696866978669886699867008670186702867038670486705867068670786708867098671086711867128671386714867158671686717867188671986720867218672286723867248672586726867278672886729867308673186732867338673486735867368673786738867398674086741867428674386744867458674686747867488674986750867518675286753867548675586756867578675886759867608676186762867638676486765867668676786768867698677086771867728677386774867758677686777867788677986780867818678286783867848678586786867878678886789867908679186792867938679486795867968679786798867998680086801868028680386804868058680686807868088680986810868118681286813868148681586816868178681886819868208682186822868238682486825868268682786828868298683086831868328683386834868358683686837868388683986840868418684286843868448684586846868478684886849868508685186852868538685486855868568685786858868598686086861868628686386864868658686686867868688686986870868718687286873868748687586876868778687886879868808688186882868838688486885868868688786888868898689086891868928689386894868958689686897868988689986900869018690286903869048690586906869078690886909869108691186912869138691486915869168691786918869198692086921869228692386924869258692686927869288692986930869318693286933869348693586936869378693886939869408694186942869438694486945869468694786948869498695086951869528695386954869558695686957869588695986960869618696286963869648696586966869678696886969869708697186972869738697486975869768697786978869798698086981869828698386984869858698686987869888698986990869918699286993869948699586996869978699886999870008700187002870038700487005870068700787008870098701087011870128701387014870158701687017870188701987020870218702287023870248702587026870278702887029870308703187032870338703487035870368703787038870398704087041870428704387044870458704687047870488704987050870518705287053870548705587056870578705887059870608706187062870638706487065870668706787068870698707087071870728707387074870758707687077870788707987080870818708287083870848708587086870878708887089870908709187092870938709487095870968709787098870998710087101871028710387104871058710687107871088710987110871118711287113871148711587116871178711887119871208712187122871238712487125871268712787128871298713087131871328713387134871358713687137871388713987140871418714287143871448714587146871478714887149871508715187152871538715487155871568715787158871598716087161871628716387164871658716687167871688716987170871718717287173871748717587176871778717887179871808718187182871838718487185871868718787188871898719087191871928719387194871958719687197871988719987200872018720287203872048720587206872078720887209872108721187212872138721487215872168721787218872198722087221872228722387224872258722687227872288722987230872318723287233872348723587236872378723887239872408724187242872438724487245872468724787248872498725087251872528725387254872558725687257872588725987260872618726287263872648726587266872678726887269872708727187272872738727487275872768727787278872798728087281872828728387284872858728687287872888728987290872918729287293872948729587296872978729887299873008730187302873038730487305873068730787308873098731087311873128731387314873158731687317873188731987320873218732287323873248732587326873278732887329873308733187332873338733487335873368733787338873398734087341873428734387344873458734687347873488734987350873518735287353873548735587356873578735887359873608736187362873638736487365873668736787368873698737087371873728737387374873758737687377873788737987380873818738287383873848738587386873878738887389873908739187392873938739487395873968739787398873998740087401874028740387404874058740687407874088740987410874118741287413874148741587416874178741887419874208742187422874238742487425874268742787428874298743087431874328743387434874358743687437874388743987440874418744287443874448744587446874478744887449874508745187452874538745487455874568745787458874598746087461874628746387464874658746687467874688746987470874718747287473874748747587476874778747887479874808748187482874838748487485874868748787488874898749087491874928749387494874958749687497874988749987500875018750287503875048750587506875078750887509875108751187512875138751487515875168751787518875198752087521875228752387524875258752687527875288752987530875318753287533875348753587536875378753887539875408754187542875438754487545875468754787548875498755087551875528755387554875558755687557875588755987560875618756287563875648756587566875678756887569875708757187572875738757487575875768757787578875798758087581875828758387584875858758687587875888758987590875918759287593875948759587596875978759887599876008760187602876038760487605876068760787608876098761087611876128761387614876158761687617876188761987620876218762287623876248762587626876278762887629876308763187632876338763487635876368763787638876398764087641876428764387644876458764687647876488764987650876518765287653876548765587656876578765887659876608766187662876638766487665876668766787668876698767087671876728767387674876758767687677876788767987680876818768287683876848768587686876878768887689876908769187692876938769487695876968769787698876998770087701877028770387704877058770687707877088770987710877118771287713877148771587716877178771887719877208772187722877238772487725877268772787728877298773087731877328773387734877358773687737877388773987740877418774287743877448774587746877478774887749877508775187752877538775487755877568775787758877598776087761877628776387764877658776687767877688776987770877718777287773877748777587776877778777887779877808778187782877838778487785877868778787788877898779087791877928779387794877958779687797877988779987800878018780287803878048780587806878078780887809878108781187812878138781487815878168781787818878198782087821878228782387824878258782687827878288782987830878318783287833878348783587836878378783887839878408784187842878438784487845878468784787848878498785087851878528785387854878558785687857878588785987860878618786287863878648786587866878678786887869878708787187872878738787487875878768787787878878798788087881878828788387884878858788687887878888788987890878918789287893878948789587896878978789887899879008790187902879038790487905879068790787908879098791087911879128791387914879158791687917879188791987920879218792287923879248792587926879278792887929879308793187932879338793487935879368793787938879398794087941879428794387944879458794687947879488794987950879518795287953879548795587956879578795887959879608796187962879638796487965879668796787968879698797087971879728797387974879758797687977879788797987980879818798287983879848798587986879878798887989879908799187992879938799487995879968799787998879998800088001880028800388004880058800688007880088800988010880118801288013880148801588016880178801888019880208802188022880238802488025880268802788028880298803088031880328803388034880358803688037880388803988040880418804288043880448804588046880478804888049880508805188052880538805488055880568805788058880598806088061880628806388064880658806688067880688806988070880718807288073880748807588076880778807888079880808808188082880838808488085880868808788088880898809088091880928809388094880958809688097880988809988100881018810288103881048810588106881078810888109881108811188112881138811488115881168811788118881198812088121881228812388124881258812688127881288812988130881318813288133881348813588136881378813888139881408814188142881438814488145881468814788148881498815088151881528815388154881558815688157881588815988160881618816288163881648816588166881678816888169881708817188172881738817488175881768817788178881798818088181881828818388184881858818688187881888818988190881918819288193881948819588196881978819888199882008820188202882038820488205882068820788208882098821088211882128821388214882158821688217882188821988220882218822288223882248822588226882278822888229882308823188232882338823488235882368823788238882398824088241882428824388244882458824688247882488824988250882518825288253882548825588256882578825888259882608826188262882638826488265882668826788268882698827088271882728827388274882758827688277882788827988280882818828288283882848828588286882878828888289882908829188292882938829488295882968829788298882998830088301883028830388304883058830688307883088830988310883118831288313883148831588316883178831888319883208832188322883238832488325883268832788328883298833088331883328833388334883358833688337883388833988340883418834288343883448834588346883478834888349883508835188352883538835488355883568835788358883598836088361883628836388364883658836688367883688836988370883718837288373883748837588376883778837888379883808838188382883838838488385883868838788388883898839088391883928839388394883958839688397883988839988400884018840288403884048840588406884078840888409884108841188412884138841488415884168841788418884198842088421884228842388424884258842688427884288842988430884318843288433884348843588436884378843888439884408844188442884438844488445884468844788448884498845088451884528845388454884558845688457884588845988460884618846288463884648846588466884678846888469884708847188472884738847488475884768847788478884798848088481884828848388484884858848688487884888848988490884918849288493884948849588496884978849888499885008850188502885038850488505885068850788508885098851088511885128851388514885158851688517885188851988520885218852288523885248852588526885278852888529885308853188532885338853488535885368853788538885398854088541885428854388544885458854688547885488854988550885518855288553885548855588556885578855888559885608856188562885638856488565885668856788568885698857088571885728857388574885758857688577885788857988580885818858288583885848858588586885878858888589885908859188592885938859488595885968859788598885998860088601886028860388604886058860688607886088860988610886118861288613886148861588616886178861888619886208862188622886238862488625886268862788628886298863088631886328863388634886358863688637886388863988640886418864288643886448864588646886478864888649886508865188652886538865488655886568865788658886598866088661886628866388664886658866688667886688866988670886718867288673886748867588676886778867888679886808868188682886838868488685886868868788688886898869088691886928869388694886958869688697886988869988700887018870288703887048870588706887078870888709887108871188712887138871488715887168871788718887198872088721887228872388724887258872688727887288872988730887318873288733887348873588736887378873888739887408874188742887438874488745887468874788748887498875088751887528875388754887558875688757887588875988760887618876288763887648876588766887678876888769887708877188772887738877488775887768877788778887798878088781887828878388784887858878688787887888878988790887918879288793887948879588796887978879888799888008880188802888038880488805888068880788808888098881088811888128881388814888158881688817888188881988820888218882288823888248882588826888278882888829888308883188832888338883488835888368883788838888398884088841888428884388844888458884688847888488884988850888518885288853888548885588856888578885888859888608886188862888638886488865888668886788868888698887088871888728887388874888758887688877888788887988880888818888288883888848888588886888878888888889888908889188892888938889488895888968889788898888998890088901889028890388904889058890688907889088890988910889118891288913889148891588916889178891888919889208892188922889238892488925889268892788928889298893088931889328893388934889358893688937889388893988940889418894288943889448894588946889478894888949889508895188952889538895488955889568895788958889598896088961889628896388964889658896688967889688896988970889718897288973889748897588976889778897888979889808898188982889838898488985889868898788988889898899088991889928899388994889958899688997889988899989000890018900289003890048900589006890078900889009890108901189012890138901489015890168901789018890198902089021890228902389024890258902689027890288902989030890318903289033890348903589036890378903889039890408904189042890438904489045890468904789048890498905089051890528905389054890558905689057890588905989060890618906289063890648906589066890678906889069890708907189072890738907489075890768907789078890798908089081890828908389084890858908689087890888908989090890918909289093890948909589096890978909889099891008910189102891038910489105891068910789108891098911089111891128911389114891158911689117891188911989120891218912289123891248912589126891278912889129891308913189132891338913489135891368913789138891398914089141891428914389144891458914689147891488914989150891518915289153891548915589156891578915889159891608916189162891638916489165891668916789168891698917089171891728917389174891758917689177891788917989180891818918289183891848918589186891878918889189891908919189192891938919489195891968919789198891998920089201892028920389204892058920689207892088920989210892118921289213892148921589216892178921889219892208922189222892238922489225892268922789228892298923089231892328923389234892358923689237892388923989240892418924289243892448924589246892478924889249892508925189252892538925489255892568925789258892598926089261892628926389264892658926689267892688926989270892718927289273892748927589276892778927889279892808928189282892838928489285892868928789288892898929089291892928929389294892958929689297892988929989300893018930289303893048930589306893078930889309893108931189312893138931489315893168931789318893198932089321893228932389324893258932689327893288932989330893318933289333893348933589336893378933889339893408934189342893438934489345893468934789348893498935089351893528935389354893558935689357893588935989360893618936289363893648936589366893678936889369893708937189372893738937489375893768937789378893798938089381893828938389384893858938689387893888938989390893918939289393893948939589396893978939889399894008940189402894038940489405894068940789408894098941089411894128941389414894158941689417894188941989420894218942289423894248942589426894278942889429894308943189432894338943489435894368943789438894398944089441894428944389444894458944689447894488944989450894518945289453894548945589456894578945889459894608946189462894638946489465894668946789468894698947089471894728947389474894758947689477894788947989480894818948289483894848948589486894878948889489894908949189492894938949489495894968949789498894998950089501895028950389504895058950689507895088950989510895118951289513895148951589516895178951889519895208952189522895238952489525895268952789528895298953089531895328953389534895358953689537895388953989540895418954289543895448954589546895478954889549895508955189552895538955489555895568955789558895598956089561895628956389564895658956689567895688956989570895718957289573895748957589576895778957889579895808958189582895838958489585895868958789588895898959089591895928959389594895958959689597895988959989600896018960289603896048960589606896078960889609896108961189612896138961489615896168961789618896198962089621896228962389624896258962689627896288962989630896318963289633896348963589636896378963889639896408964189642896438964489645896468964789648896498965089651896528965389654896558965689657896588965989660896618966289663896648966589666896678966889669896708967189672896738967489675896768967789678896798968089681896828968389684896858968689687896888968989690896918969289693896948969589696896978969889699897008970189702897038970489705897068970789708897098971089711897128971389714897158971689717897188971989720897218972289723897248972589726897278972889729897308973189732897338973489735897368973789738897398974089741897428974389744897458974689747897488974989750897518975289753897548975589756897578975889759897608976189762897638976489765897668976789768897698977089771897728977389774897758977689777897788977989780897818978289783897848978589786897878978889789897908979189792897938979489795897968979789798897998980089801898028980389804898058980689807898088980989810898118981289813898148981589816898178981889819898208982189822898238982489825898268982789828898298983089831898328983389834898358983689837898388983989840898418984289843898448984589846898478984889849898508985189852898538985489855898568985789858898598986089861898628986389864898658986689867898688986989870898718987289873898748987589876898778987889879898808988189882898838988489885898868988789888898898989089891898928989389894898958989689897898988989989900899018990289903899048990589906899078990889909899108991189912899138991489915899168991789918899198992089921899228992389924899258992689927899288992989930899318993289933899348993589936899378993889939899408994189942899438994489945899468994789948899498995089951899528995389954899558995689957899588995989960899618996289963899648996589966899678996889969899708997189972899738997489975899768997789978899798998089981899828998389984899858998689987899888998989990899918999289993899948999589996899978999889999900009000190002900039000490005900069000790008900099001090011900129001390014900159001690017900189001990020900219002290023900249002590026900279002890029900309003190032900339003490035900369003790038900399004090041900429004390044900459004690047900489004990050900519005290053900549005590056900579005890059900609006190062900639006490065900669006790068900699007090071900729007390074900759007690077900789007990080900819008290083900849008590086900879008890089900909009190092900939009490095900969009790098900999010090101901029010390104901059010690107901089010990110901119011290113901149011590116901179011890119901209012190122901239012490125901269012790128901299013090131901329013390134901359013690137901389013990140901419014290143901449014590146901479014890149901509015190152901539015490155901569015790158901599016090161901629016390164901659016690167901689016990170901719017290173901749017590176901779017890179901809018190182901839018490185901869018790188901899019090191901929019390194901959019690197901989019990200902019020290203902049020590206902079020890209902109021190212902139021490215902169021790218902199022090221902229022390224902259022690227902289022990230902319023290233902349023590236902379023890239902409024190242902439024490245902469024790248902499025090251902529025390254902559025690257902589025990260902619026290263902649026590266902679026890269902709027190272902739027490275902769027790278902799028090281902829028390284902859028690287902889028990290902919029290293902949029590296902979029890299903009030190302903039030490305903069030790308903099031090311903129031390314903159031690317903189031990320903219032290323903249032590326903279032890329903309033190332903339033490335903369033790338903399034090341903429034390344903459034690347903489034990350903519035290353903549035590356903579035890359903609036190362903639036490365903669036790368903699037090371903729037390374903759037690377903789037990380903819038290383903849038590386903879038890389903909039190392903939039490395903969039790398903999040090401904029040390404904059040690407904089040990410904119041290413904149041590416904179041890419904209042190422904239042490425904269042790428904299043090431904329043390434904359043690437904389043990440904419044290443904449044590446904479044890449904509045190452904539045490455904569045790458904599046090461904629046390464904659046690467904689046990470904719047290473904749047590476904779047890479904809048190482904839048490485904869048790488904899049090491904929049390494904959049690497904989049990500905019050290503905049050590506905079050890509905109051190512905139051490515905169051790518905199052090521905229052390524905259052690527905289052990530905319053290533905349053590536905379053890539905409054190542905439054490545905469054790548905499055090551905529055390554905559055690557905589055990560905619056290563905649056590566905679056890569905709057190572905739057490575905769057790578905799058090581905829058390584905859058690587905889058990590905919059290593905949059590596905979059890599906009060190602906039060490605906069060790608906099061090611906129061390614906159061690617906189061990620906219062290623906249062590626906279062890629906309063190632906339063490635906369063790638906399064090641906429064390644906459064690647906489064990650906519065290653906549065590656906579065890659906609066190662906639066490665906669066790668906699067090671906729067390674906759067690677906789067990680906819068290683906849068590686906879068890689906909069190692906939069490695906969069790698906999070090701907029070390704907059070690707907089070990710907119071290713907149071590716907179071890719907209072190722907239072490725907269072790728907299073090731907329073390734907359073690737907389073990740907419074290743907449074590746907479074890749907509075190752907539075490755907569075790758907599076090761907629076390764907659076690767907689076990770907719077290773907749077590776907779077890779907809078190782907839078490785907869078790788907899079090791907929079390794907959079690797907989079990800908019080290803908049080590806908079080890809908109081190812908139081490815908169081790818908199082090821908229082390824908259082690827908289082990830908319083290833908349083590836908379083890839908409084190842908439084490845908469084790848908499085090851908529085390854908559085690857908589085990860908619086290863908649086590866908679086890869908709087190872908739087490875908769087790878908799088090881908829088390884908859088690887908889088990890908919089290893908949089590896908979089890899909009090190902909039090490905909069090790908909099091090911909129091390914909159091690917909189091990920909219092290923909249092590926909279092890929909309093190932909339093490935909369093790938909399094090941909429094390944909459094690947909489094990950909519095290953909549095590956909579095890959909609096190962909639096490965909669096790968909699097090971909729097390974909759097690977909789097990980909819098290983909849098590986909879098890989909909099190992909939099490995909969099790998909999100091001910029100391004910059100691007910089100991010910119101291013910149101591016910179101891019910209102191022910239102491025910269102791028910299103091031910329103391034910359103691037910389103991040910419104291043910449104591046910479104891049910509105191052910539105491055910569105791058910599106091061910629106391064910659106691067910689106991070910719107291073910749107591076910779107891079910809108191082910839108491085910869108791088910899109091091910929109391094910959109691097910989109991100911019110291103911049110591106911079110891109911109111191112911139111491115911169111791118911199112091121911229112391124911259112691127911289112991130911319113291133911349113591136911379113891139911409114191142911439114491145911469114791148911499115091151911529115391154911559115691157911589115991160911619116291163911649116591166911679116891169911709117191172911739117491175911769117791178911799118091181911829118391184911859118691187911889118991190911919119291193911949119591196911979119891199912009120191202912039120491205912069120791208912099121091211912129121391214912159121691217912189121991220912219122291223912249122591226912279122891229912309123191232912339123491235912369123791238912399124091241912429124391244912459124691247912489124991250912519125291253912549125591256912579125891259912609126191262912639126491265912669126791268912699127091271912729127391274912759127691277912789127991280912819128291283912849128591286912879128891289912909129191292912939129491295912969129791298912999130091301913029130391304913059130691307913089130991310913119131291313913149131591316913179131891319913209132191322913239132491325913269132791328913299133091331913329133391334913359133691337913389133991340913419134291343913449134591346913479134891349913509135191352913539135491355913569135791358913599136091361913629136391364913659136691367913689136991370913719137291373913749137591376913779137891379913809138191382913839138491385913869138791388913899139091391913929139391394913959139691397913989139991400914019140291403914049140591406914079140891409914109141191412914139141491415914169141791418914199142091421914229142391424914259142691427914289142991430914319143291433914349143591436914379143891439914409144191442914439144491445914469144791448914499145091451914529145391454914559145691457914589145991460914619146291463914649146591466914679146891469914709147191472914739147491475914769147791478914799148091481914829148391484914859148691487914889148991490914919149291493914949149591496914979149891499915009150191502915039150491505915069150791508915099151091511915129151391514915159151691517915189151991520915219152291523915249152591526915279152891529915309153191532915339153491535915369153791538915399154091541915429154391544915459154691547915489154991550915519155291553915549155591556915579155891559915609156191562915639156491565915669156791568915699157091571915729157391574915759157691577915789157991580915819158291583915849158591586915879158891589915909159191592915939159491595915969159791598915999160091601916029160391604916059160691607916089160991610916119161291613916149161591616916179161891619916209162191622916239162491625916269162791628916299163091631916329163391634916359163691637916389163991640916419164291643916449164591646916479164891649916509165191652916539165491655916569165791658916599166091661916629166391664916659166691667916689166991670916719167291673916749167591676916779167891679916809168191682916839168491685916869168791688916899169091691916929169391694916959169691697916989169991700917019170291703917049170591706917079170891709917109171191712917139171491715917169171791718917199172091721917229172391724917259172691727917289172991730917319173291733917349173591736917379173891739917409174191742917439174491745917469174791748917499175091751917529175391754917559175691757917589175991760917619176291763917649176591766917679176891769917709177191772917739177491775917769177791778917799178091781917829178391784917859178691787917889178991790917919179291793917949179591796917979179891799918009180191802918039180491805918069180791808918099181091811918129181391814918159181691817918189181991820918219182291823918249182591826918279182891829918309183191832918339183491835918369183791838918399184091841918429184391844918459184691847918489184991850918519185291853918549185591856918579185891859918609186191862918639186491865918669186791868918699187091871918729187391874918759187691877918789187991880918819188291883918849188591886918879188891889918909189191892918939189491895918969189791898918999190091901919029190391904919059190691907919089190991910919119191291913919149191591916919179191891919919209192191922919239192491925919269192791928919299193091931919329193391934919359193691937919389193991940919419194291943919449194591946919479194891949919509195191952919539195491955919569195791958919599196091961919629196391964919659196691967919689196991970919719197291973919749197591976919779197891979919809198191982919839198491985919869198791988919899199091991919929199391994919959199691997919989199992000920019200292003920049200592006920079200892009920109201192012920139201492015920169201792018920199202092021920229202392024920259202692027920289202992030920319203292033920349203592036920379203892039920409204192042920439204492045920469204792048920499205092051920529205392054920559205692057920589205992060920619206292063920649206592066920679206892069920709207192072920739207492075920769207792078920799208092081920829208392084920859208692087920889208992090920919209292093920949209592096920979209892099921009210192102921039210492105921069210792108921099211092111921129211392114921159211692117921189211992120921219212292123921249212592126921279212892129921309213192132921339213492135921369213792138921399214092141921429214392144921459214692147921489214992150921519215292153921549215592156921579215892159921609216192162921639216492165921669216792168921699217092171921729217392174921759217692177921789217992180921819218292183921849218592186921879218892189921909219192192921939219492195921969219792198921999220092201922029220392204922059220692207922089220992210922119221292213922149221592216922179221892219922209222192222922239222492225922269222792228922299223092231922329223392234922359223692237922389223992240922419224292243922449224592246922479224892249922509225192252922539225492255922569225792258922599226092261922629226392264922659226692267922689226992270922719227292273922749227592276922779227892279922809228192282922839228492285922869228792288922899229092291922929229392294922959229692297922989229992300923019230292303923049230592306923079230892309923109231192312923139231492315923169231792318923199232092321923229232392324923259232692327923289232992330923319233292333923349233592336923379233892339923409234192342923439234492345923469234792348923499235092351923529235392354923559235692357923589235992360923619236292363923649236592366923679236892369923709237192372923739237492375923769237792378923799238092381923829238392384923859238692387923889238992390923919239292393923949239592396923979239892399924009240192402924039240492405924069240792408924099241092411924129241392414924159241692417924189241992420924219242292423924249242592426924279242892429924309243192432924339243492435924369243792438924399244092441924429244392444924459244692447924489244992450924519245292453924549245592456924579245892459924609246192462924639246492465924669246792468924699247092471924729247392474924759247692477924789247992480924819248292483924849248592486924879248892489924909249192492924939249492495924969249792498924999250092501925029250392504925059250692507925089250992510925119251292513925149251592516925179251892519925209252192522925239252492525925269252792528925299253092531925329253392534925359253692537925389253992540925419254292543925449254592546925479254892549925509255192552925539255492555925569255792558925599256092561925629256392564925659256692567925689256992570925719257292573925749257592576925779257892579925809258192582925839258492585925869258792588925899259092591925929259392594925959259692597925989259992600926019260292603926049260592606926079260892609926109261192612926139261492615926169261792618926199262092621926229262392624926259262692627926289262992630926319263292633926349263592636926379263892639926409264192642926439264492645926469264792648926499265092651926529265392654926559265692657926589265992660926619266292663926649266592666926679266892669926709267192672926739267492675926769267792678926799268092681926829268392684926859268692687926889268992690926919269292693926949269592696926979269892699927009270192702927039270492705927069270792708927099271092711927129271392714927159271692717927189271992720927219272292723927249272592726927279272892729927309273192732927339273492735927369273792738927399274092741927429274392744927459274692747927489274992750927519275292753927549275592756927579275892759927609276192762927639276492765927669276792768927699277092771927729277392774927759277692777927789277992780927819278292783927849278592786927879278892789927909279192792927939279492795927969279792798927999280092801928029280392804928059280692807928089280992810928119281292813928149281592816928179281892819928209282192822928239282492825928269282792828928299283092831928329283392834928359283692837928389283992840928419284292843928449284592846928479284892849928509285192852928539285492855928569285792858928599286092861928629286392864928659286692867928689286992870928719287292873928749287592876928779287892879928809288192882928839288492885928869288792888928899289092891928929289392894928959289692897928989289992900929019290292903929049290592906929079290892909929109291192912929139291492915929169291792918929199292092921929229292392924929259292692927929289292992930929319293292933929349293592936929379293892939929409294192942929439294492945929469294792948929499295092951929529295392954929559295692957929589295992960929619296292963929649296592966929679296892969929709297192972929739297492975929769297792978929799298092981929829298392984929859298692987929889298992990929919299292993929949299592996929979299892999930009300193002930039300493005930069300793008930099301093011930129301393014930159301693017930189301993020930219302293023930249302593026930279302893029930309303193032930339303493035930369303793038930399304093041930429304393044930459304693047930489304993050930519305293053930549305593056930579305893059930609306193062930639306493065930669306793068930699307093071930729307393074930759307693077930789307993080930819308293083930849308593086930879308893089930909309193092930939309493095930969309793098930999310093101931029310393104931059310693107931089310993110931119311293113931149311593116931179311893119931209312193122931239312493125931269312793128931299313093131931329313393134931359313693137931389313993140931419314293143931449314593146931479314893149931509315193152931539315493155931569315793158931599316093161931629316393164931659316693167931689316993170931719317293173931749317593176931779317893179931809318193182931839318493185931869318793188931899319093191931929319393194931959319693197931989319993200932019320293203932049320593206932079320893209932109321193212932139321493215932169321793218932199322093221932229322393224932259322693227932289322993230932319323293233932349323593236932379323893239932409324193242932439324493245932469324793248932499325093251932529325393254932559325693257932589325993260932619326293263932649326593266932679326893269932709327193272932739327493275932769327793278932799328093281932829328393284932859328693287932889328993290932919329293293932949329593296932979329893299933009330193302933039330493305933069330793308933099331093311933129331393314933159331693317933189331993320933219332293323933249332593326933279332893329933309333193332933339333493335933369333793338933399334093341933429334393344933459334693347933489334993350933519335293353933549335593356933579335893359933609336193362933639336493365933669336793368933699337093371933729337393374933759337693377933789337993380933819338293383933849338593386933879338893389933909339193392933939339493395933969339793398933999340093401934029340393404934059340693407934089340993410934119341293413934149341593416934179341893419934209342193422934239342493425934269342793428934299343093431934329343393434934359343693437934389343993440934419344293443934449344593446934479344893449934509345193452934539345493455934569345793458934599346093461934629346393464934659346693467934689346993470934719347293473934749347593476934779347893479934809348193482934839348493485934869348793488934899349093491934929349393494934959349693497934989349993500935019350293503935049350593506935079350893509935109351193512935139351493515935169351793518935199352093521935229352393524935259352693527935289352993530935319353293533935349353593536935379353893539935409354193542935439354493545935469354793548935499355093551935529355393554935559355693557935589355993560935619356293563935649356593566935679356893569935709357193572935739357493575935769357793578935799358093581935829358393584935859358693587935889358993590935919359293593935949359593596935979359893599936009360193602936039360493605936069360793608936099361093611936129361393614936159361693617936189361993620936219362293623936249362593626936279362893629936309363193632936339363493635936369363793638936399364093641936429364393644936459364693647936489364993650936519365293653936549365593656936579365893659936609366193662936639366493665936669366793668936699367093671936729367393674936759367693677936789367993680936819368293683936849368593686936879368893689936909369193692936939369493695936969369793698936999370093701937029370393704937059370693707937089370993710937119371293713937149371593716937179371893719937209372193722937239372493725937269372793728937299373093731937329373393734937359373693737937389373993740937419374293743937449374593746937479374893749937509375193752937539375493755937569375793758937599376093761937629376393764937659376693767937689376993770937719377293773937749377593776937779377893779937809378193782937839378493785937869378793788937899379093791937929379393794937959379693797937989379993800938019380293803938049380593806938079380893809938109381193812938139381493815938169381793818938199382093821938229382393824938259382693827938289382993830938319383293833938349383593836938379383893839938409384193842938439384493845938469384793848938499385093851938529385393854938559385693857938589385993860938619386293863938649386593866938679386893869938709387193872938739387493875938769387793878938799388093881938829388393884938859388693887938889388993890938919389293893938949389593896938979389893899939009390193902939039390493905939069390793908939099391093911939129391393914939159391693917939189391993920939219392293923939249392593926939279392893929939309393193932939339393493935939369393793938939399394093941939429394393944939459394693947939489394993950939519395293953939549395593956939579395893959939609396193962939639396493965939669396793968939699397093971939729397393974939759397693977939789397993980939819398293983939849398593986939879398893989939909399193992939939399493995939969399793998939999400094001940029400394004940059400694007940089400994010940119401294013940149401594016940179401894019940209402194022940239402494025940269402794028940299403094031940329403394034940359403694037940389403994040940419404294043940449404594046940479404894049940509405194052940539405494055940569405794058940599406094061940629406394064940659406694067940689406994070940719407294073940749407594076940779407894079940809408194082940839408494085940869408794088940899409094091940929409394094940959409694097940989409994100941019410294103941049410594106941079410894109941109411194112941139411494115941169411794118941199412094121941229412394124941259412694127941289412994130941319413294133941349413594136941379413894139941409414194142941439414494145941469414794148941499415094151941529415394154941559415694157941589415994160941619416294163941649416594166941679416894169941709417194172941739417494175941769417794178941799418094181941829418394184941859418694187941889418994190941919419294193941949419594196941979419894199942009420194202942039420494205942069420794208942099421094211942129421394214942159421694217942189421994220942219422294223942249422594226942279422894229942309423194232942339423494235942369423794238942399424094241942429424394244942459424694247942489424994250942519425294253942549425594256942579425894259942609426194262942639426494265942669426794268942699427094271942729427394274942759427694277942789427994280942819428294283942849428594286942879428894289942909429194292942939429494295942969429794298942999430094301943029430394304943059430694307943089430994310943119431294313943149431594316943179431894319943209432194322943239432494325943269432794328943299433094331943329433394334943359433694337943389433994340943419434294343943449434594346943479434894349943509435194352943539435494355943569435794358943599436094361943629436394364943659436694367943689436994370943719437294373943749437594376943779437894379943809438194382943839438494385943869438794388943899439094391943929439394394943959439694397943989439994400944019440294403944049440594406944079440894409944109441194412944139441494415944169441794418944199442094421
  1. /*!
  2. *
  3. * iclient-maplibregl
  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. /***/ 52:
  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 references for various `Number` constants. */
  3043. var MAX_SAFE_INTEGER = 9007199254740991;
  3044. /** `Object#toString` result references. */
  3045. var argsTag = '[object Arguments]',
  3046. funcTag = '[object Function]',
  3047. genTag = '[object GeneratorFunction]',
  3048. mapTag = '[object Map]',
  3049. objectTag = '[object Object]',
  3050. promiseTag = '[object Promise]',
  3051. setTag = '[object Set]',
  3052. weakMapTag = '[object WeakMap]';
  3053. var dataViewTag = '[object DataView]';
  3054. /**
  3055. * Used to match `RegExp`
  3056. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  3057. */
  3058. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  3059. /** Used to detect host constructors (Safari). */
  3060. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  3061. /** Used to detect unsigned integer values. */
  3062. var reIsUint = /^(?:0|[1-9]\d*)$/;
  3063. /** Detect free variable `global` from Node.js. */
  3064. var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
  3065. /** Detect free variable `self`. */
  3066. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  3067. /** Used as a reference to the global object. */
  3068. var root = freeGlobal || freeSelf || Function('return this')();
  3069. /**
  3070. * A specialized version of `_.map` for arrays without support for iteratee
  3071. * shorthands.
  3072. *
  3073. * @private
  3074. * @param {Array} [array] The array to iterate over.
  3075. * @param {Function} iteratee The function invoked per iteration.
  3076. * @returns {Array} Returns the new mapped array.
  3077. */
  3078. function arrayMap(array, iteratee) {
  3079. var index = -1,
  3080. length = array ? array.length : 0,
  3081. result = Array(length);
  3082. while (++index < length) {
  3083. result[index] = iteratee(array[index], index, array);
  3084. }
  3085. return result;
  3086. }
  3087. /**
  3088. * The base implementation of `_.times` without support for iteratee shorthands
  3089. * or max array length checks.
  3090. *
  3091. * @private
  3092. * @param {number} n The number of times to invoke `iteratee`.
  3093. * @param {Function} iteratee The function invoked per iteration.
  3094. * @returns {Array} Returns the array of results.
  3095. */
  3096. function baseTimes(n, iteratee) {
  3097. var index = -1,
  3098. result = Array(n);
  3099. while (++index < n) {
  3100. result[index] = iteratee(index);
  3101. }
  3102. return result;
  3103. }
  3104. /**
  3105. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  3106. * of key-value pairs for `object` corresponding to the property names of `props`.
  3107. *
  3108. * @private
  3109. * @param {Object} object The object to query.
  3110. * @param {Array} props The property names to get values for.
  3111. * @returns {Object} Returns the key-value pairs.
  3112. */
  3113. function baseToPairs(object, props) {
  3114. return arrayMap(props, function(key) {
  3115. return [key, object[key]];
  3116. });
  3117. }
  3118. /**
  3119. * Gets the value at `key` of `object`.
  3120. *
  3121. * @private
  3122. * @param {Object} [object] The object to query.
  3123. * @param {string} key The key of the property to get.
  3124. * @returns {*} Returns the property value.
  3125. */
  3126. function getValue(object, key) {
  3127. return object == null ? undefined : object[key];
  3128. }
  3129. /**
  3130. * Checks if `value` is a host object in IE < 9.
  3131. *
  3132. * @private
  3133. * @param {*} value The value to check.
  3134. * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
  3135. */
  3136. function isHostObject(value) {
  3137. // Many host objects are `Object` objects that can coerce to strings
  3138. // despite having improperly defined `toString` methods.
  3139. var result = false;
  3140. if (value != null && typeof value.toString != 'function') {
  3141. try {
  3142. result = !!(value + '');
  3143. } catch (e) {}
  3144. }
  3145. return result;
  3146. }
  3147. /**
  3148. * Converts `map` to its key-value pairs.
  3149. *
  3150. * @private
  3151. * @param {Object} map The map to convert.
  3152. * @returns {Array} Returns the key-value pairs.
  3153. */
  3154. function mapToArray(map) {
  3155. var index = -1,
  3156. result = Array(map.size);
  3157. map.forEach(function(value, key) {
  3158. result[++index] = [key, value];
  3159. });
  3160. return result;
  3161. }
  3162. /**
  3163. * Creates a unary function that invokes `func` with its argument transformed.
  3164. *
  3165. * @private
  3166. * @param {Function} func The function to wrap.
  3167. * @param {Function} transform The argument transform.
  3168. * @returns {Function} Returns the new function.
  3169. */
  3170. function overArg(func, transform) {
  3171. return function(arg) {
  3172. return func(transform(arg));
  3173. };
  3174. }
  3175. /**
  3176. * Converts `set` to its value-value pairs.
  3177. *
  3178. * @private
  3179. * @param {Object} set The set to convert.
  3180. * @returns {Array} Returns the value-value pairs.
  3181. */
  3182. function setToPairs(set) {
  3183. var index = -1,
  3184. result = Array(set.size);
  3185. set.forEach(function(value) {
  3186. result[++index] = [value, value];
  3187. });
  3188. return result;
  3189. }
  3190. /** Used for built-in method references. */
  3191. var funcProto = Function.prototype,
  3192. objectProto = Object.prototype;
  3193. /** Used to detect overreaching core-js shims. */
  3194. var coreJsData = root['__core-js_shared__'];
  3195. /** Used to detect methods masquerading as native. */
  3196. var maskSrcKey = (function() {
  3197. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  3198. return uid ? ('Symbol(src)_1.' + uid) : '';
  3199. }());
  3200. /** Used to resolve the decompiled source of functions. */
  3201. var funcToString = funcProto.toString;
  3202. /** Used to check objects for own properties. */
  3203. var hasOwnProperty = objectProto.hasOwnProperty;
  3204. /**
  3205. * Used to resolve the
  3206. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  3207. * of values.
  3208. */
  3209. var objectToString = objectProto.toString;
  3210. /** Used to detect if a method is native. */
  3211. var reIsNative = RegExp('^' +
  3212. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  3213. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  3214. );
  3215. /** Built-in value references. */
  3216. var propertyIsEnumerable = objectProto.propertyIsEnumerable;
  3217. /* Built-in method references for those with the same name as other `lodash` methods. */
  3218. var nativeKeys = overArg(Object.keys, Object);
  3219. /* Built-in method references that are verified to be native. */
  3220. var DataView = getNative(root, 'DataView'),
  3221. Map = getNative(root, 'Map'),
  3222. Promise = getNative(root, 'Promise'),
  3223. Set = getNative(root, 'Set'),
  3224. WeakMap = getNative(root, 'WeakMap');
  3225. /** Used to detect maps, sets, and weakmaps. */
  3226. var dataViewCtorString = toSource(DataView),
  3227. mapCtorString = toSource(Map),
  3228. promiseCtorString = toSource(Promise),
  3229. setCtorString = toSource(Set),
  3230. weakMapCtorString = toSource(WeakMap);
  3231. /**
  3232. * Creates an array of the enumerable property names of the array-like `value`.
  3233. *
  3234. * @private
  3235. * @param {*} value The value to query.
  3236. * @param {boolean} inherited Specify returning inherited property names.
  3237. * @returns {Array} Returns the array of property names.
  3238. */
  3239. function arrayLikeKeys(value, inherited) {
  3240. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  3241. // Safari 9 makes `arguments.length` enumerable in strict mode.
  3242. var result = (isArray(value) || isArguments(value))
  3243. ? baseTimes(value.length, String)
  3244. : [];
  3245. var length = result.length,
  3246. skipIndexes = !!length;
  3247. for (var key in value) {
  3248. if ((inherited || hasOwnProperty.call(value, key)) &&
  3249. !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
  3250. result.push(key);
  3251. }
  3252. }
  3253. return result;
  3254. }
  3255. /**
  3256. * The base implementation of `getTag`.
  3257. *
  3258. * @private
  3259. * @param {*} value The value to query.
  3260. * @returns {string} Returns the `toStringTag`.
  3261. */
  3262. function baseGetTag(value) {
  3263. return objectToString.call(value);
  3264. }
  3265. /**
  3266. * The base implementation of `_.isNative` without bad shim checks.
  3267. *
  3268. * @private
  3269. * @param {*} value The value to check.
  3270. * @returns {boolean} Returns `true` if `value` is a native function,
  3271. * else `false`.
  3272. */
  3273. function baseIsNative(value) {
  3274. if (!isObject(value) || isMasked(value)) {
  3275. return false;
  3276. }
  3277. var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
  3278. return pattern.test(toSource(value));
  3279. }
  3280. /**
  3281. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  3282. *
  3283. * @private
  3284. * @param {Object} object The object to query.
  3285. * @returns {Array} Returns the array of property names.
  3286. */
  3287. function baseKeys(object) {
  3288. if (!isPrototype(object)) {
  3289. return nativeKeys(object);
  3290. }
  3291. var result = [];
  3292. for (var key in Object(object)) {
  3293. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  3294. result.push(key);
  3295. }
  3296. }
  3297. return result;
  3298. }
  3299. /**
  3300. * Creates a `_.toPairs` or `_.toPairsIn` function.
  3301. *
  3302. * @private
  3303. * @param {Function} keysFunc The function to get the keys of a given object.
  3304. * @returns {Function} Returns the new pairs function.
  3305. */
  3306. function createToPairs(keysFunc) {
  3307. return function(object) {
  3308. var tag = getTag(object);
  3309. if (tag == mapTag) {
  3310. return mapToArray(object);
  3311. }
  3312. if (tag == setTag) {
  3313. return setToPairs(object);
  3314. }
  3315. return baseToPairs(object, keysFunc(object));
  3316. };
  3317. }
  3318. /**
  3319. * Gets the native function at `key` of `object`.
  3320. *
  3321. * @private
  3322. * @param {Object} object The object to query.
  3323. * @param {string} key The key of the method to get.
  3324. * @returns {*} Returns the function if it's native, else `undefined`.
  3325. */
  3326. function getNative(object, key) {
  3327. var value = getValue(object, key);
  3328. return baseIsNative(value) ? value : undefined;
  3329. }
  3330. /**
  3331. * Gets the `toStringTag` of `value`.
  3332. *
  3333. * @private
  3334. * @param {*} value The value to query.
  3335. * @returns {string} Returns the `toStringTag`.
  3336. */
  3337. var getTag = baseGetTag;
  3338. // Fallback for data views, maps, sets, and weak maps in IE 11,
  3339. // for data views in Edge < 14, and promises in Node.js.
  3340. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  3341. (Map && getTag(new Map) != mapTag) ||
  3342. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  3343. (Set && getTag(new Set) != setTag) ||
  3344. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  3345. getTag = function(value) {
  3346. var result = objectToString.call(value),
  3347. Ctor = result == objectTag ? value.constructor : undefined,
  3348. ctorString = Ctor ? toSource(Ctor) : undefined;
  3349. if (ctorString) {
  3350. switch (ctorString) {
  3351. case dataViewCtorString: return dataViewTag;
  3352. case mapCtorString: return mapTag;
  3353. case promiseCtorString: return promiseTag;
  3354. case setCtorString: return setTag;
  3355. case weakMapCtorString: return weakMapTag;
  3356. }
  3357. }
  3358. return result;
  3359. };
  3360. }
  3361. /**
  3362. * Checks if `value` is a valid array-like index.
  3363. *
  3364. * @private
  3365. * @param {*} value The value to check.
  3366. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  3367. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  3368. */
  3369. function isIndex(value, length) {
  3370. length = length == null ? MAX_SAFE_INTEGER : length;
  3371. return !!length &&
  3372. (typeof value == 'number' || reIsUint.test(value)) &&
  3373. (value > -1 && value % 1 == 0 && value < length);
  3374. }
  3375. /**
  3376. * Checks if `func` has its source masked.
  3377. *
  3378. * @private
  3379. * @param {Function} func The function to check.
  3380. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  3381. */
  3382. function isMasked(func) {
  3383. return !!maskSrcKey && (maskSrcKey in func);
  3384. }
  3385. /**
  3386. * Checks if `value` is likely a prototype object.
  3387. *
  3388. * @private
  3389. * @param {*} value The value to check.
  3390. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  3391. */
  3392. function isPrototype(value) {
  3393. var Ctor = value && value.constructor,
  3394. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  3395. return value === proto;
  3396. }
  3397. /**
  3398. * Converts `func` to its source code.
  3399. *
  3400. * @private
  3401. * @param {Function} func The function to process.
  3402. * @returns {string} Returns the source code.
  3403. */
  3404. function toSource(func) {
  3405. if (func != null) {
  3406. try {
  3407. return funcToString.call(func);
  3408. } catch (e) {}
  3409. try {
  3410. return (func + '');
  3411. } catch (e) {}
  3412. }
  3413. return '';
  3414. }
  3415. /**
  3416. * Checks if `value` is likely an `arguments` object.
  3417. *
  3418. * @static
  3419. * @memberOf _
  3420. * @since 0.1.0
  3421. * @category Lang
  3422. * @param {*} value The value to check.
  3423. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  3424. * else `false`.
  3425. * @example
  3426. *
  3427. * _.isArguments(function() { return arguments; }());
  3428. * // => true
  3429. *
  3430. * _.isArguments([1, 2, 3]);
  3431. * // => false
  3432. */
  3433. function isArguments(value) {
  3434. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  3435. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
  3436. (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
  3437. }
  3438. /**
  3439. * Checks if `value` is classified as an `Array` object.
  3440. *
  3441. * @static
  3442. * @memberOf _
  3443. * @since 0.1.0
  3444. * @category Lang
  3445. * @param {*} value The value to check.
  3446. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  3447. * @example
  3448. *
  3449. * _.isArray([1, 2, 3]);
  3450. * // => true
  3451. *
  3452. * _.isArray(document.body.children);
  3453. * // => false
  3454. *
  3455. * _.isArray('abc');
  3456. * // => false
  3457. *
  3458. * _.isArray(_.noop);
  3459. * // => false
  3460. */
  3461. var isArray = Array.isArray;
  3462. /**
  3463. * Checks if `value` is array-like. A value is considered array-like if it's
  3464. * not a function and has a `value.length` that's an integer greater than or
  3465. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  3466. *
  3467. * @static
  3468. * @memberOf _
  3469. * @since 4.0.0
  3470. * @category Lang
  3471. * @param {*} value The value to check.
  3472. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  3473. * @example
  3474. *
  3475. * _.isArrayLike([1, 2, 3]);
  3476. * // => true
  3477. *
  3478. * _.isArrayLike(document.body.children);
  3479. * // => true
  3480. *
  3481. * _.isArrayLike('abc');
  3482. * // => true
  3483. *
  3484. * _.isArrayLike(_.noop);
  3485. * // => false
  3486. */
  3487. function isArrayLike(value) {
  3488. return value != null && isLength(value.length) && !isFunction(value);
  3489. }
  3490. /**
  3491. * This method is like `_.isArrayLike` except that it also checks if `value`
  3492. * is an object.
  3493. *
  3494. * @static
  3495. * @memberOf _
  3496. * @since 4.0.0
  3497. * @category Lang
  3498. * @param {*} value The value to check.
  3499. * @returns {boolean} Returns `true` if `value` is an array-like object,
  3500. * else `false`.
  3501. * @example
  3502. *
  3503. * _.isArrayLikeObject([1, 2, 3]);
  3504. * // => true
  3505. *
  3506. * _.isArrayLikeObject(document.body.children);
  3507. * // => true
  3508. *
  3509. * _.isArrayLikeObject('abc');
  3510. * // => false
  3511. *
  3512. * _.isArrayLikeObject(_.noop);
  3513. * // => false
  3514. */
  3515. function isArrayLikeObject(value) {
  3516. return isObjectLike(value) && isArrayLike(value);
  3517. }
  3518. /**
  3519. * Checks if `value` is classified as a `Function` object.
  3520. *
  3521. * @static
  3522. * @memberOf _
  3523. * @since 0.1.0
  3524. * @category Lang
  3525. * @param {*} value The value to check.
  3526. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  3527. * @example
  3528. *
  3529. * _.isFunction(_);
  3530. * // => true
  3531. *
  3532. * _.isFunction(/abc/);
  3533. * // => false
  3534. */
  3535. function isFunction(value) {
  3536. // The use of `Object#toString` avoids issues with the `typeof` operator
  3537. // in Safari 8-9 which returns 'object' for typed array and other constructors.
  3538. var tag = isObject(value) ? objectToString.call(value) : '';
  3539. return tag == funcTag || tag == genTag;
  3540. }
  3541. /**
  3542. * Checks if `value` is a valid array-like length.
  3543. *
  3544. * **Note:** This method is loosely based on
  3545. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  3546. *
  3547. * @static
  3548. * @memberOf _
  3549. * @since 4.0.0
  3550. * @category Lang
  3551. * @param {*} value The value to check.
  3552. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  3553. * @example
  3554. *
  3555. * _.isLength(3);
  3556. * // => true
  3557. *
  3558. * _.isLength(Number.MIN_VALUE);
  3559. * // => false
  3560. *
  3561. * _.isLength(Infinity);
  3562. * // => false
  3563. *
  3564. * _.isLength('3');
  3565. * // => false
  3566. */
  3567. function isLength(value) {
  3568. return typeof value == 'number' &&
  3569. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  3570. }
  3571. /**
  3572. * Checks if `value` is the
  3573. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  3574. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  3575. *
  3576. * @static
  3577. * @memberOf _
  3578. * @since 0.1.0
  3579. * @category Lang
  3580. * @param {*} value The value to check.
  3581. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  3582. * @example
  3583. *
  3584. * _.isObject({});
  3585. * // => true
  3586. *
  3587. * _.isObject([1, 2, 3]);
  3588. * // => true
  3589. *
  3590. * _.isObject(_.noop);
  3591. * // => true
  3592. *
  3593. * _.isObject(null);
  3594. * // => false
  3595. */
  3596. function isObject(value) {
  3597. var type = typeof value;
  3598. return !!value && (type == 'object' || type == 'function');
  3599. }
  3600. /**
  3601. * Checks if `value` is object-like. A value is object-like if it's not `null`
  3602. * and has a `typeof` result of "object".
  3603. *
  3604. * @static
  3605. * @memberOf _
  3606. * @since 4.0.0
  3607. * @category Lang
  3608. * @param {*} value The value to check.
  3609. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  3610. * @example
  3611. *
  3612. * _.isObjectLike({});
  3613. * // => true
  3614. *
  3615. * _.isObjectLike([1, 2, 3]);
  3616. * // => true
  3617. *
  3618. * _.isObjectLike(_.noop);
  3619. * // => false
  3620. *
  3621. * _.isObjectLike(null);
  3622. * // => false
  3623. */
  3624. function isObjectLike(value) {
  3625. return !!value && typeof value == 'object';
  3626. }
  3627. /**
  3628. * Creates an array of the own enumerable property names of `object`.
  3629. *
  3630. * **Note:** Non-object values are coerced to objects. See the
  3631. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  3632. * for more details.
  3633. *
  3634. * @static
  3635. * @since 0.1.0
  3636. * @memberOf _
  3637. * @category Object
  3638. * @param {Object} object The object to query.
  3639. * @returns {Array} Returns the array of property names.
  3640. * @example
  3641. *
  3642. * function Foo() {
  3643. * this.a = 1;
  3644. * this.b = 2;
  3645. * }
  3646. *
  3647. * Foo.prototype.c = 3;
  3648. *
  3649. * _.keys(new Foo);
  3650. * // => ['a', 'b'] (iteration order is not guaranteed)
  3651. *
  3652. * _.keys('hi');
  3653. * // => ['0', '1']
  3654. */
  3655. function keys(object) {
  3656. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  3657. }
  3658. /**
  3659. * Creates an array of own enumerable string keyed-value pairs for `object`
  3660. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  3661. * entries are returned.
  3662. *
  3663. * @static
  3664. * @memberOf _
  3665. * @since 4.0.0
  3666. * @alias entries
  3667. * @category Object
  3668. * @param {Object} object The object to query.
  3669. * @returns {Array} Returns the key-value pairs.
  3670. * @example
  3671. *
  3672. * function Foo() {
  3673. * this.a = 1;
  3674. * this.b = 2;
  3675. * }
  3676. *
  3677. * Foo.prototype.c = 3;
  3678. *
  3679. * _.toPairs(new Foo);
  3680. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  3681. */
  3682. var toPairs = createToPairs(keys);
  3683. module.exports = toPairs;
  3684. /***/ }),
  3685. /***/ 618:
  3686. /***/ ((module, exports, __webpack_require__) => {
  3687. /* module decorator */ module = __webpack_require__.nmd(module);
  3688. /**
  3689. * lodash (Custom Build) <https://lodash.com/>
  3690. * Build: `lodash modularize exports="npm" -o ./`
  3691. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  3692. * Released under MIT license <https://lodash.com/license>
  3693. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  3694. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  3695. */
  3696. /** Used as the size to enable large array optimizations. */
  3697. var LARGE_ARRAY_SIZE = 200;
  3698. /** Used as the `TypeError` message for "Functions" methods. */
  3699. var FUNC_ERROR_TEXT = 'Expected a function';
  3700. /** Used to stand-in for `undefined` hash values. */
  3701. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  3702. /** Used to compose bitmasks for comparison styles. */
  3703. var UNORDERED_COMPARE_FLAG = 1,
  3704. PARTIAL_COMPARE_FLAG = 2;
  3705. /** Used as references for various `Number` constants. */
  3706. var INFINITY = 1 / 0,
  3707. MAX_SAFE_INTEGER = 9007199254740991;
  3708. /** `Object#toString` result references. */
  3709. var argsTag = '[object Arguments]',
  3710. arrayTag = '[object Array]',
  3711. boolTag = '[object Boolean]',
  3712. dateTag = '[object Date]',
  3713. errorTag = '[object Error]',
  3714. funcTag = '[object Function]',
  3715. genTag = '[object GeneratorFunction]',
  3716. mapTag = '[object Map]',
  3717. numberTag = '[object Number]',
  3718. objectTag = '[object Object]',
  3719. promiseTag = '[object Promise]',
  3720. regexpTag = '[object RegExp]',
  3721. setTag = '[object Set]',
  3722. stringTag = '[object String]',
  3723. symbolTag = '[object Symbol]',
  3724. weakMapTag = '[object WeakMap]';
  3725. var arrayBufferTag = '[object ArrayBuffer]',
  3726. dataViewTag = '[object DataView]',
  3727. float32Tag = '[object Float32Array]',
  3728. float64Tag = '[object Float64Array]',
  3729. int8Tag = '[object Int8Array]',
  3730. int16Tag = '[object Int16Array]',
  3731. int32Tag = '[object Int32Array]',
  3732. uint8Tag = '[object Uint8Array]',
  3733. uint8ClampedTag = '[object Uint8ClampedArray]',
  3734. uint16Tag = '[object Uint16Array]',
  3735. uint32Tag = '[object Uint32Array]';
  3736. /** Used to match property names within property paths. */
  3737. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  3738. reIsPlainProp = /^\w*$/,
  3739. reLeadingDot = /^\./,
  3740. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  3741. /**
  3742. * Used to match `RegExp`
  3743. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  3744. */
  3745. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  3746. /** Used to match backslashes in property paths. */
  3747. var reEscapeChar = /\\(\\)?/g;
  3748. /** Used to detect host constructors (Safari). */
  3749. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  3750. /** Used to detect unsigned integer values. */
  3751. var reIsUint = /^(?:0|[1-9]\d*)$/;
  3752. /** Used to identify `toStringTag` values of typed arrays. */
  3753. var typedArrayTags = {};
  3754. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  3755. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  3756. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  3757. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  3758. typedArrayTags[uint32Tag] = true;
  3759. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  3760. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  3761. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  3762. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  3763. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  3764. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  3765. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  3766. typedArrayTags[weakMapTag] = false;
  3767. /** Detect free variable `global` from Node.js. */
  3768. var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
  3769. /** Detect free variable `self`. */
  3770. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  3771. /** Used as a reference to the global object. */
  3772. var root = freeGlobal || freeSelf || Function('return this')();
  3773. /** Detect free variable `exports`. */
  3774. var freeExports = true && exports && !exports.nodeType && exports;
  3775. /** Detect free variable `module`. */
  3776. var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module;
  3777. /** Detect the popular CommonJS extension `module.exports`. */
  3778. var moduleExports = freeModule && freeModule.exports === freeExports;
  3779. /** Detect free variable `process` from Node.js. */
  3780. var freeProcess = moduleExports && freeGlobal.process;
  3781. /** Used to access faster Node.js helpers. */
  3782. var nodeUtil = (function() {
  3783. try {
  3784. return freeProcess && freeProcess.binding('util');
  3785. } catch (e) {}
  3786. }());
  3787. /* Node.js helper references. */
  3788. var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  3789. /**
  3790. * A specialized version of `_.includes` for arrays without support for
  3791. * specifying an index to search from.
  3792. *
  3793. * @private
  3794. * @param {Array} [array] The array to inspect.
  3795. * @param {*} target The value to search for.
  3796. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  3797. */
  3798. function arrayIncludes(array, value) {
  3799. var length = array ? array.length : 0;
  3800. return !!length && baseIndexOf(array, value, 0) > -1;
  3801. }
  3802. /**
  3803. * This function is like `arrayIncludes` except that it accepts a comparator.
  3804. *
  3805. * @private
  3806. * @param {Array} [array] The array to inspect.
  3807. * @param {*} target The value to search for.
  3808. * @param {Function} comparator The comparator invoked per element.
  3809. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  3810. */
  3811. function arrayIncludesWith(array, value, comparator) {
  3812. var index = -1,
  3813. length = array ? array.length : 0;
  3814. while (++index < length) {
  3815. if (comparator(value, array[index])) {
  3816. return true;
  3817. }
  3818. }
  3819. return false;
  3820. }
  3821. /**
  3822. * A specialized version of `_.some` for arrays without support for iteratee
  3823. * shorthands.
  3824. *
  3825. * @private
  3826. * @param {Array} [array] The array to iterate over.
  3827. * @param {Function} predicate The function invoked per iteration.
  3828. * @returns {boolean} Returns `true` if any element passes the predicate check,
  3829. * else `false`.
  3830. */
  3831. function arraySome(array, predicate) {
  3832. var index = -1,
  3833. length = array ? array.length : 0;
  3834. while (++index < length) {
  3835. if (predicate(array[index], index, array)) {
  3836. return true;
  3837. }
  3838. }
  3839. return false;
  3840. }
  3841. /**
  3842. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  3843. * support for iteratee shorthands.
  3844. *
  3845. * @private
  3846. * @param {Array} array The array to inspect.
  3847. * @param {Function} predicate The function invoked per iteration.
  3848. * @param {number} fromIndex The index to search from.
  3849. * @param {boolean} [fromRight] Specify iterating from right to left.
  3850. * @returns {number} Returns the index of the matched value, else `-1`.
  3851. */
  3852. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  3853. var length = array.length,
  3854. index = fromIndex + (fromRight ? 1 : -1);
  3855. while ((fromRight ? index-- : ++index < length)) {
  3856. if (predicate(array[index], index, array)) {
  3857. return index;
  3858. }
  3859. }
  3860. return -1;
  3861. }
  3862. /**
  3863. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  3864. *
  3865. * @private
  3866. * @param {Array} array The array to inspect.
  3867. * @param {*} value The value to search for.
  3868. * @param {number} fromIndex The index to search from.
  3869. * @returns {number} Returns the index of the matched value, else `-1`.
  3870. */
  3871. function baseIndexOf(array, value, fromIndex) {
  3872. if (value !== value) {
  3873. return baseFindIndex(array, baseIsNaN, fromIndex);
  3874. }
  3875. var index = fromIndex - 1,
  3876. length = array.length;
  3877. while (++index < length) {
  3878. if (array[index] === value) {
  3879. return index;
  3880. }
  3881. }
  3882. return -1;
  3883. }
  3884. /**
  3885. * The base implementation of `_.isNaN` without support for number objects.
  3886. *
  3887. * @private
  3888. * @param {*} value The value to check.
  3889. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  3890. */
  3891. function baseIsNaN(value) {
  3892. return value !== value;
  3893. }
  3894. /**
  3895. * The base implementation of `_.property` without support for deep paths.
  3896. *
  3897. * @private
  3898. * @param {string} key The key of the property to get.
  3899. * @returns {Function} Returns the new accessor function.
  3900. */
  3901. function baseProperty(key) {
  3902. return function(object) {
  3903. return object == null ? undefined : object[key];
  3904. };
  3905. }
  3906. /**
  3907. * The base implementation of `_.times` without support for iteratee shorthands
  3908. * or max array length checks.
  3909. *
  3910. * @private
  3911. * @param {number} n The number of times to invoke `iteratee`.
  3912. * @param {Function} iteratee The function invoked per iteration.
  3913. * @returns {Array} Returns the array of results.
  3914. */
  3915. function baseTimes(n, iteratee) {
  3916. var index = -1,
  3917. result = Array(n);
  3918. while (++index < n) {
  3919. result[index] = iteratee(index);
  3920. }
  3921. return result;
  3922. }
  3923. /**
  3924. * The base implementation of `_.unary` without support for storing metadata.
  3925. *
  3926. * @private
  3927. * @param {Function} func The function to cap arguments for.
  3928. * @returns {Function} Returns the new capped function.
  3929. */
  3930. function baseUnary(func) {
  3931. return function(value) {
  3932. return func(value);
  3933. };
  3934. }
  3935. /**
  3936. * Checks if a cache value for `key` exists.
  3937. *
  3938. * @private
  3939. * @param {Object} cache The cache to query.
  3940. * @param {string} key The key of the entry to check.
  3941. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3942. */
  3943. function cacheHas(cache, key) {
  3944. return cache.has(key);
  3945. }
  3946. /**
  3947. * Gets the value at `key` of `object`.
  3948. *
  3949. * @private
  3950. * @param {Object} [object] The object to query.
  3951. * @param {string} key The key of the property to get.
  3952. * @returns {*} Returns the property value.
  3953. */
  3954. function getValue(object, key) {
  3955. return object == null ? undefined : object[key];
  3956. }
  3957. /**
  3958. * Checks if `value` is a host object in IE < 9.
  3959. *
  3960. * @private
  3961. * @param {*} value The value to check.
  3962. * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
  3963. */
  3964. function isHostObject(value) {
  3965. // Many host objects are `Object` objects that can coerce to strings
  3966. // despite having improperly defined `toString` methods.
  3967. var result = false;
  3968. if (value != null && typeof value.toString != 'function') {
  3969. try {
  3970. result = !!(value + '');
  3971. } catch (e) {}
  3972. }
  3973. return result;
  3974. }
  3975. /**
  3976. * Converts `map` to its key-value pairs.
  3977. *
  3978. * @private
  3979. * @param {Object} map The map to convert.
  3980. * @returns {Array} Returns the key-value pairs.
  3981. */
  3982. function mapToArray(map) {
  3983. var index = -1,
  3984. result = Array(map.size);
  3985. map.forEach(function(value, key) {
  3986. result[++index] = [key, value];
  3987. });
  3988. return result;
  3989. }
  3990. /**
  3991. * Creates a unary function that invokes `func` with its argument transformed.
  3992. *
  3993. * @private
  3994. * @param {Function} func The function to wrap.
  3995. * @param {Function} transform The argument transform.
  3996. * @returns {Function} Returns the new function.
  3997. */
  3998. function overArg(func, transform) {
  3999. return function(arg) {
  4000. return func(transform(arg));
  4001. };
  4002. }
  4003. /**
  4004. * Converts `set` to an array of its values.
  4005. *
  4006. * @private
  4007. * @param {Object} set The set to convert.
  4008. * @returns {Array} Returns the values.
  4009. */
  4010. function setToArray(set) {
  4011. var index = -1,
  4012. result = Array(set.size);
  4013. set.forEach(function(value) {
  4014. result[++index] = value;
  4015. });
  4016. return result;
  4017. }
  4018. /** Used for built-in method references. */
  4019. var arrayProto = Array.prototype,
  4020. funcProto = Function.prototype,
  4021. objectProto = Object.prototype;
  4022. /** Used to detect overreaching core-js shims. */
  4023. var coreJsData = root['__core-js_shared__'];
  4024. /** Used to detect methods masquerading as native. */
  4025. var maskSrcKey = (function() {
  4026. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  4027. return uid ? ('Symbol(src)_1.' + uid) : '';
  4028. }());
  4029. /** Used to resolve the decompiled source of functions. */
  4030. var funcToString = funcProto.toString;
  4031. /** Used to check objects for own properties. */
  4032. var hasOwnProperty = objectProto.hasOwnProperty;
  4033. /**
  4034. * Used to resolve the
  4035. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  4036. * of values.
  4037. */
  4038. var objectToString = objectProto.toString;
  4039. /** Used to detect if a method is native. */
  4040. var reIsNative = RegExp('^' +
  4041. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  4042. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  4043. );
  4044. /** Built-in value references. */
  4045. var Symbol = root.Symbol,
  4046. Uint8Array = root.Uint8Array,
  4047. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  4048. splice = arrayProto.splice;
  4049. /* Built-in method references for those with the same name as other `lodash` methods. */
  4050. var nativeKeys = overArg(Object.keys, Object);
  4051. /* Built-in method references that are verified to be native. */
  4052. var DataView = getNative(root, 'DataView'),
  4053. Map = getNative(root, 'Map'),
  4054. Promise = getNative(root, 'Promise'),
  4055. Set = getNative(root, 'Set'),
  4056. WeakMap = getNative(root, 'WeakMap'),
  4057. nativeCreate = getNative(Object, 'create');
  4058. /** Used to detect maps, sets, and weakmaps. */
  4059. var dataViewCtorString = toSource(DataView),
  4060. mapCtorString = toSource(Map),
  4061. promiseCtorString = toSource(Promise),
  4062. setCtorString = toSource(Set),
  4063. weakMapCtorString = toSource(WeakMap);
  4064. /** Used to convert symbols to primitives and strings. */
  4065. var symbolProto = Symbol ? Symbol.prototype : undefined,
  4066. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  4067. symbolToString = symbolProto ? symbolProto.toString : undefined;
  4068. /**
  4069. * Creates a hash object.
  4070. *
  4071. * @private
  4072. * @constructor
  4073. * @param {Array} [entries] The key-value pairs to cache.
  4074. */
  4075. function Hash(entries) {
  4076. var index = -1,
  4077. length = entries ? entries.length : 0;
  4078. this.clear();
  4079. while (++index < length) {
  4080. var entry = entries[index];
  4081. this.set(entry[0], entry[1]);
  4082. }
  4083. }
  4084. /**
  4085. * Removes all key-value entries from the hash.
  4086. *
  4087. * @private
  4088. * @name clear
  4089. * @memberOf Hash
  4090. */
  4091. function hashClear() {
  4092. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  4093. }
  4094. /**
  4095. * Removes `key` and its value from the hash.
  4096. *
  4097. * @private
  4098. * @name delete
  4099. * @memberOf Hash
  4100. * @param {Object} hash The hash to modify.
  4101. * @param {string} key The key of the value to remove.
  4102. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  4103. */
  4104. function hashDelete(key) {
  4105. return this.has(key) && delete this.__data__[key];
  4106. }
  4107. /**
  4108. * Gets the hash value for `key`.
  4109. *
  4110. * @private
  4111. * @name get
  4112. * @memberOf Hash
  4113. * @param {string} key The key of the value to get.
  4114. * @returns {*} Returns the entry value.
  4115. */
  4116. function hashGet(key) {
  4117. var data = this.__data__;
  4118. if (nativeCreate) {
  4119. var result = data[key];
  4120. return result === HASH_UNDEFINED ? undefined : result;
  4121. }
  4122. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  4123. }
  4124. /**
  4125. * Checks if a hash value for `key` exists.
  4126. *
  4127. * @private
  4128. * @name has
  4129. * @memberOf Hash
  4130. * @param {string} key The key of the entry to check.
  4131. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  4132. */
  4133. function hashHas(key) {
  4134. var data = this.__data__;
  4135. return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
  4136. }
  4137. /**
  4138. * Sets the hash `key` to `value`.
  4139. *
  4140. * @private
  4141. * @name set
  4142. * @memberOf Hash
  4143. * @param {string} key The key of the value to set.
  4144. * @param {*} value The value to set.
  4145. * @returns {Object} Returns the hash instance.
  4146. */
  4147. function hashSet(key, value) {
  4148. var data = this.__data__;
  4149. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  4150. return this;
  4151. }
  4152. // Add methods to `Hash`.
  4153. Hash.prototype.clear = hashClear;
  4154. Hash.prototype['delete'] = hashDelete;
  4155. Hash.prototype.get = hashGet;
  4156. Hash.prototype.has = hashHas;
  4157. Hash.prototype.set = hashSet;
  4158. /**
  4159. * Creates an list cache object.
  4160. *
  4161. * @private
  4162. * @constructor
  4163. * @param {Array} [entries] The key-value pairs to cache.
  4164. */
  4165. function ListCache(entries) {
  4166. var index = -1,
  4167. length = entries ? entries.length : 0;
  4168. this.clear();
  4169. while (++index < length) {
  4170. var entry = entries[index];
  4171. this.set(entry[0], entry[1]);
  4172. }
  4173. }
  4174. /**
  4175. * Removes all key-value entries from the list cache.
  4176. *
  4177. * @private
  4178. * @name clear
  4179. * @memberOf ListCache
  4180. */
  4181. function listCacheClear() {
  4182. this.__data__ = [];
  4183. }
  4184. /**
  4185. * Removes `key` and its value from the list cache.
  4186. *
  4187. * @private
  4188. * @name delete
  4189. * @memberOf ListCache
  4190. * @param {string} key The key of the value to remove.
  4191. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  4192. */
  4193. function listCacheDelete(key) {
  4194. var data = this.__data__,
  4195. index = assocIndexOf(data, key);
  4196. if (index < 0) {
  4197. return false;
  4198. }
  4199. var lastIndex = data.length - 1;
  4200. if (index == lastIndex) {
  4201. data.pop();
  4202. } else {
  4203. splice.call(data, index, 1);
  4204. }
  4205. return true;
  4206. }
  4207. /**
  4208. * Gets the list cache value for `key`.
  4209. *
  4210. * @private
  4211. * @name get
  4212. * @memberOf ListCache
  4213. * @param {string} key The key of the value to get.
  4214. * @returns {*} Returns the entry value.
  4215. */
  4216. function listCacheGet(key) {
  4217. var data = this.__data__,
  4218. index = assocIndexOf(data, key);
  4219. return index < 0 ? undefined : data[index][1];
  4220. }
  4221. /**
  4222. * Checks if a list cache value for `key` exists.
  4223. *
  4224. * @private
  4225. * @name has
  4226. * @memberOf ListCache
  4227. * @param {string} key The key of the entry to check.
  4228. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  4229. */
  4230. function listCacheHas(key) {
  4231. return assocIndexOf(this.__data__, key) > -1;
  4232. }
  4233. /**
  4234. * Sets the list cache `key` to `value`.
  4235. *
  4236. * @private
  4237. * @name set
  4238. * @memberOf ListCache
  4239. * @param {string} key The key of the value to set.
  4240. * @param {*} value The value to set.
  4241. * @returns {Object} Returns the list cache instance.
  4242. */
  4243. function listCacheSet(key, value) {
  4244. var data = this.__data__,
  4245. index = assocIndexOf(data, key);
  4246. if (index < 0) {
  4247. data.push([key, value]);
  4248. } else {
  4249. data[index][1] = value;
  4250. }
  4251. return this;
  4252. }
  4253. // Add methods to `ListCache`.
  4254. ListCache.prototype.clear = listCacheClear;
  4255. ListCache.prototype['delete'] = listCacheDelete;
  4256. ListCache.prototype.get = listCacheGet;
  4257. ListCache.prototype.has = listCacheHas;
  4258. ListCache.prototype.set = listCacheSet;
  4259. /**
  4260. * Creates a map cache object to store key-value pairs.
  4261. *
  4262. * @private
  4263. * @constructor
  4264. * @param {Array} [entries] The key-value pairs to cache.
  4265. */
  4266. function MapCache(entries) {
  4267. var index = -1,
  4268. length = entries ? entries.length : 0;
  4269. this.clear();
  4270. while (++index < length) {
  4271. var entry = entries[index];
  4272. this.set(entry[0], entry[1]);
  4273. }
  4274. }
  4275. /**
  4276. * Removes all key-value entries from the map.
  4277. *
  4278. * @private
  4279. * @name clear
  4280. * @memberOf MapCache
  4281. */
  4282. function mapCacheClear() {
  4283. this.__data__ = {
  4284. 'hash': new Hash,
  4285. 'map': new (Map || ListCache),
  4286. 'string': new Hash
  4287. };
  4288. }
  4289. /**
  4290. * Removes `key` and its value from the map.
  4291. *
  4292. * @private
  4293. * @name delete
  4294. * @memberOf MapCache
  4295. * @param {string} key The key of the value to remove.
  4296. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  4297. */
  4298. function mapCacheDelete(key) {
  4299. return getMapData(this, key)['delete'](key);
  4300. }
  4301. /**
  4302. * Gets the map value for `key`.
  4303. *
  4304. * @private
  4305. * @name get
  4306. * @memberOf MapCache
  4307. * @param {string} key The key of the value to get.
  4308. * @returns {*} Returns the entry value.
  4309. */
  4310. function mapCacheGet(key) {
  4311. return getMapData(this, key).get(key);
  4312. }
  4313. /**
  4314. * Checks if a map value for `key` exists.
  4315. *
  4316. * @private
  4317. * @name has
  4318. * @memberOf MapCache
  4319. * @param {string} key The key of the entry to check.
  4320. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  4321. */
  4322. function mapCacheHas(key) {
  4323. return getMapData(this, key).has(key);
  4324. }
  4325. /**
  4326. * Sets the map `key` to `value`.
  4327. *
  4328. * @private
  4329. * @name set
  4330. * @memberOf MapCache
  4331. * @param {string} key The key of the value to set.
  4332. * @param {*} value The value to set.
  4333. * @returns {Object} Returns the map cache instance.
  4334. */
  4335. function mapCacheSet(key, value) {
  4336. getMapData(this, key).set(key, value);
  4337. return this;
  4338. }
  4339. // Add methods to `MapCache`.
  4340. MapCache.prototype.clear = mapCacheClear;
  4341. MapCache.prototype['delete'] = mapCacheDelete;
  4342. MapCache.prototype.get = mapCacheGet;
  4343. MapCache.prototype.has = mapCacheHas;
  4344. MapCache.prototype.set = mapCacheSet;
  4345. /**
  4346. *
  4347. * Creates an array cache object to store unique values.
  4348. *
  4349. * @private
  4350. * @constructor
  4351. * @param {Array} [values] The values to cache.
  4352. */
  4353. function SetCache(values) {
  4354. var index = -1,
  4355. length = values ? values.length : 0;
  4356. this.__data__ = new MapCache;
  4357. while (++index < length) {
  4358. this.add(values[index]);
  4359. }
  4360. }
  4361. /**
  4362. * Adds `value` to the array cache.
  4363. *
  4364. * @private
  4365. * @name add
  4366. * @memberOf SetCache
  4367. * @alias push
  4368. * @param {*} value The value to cache.
  4369. * @returns {Object} Returns the cache instance.
  4370. */
  4371. function setCacheAdd(value) {
  4372. this.__data__.set(value, HASH_UNDEFINED);
  4373. return this;
  4374. }
  4375. /**
  4376. * Checks if `value` is in the array cache.
  4377. *
  4378. * @private
  4379. * @name has
  4380. * @memberOf SetCache
  4381. * @param {*} value The value to search for.
  4382. * @returns {number} Returns `true` if `value` is found, else `false`.
  4383. */
  4384. function setCacheHas(value) {
  4385. return this.__data__.has(value);
  4386. }
  4387. // Add methods to `SetCache`.
  4388. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  4389. SetCache.prototype.has = setCacheHas;
  4390. /**
  4391. * Creates a stack cache object to store key-value pairs.
  4392. *
  4393. * @private
  4394. * @constructor
  4395. * @param {Array} [entries] The key-value pairs to cache.
  4396. */
  4397. function Stack(entries) {
  4398. this.__data__ = new ListCache(entries);
  4399. }
  4400. /**
  4401. * Removes all key-value entries from the stack.
  4402. *
  4403. * @private
  4404. * @name clear
  4405. * @memberOf Stack
  4406. */
  4407. function stackClear() {
  4408. this.__data__ = new ListCache;
  4409. }
  4410. /**
  4411. * Removes `key` and its value from the stack.
  4412. *
  4413. * @private
  4414. * @name delete
  4415. * @memberOf Stack
  4416. * @param {string} key The key of the value to remove.
  4417. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  4418. */
  4419. function stackDelete(key) {
  4420. return this.__data__['delete'](key);
  4421. }
  4422. /**
  4423. * Gets the stack value for `key`.
  4424. *
  4425. * @private
  4426. * @name get
  4427. * @memberOf Stack
  4428. * @param {string} key The key of the value to get.
  4429. * @returns {*} Returns the entry value.
  4430. */
  4431. function stackGet(key) {
  4432. return this.__data__.get(key);
  4433. }
  4434. /**
  4435. * Checks if a stack value for `key` exists.
  4436. *
  4437. * @private
  4438. * @name has
  4439. * @memberOf Stack
  4440. * @param {string} key The key of the entry to check.
  4441. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  4442. */
  4443. function stackHas(key) {
  4444. return this.__data__.has(key);
  4445. }
  4446. /**
  4447. * Sets the stack `key` to `value`.
  4448. *
  4449. * @private
  4450. * @name set
  4451. * @memberOf Stack
  4452. * @param {string} key The key of the value to set.
  4453. * @param {*} value The value to set.
  4454. * @returns {Object} Returns the stack cache instance.
  4455. */
  4456. function stackSet(key, value) {
  4457. var cache = this.__data__;
  4458. if (cache instanceof ListCache) {
  4459. var pairs = cache.__data__;
  4460. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  4461. pairs.push([key, value]);
  4462. return this;
  4463. }
  4464. cache = this.__data__ = new MapCache(pairs);
  4465. }
  4466. cache.set(key, value);
  4467. return this;
  4468. }
  4469. // Add methods to `Stack`.
  4470. Stack.prototype.clear = stackClear;
  4471. Stack.prototype['delete'] = stackDelete;
  4472. Stack.prototype.get = stackGet;
  4473. Stack.prototype.has = stackHas;
  4474. Stack.prototype.set = stackSet;
  4475. /**
  4476. * Creates an array of the enumerable property names of the array-like `value`.
  4477. *
  4478. * @private
  4479. * @param {*} value The value to query.
  4480. * @param {boolean} inherited Specify returning inherited property names.
  4481. * @returns {Array} Returns the array of property names.
  4482. */
  4483. function arrayLikeKeys(value, inherited) {
  4484. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  4485. // Safari 9 makes `arguments.length` enumerable in strict mode.
  4486. var result = (isArray(value) || isArguments(value))
  4487. ? baseTimes(value.length, String)
  4488. : [];
  4489. var length = result.length,
  4490. skipIndexes = !!length;
  4491. for (var key in value) {
  4492. if ((inherited || hasOwnProperty.call(value, key)) &&
  4493. !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
  4494. result.push(key);
  4495. }
  4496. }
  4497. return result;
  4498. }
  4499. /**
  4500. * Gets the index at which the `key` is found in `array` of key-value pairs.
  4501. *
  4502. * @private
  4503. * @param {Array} array The array to inspect.
  4504. * @param {*} key The key to search for.
  4505. * @returns {number} Returns the index of the matched value, else `-1`.
  4506. */
  4507. function assocIndexOf(array, key) {
  4508. var length = array.length;
  4509. while (length--) {
  4510. if (eq(array[length][0], key)) {
  4511. return length;
  4512. }
  4513. }
  4514. return -1;
  4515. }
  4516. /**
  4517. * The base implementation of `_.get` without support for default values.
  4518. *
  4519. * @private
  4520. * @param {Object} object The object to query.
  4521. * @param {Array|string} path The path of the property to get.
  4522. * @returns {*} Returns the resolved value.
  4523. */
  4524. function baseGet(object, path) {
  4525. path = isKey(path, object) ? [path] : castPath(path);
  4526. var index = 0,
  4527. length = path.length;
  4528. while (object != null && index < length) {
  4529. object = object[toKey(path[index++])];
  4530. }
  4531. return (index && index == length) ? object : undefined;
  4532. }
  4533. /**
  4534. * The base implementation of `getTag`.
  4535. *
  4536. * @private
  4537. * @param {*} value The value to query.
  4538. * @returns {string} Returns the `toStringTag`.
  4539. */
  4540. function baseGetTag(value) {
  4541. return objectToString.call(value);
  4542. }
  4543. /**
  4544. * The base implementation of `_.hasIn` without support for deep paths.
  4545. *
  4546. * @private
  4547. * @param {Object} [object] The object to query.
  4548. * @param {Array|string} key The key to check.
  4549. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  4550. */
  4551. function baseHasIn(object, key) {
  4552. return object != null && key in Object(object);
  4553. }
  4554. /**
  4555. * The base implementation of `_.isEqual` which supports partial comparisons
  4556. * and tracks traversed objects.
  4557. *
  4558. * @private
  4559. * @param {*} value The value to compare.
  4560. * @param {*} other The other value to compare.
  4561. * @param {Function} [customizer] The function to customize comparisons.
  4562. * @param {boolean} [bitmask] The bitmask of comparison flags.
  4563. * The bitmask may be composed of the following flags:
  4564. * 1 - Unordered comparison
  4565. * 2 - Partial comparison
  4566. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  4567. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  4568. */
  4569. function baseIsEqual(value, other, customizer, bitmask, stack) {
  4570. if (value === other) {
  4571. return true;
  4572. }
  4573. if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
  4574. return value !== value && other !== other;
  4575. }
  4576. return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack);
  4577. }
  4578. /**
  4579. * A specialized version of `baseIsEqual` for arrays and objects which performs
  4580. * deep comparisons and tracks traversed objects enabling objects with circular
  4581. * references to be compared.
  4582. *
  4583. * @private
  4584. * @param {Object} object The object to compare.
  4585. * @param {Object} other The other object to compare.
  4586. * @param {Function} equalFunc The function to determine equivalents of values.
  4587. * @param {Function} [customizer] The function to customize comparisons.
  4588. * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual`
  4589. * for more details.
  4590. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  4591. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  4592. */
  4593. function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {
  4594. var objIsArr = isArray(object),
  4595. othIsArr = isArray(other),
  4596. objTag = arrayTag,
  4597. othTag = arrayTag;
  4598. if (!objIsArr) {
  4599. objTag = getTag(object);
  4600. objTag = objTag == argsTag ? objectTag : objTag;
  4601. }
  4602. if (!othIsArr) {
  4603. othTag = getTag(other);
  4604. othTag = othTag == argsTag ? objectTag : othTag;
  4605. }
  4606. var objIsObj = objTag == objectTag && !isHostObject(object),
  4607. othIsObj = othTag == objectTag && !isHostObject(other),
  4608. isSameTag = objTag == othTag;
  4609. if (isSameTag && !objIsObj) {
  4610. stack || (stack = new Stack);
  4611. return (objIsArr || isTypedArray(object))
  4612. ? equalArrays(object, other, equalFunc, customizer, bitmask, stack)
  4613. : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack);
  4614. }
  4615. if (!(bitmask & PARTIAL_COMPARE_FLAG)) {
  4616. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  4617. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  4618. if (objIsWrapped || othIsWrapped) {
  4619. var objUnwrapped = objIsWrapped ? object.value() : object,
  4620. othUnwrapped = othIsWrapped ? other.value() : other;
  4621. stack || (stack = new Stack);
  4622. return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack);
  4623. }
  4624. }
  4625. if (!isSameTag) {
  4626. return false;
  4627. }
  4628. stack || (stack = new Stack);
  4629. return equalObjects(object, other, equalFunc, customizer, bitmask, stack);
  4630. }
  4631. /**
  4632. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  4633. *
  4634. * @private
  4635. * @param {Object} object The object to inspect.
  4636. * @param {Object} source The object of property values to match.
  4637. * @param {Array} matchData The property names, values, and compare flags to match.
  4638. * @param {Function} [customizer] The function to customize comparisons.
  4639. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  4640. */
  4641. function baseIsMatch(object, source, matchData, customizer) {
  4642. var index = matchData.length,
  4643. length = index,
  4644. noCustomizer = !customizer;
  4645. if (object == null) {
  4646. return !length;
  4647. }
  4648. object = Object(object);
  4649. while (index--) {
  4650. var data = matchData[index];
  4651. if ((noCustomizer && data[2])
  4652. ? data[1] !== object[data[0]]
  4653. : !(data[0] in object)
  4654. ) {
  4655. return false;
  4656. }
  4657. }
  4658. while (++index < length) {
  4659. data = matchData[index];
  4660. var key = data[0],
  4661. objValue = object[key],
  4662. srcValue = data[1];
  4663. if (noCustomizer && data[2]) {
  4664. if (objValue === undefined && !(key in object)) {
  4665. return false;
  4666. }
  4667. } else {
  4668. var stack = new Stack;
  4669. if (customizer) {
  4670. var result = customizer(objValue, srcValue, key, object, source, stack);
  4671. }
  4672. if (!(result === undefined
  4673. ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack)
  4674. : result
  4675. )) {
  4676. return false;
  4677. }
  4678. }
  4679. }
  4680. return true;
  4681. }
  4682. /**
  4683. * The base implementation of `_.isNative` without bad shim checks.
  4684. *
  4685. * @private
  4686. * @param {*} value The value to check.
  4687. * @returns {boolean} Returns `true` if `value` is a native function,
  4688. * else `false`.
  4689. */
  4690. function baseIsNative(value) {
  4691. if (!isObject(value) || isMasked(value)) {
  4692. return false;
  4693. }
  4694. var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
  4695. return pattern.test(toSource(value));
  4696. }
  4697. /**
  4698. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  4699. *
  4700. * @private
  4701. * @param {*} value The value to check.
  4702. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  4703. */
  4704. function baseIsTypedArray(value) {
  4705. return isObjectLike(value) &&
  4706. isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
  4707. }
  4708. /**
  4709. * The base implementation of `_.iteratee`.
  4710. *
  4711. * @private
  4712. * @param {*} [value=_.identity] The value to convert to an iteratee.
  4713. * @returns {Function} Returns the iteratee.
  4714. */
  4715. function baseIteratee(value) {
  4716. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  4717. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  4718. if (typeof value == 'function') {
  4719. return value;
  4720. }
  4721. if (value == null) {
  4722. return identity;
  4723. }
  4724. if (typeof value == 'object') {
  4725. return isArray(value)
  4726. ? baseMatchesProperty(value[0], value[1])
  4727. : baseMatches(value);
  4728. }
  4729. return property(value);
  4730. }
  4731. /**
  4732. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  4733. *
  4734. * @private
  4735. * @param {Object} object The object to query.
  4736. * @returns {Array} Returns the array of property names.
  4737. */
  4738. function baseKeys(object) {
  4739. if (!isPrototype(object)) {
  4740. return nativeKeys(object);
  4741. }
  4742. var result = [];
  4743. for (var key in Object(object)) {
  4744. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  4745. result.push(key);
  4746. }
  4747. }
  4748. return result;
  4749. }
  4750. /**
  4751. * The base implementation of `_.matches` which doesn't clone `source`.
  4752. *
  4753. * @private
  4754. * @param {Object} source The object of property values to match.
  4755. * @returns {Function} Returns the new spec function.
  4756. */
  4757. function baseMatches(source) {
  4758. var matchData = getMatchData(source);
  4759. if (matchData.length == 1 && matchData[0][2]) {
  4760. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  4761. }
  4762. return function(object) {
  4763. return object === source || baseIsMatch(object, source, matchData);
  4764. };
  4765. }
  4766. /**
  4767. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  4768. *
  4769. * @private
  4770. * @param {string} path The path of the property to get.
  4771. * @param {*} srcValue The value to match.
  4772. * @returns {Function} Returns the new spec function.
  4773. */
  4774. function baseMatchesProperty(path, srcValue) {
  4775. if (isKey(path) && isStrictComparable(srcValue)) {
  4776. return matchesStrictComparable(toKey(path), srcValue);
  4777. }
  4778. return function(object) {
  4779. var objValue = get(object, path);
  4780. return (objValue === undefined && objValue === srcValue)
  4781. ? hasIn(object, path)
  4782. : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG);
  4783. };
  4784. }
  4785. /**
  4786. * A specialized version of `baseProperty` which supports deep paths.
  4787. *
  4788. * @private
  4789. * @param {Array|string} path The path of the property to get.
  4790. * @returns {Function} Returns the new accessor function.
  4791. */
  4792. function basePropertyDeep(path) {
  4793. return function(object) {
  4794. return baseGet(object, path);
  4795. };
  4796. }
  4797. /**
  4798. * The base implementation of `_.toString` which doesn't convert nullish
  4799. * values to empty strings.
  4800. *
  4801. * @private
  4802. * @param {*} value The value to process.
  4803. * @returns {string} Returns the string.
  4804. */
  4805. function baseToString(value) {
  4806. // Exit early for strings to avoid a performance hit in some environments.
  4807. if (typeof value == 'string') {
  4808. return value;
  4809. }
  4810. if (isSymbol(value)) {
  4811. return symbolToString ? symbolToString.call(value) : '';
  4812. }
  4813. var result = (value + '');
  4814. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  4815. }
  4816. /**
  4817. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  4818. *
  4819. * @private
  4820. * @param {Array} array The array to inspect.
  4821. * @param {Function} [iteratee] The iteratee invoked per element.
  4822. * @param {Function} [comparator] The comparator invoked per element.
  4823. * @returns {Array} Returns the new duplicate free array.
  4824. */
  4825. function baseUniq(array, iteratee, comparator) {
  4826. var index = -1,
  4827. includes = arrayIncludes,
  4828. length = array.length,
  4829. isCommon = true,
  4830. result = [],
  4831. seen = result;
  4832. if (comparator) {
  4833. isCommon = false;
  4834. includes = arrayIncludesWith;
  4835. }
  4836. else if (length >= LARGE_ARRAY_SIZE) {
  4837. var set = iteratee ? null : createSet(array);
  4838. if (set) {
  4839. return setToArray(set);
  4840. }
  4841. isCommon = false;
  4842. includes = cacheHas;
  4843. seen = new SetCache;
  4844. }
  4845. else {
  4846. seen = iteratee ? [] : result;
  4847. }
  4848. outer:
  4849. while (++index < length) {
  4850. var value = array[index],
  4851. computed = iteratee ? iteratee(value) : value;
  4852. value = (comparator || value !== 0) ? value : 0;
  4853. if (isCommon && computed === computed) {
  4854. var seenIndex = seen.length;
  4855. while (seenIndex--) {
  4856. if (seen[seenIndex] === computed) {
  4857. continue outer;
  4858. }
  4859. }
  4860. if (iteratee) {
  4861. seen.push(computed);
  4862. }
  4863. result.push(value);
  4864. }
  4865. else if (!includes(seen, computed, comparator)) {
  4866. if (seen !== result) {
  4867. seen.push(computed);
  4868. }
  4869. result.push(value);
  4870. }
  4871. }
  4872. return result;
  4873. }
  4874. /**
  4875. * Casts `value` to a path array if it's not one.
  4876. *
  4877. * @private
  4878. * @param {*} value The value to inspect.
  4879. * @returns {Array} Returns the cast property path array.
  4880. */
  4881. function castPath(value) {
  4882. return isArray(value) ? value : stringToPath(value);
  4883. }
  4884. /**
  4885. * Creates a set object of `values`.
  4886. *
  4887. * @private
  4888. * @param {Array} values The values to add to the set.
  4889. * @returns {Object} Returns the new set.
  4890. */
  4891. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  4892. return new Set(values);
  4893. };
  4894. /**
  4895. * A specialized version of `baseIsEqualDeep` for arrays with support for
  4896. * partial deep comparisons.
  4897. *
  4898. * @private
  4899. * @param {Array} array The array to compare.
  4900. * @param {Array} other The other array to compare.
  4901. * @param {Function} equalFunc The function to determine equivalents of values.
  4902. * @param {Function} customizer The function to customize comparisons.
  4903. * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
  4904. * for more details.
  4905. * @param {Object} stack Tracks traversed `array` and `other` objects.
  4906. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  4907. */
  4908. function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
  4909. var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
  4910. arrLength = array.length,
  4911. othLength = other.length;
  4912. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  4913. return false;
  4914. }
  4915. // Assume cyclic values are equal.
  4916. var stacked = stack.get(array);
  4917. if (stacked && stack.get(other)) {
  4918. return stacked == other;
  4919. }
  4920. var index = -1,
  4921. result = true,
  4922. seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined;
  4923. stack.set(array, other);
  4924. stack.set(other, array);
  4925. // Ignore non-index properties.
  4926. while (++index < arrLength) {
  4927. var arrValue = array[index],
  4928. othValue = other[index];
  4929. if (customizer) {
  4930. var compared = isPartial
  4931. ? customizer(othValue, arrValue, index, other, array, stack)
  4932. : customizer(arrValue, othValue, index, array, other, stack);
  4933. }
  4934. if (compared !== undefined) {
  4935. if (compared) {
  4936. continue;
  4937. }
  4938. result = false;
  4939. break;
  4940. }
  4941. // Recursively compare arrays (susceptible to call stack limits).
  4942. if (seen) {
  4943. if (!arraySome(other, function(othValue, othIndex) {
  4944. if (!seen.has(othIndex) &&
  4945. (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
  4946. return seen.add(othIndex);
  4947. }
  4948. })) {
  4949. result = false;
  4950. break;
  4951. }
  4952. } else if (!(
  4953. arrValue === othValue ||
  4954. equalFunc(arrValue, othValue, customizer, bitmask, stack)
  4955. )) {
  4956. result = false;
  4957. break;
  4958. }
  4959. }
  4960. stack['delete'](array);
  4961. stack['delete'](other);
  4962. return result;
  4963. }
  4964. /**
  4965. * A specialized version of `baseIsEqualDeep` for comparing objects of
  4966. * the same `toStringTag`.
  4967. *
  4968. * **Note:** This function only supports comparing values with tags of
  4969. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  4970. *
  4971. * @private
  4972. * @param {Object} object The object to compare.
  4973. * @param {Object} other The other object to compare.
  4974. * @param {string} tag The `toStringTag` of the objects to compare.
  4975. * @param {Function} equalFunc The function to determine equivalents of values.
  4976. * @param {Function} customizer The function to customize comparisons.
  4977. * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
  4978. * for more details.
  4979. * @param {Object} stack Tracks traversed `object` and `other` objects.
  4980. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  4981. */
  4982. function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
  4983. switch (tag) {
  4984. case dataViewTag:
  4985. if ((object.byteLength != other.byteLength) ||
  4986. (object.byteOffset != other.byteOffset)) {
  4987. return false;
  4988. }
  4989. object = object.buffer;
  4990. other = other.buffer;
  4991. case arrayBufferTag:
  4992. if ((object.byteLength != other.byteLength) ||
  4993. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  4994. return false;
  4995. }
  4996. return true;
  4997. case boolTag:
  4998. case dateTag:
  4999. case numberTag:
  5000. // Coerce booleans to `1` or `0` and dates to milliseconds.
  5001. // Invalid dates are coerced to `NaN`.
  5002. return eq(+object, +other);
  5003. case errorTag:
  5004. return object.name == other.name && object.message == other.message;
  5005. case regexpTag:
  5006. case stringTag:
  5007. // Coerce regexes to strings and treat strings, primitives and objects,
  5008. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  5009. // for more details.
  5010. return object == (other + '');
  5011. case mapTag:
  5012. var convert = mapToArray;
  5013. case setTag:
  5014. var isPartial = bitmask & PARTIAL_COMPARE_FLAG;
  5015. convert || (convert = setToArray);
  5016. if (object.size != other.size && !isPartial) {
  5017. return false;
  5018. }
  5019. // Assume cyclic values are equal.
  5020. var stacked = stack.get(object);
  5021. if (stacked) {
  5022. return stacked == other;
  5023. }
  5024. bitmask |= UNORDERED_COMPARE_FLAG;
  5025. // Recursively compare objects (susceptible to call stack limits).
  5026. stack.set(object, other);
  5027. var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
  5028. stack['delete'](object);
  5029. return result;
  5030. case symbolTag:
  5031. if (symbolValueOf) {
  5032. return symbolValueOf.call(object) == symbolValueOf.call(other);
  5033. }
  5034. }
  5035. return false;
  5036. }
  5037. /**
  5038. * A specialized version of `baseIsEqualDeep` for objects with support for
  5039. * partial deep comparisons.
  5040. *
  5041. * @private
  5042. * @param {Object} object The object to compare.
  5043. * @param {Object} other The other object to compare.
  5044. * @param {Function} equalFunc The function to determine equivalents of values.
  5045. * @param {Function} customizer The function to customize comparisons.
  5046. * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
  5047. * for more details.
  5048. * @param {Object} stack Tracks traversed `object` and `other` objects.
  5049. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  5050. */
  5051. function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
  5052. var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
  5053. objProps = keys(object),
  5054. objLength = objProps.length,
  5055. othProps = keys(other),
  5056. othLength = othProps.length;
  5057. if (objLength != othLength && !isPartial) {
  5058. return false;
  5059. }
  5060. var index = objLength;
  5061. while (index--) {
  5062. var key = objProps[index];
  5063. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  5064. return false;
  5065. }
  5066. }
  5067. // Assume cyclic values are equal.
  5068. var stacked = stack.get(object);
  5069. if (stacked && stack.get(other)) {
  5070. return stacked == other;
  5071. }
  5072. var result = true;
  5073. stack.set(object, other);
  5074. stack.set(other, object);
  5075. var skipCtor = isPartial;
  5076. while (++index < objLength) {
  5077. key = objProps[index];
  5078. var objValue = object[key],
  5079. othValue = other[key];
  5080. if (customizer) {
  5081. var compared = isPartial
  5082. ? customizer(othValue, objValue, key, other, object, stack)
  5083. : customizer(objValue, othValue, key, object, other, stack);
  5084. }
  5085. // Recursively compare objects (susceptible to call stack limits).
  5086. if (!(compared === undefined
  5087. ? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack))
  5088. : compared
  5089. )) {
  5090. result = false;
  5091. break;
  5092. }
  5093. skipCtor || (skipCtor = key == 'constructor');
  5094. }
  5095. if (result && !skipCtor) {
  5096. var objCtor = object.constructor,
  5097. othCtor = other.constructor;
  5098. // Non `Object` object instances with different constructors are not equal.
  5099. if (objCtor != othCtor &&
  5100. ('constructor' in object && 'constructor' in other) &&
  5101. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  5102. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  5103. result = false;
  5104. }
  5105. }
  5106. stack['delete'](object);
  5107. stack['delete'](other);
  5108. return result;
  5109. }
  5110. /**
  5111. * Gets the data for `map`.
  5112. *
  5113. * @private
  5114. * @param {Object} map The map to query.
  5115. * @param {string} key The reference key.
  5116. * @returns {*} Returns the map data.
  5117. */
  5118. function getMapData(map, key) {
  5119. var data = map.__data__;
  5120. return isKeyable(key)
  5121. ? data[typeof key == 'string' ? 'string' : 'hash']
  5122. : data.map;
  5123. }
  5124. /**
  5125. * Gets the property names, values, and compare flags of `object`.
  5126. *
  5127. * @private
  5128. * @param {Object} object The object to query.
  5129. * @returns {Array} Returns the match data of `object`.
  5130. */
  5131. function getMatchData(object) {
  5132. var result = keys(object),
  5133. length = result.length;
  5134. while (length--) {
  5135. var key = result[length],
  5136. value = object[key];
  5137. result[length] = [key, value, isStrictComparable(value)];
  5138. }
  5139. return result;
  5140. }
  5141. /**
  5142. * Gets the native function at `key` of `object`.
  5143. *
  5144. * @private
  5145. * @param {Object} object The object to query.
  5146. * @param {string} key The key of the method to get.
  5147. * @returns {*} Returns the function if it's native, else `undefined`.
  5148. */
  5149. function getNative(object, key) {
  5150. var value = getValue(object, key);
  5151. return baseIsNative(value) ? value : undefined;
  5152. }
  5153. /**
  5154. * Gets the `toStringTag` of `value`.
  5155. *
  5156. * @private
  5157. * @param {*} value The value to query.
  5158. * @returns {string} Returns the `toStringTag`.
  5159. */
  5160. var getTag = baseGetTag;
  5161. // Fallback for data views, maps, sets, and weak maps in IE 11,
  5162. // for data views in Edge < 14, and promises in Node.js.
  5163. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  5164. (Map && getTag(new Map) != mapTag) ||
  5165. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  5166. (Set && getTag(new Set) != setTag) ||
  5167. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  5168. getTag = function(value) {
  5169. var result = objectToString.call(value),
  5170. Ctor = result == objectTag ? value.constructor : undefined,
  5171. ctorString = Ctor ? toSource(Ctor) : undefined;
  5172. if (ctorString) {
  5173. switch (ctorString) {
  5174. case dataViewCtorString: return dataViewTag;
  5175. case mapCtorString: return mapTag;
  5176. case promiseCtorString: return promiseTag;
  5177. case setCtorString: return setTag;
  5178. case weakMapCtorString: return weakMapTag;
  5179. }
  5180. }
  5181. return result;
  5182. };
  5183. }
  5184. /**
  5185. * Checks if `path` exists on `object`.
  5186. *
  5187. * @private
  5188. * @param {Object} object The object to query.
  5189. * @param {Array|string} path The path to check.
  5190. * @param {Function} hasFunc The function to check properties.
  5191. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  5192. */
  5193. function hasPath(object, path, hasFunc) {
  5194. path = isKey(path, object) ? [path] : castPath(path);
  5195. var result,
  5196. index = -1,
  5197. length = path.length;
  5198. while (++index < length) {
  5199. var key = toKey(path[index]);
  5200. if (!(result = object != null && hasFunc(object, key))) {
  5201. break;
  5202. }
  5203. object = object[key];
  5204. }
  5205. if (result) {
  5206. return result;
  5207. }
  5208. var length = object ? object.length : 0;
  5209. return !!length && isLength(length) && isIndex(key, length) &&
  5210. (isArray(object) || isArguments(object));
  5211. }
  5212. /**
  5213. * Checks if `value` is a valid array-like index.
  5214. *
  5215. * @private
  5216. * @param {*} value The value to check.
  5217. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  5218. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  5219. */
  5220. function isIndex(value, length) {
  5221. length = length == null ? MAX_SAFE_INTEGER : length;
  5222. return !!length &&
  5223. (typeof value == 'number' || reIsUint.test(value)) &&
  5224. (value > -1 && value % 1 == 0 && value < length);
  5225. }
  5226. /**
  5227. * Checks if `value` is a property name and not a property path.
  5228. *
  5229. * @private
  5230. * @param {*} value The value to check.
  5231. * @param {Object} [object] The object to query keys on.
  5232. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  5233. */
  5234. function isKey(value, object) {
  5235. if (isArray(value)) {
  5236. return false;
  5237. }
  5238. var type = typeof value;
  5239. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  5240. value == null || isSymbol(value)) {
  5241. return true;
  5242. }
  5243. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  5244. (object != null && value in Object(object));
  5245. }
  5246. /**
  5247. * Checks if `value` is suitable for use as unique object key.
  5248. *
  5249. * @private
  5250. * @param {*} value The value to check.
  5251. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  5252. */
  5253. function isKeyable(value) {
  5254. var type = typeof value;
  5255. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  5256. ? (value !== '__proto__')
  5257. : (value === null);
  5258. }
  5259. /**
  5260. * Checks if `func` has its source masked.
  5261. *
  5262. * @private
  5263. * @param {Function} func The function to check.
  5264. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  5265. */
  5266. function isMasked(func) {
  5267. return !!maskSrcKey && (maskSrcKey in func);
  5268. }
  5269. /**
  5270. * Checks if `value` is likely a prototype object.
  5271. *
  5272. * @private
  5273. * @param {*} value The value to check.
  5274. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  5275. */
  5276. function isPrototype(value) {
  5277. var Ctor = value && value.constructor,
  5278. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  5279. return value === proto;
  5280. }
  5281. /**
  5282. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  5283. *
  5284. * @private
  5285. * @param {*} value The value to check.
  5286. * @returns {boolean} Returns `true` if `value` if suitable for strict
  5287. * equality comparisons, else `false`.
  5288. */
  5289. function isStrictComparable(value) {
  5290. return value === value && !isObject(value);
  5291. }
  5292. /**
  5293. * A specialized version of `matchesProperty` for source values suitable
  5294. * for strict equality comparisons, i.e. `===`.
  5295. *
  5296. * @private
  5297. * @param {string} key The key of the property to get.
  5298. * @param {*} srcValue The value to match.
  5299. * @returns {Function} Returns the new spec function.
  5300. */
  5301. function matchesStrictComparable(key, srcValue) {
  5302. return function(object) {
  5303. if (object == null) {
  5304. return false;
  5305. }
  5306. return object[key] === srcValue &&
  5307. (srcValue !== undefined || (key in Object(object)));
  5308. };
  5309. }
  5310. /**
  5311. * Converts `string` to a property path array.
  5312. *
  5313. * @private
  5314. * @param {string} string The string to convert.
  5315. * @returns {Array} Returns the property path array.
  5316. */
  5317. var stringToPath = memoize(function(string) {
  5318. string = toString(string);
  5319. var result = [];
  5320. if (reLeadingDot.test(string)) {
  5321. result.push('');
  5322. }
  5323. string.replace(rePropName, function(match, number, quote, string) {
  5324. result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
  5325. });
  5326. return result;
  5327. });
  5328. /**
  5329. * Converts `value` to a string key if it's not a string or symbol.
  5330. *
  5331. * @private
  5332. * @param {*} value The value to inspect.
  5333. * @returns {string|symbol} Returns the key.
  5334. */
  5335. function toKey(value) {
  5336. if (typeof value == 'string' || isSymbol(value)) {
  5337. return value;
  5338. }
  5339. var result = (value + '');
  5340. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  5341. }
  5342. /**
  5343. * Converts `func` to its source code.
  5344. *
  5345. * @private
  5346. * @param {Function} func The function to process.
  5347. * @returns {string} Returns the source code.
  5348. */
  5349. function toSource(func) {
  5350. if (func != null) {
  5351. try {
  5352. return funcToString.call(func);
  5353. } catch (e) {}
  5354. try {
  5355. return (func + '');
  5356. } catch (e) {}
  5357. }
  5358. return '';
  5359. }
  5360. /**
  5361. * This method is like `_.uniq` except that it accepts `iteratee` which is
  5362. * invoked for each element in `array` to generate the criterion by which
  5363. * uniqueness is computed. The iteratee is invoked with one argument: (value).
  5364. *
  5365. * @static
  5366. * @memberOf _
  5367. * @since 4.0.0
  5368. * @category Array
  5369. * @param {Array} array The array to inspect.
  5370. * @param {Function} [iteratee=_.identity]
  5371. * The iteratee invoked per element.
  5372. * @returns {Array} Returns the new duplicate free array.
  5373. * @example
  5374. *
  5375. * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
  5376. * // => [2.1, 1.2]
  5377. *
  5378. * // The `_.property` iteratee shorthand.
  5379. * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
  5380. * // => [{ 'x': 1 }, { 'x': 2 }]
  5381. */
  5382. function uniqBy(array, iteratee) {
  5383. return (array && array.length)
  5384. ? baseUniq(array, baseIteratee(iteratee, 2))
  5385. : [];
  5386. }
  5387. /**
  5388. * Creates a function that memoizes the result of `func`. If `resolver` is
  5389. * provided, it determines the cache key for storing the result based on the
  5390. * arguments provided to the memoized function. By default, the first argument
  5391. * provided to the memoized function is used as the map cache key. The `func`
  5392. * is invoked with the `this` binding of the memoized function.
  5393. *
  5394. * **Note:** The cache is exposed as the `cache` property on the memoized
  5395. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  5396. * constructor with one whose instances implement the
  5397. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  5398. * method interface of `delete`, `get`, `has`, and `set`.
  5399. *
  5400. * @static
  5401. * @memberOf _
  5402. * @since 0.1.0
  5403. * @category Function
  5404. * @param {Function} func The function to have its output memoized.
  5405. * @param {Function} [resolver] The function to resolve the cache key.
  5406. * @returns {Function} Returns the new memoized function.
  5407. * @example
  5408. *
  5409. * var object = { 'a': 1, 'b': 2 };
  5410. * var other = { 'c': 3, 'd': 4 };
  5411. *
  5412. * var values = _.memoize(_.values);
  5413. * values(object);
  5414. * // => [1, 2]
  5415. *
  5416. * values(other);
  5417. * // => [3, 4]
  5418. *
  5419. * object.a = 2;
  5420. * values(object);
  5421. * // => [1, 2]
  5422. *
  5423. * // Modify the result cache.
  5424. * values.cache.set(object, ['a', 'b']);
  5425. * values(object);
  5426. * // => ['a', 'b']
  5427. *
  5428. * // Replace `_.memoize.Cache`.
  5429. * _.memoize.Cache = WeakMap;
  5430. */
  5431. function memoize(func, resolver) {
  5432. if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
  5433. throw new TypeError(FUNC_ERROR_TEXT);
  5434. }
  5435. var memoized = function() {
  5436. var args = arguments,
  5437. key = resolver ? resolver.apply(this, args) : args[0],
  5438. cache = memoized.cache;
  5439. if (cache.has(key)) {
  5440. return cache.get(key);
  5441. }
  5442. var result = func.apply(this, args);
  5443. memoized.cache = cache.set(key, result);
  5444. return result;
  5445. };
  5446. memoized.cache = new (memoize.Cache || MapCache);
  5447. return memoized;
  5448. }
  5449. // Assign cache to `_.memoize`.
  5450. memoize.Cache = MapCache;
  5451. /**
  5452. * Performs a
  5453. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  5454. * comparison between two values to determine if they are equivalent.
  5455. *
  5456. * @static
  5457. * @memberOf _
  5458. * @since 4.0.0
  5459. * @category Lang
  5460. * @param {*} value The value to compare.
  5461. * @param {*} other The other value to compare.
  5462. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  5463. * @example
  5464. *
  5465. * var object = { 'a': 1 };
  5466. * var other = { 'a': 1 };
  5467. *
  5468. * _.eq(object, object);
  5469. * // => true
  5470. *
  5471. * _.eq(object, other);
  5472. * // => false
  5473. *
  5474. * _.eq('a', 'a');
  5475. * // => true
  5476. *
  5477. * _.eq('a', Object('a'));
  5478. * // => false
  5479. *
  5480. * _.eq(NaN, NaN);
  5481. * // => true
  5482. */
  5483. function eq(value, other) {
  5484. return value === other || (value !== value && other !== other);
  5485. }
  5486. /**
  5487. * Checks if `value` is likely an `arguments` object.
  5488. *
  5489. * @static
  5490. * @memberOf _
  5491. * @since 0.1.0
  5492. * @category Lang
  5493. * @param {*} value The value to check.
  5494. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  5495. * else `false`.
  5496. * @example
  5497. *
  5498. * _.isArguments(function() { return arguments; }());
  5499. * // => true
  5500. *
  5501. * _.isArguments([1, 2, 3]);
  5502. * // => false
  5503. */
  5504. function isArguments(value) {
  5505. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  5506. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
  5507. (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
  5508. }
  5509. /**
  5510. * Checks if `value` is classified as an `Array` object.
  5511. *
  5512. * @static
  5513. * @memberOf _
  5514. * @since 0.1.0
  5515. * @category Lang
  5516. * @param {*} value The value to check.
  5517. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  5518. * @example
  5519. *
  5520. * _.isArray([1, 2, 3]);
  5521. * // => true
  5522. *
  5523. * _.isArray(document.body.children);
  5524. * // => false
  5525. *
  5526. * _.isArray('abc');
  5527. * // => false
  5528. *
  5529. * _.isArray(_.noop);
  5530. * // => false
  5531. */
  5532. var isArray = Array.isArray;
  5533. /**
  5534. * Checks if `value` is array-like. A value is considered array-like if it's
  5535. * not a function and has a `value.length` that's an integer greater than or
  5536. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  5537. *
  5538. * @static
  5539. * @memberOf _
  5540. * @since 4.0.0
  5541. * @category Lang
  5542. * @param {*} value The value to check.
  5543. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  5544. * @example
  5545. *
  5546. * _.isArrayLike([1, 2, 3]);
  5547. * // => true
  5548. *
  5549. * _.isArrayLike(document.body.children);
  5550. * // => true
  5551. *
  5552. * _.isArrayLike('abc');
  5553. * // => true
  5554. *
  5555. * _.isArrayLike(_.noop);
  5556. * // => false
  5557. */
  5558. function isArrayLike(value) {
  5559. return value != null && isLength(value.length) && !isFunction(value);
  5560. }
  5561. /**
  5562. * This method is like `_.isArrayLike` except that it also checks if `value`
  5563. * is an object.
  5564. *
  5565. * @static
  5566. * @memberOf _
  5567. * @since 4.0.0
  5568. * @category Lang
  5569. * @param {*} value The value to check.
  5570. * @returns {boolean} Returns `true` if `value` is an array-like object,
  5571. * else `false`.
  5572. * @example
  5573. *
  5574. * _.isArrayLikeObject([1, 2, 3]);
  5575. * // => true
  5576. *
  5577. * _.isArrayLikeObject(document.body.children);
  5578. * // => true
  5579. *
  5580. * _.isArrayLikeObject('abc');
  5581. * // => false
  5582. *
  5583. * _.isArrayLikeObject(_.noop);
  5584. * // => false
  5585. */
  5586. function isArrayLikeObject(value) {
  5587. return isObjectLike(value) && isArrayLike(value);
  5588. }
  5589. /**
  5590. * Checks if `value` is classified as a `Function` object.
  5591. *
  5592. * @static
  5593. * @memberOf _
  5594. * @since 0.1.0
  5595. * @category Lang
  5596. * @param {*} value The value to check.
  5597. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  5598. * @example
  5599. *
  5600. * _.isFunction(_);
  5601. * // => true
  5602. *
  5603. * _.isFunction(/abc/);
  5604. * // => false
  5605. */
  5606. function isFunction(value) {
  5607. // The use of `Object#toString` avoids issues with the `typeof` operator
  5608. // in Safari 8-9 which returns 'object' for typed array and other constructors.
  5609. var tag = isObject(value) ? objectToString.call(value) : '';
  5610. return tag == funcTag || tag == genTag;
  5611. }
  5612. /**
  5613. * Checks if `value` is a valid array-like length.
  5614. *
  5615. * **Note:** This method is loosely based on
  5616. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  5617. *
  5618. * @static
  5619. * @memberOf _
  5620. * @since 4.0.0
  5621. * @category Lang
  5622. * @param {*} value The value to check.
  5623. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  5624. * @example
  5625. *
  5626. * _.isLength(3);
  5627. * // => true
  5628. *
  5629. * _.isLength(Number.MIN_VALUE);
  5630. * // => false
  5631. *
  5632. * _.isLength(Infinity);
  5633. * // => false
  5634. *
  5635. * _.isLength('3');
  5636. * // => false
  5637. */
  5638. function isLength(value) {
  5639. return typeof value == 'number' &&
  5640. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  5641. }
  5642. /**
  5643. * Checks if `value` is the
  5644. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  5645. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  5646. *
  5647. * @static
  5648. * @memberOf _
  5649. * @since 0.1.0
  5650. * @category Lang
  5651. * @param {*} value The value to check.
  5652. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  5653. * @example
  5654. *
  5655. * _.isObject({});
  5656. * // => true
  5657. *
  5658. * _.isObject([1, 2, 3]);
  5659. * // => true
  5660. *
  5661. * _.isObject(_.noop);
  5662. * // => true
  5663. *
  5664. * _.isObject(null);
  5665. * // => false
  5666. */
  5667. function isObject(value) {
  5668. var type = typeof value;
  5669. return !!value && (type == 'object' || type == 'function');
  5670. }
  5671. /**
  5672. * Checks if `value` is object-like. A value is object-like if it's not `null`
  5673. * and has a `typeof` result of "object".
  5674. *
  5675. * @static
  5676. * @memberOf _
  5677. * @since 4.0.0
  5678. * @category Lang
  5679. * @param {*} value The value to check.
  5680. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  5681. * @example
  5682. *
  5683. * _.isObjectLike({});
  5684. * // => true
  5685. *
  5686. * _.isObjectLike([1, 2, 3]);
  5687. * // => true
  5688. *
  5689. * _.isObjectLike(_.noop);
  5690. * // => false
  5691. *
  5692. * _.isObjectLike(null);
  5693. * // => false
  5694. */
  5695. function isObjectLike(value) {
  5696. return !!value && typeof value == 'object';
  5697. }
  5698. /**
  5699. * Checks if `value` is classified as a `Symbol` primitive or object.
  5700. *
  5701. * @static
  5702. * @memberOf _
  5703. * @since 4.0.0
  5704. * @category Lang
  5705. * @param {*} value The value to check.
  5706. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  5707. * @example
  5708. *
  5709. * _.isSymbol(Symbol.iterator);
  5710. * // => true
  5711. *
  5712. * _.isSymbol('abc');
  5713. * // => false
  5714. */
  5715. function isSymbol(value) {
  5716. return typeof value == 'symbol' ||
  5717. (isObjectLike(value) && objectToString.call(value) == symbolTag);
  5718. }
  5719. /**
  5720. * Checks if `value` is classified as a typed array.
  5721. *
  5722. * @static
  5723. * @memberOf _
  5724. * @since 3.0.0
  5725. * @category Lang
  5726. * @param {*} value The value to check.
  5727. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  5728. * @example
  5729. *
  5730. * _.isTypedArray(new Uint8Array);
  5731. * // => true
  5732. *
  5733. * _.isTypedArray([]);
  5734. * // => false
  5735. */
  5736. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  5737. /**
  5738. * Converts `value` to a string. An empty string is returned for `null`
  5739. * and `undefined` values. The sign of `-0` is preserved.
  5740. *
  5741. * @static
  5742. * @memberOf _
  5743. * @since 4.0.0
  5744. * @category Lang
  5745. * @param {*} value The value to process.
  5746. * @returns {string} Returns the string.
  5747. * @example
  5748. *
  5749. * _.toString(null);
  5750. * // => ''
  5751. *
  5752. * _.toString(-0);
  5753. * // => '-0'
  5754. *
  5755. * _.toString([1, 2, 3]);
  5756. * // => '1,2,3'
  5757. */
  5758. function toString(value) {
  5759. return value == null ? '' : baseToString(value);
  5760. }
  5761. /**
  5762. * Gets the value at `path` of `object`. If the resolved value is
  5763. * `undefined`, the `defaultValue` is returned in its place.
  5764. *
  5765. * @static
  5766. * @memberOf _
  5767. * @since 3.7.0
  5768. * @category Object
  5769. * @param {Object} object The object to query.
  5770. * @param {Array|string} path The path of the property to get.
  5771. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  5772. * @returns {*} Returns the resolved value.
  5773. * @example
  5774. *
  5775. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  5776. *
  5777. * _.get(object, 'a[0].b.c');
  5778. * // => 3
  5779. *
  5780. * _.get(object, ['a', '0', 'b', 'c']);
  5781. * // => 3
  5782. *
  5783. * _.get(object, 'a.b.c', 'default');
  5784. * // => 'default'
  5785. */
  5786. function get(object, path, defaultValue) {
  5787. var result = object == null ? undefined : baseGet(object, path);
  5788. return result === undefined ? defaultValue : result;
  5789. }
  5790. /**
  5791. * Checks if `path` is a direct or inherited property of `object`.
  5792. *
  5793. * @static
  5794. * @memberOf _
  5795. * @since 4.0.0
  5796. * @category Object
  5797. * @param {Object} object The object to query.
  5798. * @param {Array|string} path The path to check.
  5799. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  5800. * @example
  5801. *
  5802. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  5803. *
  5804. * _.hasIn(object, 'a');
  5805. * // => true
  5806. *
  5807. * _.hasIn(object, 'a.b');
  5808. * // => true
  5809. *
  5810. * _.hasIn(object, ['a', 'b']);
  5811. * // => true
  5812. *
  5813. * _.hasIn(object, 'b');
  5814. * // => false
  5815. */
  5816. function hasIn(object, path) {
  5817. return object != null && hasPath(object, path, baseHasIn);
  5818. }
  5819. /**
  5820. * Creates an array of the own enumerable property names of `object`.
  5821. *
  5822. * **Note:** Non-object values are coerced to objects. See the
  5823. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  5824. * for more details.
  5825. *
  5826. * @static
  5827. * @since 0.1.0
  5828. * @memberOf _
  5829. * @category Object
  5830. * @param {Object} object The object to query.
  5831. * @returns {Array} Returns the array of property names.
  5832. * @example
  5833. *
  5834. * function Foo() {
  5835. * this.a = 1;
  5836. * this.b = 2;
  5837. * }
  5838. *
  5839. * Foo.prototype.c = 3;
  5840. *
  5841. * _.keys(new Foo);
  5842. * // => ['a', 'b'] (iteration order is not guaranteed)
  5843. *
  5844. * _.keys('hi');
  5845. * // => ['0', '1']
  5846. */
  5847. function keys(object) {
  5848. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  5849. }
  5850. /**
  5851. * This method returns the first argument it receives.
  5852. *
  5853. * @static
  5854. * @since 0.1.0
  5855. * @memberOf _
  5856. * @category Util
  5857. * @param {*} value Any value.
  5858. * @returns {*} Returns `value`.
  5859. * @example
  5860. *
  5861. * var object = { 'a': 1 };
  5862. *
  5863. * console.log(_.identity(object) === object);
  5864. * // => true
  5865. */
  5866. function identity(value) {
  5867. return value;
  5868. }
  5869. /**
  5870. * This method returns `undefined`.
  5871. *
  5872. * @static
  5873. * @memberOf _
  5874. * @since 2.3.0
  5875. * @category Util
  5876. * @example
  5877. *
  5878. * _.times(2, _.noop);
  5879. * // => [undefined, undefined]
  5880. */
  5881. function noop() {
  5882. // No operation performed.
  5883. }
  5884. /**
  5885. * Creates a function that returns the value at `path` of a given object.
  5886. *
  5887. * @static
  5888. * @memberOf _
  5889. * @since 2.4.0
  5890. * @category Util
  5891. * @param {Array|string} path The path of the property to get.
  5892. * @returns {Function} Returns the new accessor function.
  5893. * @example
  5894. *
  5895. * var objects = [
  5896. * { 'a': { 'b': 2 } },
  5897. * { 'a': { 'b': 1 } }
  5898. * ];
  5899. *
  5900. * _.map(objects, _.property('a.b'));
  5901. * // => [2, 1]
  5902. *
  5903. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  5904. * // => [1, 2]
  5905. */
  5906. function property(path) {
  5907. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  5908. }
  5909. module.exports = uniqBy;
  5910. /***/ }),
  5911. /***/ 107:
  5912. /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
  5913. (function (global, factory) {
  5914. true ? factory() :
  5915. 0;
  5916. }(this, (function () { 'use strict';
  5917. /**
  5918. * @this {Promise}
  5919. */
  5920. function finallyConstructor(callback) {
  5921. var constructor = this.constructor;
  5922. return this.then(
  5923. function(value) {
  5924. // @ts-ignore
  5925. return constructor.resolve(callback()).then(function() {
  5926. return value;
  5927. });
  5928. },
  5929. function(reason) {
  5930. // @ts-ignore
  5931. return constructor.resolve(callback()).then(function() {
  5932. // @ts-ignore
  5933. return constructor.reject(reason);
  5934. });
  5935. }
  5936. );
  5937. }
  5938. function allSettled(arr) {
  5939. var P = this;
  5940. return new P(function(resolve, reject) {
  5941. if (!(arr && typeof arr.length !== 'undefined')) {
  5942. return reject(
  5943. new TypeError(
  5944. typeof arr +
  5945. ' ' +
  5946. arr +
  5947. ' is not iterable(cannot read property Symbol(Symbol.iterator))'
  5948. )
  5949. );
  5950. }
  5951. var args = Array.prototype.slice.call(arr);
  5952. if (args.length === 0) return resolve([]);
  5953. var remaining = args.length;
  5954. function res(i, val) {
  5955. if (val && (typeof val === 'object' || typeof val === 'function')) {
  5956. var then = val.then;
  5957. if (typeof then === 'function') {
  5958. then.call(
  5959. val,
  5960. function(val) {
  5961. res(i, val);
  5962. },
  5963. function(e) {
  5964. args[i] = { status: 'rejected', reason: e };
  5965. if (--remaining === 0) {
  5966. resolve(args);
  5967. }
  5968. }
  5969. );
  5970. return;
  5971. }
  5972. }
  5973. args[i] = { status: 'fulfilled', value: val };
  5974. if (--remaining === 0) {
  5975. resolve(args);
  5976. }
  5977. }
  5978. for (var i = 0; i < args.length; i++) {
  5979. res(i, args[i]);
  5980. }
  5981. });
  5982. }
  5983. // Store setTimeout reference so promise-polyfill will be unaffected by
  5984. // other code modifying setTimeout (like sinon.useFakeTimers())
  5985. var setTimeoutFunc = setTimeout;
  5986. function isArray(x) {
  5987. return Boolean(x && typeof x.length !== 'undefined');
  5988. }
  5989. function noop() {}
  5990. // Polyfill for Function.prototype.bind
  5991. function bind(fn, thisArg) {
  5992. return function() {
  5993. fn.apply(thisArg, arguments);
  5994. };
  5995. }
  5996. /**
  5997. * @constructor
  5998. * @param {Function} fn
  5999. */
  6000. function Promise(fn) {
  6001. if (!(this instanceof Promise))
  6002. throw new TypeError('Promises must be constructed via new');
  6003. if (typeof fn !== 'function') throw new TypeError('not a function');
  6004. /** @type {!number} */
  6005. this._state = 0;
  6006. /** @type {!boolean} */
  6007. this._handled = false;
  6008. /** @type {Promise|undefined} */
  6009. this._value = undefined;
  6010. /** @type {!Array<!Function>} */
  6011. this._deferreds = [];
  6012. doResolve(fn, this);
  6013. }
  6014. function handle(self, deferred) {
  6015. while (self._state === 3) {
  6016. self = self._value;
  6017. }
  6018. if (self._state === 0) {
  6019. self._deferreds.push(deferred);
  6020. return;
  6021. }
  6022. self._handled = true;
  6023. Promise._immediateFn(function() {
  6024. var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;
  6025. if (cb === null) {
  6026. (self._state === 1 ? resolve : reject)(deferred.promise, self._value);
  6027. return;
  6028. }
  6029. var ret;
  6030. try {
  6031. ret = cb(self._value);
  6032. } catch (e) {
  6033. reject(deferred.promise, e);
  6034. return;
  6035. }
  6036. resolve(deferred.promise, ret);
  6037. });
  6038. }
  6039. function resolve(self, newValue) {
  6040. try {
  6041. // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure
  6042. if (newValue === self)
  6043. throw new TypeError('A promise cannot be resolved with itself.');
  6044. if (
  6045. newValue &&
  6046. (typeof newValue === 'object' || typeof newValue === 'function')
  6047. ) {
  6048. var then = newValue.then;
  6049. if (newValue instanceof Promise) {
  6050. self._state = 3;
  6051. self._value = newValue;
  6052. finale(self);
  6053. return;
  6054. } else if (typeof then === 'function') {
  6055. doResolve(bind(then, newValue), self);
  6056. return;
  6057. }
  6058. }
  6059. self._state = 1;
  6060. self._value = newValue;
  6061. finale(self);
  6062. } catch (e) {
  6063. reject(self, e);
  6064. }
  6065. }
  6066. function reject(self, newValue) {
  6067. self._state = 2;
  6068. self._value = newValue;
  6069. finale(self);
  6070. }
  6071. function finale(self) {
  6072. if (self._state === 2 && self._deferreds.length === 0) {
  6073. Promise._immediateFn(function() {
  6074. if (!self._handled) {
  6075. Promise._unhandledRejectionFn(self._value);
  6076. }
  6077. });
  6078. }
  6079. for (var i = 0, len = self._deferreds.length; i < len; i++) {
  6080. handle(self, self._deferreds[i]);
  6081. }
  6082. self._deferreds = null;
  6083. }
  6084. /**
  6085. * @constructor
  6086. */
  6087. function Handler(onFulfilled, onRejected, promise) {
  6088. this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;
  6089. this.onRejected = typeof onRejected === 'function' ? onRejected : null;
  6090. this.promise = promise;
  6091. }
  6092. /**
  6093. * Take a potentially misbehaving resolver function and make sure
  6094. * onFulfilled and onRejected are only called once.
  6095. *
  6096. * Makes no guarantees about asynchrony.
  6097. */
  6098. function doResolve(fn, self) {
  6099. var done = false;
  6100. try {
  6101. fn(
  6102. function(value) {
  6103. if (done) return;
  6104. done = true;
  6105. resolve(self, value);
  6106. },
  6107. function(reason) {
  6108. if (done) return;
  6109. done = true;
  6110. reject(self, reason);
  6111. }
  6112. );
  6113. } catch (ex) {
  6114. if (done) return;
  6115. done = true;
  6116. reject(self, ex);
  6117. }
  6118. }
  6119. Promise.prototype['catch'] = function(onRejected) {
  6120. return this.then(null, onRejected);
  6121. };
  6122. Promise.prototype.then = function(onFulfilled, onRejected) {
  6123. // @ts-ignore
  6124. var prom = new this.constructor(noop);
  6125. handle(this, new Handler(onFulfilled, onRejected, prom));
  6126. return prom;
  6127. };
  6128. Promise.prototype['finally'] = finallyConstructor;
  6129. Promise.all = function(arr) {
  6130. return new Promise(function(resolve, reject) {
  6131. if (!isArray(arr)) {
  6132. return reject(new TypeError('Promise.all accepts an array'));
  6133. }
  6134. var args = Array.prototype.slice.call(arr);
  6135. if (args.length === 0) return resolve([]);
  6136. var remaining = args.length;
  6137. function res(i, val) {
  6138. try {
  6139. if (val && (typeof val === 'object' || typeof val === 'function')) {
  6140. var then = val.then;
  6141. if (typeof then === 'function') {
  6142. then.call(
  6143. val,
  6144. function(val) {
  6145. res(i, val);
  6146. },
  6147. reject
  6148. );
  6149. return;
  6150. }
  6151. }
  6152. args[i] = val;
  6153. if (--remaining === 0) {
  6154. resolve(args);
  6155. }
  6156. } catch (ex) {
  6157. reject(ex);
  6158. }
  6159. }
  6160. for (var i = 0; i < args.length; i++) {
  6161. res(i, args[i]);
  6162. }
  6163. });
  6164. };
  6165. Promise.allSettled = allSettled;
  6166. Promise.resolve = function(value) {
  6167. if (value && typeof value === 'object' && value.constructor === Promise) {
  6168. return value;
  6169. }
  6170. return new Promise(function(resolve) {
  6171. resolve(value);
  6172. });
  6173. };
  6174. Promise.reject = function(value) {
  6175. return new Promise(function(resolve, reject) {
  6176. reject(value);
  6177. });
  6178. };
  6179. Promise.race = function(arr) {
  6180. return new Promise(function(resolve, reject) {
  6181. if (!isArray(arr)) {
  6182. return reject(new TypeError('Promise.race accepts an array'));
  6183. }
  6184. for (var i = 0, len = arr.length; i < len; i++) {
  6185. Promise.resolve(arr[i]).then(resolve, reject);
  6186. }
  6187. });
  6188. };
  6189. // Use polyfill for setImmediate for performance gains
  6190. Promise._immediateFn =
  6191. // @ts-ignore
  6192. (typeof setImmediate === 'function' &&
  6193. function(fn) {
  6194. // @ts-ignore
  6195. setImmediate(fn);
  6196. }) ||
  6197. function(fn) {
  6198. setTimeoutFunc(fn, 0);
  6199. };
  6200. Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) {
  6201. if (typeof console !== 'undefined' && console) {
  6202. console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console
  6203. }
  6204. };
  6205. /** @suppress {undefinedVars} */
  6206. var globalNS = (function() {
  6207. // the only reliable means to get the global object is
  6208. // `Function('return this')()`
  6209. // However, this causes CSP violations in Chrome apps.
  6210. if (typeof self !== 'undefined') {
  6211. return self;
  6212. }
  6213. if (typeof window !== 'undefined') {
  6214. return window;
  6215. }
  6216. if (typeof __webpack_require__.g !== 'undefined') {
  6217. return __webpack_require__.g;
  6218. }
  6219. throw new Error('unable to locate global object');
  6220. })();
  6221. // Expose the polyfill if Promise is undefined or set to a
  6222. // non-function value. The latter can be due to a named HTMLElement
  6223. // being exposed by browsers for legacy reasons.
  6224. // https://github.com/taylorhakes/promise-polyfill/issues/114
  6225. if (typeof globalNS['Promise'] !== 'function') {
  6226. globalNS['Promise'] = Promise;
  6227. } else {
  6228. if (!globalNS.Promise.prototype['finally']) {
  6229. globalNS.Promise.prototype['finally'] = finallyConstructor;
  6230. }
  6231. if (!globalNS.Promise.allSettled) {
  6232. globalNS.Promise.allSettled = allSettled;
  6233. }
  6234. }
  6235. })));
  6236. /***/ }),
  6237. /***/ 166:
  6238. /***/ (function(module) {
  6239. (function (global, factory) {
  6240. true ? module.exports = factory() :
  6241. 0;
  6242. }(this, (function () { 'use strict';
  6243. function quickselect(arr, k, left, right, compare) {
  6244. quickselectStep(arr, k, left || 0, right || (arr.length - 1), compare || defaultCompare);
  6245. }
  6246. function quickselectStep(arr, k, left, right, compare) {
  6247. while (right > left) {
  6248. if (right - left > 600) {
  6249. var n = right - left + 1;
  6250. var m = k - left + 1;
  6251. var z = Math.log(n);
  6252. var s = 0.5 * Math.exp(2 * z / 3);
  6253. var sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);
  6254. var newLeft = Math.max(left, Math.floor(k - m * s / n + sd));
  6255. var newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));
  6256. quickselectStep(arr, k, newLeft, newRight, compare);
  6257. }
  6258. var t = arr[k];
  6259. var i = left;
  6260. var j = right;
  6261. swap(arr, left, k);
  6262. if (compare(arr[right], t) > 0) swap(arr, left, right);
  6263. while (i < j) {
  6264. swap(arr, i, j);
  6265. i++;
  6266. j--;
  6267. while (compare(arr[i], t) < 0) i++;
  6268. while (compare(arr[j], t) > 0) j--;
  6269. }
  6270. if (compare(arr[left], t) === 0) swap(arr, left, j);
  6271. else {
  6272. j++;
  6273. swap(arr, j, right);
  6274. }
  6275. if (j <= k) left = j + 1;
  6276. if (k <= j) right = j - 1;
  6277. }
  6278. }
  6279. function swap(arr, i, j) {
  6280. var tmp = arr[i];
  6281. arr[i] = arr[j];
  6282. arr[j] = tmp;
  6283. }
  6284. function defaultCompare(a, b) {
  6285. return a < b ? -1 : a > b ? 1 : 0;
  6286. }
  6287. return quickselect;
  6288. })));
  6289. /***/ }),
  6290. /***/ 510:
  6291. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  6292. "use strict";
  6293. module.exports = rbush;
  6294. module.exports["default"] = rbush;
  6295. var quickselect = __webpack_require__(166);
  6296. function rbush(maxEntries, format) {
  6297. if (!(this instanceof rbush)) return new rbush(maxEntries, format);
  6298. // max entries in a node is 9 by default; min node fill is 40% for best performance
  6299. this._maxEntries = Math.max(4, maxEntries || 9);
  6300. this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
  6301. if (format) {
  6302. this._initFormat(format);
  6303. }
  6304. this.clear();
  6305. }
  6306. rbush.prototype = {
  6307. all: function () {
  6308. return this._all(this.data, []);
  6309. },
  6310. search: function (bbox) {
  6311. var node = this.data,
  6312. result = [],
  6313. toBBox = this.toBBox;
  6314. if (!intersects(bbox, node)) return result;
  6315. var nodesToSearch = [],
  6316. i, len, child, childBBox;
  6317. while (node) {
  6318. for (i = 0, len = node.children.length; i < len; i++) {
  6319. child = node.children[i];
  6320. childBBox = node.leaf ? toBBox(child) : child;
  6321. if (intersects(bbox, childBBox)) {
  6322. if (node.leaf) result.push(child);
  6323. else if (contains(bbox, childBBox)) this._all(child, result);
  6324. else nodesToSearch.push(child);
  6325. }
  6326. }
  6327. node = nodesToSearch.pop();
  6328. }
  6329. return result;
  6330. },
  6331. collides: function (bbox) {
  6332. var node = this.data,
  6333. toBBox = this.toBBox;
  6334. if (!intersects(bbox, node)) return false;
  6335. var nodesToSearch = [],
  6336. i, len, child, childBBox;
  6337. while (node) {
  6338. for (i = 0, len = node.children.length; i < len; i++) {
  6339. child = node.children[i];
  6340. childBBox = node.leaf ? toBBox(child) : child;
  6341. if (intersects(bbox, childBBox)) {
  6342. if (node.leaf || contains(bbox, childBBox)) return true;
  6343. nodesToSearch.push(child);
  6344. }
  6345. }
  6346. node = nodesToSearch.pop();
  6347. }
  6348. return false;
  6349. },
  6350. load: function (data) {
  6351. if (!(data && data.length)) return this;
  6352. if (data.length < this._minEntries) {
  6353. for (var i = 0, len = data.length; i < len; i++) {
  6354. this.insert(data[i]);
  6355. }
  6356. return this;
  6357. }
  6358. // recursively build the tree with the given data from scratch using OMT algorithm
  6359. var node = this._build(data.slice(), 0, data.length - 1, 0);
  6360. if (!this.data.children.length) {
  6361. // save as is if tree is empty
  6362. this.data = node;
  6363. } else if (this.data.height === node.height) {
  6364. // split root if trees have the same height
  6365. this._splitRoot(this.data, node);
  6366. } else {
  6367. if (this.data.height < node.height) {
  6368. // swap trees if inserted one is bigger
  6369. var tmpNode = this.data;
  6370. this.data = node;
  6371. node = tmpNode;
  6372. }
  6373. // insert the small tree into the large tree at appropriate level
  6374. this._insert(node, this.data.height - node.height - 1, true);
  6375. }
  6376. return this;
  6377. },
  6378. insert: function (item) {
  6379. if (item) this._insert(item, this.data.height - 1);
  6380. return this;
  6381. },
  6382. clear: function () {
  6383. this.data = createNode([]);
  6384. return this;
  6385. },
  6386. remove: function (item, equalsFn) {
  6387. if (!item) return this;
  6388. var node = this.data,
  6389. bbox = this.toBBox(item),
  6390. path = [],
  6391. indexes = [],
  6392. i, parent, index, goingUp;
  6393. // depth-first iterative tree traversal
  6394. while (node || path.length) {
  6395. if (!node) { // go up
  6396. node = path.pop();
  6397. parent = path[path.length - 1];
  6398. i = indexes.pop();
  6399. goingUp = true;
  6400. }
  6401. if (node.leaf) { // check current node
  6402. index = findItem(item, node.children, equalsFn);
  6403. if (index !== -1) {
  6404. // item found, remove the item and condense tree upwards
  6405. node.children.splice(index, 1);
  6406. path.push(node);
  6407. this._condense(path);
  6408. return this;
  6409. }
  6410. }
  6411. if (!goingUp && !node.leaf && contains(node, bbox)) { // go down
  6412. path.push(node);
  6413. indexes.push(i);
  6414. i = 0;
  6415. parent = node;
  6416. node = node.children[0];
  6417. } else if (parent) { // go right
  6418. i++;
  6419. node = parent.children[i];
  6420. goingUp = false;
  6421. } else node = null; // nothing found
  6422. }
  6423. return this;
  6424. },
  6425. toBBox: function (item) { return item; },
  6426. compareMinX: compareNodeMinX,
  6427. compareMinY: compareNodeMinY,
  6428. toJSON: function () { return this.data; },
  6429. fromJSON: function (data) {
  6430. this.data = data;
  6431. return this;
  6432. },
  6433. _all: function (node, result) {
  6434. var nodesToSearch = [];
  6435. while (node) {
  6436. if (node.leaf) result.push.apply(result, node.children);
  6437. else nodesToSearch.push.apply(nodesToSearch, node.children);
  6438. node = nodesToSearch.pop();
  6439. }
  6440. return result;
  6441. },
  6442. _build: function (items, left, right, height) {
  6443. var N = right - left + 1,
  6444. M = this._maxEntries,
  6445. node;
  6446. if (N <= M) {
  6447. // reached leaf level; return leaf
  6448. node = createNode(items.slice(left, right + 1));
  6449. calcBBox(node, this.toBBox);
  6450. return node;
  6451. }
  6452. if (!height) {
  6453. // target height of the bulk-loaded tree
  6454. height = Math.ceil(Math.log(N) / Math.log(M));
  6455. // target number of root entries to maximize storage utilization
  6456. M = Math.ceil(N / Math.pow(M, height - 1));
  6457. }
  6458. node = createNode([]);
  6459. node.leaf = false;
  6460. node.height = height;
  6461. // split the items into M mostly square tiles
  6462. var N2 = Math.ceil(N / M),
  6463. N1 = N2 * Math.ceil(Math.sqrt(M)),
  6464. i, j, right2, right3;
  6465. multiSelect(items, left, right, N1, this.compareMinX);
  6466. for (i = left; i <= right; i += N1) {
  6467. right2 = Math.min(i + N1 - 1, right);
  6468. multiSelect(items, i, right2, N2, this.compareMinY);
  6469. for (j = i; j <= right2; j += N2) {
  6470. right3 = Math.min(j + N2 - 1, right2);
  6471. // pack each entry recursively
  6472. node.children.push(this._build(items, j, right3, height - 1));
  6473. }
  6474. }
  6475. calcBBox(node, this.toBBox);
  6476. return node;
  6477. },
  6478. _chooseSubtree: function (bbox, node, level, path) {
  6479. var i, len, child, targetNode, area, enlargement, minArea, minEnlargement;
  6480. while (true) {
  6481. path.push(node);
  6482. if (node.leaf || path.length - 1 === level) break;
  6483. minArea = minEnlargement = Infinity;
  6484. for (i = 0, len = node.children.length; i < len; i++) {
  6485. child = node.children[i];
  6486. area = bboxArea(child);
  6487. enlargement = enlargedArea(bbox, child) - area;
  6488. // choose entry with the least area enlargement
  6489. if (enlargement < minEnlargement) {
  6490. minEnlargement = enlargement;
  6491. minArea = area < minArea ? area : minArea;
  6492. targetNode = child;
  6493. } else if (enlargement === minEnlargement) {
  6494. // otherwise choose one with the smallest area
  6495. if (area < minArea) {
  6496. minArea = area;
  6497. targetNode = child;
  6498. }
  6499. }
  6500. }
  6501. node = targetNode || node.children[0];
  6502. }
  6503. return node;
  6504. },
  6505. _insert: function (item, level, isNode) {
  6506. var toBBox = this.toBBox,
  6507. bbox = isNode ? item : toBBox(item),
  6508. insertPath = [];
  6509. // find the best node for accommodating the item, saving all nodes along the path too
  6510. var node = this._chooseSubtree(bbox, this.data, level, insertPath);
  6511. // put the item into the node
  6512. node.children.push(item);
  6513. extend(node, bbox);
  6514. // split on node overflow; propagate upwards if necessary
  6515. while (level >= 0) {
  6516. if (insertPath[level].children.length > this._maxEntries) {
  6517. this._split(insertPath, level);
  6518. level--;
  6519. } else break;
  6520. }
  6521. // adjust bboxes along the insertion path
  6522. this._adjustParentBBoxes(bbox, insertPath, level);
  6523. },
  6524. // split overflowed node into two
  6525. _split: function (insertPath, level) {
  6526. var node = insertPath[level],
  6527. M = node.children.length,
  6528. m = this._minEntries;
  6529. this._chooseSplitAxis(node, m, M);
  6530. var splitIndex = this._chooseSplitIndex(node, m, M);
  6531. var newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));
  6532. newNode.height = node.height;
  6533. newNode.leaf = node.leaf;
  6534. calcBBox(node, this.toBBox);
  6535. calcBBox(newNode, this.toBBox);
  6536. if (level) insertPath[level - 1].children.push(newNode);
  6537. else this._splitRoot(node, newNode);
  6538. },
  6539. _splitRoot: function (node, newNode) {
  6540. // split root node
  6541. this.data = createNode([node, newNode]);
  6542. this.data.height = node.height + 1;
  6543. this.data.leaf = false;
  6544. calcBBox(this.data, this.toBBox);
  6545. },
  6546. _chooseSplitIndex: function (node, m, M) {
  6547. var i, bbox1, bbox2, overlap, area, minOverlap, minArea, index;
  6548. minOverlap = minArea = Infinity;
  6549. for (i = m; i <= M - m; i++) {
  6550. bbox1 = distBBox(node, 0, i, this.toBBox);
  6551. bbox2 = distBBox(node, i, M, this.toBBox);
  6552. overlap = intersectionArea(bbox1, bbox2);
  6553. area = bboxArea(bbox1) + bboxArea(bbox2);
  6554. // choose distribution with minimum overlap
  6555. if (overlap < minOverlap) {
  6556. minOverlap = overlap;
  6557. index = i;
  6558. minArea = area < minArea ? area : minArea;
  6559. } else if (overlap === minOverlap) {
  6560. // otherwise choose distribution with minimum area
  6561. if (area < minArea) {
  6562. minArea = area;
  6563. index = i;
  6564. }
  6565. }
  6566. }
  6567. return index;
  6568. },
  6569. // sorts node children by the best axis for split
  6570. _chooseSplitAxis: function (node, m, M) {
  6571. var compareMinX = node.leaf ? this.compareMinX : compareNodeMinX,
  6572. compareMinY = node.leaf ? this.compareMinY : compareNodeMinY,
  6573. xMargin = this._allDistMargin(node, m, M, compareMinX),
  6574. yMargin = this._allDistMargin(node, m, M, compareMinY);
  6575. // if total distributions margin value is minimal for x, sort by minX,
  6576. // otherwise it's already sorted by minY
  6577. if (xMargin < yMargin) node.children.sort(compareMinX);
  6578. },
  6579. // total margin of all possible split distributions where each node is at least m full
  6580. _allDistMargin: function (node, m, M, compare) {
  6581. node.children.sort(compare);
  6582. var toBBox = this.toBBox,
  6583. leftBBox = distBBox(node, 0, m, toBBox),
  6584. rightBBox = distBBox(node, M - m, M, toBBox),
  6585. margin = bboxMargin(leftBBox) + bboxMargin(rightBBox),
  6586. i, child;
  6587. for (i = m; i < M - m; i++) {
  6588. child = node.children[i];
  6589. extend(leftBBox, node.leaf ? toBBox(child) : child);
  6590. margin += bboxMargin(leftBBox);
  6591. }
  6592. for (i = M - m - 1; i >= m; i--) {
  6593. child = node.children[i];
  6594. extend(rightBBox, node.leaf ? toBBox(child) : child);
  6595. margin += bboxMargin(rightBBox);
  6596. }
  6597. return margin;
  6598. },
  6599. _adjustParentBBoxes: function (bbox, path, level) {
  6600. // adjust bboxes along the given tree path
  6601. for (var i = level; i >= 0; i--) {
  6602. extend(path[i], bbox);
  6603. }
  6604. },
  6605. _condense: function (path) {
  6606. // go through the path, removing empty nodes and updating bboxes
  6607. for (var i = path.length - 1, siblings; i >= 0; i--) {
  6608. if (path[i].children.length === 0) {
  6609. if (i > 0) {
  6610. siblings = path[i - 1].children;
  6611. siblings.splice(siblings.indexOf(path[i]), 1);
  6612. } else this.clear();
  6613. } else calcBBox(path[i], this.toBBox);
  6614. }
  6615. },
  6616. _initFormat: function (format) {
  6617. // data format (minX, minY, maxX, maxY accessors)
  6618. // uses eval-type function compilation instead of just accepting a toBBox function
  6619. // because the algorithms are very sensitive to sorting functions performance,
  6620. // so they should be dead simple and without inner calls
  6621. var compareArr = ['return a', ' - b', ';'];
  6622. this.compareMinX = new Function('a', 'b', compareArr.join(format[0]));
  6623. this.compareMinY = new Function('a', 'b', compareArr.join(format[1]));
  6624. this.toBBox = new Function('a',
  6625. 'return {minX: a' + format[0] +
  6626. ', minY: a' + format[1] +
  6627. ', maxX: a' + format[2] +
  6628. ', maxY: a' + format[3] + '};');
  6629. }
  6630. };
  6631. function findItem(item, items, equalsFn) {
  6632. if (!equalsFn) return items.indexOf(item);
  6633. for (var i = 0; i < items.length; i++) {
  6634. if (equalsFn(item, items[i])) return i;
  6635. }
  6636. return -1;
  6637. }
  6638. // calculate node's bbox from bboxes of its children
  6639. function calcBBox(node, toBBox) {
  6640. distBBox(node, 0, node.children.length, toBBox, node);
  6641. }
  6642. // min bounding rectangle of node children from k to p-1
  6643. function distBBox(node, k, p, toBBox, destNode) {
  6644. if (!destNode) destNode = createNode(null);
  6645. destNode.minX = Infinity;
  6646. destNode.minY = Infinity;
  6647. destNode.maxX = -Infinity;
  6648. destNode.maxY = -Infinity;
  6649. for (var i = k, child; i < p; i++) {
  6650. child = node.children[i];
  6651. extend(destNode, node.leaf ? toBBox(child) : child);
  6652. }
  6653. return destNode;
  6654. }
  6655. function extend(a, b) {
  6656. a.minX = Math.min(a.minX, b.minX);
  6657. a.minY = Math.min(a.minY, b.minY);
  6658. a.maxX = Math.max(a.maxX, b.maxX);
  6659. a.maxY = Math.max(a.maxY, b.maxY);
  6660. return a;
  6661. }
  6662. function compareNodeMinX(a, b) { return a.minX - b.minX; }
  6663. function compareNodeMinY(a, b) { return a.minY - b.minY; }
  6664. function bboxArea(a) { return (a.maxX - a.minX) * (a.maxY - a.minY); }
  6665. function bboxMargin(a) { return (a.maxX - a.minX) + (a.maxY - a.minY); }
  6666. function enlargedArea(a, b) {
  6667. return (Math.max(b.maxX, a.maxX) - Math.min(b.minX, a.minX)) *
  6668. (Math.max(b.maxY, a.maxY) - Math.min(b.minY, a.minY));
  6669. }
  6670. function intersectionArea(a, b) {
  6671. var minX = Math.max(a.minX, b.minX),
  6672. minY = Math.max(a.minY, b.minY),
  6673. maxX = Math.min(a.maxX, b.maxX),
  6674. maxY = Math.min(a.maxY, b.maxY);
  6675. return Math.max(0, maxX - minX) *
  6676. Math.max(0, maxY - minY);
  6677. }
  6678. function contains(a, b) {
  6679. return a.minX <= b.minX &&
  6680. a.minY <= b.minY &&
  6681. b.maxX <= a.maxX &&
  6682. b.maxY <= a.maxY;
  6683. }
  6684. function intersects(a, b) {
  6685. return b.minX <= a.maxX &&
  6686. b.minY <= a.maxY &&
  6687. b.maxX >= a.minX &&
  6688. b.maxY >= a.minY;
  6689. }
  6690. function createNode(children) {
  6691. return {
  6692. children: children,
  6693. height: 1,
  6694. leaf: true,
  6695. minX: Infinity,
  6696. minY: Infinity,
  6697. maxX: -Infinity,
  6698. maxY: -Infinity
  6699. };
  6700. }
  6701. // sort an array so that items come in groups of n unsorted items, with groups sorted between each other;
  6702. // combines selection algorithm with binary divide & conquer approach
  6703. function multiSelect(arr, left, right, n, compare) {
  6704. var stack = [left, right],
  6705. mid;
  6706. while (stack.length) {
  6707. right = stack.pop();
  6708. left = stack.pop();
  6709. if (right - left <= n) continue;
  6710. mid = left + Math.ceil((right - left) / n / 2) * n;
  6711. quickselect(arr, mid, left, right, compare);
  6712. stack.push(left, mid, mid, right);
  6713. }
  6714. }
  6715. /***/ }),
  6716. /***/ 901:
  6717. /***/ (function(module) {
  6718. // https://github.com/mbostock/slice-source Version 0.4.1. Copyright 2016 Mike Bostock.
  6719. (function (global, factory) {
  6720. true ? module.exports = factory() :
  6721. 0;
  6722. }(this, (function () { 'use strict';
  6723. var empty = new Uint8Array(0);
  6724. function slice_cancel() {
  6725. return this._source.cancel();
  6726. }
  6727. function concat(a, b) {
  6728. if (!a.length) return b;
  6729. if (!b.length) return a;
  6730. var c = new Uint8Array(a.length + b.length);
  6731. c.set(a);
  6732. c.set(b, a.length);
  6733. return c;
  6734. }
  6735. function slice_read() {
  6736. var that = this, array = that._array.subarray(that._index);
  6737. return that._source.read().then(function(result) {
  6738. that._array = empty;
  6739. that._index = 0;
  6740. return result.done ? (array.length > 0
  6741. ? {done: false, value: array}
  6742. : {done: true, value: undefined})
  6743. : {done: false, value: concat(array, result.value)};
  6744. });
  6745. }
  6746. function slice_slice(length) {
  6747. if ((length |= 0) < 0) throw new Error("invalid length");
  6748. var that = this, index = this._array.length - this._index;
  6749. // If the request fits within the remaining buffer, resolve it immediately.
  6750. if (this._index + length <= this._array.length) {
  6751. return Promise.resolve(this._array.subarray(this._index, this._index += length));
  6752. }
  6753. // Otherwise, read chunks repeatedly until the request is fulfilled.
  6754. var array = new Uint8Array(length);
  6755. array.set(this._array.subarray(this._index));
  6756. return (function read() {
  6757. return that._source.read().then(function(result) {
  6758. // When done, it’s possible the request wasn’t fully fullfilled!
  6759. // If so, the pre-allocated array is too big and needs slicing.
  6760. if (result.done) {
  6761. that._array = empty;
  6762. that._index = 0;
  6763. return index > 0 ? array.subarray(0, index) : null;
  6764. }
  6765. // If this chunk fulfills the request, return the resulting array.
  6766. if (index + result.value.length >= length) {
  6767. that._array = result.value;
  6768. that._index = length - index;
  6769. array.set(result.value.subarray(0, length - index), index);
  6770. return array;
  6771. }
  6772. // Otherwise copy this chunk into the array, then read the next chunk.
  6773. array.set(result.value, index);
  6774. index += result.value.length;
  6775. return read();
  6776. });
  6777. })();
  6778. }
  6779. function slice(source) {
  6780. return typeof source.slice === "function" ? source :
  6781. new SliceSource(typeof source.read === "function" ? source
  6782. : source.getReader());
  6783. }
  6784. function SliceSource(source) {
  6785. this._source = source;
  6786. this._array = empty;
  6787. this._index = 0;
  6788. }
  6789. SliceSource.prototype.read = slice_read;
  6790. SliceSource.prototype.slice = slice_slice;
  6791. SliceSource.prototype.cancel = slice_cancel;
  6792. return slice;
  6793. })));
  6794. /***/ }),
  6795. /***/ 982:
  6796. /***/ ((__unused_webpack_module, exports) => {
  6797. "use strict";
  6798. var __webpack_unused_export__;
  6799. __webpack_unused_export__ = ({ value: true });
  6800. /*! *****************************************************************************
  6801. Copyright (c) Microsoft Corporation.
  6802. Permission to use, copy, modify, and/or distribute this software for any
  6803. purpose with or without fee is hereby granted.
  6804. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  6805. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  6806. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  6807. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  6808. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  6809. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  6810. PERFORMANCE OF THIS SOFTWARE.
  6811. ***************************************************************************** */
  6812. /* global Reflect, Promise */
  6813. var extendStatics = function(d, b) {
  6814. extendStatics = Object.setPrototypeOf ||
  6815. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6816. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  6817. return extendStatics(d, b);
  6818. };
  6819. function __extends(d, b) {
  6820. extendStatics(d, b);
  6821. function __() { this.constructor = d; }
  6822. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6823. }
  6824. function __awaiter(thisArg, _arguments, P, generator) {
  6825. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  6826. return new (P || (P = Promise))(function (resolve, reject) {
  6827. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  6828. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  6829. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  6830. step((generator = generator.apply(thisArg, _arguments || [])).next());
  6831. });
  6832. }
  6833. function __generator(thisArg, body) {
  6834. var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
  6835. return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
  6836. function verb(n) { return function (v) { return step([n, v]); }; }
  6837. function step(op) {
  6838. if (f) throw new TypeError("Generator is already executing.");
  6839. while (_) try {
  6840. 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;
  6841. if (y = 0, t) op = [op[0] & 2, t.value];
  6842. switch (op[0]) {
  6843. case 0: case 1: t = op; break;
  6844. case 4: _.label++; return { value: op[1], done: false };
  6845. case 5: _.label++; y = op[1]; op = [0]; continue;
  6846. case 7: op = _.ops.pop(); _.trys.pop(); continue;
  6847. default:
  6848. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
  6849. if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
  6850. if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
  6851. if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
  6852. if (t[2]) _.ops.pop();
  6853. _.trys.pop(); continue;
  6854. }
  6855. op = body.call(thisArg, _);
  6856. } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
  6857. if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
  6858. }
  6859. }
  6860. function __values(o) {
  6861. var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  6862. if (m) return m.call(o);
  6863. if (o && typeof o.length === "number") return {
  6864. next: function () {
  6865. if (o && i >= o.length) o = void 0;
  6866. return { value: o && o[i++], done: !o };
  6867. }
  6868. };
  6869. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  6870. }
  6871. function __await(v) {
  6872. return this instanceof __await ? (this.v = v, this) : new __await(v);
  6873. }
  6874. function __asyncGenerator(thisArg, _arguments, generator) {
  6875. if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  6876. var g = generator.apply(thisArg, _arguments || []), i, q = [];
  6877. return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
  6878. 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); }); }; }
  6879. function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
  6880. function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
  6881. function fulfill(value) { resume("next", value); }
  6882. function reject(value) { resume("throw", value); }
  6883. function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
  6884. }
  6885. /** An error subclass which is thrown when there are too many pending push or next operations on a single repeater. */
  6886. var RepeaterOverflowError = /** @class */ (function (_super) {
  6887. __extends(RepeaterOverflowError, _super);
  6888. function RepeaterOverflowError(message) {
  6889. var _this = _super.call(this, message) || this;
  6890. Object.defineProperty(_this, "name", {
  6891. value: "RepeaterOverflowError",
  6892. enumerable: false,
  6893. });
  6894. if (typeof Object.setPrototypeOf === "function") {
  6895. Object.setPrototypeOf(_this, _this.constructor.prototype);
  6896. }
  6897. else {
  6898. _this.__proto__ = _this.constructor.prototype;
  6899. }
  6900. if (typeof Error.captureStackTrace === "function") {
  6901. Error.captureStackTrace(_this, _this.constructor);
  6902. }
  6903. return _this;
  6904. }
  6905. return RepeaterOverflowError;
  6906. }(Error));
  6907. /** A buffer which allows you to push a set amount of values to the repeater without pushes waiting or throwing errors. */
  6908. var FixedBuffer = /** @class */ (function () {
  6909. function FixedBuffer(capacity) {
  6910. if (capacity < 0) {
  6911. throw new RangeError("Capacity may not be less than 0");
  6912. }
  6913. this._c = capacity;
  6914. this._q = [];
  6915. }
  6916. Object.defineProperty(FixedBuffer.prototype, "empty", {
  6917. get: function () {
  6918. return this._q.length === 0;
  6919. },
  6920. enumerable: false,
  6921. configurable: true
  6922. });
  6923. Object.defineProperty(FixedBuffer.prototype, "full", {
  6924. get: function () {
  6925. return this._q.length >= this._c;
  6926. },
  6927. enumerable: false,
  6928. configurable: true
  6929. });
  6930. FixedBuffer.prototype.add = function (value) {
  6931. if (this.full) {
  6932. throw new Error("Buffer full");
  6933. }
  6934. else {
  6935. this._q.push(value);
  6936. }
  6937. };
  6938. FixedBuffer.prototype.remove = function () {
  6939. if (this.empty) {
  6940. throw new Error("Buffer empty");
  6941. }
  6942. return this._q.shift();
  6943. };
  6944. return FixedBuffer;
  6945. }());
  6946. // TODO: Use a circular buffer here.
  6947. /** 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. */
  6948. var SlidingBuffer = /** @class */ (function () {
  6949. function SlidingBuffer(capacity) {
  6950. if (capacity < 1) {
  6951. throw new RangeError("Capacity may not be less than 1");
  6952. }
  6953. this._c = capacity;
  6954. this._q = [];
  6955. }
  6956. Object.defineProperty(SlidingBuffer.prototype, "empty", {
  6957. get: function () {
  6958. return this._q.length === 0;
  6959. },
  6960. enumerable: false,
  6961. configurable: true
  6962. });
  6963. Object.defineProperty(SlidingBuffer.prototype, "full", {
  6964. get: function () {
  6965. return false;
  6966. },
  6967. enumerable: false,
  6968. configurable: true
  6969. });
  6970. SlidingBuffer.prototype.add = function (value) {
  6971. while (this._q.length >= this._c) {
  6972. this._q.shift();
  6973. }
  6974. this._q.push(value);
  6975. };
  6976. SlidingBuffer.prototype.remove = function () {
  6977. if (this.empty) {
  6978. throw new Error("Buffer empty");
  6979. }
  6980. return this._q.shift();
  6981. };
  6982. return SlidingBuffer;
  6983. }());
  6984. /** 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. */
  6985. var DroppingBuffer = /** @class */ (function () {
  6986. function DroppingBuffer(capacity) {
  6987. if (capacity < 1) {
  6988. throw new RangeError("Capacity may not be less than 1");
  6989. }
  6990. this._c = capacity;
  6991. this._q = [];
  6992. }
  6993. Object.defineProperty(DroppingBuffer.prototype, "empty", {
  6994. get: function () {
  6995. return this._q.length === 0;
  6996. },
  6997. enumerable: false,
  6998. configurable: true
  6999. });
  7000. Object.defineProperty(DroppingBuffer.prototype, "full", {
  7001. get: function () {
  7002. return false;
  7003. },
  7004. enumerable: false,
  7005. configurable: true
  7006. });
  7007. DroppingBuffer.prototype.add = function (value) {
  7008. if (this._q.length < this._c) {
  7009. this._q.push(value);
  7010. }
  7011. };
  7012. DroppingBuffer.prototype.remove = function () {
  7013. if (this.empty) {
  7014. throw new Error("Buffer empty");
  7015. }
  7016. return this._q.shift();
  7017. };
  7018. return DroppingBuffer;
  7019. }());
  7020. /** Makes sure promise-likes don’t cause unhandled rejections. */
  7021. function swallow(value) {
  7022. if (value != null && typeof value.then === "function") {
  7023. value.then(NOOP, NOOP);
  7024. }
  7025. }
  7026. /*** REPEATER STATES ***/
  7027. /** The following is an enumeration of all possible repeater states. These states are ordered, and a repeater may only advance to higher states. */
  7028. /** The initial state of the repeater. */
  7029. var Initial = 0;
  7030. /** Repeaters advance to this state the first time the next method is called on the repeater. */
  7031. var Started = 1;
  7032. /** Repeaters advance to this state when the stop function is called. */
  7033. var Stopped = 2;
  7034. /** Repeaters advance to this state when there are no values left to be pulled from the repeater. */
  7035. var Done = 3;
  7036. /** Repeaters advance to this state if an error is thrown into the repeater. */
  7037. var Rejected = 4;
  7038. /** The maximum number of push or next operations which may exist on a single repeater. */
  7039. var MAX_QUEUE_LENGTH = 1024;
  7040. var NOOP = function () { };
  7041. /** A helper function used to mimic the behavior of async generators where the final iteration is consumed. */
  7042. function consumeExecution(r) {
  7043. var err = r.err;
  7044. var execution = Promise.resolve(r.execution).then(function (value) {
  7045. if (err != null) {
  7046. throw err;
  7047. }
  7048. return value;
  7049. });
  7050. r.err = undefined;
  7051. r.execution = execution.then(function () { return undefined; }, function () { return undefined; });
  7052. return r.pending === undefined ? execution : r.pending.then(function () { return execution; });
  7053. }
  7054. /** A helper function for building iterations from values. Promises are unwrapped, so that iterations never have their value property set to a promise. */
  7055. function createIteration(r, value) {
  7056. var done = r.state >= Done;
  7057. return Promise.resolve(value).then(function (value) {
  7058. if (!done && r.state >= Rejected) {
  7059. return consumeExecution(r).then(function (value) { return ({
  7060. value: value,
  7061. done: true,
  7062. }); });
  7063. }
  7064. return { value: value, done: done };
  7065. });
  7066. }
  7067. /**
  7068. * This function is bound and passed to the executor as the stop argument.
  7069. *
  7070. * Advances state to Stopped.
  7071. */
  7072. function stop(r, err) {
  7073. var e_1, _a;
  7074. if (r.state >= Stopped) {
  7075. return;
  7076. }
  7077. r.state = Stopped;
  7078. r.onnext();
  7079. r.onstop();
  7080. if (r.err == null) {
  7081. r.err = err;
  7082. }
  7083. if (r.pushes.length === 0 &&
  7084. (typeof r.buffer === "undefined" || r.buffer.empty)) {
  7085. finish(r);
  7086. }
  7087. else {
  7088. try {
  7089. for (var _b = __values(r.pushes), _d = _b.next(); !_d.done; _d = _b.next()) {
  7090. var push_1 = _d.value;
  7091. push_1.resolve();
  7092. }
  7093. }
  7094. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  7095. finally {
  7096. try {
  7097. if (_d && !_d.done && (_a = _b.return)) _a.call(_b);
  7098. }
  7099. finally { if (e_1) throw e_1.error; }
  7100. }
  7101. }
  7102. }
  7103. /**
  7104. * 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.
  7105. *
  7106. * Advances state to Done.
  7107. */
  7108. function finish(r) {
  7109. var e_2, _a;
  7110. if (r.state >= Done) {
  7111. return;
  7112. }
  7113. if (r.state < Stopped) {
  7114. stop(r);
  7115. }
  7116. r.state = Done;
  7117. r.buffer = undefined;
  7118. try {
  7119. for (var _b = __values(r.nexts), _d = _b.next(); !_d.done; _d = _b.next()) {
  7120. var next = _d.value;
  7121. var execution = r.pending === undefined
  7122. ? consumeExecution(r)
  7123. : r.pending.then(function () { return consumeExecution(r); });
  7124. next.resolve(createIteration(r, execution));
  7125. }
  7126. }
  7127. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  7128. finally {
  7129. try {
  7130. if (_d && !_d.done && (_a = _b.return)) _a.call(_b);
  7131. }
  7132. finally { if (e_2) throw e_2.error; }
  7133. }
  7134. r.pushes = [];
  7135. r.nexts = [];
  7136. }
  7137. /**
  7138. * Called when a promise passed to push rejects, or when a push call is unhandled.
  7139. *
  7140. * Advances state to Rejected.
  7141. */
  7142. function reject(r) {
  7143. if (r.state >= Rejected) {
  7144. return;
  7145. }
  7146. if (r.state < Done) {
  7147. finish(r);
  7148. }
  7149. r.state = Rejected;
  7150. }
  7151. /** This function is bound and passed to the executor as the push argument. */
  7152. function push(r, value) {
  7153. swallow(value);
  7154. if (r.pushes.length >= MAX_QUEUE_LENGTH) {
  7155. throw new RepeaterOverflowError("No more than " + MAX_QUEUE_LENGTH + " pending calls to push are allowed on a single repeater.");
  7156. }
  7157. else if (r.state >= Stopped) {
  7158. return Promise.resolve(undefined);
  7159. }
  7160. var valueP = r.pending === undefined
  7161. ? Promise.resolve(value)
  7162. : r.pending.then(function () { return value; });
  7163. valueP = valueP.catch(function (err) {
  7164. if (r.state < Stopped) {
  7165. r.err = err;
  7166. }
  7167. reject(r);
  7168. return undefined; // void :(
  7169. });
  7170. var nextP;
  7171. if (r.nexts.length) {
  7172. var next_1 = r.nexts.shift();
  7173. next_1.resolve(createIteration(r, valueP));
  7174. if (r.nexts.length) {
  7175. nextP = Promise.resolve(r.nexts[0].value);
  7176. }
  7177. else {
  7178. nextP = new Promise(function (resolve) { return (r.onnext = resolve); });
  7179. }
  7180. }
  7181. else if (typeof r.buffer !== "undefined" && !r.buffer.full) {
  7182. r.buffer.add(valueP);
  7183. nextP = Promise.resolve(undefined);
  7184. }
  7185. else {
  7186. nextP = new Promise(function (resolve) { return r.pushes.push({ resolve: resolve, value: valueP }); });
  7187. }
  7188. // 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.
  7189. // 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.
  7190. var floating = true;
  7191. var next = {};
  7192. var unhandled = nextP.catch(function (err) {
  7193. if (floating) {
  7194. throw err;
  7195. }
  7196. return undefined; // void :(
  7197. });
  7198. next.then = function (onfulfilled, onrejected) {
  7199. floating = false;
  7200. return Promise.prototype.then.call(nextP, onfulfilled, onrejected);
  7201. };
  7202. next.catch = function (onrejected) {
  7203. floating = false;
  7204. return Promise.prototype.catch.call(nextP, onrejected);
  7205. };
  7206. next.finally = nextP.finally.bind(nextP);
  7207. r.pending = valueP
  7208. .then(function () { return unhandled; })
  7209. .catch(function (err) {
  7210. r.err = err;
  7211. reject(r);
  7212. });
  7213. return next;
  7214. }
  7215. /**
  7216. * Creates the stop callable promise which is passed to the executor
  7217. */
  7218. function createStop(r) {
  7219. var stop1 = stop.bind(null, r);
  7220. var stopP = new Promise(function (resolve) { return (r.onstop = resolve); });
  7221. stop1.then = stopP.then.bind(stopP);
  7222. stop1.catch = stopP.catch.bind(stopP);
  7223. stop1.finally = stopP.finally.bind(stopP);
  7224. return stop1;
  7225. }
  7226. /**
  7227. * Calls the executor passed into the constructor. This function is called the first time the next method is called on the repeater.
  7228. *
  7229. * Advances state to Started.
  7230. */
  7231. function execute(r) {
  7232. if (r.state >= Started) {
  7233. return;
  7234. }
  7235. r.state = Started;
  7236. var push1 = push.bind(null, r);
  7237. var stop1 = createStop(r);
  7238. r.execution = new Promise(function (resolve) { return resolve(r.executor(push1, stop1)); });
  7239. // TODO: We should consider stopping all repeaters when the executor settles.
  7240. r.execution.catch(function () { return stop(r); });
  7241. }
  7242. var records = new WeakMap();
  7243. // 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.
  7244. var Repeater = /** @class */ (function () {
  7245. function Repeater(executor, buffer) {
  7246. records.set(this, {
  7247. executor: executor,
  7248. buffer: buffer,
  7249. err: undefined,
  7250. state: Initial,
  7251. pushes: [],
  7252. nexts: [],
  7253. pending: undefined,
  7254. execution: undefined,
  7255. onnext: NOOP,
  7256. onstop: NOOP,
  7257. });
  7258. }
  7259. Repeater.prototype.next = function (value) {
  7260. swallow(value);
  7261. var r = records.get(this);
  7262. if (r === undefined) {
  7263. throw new Error("WeakMap error");
  7264. }
  7265. if (r.nexts.length >= MAX_QUEUE_LENGTH) {
  7266. throw new RepeaterOverflowError("No more than " + MAX_QUEUE_LENGTH + " pending calls to next are allowed on a single repeater.");
  7267. }
  7268. if (r.state <= Initial) {
  7269. execute(r);
  7270. }
  7271. r.onnext(value);
  7272. if (typeof r.buffer !== "undefined" && !r.buffer.empty) {
  7273. var result = createIteration(r, r.buffer.remove());
  7274. if (r.pushes.length) {
  7275. var push_2 = r.pushes.shift();
  7276. r.buffer.add(push_2.value);
  7277. r.onnext = push_2.resolve;
  7278. }
  7279. return result;
  7280. }
  7281. else if (r.pushes.length) {
  7282. var push_3 = r.pushes.shift();
  7283. r.onnext = push_3.resolve;
  7284. return createIteration(r, push_3.value);
  7285. }
  7286. else if (r.state >= Stopped) {
  7287. finish(r);
  7288. return createIteration(r, consumeExecution(r));
  7289. }
  7290. return new Promise(function (resolve) { return r.nexts.push({ resolve: resolve, value: value }); });
  7291. };
  7292. Repeater.prototype.return = function (value) {
  7293. swallow(value);
  7294. var r = records.get(this);
  7295. if (r === undefined) {
  7296. throw new Error("WeakMap error");
  7297. }
  7298. finish(r);
  7299. // We override the execution because return should always return the value passed in.
  7300. r.execution = Promise.resolve(r.execution).then(function () { return value; });
  7301. return createIteration(r, consumeExecution(r));
  7302. };
  7303. Repeater.prototype.throw = function (err) {
  7304. var r = records.get(this);
  7305. if (r === undefined) {
  7306. throw new Error("WeakMap error");
  7307. }
  7308. if (r.state <= Initial ||
  7309. r.state >= Stopped ||
  7310. (typeof r.buffer !== "undefined" && !r.buffer.empty)) {
  7311. finish(r);
  7312. // 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.
  7313. if (r.err == null) {
  7314. r.err = err;
  7315. }
  7316. return createIteration(r, consumeExecution(r));
  7317. }
  7318. return this.next(Promise.reject(err));
  7319. };
  7320. Repeater.prototype[Symbol.asyncIterator] = function () {
  7321. return this;
  7322. };
  7323. // TODO: Remove these static methods from the class.
  7324. Repeater.race = race;
  7325. Repeater.merge = merge;
  7326. Repeater.zip = zip;
  7327. Repeater.latest = latest;
  7328. return Repeater;
  7329. }());
  7330. /*** COMBINATOR FUNCTIONS ***/
  7331. // TODO: move these combinators to their own file.
  7332. function getIterators(values, options) {
  7333. var e_3, _a;
  7334. var iters = [];
  7335. var _loop_1 = function (value) {
  7336. if (value != null && typeof value[Symbol.asyncIterator] === "function") {
  7337. iters.push(value[Symbol.asyncIterator]());
  7338. }
  7339. else if (value != null && typeof value[Symbol.iterator] === "function") {
  7340. iters.push(value[Symbol.iterator]());
  7341. }
  7342. else {
  7343. iters.push((function valueToAsyncIterator() {
  7344. return __asyncGenerator(this, arguments, function valueToAsyncIterator_1() {
  7345. return __generator(this, function (_a) {
  7346. switch (_a.label) {
  7347. case 0:
  7348. if (!options.yieldValues) return [3 /*break*/, 3];
  7349. return [4 /*yield*/, __await(value)];
  7350. case 1: return [4 /*yield*/, _a.sent()];
  7351. case 2:
  7352. _a.sent();
  7353. _a.label = 3;
  7354. case 3:
  7355. if (!options.returnValues) return [3 /*break*/, 5];
  7356. return [4 /*yield*/, __await(value)];
  7357. case 4: return [2 /*return*/, _a.sent()];
  7358. case 5: return [2 /*return*/];
  7359. }
  7360. });
  7361. });
  7362. })());
  7363. }
  7364. };
  7365. try {
  7366. for (var values_1 = __values(values), values_1_1 = values_1.next(); !values_1_1.done; values_1_1 = values_1.next()) {
  7367. var value = values_1_1.value;
  7368. _loop_1(value);
  7369. }
  7370. }
  7371. catch (e_3_1) { e_3 = { error: e_3_1 }; }
  7372. finally {
  7373. try {
  7374. if (values_1_1 && !values_1_1.done && (_a = values_1.return)) _a.call(values_1);
  7375. }
  7376. finally { if (e_3) throw e_3.error; }
  7377. }
  7378. return iters;
  7379. }
  7380. // 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.
  7381. function race(contenders) {
  7382. var _this = this;
  7383. var iters = getIterators(contenders, { returnValues: true });
  7384. return new Repeater(function (push, stop) { return __awaiter(_this, void 0, void 0, function () {
  7385. var advance, stopped, finalIteration, iteration, i_1, _loop_2;
  7386. return __generator(this, function (_a) {
  7387. switch (_a.label) {
  7388. case 0:
  7389. if (!iters.length) {
  7390. stop();
  7391. return [2 /*return*/];
  7392. }
  7393. stopped = false;
  7394. stop.then(function () {
  7395. advance();
  7396. stopped = true;
  7397. });
  7398. _a.label = 1;
  7399. case 1:
  7400. _a.trys.push([1, , 5, 7]);
  7401. iteration = void 0;
  7402. i_1 = 0;
  7403. _loop_2 = function () {
  7404. var j, iters_1, iters_1_1, iter;
  7405. var e_4, _a;
  7406. return __generator(this, function (_b) {
  7407. switch (_b.label) {
  7408. case 0:
  7409. j = i_1;
  7410. try {
  7411. 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()) {
  7412. iter = iters_1_1.value;
  7413. Promise.resolve(iter.next()).then(function (iteration) {
  7414. if (iteration.done) {
  7415. stop();
  7416. if (finalIteration === undefined) {
  7417. finalIteration = iteration;
  7418. }
  7419. }
  7420. else if (i_1 === j) {
  7421. // This iterator has won, advance i and resolve the promise.
  7422. i_1++;
  7423. advance(iteration);
  7424. }
  7425. }, function (err) { return stop(err); });
  7426. }
  7427. }
  7428. catch (e_4_1) { e_4 = { error: e_4_1 }; }
  7429. finally {
  7430. try {
  7431. if (iters_1_1 && !iters_1_1.done && (_a = iters_1.return)) _a.call(iters_1);
  7432. }
  7433. finally { if (e_4) throw e_4.error; }
  7434. }
  7435. return [4 /*yield*/, new Promise(function (resolve) { return (advance = resolve); })];
  7436. case 1:
  7437. iteration = _b.sent();
  7438. if (!(iteration !== undefined)) return [3 /*break*/, 3];
  7439. return [4 /*yield*/, push(iteration.value)];
  7440. case 2:
  7441. _b.sent();
  7442. _b.label = 3;
  7443. case 3: return [2 /*return*/];
  7444. }
  7445. });
  7446. };
  7447. _a.label = 2;
  7448. case 2:
  7449. if (!!stopped) return [3 /*break*/, 4];
  7450. return [5 /*yield**/, _loop_2()];
  7451. case 3:
  7452. _a.sent();
  7453. return [3 /*break*/, 2];
  7454. case 4: return [2 /*return*/, finalIteration && finalIteration.value];
  7455. case 5:
  7456. stop();
  7457. return [4 /*yield*/, Promise.race(iters.map(function (iter) { return iter.return && iter.return(); }))];
  7458. case 6:
  7459. _a.sent();
  7460. return [7 /*endfinally*/];
  7461. case 7: return [2 /*return*/];
  7462. }
  7463. });
  7464. }); });
  7465. }
  7466. function merge(contenders) {
  7467. var _this = this;
  7468. var iters = getIterators(contenders, { yieldValues: true });
  7469. return new Repeater(function (push, stop) { return __awaiter(_this, void 0, void 0, function () {
  7470. var advances, stopped, finalIteration;
  7471. var _this = this;
  7472. return __generator(this, function (_a) {
  7473. switch (_a.label) {
  7474. case 0:
  7475. if (!iters.length) {
  7476. stop();
  7477. return [2 /*return*/];
  7478. }
  7479. advances = [];
  7480. stopped = false;
  7481. stop.then(function () {
  7482. var e_5, _a;
  7483. stopped = true;
  7484. try {
  7485. for (var advances_1 = __values(advances), advances_1_1 = advances_1.next(); !advances_1_1.done; advances_1_1 = advances_1.next()) {
  7486. var advance = advances_1_1.value;
  7487. advance();
  7488. }
  7489. }
  7490. catch (e_5_1) { e_5 = { error: e_5_1 }; }
  7491. finally {
  7492. try {
  7493. if (advances_1_1 && !advances_1_1.done && (_a = advances_1.return)) _a.call(advances_1);
  7494. }
  7495. finally { if (e_5) throw e_5.error; }
  7496. }
  7497. });
  7498. _a.label = 1;
  7499. case 1:
  7500. _a.trys.push([1, , 3, 4]);
  7501. return [4 /*yield*/, Promise.all(iters.map(function (iter, i) { return __awaiter(_this, void 0, void 0, function () {
  7502. var iteration, _a;
  7503. return __generator(this, function (_b) {
  7504. switch (_b.label) {
  7505. case 0:
  7506. _b.trys.push([0, , 6, 9]);
  7507. _b.label = 1;
  7508. case 1:
  7509. if (!!stopped) return [3 /*break*/, 5];
  7510. Promise.resolve(iter.next()).then(function (iteration) { return advances[i](iteration); }, function (err) { return stop(err); });
  7511. return [4 /*yield*/, new Promise(function (resolve) {
  7512. advances[i] = resolve;
  7513. })];
  7514. case 2:
  7515. iteration = _b.sent();
  7516. if (!(iteration !== undefined)) return [3 /*break*/, 4];
  7517. if (iteration.done) {
  7518. finalIteration = iteration;
  7519. return [2 /*return*/];
  7520. }
  7521. return [4 /*yield*/, push(iteration.value)];
  7522. case 3:
  7523. _b.sent();
  7524. _b.label = 4;
  7525. case 4: return [3 /*break*/, 1];
  7526. case 5: return [3 /*break*/, 9];
  7527. case 6:
  7528. _a = iter.return;
  7529. if (!_a) return [3 /*break*/, 8];
  7530. return [4 /*yield*/, iter.return()];
  7531. case 7:
  7532. _a = (_b.sent());
  7533. _b.label = 8;
  7534. case 8:
  7535. return [7 /*endfinally*/];
  7536. case 9: return [2 /*return*/];
  7537. }
  7538. });
  7539. }); }))];
  7540. case 2:
  7541. _a.sent();
  7542. return [2 /*return*/, finalIteration && finalIteration.value];
  7543. case 3:
  7544. stop();
  7545. return [7 /*endfinally*/];
  7546. case 4: return [2 /*return*/];
  7547. }
  7548. });
  7549. }); });
  7550. }
  7551. function zip(contenders) {
  7552. var _this = this;
  7553. var iters = getIterators(contenders, { returnValues: true });
  7554. return new Repeater(function (push, stop) { return __awaiter(_this, void 0, void 0, function () {
  7555. var advance, stopped, iterations, values;
  7556. return __generator(this, function (_a) {
  7557. switch (_a.label) {
  7558. case 0:
  7559. if (!iters.length) {
  7560. stop();
  7561. return [2 /*return*/, []];
  7562. }
  7563. stopped = false;
  7564. stop.then(function () {
  7565. advance();
  7566. stopped = true;
  7567. });
  7568. _a.label = 1;
  7569. case 1:
  7570. _a.trys.push([1, , 6, 8]);
  7571. _a.label = 2;
  7572. case 2:
  7573. if (!!stopped) return [3 /*break*/, 5];
  7574. Promise.all(iters.map(function (iter) { return iter.next(); })).then(function (iterations) { return advance(iterations); }, function (err) { return stop(err); });
  7575. return [4 /*yield*/, new Promise(function (resolve) { return (advance = resolve); })];
  7576. case 3:
  7577. iterations = _a.sent();
  7578. if (iterations === undefined) {
  7579. return [2 /*return*/];
  7580. }
  7581. values = iterations.map(function (iteration) { return iteration.value; });
  7582. if (iterations.some(function (iteration) { return iteration.done; })) {
  7583. return [2 /*return*/, values];
  7584. }
  7585. return [4 /*yield*/, push(values)];
  7586. case 4:
  7587. _a.sent();
  7588. return [3 /*break*/, 2];
  7589. case 5: return [3 /*break*/, 8];
  7590. case 6:
  7591. stop();
  7592. return [4 /*yield*/, Promise.all(iters.map(function (iter) { return iter.return && iter.return(); }))];
  7593. case 7:
  7594. _a.sent();
  7595. return [7 /*endfinally*/];
  7596. case 8: return [2 /*return*/];
  7597. }
  7598. });
  7599. }); });
  7600. }
  7601. function latest(contenders) {
  7602. var _this = this;
  7603. var iters = getIterators(contenders, {
  7604. yieldValues: true,
  7605. returnValues: true,
  7606. });
  7607. return new Repeater(function (push, stop) { return __awaiter(_this, void 0, void 0, function () {
  7608. var advance, advances, stopped, iterations_1, values_2;
  7609. var _this = this;
  7610. return __generator(this, function (_a) {
  7611. switch (_a.label) {
  7612. case 0:
  7613. if (!iters.length) {
  7614. stop();
  7615. return [2 /*return*/, []];
  7616. }
  7617. advances = [];
  7618. stopped = false;
  7619. stop.then(function () {
  7620. var e_6, _a;
  7621. advance();
  7622. try {
  7623. for (var advances_2 = __values(advances), advances_2_1 = advances_2.next(); !advances_2_1.done; advances_2_1 = advances_2.next()) {
  7624. var advance1 = advances_2_1.value;
  7625. advance1();
  7626. }
  7627. }
  7628. catch (e_6_1) { e_6 = { error: e_6_1 }; }
  7629. finally {
  7630. try {
  7631. if (advances_2_1 && !advances_2_1.done && (_a = advances_2.return)) _a.call(advances_2);
  7632. }
  7633. finally { if (e_6) throw e_6.error; }
  7634. }
  7635. stopped = true;
  7636. });
  7637. _a.label = 1;
  7638. case 1:
  7639. _a.trys.push([1, , 5, 7]);
  7640. Promise.all(iters.map(function (iter) { return iter.next(); })).then(function (iterations) { return advance(iterations); }, function (err) { return stop(err); });
  7641. return [4 /*yield*/, new Promise(function (resolve) { return (advance = resolve); })];
  7642. case 2:
  7643. iterations_1 = _a.sent();
  7644. if (iterations_1 === undefined) {
  7645. return [2 /*return*/];
  7646. }
  7647. values_2 = iterations_1.map(function (iteration) { return iteration.value; });
  7648. if (iterations_1.every(function (iteration) { return iteration.done; })) {
  7649. return [2 /*return*/, values_2];
  7650. }
  7651. // We continuously yield and mutate the same values array so we shallow copy it each time it is pushed.
  7652. return [4 /*yield*/, push(values_2.slice())];
  7653. case 3:
  7654. // We continuously yield and mutate the same values array so we shallow copy it each time it is pushed.
  7655. _a.sent();
  7656. return [4 /*yield*/, Promise.all(iters.map(function (iter, i) { return __awaiter(_this, void 0, void 0, function () {
  7657. var iteration;
  7658. return __generator(this, function (_a) {
  7659. switch (_a.label) {
  7660. case 0:
  7661. if (iterations_1[i].done) {
  7662. return [2 /*return*/, iterations_1[i].value];
  7663. }
  7664. _a.label = 1;
  7665. case 1:
  7666. if (!!stopped) return [3 /*break*/, 4];
  7667. Promise.resolve(iter.next()).then(function (iteration) { return advances[i](iteration); }, function (err) { return stop(err); });
  7668. return [4 /*yield*/, new Promise(function (resolve) { return (advances[i] = resolve); })];
  7669. case 2:
  7670. iteration = _a.sent();
  7671. if (iteration === undefined) {
  7672. return [2 /*return*/, iterations_1[i].value];
  7673. }
  7674. else if (iteration.done) {
  7675. return [2 /*return*/, iteration.value];
  7676. }
  7677. values_2[i] = iteration.value;
  7678. return [4 /*yield*/, push(values_2.slice())];
  7679. case 3:
  7680. _a.sent();
  7681. return [3 /*break*/, 1];
  7682. case 4: return [2 /*return*/];
  7683. }
  7684. });
  7685. }); }))];
  7686. case 4: return [2 /*return*/, _a.sent()];
  7687. case 5:
  7688. stop();
  7689. return [4 /*yield*/, Promise.all(iters.map(function (iter) { return iter.return && iter.return(); }))];
  7690. case 6:
  7691. _a.sent();
  7692. return [7 /*endfinally*/];
  7693. case 7: return [2 /*return*/];
  7694. }
  7695. });
  7696. }); });
  7697. }
  7698. __webpack_unused_export__ = DroppingBuffer;
  7699. __webpack_unused_export__ = FixedBuffer;
  7700. __webpack_unused_export__ = MAX_QUEUE_LENGTH;
  7701. exports.ZN = Repeater;
  7702. __webpack_unused_export__ = RepeaterOverflowError;
  7703. __webpack_unused_export__ = SlidingBuffer;
  7704. //# sourceMappingURL=repeater.js.map
  7705. /***/ })
  7706. /******/ });
  7707. /************************************************************************/
  7708. /******/ // The module cache
  7709. /******/ var __webpack_module_cache__ = {};
  7710. /******/
  7711. /******/ // The require function
  7712. /******/ function __webpack_require__(moduleId) {
  7713. /******/ // Check if module is in cache
  7714. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  7715. /******/ if (cachedModule !== undefined) {
  7716. /******/ return cachedModule.exports;
  7717. /******/ }
  7718. /******/ // Create a new module (and put it into the cache)
  7719. /******/ var module = __webpack_module_cache__[moduleId] = {
  7720. /******/ id: moduleId,
  7721. /******/ loaded: false,
  7722. /******/ exports: {}
  7723. /******/ };
  7724. /******/
  7725. /******/ // Execute the module function
  7726. /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  7727. /******/
  7728. /******/ // Flag the module as loaded
  7729. /******/ module.loaded = true;
  7730. /******/
  7731. /******/ // Return the exports of the module
  7732. /******/ return module.exports;
  7733. /******/ }
  7734. /******/
  7735. /************************************************************************/
  7736. /******/ /* webpack/runtime/compat get default export */
  7737. /******/ (() => {
  7738. /******/ // getDefaultExport function for compatibility with non-harmony modules
  7739. /******/ __webpack_require__.n = (module) => {
  7740. /******/ var getter = module && module.__esModule ?
  7741. /******/ () => (module['default']) :
  7742. /******/ () => (module);
  7743. /******/ __webpack_require__.d(getter, { a: getter });
  7744. /******/ return getter;
  7745. /******/ };
  7746. /******/ })();
  7747. /******/
  7748. /******/ /* webpack/runtime/define property getters */
  7749. /******/ (() => {
  7750. /******/ // define getter functions for harmony exports
  7751. /******/ __webpack_require__.d = (exports, definition) => {
  7752. /******/ for(var key in definition) {
  7753. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  7754. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  7755. /******/ }
  7756. /******/ }
  7757. /******/ };
  7758. /******/ })();
  7759. /******/
  7760. /******/ /* webpack/runtime/global */
  7761. /******/ (() => {
  7762. /******/ __webpack_require__.g = (function() {
  7763. /******/ if (typeof globalThis === 'object') return globalThis;
  7764. /******/ try {
  7765. /******/ return this || new Function('return this')();
  7766. /******/ } catch (e) {
  7767. /******/ if (typeof window === 'object') return window;
  7768. /******/ }
  7769. /******/ })();
  7770. /******/ })();
  7771. /******/
  7772. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  7773. /******/ (() => {
  7774. /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  7775. /******/ })();
  7776. /******/
  7777. /******/ /* webpack/runtime/node module decorator */
  7778. /******/ (() => {
  7779. /******/ __webpack_require__.nmd = (module) => {
  7780. /******/ module.paths = [];
  7781. /******/ if (!module.children) module.children = [];
  7782. /******/ return module;
  7783. /******/ };
  7784. /******/ })();
  7785. /******/
  7786. /************************************************************************/
  7787. var __webpack_exports__ = {};
  7788. // This entry need to be wrapped in an IIFE because it need to be in strict mode.
  7789. (() => {
  7790. "use strict";
  7791. // UNUSED EXPORTS: AddressMatchService, AggregationParameter, AggregationTypes, AlongLineDirection, AnalystAreaUnit, AnalystSizeUnit, AreaSolarRadiationParameters, ArrayStatistic, AttributesPopContainer, Bounds, Browser, BucketAggParameter, BucketAggType, BufferAnalystParameters, BufferDistance, BufferEndType, BufferRadiusUnit, BufferSetting, BuffersAnalystJobsParameter, BurstPipelineAnalystParameters, CartoCSS, ChartQueryFilterParameter, ChartQueryParameters, ChartService, ChartType, ChartView, ChartViewModel, CityTabsPage, ClientType, ClipAnalystMode, ClipParameter, ColorDictionary, ColorGradientType, ColorSpaceType, ColorsPickerUtil, CommonContainer, CommonServiceBase, CommonTheme, CommonUtil, ComponentsUtil, ComputeWeightMatrixParameters, CreateDatasetParameters, Credential, DataFlowService, DataFormat, DataItemOrderBy, DataItemType, DataReturnMode, DataReturnOption, DatasetBufferAnalystParameters, DatasetInfo, DatasetOverlayAnalystParameters, DatasetService, DatasetSurfaceAnalystParameters, DatasetThiessenAnalystParameters, DatasourceConnectionInfo, DatasourceService, DeckglLayer, DensityKernelAnalystParameters, DirectionType, DropDownBox, EditFeaturesParameters, EditType, ElasticSearch, EngineType, EntityType, Event, Events, Exponent, FGBLayer, FacilityAnalyst3DParameters, FacilityAnalystSinks3DParameters, FacilityAnalystSources3DParameters, FacilityAnalystStreamParameters, FacilityAnalystTracedown3DParameters, FacilityAnalystTraceup3DParameters, FacilityAnalystUpstream3DParameters, Feature, FeatureService, FeatureShapeFactory, FeatureTheme, FeatureThemeGraph, FeatureThemeRankSymbol, FeatureThemeVector, FeatureVector, FetchRequest, FieldParameters, FieldService, FieldStatisticsParameters, FieldsFilter, FileReaderUtil, FillGradientMode, FilterField, FilterParameter, FindClosestFacilitiesParameters, FindLocationParameters, FindMTSPPathsParameters, FindPathParameters, FindServiceAreasParameters, FindTSPPathsParameters, Format, GenerateSpatialDataParameters, GeoCodingParameter, GeoDecodingParameter, 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, GraphAxesTextDisplayMode, GraphMap, Graphic, GraphicLayer, GraticuleLayer, Grid, GridCellInfosService, GridType, HeatMapLayer, HillshadeParameter, 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, IndexTabsPageContainer, InterpolationAlgorithmType, InterpolationAnalystParameters, InterpolationDensityAnalystParameters, InterpolationIDWAnalystParameters, InterpolationKrigingAnalystParameters, InterpolationRBFAnalystParameters, JSONFormat, JoinItem, JoinType, KernelDensityJobParameter, KeyServiceParameter, KnowledgeGraph, KnowledgeGraphService, LabelBackShape, LabelImageCell, LabelMatrixCell, LabelMixedTextStyle, LabelOverLengthMode, LabelSymbolCell, LabelThemeCell, Lang, LayerInfoService, LayerStatus, LayerType, LinkItem, Logo, LonLat, MapExtend, MapService, MappingParameters, MapvLayer, MathExpressionAnalysisParameters, MeasureMode, MeasureParameters, MeasureService, MessageBox, MetricsAggParameter, MetricsAggType, NDVIParameter, NavTabsPage, NetworkAnalyst3DService, NetworkAnalystService, NetworkAnalystServiceBase, Online, OnlineData, OnlineQueryDatasParameter, OnlineServiceBase, OrderBy, OrderType, OutputSetting, OutputType, OverlapDisplayedOptions, OverlayAnalystParameters, OverlayGeoJobParameter, OverlayOperationType, PaginationContainer, PermissionType, Pixel, PixelFormat, PointWithMeasure, PopContainer, ProcessingService, ProcessingServiceBase, QueryByBoundsParameters, QueryByDistanceParameters, QueryByGeometryParameters, QueryBySQLParameters, QueryOption, QueryParameters, QueryService, RangeMode, RasterFunctionParameter, RasterFunctionType, ResourceType, Route, RouteCalculateMeasureParameters, RouteLocatorParameters, 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, SummaryAttributesJobsParameter, SummaryMeshJobParameter, SummaryRegionJobParameter, SummaryType, SuperMap, SupplyCenter, SupplyCenterType, SurfaceAnalystMethod, SurfaceAnalystParameters, SurfaceAnalystParametersSetting, TemplateBase, TerrainCurvatureCalculationParameters, TextAlignment, ThemeDotDensity, 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, ThreeLayer, TimeControlBase, TimeFlowControl, TokenServiceParameter, TopologyValidatorJobsParameter, TopologyValidatorRule, TrafficTransferAnalystService, TransferLine, TransferPathParameters, TransferPreference, TransferSolutionParameters, TransferTactic, Transform, TransportationAnalystParameter, TransportationAnalystResultSetting, TurnType, UGCLayer, UGCLayerType, UGCMapLayer, UGCSubLayer, Unit, UpdateDatasetParameters, UpdateEdgeWeightParameters, UpdateTurnNodeWeightParameters, Util, VariogramMode, Vector, VectorClipJobsParameter, WKTFormat, WebExportFormatType, WebPrintingJobContent, WebPrintingJobCustomItems, WebPrintingJobExportOptions, WebPrintingJobImage, WebPrintingJobLayers, WebPrintingJobLayoutOptions, WebPrintingJobLegendOptions, WebPrintingJobLittleMapOptions, WebPrintingJobNorthArrowOptions, WebPrintingJobParameters, WebPrintingJobScaleBarOptions, WebPrintingJobService, WebScaleOrientationType, WebScaleType, WebScaleUnit, conversionDegree, getMeterPerMapUnit, getWrapNum, isCORS, setCORS
  7792. ;// CONCATENATED MODULE: external "maplibregl"
  7793. const external_maplibregl_namespaceObject = maplibregl;
  7794. var external_maplibregl_default = /*#__PURE__*/__webpack_require__.n(external_maplibregl_namespaceObject);
  7795. ;// CONCATENATED MODULE: ./src/common/control/img/Logo.js
  7796. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  7797. * This program are made available under the terms of the Apache License, Version 2.0
  7798. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7799. 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=";
  7800. ;// CONCATENATED MODULE: ./src/maplibregl/control/Logo.js
  7801. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  7802. * This program are made available under the terms of the Apache License, Version 2.0
  7803. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7804. /**
  7805. * @class Logo
  7806. * @deprecatedclass maplibregl.supermap.LogoControl
  7807. * @category Control
  7808. * @classdesc Logo 控件类。默认不显示。
  7809. * @modulecategory Control
  7810. *
  7811. * @example
  7812. * (start code)
  7813. * map.addControl(new Logo(),'bottom-right');
  7814. * (end)
  7815. * @param {Object} options - logo 控件配置项。
  7816. * @param {string} [options.imageUrl] - logo 图片地址。
  7817. * @param {string} [options.width] - logo 图片宽度。
  7818. * @param {string} [options.height] - logo 图片高度。
  7819. * @param {string} [options.link] - logo图片跳转链接。
  7820. * @param {string} [options.alt='SuperMap iClient'] - logo 图片失效时显示文本。
  7821. * @usage
  7822. */
  7823. class Logo {
  7824. constructor(options) {
  7825. //logo图片地址
  7826. this.imageUrl = null;
  7827. //跳转链接
  7828. this.link = null;
  7829. //logo图片宽
  7830. this.width = null;
  7831. //logo图片高
  7832. this.height = null;
  7833. //logo图片失效时显示文本
  7834. this.alt = "SuperMap iClient";
  7835. this._extend(this, options)
  7836. }
  7837. /**
  7838. * @function Logo.prototype.onAdd
  7839. * @description 添加Logo。
  7840. * @returns {HTMLElement} 返回创建的 Logo 元素。
  7841. */
  7842. onAdd(map) {
  7843. this._map = map;
  7844. this._container = document.createElement('div');
  7845. this._container.className = 'maplibregl-ctrl iclient-logo';
  7846. this._container.style.marginTop = 0;
  7847. this._container.style.marginBottom = 0;
  7848. this._container.style.marginLeft = 0;
  7849. this._container.style.marginRight = 0;
  7850. var imgSrc = LogoBase64;
  7851. if (this.imageUrl) {
  7852. imgSrc = this.imageUrl;
  7853. }
  7854. var alt = this.alt;
  7855. var imageWidth = "94px";
  7856. var imageHeight = "29px";
  7857. var styleSize = "width:" + imageWidth + ";height:" + imageHeight + ";";
  7858. if (this.imageUrl) {
  7859. imageWidth = this.width;
  7860. imageHeight = this.height;
  7861. styleSize = "width:" + imageWidth + ";height:" + imageHeight + ";";
  7862. if (!imageWidth || !imageHeight) {
  7863. styleSize = "";
  7864. }
  7865. }
  7866. var link = this.link;
  7867. this._container.innerHTML = "<a href='" + link + "' target='_blank'>" +
  7868. "<img src=" + imgSrc + " alt='" + alt + "' style='" + styleSize + "margin-bottom: 2px'></a>";
  7869. this._createStyleSheet();
  7870. return this._container;
  7871. }
  7872. _createStyleSheet() {
  7873. var style = document.createElement('style');
  7874. style.type = 'text/css';
  7875. style.innerHTML = ".iclient-logo{" +
  7876. "margin:0 !important;" +
  7877. "}" +
  7878. ".iclient-logo a{" +
  7879. "border: none;" +
  7880. "display: block;" +
  7881. "height:31px;" +
  7882. "}" +
  7883. ".iclient-logo img{" +
  7884. "border: none;" +
  7885. "white-space: nowrap" +
  7886. "}";
  7887. document.getElementsByTagName('head')[0].appendChild(style);
  7888. }
  7889. _extend(dest) {
  7890. for (var index = 0; index < Object.getOwnPropertyNames(arguments).length; index++) {
  7891. var arg = Object.getOwnPropertyNames(arguments)[index];
  7892. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  7893. continue;
  7894. }
  7895. var obj = arguments[arg];
  7896. if (obj) {
  7897. for (var j = 0; j < Object.getOwnPropertyNames(obj).length; j++) {
  7898. var key = Object.getOwnPropertyNames(obj)[j];
  7899. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  7900. continue;
  7901. }
  7902. dest[key] = obj[key];
  7903. }
  7904. }
  7905. }
  7906. return dest;
  7907. }
  7908. }
  7909. ;// CONCATENATED MODULE: ./src/common/commontypes/Size.js
  7910. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  7911. * This program are made available under the terms of the Apache License, Version 2.0
  7912. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7913. /**
  7914. * @class Size
  7915. * @deprecatedclass SuperMap.Size
  7916. * @category BaseTypes Style
  7917. * @classdesc 此类描绘一对高宽值的实例。
  7918. * @param {number} [w=0.0] - 宽度。
  7919. * @param {number} [h=0.0] - 高度。
  7920. *
  7921. * @example
  7922. * var size = new Size(31,46);
  7923. * @usage
  7924. */
  7925. class Size {
  7926. constructor(w, h) {
  7927. /**
  7928. * @member {number} [Size.prototype.w=0.0]
  7929. * @description 宽度。
  7930. */
  7931. this.w = w ? parseFloat(w) : 0.0;
  7932. /**
  7933. * @member {number} [Size.prototype.h=0.0]
  7934. * @description 高度。
  7935. */
  7936. this.h = w ? parseFloat(h) : 0.0;
  7937. this.CLASS_NAME = "SuperMap.Size";
  7938. }
  7939. /**
  7940. * @function Size.prototype.toString
  7941. * @description 返回字符串形式。
  7942. * @example
  7943. * var size = new Size(10,5);
  7944. * var str = size.toString();
  7945. * @returns {string} 例如:"w=10,h=5"。
  7946. */
  7947. toString() {
  7948. return ("w=" + this.w + ",h=" + this.h);
  7949. }
  7950. /**
  7951. * @function Size.prototype.clone
  7952. * @description 克隆当前size对象。
  7953. * @example
  7954. * var size = new Size(31,46);
  7955. * var size2 = size.clone();
  7956. * @returns {Size} 新的与当前 size 对象有相同宽、高的 Size 对象。
  7957. */
  7958. clone() {
  7959. return new Size(this.w, this.h);
  7960. }
  7961. /**
  7962. *
  7963. * @function Size.prototype.equals
  7964. * @description 比较两个 size 对象是否相等。
  7965. * @example
  7966. * var size = new Size(31,46);
  7967. * var size2 = new Size(31,46);
  7968. * var isEquals = size.equals(size2);
  7969. *
  7970. * @param {Size} sz - 用于比较相等的 Size 对象。
  7971. * @returns {boolean} 传入的 size 和当前 size 高宽相等,注意:如果传入的 size 为空则返回 false。
  7972. *
  7973. */
  7974. equals(sz) {
  7975. var equals = false;
  7976. if (sz != null) {
  7977. equals = ((this.w === sz.w && this.h === sz.h) ||
  7978. (isNaN(this.w) && isNaN(this.h) && isNaN(sz.w) && isNaN(sz.h)));
  7979. }
  7980. return equals;
  7981. }
  7982. /**
  7983. *
  7984. * @function Size.prototype.destroy
  7985. * @description 销毁此对象。销毁后此对象的所有属性为 null,而不是初始值。
  7986. * @example
  7987. * var size = new Size(31,46);
  7988. * size.destroy();
  7989. */
  7990. destroy() {
  7991. this.w = null;
  7992. this.h = null;
  7993. }
  7994. }
  7995. ;// CONCATENATED MODULE: ./src/common/commontypes/Pixel.js
  7996. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  7997. * This program are made available under the terms of the Apache License, Version 2.0
  7998. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7999. /**
  8000. * @class Pixel
  8001. * @deprecatedclass SuperMap.Pixel
  8002. * @category BaseTypes Geometry
  8003. * @classdesc 用 x,y 坐标描绘屏幕坐标(像素点)。
  8004. * @param {number} [x=0.0] - x 坐标。
  8005. * @param {number} [y=0.0] - y 坐标。
  8006. * @param {Pixel.Mode} [mode=Pixel.Mode.LeftTop] - 坐标模式。
  8007. *
  8008. * @example
  8009. * //单独创建一个对象
  8010. * var pixcel = new Pixel(100,50);
  8011. *
  8012. * //依据 size 创建
  8013. * var size = new Size(21,25);
  8014. * var offset = new Pixel(-(size.w/2), -size.h);
  8015. * @usage
  8016. */
  8017. class Pixel {
  8018. constructor(x, y, mode) {
  8019. /**
  8020. * @member {number} [Pixel.prototype.x=0.0]
  8021. * @description x 坐标。
  8022. */
  8023. this.x = x ? parseFloat(x) : 0.0;
  8024. /**
  8025. * @member {number} [Pixel.prototype.y=0.0]
  8026. * @description y 坐标。
  8027. */
  8028. this.y = y ? parseFloat(y) : 0.0;
  8029. /**
  8030. * @member {Pixel.Mode} [Pixel.prototype.mode=Pixel.Mode.LeftTop]
  8031. * @description 坐标模式,有左上、右上、右下、左下这几种模式,分别表示相对于左上角、右上角、右下角、左下角的坐标。
  8032. */
  8033. this.mode = mode;
  8034. this.CLASS_NAME = 'SuperMap.Pixel';
  8035. }
  8036. /**
  8037. * @function Pixel.prototype.toString
  8038. * @description 返回此对象的字符串形式。
  8039. * @example
  8040. *
  8041. * var pixcel = new Pixel(100,50);
  8042. * var str = pixcel.toString();
  8043. *
  8044. * @returns {string} 例如: "x=200.4,y=242.2"
  8045. */
  8046. toString() {
  8047. return 'x=' + this.x + ',y=' + this.y;
  8048. }
  8049. /**
  8050. * @function Pixel.prototype.clone
  8051. * @description 克隆当前的 pixel 对象。
  8052. * @example
  8053. * var pixcel = new Pixel(100,50);
  8054. * var pixcel2 = pixcel.clone();
  8055. * @returns {Pixel} 新的与当前 pixel 对象有相同 x、y 坐标的 pixel 对象。
  8056. */
  8057. clone() {
  8058. return new Pixel(this.x, this.y, this.mode);
  8059. }
  8060. /**
  8061. * @function Pixel.prototype.equals
  8062. * @description 比较两 pixel 是否相等。
  8063. * @example
  8064. * var pixcel = new Pixel(100,50);
  8065. * var pixcel2 = new Pixel(100,50);
  8066. * var isEquals = pixcel.equals(pixcel2);
  8067. *
  8068. * @param {Pixel} px - 用于比较相等的 pixel 对象。
  8069. * @returns {boolean} 如果传入的像素点和当前像素点相同返回 true,如果不同或传入参数为 NULL 则返回 false。
  8070. */
  8071. equals(px) {
  8072. var equals = false;
  8073. if (px != null) {
  8074. equals = (this.x == px.x && this.y == px.y) || (isNaN(this.x) && isNaN(this.y) && isNaN(px.x) && isNaN(px.y));
  8075. }
  8076. return equals;
  8077. }
  8078. /**
  8079. * @function Pixel.prototype.distanceTo
  8080. * @description 返回两个 pixel 的距离。
  8081. * @example
  8082. * var pixcel = new Pixel(100,50);
  8083. * var pixcel2 = new Pixel(110,30);
  8084. * var distance = pixcel.distanceTo(pixcel2);
  8085. *
  8086. * @param {Pixel} px - 需要计算的 pixel。
  8087. * @returns {number} 作为参数传入的像素与当前像素点的距离。
  8088. */
  8089. distanceTo(px) {
  8090. return Math.sqrt(Math.pow(this.x - px.x, 2) + Math.pow(this.y - px.y, 2));
  8091. }
  8092. /**
  8093. * @function Pixel.prototype.add
  8094. * @description 在原来像素坐标基础上,x 值加上传入的 x 参数,y 值加上传入的 y 参数。
  8095. * @example
  8096. * var pixcel = new Pixel(100,50);
  8097. * //pixcel2是新的对象
  8098. * var pixcel2 = pixcel.add(20,30);
  8099. *
  8100. * @param {number} x - 传入的 x 值。
  8101. * @param {number} y - 传入的 y 值。
  8102. * @returns {Pixel} 新的 pixel 对象,该 pixel 是由当前的 pixel 与传入的 x,y 相加得到。
  8103. */
  8104. add(x, y) {
  8105. if (x == null || y == null) {
  8106. throw new TypeError('Pixel.add cannot receive null values');
  8107. }
  8108. return new Pixel(this.x + x, this.y + y);
  8109. }
  8110. /**
  8111. * @function Pixel.prototype.offset
  8112. * @description 通过传入的 {@link Pixel} 参数对原屏幕坐标进行偏移。
  8113. * @example
  8114. * var pixcel = new Pixel(100,50);
  8115. * var pixcel2 = new Pixel(130,20);
  8116. * //pixcel3 是新的对象
  8117. * var pixcel3 = pixcel.offset(pixcel2);
  8118. *
  8119. * @param {Pixel} px - 传入的 {@link Pixel} 对象。
  8120. * @returns {Pixel} 新的 pixel,该 pixel 是由当前的 pixel 对象的 x,y 值与传入的 Pixel 对象的 x,y 值相加得到。
  8121. */
  8122. offset(px) {
  8123. var newPx = this.clone();
  8124. if (px) {
  8125. newPx = this.add(px.x, px.y);
  8126. }
  8127. return newPx;
  8128. }
  8129. /**
  8130. *
  8131. * @function Pixel.prototype.destroy
  8132. * @description 销毁此对象。销毁后此对象的所有属性为 null,而不是初始值。
  8133. * @example
  8134. * var pixcel = new Pixel(100,50);
  8135. * pixcel.destroy();
  8136. */
  8137. destroy() {
  8138. this.x = null;
  8139. this.y = null;
  8140. this.mode = null;
  8141. }
  8142. }
  8143. /**
  8144. * @enum Mode
  8145. * @memberOf Pixel
  8146. * @readonly
  8147. * @description 模式。
  8148. * @type {string}
  8149. */
  8150. Pixel.Mode = {
  8151. /** 左上模式。*/
  8152. LeftTop: 'lefttop',
  8153. /** 右上模式。 */
  8154. RightTop: 'righttop',
  8155. /** 右下模式。 */
  8156. RightBottom: 'rightbottom',
  8157. /** 左下模式。 */
  8158. LeftBottom: 'leftbottom'
  8159. };
  8160. ;// CONCATENATED MODULE: ./src/common/commontypes/BaseTypes.js
  8161. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  8162. * This program are made available under the terms of the Apache License, Version 2.0
  8163. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8164. /**
  8165. * @function inherit
  8166. * @description 除了 C 和 P 两个必要参数外,可以传递任意数量的对象,这些对象都将继承C。
  8167. * @param {Object} C - 继承的类。
  8168. * @param {Object} P - 被继承的父类。
  8169. * @private
  8170. */
  8171. var inheritExt = function (C, P) {
  8172. var F = function () {
  8173. };
  8174. F.prototype = P.prototype;
  8175. C.prototype = new F;
  8176. var i, l, o;
  8177. for (i = 2, l = arguments.length; i < l; i++) {
  8178. o = arguments[i];
  8179. if (typeof o === "function") {
  8180. o = o.prototype;
  8181. }
  8182. Util_Util.extend(C.prototype, o);
  8183. }
  8184. };
  8185. /**
  8186. * @function mixinExt
  8187. * @description 实现多重继承。
  8188. * @param {Class|Object} ...mixins - 继承的类。
  8189. * @private
  8190. */
  8191. var mixinExt = function (...mixins) {
  8192. class Mix {
  8193. constructor(options) {
  8194. for (var index = 0; index < mixins.length; index++) {
  8195. copyProperties(this, new mixins[index](options));
  8196. }
  8197. }
  8198. }
  8199. for (var index = 0; index < mixins.length; index++) {
  8200. var mixin = mixins[index];
  8201. copyProperties(Mix, mixin);
  8202. copyProperties(Mix.prototype, mixin.prototype);
  8203. copyProperties(Mix.prototype, new mixin());
  8204. }
  8205. return Mix;
  8206. function copyProperties(target, source) {
  8207. var ownKeys = Object.getOwnPropertyNames(source);
  8208. if (Object.getOwnPropertySymbols) {
  8209. ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source));
  8210. }
  8211. for (var index = 0; index < ownKeys.length; index++) {
  8212. var key = ownKeys[index];
  8213. if (key !== "constructor"
  8214. && key !== "prototype"
  8215. && key !== "name" && key !== "length") {
  8216. let desc = Object.getOwnPropertyDescriptor(source, key);
  8217. if (window["ActiveXObject"]) {
  8218. Object.defineProperty(target, key, desc || {});
  8219. } else {
  8220. Object.defineProperty(target, key, desc);
  8221. }
  8222. }
  8223. }
  8224. }
  8225. };
  8226. /**
  8227. * @name String
  8228. * @namespace
  8229. * @category BaseTypes Util
  8230. * @description 字符串操作的一系列常用扩展函数。
  8231. * @private
  8232. */
  8233. var StringExt = {
  8234. /**
  8235. * @function StringExt.startsWith
  8236. * @description 判断目标字符串是否以指定的子字符串开头。
  8237. * @param {string} str - 目标字符串。
  8238. * @param {string} sub - 查找的子字符串。
  8239. * @returns {boolean} 目标字符串以指定的子字符串开头,则返回 true;否则返回 false。
  8240. */
  8241. startsWith: function (str, sub) {
  8242. return (str.indexOf(sub) == 0);
  8243. },
  8244. /**
  8245. * @function StringExt.contains
  8246. * @description 判断目标字符串是否包含指定的子字符串。
  8247. * @param {string} str - 目标字符串。
  8248. * @param {string} sub - 查找的子字符串。
  8249. * @returns {boolean} 目标字符串中包含指定的子字符串,则返回 true;否则返回 false。
  8250. */
  8251. contains: function (str, sub) {
  8252. return (str.indexOf(sub) != -1);
  8253. },
  8254. /**
  8255. * @function StringExt.trim
  8256. * @description 删除一个字符串的开头和结尾处的所有空白字符。
  8257. * @param {string} str - (可能)存在空白字符填塞的字符串。
  8258. * @returns {string} 删除开头和结尾处空白字符后的字符串。
  8259. */
  8260. trim: function (str) {
  8261. return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
  8262. },
  8263. /**
  8264. * @function StringExt.camelize
  8265. * @description 骆驼式("-")连字符的字符串处理。
  8266. * 例如:"chicken-head" becomes "chickenHead",
  8267. * "-chicken-head" becomes "ChickenHead"。
  8268. * @param {string} str - 要处理的字符串,原始内容不应被修改。
  8269. * @returns {string}
  8270. */
  8271. camelize: function (str) {
  8272. var oStringList = str.split('-');
  8273. var camelizedString = oStringList[0];
  8274. for (var i = 1, len = oStringList.length; i < len; i++) {
  8275. var s = oStringList[i];
  8276. camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
  8277. }
  8278. return camelizedString;
  8279. },
  8280. /**
  8281. * @function StringExt.format
  8282. * @description 提供带 ${token} 标记的字符串, 返回 context 对象属性中指定标记的属性值。
  8283. * @example
  8284. * 示例:
  8285. * (code)
  8286. * 1、template = "${value,getValue}";
  8287. * context = {value: {getValue:function(){return Math.max.apply(null,argument);}}};
  8288. * args = [2,23,12,36,21];
  8289. * 返回值:36
  8290. * (end)
  8291. * 示例:
  8292. * (code)
  8293. * 2、template = "$${{value,getValue}}";
  8294. * context = {value: {getValue:function(){return Math.max.apply(null,argument);}}};
  8295. * args = [2,23,12,36,21];
  8296. * 返回值:"${36}"
  8297. * (end)
  8298. * 示例:
  8299. * (code)
  8300. * 3、template = "${a,b}";
  8301. * context = {a: {b:"format"}};
  8302. * args = null;
  8303. * 返回值:"format"
  8304. * (end)
  8305. * 示例:
  8306. * (code)
  8307. * 3、template = "${a,b}";
  8308. * context = null;
  8309. * args = null;
  8310. * 返回值:"${a.b}"
  8311. * (end)
  8312. * @param {string} template - 带标记的字符串将要被替换。参数 template 格式为"${token}",此处的 token 标记会替换为 context["token"] 属性的值。
  8313. * @param {Object} [context=window] - 带有属性的可选对象的属性用于匹配格式化字符串中的标记。如果该参数为空,将使用 window 对象。
  8314. * @param {Array.<number>} [args] - 可选参数传递给在 context 对象上找到的函数。
  8315. * @returns {string} 从 context 对象属性中替换字符串标记位的字符串。
  8316. */
  8317. format: function (template, context, args) {
  8318. if (!context) {
  8319. context = window;
  8320. }
  8321. // Example matching:
  8322. // str = ${foo.bar}
  8323. // match = foo.bar
  8324. var replacer = function (str, match) {
  8325. var replacement;
  8326. // Loop through all subs. Example: ${a.b.c}
  8327. // 0 -> replacement = context[a];
  8328. // 1 -> replacement = context[a][b];
  8329. // 2 -> replacement = context[a][b][c];
  8330. var subs = match.split(/\.+/);
  8331. for (var i = 0; i < subs.length; i++) {
  8332. if (i == 0) {
  8333. replacement = context;
  8334. }
  8335. replacement = replacement[subs[i]];
  8336. }
  8337. if (typeof replacement === "function") {
  8338. replacement = args ?
  8339. replacement.apply(null, args) :
  8340. replacement();
  8341. }
  8342. // If replacement is undefined, return the string 'undefined'.
  8343. // This is a workaround for a bugs in browsers not properly
  8344. // dealing with non-participating groups in regular expressions:
  8345. // http://blog.stevenlevithan.com/archives/npcg-javascript
  8346. if (typeof replacement == 'undefined') {
  8347. return 'undefined';
  8348. } else {
  8349. return replacement;
  8350. }
  8351. };
  8352. return template.replace(StringExt.tokenRegEx, replacer);
  8353. },
  8354. /**
  8355. * @member {RegExp} [StringExt.tokenRegEx]
  8356. * @description 寻找带 token 的字符串,默认为 tokenRegEx=/\$\{([\w.]+?)\}/g。
  8357. * @example
  8358. * Examples: ${a}, ${a.b.c}, ${a-b}, ${5}
  8359. */
  8360. tokenRegEx: /\$\{([\w.]+?)\}/g,
  8361. /**
  8362. * @member {RegExp} [StringExt.numberRegEx]
  8363. * @description 判断一个字符串是否只包含一个数值,默认为 numberRegEx=/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/。
  8364. */
  8365. numberRegEx: /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/,
  8366. /**
  8367. * @function StringExt.isNumeric
  8368. * @description 判断一个字符串是否只包含一个数值。
  8369. * @example
  8370. * (code)
  8371. * StringExt.isNumeric("6.02e23") // true
  8372. * StringExt.isNumeric("12 dozen") // false
  8373. * StringExt.isNumeric("4") // true
  8374. * StringExt.isNumeric(" 4 ") // false
  8375. * (end)
  8376. * @returns {boolean} 字符串包含唯一的数值,返回 true;否则返回 false。
  8377. */
  8378. isNumeric: function (value) {
  8379. return StringExt.numberRegEx.test(value);
  8380. },
  8381. /**
  8382. * @function StringExt.numericIf
  8383. * @description 把一个看似数值型的字符串转化为一个数值。
  8384. * @returns {(number|string)} 如果能转换为数值则返回数值,否则返回字符串本身。
  8385. */
  8386. numericIf: function (value) {
  8387. return StringExt.isNumeric(value) ? parseFloat(value) : value;
  8388. }
  8389. };
  8390. /**
  8391. * @name Number
  8392. * @namespace
  8393. * @category BaseTypes Util
  8394. * @description 数值操作的一系列常用扩展函数。
  8395. * @private
  8396. */
  8397. var NumberExt = {
  8398. /**
  8399. * @member {string} [NumberExt.decimalSeparator='.']
  8400. * @description 格式化数字时默认的小数点分隔符。
  8401. * @constant
  8402. */
  8403. decimalSeparator: ".",
  8404. /**
  8405. * @member {string} [NumberExt.thousandsSeparator=',']
  8406. * @description 格式化数字时默认的千位分隔符。
  8407. * @constant
  8408. */
  8409. thousandsSeparator: ",",
  8410. /**
  8411. * @function NumberExt.limitSigDigs
  8412. * @description 限制浮点数的有效数字位数。
  8413. * @param {number} num - 浮点数。
  8414. * @param {number} sig - 有效位数。
  8415. * @returns {number} 将数字四舍五入到指定数量的有效位数。
  8416. */
  8417. limitSigDigs: function (num, sig) {
  8418. var fig = 0;
  8419. if (sig > 0) {
  8420. fig = parseFloat(num.toPrecision(sig));
  8421. }
  8422. return fig;
  8423. },
  8424. /**
  8425. * @function NumberExt.format
  8426. * @description 数字格式化输出。
  8427. * @param {number} num - 数字。
  8428. * @param {number} [dec=0] - 数字的小数部分四舍五入到指定的位数。设置为 null 值时小数部分不变。
  8429. * @param {string} [tsep=','] - 千位分隔符。
  8430. * @param {string} [dsep='.'] - 小数点分隔符。
  8431. * @returns {string} 数字格式化后的字符串。
  8432. */
  8433. format: function (num, dec, tsep, dsep) {
  8434. dec = (typeof dec != "undefined") ? dec : 0;
  8435. tsep = (typeof tsep != "undefined") ? tsep :
  8436. NumberExt.thousandsSeparator;
  8437. dsep = (typeof dsep != "undefined") ? dsep :
  8438. NumberExt.decimalSeparator;
  8439. if (dec != null) {
  8440. num = parseFloat(num.toFixed(dec));
  8441. }
  8442. var parts = num.toString().split(".");
  8443. if (parts.length === 1 && dec == null) {
  8444. // integer where we do not want to touch the decimals
  8445. dec = 0;
  8446. }
  8447. var integer = parts[0];
  8448. if (tsep) {
  8449. var thousands = /(-?[0-9]+)([0-9]{3})/;
  8450. while (thousands.test(integer)) {
  8451. integer = integer.replace(thousands, "$1" + tsep + "$2");
  8452. }
  8453. }
  8454. var str;
  8455. if (dec == 0) {
  8456. str = integer;
  8457. } else {
  8458. var rem = parts.length > 1 ? parts[1] : "0";
  8459. if (dec != null) {
  8460. rem = rem + new Array(dec - rem.length + 1).join("0");
  8461. }
  8462. str = integer + dsep + rem;
  8463. }
  8464. return str;
  8465. }
  8466. };
  8467. if (!Number.prototype.limitSigDigs) {
  8468. /**
  8469. * APIMethod: Number.limitSigDigs
  8470. * 限制浮点数的有效数字位数.
  8471. * @param {number} sig -有效位数。
  8472. * @returns {number} 将数字四舍五入到指定数量的有效位数。
  8473. * 如果传入值 为 null、0、或者是负数, 返回值 0。
  8474. */
  8475. Number.prototype.limitSigDigs = function (sig) {
  8476. return NumberExt.limitSigDigs(this, sig);
  8477. };
  8478. }
  8479. /**
  8480. * @name Function
  8481. * @namespace
  8482. * @category BaseTypes Util
  8483. * @description 函数操作的一系列常用扩展函数。
  8484. * @private
  8485. */
  8486. var FunctionExt = {
  8487. /**
  8488. * @function FunctionExt.bind
  8489. * @description 绑定函数到对象。方便创建 this 的作用域。
  8490. * @param {function} func - 输入函数。
  8491. * @param {Object} object - 对象绑定到输入函数(作为输入函数的 this 对象)。
  8492. * @returns {function} object 参数作为 func 函数的 this 对象。
  8493. */
  8494. bind: function (func, object) {
  8495. // create a reference to all arguments past the second one
  8496. var args = Array.prototype.slice.apply(arguments, [2]);
  8497. return function () {
  8498. // Push on any additional arguments from the actual function call.
  8499. // These will come after those sent to the bind call.
  8500. var newArgs = args.concat(
  8501. Array.prototype.slice.apply(arguments, [0])
  8502. );
  8503. return func.apply(object, newArgs);
  8504. };
  8505. },
  8506. /**
  8507. * @function FunctionExt.bindAsEventListener
  8508. * @description 绑定函数到对象,在调用该函数时配置并使用事件对象作为第一个参数。
  8509. * @param {function} func - 用于监听事件的函数。
  8510. * @param {Object} object - this 对象的引用。
  8511. * @returns {function}
  8512. */
  8513. bindAsEventListener: function (func, object) {
  8514. return function (event) {
  8515. return func.call(object, event || window.event);
  8516. };
  8517. },
  8518. /**
  8519. * @function FunctionExt.False
  8520. * @description 该函数仅仅返回 false。该函数主要是避免在 IE8 以下浏览中 DOM 事件句柄的匿名函数问题。
  8521. * @example
  8522. * document.onclick = FunctionExt.False;
  8523. * @returns {boolean}
  8524. */
  8525. False: function () {
  8526. return false;
  8527. },
  8528. /**
  8529. * @function FunctionExt.True
  8530. * @description 该函数仅仅返回 true。该函数主要是避免在 IE8 以下浏览中 DOM 事件句柄的匿名函数问题。
  8531. * @example
  8532. * document.onclick = FunctionExt.True;
  8533. * @returns {boolean}
  8534. */
  8535. True: function () {
  8536. return true;
  8537. },
  8538. /**
  8539. * @function FunctionExt.Void
  8540. * @description 可重用函数,仅仅返回 "undefined"。
  8541. * @returns {undefined}
  8542. */
  8543. Void: function () {
  8544. }
  8545. };
  8546. /**
  8547. * @name Array
  8548. * @namespace
  8549. * @category BaseTypes Util
  8550. * @description 数组操作的一系列常用扩展函数。
  8551. * @private
  8552. */
  8553. var ArrayExt = {
  8554. /**
  8555. * @function ArrayExt.filter
  8556. * @description 过滤数组,提供了 ECMA-262 标准中 Array.prototype.filter 函数的扩展。详见:{@link http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array/filter}
  8557. * @param {Array} array - 要过滤的数组。
  8558. * @param {function} callback - 数组中的每一个元素调用该函数。</br>
  8559. * 如果函数的返回值为 true,该元素将包含在返回的数组中。该函数有三个参数: 数组中的元素,元素的索引,数组自身。</br>
  8560. * 如果设置了可选参数 caller,在调用 callback 时,使用可选参数 caller 设置为 callback 的参数。</br>
  8561. * @param {Object} [caller] - 在调用 callback 时,使用参数 caller 设置为 callback 的参数。
  8562. * @returns {Array} callback 函数返回 true 时的元素将作为返回数组中的元素。
  8563. */
  8564. filter: function (array, callback, caller) {
  8565. var selected = [];
  8566. if (Array.prototype.filter) {
  8567. selected = array.filter(callback, caller);
  8568. } else {
  8569. var len = array.length;
  8570. if (typeof callback != "function") {
  8571. throw new TypeError();
  8572. }
  8573. for (var i = 0; i < len; i++) {
  8574. if (i in array) {
  8575. var val = array[i];
  8576. if (callback.call(caller, val, i, array)) {
  8577. selected.push(val);
  8578. }
  8579. }
  8580. }
  8581. }
  8582. return selected;
  8583. }
  8584. };
  8585. ;// CONCATENATED MODULE: ./src/common/commontypes/Geometry.js
  8586. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  8587. * This program are made available under the terms of the Apache License, Version 2.0
  8588. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8589. // import {WKT} from '../format/WKT';
  8590. // import {Vector} from './Vector';
  8591. /**
  8592. * @class Geometry
  8593. * @deprecatedclass SuperMap.Geometry
  8594. * @category BaseTypes Geometry
  8595. * @classdesc 几何对象类,描述地理对象的几何图形。
  8596. * @usage
  8597. */
  8598. class Geometry_Geometry {
  8599. constructor() {
  8600. this.CLASS_NAME = "SuperMap.Geometry";
  8601. /**
  8602. * @member {string} Geometry.prototype.id
  8603. * @description 几何对象的唯一标识符。
  8604. *
  8605. */
  8606. this.id = Util_Util.createUniqueID(this.CLASS_NAME + "_");
  8607. /**
  8608. * @member {Geometry} Geometry.prototype.parent
  8609. * @description 父类几何对象。
  8610. */
  8611. this.parent = null;
  8612. /**
  8613. * @member {Bounds} Geometry.prototype.bounds
  8614. * @description 几何对象的范围。
  8615. *
  8616. */
  8617. this.bounds = null;
  8618. /**
  8619. * @member {number} Geometry.prototype.SRID
  8620. * @description 投影坐标参数。通过该参数,服务器判断 Geometry 对象的坐标参考系是否与数据集相同,如果不同,则在数据入库前进行投影变换。
  8621. * @example
  8622. * var geometry= new Geometry();
  8623. * geometry. SRID=4326;
  8624. *
  8625. */
  8626. this.SRID = null;
  8627. }
  8628. /**
  8629. * @function Geometry.prototype.destroy
  8630. * @description 解构 Geometry 类,释放资源。
  8631. */
  8632. destroy() {
  8633. this.id = null;
  8634. this.bounds = null;
  8635. this.SRID = null;
  8636. }
  8637. /**
  8638. * @function Geometry.prototype.clone
  8639. * @description 克隆几何图形。克隆的几何图形不设置非标准的属性。
  8640. * @returns {Geometry} 克隆的几何图形。
  8641. */
  8642. clone() {
  8643. return new Geometry_Geometry();
  8644. }
  8645. /**
  8646. * @function Geometry.prototype.setBounds
  8647. * @description 设置几何对象的 bounds。
  8648. * @param {Bounds} bounds - 范围。
  8649. */
  8650. setBounds(bounds) {
  8651. if (bounds) {
  8652. this.bounds = bounds.clone();
  8653. }
  8654. }
  8655. /**
  8656. * @function Geometry.prototype.clearBounds
  8657. * @description 清除几何对象的 bounds。
  8658. * 如果该对象有父类,也会清除父类几何对象的 bounds。
  8659. */
  8660. clearBounds() {
  8661. this.bounds = null;
  8662. if (this.parent) {
  8663. this.parent.clearBounds();
  8664. }
  8665. }
  8666. /**
  8667. * @function Geometry.prototype.extendBounds
  8668. * @description 扩展现有边界以包含新边界。如果尚未设置几何边界,则设置新边界。
  8669. * @param {Bounds} newBounds - 几何对象的 bounds。
  8670. */
  8671. extendBounds(newBounds) {
  8672. var bounds = this.getBounds();
  8673. if (!bounds) {
  8674. this.setBounds(newBounds);
  8675. } else {
  8676. this.bounds.extend(newBounds);
  8677. }
  8678. }
  8679. /**
  8680. * @function Geometry.prototype.getBounds
  8681. * @description 获得几何图形的边界。如果没有设置边界,可通过计算获得。
  8682. * @returns {Bounds} 几何对象的边界。
  8683. */
  8684. getBounds() {
  8685. if (this.bounds == null) {
  8686. this.calculateBounds();
  8687. }
  8688. return this.bounds;
  8689. }
  8690. /**
  8691. * @function Geometry.prototype.calculateBounds
  8692. * @description 重新计算几何图形的边界(需要在子类中实现此方法)。
  8693. */
  8694. calculateBounds() {
  8695. //
  8696. // This should be overridden by subclasses.
  8697. //
  8698. }
  8699. /**
  8700. * @function Geometry.prototype.getVertices
  8701. * @description 返回几何图形的所有顶点的列表(需要在子类中实现此方法)。
  8702. * @param {boolean} [nodes] - 如果是 true,线则只返回线的末端点,如果 false,仅仅返回顶点,如果没有设置,则返回顶点。
  8703. * @returns {Array} 几何图形的顶点列表。
  8704. */
  8705. getVertices(nodes) { // eslint-disable-line no-unused-vars
  8706. }
  8707. /**
  8708. * @function Geometry.prototype.getArea
  8709. * @description 计算几何对象的面积 ,此方法需要在子类中定义。
  8710. * @returns {number} 计算后的对象面积。
  8711. */
  8712. getArea() {
  8713. //to be overridden by geometries that actually have an area
  8714. //
  8715. return 0.0;
  8716. }
  8717. // /**
  8718. // * @function Geometry.prototype.toString
  8719. // * @description 返回geometry对象的字符串表述,需要引入{@link WKTFormat}。此方法只能在子类实现,在父类使用会报错。
  8720. // * @returns {string} geometry对象的字符串表述(Well-Known Text)
  8721. // */
  8722. // toString() {
  8723. // var string;
  8724. // if (WKT) {
  8725. // var wkt = new WKT();
  8726. // string = wkt.write(new Vector(this));
  8727. // } else {
  8728. // string = Object.prototype.toString.call(this);
  8729. // }
  8730. // return string;
  8731. // }
  8732. }
  8733. ;// CONCATENATED MODULE: ./src/common/commontypes/Util.js
  8734. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  8735. * This program are made available under the terms of the Apache License, Version 2.0
  8736. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8737. /**
  8738. * @description 浏览器名称,依赖于 userAgent 属性,BROWSER_NAME 可以是空,或者以下浏览器:
  8739. * * "opera" -- Opera
  8740. * * "msie" -- Internet Explorer
  8741. * * "safari" -- Safari
  8742. * * "firefox" -- Firefox
  8743. * * "mozilla" -- Mozilla
  8744. * @category BaseTypes Constant
  8745. * @constant {Object}
  8746. * @usage
  8747. * ```
  8748. * // 浏览器
  8749. * <script type="text/javascript" src="{cdn}"></script>
  8750. * <script>
  8751. * const result = {namespace}.Browser.name;
  8752. *
  8753. * </script>
  8754. * // ES6 Import
  8755. * import { Browser } from '{npm}';
  8756. *
  8757. * const result = Browser.name;
  8758. * ```
  8759. */
  8760. const Browser = (function () {
  8761. var name = '',
  8762. version = '',
  8763. device = 'pc',
  8764. uaMatch;
  8765. //以下进行测试
  8766. var ua = navigator.userAgent.toLowerCase();
  8767. if (ua.indexOf('msie') > -1 || (ua.indexOf('trident') > -1 && ua.indexOf('rv') > -1)) {
  8768. name = 'msie';
  8769. uaMatch = ua.match(/msie ([\d.]+)/) || ua.match(/rv:([\d.]+)/);
  8770. } else if (ua.indexOf('chrome') > -1) {
  8771. name = 'chrome';
  8772. uaMatch = ua.match(/chrome\/([\d.]+)/);
  8773. } else if (ua.indexOf('firefox') > -1) {
  8774. name = 'firefox';
  8775. uaMatch = ua.match(/firefox\/([\d.]+)/);
  8776. } else if (ua.indexOf('opera') > -1) {
  8777. name = 'opera';
  8778. uaMatch = ua.match(/version\/([\d.]+)/);
  8779. } else if (ua.indexOf('safari') > -1) {
  8780. name = 'safari';
  8781. uaMatch = ua.match(/version\/([\d.]+)/);
  8782. }
  8783. version = uaMatch ? uaMatch[1] : '';
  8784. if (ua.indexOf('ipad') > -1 || ua.indexOf('ipod') > -1 || ua.indexOf('iphone') > -1) {
  8785. device = 'apple';
  8786. } else if (ua.indexOf('android') > -1) {
  8787. uaMatch = ua.match(/version\/([\d.]+)/);
  8788. version = uaMatch ? uaMatch[1] : '';
  8789. device = 'android';
  8790. }
  8791. return { name: name, version: version, device: device };
  8792. })();
  8793. const isSupportCanvas = (function () {
  8794. var checkRes = true,
  8795. broz = Browser;
  8796. if (document.createElement('canvas').getContext) {
  8797. if (broz.name === 'firefox' && parseFloat(broz.version) < 5) {
  8798. checkRes = false;
  8799. }
  8800. if (broz.name === 'safari' && parseFloat(broz.version) < 4) {
  8801. checkRes = false;
  8802. }
  8803. if (broz.name === 'opera' && parseFloat(broz.version) < 10) {
  8804. checkRes = false;
  8805. }
  8806. if (broz.name === 'msie' && parseFloat(broz.version) < 9) {
  8807. checkRes = false;
  8808. }
  8809. } else {
  8810. checkRes = false;
  8811. }
  8812. return checkRes;
  8813. })();
  8814. /**
  8815. * @description 如果 userAgent 捕获到浏览器使用的是 Gecko 引擎则返回 true。
  8816. * @constant {number}
  8817. * @private
  8818. */
  8819. const IS_GECKO = (function () {
  8820. var ua = navigator.userAgent.toLowerCase();
  8821. return ua.indexOf('webkit') === -1 && ua.indexOf('gecko') !== -1;
  8822. })();
  8823. /**
  8824. * @constant {number}
  8825. * @default
  8826. * @description 分辨率与比例尺之间转换的常量。
  8827. * @private
  8828. */
  8829. const DOTS_PER_INCH = 96;
  8830. /**
  8831. * @name CommonUtil
  8832. * @namespace
  8833. * @category BaseTypes Util
  8834. * @description common 工具类。
  8835. * @usage
  8836. * ```
  8837. * // 浏览器
  8838. * <script type="text/javascript" src="{cdn}"></script>
  8839. * <script>
  8840. * const result = {namespace}.CommonUtil.getElement();
  8841. *
  8842. * // 弃用的写法
  8843. * const result = SuperMap.Util.getElement();
  8844. *
  8845. * </script>
  8846. *
  8847. * // ES6 Import
  8848. * import { CommonUtil } from '{npm}';
  8849. *
  8850. * const result = CommonUtil.getElement();
  8851. * ```
  8852. */
  8853. const Util_Util = {
  8854. /**
  8855. * @function Util.extend
  8856. * @description 对象拷贝赋值。
  8857. * @param {Object} dest - 目标对象。
  8858. * @param {Object} arguments - 待拷贝的对象。
  8859. * @returns {Object} 赋值后的目标对象。
  8860. */
  8861. assign(dest) {
  8862. for (var index = 0; index < Object.getOwnPropertyNames(arguments).length; index++) {
  8863. var arg = Object.getOwnPropertyNames(arguments)[index];
  8864. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  8865. continue;
  8866. }
  8867. var obj = arguments[arg];
  8868. if (obj) {
  8869. for (var j = 0; j < Object.getOwnPropertyNames(obj).length; j++) {
  8870. var key = Object.getOwnPropertyNames(obj)[j];
  8871. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  8872. continue;
  8873. }
  8874. dest[key] = obj[key];
  8875. }
  8876. }
  8877. }
  8878. return dest;
  8879. },
  8880. /**
  8881. * @memberOf CommonUtil
  8882. * @description 复制源对象的所有属性到目标对象上,源对象上的没有定义的属性在目标对象上也不会被设置。
  8883. * @example
  8884. * 要复制 Size 对象的所有属性到自定义对象上,使用方法如下:
  8885. * var size = new Size(100, 100);
  8886. * var obj = {};
  8887. * CommonUtil.extend(obj, size);
  8888. * @param {Object} [destination] - 目标对象。
  8889. * @param {Object} source - 源对象,其属性将被设置到目标对象上。
  8890. * @returns {Object} 目标对象。
  8891. */
  8892. extend: function (destination, source) {
  8893. destination = destination || {};
  8894. if (source) {
  8895. for (var property in source) {
  8896. var value = source[property];
  8897. if (value !== undefined) {
  8898. destination[property] = value;
  8899. }
  8900. }
  8901. /**
  8902. * IE doesn't include the toString property when iterating over an object's
  8903. * properties with the for(property in object) syntax. Explicitly check if
  8904. * the source has its own toString property.
  8905. */
  8906. /*
  8907. * FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
  8908. * prototype object" when calling hawOwnProperty if the source object
  8909. * is an instance of window.Event.
  8910. */
  8911. var sourceIsEvt = typeof window.Event === 'function' && source instanceof window.Event;
  8912. if (!sourceIsEvt && source.hasOwnProperty && source.hasOwnProperty('toString')) {
  8913. destination.toString = source.toString;
  8914. }
  8915. }
  8916. return destination;
  8917. },
  8918. /**
  8919. * @memberOf CommonUtil
  8920. * @description 对象拷贝。
  8921. * @param {Object} [des] - 目标对象。
  8922. * @param {Object} soc - 源对象。
  8923. */
  8924. copy: function (des, soc) {
  8925. des = des || {};
  8926. var v;
  8927. if (soc) {
  8928. for (var p in des) {
  8929. v = soc[p];
  8930. if (typeof v !== 'undefined') {
  8931. des[p] = v;
  8932. }
  8933. }
  8934. }
  8935. },
  8936. /**
  8937. * @memberOf CommonUtil
  8938. * @description 销毁对象,将其属性置空。
  8939. * @param {Object} [obj] - 目标对象。
  8940. */
  8941. reset: function (obj) {
  8942. obj = obj || {};
  8943. for (var p in obj) {
  8944. if (obj.hasOwnProperty(p)) {
  8945. if (typeof obj[p] === 'object' && obj[p] instanceof Array) {
  8946. for (var i in obj[p]) {
  8947. if (obj[p][i].destroy) {
  8948. obj[p][i].destroy();
  8949. }
  8950. }
  8951. obj[p].length = 0;
  8952. } else if (typeof obj[p] === 'object' && obj[p] instanceof Object) {
  8953. if (obj[p].destroy) {
  8954. obj[p].destroy();
  8955. }
  8956. }
  8957. obj[p] = null;
  8958. }
  8959. }
  8960. },
  8961. /**
  8962. * @memberOf CommonUtil
  8963. * @description 获取 HTML 元素数组。
  8964. * @returns {Array.<HTMLElement>} HTML 元素数组。
  8965. */
  8966. getElement: function () {
  8967. var elements = [];
  8968. for (var i = 0, len = arguments.length; i < len; i++) {
  8969. var element = arguments[i];
  8970. if (typeof element === 'string') {
  8971. element = document.getElementById(element);
  8972. }
  8973. if (arguments.length === 1) {
  8974. return element;
  8975. }
  8976. elements.push(element);
  8977. }
  8978. return elements;
  8979. },
  8980. /**
  8981. * @memberOf CommonUtil
  8982. * @description instance of 的跨浏览器实现。
  8983. * @param {Object} o - 对象。
  8984. * @returns {boolean} 是否是页面元素。
  8985. */
  8986. isElement: function (o) {
  8987. return !!(o && o.nodeType === 1);
  8988. },
  8989. /**
  8990. * @memberOf CommonUtil
  8991. * @description 判断一个对象是否是数组。
  8992. * @param {Object} a - 对象。
  8993. * @returns {boolean} 是否是数组。
  8994. */
  8995. isArray: function (a) {
  8996. return Object.prototype.toString.call(a) === '[object Array]';
  8997. },
  8998. /**
  8999. * @memberOf CommonUtil
  9000. * @description 从数组中删除某一项。
  9001. * @param {Array} array - 数组。
  9002. * @param {Object} item - 数组中要删除的一项。
  9003. * @returns {Array} 执行删除操作后的数组。
  9004. */
  9005. removeItem: function (array, item) {
  9006. for (var i = array.length - 1; i >= 0; i--) {
  9007. if (array[i] === item) {
  9008. array.splice(i, 1);
  9009. //break;more than once??
  9010. }
  9011. }
  9012. return array;
  9013. },
  9014. /**
  9015. * @memberOf CommonUtil
  9016. * @description 获取某对象在数组中的索引值。
  9017. * @param {Array.<Object>} array - 数组。
  9018. * @param {Object} obj - 对象。
  9019. * @returns {number} 某对象在数组中的索引值。
  9020. */
  9021. indexOf: function (array, obj) {
  9022. if (array == null) {
  9023. return -1;
  9024. } else {
  9025. // use the build-in function if available.
  9026. if (typeof array.indexOf === 'function') {
  9027. return array.indexOf(obj);
  9028. } else {
  9029. for (var i = 0, len = array.length; i < len; i++) {
  9030. if (array[i] === obj) {
  9031. return i;
  9032. }
  9033. }
  9034. return -1;
  9035. }
  9036. }
  9037. },
  9038. /**
  9039. * @memberOf CommonUtil
  9040. * @description 修改某 DOM 元素的许多属性。
  9041. * @param {HTMLElement} element - 待修改的 DOM 元素。
  9042. * @param {string} [id] - DOM 元素的 ID。
  9043. * @param {Pixel} [px] - DOM 元素的 style 属性的 left 和 top 属性。
  9044. * @param {Size} [sz] - DOM 元素的 width 和 height 属性。
  9045. * @param {string} [position] - DOM 元素的 position 属性。
  9046. * @param {string} [border] - DOM 元素的 style 属性的 border 属性。
  9047. * @param {string} [overflow] - DOM 元素的 style 属性的 overflow 属性。
  9048. * @param {number} [opacity] - 不透明度值。取值范围为(0.0 - 1.0)。
  9049. */
  9050. modifyDOMElement: function (element, id, px, sz, position, border, overflow, opacity) {
  9051. if (id) {
  9052. element.id = id;
  9053. }
  9054. if (px) {
  9055. element.style.left = px.x + 'px';
  9056. element.style.top = px.y + 'px';
  9057. }
  9058. if (sz) {
  9059. element.style.width = sz.w + 'px';
  9060. element.style.height = sz.h + 'px';
  9061. }
  9062. if (position) {
  9063. element.style.position = position;
  9064. }
  9065. if (border) {
  9066. element.style.border = border;
  9067. }
  9068. if (overflow) {
  9069. element.style.overflow = overflow;
  9070. }
  9071. if (parseFloat(opacity) >= 0.0 && parseFloat(opacity) < 1.0) {
  9072. element.style.filter = 'alpha(opacity=' + opacity * 100 + ')';
  9073. element.style.opacity = opacity;
  9074. } else if (parseFloat(opacity) === 1.0) {
  9075. element.style.filter = '';
  9076. element.style.opacity = '';
  9077. }
  9078. },
  9079. /**
  9080. * @memberOf CommonUtil
  9081. * @description 比较两个对象并合并。
  9082. * @param {Object} [to] - 目标对象。
  9083. * @param {Object} from - 源对象。
  9084. * @returns {Object} 返回合并后的对象。
  9085. */
  9086. applyDefaults: function (to, from) {
  9087. to = to || {};
  9088. /*
  9089. * FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
  9090. * prototype object" when calling hawOwnProperty if the source object is an
  9091. * instance of window.Event.
  9092. */
  9093. var fromIsEvt = typeof window.Event === 'function' && from instanceof window.Event;
  9094. for (var key in from) {
  9095. if (
  9096. to[key] === undefined ||
  9097. (!fromIsEvt && from.hasOwnProperty && from.hasOwnProperty(key) && !to.hasOwnProperty(key))
  9098. ) {
  9099. to[key] = from[key];
  9100. }
  9101. }
  9102. /**
  9103. * IE doesn't include the toString property when iterating over an object's
  9104. * properties with the for(property in object) syntax. Explicitly check if
  9105. * the source has its own toString property.
  9106. */
  9107. if (
  9108. !fromIsEvt &&
  9109. from &&
  9110. from.hasOwnProperty &&
  9111. from.hasOwnProperty('toString') &&
  9112. !to.hasOwnProperty('toString')
  9113. ) {
  9114. to.toString = from.toString;
  9115. }
  9116. return to;
  9117. },
  9118. /**
  9119. * @memberOf CommonUtil
  9120. * @description 将参数对象转换为 HTTP 的 GET 请求中的参数字符串。例如:"key1=value1&key2=value2&key3=value3"。
  9121. * @param {Object} params - 参数对象。
  9122. * @returns {string} HTTP 的 GET 请求中的参数字符串。
  9123. */
  9124. getParameterString: function (params) {
  9125. var paramsArray = [];
  9126. for (var key in params) {
  9127. var value = params[key];
  9128. if (value != null && typeof value !== 'function') {
  9129. var encodedValue;
  9130. if (Array.isArray(value) || value.toString() === '[object Object]') {
  9131. encodedValue = encodeURIComponent(JSON.stringify(value));
  9132. } else {
  9133. /* value is a string; simply encode */
  9134. encodedValue = encodeURIComponent(value);
  9135. }
  9136. paramsArray.push(encodeURIComponent(key) + '=' + encodedValue);
  9137. }
  9138. }
  9139. return paramsArray.join('&');
  9140. },
  9141. /**
  9142. * @memberOf CommonUtil
  9143. * @description 给 URL 追加查询参数。
  9144. * @param {string} url - 待追加参数的 URL 字符串。
  9145. * @param {string} paramStr - 待追加的查询参数。
  9146. * @returns {string} 新的 URL。
  9147. */
  9148. urlAppend: function (url, paramStr) {
  9149. var newUrl = url;
  9150. if (paramStr) {
  9151. if (paramStr.indexOf('?') === 0) {
  9152. paramStr = paramStr.substring(1);
  9153. }
  9154. var parts = (url + ' ').split(/[?&]/);
  9155. newUrl += parts.pop() === ' ' ? paramStr : parts.length ? '&' + paramStr : '?' + paramStr;
  9156. }
  9157. return newUrl;
  9158. },
  9159. /**
  9160. * @memberOf CommonUtil
  9161. * @description 给 URL 追加 path 参数。
  9162. * @param {string} url - 待追加参数的 URL 字符串。
  9163. * @param {string} paramStr - 待追加的path参数。
  9164. * @returns {string} 新的 URL。
  9165. */
  9166. urlPathAppend: function (url, pathStr) {
  9167. let newUrl = url;
  9168. if (!pathStr) {
  9169. return newUrl;
  9170. }
  9171. if (pathStr.indexOf('/') === 0) {
  9172. pathStr = pathStr.substring(1);
  9173. }
  9174. const parts = url.split('?');
  9175. if (parts[0].indexOf('/', parts[0].length - 1) < 0) {
  9176. parts[0] += '/';
  9177. }
  9178. newUrl = `${parts[0]}${pathStr}${parts.length > 1 ? `?${parts[1]}` : ''}`;
  9179. return newUrl;
  9180. },
  9181. /**
  9182. * @memberOf CommonUtil
  9183. * @description 为了避免浮点精度错误而保留的有效位数。
  9184. * @type {number}
  9185. * @default 14
  9186. */
  9187. DEFAULT_PRECISION: 14,
  9188. /**
  9189. * @memberOf CommonUtil
  9190. * @description 将字符串以接近的精度转换为数字。
  9191. * @param {string} number - 字符串。
  9192. * @param {number} [precision=14] - 精度。
  9193. * @returns {number} 转化后的数字。
  9194. */
  9195. toFloat: function (number, precision) {
  9196. if (precision == null) {
  9197. precision = Util_Util.DEFAULT_PRECISION;
  9198. }
  9199. if (typeof number !== 'number') {
  9200. number = parseFloat(number);
  9201. }
  9202. return precision === 0 ? number : parseFloat(number.toPrecision(precision));
  9203. },
  9204. /**
  9205. * @memberOf CommonUtil
  9206. * @description 角度转弧度。
  9207. * @param {number} x - 角度。
  9208. * @returns {number} 转化后的弧度。
  9209. */
  9210. rad: function (x) {
  9211. return (x * Math.PI) / 180;
  9212. },
  9213. /**
  9214. * @memberOf CommonUtil
  9215. * @description 从 URL 字符串中解析出参数对象。
  9216. * @param {string} url - URL。
  9217. * @returns {Object} 解析出的参数对象。
  9218. */
  9219. getParameters: function (url) {
  9220. // if no url specified, take it from the location bar
  9221. url = url === null || url === undefined ? window.location.href : url;
  9222. //parse out parameters portion of url string
  9223. var paramsString = '';
  9224. if (StringExt.contains(url, '?')) {
  9225. var start = url.indexOf('?') + 1;
  9226. var end = StringExt.contains(url, '#') ? url.indexOf('#') : url.length;
  9227. paramsString = url.substring(start, end);
  9228. }
  9229. var parameters = {};
  9230. var pairs = paramsString.split(/[&;]/);
  9231. for (var i = 0, len = pairs.length; i < len; ++i) {
  9232. var keyValue = pairs[i].split('=');
  9233. if (keyValue[0]) {
  9234. var key = keyValue[0];
  9235. try {
  9236. key = decodeURIComponent(key);
  9237. } catch (err) {
  9238. key = unescape(key);
  9239. }
  9240. // being liberal by replacing "+" with " "
  9241. var value = (keyValue[1] || '').replace(/\+/g, ' ');
  9242. try {
  9243. value = decodeURIComponent(value);
  9244. } catch (err) {
  9245. value = unescape(value);
  9246. }
  9247. // follow OGC convention of comma delimited values
  9248. value = value.split(',');
  9249. //if there's only one value, do not return as array
  9250. if (value.length == 1) {
  9251. value = value[0];
  9252. }
  9253. parameters[key] = value;
  9254. }
  9255. }
  9256. return parameters;
  9257. },
  9258. /**
  9259. * @memberOf CommonUtil
  9260. * @description 不断递增计数变量,用于生成唯一 ID。
  9261. * @type {number}
  9262. * @default 0
  9263. */
  9264. lastSeqID: 0,
  9265. /**
  9266. * @memberOf CommonUtil
  9267. * @description 创建唯一 ID 值。
  9268. * @param {string} [prefix] - 前缀。
  9269. * @returns {string} 唯一的 ID 值。
  9270. */
  9271. createUniqueID: function (prefix) {
  9272. if (prefix == null) {
  9273. prefix = 'id_';
  9274. }
  9275. Util_Util.lastSeqID += 1;
  9276. return prefix + Util_Util.lastSeqID;
  9277. },
  9278. /**
  9279. * @memberOf CommonUtil
  9280. * @description 判断并转化比例尺。
  9281. * @param {number} scale - 比例尺。
  9282. * @returns {number} 正常的 scale 值。
  9283. */
  9284. normalizeScale: function (scale) {
  9285. var normScale = scale > 1.0 ? 1.0 / scale : scale;
  9286. return normScale;
  9287. },
  9288. /**
  9289. * @memberOf CommonUtil
  9290. * @description 比例尺转分辨率。
  9291. * @param {number} scale - 比例尺。
  9292. * @param {string} [units='degrees'] - 比例尺单位。
  9293. * @returns {number} 转化后的分辨率。
  9294. */
  9295. getResolutionFromScale: function (scale, units) {
  9296. var resolution;
  9297. if (scale) {
  9298. if (units == null) {
  9299. units = 'degrees';
  9300. }
  9301. var normScale = Util_Util.normalizeScale(scale);
  9302. resolution = 1 / (normScale * INCHES_PER_UNIT[units] * DOTS_PER_INCH);
  9303. }
  9304. return resolution;
  9305. },
  9306. /**
  9307. * @memberOf CommonUtil
  9308. * @description 分辨率转比例尺。
  9309. * @param {number} resolution - 分辨率。
  9310. * @param {string} [units='degrees'] - 分辨率单位。
  9311. * @returns {number} 转化后的比例尺。
  9312. */
  9313. getScaleFromResolution: function (resolution, units) {
  9314. if (units == null) {
  9315. units = 'degrees';
  9316. }
  9317. var scale = resolution * INCHES_PER_UNIT[units] * DOTS_PER_INCH;
  9318. return scale;
  9319. },
  9320. /**
  9321. * @memberOf CommonUtil
  9322. * @description 获取浏览器相关信息。支持的浏览器包括:Opera,Internet Explorer,Safari,Firefox。
  9323. * @returns {Object} 浏览器名称、版本、设备名称。对应的属性分别为 name, version, device。
  9324. */
  9325. getBrowser: function () {
  9326. return Browser;
  9327. },
  9328. /**
  9329. * @memberOf CommonUtil
  9330. * @description 浏览器是否支持 Canvas。
  9331. * @returns {boolean} 当前浏览器是否支持 HTML5 Canvas。
  9332. */
  9333. isSupportCanvas,
  9334. /**
  9335. * @memberOf CommonUtil
  9336. * @description 判断浏览器是否支持 Canvas。
  9337. * @returns {boolean} 当前浏览器是否支持 HTML5 Canvas 。
  9338. */
  9339. supportCanvas: function () {
  9340. return Util_Util.isSupportCanvas;
  9341. },
  9342. /**
  9343. * @memberOf CommonUtil
  9344. * @description 判断一个 URL 请求是否在当前域中。
  9345. * @param {string} url - URL 请求字符串。
  9346. * @returns {boolean} URL 请求是否在当前域中。
  9347. */
  9348. isInTheSameDomain: function (url) {
  9349. if (!url) {
  9350. return true;
  9351. }
  9352. var index = url.indexOf('//');
  9353. var documentUrl = document.location.toString();
  9354. var documentIndex = documentUrl.indexOf('//');
  9355. if (index === -1) {
  9356. return true;
  9357. } else {
  9358. var protocol;
  9359. var substring = (protocol = url.substring(0, index));
  9360. var documentSubString = documentUrl.substring(documentIndex + 2);
  9361. documentIndex = documentSubString.indexOf('/');
  9362. var documentPortIndex = documentSubString.indexOf(':');
  9363. var documentDomainWithPort = documentSubString.substring(0, documentIndex);
  9364. //var documentPort;
  9365. var documentprotocol = document.location.protocol;
  9366. if (documentPortIndex !== -1) {
  9367. // documentPort = +documentSubString.substring(documentPortIndex, documentIndex);
  9368. } else {
  9369. documentDomainWithPort += ':' + (documentprotocol.toLowerCase() === 'http:' ? 80 : 443);
  9370. }
  9371. if (documentprotocol.toLowerCase() !== substring.toLowerCase()) {
  9372. return false;
  9373. }
  9374. substring = url.substring(index + 2);
  9375. var portIndex = substring.indexOf(':');
  9376. index = substring.indexOf('/');
  9377. var domainWithPort = substring.substring(0, index);
  9378. var domain;
  9379. if (portIndex !== -1) {
  9380. domain = substring.substring(0, portIndex);
  9381. } else {
  9382. domain = substring.substring(0, index);
  9383. domainWithPort += ':' + (protocol.toLowerCase() === 'http:' ? 80 : 443);
  9384. }
  9385. var documentDomain = document.domain;
  9386. if (domain === documentDomain && domainWithPort === documentDomainWithPort) {
  9387. return true;
  9388. }
  9389. }
  9390. return false;
  9391. },
  9392. /**
  9393. * @memberOf CommonUtil
  9394. * @description 计算 iServer 服务的 REST 图层的显示分辨率,需要从 iServer 的 REST 图层表述中获取 viewBounds、viewer、scale、coordUnit、datumAxis 五个参数,来进行计算。
  9395. * @param {Bounds} viewBounds - 地图的参照可视范围,即地图初始化时默认的地图显示范围。
  9396. * @param {Size} viewer - 地图初始化时默认的地图图片的尺寸。
  9397. * @param {number} scale - 地图初始化时默认的显示比例尺。
  9398. * @param {string} [coordUnit='degrees'] - 投影坐标系统的地图单位。
  9399. * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则系统默认为 WGS84 参考系的椭球体长半轴 6378137。
  9400. * @returns {number} 图层显示分辨率。
  9401. */
  9402. calculateDpi: function (viewBounds, viewer, scale, coordUnit, datumAxis) {
  9403. //10000 是 0.1毫米与米的转换。DPI的计算公式:Viewer / DPI * 0.0254 * 10000 = ViewBounds * scale ,公式中的10000是为了提高计算结果的精度,以下出现的ratio皆为如此。
  9404. if (!viewBounds || !viewer || !scale) {
  9405. return;
  9406. }
  9407. var ratio = 10000,
  9408. rvbWidth = viewBounds.getWidth(),
  9409. rvbHeight = viewBounds.getHeight(),
  9410. rvWidth = viewer.w,
  9411. rvHeight = viewer.h;
  9412. //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
  9413. datumAxis = datumAxis || 6378137;
  9414. coordUnit = coordUnit || 'degrees';
  9415. var dpi;
  9416. if (
  9417. coordUnit.toLowerCase() === 'degree' ||
  9418. coordUnit.toLowerCase() === 'degrees' ||
  9419. coordUnit.toLowerCase() === 'dd'
  9420. ) {
  9421. let num1 = rvbWidth / rvWidth,
  9422. num2 = rvbHeight / rvHeight,
  9423. resolution = num1 > num2 ? num1 : num2;
  9424. dpi = (0.0254 * ratio) / resolution / scale / ((Math.PI * 2 * datumAxis) / 360) / ratio;
  9425. } else {
  9426. let resolution = rvbWidth / rvWidth;
  9427. dpi = (0.0254 * ratio) / resolution / scale / ratio;
  9428. }
  9429. return dpi;
  9430. },
  9431. /**
  9432. * @memberOf CommonUtil
  9433. * @description 将对象转换成 JSON 字符串。
  9434. * @param {Object} obj - 要转换成 JSON 的 Object 对象。
  9435. * @returns {string} 转换后的 JSON 对象。
  9436. */
  9437. toJSON: function (obj) {
  9438. var objInn = obj;
  9439. if (objInn == null) {
  9440. return null;
  9441. }
  9442. switch (objInn.constructor) {
  9443. case String:
  9444. //s = "'" + str.replace(/(["\\])/g, "\\$1") + "'"; string含有单引号出错
  9445. objInn = '"' + objInn.replace(/(["\\])/g, '\\$1') + '"';
  9446. objInn = objInn.replace(/\n/g, '\\n');
  9447. objInn = objInn.replace(/\r/g, '\\r');
  9448. objInn = objInn.replace('<', '&lt;');
  9449. objInn = objInn.replace('>', '&gt;');
  9450. objInn = objInn.replace(/%/g, '%25');
  9451. objInn = objInn.replace(/&/g, '%26');
  9452. return objInn;
  9453. case Array:
  9454. var arr = '';
  9455. for (var i = 0, len = objInn.length; i < len; i++) {
  9456. arr += Util_Util.toJSON(objInn[i]);
  9457. if (i !== objInn.length - 1) {
  9458. arr += ',';
  9459. }
  9460. }
  9461. return "[" + arr + "]";
  9462. case Number:
  9463. return isFinite(objInn) ? String(objInn) : null;
  9464. case Boolean:
  9465. return String(objInn);
  9466. case Date:
  9467. var dateStr =
  9468. '{' +
  9469. '\'__type\':"System.DateTime",' +
  9470. "'Year':" +
  9471. objInn.getFullYear() +
  9472. ',' +
  9473. "'Month':" +
  9474. (objInn.getMonth() + 1) +
  9475. ',' +
  9476. "'Day':" +
  9477. objInn.getDate() +
  9478. ',' +
  9479. "'Hour':" +
  9480. objInn.getHours() +
  9481. ',' +
  9482. "'Minute':" +
  9483. objInn.getMinutes() +
  9484. ',' +
  9485. "'Second':" +
  9486. objInn.getSeconds() +
  9487. ',' +
  9488. "'Millisecond':" +
  9489. objInn.getMilliseconds() +
  9490. ',' +
  9491. "'TimezoneOffset':" +
  9492. objInn.getTimezoneOffset() +
  9493. '}';
  9494. return dateStr;
  9495. default:
  9496. if (objInn['toJSON'] != null && typeof objInn['toJSON'] === 'function') {
  9497. return objInn.toJSON();
  9498. }
  9499. if (typeof objInn === 'object') {
  9500. if (objInn.length) {
  9501. let arr = [];
  9502. for (let i = 0, len = objInn.length; i < len; i++) {
  9503. arr.push(Util_Util.toJSON(objInn[i]));
  9504. }
  9505. return '[' + arr.join(',') + ']';
  9506. }
  9507. let arr = [];
  9508. for (let attr in objInn) {
  9509. //为解决Geometry类型头json时堆栈溢出的问题,attr == "parent"时不进行json转换
  9510. if (typeof objInn[attr] !== 'function' && attr !== 'CLASS_NAME' && attr !== 'parent') {
  9511. arr.push("'" + attr + "':" + Util_Util.toJSON(objInn[attr]));
  9512. }
  9513. }
  9514. if (arr.length > 0) {
  9515. return '{' + arr.join(',') + '}';
  9516. } else {
  9517. return '{}';
  9518. }
  9519. }
  9520. return objInn.toString();
  9521. }
  9522. },
  9523. /**
  9524. * @memberOf CommonUtil
  9525. * @description 根据比例尺和 DPI 计算屏幕分辨率。
  9526. * @category BaseTypes Util
  9527. * @param {number} scale - 比例尺。
  9528. * @param {number} dpi - 图像分辨率,表示每英寸内的像素个数。
  9529. * @param {string} [coordUnit] - 投影坐标系统的地图单位。
  9530. * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则 DPI 默认按照 WGS84 参考系的椭球体长半轴 6378137 来计算。
  9531. * @returns {number} 当前比例尺下的屏幕分辨率。
  9532. */
  9533. getResolutionFromScaleDpi: function (scale, dpi, coordUnit, datumAxis) {
  9534. var resolution = null,
  9535. ratio = 10000;
  9536. //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
  9537. datumAxis = datumAxis || 6378137;
  9538. coordUnit = coordUnit || '';
  9539. if (scale > 0 && dpi > 0) {
  9540. scale = Util_Util.normalizeScale(scale);
  9541. if (
  9542. coordUnit.toLowerCase() === 'degree' ||
  9543. coordUnit.toLowerCase() === 'degrees' ||
  9544. coordUnit.toLowerCase() === 'dd'
  9545. ) {
  9546. //scale = Util.normalizeScale(scale);
  9547. resolution = (0.0254 * ratio) / dpi / scale / ((Math.PI * 2 * datumAxis) / 360) / ratio;
  9548. return resolution;
  9549. } else {
  9550. resolution = (0.0254 * ratio) / dpi / scale / ratio;
  9551. return resolution;
  9552. }
  9553. }
  9554. return -1;
  9555. },
  9556. /**
  9557. * @memberOf CommonUtil
  9558. * @description 根据 resolution、dpi、coordUnit 和 datumAxis 计算比例尺。
  9559. * @param {number} resolution - 用于计算比例尺的地图分辨率。
  9560. * @param {number} dpi - 图像分辨率,表示每英寸内的像素个数。
  9561. * @param {string} [coordUnit] - 投影坐标系统的地图单位。
  9562. * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则 DPI 默认按照 WGS84 参考系的椭球体长半轴 6378137 来计算。
  9563. * @returns {number} 当前屏幕分辨率下的比例尺。
  9564. */
  9565. getScaleFromResolutionDpi: function (resolution, dpi, coordUnit, datumAxis) {
  9566. var scale = null,
  9567. ratio = 10000;
  9568. //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
  9569. datumAxis = datumAxis || 6378137;
  9570. coordUnit = coordUnit || '';
  9571. if (resolution > 0 && dpi > 0) {
  9572. if (
  9573. coordUnit.toLowerCase() === 'degree' ||
  9574. coordUnit.toLowerCase() === 'degrees' ||
  9575. coordUnit.toLowerCase() === 'dd'
  9576. ) {
  9577. scale = (0.0254 * ratio) / dpi / resolution / ((Math.PI * 2 * datumAxis) / 360) / ratio;
  9578. return scale;
  9579. } else {
  9580. scale = (0.0254 * ratio) / dpi / resolution / ratio;
  9581. return scale;
  9582. }
  9583. }
  9584. return -1;
  9585. },
  9586. /**
  9587. * @memberOf CommonUtil
  9588. * @description 转换查询结果。
  9589. * @param {Object} result - 查询结果。
  9590. * @returns {Object} 转换后的查询结果。
  9591. */
  9592. transformResult: function (result) {
  9593. if (result.responseText && typeof result.responseText === 'string') {
  9594. result = JSON.parse(result.responseText);
  9595. }
  9596. return result;
  9597. },
  9598. /**
  9599. * @memberOf CommonUtil
  9600. * @description 属性拷贝,不拷贝方法类名(CLASS_NAME)等。
  9601. * @param {Object} [destination] - 拷贝目标。
  9602. * @param {Object} source - 源对象。
  9603. *
  9604. */
  9605. copyAttributes: function (destination, source) {
  9606. destination = destination || {};
  9607. if (source) {
  9608. for (var property in source) {
  9609. var value = source[property];
  9610. if (value !== undefined && property !== 'CLASS_NAME' && typeof value !== 'function') {
  9611. destination[property] = value;
  9612. }
  9613. }
  9614. }
  9615. return destination;
  9616. },
  9617. /**
  9618. * @memberOf CommonUtil
  9619. * @description 将源对象上的属性拷贝到目标对象上。(不拷贝 CLASS_NAME 和方法)
  9620. * @param {Object} [destination] - 目标对象。
  9621. * @param {Object} source - 源对象。
  9622. * @param {Array.<string>} clip - 源对象中禁止拷贝到目标对象的属性,目的是防止目标对象上不可修改的属性被篡改。
  9623. *
  9624. */
  9625. copyAttributesWithClip: function (destination, source, clip) {
  9626. destination = destination || {};
  9627. if (source) {
  9628. for (var property in source) {
  9629. //去掉禁止拷贝的属性
  9630. var isInClip = false;
  9631. if (clip && clip.length) {
  9632. for (var i = 0, len = clip.length; i < len; i++) {
  9633. if (property === clip[i]) {
  9634. isInClip = true;
  9635. break;
  9636. }
  9637. }
  9638. }
  9639. if (isInClip === true) {
  9640. continue;
  9641. }
  9642. var value = source[property];
  9643. if (value !== undefined && property !== 'CLASS_NAME' && typeof value !== 'function') {
  9644. destination[property] = value;
  9645. }
  9646. }
  9647. }
  9648. return destination;
  9649. },
  9650. /**
  9651. * @memberOf CommonUtil
  9652. * @description 克隆一个 Object 对象。
  9653. * @param {Object} obj - 需要克隆的对象。
  9654. * @returns {Object} 对象的拷贝对象,注意是新的对象,不是指向。
  9655. */
  9656. cloneObject: function (obj) {
  9657. // Handle the 3 simple types, and null or undefined
  9658. if (null === obj || 'object' !== typeof obj) {
  9659. return obj;
  9660. }
  9661. // Handle Date
  9662. if (obj instanceof Date) {
  9663. let copy = new Date();
  9664. copy.setTime(obj.getTime());
  9665. return copy;
  9666. }
  9667. // Handle Array
  9668. if (obj instanceof Array) {
  9669. let copy = obj.slice(0);
  9670. return copy;
  9671. }
  9672. // Handle Object
  9673. if (obj instanceof Object) {
  9674. let copy = {};
  9675. for (var attr in obj) {
  9676. if (obj.hasOwnProperty(attr)) {
  9677. copy[attr] = Util_Util.cloneObject(obj[attr]);
  9678. }
  9679. }
  9680. return copy;
  9681. }
  9682. throw new Error("Unable to copy obj! Its type isn't supported.");
  9683. },
  9684. /**
  9685. * @memberOf CommonUtil
  9686. * @description 判断两条线段是不是有交点。
  9687. * @param {GeometryPoint} a1 - 第一条线段的起始节点。
  9688. * @param {GeometryPoint} a2 - 第一条线段的结束节点。
  9689. * @param {GeometryPoint} b1 - 第二条线段的起始节点。
  9690. * @param {GeometryPoint} b2 - 第二条线段的结束节点。
  9691. * @returns {Object} 如果相交返回交点,如果不相交返回两条线段的位置关系。
  9692. */
  9693. lineIntersection: function (a1, a2, b1, b2) {
  9694. var intersectValue = null;
  9695. var k1;
  9696. var k2;
  9697. var b = (b2.x - b1.x) * (a1.y - b1.y) - (b2.y - b1.y) * (a1.x - b1.x);
  9698. var a = (a2.x - a1.x) * (a1.y - b1.y) - (a2.y - a1.y) * (a1.x - b1.x);
  9699. var ab = (b2.y - b1.y) * (a2.x - a1.x) - (b2.x - b1.x) * (a2.y - a1.y);
  9700. //ab==0代表两条线断的斜率一样
  9701. if (ab != 0) {
  9702. k1 = b / ab;
  9703. k2 = a / ab;
  9704. if (k1 >= 0 && k2 <= 1 && k1 <= 1 && k2 >= 0) {
  9705. intersectValue = new Geometry_Geometry.Point(a1.x + k1 * (a2.x - a1.x), a1.y + k1 * (a2.y - a1.y));
  9706. } else {
  9707. intersectValue = 'No Intersection';
  9708. }
  9709. } else {
  9710. if (b == 0 && a == 0) {
  9711. var maxy = Math.max(a1.y, a2.y);
  9712. var miny = Math.min(a1.y, a2.y);
  9713. var maxx = Math.max(a1.x, a2.x);
  9714. var minx = Math.min(a1.x, a2.x);
  9715. if (
  9716. (((b1.y >= miny && b1.y <= maxy) || (b2.y >= miny && b2.y <= maxy)) && b1.x >= minx && b1.x <= maxx) ||
  9717. (b2.x >= minx && b2.x <= maxx)
  9718. ) {
  9719. intersectValue = 'Coincident'; //重合
  9720. } else {
  9721. intersectValue = 'Parallel'; //平行
  9722. }
  9723. } else {
  9724. intersectValue = 'Parallel'; //平行
  9725. }
  9726. }
  9727. return intersectValue;
  9728. },
  9729. /**
  9730. * @memberOf CommonUtil
  9731. * @description 获取文本外接矩形宽度与高度。
  9732. * @param {ThemeStyle} style - 文本样式。
  9733. * @param {string} text - 文本内容。
  9734. * @param {Object} element - DOM 元素。
  9735. * @returns {Object} 裁剪后的宽度,高度信息。
  9736. */
  9737. getTextBounds: function (style, text, element) {
  9738. document.body.appendChild(element);
  9739. element.style.width = 'auto';
  9740. element.style.height = 'auto';
  9741. if (style.fontSize) {
  9742. element.style.fontSize = style.fontSize;
  9743. }
  9744. if (style.fontFamily) {
  9745. element.style.fontFamily = style.fontFamily;
  9746. }
  9747. if (style.fontWeight) {
  9748. element.style.fontWeight = style.fontWeight;
  9749. }
  9750. element.style.position = 'relative';
  9751. element.style.visibility = 'hidden';
  9752. //fix 在某些情况下,element内的文本变成竖起排列,导致宽度计算不正确的bug
  9753. element.style.display = 'inline-block';
  9754. element.innerHTML = text;
  9755. var textWidth = element.clientWidth;
  9756. var textHeight = element.clientHeight;
  9757. document.body.removeChild(element);
  9758. return {
  9759. textWidth: textWidth,
  9760. textHeight: textHeight
  9761. };
  9762. },
  9763. /**
  9764. * @memberOf CommonUtil
  9765. * @description 获取转换后的path路径。
  9766. * @param {string} path - 待转换的path,包含`{param}`。
  9767. * @param {Object} pathParams - path中待替换的参数。
  9768. * @returns {string} 转换后的path路径。
  9769. */
  9770. convertPath: function (path, pathParams) {
  9771. if (!pathParams) {
  9772. return path;
  9773. }
  9774. return path.replace(/\{([\w-\.]+)\}/g, (fullMatch, key) => {
  9775. var value;
  9776. if (pathParams.hasOwnProperty(key)) {
  9777. value = paramToString(pathParams[key]);
  9778. } else {
  9779. value = fullMatch;
  9780. }
  9781. return encodeURIComponent(value);
  9782. });
  9783. }
  9784. };
  9785. /**
  9786. * @enum INCHES_PER_UNIT
  9787. * @description 每单位的英尺数。
  9788. * @type {number}
  9789. * @private
  9790. */
  9791. const INCHES_PER_UNIT = {
  9792. inches: 1.0,
  9793. ft: 12.0,
  9794. mi: 63360.0,
  9795. m: 39.3701,
  9796. km: 39370.1,
  9797. dd: 4374754,
  9798. yd: 36
  9799. };
  9800. INCHES_PER_UNIT['in'] = INCHES_PER_UNIT.inches;
  9801. INCHES_PER_UNIT['degrees'] = INCHES_PER_UNIT.dd;
  9802. INCHES_PER_UNIT['nmi'] = 1852 * INCHES_PER_UNIT.m;
  9803. // Units from CS-Map
  9804. const METERS_PER_INCH = 0.0254000508001016002;
  9805. Util_Util.extend(INCHES_PER_UNIT, {
  9806. Inch: INCHES_PER_UNIT.inches,
  9807. Meter: 1.0 / METERS_PER_INCH, //EPSG:9001
  9808. Foot: 0.30480060960121920243 / METERS_PER_INCH, //EPSG:9003
  9809. IFoot: 0.3048 / METERS_PER_INCH, //EPSG:9002
  9810. ClarkeFoot: 0.3047972651151 / METERS_PER_INCH, //EPSG:9005
  9811. SearsFoot: 0.30479947153867624624 / METERS_PER_INCH, //EPSG:9041
  9812. GoldCoastFoot: 0.30479971018150881758 / METERS_PER_INCH, //EPSG:9094
  9813. IInch: 0.0254 / METERS_PER_INCH,
  9814. MicroInch: 0.0000254 / METERS_PER_INCH,
  9815. Mil: 0.0000000254 / METERS_PER_INCH,
  9816. Centimeter: 0.01 / METERS_PER_INCH,
  9817. Kilometer: 1000.0 / METERS_PER_INCH, //EPSG:9036
  9818. Yard: 0.91440182880365760731 / METERS_PER_INCH,
  9819. SearsYard: 0.914398414616029 / METERS_PER_INCH, //EPSG:9040
  9820. IndianYard: 0.91439853074444079983 / METERS_PER_INCH, //EPSG:9084
  9821. IndianYd37: 0.91439523 / METERS_PER_INCH, //EPSG:9085
  9822. IndianYd62: 0.9143988 / METERS_PER_INCH, //EPSG:9086
  9823. IndianYd75: 0.9143985 / METERS_PER_INCH, //EPSG:9087
  9824. IndianFoot: 0.30479951 / METERS_PER_INCH, //EPSG:9080
  9825. IndianFt37: 0.30479841 / METERS_PER_INCH, //EPSG:9081
  9826. IndianFt62: 0.3047996 / METERS_PER_INCH, //EPSG:9082
  9827. IndianFt75: 0.3047995 / METERS_PER_INCH, //EPSG:9083
  9828. Mile: 1609.34721869443738887477 / METERS_PER_INCH,
  9829. IYard: 0.9144 / METERS_PER_INCH, //EPSG:9096
  9830. IMile: 1609.344 / METERS_PER_INCH, //EPSG:9093
  9831. NautM: 1852.0 / METERS_PER_INCH, //EPSG:9030
  9832. 'Lat-66': 110943.316488932731 / METERS_PER_INCH,
  9833. 'Lat-83': 110946.25736872234125 / METERS_PER_INCH,
  9834. Decimeter: 0.1 / METERS_PER_INCH,
  9835. Millimeter: 0.001 / METERS_PER_INCH,
  9836. Dekameter: 10.0 / METERS_PER_INCH,
  9837. Decameter: 10.0 / METERS_PER_INCH,
  9838. Hectometer: 100.0 / METERS_PER_INCH,
  9839. GermanMeter: 1.0000135965 / METERS_PER_INCH, //EPSG:9031
  9840. CaGrid: 0.999738 / METERS_PER_INCH,
  9841. ClarkeChain: 20.1166194976 / METERS_PER_INCH, //EPSG:9038
  9842. GunterChain: 20.11684023368047 / METERS_PER_INCH, //EPSG:9033
  9843. BenoitChain: 20.116782494375872 / METERS_PER_INCH, //EPSG:9062
  9844. SearsChain: 20.11676512155 / METERS_PER_INCH, //EPSG:9042
  9845. ClarkeLink: 0.201166194976 / METERS_PER_INCH, //EPSG:9039
  9846. GunterLink: 0.2011684023368047 / METERS_PER_INCH, //EPSG:9034
  9847. BenoitLink: 0.20116782494375872 / METERS_PER_INCH, //EPSG:9063
  9848. SearsLink: 0.2011676512155 / METERS_PER_INCH, //EPSG:9043
  9849. Rod: 5.02921005842012 / METERS_PER_INCH,
  9850. IntnlChain: 20.1168 / METERS_PER_INCH, //EPSG:9097
  9851. IntnlLink: 0.201168 / METERS_PER_INCH, //EPSG:9098
  9852. Perch: 5.02921005842012 / METERS_PER_INCH,
  9853. Pole: 5.02921005842012 / METERS_PER_INCH,
  9854. Furlong: 201.1684023368046 / METERS_PER_INCH,
  9855. Rood: 3.778266898 / METERS_PER_INCH,
  9856. CapeFoot: 0.3047972615 / METERS_PER_INCH,
  9857. Brealey: 375.0 / METERS_PER_INCH,
  9858. ModAmFt: 0.304812252984505969011938 / METERS_PER_INCH,
  9859. Fathom: 1.8288 / METERS_PER_INCH,
  9860. 'NautM-UK': 1853.184 / METERS_PER_INCH,
  9861. '50kilometers': 50000.0 / METERS_PER_INCH,
  9862. '150kilometers': 150000.0 / METERS_PER_INCH
  9863. });
  9864. //unit abbreviations supported by PROJ.4
  9865. Util_Util.extend(INCHES_PER_UNIT, {
  9866. mm: INCHES_PER_UNIT['Meter'] / 1000.0,
  9867. cm: INCHES_PER_UNIT['Meter'] / 100.0,
  9868. dm: INCHES_PER_UNIT['Meter'] * 100.0,
  9869. km: INCHES_PER_UNIT['Meter'] * 1000.0,
  9870. kmi: INCHES_PER_UNIT['nmi'], //International Nautical Mile
  9871. fath: INCHES_PER_UNIT['Fathom'], //International Fathom
  9872. ch: INCHES_PER_UNIT['IntnlChain'], //International Chain
  9873. link: INCHES_PER_UNIT['IntnlLink'], //International Link
  9874. 'us-in': INCHES_PER_UNIT['inches'], //U.S. Surveyor's Inch
  9875. 'us-ft': INCHES_PER_UNIT['Foot'], //U.S. Surveyor's Foot
  9876. 'us-yd': INCHES_PER_UNIT['Yard'], //U.S. Surveyor's Yard
  9877. 'us-ch': INCHES_PER_UNIT['GunterChain'], //U.S. Surveyor's Chain
  9878. 'us-mi': INCHES_PER_UNIT['Mile'], //U.S. Surveyor's Statute Mile
  9879. 'ind-yd': INCHES_PER_UNIT['IndianYd37'], //Indian Yard
  9880. 'ind-ft': INCHES_PER_UNIT['IndianFt37'], //Indian Foot
  9881. 'ind-ch': 20.11669506 / METERS_PER_INCH //Indian Chain
  9882. });
  9883. //将服务端的地图单位转成SuperMap的地图单位
  9884. INCHES_PER_UNIT['degree'] = INCHES_PER_UNIT.dd;
  9885. INCHES_PER_UNIT['meter'] = INCHES_PER_UNIT.m;
  9886. INCHES_PER_UNIT['foot'] = INCHES_PER_UNIT.ft;
  9887. INCHES_PER_UNIT['inch'] = INCHES_PER_UNIT.inches;
  9888. INCHES_PER_UNIT['mile'] = INCHES_PER_UNIT.mi;
  9889. INCHES_PER_UNIT['kilometer'] = INCHES_PER_UNIT.km;
  9890. INCHES_PER_UNIT['yard'] = INCHES_PER_UNIT.yd;
  9891. function paramToString(param) {
  9892. if (param == undefined || param == null) {
  9893. return '';
  9894. }
  9895. if (param instanceof Date) {
  9896. return param.toJSON();
  9897. }
  9898. if (canBeJsonified(param)) {
  9899. return JSON.stringify(param);
  9900. }
  9901. return param.toString();
  9902. }
  9903. function canBeJsonified(str) {
  9904. if (typeof str !== 'string' && typeof str !== 'object') {
  9905. return false;
  9906. }
  9907. try {
  9908. const type = str.toString();
  9909. return type === '[object Object]' || type === '[object Array]';
  9910. } catch (err) {
  9911. return false;
  9912. }
  9913. }
  9914. ;// CONCATENATED MODULE: ./src/common/commontypes/LonLat.js
  9915. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  9916. * This program are made available under the terms of the Apache License, Version 2.0
  9917. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9918. /**
  9919. * @class LonLat
  9920. * @category BaseTypes Geometry
  9921. * @classdesc 这个类用来表示经度和纬度对。
  9922. * @param {number|Array.<number>} [lon=0.0] - 地图单位上的 X 轴坐标或者横纵坐标组成的数组;如果地图是地理投影,则此值是经度,否则,此值是地图地理位置的 x 坐标。
  9923. * @param {number} [lat=0.0] - 地图单位上的 Y 轴坐标,如果地图是地理投影,则此值是纬度,否则,此值是地图地理位置的 y 坐标。
  9924. * @example
  9925. * var lonLat = new LonLat(30,45);
  9926. * @usage
  9927. */
  9928. class LonLat {
  9929. constructor(lon, lat) {
  9930. if (Util_Util.isArray(lon)) {
  9931. lat = lon[1];
  9932. lon = lon[0];
  9933. }
  9934. /**
  9935. * @member {number} [LonLat.prototype.lon=0.0]
  9936. * @description 地图的单位的 X 轴(横轴)坐标。
  9937. */
  9938. this.lon = lon ? Util_Util.toFloat(lon) : 0.0;
  9939. /**
  9940. * @member {number} [LonLat.prototype.lat=0.0]
  9941. * @description 地图的单位的 Y 轴(纵轴)坐标。
  9942. */
  9943. this.lat = lat ? Util_Util.toFloat(lat) : 0.0;
  9944. this.CLASS_NAME = "SuperMap.LonLat";
  9945. }
  9946. /**
  9947. * @function LonLat.prototype.toString
  9948. * @description 返回此对象的字符串形式。
  9949. * @example
  9950. * var lonLat = new LonLat(100,50);
  9951. * var str = lonLat.toString();
  9952. * @returns {string} 例如: "lon=100,lat=50"。
  9953. */
  9954. toString() {
  9955. return ("lon=" + this.lon + ",lat=" + this.lat);
  9956. }
  9957. /**
  9958. * @function LonLat.prototype.toShortString
  9959. * @description 将经度纬度转换成简单字符串。
  9960. * @example
  9961. * var lonLat = new LonLat(100,50);
  9962. * var str = lonLat.toShortString();
  9963. * @returns {string} 处理后的经纬度字符串。例如:"100,50"。
  9964. */
  9965. toShortString() {
  9966. return (this.lon + "," + this.lat);
  9967. }
  9968. /**
  9969. * @function LonLat.prototype.clone
  9970. * @description 复制坐标对象,并返回复制后的新对象。
  9971. * @example
  9972. * var lonLat1 = new LonLat(100,50);
  9973. * var lonLat2 = lonLat1.clone();
  9974. * @returns {LonLat} 相同坐标值的新的坐标对象。
  9975. */
  9976. clone() {
  9977. return new LonLat(this.lon, this.lat);
  9978. }
  9979. /**
  9980. * @function LonLat.prototype.add
  9981. * @description 在已有坐标对象的经纬度基础上加上新的坐标经纬度,并返回新的坐标对象。
  9982. * @example
  9983. * var lonLat1 = new LonLat(100,50);
  9984. * //lonLat2 是新的对象
  9985. * var lonLat2 = lonLat1.add(100,50);
  9986. * @param {number} lon - 经度参数。
  9987. * @param {number} lat - 纬度参数。
  9988. * @returns {LonLat} 新的 LonLat 对象,此对象的经纬度是由传入的经纬度与当前的经纬度相加所得。
  9989. */
  9990. add(lon, lat) {
  9991. if ((lon == null) || (lat == null)) {
  9992. throw new TypeError('LonLat.add cannot receive null values');
  9993. }
  9994. return new LonLat(this.lon + Util_Util.toFloat(lon),
  9995. this.lat + Util_Util.toFloat(lat));
  9996. }
  9997. /**
  9998. * @function LonLat.prototype.equals
  9999. * @description 判断两个坐标对象是否相等。
  10000. * @example
  10001. * var lonLat1 = new LonLat(100,50);
  10002. * var lonLat2 = new LonLat(100,50);
  10003. * var isEquals = lonLat1.equals(lonLat2);
  10004. * @param {LonLat} ll - 需要进行比较的坐标对象。
  10005. * @returns {boolean} 如果LonLat对象的经纬度和传入的经纬度一致则返回true,不一
  10006. * 致或传入的ll参数为NULL则返回false。
  10007. */
  10008. equals(ll) {
  10009. var equals = false;
  10010. if (ll != null) {
  10011. equals = ((this.lon === ll.lon && this.lat === ll.lat) ||
  10012. (isNaN(this.lon) && isNaN(this.lat) && isNaN(ll.lon) && isNaN(ll.lat)));
  10013. }
  10014. return equals;
  10015. }
  10016. /**
  10017. * @function LonLat.prototype.wrapDateLine
  10018. * @description 通过传入的范围对象对坐标对象转换到该范围内。
  10019. * 如果经度小于给定范围最小精度,则在原经度基础上加上范围宽度,直到精度在范围内为止,如果经度大于给定范围则在原经度基础上减去范围宽度。
  10020. * 即指将不在经度范围内的坐标转换到范围以内(只会转换 lon,不会转换 lat,主要用于转移到日界线以内)。
  10021. * @example
  10022. * var lonLat1 = new LonLat(420,50);
  10023. * var lonLat2 = lonLat1.wrapDateLine(
  10024. * new Bounds(-180,-90,180,90)
  10025. * );
  10026. * @param {Bounds} maxExtent - 最大边界的范围。
  10027. * @returns {LonLat} 将坐标转换到范围对象以内,并返回新的坐标。
  10028. */
  10029. wrapDateLine(maxExtent) {
  10030. var newLonLat = this.clone();
  10031. if (maxExtent) {
  10032. //shift right?
  10033. while (newLonLat.lon < maxExtent.left) {
  10034. newLonLat.lon += maxExtent.getWidth();
  10035. }
  10036. //shift left?
  10037. while (newLonLat.lon > maxExtent.right) {
  10038. newLonLat.lon -= maxExtent.getWidth();
  10039. }
  10040. }
  10041. return newLonLat;
  10042. }
  10043. /**
  10044. *
  10045. * @function LonLat.prototype.destroy
  10046. * @description 销毁此对象。
  10047. * 销毁后此对象的所有属性为 null,而不是初始值。
  10048. * @example
  10049. * var lonLat = new LonLat(100,50);
  10050. * lonLat.destroy();
  10051. */
  10052. destroy() {
  10053. this.lon = null;
  10054. this.lat = null;
  10055. }
  10056. /**
  10057. * @function LonLat.fromString
  10058. * @description 通过字符串生成一个 {@link LonLat} 对象。
  10059. * @example
  10060. * var str = "100,50";
  10061. * var lonLat = LonLat.fromString(str);
  10062. * @param {string} str - 字符串的格式:Lon+","+Lat。如:"100,50"。
  10063. * @returns {LonLat} {@link LonLat} 对象。
  10064. */
  10065. static fromString(str) {
  10066. var pair = str.split(",");
  10067. return new LonLat(pair[0], pair[1]);
  10068. }
  10069. /**
  10070. * @function LonLat.fromArray
  10071. * @description 通过数组生成一个 {@link LonLat} 对象。
  10072. * @param {Array.<number>} arr - 数组的格式,长度只能为2,:[Lon,Lat]。如:[5,-42]。
  10073. * @returns {LonLat} {@link LonLat} 对象。
  10074. */
  10075. static fromArray(arr) {
  10076. var gotArr = Util_Util.isArray(arr),
  10077. lon = gotArr && arr[0],
  10078. lat = gotArr && arr[1];
  10079. return new LonLat(lon, lat);
  10080. }
  10081. }
  10082. ;// CONCATENATED MODULE: ./src/common/commontypes/Bounds.js
  10083. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  10084. * This program are made available under the terms of the Apache License, Version 2.0
  10085. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  10086. /**
  10087. * @class Bounds
  10088. * @deprecatedclass SuperMap.Bounds
  10089. * @category BaseTypes Geometry
  10090. * @classdesc 表示边界类实例。使用 bounds 之前需要设置 left,bottom,right,top 四个属性,这些属性的初始值为 null。
  10091. * @param {number|Array.<number>} [left] - 如果是number,则表示左边界,注意考虑宽度,理论上小于 right 值。如果是数组,则表示 [left, bottom, right, top] 左下右上组成的数组。
  10092. * @param {number} [bottom] - 下边界。考虑高度,理论上小于 top 值。
  10093. * @param {number} [right] - 右边界。
  10094. * @param {number} [top] - 上边界。
  10095. * @example
  10096. * var bounds = new Bounds();
  10097. * bounds.extend(new LonLat(4,5));
  10098. * bounds.extend(new LonLat(5,6));
  10099. * bounds.toBBOX(); // returns 4,5,5,6
  10100. * @usage
  10101. */
  10102. class Bounds {
  10103. constructor(left, bottom, right, top) {
  10104. if (Util_Util.isArray(left)) {
  10105. top = left[3];
  10106. right = left[2];
  10107. bottom = left[1];
  10108. left = left[0];
  10109. }
  10110. /**
  10111. * @member {number} Bounds.prototype.left
  10112. * @description 最小的水平坐标系。
  10113. */
  10114. this.left = left != null ? Util_Util.toFloat(left) : this.left;
  10115. /**
  10116. * @member {number} Bounds.prototype.bottom
  10117. * @description 最小的垂直坐标系。
  10118. */
  10119. this.bottom = bottom != null ? Util_Util.toFloat(bottom) : this.bottom;
  10120. /**
  10121. * @member {number} Bounds.prototype.right
  10122. * @description 最大的水平坐标系。
  10123. */
  10124. this.right = right != null ? Util_Util.toFloat(right) : this.right;
  10125. /**
  10126. * @member {number} Bounds.prototype.top
  10127. * @description 最大的垂直坐标系。
  10128. */
  10129. this.top = top != null ? Util_Util.toFloat(top) : this.top;
  10130. /**
  10131. * @member {LonLat} Bounds.prototype.centerLonLat
  10132. * @description bounds 的地图空间的中心点。用 getCenterLonLat() 获得。
  10133. */
  10134. this.centerLonLat = null;
  10135. this.CLASS_NAME = "SuperMap.Bounds";
  10136. }
  10137. /**
  10138. * @function Bounds.prototype.clone
  10139. * @description 复制当前 bounds 对象。
  10140. * @example
  10141. * var bounds1 = new Bounds(-180,-90,180,90);
  10142. * var bounds2 = bounds1.clone();
  10143. * @returns {Bounds} 克隆后的 bounds。
  10144. */
  10145. clone() {
  10146. return new Bounds(this.left, this.bottom,
  10147. this.right, this.top);
  10148. }
  10149. /**
  10150. * @function Bounds.prototype.equals
  10151. * @description 判断两个 bounds 对象是否相等。
  10152. * @example
  10153. * var bounds1 = new Bounds(-180,-90,180,90);
  10154. * var bounds2 = new Bounds(-180,-90,180,90);
  10155. * var isEquals = bounds1.equals(bounds2);
  10156. * @param {Bounds} bounds - 需要进行计较的 bounds。
  10157. * @returns {boolean} 如果 bounds 对象的边和传入的 bounds 一致则返回 true,不一致或传入的 bounds 参数为 NULL 则返回 false。
  10158. */
  10159. equals(bounds) {
  10160. var equals = false;
  10161. if (bounds != null) {
  10162. equals = ((this.left === bounds.left) &&
  10163. (this.right === bounds.right) &&
  10164. (this.top === bounds.top) &&
  10165. (this.bottom === bounds.bottom));
  10166. }
  10167. return equals;
  10168. }
  10169. /**
  10170. * @function Bounds.prototype.toString
  10171. * @description 返回此对象的字符串形式。
  10172. * @example
  10173. * var bounds = new Bounds(-180,-90,180,90);
  10174. * var str = bounds.toString();
  10175. * @returns {string} 边界对象的字符串表示形式(left,bottom,right,top),例如: "-180,-90,180,90"。
  10176. */
  10177. toString() {
  10178. return [this.left, this.bottom, this.right, this.top].join(",");
  10179. }
  10180. /**
  10181. * @function Bounds.prototype.toArray
  10182. * @description 边界对象的数组表示形式。
  10183. * @example
  10184. * var bounds = new Bounds(-180,-90,100,80);
  10185. * //array1 = [-180,-90,100,80];
  10186. * var array1 = bounds.toArray();
  10187. * //array1 = [-90,-180,80,100];
  10188. * var array2 = bounds.toArray(true);
  10189. * @param {boolean} [reverseAxisOrder=false] - 是否反转轴顺序。
  10190. * 如果设为 true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
  10191. * @returns {Array.<number>} left, bottom, right, top 数组。
  10192. */
  10193. toArray(reverseAxisOrder) {
  10194. if (reverseAxisOrder === true) {
  10195. return [this.bottom, this.left, this.top, this.right];
  10196. } else {
  10197. return [this.left, this.bottom, this.right, this.top];
  10198. }
  10199. }
  10200. /**
  10201. * @function Bounds.prototype.toBBOX
  10202. * @description 取小数点后 decimal 位数字进行四舍五入再转换为 BBOX 字符串。
  10203. * @example
  10204. * var bounds = new Bounds(-1.1234567,-1.7654321,1.4444444,1.5555555);
  10205. * //str1 = "-1.123457,-1.765432,1.444444,1.555556";
  10206. * var str1 = bounds.toBBOX();
  10207. * //str2 = "-1.1,-1.8,1.4,1.6";
  10208. * var str2 = bounds.toBBOX(1);
  10209. * //str2 = "-1.8,-1.1,1.6,1.4";
  10210. * var str2 = bounds.toBBOX(1,true);
  10211. * @param {number} [decimal=6] - 边界方位坐标的有效数字个数。
  10212. * @param {boolean} [reverseAxisOrder=false] - 是否是反转轴顺序。
  10213. * 如果设为true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
  10214. * @returns {string} 边界对象的字符串表示形式,如:"5,42,10,45"。
  10215. */
  10216. toBBOX(decimal, reverseAxisOrder) {
  10217. if (decimal == null) {
  10218. decimal = 6;
  10219. }
  10220. var mult = Math.pow(10, decimal);
  10221. var xmin = Math.round(this.left * mult) / mult;
  10222. var ymin = Math.round(this.bottom * mult) / mult;
  10223. var xmax = Math.round(this.right * mult) / mult;
  10224. var ymax = Math.round(this.top * mult) / mult;
  10225. if (reverseAxisOrder === true) {
  10226. return ymin + "," + xmin + "," + ymax + "," + xmax;
  10227. } else {
  10228. return xmin + "," + ymin + "," + xmax + "," + ymax;
  10229. }
  10230. }
  10231. ///**
  10232. // * @function Bounds.prototype.toGeometry
  10233. // * @description 基于当前边界范围创建一个新的多边形对象。
  10234. // * @example
  10235. // * var bounds = new Bounds(-180,-90,100,80);
  10236. // * // Polygon对象
  10237. // * var geo = bounds.toGeometry();
  10238. // * @returns {GeometryPolygon} 基于当前 bounds 坐标创建的新的多边形。
  10239. // */
  10240. // toGeometry() {
  10241. // return new Polygon([
  10242. // new LinearRing([
  10243. // new Point(this.left, this.bottom),
  10244. // new Point(this.right, this.bottom),
  10245. // new Point(this.right, this.top),
  10246. // new Point(this.left, this.top)
  10247. // ])
  10248. // ]);
  10249. // }
  10250. /**
  10251. * @function Bounds.prototype.getWidth
  10252. * @description 获取 bounds 的宽度。
  10253. * @example
  10254. * var bounds = new Bounds(-180,-90,100,80);
  10255. * //width = 280;
  10256. * var width = bounds.getWidth();
  10257. * @returns {number} 获取当前 bounds 的宽度(right 减去 left)。
  10258. */
  10259. getWidth() {
  10260. return (this.right - this.left);
  10261. }
  10262. /**
  10263. * @function Bounds.prototype.getHeight
  10264. * @description 获取 bounds 的高度。
  10265. * @example
  10266. * var bounds = new Bounds(-180,-90,100,80);
  10267. * //height = 170;
  10268. * var height = bounds.getHeight();
  10269. * @returns {number} 边界高度(top 减去 bottom)。
  10270. */
  10271. getHeight() {
  10272. return (this.top - this.bottom);
  10273. }
  10274. /**
  10275. * @function Bounds.prototype.getSize
  10276. * @description 获取边框大小。
  10277. * @example
  10278. * var bounds = new Bounds(-180,-90,100,80);
  10279. * var size = bounds.getSize();
  10280. * @returns {Size} 边框大小。
  10281. */
  10282. getSize() {
  10283. return new Size(this.getWidth(), this.getHeight());
  10284. }
  10285. /**
  10286. * @function Bounds.prototype.getCenterPixel
  10287. * @description 获取像素格式的范围中心点。
  10288. * @example
  10289. * var bounds = new Bounds(-180,-90,100,80);
  10290. * var pixel = bounds.getCenterPixel();
  10291. * @returns {Pixel} 像素格式的当前范围的中心点。
  10292. */
  10293. getCenterPixel() {
  10294. return new Pixel((this.left + this.right) / 2,
  10295. (this.bottom + this.top) / 2);
  10296. }
  10297. /**
  10298. * @function Bounds.prototype.getCenterLonLat
  10299. * @description 获取地理格式的范围中心点。
  10300. * @example
  10301. * var bounds = new Bounds(-180,-90,100,80);
  10302. * var lonlat = bounds.getCenterLonLat();
  10303. * @returns {LonLat} 当前地理范围的中心点。
  10304. */
  10305. getCenterLonLat() {
  10306. if (!this.centerLonLat) {
  10307. this.centerLonLat = new LonLat(
  10308. (this.left + this.right) / 2, (this.bottom + this.top) / 2
  10309. );
  10310. }
  10311. return this.centerLonLat;
  10312. }
  10313. /**
  10314. * @function Bounds.prototype.scale
  10315. * @description 按照比例扩大/缩小出一个新的 bounds。
  10316. * @example
  10317. * var bounds = new Bounds(-50,-50,40,40);
  10318. * var bounds2 = bounds.scale(2);
  10319. * @param {number} [ratio=1] - 需要扩大的比例。
  10320. * @param {(Pixel|LonLat)} [origin] - 扩大时的基准点,默认为当前 bounds 的中心点。
  10321. * @returns {Bounds} 通过 ratio、origin 计算得到的新的边界范围。
  10322. */
  10323. scale(ratio, origin) {
  10324. ratio = ratio ? ratio : 1;
  10325. if (origin == null) {
  10326. origin = this.getCenterLonLat();
  10327. }
  10328. var origx, origy;
  10329. // get origin coordinates
  10330. if (origin.CLASS_NAME === "SuperMap.LonLat") {
  10331. origx = origin.lon;
  10332. origy = origin.lat;
  10333. } else {
  10334. origx = origin.x;
  10335. origy = origin.y;
  10336. }
  10337. var left = (this.left - origx) * ratio + origx;
  10338. var bottom = (this.bottom - origy) * ratio + origy;
  10339. var right = (this.right - origx) * ratio + origx;
  10340. var top = (this.top - origy) * ratio + origy;
  10341. return new Bounds(left, bottom, right, top);
  10342. }
  10343. /**
  10344. * @function Bounds.prototype.add
  10345. * @description 在当前的 Bounds 上按照传入的坐标点进行平移,返回新的范围。
  10346. * @example
  10347. * var bounds1 = new Bounds(-50,-50,40,40);
  10348. * //bounds2 是新的 bounds
  10349. * var bounds2 = bounds.add(20,10);
  10350. * @param {number} x - 坐标点的 x 坐标。
  10351. * @param {number} y - 坐标点的 y 坐标。
  10352. * @returns {Bounds} 新的 bounds,此 bounds 的坐标是由传入的 x,y 参数与当前 bounds 坐标计算所得。
  10353. */
  10354. add(x, y) {
  10355. if ((x == null) || (y == null)) {
  10356. throw new TypeError('Bounds.add cannot receive null values');
  10357. }
  10358. return new Bounds(this.left + x, this.bottom + y,
  10359. this.right + x, this.top + y);
  10360. }
  10361. /**
  10362. * @function Bounds.prototype.extend
  10363. * @description 在当前 bounds 上扩展 bounds,支持 point,lonlat 和 bounds。扩展后的 bounds 的范围是两者的结合。
  10364. * @example
  10365. * var bounds1 = new Bounds(-50,-50,40,40);
  10366. * //bounds 改变
  10367. * bounds.extend(new LonLat(50,60));
  10368. * @param {GeometryPoint|LonLat|Bounds} object - 可以是 point、lonlat 和 bounds。
  10369. */
  10370. extend(object) {
  10371. var bounds = null;
  10372. if (object) {
  10373. // clear cached center location
  10374. switch (object.CLASS_NAME) {
  10375. case "SuperMap.LonLat":
  10376. bounds = new Bounds(object.lon, object.lat,
  10377. object.lon, object.lat);
  10378. break;
  10379. case "SuperMap.Geometry.Point":
  10380. bounds = new Bounds(object.x, object.y,
  10381. object.x, object.y);
  10382. break;
  10383. case "SuperMap.Bounds":
  10384. bounds = object;
  10385. break;
  10386. }
  10387. if (bounds) {
  10388. this.centerLonLat = null;
  10389. if ((this.left == null) || (bounds.left < this.left)) {
  10390. this.left = bounds.left;
  10391. }
  10392. if ((this.bottom == null) || (bounds.bottom < this.bottom)) {
  10393. this.bottom = bounds.bottom;
  10394. }
  10395. if ((this.right == null) || (bounds.right > this.right)) {
  10396. this.right = bounds.right;
  10397. }
  10398. if ((this.top == null) || (bounds.top > this.top)) {
  10399. this.top = bounds.top;
  10400. }
  10401. }
  10402. }
  10403. }
  10404. /**
  10405. * @function Bounds.prototype.containsLonLat
  10406. * @description 判断传入的坐标是否在范围内。
  10407. * @example
  10408. * var bounds1 = new Bounds(-50,-50,40,40);
  10409. * //isContains1 = true
  10410. * //这里的第二个参数可以直接为 boolean 类型,也就是inclusive
  10411. * var isContains1 = bounds.containsLonLat(new LonLat(40,40),true);
  10412. *
  10413. * //(40,40)在范围内,同样(40+360,40)也在范围内
  10414. * var bounds2 = new Bounds(-50,-50,40,40);
  10415. * //isContains2 = true;
  10416. * var isContains2 = bounds2.containsLonLat(
  10417. * new LonLat(400,40),
  10418. * {
  10419. * inclusive:true,
  10420. * //全球的范围
  10421. * worldBounds: new Bounds(-180,-90,180,90)
  10422. * }
  10423. * );
  10424. * @param {(LonLat|Object)} ll - <LonLat> 对象或者是一个包含 'lon' 与 'lat' 属性的对象。
  10425. * @param {Object} options - 可选参数。
  10426. * @param {boolean} [options.inclusive=true] - 是否包含边界。
  10427. * @param {Bounds} [options.worldBounds] - 如果提供 worldBounds 参数, 如果 ll 参数提供的坐标超出了世界边界(worldBounds),
  10428. * 但是通过日界线的转化可以被包含, 它将被认为是包含在该范围内的。
  10429. * @returns {boolean} 传入坐标是否包含在范围内。
  10430. */
  10431. containsLonLat(ll, options) {
  10432. if (typeof options === "boolean") {
  10433. options = {inclusive: options};
  10434. }
  10435. options = options || {};
  10436. var contains = this.contains(ll.lon, ll.lat, options.inclusive),
  10437. worldBounds = options.worldBounds;
  10438. //日界线以外的也有可能算包含,
  10439. if (worldBounds && !contains) {
  10440. var worldWidth = worldBounds.getWidth();
  10441. var worldCenterX = (worldBounds.left + worldBounds.right) / 2;
  10442. //这一步很关键
  10443. var worldsAway = Math.round((ll.lon - worldCenterX) / worldWidth);
  10444. contains = this.containsLonLat({
  10445. lon: ll.lon - worldsAway * worldWidth,
  10446. lat: ll.lat
  10447. }, {inclusive: options.inclusive});
  10448. }
  10449. return contains;
  10450. }
  10451. /**
  10452. * @function Bounds.prototype.containsPixel
  10453. * @description 判断传入的像素是否在范围内。直接匹配大小,不涉及像素和地理转换。
  10454. * @example
  10455. * var bounds = new Bounds(-50,-50,40,40);
  10456. * //isContains = true
  10457. * var isContains = bounds.containsPixel(new Pixel(40,40),true);
  10458. * @param {Pixel} px - 提供的像素参数。
  10459. * @param {boolean} [inclusive=true] - 是否包含边界。
  10460. * @returns {boolean} 传入的 pixel 在当前边界范围之内。
  10461. */
  10462. containsPixel(px, inclusive) {
  10463. return this.contains(px.x, px.y, inclusive);
  10464. }
  10465. /**
  10466. * @function Bounds.prototype.contains
  10467. * @description 判断传入的 x,y 坐标值是否在范围内。
  10468. * @example
  10469. * var bounds = new Bounds(-50,-50,40,40);
  10470. * //isContains = true
  10471. * var isContains = bounds.contains(40,40,true);
  10472. * @param {number} x - x 坐标值。
  10473. * @param {number} y - y 坐标值。
  10474. * @param {boolean} [inclusive=true] - 是否包含边界。
  10475. * @returns {boolean} 传入的 x,y 坐标是否在当前范围内。
  10476. */
  10477. contains(x, y, inclusive) {
  10478. //set default
  10479. if (inclusive == null) {
  10480. inclusive = true;
  10481. }
  10482. if (x == null || y == null) {
  10483. return false;
  10484. }
  10485. //x = Util.toFloat(x);
  10486. //y = Util.toFloat(y);
  10487. var contains = false;
  10488. if (inclusive) {
  10489. contains = ((x >= this.left) && (x <= this.right) &&
  10490. (y >= this.bottom) && (y <= this.top));
  10491. } else {
  10492. contains = ((x > this.left) && (x < this.right) &&
  10493. (y > this.bottom) && (y < this.top));
  10494. }
  10495. return contains;
  10496. }
  10497. /**
  10498. * @function Bounds.prototype.intersectsBounds
  10499. * @description 判断目标边界范围是否与当前边界范围相交。如果两个边界范围中的任意边缘相交或者一个边界包含了另外一个就认为这两个边界相交。
  10500. * @example
  10501. * var bounds = new Bounds(-180,-90,100,80);
  10502. * var isIntersects = bounds.intersectsBounds(
  10503. * new Bounds(-170,-90,120,80)
  10504. * );
  10505. * @param {Bounds} bounds - 目标边界。
  10506. * @param {Object} options - 参数。
  10507. * @param {boolean} [options.inclusive=true] - 边缘重合也看成相交。如果是false,两个边界范围没有重叠部分仅仅是在边缘相接(重合),这种情况被认为没有相交。
  10508. * @param {Bounds} [options.worldBounds] - 提供了 worldBounds 参数,如果他们相交时是在全球范围内,两个边界将被视为相交。这仅适用于交叉或完全不在世界范围的边界。
  10509. * @returns {boolean} 传入的 bounds 对象与当前 bounds 相交。
  10510. */
  10511. intersectsBounds(bounds, options) {
  10512. if (typeof options === "boolean") {
  10513. options = {inclusive: options};
  10514. }
  10515. options = options || {};
  10516. if (options.worldBounds) {
  10517. var self = this.wrapDateLine(options.worldBounds);
  10518. bounds = bounds.wrapDateLine(options.worldBounds);
  10519. } else {
  10520. self = this;
  10521. }
  10522. if (options.inclusive == null) {
  10523. options.inclusive = true;
  10524. }
  10525. var intersects = false;
  10526. var mightTouch = (
  10527. self.left === bounds.right ||
  10528. self.right === bounds.left ||
  10529. self.top === bounds.bottom ||
  10530. self.bottom === bounds.top
  10531. );
  10532. // if the two bounds only touch at an edge, and inclusive is false,
  10533. // then the bounds don't *really* intersect.
  10534. if (options.inclusive || !mightTouch) {
  10535. // otherwise, if one of the boundaries even partially contains another,
  10536. // inclusive of the edges, then they do intersect.
  10537. var inBottom = (
  10538. ((bounds.bottom >= self.bottom) && (bounds.bottom <= self.top)) ||
  10539. ((self.bottom >= bounds.bottom) && (self.bottom <= bounds.top))
  10540. );
  10541. var inTop = (
  10542. ((bounds.top >= self.bottom) && (bounds.top <= self.top)) ||
  10543. ((self.top > bounds.bottom) && (self.top < bounds.top))
  10544. );
  10545. var inLeft = (
  10546. ((bounds.left >= self.left) && (bounds.left <= self.right)) ||
  10547. ((self.left >= bounds.left) && (self.left <= bounds.right))
  10548. );
  10549. var inRight = (
  10550. ((bounds.right >= self.left) && (bounds.right <= self.right)) ||
  10551. ((self.right >= bounds.left) && (self.right <= bounds.right))
  10552. );
  10553. intersects = ((inBottom || inTop) && (inLeft || inRight));
  10554. }
  10555. // document me
  10556. if (options.worldBounds && !intersects) {
  10557. var world = options.worldBounds;
  10558. var width = world.getWidth();
  10559. var selfCrosses = !world.containsBounds(self);
  10560. var boundsCrosses = !world.containsBounds(bounds);
  10561. if (selfCrosses && !boundsCrosses) {
  10562. bounds = bounds.add(-width, 0);
  10563. intersects = self.intersectsBounds(bounds, {inclusive: options.inclusive});
  10564. } else if (boundsCrosses && !selfCrosses) {
  10565. self = self.add(-width, 0);
  10566. intersects = bounds.intersectsBounds(self, {inclusive: options.inclusive});
  10567. }
  10568. }
  10569. return intersects;
  10570. }
  10571. /**
  10572. * @function Bounds.prototype.containsBounds
  10573. * @description 判断目标边界是否被当前边界包含在内。
  10574. * @example
  10575. * var bounds = new Bounds(-180,-90,100,80);
  10576. * var isContains = bounds.containsBounds(
  10577. * new Bounds(-170,-90,100,80),true,true
  10578. * );
  10579. * @param {Bounds} bounds - 目标边界。
  10580. * @param {boolean} [partial=false] - 目标边界的任意部分都包含在当前边界中则被认为是包含关系。
  10581. * 如果设为 false,整个目标边界全部被包含在当前边界范围内。
  10582. * @param {boolean} [inclusive=true] - 边缘共享是否被视为包含。
  10583. * @returns {boolean} 传入的边界是否被当前边界包含。
  10584. */
  10585. containsBounds(bounds, partial, inclusive) {
  10586. if (partial == null) {
  10587. partial = false;
  10588. }
  10589. if (inclusive == null) {
  10590. inclusive = true;
  10591. }
  10592. var bottomLeft = this.contains(bounds.left, bounds.bottom, inclusive);
  10593. var bottomRight = this.contains(bounds.right, bounds.bottom, inclusive);
  10594. var topLeft = this.contains(bounds.left, bounds.top, inclusive);
  10595. var topRight = this.contains(bounds.right, bounds.top, inclusive);
  10596. return (partial) ? (bottomLeft || bottomRight || topLeft || topRight)
  10597. : (bottomLeft && bottomRight && topLeft && topRight);
  10598. }
  10599. /**
  10600. * @function Bounds.prototype.determineQuadrant
  10601. * @description 判断传入坐标是否在 bounds 范围内的象限。以 bounds 中心点为坐标原点。
  10602. * @example
  10603. * var bounds = new Bounds(-180,-90,100,80);
  10604. * //str = "tr";
  10605. * var str = bounds.determineQuadrant(
  10606. * new LonLat(20,20)
  10607. * );
  10608. * @param {LonLat} lonlat - 传入的坐标对象。
  10609. * @returns {string} 传入坐标所在的象限("br" "tr" "tl" "bl" 分别对应"右下","右上","左上" "左下")。
  10610. */
  10611. determineQuadrant(lonlat) {
  10612. var quadrant = "";
  10613. var center = this.getCenterLonLat();
  10614. quadrant += (lonlat.lat < center.lat) ? "b" : "t";
  10615. quadrant += (lonlat.lon < center.lon) ? "l" : "r";
  10616. return quadrant;
  10617. }
  10618. /**
  10619. * @function Bounds.prototype.wrapDateLine
  10620. * @description 将当前 bounds 移动到最大边界范围内部(所谓的内部是相交或者内部)。
  10621. * @example
  10622. * var bounds = new Bounds(380,-40,400,-20);
  10623. * var maxExtent = new Bounds(-180,-90,100,80);
  10624. * //新的bounds
  10625. * var newBounds = bounds.wrapDateLine(maxExtent);
  10626. * @param {Bounds} maxExtent - 最大的边界范围(一般是全球范围)。
  10627. * @param {Object} options - 可选选项参数。
  10628. * @param {number} [options.leftTolerance=0] - left 允许的误差。
  10629. * @param {number} [options.rightTolerance=0] - right 允许的误差。
  10630. * @returns {Bounds} 克隆当前边界。如果当前边界完全在最大范围之外此函数则返回一个不同值的边界,
  10631. * 若落在最大边界的左边,则给当前的bounds值加上最大范围的宽度,即向右移动,
  10632. * 若落在右边,则向左移动,即给当前的bounds值加上负的最大范围的宽度。
  10633. */
  10634. wrapDateLine(maxExtent, options) {
  10635. options = options || {};
  10636. var leftTolerance = options.leftTolerance || 0;
  10637. var rightTolerance = options.rightTolerance || 0;
  10638. var newBounds = this.clone();
  10639. if (maxExtent) {
  10640. var width = maxExtent.getWidth();
  10641. //如果 newBounds 在 maxExtent 的左边,那么一直向右移动,直到相交或者包含为止,每次移动width
  10642. //shift right?
  10643. while (newBounds.left < maxExtent.left &&
  10644. newBounds.right - rightTolerance <= maxExtent.left) {
  10645. newBounds = newBounds.add(width, 0);
  10646. }
  10647. //如果 newBounds 在 maxExtent 的右边,那么一直向左移动,直到相交或者包含为止,每次移动width
  10648. //shift left?
  10649. while (newBounds.left + leftTolerance >= maxExtent.right &&
  10650. newBounds.right > maxExtent.right) {
  10651. newBounds = newBounds.add(-width, 0);
  10652. }
  10653. //如果和右边相交,左边又在内部,那么再次向左边移动一次
  10654. // crosses right only? force left
  10655. var newLeft = newBounds.left + leftTolerance;
  10656. if (newLeft < maxExtent.right && newLeft > maxExtent.left &&
  10657. newBounds.right - rightTolerance > maxExtent.right) {
  10658. newBounds = newBounds.add(-width, 0);
  10659. }
  10660. }
  10661. return newBounds;
  10662. }
  10663. /**
  10664. * @function Bounds.prototype.toServerJSONObject
  10665. * @description 转换成对应的 JSON 格式对象。
  10666. * @example
  10667. * var bounds = new Bounds(-180,-90,100,80);
  10668. * var obj = bounds.toServerJSONObject();
  10669. * @returns {Object} JSON 格式的 Object 对象。
  10670. */
  10671. toServerJSONObject() {
  10672. var jsonObject = {
  10673. rightTop: {x: this.right, y: this.top},
  10674. leftBottom: {x: this.left, y: this.bottom},
  10675. left: this.left,
  10676. right: this.right,
  10677. top: this.top,
  10678. bottom: this.bottom
  10679. }
  10680. return jsonObject;
  10681. }
  10682. /**
  10683. *
  10684. * @function Bounds.prototype.destroy
  10685. * @description 销毁此对象。
  10686. * 销毁后此对象的所有属性为 null,而不是初始值。
  10687. * @example
  10688. * var bounds = new Bounds(-180,-90,100,80);
  10689. * bounds.destroy();
  10690. */
  10691. destroy() {
  10692. this.left = null;
  10693. this.right = null;
  10694. this.top = null;
  10695. this.bottom = null;
  10696. this.centerLonLat = null;
  10697. }
  10698. /**
  10699. * @function Bounds.fromString
  10700. * @description 通过字符串参数创建新的 bounds 的构造函数。
  10701. * @example
  10702. * var bounds = Bounds.fromString("-180,-90,100,80");
  10703. * @param {string} str - 边界字符串,用逗号隔开(e.g. <i>"5,42,10,45"</i>)。
  10704. * @param {boolean} [reverseAxisOrder=false] - 是否反转轴顺序。
  10705. * 如果设为true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
  10706. * @returns {Bounds} 给定的字符串创建的新的边界对象。
  10707. */
  10708. static fromString(str, reverseAxisOrder) {
  10709. var bounds = str.split(",");
  10710. return Bounds.fromArray(bounds, reverseAxisOrder);
  10711. }
  10712. /**
  10713. * @function Bounds.fromArray
  10714. * @description 通过边界框数组创建 Bounds。
  10715. * @example
  10716. * var bounds = Bounds.fromArray([-180,-90,100,80]);
  10717. * @param {Array.<number>} bbox - 边界值数组。(e.g. <i>[5,42,10,45]</i>)。
  10718. * @param {boolean} [reverseAxisOrder=false] - 是否是反转轴顺序。如果设为true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
  10719. * @returns {Bounds} 根据传入的数组创建的新的边界对象。
  10720. */
  10721. static fromArray(bbox, reverseAxisOrder) {
  10722. return reverseAxisOrder === true ?
  10723. new Bounds(bbox[1], bbox[0], bbox[3], bbox[2]) :
  10724. new Bounds(bbox[0], bbox[1], bbox[2], bbox[3]);
  10725. }
  10726. /**
  10727. * @function Bounds.fromSize
  10728. * @description 通过传入的边界大小来创建新的边界。
  10729. * @example
  10730. * var bounds = Bounds.fromSize(new Size(20,10));
  10731. * @param {Size} size - 边界大小。
  10732. * @returns {Bounds} 根据传入的边界大小的创建新的边界。
  10733. */
  10734. static fromSize(size) {
  10735. return new Bounds(0,
  10736. size.h,
  10737. size.w,
  10738. 0);
  10739. }
  10740. /**
  10741. * @function Bounds.oppositeQuadrant
  10742. * @description 反转象限。"t"和"b" 交换,"r"和"l"交换, 如:"tl"变为"br"。
  10743. * @param {string} quadrant - 代表象限的字符串,如:"tl"。
  10744. * @returns {string} 反转后的象限。
  10745. */
  10746. static oppositeQuadrant(quadrant) {
  10747. var opp = "";
  10748. opp += (quadrant.charAt(0) === 't') ? 'b' : 't';
  10749. opp += (quadrant.charAt(1) === 'l') ? 'r' : 'l';
  10750. return opp;
  10751. }
  10752. }
  10753. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Point.js
  10754. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  10755. * This program are made available under the terms of the Apache License, Version 2.0
  10756. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  10757. /**
  10758. * @class GeometryPoint
  10759. * @aliasclass Geometry.Point
  10760. * @deprecatedclass SuperMap.Geometry.Point
  10761. * @classdesc 点几何对象类。
  10762. * @category BaseTypes Geometry
  10763. * @extends {Geometry}
  10764. * @param {number} x - x 坐标。
  10765. * @param {number} y - y 坐标。
  10766. * @param {string} [type = 'Point'] - 点的类型。
  10767. * @param {number} [tag] - 额外的属性,比如插值分析中的 Z 值。
  10768. * @example
  10769. * var point = new GeometryPoint(-111.04, 45.68);
  10770. * @usage
  10771. */
  10772. class Point extends Geometry_Geometry {
  10773. constructor(x, y, type, tag) {
  10774. super(x, y, type, tag);
  10775. /**
  10776. * @member {number} GeometryPoint.prototype.x
  10777. * @description 横坐标。
  10778. */
  10779. this.x = parseFloat(x);
  10780. /**
  10781. * @member {number} GeometryPoint.prototype.y
  10782. * @description 纵坐标。
  10783. */
  10784. this.y = parseFloat(y);
  10785. /**
  10786. * @member {string} GeometryPoint.prototype.tag
  10787. * @description 用来存储额外的属性,比如插值分析中的 Z 值。
  10788. */
  10789. this.tag = (tag || tag == 0) ? parseFloat(tag) : null;
  10790. /**
  10791. * @member {string} GeometryPoint.prototype.type
  10792. * @description 用来存储点的类型。
  10793. */
  10794. this.type = type || "Point";
  10795. this.CLASS_NAME = "SuperMap.Geometry.Point";
  10796. this.geometryType = "Point";
  10797. }
  10798. /**
  10799. * @function GeometryPoint.prototype.clone
  10800. * @description 克隆点对象。
  10801. * @returns {GeometryPoint} 克隆后的点对象。
  10802. */
  10803. clone(obj) {
  10804. if (obj == null) {
  10805. obj = new Point(this.x, this.y);
  10806. }
  10807. // catch any randomly tagged-on properties
  10808. Util_Util.applyDefaults(obj, this);
  10809. return obj;
  10810. }
  10811. /**
  10812. * @function GeometryPoint.prototype.calculateBounds
  10813. * @description 计算点对象的范围。
  10814. */
  10815. calculateBounds() {
  10816. this.bounds = new Bounds(this.x, this.y,
  10817. this.x, this.y);
  10818. }
  10819. /**
  10820. * @function GeometryPoint.prototype.equals
  10821. * @description 判断两个点对象是否相等。如果两个点对象具有相同的坐标,则认为是相等的。
  10822. * @example
  10823. * var point= new GeometryPoint(0,0);
  10824. * var point1={x:0,y:0};
  10825. * var result= point.equals(point1);
  10826. * @param {GeometryPoint} geom - 需要判断的点对象。
  10827. * @returns {boolean} 两个点对象是否相等(true 为相等,false 为不等)。
  10828. */
  10829. equals(geom) {
  10830. var equals = false;
  10831. if (geom != null) {
  10832. equals = ((this.x === geom.x && this.y === geom.y) ||
  10833. (isNaN(this.x) && isNaN(this.y) && isNaN(geom.x) && isNaN(geom.y)));
  10834. }
  10835. return equals;
  10836. }
  10837. /**
  10838. * @function GeometryPoint.prototype.move
  10839. * @description 沿着 x、y 轴的正方向上按照给定的位移移动点对象,move 不仅改变了几何对象的位置并且清理了边界缓存。
  10840. * @param {number} x - x 轴正方向上的偏移量。
  10841. * @param {number} y - y 轴正方向上偏移量。
  10842. */
  10843. move(x, y) {
  10844. this.x = this.x + x;
  10845. this.y = this.y + y;
  10846. this.clearBounds();
  10847. }
  10848. /**
  10849. * @function GeometryPoint.prototype.toShortString
  10850. * @description 将 x/y 坐标转换成简单字符串。
  10851. * @returns {string} 字符串代表点对象。(ex. <i>"5, 42"</i>)
  10852. */
  10853. toShortString() {
  10854. return (this.x + ", " + this.y);
  10855. }
  10856. /**
  10857. * @function GeometryPoint.prototype.destroy
  10858. * @description 释放点对象的资源。
  10859. */
  10860. destroy() {
  10861. this.x = null;
  10862. this.y = null;
  10863. this.tag = null;
  10864. super.destroy();
  10865. }
  10866. /**
  10867. * @function GeometryPoint.prototype.getVertices
  10868. * @description 获取几何图形所有顶点的列表。
  10869. * @returns {Array} 几何图形的顶点列表。
  10870. */
  10871. getVertices() {
  10872. return [this];
  10873. }
  10874. }
  10875. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Collection.js
  10876. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  10877. * This program are made available under the terms of the Apache License, Version 2.0
  10878. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  10879. /**
  10880. * @class GeometryCollection
  10881. * @aliasclass Geometry.Collection
  10882. * @deprecatedclass SuperMap.Geometry.Collection
  10883. * @classdesc 几何对象集合类,存储在本地的 components 属性中(可作为参数传递给构造函数)。<br>
  10884. * 随着新的几何图形添加到集合中,将不能被克隆,当移动几何图形时,需要指定参照物。<br>
  10885. * getArea 和 getLength 函数只能通过遍历存储几何对象的 components 数组,总计所有几何图形的面积和长度。
  10886. * @category BaseTypes Geometry
  10887. * @extends {Geometry}
  10888. * @param {Array.<Geometry>} components - 几何对象数组。
  10889. * @example
  10890. * var point1 = new GeometryPoint(10,20);
  10891. * var point2 = new GeometryPoint(30,40);
  10892. * var col = new GeometryCollection([point1,point2]);
  10893. * @usage
  10894. */
  10895. class Collection extends Geometry_Geometry {
  10896. constructor(components) {
  10897. super();
  10898. /**
  10899. * @description 存储几何对象的数组。
  10900. * @member {Array.<Geometry>} GeometryCollection.prototype.components
  10901. */
  10902. this.components = [];
  10903. /**
  10904. * @member {Array.<string>} GeometryCollection.prototype.componentTypes
  10905. * @description components 存储的几何对象所支持的几何类型数组,为空表示类型不受限制。
  10906. */
  10907. this.componentTypes = null;
  10908. if (components != null) {
  10909. this.addComponents(components);
  10910. }
  10911. this.CLASS_NAME = "SuperMap.Geometry.Collection";
  10912. this.geometryType = "Collection";
  10913. }
  10914. /**
  10915. * @function GeometryCollection.prototype.destroy
  10916. * @description 销毁几何图形。
  10917. */
  10918. destroy() {
  10919. this.components.length = 0;
  10920. this.components = null;
  10921. super.destroy();
  10922. }
  10923. /**
  10924. * @function GeometryCollection.prototype.clone
  10925. * @description 克隆当前几何对象。
  10926. * @returns {GeometryCollection} 克隆的几何对象集合。
  10927. */
  10928. clone() {
  10929. var geometry = new Collection();
  10930. for (var i = 0, len = this.components.length; i < len; i++) {
  10931. geometry.addComponent(this.components[i].clone());
  10932. }
  10933. // catch any randomly tagged-on properties
  10934. Util_Util.applyDefaults(geometry, this);
  10935. return geometry;
  10936. }
  10937. /**
  10938. * @function GeometryCollection.prototype.getComponentsString
  10939. * @description 获取 components 字符串。
  10940. * @returns {string} components 字符串。
  10941. */
  10942. getComponentsString() {
  10943. var strings = [];
  10944. for (var i = 0, len = this.components.length; i < len; i++) {
  10945. strings.push(this.components[i].toShortString());
  10946. }
  10947. return strings.join(",");
  10948. }
  10949. /**
  10950. * @function GeometryCollection.prototype.calculateBounds
  10951. * @description 通过遍历数组重新计算边界,在遍历每一子项中时调用 extend 方法。
  10952. */
  10953. calculateBounds() {
  10954. this.bounds = null;
  10955. var bounds = new Bounds();
  10956. var components = this.components;
  10957. if (components) {
  10958. for (var i = 0, len = components.length; i < len; i++) {
  10959. bounds.extend(components[i].getBounds());
  10960. }
  10961. }
  10962. // to preserve old behavior, we only set bounds if non-null
  10963. // in the future, we could add bounds.isEmpty()
  10964. if (bounds.left != null && bounds.bottom != null &&
  10965. bounds.right != null && bounds.top != null) {
  10966. this.setBounds(bounds);
  10967. }
  10968. }
  10969. /**
  10970. * @function GeometryCollection.prototype.addComponents
  10971. * @description 给几何图形对象添加元素。
  10972. * @param {Array.<Geometry>} components - 几何对象组件。
  10973. * @example
  10974. * var geometryCollection = new GeometryCollection();
  10975. * geometryCollection.addComponents(new SuerpMap.Geometry.Point(10,10));
  10976. */
  10977. addComponents(components) {
  10978. if (!(Util_Util.isArray(components))) {
  10979. components = [components];
  10980. }
  10981. for (var i = 0, len = components.length; i < len; i++) {
  10982. this.addComponent(components[i]);
  10983. }
  10984. }
  10985. /**
  10986. * @function GeometryCollection.prototype.addComponent
  10987. * @description 添加几何对象到集合中。如果设置了 componentTypes 类型,则添加的几何对象必须是 componentTypes 中的类型。
  10988. * @param {Geometry} component - 待添加的几何对象。
  10989. * @param {number} [index] - 几何对象插入的位置。
  10990. * @returns {boolean} 是否添加成功。
  10991. */
  10992. addComponent(component, index) {
  10993. var added = false;
  10994. if (component) {
  10995. if (this.componentTypes == null ||
  10996. (Util_Util.indexOf(this.componentTypes,
  10997. component.CLASS_NAME) > -1)) {
  10998. if (index != null && (index < this.components.length)) {
  10999. var components1 = this.components.slice(0, index);
  11000. var components2 = this.components.slice(index,
  11001. this.components.length);
  11002. components1.push(component);
  11003. this.components = components1.concat(components2);
  11004. } else {
  11005. this.components.push(component);
  11006. }
  11007. component.parent = this;
  11008. this.clearBounds();
  11009. added = true;
  11010. }
  11011. }
  11012. return added;
  11013. }
  11014. /**
  11015. * @function GeometryCollection.prototype.removeComponents
  11016. * @description 清除几何对象。
  11017. * @param {Array.<Geometry>} components - 需要清除的几何对象。
  11018. * @returns {boolean} 元素是否被删除。
  11019. */
  11020. removeComponents(components) {
  11021. var removed = false;
  11022. if (!(Util_Util.isArray(components))) {
  11023. components = [components];
  11024. }
  11025. for (var i = components.length - 1; i >= 0; --i) {
  11026. removed = this.removeComponent(components[i]) || removed;
  11027. }
  11028. return removed;
  11029. }
  11030. /**
  11031. * @function GeometryCollection.prototype.removeComponent
  11032. * @description 从集合中移除几何对象。
  11033. * @param {Geometry} component - 要移除的几何对象。
  11034. * @returns {boolean} 几何对象是否移除成功。
  11035. */
  11036. removeComponent(component) {
  11037. Util_Util.removeItem(this.components, component);
  11038. // clearBounds() so that it gets recalculated on the next call
  11039. // to this.getBounds();
  11040. this.clearBounds();
  11041. return true;
  11042. }
  11043. /**
  11044. * @function GeometryCollection.prototype.getArea
  11045. * @description 计算几何对象的面积。注意,这个方法在 {@link GeometryPolygon} 类中需要重写。
  11046. * @returns {number} 几何图形的面积,是几何对象中所有组成部分的面积之和。
  11047. */
  11048. getArea() {
  11049. var area = 0.0;
  11050. for (var i = 0, len = this.components.length; i < len; i++) {
  11051. area += this.components[i].getArea();
  11052. }
  11053. return area;
  11054. }
  11055. /**
  11056. * @function GeometryCollection.prototype.equals
  11057. * @description 判断两个几何图形是否相等。如果所有的 components 具有相同的坐标,则认为是相等的。
  11058. * @param {Geometry} geometry - 需要判断的几何图形。
  11059. * @returns {boolean} 输入的几何图形与当前几何图形是否相等。
  11060. */
  11061. equals(geometry) {
  11062. var equivalent = true;
  11063. if (!geometry || !geometry.CLASS_NAME ||
  11064. (this.CLASS_NAME !== geometry.CLASS_NAME)) {
  11065. equivalent = false;
  11066. } else if (!(Util_Util.isArray(geometry.components)) ||
  11067. (geometry.components.length !== this.components.length)) {
  11068. equivalent = false;
  11069. } else {
  11070. for (var i = 0, len = this.components.length; i < len; ++i) {
  11071. if (!this.components[i].equals(geometry.components[i])) {
  11072. equivalent = false;
  11073. break;
  11074. }
  11075. }
  11076. }
  11077. return equivalent;
  11078. }
  11079. /**
  11080. * @function GeometryCollection.prototype.getVertices
  11081. * @description 返回几何对象的所有结点的列表。
  11082. * @param {boolean} [nodes] - 对于线来说,仅仅返回作为端点的顶点,如果设为 false,则返回非端点的顶点,如果没有设置此参数,则返回所有顶点。
  11083. * @returns {Array} 几何对象的顶点列表。
  11084. */
  11085. getVertices(nodes) {
  11086. var vertices = [];
  11087. for (var i = 0, len = this.components.length; i < len; ++i) {
  11088. Array.prototype.push.apply(
  11089. vertices, this.components[i].getVertices(nodes)
  11090. );
  11091. }
  11092. return vertices;
  11093. }
  11094. }
  11095. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/MultiPoint.js
  11096. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  11097. * This program are made available under the terms of the Apache License, Version 2.0
  11098. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11099. /**
  11100. * @class GeometryMultiPoint
  11101. * @aliasclass Geometry.MultiPoint
  11102. * @deprecatedclass SuperMap.Geometry.MultiPoint
  11103. * @classdesc 几何对象多点类。
  11104. * @category BaseTypes Geometry
  11105. * @extends GeometryCollection
  11106. * @param {Array.<GeometryPoint>} components - 点对象数组。
  11107. * @example
  11108. * var point1 = new GeometryPoint(5,6);
  11109. * var poine2 = new GeometryMultiPoint(7,8);
  11110. * var multiPoint = new MultiPoint([point1,point2]);
  11111. * @usage
  11112. */
  11113. class MultiPoint extends Collection {
  11114. constructor(components) {
  11115. super(components);
  11116. /**
  11117. * @member {Array.<string>} [GeometryMultiPoint.prototype.componentTypes=["SuperMap.Geometry.Point"]]
  11118. * @description components 存储的几何对象所支持的几何类型数组。
  11119. * @readonly
  11120. */
  11121. this.componentTypes = ["SuperMap.Geometry.Point"];
  11122. this.CLASS_NAME = "SuperMap.Geometry.MultiPoint";
  11123. this.geometryType = "MultiPoint";
  11124. }
  11125. /**
  11126. * @function GeometryMultiPoint.prototype.addPoint
  11127. * @description 添加点,封装了 {@link GeometryCollection|GeometryCollection.addComponent} 方法。
  11128. * @param {GeometryPoint} point - 添加的点。
  11129. * @param {number} [index] - 下标。
  11130. */
  11131. addPoint(point, index) {
  11132. this.addComponent(point, index);
  11133. }
  11134. /**
  11135. * @function GeometryMultiPoint.prototype.removePoint
  11136. * @description 移除点,封装了 {@link GeometryCollection|GeometryCollection.removeComponent} 方法。
  11137. * @param {GeometryPoint} point - 移除的点对象。
  11138. */
  11139. removePoint(point) {
  11140. this.removeComponent(point);
  11141. }
  11142. }
  11143. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Curve.js
  11144. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  11145. * This program are made available under the terms of the Apache License, Version 2.0
  11146. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11147. /**
  11148. * @class GeometryCurve
  11149. * @aliasclass Geometry.Curve
  11150. * @deprecatedclass SuperMap.Geometry.Curve
  11151. * @classdesc 几何对象曲线类。
  11152. * @category BaseTypes Geometry
  11153. * @extends GeometryMultiPoint
  11154. * @param {Array.<GeometryPoint>} components - 几何对象数组。
  11155. * @example
  11156. * var point1 = new GeometryPoint(10,20);
  11157. * var point2 = new GeometryPoint(30,40);
  11158. * var curve = new Curve([point1,point2]);
  11159. * @usage
  11160. */
  11161. class Curve extends MultiPoint {
  11162. constructor(components) {
  11163. super(components);
  11164. /**
  11165. * @member {Array.<string>} [GeometryCurve.prototype.componentTypes=["SuperMap.Geometry.Point", "SuperMap.PointWithMeasure"]]
  11166. * @description components 存储的几何对象所支持的几何类型数组。
  11167. * @readonly
  11168. */
  11169. this.componentTypes = ["SuperMap.Geometry.Point", "SuperMap.PointWithMeasure"];
  11170. this.CLASS_NAME = "SuperMap.Geometry.Curve";
  11171. this.geometryType = "Curve";
  11172. }
  11173. }
  11174. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/LineString.js
  11175. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  11176. * This program are made available under the terms of the Apache License, Version 2.0
  11177. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11178. /**
  11179. * @class GeometryLineString
  11180. * @aliasclass Geometry.LineString
  11181. * @deprecatedclass SuperMap.Geometry.LineString
  11182. * @classdesc 几何对象线串类。
  11183. * @category BaseTypes Geometry
  11184. * @param {Array.<GeometryPoint>} points - 用来生成线串的点数组。
  11185. * @extends GeometryCurve
  11186. * @example
  11187. * var points = [new GeometryPoint(4933.319287022352, -3337.3849141502124),
  11188. * new GeometryPoint(4960.9674060199022, -3349.3316322355736),
  11189. * new GeometryPoint(5006.0235999418364, -3358.8890067038628),
  11190. * new GeometryPoint(5075.3145648369318, -3378.0037556404409),
  11191. * new GeometryPoint(5305.19551436013, -3376.9669111768926)],
  11192. * var roadLine = new GeometryLineString(points);
  11193. * @usage
  11194. */
  11195. class LineString extends Curve {
  11196. constructor(points) {
  11197. super(points);
  11198. this.CLASS_NAME = "SuperMap.Geometry.LineString";
  11199. this.geometryType = "LineString";
  11200. }
  11201. /**
  11202. * @function GeometryLineString.prototype.removeComponent
  11203. * @description 只有在线串上有三个或更多的点的时候,才会允许移除点(否则结果将会是单一的点)。
  11204. * @param {GeometryPoint} point - 将被删除的点。
  11205. * @returns {boolean} 删除的点。
  11206. */
  11207. removeComponent(point) { // eslint-disable-line no-unused-vars
  11208. var removed = this.components && (this.components.length > 2);
  11209. if (removed) {
  11210. super.removeComponent.apply(this, arguments);
  11211. }
  11212. return removed;
  11213. }
  11214. /**
  11215. * @function GeometryLineString.prototype.getSortedSegments
  11216. * @description 获取升序排列的点坐标对象数组。
  11217. * @returns {Array} 升序排列的点坐标对象数组。
  11218. */
  11219. getSortedSegments() {
  11220. var numSeg = this.components.length - 1;
  11221. var segments = new Array(numSeg), point1, point2;
  11222. for (var i = 0; i < numSeg; ++i) {
  11223. point1 = this.components[i];
  11224. point2 = this.components[i + 1];
  11225. if (point1.x < point2.x) {
  11226. segments[i] = {
  11227. x1: point1.x,
  11228. y1: point1.y,
  11229. x2: point2.x,
  11230. y2: point2.y
  11231. };
  11232. } else {
  11233. segments[i] = {
  11234. x1: point2.x,
  11235. y1: point2.y,
  11236. x2: point1.x,
  11237. y2: point1.y
  11238. };
  11239. }
  11240. }
  11241. // more efficient to define this somewhere static
  11242. function byX1(seg1, seg2) {
  11243. return seg1.x1 - seg2.x1;
  11244. }
  11245. return segments.sort(byX1);
  11246. }
  11247. /**
  11248. * @function GeometryLineString.prototype.getVertices
  11249. * @description 返回几何图形的所有顶点的列表。
  11250. * @param {boolean} [nodes] - 对于线来说,仅仅返回作为端点的顶点,如果设为 false,则返回非端点的顶点,如果没有设置此参数,则返回所有顶点。
  11251. * @returns {Array} 几何图形的顶点列表。
  11252. */
  11253. getVertices(nodes) {
  11254. var vertices;
  11255. if (nodes === true) {
  11256. vertices = [
  11257. this.components[0],
  11258. this.components[this.components.length - 1]
  11259. ];
  11260. } else if (nodes === false) {
  11261. vertices = this.components.slice(1, this.components.length - 1);
  11262. } else {
  11263. vertices = this.components.slice();
  11264. }
  11265. return vertices;
  11266. }
  11267. /**
  11268. * @function GeometryLineString.calculateCircle
  11269. * @description 三点画圆弧。
  11270. * @param {Array.<GeometryPoint>} points - 传入的待计算的初始点串。
  11271. * @returns {Array.<GeometryPoint>} 计算出相应的圆弧控制点。
  11272. * @example
  11273. * var points = [];
  11274. * points.push(new GeometryPoint(-50,30));
  11275. * points.push(new GeometryPoint(-30,50));
  11276. * points.push(new GeometryPoint(2,60));
  11277. * var circle = GeometryLineString.calculateCircle(points);
  11278. */
  11279. static calculateCircle(points) {
  11280. if (points.length < 3) {
  11281. return points
  11282. }
  11283. var centerPoint = {},
  11284. p1 = points[0],
  11285. p2 = points[1],
  11286. p3 = points[2];
  11287. var R = 0,
  11288. dStep = 0,
  11289. direc = true,
  11290. dRotation = 0,
  11291. dRotationBegin = 0,
  11292. dRotationAngle = 0,
  11293. nSegmentCount = 72,
  11294. circlePoints = [];
  11295. var KTan13 = (p3.y - p1.y) / (p3.x - p1.x);
  11296. var B13 = p3.y - KTan13 * p3.x;
  11297. if ((((p3.x != p1.x) && (p3.y != p1.y)) && (p2.y == KTan13 * p2.x + B13)) ||
  11298. ((p3.x == p1.x) && (p2.x == p1.x)) || ((p3.y == p1.y) && (p2.y == p1.y)) ||
  11299. ((p3.x == p1.x) && (p3.y == p1.y)) || ((p3.x == p2.x) && (p3.y == p2.y)) || ((p1.x == p2.x) && (p1.y == p2.y))) {
  11300. circlePoints.push(p1);
  11301. circlePoints.push(p2);
  11302. circlePoints.push(p3);
  11303. } else {
  11304. 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) -
  11305. (p1.x * p1.x + p1.y * p1.y)) * (2 * (p2.y - p1.y));
  11306. var E = (2 * (p2.x - p1.x)) * ((p3.x * p3.x + p3.y * p3.y) - (p1.x * p1.x + p1.y * p1.y)) -
  11307. (2 * (p3.x - p1.x)) * ((p2.x * p2.x + p2.y * p2.y) - (p1.x * p1.x + p1.y * p1.y));
  11308. var F = 4 * ((p2.x - p1.x) * (p3.y - p1.y) - (p3.x - p1.x) * (p2.y - p1.y));
  11309. centerPoint.x = D / F;
  11310. centerPoint.y = E / F;
  11311. R = Math.sqrt((p1.x - centerPoint.x) * (p1.x - centerPoint.x) + (p1.y - centerPoint.y) * (p1.y - centerPoint.y));
  11312. var dis = (p1.x - p3.x) * (p1.x - p3.x) + (p1.y - p3.y) * (p1.y - p3.y);
  11313. var cons = (2 * R * R - dis) / (2 * R * R);
  11314. cons = cons >= 1 ? 1 : cons;
  11315. cons = cons <= -1 ? -1 : cons;
  11316. dRotationAngle = Math.acos(cons) * 180 / Math.PI;
  11317. if (p3.x == p1.x) {
  11318. dRotationAngle = ((centerPoint.x > p1.x && p2.x > p1.x) || (centerPoint.x < p1.x && p2.x < p1.x)) ? (360 - dRotationAngle) : dRotationAngle;
  11319. } else {
  11320. dRotationAngle = ((centerPoint.y > (KTan13 * centerPoint.x + B13) && p2.y > (KTan13 * p2.x + B13)) ||
  11321. (centerPoint.y < (KTan13 * centerPoint.x + B13) && p2.y < (KTan13 * p2.x + B13))) ? (360 - dRotationAngle) : dRotationAngle;
  11322. }
  11323. dStep = dRotationAngle / 72;
  11324. if (p3.y != p1.y) {
  11325. if (p3.x == p1.x) {
  11326. if (p3.y > p1.y) {
  11327. if (p2.x < p1.x) {
  11328. direc = false;
  11329. }
  11330. } else {
  11331. if (p2.x > p1.x) {
  11332. direc = false;
  11333. }
  11334. }
  11335. } else if (p3.x < p1.x) {
  11336. if (p2.y < KTan13 * p2.x + B13) {
  11337. direc = false;
  11338. }
  11339. } else {
  11340. if (p2.y > KTan13 * p2.x + B13) {
  11341. direc = false;
  11342. }
  11343. }
  11344. } else {
  11345. if (p3.x > p1.x) {
  11346. if (p2.y > p1.y) {
  11347. direc = false;
  11348. }
  11349. } else {
  11350. if (p2.y < p1.y) {
  11351. direc = false;
  11352. }
  11353. }
  11354. }
  11355. var K10 = (p1.y - centerPoint.y) / (p1.x - centerPoint.x);
  11356. var atan10 = K10 >= 0 ? Math.atan(K10) * 180 / Math.PI : Math.abs(Math.atan(K10) * 180 / Math.PI) + 90;
  11357. var CY = Math.abs(centerPoint.y);
  11358. if ((p1.y == CY) && (CY == p3.y)) {
  11359. if (p1.x < p3.x) {
  11360. atan10 = atan10 + 180;
  11361. }
  11362. }
  11363. var newPY = p1.y - centerPoint.y;
  11364. circlePoints.push(p1);
  11365. for (var i = 1; i < nSegmentCount; i++) {
  11366. dRotation = dStep * i;
  11367. dRotationBegin = atan10;
  11368. if (direc) {
  11369. if (newPY >= 0) {
  11370. if (K10 >= 0) {
  11371. dRotationBegin = dRotationBegin + dRotation;
  11372. } else {
  11373. dRotationBegin = (180 - (dRotationBegin - 90)) + dRotation;
  11374. }
  11375. } else {
  11376. if (K10 > 0) {
  11377. dRotationBegin = (dRotationBegin - 180) + dRotation;
  11378. } else {
  11379. dRotationBegin = (90 - dRotationBegin) + dRotation;
  11380. }
  11381. }
  11382. } else {
  11383. if (newPY >= 0) {
  11384. if (K10 >= 0) {
  11385. dRotationBegin = dRotationBegin - dRotation;
  11386. } else {
  11387. dRotationBegin = (180 - (dRotationBegin - 90)) - dRotation;
  11388. }
  11389. } else {
  11390. if (K10 >= 0) {
  11391. dRotationBegin = (dRotationBegin - 180) - dRotation;
  11392. } else {
  11393. dRotationBegin = (90 - dRotationBegin) - dRotation;
  11394. }
  11395. }
  11396. }
  11397. dRotationBegin = dRotationBegin * Math.PI / 180;
  11398. var x = centerPoint.x + R * Math.cos(dRotationBegin);
  11399. var y = centerPoint.y + R * Math.sin(dRotationBegin);
  11400. circlePoints.push(new Point(x, y));
  11401. }
  11402. circlePoints.push(p3);
  11403. }
  11404. return circlePoints;
  11405. }
  11406. /**
  11407. * @function GeometryLineString.createLineEPS
  11408. * @description 根据点的类型画出不同类型的曲线。
  11409. * 点的类型有三种:LTypeArc,LTypeCurve,NONE。
  11410. * @param {Array.<GeometryPoint>} points - 传入的待计算的初始点串。
  11411. * @returns {Array.<GeometryPoint>} 计算出相应的 lineEPS 控制点。
  11412. * @example
  11413. * var points = [];
  11414. * points.push(new GeometryPoint(-50,30));
  11415. * points.push(new GeometryPoint(-30,50,"LTypeArc"));
  11416. * points.push(new GeometryPoint(2,60));
  11417. * points.push(new GeometryPoint(8,20));
  11418. * var lineEPS = GeometryLineString.createLineEPS(points);
  11419. */
  11420. static createLineEPS(points) {
  11421. var list = [],
  11422. len = points.length;
  11423. if (len < 2) {
  11424. return points;
  11425. }
  11426. for (var i = 0; i < len;) {
  11427. var type = points[i].type;
  11428. if (type == 'LTypeArc') {
  11429. var listObj = LineString.createLineArc(list, i, len, points);
  11430. list = listObj[0];
  11431. i = listObj[1];
  11432. } else {
  11433. list.push(points[i]);
  11434. i++;
  11435. }
  11436. }
  11437. return list;
  11438. }
  11439. static createLineArc(list, i, len, points) {
  11440. if (i == 0) {
  11441. let bezierPtsObj = LineString.addPointEPS(points, i, len, 'LTypeArc');
  11442. Array.prototype.push.apply(list, bezierPtsObj[0]);
  11443. i = bezierPtsObj[1] + 1;
  11444. } else if (i == len - 1) {
  11445. var bezierP = [points[i - 1], points[i]],
  11446. bezierPts = LineString.calculateCircle(bezierP);
  11447. Array.prototype.push.apply(list, bezierPts);
  11448. i++;
  11449. } else {
  11450. let bezierPtsObj = LineString.addPointEPS(points, i, len, 'LTypeArc');
  11451. list.pop();
  11452. Array.prototype.push.apply(list, bezierPtsObj[0]);
  11453. i = bezierPtsObj[1] + 1;
  11454. }
  11455. return [list, i];
  11456. }
  11457. static addPointEPS(points, i, len, type) {
  11458. var bezierP = [], j = i + 1;
  11459. if (i == 0) {
  11460. Array.prototype.push.apply(bezierP, [points[i], points[i + 1]]);
  11461. } else if (i == len - 1) {
  11462. Array.prototype.push.apply(bezierP, [points[i - 1], points[i]]);
  11463. } else {
  11464. Array.prototype.push.apply(bezierP, [points[i - 1], points[i], points[i + 1]]);
  11465. }
  11466. var bezierPts;
  11467. if (type == 'LTypeCurve') {
  11468. bezierPts = LineString.calculatePointsFBZN(bezierP);
  11469. } else if (type == 'LTypeArc') {
  11470. bezierPts = LineString.calculateCircle(bezierP);
  11471. }
  11472. return [bezierPts, j];
  11473. }
  11474. }
  11475. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/LinearRing.js
  11476. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  11477. * This program are made available under the terms of the Apache License, Version 2.0
  11478. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11479. /**
  11480. * @class GeometryLinearRing
  11481. * @aliasclass Geometry.LinearRing
  11482. * @deprecatedclass SuperMap.Geometry.LinearRing
  11483. * @classdesc 几何对象线环类,是一个特殊的封闭的线串,在每次 addPoint/removePoint 之后会通过添加一个点(此点是复制的第一个点得到的)
  11484. * 作为最后的一个点来自动关闭线环。
  11485. * @category BaseTypes Geometry
  11486. * @extends GeometryLineString
  11487. * @param {Array.<GeometryPoint>} points - 组成线性环的点。
  11488. * @example
  11489. * var points = [new GeometryPoint(4933.319287022352, -3337.3849141502124),
  11490. * new GeometryPoint(4960.9674060199022, -3349.3316322355736),
  11491. * new GeometryPoint(5006.0235999418364, -3358.8890067038628),
  11492. * new GeometryPoint(5075.3145648369318, -3378.0037556404409),
  11493. * new GeometryPoint(5305.19551436013, -3376.9669111768926)],
  11494. * var linearRing = new GeometryLinearRing(points);
  11495. * @usage
  11496. */
  11497. class LinearRing_LinearRing extends LineString {
  11498. constructor(points) {
  11499. super(points);
  11500. /**
  11501. * @member {Array.<string>} [GeometryLinearRing.prototype.componentTypes=["SuperMap.Geometry.Point"]]
  11502. * @description components 存储的几何对象所支持的几何类型数组,为空表示类型不受限制。
  11503. * @readonly
  11504. */
  11505. this.componentTypes = ["SuperMap.Geometry.Point"];
  11506. this.CLASS_NAME = "SuperMap.Geometry.LinearRing";
  11507. this.geometryType = "LinearRing";
  11508. }
  11509. /**
  11510. * @function GeometryLinearRing.prototype.addComponent
  11511. * @description 添加一个点到几何图形数组中,如果这个点将要被添加到组件数组的末端,并且与数组中已经存在的最后一个点相同,
  11512. * 重复的点是不能被添加的。这将影响未关闭环的关闭。
  11513. * 这个方法可以通过将非空索引(组件数组的下标)作为第二个参数重写。
  11514. * @param {GeometryPoint} point - 点对象。
  11515. * @param {number} [index] - 插入组件数组的下标。
  11516. * @returns {boolean} 点对象是否添加成功。
  11517. */
  11518. addComponent(point, index) {
  11519. var added = false;
  11520. //remove last point
  11521. var lastPoint = this.components.pop();
  11522. // given an index, add the point
  11523. // without an index only add non-duplicate points
  11524. if (index != null || !point.equals(lastPoint)) {
  11525. added = super.addComponent.apply(this, arguments);
  11526. }
  11527. //append copy of first point
  11528. var firstPoint = this.components[0];
  11529. super.addComponent.apply(this, [firstPoint]);
  11530. return added;
  11531. }
  11532. /**
  11533. * @function GeometryLinearRing.prototype.removeComponent
  11534. * @description 从几何组件中删除一个点。
  11535. * @param {GeometryPoint} point - 点对象。
  11536. * @returns {boolean} 点对象是否删除。
  11537. */
  11538. removeComponent(point) { // eslint-disable-line no-unused-vars
  11539. var removed = this.components && (this.components.length > 3);
  11540. if (removed) {
  11541. //remove last point
  11542. this.components.pop();
  11543. //remove our point
  11544. super.removeComponent.apply(this, arguments);
  11545. //append copy of first point
  11546. var firstPoint = this.components[0];
  11547. super.addComponent.apply(this, [firstPoint]);
  11548. }
  11549. return removed;
  11550. }
  11551. /**
  11552. * @function GeometryLinearRing.prototype.getArea
  11553. * @description 获得当前几何对象区域大小,如果是沿顺时针方向的环则是正值,否则为负值。
  11554. * @returns {number} 环的面积。
  11555. */
  11556. getArea() {
  11557. var area = 0.0;
  11558. if (this.components && (this.components.length > 2)) {
  11559. var sum = 0.0;
  11560. for (var i = 0, len = this.components.length; i < len - 1; i++) {
  11561. var b = this.components[i];
  11562. var c = this.components[i + 1];
  11563. sum += (b.x + c.x) * (c.y - b.y);
  11564. }
  11565. area = -sum / 2.0;
  11566. }
  11567. return area;
  11568. }
  11569. /**
  11570. * @function GeometryLinearRing.prototype.getVertices
  11571. * @description 返回几何图形的所有点的列表。
  11572. * @param {boolean} [nodes] - 对于线来说,仅仅返回作为端点的顶点,如果设为 false ,则返回非端点的顶点,如果没有设置此参数,则返回所有顶点。
  11573. * @returns {Array} 几何对象所有点的列表。
  11574. */
  11575. getVertices(nodes) {
  11576. return (nodes === true) ? [] : this.components.slice(0, this.components.length - 1);
  11577. }
  11578. }
  11579. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Polygon.js
  11580. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  11581. * This program are made available under the terms of the Apache License, Version 2.0
  11582. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11583. /**
  11584. * @class GeometryPolygon
  11585. * @aliasclass Geometry.Polygon
  11586. * @deprecatedclass SuperMap.Geometry.Polygon
  11587. * @classdesc 多边形几何对象类。
  11588. * @category BaseTypes Geometry
  11589. * @extends GeometryCollection
  11590. * @param {Array.<GeometryLinearRing>} components - 多边形的线环数组。
  11591. * @example
  11592. * var points =[new GeometryPoint(0,4010338),
  11593. * new GeometryPoint(1063524,4010338),
  11594. * new GeometryPoint(1063524,3150322),
  11595. * new GeometryPoint(0,3150322)
  11596. * ],
  11597. * var linearRings = new GeometryLinearRing(points),
  11598. * var region = new GeometryPolygon([linearRings]);
  11599. * @usage
  11600. */
  11601. class Polygon_Polygon extends Collection {
  11602. constructor(components) {
  11603. super(components);
  11604. /**
  11605. * @member {Array.<string>} [GeometryPolygon.prototype.componentTypes=["SuperMap.Geometry.LinearRing"]]
  11606. * @description components 存储的几何对象所支持的几何类型数组。
  11607. * @readonly
  11608. */
  11609. this.componentTypes = ["SuperMap.Geometry.LinearRing"];
  11610. this.CLASS_NAME = "SuperMap.Geometry.Polygon";
  11611. this.geometryType = "Polygon";
  11612. }
  11613. /**
  11614. * @function GeometryMultiPoint.prototype.getArea
  11615. * @description 获得区域面积,从区域的外部口径减去计此区域内部口径算所得的面积。
  11616. * @returns {number} 几何对象的面积。
  11617. */
  11618. getArea() {
  11619. var area = 0.0;
  11620. if (this.components && (this.components.length > 0)) {
  11621. area += Math.abs(this.components[0].getArea());
  11622. for (var i = 1, len = this.components.length; i < len; i++) {
  11623. area -= Math.abs(this.components[i].getArea());
  11624. }
  11625. }
  11626. return area;
  11627. }
  11628. }
  11629. ;// CONCATENATED MODULE: ./src/common/commontypes/Feature.js
  11630. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  11631. * This program are made available under the terms of the Apache License, Version 2.0
  11632. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11633. /**
  11634. * @class Feature
  11635. * @deprecatedclass SuperMap.Feature
  11636. * @category BaseTypes Geometry
  11637. * @classdesc 要素类组合了地理和属性,Feature 类同时具有 marker 和 lonlat 属性。
  11638. * @param {SuperMap.Layer} layer - 图层。
  11639. * @param {LonLat} lonlat - 经纬度。
  11640. * @param {Object} data - 数据对象。
  11641. * @usage
  11642. */
  11643. class Feature_Feature {
  11644. constructor(layer, lonlat, data) {
  11645. this.CLASS_NAME = "SuperMap.Feature";
  11646. /**
  11647. * @deprecated
  11648. * @member {SuperMap.Layer} Feature.prototype.layer
  11649. * @description 图层。
  11650. */
  11651. this.layer = layer;
  11652. /**
  11653. * @member {string} Feature.prototype.id
  11654. * @description 要素 ID。
  11655. */
  11656. this.id = Util_Util.createUniqueID(this.CLASS_NAME + "_");
  11657. /**
  11658. * @member {LonLat} Feature.prototype.lonlat
  11659. * @description 经纬度。
  11660. *
  11661. */
  11662. this.lonlat = lonlat;
  11663. /**
  11664. * @member {Object} Feature.prototype.data
  11665. * @description 数据对象。
  11666. */
  11667. this.data = (data != null) ? data : {};
  11668. }
  11669. /**
  11670. * @function Feature.prototype.destroy
  11671. * @description 释放相关资源。
  11672. */
  11673. destroy() {
  11674. this.id = null;
  11675. this.lonlat = null;
  11676. this.data = null;
  11677. }
  11678. }
  11679. ;// CONCATENATED MODULE: ./src/common/commontypes/Vector.js
  11680. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  11681. * This program are made available under the terms of the Apache License, Version 2.0
  11682. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11683. /**
  11684. * @class FeatureVector
  11685. * @aliasclass Feature.Vector
  11686. * @deprecatedclass SuperMap.Feature.Vector
  11687. * @category BaseTypes Geometry
  11688. * @classdesc 矢量要素类。该类具有 Geometry 属性存放几何信息,
  11689. * attributes 属性存放非几何信息,另外还包含了 style 属性,用来定义矢量要素的样式,
  11690. * 其中,默认的样式在 {@link FeatureVector.style} 类中定义,如果没有特别的指定将使用默认的样式。
  11691. * @extends {Feature}
  11692. * @param {Geometry} geometry - 要素的几何信息。
  11693. * @param {Object} [attributes] - 描述要素的任意的可序列化属性,将要映射到 attributes 属性中的对象。
  11694. * @param {Object} [style] - 样式对象。
  11695. * @example
  11696. * var geometry = new GeometryPoint(-115,10);
  11697. * var style = {
  11698. * strokeColor:"#339933",
  11699. * strokeOpacity:1,
  11700. * strokeWidth:3,
  11701. * pointRadius:6
  11702. * }
  11703. * var pointFeature = new FeatureVector(geometry,null,style);
  11704. * vectorLayer.addFeatures(pointFeature);
  11705. * @usage
  11706. */
  11707. // TRASH THIS
  11708. const State = {
  11709. /** states */
  11710. UNKNOWN: 'Unknown',
  11711. INSERT: 'Insert',
  11712. UPDATE: 'Update',
  11713. DELETE: 'Delete'
  11714. };
  11715. class Vector extends Feature_Feature {
  11716. constructor(geometry, attributes, style) {
  11717. super(null, null, attributes);
  11718. /**
  11719. * @member {string} FeatureVector.prototype.fid
  11720. * @description fid。
  11721. */
  11722. this.fid = null;
  11723. /**
  11724. * @member {Geometry} FeatureVector.prototype.geometry
  11725. * @description 存放几何信息。
  11726. */
  11727. this.geometry = geometry ? geometry : null;
  11728. /**
  11729. * @member {Object} FeatureVector.prototype.attributes
  11730. * @description 描述要素的任意的可序列化属性。
  11731. */
  11732. this.attributes = {};
  11733. if (attributes) {
  11734. this.attributes = Util_Util.extend(this.attributes, attributes);
  11735. }
  11736. /**
  11737. * @member {Bounds} FeatureVector.prototype.bounds
  11738. * @description 限制要素几何的边界。
  11739. */
  11740. this.bounds = null;
  11741. /**
  11742. * @member {string} FeatureVector.prototype.state
  11743. * @description state。
  11744. */
  11745. this.state = null;
  11746. /**
  11747. * @member {Object} FeatureVector.prototype.style
  11748. * @description 要素的样式属性,地图查询返回的 feature 的 style,8C 变为null。
  11749. */
  11750. this.style = style ? style : null;
  11751. /**
  11752. * @member {string} FeatureVector.prototype.url
  11753. * @description 如果设置了这个属性,在更新或者删除要素时需要考虑 {@link HTTP} 。
  11754. */
  11755. this.url = null;
  11756. this.lonlat = null;
  11757. this.CLASS_NAME = "SuperMap.Feature.Vector";
  11758. Vector.style = {
  11759. 'default': {
  11760. fillColor: "#ee9900",
  11761. fillOpacity: 0.4,
  11762. hoverFillColor: "white",
  11763. hoverFillOpacity: 0.8,
  11764. strokeColor: "#ee9900",
  11765. strokeOpacity: 1,
  11766. strokeWidth: 1,
  11767. strokeLinecap: "round",
  11768. strokeDashstyle: "solid",
  11769. hoverStrokeColor: "red",
  11770. hoverStrokeOpacity: 1,
  11771. hoverStrokeWidth: 0.2,
  11772. pointRadius: 6,
  11773. hoverPointRadius: 1,
  11774. hoverPointUnit: "%",
  11775. pointerEvents: "visiblePainted",
  11776. cursor: "inherit",
  11777. fontColor: "#000000",
  11778. labelAlign: "cm",
  11779. labelOutlineColor: "white",
  11780. labelOutlineWidth: 3
  11781. },
  11782. 'select': {
  11783. fillColor: "blue",
  11784. fillOpacity: 0.4,
  11785. hoverFillColor: "white",
  11786. hoverFillOpacity: 0.8,
  11787. strokeColor: "blue",
  11788. strokeOpacity: 1,
  11789. strokeWidth: 2,
  11790. strokeLinecap: "round",
  11791. strokeDashstyle: "solid",
  11792. hoverStrokeColor: "red",
  11793. hoverStrokeOpacity: 1,
  11794. hoverStrokeWidth: 0.2,
  11795. pointRadius: 6,
  11796. hoverPointRadius: 1,
  11797. hoverPointUnit: "%",
  11798. pointerEvents: "visiblePainted",
  11799. cursor: "pointer",
  11800. fontColor: "#000000",
  11801. labelAlign: "cm",
  11802. labelOutlineColor: "white",
  11803. labelOutlineWidth: 3
  11804. },
  11805. 'temporary': {
  11806. fillColor: "#66cccc",
  11807. fillOpacity: 0.2,
  11808. hoverFillColor: "white",
  11809. hoverFillOpacity: 0.8,
  11810. strokeColor: "#66cccc",
  11811. strokeOpacity: 1,
  11812. strokeLinecap: "round",
  11813. strokeWidth: 2,
  11814. strokeDashstyle: "solid",
  11815. hoverStrokeColor: "red",
  11816. hoverStrokeOpacity: 1,
  11817. hoverStrokeWidth: 0.2,
  11818. pointRadius: 6,
  11819. hoverPointRadius: 1,
  11820. hoverPointUnit: "%",
  11821. pointerEvents: "visiblePainted",
  11822. //cursor:"inherit",
  11823. cursor: "default",
  11824. fontColor: "#000000",
  11825. labelAlign: "cm",
  11826. labelOutlineColor: "white",
  11827. labelOutlineWidth: 3
  11828. },
  11829. 'delete': {
  11830. display: "none"
  11831. }
  11832. };
  11833. }
  11834. /**
  11835. * @function FeatureVector.prototype.destroy
  11836. * @description 释放资源,将引用资源的属性置空。
  11837. */
  11838. destroy() {
  11839. if (this.layer) {
  11840. this.layer.removeFeatures(this);
  11841. this.layer = null;
  11842. }
  11843. this.geometry = null;
  11844. super.destroy();
  11845. }
  11846. /**
  11847. * @function FeatureVector.prototype.clone
  11848. * @description 复制矢量要素,并返回复制后的新对象。
  11849. * @returns {FeatureVector} 相同要素的新的矢量要素。
  11850. */
  11851. clone() {
  11852. return new Vector(
  11853. this.geometry ? this.geometry.clone() : null,
  11854. this.attributes,
  11855. this.style);
  11856. }
  11857. /**
  11858. * @function FeatureVector.prototype.toState
  11859. * @description 设置新状态。
  11860. * @param {string} state - 状态。
  11861. */
  11862. toState(state) {
  11863. if (state === State.UPDATE) {
  11864. switch (this.state) {
  11865. case State.UNKNOWN:
  11866. case State.DELETE:
  11867. this.state = state;
  11868. break;
  11869. case State.UPDATE:
  11870. case State.INSERT:
  11871. break;
  11872. }
  11873. } else if (state === State.INSERT) {
  11874. switch (this.state) {
  11875. case State.UNKNOWN:
  11876. break;
  11877. default:
  11878. this.state = state;
  11879. break;
  11880. }
  11881. } else if (state === State.DELETE) {
  11882. switch (this.state) {
  11883. case State.INSERT:
  11884. // the feature should be destroyed
  11885. break;
  11886. case State.DELETE:
  11887. break;
  11888. case State.UNKNOWN:
  11889. case State.UPDATE:
  11890. this.state = state;
  11891. break;
  11892. }
  11893. } else if (state === State.UNKNOWN) {
  11894. this.state = state;
  11895. }
  11896. }
  11897. }
  11898. /**
  11899. *
  11900. * @typedef {Object} FeatureVector.style
  11901. * @description Feature 有大量的样式属性,如果没有特别的指定将使用默认的样式,
  11902. * 大部分样式通过 SVG 标准定义属性。
  11903. * - fill properties 资料介绍:{@link http://www.w3.org/TR/SVG/painting.html#FillProperties}
  11904. * - stroke properties 资料介绍:{@link http://www.w3.org/TR/SVG/painting.html#StrokeProperties}
  11905. * @property {boolean} [fill] - 不需要填充则设置为 false。
  11906. * @property {string} [fillColor='#ee9900'] - 十六进制填充颜色。
  11907. * @property {number} [fillOpacity=0.4] - 填充不透明度。
  11908. * @property {boolean} [stroke] - 不需要描边则设为 false。
  11909. * @property {string} [strokeColor='#ee9900'] - 十六进制描边颜色。
  11910. * @property {number} [strokeOpacity=0.4] - 描边的不透明度(0-1)。
  11911. * @property {number} [strokeWidth=1] - 像素描边宽度。
  11912. * @property {string} [strokeLinecap='round'] - strokeLinecap 有三种类型 butt,round,square。
  11913. * @property {string} [strokeDashstyle='solid'] - 有 dot,dash,dashdot,longdash,longdashdot,solid 几种样式。
  11914. * @property {boolean} [graphic] - 不需要则设置为 false。
  11915. * @property {number} [pointRadius=6] - 像素点半径。
  11916. * @property {string} [pointerEvents='visiblePainted'] - pointerEvents。
  11917. * @property {string} [cursor] - cursor。
  11918. * @property {boolean} [allowRotate='false'] - 是否允许图标随着运行方向旋转。用于时空数据图层。
  11919. * @property {string} [externalGraphic] - 连接到用来渲染点的外部的图形。
  11920. * @property {number} [graphicWidth] - 外部图表的像素宽度。
  11921. * @property {number} [graphicHeight] - 外部图表的像素高度。
  11922. * @property {number} [graphicOpacity] - 外部图表的不透明度(0-1)。
  11923. * @property {number} [graphicXOffset] - 外部图表沿着x方向的偏移量。
  11924. * @property {number} [graphicYOffset] - 外部图表沿着y方向的偏移量。
  11925. * @property {number} [rotation] - 一个图表沿着其中心点(或者偏移中心指定点)在顺时针方向旋转。
  11926. * @property {number} [graphicZIndex] - 渲染时使用的索引值。
  11927. * @property {string} [graphicName='circle'] - 渲染点时图标使用的名字。支持"circle" , "square", "star", "x", "cross", "triangle"。
  11928. * @property {string} [graphicTitle] - 外部图表的提示框。
  11929. * @property {string} [backgroundGraphic] - 外部图表的背景。
  11930. * @property {number} [backgroundGraphicZIndex] - 背景图渲染时使用的索引值。
  11931. * @property {number} [backgroundXOffset] - 背景图在 x 轴的偏移量。
  11932. * @property {number} [backgroundYOffset] - 背景图在 y 轴的偏移量。
  11933. * @property {number} [backgroundHeight] - 背景图的高度。如果没有设置,将用 graphicHeight。
  11934. * @property {number} [backgroundWidth] - 背景图的宽度。如果没有设置,将用 graphicWidth。
  11935. * @property {boolean} [isUnicode=false] - 这个属性要配合 label 属性来用,当为 true时,label 就可以使用 unicode 编码,
  11936. * 比如 "a" 的 unicode 十六进制编码为 61,则 label 属性可以为 "&#x61;",其中 "&#" 为前缀,标志这个为 unicode 编码,
  11937. * "x" 是指 16 进制,这时页面显示的是 "a";当此值为 false 的时候,label 的内容会被直接输出,
  11938. * 比如,label 为 "&#x61;",这时页面显示的也是 "&#x61;"。
  11939. * @property {string} [label] - 可选的标签文本。
  11940. * @property {string} [labelAlign='cm'] - 标签对齐,是由两个字符组成的字符串,如:"lt", "cm", "rb",
  11941. * 其中第一个字符代表水平方向上的对齐,"l"=left, "c"=center, "r"=right;
  11942. * 第二个字符代表垂直方向上的对齐,"t"=top, "m"=middle, "b"=bottom。
  11943. * @property {number} [labelXOffset] - 标签在 x 轴方向的偏移量。
  11944. * @property {number} [labelYOffset] - 标签在 y 轴方向的偏移量。
  11945. * @property {boolean} [labelSelect=false] - 如果设为 true,标签可以选用 SelectFeature 或者 similar 控件。
  11946. * @property {string} [fontColor='#000000'] - 标签字体颜色。
  11947. * @property {number} [fontOpacity] - 标签透明度 (0-1)。
  11948. * @property {string} [fontFamily] - 标签的字体类型。
  11949. * @property {string} [fontSize] - 标签的字体大小。
  11950. * @property {string} [fontStyle] - 标签的字体样式。
  11951. * @property {string} [fontWeight] - 标签的字体粗细。
  11952. * @property {string} [display] - 如果 display 属性设置为 “none”,符号将没有任何效果。
  11953. * @example
  11954. * // label的用法如下:
  11955. * function addGeoTest(){
  11956. * var geometry = new GeometryPoint(105, 35);
  11957. * var pointFeature = new FeatureVector(geometry);
  11958. * var styleTest = {
  11959. * label:"supermap",
  11960. * fontColor:"#0000ff",
  11961. * fontOpacity:"0.5",
  11962. * fontFamily:"隶书",
  11963. * fontSize:"8em",
  11964. * fontWeight:"bold",
  11965. * fontStyle:"italic",
  11966. * labelSelect:"true",
  11967. * }
  11968. * pointFeature.style = styleTest;
  11969. * vectorLayer.addFeatures([pointFeature]);
  11970. * }
  11971. */
  11972. ;// CONCATENATED MODULE: ./src/common/format/Format.js
  11973. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  11974. * This program are made available under the terms of the Apache License, Version 2.0
  11975. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11976. /**
  11977. * @class Format
  11978. * @deprecatedclass SuperMap.Format
  11979. * @classdesc 读写各种格式的格式类基类。其子类应该包含并实现 read 和 write 方法。
  11980. * @category BaseTypes Format
  11981. * @param {Object} options - 可选参数。
  11982. * @param {boolean} [options.keepData=false] - 如果设置为 true, data 属性会指向被解析的对象(例如 JSON 或 xml 数据对象)。
  11983. * @param {Object} [options.data] - 当 keepData 属性设置为 true,这是传递给 read 操作的要被解析的字符串。
  11984. * @usage
  11985. */
  11986. class Format {
  11987. constructor(options) {
  11988. /**
  11989. * @member {Object} Format.prototype.data
  11990. * @description 当 keepData 属性设置为 true,这是传递给 read 操作的要被解析的字符串。
  11991. */
  11992. this.data = null;
  11993. /**
  11994. * @member {Object} [Format.prototype.keepData=false]
  11995. * @description 保持最近读到的数据的引用(通过 data 属性)。
  11996. */
  11997. this.keepData = false;
  11998. Util_Util.extend(this, options);
  11999. this.options = options;
  12000. this.CLASS_NAME = "SuperMap.Format";
  12001. }
  12002. /**
  12003. * @function Format.prototype.destroy
  12004. * @description 销毁该格式类,释放相关资源。
  12005. */
  12006. destroy() {
  12007. //用来销毁该格式类,释放相关资源
  12008. }
  12009. /**
  12010. * @function Format.prototype.read
  12011. * @description 来从字符串中读取数据。
  12012. * @param {string} data - 读取的数据。
  12013. */
  12014. read(data) { // eslint-disable-line no-unused-vars
  12015. //用来从字符串中读取数据
  12016. }
  12017. /**
  12018. * @function Format.prototype.write
  12019. * @description 将对象写成字符串。
  12020. * @param {Object} object - 可序列化的对象。
  12021. * @returns {string} 对象转化后的字符串。
  12022. */
  12023. write(object) { // eslint-disable-line no-unused-vars
  12024. //用来写字符串
  12025. }
  12026. }
  12027. ;// CONCATENATED MODULE: ./src/common/format/JSON.js
  12028. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  12029. * This program are made available under the terms of the Apache License, Version 2.0
  12030. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12031. /**
  12032. * @class JSONFormat
  12033. * @aliasclass Format.JSON
  12034. * @deprecatedclass SuperMap.Format.JSON
  12035. * @classdesc 安全的读写 JSON 的解析类。使用 {@link JSONFormat} 构造函数创建新实例。
  12036. * @category BaseTypes Format
  12037. * @param {Object} [options] - 可选参数。
  12038. * @param {string} [options.indent=" "] - 用于格式化输出,indent 字符串会在每次缩进的时候使用一次。
  12039. * @param {string} [options.space=" "] - 用于格式化输出,space 字符串会在名值对的 ":" 后边添加。
  12040. * @param {string} [options.newline="\n"] - 用于格式化输出, newline 字符串会用在每一个名值对或数组项末尾。
  12041. * @param {number} [options.level=0] - 用于格式化输出, 表示的是缩进级别。
  12042. * @param {boolean} [options.pretty=false] - 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  12043. * @param {boolean} [options.nativeJSON] - 需要被注册的监听器对象。
  12044. * @extends {Format}
  12045. * @usage
  12046. */
  12047. class JSONFormat extends Format {
  12048. constructor(options) {
  12049. super(options);
  12050. /**
  12051. * @member {string} [JSONFormat.prototype.indent=" "]
  12052. * @description 用于格式化输出,indent 字符串会在每次缩进的时候使用一次。
  12053. */
  12054. this.indent = " ";
  12055. /**
  12056. * @member {string} [JSONFormat.prototype.space=" "]
  12057. * @description 用于格式化输出,space 字符串会在名值对的 ":" 后边添加。
  12058. */
  12059. this.space = " ";
  12060. /**
  12061. * @member {string} [JSONFormat.prototype.newline="\n"]
  12062. * @description 用于格式化输出, newline 字符串会用在每一个名值对或数组项末尾。
  12063. */
  12064. this.newline = "\n";
  12065. /**
  12066. * @member {number} [JSONFormat.prototype.level=0]
  12067. * @description 用于格式化输出, 表示的是缩进级别。
  12068. */
  12069. this.level = 0;
  12070. /**
  12071. * @member {boolean} [JSONFormat.prototype.pretty=false]
  12072. * @description 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  12073. */
  12074. this.pretty = false;
  12075. /**
  12076. * @member {boolean} JSONFormat.prototype.nativeJSON
  12077. * @description 判断浏览器是否原生支持 JSON 格式数据。
  12078. */
  12079. this.nativeJSON = (function () {
  12080. return !!(window.JSON && typeof JSON.parse === "function" && typeof JSON.stringify === "function");
  12081. })();
  12082. this.CLASS_NAME = "SuperMap.Format.JSON";
  12083. /**
  12084. * @member JSONFormat.prototype.serialize
  12085. * @description 提供一些类型对象转 JSON 字符串的方法。
  12086. */
  12087. this.serialize = {
  12088. /**
  12089. * @function JSONFormat.serialize.object
  12090. * @description 把对象转换为 JSON 字符串。
  12091. * @param {Object} object - 可序列化的对象。
  12092. * @returns {string} JSON 字符串。
  12093. */
  12094. 'object': function (object) {
  12095. // three special objects that we want to treat differently
  12096. if (object == null) {
  12097. return "null";
  12098. }
  12099. if (object.constructor === Date) {
  12100. return this.serialize.date.apply(this, [object]);
  12101. }
  12102. if (object.constructor === Array) {
  12103. return this.serialize.array.apply(this, [object]);
  12104. }
  12105. var pieces = ['{'];
  12106. this.level += 1;
  12107. var key, keyJSON, valueJSON;
  12108. var addComma = false;
  12109. for (key in object) {
  12110. if (object.hasOwnProperty(key)) {
  12111. // recursive calls need to allow for sub-classing
  12112. keyJSON = this.write.apply(this,
  12113. [key, this.pretty]);
  12114. valueJSON = this.write.apply(this,
  12115. [object[key], this.pretty]);
  12116. if (keyJSON != null && valueJSON != null) {
  12117. if (addComma) {
  12118. pieces.push(',');
  12119. }
  12120. pieces.push(this.writeNewline(), this.writeIndent(),
  12121. keyJSON, ':', this.writeSpace(), valueJSON);
  12122. addComma = true;
  12123. }
  12124. }
  12125. }
  12126. this.level -= 1;
  12127. pieces.push(this.writeNewline(), this.writeIndent(), '}');
  12128. return pieces.join('');
  12129. },
  12130. /**
  12131. * @function JSONFormat.serialize.array
  12132. * @description 把数组转换成 JSON 字符串。
  12133. * @param {Array} array - 可序列化的数组。
  12134. * @returns {string} JSON 字符串。
  12135. */
  12136. 'array': function (array) {
  12137. var json;
  12138. var pieces = ['['];
  12139. this.level += 1;
  12140. for (var i = 0, len = array.length; i < len; ++i) {
  12141. // recursive calls need to allow for sub-classing
  12142. json = this.write.apply(this,
  12143. [array[i], this.pretty]);
  12144. if (json != null) {
  12145. if (i > 0) {
  12146. pieces.push(',');
  12147. }
  12148. pieces.push(this.writeNewline(), this.writeIndent(), json);
  12149. }
  12150. }
  12151. this.level -= 1;
  12152. pieces.push(this.writeNewline(), this.writeIndent(), ']');
  12153. return pieces.join('');
  12154. },
  12155. /**
  12156. * @function JSONFormat.serialize.string
  12157. * @description 把字符串转换成 JSON 字符串。
  12158. * @param {string} string - 可序列化的字符串。
  12159. * @returns {string} JSON 字符串。
  12160. */
  12161. 'string': function (string) {
  12162. // If the string contains no control characters, no quote characters, and no
  12163. // backslash characters, then we can simply slap some quotes around it.
  12164. // Otherwise we must also replace the offending characters with safe
  12165. // sequences.
  12166. var m = {
  12167. '\b': '\\b',
  12168. '\t': '\\t',
  12169. '\n': '\\n',
  12170. '\f': '\\f',
  12171. '\r': '\\r',
  12172. '"': '\\"',
  12173. '\\': '\\\\'
  12174. };
  12175. /*eslint-disable no-control-regex*/
  12176. if (/["\\\x00-\x1f]/.test(string)) {
  12177. return '"' + string.replace(/([\x00-\x1f\\"])/g, function (a, b) {
  12178. var c = m[b];
  12179. if (c) {
  12180. return c;
  12181. }
  12182. c = b.charCodeAt();
  12183. return '\\u00' +
  12184. Math.floor(c / 16).toString(16) +
  12185. (c % 16).toString(16);
  12186. }) + '"';
  12187. }
  12188. return '"' + string + '"';
  12189. },
  12190. /**
  12191. * @function JSONFormat.serialize.number
  12192. * @description 把数字转换成 JSON 字符串。
  12193. * @param {number} number - 可序列化的数字。
  12194. * @returns {string} JSON 字符串。
  12195. */
  12196. 'number': function (number) {
  12197. return isFinite(number) ? String(number) : "null";
  12198. },
  12199. /**
  12200. * @function JSONFormat.serialize.boolean
  12201. * @description Transform a boolean into a JSON string.
  12202. * @param {boolean} bool - The boolean to be serialized.
  12203. * @returns {string} A JSON string representing the boolean.
  12204. */
  12205. 'boolean': function (bool) {
  12206. return String(bool);
  12207. },
  12208. /**
  12209. * @function JSONFormat.serialize.object
  12210. * @description 将日期对象转换成 JSON 字符串。
  12211. * @param {Date} date - 可序列化的日期对象。
  12212. * @returns {string} JSON 字符串。
  12213. */
  12214. 'date': function (date) {
  12215. function format(number) {
  12216. // Format integers to have at least two digits.
  12217. return (number < 10) ? '0' + number : number;
  12218. }
  12219. return '"' + date.getFullYear() + '-' +
  12220. format(date.getMonth() + 1) + '-' +
  12221. format(date.getDate()) + 'T' +
  12222. format(date.getHours()) + ':' +
  12223. format(date.getMinutes()) + ':' +
  12224. format(date.getSeconds()) + '"';
  12225. }
  12226. };
  12227. }
  12228. /**
  12229. * @function JSONFormat.prototype.read
  12230. * @description 将一个符合 JSON 结构的字符串进行解析。
  12231. * @param {string} json - 符合 JSON 结构的字符串。
  12232. * @param {function} filter - 过滤方法,最终结果的每一个键值对都会调用该过滤方法,并在对应的值的位置替换成该方法返回的值。
  12233. * @returns {(Object|string|Array|number|boolean)} 对象,数组,字符串或数字。
  12234. */
  12235. read(json, filter) {
  12236. var object;
  12237. if (this.nativeJSON) {
  12238. try {
  12239. object = JSON.parse(json, filter);
  12240. } catch (e) {
  12241. // Fall through if the regexp test fails.
  12242. return { data: json}
  12243. }
  12244. }
  12245. if (this.keepData) {
  12246. this.data = object;
  12247. }
  12248. return object;
  12249. }
  12250. /**
  12251. * @function JSONFormat.prototype.write
  12252. * @description 序列化一个对象到一个符合 JSON 格式的字符串。
  12253. * @param {Object|string|Array|number|boolean} value - 需要被序列化的对象,数组,字符串,数字,布尔值。
  12254. * @param {boolean} [pretty=false] - 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  12255. * @returns {string} 符合 JSON 格式的字符串。
  12256. *
  12257. */
  12258. write(value, pretty) {
  12259. this.pretty = !!pretty;
  12260. var json = null;
  12261. var type = typeof value;
  12262. if (this.serialize[type]) {
  12263. try {
  12264. json = (!this.pretty && this.nativeJSON) ?
  12265. JSON.stringify(value) :
  12266. this.serialize[type].apply(this, [value]);
  12267. } catch (err) {
  12268. //console.error("Trouble serializing: " + err);
  12269. }
  12270. }
  12271. return json;
  12272. }
  12273. /**
  12274. * @function JSONFormat.prototype.writeIndent
  12275. * @description 根据缩进级别输出一个缩进字符串。
  12276. * @private
  12277. * @returns {string} 一个适当的缩进字符串。
  12278. */
  12279. writeIndent() {
  12280. var pieces = [];
  12281. if (this.pretty) {
  12282. for (var i = 0; i < this.level; ++i) {
  12283. pieces.push(this.indent);
  12284. }
  12285. }
  12286. return pieces.join('');
  12287. }
  12288. /**
  12289. * @function JSONFormat.prototype.writeNewline
  12290. * @description 在格式化输出模式情况下输出代表新一行的字符串。
  12291. * @private
  12292. * @returns {string} 代表新的一行的字符串。
  12293. */
  12294. writeNewline() {
  12295. return (this.pretty) ? this.newline : '';
  12296. }
  12297. /**
  12298. * @function JSONFormat.prototype.writeSpace
  12299. * @private
  12300. * @description 在格式化输出模式情况下输出一个代表空格的字符串。
  12301. * @returns {string} 空格字符串。
  12302. */
  12303. writeSpace() {
  12304. return (this.pretty) ? this.space : '';
  12305. }
  12306. }
  12307. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/MultiLineString.js
  12308. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  12309. * This program are made available under the terms of the Apache License, Version 2.0
  12310. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12311. /**
  12312. * @class GeometryMultiLineString
  12313. * @aliasclass Geometry.MultiLineString
  12314. * @deprecatedclass SuperMap.Geometry.MultiLineString
  12315. * @classdesc 几何对象多线类。
  12316. * @category BaseTypes Geometry
  12317. * @extends GeometryCollection
  12318. * @param {Array.<GeometryLineString>} components - GeometryLineString 数组。
  12319. * @example
  12320. * var multi = new GeometryMultiLineString([
  12321. * new GeometryLineString([
  12322. * new GeometryPoint(1, 0),
  12323. * new GeometryPoint(0, 1)
  12324. * ])
  12325. * ]);
  12326. * @usage
  12327. */
  12328. class MultiLineString extends Collection {
  12329. constructor(components) {
  12330. super(components);
  12331. /**
  12332. * @member {Array.<string>} [GeometryMultiLineString.prototype.componentTypes=["SuperMap.Geometry.LineString"]]
  12333. * @description components 存储的几何对象所支持的几何类型数组。
  12334. * @readonly
  12335. */
  12336. this.componentTypes = ["SuperMap.Geometry.LineString"];
  12337. this.CLASS_NAME = "SuperMap.Geometry.MultiLineString";
  12338. this.geometryType = "MultiLineString";
  12339. }
  12340. }
  12341. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/MultiPolygon.js
  12342. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  12343. * This program are made available under the terms of the Apache License, Version 2.0
  12344. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12345. /**
  12346. * @class GeometryMultiPolygon
  12347. * @aliasclass Geometry.MultiPolygon
  12348. * @deprecatedclass SuperMap.Geometry.MultiPolygon
  12349. * @classdesc 几何对象多多边形类。
  12350. * @category BaseTypes Geometry
  12351. * @extends GeometryCollection
  12352. * @param {Array.<GeometryPolygon>} components - 形成 GeometryMultiPolygon 的多边形数组。
  12353. * @example
  12354. * var points1 = [new GeometryPoint(10,10),new GeometryPoint(0,0)];
  12355. * var points2 = [new GeometryPoint(10,10),new GeometryPoint(0,0),new GeometryPoint(3,3),new GeometryPoint(10,10)];
  12356. *
  12357. * var linearRing1 = new GeometryLinearRing(points1);
  12358. * var linearRing2 = new GeometryLinearRing(points2);
  12359. *
  12360. * var polygon1 = new GeometryPolygon([linearRing1]);
  12361. * var polygon2 = new GeometryPolygon([linearRing2]);
  12362. *
  12363. * var multiPolygon1 = new GeometryMultiPolygon([polygon1,polygon2]);
  12364. * @usage
  12365. */
  12366. class MultiPolygon extends Collection {
  12367. constructor(components) {
  12368. super(components);
  12369. /**
  12370. * @member {Array.<string>} [GeometryMultiPolygon.prototype.componentTypes=["SuperMap.Geometry.Polygon"]]
  12371. * @description components 存储的几何对象所支持的几何类型数组。
  12372. * @readonly
  12373. */
  12374. this.componentTypes = ["SuperMap.Geometry.Polygon"];
  12375. this.CLASS_NAME = "SuperMap.Geometry.MultiPolygon";
  12376. this.geometryType = "MultiPolygon";
  12377. }
  12378. }
  12379. ;// CONCATENATED MODULE: ./src/common/iServer/ServerColor.js
  12380. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  12381. * This program are made available under the terms of the Apache License, Version 2.0
  12382. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12383. /**
  12384. * @class ServerColor
  12385. * @deprecatedclass SuperMap.ServerColor
  12386. * @category iServer Map Theme
  12387. * @classdesc 颜色类。该类使用三原色( RGB )来表达颜色。
  12388. * @param {Object} options - 可选参数。
  12389. * @param {number} [options.red=255] - 获取或设置红色值。
  12390. * @param {number} [options.green=0] - 获取或设置绿色值。
  12391. * @param {number} [options.blue=0] - 获取或设置蓝色值。
  12392. * @usage
  12393. */
  12394. class ServerColor {
  12395. constructor(red, green, blue) {
  12396. /**
  12397. * @member {number} [ServerColor.prototype.red=255]
  12398. * @description 获取或设置红色值。
  12399. */
  12400. this.red = (!red && red != 0)?255:red;
  12401. /**
  12402. * @member {number} [ServerColor.prototype.green=0]
  12403. * @description 获取或设置绿色值。
  12404. */
  12405. this.green = green||0;
  12406. /**
  12407. * @member {number} [ServerColor.prototype.blue=0]
  12408. * @description 获取或设置蓝色值。
  12409. */
  12410. this.blue = blue||0;
  12411. this.CLASS_NAME = "SuperMap.ServerColor";
  12412. }
  12413. /**
  12414. * @function ServerColor.prototype.destroy
  12415. * @description 释放资源,将引用资源的属性置空。
  12416. */
  12417. destroy() {
  12418. var me = this;
  12419. me.red = null;
  12420. me.green = null;
  12421. me.blue = null;
  12422. }
  12423. /**
  12424. * @function ServerColor.formJson
  12425. * @description 将 JSON 对象转化为 ServerColor 对象。
  12426. * @param {Object} jsonObject - 要转换的 JSON 对象。
  12427. * @returns {ServerColor} 转化后的 ServerColor 对象。
  12428. */
  12429. static fromJson(jsonObject) {
  12430. if (!jsonObject) {
  12431. return;
  12432. }
  12433. var color = new ServerColor();
  12434. var red = 255;
  12435. if (jsonObject.red !== null) {
  12436. red = Number(jsonObject.red);
  12437. }
  12438. color.red = red;
  12439. var green = 0;
  12440. if (jsonObject.green !== null) {
  12441. green = Number(jsonObject.green);
  12442. }
  12443. color.green = green;
  12444. var blue = 0;
  12445. if (jsonObject.blue !== null) {
  12446. blue = Number(jsonObject.blue);
  12447. }
  12448. color.blue = blue;
  12449. return color;
  12450. }
  12451. }
  12452. ;// CONCATENATED MODULE: ./src/common/iServer/ServerStyle.js
  12453. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  12454. * This program are made available under the terms of the Apache License, Version 2.0
  12455. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12456. /**
  12457. * @class ServerStyle
  12458. * @deprecatedclass SuperMap.ServerStyle
  12459. * @category iServer Map Theme
  12460. * @classdesc 服务端矢量要素风格类。该类用于定义点状符号、线状符号、填充符号风格及其相关属性。
  12461. * @param {Object} options - 参数。
  12462. * @param {FillGradientMode} options.fillGradientMode - 渐变填充风格的渐变类型。
  12463. * @param {ServerColor} [options.fillBackColor=[255,255,255]] - 填充背景颜色。
  12464. * @param {boolean} [options.fillBackOpaque=false] - 背景是否不透明。
  12465. * @param {ServerColor} [options.fillForeColor=[255,0,0]] - 填充颜色。
  12466. * @param {number} [options.fillGradientAngle=0] - 渐变填充的旋转角度。
  12467. * @param {number} [options.fillGradientOffsetRatioX=0] - 渐变填充中心点相对于填充区域范围中心点的水平偏移百分比。
  12468. * @param {number} [options.fillGradientOffsetRatioY=0] - 填充中心点相对于填充区域范围中心点的垂直偏移百分比。
  12469. * @param {number} [options.fillOpaqueRate=100] - 填充不透明度。
  12470. * @param {number} [options.fillSymbolID=0] - 填充符号的编码。
  12471. * @param {ServerColor} [options.lineColor] - 矢量要素的边线颜色。默认 lineColor = new ServerColor(0, 0, 0)。
  12472. * @param {number} [options.lineSymbolID=0] - 线状符号的编码。
  12473. * @param {number} [options.lineWidth=1] - 边线的宽度。
  12474. * @param {number} [options.markerAngle=0] - 点状符号的旋转角度。
  12475. * @param {number} [options.markerSize=1] - 点状符号的大小。
  12476. * @param {number} [options.markerSymbolID=-1] - 点状符号的编码。
  12477. * @usage
  12478. */
  12479. class ServerStyle {
  12480. constructor(options) {
  12481. /**
  12482. * @member {ServerColor} ServerStyle.prototype.fillBackColor
  12483. * @description 填充背景颜色。当填充模式为渐变填充时,该颜色为填充终止色。
  12484. */
  12485. this.fillBackColor = new ServerColor(255, 255, 255);
  12486. /**
  12487. * @member {boolean} [ServerStyle.prototype.fillBackOpaque=false]
  12488. * @description 背景是否不透明。false 表示透明。
  12489. */
  12490. this.fillBackOpaque = false;
  12491. /**
  12492. * @member {ServerColor} ServerStyle.prototype.fillForeColor
  12493. * @description 填充颜色。当填充模式为渐变填充时,该颜色为填充起始颜色。
  12494. */
  12495. this.fillForeColor = new ServerColor(255, 0, 0);
  12496. /**
  12497. * @member {FillGradientMode} ServerStyle.prototype.fillGradientMode
  12498. * @description 渐变填充风格的渐变类型。
  12499. */
  12500. this.fillGradientMode = null;
  12501. /**
  12502. * @member {number} ServerStyle.prototype.fillGradientAngle -
  12503. * @description 渐变填充的旋转角度。单位为度,精确到 0.1 度,逆时针方向为正方向。
  12504. */
  12505. this.fillGradientAngle = 0;
  12506. /**
  12507. * @member {number} ServerStyle.prototype.fillGradientOffsetRatioX
  12508. * @description 渐变填充中心点相对于填充区域范围中心点的水平偏移百分比。它们的关系如下:设填充区域范围中心点的坐标为(x0, y0),
  12509. * 填充中心点的坐标为(x, y),填充区域范围的宽度为 a,水平偏移百分比为 dx,则 x=x0 + a*dx/100。
  12510. */
  12511. this.fillGradientOffsetRatioX = 0;
  12512. /**
  12513. * @member {number} ServerStyle.prototype.fillGradientOffsetRatioY
  12514. * @description 填充中心点相对于填充区域范围中心点的垂直偏移百分比。它们的关系如下:<br>
  12515. * 设填充区域范围中心点的坐标为(x0, y0),填充中心点的坐标为(x, y),填充区域范围的高度为 b,垂直偏移百分比为 dy,则 y=y0 + b*dx/100。
  12516. */
  12517. this.fillGradientOffsetRatioY = 0;
  12518. /**
  12519. * @member {number} [ServerStyle.prototype.fillOpaqueRate=100]
  12520. * @description 填充不透明度。合法值为 0 - 100 的数值。其中为 0 表示完全透明;
  12521. * 100 表示完全不透明。赋值小于 0 时按照 0 处理,大于 100 时按照 100 处理。
  12522. */
  12523. this.fillOpaqueRate = 100;
  12524. /**
  12525. * @member {number} ServerStyle.prototype.fillSymbolID
  12526. * @description 填充符号的编码。此编码用于唯一标识各普通填充风格的填充符号。
  12527. * 关于填充符号的样式与对应的 ID 号请在 SuperMap 桌面软件中查找。
  12528. */
  12529. this.fillSymbolID = 0;
  12530. /**
  12531. * @member {ServerColor} ServerStyle.prototype.lineColor
  12532. * @description 矢量要素的边线颜色。如果等级符号是点符号,点符号的颜色由 lineColor 控制。
  12533. */
  12534. this.lineColor = new ServerColor(0, 0, 0);
  12535. /**
  12536. * @member {number} [ServerStyle.prototype.lineSymbolID=0]
  12537. * @description 线状符号的编码。此编码用于唯一标识各普通填充风格的填充符号。
  12538. * 关于线状符号的样式与对应的 ID 号请在 SuperMap 桌面软件中查找。
  12539. */
  12540. this.lineSymbolID = 0;
  12541. /**
  12542. * @member {number} [ServerStyle.prototype.lineWidth=1.0]
  12543. * @description 边线的宽度。单位为毫米,精度到 0.1。
  12544. */
  12545. this.lineWidth = 1;
  12546. /**
  12547. * @member {number} [ServerStyle.prototype.markerAngle=0]
  12548. * @description 点状符号的旋转角度。以度为单位,精确到 0.1 度,逆时针方向为正方向。
  12549. */
  12550. this.markerAngle = 0;
  12551. /**
  12552. * @member {number} [ServerStyle.prototype.markerSize=1.0]
  12553. * @description 点状符号的大小。单位为毫米,精度为 0.1。当该属性设置为0时,采用符号默认大小 1.0 显示。
  12554. * 当该属性设置为非法值时,交由服务器默认处理。
  12555. */
  12556. this.markerSize = 1;
  12557. /**
  12558. * @member {number} [ServerStyle.prototype.markerSymbolID=-1]
  12559. * @description 点状符号的编码。此编码用于唯一标识各点状符号。
  12560. * 关于线状符号的样式与对应的 ID 号请在 SuperMap 桌面软件中查找。
  12561. */
  12562. this.markerSymbolID = -1;
  12563. if (options) {
  12564. Util_Util.extend(this, options);
  12565. }
  12566. this.CLASS_NAME = "SuperMap.ServerStyle";
  12567. }
  12568. /**
  12569. * @function ServerStyle.prototype.destroy
  12570. * @description 释放资源,将引用资源的属性置空。
  12571. */
  12572. destroy() {
  12573. var me = this;
  12574. if (me.fillBackColor) {
  12575. me.fillBackColor.destroy();
  12576. me.fillBackColor = null;
  12577. }
  12578. me.fillBackOpaque = null;
  12579. if (me.fillForeColor) {
  12580. me.fillForeColor.destroy();
  12581. me.fillForeColor = null;
  12582. }
  12583. me.fillGradientMode = null;
  12584. me.fillGradientAngle = null;
  12585. me.fillGradientOffsetRatioX = null;
  12586. me.fillGradientOffsetRatioY = null;
  12587. me.fillOpaqueRate = null;
  12588. me.fillSymbolID = null;
  12589. if (me.lineColor) {
  12590. me.lineColor.destroy();
  12591. me.lineColor = null;
  12592. }
  12593. me.lineSymbolID = null;
  12594. me.lineWidth = null;
  12595. me.markerAngle = null;
  12596. me.markerSize = null;
  12597. me.markerSymbolID = null;
  12598. }
  12599. /**
  12600. * @function ServerStyle.prototype.toServerJSONObject
  12601. * @description 转换成对应的 JSON 格式对象。
  12602. * @returns {Object} 对应的 JSON 格式对象.
  12603. */
  12604. toServerJSONObject() {
  12605. var styleObj = {};
  12606. styleObj = Util_Util.copyAttributes(styleObj, this);
  12607. //暂时先忽略serverColor往Json的转换
  12608. return styleObj;
  12609. }
  12610. /**
  12611. * @function ServerStyle.fromJson
  12612. * @description 将JSON对象转换为 ServerStyle 对象。
  12613. * @param {Object} jsonObject - 要转换的 JSON 对象。
  12614. * @returns {ServerStyle} 转化后的 ServerStyle 对象。
  12615. */
  12616. static fromJson(jsonObject) {
  12617. if (!jsonObject) {
  12618. return;
  12619. }
  12620. return new ServerStyle({
  12621. fillBackColor: ServerColor.fromJson(jsonObject.fillBackColor),
  12622. fillBackOpaque: jsonObject.fillBackOpaque,
  12623. fillForeColor: ServerColor.fromJson(jsonObject.fillForeColor),
  12624. fillGradientMode: jsonObject.fillGradientMode,
  12625. fillGradientAngle: jsonObject.fillGradientAngle,
  12626. fillGradientOffsetRatioX: jsonObject.fillGradientOffsetRatioX,
  12627. fillGradientOffsetRatioY: jsonObject.fillGradientOffsetRatioY,
  12628. fillOpaqueRate: jsonObject.fillOpaqueRate,
  12629. fillSymbolID: jsonObject.fillSymbolID,
  12630. lineColor: ServerColor.fromJson(jsonObject.lineColor),
  12631. lineSymbolID: jsonObject.lineSymbolID,
  12632. lineWidth: jsonObject.lineWidth,
  12633. markerAngle: jsonObject.markerAngle,
  12634. markerSize: jsonObject.markerSize,
  12635. markerSymbolID: jsonObject.markerSymbolID
  12636. });
  12637. }
  12638. }
  12639. ;// CONCATENATED MODULE: ./src/common/iServer/PointWithMeasure.js
  12640. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  12641. * This program are made available under the terms of the Apache License, Version 2.0
  12642. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12643. /**
  12644. * @class PointWithMeasure
  12645. * @deprecatedclass SuperMap.PointWithMeasure
  12646. * @category iServer SpatialAnalyst RouteLocator
  12647. * @classdesc 路由点类。路由点是指具有线性度量值 (Measure) 的二维地理坐标点。
  12648. * @param {Object} options - 参数。
  12649. * @param {number} options.measure - 度量值,即路由对象属性值 M。
  12650. * @param {number} options.x - 地理坐标系下的 X 坐标值。
  12651. * @param {number} options.y - 地理坐标系下的 Y 坐标值。
  12652. * @extends {GeometryPoint}
  12653. * @usage
  12654. */
  12655. class PointWithMeasure extends Point {
  12656. constructor(options) {
  12657. super(options);
  12658. /**
  12659. * @member {number} PointWithMeasure.prototype.measure
  12660. * @description 度量值,即路由对象属性值 M。
  12661. */
  12662. this.measure = null;
  12663. if (options) {
  12664. Util_Util.extend(this, options);
  12665. }
  12666. this.CLASS_NAME = "SuperMap.PointWithMeasure";
  12667. }
  12668. /**
  12669. * @function PointWithMeasure.prototype.equals
  12670. * @description 判断两个路由点对象是否相等。如果两个路由点对象具有相同的坐标以及度量值,则认为是相等的。
  12671. * @param {PointWithMeasure} geom - 需要判断的路由点对象。
  12672. * @returns {boolean} 两个路由点对象是否相等(true 为相等,false 为不等)。
  12673. */
  12674. equals(geom) {
  12675. var equals = false;
  12676. if (geom != null) {
  12677. var isValueEquals = this.x === geom.x && this.y === geom.y && this.measure === geom.measure;
  12678. var isNaNValue = isNaN(this.x) && isNaN(this.y) && isNaN(this.measure);
  12679. var isNaNGeometry = isNaN(geom.x) && isNaN(geom.y) && isNaN(geom.measure);
  12680. equals = ( isValueEquals || ( isNaNValue && isNaNGeometry ));
  12681. }
  12682. return equals;
  12683. }
  12684. /**
  12685. * @function PointWithMeasure.prototype.toJson
  12686. * @description 转换为 JSON 对象。
  12687. * */
  12688. toJson() {
  12689. var result = "{";
  12690. if (this.measure != null && this.measure != undefined) {
  12691. result += "\"measure\":" + this.measure + ",";
  12692. }
  12693. result += "\"x\":" + this.x + ",";
  12694. result += "\"y\":" + this.y;
  12695. result += "}";
  12696. return result;
  12697. }
  12698. /**
  12699. * @function PointWithMeasure.prototype.destroy
  12700. * @description 释放资源,将引用资源的属性置空。
  12701. */
  12702. destroy() {
  12703. var me = this;
  12704. me.measure = null;
  12705. me.x = null;
  12706. me.y = null;
  12707. }
  12708. /**
  12709. * @function PointWithMeasure.fromJson
  12710. * @description 将 JSON 对象转换为{@link PointWithMeasure} 对象。
  12711. * @param {Object} jsonObject - JSON 对象表示的路由点。
  12712. * @returns {PointWithMeasure} 转化后的 PointWithMeasure 对象。
  12713. */
  12714. static fromJson(jsonObject) {
  12715. if (!jsonObject) {
  12716. return;
  12717. }
  12718. return new PointWithMeasure({
  12719. x: jsonObject.x,
  12720. y: jsonObject.y,
  12721. measure: jsonObject.measure
  12722. });
  12723. }
  12724. }
  12725. ;// CONCATENATED MODULE: ./src/common/iServer/Route.js
  12726. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  12727. * This program are made available under the terms of the Apache License, Version 2.0
  12728. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12729. /**
  12730. * @class Route
  12731. * @deprecatedclass SuperMap.Route
  12732. * @category iServer SpatialAnalyst RouteCalculateMeasure
  12733. * @classdesc 路由对象类。路由对象为一系列有序的带有属性值 M 的 x,y 坐标对,其中 M 值为该结点的距离属性(到已知点的距离)。
  12734. * @param {Array.<Geometry>} points - 形成路由对象的线数组。
  12735. * @param {Object} options - 参数。
  12736. * @param {number} options.id - 路由对象在数据库中的 ID。
  12737. * @param {number} options.length - 路由对象的长度。单位与数据集的单位相同。
  12738. * @param {number} [options.maxM] - 最大线性度量值,即所有结点到起始点的量算距离中最大值。
  12739. * @param {number} [options.minM] - 最小线性度量值,即所有结点到起始点的量算距离中最小值。
  12740. * @param {string} [options.type] - 数据类型,如:"LINEM"。
  12741. * @extends GeometryCollection
  12742. * @usage
  12743. */
  12744. class Route extends Collection {
  12745. constructor(points, options) {
  12746. super(points, options);
  12747. /**
  12748. * @member {number} Route.prototype.id
  12749. * @description 路由对象在数据库中的 ID。
  12750. */
  12751. this.id = null;
  12752. /**
  12753. * @member {number} Route.prototype.center
  12754. * @description 路由对象的中心点。
  12755. */
  12756. this.center = null;
  12757. /**
  12758. * @member {string} Route.prototype.style
  12759. * @description 路由对象的样式。
  12760. */
  12761. this.style = null;
  12762. /**
  12763. * @member {number} Route.prototype.length
  12764. * @description 路由对象的长度。单位与数据集的单位相同。
  12765. */
  12766. this.length = null;
  12767. /**
  12768. * @member {number} Route.prototype.maxM
  12769. * @description 最大线性度量值,即所有结点到起始点的量算距离中最大值。
  12770. */
  12771. this.maxM = null;
  12772. /**
  12773. * @member {number} Route.prototype.minM
  12774. * @description 最小线性度量值,即所有结点到起始点的量算距离中最小值。
  12775. */
  12776. this.minM = null;
  12777. /**
  12778. * @member {Array.<number>} Route.prototype.parts
  12779. * @description 服务端几何对象中各个子对象所包含的节点个数。
  12780. */
  12781. this.parts = null;
  12782. /**
  12783. * @member {Array.<Object>} Route.prototype.points
  12784. * @description 路由对象的所有路由点。
  12785. * @example
  12786. * (start code)
  12787. * [
  12788. * {
  12789. * "measure": 0,
  12790. * "y": -4377.027184298267,
  12791. * "x": 4020.0045221720466
  12792. * },
  12793. * {
  12794. * "measure": 37.33288381391519,
  12795. * "y": -4381.569363260499,
  12796. * "x": 4057.0600591960642
  12797. * }
  12798. * ]
  12799. * (end)
  12800. */
  12801. this.points = null;
  12802. /**
  12803. * @member {string} Route.prototype.type
  12804. * @description 服务端几何对象类型。
  12805. */
  12806. this.type = null;
  12807. /**
  12808. * @member {Array.<string>} [Route.prototype.componentTypes=LineString]
  12809. * @description components 存储的几何对象所支持的几何类型数组。
  12810. */
  12811. this.componentTypes = ["SuperMap.Geometry.LinearRing", "SuperMap.Geometry.LineString"];
  12812. if (options) {
  12813. Util_Util.extend(this, options);
  12814. }
  12815. this.CLASS_NAME = "SuperMap.Route";
  12816. this.geometryType = "LINEM";
  12817. }
  12818. /**
  12819. *
  12820. * @function Route.prototype.toJson
  12821. * @description 转换为 JSON 对象。
  12822. * @returns {Object} JSON 对象。
  12823. */
  12824. toJson() {
  12825. var result = "{";
  12826. if (this.id != null && this.id != undefined) {
  12827. result += "\"id\":" + this.id + ",";
  12828. }
  12829. if (this.center != null && this.center != undefined) {
  12830. result += "\"center\":" + this.center + ",";
  12831. }
  12832. if (this.style != null && this.style != undefined) {
  12833. result += "\"style\":" + this.style + ",";
  12834. }
  12835. if (this.length != null && this.length != undefined) {
  12836. result += "\"length\":" + this.length + ",";
  12837. }
  12838. if (this.maxM != null && this.maxM != undefined) {
  12839. result += "\"maxM\":" + this.maxM + ",";
  12840. }
  12841. if (this.minM != null && this.minM != undefined) {
  12842. result += "\"minM\":" + this.minM + ",";
  12843. }
  12844. if (this.type != null && this.type != undefined) {
  12845. result += "\"type\":\"" + this.type + "\",";
  12846. }
  12847. if (this.parts != null && this.parts != undefined) {
  12848. result += "\"parts\":[" + this.parts[0];
  12849. for (var i = 1; i < this.parts.length; i++) {
  12850. result += "," + this.parts[i];
  12851. }
  12852. result += "],";
  12853. }
  12854. if (this.components != null && this.components.length > 0) {
  12855. result += "\"points\":[";
  12856. for (var j = 0, len = this.components.length; j < len; j++) {
  12857. for (var k = 0, len2 = this.components[j].components.length; k < len2; k++) {
  12858. result += this.components[j].components[k].toJson() + ",";
  12859. }
  12860. }
  12861. result = result.replace(/,$/g, '');
  12862. result += "]";
  12863. }
  12864. result = result.replace(/,$/g, '');
  12865. result += "}";
  12866. return result;
  12867. }
  12868. /**
  12869. * @function Route.prototype.destroy
  12870. * @override
  12871. */
  12872. destroy() {
  12873. var me = this;
  12874. me.id = null;
  12875. me.center = null;
  12876. me.style = null;
  12877. me.length = null;
  12878. me.maxM = null;
  12879. me.minM = null;
  12880. me.type = null;
  12881. me.parts = null;
  12882. me.components.length = 0;
  12883. me.components = null;
  12884. me.componentTypes = null;
  12885. }
  12886. /**
  12887. * @function Route.fromJson
  12888. * @description 将 JSON 对象转换为 Route 对象。
  12889. * @param {Object} [jsonObject] - JSON 对象表示的路由对象。
  12890. * @returns {Route} 转化后的 Route 对象。
  12891. */
  12892. static fromJson(jsonObject) {
  12893. if (!jsonObject) {
  12894. return;
  12895. }
  12896. var geoParts = jsonObject.parts || [],
  12897. geoPoints = jsonObject.points || [],
  12898. len = geoParts.length,
  12899. lineList = [];
  12900. if (len > 0) {
  12901. for (var i = 0, pointIndex = 0, pointList = []; i < len; i++) {
  12902. for (var j = 0; j < geoParts[i]; j++) {
  12903. pointList.push(PointWithMeasure.fromJson(geoPoints[pointIndex + j]));
  12904. }
  12905. pointIndex += geoParts[i];
  12906. //判断线是否闭合,如果闭合,则返回LinearRing,否则返回LineString
  12907. if (pointList[0].equals(pointList[geoParts[i] - 1])) {
  12908. lineList.push(new LinearRing_LinearRing(pointList));
  12909. } else {
  12910. lineList.push(new LineString(pointList));
  12911. }
  12912. pointList = [];
  12913. }
  12914. } else {
  12915. return null;
  12916. }
  12917. return new Route(lineList, {
  12918. id: jsonObject.id,
  12919. center: jsonObject.center,
  12920. style: jsonObject.style,
  12921. length: jsonObject.length,
  12922. maxM: jsonObject.maxM,
  12923. minM: jsonObject.minM,
  12924. type: jsonObject.type,
  12925. parts: jsonObject.parts
  12926. });
  12927. }
  12928. }
  12929. ;// CONCATENATED MODULE: ./src/common/REST.js
  12930. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  12931. * This program are made available under the terms of the Apache License, Version 2.0
  12932. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12933. /**
  12934. * @enum DataFormat
  12935. * @description 服务请求返回结果数据类型
  12936. * @category BaseTypes Constant
  12937. * @type {string}
  12938. * @usage
  12939. * ```
  12940. * // 浏览器
  12941. * <script type="text/javascript" src="{cdn}"></script>
  12942. * <script>
  12943. * const result = {namespace}.DataFormat.GEOJSON;
  12944. *
  12945. * </script>
  12946. * // ES6 Import
  12947. * import { DataFormat } from '{npm}';
  12948. *
  12949. * const result = DataFormat.GEOJSON;
  12950. * ```
  12951. */
  12952. var DataFormat = {
  12953. /** GEOJSON */
  12954. GEOJSON: "GEOJSON",
  12955. /** ISERVER */
  12956. ISERVER: "ISERVER",
  12957. /** FGB */
  12958. FGB: "FGB"
  12959. };
  12960. /**
  12961. * @enum ServerType
  12962. * @description 服务器类型
  12963. * @category BaseTypes Constant
  12964. * @type {string}
  12965. * @usage
  12966. * ```
  12967. * // 浏览器
  12968. * <script type="text/javascript" src="{cdn}"></script>
  12969. * <script>
  12970. * const result = {namespace}.ServerType.ISERVER;
  12971. *
  12972. * </script>
  12973. * // ES6 Import
  12974. * import { ServerType } from '{npm}';
  12975. *
  12976. * const result = ServerType.ISERVER;
  12977. * ```
  12978. */
  12979. var ServerType = {
  12980. /** ISERVER */
  12981. ISERVER: "ISERVER",
  12982. /** IPORTAL */
  12983. IPORTAL: "IPORTAL",
  12984. /** ONLINE */
  12985. ONLINE: "ONLINE"
  12986. };
  12987. /**
  12988. * @enum GeometryType
  12989. * @description 几何对象枚举,定义了一系列几何对象类型。
  12990. * @category BaseTypes Constant
  12991. * @type {string}
  12992. * @usage
  12993. * ```
  12994. * // 浏览器
  12995. * <script type="text/javascript" src="{cdn}"></script>
  12996. * <script>
  12997. * const result = {namespace}.GeometryType.LINE;
  12998. *
  12999. * </script>
  13000. * // ES6 Import
  13001. * import { GeometryType } from '{npm}';
  13002. *
  13003. * const result = GeometryType.LINE;
  13004. * ```
  13005. */
  13006. var REST_GeometryType = {
  13007. /** 线几何对象类型。 */
  13008. LINE: "LINE",
  13009. /** 路由对象。 */
  13010. LINEM: "LINEM",
  13011. /** 点几何对象类型。 */
  13012. POINT: "POINT",
  13013. /** 面几何对象类型。 */
  13014. REGION: "REGION",
  13015. /** EPS点几何对象。 */
  13016. POINTEPS: "POINTEPS",
  13017. /** EPS线几何对象。 */
  13018. LINEEPS: "LINEEPS",
  13019. /** EPS面几何对象。 */
  13020. REGIONEPS: "REGIONEPS",
  13021. /** 椭圆。 */
  13022. ELLIPSE: "ELLIPSE",
  13023. /** 圆。 */
  13024. CIRCLE: "CIRCLE",
  13025. /** 文本几何对象类型。 */
  13026. TEXT: "TEXT",
  13027. /** 矩形。 */
  13028. RECTANGLE: "RECTANGLE",
  13029. /** 未定义。 */
  13030. UNKNOWN: "UNKNOWN",
  13031. /** 复合几何对象类型。 */
  13032. GEOCOMPOUND:"GEOCOMPOUND"
  13033. };
  13034. /**
  13035. * @enum QueryOption
  13036. * @description 查询结果类型枚举,描述查询结果返回类型,包括只返回属性、只返回几何实体以及返回属性和几何实体。
  13037. * @category BaseTypes Constant
  13038. * @type {string}
  13039. * @usage
  13040. * ```
  13041. * // 浏览器
  13042. * <script type="text/javascript" src="{cdn}"></script>
  13043. * <script>
  13044. * const result = {namespace}.QueryOption.ATTRIBUTE;
  13045. *
  13046. * </script>
  13047. * // ES6 Import
  13048. * import { QueryOption } from '{npm}';
  13049. *
  13050. * const result = QueryOption.ATTRIBUTE;
  13051. * ```
  13052. */
  13053. var QueryOption = {
  13054. /** 属性。 */
  13055. ATTRIBUTE: "ATTRIBUTE",
  13056. /** 属性和几何对象。 */
  13057. ATTRIBUTEANDGEOMETRY: "ATTRIBUTEANDGEOMETRY",
  13058. /** 几何对象。 */
  13059. GEOMETRY: "GEOMETRY"
  13060. };
  13061. /**
  13062. * @enum JoinType
  13063. * @description 关联查询时的关联类型常量。
  13064. * 该类定义了两个表之间的连接类型常量,决定了对两个表之间进行连接查询时,查询结果中得到的记录的情况。
  13065. * @category BaseTypes Constant
  13066. * @type {string}
  13067. * @usage
  13068. * ```
  13069. * // 浏览器
  13070. * <script type="text/javascript" src="{cdn}"></script>
  13071. * <script>
  13072. * const result = {namespace}.JoinType.INNERJOIN;
  13073. *
  13074. * </script>
  13075. * // ES6 Import
  13076. * import { JoinType } from '{npm}';
  13077. *
  13078. * const result = JoinType.INNERJOIN;
  13079. * ```
  13080. */
  13081. var JoinType = {
  13082. /** 内连接。 */
  13083. INNERJOIN: "INNERJOIN",
  13084. /** 左连接。 */
  13085. LEFTJOIN: "LEFTJOIN"
  13086. };
  13087. /**
  13088. * @enum SpatialQueryMode
  13089. * @description 空间查询模式枚举。该类定义了空间查询操作模式常量。
  13090. * @category BaseTypes Constant
  13091. * @type {string}
  13092. * @usage
  13093. * ```
  13094. * // 浏览器
  13095. * <script type="text/javascript" src="{cdn}"></script>
  13096. * <script>
  13097. * const result = {namespace}.SpatialQueryMode.CONTAIN;
  13098. *
  13099. * </script>
  13100. * // ES6 Import
  13101. * import { SpatialQueryMode } from '{npm}';
  13102. *
  13103. * const result = SpatialQueryMode.CONTAIN;
  13104. * ```
  13105. */
  13106. var SpatialQueryMode = {
  13107. /** 包含空间查询模式。 */
  13108. CONTAIN: "CONTAIN",
  13109. /** 交叉空间查询模式。 */
  13110. CROSS: "CROSS",
  13111. /** 分离空间查询模式。 */
  13112. DISJOINT: "DISJOINT",
  13113. /** 重合空间查询模式。 */
  13114. IDENTITY: "IDENTITY",
  13115. /** 相交空间查询模式。 */
  13116. INTERSECT: "INTERSECT",
  13117. /** 无空间查询。 */
  13118. NONE: "NONE",
  13119. /** 叠加空间查询模式。 */
  13120. OVERLAP: "OVERLAP",
  13121. /** 邻接空间查询模式。 */
  13122. TOUCH: "TOUCH",
  13123. /** 被包含空间查询模式。 */
  13124. WITHIN: "WITHIN"
  13125. };
  13126. /**
  13127. * @enum SpatialRelationType
  13128. * @description 数据集对象间的空间关系枚举。
  13129. * 该类定义了数据集对象间的空间关系类型常量。
  13130. * @category BaseTypes Constant
  13131. * @type {string}
  13132. * @usage
  13133. * ```
  13134. * // 浏览器
  13135. * <script type="text/javascript" src="{cdn}"></script>
  13136. * <script>
  13137. * const result = {namespace}.SpatialRelationType.CONTAIN;
  13138. *
  13139. * </script>
  13140. * // ES6 Import
  13141. * import { SpatialRelationType } from '{npm}';
  13142. *
  13143. * const result = {namespace}.SpatialRelationType.CONTAIN;
  13144. * ```
  13145. */
  13146. var SpatialRelationType = {
  13147. /** 包含关系。 */
  13148. CONTAIN: "CONTAIN",
  13149. /** 相交关系。 */
  13150. INTERSECT: "INTERSECT",
  13151. /** 被包含关系。 */
  13152. WITHIN: "WITHIN"
  13153. };
  13154. /**
  13155. * @enum MeasureMode
  13156. * @type {string}
  13157. * @description 量算模式枚举。
  13158. * @category BaseTypes Constant
  13159. * 该类定义了两种测量模式:距离测量和面积测量。
  13160. * @usage
  13161. * ```
  13162. * // 浏览器
  13163. * <script type="text/javascript" src="{cdn}"></script>
  13164. * <script>
  13165. * const result = {namespace}.MeasureMode.DISTANCE;
  13166. *
  13167. * </script>
  13168. * // ES6 Import
  13169. * import { MeasureMode } from '{npm}';
  13170. *
  13171. * const result = MeasureMode.DISTANCE;
  13172. * ```
  13173. */
  13174. var MeasureMode = {
  13175. /** 距离测量。 */
  13176. DISTANCE: "DISTANCE",
  13177. /** 面积测量。 */
  13178. AREA: "AREA"
  13179. };
  13180. /**
  13181. * @enum Unit
  13182. * @description 距离单位枚举。
  13183. * 该类定义了一系列距离单位类型。
  13184. * @category BaseTypes Constant
  13185. * @type {string}
  13186. * @usage
  13187. * ```
  13188. * // 浏览器
  13189. * <script type="text/javascript" src="{cdn}"></script>
  13190. * <script>
  13191. * const result = {namespace}.Unit.METER;
  13192. *
  13193. * </script>
  13194. * // ES6 Import
  13195. * import { Unit } from '{npm}';
  13196. *
  13197. * const result = Unit.METER;
  13198. * ```
  13199. */
  13200. var Unit = {
  13201. /** 米。 */
  13202. METER: "METER",
  13203. /** 千米。 */
  13204. KILOMETER: "KILOMETER",
  13205. /** 英里。 */
  13206. MILE: "MILE",
  13207. /** 码。 */
  13208. YARD: "YARD",
  13209. /** 度。 */
  13210. DEGREE: "DEGREE",
  13211. /** 毫米。 */
  13212. MILLIMETER: "MILLIMETER",
  13213. /** 厘米。 */
  13214. CENTIMETER: "CENTIMETER",
  13215. /** 英寸。 */
  13216. INCH: "INCH",
  13217. /** 分米。 */
  13218. DECIMETER: "DECIMETER",
  13219. /** 英尺。 */
  13220. FOOT: "FOOT",
  13221. /** 秒。 */
  13222. SECOND: "SECOND",
  13223. /** 分。 */
  13224. MINUTE: "MINUTE",
  13225. /** 弧度。 */
  13226. RADIAN: "RADIAN"
  13227. };
  13228. /**
  13229. * @enum BufferRadiusUnit
  13230. * @description 缓冲区距离单位枚举。该类定义了一系列缓冲距离单位类型。
  13231. * @category BaseTypes Constant
  13232. * @type {string}
  13233. * @usage
  13234. * ```
  13235. * // 浏览器
  13236. * <script type="text/javascript" src="{cdn}"></script>
  13237. * <script>
  13238. * const result = {namespace}.BufferRadiusUnit.CENTIMETER;
  13239. *
  13240. * </script>
  13241. * // ES6 Import
  13242. * import { BufferRadiusUnit } from '{npm}';
  13243. *
  13244. * const result = BufferRadiusUnit.CENTIMETER;
  13245. * ```
  13246. */
  13247. var BufferRadiusUnit = {
  13248. /** 厘米。 */
  13249. CENTIMETER: "CENTIMETER",
  13250. /** 分米。 */
  13251. DECIMETER: "DECIMETER",
  13252. /** 英尺。 */
  13253. FOOT: "FOOT",
  13254. /** 英寸。 */
  13255. INCH: "INCH",
  13256. /** 千米。 */
  13257. KILOMETER: "KILOMETER",
  13258. /** 米。 */
  13259. METER: "METER",
  13260. /** 英里。 */
  13261. MILE: "MILE",
  13262. /** 毫米。 */
  13263. MILLIMETER: "MILLIMETER",
  13264. /** 码。 */
  13265. YARD: "YARD"
  13266. }
  13267. /**
  13268. * @enum EngineType
  13269. * @description 数据源引擎类型枚举。
  13270. * @category BaseTypes Constant
  13271. * @type {string}
  13272. * @usage
  13273. * ```
  13274. * // 浏览器
  13275. * <script type="text/javascript" src="{cdn}"></script>
  13276. * <script>
  13277. * const result = {namespace}.EngineType.IMAGEPLUGINS;
  13278. *
  13279. * </script>
  13280. * // ES6 Import
  13281. * import { EngineType } from '{npm}';
  13282. *
  13283. * const result = EngineType.IMAGEPLUGINS;
  13284. * ```
  13285. */
  13286. var EngineType = {
  13287. /** 影像只读引擎类型,文件引擎,针对通用影像格式如 BMP,JPG,TIFF 以及超图自定义影像格式 SIT 等。 */
  13288. IMAGEPLUGINS: "IMAGEPLUGINS",
  13289. /** OGC 引擎类型,针对于 Web 数据源,Web 引擎,目前支持的类型有 WMS,WFS,WCS。 */
  13290. OGC: "OGC",
  13291. /** Oracle 引擎类型,针对 Oracle 数据源,数据库引擎。 */
  13292. ORACLEPLUS: "ORACLEPLUS",
  13293. /** SDB 引擎类型,文件引擎,即 SDB 数据源。 */
  13294. SDBPLUS: "SDBPLUS",
  13295. /** SQL Server 引擎类型,针对 SQL Server 数据源,数据库引擎。 */
  13296. SQLPLUS: "SQLPLUS",
  13297. /** UDB 引擎类型,文件引擎。 */
  13298. UDB: "UDB"
  13299. };
  13300. /**
  13301. * @enum ThemeGraphTextFormat
  13302. * @description 统计专题图文本显示格式枚举。
  13303. * @category BaseTypes Constant
  13304. * @type {string}
  13305. * @usage
  13306. * ```
  13307. * // 浏览器
  13308. * <script type="text/javascript" src="{cdn}"></script>
  13309. * <script>
  13310. * const result = {namespace}.ThemeGraphTextFormat.CAPTION;
  13311. *
  13312. * </script>
  13313. * // ES6 Import
  13314. * import { ThemeGraphTextFormat } from '{npm}';
  13315. *
  13316. * const result = ThemeGraphTextFormat.CAPTION;
  13317. * ```
  13318. */
  13319. var ThemeGraphTextFormat = {
  13320. /** 标题。以各子项的标题来进行标注。 */
  13321. CAPTION: "CAPTION",
  13322. /** 标题 + 百分数。以各子项的标题和所占的百分比来进行标注。 */
  13323. CAPTION_PERCENT: "CAPTION_PERCENT",
  13324. /** 标题 + 实际数值。以各子项的标题和真实数值来进行标注。 */
  13325. CAPTION_VALUE: "CAPTION_VALUE",
  13326. /** 百分数。以各子项所占的百分比来进行标注。 */
  13327. PERCENT: "PERCENT",
  13328. /** 实际数值。以各子项的真实数值来进行标注。 */
  13329. VALUE: "VALUE"
  13330. };
  13331. /**
  13332. * @enum ThemeGraphType
  13333. * @description 统计专题图类型枚举。
  13334. * @category BaseTypes Constant
  13335. * @type {string}
  13336. * @usage
  13337. * ```
  13338. * // 浏览器
  13339. * <script type="text/javascript" src="{cdn}"></script>
  13340. * <script>
  13341. * const result = {namespace}.ThemeGraphType.AREA;
  13342. *
  13343. * </script>
  13344. * // ES6 Import
  13345. * import { ThemeGraphType } from '{npm}';
  13346. *
  13347. * const result = ThemeGraphType.AREA;
  13348. * ```
  13349. */
  13350. var ThemeGraphType = {
  13351. /** 面积图。 */
  13352. AREA: "AREA",
  13353. /** 柱状图。 */
  13354. BAR: "BAR",
  13355. /** 三维柱状图。 */
  13356. BAR3D: "BAR3D",
  13357. /** 折线图。 */
  13358. LINE: "LINE",
  13359. /** 饼图。 */
  13360. PIE: "PIE",
  13361. /** 三维饼图。 */
  13362. PIE3D: "PIE3D",
  13363. /** 点状图。 */
  13364. POINT: "POINT",
  13365. /** 环状图。 */
  13366. RING: "RING",
  13367. /** 玫瑰图。 */
  13368. ROSE: "ROSE",
  13369. /** 三维玫瑰图。 */
  13370. ROSE3D: "ROSE3D",
  13371. /** 堆叠柱状图。 */
  13372. STACK_BAR: "STACK_BAR",
  13373. /** 三维堆叠柱状图。 */
  13374. STACK_BAR3D: "STACK_BAR3D",
  13375. /** 阶梯图。 */
  13376. STEP: "STEP"
  13377. };
  13378. /**
  13379. * @enum GraphAxesTextDisplayMode
  13380. * @description 统计专题图坐标轴文本显示模式。
  13381. * @category BaseTypes Constant
  13382. * @type {string}
  13383. * @usage
  13384. * ```
  13385. * // 浏览器
  13386. * <script type="text/javascript" src="{cdn}"></script>
  13387. * <script>
  13388. * const result = {namespace}.GraphAxesTextDisplayMode.ALL;
  13389. *
  13390. * </script>
  13391. * // ES6 Import
  13392. * import { GraphAxesTextDisplayMode } from '{npm}';
  13393. *
  13394. * const result = GraphAxesTextDisplayMode.ALL;
  13395. * ```
  13396. */
  13397. var GraphAxesTextDisplayMode = {
  13398. /** 显示全部文本。 */
  13399. ALL: "ALL",
  13400. /** 不显示。 */
  13401. NONE: "NONE",
  13402. /** 显示Y轴的文本。 */
  13403. YAXES: "YAXES"
  13404. };
  13405. /**
  13406. * @enum GraduatedMode
  13407. * @description 专题图分级模式枚举。
  13408. * @category BaseTypes Constant
  13409. * @type {string}
  13410. * @usage
  13411. * ```
  13412. * // 浏览器
  13413. * <script type="text/javascript" src="{cdn}"></script>
  13414. * <script>
  13415. * const result = {namespace}.GraduatedMode.CONSTANT;
  13416. *
  13417. * </script>
  13418. * // ES6 Import
  13419. * import { GraduatedMode } from '{npm}';
  13420. *
  13421. * const result = GraduatedMode.CONSTANT;
  13422. * ```
  13423. */
  13424. var GraduatedMode = {
  13425. /** 常量分级模式。 */
  13426. CONSTANT: "CONSTANT",
  13427. /** 对数分级模式。 */
  13428. LOGARITHM: "LOGARITHM",
  13429. /** 平方根分级模式。 */
  13430. SQUAREROOT: "SQUAREROOT"
  13431. };
  13432. /**
  13433. * @enum RangeMode
  13434. * @description 范围分段专题图分段方式枚举。
  13435. * @category BaseTypes Constant
  13436. * @type {string}
  13437. * @usage
  13438. * ```
  13439. * // 浏览器
  13440. * <script type="text/javascript" src="{cdn}"></script>
  13441. * <script>
  13442. * const result = {namespace}.RangeMode.CUSTOMINTERVAL;
  13443. *
  13444. * </script>
  13445. * // ES6 Import
  13446. * import { RangeMode } from '{npm}';
  13447. *
  13448. * const result = RangeMode.CUSTOMINTERVAL;
  13449. * ```
  13450. */
  13451. var RangeMode = {
  13452. /** 自定义分段法。 */
  13453. CUSTOMINTERVAL: "CUSTOMINTERVAL",
  13454. /** 等距离分段法。 */
  13455. EQUALINTERVAL: "EQUALINTERVAL",
  13456. /** 对数分段法。 */
  13457. LOGARITHM: "LOGARITHM",
  13458. /** 等计数分段法。 */
  13459. QUANTILE: "QUANTILE",
  13460. /** 平方根分段法。 */
  13461. SQUAREROOT: "SQUAREROOT",
  13462. /** 标准差分段法。 */
  13463. STDDEVIATION: "STDDEVIATION"
  13464. };
  13465. /**
  13466. * @enum ThemeType
  13467. * @description 专题图类型枚举。
  13468. * @category BaseTypes Constant
  13469. * @type {string}
  13470. * @usage
  13471. * ```
  13472. * // 浏览器
  13473. * <script type="text/javascript" src="{cdn}"></script>
  13474. * <script>
  13475. * const result = {namespace}.ThemeType.DOTDENSITY;
  13476. *
  13477. * </script>
  13478. * // ES6 Import
  13479. * import { ThemeType } from '{npm}';
  13480. *
  13481. * const result = ThemeType.DOTDENSITY;
  13482. * ```
  13483. */
  13484. var ThemeType = {
  13485. /** 点密度专题图。 */
  13486. DOTDENSITY: "DOTDENSITY",
  13487. /** 等级符号专题图。 */
  13488. GRADUATEDSYMBOL: "GRADUATEDSYMBOL",
  13489. /** 统计专题图。 */
  13490. GRAPH: "GRAPH",
  13491. /** 标签专题图。 */
  13492. LABEL: "LABEL",
  13493. /** 分段专题图。 */
  13494. RANGE: "RANGE",
  13495. /** 単值专题图。 */
  13496. UNIQUE: "UNIQUE"
  13497. };
  13498. /**
  13499. * @enum ColorGradientType
  13500. * @description 渐变颜色枚举。
  13501. * @category BaseTypes Constant
  13502. * @type {string}
  13503. * @usage
  13504. * ```
  13505. * // 浏览器
  13506. * <script type="text/javascript" src="{cdn}"></script>
  13507. * <script>
  13508. * const result = {namespace}.ColorGradientType.BLACK_WHITE;
  13509. *
  13510. * </script>
  13511. * // ES6 Import
  13512. * import { ColorGradientType } from '{npm}';
  13513. *
  13514. * const result = ColorGradientType.BLACK_WHITE;
  13515. * ```
  13516. */
  13517. var ColorGradientType = {
  13518. /** 黑白渐变色。 */
  13519. BLACK_WHITE: "BLACKWHITE",
  13520. /** 蓝黑渐变色。 */
  13521. BLUE_BLACK: "BLUEBLACK",
  13522. /** 蓝红渐变色。 */
  13523. BLUE_RED: "BLUERED",
  13524. /** 蓝白渐变色。 */
  13525. BLUE_WHITE: "BLUEWHITE",
  13526. /** 青黑渐变色。 */
  13527. CYAN_BLACK: "CYANBLACK",
  13528. /** 青蓝渐变色。 */
  13529. CYAN_BLUE: "CYANBLUE",
  13530. /** 青绿渐变色。 */
  13531. CYAN_GREEN: "CYANGREEN",
  13532. /** 青白渐变色。 */
  13533. CYAN_WHITE: "CYANWHITE",
  13534. /** 绿黑渐变色。 */
  13535. GREEN_BLACK: "GREENBLACK",
  13536. /** 绿蓝渐变色。 */
  13537. GREEN_BLUE: "GREENBLUE",
  13538. /** 绿橙紫渐变色。 */
  13539. GREEN_ORANGE_VIOLET: "GREENORANGEVIOLET",
  13540. /** 绿红渐变色。 */
  13541. GREEN_RED: "GREENRED",
  13542. /** 蓝红渐变色。 */
  13543. GREEN_WHITE: "GREENWHITE",
  13544. /** 粉黑渐变色。 */
  13545. PINK_BLACK: "PINKBLACK",
  13546. /** 粉蓝渐变色。 */
  13547. PINK_BLUE: "PINKBLUE",
  13548. /** 粉红渐变色。 */
  13549. PINK_RED: "PINKRED",
  13550. /** 粉白渐变色。 */
  13551. PINK_WHITE: "PINKWHITE",
  13552. /** 彩虹色。 */
  13553. RAIN_BOW: "RAINBOW",
  13554. /** 红黑渐变色。 */
  13555. RED_BLACK: "REDBLACK",
  13556. /** 红白渐变色。 */
  13557. RED_WHITE: "REDWHITE",
  13558. /** 光谱渐变。 */
  13559. SPECTRUM: "SPECTRUM",
  13560. /** 地形渐变,用于三维显示效果较好。 */
  13561. TERRAIN: "TERRAIN",
  13562. /** 黄黑渐变色。 */
  13563. YELLOW_BLACK: "YELLOWBLACK",
  13564. /** 黄蓝渐变色。 */
  13565. YELLOW_BLUE: "YELLOWBLUE",
  13566. /** 黄绿渐变色。 */
  13567. YELLOW_GREEN: "YELLOWGREEN",
  13568. /** 黄红渐变色。 */
  13569. YELLOW_RED: "YELLOWRED",
  13570. /** 黄白渐变色。 */
  13571. YELLOW_WHITE: "YELLOWWHITE"
  13572. };
  13573. /**
  13574. * @enum TextAlignment
  13575. * @description 文本对齐枚举。
  13576. * @category BaseTypes Constant
  13577. * @type {string}
  13578. * @usage
  13579. * ```
  13580. * // 浏览器
  13581. * <script type="text/javascript" src="{cdn}"></script>
  13582. * <script>
  13583. * const result = {namespace}.TextAlignment.TOPLEFT;
  13584. *
  13585. * </script>
  13586. * // ES6 Import
  13587. * import { TextAlignment } from '{npm}';
  13588. *
  13589. * const result = TextAlignment.TOPLEFT;
  13590. * ```
  13591. */
  13592. var TextAlignment = {
  13593. /** 左上角对齐。 */
  13594. TOPLEFT: "TOPLEFT",
  13595. /** 顶部居中对齐。 */
  13596. TOPCENTER: "TOPCENTER",
  13597. /** 右上角对齐。 */
  13598. TOPRIGHT: "TOPRIGHT",
  13599. /** 基准线左对齐。 */
  13600. BASELINELEFT: "BASELINELEFT",
  13601. /** 基准线居中对齐。 */
  13602. BASELINECENTER: "BASELINECENTER",
  13603. /** 基准线右对齐。 */
  13604. BASELINERIGHT: "BASELINERIGHT",
  13605. /** 左下角对齐。 */
  13606. BOTTOMLEFT: "BOTTOMLEFT",
  13607. /** 底部居中对齐。 */
  13608. BOTTOMCENTER: "BOTTOMCENTER",
  13609. /** 右下角对齐。 */
  13610. BOTTOMRIGHT: "BOTTOMRIGHT",
  13611. /** 左中对齐。 */
  13612. MIDDLELEFT: "MIDDLELEFT",
  13613. /** 中心对齐。 */
  13614. MIDDLECENTER: "MIDDLECENTER",
  13615. /** 右中对齐。 */
  13616. MIDDLERIGHT: "MIDDLERIGHT"
  13617. };
  13618. /**
  13619. * @enum FillGradientMode
  13620. * @description 渐变填充风格的渐变类型枚举。
  13621. * @category BaseTypes Constant
  13622. * @type {string}
  13623. * @usage
  13624. * ```
  13625. * // 浏览器
  13626. * <script type="text/javascript" src="{cdn}"></script>
  13627. * <script>
  13628. * const result = {namespace}.FillGradientMode.NONE;
  13629. *
  13630. * </script>
  13631. * // ES6 Import
  13632. * import { FillGradientMode } from '{npm}';
  13633. *
  13634. * const result = FillGradientMode.NONE;
  13635. * ```
  13636. */
  13637. var FillGradientMode = {
  13638. /** 无渐变。 */
  13639. NONE: "NONE",
  13640. /** 线性渐变填充。 */
  13641. LINEAR: "LINEAR",
  13642. /** 辐射渐变填充。 */
  13643. RADIAL: "RADIAL",
  13644. /** 圆锥渐变填充。 */
  13645. CONICAL: "CONICAL",
  13646. /** 四角渐变填充。 */
  13647. SQUARE: "SQUARE"
  13648. };
  13649. /**
  13650. * @enum AlongLineDirection
  13651. * @description 标签沿线标注方向枚举。
  13652. * @category BaseTypes Constant
  13653. * @type {string}
  13654. * @usage
  13655. * ```
  13656. * // 浏览器
  13657. * <script type="text/javascript" src="{cdn}"></script>
  13658. * <script>
  13659. * const result = {namespace}.AlongLineDirection.NORMAL;
  13660. *
  13661. * </script>
  13662. * // ES6 Import
  13663. * import { AlongLineDirection } from '{npm}';
  13664. *
  13665. * const result = AlongLineDirection.NORMAL;
  13666. * ```
  13667. */
  13668. var AlongLineDirection = {
  13669. /** 沿线的法线方向放置标签。 */
  13670. NORMAL: "ALONG_LINE_NORMAL",
  13671. /** 从下到上,从左到右放置。 */
  13672. LB_TO_RT: "LEFT_BOTTOM_TO_RIGHT_TOP",
  13673. /** 从上到下,从左到右放置。 */
  13674. LT_TO_RB: "LEFT_TOP_TO_RIGHT_BOTTOM",
  13675. /** 从下到上,从右到左放置。 */
  13676. RB_TO_LT: "RIGHT_BOTTOM_TO_LEFT_TOP",
  13677. /** 从上到下,从右到左放置。 */
  13678. RT_TO_LB: "RIGHT_TOP_TO_LEFT_BOTTOM"
  13679. };
  13680. /**
  13681. * @enum LabelBackShape
  13682. * @description 标签专题图中标签背景的形状枚举。
  13683. * @category BaseTypes Constant
  13684. * @type {string}
  13685. * @usage
  13686. * ```
  13687. * // 浏览器
  13688. * <script type="text/javascript" src="{cdn}"></script>
  13689. * <script>
  13690. * const result = {namespace}.LabelBackShape.DIAMOND;
  13691. *
  13692. * </script>
  13693. * // ES6 Import
  13694. * import { LabelBackShape } from '{npm}';
  13695. *
  13696. * const result = LabelBackShape.DIAMOND;
  13697. * ```
  13698. */
  13699. var LabelBackShape = {
  13700. /** 菱形背景,即标签背景的形状为菱形。 */
  13701. DIAMOND: "DIAMOND",
  13702. /** 椭圆形背景,即标签背景的行状为椭圆形。 */
  13703. ELLIPSE: "ELLIPSE",
  13704. /** 符号背景,即标签背景的形状为设定的符号。 */
  13705. MARKER: "MARKER",
  13706. /** 空背景,即不使用任何形状作为标签的背景。 */
  13707. NONE: "NONE",
  13708. /** 矩形背景,即标签背景的形状为矩形。 */
  13709. RECT: "RECT",
  13710. /** 圆角矩形背景,即标签背景的形状为圆角矩形。 */
  13711. ROUNDRECT: "ROUNDRECT",
  13712. /** 三角形背景,即标签背景的形状为三角形。 */
  13713. TRIANGLE: "TRIANGLE"
  13714. };
  13715. /**
  13716. * @enum LabelOverLengthMode
  13717. * @description 标签专题图中超长标签的处理模式枚举。
  13718. * @category BaseTypes Constant
  13719. * @type {string}
  13720. * @usage
  13721. * ```
  13722. * // 浏览器
  13723. * <script type="text/javascript" src="{cdn}"></script>
  13724. * <script>
  13725. * const result = {namespace}.LabelOverLengthMode.NEWLINE;
  13726. *
  13727. * </script>
  13728. * // ES6 Import
  13729. * import { LabelOverLengthMode } from '{npm}';
  13730. *
  13731. * const result = LabelOverLengthMode.NEWLINE;
  13732. * ```
  13733. */
  13734. var LabelOverLengthMode = {
  13735. /** 换行显示。 */
  13736. NEWLINE: "NEWLINE",
  13737. /** 对超长标签不进行处理。 */
  13738. NONE: "NONE",
  13739. /** 省略超出部分。 */
  13740. OMIT: "OMIT"
  13741. };
  13742. /**
  13743. * @enum DirectionType
  13744. * @description 网络分析中方向枚举。
  13745. * 在行驶引导子项中使用。
  13746. * @category BaseTypes Constant
  13747. * @type {string}
  13748. * @usage
  13749. * ```
  13750. * // 浏览器
  13751. * <script type="text/javascript" src="{cdn}"></script>
  13752. * <script>
  13753. * const result = {namespace}.DirectionType.EAST;
  13754. *
  13755. * </script>
  13756. * // ES6 Import
  13757. * import { DirectionType } from '{npm}';
  13758. *
  13759. * const result = DirectionType.EAST;
  13760. * ```
  13761. */
  13762. var DirectionType = {
  13763. /** 东。 */
  13764. EAST: "EAST",
  13765. /** 无方向。 */
  13766. NONE: "NONE",
  13767. /** 北。 */
  13768. NORTH: "NORTH",
  13769. /** 南。 */
  13770. SOURTH: "SOURTH",
  13771. /** 西。 */
  13772. WEST: "WEST"
  13773. };
  13774. /**
  13775. * @enum SideType
  13776. * @description 行驶位置枚举。
  13777. * 表示在行驶在路的左边、右边或者路上的枚举,该类用在行驶导引子项类中。
  13778. * @category BaseTypes Constant
  13779. * @type {string}
  13780. * @usage
  13781. * ```
  13782. * // 浏览器
  13783. * <script type="text/javascript" src="{cdn}"></script>
  13784. * <script>
  13785. * const result = {namespace}.SideType.LEFT;
  13786. *
  13787. * </script>
  13788. * // ES6 Import
  13789. * import { SideType } from '{npm}';
  13790. *
  13791. * const result = SideType.LEFT;
  13792. * ```
  13793. */
  13794. var SideType = {
  13795. /** 路的左侧。 */
  13796. LEFT: "LEFT",
  13797. /** 在路上(即路的中间)。 */
  13798. MIDDLE: "MIDDLE",
  13799. /** 无效值。 */
  13800. NONE: "NONE",
  13801. /** 路的右侧。 */
  13802. RIGHT: "RIGHT"
  13803. };
  13804. /**
  13805. * @enum SupplyCenterType
  13806. * @description 资源供给中心类型枚举。
  13807. * 该枚举定义了网络分析中资源中心点的类型,主要用于资源分配和选址分区。
  13808. * 资源供给中心点的类型包括非中心,固定中心和可选中心。固定中心用于资源分配分析;固定中心和可选中心用于选址分析;非中心在两种网络分析时都不予考虑。
  13809. * @category BaseTypes Constant
  13810. * @type {string}
  13811. * @usage
  13812. * ```
  13813. * // 浏览器
  13814. * <script type="text/javascript" src="{cdn}"></script>
  13815. * <script>
  13816. * const result = {namespace}.SupplyCenterType.FIXEDCENTER;
  13817. *
  13818. * </script>
  13819. * // ES6 Import
  13820. * import { SupplyCenterType } from '{npm}';
  13821. *
  13822. * const result = SupplyCenterType.FIXEDCENTER;
  13823. * ```
  13824. */
  13825. var SupplyCenterType = {
  13826. /** 固定中心点。 */
  13827. FIXEDCENTER: "FIXEDCENTER",
  13828. /** 非中心点。 */
  13829. NULL: "NULL",
  13830. /** 可选中心点。 */
  13831. OPTIONALCENTER: "OPTIONALCENTER"
  13832. };
  13833. /**
  13834. * @enum TurnType
  13835. * @description 转弯方向枚举。
  13836. * 用在行驶引导子项类中,表示转弯的方向。
  13837. * @category BaseTypes Constant
  13838. * @type {string}
  13839. * @usage
  13840. * ```
  13841. * // 浏览器
  13842. * <script type="text/javascript" src="{cdn}"></script>
  13843. * <script>
  13844. * const result = {namespace}.TurnType.AHEAD;
  13845. *
  13846. * </script>
  13847. * // ES6 Import
  13848. * import { TurnType } from '{npm}';
  13849. *
  13850. * const result = TurnType.AHEAD;
  13851. * ```
  13852. */
  13853. var TurnType = {
  13854. /** 向前直行。 */
  13855. AHEAD: "AHEAD",
  13856. /** 掉头。 */
  13857. BACK: "BACK",
  13858. /** 终点,不拐弯。 */
  13859. END: "END",
  13860. /** 左转弯。 */
  13861. LEFT: "LEFT",
  13862. /** 无效值。 */
  13863. NONE: "NONE",
  13864. /** 右转弯。 */
  13865. RIGHT: "RIGHT"
  13866. };
  13867. /**
  13868. * @enum BufferEndType
  13869. * @description 缓冲区分析BufferEnd类型。
  13870. * @category BaseTypes Constant
  13871. * @type {string}
  13872. * @usage
  13873. * ```
  13874. * // 浏览器
  13875. * <script type="text/javascript" src="{cdn}"></script>
  13876. * <script>
  13877. * const result = {namespace}.BufferEndType.FLAT;
  13878. *
  13879. * </script>
  13880. * // ES6 Import
  13881. * import { BufferEndType } from '{npm}';
  13882. *
  13883. * const result = BufferEndType.FLAT;
  13884. * ```
  13885. */
  13886. var BufferEndType = {
  13887. /** 平头缓冲。 */
  13888. FLAT: "FLAT",
  13889. /** 圆头缓冲。 */
  13890. ROUND: "ROUND"
  13891. };
  13892. /**
  13893. * @enum OverlayOperationType
  13894. * @description 叠加分析类型枚举。
  13895. * @category BaseTypes Constant
  13896. * @type {string}
  13897. * @usage
  13898. * ```
  13899. * // 浏览器
  13900. * <script type="text/javascript" src="{cdn}"></script>
  13901. * <script>
  13902. * const result = {namespace}.OverlayOperationType.CLIP;
  13903. *
  13904. * </script>
  13905. * // ES6 Import
  13906. * import { OverlayOperationType } from '{npm}';
  13907. *
  13908. * const result = OverlayOperationType.CLIP;
  13909. * ```
  13910. */
  13911. var OverlayOperationType = {
  13912. /** 操作数据集(几何对象)裁剪被操作数据集(几何对象)。 */
  13913. CLIP: "CLIP",
  13914. /** 在被操作数据集(几何对象)上擦除掉与操作数据集(几何对象)相重合的部分。 */
  13915. ERASE: "ERASE",
  13916. /**对被操作数据集(几何对象)进行同一操作,即操作执行后,被操作数据集(几何对象)包含来自操作数据集(几何对象)的几何形状。 */
  13917. IDENTITY: "IDENTITY",
  13918. /** 对两个数据集(几何对象)求交,返回两个数据集(几何对象)的交集。 */
  13919. INTERSECT: "INTERSECT",
  13920. /** 对两个面数据集(几何对象)进行合并操作。 */
  13921. UNION: "UNION",
  13922. /** 对两个面数据集(几何对象)进行更新操作。 */
  13923. UPDATE: "UPDATE",
  13924. /** 对两个面数据集(几何对象)进行对称差操作。 */
  13925. XOR: "XOR"
  13926. };
  13927. /**
  13928. * @enum OutputType
  13929. * @description 分布式分析输出类型枚举。
  13930. * @category BaseTypes Constant
  13931. * @type {string}
  13932. * @usage
  13933. * ```
  13934. * // 浏览器
  13935. * <script type="text/javascript" src="{cdn}"></script>
  13936. * <script>
  13937. * const result = {namespace}.OutputType.INDEXEDHDFS;
  13938. *
  13939. * </script>
  13940. * // ES6 Import
  13941. * import { OutputType } from '{npm}';
  13942. *
  13943. * const result = OutputType.INDEXEDHDFS;
  13944. * ```
  13945. */
  13946. var OutputType = {
  13947. /** INDEXEDHDFS */
  13948. INDEXEDHDFS: "INDEXEDHDFS",
  13949. /** UDB */
  13950. UDB: "UDB",
  13951. /** MONGODB */
  13952. MONGODB: "MONGODB",
  13953. /** PG */
  13954. PG: "PG"
  13955. };
  13956. /**
  13957. * @enum SmoothMethod
  13958. * @description 光滑方法枚举。
  13959. * 用于从Grid 或DEM数据生成等值线或等值面时对等值线或者等值面的边界线进行平滑处理的方法。
  13960. * @category BaseTypes Constant
  13961. * @type {string}
  13962. * @usage
  13963. * ```
  13964. * // 浏览器
  13965. * <script type="text/javascript" src="{cdn}"></script>
  13966. * <script>
  13967. * const result = {namespace}.SmoothMethod.BSPLINE;
  13968. *
  13969. * </script>
  13970. * // ES6 Import
  13971. * import { SmoothMethod } from '{npm}';
  13972. *
  13973. * const result = SmoothMethod.BSPLINE;
  13974. * ```
  13975. */
  13976. var SmoothMethod = {
  13977. /** B 样条法。 */
  13978. BSPLINE: "BSPLINE",
  13979. /** 磨角法。 */
  13980. POLISH: "POLISH"
  13981. };
  13982. /**
  13983. * @enum SurfaceAnalystMethod
  13984. * @description 表面分析方法枚举。
  13985. * 通过对数据进行表面分析,能够挖掘原始数据所包含的信息,使某些细节明显化,易于分析。
  13986. * @category BaseTypes Constant
  13987. * @type {string}
  13988. * @usage
  13989. * ```
  13990. * // 浏览器
  13991. * <script type="text/javascript" src="{cdn}"></script>
  13992. * <script>
  13993. * const result = {namespace}.SurfaceAnalystMethod.ISOLINE;
  13994. *
  13995. * </script>
  13996. * // ES6 Import
  13997. * import { SurfaceAnalystMethod } from '{npm}';
  13998. *
  13999. * const result = SurfaceAnalystMethod.ISOLINE;
  14000. * ```
  14001. */
  14002. var SurfaceAnalystMethod = {
  14003. /** 等值线提取。 */
  14004. ISOLINE: "ISOLINE",
  14005. /** 等值面提取。 */
  14006. ISOREGION: "ISOREGION"
  14007. };
  14008. /**
  14009. * @enum DataReturnMode
  14010. * @description 数据返回模式枚举。
  14011. * 该枚举用于指定空间分析返回结果模式,包含返回数据集标识和记录集、只返回数据集标识(数据集名称@数据源名称)及只返回记录集三种模式。
  14012. * @category BaseTypes Constant
  14013. * @type {string}
  14014. * @usage
  14015. * ```
  14016. * // 浏览器
  14017. * <script type="text/javascript" src="{cdn}"></script>
  14018. * <script>
  14019. * const result = {namespace}.DataReturnMode.DATASET_AND_RECORDSET;
  14020. *
  14021. * </script>
  14022. * // ES6 Import
  14023. * import { DataReturnMode } from '{npm}';
  14024. *
  14025. * const result = DataReturnMode.DATASET_AND_RECORDSET;
  14026. * ```
  14027. */
  14028. var DataReturnMode = {
  14029. /** 返回结果数据集标识(数据集名称@数据源名称)和记录集(RecordSet)。 */
  14030. DATASET_AND_RECORDSET: "DATASET_AND_RECORDSET",
  14031. /** 只返回数据集标识(数据集名称@数据源名称)。 */
  14032. DATASET_ONLY: "DATASET_ONLY",
  14033. /** 只返回记录集(RecordSet)。 */
  14034. RECORDSET_ONLY: "RECORDSET_ONLY"
  14035. };
  14036. /**
  14037. * @enum EditType
  14038. * @description 要素集更新模式枚举。
  14039. * 该枚举用于指定数据服务中要素集更新模式,包含添加要素集、更新要素集和删除要素集。
  14040. * @category BaseTypes Constant
  14041. * @type {string}
  14042. * @usage
  14043. * ```
  14044. * // 浏览器
  14045. * <script type="text/javascript" src="{cdn}"></script>
  14046. * <script>
  14047. * const result = {namespace}.EditType.ADD;
  14048. *
  14049. * </script>
  14050. * // ES6 Import
  14051. * import { EditType } from '{npm}';
  14052. *
  14053. * const result = {namespace}.EditType.ADD;
  14054. * ```
  14055. */
  14056. var EditType = {
  14057. /** 增加操作。 */
  14058. ADD: "add",
  14059. /** 修改操作。 */
  14060. UPDATE: "update",
  14061. /** 删除操作。 */
  14062. DELETE: "delete"
  14063. };
  14064. /**
  14065. * @enum TransferTactic
  14066. * @description 公交换乘策略枚举。
  14067. * 该枚举用于指定公交服务中要素集更新模式,包含添加要素集、更新要素集和删除要素集。
  14068. * @category BaseTypes Constant
  14069. * @type {string}
  14070. * @usage
  14071. * ```
  14072. * // 浏览器
  14073. * <script type="text/javascript" src="{cdn}"></script>
  14074. * <script>
  14075. * const result = {namespace}.TransferTactic.LESS_TIME;
  14076. *
  14077. * </script>
  14078. * // ES6 Import
  14079. * import { TransferTactic } from '{npm}';
  14080. *
  14081. * const result = TransferTactic.LESS_TIME;
  14082. * ```
  14083. */
  14084. var TransferTactic = {
  14085. /** 时间短。 */
  14086. LESS_TIME: "LESS_TIME",
  14087. /** 少换乘。 */
  14088. LESS_TRANSFER: "LESS_TRANSFER",
  14089. /** 少步行。 */
  14090. LESS_WALK: "LESS_WALK",
  14091. /** 距离最短。 */
  14092. MIN_DISTANCE: "MIN_DISTANCE"
  14093. };
  14094. /**
  14095. * @enum TransferPreference
  14096. * @description 公交换乘策略枚举。
  14097. * 该枚举用于指定交通换乘服务中设置地铁优先、公交优先、不乘地铁、无偏好等偏好设置。
  14098. * @category BaseTypes Constant
  14099. * @type {string}
  14100. * @usage
  14101. * ```
  14102. * // 浏览器
  14103. * <script type="text/javascript" src="{cdn}"></script>
  14104. * <script>
  14105. * const result = {namespace}.TransferPreference.BUS;
  14106. *
  14107. * </script>
  14108. * // ES6 Import
  14109. * import { TransferPreference } from '{npm}';
  14110. *
  14111. * const result = TransferPreference.BUS;
  14112. * ```
  14113. */
  14114. var TransferPreference = {
  14115. /** 公交汽车优先。 */
  14116. BUS: "BUS",
  14117. /** 地铁优先。 */
  14118. SUBWAY: "SUBWAY",
  14119. /** 不乘坐地铁。 */
  14120. NO_SUBWAY: "NO_SUBWAY",
  14121. /** 无乘车偏好。 */
  14122. NONE: "NONE"
  14123. };
  14124. /**
  14125. * @enum GridType
  14126. * @description 地图背景格网类型枚举。
  14127. * @category BaseTypes Constant
  14128. * @type {string}
  14129. * @usage
  14130. * ```
  14131. * // 浏览器
  14132. * <script type="text/javascript" src="{cdn}"></script>
  14133. * <script>
  14134. * const result = {namespace}.GridType.CROSS;
  14135. *
  14136. * </script>
  14137. * // ES6 Import
  14138. * import { GridType } from '{npm}';
  14139. *
  14140. * const result = GridType.CROSS;
  14141. * ```
  14142. */
  14143. var GridType = {
  14144. /** 十字叉丝。 */
  14145. CROSS: "CROSS",
  14146. /** 网格线。 */
  14147. GRID: "GRID",
  14148. /** 点。 */
  14149. POINT: "POINT"
  14150. };
  14151. /**
  14152. * @enum ColorSpaceType
  14153. * @description 色彩空间枚举。
  14154. * 由于成色原理的不同,决定了显示器、投影仪这类靠色光直接合成颜色的颜色设备和打印机、
  14155. * 印刷机这类靠使用颜料的印刷设备在生成颜色方式上的区别。
  14156. * 针对上述不同成色方式,SuperMap 提供两种色彩空间,
  14157. * 分别为 RGB 和 CMYK。RGB 主要用于显示系统中,CMYK 主要用于印刷系统中。
  14158. * @category BaseTypes Constant
  14159. * @type {string}
  14160. * @usage
  14161. * ```
  14162. * // 浏览器
  14163. * <script type="text/javascript" src="{cdn}"></script>
  14164. * <script>
  14165. * const result = {namespace}.ColorSpaceType.CMYK;
  14166. *
  14167. * </script>
  14168. * // ES6 Import
  14169. * import { ColorSpaceType } from '{npm}';
  14170. *
  14171. * const result = ColorSpaceType.CMYK;
  14172. * ```
  14173. */
  14174. var ColorSpaceType = {
  14175. /** 该类型主要在印刷系统使用。 */
  14176. CMYK: "CMYK",
  14177. /** 该类型主要在显示系统中使用。 */
  14178. RGB: "RGB"
  14179. };
  14180. /**
  14181. * @enum LayerType
  14182. * @description 图层类型。
  14183. * @category BaseTypes Constant
  14184. * @type {string}
  14185. * @usage
  14186. * ```
  14187. * // 浏览器
  14188. * <script type="text/javascript" src="{cdn}"></script>
  14189. * <script>
  14190. * const result = {namespace}.LayerType.UGC;
  14191. *
  14192. * </script>
  14193. * // ES6 Import
  14194. * import { LayerType } from '{npm}';
  14195. *
  14196. * const result = LayerType.UGC;
  14197. * ```
  14198. */
  14199. var LayerType = {
  14200. /** SuperMap UGC 类型图层。如矢量图层、栅格(Grid)图层、影像图层。 */
  14201. UGC: "UGC",
  14202. /** WMS 图层。 */
  14203. WMS: "WMS",
  14204. /** WFS 图层。 */
  14205. WFS: "WFS",
  14206. /** 自定义图层。 */
  14207. CUSTOM: "CUSTOM"
  14208. };
  14209. /**
  14210. * @enum UGCLayerType
  14211. * @description SuperMap 图层类型。
  14212. * @category BaseTypes Constant
  14213. * @type {string}
  14214. * @usage
  14215. * ```
  14216. * // 浏览器
  14217. * <script type="text/javascript" src="{cdn}"></script>
  14218. * <script>
  14219. * const result = {namespace}.UGCLayerType.THEME;
  14220. *
  14221. * </script>
  14222. * // ES6 Import
  14223. * import { UGCLayerType } from '{npm}';
  14224. *
  14225. * const result = UGCLayerType.THEME;
  14226. * ```
  14227. */
  14228. var UGCLayerType = {
  14229. /** 专题图层。 */
  14230. THEME: "THEME",
  14231. /** 矢量图层。 */
  14232. VECTOR: "VECTOR",
  14233. /** 栅格图层。 */
  14234. GRID: "GRID",
  14235. /** 影像图层。 */
  14236. IMAGE: "IMAGE"
  14237. };
  14238. /**
  14239. * @enum StatisticMode
  14240. * @description 字段统计方法类型。
  14241. * @category BaseTypes Constant
  14242. * @type {string}
  14243. * @usage
  14244. * ```
  14245. * // 浏览器
  14246. * <script type="text/javascript" src="{cdn}"></script>
  14247. * <script>
  14248. * const result = {namespace}.StatisticMode.AVERAGE;
  14249. *
  14250. * </script>
  14251. * // ES6 Import
  14252. * import { StatisticMode } from '{npm}';
  14253. *
  14254. * const result = StatisticMode.AVERAGE;
  14255. * ```
  14256. */
  14257. var StatisticMode = {
  14258. /** 统计所选字段的平均值。 */
  14259. AVERAGE: "AVERAGE",
  14260. /** 统计所选字段的最大值。 */
  14261. MAX: "MAX",
  14262. /** 统计所选字段的最小值。 */
  14263. MIN: "MIN",
  14264. /** 统计所选字段的标准差 */
  14265. STDDEVIATION: "STDDEVIATION",
  14266. /** 统计所选字段的总和。 */
  14267. SUM: "SUM",
  14268. /** 统计所选字段的方差。 */
  14269. VARIANCE: "VARIANCE"
  14270. };
  14271. /**
  14272. * @enum PixelFormat
  14273. * @description 栅格与影像数据存储的像素格式枚举。
  14274. * @category BaseTypes Constant
  14275. * @type {string}
  14276. * @usage
  14277. * ```
  14278. * // 浏览器
  14279. * <script type="text/javascript" src="{cdn}"></script>
  14280. * <script>
  14281. * const result = {namespace}.PixelFormat.BIT16;
  14282. *
  14283. * </script>
  14284. * // ES6 Import
  14285. * import { PixelFormat } from '{npm}';
  14286. *
  14287. * const result = PixelFormat.BIT16;
  14288. * ```
  14289. */
  14290. var PixelFormat = {
  14291. /** 每个像元用16个比特(即2个字节)表示。 */
  14292. BIT16: "BIT16",
  14293. /** 每个像元用32个比特(即4个字节)表示。 */
  14294. BIT32: "BIT32",
  14295. /** 每个像元用64个比特(即8个字节)表示,只提供给栅格数据集使用。 */
  14296. BIT64: "BIT64",
  14297. /** 每个像元用4个字节来表示,只提供给栅格数据集使用。 */
  14298. SINGLE: "SINGLE",
  14299. /** 每个像元用8个字节来表示,只提供给栅格数据集使用。 */
  14300. DOUBLE: "DOUBLE",
  14301. /** 每个像元用1个比特表示。 */
  14302. UBIT1: "UBIT1",
  14303. /** 每个像元用4个比特来表示。 */
  14304. UBIT4: "UBIT4",
  14305. /** 每个像元用8个比特(即1个字节)来表示。 */
  14306. UBIT8: "UBIT8",
  14307. /** 每个像元用24个比特(即3个字节)来表示。 */
  14308. UBIT24: "UBIT24",
  14309. /** 每个像元用32个比特(即4个字节)来表示。 */
  14310. UBIT32: "UBIT32"
  14311. };
  14312. /**
  14313. * @enum SearchMode
  14314. * @description 内插时使用的样本点的查找方式枚举。
  14315. * @category BaseTypes Constant
  14316. * @type {string}
  14317. * @usage
  14318. * ```
  14319. * // 浏览器
  14320. * <script type="text/javascript" src="{cdn}"></script>
  14321. * <script>
  14322. * const result = {namespace}.SearchMode.KDTREE_FIXED_COUNT;
  14323. *
  14324. * </script>
  14325. * // ES6 Import
  14326. * import { SearchMode } from '{npm}';
  14327. *
  14328. * const result = SearchMode.KDTREE_FIXED_COUNT;
  14329. * ```
  14330. */
  14331. var SearchMode = {
  14332. /** 使用 KDTREE 的固定点数方式查找参与内插分析的点。 */
  14333. KDTREE_FIXED_COUNT: "KDTREE_FIXED_COUNT",
  14334. /** 使用 KDTREE 的定长方式查找参与内插分析的点。 */
  14335. KDTREE_FIXED_RADIUS: "KDTREE_FIXED_RADIUS",
  14336. /** 不进行查找,使用所有的输入点进行内插分析。 */
  14337. NONE: "NONE",
  14338. /** 使用 QUADTREE 方式查找参与内插分析的点,仅对样条(RBF)插值和普通克吕金(Kriging)有用。 */
  14339. QUADTREE: "QUADTREE"
  14340. };
  14341. /**
  14342. * @enum InterpolationAlgorithmType
  14343. * @description 插值分析的算法的类型。
  14344. * @category BaseTypes Constant
  14345. * @type {string}
  14346. * @usage
  14347. * ```
  14348. * // 浏览器
  14349. * <script type="text/javascript" src="{cdn}"></script>
  14350. * <script>
  14351. * const result = {namespace}.InterpolationAlgorithmType.KRIGING;
  14352. *
  14353. * </script>
  14354. * // ES6 Import
  14355. * import { InterpolationAlgorithmType } from '{npm}';
  14356. *
  14357. * const result = InterpolationAlgorithmType.KRIGING;
  14358. * ```
  14359. */
  14360. var InterpolationAlgorithmType = {
  14361. /** 普通克吕金插值法。 */
  14362. KRIGING: "KRIGING",
  14363. /** 简单克吕金插值法。 */
  14364. SimpleKriging: "SimpleKriging",
  14365. /** 泛克吕金插值法。 */
  14366. UniversalKriging: "UniversalKriging"
  14367. };
  14368. /**
  14369. * @enum VariogramMode
  14370. * @description 克吕金(Kriging)插值时的半变函数类型枚举。
  14371. * @category BaseTypes Constant
  14372. * @type {string}
  14373. * @usage
  14374. * ```
  14375. * // 浏览器
  14376. * <script type="text/javascript" src="{cdn}"></script>
  14377. * <script>
  14378. * const result = {namespace}.VariogramMode.EXPONENTIAL;
  14379. *
  14380. * </script>
  14381. * // ES6 Import
  14382. * import { VariogramMode } from '{npm}';
  14383. *
  14384. * const result = VariogramMode.EXPONENTIAL;
  14385. * ```
  14386. */
  14387. var VariogramMode = {
  14388. /** 指数函数。 */
  14389. EXPONENTIAL: "EXPONENTIAL",
  14390. /** 高斯函数。 */
  14391. GAUSSIAN: "GAUSSIAN",
  14392. /** 球型函数。 */
  14393. SPHERICAL: "SPHERICAL"
  14394. };
  14395. /**
  14396. * @enum Exponent
  14397. * @description 定义了泛克吕金(UniversalKriging)插值时样点数据中趋势面方程的阶数。
  14398. * @category BaseTypes Constant
  14399. * @type {string}
  14400. * @usage
  14401. * ```
  14402. * // 浏览器
  14403. * <script type="text/javascript" src="{cdn}"></script>
  14404. * <script>
  14405. * const result = {namespace}.Exponent.EXP1;
  14406. *
  14407. * </script>
  14408. * // ES6 Import
  14409. * import { Exponent } from '{npm}';
  14410. *
  14411. * const result = Exponent.EXP1;
  14412. * ```
  14413. */
  14414. var Exponent = {
  14415. /** 阶数为1。 */
  14416. EXP1: "EXP1",
  14417. /** 阶数为2。 */
  14418. EXP2: "EXP2"
  14419. };
  14420. /**
  14421. * @enum ClientType
  14422. * @description token申请的客户端标识类型。
  14423. * @category BaseTypes Constant
  14424. * @type {string}
  14425. * @usage
  14426. * ```
  14427. * // 浏览器
  14428. * <script type="text/javascript" src="{cdn}"></script>
  14429. * <script>
  14430. * const result = {namespace}.ClientType.IP;
  14431. *
  14432. * </script>
  14433. * // ES6 Import
  14434. * import { ClientType } from '{npm}';
  14435. *
  14436. * const result = ClientType.IP;
  14437. * ```
  14438. */
  14439. var ClientType = {
  14440. /** 指定的 IP 地址。 */
  14441. IP: "IP",
  14442. /** 指定的 URL。 */
  14443. REFERER: "Referer",
  14444. /** 发送申请令牌请求的客户端 IP。 */
  14445. REQUESTIP: "RequestIP",
  14446. /** 不做任何验证。 */
  14447. NONE: "NONE",
  14448. /** SERVER。 */
  14449. SERVER: "SERVER",
  14450. /** WEB。 */
  14451. WEB: "WEB"
  14452. };
  14453. /**
  14454. * @enum ChartType
  14455. * @description 客户端专题图图表类型。
  14456. * @category BaseTypes Constant
  14457. * @type {string}
  14458. * @usage
  14459. * ```
  14460. * // 浏览器
  14461. * <script type="text/javascript" src="{cdn}"></script>
  14462. * <script>
  14463. * const result = {namespace}.ChartType.BAR;
  14464. *
  14465. * </script>
  14466. * // ES6 Import
  14467. * import { ChartType } from '{npm}';
  14468. *
  14469. * const result = ChartType.BAR;
  14470. * ```
  14471. */
  14472. var ChartType = {
  14473. /** 柱状图。 */
  14474. BAR: "Bar",
  14475. /** 三维柱状图。 */
  14476. BAR3D: "Bar3D",
  14477. /** 圆形图。 */
  14478. CIRCLE: "Circle",
  14479. /** 饼图。 */
  14480. PIE: "Pie",
  14481. /** 散点图。 */
  14482. POINT: "Point",
  14483. /** 折线图。 */
  14484. LINE: "Line",
  14485. /** 环状图。 */
  14486. RING: "Ring"
  14487. };
  14488. /**
  14489. * @enum ClipAnalystMode
  14490. * @description 裁剪分析模式
  14491. * @category BaseTypes Constant
  14492. * @type {string}
  14493. * @usage
  14494. * ```
  14495. * // 浏览器
  14496. * <script type="text/javascript" src="{cdn}"></script>
  14497. * <script>
  14498. * const result = {namespace}.ClipAnalystMode.CLIP;
  14499. *
  14500. * </script>
  14501. * // ES6 Import
  14502. * import { ClipAnalystMode } from '{npm}';
  14503. *
  14504. * const result = ClipAnalystMode.CLIP;
  14505. * ```
  14506. */
  14507. var ClipAnalystMode = {
  14508. /** CLIP。 */
  14509. CLIP: "clip",
  14510. /** INTERSECT。 */
  14511. INTERSECT: "intersect"
  14512. };
  14513. /**
  14514. * @enum AnalystAreaUnit
  14515. * @description 分布式分析面积单位。
  14516. * @category BaseTypes Constant
  14517. * @type {string}
  14518. * @usage
  14519. * ```
  14520. * // 浏览器
  14521. * <script type="text/javascript" src="{cdn}"></script>
  14522. * <script>
  14523. * const result = {namespace}.AnalystAreaUnit.SQUAREMETER;
  14524. *
  14525. * </script>
  14526. * // ES6 Import
  14527. * import { AnalystAreaUnit } from '{npm}';
  14528. *
  14529. * const result = AnalystAreaUnit.SQUAREMETER;
  14530. * ```
  14531. */
  14532. var AnalystAreaUnit = {
  14533. /** 平方米。 */
  14534. "SQUAREMETER": "SquareMeter",
  14535. /** 平方千米。 */
  14536. "SQUAREKILOMETER": "SquareKiloMeter",
  14537. /** 公顷。 */
  14538. "HECTARE": "Hectare",
  14539. /** 公亩。 */
  14540. "ARE": "Are",
  14541. /** 英亩。 */
  14542. "ACRE": "Acre",
  14543. /** 平方英尺。 */
  14544. "SQUAREFOOT": "SquareFoot",
  14545. /** 平方码。 */
  14546. "SQUAREYARD": "SquareYard",
  14547. /** 平方英里。 */
  14548. "SQUAREMILE": "SquareMile"
  14549. };
  14550. /**
  14551. * @enum AnalystSizeUnit
  14552. * @description 分布式分析单位。
  14553. * @category BaseTypes Constant
  14554. * @type {string}
  14555. * @usage
  14556. * ```
  14557. * // 浏览器
  14558. * <script type="text/javascript" src="{cdn}"></script>
  14559. * <script>
  14560. * const result = {namespace}.AnalystSizeUnit.METER;
  14561. *
  14562. * </script>
  14563. * // ES6 Import
  14564. * import { AnalystSizeUnit } from '{npm}';
  14565. *
  14566. * const result = AnalystSizeUnit.METER;
  14567. * ```
  14568. */
  14569. var AnalystSizeUnit = {
  14570. /** 米。 */
  14571. "METER": "Meter",
  14572. /** 千米。 */
  14573. "KILOMETER": "Kilometer",
  14574. /** 码。 */
  14575. "YARD": "Yard",
  14576. /** 英尺。 */
  14577. "FOOT": "Foot",
  14578. /** 英里。 */
  14579. "MILE": "Mile"
  14580. };
  14581. /**
  14582. * @enum StatisticAnalystMode
  14583. * @description 分布式分析统计模式。
  14584. * @category BaseTypes Constant
  14585. * @type {string}
  14586. * @usage
  14587. * ```
  14588. * // 浏览器
  14589. * <script type="text/javascript" src="{cdn}"></script>
  14590. * <script>
  14591. * const result = {namespace}.StatisticAnalystMode.MAX;
  14592. *
  14593. * </script>
  14594. * // ES6 Import
  14595. * import { StatisticAnalystMode } from '{npm}';
  14596. *
  14597. * const result = StatisticAnalystMode.MAX;
  14598. * ```
  14599. */
  14600. var StatisticAnalystMode = {
  14601. /** 统计所选字段的最大值。 */
  14602. "MAX": "max",
  14603. /** 统计所选字段的最小值。 */
  14604. "MIN": "min",
  14605. /** 统计所选字段的平均值。 */
  14606. "AVERAGE": "average",
  14607. /** 统计所选字段的总和。 */
  14608. "SUM": "sum",
  14609. /** 统计所选字段的方差。 */
  14610. "VARIANCE": "variance",
  14611. /** 统计所选字段的标准差。 */
  14612. "STDDEVIATION": "stdDeviation"
  14613. };
  14614. /**
  14615. * @enum SummaryType
  14616. * @description 分布式分析聚合类型。
  14617. * @category BaseTypes Constant
  14618. * @type {string}
  14619. * @usage
  14620. * ```
  14621. * // 浏览器
  14622. * <script type="text/javascript" src="{cdn}"></script>
  14623. * <script>
  14624. * const result = {namespace}.SummaryType.SUMMARYMESH;
  14625. *
  14626. * </script>
  14627. * // ES6 Import
  14628. * import { SummaryType } from '{npm}';
  14629. *
  14630. * const result = SummaryType.SUMMARYMESH;
  14631. * ```
  14632. */
  14633. var SummaryType = {
  14634. /** 格网聚合。 */
  14635. "SUMMARYMESH": "SUMMARYMESH",
  14636. /** 多边形聚合。 */
  14637. "SUMMARYREGION": "SUMMARYREGION"
  14638. };
  14639. /**
  14640. * @enum TopologyValidatorRule
  14641. * @description 拓扑检查模式枚举。该类定义了拓扑检查操作模式常量。
  14642. * @category BaseTypes Constant
  14643. * @type {string}
  14644. * @usage
  14645. * ```
  14646. * // 浏览器
  14647. * <script type="text/javascript" src="{cdn}"></script>
  14648. * <script>
  14649. * const result = {namespace}.TopologyValidatorRule.REGIONNOOVERLAP;
  14650. *
  14651. * </script>
  14652. * // ES6 Import
  14653. * import { TopologyValidatorRule } from '{npm}';
  14654. *
  14655. * const result = TopologyValidatorRule.REGIONNOOVERLAP;
  14656. * ```
  14657. */
  14658. var TopologyValidatorRule = {
  14659. /** 面内无重叠,用于对面数据进行拓扑检查。 */
  14660. REGIONNOOVERLAP: "REGIONNOOVERLAP",
  14661. /** 面与面无重叠,用于对面数据进行拓扑检查。 */
  14662. REGIONNOOVERLAPWITH: "REGIONNOOVERLAPWITH",
  14663. /** 面被面包含,用于对面数据进行拓扑检查。 */
  14664. REGIONCONTAINEDBYREGION: "REGIONCONTAINEDBYREGION",
  14665. /** 面被面覆盖,用于对面数据进行拓扑检查。 */
  14666. REGIONCOVEREDBYREGION: "REGIONCOVEREDBYREGION",
  14667. /** 线与线无重叠,用于对线数据进行拓扑检查。 */
  14668. LINENOOVERLAP: "LINENOOVERLAP",
  14669. /** 线内无重叠,用于对线数据进行拓扑检查。 */
  14670. LINENOOVERLAPWITH: "LINENOOVERLAPWITH",
  14671. /** 点不相同,用于对点数据进行拓扑检查。 */
  14672. POINTNOIDENTICAL: "POINTNOIDENTICAL"
  14673. };
  14674. /**
  14675. * @enum BucketAggType
  14676. * @description 格网聚合查询枚举类,该类定义了Elasticsearch数据服务中聚合查询模式常量
  14677. * @category BaseTypes Constant
  14678. * @type {string}
  14679. * @usage
  14680. * ```
  14681. * // 浏览器
  14682. * <script type="text/javascript" src="{cdn}"></script>
  14683. * <script>
  14684. * const result = {namespace}.BucketAggType.GEOHASH_GRID;
  14685. *
  14686. * </script>
  14687. * // ES6 Import
  14688. * import { BucketAggType } from '{npm}';
  14689. *
  14690. * const result = BucketAggType.GEOHASH_GRID;
  14691. * ```
  14692. */
  14693. var BucketAggType = {
  14694. /** 格网聚合类型。 */
  14695. GEOHASH_GRID: "geohash_grid"
  14696. };
  14697. /**
  14698. * @enum MetricsAggType
  14699. * @description 指标聚合类型枚举类,该类定义了Elasticsearch数据服务中聚合查询模式常量。
  14700. * @category BaseTypes Constant
  14701. * @type {string}
  14702. * @usage
  14703. * ```
  14704. * // 浏览器
  14705. * <script type="text/javascript" src="{cdn}"></script>
  14706. * <script>
  14707. * const result = {namespace}.MetricsAggType.AVG;
  14708. *
  14709. * </script>
  14710. * // ES6 Import
  14711. * import { MetricsAggType } from '{npm}';
  14712. *
  14713. * const result = MetricsAggType.AVG;
  14714. * ```
  14715. */
  14716. var MetricsAggType = {
  14717. /** 平均值聚合类型。 */
  14718. AVG:'avg',
  14719. /** 最大值聚合类型。 */
  14720. MAX:'max',
  14721. /** 最小值聚合类型。 */
  14722. MIN:'min',
  14723. /** 求和聚合类型。 */
  14724. SUM:'sum'
  14725. };
  14726. /**
  14727. * @enum GetFeatureMode
  14728. * @description feature 查询方式。
  14729. * @category BaseTypes Constant
  14730. * @type {string}
  14731. * @usage
  14732. * ```
  14733. * // 浏览器
  14734. * <script type="text/javascript" src="{cdn}"></script>
  14735. * <script>
  14736. * const result = {namespace}.GetFeatureMode.BOUNDS;
  14737. *
  14738. * </script>
  14739. * // ES6 Import
  14740. * import { GetFeatureMode } from '{npm}';
  14741. *
  14742. * const result = GetFeatureMode.BOUNDS;
  14743. * ```
  14744. */
  14745. var GetFeatureMode = {
  14746. /** 通过范围查询来获取要素。 */
  14747. BOUNDS: "BOUNDS",
  14748. /** 通过几何对象的缓冲区来获取要素。 */
  14749. BUFFER: "BUFFER",
  14750. /** 通过 ID 来获取要素。 */
  14751. ID: "ID",
  14752. /** 通过空间查询模式来获取要素。 */
  14753. SPATIAL: "SPATIAL",
  14754. /** 通过 SQL 查询来获取要素。 */
  14755. SQL: 'SQL'
  14756. }
  14757. /**
  14758. * @enum RasterFunctionType
  14759. * @description 栅格分析方法。
  14760. * @category BaseTypes Constant
  14761. * @type {string}
  14762. * @usage
  14763. * ```
  14764. * // 浏览器
  14765. * <script type="text/javascript" src="{cdn}"></script>
  14766. * <script>
  14767. * const result = {namespace}.GetFeatureMode.NDVI;
  14768. *
  14769. * </script>
  14770. * // ES6 Import
  14771. * import { GetFeatureMode } from '{npm}';
  14772. *
  14773. * const result = GetFeatureMode.NDVI;
  14774. * ```
  14775. */
  14776. var RasterFunctionType = {
  14777. /** 归一化植被指数。 */
  14778. NDVI: "NDVI",
  14779. /** 阴影面分析。 */
  14780. HILLSHADE: "HILLSHADE"
  14781. }
  14782. /**
  14783. * @enum ResourceType
  14784. * @description iportal资源类型。
  14785. * @category BaseTypes Constant
  14786. * @version 10.0.1
  14787. * @type {string}
  14788. * @usage
  14789. * ```
  14790. * // 浏览器
  14791. * <script type="text/javascript" src="{cdn}"></script>
  14792. * <script>
  14793. * const result = {namespace}.GetFeatureMode.MAP;
  14794. *
  14795. * </script>
  14796. * // ES6 Import
  14797. * import { GetFeatureMode } from '{npm}';
  14798. *
  14799. * const result = GetFeatureMode.MAP;
  14800. * ```
  14801. */
  14802. var ResourceType = {
  14803. /** 地图。 */
  14804. MAP: "MAP",
  14805. /** 服务。 */
  14806. SERVICE: "SERVICE",
  14807. /** 场景。 */
  14808. SCENE: "SCENE",
  14809. /** 数据。 */
  14810. DATA: "DATA",
  14811. /** 洞察。 */
  14812. INSIGHTS_WORKSPACE: "INSIGHTS_WORKSPACE",
  14813. /** 大屏。 */
  14814. MAP_DASHBOARD: "MAP_DASHBOARD"
  14815. }
  14816. /**
  14817. * @enum OrderBy
  14818. * @description iportal资源排序字段。
  14819. * @category BaseTypes Constant
  14820. * @version 10.0.1
  14821. * @type {string}
  14822. * @usage
  14823. * ```
  14824. * // 浏览器
  14825. * <script type="text/javascript" src="{cdn}"></script>
  14826. * <script>
  14827. * const result = {namespace}.OrderBy.UPDATETIME;
  14828. *
  14829. * </script>
  14830. * // ES6 Import
  14831. * import { OrderBy } from '{npm}';
  14832. *
  14833. * const result = OrderBy.UPDATETIME;
  14834. * ```
  14835. */
  14836. var OrderBy = {
  14837. /** 按更新时间排序。 */
  14838. UPDATETIME: "UPDATETIME",
  14839. /** 按热度(可能是访问量、下载量)排序。 */
  14840. HEATLEVEL: "HEATLEVEL",
  14841. /** 按相关性排序。 */
  14842. RELEVANCE: "RELEVANCE"
  14843. }
  14844. /**
  14845. * @enum OrderType
  14846. * @description iportal资源升序还是降序过滤。
  14847. * @category BaseTypes Constant
  14848. * @version 10.0.1
  14849. * @type {string}
  14850. * @usage
  14851. * ```
  14852. * // 浏览器
  14853. * <script type="text/javascript" src="{cdn}"></script>
  14854. * <script>
  14855. * const result = {namespace}.OrderType.ASC;
  14856. *
  14857. * </script>
  14858. * // ES6 Import
  14859. * import { OrderType } from '{npm}';
  14860. *
  14861. * const result = OrderType.ASC;
  14862. * ```
  14863. */
  14864. var OrderType = {
  14865. /** 升序。 */
  14866. ASC: "ASC",
  14867. /** 降序。 */
  14868. DESC: "DESC"
  14869. }
  14870. /**
  14871. * @enum SearchType
  14872. * @description iportal资源查询的范围进行过滤。
  14873. * @category BaseTypes Constant
  14874. * @version 10.0.1
  14875. * @type {string}
  14876. * @usage
  14877. * ```
  14878. * // 浏览器
  14879. * <script type="text/javascript" src="{cdn}"></script>
  14880. * <script>
  14881. * const result = {namespace}.SearchType.PUBLIC;
  14882. *
  14883. * </script>
  14884. * // ES6 Import
  14885. * import { SearchType } from '{npm}';
  14886. *
  14887. * const result = SearchType.PUBLIC;
  14888. * ```
  14889. */
  14890. var SearchType = {
  14891. /** 公开资源。 */
  14892. PUBLIC: "PUBLIC",
  14893. /** 我的资源。 */
  14894. MY_RES: "MY_RES",
  14895. /** 我的群组资源。 */
  14896. MYGROUP_RES: "MYGROUP_RES",
  14897. /** 我的部门资源。 */
  14898. MYDEPARTMENT_RES: "MYDEPARTMENT_RES",
  14899. /** 分享给我的资源。 */
  14900. SHARETOME_RES: "SHARETOME_RES"
  14901. }
  14902. /**
  14903. * @enum AggregationTypes
  14904. * @description iportal资源聚合查询的类型。
  14905. * @category BaseTypes Constant
  14906. * @version 10.0.1
  14907. * @type {string}
  14908. * @usage
  14909. * ```
  14910. * // 浏览器
  14911. * <script type="text/javascript" src="{cdn}"></script>
  14912. * <script>
  14913. * const result = {namespace}.AggregationTypes.TAG;
  14914. *
  14915. * </script>
  14916. * // ES6 Import
  14917. * import { AggregationTypes } from '{npm}';
  14918. *
  14919. * const result = AggregationTypes.TAG;
  14920. * ```
  14921. */
  14922. var AggregationTypes = {
  14923. /** 标签。 */
  14924. TAG: "TAG",
  14925. /** 资源类型。 */
  14926. TYPE: "TYPE"
  14927. }
  14928. /**
  14929. * @enum PermissionType
  14930. * @description iportal资源权限类型。
  14931. * @category BaseTypes Constant
  14932. * @version 10.0.1
  14933. * @type {string}
  14934. * @usage
  14935. * ```
  14936. * // 浏览器
  14937. * <script type="text/javascript" src="{cdn}"></script>
  14938. * <script>
  14939. * const result = {namespace}.PermissionType.SEARCH;
  14940. *
  14941. * </script>
  14942. * // ES6 Import
  14943. * import { PermissionType } from '{npm}';
  14944. *
  14945. * const result = PermissionType.SEARCH;
  14946. * ```
  14947. */
  14948. var PermissionType = {
  14949. /** 可检索。 */
  14950. SEARCH:"SEARCH",
  14951. /** 可查看。 */
  14952. READ: "READ",
  14953. /** 可编辑。 */
  14954. READWRITE: "READWRITE",
  14955. /** 可删除。 */
  14956. DELETE: "DELETE",
  14957. /** 可下载,包括可读、可检索。 */
  14958. DOWNLOAD:"DOWNLOAD"
  14959. }
  14960. /**
  14961. * @enum EntityType
  14962. * @description iportal资源实体类型。
  14963. * @category BaseTypes Constant
  14964. * @version 10.0.1
  14965. * @type {string}
  14966. * @usage
  14967. * ```
  14968. * // 浏览器
  14969. * <script type="text/javascript" src="{cdn}"></script>
  14970. * <script>
  14971. * const result = {namespace}.EntityType.DEPARTMENT;
  14972. *
  14973. * </script>
  14974. * // ES6 Import
  14975. * import { EntityType } from '{npm}';
  14976. *
  14977. * const result = EntityType.DEPARTMENT;
  14978. * ```
  14979. */
  14980. var EntityType = {
  14981. /** 部门。 */
  14982. DEPARTMENT: "DEPARTMENT",
  14983. /** 用户组。 */
  14984. GROUP: "GROUP",
  14985. /** 群组。 */
  14986. IPORTALGROUP: "IPORTALGROUP",
  14987. /** 角色。 */
  14988. ROLE: "ROLE",
  14989. /** 用户。 */
  14990. USER: "USER"
  14991. }
  14992. /**
  14993. * @enum DataItemType
  14994. * @description iportal数据类型。
  14995. * @category BaseTypes Constant
  14996. * @version 10.0.1
  14997. * @type {string}
  14998. * @usage
  14999. * ```
  15000. * // 浏览器
  15001. * <script type="text/javascript" src="{cdn}"></script>
  15002. * <script>
  15003. * const result = {namespace}.DataItemType.GEOJSON;
  15004. *
  15005. * </script>
  15006. * // ES6 Import
  15007. * import { DataItemType } from '{npm}';
  15008. *
  15009. * const result = DataItemType.GEOJSON;
  15010. * ```
  15011. */
  15012. var DataItemType = {
  15013. /** geojson 数据。 */
  15014. GEOJSON: "GEOJSON",
  15015. /** UGCV5_MVT。 */
  15016. UGCV5_MVT: "UGCV5_MVT",
  15017. /** json数据。 */
  15018. JSON: "JSON",
  15019. /** 音频文件。 */
  15020. AUDIO: "AUDIO",
  15021. /** Color 颜色。 */
  15022. COLOR: "COLOR",
  15023. /** ColorScheme 颜色方案。 */
  15024. COLORSCHEME: "COLORSCHEME",
  15025. /** CSV 数据。 */
  15026. CSV: "CSV",
  15027. /** EXCEL 数据。 */
  15028. EXCEL: "EXCEL",
  15029. /** FillSymbol 填充符号库。 */
  15030. FILLSYMBOL: "FILLSYMBOL",
  15031. /** 图片类型。 */
  15032. IMAGE: "IMAGE",
  15033. /** LayerTemplate 图层模板。 */
  15034. LAYERTEMPLATE: "LAYERTEMPLATE",
  15035. /** LayoutTemplate 布局模板。 */
  15036. LAYOUTTEMPLATE: "LAYOUTTEMPLATE",
  15037. /** LineSymbol 线符号库。 */
  15038. LINESYMBOL: "LINESYMBOL",
  15039. /** MapTemplate 地图模板。 */
  15040. MAPTEMPLATE: "MAPTEMPLATE",
  15041. /** MarkerSymbol 点符号库。 */
  15042. MARKERSYMBOL: "MARKERSYMBOL",
  15043. /** MBTILES。 */
  15044. MBTILES: "MBTILES",
  15045. /** 照片。 */
  15046. PHOTOS: "PHOTOS",
  15047. /** SHP 空间数据。 */
  15048. SHP: "SHP",
  15049. /** SMTILES。 */
  15050. SMTILES: "SMTILES",
  15051. /** SVTILES。 */
  15052. SVTILES: "SVTILES",
  15053. /** ThemeTemplate 专题图模板。 */
  15054. THEMETEMPLATE: "THEMETEMPLATE",
  15055. /** TPK。 */
  15056. TPK: "TPK",
  15057. /** UDB 数据源。 */
  15058. UDB: "UDB",
  15059. /** UGCV5。 */
  15060. UGCV5: "UGCV5",
  15061. /** 其他类型(普通文件)。 */
  15062. UNKNOWN: "UNKNOWN",
  15063. /** 视频文件。 */
  15064. VIDEO: "VIDEO",
  15065. /** WorkEnviroment 工作环境。 */
  15066. WORKENVIRONMENT: "WORKENVIRONMENT",
  15067. /** 工作空间。 */
  15068. WORKSPACE: "WORKSPACE"
  15069. }
  15070. /**
  15071. * @enum WebExportFormatType
  15072. * @description Web 打印输出的格式。
  15073. * @category BaseTypes Constant
  15074. * @version 10.0.1
  15075. * @type {string}
  15076. * @usage
  15077. * ```
  15078. * // 浏览器
  15079. * <script type="text/javascript" src="{cdn}"></script>
  15080. * <script>
  15081. * const result = {namespace}.WebExportFormatType.PNG;
  15082. *
  15083. * </script>
  15084. * // ES6 Import
  15085. * import { WebExportFormatType } from '{npm}';
  15086. *
  15087. * const result = WebExportFormatType.PNG;
  15088. * ```
  15089. */
  15090. var WebExportFormatType = {
  15091. /** PNG */
  15092. PNG: "PNG",
  15093. /** PDF */
  15094. PDF: "PDF"
  15095. }
  15096. /**
  15097. * @enum WebScaleOrientationType
  15098. * @description Web 比例尺的方位样式。
  15099. * @category BaseTypes Constant
  15100. * @version 10.0.1
  15101. * @type {string}
  15102. * @usage
  15103. * ```
  15104. * // 浏览器
  15105. * <script type="text/javascript" src="{cdn}"></script>
  15106. * <script>
  15107. * const result = {namespace}.WebScaleOrientationType.HORIZONTALLABELSBELOW;
  15108. *
  15109. * </script>
  15110. * // ES6 Import
  15111. * import { WebScaleOrientationType } from '{npm}';
  15112. *
  15113. * const result = WebScaleOrientationType.HORIZONTALLABELSBELOW;
  15114. * ```
  15115. */
  15116. var WebScaleOrientationType = {
  15117. /** horizontal labels below. */
  15118. HORIZONTALLABELSBELOW: "HORIZONTALLABELSBELOW",
  15119. /** horizontal labels above. */
  15120. HORIZONTALLABELSABOVE: "HORIZONTALLABELSABOVE",
  15121. /** vertical labels left. */
  15122. VERTICALLABELSLEFT: "VERTICALLABELSLEFT",
  15123. /** vertical labels right. */
  15124. VERTICALLABELSRIGHT: "VERTICALLABELSRIGHT"
  15125. }
  15126. /**
  15127. * @enum WebScaleType
  15128. * @description Web 比例尺的样式。
  15129. * @category BaseTypes Constant
  15130. * @version 10.0.1
  15131. * @type {string}
  15132. * @usage
  15133. * ```
  15134. * // 浏览器
  15135. * <script type="text/javascript" src="{cdn}"></script>
  15136. * <script>
  15137. * const result = {namespace}.WebScaleType.LINE;
  15138. *
  15139. * </script>
  15140. * // ES6 Import
  15141. * import { WebScaleType } from '{npm}';
  15142. *
  15143. * const result = WebScaleType.LINE;
  15144. * ```
  15145. */
  15146. var WebScaleType = {
  15147. /** line. */
  15148. LINE: "LINE",
  15149. /** bar. */
  15150. BAR: "BAR",
  15151. /** bar sub. */
  15152. BAR_SUB: "BAR_SUB"
  15153. }
  15154. /**
  15155. * @enum WebScaleUnit
  15156. * @description Web 比例尺的单位制。
  15157. * @category BaseTypes Constant
  15158. * @version 10.0.1
  15159. * @type {string}
  15160. * @usage
  15161. * ```
  15162. * // 浏览器
  15163. * <script type="text/javascript" src="{cdn}"></script>
  15164. * <script>
  15165. * const result = {namespace}.WebScaleUnit.METER;
  15166. *
  15167. * </script>
  15168. * // ES6 Import
  15169. * import { WebScaleUnit } from '{npm}';
  15170. *
  15171. * const result = WebScaleUnit.METER;
  15172. * ```
  15173. */
  15174. var WebScaleUnit = {
  15175. /** 米。 */
  15176. METER: "METER",
  15177. /** 英尺。 */
  15178. FOOT: "FOOT",
  15179. /** 度。 */
  15180. DEGREES: "DEGREES"
  15181. }
  15182. ;// CONCATENATED MODULE: ./src/common/iServer/ServerGeometry.js
  15183. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  15184. * This program are made available under the terms of the Apache License, Version 2.0
  15185. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15186. /**
  15187. * @class ServerGeometry
  15188. * @deprecatedclass SuperMap.ServerGeometry
  15189. * @category iServer Data Feature
  15190. * @classdesc 服务端几何对象类。该类描述几何对象(矢量)的特征数据(坐标点对、几何对象的类型等)。基于服务端的空间分析、空间关系运算、查询等 GIS 服务功能使用服务端几何对象。
  15191. * @param {Object} options - 参数。
  15192. * @param {string} options.id - 服务端几何对象唯一标识符。
  15193. * @param {Array.<number>} options.parts - 服务端几何对象中各个子对象所包含的节点个数。
  15194. * @param {Array.<GeometryPoint>} options.points - 组成几何对象的节点的坐标对数组。
  15195. * @param {GeometryType} options.type - 几何对象的类型。
  15196. * @param {ServerStyle} [options.style] - 服务端几何对象的风格。
  15197. * @usage
  15198. */
  15199. class ServerGeometry {
  15200. constructor(options) {
  15201. /**
  15202. * @member {string} ServerGeometry.prototype.id
  15203. * @description 服务端几何对象唯一标识符。
  15204. */
  15205. this.id = 0;
  15206. /**
  15207. * @member {ServerStyle} [ServerGeometry.prototype.style]
  15208. * @description 服务端几何对象的风格(ServerStyle)。
  15209. */
  15210. this.style = null;
  15211. /**
  15212. * @member {Array.<number>} ServerGeometry.prototype.parts
  15213. * @description 服务端几何对象中各个子对象所包含的节点个数。<br>
  15214. * 1.几何对象从结构上可以分为简单几何对象和复杂几何对象。
  15215. * 简单几何对象与复杂几何对象的区别:简单的几何对象一般为单一对象,
  15216. * 而复杂的几何对象由多个简单对象组成或经过一定的空间运算之后产生,
  15217. * 如:矩形为简单的区域对象,而中空的矩形为复杂的区域对象。<br>
  15218. * 2.通常情况,一个简单几何对象的子对象就是它本身,
  15219. * 因此对于简单对象来说的该字段为长度为1的整型数组,
  15220. * 该字段的值就是这个简单对象节点的个数。
  15221. * 如果一个几何对象是由几个简单对象组合而成的,
  15222. * 例如,一个岛状几何对象由 3 个简单的多边形组成而成,
  15223. * 那么这个岛状的几何对象的 Parts 字段值就是一个长度为 3 的整型数组,
  15224. * 数组中每个成员的值分别代表这三个多边形所包含的节点个数。
  15225. */
  15226. this.parts = null;
  15227. /**
  15228. * @member {Array.<GeometryPoint>} ServerGeometry.prototype.points
  15229. * @description 组成几何对象的节点的坐标对数组。<br>
  15230. * 1.所有几何对象(点、线、面)都是由一些简单的点坐标组成的,
  15231. * 该字段存放了组成几何对象的点坐标的数组。
  15232. * 对于简单的面对象,他的起点和终点的坐标点相同。<br>
  15233. * 2.对于复杂的几何对象,根据 Parts 属性来确定每一个组成复杂几何对象的简单对象所对应的节点的个数,
  15234. * 从而确定 Points 字段中坐标对的分配归属问题。
  15235. */
  15236. this.points = null;
  15237. /**
  15238. * @member {GeometryType} ServerGeometry.prototype.type
  15239. * @description 几何对象的类型(GeometryType)。
  15240. */
  15241. this.type = null;
  15242. /**
  15243. * @member {Object} ServerGeometry.prototype.prjCoordSys
  15244. * @description 投影坐标参数,现仅在缓冲区分析中有效。
  15245. */
  15246. this.prjCoordSys = null;
  15247. if (options) {
  15248. Util_Util.extend(this, options);
  15249. }
  15250. this.CLASS_NAME = 'SuperMap.ServerGeometry';
  15251. }
  15252. /**
  15253. * @function ServerGeometry.prototype.destroy
  15254. * @description 释放资源,将引用资源的属性置空。
  15255. */
  15256. destroy() {
  15257. var me = this;
  15258. me.id = null;
  15259. me.style = null;
  15260. me.parts = null;
  15261. me.partTopo = null;
  15262. me.points = null;
  15263. me.type = null;
  15264. me.prjCoordSys = null;
  15265. }
  15266. /**
  15267. * @function ServerGeometry.prototype.toGeometry
  15268. * @description 将服务端几何对象 ServerGeometry 转换为客户端几何对象 Geometry。
  15269. * @returns {Geometry} 转换后的客户端几何对象。
  15270. */
  15271. toGeometry() {
  15272. var me = this,
  15273. geoType = me.type;
  15274. switch (geoType.toUpperCase()) {
  15275. case REST_GeometryType.POINT:
  15276. return me.toGeoPoint();
  15277. case REST_GeometryType.LINE:
  15278. return me.toGeoLine();
  15279. case REST_GeometryType.LINEM:
  15280. return me.toGeoLinem();
  15281. case REST_GeometryType.REGION:
  15282. return me.toGeoRegion();
  15283. case REST_GeometryType.POINTEPS:
  15284. return me.toGeoPoint();
  15285. case REST_GeometryType.LINEEPS:
  15286. return me.toGeoLineEPS();
  15287. case REST_GeometryType.REGIONEPS:
  15288. return me.toGeoRegionEPS();
  15289. case REST_GeometryType.GEOCOMPOUND:
  15290. return me.transformGeoCompound();
  15291. }
  15292. }
  15293. /**
  15294. * @function ServerGeometry.prototype.toGeoPoint
  15295. * @description 将服务端的点几何对象转换为客户端几何对象。包括 Point、MultiPoint。
  15296. * @returns {Geometry} 转换后的客户端几何对象。
  15297. */
  15298. toGeoPoint() {
  15299. var me = this,
  15300. geoParts = me.parts || [],
  15301. geoPoints = me.points || [],
  15302. len = geoParts.length;
  15303. if (len > 0) {
  15304. if (len === 1) {
  15305. return new Point(geoPoints[0].x, geoPoints[0].y);
  15306. } else {
  15307. var pointList = [];
  15308. for (let i = 0; i < len; i++) {
  15309. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y));
  15310. }
  15311. return new MultiPoint(pointList);
  15312. }
  15313. } else {
  15314. return null;
  15315. }
  15316. }
  15317. /**
  15318. * @function ServerGeometry.prototype.toGeoLine
  15319. * @description 将服务端的线几何对象转换为客户端几何对象。包括 GeometryLinearRing、GeometryLineString、GeometryMultiLineString。
  15320. * @returns {Geometry} 转换后的客户端几何对象。
  15321. */
  15322. toGeoLine() {
  15323. var me = this,
  15324. geoParts = me.parts || [],
  15325. geoPoints = me.points || [],
  15326. len = geoParts.length;
  15327. if (len > 0) {
  15328. if (len === 1) {
  15329. let pointList = [];
  15330. for (let i = 0; i < geoParts[0]; i++) {
  15331. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y));
  15332. }
  15333. //判断线是否闭合,如果闭合,则返回LinearRing,否则返回LineString
  15334. if (pointList[0].equals(pointList[geoParts[0] - 1])) {
  15335. return new LinearRing_LinearRing(pointList);
  15336. } else {
  15337. return new LineString(pointList);
  15338. }
  15339. } else {
  15340. let lineList = [];
  15341. for (let i = 0; i < len; i++) {
  15342. let pointList = [];
  15343. for (let j = 0; j < geoParts[i]; j++) {
  15344. pointList.push(new Point(geoPoints[j].x, geoPoints[j].y));
  15345. }
  15346. lineList.push(new LineString(pointList));
  15347. geoPoints.splice(0, geoParts[i]);
  15348. }
  15349. return new MultiLineString(lineList);
  15350. }
  15351. } else {
  15352. return null;
  15353. }
  15354. }
  15355. /**
  15356. * @function ServerGeometry.prototype.toGeoLineEPS
  15357. * @description 将服务端的线几何对象转换为客户端几何对象。包括 GeometryLinearRing、GeometryLineString、GeometryMultiLineString。
  15358. * @returns {Geometry} 转换后的客户端几何对象。
  15359. */
  15360. toGeoLineEPS() {
  15361. var me = this,
  15362. geoParts = me.parts || [],
  15363. geoPoints = me.points || [],
  15364. i,
  15365. j,
  15366. pointList,
  15367. lineList,
  15368. lineEPS,
  15369. len = geoParts.length;
  15370. if (len > 0) {
  15371. if (len === 1) {
  15372. for (i = 0, pointList = []; i < geoParts[0]; i++) {
  15373. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y, geoPoints[i].type));
  15374. }
  15375. //判断线是否闭合,如果闭合,则返回LinearRing,否则返回LineString
  15376. if (pointList[0].equals(pointList[geoParts[0] - 1])) {
  15377. lineEPS = LineString.createLineEPS(pointList);
  15378. return new LinearRing_LinearRing(lineEPS);
  15379. } else {
  15380. lineEPS = LineString.createLineEPS(pointList);
  15381. return new LineString(lineEPS);
  15382. }
  15383. } else {
  15384. for (i = 0, lineList = []; i < len; i++) {
  15385. for (j = 0, pointList = []; j < geoParts[i]; j++) {
  15386. pointList.push(new Point(geoPoints[j].x, geoPoints[j].y));
  15387. }
  15388. lineEPS = LineString.createLineEPS(pointList);
  15389. lineList.push(new LineString(lineEPS));
  15390. geoPoints.splice(0, geoParts[i]);
  15391. }
  15392. return new MultiLineString(lineList);
  15393. }
  15394. } else {
  15395. return null;
  15396. }
  15397. }
  15398. /**
  15399. * @function ServerGeometry.prototype.toGeoLinem
  15400. * @description 将服务端的路由线几何对象转换为客户端几何对象。包括 LinearRing、LineString、MultiLineString。
  15401. * @returns {Geometry} 转换后的客户端几何对象。
  15402. */
  15403. toGeoLinem() {
  15404. var me = this;
  15405. return Route.fromJson(me);
  15406. }
  15407. /**
  15408. * @function ServerGeometry.prototype.toGeoRegion
  15409. * @description 将服务端的面几何对象转换为客户端几何对象。类型为 GeometryPolygon。
  15410. * @returns {Geometry} 转换后的客户端几何对象。
  15411. */
  15412. toGeoRegion() {
  15413. var me = this,
  15414. geoParts = me.parts || [],
  15415. geoTopo = me.partTopo || [],
  15416. geoPoints = me.points || [],
  15417. len = geoParts.length;
  15418. if (len <= 0) {
  15419. return null;
  15420. }
  15421. var polygonArray = [];
  15422. var pointList = [];
  15423. if (len == 1) {
  15424. for (let i = 0; i < geoPoints.length; i++) {
  15425. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y));
  15426. }
  15427. polygonArray.push(new Polygon_Polygon([new LinearRing_LinearRing(pointList)]));
  15428. return new MultiPolygon(polygonArray);
  15429. }
  15430. //处理复杂面
  15431. var CCWArray = [];
  15432. var areaArray = [];
  15433. var polygonArrayTemp = [];
  15434. var polygonBounds = [];
  15435. //polyon岛洞标识数组,初始都是岛。
  15436. var CCWIdent = [];
  15437. for (let i = 0, pointIndex = 0; i < len; i++) {
  15438. for (let j = 0; j < geoParts[i]; j++) {
  15439. pointList.push(new Point(geoPoints[pointIndex + j].x, geoPoints[pointIndex + j].y));
  15440. }
  15441. pointIndex += geoParts[i];
  15442. var polygon = new Polygon_Polygon([new LinearRing_LinearRing(pointList)]);
  15443. pointList = [];
  15444. polygonArrayTemp.push(polygon);
  15445. if (geoTopo.length === 0) {
  15446. polygonBounds.push(polygon.getBounds());
  15447. }
  15448. CCWIdent.push(1);
  15449. areaArray.push(polygon.getArea());
  15450. }
  15451. //iServer 9D新增字段
  15452. if (geoTopo.length === 0) {
  15453. //根据面积排序
  15454. ServerGeometry.bubbleSort(areaArray, polygonArrayTemp, geoTopo, polygonBounds);
  15455. //岛洞底层判断原则:将所有的子对象按照面积排序,面积最大的直接判定为岛(1),从面积次大的开始处理,
  15456. // 如果发现该对象在某个面积大于它的对象之中(即被包含),则根据包含它的对象的标识(1 or -1),指定其标识(-1 or 1),
  15457. // 依次处理完所有对象,就得到了一个标识数组,1表示岛,-1表示洞
  15458. //目标polygon索引列表 -1标示没有被任何polygon包含,
  15459. var targetArray = [];
  15460. for (let i = 1; i < polygonArrayTemp.length; i++) {
  15461. for (let j = i - 1; j >= 0; j--) {
  15462. targetArray[i] = -1;
  15463. if (polygonBounds[j].containsBounds(polygonBounds[i])) {
  15464. CCWIdent[i] = CCWIdent[j] * -1;
  15465. if (CCWIdent[i] < 0) {
  15466. targetArray[i] = j;
  15467. }
  15468. break;
  15469. }
  15470. }
  15471. }
  15472. for (let i = 0; i < polygonArrayTemp.length; i++) {
  15473. if (CCWIdent[i] > 0) {
  15474. polygonArray.push(polygonArrayTemp[i]);
  15475. } else {
  15476. polygonArray[targetArray[i]].components = polygonArray[targetArray[i]].components.concat(
  15477. polygonArrayTemp[i].components
  15478. );
  15479. //占位
  15480. polygonArray.push('');
  15481. }
  15482. }
  15483. } else {
  15484. polygonArray = new Array();
  15485. for (let i = 0; i < polygonArrayTemp.length; i++) {
  15486. if (geoTopo[i] && geoTopo[i] == -1) {
  15487. CCWArray = CCWArray.concat(polygonArrayTemp[i].components);
  15488. } else {
  15489. if (CCWArray.length > 0 && polygonArray.length > 0) {
  15490. polygonArray[polygonArray.length - 1].components =
  15491. polygonArray[polygonArray.length - 1].components.concat(CCWArray);
  15492. CCWArray = [];
  15493. }
  15494. polygonArray.push(polygonArrayTemp[i]);
  15495. }
  15496. if (i == len - 1) {
  15497. var polyLength = polygonArray.length;
  15498. if (polyLength) {
  15499. polygonArray[polyLength - 1].components =
  15500. polygonArray[polyLength - 1].components.concat(CCWArray);
  15501. } else {
  15502. for (let k = 0, length = CCWArray.length; k < length; k++) {
  15503. polygonArray.push(new Polygon_Polygon(CCWArray));
  15504. }
  15505. }
  15506. }
  15507. }
  15508. }
  15509. return new MultiPolygon(polygonArray);
  15510. }
  15511. /**
  15512. * @function ServerGeometry.prototype.toGeoRegionEPS
  15513. * @description 将服务端的面几何对象转换为客户端几何对象。类型为 Polygon。
  15514. * @returns {Geometry} 转换后的客户端几何对象。
  15515. */
  15516. toGeoRegionEPS() {
  15517. var me = this,
  15518. geoParts = me.parts || [],
  15519. geoTopo = me.partTopo || [],
  15520. geoPoints = me.points || [],
  15521. len = geoParts.length;
  15522. if (len <= 0) {
  15523. return null;
  15524. }
  15525. var polygonArray = [];
  15526. var pointList = [];
  15527. var lineEPS;
  15528. if (len == 1) {
  15529. for (var i = 0; i < geoPoints.length; i++) {
  15530. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y));
  15531. }
  15532. lineEPS = LineString.createLineEPS(pointList);
  15533. polygonArray.push(new Polygon_Polygon([new LinearRing_LinearRing(lineEPS)]));
  15534. return new MultiPolygon(polygonArray);
  15535. }
  15536. //处理复杂面
  15537. var CCWArray = [];
  15538. var areaArray = [];
  15539. var polygonArrayTemp = [];
  15540. var polygonBounds = [];
  15541. //polyon岛洞标识数组,初始都是岛。
  15542. var CCWIdent = [];
  15543. for (let i = 0, pointIndex = 0; i < len; i++) {
  15544. for (let j = 0; j < geoParts[i]; j++) {
  15545. pointList.push(new Point(geoPoints[pointIndex + j].x, geoPoints[pointIndex + j].y));
  15546. }
  15547. pointIndex += geoParts[i];
  15548. lineEPS = LineString.createLineEPS(pointList);
  15549. var polygon = new Polygon_Polygon([new LinearRing_LinearRing(lineEPS)]);
  15550. pointList = [];
  15551. polygonArrayTemp.push(polygon);
  15552. if (geoTopo.length === 0) {
  15553. polygonBounds.push(polygon.getBounds());
  15554. }
  15555. CCWIdent.push(1);
  15556. areaArray.push(polygon.getArea());
  15557. }
  15558. //iServer 9D新增字段
  15559. if (geoTopo.length === 0) {
  15560. //根据面积排序
  15561. ServerGeometry.bubbleSort(areaArray, polygonArrayTemp, geoTopo, polygonBounds);
  15562. //岛洞底层判断原则:将所有的子对象按照面积排序,面积最大的直接判定为岛(1),从面积次大的开始处理,
  15563. // 如果发现该对象在某个面积大于它的对象之中(即被包含),则根据包含它的对象的标识(1 or -1),指定其标识(-1 or 1),
  15564. // 依次处理完所有对象,就得到了一个标识数组,1表示岛,-1表示洞
  15565. //目标polygon索引列表 -1标示没有被任何polygon包含,
  15566. var targetArray = [];
  15567. for (let i = 1; i < polygonArrayTemp.length; i++) {
  15568. for (let j = i - 1; j >= 0; j--) {
  15569. targetArray[i] = -1;
  15570. if (polygonBounds[j].containsBounds(polygonBounds[i])) {
  15571. CCWIdent[i] = CCWIdent[j] * -1;
  15572. if (CCWIdent[i] < 0) {
  15573. targetArray[i] = j;
  15574. }
  15575. break;
  15576. }
  15577. }
  15578. }
  15579. for (let i = 0; i < polygonArrayTemp.length; i++) {
  15580. if (CCWIdent[i] > 0) {
  15581. polygonArray.push(polygonArrayTemp[i]);
  15582. } else {
  15583. polygonArray[targetArray[i]].components = polygonArray[targetArray[i]].components.concat(
  15584. polygonArrayTemp[i].components
  15585. );
  15586. //占位
  15587. polygonArray.push('');
  15588. }
  15589. }
  15590. } else {
  15591. polygonArray = new Array();
  15592. for (let i = 0; i < polygonArrayTemp.length; i++) {
  15593. if (geoTopo[i] && geoTopo[i] == -1) {
  15594. CCWArray = CCWArray.concat(polygonArrayTemp[i].components);
  15595. } else {
  15596. if (CCWArray.length > 0 && polygonArray.length > 0) {
  15597. polygonArray[polygonArray.length - 1].components =
  15598. polygonArray[polygonArray.length - 1].components.concat(CCWArray);
  15599. CCWArray = [];
  15600. }
  15601. polygonArray.push(polygonArrayTemp[i]);
  15602. }
  15603. if (i == len - 1) {
  15604. var polyLength = polygonArray.length;
  15605. if (polyLength) {
  15606. polygonArray[polyLength - 1].components =
  15607. polygonArray[polyLength - 1].components.concat(CCWArray);
  15608. } else {
  15609. for (let k = 0, length = CCWArray.length; k < length; k++) {
  15610. polygonArray.push(new Polygon_Polygon(CCWArray));
  15611. }
  15612. }
  15613. }
  15614. }
  15615. }
  15616. return new MultiPolygon(polygonArray);
  15617. }
  15618. transformGeoCompound() {
  15619. const me = this,
  15620. geoParts = me.geoParts || [],
  15621. len = geoParts.length;
  15622. if (len <= 0) {
  15623. return null;
  15624. }
  15625. const geometryList = [];
  15626. for (let index = 0; index < len; index++) {
  15627. const geometry = geoParts[index];
  15628. geometryList.push(new ServerGeometry(geometry).toGeometry());
  15629. }
  15630. return new Collection(geometryList);
  15631. }
  15632. /**
  15633. * @function ServerGeometry.prototype.fromJson
  15634. * @description 将 JSON 对象表示服务端几何对象转换为 ServerGeometry。
  15635. * @param {Object} jsonObject - 要转换的 JSON 对象。
  15636. * @returns {ServerGeometry} 转换后的 ServerGeometry 对象。
  15637. */
  15638. static fromJson(jsonObject) {
  15639. if (!jsonObject) {
  15640. return;
  15641. }
  15642. return new ServerGeometry({
  15643. id: jsonObject.id,
  15644. style: ServerStyle.fromJson(jsonObject.style),
  15645. parts: jsonObject.parts,
  15646. partTopo: jsonObject.partTopo,
  15647. points: jsonObject.points,
  15648. center: jsonObject.center,
  15649. length: jsonObject.length,
  15650. maxM: jsonObject.maxM,
  15651. minM: jsonObject.minM,
  15652. type: jsonObject.type
  15653. });
  15654. }
  15655. /**
  15656. * @function ServerGeometry.prototype.fromGeometry
  15657. * @description 将客户端 Geometry 转换成服务端 ServerGeometry。
  15658. * @param {Geometry} geometry - 要转换的客户端 Geometry 对象。
  15659. * @returns {ServerGeometry} 转换后的 ServerGeometry 对象。
  15660. */
  15661. static fromGeometry(geometry) {
  15662. if (!geometry) {
  15663. return;
  15664. }
  15665. var id = 0,
  15666. parts = [],
  15667. points = [],
  15668. type = null,
  15669. icomponents = geometry.components,
  15670. className = geometry.CLASS_NAME,
  15671. prjCoordSys = { epsgCode: geometry.SRID };
  15672. if (!isNaN(geometry.id)) {
  15673. id = geometry.id;
  15674. }
  15675. //坑爹的改法,没法,为了支持态势标绘,有时间就得全改
  15676. if (
  15677. className != 'SuperMap.Geometry.LinearRing' &&
  15678. className != 'SuperMap.Geometry.LineString' &&
  15679. (geometry instanceof MultiPoint || geometry instanceof MultiLineString)
  15680. ) {
  15681. let ilen = icomponents.length;
  15682. for (let i = 0; i < ilen; i++) {
  15683. const vertices = icomponents[i].getVertices();
  15684. let partPointsCount = vertices.length;
  15685. parts.push(partPointsCount);
  15686. for (let j = 0; j < partPointsCount; j++) {
  15687. points.push(new Point(vertices[j].x, vertices[j].y));
  15688. }
  15689. }
  15690. //这里className不是多点就全部是算线
  15691. type = className == 'SuperMap.Geometry.MultiPoint' ? REST_GeometryType.POINT : REST_GeometryType.LINE;
  15692. } else if (geometry instanceof MultiPolygon) {
  15693. let ilen = icomponents.length;
  15694. for (let i = 0; i < ilen; i++) {
  15695. let polygon = icomponents[i],
  15696. linearRingOfPolygon = polygon.components,
  15697. linearRingOfPolygonLen = linearRingOfPolygon.length;
  15698. for (let j = 0; j < linearRingOfPolygonLen; j++) {
  15699. const vertices = linearRingOfPolygon[j].getVertices();
  15700. const partPointsCount = vertices.length + 1;
  15701. parts.push(partPointsCount);
  15702. for (let k = 0; k < partPointsCount - 1; k++) {
  15703. points.push(new Point(vertices[k].x, vertices[k].y));
  15704. }
  15705. points.push(
  15706. new Point(vertices[0].x, vertices[0].y)
  15707. );
  15708. }
  15709. }
  15710. type = REST_GeometryType.REGION;
  15711. } else if (geometry instanceof Polygon_Polygon) {
  15712. let ilen = icomponents.length;
  15713. for (let i = 0; i < ilen; i++) {
  15714. const vertices = icomponents[i].getVertices();
  15715. let partPointsCount = vertices.length + 1;
  15716. parts.push(partPointsCount);
  15717. for (let j = 0; j < partPointsCount - 1; j++) {
  15718. points.push(new Point(vertices[j].x, vertices[j].y));
  15719. }
  15720. points.push(new Point(vertices[0].x, vertices[0].y));
  15721. }
  15722. type = REST_GeometryType.REGION;
  15723. } else {
  15724. const vertices = geometry.getVertices();
  15725. let geometryVerticesCount = vertices.length;
  15726. for (let j = 0; j < geometryVerticesCount; j++) {
  15727. points.push(new Point(vertices[j].x, vertices[j].y));
  15728. }
  15729. if (geometry instanceof LinearRing_LinearRing) {
  15730. points.push(new Point(vertices[0].x, vertices[0].y));
  15731. geometryVerticesCount++;
  15732. }
  15733. parts.push(geometryVerticesCount);
  15734. type = geometry instanceof Point ? REST_GeometryType.POINT : REST_GeometryType.LINE;
  15735. }
  15736. return new ServerGeometry({
  15737. id: id,
  15738. style: null,
  15739. parts: parts,
  15740. points: points,
  15741. type: type,
  15742. prjCoordSys: prjCoordSys
  15743. });
  15744. }
  15745. /**
  15746. * @function ServerGeometry.prototype.IsClockWise
  15747. * @description 判断 linearRing 中的点的顺序。返回值大于 0,逆时针;小于 0,顺时针。
  15748. * @param {Geometry} geometry - 要转换的客户端 Geometry 对象。
  15749. * @returns {number} 返回值大于 0,逆时针;小于 0,顺时针。
  15750. */
  15751. static IsClockWise(points) {
  15752. var length = points.length;
  15753. if (length < 3) {
  15754. return 0.0;
  15755. }
  15756. var s = points[0].y * (points[length - 1].x - points[1].x);
  15757. points.push(points[0]);
  15758. for (var i = 1; i < length; i++) {
  15759. s += points[i].y * (points[i - 1].x - points[i + 1].x);
  15760. }
  15761. return s * 0.5;
  15762. }
  15763. static bubbleSort(areaArray, pointList, geoTopo, polygonBounds) {
  15764. for (var i = 0; i < areaArray.length; i++) {
  15765. for (var j = 0; j < areaArray.length; j++) {
  15766. if (areaArray[i] > areaArray[j]) {
  15767. var d = areaArray[j];
  15768. areaArray[j] = areaArray[i];
  15769. areaArray[i] = d;
  15770. var b = pointList[j];
  15771. pointList[j] = pointList[i];
  15772. pointList[i] = b;
  15773. if (geoTopo && geoTopo.length > 0) {
  15774. var c = geoTopo[j];
  15775. geoTopo[j] = geoTopo[i];
  15776. geoTopo[i] = c;
  15777. }
  15778. if (polygonBounds && polygonBounds.length > 0) {
  15779. var f = polygonBounds[j];
  15780. polygonBounds[j] = polygonBounds[i];
  15781. polygonBounds[i] = f;
  15782. }
  15783. }
  15784. }
  15785. }
  15786. }
  15787. }
  15788. ;// CONCATENATED MODULE: ./src/common/format/GeoJSON.js
  15789. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  15790. * This program are made available under the terms of the Apache License, Version 2.0
  15791. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15792. /**
  15793. * @class GeoJSONFormat
  15794. * @aliasclass Format.GeoJSON
  15795. * @deprecatedclass SuperMap.Format.GeoJSON
  15796. * @classdesc GeoJSON 的读和写。使用 {@link GeoJSONObject} 构造器创建一个 GeoJSON 解析器。
  15797. * @category BaseTypes Format
  15798. * @param {Object} [options] - 可选参数。
  15799. * @param {string} [options.indent=" "] - 用于格式化输出,indent 字符串会在每次缩进的时候使用一次。
  15800. * @param {string} [options.space=" "] - 用于格式化输出,space 字符串会在名值对的 ":" 后边添加。
  15801. * @param {string} [options.newline="\n"] - 用于格式化输出, newline 字符串会用在每一个名值对或数组项末尾。
  15802. * @param {number} [options.level=0] - 用于格式化输出, 表示的是缩进级别。
  15803. * @param {boolean} [options.pretty=false] - 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  15804. * @param {boolean} [options.nativeJSON] - 需要被注册的监听器对象。
  15805. * @param {boolean} [options.ignoreExtraDims=true] - 忽略维度超过 2 的几何要素。
  15806. * @extends {JSONFormat}
  15807. * @usage
  15808. */
  15809. class GeoJSON extends JSONFormat {
  15810. constructor(options) {
  15811. super(options);
  15812. /**
  15813. * @member {boolean} [GeoJSONFormat.prototype.ignoreExtraDims=true]
  15814. * @description 忽略维度超过 2 的几何要素。
  15815. */
  15816. this.ignoreExtraDims = true;
  15817. this.CLASS_NAME = "SuperMap.Format.GeoJSON";
  15818. /**
  15819. * @member {Object} GeoJSONFormat.prototype.parseCoords
  15820. * @private
  15821. * @description 一个属性名对应着 GeoJSON 对象的几何类型的对象。每个属性其实都是一个实际上做解析用的方法。
  15822. */
  15823. this.parseCoords = {
  15824. /**
  15825. * @function GeoJSONFormat.parseCoords.point
  15826. * @description 将一组坐标转成一个 {@link Geometry} 对象。
  15827. * @param {Object} array - GeoJSON 片段中的一组坐标。
  15828. * @returns {Geometry} 一个几何对象。
  15829. */
  15830. "point": function (array) {
  15831. if (this.ignoreExtraDims === false &&
  15832. array.length != 2) {
  15833. throw "Only 2D points are supported: " + array;
  15834. }
  15835. return new Point(array[0], array[1]);
  15836. },
  15837. /**
  15838. * @function GeoJSONFormat.parseCoords.multipoint
  15839. * @description 将坐标组数组转化成为一个 {@link Geometry} 对象。
  15840. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  15841. * @returns {Geometry} 一个几何对象。
  15842. */
  15843. "multipoint": function (array) {
  15844. var points = [];
  15845. var p = null;
  15846. for (var i = 0, len = array.length; i < len; ++i) {
  15847. try {
  15848. p = this.parseCoords["point"].apply(this, [array[i]]);
  15849. } catch (err) {
  15850. throw err;
  15851. }
  15852. points.push(p);
  15853. }
  15854. return new MultiPoint(points);
  15855. },
  15856. /**
  15857. * @function GeoJSONFormat.parseCoords.linestring
  15858. * @description 将坐标组数组转化成为一个 {@link Geometry} 对象。
  15859. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  15860. * @returns {Geometry} 一个几何对象。
  15861. */
  15862. "linestring": function (array) {
  15863. var points = [];
  15864. var p = null;
  15865. for (var i = 0, len = array.length; i < len; ++i) {
  15866. try {
  15867. p = this.parseCoords["point"].apply(this, [array[i]]);
  15868. } catch (err) {
  15869. throw err;
  15870. }
  15871. points.push(p);
  15872. }
  15873. return new LineString(points);
  15874. },
  15875. /**
  15876. * @function GeoJSONFormat.parseCoords.multilinestring
  15877. * @description 将坐标组数组转化成为一个 {@link Geometry} 对象。
  15878. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  15879. * @returns {Geometry} 一个几何对象。
  15880. */
  15881. "multilinestring": function (array) {
  15882. var lines = [];
  15883. var l = null;
  15884. for (var i = 0, len = array.length; i < len; ++i) {
  15885. try {
  15886. l = this.parseCoords["linestring"].apply(this, [array[i]]);
  15887. } catch (err) {
  15888. throw err;
  15889. }
  15890. lines.push(l);
  15891. }
  15892. return new MultiLineString(lines);
  15893. },
  15894. /**
  15895. * @function GeoJSONFormat.parseCoords.polygon
  15896. * @description 将坐标组数组转化成为一个 {@link Geometry} 对象。
  15897. * @returns {Geometry} 一个几何对象。
  15898. */
  15899. "polygon": function (array) {
  15900. var rings = [];
  15901. var r, l;
  15902. for (var i = 0, len = array.length; i < len; ++i) {
  15903. try {
  15904. l = this.parseCoords["linestring"].apply(this, [array[i]]);
  15905. } catch (err) {
  15906. throw err;
  15907. }
  15908. r = new LinearRing_LinearRing(l.components);
  15909. rings.push(r);
  15910. }
  15911. return new Polygon_Polygon(rings);
  15912. },
  15913. /**
  15914. * @function GeoJSONFormat.parseCoords.multipolygon
  15915. * @description 将坐标组数组转化成为一个 {@link Geometry} 对象。
  15916. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  15917. * @returns {Geometry} 一个几何对象。
  15918. */
  15919. "multipolygon": function (array) {
  15920. var polys = [];
  15921. var p = null;
  15922. for (var i = 0, len = array.length; i < len; ++i) {
  15923. try {
  15924. p = this.parseCoords["polygon"].apply(this, [array[i]]);
  15925. } catch (err) {
  15926. throw err;
  15927. }
  15928. polys.push(p);
  15929. }
  15930. return new MultiPolygon(polys);
  15931. },
  15932. /**
  15933. * @function GeoJSONFormat.parseCoords.box
  15934. * @description 将坐标组数组转化成为一个 {@link Geometry} 对象。
  15935. * @param {Array} array - GeoJSON 片段中的坐标组数组。
  15936. * @returns {Geometry} 一个几何对象。
  15937. */
  15938. "box": function (array) {
  15939. if (array.length != 2) {
  15940. throw "GeoJSON box coordinates must have 2 elements";
  15941. }
  15942. return new Polygon_Polygon([
  15943. new LinearRing_LinearRing([
  15944. new Point(array[0][0], array[0][1]),
  15945. new Point(array[1][0], array[0][1]),
  15946. new Point(array[1][0], array[1][1]),
  15947. new Point(array[0][0], array[1][1]),
  15948. new Point(array[0][0], array[0][1])
  15949. ])
  15950. ]);
  15951. }
  15952. };
  15953. /**
  15954. * @member {Object} GeoJSONFormat.prototype.extract
  15955. * @private
  15956. * @description 一个属性名对应着GeoJSON类型的对象。其值为相应的实际的解析方法。
  15957. */
  15958. this.extract = {
  15959. /**
  15960. * @function GeoJSONFormat.extract.feature
  15961. * @description 返回一个表示单个要素对象的 GeoJSON 的一部分。
  15962. * @param {SuperMap.ServerFeature} feature - iServer 要素对象。
  15963. * @returns {Object} 一个表示点的对象。
  15964. */
  15965. 'feature': function (feature) {
  15966. var geom = this.extract.geometry.apply(this, [feature.geometry]);
  15967. var json = {
  15968. "type": "Feature",
  15969. "properties": this.createAttributes(feature),
  15970. "geometry": geom
  15971. };
  15972. if (feature.geometry && feature.geometry.type === 'TEXT') {
  15973. json.properties.texts = feature.geometry.texts;
  15974. json.properties.textStyle = feature.geometry.textStyle;
  15975. }
  15976. if (feature.fid) {
  15977. json.id = feature.fid;
  15978. }
  15979. if (feature.ID) {
  15980. json.id = feature.ID;
  15981. }
  15982. return json;
  15983. },
  15984. /**
  15985. * @function GeoJSONFormat.extract.geometry
  15986. * @description 返回一个表示单个几何对象的 GeoJSON 的一部分。
  15987. * @param {Object} geometry - iServer 几何对象。
  15988. * @returns {Object} 一个表示几何体的对象。
  15989. */
  15990. 'geometry': function (geometry) {
  15991. if (geometry == null) {
  15992. return null;
  15993. }
  15994. if (!geometry.parts && geometry.points) {
  15995. geometry.parts = [geometry.points.length];
  15996. }
  15997. var geo = geometry.hasOwnProperty('geometryType')
  15998. ? geometry
  15999. : new ServerGeometry(geometry).toGeometry() || geometry;
  16000. var geometryType = geo.geometryType || geo.type;
  16001. var data;
  16002. if (geometryType === "LinearRing") {
  16003. geometryType = "LineString";
  16004. }
  16005. if (geometryType === "LINEM") {
  16006. geometryType = "MultiLineString";
  16007. }
  16008. data = this.extract[geometryType.toLowerCase()].apply(this, [geo]);
  16009. geometryType = geometryType === 'TEXT' ? 'Point' : geometryType;
  16010. var json;
  16011. if (geometryType === "Collection") {
  16012. json = {
  16013. "type": "GeometryCollection",
  16014. "geometries": data
  16015. };
  16016. } else {
  16017. json = {
  16018. "type": geometryType,
  16019. "coordinates": data
  16020. };
  16021. }
  16022. return json;
  16023. },
  16024. /**
  16025. * @function GeoJSONFormat.extract.point
  16026. * @description 从一个点对象中返回一个坐标组。
  16027. * @param {GeometryPoint} point - 一个点对象。
  16028. * @returns {Array} 一个表示一个点的坐标组。
  16029. */
  16030. 'point': function (point) {
  16031. var p = [point.x, point.y];
  16032. for (var name in point) {
  16033. if (name !== "x" && name !== "y" && point[name] !== null && !isNaN(point[name])) {
  16034. p.push(point[name]);
  16035. }
  16036. }
  16037. return p;
  16038. },
  16039. /**
  16040. * @function GeoJSONFormat.extract.point
  16041. * @description 从一个文本对象中返回一个坐标组。
  16042. * @param {Object} geo - 一个文本对象。
  16043. * @returns {Array} 一个表示一个点的坐标组。
  16044. */
  16045. 'text': function (geo) {
  16046. return [geo.points[0].x, geo.points[0].y];
  16047. },
  16048. /**
  16049. * @function GeoJSONFormat.extract.multipoint
  16050. * @description 从一个多点对象中返一个坐标组数组。
  16051. * @param {GeometryMultiPoint} multipoint - 多点对象。
  16052. * @returns {Array} 一个表示多点的坐标组数组。
  16053. */
  16054. 'multipoint': function (multipoint) {
  16055. var array = [];
  16056. for (var i = 0, len = multipoint.components.length; i < len; ++i) {
  16057. array.push(this.extract.point.apply(this, [multipoint.components[i]]));
  16058. }
  16059. return array;
  16060. },
  16061. /**
  16062. * @function GeoJSONFormat.extract.linestring
  16063. * @description 从一个线对象中返回一个坐标组数组。
  16064. * @param {Linestring} linestring - 线对象。
  16065. * @returns {Array} 一个表示线对象的坐标组数组。
  16066. */
  16067. 'linestring': function (linestring) {
  16068. var array = [];
  16069. for (var i = 0, len = linestring.components.length; i < len; ++i) {
  16070. array.push(this.extract.point.apply(this, [linestring.components[i]]));
  16071. }
  16072. return array;
  16073. },
  16074. /**
  16075. * @function GeoJSONFormat.extract.multilinestring
  16076. * @description 从一个多线对象中返回一个线数组。
  16077. * @param {GeometryMultiLineString} multilinestring - 多线对象。
  16078. *
  16079. * @returns {Array} 一个表示多线的线数组。
  16080. */
  16081. 'multilinestring': function (multilinestring) {
  16082. var array = [];
  16083. for (var i = 0, len = multilinestring.components.length; i < len; ++i) {
  16084. array.push(this.extract.linestring.apply(this, [multilinestring.components[i]]));
  16085. }
  16086. return array;
  16087. },
  16088. /**
  16089. * @function GeoJSONFormat.extract.polygon
  16090. * @description 从一个面对象中返回一组线环。
  16091. * @param {GeometryPolygon} polygon - 面对象。
  16092. * @returns {Array} 一组表示面的线环。
  16093. */
  16094. 'polygon': function (polygon) {
  16095. var array = [];
  16096. for (var i = 0, len = polygon.components.length; i < len; ++i) {
  16097. array.push(this.extract.linestring.apply(this, [polygon.components[i]]));
  16098. }
  16099. return array;
  16100. },
  16101. /**
  16102. * @function GeoJSONFormat.extract.multipolygon
  16103. * @description 从一个多面对象中返回一组面。
  16104. * @param {GeometryMultiPolygon} multipolygon - 多面对象。
  16105. * @returns {Array} 一组表示多面的面。
  16106. */
  16107. 'multipolygon': function (multipolygon) {
  16108. var array = [];
  16109. for (var i = 0, len = multipolygon.components.length; i < len; ++i) {
  16110. array.push(this.extract.polygon.apply(this, [multipolygon.components[i]]));
  16111. }
  16112. return array;
  16113. },
  16114. /**
  16115. * @function GeoJSONFormat.extract.collection
  16116. * @description 从一个几何要素集合中一组几何要素数组。
  16117. * @param {GeometryCollection} collection - 几何要素集合。
  16118. * @returns {Array} 一组表示几何要素集合的几何要素数组。
  16119. */
  16120. 'collection': function (collection) {
  16121. var len = collection.components.length;
  16122. var array = new Array(len);
  16123. for (var i = 0; i < len; ++i) {
  16124. array[i] = this.extract.geometry.apply(this, [collection.components[i]]);
  16125. }
  16126. return array;
  16127. }
  16128. };
  16129. }
  16130. /**
  16131. * @function GeoJSONFormat.prototype.read
  16132. * @description 将 GeoJSON 对象或者GeoJSON 对象字符串转换为 SuperMap Feature 对象。
  16133. * @param {GeoJSONObject} json - GeoJSON 对象。
  16134. * @param {string} [type='FeaureCollection'] - 可选的字符串,它决定了输出的格式。支持的值有:"Geometry","Feature",和 "FeatureCollection",如果此值为null。
  16135. * @param {function} filter - 对象中每个层次每个键值对都会调用此函数得出一个结果。每个值都会被 filter 函数的结果所替换掉。这个函数可被用来将某些对象转化成某个类相应的对象,或者将日期字符串转化成Date对象。
  16136. * @returns {Object} 返回值依赖于 type 参数的值。
  16137. * -如果 type 等于 "FeatureCollection",返回值将会是 {@link FeatureVector} 数组。
  16138. * -如果 type 为 "Geometry",输入的 JSON 对象必须表示一个唯一的几何体,然后返回值就会是 {@link Geometry}。
  16139. * -如果 type 为 "Feature",输入的 JSON 对象也必须表示的一个要素,这样返回值才会是 {@link FeatureVector}。
  16140. */
  16141. read(json, type, filter) {
  16142. type = (type) ? type : "FeatureCollection";
  16143. var results = null;
  16144. var obj = null;
  16145. if (typeof json == "string") {
  16146. obj = super.read(json, filter);
  16147. } else {
  16148. obj = json;
  16149. }
  16150. if (!obj) {
  16151. //console.error("Bad JSON: " + json);
  16152. } else if (typeof (obj.type) != "string") {
  16153. //console.error("Bad GeoJSON - no type: " + json);
  16154. } else if (this.isValidType(obj, type)) {
  16155. switch (type) {
  16156. case "Geometry":
  16157. try {
  16158. results = this.parseGeometry(obj);
  16159. } catch (err) {
  16160. //console.error(err);
  16161. }
  16162. break;
  16163. case "Feature":
  16164. try {
  16165. results = this.parseFeature(obj);
  16166. results.type = "Feature";
  16167. } catch (err) {
  16168. //console.error(err);
  16169. }
  16170. break;
  16171. case "FeatureCollection":
  16172. // for type FeatureCollection, we allow input to be any type
  16173. results = [];
  16174. switch (obj.type) {
  16175. case "Feature":
  16176. try {
  16177. results.push(this.parseFeature(obj));
  16178. } catch (err) {
  16179. results = null;
  16180. //console.error(err);
  16181. }
  16182. break;
  16183. case "FeatureCollection":
  16184. for (var i = 0, len = obj.features.length; i < len; ++i) {
  16185. try {
  16186. results.push(this.parseFeature(obj.features[i]));
  16187. } catch (err) {
  16188. results = null;
  16189. // console.error(err);
  16190. }
  16191. }
  16192. break;
  16193. default:
  16194. try {
  16195. var geom = this.parseGeometry(obj);
  16196. results.push(new Vector(geom));
  16197. } catch (err) {
  16198. results = null;
  16199. //console.error(err);
  16200. }
  16201. }
  16202. break;
  16203. default:
  16204. break;
  16205. }
  16206. }
  16207. return results;
  16208. }
  16209. /**
  16210. * @function GeoJSONFormat.prototype.write
  16211. * @description iServer Geometry JSON 对象 转 GeoJSON对象字符串。
  16212. * @param {Object} obj - iServer Geometry JSON 对象。
  16213. * @param {boolean} [pretty=false] - 是否使用换行和缩进来控制输出。
  16214. * @returns {GeoJSONObject} 一个 GeoJSON 字符串,它表示了输入的几何对象,要素对象,或者要素对象数组。
  16215. */
  16216. write(obj, pretty) {
  16217. return super.write(this.toGeoJSON(obj), pretty);
  16218. }
  16219. /**
  16220. * @function GeoJSONFormat.prototype.fromGeoJSON
  16221. * @version 9.1.1
  16222. * @description 将 GeoJSON 对象或者GeoJSON 对象字符串转换为iServer Feature JSON。
  16223. * @param {GeoJSONObject} json - GeoJSON 对象。
  16224. * @param {string} [type='FeaureCollection'] - 可选的字符串,它决定了输出的格式。支持的值有:"Geometry","Feature",和 "FeatureCollection",如果此值为null。
  16225. * @param {function} filter - 对象中每个层次每个键值对都会调用此函数得出一个结果。每个值都会被 filter 函数的结果所替换掉。这个函数可被用来将某些对象转化成某个类相应的对象,或者将日期字符串转化成Date对象。
  16226. * @returns {Object} iServer Feature JSON。
  16227. */
  16228. fromGeoJSON(json, type, filter) {
  16229. let feature = this.read(json, type, filter);
  16230. if (!Util_Util.isArray(feature)) {
  16231. return this._toiSevrerFeature(feature);
  16232. }
  16233. return feature.map((element) => {
  16234. return this._toiSevrerFeature(element);
  16235. })
  16236. }
  16237. /**
  16238. * @function GeoJSONFormat.prototype.toGeoJSON
  16239. * @version 9.1.1
  16240. * @description 将 iServer Feature JSON 对象转换为 GeoJSON 对象。
  16241. * @param {Object} obj - iServer Feature JSON。
  16242. * @returns {GeoJSONObject} GeoJSON 对象。
  16243. */
  16244. toGeoJSON(obj) {
  16245. var geojson = {
  16246. "type": null
  16247. };
  16248. if (Util_Util.isArray(obj)) {
  16249. geojson.type = "FeatureCollection";
  16250. var numFeatures = obj.length;
  16251. geojson.features = new Array(numFeatures);
  16252. for (var i = 0; i < numFeatures; ++i) {
  16253. var element = obj[i];
  16254. if (isGeometry(element)) {
  16255. let feature = {};
  16256. feature.geometry = element;
  16257. geojson.features[i] = this.extract.feature.apply(this, [feature]);
  16258. } else {
  16259. geojson.features[i] = this.extract.feature.apply(this, [element]);
  16260. }
  16261. }
  16262. } else if (isGeometry(obj)) {
  16263. let feature = {};
  16264. feature.geometry = obj;
  16265. geojson = this.extract.feature.apply(this, [feature]);
  16266. } else {
  16267. geojson = this.extract.feature.apply(this, [obj]);
  16268. }
  16269. function isGeometry(input) {
  16270. return (input.hasOwnProperty("parts") && input.hasOwnProperty("points")) || input.hasOwnProperty("geoParts");
  16271. }
  16272. return geojson;
  16273. }
  16274. /**
  16275. * @function GeoJSONFormat.prototype.isValidType
  16276. * @description 检查一个 GeoJSON 对象是否和给定的类型相符的合法的对象。
  16277. * @returns {boolean} GeoJSON 是否是给定类型的合法对象。
  16278. * @private
  16279. */
  16280. isValidType(obj, type) {
  16281. var valid = false;
  16282. switch (type) {
  16283. case "Geometry":
  16284. if (Util_Util.indexOf(
  16285. ["Point", "MultiPoint", "LineString", "MultiLineString",
  16286. "Polygon", "MultiPolygon", "Box", "GeometryCollection"
  16287. ],
  16288. obj.type) == -1) {
  16289. // unsupported geometry type
  16290. //console.error("Unsupported geometry type: " +
  16291. // obj.type);
  16292. } else {
  16293. valid = true;
  16294. }
  16295. break;
  16296. case "FeatureCollection":
  16297. // allow for any type to be converted to a feature collection
  16298. valid = true;
  16299. break;
  16300. default:
  16301. // for Feature types must match
  16302. if (obj.type == type) {
  16303. valid = true;
  16304. } else {
  16305. //console.error("Cannot convert types from " +
  16306. //obj.type + " to " + type);
  16307. }
  16308. }
  16309. return valid;
  16310. }
  16311. /**
  16312. * @function GeoJSONFormat.prototype.parseFeature
  16313. * @description 将一个 GeoJSON 中的 feature 转化成 {@link FeatureVector}> 对象。
  16314. * @private
  16315. * @param {GeoJSONObject} obj - 从 GeoJSON 对象中创建一个对象。
  16316. * @returns {FeatureVector} 一个要素。
  16317. */
  16318. parseFeature(obj) {
  16319. var feature, geometry, attributes, bbox;
  16320. attributes = (obj.properties) ? obj.properties : {};
  16321. bbox = (obj.geometry && obj.geometry.bbox) || obj.bbox;
  16322. try {
  16323. geometry = this.parseGeometry(obj.geometry);
  16324. } catch (err) {
  16325. // deal with bad geometries
  16326. throw err;
  16327. }
  16328. feature = new Vector(geometry, attributes);
  16329. if (bbox) {
  16330. feature.bounds = Bounds.fromArray(bbox);
  16331. }
  16332. if (obj.id) {
  16333. feature.geometry.id = obj.id;
  16334. feature.fid = obj.id;
  16335. }
  16336. return feature;
  16337. }
  16338. /**
  16339. * @function GeoJSONFormat.prototype.parseGeometry
  16340. * @description 将一个 GeoJSON 中的几何要素转化成 {@link Geometry} 对象。
  16341. * @param {GeoJSONObject} obj - 从 GeoJSON 对象中创建一个对象。
  16342. * @returns {Geometry} 一个几何要素。
  16343. * @private
  16344. */
  16345. parseGeometry(obj) {
  16346. if (obj == null) {
  16347. return null;
  16348. }
  16349. var geometry;
  16350. if (obj.type == "GeometryCollection") {
  16351. if (!(Util_Util.isArray(obj.geometries))) {
  16352. throw "GeometryCollection must have geometries array: " + obj;
  16353. }
  16354. var numGeom = obj.geometries.length;
  16355. var components = new Array(numGeom);
  16356. for (var i = 0; i < numGeom; ++i) {
  16357. components[i] = this.parseGeometry.apply(
  16358. this, [obj.geometries[i]]
  16359. );
  16360. }
  16361. geometry = new Collection(components);
  16362. } else {
  16363. if (!(Util_Util.isArray(obj.coordinates))) {
  16364. throw "Geometry must have coordinates array: " + obj;
  16365. }
  16366. if (!this.parseCoords[obj.type.toLowerCase()]) {
  16367. throw "Unsupported geometry type: " + obj.type;
  16368. }
  16369. try {
  16370. geometry = this.parseCoords[obj.type.toLowerCase()].apply(
  16371. this, [obj.coordinates]
  16372. );
  16373. } catch (err) {
  16374. // deal with bad coordinates
  16375. throw err;
  16376. }
  16377. }
  16378. return geometry;
  16379. }
  16380. /**
  16381. * @function GeoJSONFormat.prototype.createCRSObject
  16382. * @description 从一个要素对象中创建一个坐标参考系对象。
  16383. * @param {FeatureVector} object - 要素对象。
  16384. * @private
  16385. * @returns {GeoJSONObject} 一个可作为 GeoJSON 对象的 CRS 属性使用的对象。
  16386. */
  16387. createCRSObject(object) {
  16388. var proj = object.layer.projection.toString();
  16389. var crs = {};
  16390. if (proj.match(/epsg:/i)) {
  16391. var code = parseInt(proj.substring(proj.indexOf(":") + 1));
  16392. if (code == 4326) {
  16393. crs = {
  16394. "type": "name",
  16395. "properties": {
  16396. "name": "urn:ogc:def:crs:OGC:1.3:CRS84"
  16397. }
  16398. };
  16399. } else {
  16400. crs = {
  16401. "type": "name",
  16402. "properties": {
  16403. "name": "EPSG:" + code
  16404. }
  16405. };
  16406. }
  16407. }
  16408. return crs;
  16409. }
  16410. _toiSevrerFeature(feature) {
  16411. const attributes = feature.attributes;
  16412. const attrNames = [];
  16413. const attrValues = [];
  16414. for (var attr in attributes) {
  16415. attrNames.push(attr);
  16416. attrValues.push(attributes[attr]);
  16417. }
  16418. const newFeature = {
  16419. fieldNames: attrNames,
  16420. fieldValues: attrValues,
  16421. geometry: ServerGeometry.fromGeometry(feature.geometry)
  16422. };
  16423. newFeature.geometry.id = feature.fid;
  16424. return newFeature;
  16425. }
  16426. createAttributes(feature) {
  16427. if (!feature) {
  16428. return null;
  16429. }
  16430. var attr = {};
  16431. processFieldsAttributes(feature, attr);
  16432. var exceptKeys = ["fieldNames", "fieldValues", "geometry", "stringID", "ID"];
  16433. for (var key in feature) {
  16434. if (exceptKeys.indexOf(key) > -1) {
  16435. continue;
  16436. }
  16437. attr[key] = feature[key];
  16438. }
  16439. function processFieldsAttributes(feature, attributes) {
  16440. if (!(feature.hasOwnProperty("fieldNames") && feature.hasOwnProperty("fieldValues"))) {
  16441. return;
  16442. }
  16443. var names = feature.fieldNames,
  16444. values = feature.fieldValues;
  16445. for (var i in names) {
  16446. attributes[names[i]] = values[i];
  16447. }
  16448. }
  16449. return attr;
  16450. }
  16451. }
  16452. ;// CONCATENATED MODULE: ./src/maplibregl/core/Util.js
  16453. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  16454. * This program are made available under the terms of the Apache License, Version 2.0
  16455. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16456. // import "../core/Base";
  16457. const isArray = function (obj){
  16458. return Object.prototype.toString.call(obj) == "[object Array]";
  16459. }
  16460. const isString = function (str) {
  16461. return (typeof str === 'string') && str.constructor === String;
  16462. }
  16463. /**
  16464. * @name Util
  16465. * @namespace
  16466. * @category BaseTypes Util
  16467. * @description 工具类。
  16468. * @usage
  16469. * ```
  16470. * // 浏览器
  16471. * <script type="text/javascript" src="{cdn}"></script>
  16472. * <script>
  16473. * const result = {namespace}.Util.toSuperMapGeometry(geoJSON);
  16474. *
  16475. * </script>
  16476. * // ES6 Import
  16477. * import { Util } from '{npm}';
  16478. *
  16479. * const result = Util.toSuperMapGeometry(geoJSON);
  16480. * ```
  16481. */
  16482. const core_Util_Util = {
  16483. /**
  16484. * @function Util.toSuperMapGeometry
  16485. * @description 将 GeoJSON 对象转为 SuperMap 几何图形。
  16486. * @param {GeoJSONObject} geoJSON - GeoJSON 对象。
  16487. * @returns {Geometry}
  16488. */
  16489. toSuperMapGeometry(geoJSON) {
  16490. if (geoJSON && geoJSON.type) {
  16491. var format = new GeoJSON();
  16492. var result = format.read(geoJSON, "FeatureCollection");
  16493. return result[0].geometry;
  16494. }
  16495. },
  16496. toSuperMapBounds(bounds) {
  16497. if (isArray(bounds)) {
  16498. //左下右上
  16499. return new Bounds(bounds[0], bounds[1], bounds[2], bounds[3]);
  16500. }
  16501. return new Bounds(bounds.getWest(), bounds.getSouth(), bounds.getEast(), bounds.getNorth());
  16502. },
  16503. toSuperMapPoint(lnglat) {
  16504. //客户端可传入 geojson 对象 或者 maplibregl lnglat 点对象,或者是点数组
  16505. if (isArray(lnglat)) {
  16506. return new Point(lnglat[0], lnglat[1]);
  16507. } else if (lnglat.lng && lnglat.lat) {
  16508. return new Point(lnglat.lng, lnglat.lat);
  16509. }
  16510. return new Point(lnglat.geometry.coordinates[0], lnglat.geometry.coordinates[1]);
  16511. },
  16512. /**
  16513. * @function Util.toSuperMapPolygon
  16514. * @description 将 Maplibre GL LngLatbounds 对象转为 SuperMap 几何图形。
  16515. * @param {maplibregl.LngLatBounds} lnglatBounds - Maplibre GL LngLatbounds对象。
  16516. * @returns {GeometryPolygon}
  16517. */
  16518. toSuperMapPolygon(lnglatBounds) {
  16519. const west = lnglatBounds.getWest();
  16520. const east = lnglatBounds.getEast();
  16521. const sourth = lnglatBounds.getSouth();
  16522. const north = lnglatBounds.getNorth();
  16523. return new Polygon_Polygon([
  16524. new LinearRing_LinearRing([
  16525. new Point(west, sourth),
  16526. new Point(east, sourth),
  16527. new Point(east, north),
  16528. new Point(west, north)
  16529. ])
  16530. ]);
  16531. },
  16532. /**
  16533. * @function Util.isArray
  16534. * @description 判断是否为数组格式。
  16535. * @param {Object} obj - 待判断对象。
  16536. * @returns {boolean} 是否是数组。
  16537. */
  16538. isArray,
  16539. /**
  16540. * @function Util.toGeoJSON
  16541. * @description 将传入对象转为 GeoJSON 格式。
  16542. * @param {Object} smObj - 待转对象。
  16543. */
  16544. toGeoJSON(smObj) {
  16545. if (smObj) {
  16546. var format = new GeoJSON();
  16547. return format.toGeoJSON(smObj);
  16548. }
  16549. },
  16550. /**
  16551. * @function Util.toProcessingParam
  16552. * @description 将 Region 节点数组转为 Processing 服务需要的分析参数。
  16553. * @param {Array} points - Region 各个节点数组。
  16554. * @returns {Object} processing 服务裁剪、查询分析的分析参数。
  16555. */
  16556. toProcessingParam(points) {
  16557. var geometryParam = {};
  16558. if (points.length < 1) {
  16559. geometryParam = "";
  16560. } else {
  16561. var results = [];
  16562. for (var i = 0; i < points.length; i++) {
  16563. var point = {};
  16564. point.x = points[i][0];
  16565. point.y = points[i][1];
  16566. results.push(point);
  16567. }
  16568. geometryParam.type = "REGION";
  16569. geometryParam.points = results;
  16570. }
  16571. return geometryParam;
  16572. },
  16573. /**
  16574. * @function Util.extend
  16575. * @description 对象拷贝赋值。
  16576. * @param {Object} dest - 目标对象。
  16577. * @param {Object} arguments - 待拷贝的对象。
  16578. * @returns {Object} 赋值后的目标对象。
  16579. */
  16580. extend(dest) {
  16581. for (var index = 0; index < Object.getOwnPropertyNames(arguments).length; index++) {
  16582. var arg = Object.getOwnPropertyNames(arguments)[index];
  16583. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  16584. continue;
  16585. }
  16586. var obj = arguments[arg];
  16587. if (obj) {
  16588. for (var j = 0; j < Object.getOwnPropertyNames(obj).length; j++) {
  16589. var key = Object.getOwnPropertyNames(obj)[j];
  16590. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  16591. continue;
  16592. }
  16593. dest[key] = obj[key];
  16594. }
  16595. }
  16596. }
  16597. return dest;
  16598. },
  16599. /**
  16600. * 检测数据是否为number
  16601. * @param value 值,未知数据类型
  16602. * @returns {boolean}
  16603. */
  16604. isNumber(value) {
  16605. if (value === "") {
  16606. return false;
  16607. }
  16608. let mdata = Number(value);
  16609. if (mdata === 0) {
  16610. return true;
  16611. }
  16612. return !isNaN(mdata);
  16613. },
  16614. isString: isString,
  16615. /**
  16616. * 随机生成id
  16617. * @param attr
  16618. * @returns {string}
  16619. */
  16620. newGuid(attr) {
  16621. let len = attr || 32;
  16622. let guid = "";
  16623. for (let i = 1; i < len; i++) {
  16624. let n = Math.floor(Math.random() * 16.0).toString(16);
  16625. guid += n;
  16626. }
  16627. return guid;
  16628. },
  16629. /**
  16630. * @description 十六进制转 RGBA 格式。
  16631. * @param {Object} hex - 十六进制格式。
  16632. * @param {number} opacity - 不透明度Alpha。
  16633. * @returns {string} 生成的 RGBA 格式。
  16634. */
  16635. hexToRgba(hex, opacity) {
  16636. var color = [],
  16637. rgba = [];
  16638. hex = hex.replace(/#/, "");
  16639. if (hex.length == 3) {
  16640. var tmp = [];
  16641. for (let i = 0; i < 3; i++) {
  16642. tmp.push(hex.charAt(i) + hex.charAt(i));
  16643. }
  16644. hex = tmp.join("");
  16645. }
  16646. for (let i = 0; i < 6; i += 2) {
  16647. color[i] = "0x" + hex.substr(i, 2);
  16648. rgba.push(parseInt(Number(color[i])));
  16649. }
  16650. rgba.push(opacity);
  16651. return "rgba(" + rgba.join(",") + ")";
  16652. },
  16653. /**
  16654. * @param {string} featureName 原始数据中的地名
  16655. * @param {string} fieldName 待匹配的地名
  16656. * @returns {boolean} 是否匹配
  16657. */
  16658. isMatchAdministrativeName(featureName, fieldName) {
  16659. if (isString(fieldName)) {
  16660. let shortName = featureName.substr(0, 2);
  16661. // 张家口市和张家界市 特殊处理
  16662. if (shortName === '张家') {
  16663. shortName = featureName.substr(0, 3);
  16664. }
  16665. return !!fieldName.match(new RegExp(shortName));
  16666. }
  16667. return false;
  16668. }
  16669. }
  16670. ;// CONCATENATED MODULE: ./src/maplibregl/core/MapExtend.js
  16671. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  16672. * This program are made available under the terms of the Apache License, Version 2.0
  16673. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16674. /**
  16675. * @function MapExtend
  16676. * @description 扩展了 maplibregl.Map 对图层相关的操作。
  16677. * @private
  16678. */
  16679. var MapExtend = (function () {
  16680. (external_maplibregl_default()).Map.prototype.overlayLayersManager = {};
  16681. if ((external_maplibregl_default()).Map.prototype.addLayerBak === undefined) {
  16682. (external_maplibregl_default()).Map.prototype.addLayerBak = (external_maplibregl_default()).Map.prototype.addLayer;
  16683. (external_maplibregl_default()).Map.prototype.addLayer = function (layer, before) {
  16684. if (layer.source || layer.type === 'custom' || layer.type === 'background') {
  16685. this.addLayerBak(layer, before);
  16686. if (layer.overlay && !this.overlayLayersManager[layer.id]) {
  16687. this.overlayLayersManager[layer.id] = layer;
  16688. }
  16689. return this;
  16690. }
  16691. if (this.overlayLayersManager[layer.id] || this.style._layers[layer.id]) {
  16692. this.fire('error', {
  16693. error: new Error('A layer with this id already exists.')
  16694. });
  16695. return;
  16696. }
  16697. addLayer(layer, this);
  16698. this.overlayLayersManager[layer.id] = layer;
  16699. return this;
  16700. };
  16701. }
  16702. (external_maplibregl_default()).Map.prototype.getLayer = function (id) {
  16703. if (this.overlayLayersManager[id]) {
  16704. return this.overlayLayersManager[id];
  16705. }
  16706. return this.style.getLayer(id);
  16707. };
  16708. (external_maplibregl_default()).Map.prototype.moveLayer = function (id, beforeId) {
  16709. if (this.overlayLayersManager[id]) {
  16710. this.overlayLayersManager[id].moveLayer
  16711. ? this.overlayLayersManager[id].moveLayer(id, beforeId)
  16712. : moveLayer(id, beforeId);
  16713. return this;
  16714. }
  16715. if (this.style._layers[id]) {
  16716. this.style.moveLayer(id, beforeId);
  16717. this._update(true);
  16718. return this;
  16719. }
  16720. };
  16721. (external_maplibregl_default()).Map.prototype.removeLayer = function (id) {
  16722. if (this.overlayLayersManager[id]) {
  16723. delete this.overlayLayersManager[id];
  16724. }
  16725. this.style.removeLayer(id);
  16726. this._update(true);
  16727. return this;
  16728. };
  16729. //目前扩展的overlayer,只支持显示或隐藏图层操作
  16730. (external_maplibregl_default()).Map.prototype.setLayoutProperty = function (layerID, name, value) {
  16731. if (this.overlayLayersManager[layerID]) {
  16732. if (name === 'visibility') {
  16733. if (value === 'visible') {
  16734. value = true;
  16735. } else {
  16736. value = false;
  16737. }
  16738. setVisibility(this.overlayLayersManager[layerID], value);
  16739. this.style.fire('data', { dataType: 'style' });
  16740. }
  16741. return this;
  16742. }
  16743. this.style.setLayoutProperty(layerID, name, value);
  16744. this._update(true);
  16745. return this;
  16746. };
  16747. (external_maplibregl_default()).Map.prototype.updateTransform = function (units, originX, originY, centerX, centerY, width, height) {
  16748. this.transform.units = units;
  16749. var mercatorZfromAltitude = this.mercatorZfromAltitude;
  16750. (external_maplibregl_default()).MercatorCoordinate.fromLngLat = function (lngLatLike, altitude) {
  16751. altitude = altitude || 0;
  16752. const lngLat = external_maplibregl_default().LngLat.convert(lngLatLike);
  16753. return new (external_maplibregl_default()).MercatorCoordinate(
  16754. (lngLat.lng - originX) / width,
  16755. (originY - lngLat.lat) / height,
  16756. mercatorZfromAltitude(altitude, lngLat.lat)
  16757. );
  16758. };
  16759. (external_maplibregl_default()).MercatorCoordinate.prototype.toLngLat = function () {
  16760. return new (external_maplibregl_default()).LngLat(this.x * width + originX, originY - this.y * height);
  16761. };
  16762. this.customConvertPoint = window.URL.createObjectURL(
  16763. new Blob(
  16764. [
  16765. 'customConvertPoint = {projectX:function(x){return (x - ' +
  16766. centerX +
  16767. ') / ' +
  16768. width +
  16769. ' + 0.5},projectY:function(y){y = 0.5 - ((y - ' +
  16770. centerY +
  16771. ') / ' +
  16772. height +
  16773. ');return y < 0 ? 0 : y > 1 ? 1 : y;},toY:function(y){return (0.5-y)*' +
  16774. height +
  16775. '+' +
  16776. centerY +
  16777. ';}}'
  16778. ],
  16779. { type: 'text/javascript' }
  16780. )
  16781. );
  16782. };
  16783. function addLayer(layer, map) {
  16784. layer.onAdd && layer.onAdd(map);
  16785. }
  16786. /**
  16787. * @function MapExtend.prototype.setVisibility
  16788. * @description 设置图层可见性,设置图层的隐藏,显示,重绘的相应的可见标记。
  16789. * @param {boolean} [visibility] - 是否显示图层(当前地图的 resolution 在最大最小 resolution 之间)。
  16790. */
  16791. function setVisibility(layer, visibility) {
  16792. layer.setVisibility && layer.setVisibility(visibility);
  16793. }
  16794. /**
  16795. * @function MapExtend.prototype.moveTo
  16796. * @description 将图层移动到某个图层之前。
  16797. * @param {string} layerID -待插入的图层 ID。
  16798. * @param {boolean} [beforeLayerID] - 是否将本图层插入到图层 id 为 layerID 的图层之前(如果为 false 则将本图层插入到图层 id 为 layerID 的图层之后)。
  16799. */
  16800. function moveLayer(layerID, beforeLayerID) {
  16801. var layer = document.getElementById(layerID);
  16802. // var beforeLayer;
  16803. if (beforeLayerID) {
  16804. var beforeLayer = document.getElementById(beforeLayerID);
  16805. if (!beforeLayer) {
  16806. external_maplibregl_default().Evented.prototype.fire('error', {
  16807. error: new Error(`Layer with id "${beforeLayerID}" does not exist on this document.`)
  16808. });
  16809. }
  16810. }
  16811. if (layer && beforeLayer) {
  16812. beforeLayer.parentNode.insertBefore(layer, beforeLayer);
  16813. } else {
  16814. //当没有传入beforeLayerID ,则默认将图层移动到最上面
  16815. layer.parentNode.appendChild(layer);
  16816. }
  16817. }
  16818. })();
  16819. ;// CONCATENATED MODULE: ./src/maplibregl/core/index.js
  16820. ;// CONCATENATED MODULE: ./src/maplibregl/services/ServiceBase.js
  16821. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  16822. * This program are made available under the terms of the Apache License, Version 2.0
  16823. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16824. /**
  16825. * @class ServiceBase
  16826. * @category iServer Core
  16827. * @classdesc maplibregl.supermap 服务基类。
  16828. * @version 11.1.0
  16829. * @param {string} url - 服务地址。
  16830. * @param {Object} options - 参数。
  16831. * @param {string} [options.proxy] - 服务代理地址。
  16832. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  16833. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  16834. * @param {Object} [options.headers] - 请求头。
  16835. * @fires ServiceBase#initialized
  16836. * @usage
  16837. */
  16838. class ServiceBase extends (external_maplibregl_default()).Evented {
  16839. constructor(url, options) {
  16840. super();
  16841. this.options = options || {};
  16842. this.url = url;
  16843. /**
  16844. * @event ServiceBase#initialized
  16845. * @description 构造函数构造成功之后触发。
  16846. * @property {Object} this - this 对象。
  16847. */
  16848. this.fire('initialized', this);
  16849. }
  16850. }
  16851. // EXTERNAL MODULE: ./node_modules/promise-polyfill/dist/polyfill.js
  16852. var polyfill = __webpack_require__(107);
  16853. // EXTERNAL MODULE: ./node_modules/fetch-ie8/fetch.js
  16854. var fetch_ie8_fetch = __webpack_require__(693);
  16855. // EXTERNAL MODULE: ./node_modules/fetch-jsonp/build/fetch-jsonp.js
  16856. var fetch_jsonp = __webpack_require__(144);
  16857. var fetch_jsonp_default = /*#__PURE__*/__webpack_require__.n(fetch_jsonp);
  16858. ;// CONCATENATED MODULE: ./src/common/util/FetchRequest.js
  16859. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  16860. * This program are made available under the terms of the Apache License, Version 2.0
  16861. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16862. let FetchRequest_fetch = window.fetch;
  16863. var setFetch = function (newFetch) {
  16864. FetchRequest_fetch = newFetch;
  16865. }
  16866. var RequestJSONPPromise = {
  16867. limitLength: 1500,
  16868. queryKeys: [],
  16869. queryValues: [],
  16870. supermap_callbacks: {},
  16871. addQueryStrings: function (values) {
  16872. var me = this;
  16873. for (var key in values) {
  16874. me.queryKeys.push(key);
  16875. if (typeof values[key] !== 'string') {
  16876. values[key] = Util_Util.toJSON(values[key]);
  16877. }
  16878. var tempValue = encodeURIComponent(values[key]);
  16879. me.queryValues.push(tempValue);
  16880. }
  16881. },
  16882. issue: function (config) {
  16883. var me = this,
  16884. uid = me.getUid(),
  16885. url = config.url,
  16886. splitQuestUrl = [];
  16887. // me.addQueryStrings({
  16888. // callback: "RequestJSONPPromise.supermap_callbacks[" + uid + "]"
  16889. // });
  16890. var sectionURL = url,
  16891. keysCount = 0; //此次sectionURL中有多少个key
  16892. var length = me.queryKeys ? me.queryKeys.length : 0;
  16893. for (var i = 0; i < length; i++) {
  16894. if (sectionURL.length + me.queryKeys[i].length + 2 >= me.limitLength) {
  16895. //+2 for ("&"or"?")and"="
  16896. if (keysCount == 0) {
  16897. return false;
  16898. }
  16899. splitQuestUrl.push(sectionURL);
  16900. sectionURL = url;
  16901. keysCount = 0;
  16902. i--;
  16903. } else {
  16904. if (sectionURL.length + me.queryKeys[i].length + 2 + me.queryValues[i].length > me.limitLength) {
  16905. var leftValue = me.queryValues[i];
  16906. while (leftValue.length > 0) {
  16907. var leftLength = me.limitLength - sectionURL.length - me.queryKeys[i].length - 2; //+2 for ("&"or"?")and"="
  16908. if (sectionURL.indexOf('?') > -1) {
  16909. sectionURL += '&';
  16910. } else {
  16911. sectionURL += '?';
  16912. }
  16913. var tempLeftValue = leftValue.substring(0, leftLength);
  16914. //避免 截断sectionURL时,将类似于%22这样的符号截成两半,从而导致服务端组装sectionURL时发生错误
  16915. if (tempLeftValue.substring(leftLength - 1, leftLength) === '%') {
  16916. leftLength -= 1;
  16917. tempLeftValue = leftValue.substring(0, leftLength);
  16918. } else if (tempLeftValue.substring(leftLength - 2, leftLength - 1) === '%') {
  16919. leftLength -= 2;
  16920. tempLeftValue = leftValue.substring(0, leftLength);
  16921. }
  16922. sectionURL += me.queryKeys[i] + '=' + tempLeftValue;
  16923. leftValue = leftValue.substring(leftLength);
  16924. if (tempLeftValue.length > 0) {
  16925. splitQuestUrl.push(sectionURL);
  16926. sectionURL = url;
  16927. keysCount = 0;
  16928. }
  16929. }
  16930. } else {
  16931. keysCount++;
  16932. if (sectionURL.indexOf('?') > -1) {
  16933. sectionURL += '&';
  16934. } else {
  16935. sectionURL += '?';
  16936. }
  16937. sectionURL += me.queryKeys[i] + '=' + me.queryValues[i];
  16938. }
  16939. }
  16940. }
  16941. splitQuestUrl.push(sectionURL);
  16942. return me.send(
  16943. splitQuestUrl,
  16944. 'SuperMapJSONPCallbacks_' + uid,
  16945. config && config.proxy
  16946. );
  16947. },
  16948. getUid: function () {
  16949. var uid = new Date().getTime(),
  16950. random = Math.floor(Math.random() * 1e17);
  16951. return uid * 1000 + random;
  16952. },
  16953. send: function (splitQuestUrl, callback, proxy) {
  16954. var len = splitQuestUrl.length;
  16955. if (len > 0) {
  16956. return new Promise((resolve) => {
  16957. var jsonpUserID = new Date().getTime();
  16958. for (var i = 0; i < len; i++) {
  16959. var url = splitQuestUrl[i];
  16960. if (url.indexOf('?') > -1) {
  16961. url += '&';
  16962. } else {
  16963. url += '?';
  16964. }
  16965. url += 'sectionCount=' + len;
  16966. url += '&sectionIndex=' + i;
  16967. url += '&jsonpUserID=' + jsonpUserID;
  16968. if (proxy) {
  16969. url = decodeURIComponent(url);
  16970. url = proxy + encodeURIComponent(url);
  16971. }
  16972. fetch_jsonp_default()(url, {
  16973. jsonpCallbackFunction: callback,
  16974. timeout: 30000
  16975. }).then((result) => {
  16976. resolve(result.json());
  16977. });
  16978. }
  16979. })
  16980. }
  16981. },
  16982. GET: function (config) {
  16983. var me = this;
  16984. me.queryKeys.length = 0;
  16985. me.queryValues.length = 0;
  16986. me.addQueryStrings(config.params);
  16987. return me.issue(config);
  16988. },
  16989. POST: function (config) {
  16990. var me = this;
  16991. me.queryKeys.length = 0;
  16992. me.queryValues.length = 0;
  16993. me.addQueryStrings({
  16994. requestEntity: config.data
  16995. });
  16996. return me.issue(config);
  16997. },
  16998. PUT: function (config) {
  16999. var me = this;
  17000. me.queryKeys.length = 0;
  17001. me.queryValues.length = 0;
  17002. me.addQueryStrings({
  17003. requestEntity: config.data
  17004. });
  17005. return me.issue(config);
  17006. },
  17007. DELETE: function (config) {
  17008. var me = this;
  17009. me.queryKeys.length = 0;
  17010. me.queryValues.length = 0;
  17011. me.addQueryStrings({
  17012. requestEntity: config.data
  17013. });
  17014. return me.issue(config);
  17015. }
  17016. };
  17017. var CORS;
  17018. var RequestTimeout;
  17019. /**
  17020. * @function setCORS
  17021. * @description 设置是否允许跨域请求,全局配置,优先级低于 service 下的 crossOring 参数。
  17022. * @category BaseTypes Util
  17023. * @param {boolean} cors - 是否允许跨域请求。
  17024. * @usage
  17025. * ```
  17026. * // 浏览器
  17027. * <script type="text/javascript" src="{cdn}"></script>
  17028. * <script>
  17029. * {namespace}.setCORS(cors);
  17030. *
  17031. * // 弃用的写法
  17032. * SuperMap.setCORS(cors);
  17033. *
  17034. * </script>
  17035. *
  17036. * // ES6 Import
  17037. * import { setCORS } from '{npm}';
  17038. *
  17039. * setCORS(cors);
  17040. * ```
  17041. */
  17042. var setCORS = function (cors) {
  17043. CORS = cors;
  17044. }
  17045. /**
  17046. * @function isCORS
  17047. * @description 是是否允许跨域请求。
  17048. * @category BaseTypes Util
  17049. * @returns {boolean} 是否允许跨域请求。
  17050. * @usage
  17051. * ```
  17052. * // 浏览器
  17053. * <script type="text/javascript" src="{cdn}"></script>
  17054. * <script>
  17055. * const result = {namespace}.isCORS();
  17056. *
  17057. * // 弃用的写法
  17058. * const result = SuperMap.isCORS();
  17059. *
  17060. * </script>
  17061. *
  17062. * // ES6 Import
  17063. * import { isCORS } from '{npm}';
  17064. *
  17065. * const result = isCORS();
  17066. * ```
  17067. */
  17068. var isCORS = function () {
  17069. if (CORS != undefined) {
  17070. return CORS;
  17071. }
  17072. return window.XMLHttpRequest && 'withCredentials' in new window.XMLHttpRequest();
  17073. }
  17074. /**
  17075. * @function setRequestTimeout
  17076. * @category BaseTypes Util
  17077. * @description 设置请求超时时间。
  17078. * @param {number} [timeout=45] - 请求超时时间,单位秒。
  17079. * @usage
  17080. * ```
  17081. * // 浏览器
  17082. <script type="text/javascript" src="{cdn}"></script>
  17083. <script>
  17084. {namespace}.setRequestTimeout(timeout);
  17085. // 弃用的写法
  17086. SuperMap.setRequestTimeout(timeout);
  17087. </script>
  17088. // ES6 Import
  17089. import { setRequestTimeout } from '{npm}';
  17090. setRequestTimeout(timeout);
  17091. * ```
  17092. */
  17093. var setRequestTimeout = function (timeout) {
  17094. return RequestTimeout = timeout;
  17095. }
  17096. /**
  17097. * @function getRequestTimeout
  17098. * @category BaseTypes Util
  17099. * @description 获取请求超时时间。
  17100. * @returns {number} 请求超时时间。
  17101. * @usage
  17102. * ```
  17103. * // 浏览器
  17104. <script type="text/javascript" src="{cdn}"></script>
  17105. <script>
  17106. {namespace}.getRequestTimeout();
  17107. // 弃用的写法
  17108. SuperMap.getRequestTimeout();
  17109. </script>
  17110. // ES6 Import
  17111. import { getRequestTimeout } from '{npm}';
  17112. getRequestTimeout();
  17113. * ```
  17114. */
  17115. var getRequestTimeout = function () {
  17116. return RequestTimeout || 45000;
  17117. }
  17118. /**
  17119. * @name FetchRequest
  17120. * @namespace
  17121. * @category BaseTypes Util
  17122. * @description 获取请求。
  17123. * @usage
  17124. * ```
  17125. * // 浏览器
  17126. * <script type="text/javascript" src="{cdn}"></script>
  17127. * <script>
  17128. * const result = {namespace}.FetchRequest.commit(method, url, params, options);
  17129. *
  17130. * </script>
  17131. *
  17132. * // ES6 Import
  17133. * import { FetchRequest } from '{npm}';
  17134. *
  17135. * const result = FetchRequest.commit(method, url, params, options);
  17136. *
  17137. * ```
  17138. */
  17139. var FetchRequest = {
  17140. /**
  17141. * @function FetchRequest.commit
  17142. * @description commit 请求。
  17143. * @param {string} method - 请求方法。
  17144. * @param {string} url - 请求地址。
  17145. * @param {string} params - 请求参数。
  17146. * @param {Object} options - 请求的配置属性。
  17147. * @returns {Promise} Promise 对象。
  17148. */
  17149. commit: function (method, url, params, options) {
  17150. method = method ? method.toUpperCase() : method;
  17151. switch (method) {
  17152. case 'GET':
  17153. return this.get(url, params, options);
  17154. case 'POST':
  17155. return this.post(url, params, options);
  17156. case 'PUT':
  17157. return this.put(url, params, options);
  17158. case 'DELETE':
  17159. return this.delete(url, params, options);
  17160. default:
  17161. return this.get(url, params, options);
  17162. }
  17163. },
  17164. /**
  17165. * @function FetchRequest.supportDirectRequest
  17166. * @description supportDirectRequest 请求。
  17167. * @param {string} url - 请求地址。
  17168. * @param {Object} options - 请求的配置属性。
  17169. * @returns {boolean} 是否允许跨域请求。
  17170. */
  17171. supportDirectRequest: function (url, options) {
  17172. if (Util_Util.isInTheSameDomain(url)) {
  17173. return true;
  17174. }
  17175. if (options.crossOrigin != undefined) {
  17176. return options.crossOrigin;
  17177. } else {
  17178. return isCORS() || options.proxy;
  17179. }
  17180. },
  17181. /**
  17182. * @function FetchRequest.get
  17183. * @description get 请求。
  17184. * @param {string} url - 请求地址。
  17185. * @param {string} params - 请求参数。
  17186. * @param {Object} options - 请求的配置属性。
  17187. * @returns {Promise} Promise 对象。
  17188. */
  17189. get: function (url, params, options) {
  17190. options = options || {};
  17191. var type = 'GET';
  17192. url = Util_Util.urlAppend(url, this._getParameterString(params || {}));
  17193. url = this._processUrl(url, options);
  17194. if (!this.supportDirectRequest(url, options)) {
  17195. url = url.replace('.json', '.jsonp');
  17196. var config = {
  17197. url: url,
  17198. data: params
  17199. };
  17200. return RequestJSONPPromise.GET(config);
  17201. }
  17202. if (!this.urlIsLong(url)) {
  17203. return this._fetch(url, params, options, type);
  17204. } else {
  17205. return this._postSimulatie(type, url.substring(0, url.indexOf('?')), params, options);
  17206. }
  17207. },
  17208. /**
  17209. * @function FetchRequest.delete
  17210. * @description delete 请求。
  17211. * @param {string} url - 请求地址。
  17212. * @param {string} params - 请求参数。
  17213. * @param {Object} options -请求的配置属性。
  17214. * @returns {Promise} Promise 对象。
  17215. */
  17216. delete: function (url, params, options) {
  17217. options = options || {};
  17218. var type = 'DELETE';
  17219. url = Util_Util.urlAppend(url, this._getParameterString(params || {}));
  17220. url = this._processUrl(url, options);
  17221. if (!this.supportDirectRequest(url, options)) {
  17222. url = url.replace('.json', '.jsonp');
  17223. var config = {
  17224. url: url += "&_method=DELETE",
  17225. data: params
  17226. };
  17227. return RequestJSONPPromise.DELETE(config);
  17228. }
  17229. if (this.urlIsLong(url)) {
  17230. return this._postSimulatie(type, url.substring(0, url.indexOf('?')), params, options);
  17231. }
  17232. return this._fetch(url, params, options, type);
  17233. },
  17234. /**
  17235. * @function FetchRequest.post
  17236. * @description post 请求。
  17237. * @param {string} url - 请求地址。
  17238. * @param {string} params - 请求参数。
  17239. * @param {Object} options - 请求的配置属性。
  17240. * @returns {Promise} Promise 对象。
  17241. */
  17242. post: function (url, params, options) {
  17243. options = options || {};
  17244. url = this._processUrl(url, options);
  17245. if (!this.supportDirectRequest(url, options)) {
  17246. url = url.replace('.json', '.jsonp');
  17247. var config = {
  17248. url: Util_Util.urlAppend(url, "_method=POST"),
  17249. data: params
  17250. };
  17251. return RequestJSONPPromise.POST(config);
  17252. }
  17253. return this._fetch(url, params, options, 'POST');
  17254. },
  17255. /**
  17256. * @function FetchRequest.put
  17257. * @description put 请求。
  17258. * @param {string} url - 请求地址。
  17259. * @param {string} params - 请求参数。
  17260. * @param {Object} options - 请求的配置属性。
  17261. * @returns {Promise} Promise 对象。
  17262. */
  17263. put: function (url, params, options) {
  17264. options = options || {};
  17265. url = this._processUrl(url, options);
  17266. if (!this.supportDirectRequest(url, options)) {
  17267. url = url.replace('.json', '.jsonp');
  17268. var config = {
  17269. url: url += "&_method=PUT",
  17270. data: params
  17271. };
  17272. return RequestJSONPPromise.PUT(config);
  17273. }
  17274. return this._fetch(url, params, options, 'PUT');
  17275. },
  17276. /**
  17277. * @function FetchRequest.urlIsLong
  17278. * @description URL 的字节长度是否太长。
  17279. * @param {string} url - 请求地址。
  17280. * @returns {boolean} URL 的字节长度是否太长。
  17281. */
  17282. urlIsLong: function (url) {
  17283. //当前url的字节长度。
  17284. var totalLength = 0,
  17285. charCode = null;
  17286. for (var i = 0, len = url.length; i < len; i++) {
  17287. //转化为Unicode编码
  17288. charCode = url.charCodeAt(i);
  17289. if (charCode < 0x007f) {
  17290. totalLength++;
  17291. } else if ((0x0080 <= charCode) && (charCode <= 0x07ff)) {
  17292. totalLength += 2;
  17293. } else if ((0x0800 <= charCode) && (charCode <= 0xffff)) {
  17294. totalLength += 3;
  17295. }
  17296. }
  17297. return totalLength < 2000 ? false : true;
  17298. },
  17299. _postSimulatie: function (type, url, params, options) {
  17300. var separator = url.indexOf('?') > -1 ? '&' : '?';
  17301. url += separator + '_method=' + type;
  17302. if (typeof params !== 'string') {
  17303. params = JSON.stringify(params);
  17304. }
  17305. return this.post(url, params, options);
  17306. },
  17307. _processUrl: function (url, options) {
  17308. if (this._isMVTRequest(url)) {
  17309. return url;
  17310. }
  17311. if (url.indexOf('.json') === -1 && !options.withoutFormatSuffix) {
  17312. if (url.indexOf('?') < 0) {
  17313. url += '.json';
  17314. } else {
  17315. var urlArrays = url.split('?');
  17316. if (urlArrays.length === 2) {
  17317. url = urlArrays[0] + '.json?' + urlArrays[1];
  17318. }
  17319. }
  17320. }
  17321. if (options && options.proxy) {
  17322. if (typeof options.proxy === 'function') {
  17323. url = options.proxy(url);
  17324. } else {
  17325. url = decodeURIComponent(url);
  17326. url = options.proxy + encodeURIComponent(url);
  17327. }
  17328. }
  17329. return url;
  17330. },
  17331. _fetch: function (url, params, options, type) {
  17332. options = options || {};
  17333. options.headers = options.headers || {};
  17334. if (!options.headers['Content-Type'] && !FormData.prototype.isPrototypeOf(params)) {
  17335. options.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8';
  17336. }
  17337. if (options.timeout) {
  17338. return this._timeout(
  17339. options.timeout,
  17340. FetchRequest_fetch(url, {
  17341. method: type,
  17342. headers: options.headers,
  17343. body: type === 'PUT' || type === 'POST' ? params : undefined,
  17344. credentials: this._getWithCredentials(options),
  17345. mode: 'cors',
  17346. timeout: getRequestTimeout()
  17347. }).then(function (response) {
  17348. return response;
  17349. })
  17350. );
  17351. }
  17352. return FetchRequest_fetch(url, {
  17353. method: type,
  17354. body: type === 'PUT' || type === 'POST' ? params : undefined,
  17355. headers: options.headers,
  17356. credentials: this._getWithCredentials(options),
  17357. mode: 'cors',
  17358. timeout: getRequestTimeout()
  17359. }).then(function (response) {
  17360. return response;
  17361. });
  17362. },
  17363. _getWithCredentials: function (options) {
  17364. if (options.withCredentials === true) {
  17365. return 'include';
  17366. }
  17367. if (options.withCredentials === false) {
  17368. return 'omit';
  17369. }
  17370. return 'same-origin';
  17371. },
  17372. _fetchJsonp: function (url, options) {
  17373. options = options || {};
  17374. return fetch_jsonp_default()(url, {
  17375. method: 'GET',
  17376. timeout: options.timeout
  17377. }).then(function (response) {
  17378. return response;
  17379. });
  17380. },
  17381. _timeout: function (seconds, promise) {
  17382. return new Promise(function (resolve, reject) {
  17383. setTimeout(function () {
  17384. reject(new Error('timeout'));
  17385. }, seconds);
  17386. promise.then(resolve, reject);
  17387. });
  17388. },
  17389. _getParameterString: function (params) {
  17390. var paramsArray = [];
  17391. for (var key in params) {
  17392. var value = params[key];
  17393. if (value != null && typeof value !== 'function') {
  17394. var encodedValue;
  17395. if (Array.isArray(value) || value.toString() === '[object Object]') {
  17396. encodedValue = encodeURIComponent(JSON.stringify(value));
  17397. } else {
  17398. encodedValue = encodeURIComponent(value);
  17399. }
  17400. paramsArray.push(encodeURIComponent(key) + '=' + encodedValue);
  17401. }
  17402. }
  17403. return paramsArray.join('&');
  17404. },
  17405. _isMVTRequest: function (url) {
  17406. return url.indexOf('.mvt') > -1 || url.indexOf('.pbf') > -1;
  17407. }
  17408. }
  17409. ;// CONCATENATED MODULE: ./src/common/commontypes/Event.js
  17410. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  17411. * This program are made available under the terms of the Apache License, Version 2.0
  17412. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17413. /**
  17414. * @name Event
  17415. * @namespace
  17416. * @category BaseTypes Events
  17417. * @description 事件处理函数.
  17418. * @usage
  17419. * ```
  17420. * // 浏览器
  17421. * <script type="text/javascript" src="{cdn}"></script>
  17422. * <script>
  17423. * const element = {namespace}.Event.element();
  17424. *
  17425. * // 弃用的写法
  17426. * const result = SuperMap.Event.element();
  17427. *
  17428. * </script>
  17429. *
  17430. * // ES6 Import
  17431. * import { Event } from '{npm}';
  17432. *
  17433. * const result = Event.element();
  17434. * ```
  17435. */
  17436. var Event = {
  17437. /**
  17438. * @description 事件观察者列表。
  17439. * @type {Object}
  17440. * @default false
  17441. */
  17442. observers: false,
  17443. /**
  17444. * @description KEY_SPACE
  17445. * @type {number}
  17446. * @default 32
  17447. */
  17448. KEY_SPACE: 32,
  17449. /**
  17450. * @description KEY_BACKSPACE
  17451. * @type {number}
  17452. * @default 8
  17453. */
  17454. KEY_BACKSPACE: 8,
  17455. /**
  17456. * @description KEY_TAB
  17457. * @type {number}
  17458. * @default 9
  17459. */
  17460. KEY_TAB: 9,
  17461. /**
  17462. * @description KEY_RETURN
  17463. * @type {number}
  17464. * @default 13
  17465. */
  17466. KEY_RETURN: 13,
  17467. /**
  17468. * @description KEY_ESC
  17469. * @type {number}
  17470. * @default 27
  17471. */
  17472. KEY_ESC: 27,
  17473. /**
  17474. * @description KEY_LEFT
  17475. * @type {number}
  17476. * @default 37
  17477. */
  17478. KEY_LEFT: 37,
  17479. /**
  17480. * @description KEY_UP
  17481. * @type {number}
  17482. * @default 38
  17483. */
  17484. KEY_UP: 38,
  17485. /**
  17486. * @description KEY_RIGHT
  17487. * @type {number}
  17488. * @default 39
  17489. */
  17490. KEY_RIGHT: 39,
  17491. /**
  17492. * @description KEY_DOWN
  17493. * @type {number}
  17494. * @default 40
  17495. */
  17496. KEY_DOWN: 40,
  17497. /**
  17498. * @description KEY_DELETE
  17499. * @type {number}
  17500. * @default 46
  17501. */
  17502. KEY_DELETE: 46,
  17503. /**
  17504. * @description 监听浏览器 DOM 事件。
  17505. * @param {Event} event - Event 对象。
  17506. * @returns {HTMLElement} 触发事件的 DOM 元素。
  17507. */
  17508. element: function (event) {
  17509. return event.target || event.srcElement;
  17510. },
  17511. /**
  17512. * @description 判断事件是否由单次触摸引起。
  17513. * @param {Event} event - Event 对象。
  17514. * @returns {boolean} 是否有且只有一个当前在与触摸表面接触的 Touch 对象。
  17515. */
  17516. isSingleTouch: function (event) {
  17517. return event.touches && event.touches.length === 1;
  17518. },
  17519. /**
  17520. * @description 判断事件是否由多点触控引起。
  17521. * @param {Event} event - Event 对象。
  17522. * @returns {boolean} 是否存在多个当前在与触摸表面接触的 Touch 对象。
  17523. */
  17524. isMultiTouch: function (event) {
  17525. return event.touches && event.touches.length > 1;
  17526. },
  17527. /**
  17528. * @description 确定事件是否由左键单击引起。
  17529. * @param {Event} event - Event 对象。
  17530. * @returns {boolean} 是否点击鼠标左键。
  17531. */
  17532. isLeftClick: function (event) {
  17533. return (((event.which) && (event.which === 1)) ||
  17534. ((event.button) && (event.button === 1)));
  17535. },
  17536. /**
  17537. * @description 确定事件是否由鼠标右键单击引起。
  17538. * @param {Event} event - Event 对象。
  17539. * @returns {boolean} 是否点击鼠标右键。
  17540. */
  17541. isRightClick: function (event) {
  17542. return (((event.which) && (event.which === 3)) ||
  17543. ((event.button) && (event.button === 2)));
  17544. },
  17545. /**
  17546. * @description 阻止事件冒泡。
  17547. * @param {Event} event - Event 对象。
  17548. * @param {boolean} allowDefault - 默认为 false,表示阻止事件的默认行为。
  17549. */
  17550. stop: function (event, allowDefault) {
  17551. if (!allowDefault) {
  17552. if (event.preventDefault) {
  17553. event.preventDefault();
  17554. } else {
  17555. event.returnValue = false;
  17556. }
  17557. }
  17558. if (event.stopPropagation) {
  17559. event.stopPropagation();
  17560. } else {
  17561. event.cancelBubble = true;
  17562. }
  17563. },
  17564. /**
  17565. * @description 查询触发指定事件的 DOM 元素。
  17566. * @param {Event} event - Event 对象。
  17567. * @param {string} tagName - html 标签名。
  17568. * @returns {HTMLElement} DOM 元素。
  17569. */
  17570. findElement: function (event, tagName) {
  17571. var element = Event.element(event);
  17572. while (element.parentNode && (!element.tagName ||
  17573. (element.tagName.toUpperCase() != tagName.toUpperCase()))) {
  17574. element = element.parentNode;
  17575. }
  17576. return element;
  17577. },
  17578. /**
  17579. * @description 监听事件,注册事件处理方法。
  17580. * @param {(HTMLElement|string)} elementParam - 待监听的 DOM 对象或者其 ID 标识。
  17581. * @param {string} name - 监听事件的类别名称。
  17582. * @param {function} observer - 注册的事件处理方法。
  17583. * @param {boolean} [useCapture=false] - 是否捕获。
  17584. */
  17585. observe: function (elementParam, name, observer, useCapture) {
  17586. var element = Util_Util.getElement(elementParam);
  17587. useCapture = useCapture || false;
  17588. if (name === 'keypress' &&
  17589. (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
  17590. || element.attachEvent)) {
  17591. name = 'keydown';
  17592. }
  17593. //if observers cache has not yet been created, create it
  17594. if (!this.observers) {
  17595. this.observers = {};
  17596. }
  17597. //if not already assigned, make a new unique cache ID
  17598. if (!element._eventCacheID) {
  17599. var idPrefix = "eventCacheID_";
  17600. if (element.id) {
  17601. idPrefix = element.id + "_" + idPrefix;
  17602. }
  17603. element._eventCacheID = Util_Util.createUniqueID(idPrefix);
  17604. }
  17605. var cacheID = element._eventCacheID;
  17606. //if there is not yet a hash entry for this element, add one
  17607. if (!this.observers[cacheID]) {
  17608. this.observers[cacheID] = [];
  17609. }
  17610. //add a new observer to this element's list
  17611. this.observers[cacheID].push({
  17612. 'element': element,
  17613. 'name': name,
  17614. 'observer': observer,
  17615. 'useCapture': useCapture
  17616. });
  17617. //add the actual browser event listener
  17618. if (element.addEventListener) {
  17619. if(name === 'mousewheel'){
  17620. // https://www.chromestatus.com/features/6662647093133312
  17621. element.addEventListener(name, observer, {useCapture: useCapture, passive: false} );
  17622. } else {
  17623. element.addEventListener(name, observer, useCapture);
  17624. }
  17625. } else if (element.attachEvent) {
  17626. element.attachEvent('on' + name, observer);
  17627. }
  17628. },
  17629. /**
  17630. * @description 移除给定 DOM 元素的监听事件。
  17631. * @param {(HTMLElement|string)} elementParam - 待监听的 DOM 对象或者其 ID 标识。
  17632. */
  17633. stopObservingElement: function (elementParam) {
  17634. var element = Util_Util.getElement(elementParam);
  17635. var cacheID = element._eventCacheID;
  17636. this._removeElementObservers(Event.observers[cacheID]);
  17637. },
  17638. _removeElementObservers: function (elementObservers) {
  17639. if (elementObservers) {
  17640. for (var i = elementObservers.length - 1; i >= 0; i--) {
  17641. var entry = elementObservers[i];
  17642. var args = new Array(entry.element, entry.name, entry.observer, entry.useCapture);
  17643. Event.stopObserving.apply(this, args);
  17644. }
  17645. }
  17646. },
  17647. /**
  17648. * @description 移除事件监听和注册的事件处理方法。注意:事件的移除和监听相对应,移除时的各属性信息必须监听时保持一致才能确保事件移除成功。
  17649. * @param {(HTMLElement|string)} elementParam - 被监听的 DOM 元素或者其 ID。
  17650. * @param {string} name - 需要移除的被监听事件名称。
  17651. * @param {function} observer - 需要移除的事件处理方法。
  17652. * @param {boolean} [useCapture=false] - 是否捕获。
  17653. * @returns {boolean} 监听事件是否被移除。
  17654. */
  17655. stopObserving: function (elementParam, name, observer, useCapture) {
  17656. useCapture = useCapture || false;
  17657. var element = Util_Util.getElement(elementParam);
  17658. var cacheID = element._eventCacheID;
  17659. if (name === 'keypress') {
  17660. if (navigator.appVersion.match(/Konqueror|Safari|KHTML/) ||
  17661. element.detachEvent) {
  17662. name = 'keydown';
  17663. }
  17664. }
  17665. // find element's entry in this.observers cache and remove it
  17666. var foundEntry = false;
  17667. var elementObservers = Event.observers[cacheID];
  17668. if (elementObservers) {
  17669. // find the specific event type in the element's list
  17670. var i = 0;
  17671. while (!foundEntry && i < elementObservers.length) {
  17672. var cacheEntry = elementObservers[i];
  17673. if ((cacheEntry.name === name) &&
  17674. (cacheEntry.observer === observer) &&
  17675. (cacheEntry.useCapture === useCapture)) {
  17676. elementObservers.splice(i, 1);
  17677. if (elementObservers.length == 0) {
  17678. delete Event.observers[cacheID];
  17679. }
  17680. foundEntry = true;
  17681. break;
  17682. }
  17683. i++;
  17684. }
  17685. }
  17686. //actually remove the event listener from browser
  17687. if (foundEntry) {
  17688. if (element.removeEventListener) {
  17689. element.removeEventListener(name, observer, useCapture);
  17690. } else if (element && element.detachEvent) {
  17691. element.detachEvent('on' + name, observer);
  17692. }
  17693. }
  17694. return foundEntry;
  17695. },
  17696. /**
  17697. * @description 移除缓存中的监听事件。
  17698. */
  17699. unloadCache: function () {
  17700. // check for Event before checking for observers, because
  17701. // Event may be undefined in IE if no map instance was
  17702. // created
  17703. if (Event && Event.observers) {
  17704. for (var cacheID in Event.observers) {
  17705. var elementObservers = Event.observers[cacheID];
  17706. Event._removeElementObservers.apply(this,
  17707. [elementObservers]);
  17708. }
  17709. Event.observers = false;
  17710. }
  17711. },
  17712. CLASS_NAME: "SuperMap.Event"
  17713. };
  17714. /* prevent memory leaks in IE */
  17715. Event.observe(window, 'resize', Event.unloadCache, false);
  17716. ;// CONCATENATED MODULE: ./src/common/commontypes/Events.js
  17717. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  17718. * This program are made available under the terms of the Apache License, Version 2.0
  17719. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17720. /**
  17721. * @class Events
  17722. * @deprecatedclass SuperMap.Events
  17723. * @classdesc 事件类。
  17724. * @category BaseTypes Events
  17725. * @param {Object} object - 当前事件对象被添加到的 JS 对象。
  17726. * @param {HTMLElement} element - 响应浏览器事件的 DOM 元素。
  17727. * @param {Array.<string>} eventTypes - 自定义应用事件的数组。
  17728. * @param {boolean} [fallThrough=false] - 是否允许事件处理之后向上传递(冒泡),为 false 的时候阻止事件冒泡。
  17729. * @param {Object} options - 事件对象选项。
  17730. * @usage
  17731. */
  17732. class Events {
  17733. constructor(object, element, eventTypes, fallThrough, options) {
  17734. /**
  17735. * @member {Array.<string>} Events.prototype.BROWSER_EVENTS
  17736. * @description 支持的事件。
  17737. * @constant
  17738. * @default [
  17739. "mouseover", "mouseout","mousedown", "mouseup", "mousemove",
  17740. "click", "dblclick", "rightclick", "dblrightclick","resize",
  17741. "focus", "blur","touchstart", "touchmove", "touchend","keydown",
  17742. "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
  17743. "MSGestureStart", "MSGestureChange", "MSGestureEnd","contextmenu"
  17744. ]
  17745. */
  17746. this.BROWSER_EVENTS = [
  17747. "mouseover", "mouseout",
  17748. "mousedown", "mouseup", "mousemove",
  17749. "click", "dblclick", "rightclick", "dblrightclick",
  17750. "resize", "focus", "blur",
  17751. "touchstart", "touchmove", "touchend",
  17752. "keydown", "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
  17753. "MSGestureStart", "MSGestureChange", "MSGestureEnd",
  17754. "contextmenu"
  17755. ];
  17756. /**
  17757. * @member {Object} Events.prototype.listeners
  17758. * @description 事件监听器函数。
  17759. */
  17760. this.listeners = {};
  17761. /**
  17762. * @member {Object} Events.prototype.object
  17763. * @description 发布应用程序事件的对象。
  17764. */
  17765. this.object = object;
  17766. /**
  17767. * @member {HTMLElement} Events.prototype.element
  17768. * @description 接受浏览器事件的 DOM 节点。
  17769. */
  17770. this.element = null;
  17771. /**
  17772. * @member {Array.<string>} Events.prototype.eventTypes
  17773. * @description 支持的事件类型列表。
  17774. */
  17775. this.eventTypes = [];
  17776. /**
  17777. * @member {function} Events.prototype.eventHandler
  17778. * @description 绑定在元素上的事件处理器对象。
  17779. */
  17780. this.eventHandler = null;
  17781. /**
  17782. * @member {boolean} [Events.prototype.fallThrough=false]
  17783. * @description 是否允许事件处理之后向上传递(冒泡),为 false 的时候阻止事件冒泡。
  17784. */
  17785. this.fallThrough = fallThrough;
  17786. /**
  17787. * @member {boolean} [Events.prototype.includeXY=false]
  17788. * @description 判断是否让 xy 属性自动创建到浏览器上的鼠标事件,一般设置为 false,如果设置为 true,鼠标事件将会在事件传递过程中自动产生 xy 属性。可根据事件对象的 'evt.object' 属性在相关的事件句柄上调用 getMousePosition 函数。这个选项习惯默认为 false 的原因在于,当创建一个事件对象,其主要目的是管理。在一个 div 的相对定位的鼠标事件,将其设为 true 也是有意义的。这个选项也可以用来控制是否抵消缓存。如果设为 false 不抵消,如果设为 true,用 this.clearMouseCache() 清除缓存偏移(边界元素偏移,元素在页面的位置偏移)。
  17789. * @example
  17790. * function named(evt) {
  17791. * this.xy = this.object.events.getMousePosition(evt);
  17792. * }
  17793. */
  17794. this.includeXY = false;
  17795. /**
  17796. * @member {Object} Events.prototype.extensions
  17797. * @description 事件扩展。Keys 代表事件类型,values 代表事件对象。
  17798. */
  17799. this.extensions = {};
  17800. /**
  17801. * @member {Object} Events.prototype.extensionCount
  17802. * @description 事件扩展数量。
  17803. */
  17804. this.extensionCount = {};
  17805. /**
  17806. * @member {Object} Events.prototype.clearMouseListener
  17807. * @description 待移除的鼠标监听事件。
  17808. */
  17809. this.clearMouseListener = null;
  17810. Util_Util.extend(this, options);
  17811. if (eventTypes != null) {
  17812. for (var i = 0, len = eventTypes.length; i < len; i++) {
  17813. this.addEventType(eventTypes[i]);
  17814. }
  17815. }
  17816. if (element != null) {
  17817. this.attachToElement(element);
  17818. }
  17819. this.CLASS_NAME = "SuperMap.Events";
  17820. }
  17821. /**
  17822. * @function Events.prototype.destroy
  17823. * @description 移除当前要素 element 上的所有事件监听和处理。
  17824. */
  17825. destroy() {
  17826. for (var e in this.extensions) {
  17827. if (typeof this.extensions[e] !== "boolean") {
  17828. this.extensions[e].destroy();
  17829. }
  17830. }
  17831. this.extensions = null;
  17832. if (this.element) {
  17833. Event.stopObservingElement(this.element);
  17834. if (this.element.hasScrollEvent) {
  17835. Event.stopObserving(
  17836. window, "scroll", this.clearMouseListener
  17837. );
  17838. }
  17839. }
  17840. this.element = null;
  17841. this.listeners = null;
  17842. this.object = null;
  17843. this.eventTypes = null;
  17844. this.fallThrough = null;
  17845. this.eventHandler = null;
  17846. }
  17847. /**
  17848. * @function Events.prototype.addEventType
  17849. * @description 在此事件对象中添加新的事件类型,如果这个事件类型已经添加过了,则不做任何事情。
  17850. * @param {string} eventName - 事件名。
  17851. */
  17852. addEventType(eventName) {
  17853. if (!this.listeners[eventName]) {
  17854. this.eventTypes.push(eventName);
  17855. this.listeners[eventName] = [];
  17856. }
  17857. }
  17858. /**
  17859. * @function Events.prototype.attachToElement
  17860. * @description 给 DOM 元素绑定浏览器事件。
  17861. * @param {HTMLElement} element - 绑定浏览器事件的 DOM 元素。
  17862. */
  17863. attachToElement(element) {
  17864. if (this.element) {
  17865. Event.stopObservingElement(this.element);
  17866. } else {
  17867. // keep a bound copy of handleBrowserEvent() so that we can
  17868. // pass the same function to both Event.observe() and .stopObserving()
  17869. this.eventHandler = FunctionExt.bindAsEventListener(
  17870. this.handleBrowserEvent, this
  17871. );
  17872. // to be used with observe and stopObserving
  17873. this.clearMouseListener = FunctionExt.bind(
  17874. this.clearMouseCache, this
  17875. );
  17876. }
  17877. this.element = element;
  17878. for (var i = 0, len = this.BROWSER_EVENTS.length; i < len; i++) {
  17879. var eventType = this.BROWSER_EVENTS[i];
  17880. // every browser event has a corresponding application event
  17881. // (whether it's listened for or not).
  17882. this.addEventType(eventType);
  17883. // use Prototype to register the event cross-browser
  17884. Event.observe(element, eventType, this.eventHandler);
  17885. }
  17886. // disable dragstart in IE so that mousedown/move/up works normally
  17887. Event.observe(element, "dragstart", Event.stop);
  17888. }
  17889. /**
  17890. * @function Events.prototype.on
  17891. * @description 在一个相同的范围内注册监听器的方法,此方法调用 register 函数。
  17892. * @example
  17893. * // 注册一个 "loadstart" 监听事件
  17894. * events.on({"loadstart": loadStartListener});
  17895. *
  17896. * // 同样注册一个 "loadstart" 监听事件
  17897. * events.register("loadstart", undefined, loadStartListener);
  17898. *
  17899. * // 同时为对象注册多个监听事件
  17900. * events.on({
  17901. * "loadstart": loadStartListener,
  17902. * "loadend": loadEndListener,
  17903. * scope: object
  17904. * });
  17905. *
  17906. * // 同时为对象注册多个监听事件,多次调用 register 方法
  17907. * events.register("loadstart", object, loadStartListener);
  17908. * events.register("loadend", object, loadEndListener);
  17909. *
  17910. *
  17911. * @param {Object} object - 添加监听的对象。
  17912. */
  17913. on(object) {
  17914. for (var type in object) {
  17915. if (type !== "scope" && object.hasOwnProperty(type)) {
  17916. this.register(type, object.scope, object[type]);
  17917. }
  17918. }
  17919. }
  17920. /**
  17921. * @function Events.prototype.register
  17922. * @description 在事件对象上注册一个事件。当事件被触发时,'func' 函数被调用,假设我们触发一个事件,
  17923. * 指定 Bounds 作为 "obj",当事件被触发时,回调函数的上下文作为 Bounds 对象。
  17924. * @param {string} type - 事件注册者的名字。
  17925. * @param {Object} [obj=this.object] - 对象绑定的回调。
  17926. * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
  17927. * @param {(boolean|Object)} [priority] - 当为 true 时将新的监听加在事件队列的前面。
  17928. */
  17929. register(type, obj, func, priority) {
  17930. if (type in Events && !this.extensions[type]) {
  17931. this.extensions[type] = new Events[type](this);
  17932. }
  17933. if ((func != null) &&
  17934. (Util_Util.indexOf(this.eventTypes, type) !== -1)) {
  17935. if (obj == null) {
  17936. obj = this.object;
  17937. }
  17938. var listeners = this.listeners[type];
  17939. if (!listeners) {
  17940. listeners = [];
  17941. this.listeners[type] = listeners;
  17942. this.extensionCount[type] = 0;
  17943. }
  17944. var listener = {obj: obj, func: func};
  17945. if (priority) {
  17946. listeners.splice(this.extensionCount[type], 0, listener);
  17947. if (typeof priority === "object" && priority.extension) {
  17948. this.extensionCount[type]++;
  17949. }
  17950. } else {
  17951. listeners.push(listener);
  17952. }
  17953. }
  17954. }
  17955. /**
  17956. * @function Events.prototype.registerPriority
  17957. * @description 相同的注册方法,但是在前面增加新的监听者事件查询而代替到方法的结束。
  17958. * @param {string} type - 事件注册者的名字。
  17959. * @param {Object} [obj=this.object] - 对象绑定的回调。
  17960. * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
  17961. */
  17962. registerPriority(type, obj, func) {
  17963. this.register(type, obj, func, true);
  17964. }
  17965. /**
  17966. * @function Events.prototype.un
  17967. * @description 在一个相同的范围内取消注册监听器的方法,此方法调用 unregister 函数。
  17968. * @example
  17969. * // 移除 "loadstart" 事件监听
  17970. * events.un({"loadstart": loadStartListener});
  17971. *
  17972. * // 使用 "unregister" 方法移除 "loadstart" 事件监听
  17973. * events.unregister("loadstart", undefined, loadStartListener);
  17974. *
  17975. * // 取消对象多个事件监听
  17976. * events.un({
  17977. * "loadstart": loadStartListener,
  17978. * "loadend": loadEndListener,
  17979. * scope: object
  17980. * });
  17981. *
  17982. * // 取消对象多个事件监听,多次调用unregister方法。
  17983. * events.unregister("loadstart", object, loadStartListener);
  17984. * events.unregister("loadend", object, loadEndListener);
  17985. *
  17986. * @param {Object} object - 移除监听的对象。
  17987. */
  17988. un(object) {
  17989. for (var type in object) {
  17990. if (type !== "scope" && object.hasOwnProperty(type)) {
  17991. this.unregister(type, object.scope, object[type]);
  17992. }
  17993. }
  17994. }
  17995. /**
  17996. * @function Events.prototype.unregister
  17997. * @description 取消注册。
  17998. * @param {string} type - 事件类型。
  17999. * @param {Object} [obj=this.object] - 对象绑定的回调。
  18000. * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
  18001. */
  18002. unregister(type, obj, func) {
  18003. if (obj == null) {
  18004. obj = this.object;
  18005. }
  18006. var listeners = this.listeners[type];
  18007. if (listeners != null) {
  18008. for (var i = 0, len = listeners.length; i < len; i++) {
  18009. if (listeners[i].obj === obj && listeners[i].func === func) {
  18010. listeners.splice(i, 1);
  18011. break;
  18012. }
  18013. }
  18014. }
  18015. }
  18016. /**
  18017. * @function Events.prototype.remove
  18018. * @description 删除某个事件类型的所有监听,如果该事件类型没有注册,则不做任何操作。
  18019. * @param {string} type - 事件类型。
  18020. */
  18021. remove(type) {
  18022. if (this.listeners[type] != null) {
  18023. this.listeners[type] = [];
  18024. }
  18025. }
  18026. /**
  18027. * @function Events.prototype.triggerEvent
  18028. * @description 触发一个特定的注册事件。
  18029. * @param {string} type - 触发事件类型。
  18030. * @param {Event} evt - 事件对象。
  18031. * @returns {Event|boolean} 监听对象,如果返回是 false,则停止监听。
  18032. */
  18033. triggerEvent(type, evt) {
  18034. var listeners = this.listeners[type];
  18035. // fast path
  18036. if (!listeners || listeners.length == 0) {
  18037. return undefined;
  18038. }
  18039. // prep evt object with object & div references
  18040. if (evt == null) {
  18041. evt = {};
  18042. }
  18043. evt.object = this.object;
  18044. evt.element = this.element;
  18045. if (!evt.type) {
  18046. evt.type = type;
  18047. }
  18048. // execute all callbacks registered for specified type
  18049. // get a clone of the listeners array to
  18050. // allow for splicing during callbacks
  18051. listeners = listeners.slice();
  18052. var continueChain;
  18053. for (var i = 0, len = listeners.length; i < len; i++) {
  18054. var callback = listeners[i];
  18055. // bind the context to callback.obj
  18056. continueChain = callback.func.apply(callback.obj, [evt]);
  18057. if ((continueChain != undefined) && (continueChain === false)) {
  18058. // if callback returns false, execute no more callbacks.
  18059. break;
  18060. }
  18061. }
  18062. // don't fall through to other DOM elements
  18063. if (!this.fallThrough) {
  18064. Event.stop(evt, true);
  18065. }
  18066. return continueChain;
  18067. }
  18068. /**
  18069. * @function Events.prototype.handleBrowserEvent
  18070. * @description 对 triggerEvent 函数的包装,给事件对象设置了 xy 属性(即当前鼠标点的 xy 坐标)。
  18071. * @param {Event} evt - 事件对象。
  18072. */
  18073. handleBrowserEvent(evt) {
  18074. var type = evt.type, listeners = this.listeners[type];
  18075. if (!listeners || listeners.length == 0) {
  18076. // noone's listening, bail out
  18077. return;
  18078. }
  18079. // add clientX & clientY to all events - corresponds to average x, y
  18080. var touches = evt.touches;
  18081. if (touches && touches[0]) {
  18082. var x = 0;
  18083. var y = 0;
  18084. var num = touches.length;
  18085. var touch;
  18086. for (var i = 0; i < num; ++i) {
  18087. touch = touches[i];
  18088. x += touch.clientX;
  18089. y += touch.clientY;
  18090. }
  18091. evt.clientX = x / num;
  18092. evt.clientY = y / num;
  18093. }
  18094. if (this.includeXY) {
  18095. evt.xy = this.getMousePosition(evt);
  18096. }
  18097. this.triggerEvent(type, evt);
  18098. }
  18099. /**
  18100. * @function Events.prototype.clearMouseCache
  18101. * @description 清除鼠标缓存。
  18102. */
  18103. clearMouseCache() {
  18104. this.element.scrolls = null;
  18105. this.element.lefttop = null;
  18106. var body = document.body;
  18107. if (body && !((body.scrollTop != 0 || body.scrollLeft != 0) &&
  18108. navigator.userAgent.match(/iPhone/i))) {
  18109. this.element.offsets = null;
  18110. }
  18111. }
  18112. /**
  18113. * @function Events.prototype.getMousePosition
  18114. * @description 获取当前鼠标的位置。
  18115. * @param {Event} evt - 事件对象。
  18116. * @returns {Pixel} 当前的鼠标的 xy 坐标点。
  18117. */
  18118. getMousePosition(evt) {
  18119. if (!this.includeXY) {
  18120. this.clearMouseCache();
  18121. } else if (!this.element.hasScrollEvent) {
  18122. Event.observe(window, "scroll", this.clearMouseListener);
  18123. this.element.hasScrollEvent = true;
  18124. }
  18125. if (!this.element.scrolls) {
  18126. var viewportElement = Util_Util.getViewportElement();
  18127. this.element.scrolls = [
  18128. viewportElement.scrollLeft,
  18129. viewportElement.scrollTop
  18130. ];
  18131. }
  18132. if (!this.element.lefttop) {
  18133. this.element.lefttop = [
  18134. (document.documentElement.clientLeft || 0),
  18135. (document.documentElement.clientTop || 0)
  18136. ];
  18137. }
  18138. if (!this.element.offsets) {
  18139. this.element.offsets = Util_Util.pagePosition(this.element);
  18140. }
  18141. return new Pixel(
  18142. (evt.clientX + this.element.scrolls[0]) - this.element.offsets[0]
  18143. - this.element.lefttop[0],
  18144. (evt.clientY + this.element.scrolls[1]) - this.element.offsets[1]
  18145. - this.element.lefttop[1]
  18146. );
  18147. }
  18148. }
  18149. Events.prototype.BROWSER_EVENTS = [
  18150. "mouseover", "mouseout",
  18151. "mousedown", "mouseup", "mousemove",
  18152. "click", "dblclick", "rightclick", "dblrightclick",
  18153. "resize", "focus", "blur",
  18154. "touchstart", "touchmove", "touchend",
  18155. "keydown", "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
  18156. "MSGestureStart", "MSGestureChange", "MSGestureEnd",
  18157. "contextmenu"
  18158. ];
  18159. ;// CONCATENATED MODULE: ./src/common/commontypes/Credential.js
  18160. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  18161. * This program are made available under the terms of the Apache License, Version 2.0
  18162. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18163. /**
  18164. * @class Credential
  18165. * @deprecatedclass SuperMap.Credential
  18166. * @category Security
  18167. * @classdesc SuperMap 的安全证书类,其中包括 token 等安全验证信息。</br>
  18168. * 需要使用用户名和密码在:"http://localhost:8090/iserver/services/security/tokens" 下申请 value。</br>
  18169. * 获得形如:"2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ.." 的 value。</br>
  18170. * 目前支持的功能包括:地图服务、专题图、量算、查询、公交换乘、空间分析、网络分析,不支持轮询功能。</br>
  18171. * @param {string} value - 访问受安全限制的服务时用于通过安全认证的验证信息。
  18172. * @param {string} [name='token'] - 验证信息前缀,name=value 部分的 name 部分。
  18173. * @example
  18174. * var pixcel = new Credential("valueString","token");
  18175. * pixcel.destroy();
  18176. * @usage
  18177. */
  18178. class Credential {
  18179. constructor(value, name) {
  18180. /**
  18181. * @member {string} Credential.prototype.value
  18182. * @description 访问受安全限制的服务时用于通过安全认证的验证信息。
  18183. */
  18184. this.value = value ? value : "";
  18185. /**
  18186. * @member {string} [Credential.prototype.name='token']
  18187. * @description 验证信息前缀,name=value 部分的 name 部分。
  18188. */
  18189. this.name = name ? name : "token";
  18190. this.CLASS_NAME = "SuperMap.Credential";
  18191. }
  18192. /**
  18193. * @function Credential.prototype.getUrlParameters
  18194. * @description 获取 name=value 的表达式。
  18195. * @example
  18196. * var credential = new Credential("valueString","token");
  18197. * //这里 str = "token=valueString";
  18198. * var str = credential.getUrlParameters();
  18199. * @returns {string} 安全信息组成的 url 片段。
  18200. */
  18201. getUrlParameters() {
  18202. //当需要其他安全信息的时候,则需要return this.name + "=" + this.value + "&" + "...";的形式添加。
  18203. return this.name + "=" + this.value;
  18204. }
  18205. /**
  18206. * @function Credential.prototype.getValue
  18207. * @description 获取 value。
  18208. * @example
  18209. * var credential = new Credential("2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ..","token");
  18210. * //这里 str = "2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ..";
  18211. * var str = credential.getValue();
  18212. * @returns {string} value 字符串,在 iServer 服务下该 value 值即为 token 值。
  18213. */
  18214. getValue() {
  18215. return this.value;
  18216. }
  18217. /**
  18218. *
  18219. * @function Credential.prototype.destroy
  18220. * @description 销毁此对象。销毁后此对象的所有属性为 null,而不是初始值。
  18221. * @example
  18222. * var credential = new Credential("valueString","token");
  18223. * credential.destroy();
  18224. */
  18225. destroy() {
  18226. this.value = null;
  18227. this.name = null;
  18228. }
  18229. }
  18230. /**
  18231. * @member {Credential} Credential.CREDENTIAL
  18232. * @description 这个对象保存一个安全类的实例,在服务端需要安全验证的时候必须进行设置。
  18233. * @example
  18234. * 代码实例:
  18235. * // 当iServer启用服务安全的时候,下边的代码是必须的。安全证书类能够接收一个value和一个name参数。
  18236. * var value = "(以iServer为例,这里是申请的token值)";
  18237. * var name = "token";
  18238. * // 默认name参数为token,所以当使用iServer服务的时候可以不进行设置。
  18239. * Credential.CREDENTIAL = new Credential(value, name);
  18240. *
  18241. */
  18242. Credential.CREDENTIAL = null;
  18243. ;// CONCATENATED MODULE: ./src/common/security/SecurityManager.js
  18244. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  18245. * This program are made available under the terms of the Apache License, Version 2.0
  18246. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18247. /**
  18248. * @class SecurityManager
  18249. * @deprecatedclass SuperMap.SecurityManager
  18250. * @category Security
  18251. * @classdesc 安全管理中心,提供 iServer,iPortal,Online 统一权限认证管理。
  18252. * > 使用说明:
  18253. * > 创建任何一个服务之前调用 {@link SecurityManager.registerToken}或
  18254. * > {@link SecurityManager.registerKey}注册凭据。
  18255. * > 发送请求时根据 URL 或者服务 ID 获取相应的 key 或者 token 并自动添加到服务地址中。
  18256. * @usage
  18257. */
  18258. class SecurityManager {
  18259. /**
  18260. * @description 从服务器获取一个token,在此之前要注册服务器信息。
  18261. * @function SecurityManager.generateToken
  18262. * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
  18263. * @param {TokenServiceParameter} tokenParam - token 申请参数。
  18264. * @returns {Promise} 包含 token 信息的 Promise 对象。
  18265. */
  18266. static generateToken(url, tokenParam) {
  18267. var serverInfo = this.servers[url];
  18268. if (!serverInfo) {
  18269. return;
  18270. }
  18271. return FetchRequest.post(serverInfo.tokenServiceUrl, JSON.stringify(tokenParam.toJSON())).then(function(
  18272. response
  18273. ) {
  18274. return response.text();
  18275. });
  18276. }
  18277. /**
  18278. * @description 注册安全服务器相关信息。
  18279. * @function SecurityManager.registerServers
  18280. * @param {ServerInfo} serverInfos - 服务器信息。
  18281. */
  18282. static registerServers(serverInfos) {
  18283. this.servers = this.servers || {};
  18284. if (!Util_Util.isArray(serverInfos)) {
  18285. serverInfos = [serverInfos];
  18286. }
  18287. for (var i = 0; i < serverInfos.length; i++) {
  18288. var serverInfo = serverInfos[i];
  18289. this.servers[serverInfo.server] = serverInfo;
  18290. }
  18291. }
  18292. /**
  18293. * @description 服务请求都会自动带上这个 token。
  18294. * @function SecurityManager.registerToken
  18295. * @param {string} url -服务器域名+端口:如http://localhost:8090。
  18296. * @param {string} token - token。
  18297. */
  18298. static registerToken(url, token) {
  18299. this.tokens = this.tokens || {};
  18300. if (!url || !token) {
  18301. return;
  18302. }
  18303. var domain = this._getTokenStorageKey(url);
  18304. this.tokens[domain] = token;
  18305. }
  18306. /**
  18307. * @description 注册 key,ids 为数组(存在一个 key 对应多个服务)。
  18308. * @function SecurityManager.registerKey
  18309. * @param {Array} ids - 可以是服务 ID 数组或者 URL 地址数组或者 webAPI 类型数组。
  18310. * @param {string} key - key。
  18311. */
  18312. static registerKey(ids, key) {
  18313. this.keys = this.keys || {};
  18314. if (!ids || ids.length < 1 || !key) {
  18315. return;
  18316. }
  18317. ids = Util_Util.isArray(ids) ? ids : [ids];
  18318. for (var i = 0; i < ids.length; i++) {
  18319. var id = this._getUrlRestString(ids[0]) || ids[0];
  18320. this.keys[id] = key;
  18321. }
  18322. }
  18323. /**
  18324. * @description 获取服务器信息。
  18325. * @function SecurityManager.getServerInfo
  18326. * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
  18327. * @returns {ServerInfo} 服务器信息。
  18328. */
  18329. static getServerInfo(url) {
  18330. this.servers = this.servers || {};
  18331. return this.servers[url];
  18332. }
  18333. /**
  18334. * @description 根据 URL 获取token。
  18335. * @function SecurityManager.getToken
  18336. * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
  18337. * @returns {string} token。
  18338. */
  18339. static getToken(url) {
  18340. if (!url) {
  18341. return;
  18342. }
  18343. this.tokens = this.tokens || {};
  18344. var domain = this._getTokenStorageKey(url);
  18345. return this.tokens[domain];
  18346. }
  18347. /**
  18348. * @description 根据 URL 获取 key。
  18349. * @function SecurityManager.getKey
  18350. * @param {string} id - ID。
  18351. * @returns {string} key。
  18352. */
  18353. static getKey(id) {
  18354. this.keys = this.keys || {};
  18355. var key = this._getUrlRestString(id) || id;
  18356. return this.keys[key];
  18357. }
  18358. /**
  18359. * @description iServer 登录验证。
  18360. * @function SecurityManager.loginiServer
  18361. * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
  18362. * @param {string} username - 用户名。
  18363. * @param {string} password - 密码。
  18364. * @param {boolean} [rememberme=false] - 是否记住。
  18365. * @returns {Promise} 包含 iServer 登录请求结果的 Promise 对象。
  18366. */
  18367. static loginiServer(url, username, password, rememberme) {
  18368. url = Util_Util.urlPathAppend(url, 'services/security/login');
  18369. var loginInfo = {
  18370. username: username && username.toString(),
  18371. password: password && password.toString(),
  18372. rememberme: rememberme
  18373. };
  18374. loginInfo = JSON.stringify(loginInfo);
  18375. var requestOptions = {
  18376. headers: {
  18377. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  18378. }
  18379. };
  18380. return FetchRequest.post(url, loginInfo, requestOptions).then(function(response) {
  18381. return response.json();
  18382. });
  18383. }
  18384. /**
  18385. * @description iServer登出。
  18386. * @function SecurityManager.logoutiServer
  18387. * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
  18388. * @returns {Promise} 是否登出成功。
  18389. */
  18390. static logoutiServer(url) {
  18391. url = Util_Util.urlPathAppend(url, 'services/security/logout');
  18392. var requestOptions = {
  18393. headers: {
  18394. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  18395. },
  18396. withoutFormatSuffix: true
  18397. };
  18398. return FetchRequest.get(url, '', requestOptions)
  18399. .then(function() {
  18400. return true;
  18401. })
  18402. .catch(function() {
  18403. return false;
  18404. });
  18405. }
  18406. /**
  18407. * @description Online 登录验证。
  18408. * @function SecurityManager.loginOnline
  18409. * @param {string} callbackLocation - 跳转位置。
  18410. * @param {boolean} [newTab=true] - 是否新窗口打开。
  18411. */
  18412. static loginOnline(callbackLocation, newTab) {
  18413. var loginUrl = SecurityManager.SSO + '/login?service=' + callbackLocation;
  18414. this._open(loginUrl, newTab);
  18415. }
  18416. /**
  18417. * @description iPortal登录验证。
  18418. * @function SecurityManager.loginiPortal
  18419. * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal。
  18420. * @param {string} username - 用户名。
  18421. * @param {string} password - 密码。
  18422. * @returns {Promise} 包含 iPortal 登录请求结果的 Promise 对象。
  18423. */
  18424. static loginiPortal(url, username, password) {
  18425. url = Util_Util.urlPathAppend(url, 'web/login');
  18426. var loginInfo = {
  18427. username: username && username.toString(),
  18428. password: password && password.toString()
  18429. };
  18430. loginInfo = JSON.stringify(loginInfo);
  18431. var requestOptions = {
  18432. headers: {
  18433. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  18434. },
  18435. withCredentials: true
  18436. };
  18437. return FetchRequest.post(url, loginInfo, requestOptions).then(function(response) {
  18438. return response.json();
  18439. });
  18440. }
  18441. /**
  18442. * @description iPortal 登出。
  18443. * @function SecurityManager.logoutiPortal
  18444. * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal。
  18445. * @returns {Promise} 如果登出成功,返回 true;否则返回 false。
  18446. */
  18447. static logoutiPortal(url) {
  18448. url = Util_Util.urlPathAppend(url, 'services/security/logout');
  18449. var requestOptions = {
  18450. headers: {
  18451. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  18452. },
  18453. withCredentials: true,
  18454. withoutFormatSuffix: true
  18455. };
  18456. return FetchRequest.get(url, '', requestOptions)
  18457. .then(function() {
  18458. return true;
  18459. })
  18460. .catch(function() {
  18461. return false;
  18462. });
  18463. }
  18464. /**
  18465. * @description iManager 登录验证。
  18466. * @function SecurityManager.loginManager
  18467. * @param {string} url - iManager 地址。地址参数为 iManager 首页地址,如: http://localhost:8390/imanager。
  18468. * @param {Object} [loginInfoParams] - iManager 登录参数。
  18469. * @param {string} loginInfoParams.userName - 用户名。
  18470. * @param {string} loginInfoParams.password - 密码。
  18471. * @param {Object} options
  18472. * @param {boolean} [options.isNewTab=true] - 不同域时是否在新窗口打开登录页面。
  18473. * @returns {Promise} 包含 iManager 登录请求结果的 Promise 对象。
  18474. */
  18475. static loginManager(url, loginInfoParams, options) {
  18476. if (!Util_Util.isInTheSameDomain(url)) {
  18477. var isNewTab = options ? options.isNewTab : true;
  18478. this._open(url, isNewTab);
  18479. return;
  18480. }
  18481. var requestUrl = Util_Util.urlPathAppend(url, 'icloud/security/tokens');
  18482. var params = loginInfoParams || {};
  18483. var loginInfo = {
  18484. username: params.userName && params.userName.toString(),
  18485. password: params.password && params.password.toString()
  18486. };
  18487. loginInfo = JSON.stringify(loginInfo);
  18488. var requestOptions = {
  18489. headers: {
  18490. Accept: '*/*',
  18491. 'Content-Type': 'application/json'
  18492. }
  18493. };
  18494. var me = this;
  18495. return FetchRequest.post(requestUrl, loginInfo, requestOptions).then(function(response) {
  18496. response.text().then(function(result) {
  18497. me.imanagerToken = result;
  18498. return result;
  18499. });
  18500. });
  18501. }
  18502. /**
  18503. * @description 清空全部验证信息。
  18504. * @function SecurityManager.destroyAllCredentials
  18505. */
  18506. static destroyAllCredentials() {
  18507. this.keys = null;
  18508. this.tokens = null;
  18509. this.servers = null;
  18510. }
  18511. /**
  18512. * @description 清空令牌信息。
  18513. * @function SecurityManager.destroyToken
  18514. * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal。
  18515. */
  18516. static destroyToken(url) {
  18517. if (!url) {
  18518. return;
  18519. }
  18520. var domain = this._getTokenStorageKey(url);
  18521. this.tokens = this.tokens || {};
  18522. if (this.tokens[domain]) {
  18523. delete this.tokens[domain];
  18524. }
  18525. }
  18526. /**
  18527. * @description 清空服务授权码。
  18528. * @function SecurityManager.destroyKey
  18529. * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
  18530. */
  18531. static destroyKey(url) {
  18532. if (!url) {
  18533. return;
  18534. }
  18535. this.keys = this.keys || {};
  18536. var key = this._getUrlRestString(url) || url;
  18537. if (this.keys[key]) {
  18538. delete this.keys[key];
  18539. }
  18540. }
  18541. /**
  18542. * @description 服务URL追加授权信息,授权信息需先通过SecurityManager.registerKey或SecurityManager.registerToken注册。
  18543. * @version 10.1.2
  18544. * @function SecurityManager.appendCredential
  18545. * @param {string} url - 服务URL。
  18546. * @returns {string} 绑定了token或者key的服务URL。
  18547. */
  18548. static appendCredential(url) {
  18549. var newUrl = url;
  18550. var value = this.getToken(url);
  18551. var credential = value ? new Credential(value, 'token') : null;
  18552. if (!credential) {
  18553. value = this.getKey(url);
  18554. credential = value ? new Credential(value, 'key') : null;
  18555. }
  18556. if (credential) {
  18557. newUrl = Util_Util.urlAppend(newUrl, credential.getUrlParameters());
  18558. }
  18559. return newUrl;
  18560. }
  18561. static _open(url, newTab) {
  18562. newTab = newTab != null ? newTab : true;
  18563. var offsetX = window.screen.availWidth / 2 - this.INNER_WINDOW_WIDTH / 2;
  18564. var offsetY = window.screen.availHeight / 2 - this.INNER_WINDOW_HEIGHT / 2;
  18565. var options =
  18566. 'height=' +
  18567. this.INNER_WINDOW_HEIGHT +
  18568. ', width=' +
  18569. this.INNER_WINDOW_WIDTH +
  18570. ',top=' +
  18571. offsetY +
  18572. ', left=' +
  18573. offsetX +
  18574. ',toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no';
  18575. if (newTab) {
  18576. window.open(url, 'login');
  18577. } else {
  18578. window.open(url, 'login', options);
  18579. }
  18580. }
  18581. static _getTokenStorageKey(url) {
  18582. var patten = /(.*?):\/\/([^\/]+)/i;
  18583. var result = url.match(patten);
  18584. if (!result) {
  18585. return url;
  18586. }
  18587. return result[0];
  18588. }
  18589. static _getUrlRestString(url) {
  18590. if (!url) {
  18591. return url;
  18592. }
  18593. // var patten = /http:\/\/(.*\/rest)/i;
  18594. var patten = /(http|https):\/\/(.*\/rest)/i;
  18595. var result = url.match(patten);
  18596. if (!result) {
  18597. return url;
  18598. }
  18599. return result[0];
  18600. }
  18601. }
  18602. SecurityManager.INNER_WINDOW_WIDTH = 600;
  18603. SecurityManager.INNER_WINDOW_HEIGHT = 600;
  18604. SecurityManager.SSO = 'https://sso.supermap.com';
  18605. SecurityManager.ONLINE = 'https://www.supermapol.com';
  18606. ;// CONCATENATED MODULE: ./src/common/iServer/CommonServiceBase.js
  18607. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  18608. * This program are made available under the terms of the Apache License, Version 2.0
  18609. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18610. /**
  18611. * @class CommonServiceBase
  18612. * @deprecatedclass SuperMap.CommonServiceBase
  18613. * @category iServer Core
  18614. * @classdesc 对接 iServer 各种服务的 Service 的基类。
  18615. * @param {string} url - 服务地址。
  18616. * @param {Object} options - 参数。
  18617. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  18618. * @param {string} [options.proxy] - 服务代理地址。
  18619. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  18620. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  18621. * @param {Object} [options.headers] - 请求头。
  18622. * @usage
  18623. */
  18624. class CommonServiceBase {
  18625. constructor(url, options) {
  18626. let me = this;
  18627. this.EVENT_TYPES = ['processCompleted', 'processFailed'];
  18628. this.events = null;
  18629. this.eventListeners = null;
  18630. this.url = null;
  18631. this.urls = null;
  18632. this.proxy = null;
  18633. this.index = null;
  18634. this.length = null;
  18635. this.totalTimes = null;
  18636. this.POLLING_TIMES = 3;
  18637. this.isInTheSameDomain = null;
  18638. this.withCredentials = false;
  18639. if (Util_Util.isArray(url)) {
  18640. me.urls = url;
  18641. me.length = url.length;
  18642. me.totalTimes = me.length;
  18643. if (me.length === 1) {
  18644. me.url = url[0];
  18645. } else {
  18646. me.index = parseInt(Math.random() * me.length);
  18647. me.url = url[me.index];
  18648. }
  18649. } else {
  18650. me.totalTimes = 1;
  18651. me.url = url;
  18652. }
  18653. if (Util_Util.isArray(url) && !me.isServiceSupportPolling()) {
  18654. me.url = url[0];
  18655. me.totalTimes = 1;
  18656. }
  18657. options = options || {};
  18658. this.crossOrigin = options.crossOrigin;
  18659. this.headers = options.headers;
  18660. Util_Util.extend(this, options);
  18661. me.isInTheSameDomain = Util_Util.isInTheSameDomain(me.url);
  18662. me.events = new Events(me, null, me.EVENT_TYPES, true);
  18663. if (me.eventListeners instanceof Object) {
  18664. me.events.on(me.eventListeners);
  18665. }
  18666. this.CLASS_NAME = 'SuperMap.CommonServiceBase';
  18667. }
  18668. /**
  18669. * @function CommonServiceBase.prototype.destroy
  18670. * @description 释放资源,将引用的资源属性置空。
  18671. */
  18672. destroy() {
  18673. let me = this;
  18674. if (Util_Util.isArray(me.urls)) {
  18675. me.urls = null;
  18676. me.index = null;
  18677. me.length = null;
  18678. me.totalTimes = null;
  18679. }
  18680. me.url = null;
  18681. me._processSuccess = null;
  18682. me._processFailed = null;
  18683. me.isInTheSameDomain = null;
  18684. me.EVENT_TYPES = null;
  18685. if (me.events) {
  18686. me.events.destroy();
  18687. me.events = null;
  18688. }
  18689. if (me.eventListeners) {
  18690. me.eventListeners = null;
  18691. }
  18692. }
  18693. /**
  18694. * @function CommonServiceBase.prototype.request
  18695. * @description: 该方法用于向服务发送请求。
  18696. * @param {Object} options - 参数。
  18697. * @param {string} [options.method='GET'] - 请求方式,包括 "GET","POST","PUT","DELETE"。
  18698. * @param {string} [options.url] - 发送请求的地址。
  18699. * @param {Object} [options.params] - 作为查询字符串添加到 URL 中的一组键值对,此参数只适用于 GET 方式发送的请求。
  18700. * @param {string} [options.data] - 发送到服务器的数据。
  18701. * @param {function} options.success - 请求成功后的回调函数。
  18702. * @param {function} options.failure - 请求失败后的回调函数。
  18703. * @param {Object} [options.scope] - 如果回调函数是对象的一个公共方法,设定该对象的范围。
  18704. * @param {boolean} [options.isInTheSameDomain] - 请求是否在当前域中。
  18705. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  18706. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  18707. * @param {Object} [options.headers] - 请求头。
  18708. */
  18709. request(options) {
  18710. const format = options.scope.format;
  18711. if (format && !this.supportDataFormat(format)) {
  18712. throw new Error(`${this.CLASS_NAME} is not surport ${format} format!`);
  18713. }
  18714. let me = this;
  18715. options.url = options.url || me.url;
  18716. if (this._returnContent(options) && !options.url.includes('returnContent=true')) {
  18717. options.url = Util_Util.urlAppend(options.url, 'returnContent=true');
  18718. }
  18719. options.proxy = options.proxy || me.proxy;
  18720. options.withCredentials = options.withCredentials != undefined ? options.withCredentials : me.withCredentials;
  18721. options.crossOrigin = options.crossOrigin != undefined ? options.crossOrigin : me.crossOrigin;
  18722. options.headers = options.headers || me.headers;
  18723. options.isInTheSameDomain = me.isInTheSameDomain;
  18724. options.withoutFormatSuffix = options.scope.withoutFormatSuffix || false;
  18725. //为url添加安全认证信息片段
  18726. options.url = SecurityManager.appendCredential(options.url);
  18727. me.calculatePollingTimes();
  18728. options.scope = me;
  18729. var success = options.scope? options.success.bind(options.scope) : options.success;
  18730. var failure = options.scope? options.failure.bind(options.scope) : options.failure;
  18731. options.success = me.getUrlCompleted(success, options);
  18732. options.failure = me.getUrlFailed(failure, options);
  18733. me._commit(options);
  18734. }
  18735. /**
  18736. * @function CommonServiceBase.prototype.getUrlCompleted
  18737. * @description 请求成功后执行此方法。
  18738. * @param {Object} cb - 成功回调函数。
  18739. * @param {Object} options - 请求参数对象。
  18740. * @private
  18741. */
  18742. getUrlCompleted(cb, options) {
  18743. // @param {Object} result - 服务器返回的结果对象。
  18744. return function(result) {
  18745. cb && cb(result, options);
  18746. }
  18747. }
  18748. /**
  18749. * @function CommonServiceBase.prototype.getUrlFailed
  18750. * @description 请求失败后执行此方法。
  18751. * @param {Object} cb - 失败回调函数。
  18752. * @param {Object} options - 请求参数对象。
  18753. * @private
  18754. */
  18755. getUrlFailed(cb, options) {
  18756. const me = this;
  18757. // @param {Object} result - 服务器返回的结果对象。
  18758. return function(result) {
  18759. if (me.totalTimes > 0) {
  18760. me.totalTimes--;
  18761. me.ajaxPolling(options);
  18762. } else {
  18763. cb && cb(result, options);
  18764. }
  18765. }
  18766. }
  18767. /**
  18768. *
  18769. * @function CommonServiceBase.prototype.ajaxPolling
  18770. * @description 请求失败后,如果剩余请求失败次数不为 0,重新获取 URL 发送请求。
  18771. * @param {Object} options - 请求参数对象。
  18772. * @private
  18773. */
  18774. ajaxPolling(options) {
  18775. let me = this,
  18776. url = options.url,
  18777. re = /^http:\/\/([a-z]{9}|(\d+\.){3}\d+):\d{0,4}/;
  18778. me.index = parseInt(Math.random() * me.length);
  18779. me.url = me.urls[me.index];
  18780. url = url.replace(re, re.exec(me.url)[0]);
  18781. options.url = url;
  18782. options.isInTheSameDomain = Util_Util.isInTheSameDomain(url);
  18783. me._commit(options);
  18784. }
  18785. /**
  18786. * @function CommonServiceBase.prototype.calculatePollingTimes
  18787. * @description 计算剩余请求失败执行次数。
  18788. */
  18789. calculatePollingTimes() {
  18790. let me = this;
  18791. if (me.times) {
  18792. if (me.totalTimes > me.POLLING_TIMES) {
  18793. if (me.times > me.POLLING_TIMES) {
  18794. me.totalTimes = me.POLLING_TIMES;
  18795. } else {
  18796. me.totalTimes = me.times;
  18797. }
  18798. } else {
  18799. if (me.times < me.totalTimes) {
  18800. me.totalTimes = me.times;
  18801. }
  18802. }
  18803. } else {
  18804. if (me.totalTimes > me.POLLING_TIMES) {
  18805. me.totalTimes = me.POLLING_TIMES;
  18806. }
  18807. }
  18808. me.totalTimes--;
  18809. }
  18810. /**
  18811. * @function CommonServiceBase.prototype.isServiceSupportPolling
  18812. * @description 判断服务是否支持轮询。
  18813. */
  18814. isServiceSupportPolling() {
  18815. let me = this;
  18816. return !(
  18817. me.CLASS_NAME === 'SuperMap.REST.ThemeService' || me.CLASS_NAME === 'SuperMap.REST.EditFeaturesService'
  18818. );
  18819. }
  18820. /**
  18821. * @function CommonServiceBase.prototype.serviceProcessCompleted
  18822. * @description 状态完成,执行此方法。
  18823. * @param {Object} result - 服务器返回的结果对象。
  18824. * @param {Object} options - 请求参数对象。
  18825. * @private
  18826. */
  18827. serviceProcessCompleted(result, options) {
  18828. result = Util_Util.transformResult(result);
  18829. this.events.triggerEvent('processCompleted', {
  18830. result: result,
  18831. options: options
  18832. });
  18833. }
  18834. /**
  18835. * @function CommonServiceBase.prototype.serviceProcessFailed
  18836. * @description 状态失败,执行此方法。
  18837. * @param {Object} result - 服务器返回的结果对象。
  18838. * @param {Object} options - 请求参数对象。对象
  18839. * @private
  18840. */
  18841. serviceProcessFailed(result, options) {
  18842. result = Util_Util.transformResult(result);
  18843. let error = result.error || result;
  18844. this.events.triggerEvent('processFailed', {
  18845. error: error,
  18846. options: options
  18847. });
  18848. }
  18849. _returnContent(options) {
  18850. if (options.scope.format === DataFormat.FGB) {
  18851. return false;
  18852. }
  18853. if (options.scope.returnContent) {
  18854. return true;
  18855. }
  18856. return false;
  18857. }
  18858. supportDataFormat(foramt) {
  18859. return this.dataFormat().includes(foramt);
  18860. }
  18861. dataFormat() {
  18862. return [DataFormat.GEOJSON, DataFormat.ISERVER];
  18863. }
  18864. _commit(options) {
  18865. if (options.method === 'POST' || options.method === 'PUT' || options.method === 'PATCH') {
  18866. if (options.params) {
  18867. options.url = Util_Util.urlAppend(options.url, Util_Util.getParameterString(options.params || {}));
  18868. }
  18869. if (typeof options.data === 'object') {
  18870. try {
  18871. options.params = Util_Util.toJSON(options.data);
  18872. } catch (e) {
  18873. console.log('不是json对象');
  18874. }
  18875. } else {
  18876. options.params = options.data;
  18877. }
  18878. }
  18879. FetchRequest.commit(options.method, options.url, options.params, {
  18880. headers: options.headers,
  18881. withoutFormatSuffix: options.withoutFormatSuffix,
  18882. withCredentials: options.withCredentials,
  18883. crossOrigin: options.crossOrigin,
  18884. timeout: options.async ? 0 : null,
  18885. proxy: options.proxy
  18886. })
  18887. .then(function (response) {
  18888. if (response.text) {
  18889. return response.text();
  18890. }
  18891. if (response.json) {
  18892. return response.json();
  18893. }
  18894. return response;
  18895. })
  18896. .then(function (text) {
  18897. let requestResult = text;
  18898. if (typeof text === 'string') {
  18899. requestResult = new JSONFormat().read(text);
  18900. }
  18901. if (
  18902. !requestResult ||
  18903. requestResult.error ||
  18904. (requestResult.code >= 300 && requestResult.code !== 304)
  18905. ) {
  18906. if (requestResult && requestResult.error) {
  18907. requestResult = {
  18908. error: requestResult.error
  18909. };
  18910. } else {
  18911. requestResult = {
  18912. error: requestResult
  18913. };
  18914. }
  18915. }
  18916. if (requestResult && options.scope.format === DataFormat.FGB) {
  18917. requestResult.newResourceLocation = requestResult.newResourceLocation.replace('.json', '') + '.fgb';
  18918. }
  18919. return requestResult;
  18920. })
  18921. .catch(function (e) {
  18922. return { error: e };
  18923. })
  18924. .then((requestResult) => {
  18925. if (requestResult.error) {
  18926. var failure = options.scope ? FunctionExt.bind(options.failure, options.scope) : options.failure;
  18927. failure(requestResult);
  18928. } else {
  18929. requestResult.succeed = requestResult.succeed == undefined ? true : requestResult.succeed;
  18930. var success = options.scope ? FunctionExt.bind(options.success, options.scope) : options.success;
  18931. success(requestResult);
  18932. }
  18933. });
  18934. }
  18935. }
  18936. /**
  18937. * 服务器请求回调函数。
  18938. * @callback RequestCallback
  18939. * @category BaseTypes Util
  18940. * @example
  18941. * var requestCallback = function (serviceResult){
  18942. * console.log(serviceResult.result);
  18943. * }
  18944. * new QueryService(url).queryByBounds(param, requestCallback);
  18945. * @param {Object} serviceResult
  18946. * @param {Object} serviceResult.result 服务器返回结果。
  18947. * @param {Object} serviceResult.object 发布应用程序事件的对象。
  18948. * @param {Object} serviceResult.type 事件类型。
  18949. * @param {Object} serviceResult.element 接受浏览器事件的 DOM 节点。
  18950. * @param {Object} serviceResult.options 请求参数。
  18951. */
  18952. ;// CONCATENATED MODULE: ./src/common/iServer/GeoCodingParameter.js
  18953. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  18954. * This program are made available under the terms of the Apache License, Version 2.0
  18955. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18956. /**
  18957. * @class GeoCodingParameter
  18958. * @deprecatedclass SuperMap.GeoCodingParameter
  18959. * @category iServer AddressMatch
  18960. * @classdesc 地理正向匹配参数类。
  18961. * @param {Object} options - 参数。
  18962. * @param {string} options.address - 地点关键词。
  18963. * @param {number} [options.fromIndex] - 设置返回对象的起始索引值。
  18964. * @param {number} [options.toIndex] - 设置返回对象的结束索引值。
  18965. * @param {Array.<string>} [options.filters] - 过滤字段,限定查询区域。
  18966. * @param {string} [options.prjCoordSys] - 查询结果的坐标系。
  18967. * @param {number} [options.maxReturn] - 最大返回结果数。
  18968. * @usage
  18969. */
  18970. class GeoCodingParameter {
  18971. constructor(options) {
  18972. if (options.filters && typeof(options.filters) === 'string') {
  18973. options.filters = options.filters.split(',');
  18974. }
  18975. /**
  18976. * @member {string} GeoCodingParameter.prototype.address
  18977. * @description 地点关键词。
  18978. */
  18979. this.address = null;
  18980. /**
  18981. * @member {number} [GeoCodingParameter.prototype.fromIndex]
  18982. * @description 设置返回对象的起始索引值。
  18983. */
  18984. this.fromIndex = null;
  18985. /**
  18986. * @member {number} [GeoCodingParameter.prototype.toIndex]
  18987. * @description 设置返回对象的结束索引值。
  18988. */
  18989. this.toIndex = null;
  18990. /**
  18991. * @member {Array.<string>} [GeoCodingParameter.prototype.filters]
  18992. * @description 过滤字段,限定查询区域。
  18993. */
  18994. this.filters = null;
  18995. /**
  18996. * @member {string} [GeoCodingParameter.prototype.prjCoordSys]
  18997. * @description 查询结果的坐标系。
  18998. */
  18999. this.prjCoordSys = null;
  19000. /**
  19001. * @member {number} [GeoCodingParameter.prototype.maxReturn]
  19002. * @description 最大返回结果数。
  19003. */
  19004. this.maxReturn = null;
  19005. Util_Util.extend(this, options);
  19006. }
  19007. /**
  19008. * @function GeoCodingParameter.prototype.destroy
  19009. * @description 释放资源,将引用资源的属性置空。
  19010. */
  19011. destroy() {
  19012. this.address = null;
  19013. this.fromIndex = null;
  19014. this.toIndex = null;
  19015. this.filters = null;
  19016. this.prjCoordSys = null;
  19017. this.maxReturn = null;
  19018. }
  19019. }
  19020. ;// CONCATENATED MODULE: ./src/common/iServer/GeoDecodingParameter.js
  19021. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  19022. * This program are made available under the terms of the Apache License, Version 2.0
  19023. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19024. /**
  19025. * @class GeoDecodingParameter
  19026. * @deprecatedclass SuperMap.GeoDecodingParameter
  19027. * @category iServer AddressMatch
  19028. * @classdesc 地理反向匹配参数类。
  19029. * @param {Object} options - 参数。
  19030. * @param {number} options.x - 查询位置的横坐标。
  19031. * @param {number} options.y - 查询位置的纵坐标。
  19032. * @param {number} [options.fromIndex] - 设置返回对象的起始索引值。
  19033. * @param {number} [options.toIndex] - 设置返回对象的结束索引值。
  19034. * @param {Array.<string>} [options.filters] - 过滤字段,限定查询区域。
  19035. * @param {string} [options.prjCoordSys] - 查询结果的坐标系。
  19036. * @param {number} [options.maxReturn] - 最大返回结果数。
  19037. * @param {number} [options.geoDecodingRadius] - 查询半径。
  19038. * @usage
  19039. */
  19040. class GeoDecodingParameter {
  19041. constructor(options) {
  19042. if (options.filters) {
  19043. options.filters = options.filters.split(',');
  19044. }
  19045. /**
  19046. * @member {number} GeoDecodingParameter.prototype.x
  19047. * @description 查询位置的横坐标。
  19048. */
  19049. this.x = null;
  19050. /**
  19051. * @member {number} GeoDecodingParameter.prototype.y
  19052. * @description 查询位置的纵坐标。
  19053. */
  19054. this.y = null;
  19055. /**
  19056. * @member {number} [GeoDecodingParameter.prototype.fromIndex]
  19057. * @description 设置返回对象的起始索引值。
  19058. */
  19059. this.fromIndex = null;
  19060. /**
  19061. * @member {number} [GeoDecodingParameter.prototype.toIndex]
  19062. * @description 设置返回对象的结束索引值。
  19063. */
  19064. this.toIndex = null;
  19065. /**
  19066. * @member {Array.<string>} [GeoDecodingParameter.prototype.filters]
  19067. * @description 过滤字段,限定查询区域。
  19068. */
  19069. this.filters = null;
  19070. /**
  19071. * @member {string} [GeoDecodingParameter.prototype.prjCoordSys]
  19072. * @description 查询结果的坐标系。
  19073. */
  19074. this.prjCoordSys = null;
  19075. /**
  19076. * @member {number} [GeoDecodingParameter.prototype.maxReturn]
  19077. * @description 最大返回结果数。
  19078. */
  19079. this.maxReturn = null;
  19080. /**
  19081. * @member {number} GeoDecodingParameter.prototype.geoDecodingRadius
  19082. * @description 查询半径。
  19083. */
  19084. this.geoDecodingRadius = null;
  19085. Util_Util.extend(this, options);
  19086. }
  19087. /**
  19088. * @function GeoDecodingParameter.prototype.destroy
  19089. * @description 释放资源,将引用资源的属性置空。
  19090. */
  19091. destroy() {
  19092. this.x = null;
  19093. this.y = null;
  19094. this.fromIndex = null;
  19095. this.toIndex = null;
  19096. this.filters = null;
  19097. this.prjCoordSys = null;
  19098. this.maxReturn = null;
  19099. this.geoDecodingRadius = null;
  19100. }
  19101. }
  19102. ;// CONCATENATED MODULE: ./src/common/iServer/AddressMatchService.js
  19103. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  19104. * This program are made available under the terms of the Apache License, Version 2.0
  19105. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19106. /**
  19107. * @class AddressMatchService
  19108. * @deprecatedclass SuperMap.AddressMatchService
  19109. * @category iServer AddressMatch
  19110. * @classdesc 地址匹配服务,包括正向匹配和反向匹配。
  19111. * @param {string} url - 服务地址。
  19112. * @param {Object} options - 可选参数。
  19113. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  19114. * @param {Object} [options.headers] - 请求头。
  19115. * @usage
  19116. */
  19117. class AddressMatchService_AddressMatchService extends CommonServiceBase {
  19118. constructor(url, options) {
  19119. super(url, options);
  19120. this.options = options || {};
  19121. this.eventCount = 0;
  19122. this.CLASS_NAME = 'SuperMap.AddressMatchService';
  19123. }
  19124. /**
  19125. * @function AddressMatchService.prototype.destroy
  19126. * @override
  19127. */
  19128. destroy() {
  19129. super.destroy();
  19130. }
  19131. /**
  19132. * @function AddressMatchService.prototype.code
  19133. * @param {string} url - 正向地址匹配服务地址。
  19134. * @param {GeoCodingParameter} params - 正向地址匹配服务参数。
  19135. */
  19136. code(url, params, callback) {
  19137. if (!(params instanceof GeoCodingParameter)) {
  19138. return;
  19139. }
  19140. this.processAsync(url, params, callback);
  19141. }
  19142. /**
  19143. * @function AddressMatchService.prototype.decode
  19144. * @param {string} url - 反向地址匹配服务地址。
  19145. * @param {GeoDecodingParameter} params - 反向地址匹配服务参数。
  19146. */
  19147. decode(url, params, callback) {
  19148. if (!(params instanceof GeoDecodingParameter)) {
  19149. return;
  19150. }
  19151. this.processAsync(url, params, callback);
  19152. }
  19153. /**
  19154. * @function AddressMatchService.prototype.processAsync
  19155. * @description 负责将客户端的动态分段服务参数传递到服务端。
  19156. * @param {string} url - 服务地址。
  19157. * @param {Object} params - 参数。
  19158. */
  19159. processAsync(url, params, callback) {
  19160. let eventId = ++this.eventCount;
  19161. let eventListeners = {
  19162. scope: this,
  19163. processCompleted: function(result) {
  19164. if (eventId === result.result.eventId && callback) {
  19165. delete result.result.eventId;
  19166. callback(result);
  19167. this.events && this.events.un(eventListeners);
  19168. return false;
  19169. }
  19170. },
  19171. processFailed: function(result) {
  19172. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  19173. callback(result);
  19174. this.events && this.events.un(eventListeners);
  19175. return false;
  19176. }
  19177. }
  19178. }
  19179. this.events.on(eventListeners);
  19180. this.request({
  19181. method: 'GET',
  19182. url,
  19183. params,
  19184. scope: this,
  19185. success(result, options) {
  19186. result.eventId = eventId;
  19187. this.serviceProcessCompleted(result, options);
  19188. },
  19189. failure(result, options) {
  19190. if (result.error) {
  19191. result.error.eventId = eventId;
  19192. }
  19193. result.eventId = eventId;
  19194. this.serviceProcessFailed(result, options);
  19195. }
  19196. });
  19197. }
  19198. /**
  19199. * @function AddressMatchService.prototype.serviceProcessCompleted
  19200. * @param {Object} result - 服务器返回的结果对象。
  19201. * @description 服务流程是否完成
  19202. */
  19203. serviceProcessCompleted(result, options) {
  19204. if (result.succeed) {
  19205. delete result.succeed;
  19206. }
  19207. super.serviceProcessCompleted(result, options);
  19208. }
  19209. /**
  19210. * @function AddressMatchService.prototype.serviceProcessCompleted
  19211. * @param {Object} result - 服务器返回的结果对象。
  19212. * @description 服务流程是否失败
  19213. */
  19214. serviceProcessFailed(result, options) {
  19215. super.serviceProcessFailed(result, options);
  19216. }
  19217. }
  19218. ;// CONCATENATED MODULE: ./src/maplibregl/services/AddressMatchService.js
  19219. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  19220. * This program are made available under the terms of the Apache License, Version 2.0
  19221. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19222. /**
  19223. * @class AddressMatchService
  19224. * @category iServer AddressMatch
  19225. * @classdesc 地址匹配服务类。
  19226. * @version 11.1.0
  19227. * @modulecategory Services
  19228. * @example
  19229. * new AddressMatchService(url,options)
  19230. * .code(function(result){
  19231. * //doSomething
  19232. * })
  19233. * @param {string} url - 服务地址。
  19234. * @param {Object} options - 参数。
  19235. * @param {string} [options.proxy] - 服务代理地址。
  19236. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  19237. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  19238. * @param {Object} [options.headers] - 请求头。
  19239. * @extends {ServiceBase}
  19240. * @usage
  19241. */
  19242. class AddressMatchService extends ServiceBase {
  19243. constructor(url, options) {
  19244. super(url, options);
  19245. this._addressMatchService = new AddressMatchService_AddressMatchService(url, options);
  19246. }
  19247. /**
  19248. * @function AddressMatchService.prototype.code
  19249. * @description 获取正向地址匹配结果。
  19250. * @param {GeoCodingParameter} params - 正向匹配参数。
  19251. * @param {RequestCallback} callback - 回调函数。
  19252. */
  19253. code(params, callback) {
  19254. this._addressMatchService.code(Util_Util.urlPathAppend(this.url, 'geocoding'), params, callback);
  19255. }
  19256. /**
  19257. * @function AddressMatchService.prototype.decode
  19258. * @description 获取反向地址匹配结果。
  19259. * @param {GeoDecodingParameter} params -反向匹配参数。
  19260. * @param {RequestCallback} callback - 回调函数。
  19261. */
  19262. decode(params, callback) {
  19263. this._addressMatchService.decode(Util_Util.urlPathAppend(this.url, 'geodecoding'), params, callback);
  19264. }
  19265. }
  19266. ;// CONCATENATED MODULE: ./src/common/iServer/QueryParameters.js
  19267. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  19268. * This program are made available under the terms of the Apache License, Version 2.0
  19269. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19270. /**
  19271. * @class QueryParameters
  19272. * @deprecatedclass SuperMap.QueryParameters
  19273. * @category iServer Map QueryResults
  19274. * @classdesc 查询参数基类。距离查询、SQL 查询、几何地物查询等各自的参数均继承此类。
  19275. * @param {Object} options - 参数。
  19276. * @param {Array.<FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  19277. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  19278. * @param {Object} [options.prjCoordSys] - 自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  19279. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  19280. * @param {GeometryType} [options.networkType=GeometryType.LINE] - 网络数据集对应的查询类型。
  19281. * @param {QueryOption} [options.queryOption=QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  19282. * @param {number} [options.startRecord=0] - 查询起始记录号。
  19283. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  19284. * @param {boolean} [options.returnCustomResult=false] - 仅供三维使用。
  19285. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  19286. * @usage
  19287. */
  19288. class QueryParameters {
  19289. constructor(options) {
  19290. if (!options) {
  19291. return;
  19292. }
  19293. /**
  19294. * @member {string} [QueryParameters.prototype.customParams]
  19295. * @description 自定义参数,供扩展使用。
  19296. */
  19297. this.customParams = null;
  19298. /**
  19299. * @member {Object} [QueryParameters.prototype.prjCoordSys]
  19300. * @description 自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}
  19301. */
  19302. this.prjCoordSys = null;
  19303. /**
  19304. * @member {number} [QueryParameters.prototype.expectCount=100000]
  19305. * @description 期望返回结果记录个数,默认返回100000条查询记录,
  19306. * 如果实际不足100000条则返回实际记录条数。
  19307. */
  19308. this.expectCount = 100000;
  19309. /**
  19310. * @member {GeometryType} [QueryParameters.prototype.networkType=GeometryType.LINE]
  19311. * @description 网络数据集对应的查询类型,分为点和线两种类型。
  19312. */
  19313. this.networkType = REST_GeometryType.LINE;
  19314. /**
  19315. * @member {QueryOption} [QueryParameters.prototype.queryOption=QueryOption.ATTRIBUTEANDGEOMETRY]
  19316. * @description 查询结果类型枚举类。
  19317. * 该类描述查询结果返回类型,包括只返回属性、
  19318. * 只返回几何实体以及返回属性和几何实体。
  19319. */
  19320. this.queryOption = QueryOption.ATTRIBUTEANDGEOMETRY;
  19321. /**
  19322. * @member {Array.<FilterParameter>} QueryParameters.prototype.queryParams
  19323. * @description 查询过滤条件参数数组。
  19324. * 该类用于设置查询数据集的查询过滤参数。
  19325. */
  19326. this.queryParams = null;
  19327. /**
  19328. * @member {number} [QueryParameters.prototype.startRecord=0]
  19329. * @description 查询起始记录号。
  19330. */
  19331. this.startRecord = 0;
  19332. /**
  19333. * @member {number} [QueryParameters.prototype.holdTime=10]
  19334. * @description 资源在服务端保存的时间,单位为分钟。
  19335. */
  19336. this.holdTime = 10;
  19337. /**
  19338. * @member {boolean} [QueryParameters.prototype.returnCustomResult=false]
  19339. * @description 仅供三维使用。
  19340. */
  19341. this.returnCustomResult = false;
  19342. /**
  19343. * @member {boolean} [QueryParameters.prototype.returnFeatureWithFieldCaption=false]
  19344. * @description 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  19345. */
  19346. this.returnFeatureWithFieldCaption = false;
  19347. Util_Util.extend(this, options);
  19348. this.CLASS_NAME = "SuperMap.QueryParameters";
  19349. }
  19350. /**
  19351. * @function QueryParameters.prototype.destroy
  19352. * @description 释放资源,将引用资源的属性置空。
  19353. */
  19354. destroy() {
  19355. var me = this;
  19356. me.customParams = null;
  19357. me.expectCount = null;
  19358. me.networkType = null;
  19359. me.queryOption = null;
  19360. if (me.queryParams) {
  19361. for (var i = 0, qps = me.queryParams, len = qps.length; i < len; i++) {
  19362. qps[i].destroy();
  19363. }
  19364. me.queryParams = null;
  19365. }
  19366. me.startRecord = null;
  19367. me.holdTime = null;
  19368. me.returnCustomResult = null;
  19369. me.prjCoordSys = null;
  19370. }
  19371. }
  19372. ;// CONCATENATED MODULE: ./src/common/iServer/ChartQueryFilterParameter.js
  19373. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  19374. * This program are made available under the terms of the Apache License, Version 2.0
  19375. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19376. /**
  19377. * @class ChartQueryFilterParameter
  19378. * @deprecatedclass SuperMap.ChartQueryFilterParameter
  19379. * @category iServer Map Chart
  19380. * @classdesc 海图查询过滤参数类,用于设置海图查询的过滤参数。包括:物标代码、物标可应用对象的选择(是否查询点、线或面)、属性字段过滤条件。
  19381. * @param {Object} options - 参数。
  19382. * @param {string} options.attributeFilter - 属性字段过滤条件。
  19383. * @param {number} options.chartFeatureInfoSpecCode - 查询的物标代号。
  19384. * @param {boolean} [options.isQueryPoint] - 是否查询点。
  19385. * @param {boolean} [options.isQueryLine] - 是否查询线。
  19386. * @param {boolean} [options.isQueryRegion] - 是否查询面。
  19387. * @usage
  19388. */
  19389. class ChartQueryFilterParameter {
  19390. constructor(options) {
  19391. /**
  19392. * @member {boolean} [ChartQueryFilterParameter.prototype.isQueryPoint]
  19393. * @description 是否查询点。
  19394. */
  19395. this.isQueryPoint = null;
  19396. /**
  19397. * @member {boolean} [ChartQueryFilterParameter.prototype.isQueryLine]
  19398. * @description 是否查询线。
  19399. */
  19400. this.isQueryLine = null;
  19401. /**
  19402. * @member {boolean} [ChartQueryFilterParameter.prototype.isQueryRegion]
  19403. * @description 是否查询面。
  19404. */
  19405. this.isQueryRegion = null;
  19406. /**
  19407. * @member {string} ChartQueryFilterParameter.prototype.attributeFilter
  19408. * @description 属性字段过滤条件。
  19409. */
  19410. this.attributeFilter = null;
  19411. /**
  19412. * @member {number} ChartQueryFilterParameter.prototype.chartFeatureInfoSpecCode
  19413. * @description 查询的物标代号。
  19414. */
  19415. this.chartFeatureInfoSpecCode = null;
  19416. Util_Util.extend(this, options);
  19417. this.CLASS_NAME = "SuperMap.ChartQueryFilterParameter";
  19418. }
  19419. /**
  19420. * @function ChartQueryFilterParameter.prototype.destroy
  19421. * @description 释放资源,将引用资源的属性置空。
  19422. */
  19423. destroy() {
  19424. var me = this;
  19425. me.isQueryPoint = null;
  19426. me.isQueryLine = null;
  19427. me.isQueryRegion = null;
  19428. me.attributeFilter = null;
  19429. me.chartFeatureInfoSpecCode = null;
  19430. }
  19431. /**
  19432. * @function ChartQueryFilterParameter.prototype.toJson
  19433. * @description 将属性信息转化成 JSON 格式字符串。
  19434. */
  19435. toJson() {
  19436. var json = "";
  19437. json += "\"isQueryPoint\":" + this.isQueryPoint + ",";
  19438. json += "\"isQueryLine\":" + this.isQueryLine + ",";
  19439. json += "\"isQueryRegion\":" + this.isQueryRegion + ",";
  19440. if (this.attributeFilter) {
  19441. json += "\"attributeFilter\": \"" + this.attributeFilter + "\",";
  19442. }
  19443. json += "\"chartFeatureInfoSpecCode\":" + this.chartFeatureInfoSpecCode;
  19444. json = "{" + json + "}";
  19445. return json;
  19446. }
  19447. }
  19448. ;// CONCATENATED MODULE: ./src/common/iServer/ChartQueryParameters.js
  19449. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  19450. * This program are made available under the terms of the Apache License, Version 2.0
  19451. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19452. /**
  19453. * @class ChartQueryParameters
  19454. * @deprecatedclass SuperMap.ChartQueryParameters
  19455. * @category iServer Map Chart
  19456. * @classdesc 海图查询参数类,该类用于设置海图查询时的相关参数,海图查询分为海图属性查询和海图范围查询两类,通过属性 queryMode 指定查询模式。
  19457. * 必设属性有:queryMode、chartLayerNames、chartQueryFilterParameters。当进行海图范围查询时,必设属性还包括 bounds。
  19458. * @param {Object} options - 参数。
  19459. * @param {string} options.queryMode - 海图查询模式类型,支持两种查询方式:海图属性查询("ChartAttributeQuery")和海图空间查询("ChartBoundsQuery")。
  19460. * @param {Array.<string>} options.chartLayerNames - 查询的海图图层的名称。
  19461. * @param {Array.<ChartQueryFilterParameter>} options.chartQueryFilterParameters - 海图查询过滤参数。包括:物标代码、物标可应用对象的选择(是否查询点、线或面)、属性字段过滤条件。
  19462. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 海图查询范围。当进行海图范围查询时,此为必选参数。
  19463. * @param {boolean} [options.returnContent=true] - 获取或设置是返回查询结果记录集 recordsets,还是返回查询结果的资源 resourceInfo。
  19464. * @param {number} [options.startRecord=0] - 查询起始记录位置。
  19465. * @param {number} [options.expectCount] - 期望查询结果返回的记录数,该值大于0。
  19466. * @usage
  19467. */
  19468. class ChartQueryParameters {
  19469. constructor(options) {
  19470. /**
  19471. * @member {string} ChartQueryParameters.prototype.queryMode
  19472. * @description 海图查询模式类型,支持两种查询方式:海图属性查询("ChartAttributeQuery")和海图空间查询("ChartBoundsQuery")。
  19473. */
  19474. this.queryMode = null;
  19475. /**
  19476. * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} ChartQueryParameters.prototype.bounds
  19477. * @description 海图查询范围。
  19478. */
  19479. this.bounds = null;
  19480. /**
  19481. * @member {Array.<string>} ChartQueryParameters.prototype.chartLayerNames
  19482. * @description 查询的海图图层的名称。
  19483. */
  19484. this.chartLayerNames = null;
  19485. /**
  19486. * @member {Array.<ChartQueryFilterParameter>} ChartQueryParameters.prototype.chartQueryFilterParameters
  19487. * @description 海图查询过滤参数。包括:物标代码、物标可应用对象的选择(是否查询点、线或面)、属性字段过滤条件。
  19488. */
  19489. this.chartQueryFilterParameters = null;
  19490. /**
  19491. * @member {boolean} [ChartQueryParameters.prototype.returnContent=true]
  19492. * @description 获取或设置是返回查询结果记录集 recordsets,还是返回查询结果的资源 resourceInfo。
  19493. */
  19494. this.returnContent = true;
  19495. /**
  19496. * @member {number} [ChartQueryParameters.prototype.startRecord=0]
  19497. * @description 查询起始记录位置。
  19498. */
  19499. this.startRecord = 0;
  19500. /**
  19501. * @member {number} [ChartQueryParameters.prototype.expectCount]
  19502. * @description 期望查询结果返回的记录数,该值大于0。
  19503. */
  19504. this.expectCount = null;
  19505. Util_Util.extend(this, options);
  19506. this.CLASS_NAME = "SuperMap.ChartQueryParameters";
  19507. }
  19508. /**
  19509. * @function ChartQueryParameters.prototype.destroy
  19510. * @description 释放资源,将引用资源的属性置空。
  19511. */
  19512. destroy() {
  19513. var me = this;
  19514. me.queryMode = null;
  19515. me.bounds = null;
  19516. me.chartLayerNames = null;
  19517. me.chartQueryFilterParameters = null;
  19518. me.returnContent = true;
  19519. me.startRecord = 0;
  19520. me.expectCount = null;
  19521. }
  19522. /**
  19523. * @function ChartQueryParameters.prototype.getVariablesJson
  19524. * @description 将属性信息转换成能够被服务识别的 JSON 格式字符串。
  19525. * @returns {string} JSON 字符串。
  19526. */
  19527. getVariablesJson() {
  19528. var json = "";
  19529. json += "\"queryMode\":\"" + this.queryMode + "\",";
  19530. if (this.chartLayerNames && this.chartLayerNames.length) {
  19531. var chartLayersArray = [];
  19532. var layerLength = this.chartLayerNames.length;
  19533. for (var i = 0; i < layerLength; i++) {
  19534. chartLayersArray.push("\"" + this.chartLayerNames[i] + "\"");
  19535. }
  19536. var layerNames = "[" + chartLayersArray.join(",") + "]";
  19537. json += "\"chartLayerNames\":" + layerNames + ",";
  19538. }
  19539. if (this.queryMode === "ChartBoundsQuery" && this.bounds) {
  19540. json += "\"bounds\":" + "{" + "\"leftBottom\":" + "{" + "\"x\":" + this.bounds.left + "," +
  19541. "\"y\":" + this.bounds.bottom + "}" + "," + "\"rightTop\":" + "{" + "\"x\":" + this.bounds.right + "," +
  19542. "\"y\":" + this.bounds.top + "}" + "},";
  19543. }
  19544. if (this.chartQueryFilterParameters && this.chartQueryFilterParameters.length) {
  19545. var chartParamArray = [];
  19546. var chartLength = this.chartQueryFilterParameters.length;
  19547. for (var j = 0; j < chartLength; j++) {
  19548. var chartQueryFilterParameter = this.chartQueryFilterParameters[j];
  19549. if (!(chartQueryFilterParameter instanceof ChartQueryFilterParameter)) {
  19550. continue;
  19551. }
  19552. chartParamArray.push(chartQueryFilterParameter.toJson());
  19553. }
  19554. var chartParamsJson = "[" + chartParamArray.join(",") + "]";
  19555. chartParamsJson = "\"chartQueryParams\":" + chartParamsJson + ",";
  19556. chartParamsJson += "\"startRecord\":" + this.startRecord + ",";
  19557. chartParamsJson += "\"expectCount\":" + this.expectCount;
  19558. chartParamsJson = "{" + chartParamsJson + "}";
  19559. json += "\"chartQueryParameters\":" + chartParamsJson;
  19560. }
  19561. json = "{" + json + "}";
  19562. return json;
  19563. }
  19564. }
  19565. ;// CONCATENATED MODULE: ./src/common/iServer/ChartQueryService.js
  19566. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  19567. * This program are made available under the terms of the Apache License, Version 2.0
  19568. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19569. /**
  19570. * @class ChartQueryService
  19571. * @deprecatedclass SuperMap.ChartQueryService
  19572. * @category iServer Map Chart
  19573. * @classdesc 海图查询服务类。该类负责将海图查询所需参数(ChartQueryParameters)传递至服务端,并获取服务端的返回结果。
  19574. * 用户可以通过两种方式获取查询结果:
  19575. * 1.通过 AsyncResponder 类获取(推荐使用);
  19576. * 2.通过监听 QueryEvent.PROCESS_COMPLETE 事件获取。
  19577. * @extends {CommonServiceBase}
  19578. * @param {string} url - 地图查询服务访问地址。如:"http://localhost:8090/iserver/services/map-ChartW/rest/maps/海图"。
  19579. * @param {Object} options - 参数。
  19580. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  19581. * @param {DataFormat} [options.format] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为"ISERVER","GEOJSON"。
  19582. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  19583. * @param {Object} [options.headers] - 请求头。
  19584. * @example
  19585. * 下面示例显示了如何进行海图属性查询:
  19586. * var nameArray = ["GB4X0000_52000"];
  19587. * var chartQueryFilterParameter = new ChartQueryFilterParameter({
  19588. * isQueryPoint:true,
  19589. * isQueryLine:true,
  19590. * isQueryRegion:true,
  19591. * attributeFilter:"SmID<10",
  19592. * chartFeatureInfoSpecCode:1
  19593. * });
  19594. *
  19595. * var chartQueryParameters = new ChartQueryParameters({
  19596. * queryMode:"ChartAttributeQuery",
  19597. * chartLayerNames:nameArray,
  19598. * returnContent:true,
  19599. * chartQueryFilterParameters:[chartQueryFilterParameter]
  19600. * });
  19601. *
  19602. * var chartQueryService = new ChartQueryService(url);
  19603. *
  19604. * chartQueryService.events.on({
  19605. * "processCompleted":processCompleted,
  19606. * "processFailed":processFailed
  19607. * });
  19608. * chartQueryService.processAsync(chartQueryParameters);
  19609. * @usage
  19610. */
  19611. class ChartQueryService extends CommonServiceBase {
  19612. constructor(url, options) {
  19613. super(url, options);
  19614. options = options || {};
  19615. /**
  19616. * @member {boolean} ChartQueryService.prototype.returnContent
  19617. * @description 是否立即返回新创建资源的表述还是返回新资源的URI。
  19618. */
  19619. this.returnContent = null;
  19620. /**
  19621. * @member {DataFormat} ChartQueryService.prototype.format
  19622. * @description 查询结果返回格式,目前支持iServerJSON 和GeoJSON两种格式
  19623. * 参数格式为"ISERVER","GEOJSON",GEOJSON
  19624. */
  19625. this.format = DataFormat.GEOJSON;
  19626. Util_Util.extend(this, options);
  19627. var me = this;
  19628. if (options.format) {
  19629. me.format = options.format.toUpperCase();
  19630. }
  19631. if (!me.url) {
  19632. return;
  19633. }
  19634. me.url = Util_Util.urlPathAppend(me.url, 'queryResults');
  19635. this.CLASS_NAME = "SuperMap.ChartQueryService";
  19636. }
  19637. /**
  19638. * @function ChartQueryService.prototype.destroy
  19639. * @override
  19640. */
  19641. destroy() {
  19642. var me = this;
  19643. CommonServiceBase.prototype.destroy.apply(this, arguments);
  19644. me.returnContent = null;
  19645. me.format = null;
  19646. }
  19647. /**
  19648. * @function ChartQueryService.prototype.processAsync
  19649. * @description 使用服务地址 URL 实例化 ChartQueryService 对象。
  19650. * @param {ChartQueryParameters} params - 查询参数。
  19651. */
  19652. processAsync(params) {
  19653. //todo重点需要添加代码的地方
  19654. if (!(params instanceof ChartQueryParameters)) {
  19655. return;
  19656. }
  19657. var me = this, jsonParameters;
  19658. me.returnContent = params.returnContent;
  19659. jsonParameters = params.getVariablesJson();
  19660. if (me.returnContent) {
  19661. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  19662. }
  19663. me.request({
  19664. method: "POST",
  19665. data: jsonParameters,
  19666. scope: me,
  19667. success: me.serviceProcessCompleted,
  19668. failure: me.serviceProcessFailed
  19669. });
  19670. }
  19671. /**
  19672. * @function ChartQueryService.prototype.serviceProcessCompleted
  19673. * @description 查询完成,执行此方法。
  19674. * @param {Object} result - 服务器返回的结果对象。
  19675. */
  19676. serviceProcessCompleted(result, options) {
  19677. var me = this;
  19678. result = Util_Util.transformResult(result);
  19679. if (result && result.recordsets && me.format === DataFormat.GEOJSON) {
  19680. for (var i = 0, recordsets = result.recordsets, len = recordsets.length; i < len; i++) {
  19681. if (recordsets[i].features) {
  19682. var geoJSONFormat = new GeoJSON();
  19683. recordsets[i].features = geoJSONFormat.toGeoJSON(recordsets[i].features);
  19684. }
  19685. }
  19686. }
  19687. me.events.triggerEvent("processCompleted", {result: result, options});
  19688. }
  19689. /**
  19690. * @function ChartQueryService.prototype.getQueryParameters
  19691. * @description 将 JSON 对象表示的查询参数转化为 QueryParameters 对象。
  19692. * @param {Object} params - JSON 字符串表示的查询参数。
  19693. * @returns {QueryParameters} 返回查询结果
  19694. */
  19695. getQueryParameters(params) {
  19696. return new QueryParameters({
  19697. queryMode: params.queryMode,
  19698. bounds: params.bounds,
  19699. chartLayerNames: params.chartLayerNames,
  19700. chartQueryFilterParameters: params.chartQueryFilterParameters,
  19701. returnContent: params.returnContent
  19702. });
  19703. }
  19704. }
  19705. ;// CONCATENATED MODULE: ./src/common/iServer/ChartFeatureInfoSpecsService.js
  19706. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  19707. * This program are made available under the terms of the Apache License, Version 2.0
  19708. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19709. /**
  19710. * @class ChartFeatureInfoSpecsService
  19711. * @deprecatedclass SuperMap.ChartFeatureInfoSpecsService
  19712. * @category iServer Map Chart
  19713. * @classdesc 海图物标信息服务类,通过该服务类可以查询到服务端支持的所有海图物标信息。
  19714. * 用户可以通过两种方式获取查询结果:
  19715. * 一种是通过监听 ChartFeatureInfoSpecsEvent.PROCESS_COMPLETE 事件;
  19716. * 另一种是使用 AsyncResponder 类实现异步处理。
  19717. * @extends {CommonServiceBase}
  19718. * @param {string} url - 地图(特指海图)服务地址。
  19719. * 如:"http://localhost:8090/iserver/services/map-ChartW/rest/maps/海图"。
  19720. * 发送请求格式类似于:"http://localhost:8090/iserver/services/map-ChartW/rest/maps/海图/chartFeatureInfoSpecs.json"。
  19721. * @param {Object} options - 参数。
  19722. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  19723. * @param {DataFormat} [options.format] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式,参数格式为"ISERVER","GEOJSON"。
  19724. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  19725. * @param {Object} [options.headers] - 请求头。
  19726. * @usage
  19727. */
  19728. class ChartFeatureInfoSpecsService extends CommonServiceBase {
  19729. constructor(url, options) {
  19730. super(url, options);
  19731. this.CLASS_NAME = "SuperMap.ChartFeatureInfoSpecsService";
  19732. }
  19733. /**
  19734. * @function ChartFeatureInfoSpecsService.prototype.destroy
  19735. * @override
  19736. */
  19737. destroy() {
  19738. super.destroy();
  19739. Util_Util.reset(this);
  19740. }
  19741. /**
  19742. * @function ChartFeatureInfoSpecsService.prototype.processAsync
  19743. * @description 根据地图(特指海图)服务地址与服务端完成异步通讯,获取物标信息。
  19744. * 当查询物标信息成功时,将触发 ChartFeatureInfoSpecsEvent.PROCESS_COMPLETE
  19745. * 事件。用可以通过户两种方式获取图层信息:
  19746. * 1. 通过 AsyncResponder 类获取(推荐使用);
  19747. * 2. 通过监听 ChartFeatureInfoSpecsEvent.PROCESS_COMPLETE 事件获取。
  19748. */
  19749. processAsync() {
  19750. var me = this, method = "GET";
  19751. if (!me.isTempLayers) {
  19752. Util_Util.urlPathAppend(me.url,'chartFeatureInfoSpecs');
  19753. }
  19754. me.request({
  19755. method: method,
  19756. params: null,
  19757. scope: me,
  19758. success: me.serviceProcessCompleted,
  19759. failure: me.serviceProcessFailed
  19760. });
  19761. }
  19762. }
  19763. ;// CONCATENATED MODULE: ./src/common/iServer/ChartService.js
  19764. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  19765. * This program are made available under the terms of the Apache License, Version 2.0
  19766. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19767. /**
  19768. * @class ChartService
  19769. * @category iServer Map Chart
  19770. * @classdesc 海图服务。
  19771. * @extends {ServiceBase}
  19772. * @example
  19773. * new ChartService(url).queryChart(param,function(result){
  19774. * //doSomething
  19775. * })
  19776. * @param {string} url - 服务地址。
  19777. * @param {Object} options - 参数。
  19778. * @param {string} [options.proxy] - 服务代理地址。
  19779. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  19780. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  19781. * @param {Object} [options.headers] - 请求头。
  19782. * @usage
  19783. */
  19784. class ChartService_ChartService {
  19785. constructor(url, options) {
  19786. this.url = url;
  19787. this.options = options || {};
  19788. }
  19789. /**
  19790. * @function ChartService.prototype.queryChart
  19791. * @description 查询海图服务。
  19792. * @param {ChartQueryParameters} params - 海图查询所需参数类。
  19793. * @param {RequestCallback} callback - 回调函数。
  19794. * @param {DataFormat} resultFormat - 返回结果类型。
  19795. */
  19796. queryChart(params, callback, resultFormat) {
  19797. var me = this,
  19798. param = params,
  19799. format = me._processFormat(resultFormat);
  19800. var chartQueryService = new ChartQueryService(me.url, {
  19801. proxy: me.options.proxy,
  19802. withCredentials: me.options.withCredentials,
  19803. crossOrigin: me.options.crossOrigin,
  19804. headers: me.options.headers,
  19805. eventListeners: {
  19806. scope: me,
  19807. processCompleted: callback,
  19808. processFailed: callback
  19809. },
  19810. format: format
  19811. });
  19812. chartQueryService.processAsync(param);
  19813. }
  19814. /**
  19815. * @function ChartService.prototype.getChartFeatureInfo
  19816. * @description 获取海图物标信息服务。
  19817. * @param {RequestCallback} callback 回调函数。
  19818. */
  19819. getChartFeatureInfo(callback) {
  19820. var me = this;
  19821. var url = Util_Util.urlPathAppend(me.url, 'chartFeatureInfoSpecs');
  19822. var chartFeatureInfoSpecsService = new ChartFeatureInfoSpecsService(url, {
  19823. proxy: me.options.proxy,
  19824. withCredentials: me.options.withCredentials,
  19825. crossOrigin: me.options.crossOrigin,
  19826. headers: me.options.headers,
  19827. eventListeners: {
  19828. scope: me,
  19829. processCompleted: callback,
  19830. processFailed: callback
  19831. }
  19832. });
  19833. chartFeatureInfoSpecsService.processAsync();
  19834. }
  19835. _processFormat(resultFormat) {
  19836. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  19837. }
  19838. }
  19839. ;// CONCATENATED MODULE: ./src/maplibregl/services/ChartService.js
  19840. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  19841. * This program are made available under the terms of the Apache License, Version 2.0
  19842. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19843. /**
  19844. * @class ChartService
  19845. * @category iServer Map Chart
  19846. * @classdesc 海图服务类。
  19847. * @version 11.1.0
  19848. * @modulecategory Services
  19849. * @extends {ServiceBase}
  19850. * @example
  19851. * new ChartService(url)
  19852. * .queryChart(param,function(result){
  19853. * //doSomething
  19854. * })
  19855. * @param {string} url - 服务地址。
  19856. * @param {Object} options - 参数。
  19857. * @param {string} [options.proxy] - 服务代理地址。
  19858. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  19859. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  19860. * @param {Object} [options.headers] - 请求头。
  19861. * @usage
  19862. */
  19863. class ChartService extends ServiceBase {
  19864. constructor(url, options) {
  19865. super(url, options);
  19866. this._chartService = new ChartService_ChartService(url, options);
  19867. }
  19868. /**
  19869. * @function ChartService.prototype.queryChart
  19870. * @description 查询海图服务。
  19871. * @param {ChartQueryParameters} params - 海图查询参数类。
  19872. * @param {RequestCallback} callback 回调函数。
  19873. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  19874. */
  19875. queryChart(params, callback, resultFormat) {
  19876. this._chartService.queryChart(params, callback, resultFormat);
  19877. }
  19878. /**
  19879. * @function ChartService.prototype.getChartFeatureInfo
  19880. * @description 获取海图物标信息服务。
  19881. * @param {RequestCallback} callback 回调函数。
  19882. */
  19883. getChartFeatureInfo(callback) {
  19884. this._chartService.getChartFeatureInfo(callback);
  19885. }
  19886. _processFormat(resultFormat) {
  19887. return resultFormat ? resultFormat : DataFormat.GEOJSON;
  19888. }
  19889. }
  19890. ;// CONCATENATED MODULE: ./src/common/iServer/DataFlowService.js
  19891. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  19892. * This program are made available under the terms of the Apache License, Version 2.0
  19893. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19894. /**
  19895. * @class DataFlowService
  19896. * @deprecatedclass SuperMap.DataFlowService
  19897. * @category iServer DataFlow
  19898. * @classdesc 数据流服务类。
  19899. * @extends {CommonServiceBase}
  19900. * @param {string} url - 数据流服务地址。
  19901. * @param {Object} options - 参数。
  19902. * @param {function} options.style - 设置数据加载样式。
  19903. * @param {function} [options.onEachFeature] - 设置每个数据加载popup等。
  19904. * @param {GeoJSONObject} [options.geometry] - 指定几何范围,该范围内的要素才能被订阅。
  19905. * @param {Object} [options.excludeField] - 排除字段。
  19906. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  19907. * @param {Object} [options.headers] - 请求头。
  19908. * @usage
  19909. */
  19910. class DataFlowService_DataFlowService extends CommonServiceBase {
  19911. constructor(url, options) {
  19912. options = options || {};
  19913. /*
  19914. * @constant EVENT_TYPES
  19915. * {Array.<string>}
  19916. * 此类支持的事件类型
  19917. */
  19918. options.EVENT_TYPES = ["broadcastSocketConnected", "broadcastSocketClosed", "broadcastSocketError", "broadcastFailed", "broadcastSucceeded", "subscribeSocketConnected", "subscribeSocketClosed", "subscribeSocketError", "messageSucceeded", "setFilterParamSucceeded"]
  19919. super(url, options);
  19920. /**
  19921. * @member {GeoJSONObject} DataFlowService.prototype.geometry
  19922. * @description 指定几何范围,该范围内的要素才能被订阅。
  19923. */
  19924. this.geometry = null;
  19925. /**
  19926. * @member {Object} DataFlowService.prototype.prjCoordSys
  19927. * @description 动态投影参数。
  19928. */
  19929. this.prjCoordSys = null;
  19930. /**
  19931. * @member {Object} DataFlowService.prototype.excludeField
  19932. * @description 排除字段。
  19933. */
  19934. this.excludeField = null;
  19935. Util_Util.extend(this, options);
  19936. this.CLASS_NAME = "SuperMap.DataFlowService";
  19937. }
  19938. /**
  19939. * @function DataFlowService.prototype.initBroadcast
  19940. * @description 初始化广播。
  19941. * @returns {DataFlowService}
  19942. */
  19943. initBroadcast() {
  19944. var me = this;
  19945. this.broadcastWebSocket = this._connect(Util_Util.urlPathAppend(me.url, 'broadcast'));
  19946. this.broadcastWebSocket.onopen = function (e) {
  19947. me.broadcastWebSocket.isOpen = true;
  19948. e.eventType = 'broadcastSocketConnected';
  19949. me.events.triggerEvent('broadcastSocketConnected', e);
  19950. };
  19951. this.broadcastWebSocket.onclose = function (e) {
  19952. if (me.broadcastWebSocket) {
  19953. me.broadcastWebSocket.isOpen = false;
  19954. }
  19955. e.eventType = 'broadcastSocketClosed';
  19956. me.events.triggerEvent('broadcastSocketClosed', e);
  19957. };
  19958. this.broadcastWebSocket.onerror = function (e) {
  19959. e.eventType = 'broadcastSocketError';
  19960. me.events.triggerEvent('broadcastSocketError', e);
  19961. };
  19962. return this;
  19963. }
  19964. /**
  19965. * @function DataFlowService.prototype.broadcast
  19966. * @description 加载广播数据。
  19967. * @param {GeoJSONObject} geoJSONFeature - JSON 格式的要素数据。
  19968. */
  19969. broadcast(geoJSONFeature) {
  19970. if (!this.broadcastWebSocket||!this.broadcastWebSocket.isOpen) {
  19971. this.events.triggerEvent('broadcastFailed');
  19972. return;
  19973. }
  19974. this.broadcastWebSocket.send(JSON.stringify(geoJSONFeature));
  19975. this.events.triggerEvent('broadcastSucceeded');
  19976. }
  19977. /**
  19978. * @function DataFlowService.prototype.initSubscribe
  19979. * @description 初始化订阅数据。
  19980. * @returns {DataFlowService} DataFlowService的实例对象。
  19981. */
  19982. initSubscribe() {
  19983. var me = this;
  19984. this.subscribeWebSocket = this._connect(Util_Util.urlPathAppend(me.url, 'subscribe'));
  19985. this.subscribeWebSocket.onopen = function (e) {
  19986. me.subscribeWebSocket.send(me._getFilterParams());
  19987. e.eventType = 'subscribeSocketConnected';
  19988. me.events.triggerEvent('subscribeSocketConnected', e);
  19989. };
  19990. this.subscribeWebSocket.onclose = function (e) {
  19991. e.eventType = 'subscribeWebSocketClosed';
  19992. me.events.triggerEvent('subscribeWebSocketClosed', e);
  19993. };
  19994. this.subscribeWebSocket.onerror = function (e) {
  19995. e.eventType = 'subscribeSocketError';
  19996. me.events.triggerEvent('subscribeSocketError', e);
  19997. };
  19998. this.subscribeWebSocket.onmessage = function (e) {
  19999. me._onMessage(e);
  20000. };
  20001. return this;
  20002. }
  20003. /**
  20004. * @function DataFlowService.prototype.setExcludeField
  20005. * @description 设置排除字段。
  20006. * @param {Object} excludeField - 排除字段。
  20007. * @returns {DataFlowService} DataFlowService的实例对象。
  20008. */
  20009. setExcludeField(excludeField) {
  20010. this.excludeField = excludeField;
  20011. this.subscribeWebSocket.send(this._getFilterParams());
  20012. return this;
  20013. }
  20014. /**
  20015. * @function DataFlowService.prototype.setGeometry
  20016. * @description 设置添加的几何要素数据。
  20017. * @param {GeoJSONObject} geometry - 指定几何范围,该范围内的要素才能被订阅。
  20018. * @returns {DataFlowService} DataFlowService的实例对象。
  20019. */
  20020. setGeometry(geometry) {
  20021. this.geometry = geometry;
  20022. this.subscribeWebSocket.send(this._getFilterParams());
  20023. return this;
  20024. }
  20025. /**
  20026. * @function DataFlowService.prototype.unSubscribe
  20027. * @description 结束订阅数据。
  20028. */
  20029. unSubscribe() {
  20030. if (!this.subscribeWebSocket) {
  20031. return;
  20032. }
  20033. this.subscribeWebSocket.close();
  20034. this.subscribeWebSocket = null;
  20035. }
  20036. /**
  20037. * @function DataFlowService.prototype.unBroadcast
  20038. * @description 结束加载广播。
  20039. */
  20040. unBroadcast() {
  20041. if (!this.broadcastWebSocket) {
  20042. return;
  20043. }
  20044. this.broadcastWebSocket.close();
  20045. this.broadcastWebSocket = null;
  20046. }
  20047. /**
  20048. * @function DataFlowService.prototype.destroy
  20049. * @override
  20050. */
  20051. destroy() {
  20052. CommonServiceBase.prototype.destroy.apply(this, arguments);
  20053. var me = this;
  20054. me.geometry = null;
  20055. me.prjCoordSys = null;
  20056. me.excludeField = null;
  20057. this.unBroadcast();
  20058. this.unSubscribe();
  20059. }
  20060. _getFilterParams() {
  20061. var filter = {
  20062. filterParam: {
  20063. prjCoordSys: this.prjCoordSys,
  20064. excludeField: this.excludeField,
  20065. geometry: this.geometry
  20066. }
  20067. };
  20068. return Util_Util.toJSON(filter);
  20069. }
  20070. _onMessage(e) {
  20071. if (e.data && e.data.indexOf("filterParam") >= 0) {
  20072. var filterParam = JSON.parse(e.data);
  20073. e.filterParam = filterParam;
  20074. e.eventType = 'setFilterParamSucceeded';
  20075. this.events.triggerEvent('setFilterParamSucceeded', e);
  20076. return;
  20077. }
  20078. var feature = JSON.parse(e.data);
  20079. e.featureResult = feature;
  20080. e.eventType = 'messageSucceeded';
  20081. this.events.triggerEvent('messageSucceeded', e);
  20082. }
  20083. _connect(url) {
  20084. url = SecurityManager.appendCredential(url);
  20085. if ("WebSocket" in window) {
  20086. return new WebSocket(url);
  20087. } else if ("MozWebSocket" in window) {
  20088. var mozWebSocket = window.MozWebSocket;
  20089. return new mozWebSocket(url);
  20090. } else {
  20091. console.log("no WebSocket");
  20092. return null;
  20093. }
  20094. }
  20095. }
  20096. ;// CONCATENATED MODULE: ./src/maplibregl/services/DataFlowService.js
  20097. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  20098. * This program are made available under the terms of the Apache License, Version 2.0
  20099. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20100. /**
  20101. * @class DataFlowService
  20102. * @category iServer DataFlow
  20103. * @classdesc 数据流服务类。
  20104. * @version 11.1.0
  20105. * @modulecategory Services
  20106. * @extends {ServiceBase}
  20107. * @example
  20108. * new DataFlowService(url)
  20109. * .queryChart(param,function(result){
  20110. * //doSomething
  20111. * })
  20112. * @param {string} url - 服务地址。
  20113. * @param {Object} options - 参数。
  20114. * @param {GeoJSONObject} [options.geometry] - 指定几何范围,该范围内的要素才能被订阅。
  20115. * @param {Object} [options.excludeField] - 排除字段。
  20116. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  20117. * @param {Object} [options.headers] - 请求头。
  20118. * @fires DataFlowService#broadcastSocketConnected
  20119. * @fires DataFlowService#broadcastSocketError
  20120. * @fires DataFlowService#broadcastFailed
  20121. * @fires DataFlowService#broadcastSucceeded
  20122. * @fires DataFlowService#subscribeSocketError
  20123. * @fires DataFlowService#messageSucceeded
  20124. * @fires DataFlowService#setFilterParamSucceeded
  20125. * @usage
  20126. */
  20127. class DataFlowService extends ServiceBase {
  20128. constructor(url, options) {
  20129. options = options || {};
  20130. if (options.projection) {
  20131. options.prjCoordSys = options.projection;
  20132. }
  20133. super(url, options);
  20134. this.dataFlow = new DataFlowService_DataFlowService(url, options);
  20135. /**
  20136. * @event DataFlowService#broadcastSocketConnected
  20137. * @description broadcast Socket 连接成功。
  20138. */
  20139. /**
  20140. * @event DataFlowService#broadcastSocketError
  20141. * @description broadcast Socket 连接失败。
  20142. */
  20143. /**
  20144. * @event DataFlowService#broadcastFailed
  20145. * @description 广播失败。
  20146. */
  20147. /**
  20148. * @event DataFlowService#broadcastSucceeded
  20149. * @description 广播成功。
  20150. */
  20151. /**
  20152. * @event DataFlowService#subscribeSocketConnected
  20153. * @description 订阅数据连接成功。
  20154. */
  20155. /**
  20156. * @event DataFlowService#subscribeSocketError
  20157. * @description 订阅数据连接失败。
  20158. */
  20159. /**
  20160. * @event DataFlowService#messageSucceeded
  20161. * @description 获取信息成功。
  20162. */
  20163. /**
  20164. * @event DataFlowService#setFilterParamSucceeded
  20165. * @description 设置过滤参数成功。
  20166. */
  20167. this.dataFlow.events.on({
  20168. "broadcastSocketConnected": this._defaultEvent,
  20169. "broadcastSocketError": this._defaultEvent,
  20170. "broadcastFailed": this._defaultEvent,
  20171. "broadcastSucceeded": this._defaultEvent,
  20172. "subscribeSocketConnected": this._defaultEvent,
  20173. "subscribeSocketError": this._defaultEvent,
  20174. "messageSucceeded": this._defaultEvent,
  20175. "setFilterParamSucceeded": this._defaultEvent,
  20176. scope: this
  20177. });
  20178. var me = this;
  20179. me.on('subscribeSocketConnected', function (e) {
  20180. /**
  20181. * @event DataFlowService#subscribesucceeded
  20182. * @description 数据流服务订阅成功后触发。
  20183. * @property {Object} e - 事件对象。
  20184. */
  20185. me.fire('subscribesucceeded', e);
  20186. })
  20187. }
  20188. /**
  20189. * @function DataFlowService.prototype.initBroadcast
  20190. * @description 初始化广播。
  20191. * @returns {DataFlowService}
  20192. */
  20193. initBroadcast() {
  20194. this.dataFlow.initBroadcast();
  20195. return this;
  20196. }
  20197. /**
  20198. * @function DataFlowService.prototype.broadcast
  20199. * @description 加载广播数据。
  20200. * @param {JSONObject} obj - 要素数据。
  20201. */
  20202. broadcast(obj) {
  20203. this.dataFlow.broadcast(obj);
  20204. }
  20205. /**
  20206. * @function DataFlowService.prototype.initSubscribe
  20207. * @description 初始化订阅数据。
  20208. */
  20209. initSubscribe() {
  20210. this.dataFlow.initSubscribe();
  20211. return this;
  20212. }
  20213. /**
  20214. * @function DataFlowService.prototype.setExcludeField
  20215. * @description 设置排除字段。
  20216. * @param {Object} excludeField - 排除字段。
  20217. */
  20218. setExcludeField(excludeField) {
  20219. this.dataFlow.setExcludeField(excludeField);
  20220. this.options.excludeField = excludeField;
  20221. return this;
  20222. }
  20223. /**
  20224. * @function DataFlowService.prototype.setGeometry
  20225. * @description 设置添加的几何要素数据。
  20226. * @param {GeoJSONObject} geometry - 指定几何范围,该范围内的要素才能被订阅。
  20227. */
  20228. setGeometry(geometry) {
  20229. this.dataFlow.setGeometry(geometry);
  20230. this.options.geometry = geometry;
  20231. return this;
  20232. }
  20233. /**
  20234. * @function DataFlowService.prototype.unSubscribe
  20235. * @description 结束订阅数据。
  20236. */
  20237. unSubscribe() {
  20238. this.dataFlow.unSubscribe();
  20239. }
  20240. /**
  20241. * @function DataFlowService.prototype.unBroadcast
  20242. * @description 结束加载广播。
  20243. */
  20244. unBroadcast() {
  20245. this.dataFlow.unBroadcast();
  20246. }
  20247. _defaultEvent(e) {
  20248. this.fire(e.eventType || e.type, e);
  20249. }
  20250. }
  20251. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetService.js
  20252. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  20253. * This program are made available under the terms of the Apache License, Version 2.0
  20254. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20255. /**
  20256. * @class DatasetService
  20257. * @deprecatedclass SuperMap.DatasetService
  20258. * @category iServer Data Dataset
  20259. * @classdesc 数据集查询服务。
  20260. * @param {string} url - 服务的访问地址。如访问World Data服务,只需将url设为:http://localhost:8090/iserver/services/data-world/rest/data 即可。
  20261. * @param {Object} options - 参数。
  20262. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  20263. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  20264. * @param {string}options.datasource - 数据源名称。
  20265. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  20266. * @param {Object} [options.headers] - 请求头。
  20267. * @usage
  20268. */
  20269. class DatasetService_DatasetService extends CommonServiceBase {
  20270. constructor(url, options) {
  20271. super(url, options);
  20272. if(!options){
  20273. return;
  20274. }
  20275. /**
  20276. * @member {string} DatasetService.prototype.datasource
  20277. * @description 要查询的数据集所在的数据源名称。
  20278. */
  20279. this.datasource = null;
  20280. /**
  20281. * @member {string} DatasetService.prototype.dataset
  20282. * @description 要查询的数据集名称。
  20283. */
  20284. this.dataset = null;
  20285. this.eventCount = 0;
  20286. if (options) {
  20287. Util_Util.extend(this, options);
  20288. }
  20289. this.CLASS_NAME = "SuperMap.DatasetService";
  20290. }
  20291. /**
  20292. * @function DatasetService.prototype.destroy
  20293. * @override
  20294. */
  20295. destroy() {
  20296. super.destroy();
  20297. var me = this;
  20298. me.datasource = null;
  20299. me.dataset = null;
  20300. }
  20301. /**
  20302. * @function DatasetService.prototype.getDatasetsService
  20303. * @description 执行服务,查询数据集服务。
  20304. */
  20305. getDatasetsService(params, callback) {
  20306. const url = Util_Util.urlPathAppend(this.url,`datasources/name/${params}/datasets`);
  20307. this.processAsync(url, 'GET', callback);
  20308. }
  20309. /**
  20310. * @function DatasetService.prototype.getDatasetService
  20311. * @description 执行服务,查询数据集信息服务。
  20312. */
  20313. getDatasetService(datasourceName, datasetName, callback) {
  20314. const url = Util_Util.urlPathAppend(this.url,`datasources/name/${datasourceName}/datasets/name/${datasetName}`);
  20315. this.processAsync(url, 'GET', callback);
  20316. }
  20317. /**
  20318. * @function DatasetService.prototype.setDatasetService
  20319. * @description 执行服务,更改数据集信息服务。
  20320. */
  20321. setDatasetService(params, callback) {
  20322. if (!params) {
  20323. return;
  20324. }
  20325. const url = Util_Util.urlPathAppend(this.url, `datasources/name/${params.datasourceName}/datasets/name/${params.datasetName}`);
  20326. delete params.datasourceName;
  20327. this.processAsync(url, 'PUT', callback, params);
  20328. }
  20329. /**
  20330. * @function DatasetService.prototype.deleteDatasetService
  20331. * @description 执行服务,删除数据集信息服务。
  20332. */
  20333. deleteDatasetService(datasourceName, datasetName, callback) {
  20334. const url = Util_Util.urlPathAppend(this.url, `datasources/name/${datasourceName}/datasets/name/${datasetName}`);
  20335. this.processAsync(url, 'DELETE', callback);
  20336. }
  20337. processAsync(url, method, callback, params) {
  20338. let eventId = ++this.eventCount;
  20339. let eventListeners = {
  20340. scope: this,
  20341. processCompleted: function(result) {
  20342. if (eventId === result.result.eventId && callback) {
  20343. delete result.result.eventId;
  20344. callback(result);
  20345. this.events && this.events.un(eventListeners);
  20346. return false;
  20347. }
  20348. },
  20349. processFailed: function(result) {
  20350. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  20351. callback(result);
  20352. this.events && this.events.un(eventListeners);
  20353. return false;
  20354. }
  20355. }
  20356. }
  20357. this.events.on(eventListeners);
  20358. var me = this;
  20359. let requestConfig = {
  20360. url,
  20361. method,
  20362. scope: me,
  20363. success(result, options) {
  20364. result.eventId = eventId;
  20365. me.serviceProcessCompleted(result, options);
  20366. },
  20367. failure(result, options) {
  20368. if (result.error) {
  20369. result.error.eventId = eventId;
  20370. }
  20371. result.eventId = eventId;
  20372. me.serviceProcessFailed(result, options);
  20373. }
  20374. }
  20375. params && (requestConfig.data = Util_Util.toJSON(params));
  20376. me.request(requestConfig);
  20377. }
  20378. }
  20379. ;// CONCATENATED MODULE: ./src/common/iServer/CreateDatasetParameters.js
  20380. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  20381. * This program are made available under the terms of the Apache License, Version 2.0
  20382. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20383. /**
  20384. * @class CreateDatasetParameters
  20385. * @deprecatedclass SuperMap.CreateDatasetParameters
  20386. * @category iServer Data Dataset
  20387. * @classdesc 数据集创建参数类。
  20388. * @param {Object} options - 参数。
  20389. * @param {string} options.datasourceName - 数据源名称,此为必选参数。
  20390. * @param {string} options.datasetName - 数据集名称,此为必选参数。
  20391. * @param {string} options.datasetType - 数据集类型。目前支持创建的数据集类型有:点、线、面、文本、复合(CAD)和属性数据集。
  20392. * @usage
  20393. */
  20394. class CreateDatasetParameters {
  20395. constructor(options) {
  20396. if (!options) {
  20397. return;
  20398. }
  20399. /**
  20400. * @member {string} CreateDatasetParameters.prototype.datasourceName
  20401. * @description 数据源名称,此为必选参数。
  20402. */
  20403. this.datasourceName = null;
  20404. /**
  20405. * @member {string} CreateDatasetParameters.prototype.datasetName
  20406. * @description 数据集名称,此为必选参数。
  20407. */
  20408. this.datasetName = null;
  20409. /**
  20410. * @member {string} CreateDatasetParameters.prototype.datasetType
  20411. * @description 数据集类型。目前支持创建的数据集类型有:点、线、面、文本、复合(CAD)和属性数据集。
  20412. */
  20413. this.datasetType = null;
  20414. if (options) {
  20415. Util_Util.extend(this, options);
  20416. }
  20417. this.CLASS_NAME = "SuperMap.CreateDatasetParameters";
  20418. }
  20419. /**
  20420. * @function CreateDatasetParameters.prototype.destroy
  20421. * @description 释放资源,将引用资源的属性置空。
  20422. */
  20423. destroy() {
  20424. var me = this;
  20425. me.datasourceName = null;
  20426. me.datasetName = null;
  20427. me.datasetType = null;
  20428. }
  20429. }
  20430. ;// CONCATENATED MODULE: ./src/common/iServer/UpdateDatasetParameters.js
  20431. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  20432. * This program are made available under the terms of the Apache License, Version 2.0
  20433. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20434. /**
  20435. * @class UpdateDatasetParameters
  20436. * @deprecatedclass SuperMap.UpdateDatasetParameters
  20437. * @category iServer Data Dataset
  20438. * @classdesc 数据集信息更改参数类。
  20439. * @param {Object} options - 参数。
  20440. * @param {string} options.datasourceName - 数据源名称。
  20441. * @param {string} options.datasetName - 数据集名称。
  20442. * @param {boolean} options.isFileCache - 是否使用文件形式的缓存。仅对数据库型数据源中的矢量数据集有效。
  20443. * @param {string} options.description - 数据集描述信息。
  20444. * @param {string} options.prjCoordSys - 投影坐标系。
  20445. * @param {Object} options.charset - 矢量数据集的字符集。当数据集类型为矢量数据集时,可以传递此参数。如果用户传递空值,则编码方式保持不变。
  20446. * @param {Array.<string>} options.palette - 影像数据的颜色调色板。当数据集类型为影像数据集时,可以传递此参数。
  20447. * @param {number} options.noValue - 栅格数据集中没有数据的像元的栅格值。当数据集类型为栅格数据集时,可以传递此参数。
  20448. * @usage
  20449. */
  20450. class UpdateDatasetParameters {
  20451. constructor(options) {
  20452. if (!options) {
  20453. return;
  20454. }
  20455. /**
  20456. * @member {string} UpdateDatasetParameters.prototype.datasourceName
  20457. * @description 数据源名称。
  20458. */
  20459. this.datasourceName = null;
  20460. /**
  20461. * @member {string} UpdateDatasetParameters.prototype.datasetName
  20462. * @description 数据集名称。
  20463. */
  20464. this.datasetName = null;
  20465. /**
  20466. * @member {boolean} UpdateDatasetParameters.prototype.isFileCache
  20467. * @description 是否使用文件形式的缓存。仅对数据库型数据源中的矢量数据集有效。
  20468. */
  20469. this.isFileCache = null;
  20470. /**
  20471. * @member {string} UpdateDatasetParameters.prototype.description
  20472. * @description 数据集描述信息。
  20473. */
  20474. this.description = null;
  20475. /**
  20476. * @member {string} UpdateDatasetParameters.prototype.prjCoordSys
  20477. * @description 投影坐标系。
  20478. */
  20479. this.prjCoordSys = null;
  20480. /**
  20481. * @member {Object} UpdateDatasetParameters.prototype.charset
  20482. * @description 矢量数据集的字符集。
  20483. */
  20484. this.charset = null;
  20485. /**
  20486. * @member {Array.<string>} UpdateDatasetParameters.prototype.palette
  20487. * @description 影像数据的颜色调色板。
  20488. */
  20489. this.palette = null;
  20490. /**
  20491. * @member {number} UpdateDatasetParameters.prototype.noValue
  20492. * @description 栅格数据集中没有数据的像元的栅格值。
  20493. */
  20494. this.noValue = null;
  20495. if (options) {
  20496. Util_Util.extend(this, options);
  20497. }
  20498. this.CLASS_NAME = "SuperMap.UpdateDatasetParameters";
  20499. }
  20500. /**
  20501. * @function UpdateDatasetParameters.prototype.destroy
  20502. * @description 释放资源,将引用资源的属性置空。
  20503. */
  20504. destroy() {
  20505. var me = this;
  20506. me.datasourceName = null;
  20507. me.datasetName = null;
  20508. me.isFileCache = null;
  20509. me.prjCoordSys = null;
  20510. me.charset = null;
  20511. me.palette = null;
  20512. me.noValue = null;
  20513. }
  20514. }
  20515. ;// CONCATENATED MODULE: ./src/maplibregl/services/DatasetService.js
  20516. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  20517. * This program are made available under the terms of the Apache License, Version 2.0
  20518. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20519. /**
  20520. * @class DatasetService
  20521. * @category iServer Data Dataset
  20522. * @classdesc 数据集信息服务类。
  20523. * @version 11.1.0
  20524. * @modulecategory Services
  20525. * @param {string} url - 服务地址。
  20526. * @param {Object} options - 参数。
  20527. * @param {string} [options.proxy] - 服务代理地址。
  20528. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  20529. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  20530. * @param {Object} [options.headers] - 请求头。
  20531. * @extends {ServiceBase}
  20532. * @usage
  20533. */
  20534. class DatasetService extends ServiceBase {
  20535. constructor(url, options) {
  20536. super(url, options);
  20537. this._datasetService = new DatasetService_DatasetService(this.url, {
  20538. proxy: this.options.proxy,
  20539. withCredentials: this.options.withCredentials,
  20540. crossOrigin: this.options.crossOrigin,
  20541. headers: this.options.headers
  20542. });
  20543. }
  20544. /**
  20545. * @function DatasetService.prototype.getDatasets
  20546. * @description 数据集查询服务。
  20547. * @example
  20548. * new DatasetService(url).getDatasets(datasourceName,function(result){
  20549. * //doSomething
  20550. * });
  20551. * @param {string} datasourceName - 数据源名称。
  20552. * @param {RequestCallback} callback - 回调函数。
  20553. */
  20554. getDatasets(datasourceName, callback) {
  20555. if (!datasourceName) {
  20556. return;
  20557. }
  20558. this._datasetService.getDatasetsService(datasourceName, callback);
  20559. }
  20560. /**
  20561. * @function DatasetService.prototype.getDataset
  20562. * @description 数据集查询服务。
  20563. * @example
  20564. * new DatasetService(url).getDataset(datasourceName, datasetName, function(result){
  20565. * //doSomething
  20566. * });
  20567. * @param {string} datasourceName - 数据源名称。
  20568. * @param {string} datasetName - 数据集名称。
  20569. * @param {RequestCallback} callback - 回调函数。
  20570. */
  20571. getDataset(datasourceName, datasetName, callback) {
  20572. if (!datasourceName || !datasetName) {
  20573. return;
  20574. }
  20575. this._datasetService.getDatasetService(datasourceName, datasetName, callback);
  20576. }
  20577. /**
  20578. * @function DatasetService.prototype.setDataset
  20579. * @description 数据集信息设置服务。可实现修改已存在数据集,新增不存在数据集。
  20580. * @example
  20581. * new DatasetService(url).setDataset(params, function(result){
  20582. * //doSomething
  20583. * });
  20584. * @param {CreateDatasetParameters|UpdateDatasetParameters} params - 数据集创建参数类或数据集信息更改参数类。
  20585. * @param {RequestCallback} callback - 回调函数。
  20586. */
  20587. setDataset(params, callback) {
  20588. if(!(params instanceof CreateDatasetParameters) && !(params instanceof UpdateDatasetParameters)){
  20589. return;
  20590. }else if (params instanceof CreateDatasetParameters) {
  20591. var datasetParams = {
  20592. "datasetType": params.datasetType,
  20593. "datasetName": params.datasetName,
  20594. "datasourceName": params.datasourceName
  20595. }
  20596. }else if(params instanceof UpdateDatasetParameters){
  20597. datasetParams = {
  20598. "datasetName": params.datasetName,
  20599. "datasourceName": params.datasourceName,
  20600. "isFileCache": params.isFileCache,
  20601. "description": params.description,
  20602. "prjCoordSys": params.prjCoordSys,
  20603. "charset": params.charset
  20604. }
  20605. }
  20606. this._datasetService.setDatasetService(datasetParams, callback);
  20607. }
  20608. /**
  20609. * @function DatasetService.prototype.deleteDataset
  20610. * @description 指定数据源下的数据集删除服务。
  20611. * @example
  20612. * new DatasetService(url).deleteDataset(datasourceName, datasetName, function(result){
  20613. * //doSomething
  20614. * });
  20615. * @param {string} datasourceName - 数据源名称。
  20616. * @param {string} datasetName - 数据集名称。
  20617. * @param {RequestCallback} callback - 回调函数。
  20618. */
  20619. deleteDataset(datasourceName, datasetName, callback) {
  20620. this._datasetService.deleteDatasetService(datasourceName, datasetName, callback);
  20621. }
  20622. }
  20623. ;// CONCATENATED MODULE: ./src/common/iServer/SetDatasourceParameters.js
  20624. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  20625. * This program are made available under the terms of the Apache License, Version 2.0
  20626. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20627. /**
  20628. * @class SetDatasourceParameters
  20629. * @deprecatedclass SuperMap.SetDatasourceParameters
  20630. * @category iServer Data Datasource
  20631. * @classdesc 设置数据源信息参数类。
  20632. * @param {Object} options - 参数。
  20633. * @param {string} options.datasourceName - 数据源名称。
  20634. * @param {string} options.description - 数据源描述信息。
  20635. * @param {string} options.coordUnit - 坐标单位。
  20636. * @param {string} options.distanceUnit - 距离单位。
  20637. * @usage
  20638. */
  20639. class SetDatasourceParameters {
  20640. constructor(options) {
  20641. if (!options) {
  20642. return;
  20643. }
  20644. /**
  20645. * @member {string} SetDatasourceParameters.prototype.datasourceName
  20646. * @description 数据源名称。
  20647. */
  20648. this.datasourceName = null;
  20649. /**
  20650. * @member {string} SetDatasourceParameters.prototype.description
  20651. * @description 数据源描述信息。
  20652. */
  20653. this.description = null;
  20654. /**
  20655. * @member {string} SetDatasourceParameters.prototype.coordUnit
  20656. * @description 坐标单位。
  20657. */
  20658. this.coordUnit = null;
  20659. /**
  20660. * @member {string} SetDatasourceParameters.prototype.distanceUnit
  20661. * @description 距离单位。
  20662. */
  20663. this.distanceUnit = null;
  20664. if (options) {
  20665. Util_Util.extend(this, options);
  20666. }
  20667. this.CLASS_NAME = "SuperMap.SetDatasourceParameters";
  20668. }
  20669. /**
  20670. * @function SetDatasourceParameters.prototype.destroy
  20671. * @description 释放资源,将引用资源的属性置空。
  20672. */
  20673. destroy() {
  20674. var me = this;
  20675. me.datasourceName = null;
  20676. me.description = null;
  20677. me.coordUnit = null;
  20678. me.distanceUnit = null;
  20679. }
  20680. }
  20681. ;// CONCATENATED MODULE: ./src/common/iServer/DatasourceService.js
  20682. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  20683. * This program are made available under the terms of the Apache License, Version 2.0
  20684. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20685. /**
  20686. * @class DatasourceService
  20687. * @deprecatedclass SuperMap.DatasourceService
  20688. * @category iServer Data Datasource
  20689. * @classdesc 数据源查询服务类。
  20690. * @param {string} url - 服务地址。如访问World Data服务,只需将url设为:http://localhost:8090/iserver/services/data-world/rest/data 即可。
  20691. * @param {Object} options - 参数。
  20692. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  20693. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  20694. * @param {string} options.datasource - 要查询的数据集所在的数据源名称。
  20695. * @param {string} options.dataset - 要查询的数据集名称。
  20696. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  20697. * @param {Object} [options.headers] - 请求头。
  20698. * @extends {CommonServiceBase}
  20699. * @usage
  20700. */
  20701. class DatasourceService_DatasourceService extends CommonServiceBase {
  20702. constructor(url, options) {
  20703. super(url, options);
  20704. if (options) {
  20705. Util_Util.extend(this, options);
  20706. }
  20707. this.eventCount = 0;
  20708. this.CLASS_NAME = "SuperMap.DatasourceService";
  20709. }
  20710. /**
  20711. * @function DatasourceService.prototype.destroy
  20712. * @override
  20713. */
  20714. destroy() {
  20715. this.eventCount = 0;
  20716. super.destroy();
  20717. }
  20718. /**
  20719. * @function DatasourceService.prototype.getDatasourceService
  20720. * @description 获取指定数据源信息。
  20721. */
  20722. getDatasourceService(datasourceName, callback) {
  20723. let url = Util_Util.urlPathAppend(this.url,`datasources/name/${datasourceName}`);
  20724. this.processAsync(url, "GET", callback);
  20725. }
  20726. /**
  20727. * @function DatasourceService.prototype.getDatasourcesService
  20728. * @description 获取所有数据源信息。
  20729. */
  20730. getDatasourcesService(callback) {
  20731. let url = Util_Util.urlPathAppend(this.url,`datasources`);
  20732. this.processAsync(url, "GET", callback);
  20733. }
  20734. /**
  20735. * @function DatasourceService.prototype.setDatasourceService
  20736. * @description 更新数据源信息。
  20737. */
  20738. setDatasourceService(params, callback) {
  20739. if (!params) {
  20740. return;
  20741. }
  20742. const url = Util_Util.urlPathAppend(this.url,`datasources/name/${params.datasourceName}`);
  20743. this.processAsync(url, "PUT", callback, params);
  20744. }
  20745. processAsync(url, method, callback, params) {
  20746. let eventId = ++this.eventCount;
  20747. let eventListeners = {
  20748. scope: this,
  20749. processCompleted: function(result) {
  20750. if (eventId === result.result.eventId && callback) {
  20751. delete result.result.eventId;
  20752. callback(result);
  20753. this.events && this.events.un(eventListeners);
  20754. return false;
  20755. }
  20756. },
  20757. processFailed: function(result) {
  20758. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  20759. callback(result);
  20760. this.events && this.events.un(eventListeners);
  20761. return false;
  20762. }
  20763. }
  20764. }
  20765. this.events.on(eventListeners);
  20766. var me = this;
  20767. let requestConfig = {
  20768. url,
  20769. method,
  20770. scope: me,
  20771. success(result, options) {
  20772. result.eventId = eventId;
  20773. this.serviceProcessCompleted(result, options);
  20774. },
  20775. failure(result, options) {
  20776. if (result.error) {
  20777. result.error.eventId = eventId;
  20778. }
  20779. result.eventId = eventId;
  20780. this.serviceProcessFailed(result, options);
  20781. }
  20782. }
  20783. params && (requestConfig.data = Util_Util.toJSON(params));
  20784. me.request(requestConfig);
  20785. }
  20786. }
  20787. ;// CONCATENATED MODULE: ./src/maplibregl/services/DatasourceService.js
  20788. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  20789. * This program are made available under the terms of the Apache License, Version 2.0
  20790. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20791. /**
  20792. * @class DatasourceService
  20793. * @category iServer Data Datasource
  20794. * @classdesc 数据源服务类。
  20795. * @modulecategory Services
  20796. * @version 11.1.0
  20797. * @modulecategory Services
  20798. * @param {string} url - 服务地址。
  20799. * @param {Object} options - 参数。
  20800. * @param {string} [options.proxy] - 服务代理地址。
  20801. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  20802. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  20803. * @param {Object} [options.headers] - 请求头。
  20804. * @extends {ServiceBase}
  20805. * @usage
  20806. */
  20807. class DatasourceService extends ServiceBase {
  20808. constructor(url, options) {
  20809. super(url, options);
  20810. this._datasourceService = new DatasourceService_DatasourceService(this.url, {
  20811. proxy: this.proxy,
  20812. withCredentials: this.withCredentials,
  20813. crossOrigin: this.crossOrigin,
  20814. headers: this.headers
  20815. });
  20816. }
  20817. /**
  20818. * @function DatasourceService.prototype.getDatasources
  20819. * @description 数据源集查询服务。
  20820. * @example
  20821. * new DatasourceService(url).getDatasources(function(result){
  20822. * //doSomething
  20823. * });
  20824. * @param {RequestCallback} callback - 回调函数。
  20825. */
  20826. getDatasources(callback) {
  20827. this._datasourceService.getDatasourcesService(callback);
  20828. }
  20829. /**
  20830. * @function DatasourceService.prototype.getDatasource
  20831. * @description 数据源信息查询服务。
  20832. * @example
  20833. * new DatasourceService(url).getDatasource(datasourceName,function(result){
  20834. * //doSomething
  20835. * });
  20836. * @param {string} datasourceName - 数据源名称。
  20837. * @param {RequestCallback} callback 回调函数。
  20838. */
  20839. getDatasource(datasourceName, callback) {
  20840. if (!datasourceName) {
  20841. return;
  20842. }
  20843. this._datasourceService.getDatasourceService(datasourceName, callback);
  20844. }
  20845. /**
  20846. * @function DatasourceService.prototype.setDatasource
  20847. * @description 数据源信息设置服务。可实现更改当前数据源信息。
  20848. * @example
  20849. * new DatasourceService(url).setDatasource(params, function(result){
  20850. * //doSomething
  20851. * });
  20852. * @param {SetDatasourceParameters} params - 数据源信息查询参数类。
  20853. * @param {RequestCallback} callback - 回调函数。
  20854. */
  20855. setDatasource(params, callback) {
  20856. if (!(params instanceof SetDatasourceParameters)) {
  20857. return;
  20858. }
  20859. const datasourceParams = {
  20860. description: params.description ,
  20861. coordUnit: params.coordUnit,
  20862. distanceUnit: params.distanceUnit,
  20863. datasourceName: params.datasourceName
  20864. };
  20865. this._datasourceService.setDatasourceService(datasourceParams, callback);
  20866. }
  20867. }
  20868. ;// CONCATENATED MODULE: ./src/common/iServer/EditFeaturesParameters.js
  20869. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  20870. * This program are made available under the terms of the Apache License, Version 2.0
  20871. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20872. /**
  20873. * @class EditFeaturesParameters
  20874. * @deprecatedclass SuperMap.EditFeaturesParameters
  20875. * @category iServer Data Feature
  20876. * @classdesc 数据集添加、修改、删除参数类。
  20877. * @param {Object} options - 参数。
  20878. * @param {Array.<FeatureVector|GeoJSONObject|ol.Feature>} options.features - 当前需要创建或者是修改的要素集。
  20879. * @param {boolean} [options.returnContent=false] - 是否返回要素内容。如果为true则返回创建要素的 ID 数组,否则返回 featureResult 资源的 URI。
  20880. * @param {EditType} [options.editType=EditType.ADD] - POST 动作类型 (ADD、UPDATE、DELETE)。
  20881. * @param {Array.<string|number>} [options.IDs] - 删除要素时的要素的 ID 数组。
  20882. * @usage
  20883. */
  20884. class EditFeaturesParameters {
  20885. constructor(options) {
  20886. /**
  20887. * @member {string} EditFeaturesParameters.prototype.dataSourceName
  20888. * @description 当前需要创建或者是修改的要素的数据源。
  20889. */
  20890. this.dataSourceName = null;
  20891. /**
  20892. * @member {string} EditFeaturesParameters.prototype.dataSetName
  20893. * @description 当前需要创建或者是修改的要素的数据集。
  20894. */
  20895. this.dataSetName = null;
  20896. /**
  20897. * @member {Array.<FeatureVector|GeoJSONObject|ol.Feature>} EditFeaturesParameters.prototype.features
  20898. * @description 当前需要创建或者是修改的要素集。
  20899. */
  20900. this.features = null;
  20901. /**
  20902. * @member {EditType} [EditFeaturesParameters.prototype.editType=EditType.ADD]
  20903. * @description 要素集更新类型 (add、update、delete)。
  20904. */
  20905. this.editType = EditType.ADD;
  20906. /**
  20907. * @member {Array.<string|number>} [EditFeaturesParameters.prototype.IDs]
  20908. * @description 执行删除时要素集 ID 集合。
  20909. */
  20910. this.IDs = null;
  20911. /**
  20912. * @member {boolean} [EditFeaturesParameters.prototype.returnContent=false]
  20913. * @description 要素添加时,isUseBatch 不传或传为 false 的情况下有效。
  20914. * true 表示直接返回新创建的要素的 ID 数组;false 表示返回创建的 featureResult 资源的 URI。
  20915. */
  20916. this.returnContent = false;
  20917. /**
  20918. * @member {boolean} [EditFeaturesParameters.prototype.isUseBatch=false]
  20919. * @description 是否使用批量添加要素功能,要素添加时有效。批量添加能够提高要素编辑效率。true 表示批量添加;false 表示不使用批量添加。
  20920. */
  20921. this.isUseBatch = false;
  20922. Util_Util.extend(this, options);
  20923. this.CLASS_NAME = "SuperMap.EditFeaturesParameters";
  20924. }
  20925. /**
  20926. * @function EditFeaturesParameters.prototype.destroy
  20927. * @description 释放资源,将引用资源的属性置空。
  20928. */
  20929. destroy() {
  20930. var me = this;
  20931. me.dataSourceName = null;
  20932. me.dataSetName = null;
  20933. me.features = null;
  20934. me.editType = null;
  20935. me.IDs = null;
  20936. me.returnContent = null;
  20937. }
  20938. /**
  20939. * @function EditFeaturesParameters.prototype.toJsonParameters
  20940. * @description 将 EditFeaturesParameters 对象参数转换为 JSON 字符串。
  20941. * @param {EditFeaturesParameters} params - 地物编辑参数。
  20942. * @returns {string} JSON 字符串。
  20943. */
  20944. static toJsonParameters(params) {
  20945. var feature,
  20946. len,
  20947. features,
  20948. editType = params.editType;
  20949. if (editType === EditType.DELETE) {
  20950. if (params.IDs === null) {
  20951. return;
  20952. }
  20953. features = {ids: params.IDs};
  20954. } else {
  20955. features = [];
  20956. if (params.features) {
  20957. len = params.features.length;
  20958. for (var i = 0; i < len; i++) {
  20959. feature = params.features[i];
  20960. feature.geometry = ServerGeometry.fromGeometry(feature.geometry);
  20961. features.push(feature);
  20962. }
  20963. }
  20964. }
  20965. return Util_Util.toJSON(features);
  20966. }
  20967. }
  20968. ;// CONCATENATED MODULE: ./src/common/iServer/EditFeaturesService.js
  20969. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  20970. * This program are made available under the terms of the Apache License, Version 2.0
  20971. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20972. /**
  20973. * @class EditFeaturesService
  20974. * @deprecatedclass SuperMap.EditFeaturesService
  20975. * @category iServer Data Feature
  20976. * @classdesc 数据服务中数据集添加、更新、删除服务类。
  20977. * @extends {CommonServiceBase}
  20978. * @param {string} url - 服务端的数据服务资源地址。请求数据服务中数据集编辑服务,URL 应为:</br>
  20979. * http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/datasources/name/{数据源名}/datasets/name/{数据集名} 。</br>
  20980. * 例如:http://localhost:8090/iserver/services/data-jingjin/rest/data/datasources/name/Jingjin/datasets/name/Landuse_R
  20981. * @param {Object} options - 参数。
  20982. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  20983. * @param {DataFormat} [format] -查询结果返回格式,目前支持iServerJSON 和GeoJSON两种格式。参数格式为"ISERVER","GEOJSON"。
  20984. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  20985. * @param {Object} [options.headers] - 请求头。
  20986. * @example
  20987. * var myService = new EditFeaturesService(url, {eventListeners: {
  20988. * "processCompleted": editFeatureCompleted,
  20989. * "processFailed": editFeatureError
  20990. * }
  20991. * };
  20992. * @usage
  20993. */
  20994. class EditFeaturesService extends CommonServiceBase {
  20995. constructor(url, options) {
  20996. super(url, options);
  20997. /**
  20998. * @member {boolean} [EditFeaturesService.prototype.returnContent=false]
  20999. * @description要素添加时,isUseBatch 不传或传为 false 的情况下有效。true 表示直接返回新创建的要素的 ID 数组;false 表示返回创建的 featureResult 资源的 URI。
  21000. */
  21001. this.returnContent = false;
  21002. /**
  21003. * @member {boolean} [EditFeaturesService.prototype.isUseBatch=false]
  21004. * @description 是否使用批量添加要素功能,要素添加时有效。
  21005. * 批量添加能够提高要素编辑效率。
  21006. * true 表示批量添加;false 表示不使用批量添加。
  21007. */
  21008. this.isUseBatch = false;
  21009. if (options) {
  21010. Util_Util.extend(this, options);
  21011. }
  21012. this.url = Util_Util.urlPathAppend(this.url, 'features');
  21013. this.CLASS_NAME = "SuperMap.EditFeaturesService";
  21014. }
  21015. /**
  21016. * @function EditFeaturesService.prototype.destroy
  21017. * @override
  21018. */
  21019. destroy() {
  21020. super.destroy();
  21021. var me = this;
  21022. me.returnContent = null;
  21023. me.isUseBatch = null;
  21024. me.fromIndex = null;
  21025. me.toIndex = null;
  21026. }
  21027. /**
  21028. * @function EditFeaturesService.prototype.processAsync
  21029. * @description 负责将客户端的更新参数传递到服务端。
  21030. * @param {EditFeaturesParameters} params - 编辑要素参数。
  21031. */
  21032. processAsync(params) {
  21033. if (!(params instanceof EditFeaturesParameters)) {
  21034. return;
  21035. }
  21036. var me = this,
  21037. method = "POST",
  21038. ids = "",
  21039. editType = params.editType,
  21040. jsonParameters = null;
  21041. me.returnContent = params.returnContent;
  21042. me.isUseBatch = params.isUseBatch;
  21043. jsonParameters = EditFeaturesParameters.toJsonParameters(params);
  21044. if (editType === EditType.DELETE) {
  21045. ids = Util_Util.toJSON(params.IDs);
  21046. jsonParameters = ids;
  21047. var urlWithIds = Util_Util.urlAppend(me.url, Util_Util.getParameterString({ids}))
  21048. if(FetchRequest.urlIsLong(urlWithIds)) {
  21049. me.url = Util_Util.urlAppend(me.url, Util_Util.getParameterString({_method: 'DELETE'}));
  21050. method = "POST";
  21051. } else{
  21052. me.url = urlWithIds;
  21053. method = "DELETE";
  21054. }
  21055. } else if (editType === EditType.UPDATE) {
  21056. method = "PUT";
  21057. } else {
  21058. if (me.isUseBatch) {
  21059. me.url = Util_Util.urlAppend(me.url, `isUseBatch=${me.isUseBatch}`);
  21060. me.returnContent = false;
  21061. }
  21062. if (me.returnContent) {
  21063. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  21064. method = "POST";
  21065. }
  21066. }
  21067. me.request({
  21068. method: method,
  21069. data: jsonParameters,
  21070. scope: me,
  21071. success: me.serviceProcessCompleted,
  21072. failure: me.serviceProcessFailed
  21073. });
  21074. }
  21075. }
  21076. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesServiceBase.js
  21077. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  21078. * This program are made available under the terms of the Apache License, Version 2.0
  21079. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21080. /**
  21081. * @class GetFeaturesServiceBase
  21082. * @deprecatedclass SuperMap.GetFeaturesServiceBase
  21083. * @category iServer Data FeatureResults
  21084. * @classdesc 数据服务中数据集查询服务基类。获取结果数据类型为 Object。包含 result 属性,result 的数据格式根据 format 参数决定为 GeoJSON 或者 iServerJSON。
  21085. * @extends CommonServiceBase
  21086. * @param {string} url - 服务地址。请求数据服务中数据集查询服务,
  21087. * URL应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/
  21088. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  21089. * @param {Object} options - 参数。
  21090. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  21091. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  21092. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  21093. * @param {Object} [options.headers] - 请求头。
  21094. * @example
  21095. * var myService = new GetFeaturesServiceBase(url, {
  21096. * eventListeners: {
  21097. * "processCompleted": getFeatureCompleted,
  21098. * "processFailed": getFeatureError
  21099. * }
  21100. * });
  21101. * @usage
  21102. */
  21103. class GetFeaturesServiceBase extends CommonServiceBase {
  21104. constructor(url, options) {
  21105. super(url, options);
  21106. options = options || {};
  21107. /**
  21108. * @member {boolean} [GetFeaturesServiceBase.prototype.returnContent=true]
  21109. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  21110. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  21111. * 如果为 false,则返回的是查询结果资源的 URI。
  21112. */
  21113. this.returnContent = true;
  21114. /**
  21115. * @member {number} [GetFeaturesServiceBase.prototype.fromIndex=0]
  21116. * @description 查询结果的最小索引号。如果该值大于查询结果的最大索引号,则查询结果为空。
  21117. */
  21118. this.fromIndex = 0;
  21119. /**
  21120. * @member {number} [GetFeaturesServiceBase.prototype.toIndex=19]
  21121. * @description 查询结果的最大索引号。
  21122. * 如果该值大于查询结果的最大索引号,则以查询结果的最大索引号为终止索引号。
  21123. */
  21124. this.toIndex = 19;
  21125. /**
  21126. * @member {number} [GetFeaturesServiceBase.prototype.hasGeometry=true]
  21127. * @description 返回结果是否包含Geometry。
  21128. */
  21129. this.hasGeometry = true;
  21130. /**
  21131. * @member {number} [GetFeaturesServiceBase.prototype.maxFeatures=1000]
  21132. * @description 进行 SQL 查询时,用于设置服务端返回查询结果条目数量。
  21133. */
  21134. this.maxFeatures = null;
  21135. /**
  21136. * @member {string} [GetFeaturesServiceBase.prototype.format=DataFormat.GEOJSON]
  21137. * @description 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。
  21138. * 参数格式为 "ISERVER","GEOJSON","FGB"。
  21139. */
  21140. this.format = DataFormat.GEOJSON;
  21141. Util_Util.extend(this, options);
  21142. this.url = Util_Util.urlPathAppend(this.url, 'featureResults');
  21143. this.CLASS_NAME = "SuperMap.GetFeaturesServiceBase";
  21144. }
  21145. /**
  21146. * @function GetFeaturesServiceBase.prototype.destroy
  21147. * @description 释放资源,将引用资源的属性置空。
  21148. */
  21149. destroy() {
  21150. super.destroy();
  21151. var me = this;
  21152. me.returnContent = null;
  21153. me.fromIndex = null;
  21154. me.toIndex = null;
  21155. me.maxFeatures = null;
  21156. me.format = null;
  21157. me.hasGeometry = null;
  21158. }
  21159. /**
  21160. * @function GetFeaturesServiceBase.prototype.processAsync
  21161. * @description 将客户端的查询参数传递到服务端。
  21162. * @param {Object} params - 查询参数。
  21163. */
  21164. processAsync(params) {
  21165. if (!params) {
  21166. return;
  21167. }
  21168. var me = this,
  21169. jsonParameters = null,
  21170. firstPara = true;
  21171. me.returnContent = params.returnContent;
  21172. me.fromIndex = params.fromIndex;
  21173. me.toIndex = params.toIndex;
  21174. me.maxFeatures = params.maxFeatures;
  21175. me.hasGeometry = params.hasGeometry;
  21176. if (me.returnContent) {
  21177. firstPara = false;
  21178. }
  21179. var isValidNumber = me.fromIndex != null && me.toIndex != null && !isNaN(me.fromIndex) && !isNaN(me.toIndex);
  21180. if (isValidNumber && me.fromIndex >= 0 && me.toIndex >= 0 && !firstPara) {
  21181. me.url = Util_Util.urlAppend(me.url, `fromIndex=${me.fromIndex}&toIndex=${me.toIndex}`);
  21182. }
  21183. if (params.returnCountOnly) {
  21184. me.url = Util_Util.urlAppend(me.url, "&returnCountOnly=" + params.returnContent)
  21185. }
  21186. jsonParameters = me.getJsonParameters(params);
  21187. me.request({
  21188. method: "POST",
  21189. data: jsonParameters,
  21190. scope: me,
  21191. success: me.serviceProcessCompleted,
  21192. failure: me.serviceProcessFailed
  21193. });
  21194. }
  21195. /**
  21196. * @function GetFeaturesServiceBase.prototype.getFeatureComplete
  21197. * @description 查询完成,执行此方法。
  21198. * @param {Object} result - 服务器返回的结果对象。
  21199. */
  21200. serviceProcessCompleted(result, options) {
  21201. var me = this;
  21202. result = Util_Util.transformResult(result);
  21203. if (me.format === DataFormat.GEOJSON && result.features) {
  21204. var geoJSONFormat = new GeoJSON();
  21205. result.features = geoJSONFormat.toGeoJSON(result.features);
  21206. }
  21207. me.events.triggerEvent("processCompleted", {result: result, options});
  21208. }
  21209. dataFormat() {
  21210. return [DataFormat.GEOJSON, DataFormat.ISERVER, DataFormat.FGB];
  21211. }
  21212. }
  21213. ;// CONCATENATED MODULE: ./src/common/iServer/FilterParameter.js
  21214. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  21215. * This program are made available under the terms of the Apache License, Version 2.0
  21216. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21217. /**
  21218. * @class FilterParameter
  21219. * @deprecatedclass SuperMap.FilterParameter
  21220. * @category iServer Data FeatureResults
  21221. * @classdesc 查询过滤条件参数类。该类用于设置查询数据集的查询过滤参数。
  21222. * @param {Object} options - 参数。
  21223. * @param {string} options.attributeFilter - 属性过滤条件。
  21224. * @param {string} options.name - 查询数据集名称或者图层名称。
  21225. * @param {Array.<JoinItem>} [options.joinItems] - 与外部表的连接信息 JoinItem 数组。
  21226. * @param {Array.<LinkItem>} [options.linkItems] - 与外部表的关联信息 LinkItem 数组。
  21227. * @param {Array.<string>} [options.ids] - 查询 id 数组,即属性表中的 SmID 值。
  21228. * @param {string} [options.orderBy] - 查询排序的字段,orderBy 的字段须为数值型的。
  21229. * @param {string} [options.groupBy] - 查询分组条件的字段。
  21230. * @param {Array.<string>} [options.fields] - 查询字段数组。
  21231. * @usage
  21232. */
  21233. class FilterParameter {
  21234. constructor(options) {
  21235. /**
  21236. * @member {string} FilterParameter.prototype.attributeFilter
  21237. * @description 属性过滤条件。
  21238. * 相当于 SQL 语句中的 WHERE 子句,其格式为:WHERE <条件表达式>,
  21239. * attributeFilter 就是其中的“条件表达式”。
  21240. * 该字段的用法为 attributeFilter = "过滤条件"。
  21241. * 例如,要查询字段 fieldValue 小于100的记录,设置 attributeFilter = "fieldValue < 100";
  21242. * 要查询字段 name 的值为“酒店”的记录,设置 attributeFilter = "name like '%酒店%'",等等。
  21243. */
  21244. this.attributeFilter = null;
  21245. /**
  21246. * @member {string} FilterParameter.prototype.name
  21247. * @description 查询数据集名称或者图层名称,根据实际的查询对象而定。
  21248. * 一般情况下该字段为数据集名称,但在进行与地图相关功能的操作时,
  21249. * 需要设置为图层名称(图层名称格式:数据集名称@数据源别名)。
  21250. * 因为一个地图的图层可能是来自于不同数据源的数据集,
  21251. * 而不同的数据源中可能存在同名的数据集,
  21252. * 使用数据集名称不能唯一的确定数据集,
  21253. * 所以在进行与地图相关功能的操作时,该值需要设置为图层名称。
  21254. */
  21255. this.name = null;
  21256. /**
  21257. * @member {Array.<JoinItem>} [FilterParameter.prototype.joinItems]
  21258. * @description 与外部表的连接信息 JoinItem 数组。
  21259. */
  21260. this.joinItems = null;
  21261. /**
  21262. * @member {Array.<LinkItem>} [FilterParameter.prototype.linkItems]
  21263. * @description 与外部表的关联信息 LinkItem 数组。
  21264. */
  21265. this.linkItems = null;
  21266. /**
  21267. * @member {Array.<string>} [FilterParameter.prototype.ids]
  21268. * @description 查询 id 数组,即属性表中的 SmID 值。
  21269. */
  21270. this.ids = null;
  21271. /**
  21272. * @member {string} [FilterParameter.prototype.orderBy]
  21273. * @description 查询排序的字段,orderBy的字段须为数值型的。
  21274. * 相当于 SQL 语句中的 ORDER BY 子句,其格式为:ORDER BY <列名>,
  21275. * 列名即属性表中每一列的名称,列又可称为属性,在 SuperMap 中又称为字段。
  21276. * 对单个字段排序时,该字段的用法为 orderBy = "字段名";
  21277. * 对多个字段排序时,字段之间以英文逗号进行分割,用法为 orderBy = "字段名1, 字段名2"。
  21278. * 例如,现有一个国家数据集,它有两个字段分别为“SmArea”和“pop_1994”,
  21279. * 分别表示国家的面积和1994年的各国人口数量。
  21280. * 如果要按照各国人口数量对记录进行排序,则 orderBy = "pop_1994";
  21281. * 如果要以面积和人口进行排序,则 orderBy = "SmArea, pop_1994"。
  21282. */
  21283. this.orderBy = null;
  21284. /**
  21285. * @member {string} [FilterParameter.prototype.groupBy]
  21286. * @description 查询分组条件的字段。
  21287. * 相当于 SQL 语句中的 GROUP BY 子句,其格式为:GROUP BY <列名>,
  21288. * 列名即属性表中每一列的名称,列又可称为属性,在 SuperMap 中又称为字段。
  21289. * 对单个字段分组时,该字段的用法为 groupBy = "字段名";
  21290. * 对多个字段分组时,字段之间以英文逗号进行分割,用法为 groupBy = "字段名1, 字段名2"。
  21291. * 例如,现有一个全球城市数据集,该数据集有两个字段分别为“Continent”和“Country”,
  21292. * 分别表示某个城市所属的洲和国家。
  21293. * 如果要按照国家对全球的城市进行分组,可以设置 groupBy = "Country";
  21294. * 如果以洲和国家对城市进行分组,设置 groupBy = "Continent, Country"。
  21295. */
  21296. this.groupBy = null;
  21297. /**
  21298. * @member {Array.<string>} [FilterParameter.prototype.fields]
  21299. * @description 查询字段数组,如果不设置则使用系统返回的所有字段。
  21300. */
  21301. this.fields = null;
  21302. if (options) {
  21303. Util_Util.extend(this, options);
  21304. }
  21305. this.CLASS_NAME = "SuperMap.FilterParameter";
  21306. }
  21307. /**
  21308. * @function FilterParameter.prototype.destroy
  21309. * @description 释放资源,将引用资源的属性置空。
  21310. */
  21311. destroy() {
  21312. var me = this;
  21313. me.attributeFilter = null;
  21314. me.name = null;
  21315. if (me.joinItems) {
  21316. for (let i = 0, joinItems = me.joinItems, len = joinItems.length; i < len; i++) {
  21317. joinItems[i].destroy();
  21318. }
  21319. me.joinItems = null;
  21320. }
  21321. if (me.linkItems) {
  21322. for (let i = 0, linkItems = me.linkItems, len = linkItems.length; i < len; i++) {
  21323. linkItems[i].destroy();
  21324. }
  21325. me.linkItems = null;
  21326. }
  21327. me.ids = null;
  21328. me.orderBy = null;
  21329. me.groupBy = null;
  21330. me.fields = null;
  21331. }
  21332. }
  21333. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesParametersBase.js
  21334. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  21335. * This program are made available under the terms of the Apache License, Version 2.0
  21336. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21337. /**
  21338. * @class GetFeaturesParametersBase
  21339. * @deprecatedclass SuperMap.GetFeaturesParametersBase
  21340. * @category iServer Data FeatureResults
  21341. * @classdesc 要素查询参数基类。
  21342. * @param {Object} options - 参数。
  21343. * @param {Array.<string>} options.datasetNames - 数据集名称列表。
  21344. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  21345. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  21346. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  21347. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  21348. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  21349. * @param {MetricsAggParameter|GeoHashGridAggParameter} [options.aggregations] - 聚合查询参数。该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  21350. * @usage
  21351. */
  21352. class GetFeaturesParametersBase {
  21353. constructor(options) {
  21354. /**
  21355. * @member {Array.<string>} GetFeaturesParametersBase.prototype.datasetName
  21356. * @description 数据集集合中的数据集名称列表。
  21357. */
  21358. this.datasetNames = null;
  21359. /**
  21360. * @member {string} GetFeaturesParametersBase.prototype.targetEpsgCode
  21361. * @description 动态投影的目标坐标系对应的 EPSG Code,使用时需设置 returnContent 参数为 true。
  21362. */
  21363. this.targetEpsgCode = null;
  21364. /**
  21365. * @member {Object} GetFeaturesParametersBase.prototype.targetPrj
  21366. * @description 动态投影的目标坐标系。使用时需设置 returnContent 参数为 true。如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  21367. */
  21368. this.targetPrj = null;
  21369. /**
  21370. * @member {boolean} [GetFeaturesParametersBase.prototype.returnContent=true]
  21371. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  21372. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  21373. * 如果为 false,则返回的是查询结果资源的 URI。
  21374. */
  21375. this.returnContent = true;
  21376. /**
  21377. * @member {number} [GetFeaturesParametersBase.prototype.fromIndex=0]
  21378. * @description 查询结果的最小索引号。如果该值大于查询结果的最大索引号,则查询结果为空。
  21379. */
  21380. this.fromIndex = 0;
  21381. /**
  21382. * @member {number} [GetFeaturesParametersBase.prototype.toIndex=19]
  21383. * @description 查询结果的最大索引号。如果该值大于查询结果的最大索引号,则以查询结果的最大索引号为终止索引号。
  21384. */
  21385. this.toIndex = 19;
  21386. /**
  21387. * @member {boolean} [GetFeaturesParametersBase.prototype.returnCountOnly=false]
  21388. * @description 只返回查询结果的总数。
  21389. */
  21390. this.returnCountOnly = false;
  21391. /**
  21392. * @member {number} [GetFeaturesParametersBase.prototype.maxFeatures=1000]
  21393. * @description 进行 SQL 查询时,用于设置服务端返回查询结果条目数量。
  21394. */
  21395. this.maxFeatures = null;
  21396. /**
  21397. * @member {number} [GetFeaturesParametersBase.prototype.hasGeometry=true]
  21398. * @description 返回结果是否包含Geometry。
  21399. */
  21400. this.hasGeometry = true;
  21401. /**
  21402. * @member {MetricsAggParameter|GeoHashGridAggParameter} GetFeaturesParametersBase.prototype.aggregations
  21403. * @description 聚合查询参数,该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  21404. */
  21405. this.aggregations = null;
  21406. Util_Util.extend(this, options);
  21407. this.CLASS_NAME = 'SuperMap.GetFeaturesParametersBase';
  21408. }
  21409. /**
  21410. *
  21411. * @function GetFeaturesParametersBase.prototype.destroy
  21412. * @description 释放资源,将引用资源的属性置空。
  21413. */
  21414. destroy() {
  21415. var me = this;
  21416. me.datasetNames = null;
  21417. me.returnContent = null;
  21418. me.fromIndex = null;
  21419. me.toIndex = null;
  21420. me.hasGeometry = null;
  21421. me.maxFeatures = null;
  21422. me.targetEpsgCode = null;
  21423. me.targetPrj = null;
  21424. if (me.aggregation) {
  21425. me.aggregation = null;
  21426. }
  21427. }
  21428. }
  21429. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByIDsParameters.js
  21430. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  21431. * This program are made available under the terms of the Apache License, Version 2.0
  21432. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21433. /**
  21434. * @class GetFeaturesByIDsParameters
  21435. * @deprecatedclass SuperMap.GetFeaturesByIDsParameters
  21436. * @category iServer Data FeatureResults
  21437. * @classdesc ID 查询参数类。
  21438. * @param {Object} options - 参数。
  21439. * @param {Array.<number>} options.IDs - 指定查询的元素 ID 信息。
  21440. * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
  21441. * @param {Array.<string>} options.dataSetNames - 数据集集合中的数据集名称列表。
  21442. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  21443. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  21444. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  21445. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  21446. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  21447. * @param {MetricsAggParameter|GeoHashGridAggParameter} [options.aggregations] - 聚合查询参数。该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  21448. * @extends {GetFeaturesParametersBase}
  21449. * @usage
  21450. */
  21451. class GetFeaturesByIDsParameters extends GetFeaturesParametersBase {
  21452. constructor(options) {
  21453. super(options);
  21454. /**
  21455. * @member {string} GetFeaturesByIDsParameters.prototype.getFeatureMode
  21456. * @description 数据集查询模式。
  21457. */
  21458. this.getFeatureMode = 'ID';
  21459. /**
  21460. * @member {Array.<number>} GetFeaturesByIDsParameters.prototype.IDs
  21461. * @description 所要查询指定的元素 ID 信息。
  21462. */
  21463. this.IDs = null;
  21464. /**
  21465. * @member {Array.<string>} GetFeaturesByIDsParameters.prototype.fields
  21466. * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
  21467. */
  21468. this.fields = null;
  21469. Util_Util.extend(this, options);
  21470. this.CLASS_NAME = 'SuperMap.GetFeaturesByIDsParameters';
  21471. }
  21472. /**
  21473. * @function GetFeaturesByIDsParameters.prototype.destroy
  21474. * @override
  21475. */
  21476. destroy() {
  21477. super.destroy();
  21478. var me = this;
  21479. me.IDs = null;
  21480. me.getFeatureMode = null;
  21481. if (me.fields) {
  21482. while (me.fields.length > 0) {
  21483. me.fields.pop();
  21484. }
  21485. me.fields = null;
  21486. }
  21487. }
  21488. /**
  21489. * @function GetFeaturesByIDsParameters.toJsonParameters
  21490. * @description 将 GetFeaturesByIDsParameters 对象转换为 JSON 字符串。
  21491. * @param {GetFeaturesByIDsParameters} params - ID 查询参数对象。
  21492. * @returns {string} 转化后的 JSON 字符串。
  21493. */
  21494. static toJsonParameters(params) {
  21495. var parasByIDs, filterParameter;
  21496. parasByIDs = {
  21497. datasetNames: params.datasetNames,
  21498. getFeatureMode: 'ID',
  21499. ids: params.IDs
  21500. };
  21501. if (params.fields) {
  21502. filterParameter = new FilterParameter();
  21503. filterParameter.name = params.datasetNames;
  21504. filterParameter.fields = params.fields;
  21505. parasByIDs.queryParameter = filterParameter;
  21506. }
  21507. if (params.targetEpsgCode) {
  21508. parasByIDs.targetEpsgCode = params.targetEpsgCode;
  21509. }
  21510. if (typeof params.hasGeometry === 'boolean') {
  21511. parasByIDs.hasGeometry = params.hasGeometry;
  21512. }
  21513. if (!params.targetEpsgCode && params.targetPrj) {
  21514. parasByIDs.targetPrj = params.targetPrj;
  21515. }
  21516. if (params.aggregations) {
  21517. parasByIDs.aggregations = params.aggregations;
  21518. }
  21519. return Util_Util.toJSON(parasByIDs);
  21520. }
  21521. }
  21522. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByIDsService.js
  21523. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  21524. * This program are made available under the terms of the Apache License, Version 2.0
  21525. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21526. /**
  21527. * @class GetFeaturesByIDsService
  21528. * @deprecatedclass SuperMap.GetFeaturesByIDsService
  21529. * @category iServer Data FeatureResults
  21530. * @classdesc 数据集ID查询服务类。在数据集集合中查找指定 ID 号对应的空间地物要素。
  21531. * @param {string} url - 服务地址。请求数据服务中数据集查询服务。
  21532. * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;</br>
  21533. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  21534. * @param {Object} options - 参数。
  21535. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  21536. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  21537. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  21538. * @param {Object} [options.headers] - 请求头。
  21539. * @extends {GetFeaturesServiceBase}
  21540. * @example
  21541. * var myGetFeaturesByIDsService = new GetFeaturesByIDsService(url, {
  21542. * eventListeners: {
  21543. * "processCompleted": getFeatureCompleted,
  21544. * "processFailed": getFeatureError
  21545. * }
  21546. * });
  21547. * function getFeatureCompleted(object){//todo};
  21548. * function getFeatureError(object){//todo}
  21549. * @usage
  21550. */
  21551. class GetFeaturesByIDsService extends GetFeaturesServiceBase {
  21552. constructor(url, options) {
  21553. super(url, options);
  21554. this.CLASS_NAME = "SuperMap.GetFeaturesByIDsService";
  21555. }
  21556. /**
  21557. * @function GetFeaturesByIDsService.prototype.destroy
  21558. * @override
  21559. */
  21560. destroy() {
  21561. super.destroy();
  21562. }
  21563. /**
  21564. * @function GetFeaturesByIDsService.prototype.getJsonParameters
  21565. * @description 将查询参数转化为 JSON 字符串。
  21566. * 在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry等)。
  21567. * @param {GetFeaturesByIDsParameters} params - ID查询参数类。
  21568. * @returns {string} 转化后的 JSON 字符串。
  21569. */
  21570. getJsonParameters(params) {
  21571. return GetFeaturesByIDsParameters.toJsonParameters(params);
  21572. }
  21573. }
  21574. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesBySQLParameters.js
  21575. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  21576. * This program are made available under the terms of the Apache License, Version 2.0
  21577. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21578. /**
  21579. * @class GetFeaturesBySQLParameters
  21580. * @deprecatedclass SuperMap.GetFeaturesBySQLParameters
  21581. * @category iServer Data FeatureResults
  21582. * @classdesc 数据集 SQL 查询参数类。
  21583. * @param {Object} options - 参数。
  21584. * @param {FilterParameter} options.queryParameter - 查询过滤条件参数。
  21585. * @param {Array.<string>} options.datasetNames - 数据集集合中的数据集名称列表。
  21586. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  21587. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  21588. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  21589. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  21590. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  21591. * @param {MetricsAggParameter|GeoHashGridAggParameter} [options.aggregations] - 聚合查询参数。该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  21592. * @extends {GetFeaturesParametersBase}
  21593. * @usage
  21594. */
  21595. class GetFeaturesBySQLParameters extends GetFeaturesParametersBase {
  21596. constructor(options) {
  21597. super(options);
  21598. /**
  21599. * @member {string} GetFeaturesBySQLParameters.prototype.getFeatureMode
  21600. * @description 数据集查询模式。
  21601. */
  21602. this.getFeatureMode = 'SQL';
  21603. /**
  21604. * @member {FilterParameter} GetFeaturesBySQLParameters.prototype.queryParameter
  21605. * @description 查询过滤条件参数类。
  21606. */
  21607. this.queryParameter = null;
  21608. Util_Util.extend(this, options);
  21609. this.CLASS_NAME = 'SuperMap.GetFeaturesBySQLParameters';
  21610. }
  21611. /**
  21612. * @function GetFeaturesBySQLParameters.prototype.destroy
  21613. * @override
  21614. */
  21615. destroy() {
  21616. super.destroy();
  21617. var me = this;
  21618. me.getFeatureMode = null;
  21619. if (me.queryParameter) {
  21620. me.queryParameter.destroy();
  21621. me.queryParameter = null;
  21622. }
  21623. }
  21624. /**
  21625. * @function GetFeaturesBySQLParameters.prototype.toJsonParameters
  21626. * @description 将 GetFeaturesBySQLParameters 对象转换为 JSON 字符串。
  21627. * @param {GetFeaturesBySQLParameters} params - 数据集 SQL 查询参数对象。
  21628. * @returns {string} 转化后的 JSON 字符串。
  21629. */
  21630. static toJsonParameters(params) {
  21631. var paramsBySql = {
  21632. datasetNames: params.datasetNames,
  21633. getFeatureMode: 'SQL',
  21634. queryParameter: params.queryParameter
  21635. };
  21636. if (params.maxFeatures && !isNaN(params.maxFeatures)) {
  21637. paramsBySql.maxFeatures = params.maxFeatures;
  21638. }
  21639. if (typeof params.hasGeometry === 'boolean') {
  21640. paramsBySql.hasGeometry = params.hasGeometry;
  21641. }
  21642. if (params.aggregations) {
  21643. paramsBySql.aggregations = params.aggregations;
  21644. }
  21645. if (params.targetEpsgCode) {
  21646. paramsBySql.targetEpsgCode = params.targetEpsgCode;
  21647. }
  21648. if (!params.targetEpsgCode && params.targetPrj) {
  21649. paramsBySql.targetPrj = params.targetPrj;
  21650. }
  21651. if (params.aggregations) {
  21652. paramsBySql.aggregations = params.aggregations;
  21653. }
  21654. return Util_Util.toJSON(paramsBySql);
  21655. }
  21656. }
  21657. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesBySQLService.js
  21658. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  21659. * This program are made available under the terms of the Apache License, Version 2.0
  21660. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21661. /**
  21662. * @class GetFeaturesBySQLService
  21663. * @deprecatedclass SuperMap.GetFeaturesBySQLService
  21664. * @constructs GetFeaturesBySQLService
  21665. * @category iServer Data FeatureResults
  21666. * @classdesc 数据服务中数据集 SQL 查询服务类。在一个或多个指定的图层上查询符合 SQL 条件的空间地物信息。
  21667. * @param {string} url - 服务地址。请求数据服务中数据集查询服务,
  21668. * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;</br>
  21669. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  21670. * @param {Object} options - 参数。
  21671. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  21672. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  21673. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  21674. * @param {Object} [options.headers] - 请求头。
  21675. * @extends {GetFeaturesServiceBase}
  21676. * @example
  21677. * var myGetFeaturesBySQLService = new GetFeaturesBySQLService(url, {
  21678. * eventListeners: {
  21679. * "processCompleted": GetFeaturesCompleted,
  21680. * "processFailed": GetFeaturesError
  21681. * }
  21682. * });
  21683. * function getFeaturesCompleted(object){//todo};
  21684. * function getFeaturesError(object){//todo};
  21685. * @usage
  21686. */
  21687. class GetFeaturesBySQLService extends GetFeaturesServiceBase {
  21688. constructor(url, options) {
  21689. super(url, options);
  21690. this.CLASS_NAME = "SuperMap.GetFeaturesBySQLService";
  21691. }
  21692. /**
  21693. * @function GetFeaturesBySQLService.prototype.destroy
  21694. * @override
  21695. */
  21696. destroy() {
  21697. super.destroy();
  21698. }
  21699. /*
  21700. * @function GetFeaturesBySQLService.prototype.getJsonParameters
  21701. * @description 将查询参数转化为 JSON 字符串。
  21702. * 在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry等)。
  21703. * @param {GetFeaturesBySQLParameters} params - 数据集SQL查询参数类。
  21704. * @returns {string} 转化后的 JSON 字符串。
  21705. */
  21706. getJsonParameters(params) {
  21707. return GetFeaturesBySQLParameters.toJsonParameters(params);
  21708. }
  21709. }
  21710. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBoundsParameters.js
  21711. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  21712. * This program are made available under the terms of the Apache License, Version 2.0
  21713. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21714. /**
  21715. * @class GetFeaturesByBoundsParameters
  21716. * @deprecatedclass SuperMap.GetFeaturesByBoundsParameters
  21717. * @category iServer Data FeatureResults
  21718. * @classdesc 数据集范围查询参数类,该类用于设置数据集范围查询的相关参数。
  21719. * @param {Object} options - 参数。
  21720. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 查询的范围对象。
  21721. * @param {Array.<string>} options.datasetNames - 数据集名称列表。
  21722. * @param {string} [options.attributeFilter] - 范围查询属性过滤条件。
  21723. * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
  21724. * @param {SpatialQueryMode} [options.spatialQueryMode=SpatialQueryMode.CONTAIN] - 空间查询模式常量。
  21725. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  21726. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  21727. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  21728. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  21729. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  21730. * @param {MetricsAggParameter|GeoHashGridAggParameter} [options.aggregations] - 聚合查询参数。该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  21731. * @extends {GetFeaturesParametersBase}
  21732. * @usage
  21733. */
  21734. class GetFeaturesByBoundsParameters extends GetFeaturesParametersBase {
  21735. constructor(options) {
  21736. super(options);
  21737. /**
  21738. * @member {string} GetFeaturesByBoundsParameters.prototype.getFeatureMode
  21739. * @description 数据集查询模式。范围查询有 "BOUNDS","BOUNDS_ATTRIBUTEFILTER" 两种,当用户设置 attributeFilter 时会自动切换到 BOUNDS_ATTRIBUTEFILTER 访问服务。
  21740. */
  21741. this.getFeatureMode = GetFeaturesByBoundsParameters.getFeatureMode.BOUNDS;
  21742. /**
  21743. * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} GetFeaturesByBoundsParameters.prototype.bounds
  21744. * @description 用于查询的范围对象。
  21745. *
  21746. */
  21747. this.bounds = null;
  21748. /**
  21749. * @member {Array.<string>} GetFeaturesByBoundsParameters.prototype.fields
  21750. * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
  21751. */
  21752. this.fields = null;
  21753. /**
  21754. * @member {string} GetFeaturesByBoundsParameters.prototype.attributeFilter
  21755. * @description 范围查询属性过滤条件。
  21756. */
  21757. this.attributeFilter = null;
  21758. /**
  21759. * @member {SpatialQueryMode} [GetFeaturesByBoundsParameters.prototype.spatialQueryMode=SpatialQueryMode.CONTAIN]
  21760. * @description 空间查询模式常量。
  21761. */
  21762. this.spatialQueryMode = SpatialQueryMode.CONTAIN;
  21763. Util_Util.extend(this, options);
  21764. this.CLASS_NAME = 'SuperMap.GetFeaturesByBoundsParameters';
  21765. }
  21766. /**
  21767. * @function GetFeaturesByBoundsParameters.prototype.destroy
  21768. * @override
  21769. */
  21770. destroy() {
  21771. super.destroy();
  21772. var me = this;
  21773. if (me.bounds) {
  21774. me.bounds.destroy();
  21775. me.bounds = null;
  21776. }
  21777. if (me.fields) {
  21778. while (me.fields.length > 0) {
  21779. me.fields.pop();
  21780. }
  21781. me.fields = null;
  21782. }
  21783. me.attributeFilter = null;
  21784. me.spatialQueryMode = null;
  21785. me.getFeatureMode = null;
  21786. }
  21787. /**
  21788. * @function GetFeaturesByBoundsParameters.toJsonParameters
  21789. * @description 将 {@link GetFeaturesByBoundsParameters} 对象参数转换为 JSON 字符串。
  21790. * @param {GetFeaturesByBoundsParameters} params - 范围查询参数。
  21791. * @returns {string} 转化后的 JSON 字符串。
  21792. *
  21793. */
  21794. static toJsonParameters(params) {
  21795. var filterParameter, bounds, parasByBounds;
  21796. bounds = {
  21797. leftBottom: { x: params.bounds.left, y: params.bounds.bottom },
  21798. rightTop: { x: params.bounds.right, y: params.bounds.top }
  21799. };
  21800. parasByBounds = {
  21801. datasetNames: params.datasetNames,
  21802. getFeatureMode: GetFeaturesByBoundsParameters.getFeatureMode.BOUNDS,
  21803. bounds: bounds,
  21804. spatialQueryMode: params.spatialQueryMode
  21805. };
  21806. if (params.fields) {
  21807. filterParameter = new FilterParameter();
  21808. filterParameter.name = params.datasetNames;
  21809. filterParameter.fields = params.fields;
  21810. parasByBounds.queryParameter = filterParameter;
  21811. }
  21812. if (params.attributeFilter) {
  21813. parasByBounds.attributeFilter = params.attributeFilter;
  21814. parasByBounds.getFeatureMode = GetFeaturesByBoundsParameters.getFeatureMode.BOUNDS_ATTRIBUTEFILTER;
  21815. }
  21816. if (params.maxFeatures && !isNaN(params.maxFeatures)) {
  21817. parasByBounds.maxFeatures = params.maxFeatures;
  21818. }
  21819. if (typeof params.hasGeometry === 'boolean') {
  21820. parasByBounds.hasGeometry = params.hasGeometry;
  21821. }
  21822. if (params.targetEpsgCode) {
  21823. parasByBounds.targetEpsgCode = params.targetEpsgCode;
  21824. }
  21825. if (!params.targetEpsgCode && params.targetPrj) {
  21826. parasByBounds.targetPrj = params.targetPrj;
  21827. }
  21828. if (params.aggregations) {
  21829. parasByBounds.aggregations = params.aggregations;
  21830. }
  21831. return Util_Util.toJSON(parasByBounds);
  21832. }
  21833. }
  21834. GetFeaturesByBoundsParameters.getFeatureMode = {
  21835. BOUNDS: 'BOUNDS',
  21836. BOUNDS_ATTRIBUTEFILTER: 'BOUNDS_ATTRIBUTEFILTER'
  21837. };
  21838. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBoundsService.js
  21839. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  21840. * This program are made available under the terms of the Apache License, Version 2.0
  21841. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21842. /**
  21843. * @class GetFeaturesByBoundsService
  21844. * @deprecatedclass SuperMap.GetFeaturesByBoundsService
  21845. * @category iServer Data FeatureResults
  21846. * @classdesc 数据集范围查询服务类,查询与指定范围对象符合一定空间关系的矢量要素。
  21847. * @description 数据集范围查询服务类构造函数。
  21848. * @extends {GetFeaturesServiceBase}
  21849. * @param {string} url - 服务地址。请求数据服务中数据集查询服务,URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;
  21850. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  21851. * @param {Object} options - 参数。
  21852. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  21853. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  21854. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  21855. * @param {Object} [options.headers] - 请求头。
  21856. * @example
  21857. * var myGetFeaturesByBoundsService = new SuperMa.GetFeaturesByBoundsService(url, {
  21858. * eventListeners: {
  21859. * "processCompleted": getFeatureCompleted,
  21860. * "processFailed": getFeatureError
  21861. * }
  21862. * });
  21863. * function getFeatureCompleted(object){//todo};
  21864. * function getFeatureError(object){//todo}
  21865. * @usage
  21866. */
  21867. class GetFeaturesByBoundsService extends GetFeaturesServiceBase {
  21868. constructor(url, options) {
  21869. super(url, options);
  21870. this.CLASS_NAME = "SuperMap.GetFeaturesByBoundsService";
  21871. }
  21872. /**
  21873. * @function GetFeaturesByBoundsService.prototype.destroy
  21874. * @override
  21875. */
  21876. destroy() {
  21877. super.destroy();
  21878. }
  21879. /**
  21880. * @function GetFeaturesByBoundsService.prototype.getJsonParameters
  21881. * @description 将查询参数转化为 JSON 字符串。在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry,Bounds等)。
  21882. * @param params {GetFeaturesByBoundsParameters}
  21883. * @returns {string} 转化后的 JSON 字符串。
  21884. *
  21885. */
  21886. getJsonParameters(params) {
  21887. return GetFeaturesByBoundsParameters.toJsonParameters(params);
  21888. }
  21889. }
  21890. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBufferParameters.js
  21891. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  21892. * This program are made available under the terms of the Apache License, Version 2.0
  21893. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21894. /**
  21895. * @class GetFeaturesByBufferParameters
  21896. * @deprecatedclass SuperMap.GetFeaturesByBufferParameters
  21897. * @category iServer Data FeatureResults
  21898. * @classdesc 数据集缓冲区查询参数类。
  21899. * @param {Object} options - 参数。
  21900. * @param {number} options.bufferDistance - buffer 距离,单位与所查询图层对应的数据集单位相同。
  21901. * @param {GeoJSONObject} options.geometry - 空间查询条件。
  21902. * @param {Array.<string>} options.dataSetNames - 数据集集合中的数据集名称列表。
  21903. * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
  21904. * @param {string} [options.attributeFilter] - 属性查询条件。
  21905. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  21906. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  21907. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  21908. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  21909. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  21910. * @extends {GetFeaturesParametersBase}
  21911. * @usage
  21912. */
  21913. class GetFeaturesByBufferParameters extends GetFeaturesParametersBase {
  21914. constructor(options) {
  21915. super(options);
  21916. /**
  21917. * @member {number} GetFeaturesByBufferParameters.prototype.bufferDistance
  21918. * @description buffer 距离,单位与所查询图层对应的数据集单位相同。
  21919. */
  21920. this.bufferDistance = null;
  21921. /**
  21922. * @member {string} GetFeaturesByBufferParameters.prototype.attributeFilter
  21923. * @description 属性查询条件。
  21924. */
  21925. this.attributeFilter = null;
  21926. /**
  21927. * @member {GeoJSONObject} GetFeaturesByBufferParameters.prototype.geometry
  21928. * @description 空间查询条件。<br>
  21929. * 点类型可以是:{@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>
  21930. * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。</br>
  21931. * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}|{@link mapboxgl.LngLatBounds}|{@link GeoJSONObject}。
  21932. */
  21933. this.geometry = null;
  21934. /**
  21935. * @member {Array.<string>} GetFeaturesByBufferParameters.prototype.fields
  21936. * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
  21937. */
  21938. this.fields = null;
  21939. Util_Util.extend(this, options);
  21940. this.CLASS_NAME = 'SuperMap.GetFeaturesByBufferParameters';
  21941. }
  21942. /**
  21943. * @function GetFeaturesByBufferParameters.prototype.destroy
  21944. * @override
  21945. */
  21946. destroy() {
  21947. super.destroy();
  21948. var me = this;
  21949. me.bufferDistance = null;
  21950. me.attributeFilter = null;
  21951. if (me.fields) {
  21952. while (me.fields.length > 0) {
  21953. me.fields.pop();
  21954. }
  21955. me.fields = null;
  21956. }
  21957. if (me.geometry) {
  21958. me.geometry.destroy();
  21959. me.geometry = null;
  21960. }
  21961. }
  21962. /**
  21963. * @function GetFeaturesByBufferParameters.toJsonParameters
  21964. * @description 将 GetFeaturesByBufferParameters 对象转换为 JSON 字符串。
  21965. * @param {GetFeaturesByBufferParameters} params - 数据集缓冲区查询参数对象。
  21966. * @returns {string} 转化后的 JSON 字符串。
  21967. */
  21968. static toJsonParameters(params) {
  21969. var filterParameter, paramsByBuffer, geometry;
  21970. geometry = ServerGeometry.fromGeometry(params.geometry);
  21971. paramsByBuffer = {
  21972. datasetNames: params.datasetNames,
  21973. getFeatureMode: 'BUFFER',
  21974. bufferDistance: params.bufferDistance,
  21975. geometry: geometry
  21976. };
  21977. if (params.fields) {
  21978. filterParameter = new FilterParameter();
  21979. filterParameter.name = params.datasetNames;
  21980. filterParameter.fields = params.fields;
  21981. paramsByBuffer.queryParameter = filterParameter;
  21982. }
  21983. if (params.attributeFilter) {
  21984. paramsByBuffer.attributeFilter = params.attributeFilter;
  21985. paramsByBuffer.getFeatureMode = 'BUFFER_ATTRIBUTEFILTER';
  21986. }
  21987. if (params.maxFeatures && !isNaN(params.maxFeatures)) {
  21988. paramsByBuffer.maxFeatures = params.maxFeatures;
  21989. }
  21990. if (typeof params.hasGeometry === 'boolean') {
  21991. paramsByBuffer.hasGeometry = params.hasGeometry;
  21992. }
  21993. if (params.targetEpsgCode) {
  21994. paramsByBuffer.targetEpsgCode = params.targetEpsgCode;
  21995. }
  21996. if (!params.targetEpsgCode && params.targetPrj) {
  21997. paramsByBuffer.targetPrj = params.targetPrj;
  21998. }
  21999. return Util_Util.toJSON(paramsByBuffer);
  22000. }
  22001. }
  22002. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBufferService.js
  22003. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22004. * This program are made available under the terms of the Apache License, Version 2.0
  22005. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22006. /**
  22007. * @class GetFeaturesByBufferService
  22008. * @deprecatedclass SuperMap.GetFeaturesByBufferService
  22009. * @category iServer Data FeatureResults
  22010. * @classdesc 数据服务中数据集缓冲区查询服务类。
  22011. * @param {string} url - 服务地址。请求数据服务中数据集查询服务,
  22012. * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;
  22013. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  22014. * @param {Object} options - 参数。
  22015. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  22016. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  22017. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  22018. * @param {Object} [options.headers] - 请求头。
  22019. * @extends {GetFeaturesServiceBase}
  22020. * @example
  22021. * var myGetFeaturesByBufferService = new GetFeaturesByBufferService(url, {
  22022. * eventListeners: {
  22023. * "processCompleted": GetFeaturesCompleted,
  22024. * "processFailed": GetFeaturesError
  22025. * }
  22026. * });
  22027. * function GetFeaturesCompleted(object){//todo};
  22028. * function GetFeaturesError(object){//todo};
  22029. * @usage
  22030. */
  22031. class GetFeaturesByBufferService extends GetFeaturesServiceBase {
  22032. constructor(url, options) {
  22033. super(url, options);
  22034. this.CLASS_NAME = "SuperMap.GetFeaturesByBufferService";
  22035. }
  22036. /**
  22037. * @function GetFeaturesByBufferService.prototype.destroy
  22038. * @override
  22039. */
  22040. destroy() {
  22041. super.destroy();
  22042. }
  22043. /**
  22044. * @function GetFeaturesByBufferService.prototype.getJsonParameters
  22045. * @description 将查询参数转化为 JSON 字符串。在本类中重写此方法,可以实现不同种类的查询(IDs, SQL, Buffer, Geometry等)。
  22046. * @param {GetFeaturesByBufferParameters} params - 数据集缓冲区查询参数类。
  22047. * @returns {Object} 转化后的 JSON 字符串。
  22048. */
  22049. getJsonParameters(params) {
  22050. if (!(params instanceof GetFeaturesByBufferParameters)) {
  22051. return;
  22052. }
  22053. return GetFeaturesByBufferParameters.toJsonParameters(params);
  22054. }
  22055. }
  22056. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByGeometryParameters.js
  22057. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22058. * This program are made available under the terms of the Apache License, Version 2.0
  22059. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22060. /**
  22061. * @class GetFeaturesByGeometryParameters
  22062. * @deprecatedclass SuperMap.GetFeaturesByGeometryParameters
  22063. * @category iServer Data FeatureResults
  22064. * @classdesc 数据集几何查询参数类。该类用于设置数据集几何查询的相关参数。
  22065. * @param {Object} options - 参数。
  22066. * @param {GeoJSONObject} options.geometry - 查询的几何对象。
  22067. * @param {Array.<string>} options.datasetNames - 数据集集合中的数据集名称列表。
  22068. * @param {string} [options.attributeFilter] - 几何查询属性过滤条件。
  22069. * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
  22070. * @param {SpatialQueryMode} [options.spatialQueryMode=SpatialQueryMode.CONTAIN] - 空间查询模式常量。
  22071. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  22072. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  22073. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  22074. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  22075. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  22076. * @param {MetricsAggParameter|GeoHashGridAggParameter} [options.aggregations] - 聚合查询参数。该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  22077. * @extends {GetFeaturesParametersBase}
  22078. * @usage
  22079. */
  22080. class GetFeaturesByGeometryParameters extends GetFeaturesParametersBase {
  22081. constructor(options) {
  22082. super(options);
  22083. /**
  22084. * @member {string} GetFeaturesByGeometryParameters.prototype.getFeatureMode
  22085. * @description 数据集查询模式。几何查询有 "SPATIAL","SPATIAL_ATTRIBUTEFILTER" 两种,当用户设置 attributeFilter 时会自动切换到 SPATIAL_ATTRIBUTEFILTER 访问服务。
  22086. */
  22087. this.getFeatureMode = 'SPATIAL';
  22088. /**
  22089. * @member {GeoJSONObject} GetFeaturesByGeometryParameters.prototype.geometry
  22090. * @description 用于查询的几何对象。 </br>
  22091. * 点类型可以是:{@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>
  22092. * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。</br>
  22093. * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}|{@link mapboxgl.LngLatBounds}|{@link GeoJSONObject}。
  22094. */
  22095. this.geometry = null;
  22096. /**
  22097. * @member {Array.<string>} GetFeaturesByGeometryParameters.prototype.fields
  22098. * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
  22099. */
  22100. this.fields = null;
  22101. /**
  22102. * @member {string} GetFeaturesByGeometryParameters.prototype.attributeFilter
  22103. * @description 几何查询属性过滤条件。
  22104. */
  22105. this.attributeFilter = null;
  22106. /**
  22107. * @member {SpatialQueryMode} [GetFeaturesByGeometryParameters.prototype.spatialQueryMode=SpatialQueryMode.CONTAIN]
  22108. * @description 空间查询模式常量。
  22109. */
  22110. this.spatialQueryMode = SpatialQueryMode.CONTAIN;
  22111. Util_Util.extend(this, options);
  22112. this.CLASS_NAME = 'SuperMap.GetFeaturesByGeometryParameters';
  22113. }
  22114. /**
  22115. * @function GetFeaturesByGeometryParameters.prototype.destroy
  22116. * @description 释放资源,将引用资源的属性置空。
  22117. */
  22118. destroy() {
  22119. super.destroy();
  22120. var me = this;
  22121. if (me.geometry) {
  22122. me.geometry.destroy();
  22123. me.geometry = null;
  22124. }
  22125. if (me.fields) {
  22126. while (me.fields.length > 0) {
  22127. me.fields.pop();
  22128. }
  22129. me.fields = null;
  22130. }
  22131. me.attributeFilter = null;
  22132. me.spatialQueryMode = null;
  22133. me.getFeatureMode = null;
  22134. }
  22135. /**
  22136. * @function GetFeaturesByGeometryParameters.toJsonParameters
  22137. * @description 将 GetFeaturesByGeometryParameters 对象参数转换为 JSON 字符串。
  22138. * @param {GetFeaturesByGeometryParameters} params - 查询参数对象。
  22139. * @returns {string} 转化后的 JSON 字符串。
  22140. */
  22141. static toJsonParameters(params) {
  22142. var filterParameter, geometry, parasByGeometry;
  22143. geometry = ServerGeometry.fromGeometry(params.geometry);
  22144. parasByGeometry = {
  22145. datasetNames: params.datasetNames,
  22146. getFeatureMode: 'SPATIAL',
  22147. geometry: geometry,
  22148. spatialQueryMode: params.spatialQueryMode
  22149. };
  22150. if (params.fields) {
  22151. filterParameter = new FilterParameter();
  22152. filterParameter.name = params.datasetNames;
  22153. filterParameter.fields = params.fields;
  22154. parasByGeometry.queryParameter = filterParameter;
  22155. }
  22156. if (params.attributeFilter) {
  22157. parasByGeometry.attributeFilter = params.attributeFilter;
  22158. parasByGeometry.getFeatureMode = 'SPATIAL_ATTRIBUTEFILTER';
  22159. }
  22160. if (params.maxFeatures && !isNaN(params.maxFeatures)) {
  22161. parasByGeometry.maxFeatures = params.maxFeatures;
  22162. }
  22163. if (typeof params.hasGeometry === 'boolean') {
  22164. parasByGeometry.hasGeometry = params.hasGeometry;
  22165. }
  22166. if (params.targetEpsgCode) {
  22167. parasByGeometry.targetEpsgCode = params.targetEpsgCode;
  22168. }
  22169. if (!params.targetEpsgCode && params.targetPrj) {
  22170. parasByGeometry.targetPrj = params.targetPrj;
  22171. }
  22172. if (params.aggregations) {
  22173. parasByGeometry.aggregations = params.aggregations;
  22174. }
  22175. return Util_Util.toJSON(parasByGeometry);
  22176. }
  22177. }
  22178. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByGeometryService.js
  22179. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22180. * This program are made available under the terms of the Apache License, Version 2.0
  22181. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22182. /**
  22183. * @class GetFeaturesByGeometryService
  22184. * @deprecatedclass SuperMap.GetFeaturesByGeometryService
  22185. * @category iServer Data FeatureResults
  22186. * @classdesc 数据集几何查询服务类,查询与指定几何对象符合一定空间关系的矢量要素。
  22187. * @param {string} url - 服务地址。请求数据服务中数据集查询服务。
  22188. * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data;
  22189. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data"
  22190. * @param {Object} options - 参数。
  22191. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  22192. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  22193. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  22194. * @param {Object} [options.headers] - 请求头。
  22195. * @extends {GetFeaturesServiceBase}
  22196. * @example
  22197. * var myService = new GetFeaturesByGeometryService(url, {
  22198. * eventListeners: {
  22199. * "processCompleted": getFeatureCompleted,
  22200. * "processFailed": getFeatureError
  22201. * }
  22202. * });
  22203. * function getFeatureCompleted(object){//todo};
  22204. * function getFeatureError(object){//todo}
  22205. * @usage
  22206. */
  22207. class GetFeaturesByGeometryService extends GetFeaturesServiceBase {
  22208. constructor(url, options) {
  22209. super(url, options);
  22210. this.CLASS_NAME = "SuperMap.GetFeaturesByGeometryService";
  22211. }
  22212. /**
  22213. * @function GetFeaturesByGeometryService.prototype.destroy
  22214. * @override
  22215. */
  22216. destroy() {
  22217. super.destroy();
  22218. }
  22219. /**
  22220. * @function GetFeaturesByGeometryService.prototype.getJsonParameters
  22221. * @param {GetFeaturesByGeometryParameters} params - 数据集几何查询参数类。
  22222. * @description 将查询参数转化为 JSON 字符串。
  22223. * 在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry等)。
  22224. * @returns {Object} 转化后的 JSON 字符串。
  22225. */
  22226. getJsonParameters(params) {
  22227. return GetFeaturesByGeometryParameters.toJsonParameters(params);
  22228. }
  22229. }
  22230. ;// CONCATENATED MODULE: ./src/common/iServer/FeatureService.js
  22231. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22232. * This program are made available under the terms of the Apache License, Version 2.0
  22233. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22234. /**
  22235. * @class FeatureService
  22236. * @constructs FeatureService
  22237. * @category iServer Data Feature
  22238. * @classdesc 数据集类。提供:ID 查询,范围查询,SQL查询,几何查询,bounds 查询,缓冲区查询,地物编辑。
  22239. * @example
  22240. * new FeatureService(url).getFeaturesByIDs(param,function(result){
  22241. * //doSomething
  22242. * })
  22243. * @param {string} url - 服务地址。
  22244. * @param {Object} options - 参数。
  22245. * @param {string} [options.proxy] - 服务代理地址。
  22246. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  22247. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  22248. * @param {Object} [options.headers] - 请求头。
  22249. * @extends {ServiceBase}
  22250. * @usage
  22251. */
  22252. class FeatureService_FeatureService {
  22253. constructor(url, options) {
  22254. this.url = url;
  22255. this.options = options || {};
  22256. }
  22257. /**
  22258. * @function FeatureService.prototype.getFeaturesByIDs
  22259. * @description 数据集 ID 查询服务。
  22260. * @param {GetFeaturesByIDsParameters} params - ID查询参数类。
  22261. * @param {RequestCallback} callback - 回调函数。
  22262. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  22263. */
  22264. getFeaturesByIDs(params, callback, resultFormat) {
  22265. var me = this;
  22266. var getFeaturesByIDsService = new GetFeaturesByIDsService(me.url, {
  22267. proxy: me.options.proxy,
  22268. withCredentials: me.options.withCredentials,
  22269. crossOrigin: me.options.crossOrigin,
  22270. headers: me.options.headers,
  22271. eventListeners: {
  22272. processCompleted: callback,
  22273. processFailed: callback
  22274. },
  22275. format: resultFormat
  22276. });
  22277. getFeaturesByIDsService.processAsync(params);
  22278. }
  22279. /**
  22280. * @function FeatureService.prototype.getFeaturesByBounds
  22281. * @description 数据集 Bounds 查询服务。
  22282. * @param {GetFeaturesByBoundsParameters} params - 数据集范围查询参数类。
  22283. * @param {RequestCallback} callback - 回调函数。
  22284. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  22285. */
  22286. getFeaturesByBounds(params, callback, resultFormat) {
  22287. var me = this;
  22288. var getFeaturesByBoundsService = new GetFeaturesByBoundsService(me.url, {
  22289. proxy: me.options.proxy,
  22290. withCredentials: me.options.withCredentials,
  22291. crossOrigin: me.options.crossOrigin,
  22292. headers: me.options.headers,
  22293. eventListeners: {
  22294. processCompleted: callback,
  22295. processFailed: callback
  22296. },
  22297. format: me._processFormat(resultFormat)
  22298. });
  22299. getFeaturesByBoundsService.processAsync(params);
  22300. }
  22301. /**
  22302. * @function FeatureService.prototype.getFeaturesByBuffer
  22303. * @description 数据集 Buffer 查询服务。
  22304. * @param {GetFeaturesByBufferParameters} params - 数据集缓冲区查询参数类。
  22305. * @param {RequestCallback} callback - 回调函数。
  22306. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  22307. */
  22308. getFeaturesByBuffer(params, callback, resultFormat) {
  22309. var me = this;
  22310. var getFeatureService = new GetFeaturesByBufferService(me.url, {
  22311. proxy: me.options.proxy,
  22312. withCredentials: me.options.withCredentials,
  22313. crossOrigin: me.options.crossOrigin,
  22314. headers: me.options.headers,
  22315. eventListeners: {
  22316. processCompleted: callback,
  22317. processFailed: callback
  22318. },
  22319. format: me._processFormat(resultFormat)
  22320. });
  22321. getFeatureService.processAsync(params);
  22322. }
  22323. /**
  22324. * @function FeatureService.prototype.getFeaturesBySQL
  22325. * @description 数据集 SQL 查询服务。
  22326. * @param {GetFeaturesBySQLParameters} params - 数据集 SQL 查询参数类。
  22327. * @param {RequestCallback} callback - 回调函数。
  22328. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  22329. */
  22330. getFeaturesBySQL(params, callback, resultFormat) {
  22331. var me = this;
  22332. var getFeatureBySQLService = new GetFeaturesBySQLService(me.url, {
  22333. proxy: me.options.proxy,
  22334. withCredentials: me.options.withCredentials,
  22335. crossOrigin: me.options.crossOrigin,
  22336. headers: me.options.headers,
  22337. eventListeners: {
  22338. processCompleted: callback,
  22339. processFailed: callback
  22340. },
  22341. format: me._processFormat(resultFormat)
  22342. });
  22343. getFeatureBySQLService.processAsync(params);
  22344. }
  22345. /**
  22346. * @function FeatureService.prototype.getFeaturesByGeometry
  22347. * @description 数据集几何查询服务类。
  22348. * @param {GetFeaturesByGeometryParameters} params - 数据集几何查询参数类。
  22349. * @param {RequestCallback} callback - 回调函数。
  22350. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的数据格式。
  22351. */
  22352. getFeaturesByGeometry(params, callback, resultFormat) {
  22353. var me = this;
  22354. var getFeaturesByGeometryService = new GetFeaturesByGeometryService(me.url, {
  22355. proxy: me.options.proxy,
  22356. withCredentials: me.options.withCredentials,
  22357. crossOrigin: me.options.crossOrigin,
  22358. headers: me.options.headers,
  22359. eventListeners: {
  22360. processCompleted: callback,
  22361. processFailed: callback
  22362. },
  22363. format: me._processFormat(resultFormat)
  22364. });
  22365. getFeaturesByGeometryService.processAsync(params);
  22366. }
  22367. /**
  22368. * @function FeatureService.prototype.editFeatures
  22369. * @description 地物编辑服务。
  22370. * @param {EditFeaturesParameters} params - 数据服务中数据集添加、修改、删除参数类。
  22371. * @param {RequestCallback} callback - 回调函数。
  22372. */
  22373. editFeatures(params, callback) {
  22374. if (!params || !params.dataSourceName || !params.dataSetName) {
  22375. return;
  22376. }
  22377. var me = this,
  22378. url = me.url,
  22379. dataSourceName = params.dataSourceName,
  22380. dataSetName = params.dataSetName;
  22381. url = Util_Util.urlPathAppend(url, "datasources/" + dataSourceName + "/datasets/" + dataSetName);
  22382. var editFeatureService = new EditFeaturesService(url, {
  22383. proxy: me.options.proxy,
  22384. withCredentials: me.options.withCredentials,
  22385. crossOrigin: me.options.crossOrigin,
  22386. headers: me.options.headers,
  22387. eventListeners: {
  22388. processCompleted: callback,
  22389. processFailed: callback
  22390. }
  22391. });
  22392. editFeatureService.processAsync(params);
  22393. }
  22394. _processFormat(resultFormat) {
  22395. return resultFormat ? resultFormat : DataFormat.GEOJSON;
  22396. }
  22397. }
  22398. ;// CONCATENATED MODULE: ./src/maplibregl/services/FeatureService.js
  22399. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22400. * This program are made available under the terms of the Apache License, Version 2.0
  22401. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22402. /**
  22403. * @class FeatureService
  22404. * @category iServer Data Feature
  22405. * @classdesc 要素数据集类。提供:ID 查询、范围查询、SQL 查询、几何查询、bounds 查询、缓冲区查询、地物编辑。
  22406. * @version 11.1.0
  22407. * @modulecategory Services
  22408. * @example
  22409. * new FeatureService(url)
  22410. * .getFeaturesByIDs(param,function(result){
  22411. * //doSomething
  22412. * })
  22413. * @extends {ServiceBase}
  22414. * @param {string} url - 服务地址。
  22415. * @param {Object} options -参数。
  22416. * @param {string} [options.proxy] - 服务代理地址。
  22417. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  22418. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  22419. * @param {Object} [options.headers] - 请求头。
  22420. * @usage
  22421. */
  22422. class FeatureService extends ServiceBase {
  22423. constructor(url, options) {
  22424. super(url, options);
  22425. this._featureService = new FeatureService_FeatureService(url, options);
  22426. }
  22427. /**
  22428. * @function FeatureService.prototype.getFeaturesByIDs
  22429. * @description 数据集 ID 查询服务。
  22430. * @param {GetFeaturesByIDsParameters} params - ID查询参数类。
  22431. * @param {RequestCallback} callback - 回调函数。
  22432. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  22433. */
  22434. getFeaturesByIDs(params, callback, resultFormat) {
  22435. params = this._processParams(params);
  22436. this._featureService.getFeaturesByIDs(params, callback, resultFormat);
  22437. }
  22438. /**
  22439. * @function FeatureService.prototype.getFeaturesByBounds
  22440. * @description 数据集 Bounds 查询服务。
  22441. * @param {GetFeaturesByBoundsParameters} params - 数据集范围查询参数类。
  22442. * @param {RequestCallback} callback - 回调函数。
  22443. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  22444. */
  22445. getFeaturesByBounds(params, callback, resultFormat) {
  22446. params = this._processParams(params);
  22447. this._featureService.getFeaturesByBounds(params, callback, resultFormat);
  22448. }
  22449. /**
  22450. * @function FeatureService.prototype.getFeaturesByBuffer
  22451. * @description 数据集 Buffer 查询服务。
  22452. * @param {GetFeaturesByBufferParameters} params - 数据集缓冲区查询参数类。
  22453. * @param {RequestCallback} callback 回调函数。
  22454. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  22455. */
  22456. getFeaturesByBuffer(params, callback, resultFormat) {
  22457. params = this._processParams(params);
  22458. this._featureService.getFeaturesByBuffer(params, callback, resultFormat);
  22459. }
  22460. /**
  22461. * @function FeatureService.prototype.getFeaturesBySQL
  22462. * @description 数据集 SQL 查询服务。
  22463. * @param {GetFeaturesBySQLParameters} params - 数据集 SQL 查询参数类。
  22464. * @param {RequestCallback} callback 回调函数。
  22465. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  22466. */
  22467. getFeaturesBySQL(params, callback, resultFormat) {
  22468. params = this._processParams(params);
  22469. this._featureService.getFeaturesBySQL(params, callback, resultFormat);
  22470. }
  22471. /**
  22472. * @function FeatureService.prototype.getFeaturesByGeometry
  22473. * @description 数据集几何查询服务类。
  22474. * @param {GetFeaturesByGeometryParameters} params - 数据集几何查询参数类。
  22475. * @param {RequestCallback} callback - 回调函数。
  22476. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  22477. */
  22478. getFeaturesByGeometry(params, callback, resultFormat) {
  22479. params = this._processParams(params);
  22480. this._featureService.getFeaturesByGeometry(params, callback, resultFormat);
  22481. }
  22482. /**
  22483. * @function FeatureService.prototype.editFeatures
  22484. * @description 地物编辑服务。
  22485. * @param {EditFeaturesParameters} params - 数据集添加、修改、删除参数类。
  22486. * @param {RequestCallback} callback 回调函数。
  22487. */
  22488. editFeatures(params, callback) {
  22489. if (!params || !params.dataSourceName || !params.dataSetName) {
  22490. return;
  22491. }
  22492. let me = this,
  22493. url = me.url,
  22494. dataSourceName = params.dataSourceName,
  22495. dataSetName = params.dataSetName;
  22496. url = Util_Util.urlPathAppend(url, 'datasources/' + dataSourceName + '/datasets/' + dataSetName);
  22497. let editFeatureService = new EditFeaturesService(url, {
  22498. proxy: me.options.proxy,
  22499. withCredentials: me.options.withCredentials,
  22500. crossOrigin: me.options.crossOrigin,
  22501. headers: me.options.headers,
  22502. eventListeners: {
  22503. processCompleted: callback,
  22504. processFailed: callback
  22505. }
  22506. });
  22507. editFeatureService.processAsync(me._processParams(params));
  22508. }
  22509. /**
  22510. * @private
  22511. * @description 参数类型转换。
  22512. * @param {Object} params - 参数 。
  22513. * @returns {Object} params - 转换后的对接 SuperMap 服务的参数。
  22514. */
  22515. _processParams(params) {
  22516. if (!params) {
  22517. return {};
  22518. }
  22519. let me = this;
  22520. params.returnContent = params.returnContent == null ? true : params.returnContent;
  22521. params.fromIndex = params.fromIndex ? params.fromIndex : 0;
  22522. params.toIndex = params.toIndex === 0 ? 0 : params.toIndex ? params.toIndex : -1;
  22523. if (params.bounds) {
  22524. params.bounds = core_Util_Util.toSuperMapBounds(params.bounds);
  22525. }
  22526. if (params.editType) {
  22527. params.editType = params.editType.toLowerCase();
  22528. }
  22529. //maplibregl geojson要素对象转 SuperMap Geometry 对象
  22530. if (params.geometry) {
  22531. if (params.geometry instanceof (external_maplibregl_default()).LngLatBounds) {
  22532. params.geometry = core_Util_Util.toSuperMapPolygon(params.geometry);
  22533. params.geometry.SRID = 4326;
  22534. } else if (params.geometry instanceof (external_maplibregl_default()).Point) {
  22535. params.geometry = new Point(params.geometry.x, params.geometry.y);
  22536. } else if (params.geometry instanceof (external_maplibregl_default()).LngLat) {
  22537. params.geometry = new Point(params.geometry.lng, params.geometry.lat);
  22538. params.geometry.SRID = 4326;
  22539. } else if (!(params.geometry instanceof Geometry_Geometry)) {
  22540. params.geometry = core_Util_Util.toSuperMapGeometry(params.geometry);
  22541. }
  22542. }
  22543. //editFeature服务参数转换,传入单独得对象或对象数组
  22544. if (params.features) {
  22545. let features = [];
  22546. if (core_Util_Util.isArray(params.features)) {
  22547. params.features.map(function (feature) {
  22548. features.push(me._createServerFeature(feature));
  22549. return features;
  22550. });
  22551. } else {
  22552. features.push(me._createServerFeature(params.features));
  22553. }
  22554. params.features = features;
  22555. }
  22556. return params;
  22557. }
  22558. //geoFeature严格按照 MapLibreGL geojson的结构
  22559. _createServerFeature(geoFeature) {
  22560. let feature = {},
  22561. fieldNames = [],
  22562. fieldValues = [];
  22563. let properties = geoFeature.properties;
  22564. for (let key in properties) {
  22565. fieldNames.push(key);
  22566. fieldValues.push(properties[key]);
  22567. }
  22568. feature.fieldNames = fieldNames;
  22569. feature.fieldValues = fieldValues;
  22570. if (geoFeature.id) {
  22571. feature.id = geoFeature.id;
  22572. }
  22573. feature.geometry = core_Util_Util.toSuperMapGeometry(geoFeature);
  22574. return feature;
  22575. }
  22576. }
  22577. ;// CONCATENATED MODULE: ./src/common/iServer/GetFieldsService.js
  22578. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22579. * This program are made available under the terms of the Apache License, Version 2.0
  22580. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22581. /**
  22582. * @class GetFieldsService
  22583. * @deprecatedclass SuperMap.GetFieldsService
  22584. * @category iServer Data Field
  22585. * @classdesc 字段查询服务,支持查询指定数据集的中所有属性字段(field)的集合。
  22586. * @param {string} url - 服务地址。如访问World Map服务,只需将url设为:http://localhost:8090/iserver/services/data-world/rest/data 即可。
  22587. * @param {Object} options - 参数。
  22588. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  22589. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  22590. * @param {string}options.datasource - 数据源名称。
  22591. * @param {string}options.dataset - 数据集名称。
  22592. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  22593. * @param {Object} [options.headers] - 请求头。
  22594. * @extends {CommonServiceBase}
  22595. * @example
  22596. * var myService = new GetFieldsService(url, {eventListeners: {
  22597. * "processCompleted": getFieldsCompleted,
  22598. * "processFailed": getFieldsError
  22599. * },
  22600. * datasource: "World",
  22601. * dataset: "Countries"
  22602. * };
  22603. * @usage
  22604. */
  22605. class GetFieldsService extends CommonServiceBase {
  22606. constructor(url, options) {
  22607. super(url, options);
  22608. /**
  22609. * @member {string} GetFieldsService.prototype.datasource
  22610. * @description 要查询的数据集所在的数据源名称。
  22611. */
  22612. this.datasource = null;
  22613. /**
  22614. * @member {string} GetFieldsService.prototype.dataset
  22615. * @description 要查询的数据集名称。
  22616. */
  22617. this.dataset = null;
  22618. if (options) {
  22619. Util_Util.extend(this, options);
  22620. }
  22621. this.CLASS_NAME = "SuperMap.GetFieldsService";
  22622. }
  22623. /**
  22624. * @function GetFieldsService.prototype.destroy
  22625. * @override
  22626. */
  22627. destroy() {
  22628. super.destroy();
  22629. var me = this;
  22630. me.datasource = null;
  22631. me.dataset = null;
  22632. }
  22633. /**
  22634. * @function GetFieldsService.prototype.processAsync
  22635. * @description 执行服务,查询指定数据集的字段信息。
  22636. */
  22637. processAsync() {
  22638. var me = this;
  22639. me.url = Util_Util.urlPathAppend(me.url,`datasources/${me.datasource}/datasets/${me.dataset}/fields`);
  22640. me.request({
  22641. method: "GET",
  22642. data: null,
  22643. scope: me,
  22644. success: me.serviceProcessCompleted,
  22645. failure: me.serviceProcessFailed
  22646. });
  22647. }
  22648. }
  22649. ;// CONCATENATED MODULE: ./src/common/iServer/FieldParameters.js
  22650. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22651. * This program are made available under the terms of the Apache License, Version 2.0
  22652. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22653. /**
  22654. * @class FieldParameters
  22655. * @deprecatedclass SuperMap.FieldParameters
  22656. * @category iServer Data Field
  22657. * @classdesc 字段信息查询参数类。
  22658. * @param {Object} options - 参数。
  22659. * @param {string} options.datasource - 数据源名称。
  22660. * @param {string} options.dataset - 数据集名称。
  22661. * @usage
  22662. */
  22663. class FieldParameters {
  22664. constructor(options) {
  22665. /**
  22666. * @member {string} FieldParameters.prototype.datasource
  22667. * @description 要查询的数据集所在的数据源名称。
  22668. */
  22669. this.datasource = null;
  22670. /**
  22671. * @member {string} FieldParameters.prototype.dataset
  22672. * @description 要查询的数据集名称。
  22673. */
  22674. this.dataset = null;
  22675. if (options) {
  22676. Util_Util.extend(this, options);
  22677. }
  22678. this.CLASS_NAME = "SuperMap.FieldParameters";
  22679. }
  22680. /**
  22681. * @function FieldParameters.prototype.destroy
  22682. * @description 释放资源,将引用资源的属性置空。
  22683. */
  22684. destroy() {
  22685. var me = this;
  22686. me.datasource = null;
  22687. me.dataset = null;
  22688. }
  22689. }
  22690. ;// CONCATENATED MODULE: ./src/common/iServer/FieldStatisticsParameters.js
  22691. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22692. * This program are made available under the terms of the Apache License, Version 2.0
  22693. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22694. /**
  22695. * @class FieldStatisticsParameters
  22696. * @deprecatedclass SuperMap.FieldStatisticsParameters
  22697. * @category iServer Data Field
  22698. * @classdesc 字段统计信息查询参数类。
  22699. * @param {Object} options - 参数。
  22700. * @param {string} options.datasource - 数据源名称。
  22701. * @param {string} options.dataset - 数据集名称。
  22702. * @param {string} options.fieldName - 字段名。
  22703. * @param {(string.<StatisticMode>|Array.<string.<StatisticMode>>)} statisticMode - 字段统计方法类型。
  22704. * @extends {FieldParameters}
  22705. * @usage
  22706. */
  22707. class FieldStatisticsParameters extends FieldParameters {
  22708. constructor(options) {
  22709. super(options);
  22710. /**
  22711. * @member {string} FieldStatisticsParameters.prototype.fieldName
  22712. * @description 字段名。
  22713. */
  22714. this.fieldName = null;
  22715. /**
  22716. * @member {(string.<StatisticMode>|Array.<string.<StatisticMode>>)} FieldStatisticsParameters.prototype.statisticMode
  22717. * @description 字段统计方法类型。
  22718. */
  22719. this.statisticMode = null;
  22720. if (options) {
  22721. Util_Util.extend(this, options);
  22722. }
  22723. this.CLASS_NAME = "SuperMap.FieldStatisticsParameters";
  22724. }
  22725. /**
  22726. * @function FieldStatisticsParameters.prototype.destroy
  22727. * @description 释放资源,将引用资源的属性置空。
  22728. */
  22729. destroy() {
  22730. var me = this;
  22731. me.fieldName = null;
  22732. me.statisticMode = null;
  22733. }
  22734. }
  22735. ;// CONCATENATED MODULE: ./src/common/iServer/FieldStatisticService.js
  22736. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22737. * This program are made available under the terms of the Apache License, Version 2.0
  22738. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22739. /**
  22740. * @class FieldStatisticService
  22741. * @deprecatedclass SuperMap.FieldStatisticService
  22742. * @category iServer Data Field
  22743. * @classdesc 字段查询统计服务类。用来完成对指定数据集指定字段的查询统计分析,即求平均值,最大值等。
  22744. * @extends {CommonServiceBase}
  22745. * @param {string} url - 服务地址。如访问 World Map 服务,只需将 url 设为:http://localhost:8090/iserver/services/data-world/rest/data 即可。
  22746. * @param {Object} options - 参数。
  22747. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  22748. * @param {DataFormat} [options.format] - 查询结果返回格式,目前支持 iServerJSON 和GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  22749. * @param {string} options.datasource - 数据集所在的数据源名称。
  22750. * @param {string} options.dataset - 数据集名称。
  22751. * @param {string} options.field - 查询统计的目标字段名称。
  22752. * @param {StatisticMode} options.statisticMode - 字段查询统计的方法类型。
  22753. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  22754. * @param {Object} [options.headers] - 请求头。
  22755. * @example
  22756. * var myService = new FieldStatisticService(url, {eventListeners: {
  22757. * "processCompleted": fieldStatisticCompleted,
  22758. * "processFailed": fieldStatisticError
  22759. * },
  22760. * datasource: "World",
  22761. * dataset: "Countries",
  22762. * field: "SmID",
  22763. * statisticMode: StatisticMode.AVERAGE
  22764. * };
  22765. * @usage
  22766. */
  22767. class FieldStatisticService extends CommonServiceBase {
  22768. constructor(url, options) {
  22769. super(url, options);
  22770. /**
  22771. * @member {string} FieldStatisticService.prototype.datasource
  22772. * @description 数据集所在的数据源名称。
  22773. */
  22774. this.datasource = null;
  22775. /**
  22776. * @member {string} FieldStatisticService.prototype.dataset
  22777. * @description 数据集名称。
  22778. */
  22779. this.dataset = null;
  22780. /**
  22781. * @member {string} FieldStatisticService.prototype.field
  22782. * @description 查询统计的目标字段名称。
  22783. */
  22784. this.field = null;
  22785. /**
  22786. * @member {StatisticMode} FieldStatisticService.prototype.statisticMode
  22787. * @description 字段查询统计的方法类型。
  22788. */
  22789. this.statisticMode = null;
  22790. if (options) {
  22791. Util_Util.extend(this, options);
  22792. }
  22793. this.CLASS_NAME = "SuperMap.FieldStatisticService";
  22794. }
  22795. /**
  22796. * @function FieldStatisticService.prototype.destroy
  22797. * @override
  22798. */
  22799. destroy() {
  22800. super.destroy();
  22801. var me = this;
  22802. me.datasource = null;
  22803. me.dataset = null;
  22804. me.field = null;
  22805. me.statisticMode = null;
  22806. }
  22807. /**
  22808. * @function FieldStatisticService.prototype.processAsync
  22809. * @description 执行服务,进行指定字段的查询统计。
  22810. */
  22811. processAsync() {
  22812. var me = this,
  22813. fieldStatisticURL = "datasources/" + me.datasource + "/datasets/" + me.dataset + "/fields/" + me.field + "/" + me.statisticMode;
  22814. me.url = Util_Util.urlPathAppend(me.url, fieldStatisticURL);
  22815. me.request({
  22816. method: "GET",
  22817. data: null,
  22818. scope: me,
  22819. success: me.serviceProcessCompleted,
  22820. failure: me.serviceProcessFailed
  22821. });
  22822. }
  22823. }
  22824. ;// CONCATENATED MODULE: ./src/common/iServer/FieldService.js
  22825. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22826. * This program are made available under the terms of the Apache License, Version 2.0
  22827. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22828. /**
  22829. * @class FieldService
  22830. * @category iServer Data Field
  22831. * @classdesc 字段服务类。
  22832. * @example
  22833. * new FieldService(url).getFields(function(result){
  22834. * //doSomething
  22835. * });
  22836. * @param {string} url - 服务地址。
  22837. * @param {Object} options - 参数。
  22838. * @param {string} [options.proxy] - 服务代理地址。
  22839. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  22840. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  22841. * @param {Object} [options.headers] - 请求头。
  22842. * @extends {ServiceBase}
  22843. * @usage
  22844. */
  22845. class FieldService_FieldService {
  22846. constructor(url, options) {
  22847. this.url = url;
  22848. this.options = options || {};
  22849. }
  22850. /**
  22851. * @function FieldService.prototype.getFields
  22852. * @description 字段查询服务。
  22853. * @param {FieldParameters} params - 字段信息查询参数类。
  22854. * @param {RequestCallback} callback 回调函数。
  22855. */
  22856. getFields(params, callback) {
  22857. var me = this;
  22858. var getFieldsService = new GetFieldsService(me.url, {
  22859. proxy: me.options.proxy,
  22860. withCredentials: me.options.withCredentials,
  22861. crossOrigin: me.options.crossOrigin,
  22862. headers: me.options.headers,
  22863. eventListeners: {
  22864. scope: me,
  22865. processCompleted: callback,
  22866. processFailed: callback
  22867. },
  22868. datasource: params.datasource,
  22869. dataset: params.dataset
  22870. });
  22871. getFieldsService.processAsync();
  22872. }
  22873. /**
  22874. * @function FieldService.prototype.getFieldStatisticsInfo
  22875. * @description 字段统计服务。
  22876. * @param {FieldStatisticsParameters} params - 字段统计信息查询参数类。
  22877. * @param {RequestCallback} callback 回调函数。
  22878. */
  22879. getFieldStatisticsInfo(params, callback) {
  22880. if (!(params instanceof FieldStatisticsParameters)) {
  22881. return;
  22882. }
  22883. var me = this,
  22884. fieldName = params.fieldName,
  22885. modes = params.statisticMode;
  22886. if (modes && !Array.isArray(modes)) {
  22887. modes = [modes];
  22888. }
  22889. me.currentStatisticResult = {fieldName: fieldName};
  22890. me._statisticsCallback = callback;
  22891. //针对每种统计方式分别进行请求
  22892. modes.forEach(mode => {
  22893. me.currentStatisticResult[mode] = null;
  22894. me._fieldStatisticRequest(params.datasource, params.dataset, fieldName, mode);
  22895. })
  22896. }
  22897. _fieldStatisticRequest(datasource, dataset, fieldName, statisticMode) {
  22898. var me = this;
  22899. var statisticService = new FieldStatisticService(me.url, {
  22900. eventListeners: {
  22901. scope: me,
  22902. processCompleted: me._processCompleted.bind(me),
  22903. processFailed: me._statisticsCallback
  22904. },
  22905. datasource: datasource,
  22906. dataset: dataset,
  22907. field: fieldName,
  22908. statisticMode: statisticMode,
  22909. crossOrigin: me.options.crossOrigin,
  22910. headers: me.options.headers
  22911. });
  22912. statisticService.processAsync();
  22913. }
  22914. _processCompleted(fieldStatisticResult, options) {
  22915. var me = this;
  22916. var getAll = true,
  22917. result = fieldStatisticResult.result;
  22918. if (this.currentStatisticResult) {
  22919. if (null == me.currentStatisticResult[result.mode]) {
  22920. this.currentStatisticResult[result.mode] = result.result;
  22921. }
  22922. }
  22923. for (var mode in me.currentStatisticResult) {
  22924. if (null == me.currentStatisticResult[mode]) {
  22925. getAll = false;
  22926. break;
  22927. }
  22928. }
  22929. if (getAll) {
  22930. me._statisticsCallback({result: me.currentStatisticResult, options});
  22931. }
  22932. }
  22933. }
  22934. ;// CONCATENATED MODULE: ./src/maplibregl/services/FieldService.js
  22935. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22936. * This program are made available under the terms of the Apache License, Version 2.0
  22937. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22938. /**
  22939. * @class FieldService
  22940. * @category iServer Data Field
  22941. * @classdesc 字段服务类。
  22942. * @version 11.1.0
  22943. * @modulecategory Services
  22944. * @example
  22945. * new FieldService(url).getFields(function(result){
  22946. * //doSomething
  22947. * });
  22948. * @param {string} url - 服务地址。
  22949. * @param {Object} options - 参数。
  22950. * @param {string} [options.proxy] - 服务代理地址。
  22951. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  22952. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  22953. * @param {Object} [options.headers] - 请求头。
  22954. * @extends {ServiceBase}
  22955. * @usage
  22956. */
  22957. class FieldService extends ServiceBase {
  22958. constructor(url, options) {
  22959. super(url, options);
  22960. this._fieldService = new FieldService_FieldService(url, options);
  22961. }
  22962. /**
  22963. * @function FieldService.prototype.getFields
  22964. * @description 字段查询服务。
  22965. * @param {FieldParameters} params - 字段信息查询参数类。
  22966. * @param {RequestCallback} callback 回调函数。
  22967. */
  22968. getFields(params, callback) {
  22969. this._fieldService.getFields(params, callback);
  22970. }
  22971. /**
  22972. * @function FieldService.prototype.getFieldStatisticsInfo
  22973. * @description 字段统计服务。
  22974. * @param {FieldStatisticsParameters} params - 字段统计信息查询参数类。
  22975. * @param {RequestCallback} callback 回调函数。
  22976. */
  22977. getFieldStatisticsInfo(params, callback) {
  22978. this._fieldService.getFieldStatisticsInfo(params, callback);
  22979. }
  22980. }
  22981. ;// CONCATENATED MODULE: ./src/common/iServer/GetGridCellInfosParameters.js
  22982. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  22983. * This program are made available under the terms of the Apache License, Version 2.0
  22984. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22985. /**
  22986. * @class GetGridCellInfosParameters
  22987. * @deprecatedclass SuperMap.GetGridCellInfosParameters
  22988. * @category iServer Data Grid
  22989. * @classdesc 数据服务栅格查询参数类。
  22990. * @param {Object} options - 参数。
  22991. * @param {string} options.datasetName - 数据集名称。
  22992. * @param {string} options.dataSourceName - 数据源名称。
  22993. * @param {number} options.X - 地理位置 X 轴。
  22994. * @param {number} options.Y - 地理位置 Y 轴。
  22995. * @usage
  22996. */
  22997. class GetGridCellInfosParameters {
  22998. constructor(options) {
  22999. /**
  23000. * @member {string} GetGridCellInfosParameters.prototype.datasetName
  23001. * @description 数据集名称。
  23002. */
  23003. this.datasetName = null;
  23004. /**
  23005. * @member {string} GetGridCellInfosParameters.prototype.dataSourceName
  23006. * @description 数据源名称。
  23007. */
  23008. this.dataSourceName = null;
  23009. /**
  23010. * @member {number} GetGridCellInfosParameters.prototype.X
  23011. * @description 要查询的地理位置 X 轴。
  23012. */
  23013. this.X = null;
  23014. /**
  23015. * @member {number} GetGridCellInfosParameters.prototype.Y
  23016. * @description 要查询的地理位置 Y 轴。
  23017. */
  23018. this.Y = null;
  23019. Util_Util.extend(this, options);
  23020. this.CLASS_NAME = "SuperMap.GetGridCellInfosParameters";
  23021. }
  23022. /**
  23023. * @function GetGridCellInfosParameters.prototype.destroy
  23024. * @description 释放资源,将引用的资源属性置空。
  23025. */
  23026. destroy() {
  23027. var me = this;
  23028. me.datasetName = null;
  23029. me.dataSourceName = null;
  23030. me.X = null;
  23031. me.Y = null;
  23032. }
  23033. }
  23034. ;// CONCATENATED MODULE: ./src/common/iServer/GetGridCellInfosService.js
  23035. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  23036. * This program are made available under the terms of the Apache License, Version 2.0
  23037. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23038. /**
  23039. * @class GetGridCellInfosService
  23040. * @deprecatedclass SuperMap.GetGridCellInfosService
  23041. * @category iServer Data Grid
  23042. * @classdesc 数据栅格查询服务,支持查询指定地理位置的栅格信息。
  23043. * @param {string} url - 服务地址。例如: http://localhost:8090/iserver/services/data-jingjin/rest/data
  23044. * @param {Object} options - 参数。
  23045. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。<br>
  23046. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  23047. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  23048. * @param {Object} [options.headers] - 请求头。
  23049. * @extends {CommonServiceBase}
  23050. * @example
  23051. * var myService = new GetGridCellInfosService(url, {eventListeners: {
  23052. * "processCompleted": queryCompleted,
  23053. * "processFailed": queryError
  23054. * }
  23055. * });
  23056. * @usage
  23057. */
  23058. class GetGridCellInfosService extends CommonServiceBase {
  23059. constructor(url, options) {
  23060. super(url, options);
  23061. /**
  23062. * @member {string} GetGridCellInfosService.prototype.datasetName
  23063. * @description 数据集名称。
  23064. */
  23065. this.datasetName = null;
  23066. /**
  23067. * @member {string} GetGridCellInfosService.prototype.dataSourceName
  23068. * @description 数据源名称。
  23069. */
  23070. this.dataSourceName = null;
  23071. /**
  23072. * @member {string} GetGridCellInfosService.prototype.datasetType
  23073. * @description 数据集类型。
  23074. */
  23075. this.datasetType = null;
  23076. /**
  23077. * @member {number} GetGridCellInfosService.prototype.X
  23078. * @description 要查询的地理位置X轴
  23079. */
  23080. this.X = null;
  23081. /**
  23082. * @member {number} GetGridCellInfosService.prototype.Y
  23083. * @description 要查询的地理位置Y轴
  23084. */
  23085. this.Y = null;
  23086. if (options) {
  23087. Util_Util.extend(this, options);
  23088. }
  23089. this.eventCount = 0;
  23090. this.CLASS_NAME = "SuperMap.GetGridCellInfosService";
  23091. }
  23092. /**
  23093. * @function GetGridCellInfosService.prototype.destroy
  23094. * @override
  23095. */
  23096. destroy() {
  23097. super.destroy();
  23098. var me = this;
  23099. me.X = null;
  23100. me.Y = null;
  23101. me.datasetName = null;
  23102. me.dataSourceName = null;
  23103. me.datasetType = null;
  23104. }
  23105. /**
  23106. * @function GetGridCellInfosService.prototype.processAsync
  23107. * @description 执行服务,查询数据集信息。
  23108. * @param {GetGridCellInfosParameters} params - 查询参数。
  23109. */
  23110. processAsync(params, callback) {
  23111. if (!(params instanceof GetGridCellInfosParameters)) {
  23112. return;
  23113. }
  23114. Util_Util.extend(this, params);
  23115. var me = this;
  23116. me.url = Util_Util.urlPathAppend(me.url,`datasources/${me.dataSourceName}/datasets/${me.datasetName}`);
  23117. me.queryRequest(me.getDatasetInfoCompleted.bind(me), me.getDatasetInfoFailed.bind(me), callback);
  23118. }
  23119. /**
  23120. * @function GetGridCellInfosService.prototype.queryRequest
  23121. * @description 执行服务,查询。
  23122. * @callback {function} successFun - 成功后执行的函数。
  23123. * @callback {function} failedFunc - 失败后执行的函数。
  23124. */
  23125. queryRequest(successFun, failedFunc, callback) {
  23126. let eventId = ++this.eventCount;
  23127. let eventListeners = {
  23128. scope: this,
  23129. processCompleted: function(result) {
  23130. if (eventId === result.result.eventId && callback) {
  23131. delete result.result.eventId;
  23132. callback(result);
  23133. this.events && this.events.un(eventListeners);
  23134. return false;
  23135. }
  23136. },
  23137. processFailed: function(result) {
  23138. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  23139. callback(result);
  23140. this.events && this.events.un(eventListeners);
  23141. return false;
  23142. }
  23143. }
  23144. }
  23145. this.events.on(eventListeners);
  23146. var me = this;
  23147. me.request({
  23148. method: "GET",
  23149. data: null,
  23150. scope: me,
  23151. success(result, options) {
  23152. result.eventId = eventId;
  23153. successFun(result, options, callback);
  23154. },
  23155. failure(result, options) {
  23156. if (result.error) {
  23157. result.error.eventId = eventId;
  23158. }
  23159. result.eventId = eventId;
  23160. failedFunc(result, options);
  23161. }
  23162. });
  23163. }
  23164. /**
  23165. * @function GetGridCellInfosService.prototype.getDatasetInfoCompleted
  23166. * @description 数据集查询完成,执行此方法。
  23167. * @param {Object} result - 服务器返回的结果对象。
  23168. */
  23169. getDatasetInfoCompleted(result, options, callback) {
  23170. var me = this;
  23171. result = Util_Util.transformResult(result);
  23172. me.datasetType = result.datasetInfo.type;
  23173. me.queryGridInfos(callback);
  23174. }
  23175. /**
  23176. * @function GetGridCellInfosService.prototype.queryGridInfos
  23177. * @description 执行服务,查询数据集栅格信息。
  23178. */
  23179. queryGridInfos(callback) {
  23180. var me = this;
  23181. me.url = Util_Util.urlPathAppend(me.url, me.datasetType == 'GRID' ? 'gridValue' : 'imageValue');
  23182. if (me.X != null && me.Y != null) {
  23183. me.url = Util_Util.urlAppend(me.url, `x=${me.X}&y=${me.Y}`);
  23184. }
  23185. me.queryRequest(me.serviceProcessCompleted.bind(me), me.serviceProcessFailed.bind(me), callback);
  23186. }
  23187. /**
  23188. * @function GetGridCellInfosService.prototype.getDatasetInfoFailed
  23189. * @description 数据集查询失败,执行此方法。
  23190. * @param {Object} result - 服务器返回的结果对象。
  23191. */
  23192. getDatasetInfoFailed(result, options) {
  23193. var me = this;
  23194. me.serviceProcessFailed(result, options);
  23195. }
  23196. }
  23197. ;// CONCATENATED MODULE: ./src/maplibregl/services/GridCellInfosService.js
  23198. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  23199. * This program are made available under the terms of the Apache License, Version 2.0
  23200. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23201. /**
  23202. * @class GridCellInfosService
  23203. * @category iServer Data Grid
  23204. * @classdesc 数据栅格查询服务类。
  23205. * @version 11.1.0
  23206. * @modulecategory Services
  23207. * @extends {ServiceBase}
  23208. * @example
  23209. * new GridCellInfosService(url)
  23210. * .getGridCellInfos(param,function(result){
  23211. * //doSomething
  23212. * })
  23213. * @param {string} url - 服务地址。请求地图服务,URL 应为:</br>
  23214. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名}/tempLayersSet/{tempLayerID}/Rivers@World@@World。
  23215. * @param {Object} options - 参数。
  23216. * @param {string} [options.proxy] - 服务代理地址。
  23217. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  23218. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  23219. * @param {Object} [options.headers] - 请求头。
  23220. * @usage
  23221. */
  23222. class GridCellInfosService extends ServiceBase {
  23223. constructor(url, options) {
  23224. super(url, options);
  23225. this._gridCellQueryService = new GetGridCellInfosService(this.url, {
  23226. proxy: this.options.proxy,
  23227. withCredentials: this.options.withCredentials,
  23228. crossOrigin: this.options.crossOrigin,
  23229. headers: this.options.headers
  23230. });
  23231. }
  23232. /**
  23233. * @function GridCellInfosService.prototype.getGridCellInfos
  23234. * @param {GetGridCellInfosParameters} params - 数据服务栅格查询参数类。
  23235. * @param {RequestCallback} callback 回调函数。
  23236. */
  23237. getGridCellInfos(params, callback) {
  23238. if (!params) {
  23239. return null;
  23240. }
  23241. this._gridCellQueryService.processAsync(params, callback);
  23242. }
  23243. }
  23244. ;// CONCATENATED MODULE: ./src/common/iServer/GeoprocessingService.js
  23245. /**
  23246. * @class GeoprocessingService
  23247. * @deprecatedclass SuperMap.GeoprocessingService
  23248. * @category iServer ProcessingAutomationService
  23249. * @classdesc 处理自动化服务接口的基类。
  23250. * @version 10.1.0
  23251. * @extends {CommonServiceBase}
  23252. * @param {string} url - 服务地址。
  23253. * @param {Object} options - 参数。
  23254. * @param {Events} options.events - 处理所有事件的对象。
  23255. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  23256. * @usage
  23257. */
  23258. class GeoprocessingService_GeoprocessingService extends CommonServiceBase {
  23259. constructor(url, options) {
  23260. options = options || {};
  23261. options.EVENT_TYPES = ['processCompleted', 'processFailed', 'processRunning'];
  23262. super(url, options);
  23263. this.CLASS_NAME = 'SuperMap.GeoprocessingService';
  23264. this.headers = {};
  23265. this.crossOrigin = true;
  23266. this.eventCount = 0;
  23267. }
  23268. /**
  23269. * @function GeoprocessingService.prototype.getTools
  23270. * @description 获取处理自动化工具列表。
  23271. * @param {string} identifier - 处理自动化工具ID。
  23272. */
  23273. getTools(callback) {
  23274. this._processAsync({ url: `${this.url}/list`, callback });
  23275. }
  23276. /**
  23277. * @function GeoprocessingService.prototype.getTool
  23278. * @description 获取处理自动化工具的ID、名称、描述、输入参数、环境参数和输出结果等相关参数。
  23279. * @param {string} identifier - 处理自动化工具ID。
  23280. */
  23281. getTool(identifier, callback) {
  23282. this._processAsync({ url: `${this.url}/${identifier}`, callback });
  23283. }
  23284. /**
  23285. * @function GeoprocessingService.prototype.execute
  23286. * @description 同步执行处理自动化工具。
  23287. * @param {string} identifier - 处理自动化工具ID。
  23288. * @param {Object} parameter - 处理自动化工具的输入参数。
  23289. * @param {Object} environment - 处理自动化工具的环境参数。
  23290. */
  23291. execute(identifier, parameter, environment, callback) {
  23292. parameter = parameter ? parameter : null;
  23293. environment = environment ? environment : null;
  23294. const executeParamter = { parameter, environment };
  23295. this._processAsync({ url: `${this.url}/${identifier}/execute`, executeParamter, callback });
  23296. }
  23297. /**
  23298. * @function GeoprocessingService.prototype.submitJob
  23299. * @description 异步执行处理自动化工具。
  23300. * @param {string} identifier - 处理自动化工具ID。
  23301. * @param {Object} parameter - 处理自动化工具的输入参数。
  23302. * @param {Object} environments - 处理自动化工具的环境参数。
  23303. */
  23304. submitJob(identifier, parameter, environments, callback) {
  23305. parameter = parameter ? parameter : null;
  23306. environments = environments ? environments : null;
  23307. const asyncParamter = JSON.stringify({ parameter: parameter, environments: environments });
  23308. this._processAsync({ url: `${this.url}/${identifier}/jobs`, method: 'POST', callback, params: asyncParamter });
  23309. }
  23310. /**
  23311. * @function GeoprocessingService.prototype.waitForJobCompletion
  23312. * @description 获取处理自动化异步执行状态信息。
  23313. * @param {string} jobId - 处理自动化任务ID。
  23314. * @param {string} identifier - 处理自动化工具ID。
  23315. * @param {Object} options - 状态信息参数。
  23316. * @param {number} options.interval - 定时器时间间隔。
  23317. * @param {function} options.statusCallback - 任务状态的回调函数。
  23318. */
  23319. waitForJobCompletion(jobId, identifier, options, callback) {
  23320. const me = this;
  23321. const timer = setInterval(function () {
  23322. const serviceProcessCompleted = function (serverResult, options) {
  23323. const state = serverResult.state.runState;
  23324. if (options.statusCallback) {
  23325. options.statusCallback(state);
  23326. }
  23327. switch (state) {
  23328. case 'FINISHED':
  23329. clearInterval(timer);
  23330. me.events.triggerEvent('processCompleted', {
  23331. result: serverResult,
  23332. options
  23333. });
  23334. break;
  23335. case 'FAILED':
  23336. clearInterval(timer);
  23337. me.events.triggerEvent('processFailed', {
  23338. result: serverResult,
  23339. options
  23340. });
  23341. break;
  23342. case 'CANCELED':
  23343. clearInterval(timer);
  23344. me.events.triggerEvent('processFailed', {
  23345. result: serverResult,
  23346. options
  23347. });
  23348. break;
  23349. }
  23350. };
  23351. me._processAsync({ url: `${me.url}/${identifier}/jobs/${jobId}`, serviceProcessCompleted, callback });
  23352. }, options.interval);
  23353. }
  23354. /**
  23355. * @function GeoprocessingService.prototype.getJobInfo
  23356. * @description 获取处理自动化任务的执行信息。
  23357. * @param {string} identifier - 处理自动化工具ID。
  23358. * @param {string} jobId - 处理自动化任务ID。
  23359. */
  23360. getJobInfo(identifier, jobId, callback) {
  23361. this._processAsync({ url: `${this.url}/${identifier}/jobs/${jobId}`, callback });
  23362. }
  23363. /**
  23364. * @function GeoprocessingService.prototype.cancelJob
  23365. * @description 取消处理自动化任务的异步执行。
  23366. * @param {string} identifier - 处理自动化工具ID。
  23367. * @param {string} jobId - 处理自动化任务ID。
  23368. */
  23369. cancelJob(identifier, jobId, callback) {
  23370. this._processAsync({ url: `${this.url}/${identifier}/jobs/${jobId}/cancel`, callback });
  23371. }
  23372. /**
  23373. * @function GeoprocessingService.prototype.getJobs
  23374. * @description 获取处理自动化服务任务列表。
  23375. * @param {string} identifier - 处理自动化工具ID。(传参代表identifier算子的任务列表,不传参代表所有任务的列表)
  23376. */
  23377. getJobs(identifier, callback) {
  23378. let url = `${this.url}/jobs`;
  23379. if (identifier) {
  23380. url = `${this.url}/${identifier}/jobs`;
  23381. }
  23382. this._processAsync({ url, callback });
  23383. }
  23384. /**
  23385. * @function GeoprocessingService.prototype.getResults
  23386. * @description 处理自动化工具执行的结果等,支持结果过滤。
  23387. * @param {string} identifier - 处理自动化工具ID。
  23388. * @param {string} jobId - 处理自动化任务ID。
  23389. * @param {string} filter - 输出异步结果的ID。(可选,传入filter参数时对该处理自动化工具执行的结果进行过滤获取,不填参时显示所有的执行结果)
  23390. */
  23391. getResults(identifier, jobId, filter, callback) {
  23392. let url = `${this.url}/${identifier}/jobs/${jobId}/results`;
  23393. if (filter) {
  23394. url = `${url}/${filter}`;
  23395. }
  23396. this._processAsync({ url, callback });
  23397. }
  23398. _processAsync({ url, method, callback, paramter, serviceProcessCompleted, serviceProcessFailed }) {
  23399. let eventId = ++this.eventCount;
  23400. let eventListeners = {
  23401. scope: this,
  23402. processCompleted: function(result) {
  23403. if (eventId === result.result.eventId && callback) {
  23404. delete result.result.eventId;
  23405. callback(result);
  23406. this.events && this.events.un(eventListeners);
  23407. return false;
  23408. }
  23409. },
  23410. processFailed: function(result) {
  23411. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  23412. callback(result);
  23413. this.events && this.events.un(eventListeners);
  23414. return false;
  23415. }
  23416. }
  23417. }
  23418. this.events.on(eventListeners);
  23419. this.request({
  23420. url: url,
  23421. method: method || 'GET',
  23422. params: paramter,
  23423. headers: { 'Content-type': 'application/json' },
  23424. scope: this,
  23425. success(result, options) {
  23426. result.eventId = eventId;
  23427. const callback = serviceProcessCompleted || this.serviceProcessCompleted.bind(this);
  23428. callback(result, options);
  23429. },
  23430. failure(result, options) {
  23431. if (result.error) {
  23432. result.error.eventId = eventId;
  23433. }
  23434. result.eventId = eventId;
  23435. const callback = serviceProcessFailed || this.serviceProcessFailed.bind(this);
  23436. callback(result, options);
  23437. }
  23438. });
  23439. }
  23440. }
  23441. ;// CONCATENATED MODULE: ./src/maplibregl/services/GeoprocessingService.js
  23442. /**
  23443. * @class GeoprocessingService
  23444. * @classdesc 处理自动化服务接口类。
  23445. * @version 11.1.0
  23446. * @category iServer ProcessingAutomationService
  23447. * @modulecategory Services
  23448. * @extends {ServiceBase}
  23449. * @example
  23450. * //为了安全访问受保护的处理自动化服务,必须通过传递iserver令牌(token),才能正确访问相关资源。
  23451. * SecurityManager.registerToken(serviceUrl, token);
  23452. * var geoprocessingService = new GeoprocessingService("http://localhost:8090/iserver/services/geoprocessing/restjsr/gp/v2")
  23453. geoprocessingService.submitJob(identifier,params, environments, function(serverResult) {
  23454. console.log(serverResult.result);
  23455. var jobID = serverResult.result.jobID;
  23456. var options = {
  23457. interval: 5000,
  23458. statusCallback: function(state) {
  23459. console.log("Job Status: ", state);
  23460. }
  23461. };
  23462. geoprocessingService.waitForJobCompletion(jobID, identifier, options, function(serverResult) {
  23463. console.log(serverResult);
  23464. })
  23465. })
  23466. * @param {string} url - 服务地址。
  23467. * @param {Object} options - 参数。
  23468. * @usage
  23469. */
  23470. class GeoprocessingService extends ServiceBase {
  23471. constructor(url, options) {
  23472. super(url, options);
  23473. this.headers = {};
  23474. this.crossOrigin = true;
  23475. this.withCredentials = true;
  23476. this.proxy = true;
  23477. this._geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, {
  23478. proxy: this.options.proxy,
  23479. withCredentials: this.options.withCredentials,
  23480. crossOrigin: this.options.crossOrigin,
  23481. headers: this.options.headers
  23482. });
  23483. }
  23484. /**
  23485. * @function GeoprocessingService.prototype.getTools
  23486. * @description 获取处理自动化工具列表。
  23487. * @param {RequestCallback} callback 回调函数。
  23488. */
  23489. getTools(callback) {
  23490. this._geoprocessingJobsService.getTools(callback);
  23491. }
  23492. /**
  23493. * @function GeoprocessingService.prototype.getTool
  23494. * @description 获取处理自动化工具的ID、名称、描述、输入参数、环境参数和输出结果等相关参数。
  23495. * @param {string} identifier - 处理自动化工具ID。
  23496. * @param {RequestCallback} callback 回调函数。
  23497. */
  23498. getTool(identifier, callback) {
  23499. this._geoprocessingJobsService.getTool(identifier, callback);
  23500. }
  23501. /**
  23502. * @function GeoprocessingService.prototype.execute
  23503. * @description 同步执行处理自动化工具。
  23504. * @param {string} identifier - 处理自动化工具ID。
  23505. * @param {Object} parameter - 处理自动化工具的输入参数。
  23506. * @param {Object} environment - 处理自动化工具的环境参数。
  23507. * @param {RequestCallback} callback 回调函数。
  23508. */
  23509. execute(identifier, parameter, environment, callback) {
  23510. this._geoprocessingJobsService.execute(identifier, parameter, environment, callback);
  23511. }
  23512. /**
  23513. * @function GeoprocessingService.prototype.submitJob
  23514. * @description 异步执行处理自动化工具。
  23515. * @param {string} identifier - 处理自动化工具ID。
  23516. * @param {Object} parameter - 处理自动化工具的输入参数。
  23517. * @param {Object} environment - 处理自动化工具的环境参数。
  23518. * @param {RequestCallback} callback 回调函数。
  23519. */
  23520. submitJob(identifier, parameter, environment, callback) {
  23521. this._geoprocessingJobsService.submitJob(identifier, parameter, environment, callback);
  23522. }
  23523. /**
  23524. * @function GeoprocessingService.prototype.waitForJobCompletion
  23525. * @description 获取处理自动化异步执行状态信息。
  23526. * @param {string} jobId - 处理自动化任务ID。
  23527. * @param {string} identifier - 处理自动化工具ID。
  23528. * @param {Object} options - 状态信息参数。
  23529. * @param {number} options.interval - 定时器时间间隔。
  23530. * @param {function} options.statusCallback - 任务状态的回调函数。
  23531. * @param {RequestCallback} callback 回调函数。
  23532. */
  23533. waitForJobCompletion(jobId, identifier, options, callback) {
  23534. this._geoprocessingJobsService.waitForJobCompletion(jobId, identifier, options, callback);
  23535. }
  23536. /**
  23537. * @function GeoprocessingService.prototype.getJobInfo
  23538. * @description 获取处理自动化任务的执行信息。
  23539. * @param {string} identifier - 处理自动化工具ID。
  23540. * @param {string} jobId - 处理自动化任务ID。
  23541. * @param {RequestCallback} callback 回调函数。
  23542. */
  23543. getJobInfo(identifier, jobId, callback) {
  23544. this._geoprocessingJobsService.getJobInfo(identifier, jobId, callback);
  23545. }
  23546. /**
  23547. * @function GeoprocessingService.prototype.cancelJob
  23548. * @description 取消处理自动化任务的异步执行。
  23549. * @param {string} identifier - 处理自动化工具ID。
  23550. * @param {string} jobId - 处理自动化任务ID。
  23551. * @param {RequestCallback} callback 回调函数。
  23552. */
  23553. cancelJob(identifier, jobId, callback) {
  23554. this._geoprocessingJobsService.cancelJob(identifier, jobId, callback);
  23555. }
  23556. /**
  23557. * @function GeoprocessingService.prototype.getJobs
  23558. * @description 获取处理自动化服务任务列表。
  23559. * @param {string} identifier - 处理自动化工具ID。(可选,传参代表identifier算子的任务列表,不传参代表所有任务的列表)
  23560. * @param {RequestCallback} callback 回调函数。
  23561. */
  23562. getJobs(identifier, callback) {
  23563. this._geoprocessingJobsService.getJobs(identifier, callback);
  23564. }
  23565. /**
  23566. * @function GeoprocessingService.prototype.getResults
  23567. * @description 处理自动化工具异步执行的结果,支持结果过滤。
  23568. * @param {string} identifier - 处理自动化工具ID。
  23569. * @param {string} jobId - 处理自动化任务ID。
  23570. * @param {string} filter - 输出异步结果的ID。(可选,传入filter参数时对该处理自动化工具执行的结果进行过滤获取,不填参时显示所有的执行结果)
  23571. * @param {RequestCallback} callback 回调函数。
  23572. */
  23573. getResults(identifier, jobId, filter, callback) {
  23574. this._geoprocessingJobsService.getResults(identifier, jobId, filter, callback);
  23575. }
  23576. }
  23577. ;// CONCATENATED MODULE: ./src/common/iServer/Theme.js
  23578. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  23579. * This program are made available under the terms of the Apache License, Version 2.0
  23580. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23581. /**
  23582. * @class CommonTheme
  23583. * @aliasclass Theme
  23584. * @deprecatedclass SuperMap.Theme
  23585. * @category iServer Map Theme
  23586. * @classdesc 专题图基类。
  23587. * @param {string} type - 专题图类型。
  23588. * @param {Object} options - 可选参数。
  23589. * @param {ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  23590. * @usage
  23591. */
  23592. class Theme {
  23593. constructor(type, options) {
  23594. if (!type) {
  23595. return this;
  23596. }
  23597. /**
  23598. * @member {ThemeMemoryData} CommonTheme.prototype.memoryData
  23599. * @description 专题图内存数据。<br>
  23600. * 用内存数据制作专题图的方式与表达式制作专题图的方式互斥,前者优先级较高。
  23601. * 第一个参数代表专题值,即数据集中用来做专题图的字段或表达式的值;第二个参数代表外部值。在制作专题图时,会用外部值代替专题值来制作相应的专题图。
  23602. */
  23603. this.memoryData = null;
  23604. /**
  23605. * @member {string} CommonTheme.prototype.type
  23606. * @description 专题图类型。
  23607. */
  23608. this.type = type;
  23609. if (options) {
  23610. Util_Util.extend(this, options);
  23611. }
  23612. this.CLASS_NAME = "SuperMap.Theme";
  23613. }
  23614. /**
  23615. * @function CommonTheme.prototype.destroy
  23616. * @description 释放资源,将引用资源的属性置空。
  23617. */
  23618. destroy() {
  23619. var me = this;
  23620. if (me.memoryData) {
  23621. me.memoryData.destroy();
  23622. me.memoryData = null;
  23623. }
  23624. me.type = null;
  23625. }
  23626. /**
  23627. * @function CommonTheme.prototype.toServerJSONObject
  23628. * @description 转换成对应的 JSON 格式对象。
  23629. * @returns {Object} 对应的 JSON 格式对象。
  23630. */
  23631. toServerJSONObject() {
  23632. //return 子类实现
  23633. return;
  23634. }
  23635. }
  23636. ;// CONCATENATED MODULE: ./src/common/iServer/ServerTextStyle.js
  23637. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  23638. * This program are made available under the terms of the Apache License, Version 2.0
  23639. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23640. /**
  23641. * @class ServerTextStyle
  23642. * @deprecatedclass SuperMap.ServerTextStyle
  23643. * @category iServer Map Theme
  23644. * @classdesc 服务端文本风格类。该类用于定义文本风格的相关属性。
  23645. * @param {Object} options - 可选参数。
  23646. * @param {TextAlignment} [options.align=TextAlignment.BASELINECENTER] - 文本的对齐方式。
  23647. * @param {ServerColor} [options.backColor] - 文本的背景色。默认 backColor = new ServerColor(255, 255, 255)。
  23648. * @param {ServerColor} [options.foreColor] - 文本的前景色。默认 foreColor = new ServerColor(0, 0, 0)。
  23649. * @param {boolean} [options.backOpaque=false] - 文本背景是否不透明。
  23650. * @param {boolean} [options.sizeFixed=true] - 文本大小是否固定。
  23651. * @param {number} [options.fontHeight=6] - 文本字体的高度。
  23652. * @param {number} [options.fontWidth=0] - 文本字体的宽度。
  23653. * @param {number} [options.fontWeight=400] - 文本字体的磅数。
  23654. * @param {string} [options.fontName='Times New Roman'] - 文本字体的名称。
  23655. * @param {boolean} [options.bold=false] - 文本是否为粗体字。
  23656. * @param {boolean} [options.italic=false] - 文本是否采用斜体。
  23657. * @param {number} [options.italicAngle=0] - 字体倾斜角度。
  23658. * @param {boolean} [options.shadow=false] - 文本是否有阴影。
  23659. * @param {boolean} [options.strikeout=false] - 文本字体是否加删除线。
  23660. * @param {boolean} [options.outline=false] - 是否以轮廓的方式来显示文本的背景。
  23661. * @param {number} [options.opaqueRate=0] - 注记文字的不透明度。
  23662. * @param {boolean} [options.underline=false] - 文本字体是否加下划线。
  23663. * @param {number} [options.rotation=0.0] - 文本旋转的角度。
  23664. * @usage
  23665. */
  23666. class ServerTextStyle {
  23667. constructor(options) {
  23668. /**
  23669. * @member {TextAlignment} [ServerTextStyle.prototype.align= TextAlignment.BASELINECENTER]
  23670. * @description 文本的对齐方式。
  23671. */
  23672. this.align = TextAlignment.BASELINECENTER;
  23673. /**
  23674. * @member {ServerColor} [ServerTextStyle.prototype.backColor=(255, 255, 255)]
  23675. * @description 文本的背景色。
  23676. */
  23677. this.backColor = new ServerColor(255, 255, 255);
  23678. /**
  23679. * @member {ServerColor} [ServerTextStyle.prototype.foreColor=(0, 0, 0)]
  23680. * @description 文本的前景色。
  23681. */
  23682. this.foreColor = new ServerColor(0, 0, 0);
  23683. /**
  23684. * @member {boolean} [ServerTextStyle.prototype.backOpaque=false]
  23685. * @description 文本背景是否不透明。true 表示文本背景不透明。
  23686. */
  23687. this.backOpaque = false;
  23688. /**
  23689. * @member {boolean} [ServerTextStyle.prototype.sizeFixed=true]
  23690. * @description 文本大小是否固定。设置为 true,表示图片为固定像素大小,具体大小请参考 fontHeight。当设为 false 时,图片会随着地图缩放而缩放。
  23691. */
  23692. this.sizeFixed = true;
  23693. /**
  23694. * @member {number} [ServerTextStyle.prototype.fontHeight=6]
  23695. * @description 文本字体的高度,单位与 sizeFixed 有关,当 sizeFixed 为 False 时,即非固定文本大小时使用地图坐标单位,
  23696. * 如地理坐标系下的地图中单位为度;当 sizeFixed 为 True 时,单位为毫米(mm)。
  23697. */
  23698. this.fontHeight = 6;
  23699. /**
  23700. * @member {number} [ServerTextStyle.prototype.fontWidth=0]
  23701. * @description 文本字体的宽度。字体的宽度以英文字符为标准,由于一个中文字符相当于两个英文字符。
  23702. */
  23703. this.fontWidth = 0;
  23704. /**
  23705. * @member {number} [ServerTextStyle.prototype.fontWeight=400]
  23706. * @description 文本字体的磅数。表示粗体的具体数值。取值范围为从0-900之间的整百数。
  23707. */
  23708. this.fontWeight = 400;
  23709. /**
  23710. * @member {string} [ServerTextStyle.prototype.fontName="Times New Roman"]
  23711. * @description 文本字体的名称。
  23712. */
  23713. this.fontName = "Times New Roman";
  23714. /**
  23715. * @member {boolean} [ServerTextStyle.prototype.bold=false]
  23716. * @description 文本是否为粗体字。true 表示为粗体。false 表示文本不是粗体字。
  23717. */
  23718. this.bold = false;
  23719. /**
  23720. * @member {boolean} [ServerTextStyle.prototype.italic=false]
  23721. * @description 文本是否采用斜体。true 表示采用斜体。
  23722. */
  23723. this.italic = false;
  23724. /**
  23725. * @member {number} [ServerTextStyle.prototype.italicAngle=0]
  23726. * @description 字体倾斜角度。正负度之间,以度为单位,精确到0.1度。当倾斜角度为0度,为系统默认的字体倾斜样式。
  23727. * 正负度是指以纵轴为起始零度线,其纵轴左侧为正,右侧为负。允许的最大角度为60,最小-60。大于60按照60处理,小于-60按照-60处理。目前只对标签专题图有效。
  23728. */
  23729. this.italicAngle = 0;
  23730. /**
  23731. * @member {boolean} [ServerTextStyle.prototype.shadow=false]
  23732. * @description 文本是否有阴影。true 表示给文本增加阴影。false 表示文本没有阴影。
  23733. */
  23734. this.shadow = false;
  23735. /**
  23736. * @member {boolean} [ServerTextStyle.prototype.strikeout=false]
  23737. * @description 文本字体是否加删除线。true 表示加删除线。false 表示文本字体不加删除线。
  23738. */
  23739. this.strikeout = false;
  23740. /**
  23741. * @member {boolean} [ServerTextStyle.prototype.outline=false]
  23742. * @description 是否以轮廓的方式来显示文本的背景。true 表示以轮廓的方式来显示文本的背景。false 表示不以轮廓的方式来显示文本的背景。
  23743. */
  23744. this.outline = false;
  23745. /**
  23746. * @member {number} [ServerTextStyle.prototype.opaqueRate=0]
  23747. * @description 注记文字的不透明度。不透明度的范围为0-100。0表示透明。
  23748. */
  23749. this.opaqueRate = 0;
  23750. /**
  23751. * @member {boolean} [ServerTextStyle.prototype.underline=false]
  23752. * @description 文本字体是否加下划线。true 表示加下划线。
  23753. */
  23754. this.underline = false;
  23755. /**
  23756. * @member {number} [ServerTextStyle.prototype.rotation=0.0]
  23757. * @description 文本旋转的角度。逆时针方向为正方向,单位为度,精确到0.1度。
  23758. */
  23759. this.rotation = 0.0;
  23760. if (options) {
  23761. Util_Util.extend(this, options);
  23762. }
  23763. this.CLASS_NAME = "SuperMap.ServerTextStyle";
  23764. }
  23765. /**
  23766. * @function ServerTextStyle.prototype.destroy
  23767. * @description 释放资源,将引用资源的属性置空。
  23768. */
  23769. destroy() {
  23770. var me = this;
  23771. me.align = null;
  23772. if (me.backColor) {
  23773. me.backColor.destroy();
  23774. me.backColor = null;
  23775. }
  23776. if (me.foreColor) {
  23777. me.foreColor.destroy();
  23778. me.foreColor = null;
  23779. }
  23780. me.backOpaque = null;
  23781. me.sizeFixed = null;
  23782. me.fontHeight = null;
  23783. me.fontWidth = null;
  23784. me.fontWeight = null;
  23785. me.fontName = null;
  23786. me.bold = null;
  23787. me.italic = null;
  23788. me.italicAngle = null;
  23789. me.shadow = null;
  23790. me.strikeout = null;
  23791. me.outline = null;
  23792. me.opaqueRate = null;
  23793. me.underline = null;
  23794. me.rotation = null;
  23795. }
  23796. /**
  23797. * @function ServerTextStyle.fromObj
  23798. * @description 从传入对象获服务端文本风格类。
  23799. * @param {Object} obj - 传入对象
  23800. * @returns {ServerTextStyle} 返回服务端文本风格对象
  23801. */
  23802. static fromObj(obj) {
  23803. var res = new ServerTextStyle(obj);
  23804. Util_Util.copy(res, obj);
  23805. res.backColor = ServerColor.fromJson(obj.backColor);
  23806. res.foreColor = ServerColor.fromJson(obj.foreColor);
  23807. return res;
  23808. }
  23809. }
  23810. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelItem.js
  23811. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  23812. * This program are made available under the terms of the Apache License, Version 2.0
  23813. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23814. /**
  23815. * @class ThemeLabelItem
  23816. * @deprecatedclass SuperMap.ThemeLabelItem
  23817. * @category iServer Map Theme
  23818. * @classdesc 分段标签专题图的子项。标签专题图用专题值对点、线、面等对象做标注。
  23819. * 值得注意的是,分段标签专题图允许用户通过 rangeExpression 字段指定用于分段的数值型字段,
  23820. * 同一范围段内的标签具有相同的显示风格,其中每一个范围段就是一个专题图子项,
  23821. * 每一个子项都具有其名称、风格、起始值和终止值。注意:每个分段所表示的范围为 [Start, End)。例如:标签专题图的分段点有两个子项,
  23822. * 他们所代表的分段区间分别为[0,5),[5,10)。那么需要分别设置 ThemeLabelItem[0].start=0,
  23823. * ThemeLabelItem[0].end=5,SuperMap.ThemeLabelItem[1].start=5,SuperMap.ThemeLabelItem[1].end=10。
  23824. * @param {Object} options - 可选参数。
  23825. * @param {string} [options.caption] - 子项的名称。
  23826. * @param {number} [options.end=0] - 子项的终止值。
  23827. * @param {number} [options.start=0] - 子项的分段起始值。
  23828. * @param {boolean} [options.visible=true] - 子项是否可见。
  23829. * @param {ServerTextStyle} [options.style] - 子项文本的显示风格。
  23830. * @usage
  23831. */
  23832. class ThemeLabelItem {
  23833. constructor(options) {
  23834. /**
  23835. * @member {string} [ThemeLabelItem.prototype.caption]
  23836. * @description 标签专题子项的标题。
  23837. */
  23838. this.caption = null;
  23839. /**
  23840. * @member {number} [ThemeLabelItem.prototype.end=0]
  23841. * @description 标签专题图子项的终止值。如果该子项是分段中最后一个子项,那么该终止值就是分段的最大值;
  23842. * 如果不是最后一项,该终止值必须与其下一子项的起始值相同,否则系统抛出异常。
  23843. */
  23844. this.end = 0;
  23845. /**
  23846. * @member {number} [ThemeLabelItem.prototype.start=0]
  23847. * @description 标签专题图子项的分段起始值。如果该子项是分段中第一项,那么该起始值就是分段的最小值;
  23848. * 如果该子项的序号大于等于 1 的时候,该起始值必须与前一子项的终止值相同,否则系统会抛出异常。
  23849. */
  23850. this.start = 0;
  23851. /**
  23852. * @member {boolean} [ThemeLabelItem.prototype.visible=true]
  23853. * @description 标签专题图子项是否可见。如果标签专题图子项可见,则为 true,否则为 false。
  23854. */
  23855. this.visible = true;
  23856. /**
  23857. * @member {ServerTextStyle} ThemeLabelItem.prototype.style
  23858. * @description 标签专题图子项文本的显示风格。各种风格的优先级从高到低为:<br>
  23859. * uniformMixedStyle(标签文本的复合风格),ThemeLabelItem.style(分段子项的文本风格),uniformStyle(统一文本风格)。
  23860. */
  23861. this.style = new ServerTextStyle();
  23862. if (options) {
  23863. Util_Util.extend(this, options);
  23864. }
  23865. this.CLASS_NAME = "SuperMap.ThemeLabelItem";
  23866. }
  23867. /**
  23868. * @function ThemeLabelItem.prototype.destroy
  23869. * @description 释放资源,将引用资源的属性置空。
  23870. */
  23871. destroy() {
  23872. var me = this;
  23873. me.caption = null;
  23874. me.end = null;
  23875. me.start = null;
  23876. if (me.style) {
  23877. me.style.destroy();
  23878. me.style = null;
  23879. }
  23880. me.visible = null;
  23881. }
  23882. /**
  23883. * @function ThemeLabelItem.fromObj
  23884. * @description 从传入对象获取分段标签专题图的子项类。
  23885. * @param {Object} obj - 传入对象。
  23886. * @returns {ThemeLabelItem} ThemeLabelItem 对象。
  23887. */
  23888. static fromObj(obj) {
  23889. if (!obj) {
  23890. return;
  23891. }
  23892. var t = new ThemeLabelItem();
  23893. Util_Util.copy(t, obj);
  23894. return t;
  23895. }
  23896. }
  23897. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeUniqueItem.js
  23898. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  23899. * This program are made available under the terms of the Apache License, Version 2.0
  23900. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23901. /**
  23902. * @class ThemeUniqueItem
  23903. * @deprecatedclass SuperMap.ThemeUniqueItem
  23904. * @category iServer Map Theme
  23905. * @classdesc 单值专题图子项类。单值专题图是将专题值相同的要素归为一类,为每一类设定一种渲染风格,其中每一类就是一个专题图子项。比如,利用单值专题图制作行政区划图,Name 字段代表省/直辖市名,该字段用来做专题变量,如果该字段的字段值总共有 5 种不同值,则该行政区划图有 5 个专题图子项。
  23906. * @param {Object} options - 参数。
  23907. * @param {string} options.unique - 子项的单值字段。
  23908. * @param {string} [options.caption] - 子项的标题。
  23909. * @param {ServerStyle} [options.style] - 子项的风格。
  23910. * @param {boolean} [options.visible=true] - 子项是否可见。
  23911. * @usage
  23912. */
  23913. class ThemeUniqueItem {
  23914. constructor(options) {
  23915. /**
  23916. * @member {string} [ThemeUniqueItem.prototype.caption]
  23917. * @description 单值专题图子项的标题。
  23918. */
  23919. this.caption = null;
  23920. /**
  23921. * @member {ServerStyle} [ThemeUniqueItem.prototype.style]
  23922. * @description 单值专题图子项的显示风格。
  23923. */
  23924. this.style = new ServerStyle();
  23925. /**
  23926. * @member {string} ThemeUniqueItem.prototype.unique
  23927. * @description 单值专题图子项的值,可以为数字、字符串等。
  23928. */
  23929. this.unique = null;
  23930. /**
  23931. * @member {boolean} [ThemeUniqueItem.prototype.visible=true]
  23932. * @description 单值专题图子项的可见性。
  23933. */
  23934. this.visible = true;
  23935. if (options) {
  23936. Util_Util.extend(this, options);
  23937. }
  23938. this.CLASS_NAME = "SuperMap.ThemeUniqueItem";
  23939. }
  23940. /**
  23941. * @function ThemeUniqueItem.prototype.destroy
  23942. * @description 释放资源,将引用资源的属性置空。
  23943. */
  23944. destroy() {
  23945. var me = this;
  23946. me.caption = null;
  23947. me.unique = null;
  23948. if (me.style) {
  23949. me.style.destroy();
  23950. me.style = null;
  23951. }
  23952. me.visible = null;
  23953. }
  23954. /**
  23955. * @function ThemeUniqueItem.prototype.toServerJSONObject
  23956. * @description 转换成对应的 JSON 格式对象。
  23957. * @returns {Object} 对应的 JSON 格式对象。
  23958. */
  23959. toServerJSONObject() {
  23960. var obj = {};
  23961. obj = Util_Util.copyAttributes(obj, this);
  23962. if (obj.style) {
  23963. if (obj.style.toServerJSONObject) {
  23964. obj.style = obj.style.toServerJSONObject();
  23965. }
  23966. }
  23967. return obj;
  23968. }
  23969. /**
  23970. * @function ThemeUniqueItem.fromObj
  23971. * @description 从传入对象获取单值专题图子项类。
  23972. * @param {Object} obj - 传入对象。
  23973. * @returns {ThemeUniqueItem} ThemeUniqueItem 对象。
  23974. */
  23975. static fromObj(obj) {
  23976. var res = new ThemeUniqueItem();
  23977. Util_Util.copy(res, obj);
  23978. res.style = ServerStyle.fromJson(obj.style);
  23979. return res;
  23980. }
  23981. }
  23982. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeOffset.js
  23983. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  23984. * This program are made available under the terms of the Apache License, Version 2.0
  23985. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23986. /**
  23987. * @class ThemeOffset
  23988. * @deprecatedclass SuperMap.ThemeOffset
  23989. * @category iServer Map Theme
  23990. * @classdesc 专题图中文本或符号相对于要素内点的偏移量设置类。
  23991. * 通过该类可以设置专题图中标记文本或符号的偏移量以及偏移量是否随地图缩放而改变。
  23992. * @param {Object} options - 可选参数。
  23993. * @param {boolean} [options.offsetFixed=false] - 当前专题图是否固定标记文本或符号的偏移量。
  23994. * @param {string} [options.offsetX='0.0'] - 专题图中文本或符号相对于要素内点的水平偏移量。
  23995. * @param {string} [options.offsetY='0.0'] - 专题图中文本或符号相对于要素内点的垂直偏移量。
  23996. * @usage
  23997. */
  23998. class ThemeOffset {
  23999. constructor(options) {
  24000. /**
  24001. * @member {boolean} [ThemeOffset.prototype.offsetFixed=false]
  24002. * @description 当前专题图是否固定标记文本或符号的偏移量。所谓固定偏移量,指文本或符号的偏移量不随地图的缩放而变化。
  24003. */
  24004. this.offsetFixed = false;
  24005. /**
  24006. * @member {string} [ThemeOffset.prototype.offsetX=0.0]
  24007. * @description 专题图中文本或符号相对于要素内点的水平偏移量。偏移量的单位为地图单位。
  24008. * 该偏移量的值为一个常量值或者字段表达式所表示的值,即如果字段表达式为 SmID,其中 SmID = 2,那么水平偏移量为2。
  24009. */
  24010. this.offsetX = "0.0";
  24011. /**
  24012. * @member {string} [ThemeOffset.prototype.offsetY=0.0]
  24013. * @description 专题图中文本或符号相对于要素内点的垂直偏移量。偏移量的单位为地图单位。
  24014. * 该偏移量的值为一个常量值或者字段表达式所表示的值,即如果字段表达式为 SmID,其中 SmID = 2,那么垂直偏移量为2。
  24015. */
  24016. this.offsetY = "0.0";
  24017. if (options) {
  24018. Util_Util.extend(this, options);
  24019. }
  24020. this.CLASS_NAME = "SuperMap.ThemeOffset";
  24021. }
  24022. /**
  24023. * @function ThemeOffset.prototype.destroy
  24024. * @description 释放资源,将引用资源的属性置空。
  24025. */
  24026. destroy() {
  24027. var me = this;
  24028. me.offsetFixed = null;
  24029. me.offsetX = null;
  24030. me.offsetY = null;
  24031. }
  24032. /**
  24033. * @function ThemeOffset.fromObj
  24034. * @description 从传入对象获取专题图中文本或符号相对于要素内点的偏移量设置类。
  24035. * @param {Object} obj - 传入对象。
  24036. * @returns {ThemeOffset} ThemeOffset 对象。
  24037. */
  24038. static fromObj(obj) {
  24039. if (!obj) {
  24040. return;
  24041. }
  24042. var res = new ThemeOffset();
  24043. Util_Util.copy(res, obj);
  24044. return res;
  24045. }
  24046. }
  24047. ;// CONCATENATED MODULE: ./src/common/iServer/LabelMixedTextStyle.js
  24048. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  24049. * This program are made available under the terms of the Apache License, Version 2.0
  24050. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24051. /**
  24052. * @class LabelMixedTextStyle
  24053. * @deprecatedclass SuperMap.LabelMixedTextStyle
  24054. * @category iServer Map Theme
  24055. * @classdesc 标签文本复合风格类。
  24056. * 该类主要用于对标签专题图中标签的文本内容进行风格设置。通过该类用户可以使标签的文字显示不同的风格,比如文本 “喜马拉雅山”,通过本类可以将前三个字用红色显示,后两个字用蓝色显示。对同一文本设置不同的风格实质上是对文本的字符进行分段,同一分段内的字符具有相同的显示风格。对字符分段有两种方式,一种是利用分隔符对文本进行分段;另一种是根据分段索引值进行分段:</br>
  24057. * 1.利用分隔符对文本进行分段: 比如文本 “5&109” 被分隔符 “&” 分为 “5” 和 “109” 两部分,
  24058. * 在显示时,“5” 和分隔符 “&” 使用同一个风格,字符串 “109” 使用相同的风格。<br>
  24059. * 2.利用分段索引值进行分段: 文本中字符的索引值是以0开始的整数,比如文本 “珠穆朗玛峰”,
  24060. * 第一个字符(“珠”)的索引值为 0,第二个字符(“穆”)的索引值为 1,以此类推;当设置分段索引值为 1,3,4,9 时,
  24061. * 字符分段范围相应的就是 (-∞,1),[1,3),[3,4),[4,9),[9,+∞),可以看出索引号为 0 的字符(即“珠” )在第一个分段内,
  24062. * 索引号为 1,2 的字符(即“穆”、“朗”)位于第二个分段内,索引号为 3 的字符(“玛”)在第三个分段内,索引号为 4 的字符(“峰”)在第四个分段内,其余分段中没有字符。
  24063. * @param {Object} options - 可选参数。
  24064. * @param {ServerTextStyle} [options.defaultStyle] - 默认的文本复合风格。
  24065. * @param {string} [options.separator] - 文本的分隔符。
  24066. * @param {boolean} [options.separatorEnabled=false] - 文本的分隔符是否有效。
  24067. * @param {Array.<number>} [options.splitIndexes] - 分段索引值,分段索引值用来对文本中的字符进行分段。
  24068. * @param {Array.<ServerTextStyle>} [options.styles] - 文本样式集合。
  24069. * @usage
  24070. */
  24071. class LabelMixedTextStyle {
  24072. constructor(options) {
  24073. /**
  24074. * @member {ServerTextStyle} LabelMixedTextStyle.prototype.defaultStyle
  24075. * @description 默认的文本复合风格,即 ServerTextStyle 各字段的默认值。
  24076. */
  24077. this.defaultStyle = null;
  24078. /**
  24079. * @member {string} LabelMixedTextStyle.prototype.separator
  24080. * @description 文本的分隔符,分隔符的风格与前一个字符的风格一样。文本的分隔符是一个将文本分割开的符号,
  24081. * 比如文本 “5_109” 被 “ _ ” 分隔为 “5” 和 “109” 两部分,假设有风格数组:style1、style2。
  24082. * 在显示时,“5” 和分隔符 “ _ ” 使用 Style1 风格渲染,字符串 “109” 使用 Style2 的风格。
  24083. */
  24084. this.separator = null;
  24085. /**
  24086. * @member {boolean} [LabelMixedTextStyle.prototype.separatorEnabled=false]
  24087. * @description 文本的分隔符是否有效。分隔符有效时利用分隔符对文本进行分段;无效时根据文本中字符的位置进行分段。
  24088. * 分段后,同一分段内的字符具有相同的显示风格。
  24089. */
  24090. this.separatorEnabled = false;
  24091. /**
  24092. * @member {Array.<number>} LabelMixedTextStyle.prototype.splitIndexes
  24093. * @description 分段索引值,分段索引值用来对文本中的字符进行分段。
  24094. * 文本中字符的索引值是以 0 开始的整数,比如文本“珠穆朗玛峰”,第一个字符(“珠”)的索引值为0,第二个字符(“穆”)的索引值为 1,
  24095. * 以此类推;当设置分段索引值数组为 [1,3,4,9] 时,字符分段范围相应的就是 (-∞,1),[1,3),[3,4),[4,9),[9,+∞),
  24096. * 可以看出索引号为 0 的字符(即 “珠”)在第一个分段内,索引号为 1,2 的字符(即 “穆”、“朗”)位于第二个分段内,
  24097. * 索引号为 3 的字符(“玛”)在第三个分段内,索引号为 4 的字符(“峰”)在第四个分段内,其余分段中没有字符。
  24098. */
  24099. this.splitIndexes = null;
  24100. /**
  24101. * @member {Array.<ServerTextStyle>} LabelMixedTextStyle.prototype.styles
  24102. * @description 文本样式集合。文本样式集合中的样式根据索引与不同分段一一对应,
  24103. * 如果有分段没有风格对应则使用 defaultStyle。
  24104. */
  24105. this.styles = new ServerTextStyle();
  24106. if (options) {
  24107. Util_Util.extend(this, options);
  24108. }
  24109. this.CLASS_NAME = "SuperMap.LabelMixedTextStyle"
  24110. }
  24111. /**
  24112. * @function LabelMixedTextStyle.prototype.destroy
  24113. * @description 释放资源,将引用资源的属性置空。
  24114. */
  24115. destroy() {
  24116. var me = this;
  24117. if (me.defaultStyle) {
  24118. me.defaultStyle.destroy();
  24119. me.defaultStyle = null;
  24120. }
  24121. me.separator = null;
  24122. me.separatorEnabled = null;
  24123. if (me.splitIndexes) {
  24124. me.splitIndexes = null;
  24125. }
  24126. if (me.styles) {
  24127. for (var i = 0, styles = me.styles, len = styles.length; i < len; i++) {
  24128. styles[i].destroy();
  24129. }
  24130. me.styles = null;
  24131. }
  24132. }
  24133. /**
  24134. * @function LabelMixedTextStyle.fromObj
  24135. * @description 从传入对象获取标签文本复合风格类。
  24136. * @param {Object} obj - 传入对象。
  24137. * @returns {LabelMixedTextStyle} 返回新的 LabelMixedTextStyle 对象。
  24138. */
  24139. static fromObj(obj) {
  24140. if (!obj) {
  24141. return;
  24142. }
  24143. var res = new LabelMixedTextStyle();
  24144. var stys = obj.styles;
  24145. Util_Util.copy(res, obj);
  24146. res.defaultStyle = new ServerTextStyle(obj.defaultStyle);
  24147. if (stys) {
  24148. res.styles = [];
  24149. for (var i = 0, len = stys.length; i < len; i++) {
  24150. res.styles.push(new ServerTextStyle(stys[i]));
  24151. }
  24152. }
  24153. return res;
  24154. }
  24155. }
  24156. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelText.js
  24157. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  24158. * This program are made available under the terms of the Apache License, Version 2.0
  24159. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24160. /**
  24161. * @class ThemeLabelText
  24162. * @deprecatedclass SuperMap.ThemeLabelText
  24163. * @category iServer Map Theme
  24164. * @classdesc 标签中文本风格类。
  24165. * 通过该类可以设置标签中的文本字体大小和显示风格。
  24166. * @param {Object} options - 参数。
  24167. * @param {number} [options.maxTextHeight=0] - 标签中文本的最大高度。
  24168. * @param {number} [options.maxTextWidth=0] - 标签中文本的最大宽度。
  24169. * @param {number} [options.minTextHeight=0] - 标签中文本的最小高度。
  24170. * @param {number} [options.minTextWidth=0] - 标签中文本的最小宽度。
  24171. * @param {ServerTextStyle} [options.uniformStyle] - 统一文本风格。
  24172. * @param {LabelMixedTextStyle} [options.uniformMixedStyle] - 标签专题图统一的文本复合风格。
  24173. * @usage
  24174. */
  24175. class ThemeLabelText {
  24176. constructor(options) {
  24177. /**
  24178. * @member {number} [ThemeLabelText.prototype.maxTextHeight=0]
  24179. * @description 标签中文本的最大高度。当标签文本不固定大小时,即 ServerTextStyle.sizeFixed = false 有效,
  24180. * 当放大后的文本高度超过最大高度之后就不再放大。高度单位为毫米。
  24181. */
  24182. this.maxTextHeight = 0;
  24183. /**
  24184. * @member {number} [ThemeLabelText.prototype.maxTextWidth=0]
  24185. * @description 标签中文本的最大宽度。当标签文本不固定大小时,即 ServerTextStyle.sizeFixed = false 有效,
  24186. * 当放大后的文本宽度超过最大高度之后就不再放大。宽度单位为毫米。
  24187. */
  24188. this.maxTextWidth = 0;
  24189. /**
  24190. * @member {number} [ThemeLabelText.prototype.minTextHeight=0]
  24191. * @description 标签中文本的最小高度。当标签文本不固定大小时,即 ServerTextStyle.sizeFixed = false 有效,
  24192. * 当缩小后的文本高度小于最小高度之后就不再缩小。高度单位为毫米。
  24193. */
  24194. this.minTextHeight = 0;
  24195. /**
  24196. * @member {number} [ThemeLabelText.prototype.minTextWidth=0]
  24197. * @description 标签中文本的最小宽度。当标签文本不固定大小时,即 ServerTextStyle.sizeFixed = false 有效,
  24198. * 当缩小后的文本宽度小于最小宽度之后就不再缩小。宽度单位为毫米。
  24199. */
  24200. this.minTextWidth = 0;
  24201. /**
  24202. * @member {ServerTextStyle} [ThemeLabelText.prototype.uniformStyle]
  24203. * @description 统一文本风格。当标签专题图子项的个数大于等于1时,
  24204. * uniformStyle 不起作用,各标签的风格使用子项中设置的风格。各种风格的优先级从高到低为:uniformMixedStyle(标签文本的复合风格),
  24205. * ThemeLabelItem.style(分段子项的文本风格),uniformStyle(统一文本风格)。
  24206. */
  24207. this.uniformStyle = new ServerTextStyle();
  24208. /**
  24209. *@member {LabelMixedTextStyle} [ThemeLabelText.prototype.uniformMixedStyle]
  24210. *@description 标签专题图统一的文本复合风格。通过该类可以使同一个标签中的文字使用多种风格显示。各种风格的优先级从高到低为:uniformMixedStyle(标签文本的复合风格),
  24211. * ThemeLabelItem.style(分段子项的文本风格),uniformStyle(统一文本风格)。
  24212. */
  24213. this.uniformMixedStyle = null;
  24214. if (options) {
  24215. Util_Util.extend(this, options);
  24216. }
  24217. this.CLASS_NAME = "SuperMap.ThemeLabelText";
  24218. }
  24219. /**
  24220. * @function ThemeLabelText.prototype.destroy
  24221. * @description 释放资源,将引用资源的属性置空。
  24222. */
  24223. destroy() {
  24224. var me = this;
  24225. me.maxTextHeight = null;
  24226. me.maxTextWidth = null;
  24227. me.minTextHeight = null;
  24228. me.minTextWidth = null;
  24229. if (me.uniformStyle) {
  24230. me.uniformStyle.destroy();
  24231. me.uniformStyle = null;
  24232. }
  24233. if (me.uniformMixedStyle) {
  24234. me.uniformMixedStyle.destroy();
  24235. me.uniformMixedStyle = null;
  24236. }
  24237. }
  24238. /**
  24239. * @function ThemeLabelText.fromObj
  24240. * @description 从传入对象获取标签中文本风格类。
  24241. * @param {Object} obj - 传入对象。
  24242. * @returns {ThemeLabelText} ThemeLabelText 对象。
  24243. */
  24244. static fromObj(obj) {
  24245. if (!obj) {
  24246. return;
  24247. }
  24248. var res = new ThemeLabelText();
  24249. Util_Util.copy(res, obj);
  24250. res.uniformStyle = ServerTextStyle.fromObj(obj.uniformStyle);
  24251. res.uniformMixedStyle = LabelMixedTextStyle.fromObj(obj.uniformMixedStyle);
  24252. return res;
  24253. }
  24254. }
  24255. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelAlongLine.js
  24256. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  24257. * This program are made available under the terms of the Apache License, Version 2.0
  24258. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24259. /**
  24260. * @class ThemeLabelAlongLine
  24261. * @deprecatedclass SuperMap.ThemeLabelAlongLine
  24262. * @category iServer Map Theme
  24263. * @classdesc 标签沿线标注样式类。
  24264. * @param {Object} options - 可选参数。
  24265. * @param {boolean} [options.isAlongLine=true] - 是否沿线显示文本。
  24266. * @param {AlongLineDirection} [options.alongLineDirection=AlongLineDirection.LB_TO_RT] - 标签沿线标注方向。
  24267. * @param {boolean} [options.angleFixed=false] - 当沿线显示文本时,是否将文本角度固定。
  24268. * @param {boolean} [options.repeatedLabelAvoided=false] - 沿线循环标注时是否避免标签重复标注。
  24269. * @param {boolean} [options.repeatIntervalFixed=false] - 循环标注间隔是否固定。
  24270. * @param {number} [options.labelRepeatInterval=0] - 沿线且循环标注时循环标注的间隔。
  24271. * @usage
  24272. */
  24273. class ThemeLabelAlongLine {
  24274. constructor(options) {
  24275. /**
  24276. * @member {boolean} [ThemeLabelAlongLine.prototype.isAlongLine=true]
  24277. * @description 是否沿线显示文本。true 表示沿线显示文本,false 表示正常显示文本。
  24278. */
  24279. this.isAlongLine = true;
  24280. /**
  24281. * @member {AlongLineDirection} [ThemeLabelAlongLine.prototype.alongLineDirection=AlongLineDirection.LB_TO_RT]
  24282. * @description 标签沿线标注方向。
  24283. */
  24284. this.alongLineDirection = AlongLineDirection.LB_TO_RT;
  24285. /**
  24286. * @member {boolean} [ThemeLabelAlongLine.prototype.angleFixed=false]
  24287. * @description 当沿线显示文本时,是否将文本角度固定。true 表示按固定文本角度显示文本,false 表示按照沿线角度显示文本。
  24288. * 如果固定角度,则所有标签均按所设置的文本风格中字体的旋转角度来显示,不考虑沿线标注的方向;
  24289. * 如果不固定角度,在显示标签时会同时考虑字体的旋转角度和沿线标注的方向。
  24290. */
  24291. this.angleFixed = false;
  24292. /**
  24293. * @member {boolean} ThemeLabelAlongLine.prototype.repeatedLabelAvoided
  24294. * @description 沿线循环标注时是否避免标签重复标注。
  24295. */
  24296. this.repeatedLabelAvoided = false;
  24297. /**
  24298. * @member {boolean} [ThemeLabelAlongLine.prototype.repeatIntervalFixed=false]
  24299. * @description 循环标注间隔是否固定。true 表示使用固定循环标注间隔,即使用逻辑坐标来显示循环标注间隔;
  24300. * false 表示循环标注间隔随地图的缩放而变化,即使用地理坐标来显示循环标注间隔。
  24301. */
  24302. this.repeatIntervalFixed = false;
  24303. /**
  24304. * @member {number} [ThemeLabelAlongLine.prototype.labelRepeatInterval=0]
  24305. * @description 沿线且循环标注时循环标注的间隔。长度的单位与地图的地理单位一致。只有设定 RepeatedLabelAvoided 为 true
  24306. * 的时候,labelRepeatInterval 属性才有效。
  24307. */
  24308. this.labelRepeatInterval = 0;
  24309. if (options) {
  24310. Util_Util.extend(this, options);
  24311. }
  24312. this.CLASS_NAME = "SuperMap.ThemeLabelAlongLine";
  24313. }
  24314. /**
  24315. * @function ThemeLabelAlongLine.prototype.destroy
  24316. * @description 释放资源,将引用资源的属性置空。
  24317. */
  24318. destroy() {
  24319. var me = this;
  24320. me.isAlongLine = null;
  24321. me.alongLineDirection = null;
  24322. me.angleFixed = null;
  24323. me.repeatedLabelAvoided = null;
  24324. me.repeatIntervalFixed = null;
  24325. me.labelRepeatInterval = null;
  24326. }
  24327. /**
  24328. * @function ThemeLabelAlongLine.fromObj
  24329. * @description 从传入对象获取标签沿线标注样式类。
  24330. * @param {Object} obj - 传入对象。
  24331. * @returns {ThemeLabelAlongLine} ThemeLabelAlongLine 对象。
  24332. */
  24333. static fromObj(obj) {
  24334. if (!obj) {
  24335. return;
  24336. }
  24337. var t = new ThemeLabelAlongLine();
  24338. Util_Util.copy(t, obj);
  24339. return t;
  24340. }
  24341. }
  24342. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelBackground.js
  24343. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  24344. * This program are made available under the terms of the Apache License, Version 2.0
  24345. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24346. /**
  24347. * @class ThemeLabelBackground
  24348. * @deprecatedclass SuperMap.ThemeLabelBackground
  24349. * @category iServer Map Theme
  24350. * @classdesc 标签背景风格类。通过该类可以设置标签的背景形状和风格。
  24351. * @param {Object} options - 可选参数。
  24352. * @param {LabelBackShape} [options.labelBackShape=LabelBackShape.NONE] - 标签专题图中标签背景的形状枚举类。
  24353. * @param {ServerStyle} [options.backStyle] - 标签专题图中标签背景风格。
  24354. * @usage
  24355. */
  24356. class ThemeLabelBackground {
  24357. constructor(options) {
  24358. /**
  24359. * @member {LabelBackShape} [ThemeLabelBackground.prototype.labelBackShape=LabelBackShape.NONE]
  24360. * @description 标签专题图中标签背景风格。当背景形状
  24361. * labelBackShape 属性设为 NONE(即无背景形状)时,backStyle 属性无效。
  24362. */
  24363. this.labelBackShape = LabelBackShape.NONE;
  24364. /**
  24365. * @member {ServerStyle} [ThemeLabelBackground.prototype.backStyle]
  24366. * @description 标签专题图中标签背景的形状枚举类。背景类型可以是矩形、圆角矩形、菱形、椭圆形、三角形和符号等,即不使用任何的形状作为标签的背景。
  24367. */
  24368. this.backStyle = new ServerStyle();
  24369. if (options) {
  24370. Util_Util.extend(this, options);
  24371. }
  24372. this.CLASS_NAME = "SuperMap.ThemeLabelBackground";
  24373. }
  24374. /**
  24375. * @function ThemeLabelBackground.prototype.destroy
  24376. * @description 释放资源,将引用资源的属性置空。
  24377. */
  24378. destroy() {
  24379. var me = this;
  24380. me.labelBackShape = null;
  24381. if (me.backStyle) {
  24382. me.backStyle.destroy();
  24383. me.backStyle = null;
  24384. }
  24385. }
  24386. /**
  24387. * @function ThemeLabelBackground.fromObj
  24388. * @description 从传入对象获取标签背景风格类。
  24389. * @param {Object} obj - 传入对象。
  24390. * @returns {ThemeLabelBackground} ThemeLabelBackground 对象。
  24391. */
  24392. static fromObj(obj) {
  24393. if (!obj) {
  24394. return;
  24395. }
  24396. var t = new ThemeLabelBackground();
  24397. t.labelBackShape = obj.labelBackShape;
  24398. t.backStyle = ServerStyle.fromJson(obj.backStyle);
  24399. return t;
  24400. }
  24401. }
  24402. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabel.js
  24403. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  24404. * This program are made available under the terms of the Apache License, Version 2.0
  24405. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24406. /**
  24407. * @class ThemeLabel
  24408. * @deprecatedclass SuperMap.ThemeLabel
  24409. * @category iServer Map Theme
  24410. * @classdesc 标签专题图类。
  24411. * @extends CommonTheme
  24412. * @param {Object} options - 参数。
  24413. * @param {Array.<ThemeLabelItem>} options.items - 子项数组。
  24414. * @param {string} options.labelExpression - 标注字段表达式。
  24415. * @param {Array.<LabelImageCell|LabelSymbolCell|LabelThemeCell>} options.matrixCells - 矩阵标签元素数组。
  24416. * @param {ThemeLabelAlongLine} [options.alongLine] - 标签沿线标注方向样式类。
  24417. * @param {ThemeLabelBackground} [options.background] - 标签的背景风格类。
  24418. * @param {LabelOverLengthMode} [options.labelOverLengthMode=LabelOverLengthMode.NONE] - 超长标签的处理模式枚举类。
  24419. * @param {number} [options.maxLabelLength=256] - 标签在每一行显示的最大长度。
  24420. * @param {number} [options.numericPrecision=0] - 通过该字段设置其显示的精度。
  24421. * @param {ThemeOffset} [options.offset] - 指定标签专题图中标记文本相对于要素内点的偏移量对象。
  24422. * @param {boolean} [options.overlapAvoided=true] - 是否允许以文本避让方式显示文本。
  24423. * @param {string} [options.rangeExpression] - 制作分段标签专题的分段字段或字段表达式。
  24424. * @param {boolean} [options.smallGeometryLabeled=false] - 是否显示长度大于被标注对象本身长度的标签。
  24425. * @param {ThemeLabelText} options.text - 标签中文本风格。
  24426. * @param {number} [options.textSpace=0] - 沿线标注,相邻两个文字之间的间距,单位当前设置的字高。
  24427. * @param {ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  24428. * @usage
  24429. */
  24430. class ThemeLabel extends Theme {
  24431. constructor(options) {
  24432. super("LABEL", options);
  24433. /**
  24434. * @member {ThemeLabelAlongLine} [ThemeLabel.prototype.alongLine]
  24435. * @description 标签沿线标注方向样式类。
  24436. * 在该类中可以设置标签是否沿线标注以及沿线标注的多种方式。沿线标注属性只适用于线数据集专题图。
  24437. */
  24438. this.alongLine = new ThemeLabelAlongLine();
  24439. /**
  24440. * @member {ThemeLabelBackground} [ThemeLabel.prototype.background]
  24441. * @description 标签专题图中标签的背景风格类。通过该字段可以设置标签的背景形状和风格。
  24442. */
  24443. this.background = new ThemeLabelBackground();
  24444. /**
  24445. * @member {Array.<ThemeLabelItem>} [ThemeLabel.prototype.items]
  24446. * @description 分段标签专题图的子项数组。分段标签专题图使用 rangeExpression
  24447. * 指定数字型的字段作为分段数据,items 中的每个子对象的 [start,end) 分段值必须来源于属性 rangeExpression 的字段值。每个子项拥有自己的风格。
  24448. */
  24449. this.items = null;
  24450. /**
  24451. * @member {Array.<ThemeLabelUniqueItem>} ThemeLabel.prototype.uniqueItems
  24452. * @description 单值标签专题图子项数组。单值标签专题图使用 uniqueExpression单值标签专题图子项集合。
  24453. */
  24454. this.uniqueItems = null;
  24455. /**
  24456. * @member {string} ThemeLabel.prototype.labelExpression
  24457. * @description 标注字段表达式。系统将 labelExpression 对应的字段或字段表达式的值以标签的形式显示在图层中。
  24458. */
  24459. this.labelExpression = null;
  24460. /**
  24461. * @member {LabelOverLengthMode} [ThemeLabel.prototype.labelOverLengthMode=LabelOverLengthMode.NONE] - 标签专题图中超长标签的处理模式枚举类。
  24462. * @description 对于标签的长度超过设置的标签最大长度 maxLabelLength 时称为超长标签。
  24463. */
  24464. this.labelOverLengthMode = LabelOverLengthMode.NONE;
  24465. /**
  24466. * @member {Array.<LabelImageCell|LabelSymbolCell|LabelThemeCell>} ThemeLabel.prototype.matrixCells
  24467. * @description 矩阵标签元素数组,用于制作矩阵标签专题图。
  24468. * 数组中可以放置符号类型的矩阵标签元素和图片类型的矩阵标签元素。
  24469. */
  24470. this.matrixCells = null;
  24471. /**
  24472. * @member {number} [ThemeLabel.prototype.maxLabelLength=256]
  24473. * @description 标签在每一行显示的最大长度,一个中文为两个字符。
  24474. * 如果超过最大长度,可以采用两种方式来处理,一种是换行的模式进行显示,另一种是以省略号方式显示。单位为字符。
  24475. */
  24476. this.maxLabelLength = 256;
  24477. /**
  24478. * @member {number} [ThemeLabel.prototype.numericPrecision=0]
  24479. * @description 如果显示的标签内容为数字,通过该字段设置其显示的精度。例如标签对应的数字是8071.64529347,
  24480. * 如果该属性为0时,显示8071;为1时,显示8071.6;为3时,则是8071.645。
  24481. */
  24482. this.numericPrecision = 0;
  24483. /**
  24484. * @member {ThemeOffset} [ThemeLabel.prototype.offset]
  24485. * @description 用于设置标签专题图中标记文本相对于要素内点的偏移量对象。
  24486. */
  24487. this.offset = new ThemeOffset();
  24488. /**
  24489. * @member {boolean} [ThemeLabel.prototype.overlapAvoided=true]
  24490. * @description 是否允许以文本避让方式显示文本。true 表示自动避免文本叠盖。只针对该标签专题图层中的文本数据。
  24491. * 在标签重叠度很大的情况下,即使使用自动避让功能,可能也无法完全避免标签重叠现象。
  24492. */
  24493. this.overlapAvoided = true;
  24494. /**
  24495. * @member {string} ThemeLabel.prototype.rangeExpression
  24496. * @description 制作分段标签专题的分段字段或字段表达式。该表达式对应的字段(或者字段表达式)的值应该为数值型。
  24497. * 该字段与 items 分段子项联合使用,每个子项的起始值 [start,end)来源于 rangeExpression 字段值。
  24498. * 最后 labelExpression 指定的标签字段(标签专题图要显示的具体内容)会根据分段子项的风格进行分段显示。
  24499. */
  24500. this.rangeExpression = null;
  24501. /**
  24502. * @member {string} ThemeLabel.prototype.uniqueExpression
  24503. * @description 用于制作单值专题图的字段或字段表达式。
  24504. * 该字段值的数据类型可以为数值型或字符型。如果设置字段表达式,只能是相同数据类型字段间的运算。必须与labelExpression一起使用。
  24505. */
  24506. this.uniqueExpression = null;
  24507. /**
  24508. * @member {boolean} [ThemeLabel.prototype.smallGeometryLabeled=false]
  24509. * @description 是否显示长度大于被标注对象本身长度的标签。在标签的长度大于线或者面对象本身的长度时,
  24510. * 如果该值为 true,则标签文字会叠加在一起显示,为了清楚完整的显示该标签,
  24511. * 可以采用换行模式来显示标签,但必须保证每行的长度小于对象本身的长度。
  24512. */
  24513. this.smallGeometryLabeled = false;
  24514. /**
  24515. * @member {ThemeLabelText} ThemeLabel.prototype.text
  24516. * @description 标签中文本风格。
  24517. */
  24518. this.text = new ThemeLabelText();
  24519. /**
  24520. * @member {number} [ThemeLabel.prototype.textSpace=0]
  24521. * @description 沿线标注,相邻两个文字之间的间距,单位当前设置的字高。
  24522. */
  24523. this.textSpace = 0;
  24524. if (options) {
  24525. Util_Util.extend(this, options);
  24526. }
  24527. this.CLASS_NAME = "SuperMap.ThemeLabel";
  24528. }
  24529. /**
  24530. * @function ThemeLabel.prototype.destroy
  24531. * @override
  24532. */
  24533. destroy() {
  24534. super.destroy();
  24535. var me = this;
  24536. me.alongLine = null;
  24537. if (me.background) {
  24538. me.background.destroy();
  24539. me.background = null;
  24540. }
  24541. if (me.items) {
  24542. for (var i = 0, items = me.items, len = items.length; i < len; i++) {
  24543. items[i].destroy();
  24544. }
  24545. me.items = null;
  24546. }
  24547. if (me.uniqueItems) {
  24548. for (var j = 0, uniqueItems = me.uniqueItems, uniqueLen = uniqueItems.length; j < uniqueLen; j++) {
  24549. uniqueItems[j].destory();
  24550. }
  24551. me.uniqueItems = null;
  24552. }
  24553. me.labelExpression = null;
  24554. me.labelOverLengthMode = null;
  24555. me.matrixCells = null;
  24556. me.maxLabelLength = null;
  24557. me.numericPrecision = null;
  24558. me.overlapAvoided = null;
  24559. me.rangeExpression = null;
  24560. me.uniqueExpression = null;
  24561. if (me.offset) {
  24562. me.offset.destroy();
  24563. me.offset = null;
  24564. }
  24565. me.overlapAvoided = null;
  24566. me.smallGeometryLabeled = null;
  24567. if (me.text) {
  24568. me.text.destroy();
  24569. me.text = null;
  24570. }
  24571. me.textSpace = null;
  24572. }
  24573. /**
  24574. * @function ThemeLabel.prototype.toJSON
  24575. * @description 将themeLabel对象转化为 JSON 字符串。
  24576. * @returns {string} 返回转换后的 JSON 字符串。
  24577. */
  24578. toJSON() {
  24579. return Util_Util.toJSON(this.toServerJSONObject());
  24580. }
  24581. /**
  24582. * @function ThemeLabel.prototype.toServerJSONObject
  24583. * @description 转换成对应的 JSON 格式对象。
  24584. * @returns {Object} 对应的 JSON 格式对象。
  24585. */
  24586. toServerJSONObject() {
  24587. var obj = {};
  24588. obj.type = this.type;
  24589. obj.memoryData = this.memoryData;
  24590. if (this.alongLine) {
  24591. obj.alongLine = this.alongLine.isAlongLine;
  24592. obj.alongLineDirection = this.alongLine.alongLineDirection;
  24593. obj.angleFixed = this.alongLine.angleFixed;
  24594. obj.isLabelRepeated = this.alongLine.isLabelRepeated;
  24595. obj.labelRepeatInterval = this.alongLine.labelRepeatInterval;
  24596. obj.repeatedLabelAvoided = this.alongLine.repeatedLabelAvoided;
  24597. obj.repeatIntervalFixed = this.alongLine.repeatIntervalFixed;
  24598. }
  24599. if (this.offset) {
  24600. obj.offsetFixed = this.offset.offsetFixed;
  24601. obj.offsetX = this.offset.offsetX;
  24602. obj.offsetY = this.offset.offsetY;
  24603. }
  24604. if (this.text) {
  24605. obj.maxTextHeight = this.text.maxTextHeight;
  24606. obj.maxTextWidth = this.text.maxTextWidth;
  24607. obj.minTextHeight = this.text.minTextHeight;
  24608. obj.minTextWidth = this.text.minTextWidth;
  24609. obj.uniformStyle = this.text.uniformStyle;
  24610. obj.uniformMixedStyle = this.text.uniformMixedStyle;
  24611. }
  24612. if (this.background) {
  24613. obj.labelBackShape = this.background.labelBackShape;
  24614. obj.backStyle = this.background.backStyle;
  24615. }
  24616. obj.labelOverLengthMode = this.labelOverLengthMode;
  24617. obj.maxLabelLength = this.maxLabelLength;
  24618. obj.smallGeometryLabeled = this.smallGeometryLabeled;
  24619. obj.rangeExpression = this.rangeExpression;
  24620. obj.uniqueExpression = this.uniqueExpression;
  24621. obj.numericPrecision = this.numericPrecision;
  24622. obj.items = this.items;
  24623. obj.uniqueItems = this.uniqueItems;
  24624. obj.labelExpression = this.labelExpression;
  24625. obj.overlapAvoided = this.overlapAvoided;
  24626. obj.matrixCells = this.matrixCells;
  24627. obj.textSpace = this.textSpace;
  24628. return obj;
  24629. }
  24630. /**
  24631. * @function ThemeLabel.fromObj
  24632. * @description 从传入对象获取标签专题图类。
  24633. * @param {Object} obj - 传入对象。
  24634. * @returns {ThemeLabel} ThemeLabel 对象。
  24635. */
  24636. static fromObj(obj) {
  24637. if (!obj) {
  24638. return;
  24639. }
  24640. var lab = new ThemeLabel();
  24641. var itemsL = obj.items, itemsU = obj.uniqueItems, cells = obj.matrixCells;
  24642. obj.matrixCells = null;
  24643. Util_Util.copy(lab, obj);
  24644. lab.alongLine = ThemeLabelAlongLine.fromObj(obj);
  24645. lab.background = ThemeLabelBackground.fromObj(obj);
  24646. if (itemsL) {
  24647. lab.items = [];
  24648. for (var i = 0, len = itemsL.length; i < len; i++) {
  24649. lab.items.push(ThemeLabelItem.fromObj(itemsL[i]));
  24650. }
  24651. }
  24652. if (itemsU) {
  24653. lab.uniqueItems = [];
  24654. for (let j = 0, uniqueLen = itemsU.length; j < uniqueLen; j++) {
  24655. lab.uniqueItems.push(ThemeUniqueItem.fromObj(itemsU[j]));
  24656. }
  24657. }
  24658. if (cells) {
  24659. lab.matrixCells = [];
  24660. for (let i = 0, len = cells.length; i < len; i++) {
  24661. //TODO
  24662. //lab.matrixCells.push(LabelMatrixCell.fromObj(cells[i]));
  24663. }
  24664. }
  24665. lab.offset = ThemeOffset.fromObj(obj);
  24666. lab.text = ThemeLabelText.fromObj(obj);
  24667. return lab;
  24668. }
  24669. }
  24670. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeUnique.js
  24671. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  24672. * This program are made available under the terms of the Apache License, Version 2.0
  24673. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24674. /**
  24675. * @class ThemeUnique
  24676. * @deprecatedclass SuperMap.ThemeUnique
  24677. * @category iServer Map Theme
  24678. * @classdesc 单值专题图。单值专题图是利用不同的颜色或符号(线型、填充)表示图层中某一属性信息的不同属性值,属性值相同的要素具有相同的渲染风格。单值专题图多用于具有分类属性的地图上,
  24679. * 比如土壤类型分布图、土地利用图、行政区划图等。单值专题图着重表示现象质的差别,一般不表示数量的特征。尤其是有交叉或重叠现象时,此类不推荐使用,例如:民族分布区等。
  24680. * @extends {CommonTheme}
  24681. * @param {Object} options - 参数。
  24682. * @param {Array.<ThemeUniqueItem>} options.items - 子项类数组。
  24683. * @param {string} options.uniqueExpression - 指定单值专题图的字段或字段表达式。
  24684. * @param {ServerStyle} [options.defaultStyle] - 未参与单值专题图制作的对象的显示风格。
  24685. * @param {ColorGradientType} [options.colorGradientType=ColorGradientType.YELLOW_RED] - 渐变颜色枚举类。
  24686. * @param {ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  24687. * @usage
  24688. */
  24689. class ThemeUnique extends Theme {
  24690. constructor(options) {
  24691. super("UNIQUE", options);
  24692. /**
  24693. * @member {ServerStyle} ThemeUnique.prototype.defaultStyle
  24694. * @description 未参与单值专题图制作的对象的显示风格。
  24695. * 通过单值专题图子项数组 (items)可以指定某些要素参与单值专题图制作,对于那些没有被包含的要素,即不参加单值专题表达的要素,使用该风格显示。
  24696. */
  24697. this.defaultStyle = new ServerStyle();
  24698. /**
  24699. * @member {Array.<ThemeUniqueItem>} ThemeUnique.prototype.items
  24700. * @description 单值专题图子项类数组。
  24701. * 单值专题图是将专题值相同的要素归为一类,为每一类设定一种渲染风格,其中每一类就是一个专题图子项。比如,利用单值专题图制作行政区划图,
  24702. * Name 字段代表省/直辖市名,该字段用来做专题变量,如果该字段的字段值总共有5种不同值,则该行政区划图有 5 个专题图子项。
  24703. */
  24704. this.items = null;
  24705. /**
  24706. * @member {string} ThemeUnique.prototype.uniqueExpression
  24707. * @description 用于制作单值专题图的字段或字段表达式。
  24708. * 该字段值的数据类型可以为数值型或字符型。如果设置字段表达式,只能是相同数据类型字段间的运算。
  24709. */
  24710. this.uniqueExpression = null;
  24711. /**
  24712. * @member {ColorGradientType} [ThemeUnique.prototype.colorGradientType=ColorGradientType.YELLOW_RED]
  24713. * @description 渐变颜色枚举类。
  24714. * 渐变色是由起始色根据一定算法逐渐过渡到终止色的一种混合型颜色。
  24715. * 该类作为单值专题图参数类、分段专题图参数类的属性,负责设置单值专题图、分段专题图的配色方案,在默认情况下专题图所有子项会根据这个配色方案完成填充。
  24716. * 但如果为某几个子项的风格进行单独设置后(设置了 ThemeUniqueItem 或 ThemeRangeItem 类中Style属性),
  24717. * 该配色方案对于这几个子项将不起作用。
  24718. */
  24719. this.colorGradientType = ColorGradientType.YELLOW_RED;
  24720. if (options) {
  24721. Util_Util.extend(this, options);
  24722. }
  24723. this.CLASS_NAME = "SuperMap.ThemeUnique";
  24724. }
  24725. /**
  24726. * @function ThemeUnique.prototype.destroy
  24727. * @override
  24728. */
  24729. destroy() {
  24730. super.destroy();
  24731. var me = this;
  24732. me.uniqueExpression = null;
  24733. me.colorGradientType = null;
  24734. if (me.items) {
  24735. if (me.items.length > 0) {
  24736. for (var item in me.items) {
  24737. me.items[item].destroy();
  24738. me.items[item] = null;
  24739. }
  24740. }
  24741. me.items = null;
  24742. }
  24743. if (me.defaultStyle) {
  24744. me.defaultStyle.destroy();
  24745. me.defaultStyle = null;
  24746. }
  24747. }
  24748. /**
  24749. * @function ThemeUnique.prototype.toServerJSONObject
  24750. * @description 转换成对应的 JSON 格式对象。
  24751. * @returns {Object} 对应的 JSON 格式对象。
  24752. */
  24753. toServerJSONObject() {
  24754. var obj = {};
  24755. obj = Util_Util.copyAttributes(obj, this);
  24756. if (obj.defaultStyle) {
  24757. if (obj.defaultStyle.toServerJSONObject) {
  24758. obj.defaultStyle = obj.defaultStyle.toServerJSONObject();
  24759. }
  24760. }
  24761. if (obj.items) {
  24762. var items = [],
  24763. len = obj.items.length;
  24764. for (var i = 0; i < len; i++) {
  24765. items.push(obj.items[i].toServerJSONObject());
  24766. }
  24767. obj.items = items;
  24768. }
  24769. return obj;
  24770. }
  24771. /**
  24772. * @function ThemeUnique.fromObj
  24773. * @description 从传入对象获取单值专题图类。
  24774. * @param {Object} obj - 传入对象。
  24775. * @returns {ThemeUnique} ThemeUnique 对象。
  24776. */
  24777. static fromObj(obj) {
  24778. var res = new ThemeUnique();
  24779. var uItems = obj.items;
  24780. var len = uItems ? uItems.length : 0;
  24781. Util_Util.extend(res, obj);
  24782. res.items = [];
  24783. res.defaultStyle = ServerStyle.fromJson(obj.defaultStyle);
  24784. for (var i = 0; i < len; i++) {
  24785. res.items.push(ThemeUniqueItem.fromObj(uItems[i]));
  24786. }
  24787. return res;
  24788. }
  24789. }
  24790. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraphAxes.js
  24791. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  24792. * This program are made available under the terms of the Apache License, Version 2.0
  24793. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24794. /**
  24795. * @class ThemeGraphAxes
  24796. * @deprecatedclass SuperMap.ThemeGraphAxes
  24797. * @category iServer Map Theme
  24798. * @classdesc 统计专题图坐标轴样式类。
  24799. * @param {Object} options - 参数。
  24800. * @param {ServerColor} [options.axesColor=(0, 0, 0)] - 坐标轴颜色。
  24801. * @param {boolean} [options.axesDisplayed=false] - 是否显示坐标轴。
  24802. * @param {boolean} [options.axesGridDisplayed=false] - 是否在统计图坐标轴上显示网格。
  24803. * @param {boolean} [options.axesTextDisplayed=false] - 是否显示坐标轴的文本标注。
  24804. * @param {ServerTextStyle} [options.axesTextStyle] - 统计符号的最大最小尺寸。
  24805. * @usage
  24806. */
  24807. class ThemeGraphAxes {
  24808. constructor(options) {
  24809. /**
  24810. * @member {ServerColor} [ThemeGraphAxes.prototype.axesColor=(0, 0, 0)]
  24811. * @description 坐标轴颜色。当 axesDisplayed = true 时有效。
  24812. */
  24813. this.axesColor = new ServerColor(0, 0, 0);
  24814. /**
  24815. * @member {boolean} [ThemeGraphAxes.prototype.axesDisplayed=false]
  24816. * @description 是否显示坐标轴。<br>
  24817. * 由于饼状图和环状图无坐标轴,故该属性以及所有与坐标轴设置相关的属性都不适用于它们。并且只有当该值为 true 时,其它设置坐标轴的属性才起作用。
  24818. */
  24819. this.axesDisplayed = false;
  24820. /**
  24821. * @member {boolean} [ThemeGraphAxes.prototype.axesGridDisplayed=false]
  24822. * @description 是否在统计图坐标轴上显示网格。
  24823. */
  24824. this.axesGridDisplayed = false;
  24825. /**
  24826. * @member {boolean} [ThemeGraphAxes.prototype.axesTextDisplayed=false]
  24827. * @description 是否显示坐标轴的文本标注。
  24828. */
  24829. this.axesTextDisplayed = false;
  24830. /**
  24831. * @member {ServerTextStyle} ThemeGraphAxes.prototype.axesTextStyle
  24832. * @description 坐标轴文本风格。当 axesTextDisplayed = true 时有效。
  24833. */
  24834. this.axesTextStyle = new ServerTextStyle();
  24835. if (options) {
  24836. Util_Util.extend(this, options);
  24837. }
  24838. this.CLASS_NAME = "SuperMap.ThemeGraphAxes";
  24839. }
  24840. /**
  24841. * @function ThemeGraphAxes.prototype.destroy
  24842. * @description 释放资源,将引用资源的属性置空。
  24843. */
  24844. destroy() {
  24845. var me = this;
  24846. if (me.axesColor) {
  24847. me.axesColor.destroy();
  24848. me.axesColor = null;
  24849. }
  24850. me.axesDisplayed = null;
  24851. me.axesGridDisplayed = null;
  24852. me.axesTextDisplayed = null;
  24853. if (me.axesTextStyle) {
  24854. me.axesTextStyle.destroy();
  24855. me.axesTextStyle = null;
  24856. }
  24857. }
  24858. /**
  24859. * @function ThemeGraphAxes.fromObj
  24860. * @description 从传入对象获取统计专题图坐标轴样式类。
  24861. * @param {Object} obj - 传入对象。
  24862. * @returns {ThemeGraphAxes} ThemeGraphAxes 对象。
  24863. */
  24864. static fromObj(obj) {
  24865. if (!obj) {
  24866. return;
  24867. }
  24868. var res = new ThemeGraphAxes();
  24869. Util_Util.copy(res, obj);
  24870. res.axesColor = ServerColor.fromJson(obj.axesColor);
  24871. res.axesTextStyle = ServerTextStyle.fromObj(obj.axesTextStyle);
  24872. return res;
  24873. }
  24874. }
  24875. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraphSize.js
  24876. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  24877. * This program are made available under the terms of the Apache License, Version 2.0
  24878. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24879. /**
  24880. * @class ThemeGraphSize
  24881. * @deprecatedclass SuperMap.ThemeGraphSize
  24882. * @category iServer Map Theme
  24883. * @classdesc 统计专题图符号尺寸类。
  24884. * @param {Object} options - 参数。
  24885. * @param {number} [options.maxGraphSize=0] - 统计图中显示的最大图表尺寸基准值。
  24886. * @param {number} [options.minGraphSize=0] - 统计图中显示的最小图表尺寸基准值。
  24887. * @usage
  24888. */
  24889. class ThemeGraphSize {
  24890. constructor(options) {
  24891. /**
  24892. * @member {number} [ThemeGraphSize.prototype.maxGraphSize=0]
  24893. * @description 获取或设置统计图中显示的最大图表尺寸基准值,单位为像素。
  24894. */
  24895. this.maxGraphSize = 0;
  24896. /**
  24897. * @member {number} [ThemeGraphSize.prototype.minGraphSize=0]
  24898. * @description 获取或设置统计图中显示的最小图表尺寸基准值,单位为像素。
  24899. */
  24900. this.minGraphSize = 0;
  24901. if (options) {
  24902. Util_Util.extend(this, options);
  24903. }
  24904. this.CLASS_NAME = "SuperMap.ThemeGraphSize";
  24905. }
  24906. /**
  24907. * @function ThemeGraphSize.prototype.destroy
  24908. * @description 释放资源,将引用资源的属性置空。
  24909. */
  24910. destroy() {
  24911. var me = this;
  24912. me.maxGraphSize = null;
  24913. me.minGraphSize = null;
  24914. }
  24915. /**
  24916. * @function ThemeGraphSize.fromObj
  24917. * @description 从传入对象获统计专题图符号尺寸类。
  24918. * @param {Object} obj - 传入对象。
  24919. * @returns {ThemeGraphSize} ThemeGraphSize 对象。
  24920. */
  24921. static fromObj(obj) {
  24922. var res = new ThemeGraphSize();
  24923. Util_Util.copy(res, obj);
  24924. return res;
  24925. }
  24926. }
  24927. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraphText.js
  24928. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  24929. * This program are made available under the terms of the Apache License, Version 2.0
  24930. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24931. /**
  24932. * @class ThemeGraphText
  24933. * @deprecatedclass SuperMap.ThemeGraphText
  24934. * @category iServer Map Theme
  24935. * @classdesc 统计图文字标注风格类。
  24936. * @param {Object} options - 可选参数。
  24937. * @param {boolean} [options.graphTextDisplayed=false] - 是否显示统计图上的文字标注。
  24938. * @param {ThemeGraphTextFormat} [options.graphTextFormat=ThemeGraphTextFormat.CAPTION] - 统计专题图文本显示格式。
  24939. * @param {ServerTextStyle} [options.graphTextStyle] - 统计图上的文字标注风格。
  24940. * @usage
  24941. */
  24942. class ThemeGraphText {
  24943. constructor(options) {
  24944. /**
  24945. * @member {boolean} [ThemeGraphText.prototype.graphTextDisplayed=false]
  24946. * @description 是否显示统计图上的文字标注。
  24947. */
  24948. this.graphTextDisplayed = false;
  24949. /**
  24950. * @member {ThemeGraphTextFormat} [ThemeGraphText.prototype.graphTextFormat=ThemeGraphTextFormat.CAPTION]
  24951. * @description 统计专题图文本显示格式。
  24952. * 文本显示格式包括百分数、真实数值、标题、标题+百分数、标题+真实数值。
  24953. */
  24954. this.graphTextFormat = ThemeGraphTextFormat.CAPTION;
  24955. /**
  24956. * @member {ServerTextStyle} ThemeGraphText.prototype.graphTextStyle
  24957. * @description 统计图上的文字标注风格。
  24958. */
  24959. this.graphTextStyle = new ServerTextStyle();
  24960. if (options) {
  24961. Util_Util.extend(this, options);
  24962. }
  24963. this.CLASS_NAME = "SuperMap.ThemeGraphText";
  24964. }
  24965. /**
  24966. * @function ThemeGraphText.prototype.destroy
  24967. * @description 释放资源,将引用资源的属性置空。
  24968. */
  24969. destroy() {
  24970. var me = this;
  24971. me.graphTextDisplayed = null;
  24972. me.graphTextFormat = null;
  24973. if (me.graphTextStyle) {
  24974. me.graphTextStyle.destroy();
  24975. me.graphTextStyle = null;
  24976. }
  24977. }
  24978. /**
  24979. * @function ThemeGraphText.fromObj
  24980. * @description 从传入对象获取统计图文字标注风格类。
  24981. * @param {Object} obj - 传入对象。
  24982. * @returns {ThemeGraphText} ThemeGraphText 对象。
  24983. */
  24984. static fromObj(obj) {
  24985. var res = new ThemeGraphText();
  24986. Util_Util.copy(res, obj);
  24987. res.graphTextStyle = ServerTextStyle.fromObj(obj.graphTextStyle);
  24988. return res;
  24989. }
  24990. }
  24991. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraphItem.js
  24992. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  24993. * This program are made available under the terms of the Apache License, Version 2.0
  24994. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24995. /**
  24996. * @class ThemeGraphItem
  24997. * @deprecatedclass SuperMap.ThemeGraphItem
  24998. * @category iServer Map Theme
  24999. * @classdesc 统计专题图子项类。
  25000. * @param {Object} options - 参数。
  25001. * @param {string} [options.caption] - 专题图子项的名称。
  25002. * @param {string} options.graphExpression - 统计专题图的专题变量。
  25003. * @param {Array.<number>} [options.memoryDoubleValues] - 内存数组方式制作专题图时的值数组。
  25004. * @param {ServerStyle} [options.uniformStyle] - 统计专题图子项的显示风格。
  25005. * @usage
  25006. */
  25007. class ThemeGraphItem {
  25008. constructor(options) {
  25009. /**
  25010. * @member {string} [ThemeGraphItem.prototype.caption]
  25011. * @description 专题图子项的名称。
  25012. */
  25013. this.caption = null;
  25014. /**
  25015. * @member {string} ThemeGraphItem.prototype.graphExpression
  25016. * @description 统计专题图的专题变量。专题变量可以是一个字段或字段表达式。字段必须为数值型;表达式只能为数值型的字段间的运算。
  25017. */
  25018. this.graphExpression = null;
  25019. /**
  25020. * @member {Array.<number>} [ThemeGraphItem.prototype.memoryDoubleValues]
  25021. * @description 内存数组方式制作专题图时的值数组。<br>
  25022. * 内存数组方式制作专题图时,只对 SmID 值在键数组({@link ThemeGraph#memoryKeys})中的记录制作专题图。
  25023. * 值数组的数值个数必须与键数组中数值的个数一致。值数组中的值将代替原来的专题值来制作统计专题图。
  25024. * 比如:利用面积字段和周长字段(即有两个统计专题图子项 )作为专题变量制作统计专题图。
  25025. */
  25026. this.memoryDoubleValues = null;
  25027. /**
  25028. * @member {ServerStyle} [ThemeGraphItem.prototype.uniformStyle]
  25029. * @description 统计专题图子项的显示风格。
  25030. * 每一个统计专题图子项都对应一种显示风格。
  25031. */
  25032. this.uniformStyle = new ServerStyle();
  25033. if (options) {
  25034. Util_Util.extend(this, options);
  25035. }
  25036. this.CLASS_NAME = "SuperMap.ThemeGraphItem";
  25037. }
  25038. /**
  25039. * @function ThemeGraphItem.prototype.destroy
  25040. * @description 释放资源,将引用资源的属性置空。
  25041. */
  25042. destroy() {
  25043. var me = this;
  25044. me.caption = null;
  25045. me.graphExpression = null;
  25046. me.memoryDoubleValues = null;
  25047. me.uniformStyle = null;
  25048. }
  25049. /**
  25050. * @function ThemeGraphItem.fromObj
  25051. * @description 从传入对象获取统计专题图子项类。
  25052. * @param {Object} obj - 传入对象。
  25053. * @returns {ThemeGraphItem} ThemeGraphItem 对象。
  25054. */
  25055. static fromObj(obj) {
  25056. if (!obj) {
  25057. return;
  25058. }
  25059. var res = new ThemeGraphItem();
  25060. Util_Util.copy(res, obj);
  25061. res.uniformStyle = ServerStyle.fromJson(obj.uniformStyle);
  25062. return res;
  25063. }
  25064. }
  25065. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraph.js
  25066. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  25067. * This program are made available under the terms of the Apache License, Version 2.0
  25068. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25069. /**
  25070. * @class ThemeGraph
  25071. * @deprecatedclass SuperMap.ThemeGraph
  25072. * @category iServer Map Theme
  25073. * @classdesc 统计专题图类。
  25074. * @extends {CommonTheme}
  25075. * @param {Object} options - 参数。
  25076. * @param {Array.<ThemeGraphItem>} options.items - 统计专题图子项集合。
  25077. * @param {number} [options.barWidth=0] - 柱状专题图中每一个柱的宽度。
  25078. * @param {GraduatedMode} [options.graduatedMode=GraduatedMode.CONSTANT] - 统计图中地理要素的值与图表尺寸间的映射关系。
  25079. * @param {ThemeGraphAxes} [options.graphAxes] - 统计图中坐标轴样式相关信息。
  25080. * @param {ThemeGraphSize} [options.graphSize=0] - 统计符号的最大最小尺寸。
  25081. * @param {boolean} [options.graphSizeFixed=false] - 缩放地图时统计图符号是否固定大小。
  25082. * @param {ThemeGraphText} [options.graphText] - 统计图上的文字是否可见以及文字标注风格。
  25083. * @param {GraphAxesTextDisplayMode} [options.graphAxesTextDisplayMode=GraphAxesTextDisplayMode.NONE] - 统计专题图坐标轴文本显示模式。
  25084. * @param {ThemeGraphType} [options.graphType=ThemeGraphType.AREA] - 统计专题图类型。
  25085. * @param {Array.<number>} [options.memoryKeys] - 以内存数组方式制作专题图时的键数组。
  25086. * @param {boolean} [options.negativeDisplayed=false] - 专题图中是否显示属性为负值的数据。
  25087. * @param {ThemeOffset} [options.offset] - 统计图相对于要素内点的偏移量。
  25088. * @param {boolean} [options.overlapAvoided=true] - 统计图是否采用避让方式显示。
  25089. * @param {number} [options.roseAngle=0] - 统计图中玫瑰图或三维玫瑰图用于等分的角度。
  25090. * @param {number} [options.startAngle=0] - 饼状统计图扇形的起始角度。
  25091. * @usage
  25092. */
  25093. class ThemeGraph extends Theme {
  25094. constructor(options) {
  25095. super("GRAPH", options);
  25096. /**
  25097. * @member {number} [ThemeGraph.prototype.barWidth=0]
  25098. * @description 柱状专题图中每一个柱的宽度。使用地图坐标单位。
  25099. * 只有选择的统计图类型为柱状图(柱状图、三维柱状图、堆叠柱状图、三维堆叠柱状图)时,此项才可设置。
  25100. */
  25101. this.barWidth = 0;
  25102. /**
  25103. * @member {GraduatedMode} [ThemeGraph.prototype.graduatedMode=GraduatedMode.CONSTANT]
  25104. * @description 统计图中地理要素的值与图表尺寸间的映射关系(常数、对数、平方根),即分级方式。
  25105. * 分级主要是为了减少制作统计专题图中数据大小之间的差异,使得统计图的视觉效果比较好,同时不同类别之间的比较也还是有意义的。
  25106. * 提供三种分级模式:常数、对数和平方根,对于有值为负数的字段,不可以采用对数和平方根的分级方式。不同的等级方式用于确定符号大小的数值是不相同的。
  25107. */
  25108. this.graduatedMode = GraduatedMode.CONSTANT;
  25109. /**
  25110. * @member {ThemeGraphAxes} ThemeGraph.prototype.graphAxes
  25111. * @description 用于设置统计图中坐标轴样式相关信息,如坐标轴颜色、是否显示、坐标文本样式等。
  25112. */
  25113. this.graphAxes = new ThemeGraphAxes();
  25114. /**
  25115. * @member {ThemeGraphSize} [ThemeGraph.prototype.graphSize=0]
  25116. * @description 用于设置统计符号的最大最小尺寸。
  25117. */
  25118. this.graphSize = new ThemeGraphSize();
  25119. /**
  25120. * @member {boolean} [ThemeGraph.prototype.graphSizeFixed=false]
  25121. * @description 缩放地图时统计图符号是否固定大小。即统计图符号将随地图缩放。
  25122. */
  25123. this.graphSizeFixed = false;
  25124. /**
  25125. * @member {ThemeGraphText} ThemeGraph.prototype.graphText
  25126. * @description 统计图上的文字是否可见以及文字标注风格。
  25127. */
  25128. this.graphText = new ThemeGraphText();
  25129. /**
  25130. * @member {ThemeGraphType} [ThemeGraph.prototype.graphType=ThemeGraphType.AREA]
  25131. * @description 统计专题图类型。SuperMap 提供了多种类型的统计图,
  25132. * 分别为面积图、阶梯图、折线图、点状图、柱状图、三维柱状图、饼图、三维饼图、玫瑰图、三维玫瑰图、堆叠柱状图、三维堆叠柱状图、环状图。默认为面积图。
  25133. */
  25134. this.graphType = ThemeGraphType.AREA;
  25135. /**
  25136. * @member {GraphAxesTextDisplayMode} [ThemeGraph.prototype.graphAxesTextDisplayMode=GraphAxesTextDisplayMode.NONE]
  25137. * @description 统计专题图坐标轴文本显示模式。
  25138. */
  25139. this.graphAxesTextDisplayMode = GraphAxesTextDisplayMode.NONE;
  25140. /**
  25141. * @member {Array.<ThemeGraphItem>} ThemeGraph.prototype.items
  25142. * @description 统计专题图子项集合。
  25143. * 统计专题图可以基于多个变量,反映多种属性,即可以将多个专题变量的值绘制在一个统计图上。每一个专题变量对应的统计图即为一个专题图子项。
  25144. * 对于每个专题图子项可以为其设置标题、风格,甚至可以将该子项再制作成范围分段专题图。
  25145. */
  25146. this.items = null;
  25147. /**
  25148. * @member {Array.<number>} ThemeGraph.prototype.memoryKeys
  25149. * @description 以内存数组方式制作专题图时的键数组。
  25150. * 键数组内的数值代表 SmID 值,它与 {@link ThemeGraphItem} 类中的值数组({@link ThemeGraphItem#memoryDoubleValues})要关联起来应用。
  25151. * 键数组中数值的个数必须要与值数组的数值个数一致。值数组中的值将代替原来的专题值来制作统计专题图。
  25152. * 目前所有的专题图都支持以内存数组的方式制作专题图,但统计专题图与其他专题图指定内存数组的方式不同,
  25153. * 统计专题图使用 memoryKeys 指定内存数组,而其他专题图则使用 memoryData 来指定内存数组。
  25154. * @example
  25155. * memoryKeys 的使用方法如下:
  25156. * function addThemeGraph() {
  25157. * removeTheme();
  25158. * //创建统计专题图对象,ThemeGraph 必设 items。
  25159. * //专题图参数 ThemeParameters 必设 theme(即以设置好的分段专题图对象)、dataSourceName 和 datasetName
  25160. * var style1 = new ServerStyle({
  25161. * fillForeColor: new ServerColor(92,73,234),
  25162. * lineWidth: 0.1
  25163. * }),
  25164. * style2 = new ServerStyle({
  25165. * fillForeColor: new ServerColor(211,111,240),
  25166. * lineWidth: 0.1
  25167. * }),
  25168. * item1 = new ThemeGraphItem({
  25169. * memoryDoubleValues:[1.18,0.95,0.37,1.31,0.8,1.5],
  25170. * caption: "1992-1995人口增长率",
  25171. * graphExpression: "Pop_Rate95",
  25172. * uniformStyle: style1
  25173. * }),
  25174. * item2 = new ThemeGraphItem({
  25175. * //以内存数组方式制作专题图时的值数组
  25176. * memoryDoubleValues:[2.71,0,0.74,3.1,2.2,3.5],
  25177. * caption: "1995-1999人口增长率", //专题图子项的名称
  25178. * graphExpression: "Pop_Rate99", //统计专题图的专题变量
  25179. * uniformStyle: style2 //统计专题图子项的显示风格
  25180. * }),
  25181. * themeGraph = new ThemeGraph({
  25182. * //以内存数组方式制作专题图时的键数组,键数组内的数值代表 SmID 值
  25183. * memoryKeys:[1,2,4,8,10,12],
  25184. * items: new Array(item1,item2),
  25185. * barWidth: 0.03,
  25186. * //统计图中地理要素的值与图表尺寸间的映射关系为平方根
  25187. * graduatedMode: GraduatedMode.SQUAREROOT,
  25188. * //graphAxes用于设置统计图中坐标轴样式相关信息
  25189. * graphAxes: new ThemeGraphAxes({
  25190. * axesDisplayed: true
  25191. * }),
  25192. * graphSize: new ThemeGraphSize({
  25193. * maxGraphSize: 1,
  25194. * minGraphSize: 0.35
  25195. * }),
  25196. * //统计图上的文字是否可见以及文字标注风格
  25197. * graphText: new ThemeGraphText({
  25198. * graphTextDisplayed: true,
  25199. * graphTextFormat: ThemeGraphTextFormat.VALUE,
  25200. * graphTextStyle: new ServerTextStyle({
  25201. * sizeFixed: true,
  25202. * fontHeight: 9,
  25203. * fontWidth: 5
  25204. * })
  25205. * }),
  25206. * //统计专题图类型为三维柱状图
  25207. * graphType: ThemeGraphType.BAR3D
  25208. * }),
  25209. * //专题图参数对象
  25210. * themeParameters = new ThemeParameters({
  25211. * themes: [themeGraph],
  25212. * dataSourceNames: ["Jingjin"],
  25213. * datasetNames: ["BaseMap_R"]
  25214. * }),
  25215. * //与服务端交互
  25216. * themeService=new ThemeService(url, {
  25217. * eventListeners: {
  25218. * "processCompleted": ThemeCompleted,
  25219. * "processFailed": themeFailed
  25220. * }
  25221. * });
  25222. * themeService.processAsync(themeParameters);
  25223. * }
  25224. */
  25225. this.memoryKeys = null;
  25226. /**
  25227. * @member {boolean} [ThemeGraph.prototype.negativeDisplayed=false]
  25228. * @description 专题图中是否显示属性为负值的数据。true 表示显示;false 不显示。
  25229. */
  25230. this.negativeDisplayed = false;
  25231. /**
  25232. * @member {ThemeOffset} ThemeGraph.prototype.offset
  25233. * @description 用于设置统计图相对于要素内点的偏移量。
  25234. */
  25235. this.offset = new ThemeOffset();
  25236. /**
  25237. * @member {boolean} ThemeGraph.prototype.overlapAvoided
  25238. * @description 统计图是否采用避让方式显示。<br>
  25239. * 1.对数据集制作统计专题图:当统计图采用避让方式显示时,如果 overlapAvoided 为 true,则在统计图重叠度很大的情况下,
  25240. * 会出现无法完全避免统计图重叠的现象;如果 overlapAvoided 为 false,会过滤掉一些统计图,从而保证所有的统计图均不重叠。<br>
  25241. * 2.对数据集同时制作统计专题图和标签专题图:当统计图不显示子项文本时,标签专题图的标签即使和统计图重叠,两者也都可正常显示;
  25242. * 当统计图显示子项文本时,如果统计图中的子项文本和标签专题图中的标签不重叠,则两者均正常显示;如果重叠,则会过滤掉统计图的子项文本,只显示标签。
  25243. */
  25244. this.overlapAvoided = true;
  25245. /**
  25246. * @member {number} [ThemeGraph.prototype.roseAngle=0]
  25247. * @description 统计图中玫瑰图或三维玫瑰图用于等分的角度,默认为 0 度,精确到 0.1 度。在角度为0或者大于 360 度的情况下均使用 360 度来等分制作统计图的字段数。
  25248. */
  25249. this.roseAngle = 0;
  25250. /**
  25251. * @member {number} [ThemeGraph.prototype.startAngle=0]
  25252. * @description 饼状统计图扇形的起始角度。精确到 0.1 度,以水平方向为正向。只有选择的统计图类型为饼状图(饼图、三维饼图、玫瑰图、三维玫瑰图)时,此项才可设置。
  25253. */
  25254. this.startAngle = 0;
  25255. if (options) {
  25256. Util_Util.extend(this, options);
  25257. }
  25258. this.CLASS_NAME = "SuperMap.ThemeGraph";
  25259. }
  25260. /**
  25261. * @function ThemeGraph.prototype.destroy
  25262. * @override
  25263. */
  25264. destroy() {
  25265. super.destroy();
  25266. var me = this;
  25267. me.barWidth = null;
  25268. me.graduatedMode = null;
  25269. if (me.graphAxes) {
  25270. me.graphAxes.destroy();
  25271. me.graphAxes = null;
  25272. }
  25273. if (me.graphSize) {
  25274. me.graphSize.destroy();
  25275. me.graphSize = null;
  25276. }
  25277. me.graphSizeFixed = null;
  25278. if (me.graphText) {
  25279. me.graphText.destroy();
  25280. me.graphText = null;
  25281. }
  25282. me.graphType = null;
  25283. if (me.items) {
  25284. for (var i = 0, items = me.items, len = items.length; i < len; i++) {
  25285. items[i].destroy();
  25286. }
  25287. me.items = null;
  25288. }
  25289. me.memoryKeys = null;
  25290. me.negativeDisplayed = null;
  25291. if (me.offset) {
  25292. me.offset.destroy();
  25293. me.offset = null;
  25294. }
  25295. me.overlapAvoided = null;
  25296. me.roseAngle = null;
  25297. me.startAngle = null;
  25298. me.graphAxesTextDisplayMode = null;
  25299. }
  25300. /**
  25301. * @function ThemeGraph.prototype.toJSON
  25302. * @description 将 ThemeGraph 对象转化为 JSON 字符串。
  25303. * @returns {string} 返回转换后的 JSON 字符串。
  25304. */
  25305. toJSON() {
  25306. return Util_Util.toJSON(this.toServerJSONObject());
  25307. }
  25308. /**
  25309. * @function ThemeGraph.prototype.toServerJSONObject
  25310. * @description 转换成对应的 JSON 格式对象。
  25311. * @returns {Object} 对应的 JSON 格式对象。
  25312. */
  25313. toServerJSONObject() {
  25314. var obj = {};
  25315. obj.type = this.type;
  25316. if (this.graphText) {
  25317. obj.graphTextDisplayed = this.graphText.graphTextDisplayed;
  25318. obj.graphTextFormat = this.graphText.graphTextFormat;
  25319. obj.graphTextStyle = this.graphText.graphTextStyle;
  25320. }
  25321. if (this.graphAxes) {
  25322. obj.axesColor = this.graphAxes.axesColor;
  25323. obj.axesDisplayed = this.graphAxes.axesDisplayed;
  25324. obj.axesGridDisplayed = this.graphAxes.axesGridDisplayed;
  25325. obj.axesTextDisplayed = this.graphAxes.axesTextDisplayed;
  25326. obj.axesTextStyle = this.graphAxes.axesTextStyle;
  25327. }
  25328. if (this.graphSize) {
  25329. obj.maxGraphSize = this.graphSize.maxGraphSize;
  25330. obj.minGraphSize = this.graphSize.minGraphSize;
  25331. }
  25332. if (this.offset) {
  25333. obj.offsetFixed = this.offset.offsetFixed;
  25334. obj.offsetX = this.offset.offsetX;
  25335. obj.offsetY = this.offset.offsetY;
  25336. }
  25337. obj.barWidth = this.barWidth;
  25338. obj.graduatedMode = this.graduatedMode;
  25339. obj.graphSizeFixed = this.graphSizeFixed;
  25340. obj.graphType = this.graphType;
  25341. obj.graphAxesTextDisplayMode = this.graphAxesTextDisplayMode;
  25342. obj.items = this.items;
  25343. obj.memoryKeys = this.memoryKeys;
  25344. obj.negativeDisplayed = this.negativeDisplayed;
  25345. obj.overlapAvoided = this.overlapAvoided;
  25346. obj.roseAngle = this.roseAngle;
  25347. obj.startAngle = this.startAngle;
  25348. return obj;
  25349. }
  25350. /**
  25351. * @function ThemeGraph.fromObj
  25352. * @description 从传入对象获取统计专题图类。
  25353. * @param {Object} obj - 传入对象。
  25354. * @returns {ThemeGraph} ThemeGraph 对象。
  25355. */
  25356. static fromObj(obj) {
  25357. var res = new ThemeGraph();
  25358. var itemsG = obj.items;
  25359. var len = itemsG ? itemsG.length : 0;
  25360. Util_Util.copy(res, obj);
  25361. res.items = [];
  25362. res.graphAxes = ThemeGraphAxes.fromObj(obj);
  25363. res.graphSize = ThemeGraphSize.fromObj(obj);
  25364. res.graphText = ThemeGraphText.fromObj(obj);
  25365. res.offset = ThemeOffset.fromObj(obj);
  25366. for (var i = 0; i < len; i++) {
  25367. res.items.push(ThemeGraphItem.fromObj(itemsG[i]));
  25368. }
  25369. return res;
  25370. }
  25371. }
  25372. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeDotDensity.js
  25373. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  25374. * This program are made available under the terms of the Apache License, Version 2.0
  25375. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25376. /**
  25377. * @class ThemeDotDensity
  25378. * @deprecatedclass SuperMap.ThemeDotDensity
  25379. * @category iServer Map Theme
  25380. * @classdesc 点密度专题图。点密度专题图用一定大小、形状相同的点表示现象分布范围、数量特征和分布密度。点的多少和所代表的意义由地图的内容确定。
  25381. * 点密度专题图利用图层的某一数值属性信息(专题值)映射为不同等级,每一级别使用不同数量或表现为密度的点符号来表示。
  25382. * 该专题值在各个分区内的分布情况,体现不同区域的相对数量差异。多用于具有数量特征的地图上,
  25383. * 比如表示不同地区的粮食产量、GDP、人口等的分级,主要针对区域或面状的要素,因而,点密度专题图适用于面数据集。
  25384. * 注意:点密度专题图中点的分布是随机的,并不代表实际的分布位置。即使在相关设置完全相同的情况下,
  25385. * 每次制作出的专题图,点的数量相同,但点的位置都有差异。
  25386. * @extends {CommonTheme}
  25387. * @param {Object} options - 参数。
  25388. * @param {string} options.dotExpression - 创建点密度专题图的字段或字段表达式。
  25389. * @param {ServerStyle} [options.style] - 点密度专题图中点的风格。
  25390. * @param {number} [options.value] - 专题图中每一个点所代表的数值。
  25391. * @param {ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  25392. * @usage
  25393. */
  25394. class ThemeDotDensity extends Theme {
  25395. constructor(options) {
  25396. super("DOTDENSITY", options);
  25397. /**
  25398. * @member {string} ThemeDotDensity.prototype.dotExpression
  25399. * @description 创建点密度专题图的字段或字段表达式。点的数目或密集程度的来源。
  25400. */
  25401. this.dotExpression = null;
  25402. /**
  25403. * @member {ServerStyle} ThemeDotDensity.prototype.style
  25404. * @description 点密度专题图中点的风格。
  25405. */
  25406. this.style = new ServerStyle();
  25407. /**
  25408. * @member {number} ThemeDotDensity.prototype.value
  25409. * @description 专题图中每一个点所代表的数值。<br>
  25410. * 点值的确定与地图比例尺以及点的大小有关。地图比例尺越大,相应的图面范围也越大,
  25411. * 点相应就可以越多,此时点值就可以设置相对小一些。点形状越大,
  25412. * 点值相应就应该设置的小一些。点值过大或过小都是不合适的。
  25413. */
  25414. this.value = null;
  25415. if (options) {
  25416. Util_Util.extend(this, options);
  25417. }
  25418. this.CLASS_NAME = "SuperMap.ThemeDotDensity";
  25419. }
  25420. /**
  25421. * @function ThemeDotDensity.prototype.destroy
  25422. * @description 释放资源,将引用资源的属性置空。
  25423. */
  25424. destroy() {
  25425. var me = this;
  25426. me.dotExpression = null;
  25427. me.value = null;
  25428. if (me.style) {
  25429. me.style.destroy();
  25430. me.style = null;
  25431. }
  25432. }
  25433. /**
  25434. * @function ThemeDotDensity.prototype.toServerJSONObject
  25435. * @description 转换成对应的 JSON 格式对象。
  25436. * @returns {Object} 对应的 JSON 格式对象。
  25437. */
  25438. toServerJSONObject() {
  25439. var obj = {};
  25440. obj = Util_Util.copyAttributes(obj, this);
  25441. if (obj.style) {
  25442. if (obj.style.toServerJSONObject) {
  25443. obj.style = obj.style.toServerJSONObject();
  25444. }
  25445. }
  25446. return obj;
  25447. }
  25448. /**
  25449. * @function ThemeDotDensity.fromObj
  25450. * @description 从传入对象获取点密度专题图中点的风格。
  25451. * @param {Object} obj - 传入对象。
  25452. * @returns {ThemeDotDensity} ThemeDotDensity 对象。
  25453. */
  25454. static fromObj(obj) {
  25455. if (!obj) {
  25456. return;
  25457. }
  25458. var res = new ThemeDotDensity();
  25459. Util_Util.copy(res, obj);
  25460. res.style = ServerStyle.fromJson(obj.style);
  25461. return res;
  25462. }
  25463. }
  25464. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraduatedSymbolStyle.js
  25465. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  25466. * This program are made available under the terms of the Apache License, Version 2.0
  25467. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25468. /**
  25469. * @class ThemeGraduatedSymbolStyle
  25470. * @deprecatedclass SuperMap.ThemeGraduatedSymbolStyle
  25471. * @category iServer Map Theme
  25472. * @classdesc 等级符号专题图正负零值显示风格类。
  25473. * @param {Object} options - 参数。
  25474. * @param {boolean} [options.negativeDisplayed=false] - 是否显示负值。
  25475. * @param {ServerStyle} [options.negativeStyle] - 负值的等级符号风格。
  25476. * @param {ServerStyle} [options.positiveStyle] - 正值的等级符号风格。
  25477. * @param {boolean} [options.zeroDisplayed=false] - 是否显示 0 值。
  25478. * @param {ServerStyle} [options.zeroStyle] - 0 值的等级符号风格。
  25479. * @usage
  25480. */
  25481. class ThemeGraduatedSymbolStyle {
  25482. constructor(options) {
  25483. /**
  25484. * @member {boolean} [ThemeGraduatedSymbolStyle.prototype.negativeDisplayed=false]
  25485. * @description 是否显示负值。
  25486. */
  25487. this.negativeDisplayed = false;
  25488. /**
  25489. * @member {ServerStyle} [ThemeGraduatedSymbolStyle.prototype.negativeStyle]
  25490. * @description 负值的等级符号风格。
  25491. */
  25492. this.negativeStyle = new ServerStyle();
  25493. /**
  25494. * @member {ServerStyle} [ThemeGraduatedSymbolStyle.prototype.positiveStyle]
  25495. * @description 正值的等级符号风格。
  25496. */
  25497. this.positiveStyle = new ServerStyle();
  25498. /**
  25499. * @member {boolean} [ThemeGraduatedSymbolStyle.prototype.zeroDisplayed=false]
  25500. * @description 是否显示 0 值。
  25501. */
  25502. this.zeroDisplayed = false;
  25503. /**
  25504. * @member {ServerStyle} ThemeGraduatedSymbolStyle.prototype.zeroStyle
  25505. * @description 0 值的等级符号风格。
  25506. */
  25507. this.zeroStyle = new ServerStyle();
  25508. if (options) {
  25509. Util_Util.extend(this, options);
  25510. }
  25511. this.CLASS_NAME = "SuperMap.ThemeGraduatedSymbolStyle";
  25512. }
  25513. /**
  25514. * @function ThemeGraduatedSymbolStyle.prototype.destroy
  25515. * @description 释放资源,将引用资源的属性置空。
  25516. */
  25517. destroy() {
  25518. var me = this;
  25519. me.negativeDisplayed = null;
  25520. me.negativeStyle = null;
  25521. me.positiveStyle = null;
  25522. me.zeroDisplayed = null;
  25523. me.zeroStyle = null;
  25524. }
  25525. /**
  25526. * @function ThemeGraduatedSymbolStyle.fromObj
  25527. * @description 从传入对象获取等级符号专题图正负零值显示风格类。
  25528. * @param {Object} obj - 传入对象。
  25529. * @returns {ThemeGraduatedSymbolStyle} ThemeGraduatedSymbolStyle 对象。
  25530. */
  25531. static fromObj(obj) {
  25532. if (!obj) {
  25533. return;
  25534. }
  25535. var res = new ThemeGraduatedSymbolStyle();
  25536. Util_Util.copy(res, obj);
  25537. res.negativeStyle = ServerStyle.fromJson(obj.negativeStyle);
  25538. res.positiveStyle = ServerStyle.fromJson(obj.positiveStyle);
  25539. res.zeroStyle = ServerStyle.fromJson(obj.zeroStyle);
  25540. return res;
  25541. }
  25542. }
  25543. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraduatedSymbol.js
  25544. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  25545. * This program are made available under the terms of the Apache License, Version 2.0
  25546. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25547. /**
  25548. * @class ThemeGraduatedSymbol
  25549. * @deprecatedclass SuperMap.ThemeGraduatedSymbol
  25550. * @category iServer Map Theme
  25551. * @classdesc 等级符号专题图。
  25552. * @extends {CommonTheme}
  25553. * @param {Object} options - 参数。
  25554. * @param {ThemeGraduatedSymbolStyle} options.style - 等级符号专题图正负零值显示风格类。
  25555. * @param {string} options.expression - 等级符号专题图的字段或字段表达式。
  25556. * @param {number} [options.baseValue=0] - 等级符号专题图的基准值,单位同专题变量的单位。
  25557. * @param {GraduatedMode} [options.graduatedMode=GraduatedMode.CONSTANT] - 等级符号专题图分级模式。
  25558. * @param {ThemeOffset} [options.offset] - 指定等级符号专题图中标记文本相对于要素内点的偏移量对象。
  25559. * @param {ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  25560. * @usage
  25561. */
  25562. class ThemeGraduatedSymbol extends Theme {
  25563. constructor(options) {
  25564. super("GRADUATEDSYMBOL", options);
  25565. /**
  25566. * @member {number} [ThemeGraduatedSymbol.prototype.baseValue=0]
  25567. * @description 等级符号专题图的基准值,单位同专题变量的单位。<br>
  25568. * 依据此值系统会自动根据分级方式计算其余值对应的符号大小,每个符号的显示大小等于
  25569. * ThemeValueSection.positiveStyle(或 zeroStyle,negativeStyle).markerSize * value / basevalue,
  25570. * 其中 value 是 expression 所指定字段对应的值经过分级计算之后的值。默认值为0,建议通过多次尝试设置该值才能达到较好的显示效果。
  25571. */
  25572. this.baseValue = 0;
  25573. /**
  25574. * @member {string} ThemeGraduatedSymbol.prototype.expression
  25575. * @description 用于创建等级符号专题图的字段或字段表达式,字段或字段表达式应为数值型。
  25576. */
  25577. this.expression = null;
  25578. /**
  25579. * @member {GraduatedMode} [ThemeGraduatedSymbol.prototype.graduatedMode=GraduatedMode.CONSTANT]
  25580. * @description 等级符号专题图分级模式。<br>
  25581. * 分级主要是为了减少制作等级符号专题图中数据大小之间的差异。如果数据之间差距较大,则可以采用对数或者平方根的分级方式来进行,
  25582. * 这样就减少了数据之间的绝对大小的差异,使得等级符号图的视觉效果比较好,同时不同类别之间的比较也是有意义的。
  25583. * 有三种分级模式:常数、对数和平方根,对于有值为负数的字段,在用对数或平方根方式分级时,默认对负数取正。
  25584. * 不同的分级模式用于确定符号大小的数值是不相同的:常数按照字段的原始数据进行;对数则是对每条记录对应的专题变量取自然对数;
  25585. * 平方根则是对其取平方根,然后用最终得到的结果来确定其等级符号的大小。
  25586. */
  25587. this.graduatedMode = GraduatedMode.CONSTAN;
  25588. /**
  25589. * @member {ThemeOffset} [ThemeGraduatedSymbol.prototype.offset]
  25590. * @description 用于设置等级符号图相对于要素内点的偏移量。
  25591. */
  25592. this.offset = new ThemeOffset();
  25593. /**
  25594. * @member {ThemeGraduatedSymbolStyle} ThemeGraduatedSymbol.prototype.style
  25595. * @description 用于设置等级符号图正负和零值显示风格。
  25596. */
  25597. this.style = new ThemeGraduatedSymbolStyle();
  25598. if (options) {
  25599. Util_Util.extend(this, options);
  25600. }
  25601. this.CLASS_NAME = "SuperMap.ThemeGraduatedSymbol";
  25602. }
  25603. /**
  25604. * @function ThemeGraduatedSymbol.prototype.destroy
  25605. * @description 释放资源,将引用资源的属性置空。
  25606. */
  25607. destroy() {
  25608. super.destroy();
  25609. var me = this;
  25610. me.expression = null;
  25611. me.graduatedMode = GraduatedMode.CONSTANT;
  25612. if (me.offset) {
  25613. me.offset.destroy();
  25614. me.offset = null;
  25615. }
  25616. if (me.style) {
  25617. me.style.destroy();
  25618. me.style = null;
  25619. }
  25620. }
  25621. /**
  25622. * @function ThemeGraduatedSymbol.prototype.toJSON
  25623. * @description 将 themeLabel 对象转化为 JSON 字符串。
  25624. * @returns {string} 返回转换后的 JSON 字符串。
  25625. */
  25626. toJSON() {
  25627. return Util_Util.toJSON(this.toServerJSONObject());
  25628. }
  25629. /**
  25630. * @function ThemeGraduatedSymbol.prototype.toServerJSONObject
  25631. * @description 转换成对应的 JSON 格式对象。
  25632. * @returns {Object} 对应的 JSON 格式对象。
  25633. */
  25634. toServerJSONObject() {
  25635. var obj = {};
  25636. obj.type = this.type;
  25637. obj.memoryData = this.memoryData;
  25638. obj.baseValue = this.baseValue;
  25639. obj.expression = this.expression;
  25640. obj.graduatedMode = this.graduatedMode;
  25641. if (this.offset) {
  25642. obj.offsetFixed = this.offset.offsetFixed;
  25643. obj.offsetX = this.offset.offsetX;
  25644. obj.offsetY = this.offset.offsetY;
  25645. }
  25646. if (this.style) {
  25647. obj.negativeStyle = this.style.negativeStyle;
  25648. obj.negativeDisplayed = this.style.negativeDisplayed;
  25649. obj.positiveStyle = this.style.positiveStyle;
  25650. obj.zeroDisplayed = this.style.zeroDisplayed;
  25651. obj.zeroStyle = this.style.zeroStyle;
  25652. }
  25653. return obj;
  25654. }
  25655. /**
  25656. * @function ThemeGraduatedSymbol.fromObj
  25657. * @description 从传入对象获取等级符号专题图。
  25658. * @param {Object} obj - 传入对象。
  25659. * @returns {ThemeGraduatedSymbol} 等级符号专题图对象。
  25660. */
  25661. static fromObj(obj) {
  25662. if (!obj) {
  25663. return;
  25664. }
  25665. var res = new ThemeGraduatedSymbol();
  25666. Util_Util.copy(res, obj);
  25667. res.offset = ThemeOffset.fromObj(obj);
  25668. res.style = ThemeGraduatedSymbolStyle.fromObj(obj);
  25669. return res;
  25670. }
  25671. }
  25672. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeRangeItem.js
  25673. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  25674. * This program are made available under the terms of the Apache License, Version 2.0
  25675. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25676. /**
  25677. * @class ThemeRangeItem
  25678. * @deprecatedclass SuperMap.ThemeRangeItem
  25679. * @category iServer Map Theme
  25680. * @classdesc 范围分段专题图子项类。在分段专题图中,字段值按照某种分段模式被分成多个范围段,
  25681. * 每个范围段即为一个子项,同一范围段的要素属于同一个分段专题图子项。
  25682. * 每个子项都有其分段起始值、终止值、名称和风格等。每个分段所表示的范围为[start, end)。
  25683. * @param {Object} options - 参数。
  25684. * @param {string} [options.caption] - 子项的标题。
  25685. * @param {number} [options.end=0] - 子项的终止值。
  25686. * @param {number} [options.start=0] - 子项的起始值。
  25687. * @param {ServerStyle} options.style - 子项的风格。
  25688. * @param {boolean} [options.visible=true] - 子项是否可见。
  25689. * @usage
  25690. */
  25691. class ThemeRangeItem {
  25692. constructor(options) {
  25693. /**
  25694. * @member {string} [ThemeRangeItem.prototype.caption]
  25695. * @description 分段专题图子项的标题。
  25696. */
  25697. this.caption = null;
  25698. /**
  25699. * @member {number} [ThemeRangeItem.prototype.end=0]
  25700. * @description 分段专题图子项的终止值,即该段专题值范围的最大值。<br>
  25701. * 如果该子项是分段中最后一个子项,则该终止值应大于分段字段(ThemeRange 类的 rangeExpression 属性)的最大值,若该终止值小于分段字段最大值,
  25702. * 则剩余部分由内部随机定义其颜色;如果不是最后一项,该终止值必须与其下一子项的起始值相同,否则系统抛出异常;
  25703. * 如果设置了范围分段模式和分段数,则会自动计算每段的范围 [start, end),故无需设置 [start, end);当然可以设置,那么结果就会按您设置的值对分段结果进行调整。
  25704. */
  25705. this.end = 0;
  25706. /**
  25707. * @member {number} [ThemeRangeItem.prototype.start=0]
  25708. * @description 分段专题图子项的起始值,即该段专题值范围的最小值。<br>
  25709. * 如果该子项是分段中第一个子项,那么该起始值就是分段的最小值;如果子项的序号大于等于 1 的时候,该起始值必须与前一子项的终止值相同,否则系统会抛出异常。
  25710. * 如果设置了范围分段模式和分段数,则会自动计算每段的范围 [start, end),故无需设置 [start, end);当然可以设置,那么结果就会按您设置的值对分段结果进行调整。
  25711. */
  25712. this.start = 0;
  25713. /**
  25714. * @member {ServerStyle} ThemeRangeItem.prototype.style
  25715. * @description 分段专题图子项的风格。
  25716. * 每一个分段专题图子项都对应一种显示风格。
  25717. */
  25718. this.style = new ServerStyle();
  25719. /**
  25720. * @member {boolean} [ThemeRangeItem.prototype.visible=true]
  25721. * @description 分段专题图子项是否可见。
  25722. */
  25723. this.visible = true;
  25724. if (options) {
  25725. Util_Util.extend(this, options);
  25726. }
  25727. this.CLASS_NAME = "SuperMap.ThemeRangeItem";
  25728. }
  25729. /**
  25730. * @function ThemeRangeItem.prototype.destroy
  25731. * @description 释放资源,将引用资源的属性置空。
  25732. */
  25733. destroy() {
  25734. var me = this;
  25735. me.caption = null;
  25736. me.end = null;
  25737. me.start = null;
  25738. if (me.style) {
  25739. me.style.destroy();
  25740. me.style = null;
  25741. }
  25742. me.visible = null;
  25743. }
  25744. /**
  25745. * @function ThemeRangeItem.prototypetoServerJSONObject
  25746. * @description 转换成对应的 JSON 格式对象。
  25747. * @returns {Object} 对应的 JSON 格式对象。
  25748. */
  25749. toServerJSONObject() {
  25750. var obj = {};
  25751. obj = Util_Util.copyAttributes(obj, this);
  25752. if (obj.style) {
  25753. if (obj.style.toServerJSONObject) {
  25754. obj.style = obj.style.toServerJSONObject();
  25755. }
  25756. }
  25757. return obj;
  25758. }
  25759. /**
  25760. * @function ThemeRangeItem.fromObj
  25761. * @description 从传入对象获取范围分段专题图子项类。
  25762. * @param {Object} obj - 传入对象。
  25763. * @returns {ThemeRangeItem} ThemeRangeItem 对象。
  25764. */
  25765. static fromObj(obj) {
  25766. if (!obj) {
  25767. return;
  25768. }
  25769. var res = new ThemeRangeItem();
  25770. Util_Util.copy(res, obj);
  25771. res.style = ServerStyle.fromJson(obj.style);
  25772. return res;
  25773. }
  25774. }
  25775. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeRange.js
  25776. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  25777. * This program are made available under the terms of the Apache License, Version 2.0
  25778. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25779. /**
  25780. * @class ThemeRange
  25781. * @deprecatedclass SuperMap.ThemeRange
  25782. * @category iServer Map Theme
  25783. * @classdesc 范围分段专题图。
  25784. * 范围分段专题图是按照指定的分段方法(如:等距离分段法)对字段的属性值进行分段,使用不同的颜色或符号(线型、填充)表示不同范围段落的属性值在整体上的分布情况,体现区域的差异。
  25785. * 在分段专题图中,专题值按照某种分段方式被分成多个范围段,要素根据各自的专题值被分配到其中一个范围段中,在同一个范围段中的要素使用相同的颜色,填充,符号等风格进行显示。
  25786. * 分段专题图所基于的专题变量必须为数值型,分段专题图一般用来反映连续分布现象的数量或程度特征,如降水量的分布,土壤侵蚀强度的分布等。
  25787. * @extends {CommonTheme}
  25788. * @param {Object} options - 参数。
  25789. * @param {Array.<ThemeRangeItem>} options.items - 子项数组。
  25790. * @param {string} options.rangeExpression - 分段字段表达式。
  25791. * @param {number} options.rangeParameter - 分段参数。
  25792. * @param {RangeMode} [options.rangeMode=RangeMode.EQUALINTERVAL] - 分段模式。
  25793. * @param {ColorGradientType} [options.colorGradientType=ColorGradientType.YELLOW_RED] - 渐变颜色枚举类。
  25794. * @param {ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  25795. * @usage
  25796. */
  25797. class ThemeRange extends Theme {
  25798. constructor(options) {
  25799. super("RANGE", options);
  25800. /**
  25801. * @member {string} ThemeRange.prototype.precision
  25802. * @description 精准度。
  25803. */
  25804. this.precision = '1.0E-12';
  25805. /**
  25806. * @member {Array.<ThemeRangeItem>} ThemeRange.prototype.items
  25807. * @description 分段专题图子项数组。<br>
  25808. * 在分段专题图中,字段值按照某种分段模式被分成多个范围段,每个范围段即为一个子项,同一范围段的要素属于同一个分段专题图子项。
  25809. * 每个子项都有其分段起始值、终止值、名称和风格等。每个分段所表示的范围为 [start, end)。
  25810. * 如果设置了范围分段模式和分段数,则会自动计算每段的范围 [start, end),故无需设置 [start, end);当然可以设置,那么结果就会按照您设置的值对分段结果进行调整。
  25811. */
  25812. this.items = null;
  25813. /**
  25814. * @member {string} ThemeRange.prototype.rangeExpression
  25815. * @description 分段字段表达式。<br>
  25816. * 由于范围分段专题图基于各种分段方法根据一定的距离进行分段,因而范围分段专题图所基于的字段值的数据类型必须为数值型。对于字段表达式,只能为数值型的字段间的运算。
  25817. */
  25818. this.rangeExpression = null;
  25819. /**
  25820. * @member {RangeMode} [ThemeRange.prototype.rangeMode=RangeMode.EQUALINTERVAL]
  25821. * @description 分段专题图的分段模式。<br>
  25822. * 在分段专题图中,作为专题变量的字段或表达式的值按照某种分段方式被分成多个范围段。
  25823. * 目前 SuperMap 提供的分段方式包括:等距离分段法、平方根分段法、标准差分段法、对数分段法、等计数分段法和自定义距离法,
  25824. * 显然这些分段方法根据一定的距离进行分段,因而范围分段专题图所基于的专题变量必须为数值型。
  25825. */
  25826. this.rangeMode = RangeMode.EQUALINTERVAL;
  25827. /**
  25828. * @member {number} ThemeRange.prototype.rangeParameter
  25829. * @description 分段参数。
  25830. * 当分段模式为等距离分段法,平方根分段,对数分段法,等计数分段法其中一种模式时,该参数用于设置分段个数;当分段模式为标准差分段法时,
  25831. * 该参数不起作用;当分段模式为自定义距离时,该参数用于设置自定义距离。
  25832. */
  25833. this.rangeParameter = 0;
  25834. /**
  25835. * @member {ColorGradientType} [ThemeRange.prototype.colorGradientType=ColorGradientType.YELLOW_RED]
  25836. * @description 渐变颜色枚举类。<br>
  25837. * 渐变色是由起始色根据一定算法逐渐过渡到终止色的一种混合型颜色。
  25838. * 该类作为单值专题图参数类、分段专题图参数类的属性,负责设置单值专题图、分段专题图的配色方案,在默认情况下专题图所有子项会根据这个配色方案完成填充。但如果为某几个子项的风格进行单独设置后(设置了 {@link ThemeUniqueItem} 或 {@link ThemeRangeItem} 类中Style属性),
  25839. * 该配色方案对于这几个子项将不起作用。
  25840. */
  25841. this.colorGradientType = ColorGradientType.YELLOW_RED;
  25842. if (options) {
  25843. Util_Util.extend(this, options);
  25844. }
  25845. this.CLASS_NAME = "SuperMap.ThemeRange";
  25846. }
  25847. /**
  25848. * @function ThemeRange.prototype.destroy
  25849. * @override
  25850. */
  25851. destroy() {
  25852. super.destroy();
  25853. var me = this;
  25854. if (me.items) {
  25855. if (me.items.length > 0) {
  25856. for (var item in me.items) {
  25857. me.items[item].destroy();
  25858. me.items[item] = null;
  25859. }
  25860. }
  25861. me.items = null;
  25862. }
  25863. me.rangeExpression = null;
  25864. me.rangeMode = null;
  25865. me.rangeParameter = null;
  25866. me.colorGradientType = null;
  25867. }
  25868. /**
  25869. * @function ThemeRange.fromObj
  25870. * @description 从传入对象获取范围分段专题图类。
  25871. * @param {Object} obj - 传入对象。
  25872. * @returns {ThemeRange} ThemeRange 对象。
  25873. */
  25874. static fromObj(obj) {
  25875. if (!obj) {
  25876. return;
  25877. }
  25878. var res = new ThemeRange();
  25879. Util_Util.copy(res, obj);
  25880. var itemsR = obj.items;
  25881. var len = itemsR ? itemsR.length : 0;
  25882. res.items = [];
  25883. for (var i = 0; i < len; i++) {
  25884. res.items.push(ThemeRangeItem.fromObj(itemsR[i]));
  25885. }
  25886. return res;
  25887. }
  25888. }
  25889. ;// CONCATENATED MODULE: ./src/common/iServer/UGCLayer.js
  25890. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  25891. * This program are made available under the terms of the Apache License, Version 2.0
  25892. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25893. /**
  25894. * @class UGCLayer
  25895. * @deprecatedclass SuperMap.UGCLayer
  25896. * @category iServer Map Layer
  25897. * @classdesc SuperMap 图层类。
  25898. * @param {Object} options - 参数。
  25899. * @param {Bounds} options.bounds - 图层范围。
  25900. * @param {string} options.name - 图层的名称。
  25901. * @param {UGCLayerType} options.type - 图层类型。
  25902. * @param {string} [options.caption] - 图层的标题。
  25903. * @param {string} [options.description] - 图层的描述信息。
  25904. * @param {boolean} [options.queryable] - 图层中的对象是否可以查询。
  25905. * @param {boolean} [options.subUGCLayers] - 是否允许图层的符号大小随图缩放。
  25906. * @param {boolean} [options.visible=false] - 地图对象在同一范围内时,是否重叠显示。
  25907. * @usage
  25908. */
  25909. class UGCLayer {
  25910. constructor(options) {
  25911. options = options || {};
  25912. /**
  25913. * @member {Bounds} UGCLayer.prototype.bounds
  25914. * @description 图层范围。
  25915. */
  25916. this.bounds = null;
  25917. /**
  25918. * @member {string} [UGCLayer.prototype.caption]
  25919. * @description 图层的标题。默认情况下图层的标题与图层的名称一致。在图例、图层控制列表中显示的图层名称就是该图层的标题值。
  25920. */
  25921. this.caption = null;
  25922. /**
  25923. * @member {string} UGCLayer.prototype.description
  25924. * @description 图层的描述信息。
  25925. */
  25926. this.description = null;
  25927. /**
  25928. * @member {string} UGCLayer.prototype.name
  25929. * @description 图层的名称。图层的名称在图层所在的地图中唯一标识此图层。该属性区分大小写。
  25930. */
  25931. this.name = null;
  25932. /**
  25933. * @member {boolean} UGCLayer.prototype.queryable
  25934. * @description 图层中的对象是否可以查询。
  25935. */
  25936. this.queryable = null;
  25937. /**
  25938. * @member {Array} UGCLayer.prototype.subLayers
  25939. * @description 子图层集。
  25940. */
  25941. this.subLayers = null;
  25942. /**
  25943. * @member {UGCLayerType} UGCLayer.prototype.type
  25944. * @description 图层类型。
  25945. */
  25946. this.type = null;
  25947. /**
  25948. * @member {boolean} UGCLayer.prototype.visible
  25949. * @description 地图对象在同一范围内时,是否重叠显示。
  25950. */
  25951. this.visible = null;
  25952. Util_Util.extend(this, options);
  25953. this.CLASS_NAME = "SuperMap.UGCLayer";
  25954. }
  25955. /**
  25956. * @function UGCLayer.prototype.destroy
  25957. * @description 释放资源,将引用资源的属性置空。
  25958. */
  25959. destroy() {
  25960. var me = this;
  25961. Util_Util.reset(me);
  25962. }
  25963. /**
  25964. * @function UGCLayer.prototype.fromJson
  25965. * @description 将服务端 JSON 对象转换成当前客户端对象。
  25966. * @param {Object} jsonObject - 要转换的 JSON 对象。
  25967. */
  25968. fromJson(jsonObject) {
  25969. jsonObject = jsonObject ? jsonObject : {};
  25970. Util_Util.extend(this, jsonObject);
  25971. var b = this.bounds;
  25972. if (b) {
  25973. this.bounds = new Bounds(b.leftBottom.x, b.leftBottom.y, b.rightTop.x, b.rightTop.y);
  25974. }
  25975. }
  25976. /**
  25977. * @function UGCLayer.prototype.toServerJSONObject
  25978. * @description 转换成对应的 JSON 格式对象。
  25979. * @returns {Object} 对应的 JSON 格式对象。
  25980. */
  25981. toServerJSONObject() {
  25982. var jsonObject = {};
  25983. jsonObject = Util_Util.copyAttributes(jsonObject, this);
  25984. if (jsonObject.bounds) {
  25985. if (jsonObject.bounds.toServerJSONObject) {
  25986. jsonObject.bounds = jsonObject.bounds.toServerJSONObject();
  25987. }
  25988. }
  25989. return jsonObject;
  25990. }
  25991. }
  25992. ;// CONCATENATED MODULE: ./src/common/iServer/UGCMapLayer.js
  25993. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  25994. * This program are made available under the terms of the Apache License, Version 2.0
  25995. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25996. /**
  25997. * @class UGCMapLayer
  25998. * @deprecatedclass SuperMap.UGCMapLayer
  25999. * @category iServer Map Layer
  26000. * @classdesc SuperMap 地图图层类。
  26001. * @extends {UGCLayer}
  26002. * @param {Object} options - 可选参数。
  26003. * @param {boolean} [options.completeLineSymbolDisplayed] - 是否显示完整线型。
  26004. * @param {number} [options.maxScale] - 地图最大比例尺。
  26005. * @param {number} [options.minScale] - 地图最小比例尺。
  26006. * @param {number} [options.minVisibleGeometrySize] - 几何对象的最小可见大小,以像素为单位。
  26007. * @param {number} [options.opaqueRate] - 图层的不透明度。
  26008. * @param {boolean} [options.symbolScalable] - 是否允许图层的符号大小随图缩放。
  26009. * @param {number} [options.symbolScale] - 图层的符号缩放基准比例尺。
  26010. * @param {boolean} [options.overlapDisplayed=false] - 地图对象在同一范围内时,是否重叠显示。
  26011. * @param {OverlapDisplayedOptions} [options.overlapDisplayedOptions] - 地图的压盖过滤显示选项,当overlapDisplayed 为 false 时有效。
  26012. * @usage
  26013. */
  26014. class UGCMapLayer extends UGCLayer {
  26015. constructor(options) {
  26016. options = options || {};
  26017. super(options);
  26018. /**
  26019. * @member {boolean} UGCMapLayer.prototype.completeLineSymbolDisplayed
  26020. * @description 是否显示完整线型。
  26021. */
  26022. this.completeLineSymbolDisplayed = null;
  26023. /**
  26024. * @member {number} UGCMapLayer.prototype.maxScale
  26025. * @description 地图最大比例尺。
  26026. */
  26027. this.maxScale = null;
  26028. /**
  26029. * @member {number} UGCMapLayer.prototype.minScale
  26030. * @description 地图最小比例尺。
  26031. */
  26032. this.minScale = null;
  26033. /**
  26034. * @member {number} UGCMapLayer.prototype.minVisibleGeometrySize
  26035. * @description 几何对象的最小可见大小,以像素为单位。
  26036. */
  26037. this.minVisibleGeometrySize = null;
  26038. /**
  26039. * @member {number} UGCMapLayer.prototype.opaqueRate
  26040. * @description 图层的不透明度。
  26041. */
  26042. this.opaqueRate = null;
  26043. /**
  26044. * @member {boolean} UGCMapLayer.prototype.symbolScalable
  26045. * @description 是否允许图层的符号大小随图缩放。
  26046. */
  26047. this.symbolScalable = null;
  26048. /**
  26049. * @member {number} UGCMapLayer.prototype.symbolScale
  26050. * @description 图层的符号缩放基准比例尺。
  26051. */
  26052. this.symbolScale = null;
  26053. /**
  26054. * @member {boolean} [UGCMapLayer.prototype.overlapDisplayed=false]
  26055. * @description 地图对象在同一范围内时,是否重叠显示。
  26056. */
  26057. this.overlapDisplayed = null;
  26058. /**
  26059. * @member {OverlapDisplayedOptions} UGCMapLayer.prototype.overlapDisplayedOptions
  26060. * @description 地图的压盖过滤显示选项,当 overlapDisplayed 为 false 时有效。
  26061. */
  26062. this.overlapDisplayedOptions = null;
  26063. this.CLASS_NAME = "SuperMap.UGCMapLayer";
  26064. }
  26065. /**
  26066. * @function UGCMapLayer.prototype.destroy
  26067. * @override
  26068. */
  26069. destroy() {
  26070. super.destroy();
  26071. Util_Util.reset(this);
  26072. }
  26073. /**
  26074. * @function UGCMapLayer.prototype.fromJson
  26075. * @description 将服务端 JSON 对象转换成当前客户端对象。
  26076. * @param {Object} jsonObject - 要转换的 JSON 对象。
  26077. */
  26078. fromJson(jsonObject) {
  26079. super.fromJson(jsonObject);
  26080. }
  26081. /**
  26082. * @function UGCMapLayer.prototype.toServerJSONObject
  26083. * @description 转换成对应的 JSON 格式对象。
  26084. * @returns {Object} 对应的 JSON 格式对象。
  26085. */
  26086. toServerJSONObject() {
  26087. return super.toServerJSONObject();
  26088. }
  26089. }
  26090. ;// CONCATENATED MODULE: ./src/common/iServer/JoinItem.js
  26091. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  26092. * This program are made available under the terms of the Apache License, Version 2.0
  26093. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26094. /**
  26095. * @class JoinItem
  26096. * @deprecatedclass SuperMap.JoinItem
  26097. * @category iServer Data FeatureResults
  26098. * @classdesc 连接信息类。
  26099. * 该类用于矢量数据集与外部表的连接。外部表可以为另一个矢量数据集(其中纯属性数据集中没有空间几何信息)所对应的 DBMS 表,也可以是用户自建的业务表。
  26100. * 需要注意的是,矢量数据集与外部表必须属于同一数据源。表之间的联系的建立有两种方式,一种是连接(join),一种是关联(link)。
  26101. * 连接,实际上是依据相同的字段将一个外部表追加到指定的表;而关联是基于一个相同的字段定义了两个表格之间的联系,但不是实际的追加。
  26102. * 用于连接两个表的字段的名称不一定相同,但类型必须一致。当两个表格之间建立了连接,通过对主表进行操作,可以对外部表进行查询,制作专题图以及分析等。
  26103. * 当两个表格之间是一对一或多对一的关系时,可以使用 join 连接。当为多对一的关系时,允许指定多个字段之间的关联。
  26104. *(注意:JoinItem 目前支持左连接和内连接,不支持全连接和右连接,UDB 引擎不支持内连接。并且用于建立连接的两个表必须在同一个数据源下。)
  26105. * @param {Object} options - 参数。
  26106. * @param {string} options.foreignTableName - 外部表的名称。
  26107. * @param {string} options.joinFilter - 矢量数据集与外部表之间的连接表达式,即设定两个表之间关联的字段。
  26108. * @param {JoinType} options.joinType - 两个表之间连接类型。
  26109. * @example 下面以 SQL 查询说明 joinItem 的使用方法:
  26110. *(start code)
  26111. * function queryBySQL() {
  26112. * // 设置与外部表的连接信息
  26113. * var joinItem = new JoinItem({
  26114. * foreignTableName: "foreignTable",
  26115. * joinFilter: "foreignTable.CONTINENT = Countries.CONTINENT",
  26116. * joinType: "LEFTJOIN"
  26117. * })
  26118. * var queryParam, queryBySQLParams, queryBySQLService;
  26119. * // 设置查询参数,在查询参数中添加joinItem关联条件信息
  26120. * queryParam = new FilterParameter({
  26121. * name: "Countries@World",
  26122. * joinItems: [joinItem]
  26123. * }),
  26124. * queryBySQLParams = new QueryBySQLParameters({
  26125. * queryParams: [queryParam]
  26126. * }),
  26127. * queryBySQLService = new QueryBySQLService(url, {
  26128. * eventListeners: { "processCompleted": processCompleted, "processFailed": processFailed}
  26129. * });
  26130. * queryBySQLService.processAsync(queryBySQLParams);
  26131. * }
  26132. * function processCompleted(queryEventArgs) {//todo}
  26133. * function processFailed(e) {//todo}
  26134. * (end)
  26135. * @usage
  26136. */
  26137. class JoinItem {
  26138. constructor(options) {
  26139. /**
  26140. * @member {string} JoinItem.prototype.foreignTableName
  26141. * @description 外部表的名称。
  26142. * 如果外部表的名称是以 “表名@数据源名” 命名方式,则该属性只需赋值表名。
  26143. * 例如:外部表 Name@changchun,Name 为表名,changchun 为数据源名称,则该属性的赋值应为:Name。
  26144. */
  26145. this.foreignTableName = null;
  26146. /**
  26147. * @member {string} JoinItem.prototype.joinFilter
  26148. * @description 矢量数据集与外部表之间的连接表达式,即设定两个表之间关联的字段。
  26149. * 例如,将房屋面数据集(Building)的 district 字段与房屋拥有者的纯属性数据集(Owner)的 region 字段相连接,
  26150. * 两个数据集对应的表名称分别为 Table_Building 和 Table_Owner,
  26151. * 则连接表达式为 Table_Building.district = Table_Owner.region。
  26152. * 当有多个字段相连接时,用 AND 将多个表达式相连。
  26153. */
  26154. this.joinFilter = null;
  26155. /**
  26156. * @member {JoinType} JoinItem.prototype.joinType
  26157. * @description 两个表之间连接类型。
  26158. * 连接类型决定了对两个表进行连接查询后返回的记录的情况。
  26159. */
  26160. this.joinType = null;
  26161. if (options) {
  26162. Util_Util.extend(this, options);
  26163. }
  26164. this.CLASS_NAME = "SuperMap.JoinItem";
  26165. }
  26166. /**
  26167. * @function JoinItem.prototype.destroy
  26168. * @description 释放资源,将引用资源的属性置空。
  26169. */
  26170. destroy() {
  26171. var me = this;
  26172. me.foreignTableName = null;
  26173. me.joinFilter = null;
  26174. me.joinType = null;
  26175. }
  26176. /**
  26177. * @function JoinItem.prototype.toServerJSONObject
  26178. * @description 转换成对应的 JSON 格式对象。
  26179. */
  26180. toServerJSONObject() {
  26181. var dataObj = {};
  26182. dataObj = Util_Util.copyAttributes(dataObj, this);
  26183. //joinFilter基本是个纯属性对象,这里不再做转换
  26184. return dataObj;
  26185. }
  26186. }
  26187. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetInfo.js
  26188. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  26189. * This program are made available under the terms of the Apache License, Version 2.0
  26190. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26191. /**
  26192. * @class DatasetInfo
  26193. * @deprecatedclass SuperMap.DatasetInfo
  26194. * @category iServer Data Dataset
  26195. * @classdesc 数据集信息类。
  26196. * 数据集一般为存储在一起的相关数据的集合;根据数据类型的不同,分为矢量数据集、栅格数据集(griddataset)和
  26197. * 影像数据集(image dataset),以及为了处理特定问题而设计的数据集,如拓扑数据集,网络数据集等。
  26198. * 数据集是 GIS 数据组织的最小单位。其中矢量数据集是由同种类型空间要素组成的集合,
  26199. * 所以也可以称为要素集。根据要素的空间特征的不同,矢量数据集又分为点数据集,
  26200. * 线数据集,面数据集等,各矢量数据集是空间特征和性质相同的数据组织起来的集合。
  26201. * 目前版本支持的数据集主要有点数据集,线数据集,面数据集,文本数据集,复合数据集(CAD 数据集)、
  26202. * 网络数据集,栅格数据集(grid dataset)和影像数据集(image dataset)。
  26203. * @param {Object} options - 参数。
  26204. * @param {Bounds} [options.bounds] - 数据集范围。
  26205. * @param {string} [options.dataSourceName] - 数据源名称。
  26206. * @param {string} [options.description] - 数据集的描述信息。
  26207. * @param {string} [options.encodeType] - 数据集存储时的压缩编码方式。
  26208. * @param {boolean} [options.isReadOnly] - 数据集是否为只读。
  26209. * @param {string} options.name - 数据集名称。
  26210. * @param {Object} [options.prjCoordSys] - 数据集的投影信息。如:prjCoordSys={"epsgCode":3857}。
  26211. * @param {string} [options.tableName] - 表名。
  26212. * @param {string} options.type - 数据集类型。主要有点数据集,线数据集,面数据集,文本数据集,复合数据集(CAD 数据集)、网络数据集,栅格数据集(grid dataset)和影像数据集(image dataset)。
  26213. * @usage
  26214. */
  26215. class DatasetInfo {
  26216. constructor(options) {
  26217. options = options || {};
  26218. /**
  26219. * @member {Bounds} [DatasetInfo.prototype.bounds]
  26220. * @description 数据集范围,该字段只读。
  26221. */
  26222. this.bounds = null;
  26223. /**
  26224. * @member {string} [DatasetInfo.prototype.dataSourceName]
  26225. * @description 数据源名称,该字段只读。
  26226. */
  26227. this.dataSourceName = null;
  26228. /**
  26229. * @member {string} [DatasetInfo.prototype.description]
  26230. * @description 数据集的描述信息。
  26231. */
  26232. this.description = null;
  26233. /**
  26234. * @member {string} [DatasetInfo.prototype.encodeType]
  26235. * @description 数据集存储时的压缩编码方式,该字段只读。
  26236. */
  26237. this.encodeType = null;
  26238. /**
  26239. * @member {boolean} [DatasetInfo.prototype.isReadOnly]
  26240. * @description 数据集是否为只读。
  26241. */
  26242. this.isReadOnly = null;
  26243. /**
  26244. * @member {string} DatasetInfo.prototype.name
  26245. * @description 数据集名称,该字段必须且只读。
  26246. */
  26247. this.name = null;
  26248. /**
  26249. * @member {Object} [DatasetInfo.prototype.prjCoordSys]
  26250. * @description 数据集的投影信息。
  26251. */
  26252. this.prjCoordSys = null;
  26253. /**
  26254. * @member {string} [DatasetInfo.prototype.tableName]
  26255. * @description 表名,该字段只读。
  26256. */
  26257. this.tableName = null;
  26258. /**
  26259. * @member {string} DatasetInfo.prototype.type
  26260. * @description 数据集类型,该字段必设。主要有点数据集,线数据集,面数据集,文本数据集,复合数据集(CAD 数据集)、网络数据集,栅格数据集(grid dataset)和影像数据集(image dataset)。
  26261. */
  26262. this.type = null;
  26263. Util_Util.extend(this, options);
  26264. var b = this.bounds;
  26265. if (b) {
  26266. this.bounds = new Bounds(b.leftBottom.x, b.leftBottom.y, b.rightTop.x, b.rightTop.y);
  26267. }
  26268. this.CLASS_NAME = "SuperMap.DatasetInfo";
  26269. }
  26270. /**
  26271. * @function DatasetInfo.prototype.destroy
  26272. * @description 释放资源,将引用资源的属性置空。
  26273. */
  26274. destroy() {
  26275. Util_Util.reset(this);
  26276. }
  26277. /**
  26278. * @function DatasetInfo.prototype.toServerJSONObject
  26279. * @description 转换成对应的 JSON 格式对象。
  26280. * @returns {Object} JSON 对象。
  26281. */
  26282. toServerJSONObject() {
  26283. var dataObj = {};
  26284. dataObj = Util_Util.copyAttributes(dataObj, this);
  26285. if (dataObj.bounds) {
  26286. if (dataObj.bounds.toServerJSONObject) {
  26287. dataObj.bounds = dataObj.bounds.toServerJSONObject();
  26288. }
  26289. }
  26290. return dataObj;
  26291. }
  26292. }
  26293. ;// CONCATENATED MODULE: ./src/common/iServer/UGCSubLayer.js
  26294. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  26295. * This program are made available under the terms of the Apache License, Version 2.0
  26296. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26297. /**
  26298. * @class UGCSubLayer
  26299. * @deprecatedclass SuperMap.UGCSubLayer
  26300. * @category iServer Map Layer
  26301. * @classdesc 地图服务图层属性信息类。影像图层(Image)、专题图层(ServerTheme)、栅格图层(Grid)、矢量图层(Vector)等图层均继承该类。
  26302. * @extends {UGCMapLayer}
  26303. * @param {Object} options - 参数。
  26304. * @param {DatasetInfo} options.datasetInfo - 数据集信息。
  26305. * @param {string} [options.displayFilter] - 图层显示过滤条件。
  26306. * @param {JoinItem} [options.joinItems] - 连接信息类。
  26307. * @param {string} [options.representationField] - 存储制图表达信息的字段。
  26308. * @param {LayerType} [options.ugcLayerType] - 图层类型。
  26309. * @usage
  26310. */
  26311. class UGCSubLayer extends UGCMapLayer {
  26312. constructor(options) {
  26313. options = options || {};
  26314. super(options);
  26315. /**
  26316. * @member {DatasetInfo} UGCSubLayer.prototype.datasetInfo
  26317. * @description 数据集信息。
  26318. */
  26319. this.datasetInfo = null;
  26320. /**
  26321. * @member {string} UGCSubLayer.prototype.displayFilter
  26322. * @description 图层显示过滤条件。
  26323. */
  26324. this.displayFilter = null;
  26325. /**
  26326. * @member {JoinItem} UGCSubLayer.prototype.joinItems
  26327. * @description 连接信息类。
  26328. */
  26329. this.joinItems = null;
  26330. /**
  26331. * @member {string} UGCSubLayer.prototype.representationField
  26332. * @description 存储制图表达信息的字段。
  26333. */
  26334. this.representationField = null;
  26335. /**
  26336. * @member {LayerType} UGCSubLayer.prototype.ugcLayerType
  26337. * @description 图层类型。
  26338. */
  26339. this.ugcLayerType = null;
  26340. this.CLASS_NAME = "SuperMap.UGCSubLayer";
  26341. }
  26342. /**
  26343. * @function UGCSubLayer.prototype.fromJson
  26344. * @description 将服务端 JSON 对象转换成当前客户端对象。
  26345. * @param {Object} jsonObject - 要转换的 JSON 对象。
  26346. */
  26347. fromJson(jsonObject) {
  26348. super.fromJson(jsonObject);
  26349. if (this.datasetInfo) {
  26350. this.datasetInfo = new DatasetInfo(this.datasetInfo);
  26351. }
  26352. if (this.joinItems && this.joinItems.length) {
  26353. var newJoinItems = [];
  26354. for (var i = 0; i < this.joinItems.length; i++) {
  26355. newJoinItems[i] = new JoinItem(this.joinItems[i]);
  26356. }
  26357. this.joinItems = newJoinItems;
  26358. }
  26359. }
  26360. /**
  26361. * @function UGCSubLayer.prototype.destroy
  26362. * @override
  26363. */
  26364. destroy() {
  26365. super.destroy();
  26366. Util_Util.reset(this);
  26367. }
  26368. /**
  26369. * @function UGCSubLayer.prototype.toServerJSONObject
  26370. * @description 转换成对应的 JSON 格式对象。
  26371. * @returns {Object} 对应的 JSON 格式对象。
  26372. */
  26373. toServerJSONObject() {
  26374. var jsonObject = super.toServerJSONObject();
  26375. if (jsonObject.joinItems) {
  26376. var joinItems = [];
  26377. for (var i = 0; i < jsonObject.joinItems.length; i++) {
  26378. if (jsonObject.joinItems[i].toServerJSONObject) {
  26379. joinItems[i] = jsonObject.joinItems[i].toServerJSONObject();
  26380. }
  26381. }
  26382. jsonObject.joinItems = joinItems;
  26383. }
  26384. if (jsonObject.datasetInfo) {
  26385. if (jsonObject.datasetInfo.toServerJSONObject) {
  26386. jsonObject.datasetInfo = jsonObject.datasetInfo.toServerJSONObject();
  26387. }
  26388. }
  26389. return jsonObject;
  26390. }
  26391. }
  26392. ;// CONCATENATED MODULE: ./src/common/iServer/ServerTheme.js
  26393. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  26394. * This program are made available under the terms of the Apache License, Version 2.0
  26395. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26396. /**
  26397. * @class ServerTheme
  26398. * @deprecatedclass SuperMap.ServerTheme
  26399. * @category iServer Map Theme
  26400. * @classdesc SuperMap 专题图图层类。
  26401. * @extends {UGCSubLayer}
  26402. * @param {CommonTheme} theme - 专题图对象。
  26403. * @param {LonLat} themeElementPosition - 专题图元素位置。
  26404. * @usage
  26405. */
  26406. class ServerTheme extends UGCSubLayer {
  26407. constructor(options) {
  26408. options = options || {};
  26409. super(options);
  26410. /**
  26411. * @member {CommonTheme} ServerTheme.prototype.theme
  26412. * @description 专题图对象。
  26413. */
  26414. this.theme = null;
  26415. /**
  26416. * @member {LonLat} ServerTheme.prototype.themeElementPosition
  26417. * @description 专题图元素位置。
  26418. */
  26419. this.themeElementPosition = null;
  26420. this.CLASS_NAME = "SuperMap.ServerTheme";
  26421. }
  26422. /**
  26423. * @function ServerTheme.prototype.destroy
  26424. * @description 释放资源,将引用资源的属性置空。
  26425. * @override
  26426. */
  26427. destroy() {
  26428. super.destroy();
  26429. Util_Util.reset(this);
  26430. }
  26431. /**
  26432. * @function ServerTheme.prototype.fromJson
  26433. * @description 将服务端 JSON 对象转换成当前客户端对象。
  26434. * @param {Object} jsonObject - 要转换的 JSON 对象。
  26435. */
  26436. fromJson(jsonObject) {
  26437. super.fromJson(jsonObject);
  26438. var themeObj = this.theme;
  26439. var themeT = themeObj && themeObj.type;
  26440. switch (themeT) {
  26441. case 'LABEL':
  26442. this.theme = ThemeLabel.fromObj(themeObj);
  26443. break;
  26444. case 'UNIQUE':
  26445. this.theme = ThemeUnique.fromObj(themeObj);
  26446. break;
  26447. case 'GRAPH':
  26448. this.theme = ThemeGraph.fromObj(themeObj);
  26449. break;
  26450. case 'DOTDENSITY':
  26451. this.theme = ThemeDotDensity.fromObj(themeObj);
  26452. break;
  26453. case 'GRADUATEDSYMBOL':
  26454. this.theme = ThemeGraduatedSymbol.fromObj(themeObj);
  26455. break;
  26456. case 'RANGE':
  26457. this.theme = ThemeRange.fromObj(themeObj);
  26458. break;
  26459. default:
  26460. break;
  26461. }
  26462. if (this.themeElementPosition) {
  26463. //待测试
  26464. this.themeElementPosition = new LonLat(this.themeElementPosition.x, this.themeElementPosition.y);
  26465. }
  26466. }
  26467. /**
  26468. * @function ServerTheme.prototype.toServerJSONObject
  26469. * @description 转换成对应的 JSON 格式对象。
  26470. */
  26471. toServerJSONObject() {
  26472. //普通属性直接赋值
  26473. var jsonObject = super.toServerJSONObject();
  26474. if (jsonObject.themeElementPosition) {
  26475. if (jsonObject.themeElementPosition.toServerJSONObject) {
  26476. jsonObject.themeElementPosition = jsonObject.themeElementPosition.toServerJSONObject();
  26477. }
  26478. }
  26479. if (jsonObject.theme) {
  26480. if (jsonObject.theme.toServerJSONObject) {
  26481. jsonObject.theme = jsonObject.theme.toServerJSONObject();
  26482. }
  26483. }
  26484. return jsonObject;
  26485. }
  26486. }
  26487. ;// CONCATENATED MODULE: ./src/common/iServer/ColorDictionary.js
  26488. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  26489. * This program are made available under the terms of the Apache License, Version 2.0
  26490. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26491. /**
  26492. * @class ColorDictionary
  26493. * @deprecatedclass SuperMap.ColorDictionary
  26494. * @category iServer Map Theme
  26495. * @classdesc 颜色对照表类。颜色对照表中的键名为具体的高程值,键值表示该高程值要显示的颜色。
  26496. * 对于栅格图层中高程值小于颜色对照表中高程最小值的点使用颜色对照表中高程最小值对应的颜色,
  26497. * 对于栅格图层中高程值大于颜色对照表中高程最大值的点使用颜色对照表中高程最大值对应的颜色,
  26498. * 对于栅格图层中高程值在颜色对照表中没有对应颜色的点,则查找颜色对照表中与当前高程值相邻的两个高程对应的颜色,
  26499. * 然后通过渐变运算要显示的颜色。如果设置了颜色对照表的话,则颜色表设置无效。
  26500. * @param {Object} options - 参数。
  26501. * @param {number} options.elevation - 高程值。
  26502. * @param {ServerColor} options.color - 服务端颜色类。
  26503. * @usage
  26504. */
  26505. class ColorDictionary {
  26506. constructor(options) {
  26507. options = options || {};
  26508. /**
  26509. * @member {number} ColorDictionary.prototype.elevation
  26510. * @description 高程值。
  26511. */
  26512. this.elevation = null;
  26513. /**
  26514. * @member {ServerColor} ColorDictionary.prototype.color
  26515. * @description 服务端颜色类。
  26516. */
  26517. this.color = null;
  26518. Util_Util.extend(this, options);
  26519. var me = this,
  26520. c = me.color;
  26521. if (c) {
  26522. me.color = new ServerColor(c.red, c.green, c.blue);
  26523. }
  26524. this.CLASS_NAME = "SuperMap.ColorDictionary";
  26525. }
  26526. /**
  26527. * @function ColorDictionary.prototype.destroy
  26528. * @description 释放资源,将引用资源的属性置空。
  26529. */
  26530. destroy() {
  26531. Util_Util.reset(this);
  26532. }
  26533. /**
  26534. * @function ColorDictionary.prototype.toServerJSONObject
  26535. * @description 转换成对应的 JSON 格式对象。
  26536. * @returns {Object} JSON 对象。
  26537. */
  26538. toServerJSONObject() {
  26539. var dataObj = {};
  26540. dataObj = Util_Util.copyAttributes(dataObj, this);
  26541. return dataObj;
  26542. }
  26543. }
  26544. ;// CONCATENATED MODULE: ./src/common/iServer/Grid.js
  26545. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  26546. * This program are made available under the terms of the Apache License, Version 2.0
  26547. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26548. /**
  26549. * @class Grid
  26550. * @deprecatedclass SuperMap.Grid
  26551. * @category iServer Map Layer
  26552. * @classdesc SuperMap 栅格图层类。
  26553. * @extends {UGCSubLayer}
  26554. * @param {Object} options - 可选参数。
  26555. * @param {Array.<Object>} [options.colorDictionary] - 颜色对照表对象。
  26556. * @param {number} [options.brightness] - Grid 图层的亮度。
  26557. * @param {ColorGradientType} [options.colorGradientType] - 颜色渐变枚举。
  26558. * @param {ServerColor} [options.colors] - 颜色表对象。
  26559. * @param {number} [options.contrast] - Grid 图层的对比度。
  26560. * @param {GridType} [options.gridType] - 格网类型。
  26561. * @param {number} [options.horizontalSpacing] - 格网水平间隔大小。
  26562. * @param {boolean} [options.sizeFixed] - 格网是否固定大小,如果不固定大小,则格网随着地图缩放。
  26563. * @param {ServerStyle} [options.solidStyle] - 格网实线的样式。
  26564. * @param {ServerColor} [options.specialColor] - 栅格数据集无值数据的颜色。
  26565. * @param {number} [options.specialValue] - 图层的特殊值。
  26566. * @param {boolean} [options.specialValueTransparent] - 图层的特殊值(specialValue)所处区域是否透明。
  26567. * @param {number} [options.verticalSpacing] - 格网垂直间隔大小。
  26568. * @usage
  26569. */
  26570. class Grid extends UGCSubLayer {
  26571. constructor(options) {
  26572. options = options || {};
  26573. super(options);
  26574. /**
  26575. * @member {Array.<ColorDictionary>} Grid.prototype.colorDictionarys
  26576. * @description 颜色对照表对象。
  26577. */
  26578. this.colorDictionarys = null;
  26579. /**
  26580. * @member {number} Grid.prototype.brightness
  26581. * @description Grid 图层的亮度。
  26582. */
  26583. this.brightness = null;
  26584. /**
  26585. * @member {ColorGradientType} Grid.prototype.colorGradientType
  26586. * @description 渐变颜色枚举值。
  26587. */
  26588. this.colorGradientType = null;
  26589. /**
  26590. * @member {ServerColor} Grid.prototype.colors
  26591. * @description 颜色表对象。
  26592. */
  26593. this.colors = null;
  26594. /**
  26595. * @member {number} Grid.prototype.contrast
  26596. * @description Grid 图层的对比度。
  26597. */
  26598. this.contrast = null;
  26599. /**
  26600. * @member {ServerStyle} Grid.prototype.dashStyle
  26601. * @description 栅格数据集特殊值数据的颜色。
  26602. */
  26603. this.dashStyle = null;
  26604. /**
  26605. * @member {GridType} Grid.prototype.gridType
  26606. * @description 格网类型。
  26607. */
  26608. this.gridType = null;
  26609. /**
  26610. * @member {number} Grid.prototype.horizontalSpacing
  26611. * @description 格网水平间隔大小。
  26612. */
  26613. this.horizontalSpacing = null;
  26614. /**
  26615. * @member {boolean} Grid.prototype.sizeFixed
  26616. * @description 格网是否固定大小,如果不固定大小,则格网随着地图缩放。
  26617. */
  26618. this.sizeFixed = null;
  26619. /**
  26620. * @member {ServerStyle} Grid.prototype.solidStyle
  26621. * @description 格网实线的样式。
  26622. */
  26623. this.solidStyle = null;
  26624. /**
  26625. * @member {ServerColor} Grid.prototype.specialColor
  26626. * @description 栅格数据集无值数据的颜色。
  26627. */
  26628. this.specialColor = null;
  26629. /**
  26630. * @member {number} Grid.prototype.specialValue
  26631. * @description 图层的特殊值。
  26632. */
  26633. this.specialValue = null;
  26634. /**
  26635. * @member {boolean} Grid.prototype.specialValueTransparent
  26636. * @description 图层的特殊值(specialValue)所处区域是否透明。
  26637. */
  26638. this.specialValueTransparent = null;
  26639. /**
  26640. * @member {number} Grid.prototype.verticalSpacing
  26641. * @description 格网垂直间隔大小。
  26642. */
  26643. this.verticalSpacing = null;
  26644. this.CLASS_NAME = "SuperMap.Grid";
  26645. }
  26646. /**
  26647. * @function Grid.prototype.destroy
  26648. * @description 释放资源,将引用资源的属性置空。
  26649. */
  26650. destroy() {
  26651. super.destroy();
  26652. Util_Util.reset(this);
  26653. }
  26654. /**
  26655. * @function Grid.prototype.fromJson
  26656. * @description 将服务端 JSON 对象转换成当前客户端对象。
  26657. * @param {Object} jsonObject - 要转换的 JSON 对象。
  26658. */
  26659. fromJson(jsonObject) {
  26660. super.fromJson(jsonObject);
  26661. if (this.specialColor) {
  26662. this.specialColor = new ServerColor(this.specialColor.red,
  26663. this.specialColor.green,
  26664. this.specialColor.blue);
  26665. }
  26666. if (this.colors) {
  26667. var colors = [],
  26668. color;
  26669. for (var i in this.colors) {
  26670. color = this.colors[i];
  26671. colors.push(new ServerColor(color.red, color.green, color.blue));
  26672. }
  26673. this.colors = colors;
  26674. }
  26675. if (this.dashStyle) {
  26676. this.dashStyle = new ServerStyle(this.dashStyle);
  26677. }
  26678. if (this.solidStyle) {
  26679. this.solidStyle = new ServerStyle(this.solidStyle);
  26680. }
  26681. if (this.colorDictionary) {
  26682. var colorDics = [],
  26683. colorDic;
  26684. for (var key in this.colorDictionary) {
  26685. colorDic = this.colorDictionary[key];
  26686. colorDics.push(new ColorDictionary({elevation: key, color: colorDic}));
  26687. }
  26688. this.colorDictionarys = colorDics;
  26689. }
  26690. delete this.colorDictionary;
  26691. }
  26692. /**
  26693. * @function Grid.prototype.toServerJSONObject
  26694. * @description 转换成对应的 JSON 对象。
  26695. * @returns JSON 对象。
  26696. */
  26697. toServerJSONObject() {
  26698. var jsonObject = super.toServerJSONObject();
  26699. if (jsonObject.dashStyle) {
  26700. if (jsonObject.dashStyle.toServerJSONObject) {
  26701. jsonObject.dashStyle = jsonObject.dashStyle.toServerJSONObject();
  26702. }
  26703. }
  26704. if (jsonObject.solidStyle) {
  26705. if (jsonObject.solidStyle.toServerJSONObject) {
  26706. jsonObject.solidStyle = jsonObject.solidStyle.toServerJSONObject();
  26707. }
  26708. }
  26709. return jsonObject;
  26710. }
  26711. }
  26712. ;// CONCATENATED MODULE: ./src/common/iServer/Image.js
  26713. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  26714. * This program are made available under the terms of the Apache License, Version 2.0
  26715. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26716. /**
  26717. * @class UGCImage
  26718. * @deprecatedclass SuperMap.Image
  26719. * @category iServer Map Layer
  26720. * @classdesc SuperMap 影像图层类
  26721. * @extends {UGCSubLayer}
  26722. * @param {Object} options - 可选参数。
  26723. * @param {ColorSpaceType} [options.colorSpaceType] - 返回影像图层的色彩显示模式。
  26724. * @param {number} [options.brightness] - 影像图层的亮度。
  26725. * @param {Array.<number>} [options.displayBandIndexes] - 返回当前影像图层显示的波段索引。
  26726. * @param {number} [options.contrast] - 影像图层的对比度。
  26727. * @param {boolean} [options.transparent] - 是否背景透明。
  26728. * @param {ServerColor} [options.transparentColor] - 返回背景透明色。
  26729. * @param {number} [options.transparentColorTolerance] - 背景透明色容限。
  26730. * @usage
  26731. * @private
  26732. */
  26733. class UGCImage extends UGCSubLayer {
  26734. constructor(options) {
  26735. options = options || {};
  26736. super(options);
  26737. /**
  26738. * @member {number} UGCImage.prototype.brightness
  26739. * @description 影像图层的亮度。
  26740. */
  26741. this.brightness = null;
  26742. /**
  26743. * @member {ColorSpaceType} UGCImage.prototype.colorSpaceType
  26744. * @description 返回影像图层的色彩显示模式。
  26745. */
  26746. this.colorSpaceType = null;
  26747. /**
  26748. * @member {number} UGCImage.prototype.contrast
  26749. * @description 影像图层的对比度。
  26750. */
  26751. this.contrast = null;
  26752. /**
  26753. * @member {Array.<number>} UGCImage.prototype.displayBandIndexes
  26754. * @description 返回当前影像图层显示的波段索引。
  26755. */
  26756. this.displayBandIndexes = null;
  26757. /**
  26758. * @member {boolean} UGCImage.prototype.transparent
  26759. * @description 是否背景透明。
  26760. */
  26761. this.transparent = null;
  26762. /**
  26763. * @member {ServerColor} UGCImage.prototype.transparentColor
  26764. * @description 返回背景透明色。
  26765. */
  26766. this.transparentColor = null;
  26767. /**
  26768. * @member {number} UGCImage.prototype.transparentColorTolerance
  26769. * @description 背景透明色容限。
  26770. */
  26771. this.transparentColorTolerance = null;
  26772. this.CLASS_NAME = "SuperMap.Image";
  26773. }
  26774. /**
  26775. * @function UGCImage.prototype.destroy
  26776. * @override
  26777. */
  26778. destroy() {
  26779. super.destroy();
  26780. Util_Util.reset(this);
  26781. }
  26782. /**
  26783. * @function UGCImage.prototype.fromJson
  26784. * @description 将服务端 JSON 对象转换成当前客户端对象。
  26785. * @param {Object} jsonObject - 要转换的 JSON 对象。
  26786. */
  26787. fromJson(jsonObject) {
  26788. super.fromJson(jsonObject);
  26789. if (this.transparentColor) {
  26790. this.transparentColor = new ServerColor(this.transparentColor.red,
  26791. this.transparentColor.green,
  26792. this.transparentColor.blue);
  26793. }
  26794. }
  26795. /**
  26796. * @function UGCImage.prototype.toServerJSONObject
  26797. * @description 转换成对应的 JSON 格式对象。
  26798. */
  26799. toServerJSONObject() {
  26800. return super.toServerJSONObject();
  26801. }
  26802. }
  26803. ;// CONCATENATED MODULE: ./src/common/iServer/Vector.js
  26804. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  26805. * This program are made available under the terms of the Apache License, Version 2.0
  26806. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26807. /**
  26808. * @class Vector
  26809. * @deprecatedclass SuperMap.Vector
  26810. * @category iServer Map Layer
  26811. * @classdesc SuperMap 矢量图层类。
  26812. * @extends {UGCSubLayer}
  26813. * @param {Object} options - 可选参数。
  26814. * @param {ServerStyle} [options.style] - 矢量图层的风格。
  26815. * @usage
  26816. */
  26817. class Vector_Vector extends UGCSubLayer {
  26818. constructor(options) {
  26819. options = options || {};
  26820. super(options);
  26821. /**
  26822. * @member {ServerStyle} Vector.prototype.style
  26823. * @description 矢量图层的风格。
  26824. */
  26825. this.style = null;
  26826. this.CLASS_NAME = "SuperMap.Vector";
  26827. }
  26828. /**
  26829. * @function Vector.prototype.destroy
  26830. * @description 销毁对象,将其属性置空。
  26831. * @override
  26832. */
  26833. destroy() {
  26834. super.destroy();
  26835. Util_Util.reset(this);
  26836. }
  26837. /**
  26838. * @function Vector.prototype.fromJson
  26839. * @description 将服务端 JSON 对象转换成当前客户端对象。
  26840. * @param {Object} jsonObject - 要转换的 JSON 对象。
  26841. */
  26842. fromJson(jsonObject) {
  26843. super.fromJson(jsonObject);
  26844. var sty = this.style;
  26845. if (sty) {
  26846. this.style = new ServerStyle(sty);
  26847. }
  26848. }
  26849. /**
  26850. * @function Vector.prototype.toServerJSONObject
  26851. * @description 转换成对应的 JSON 格式对象。
  26852. * @returns {Object} 对应的 JSON 格式对象
  26853. */
  26854. toServerJSONObject() {
  26855. var jsonObject = super.toServerJSONObject();
  26856. if (jsonObject.style) {
  26857. if (jsonObject.style.toServerJSONObject) {
  26858. jsonObject.style = jsonObject.style.toServerJSONObject();
  26859. }
  26860. }
  26861. return jsonObject;
  26862. }
  26863. }
  26864. ;// CONCATENATED MODULE: ./src/common/iServer/GetLayersInfoService.js
  26865. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  26866. * This program are made available under the terms of the Apache License, Version 2.0
  26867. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26868. /**
  26869. * @class GetLayersInfoService
  26870. * @deprecatedclass SuperMap.GetLayersInfoService
  26871. * @category iServer Map Layer
  26872. * @classdesc 获取图层信息服务类构造函数。
  26873. * @extends {CommonServiceBase}
  26874. * @param {string} url - 服务地址。请求地图服务,URL 应为:
  26875. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  26876. * 如 http://localhost:8090/iserver/services/map-world/rest/maps/World 。
  26877. * 如果查询临时图层的信息,请指定完成的url,包含临时图层ID信息,如:
  26878. * http://localhost:8090/iserver/services/map-world/rest/maps/World/tempLayersSet/resourceID
  26879. * @param {Object} options - 参数。
  26880. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  26881. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  26882. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  26883. * @param {Object} [options.headers] - 请求头。
  26884. * @param {boolean} options.isTempLayers - 当前url对应的图层是否是临时图层。
  26885. * @usage
  26886. */
  26887. class GetLayersInfoService extends CommonServiceBase {
  26888. constructor(url, options) {
  26889. super(url, options);
  26890. /**
  26891. * @member {boolean} GetLayersInfoService.prototype.isTempLayers
  26892. * @description 当前url对应的图层是否是临时图层。
  26893. */
  26894. this.isTempLayers = false;
  26895. if (options) {
  26896. Util_Util.extend(this, options);
  26897. }
  26898. this.CLASS_NAME = "SuperMap.GetLayersInfoService";
  26899. }
  26900. /**
  26901. * @function GetLayersInfoService.prototype.destroy
  26902. * @override
  26903. */
  26904. destroy() {
  26905. super.destroy();
  26906. Util_Util.reset(this);
  26907. }
  26908. /**
  26909. * @function GetLayersInfoService.prototype.processAsync
  26910. * @description 负责将客户端的更新参数传递到服务端。
  26911. */
  26912. processAsync() {
  26913. var me = this,
  26914. method = "GET";
  26915. if (!me.isTempLayers) {
  26916. me.url = Util_Util.urlPathAppend(me.url, 'layers');
  26917. }
  26918. me.request({
  26919. method: method,
  26920. params: null,
  26921. scope: me,
  26922. success: me.serviceProcessCompleted,
  26923. failure: me.serviceProcessFailed
  26924. });
  26925. }
  26926. /**
  26927. * @function GetLayersInfoService.prototype.serviceProcessCompleted
  26928. * @description 编辑完成,执行此方法。
  26929. * @param {Object} result - 服务器返回的结果对象。
  26930. */
  26931. serviceProcessCompleted(result, options) {
  26932. var me = this, existRes, layers, len;
  26933. result = Util_Util.transformResult(result);
  26934. existRes = !!result && result.length > 0;
  26935. layers = existRes ? result[0].subLayers.layers : null;
  26936. len = layers ? layers.length : 0;
  26937. me.handleLayers(len, layers);
  26938. me.events.triggerEvent("processCompleted", {result: result[0], options});
  26939. }
  26940. /**
  26941. * TODO 专题图时候可能会用到
  26942. * @function GetLayersInfoService.prototype.handleLayers
  26943. * @description 处理 iServer 新增图层组数据 (subLayers.layers 中可能还会含有 subLayers.layers)
  26944. * @param {number} len - subLayers.layers的长度
  26945. * @param {Array.<number>} layers - subLayers.layers的长度数组
  26946. */
  26947. handleLayers(len, layers) {
  26948. var me = this, tempLayer;
  26949. if (len) {
  26950. for (var i = 0; i < len; i++) {
  26951. if (layers[i].subLayers && layers[i].subLayers.layers && layers[i].subLayers.layers.length > 0) {
  26952. me.handleLayers(layers[i].subLayers.layers.length, layers[i].subLayers.layers);
  26953. } else {
  26954. var type = layers[i].ugcLayerType;
  26955. switch (type) {
  26956. case 'THEME':
  26957. tempLayer = new ServerTheme();
  26958. tempLayer.fromJson(layers[i]);
  26959. layers[i] = tempLayer;
  26960. break;
  26961. case 'GRID':
  26962. tempLayer = new Grid();
  26963. tempLayer.fromJson(layers[i]);
  26964. layers[i] = tempLayer;
  26965. break;
  26966. case 'IMAGE':
  26967. tempLayer = new UGCImage();
  26968. tempLayer.fromJson(layers[i]);
  26969. layers[i] = tempLayer;
  26970. break;
  26971. case 'VECTOR':
  26972. tempLayer = new Vector_Vector();
  26973. tempLayer.fromJson(layers[i]);
  26974. layers[i] = tempLayer;
  26975. break;
  26976. default:
  26977. break;
  26978. }
  26979. }
  26980. }
  26981. }
  26982. }
  26983. }
  26984. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayerInfoService.js
  26985. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  26986. * This program are made available under the terms of the Apache License, Version 2.0
  26987. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26988. /**
  26989. * @class SetLayerInfoService
  26990. * @deprecatedclass SuperMap.SetLayerInfoService
  26991. * @category iServer Map TempLayersSet
  26992. * @classdesc 设置图层信息服务类。可以实现临时图层中子图层的修改
  26993. * 该类负责将图层设置参数传递到服务端,并获取服务端返回的结果信息。
  26994. * @extends {CommonServiceBase}
  26995. * @param {string} url - 服务地址。请求地图服务,URL 应为:
  26996. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名}/tempLayersSet/{tempLayerID}/Rivers@World@@World";
  26997. * @param {Object} options - 参数。
  26998. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  26999. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  27000. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  27001. * @param {Object} [options.headers] - 请求头。
  27002. * @usage
  27003. */
  27004. class SetLayerInfoService extends CommonServiceBase {
  27005. constructor(url, options) {
  27006. super(url, options);
  27007. if (options) {
  27008. Util_Util.extend(this, options);
  27009. }
  27010. this.CLASS_NAME = "SuperMap.SetLayerInfoService";
  27011. }
  27012. /**
  27013. * @override
  27014. */
  27015. destroy() {
  27016. super.destroy();
  27017. Util_Util.reset(this);
  27018. }
  27019. /**
  27020. * @function SetLayerInfoService.prototype.processAsync
  27021. * @description 负责将客户端的更新参数传递到服务端。
  27022. * @param {Object} params - 修改后的图层资源信息。
  27023. * 该参数可以使用获取图层信息服务<{@link GetLayersInfoService}>返回图层信息,解析结果result.subLayers.layers[i],然后对其属性进行修改来获取。
  27024. */
  27025. processAsync(params) {
  27026. if (!params) {
  27027. return;
  27028. }
  27029. var me = this;
  27030. var jsonParamsStr = Util_Util.toJSON(params);
  27031. me.request({
  27032. method: "PUT",
  27033. data: jsonParamsStr,
  27034. scope: me,
  27035. success: me.serviceProcessCompleted,
  27036. failure: me.serviceProcessFailed
  27037. });
  27038. }
  27039. }
  27040. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayersInfoService.js
  27041. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  27042. * This program are made available under the terms of the Apache License, Version 2.0
  27043. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27044. /**
  27045. * @class SetLayersInfoService
  27046. * @deprecatedclass SuperMap.SetLayersInfoService
  27047. * @category iServer Map TempLayersSet
  27048. * @classdesc 设置图层信息服务类。可以实现创建新的临时图层和对现有临时图层的修改,
  27049. * 当 isTempLayers 为 false的时候执行创建临时图层。当 isTempLayers 为 ture 并且临时图层资源 resourceID 被设置有效时执行对临时图层的编辑。
  27050. * 该类负责将图层设置参数传递到服务端,并获取服务端返回的结果信息。
  27051. * @extends {CommonServiceBase}
  27052. * @param url - {string} 服务地址。请求地图服务,URL 应为:
  27053. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  27054. * @param {Object} options - 参数。
  27055. * @param {string} options.resourceID - 图层资源ID,临时图层的资源ID标记。
  27056. * @param {boolean} options.isTempLayers - 当前url对应的图层是否是临时图层。
  27057. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  27058. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  27059. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  27060. * @param {Object} [options.headers] - 请求头。
  27061. * @usage
  27062. */
  27063. class SetLayersInfoService extends CommonServiceBase {
  27064. constructor(url, options) {
  27065. super(url, options);
  27066. /**
  27067. * @member {string} SetLayersInfoService.prototype.resourceID
  27068. * @description 图层资源ID,临时图层的资源ID标记。
  27069. */
  27070. this.resourceID = null;
  27071. /**
  27072. * @function {boolean} SetLayersInfoService.prototype.isTempLayers
  27073. * @description 当前url对应的图层是否是临时图层。
  27074. */
  27075. this.isTempLayers = false;
  27076. if (options) {
  27077. Util_Util.extend(this, options);
  27078. }
  27079. this.CLASS_NAME = "SuperMap.SetLayersInfoService";
  27080. }
  27081. /**
  27082. * @override
  27083. */
  27084. destroy() {
  27085. super.destroy();
  27086. Util_Util.reset(this);
  27087. }
  27088. /**
  27089. * @function SetLayersInfoService.prototype.processAsync
  27090. * @description 负责将客户端的更新参数传递到服务端。
  27091. * @param {Object} params - 修改后的图层资源信息。该参数可以使用获取图层信息服务 <{@link GetLayersInfoService}>返回图层信息,然后对其属性进行修改来获取。
  27092. */
  27093. processAsync(params) {
  27094. if (!params) {
  27095. return;
  27096. }
  27097. var jsonParams,
  27098. subLayers = [],
  27099. me = this,
  27100. method = "";
  27101. //创建临时图层和设置修改临时图层信息对应不同的资源URL
  27102. if (me.isTempLayers) {
  27103. me.url = Util_Util.urlPathAppend(me.url, "tempLayersSet/" + me.resourceID);
  27104. method = "PUT";
  27105. } else {
  27106. me.url = Util_Util.urlPathAppend(me.url, "tempLayersSet");
  27107. method = "POST";
  27108. }
  27109. if (!params.subLayers) {
  27110. params.subLayers = {layers: []}
  27111. }
  27112. if (!params.subLayers.layers) {
  27113. params.subLayers.layers = [];
  27114. }
  27115. var layers = params.subLayers.layers,
  27116. len = layers.length;
  27117. for (let i in layers) {
  27118. if (layers[i].ugcLayerType === "GRID") {
  27119. var colorDictionary = {};
  27120. var colorDics = layers[i].colorDictionarys;
  27121. for (var j in colorDics) {
  27122. var key = colorDics[j].elevation;
  27123. colorDictionary[key] = colorDics[j].color;
  27124. }
  27125. }
  27126. layers[i].colorDictionary = colorDictionary;
  27127. delete layers[i].colorDictionarys;
  27128. }
  27129. for (let i = 0; i < len; i++) {
  27130. if (layers[i].toJsonObject) {
  27131. //将图层信息转换成服务端能识别的简单json对象
  27132. subLayers.push(layers[i].toJsonObject());
  27133. } else {
  27134. subLayers.push(layers[i]);
  27135. }
  27136. }
  27137. jsonParams = Util_Util.extend(jsonParams, params);
  27138. jsonParams.subLayers = {"layers": subLayers};
  27139. jsonParams.object = null;
  27140. var jsonParamsStr = Util_Util.toJSON([jsonParams]);
  27141. me.request({
  27142. method: method,
  27143. data: jsonParamsStr,
  27144. scope: me,
  27145. success: me.serviceProcessCompleted,
  27146. failure: me.serviceProcessFailed
  27147. });
  27148. }
  27149. }
  27150. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayerStatusParameters.js
  27151. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  27152. * This program are made available under the terms of the Apache License, Version 2.0
  27153. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27154. /**
  27155. * @class SetLayerStatusParameters
  27156. * @deprecatedclass SuperMap.SetLayerStatusParameters
  27157. * @category iServer Map TempLayersSet
  27158. * @classdesc 子图层显示控制参数类,该类存储了各子图层是否可见的状态。
  27159. * 注意在 SuperMap iClient 系列产品中所说的图层与 SuperMap Deskpro 的地图对应,子图层与 SuperMap Deskpro 的图层对应。
  27160. * @param {Object} options - 参数。
  27161. * @param {Array.<LayerStatus>} options.layerStatusList - 获取或设置图层可见状态({@link LayerStatus})集合,
  27162. * 集合中的每个 {@link LayerStatus} 对象代表一个子图层的可视状态。
  27163. * @param {number} [options.holdTime=15] - 获取或设置资源在服务端保存的时间。
  27164. * @param {string} [options.resourceID] - 获取或设置资源服务 ID。
  27165. * @usage
  27166. */
  27167. class SetLayerStatusParameters {
  27168. constructor(options) {
  27169. /**
  27170. * @member {Array.<LayerStatus>} SetLayerStatusParameters.prototype.layerStatusList
  27171. * @description 获取或设置图层可见状态({@link LayerStatus})集合,集合中的每个 {@link LayerStatus} 对象代表一个子图层的可视状态。
  27172. */
  27173. this.layerStatusList = [];
  27174. /**
  27175. * @member {number} [SetLayerStatusParameters.prototype.holdTime=15]
  27176. * @description 获取或设置资源在服务端保存的时间。单位为分钟。
  27177. */
  27178. this.holdTime = 15;
  27179. /**
  27180. * @member {string} SetLayerStatusParameters.prototype.resourceID
  27181. * @description 获取或设置资源服务ID。如果设置该参数则会在指定的 TempLayer 中进行图层的显示控制;
  27182. * 如果不设置该参数,则会首先创建一个 TempLayer ,然后在新创建的 TempLayer 中进行图层的显示控制。
  27183. */
  27184. this.resourceID = null;
  27185. if (options) {
  27186. Util_Util.extend(this, options);
  27187. }
  27188. }
  27189. /**
  27190. * @function SetLayerStatusParameters.prototype.destroy
  27191. * @description 释放资源,将引用资源的属性置空。
  27192. */
  27193. destroy() {
  27194. var me = this;
  27195. me.layerStatusList = null;
  27196. me.holdTime = null;
  27197. me.resourceID = null;
  27198. }
  27199. /**
  27200. * @function SetLayerStatusParameters.prototype.toJSON
  27201. * @description 生成 JSON。
  27202. * @returns {Object} 对应的 JSON 对象。
  27203. */
  27204. toJSON() {
  27205. var json = '{';
  27206. json += '"layers":[';
  27207. var v = [];
  27208. for (var i = 0, len = this.layerStatusList.length; i < len; i++) {
  27209. v.push(this.layerStatusList[i].toJSON());
  27210. }
  27211. json += v;
  27212. json += ']';
  27213. json += '}';
  27214. return json;
  27215. }
  27216. }
  27217. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayerStatusService.js
  27218. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  27219. * This program are made available under the terms of the Apache License, Version 2.0
  27220. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27221. /**
  27222. * @class SetLayerStatusService
  27223. * @deprecatedclass SuperMap.SetLayerStatusService
  27224. * @category iServer Map TempLayersSet
  27225. * @classdesc 子图层显示控制服务类。该类负责将子图层显示控制参数传递到服务端,并获取服务端返回的图层显示状态。
  27226. * 用户获取服务端返回的各子图层显示状态有两种方式:
  27227. * 一种是通过监听 SetLayerEvent.PROCESS_COMPLETE 事件;
  27228. * 一种是使用 AsyncResponder 类实现异步处理。
  27229. * @extends {CommonServiceBase}
  27230. * @param {string} url - 服务地址。请求地图服务,URL 应为:
  27231. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  27232. * @param {Object} options - 参数。
  27233. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  27234. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  27235. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  27236. * @param {Object} [options.headers] - 请求头。
  27237. * @usage
  27238. */
  27239. class SetLayerStatusService extends CommonServiceBase {
  27240. constructor(url, options) {
  27241. super(url, options);
  27242. this.lastparams = null;
  27243. this.mapUrl = url;
  27244. if (options) {
  27245. Util_Util.extend(this, options);
  27246. }
  27247. this.CLASS_NAME = "SuperMap.SetLayerStatusService";
  27248. }
  27249. /**
  27250. * @override
  27251. */
  27252. destroy() {
  27253. super.destroy();
  27254. Util_Util.reset(this);
  27255. }
  27256. /**
  27257. * @function SetLayerStatusService.prototype.processAsync
  27258. * @description 负责将客户端的更新参数传递到服务端。
  27259. * @param {Object} params - 修改后的图层资源信息。该参数可以使用获取图层信息服务{@link SetLayerStatusParameters}
  27260. * 返回图层信息,然后对其属性进行修改来获取。
  27261. */
  27262. processAsync(params) {
  27263. if (!(params instanceof SetLayerStatusParameters)) {
  27264. return;
  27265. }
  27266. var me = this,
  27267. method = "POST";
  27268. me.url = me.mapUrl;
  27269. if (params.resourceID == null) {
  27270. me.url = Util_Util.urlPathAppend(me.url, 'tempLayersSet');
  27271. me.lastparams = params;
  27272. me.request({
  27273. method: method,
  27274. scope: me,
  27275. success: me.createTempLayerComplete,
  27276. failure: me.serviceProcessFailed
  27277. });
  27278. } else {
  27279. me.url = Util_Util.urlPathAppend(me.url, "tempLayersSet/" + params.resourceID);
  27280. me.url = Util_Util.urlAppend(me.url, "elementRemain=true&reference=" + params.resourceID + "&holdTime=" + params.holdTime.toString());
  27281. var jsonParameters = '[{';
  27282. jsonParameters += '"type":"UGC",';
  27283. if (params.layerStatusList != null && params.layerStatusList.length > 0) {
  27284. jsonParameters += '"subLayers":' + params.toJSON();
  27285. }
  27286. jsonParameters += ',"visible":' + true + ',';
  27287. jsonParameters += '"name":"' + this.getMapName(this.mapUrl) + '"';
  27288. jsonParameters += '}]';
  27289. me.request({
  27290. method: "PUT",
  27291. data: jsonParameters,
  27292. scope: me,
  27293. success: me.serviceProcessCompleted,
  27294. failure: me.serviceProcessFailed
  27295. });
  27296. }
  27297. }
  27298. /**
  27299. * @function SetLayerStatusService.prototype.createTempLayerComplete
  27300. * @description 设置完成,执行此方法。
  27301. * @param {Object} result - 服务器返回的结果对象,记录设置操作是否成功。
  27302. */
  27303. createTempLayerComplete(result) {
  27304. var me = this;
  27305. result = Util_Util.transformResult(result);
  27306. if (result.succeed) {
  27307. me.lastparams.resourceID = result.newResourceID;
  27308. }
  27309. me.processAsync(me.lastparams);
  27310. }
  27311. /**
  27312. * @function SetLayerStatusService.prototype.getMapName
  27313. * @description 获取地图名称。
  27314. * @param {Object} url - 服务地址。
  27315. */
  27316. getMapName(url) {
  27317. var mapUrl = url;
  27318. if (mapUrl.charAt(mapUrl.length - 1) === "/") {
  27319. mapUrl = mapUrl.substr(0, mapUrl.length - 1);
  27320. }
  27321. var index = mapUrl.lastIndexOf("/");
  27322. var mapName = mapUrl.substring(index + 1, mapUrl.length);
  27323. return mapName;
  27324. }
  27325. /**
  27326. * @function SetLayerStatusService.prototype.setLayerCompleted
  27327. * @description 设置完成,执行此方法。
  27328. * @param {Object} result - 服务器返回的结果对象,记录设置操作是否成功。
  27329. */
  27330. serviceProcessCompleted(result, options) {
  27331. var me = this;
  27332. result = Util_Util.transformResult(result);
  27333. if (result != null && me.lastparams != null) {
  27334. result.newResourceID = me.lastparams.resourceID;
  27335. }
  27336. me.events.triggerEvent("processCompleted", {result: result, options});
  27337. }
  27338. }
  27339. ;// CONCATENATED MODULE: ./src/common/iServer/LayerInfoService.js
  27340. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  27341. * This program are made available under the terms of the Apache License, Version 2.0
  27342. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27343. /**
  27344. * @class LayerInfoService
  27345. * @category iServer Map Layer
  27346. * @classdesc 图层信息服务类。
  27347. * @extends {ServiceBase}
  27348. * @example
  27349. * new LayerInfoService(url).getLayersInfo(function(result){
  27350. * //doSomething
  27351. * })
  27352. * @param {string} url - 服务地址。请求地图服务,URL 应为:
  27353. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名}/tempLayersSet/{tempLayerID}/Rivers@World@@World"。
  27354. * @param {Object} options - 参数。
  27355. * @param {string} [options.proxy] - 服务代理地址。
  27356. * @param {boolean} [options.withCredentials=false] - 请求是否携带cookie。
  27357. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  27358. * @param {Object} [options.headers] - 请求头。
  27359. * @usage
  27360. */
  27361. class LayerInfoService_LayerInfoService {
  27362. constructor(url, options) {
  27363. this.url = url;
  27364. this.options = options || {};
  27365. }
  27366. /**
  27367. * @function LayerInfoService.prototype.getLayersInfo
  27368. * @description 获取图层信息服务。
  27369. * @param {RequestCallback} callback - 回调函数。
  27370. */
  27371. getLayersInfo(callback) {
  27372. var me = this;
  27373. var getLayersInfoService = new GetLayersInfoService(me.url, {
  27374. proxy: me.options.proxy,
  27375. withCredentials: me.options.withCredentials,
  27376. crossOrigin: me.options.crossOrigin,
  27377. headers: me.options.headers,
  27378. eventListeners: {
  27379. processCompleted: callback,
  27380. processFailed: callback
  27381. }
  27382. });
  27383. getLayersInfoService.processAsync();
  27384. }
  27385. /**
  27386. * @function LayerInfoService.prototype.setLayerInfo
  27387. * @description 设置图层信息服务。可以实现临时图层中子图层的修改。
  27388. * @param {SetLayerInfoParameters} params - 设置图层信息参数类。
  27389. * @param {RequestCallback} callback - 回调函数。
  27390. */
  27391. setLayerInfo(params, callback) {
  27392. if (!params) {
  27393. return;
  27394. }
  27395. var me = this,
  27396. resourceID = params.resourceID,
  27397. tempLayerName = params.tempLayerName,
  27398. layerInfoParams = params.layerInfo;
  27399. if (!resourceID || !tempLayerName) {
  27400. return;
  27401. }
  27402. var url = Util_Util.urlPathAppend(me.url, "tempLayersSet/" + resourceID + "/" + tempLayerName);
  27403. var setLayerInfoService = new SetLayerInfoService(url, {
  27404. proxy: me.options.proxy,
  27405. withCredentials: me.options.withCredentials,
  27406. crossOrigin: me.options.crossOrigin,
  27407. headers: me.options.headers,
  27408. eventListeners: {
  27409. processCompleted: callback,
  27410. processFailed: callback
  27411. }
  27412. });
  27413. setLayerInfoService.processAsync(layerInfoParams);
  27414. }
  27415. /**
  27416. * @function LayerInfoService.prototype.setLayersInfo
  27417. * @description 设置图层信息服务。可以创建新的临时图层和修改现有的临时图层。
  27418. * @param {SetLayersInfoParameters} params - 设置图层信息参数类。
  27419. * @param {RequestCallback} callback - 回调函数。
  27420. */
  27421. setLayersInfo(params, callback) {
  27422. if (!params) {
  27423. return;
  27424. }
  27425. var me = this,
  27426. resourceID = params.resourceID,
  27427. isTempLayers = params.isTempLayers ? params.isTempLayers : false,
  27428. layersInfo = params.layersInfo;
  27429. if ((isTempLayers && !resourceID) || !layersInfo) {
  27430. return;
  27431. }
  27432. var setLayersInfoService = new SetLayersInfoService(me.url, {
  27433. proxy: me.options.proxy,
  27434. withCredentials: me.options.withCredentials,
  27435. crossOrigin: me.options.crossOrigin,
  27436. headers: me.options.headers,
  27437. eventListeners: {
  27438. processCompleted: callback,
  27439. processFailed: callback
  27440. },
  27441. resourceID: resourceID,
  27442. isTempLayers: isTempLayers
  27443. });
  27444. setLayersInfoService.processAsync(layersInfo);
  27445. }
  27446. /**
  27447. * @function LayerInfoService.prototype.setLayerStatus
  27448. * @description 子图层显示控制服务。负责将子图层显示控制参数传递到服务端,并获取服务端返回的图层显示状态。
  27449. * @param {SetLayerStatusParameters} params - 子图层显示控制参数类。
  27450. * @param {RequestCallback} callback - 回调函数。
  27451. */
  27452. setLayerStatus(params, callback) {
  27453. if (!params) {
  27454. return;
  27455. }
  27456. var me = this;
  27457. var setLayerStatusService = new SetLayerStatusService(me.url, {
  27458. proxy: me.options.proxy,
  27459. withCredentials: me.options.withCredentials,
  27460. crossOrigin: me.options.crossOrigin,
  27461. headers: me.options.headers,
  27462. eventListeners: {
  27463. processCompleted: callback,
  27464. processFailed: callback
  27465. }
  27466. });
  27467. setLayerStatusService.processAsync(params);
  27468. }
  27469. }
  27470. ;// CONCATENATED MODULE: ./src/maplibregl/services/LayerInfoService.js
  27471. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  27472. * This program are made available under the terms of the Apache License, Version 2.0
  27473. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27474. /**
  27475. * @class LayerInfoService
  27476. * @category iServer Map Layer
  27477. * @classdesc 图层信息服务类。
  27478. * @version 11.1.0
  27479. * @modulecategory Services
  27480. * @extends {ServiceBase}
  27481. * @example
  27482. * new LayerInfoService(url).getLayersInfo(function(result){
  27483. * //doSomething
  27484. * })
  27485. * @param {string} url - 服务地址。请求地图服务,URL 应为:</br>
  27486. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名}/tempLayersSet/{tempLayerID}/Rivers@World@@World"。
  27487. * @param {Object} options - 参数。
  27488. * @param {string} [options.proxy] - 服务代理地址。
  27489. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  27490. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  27491. * @param {Object} [options.headers] - 请求头。
  27492. * @usage
  27493. */
  27494. class LayerInfoService extends ServiceBase {
  27495. constructor(url, options) {
  27496. super(url, options);
  27497. this._layerInfoService = new LayerInfoService_LayerInfoService(url, options);
  27498. }
  27499. /**
  27500. * @function LayerInfoService.prototype.getLayersInfo
  27501. * @description 获取图层信息服务。
  27502. * @param {RequestCallback} callback - 回调函数。
  27503. * @returns {LayerInfoService} 返回图层信息类。
  27504. */
  27505. getLayersInfo(callback) {
  27506. this._layerInfoService.getLayersInfo(callback);
  27507. }
  27508. /**
  27509. * @function LayerInfoService.prototype.setLayerInfo
  27510. * @description 设置图层信息服务。可以实现临时图层中子图层的修改。
  27511. * @param {SetLayerInfoParameters} params - 设置图层信息参数类。
  27512. * @param {RequestCallback} callback - 回调函数。
  27513. */
  27514. setLayerInfo(params, callback) {
  27515. this._layerInfoService.setLayerInfo(params, callback);
  27516. }
  27517. /**
  27518. * @function LayerInfoService.prototype.setLayersInfo
  27519. * @description 设置图层信息服务。可以实现创建新的临时图层和对现有临时图层的修改。
  27520. * @param {SetLayersInfoParameters} params - 设置图层信息参数类,包括临时图层。
  27521. * @param {RequestCallback} callback - 回调函数。
  27522. */
  27523. setLayersInfo(params, callback) {
  27524. this._layerInfoService.setLayersInfo(params, callback);
  27525. }
  27526. /**
  27527. * @function LayerInfoService.prototype.setLayerStatus
  27528. * @description 子图层显示控制服务。负责将子图层显示控制参数传递到服务端,并获取服务端返回的图层显示状态。
  27529. * @param {SetLayerStatusParameters} params - 子图层显示控制参数类。
  27530. * @param {RequestCallback} callback 回调函数。
  27531. */
  27532. setLayerStatus(params, callback) {
  27533. this._layerInfoService.setLayerStatus(params, callback);
  27534. }
  27535. }
  27536. ;// CONCATENATED MODULE: ./src/common/iServer/MapService.js
  27537. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  27538. * This program are made available under the terms of the Apache License, Version 2.0
  27539. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27540. /**
  27541. * @class MapService
  27542. * @deprecatedclass SuperMap.MapService
  27543. * @category iServer Map
  27544. * @classdesc 地图信息服务类。
  27545. * @extends {CommonServiceBase}
  27546. * @example
  27547. * var myMapService = new MapService(url, {
  27548. * eventListeners:{
  27549. * "processCompleted": MapServiceCompleted,
  27550. * "processFailed": MapServiceFailed
  27551. * }
  27552. * });
  27553. *
  27554. * @param {string} url - 服务地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 。
  27555. * @param {Object} options - 参数。
  27556. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  27557. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  27558. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  27559. * @param {Object} [options.headers] - 请求头。
  27560. * @usage
  27561. */
  27562. class MapService_MapService extends CommonServiceBase {
  27563. constructor(url, options) {
  27564. super(url, options);
  27565. /**
  27566. * @member {string} MapService.prototype.projection
  27567. * @description 根据投影参数获取地图状态信息。如"EPSG:4326"
  27568. */
  27569. this.projection = null;
  27570. this.CLASS_NAME = "SuperMap.MapService";
  27571. if (options) {
  27572. Util_Util.extend(this, options);
  27573. }
  27574. var me = this;
  27575. if (me.projection) {
  27576. var arr = me.projection.split(":");
  27577. if (arr instanceof Array) {
  27578. if (arr.length === 2) {
  27579. me.url = Util_Util.urlAppend(me.url,`prjCoordSys=${encodeURIComponent(`{\"epsgCode\":"${arr[1]}"}`)}`)
  27580. }
  27581. if (arr.length === 1) {
  27582. me.url = Util_Util.urlAppend(me.url,`prjCoordSys=${encodeURIComponent(`{\"epsgCode\":"${arr[0]}"}`)}`)
  27583. }
  27584. }
  27585. }
  27586. this.eventCount = 0;
  27587. }
  27588. /**
  27589. * @function destroy
  27590. * @description 释放资源,将引用的资源属性置空。
  27591. */
  27592. destroy() {
  27593. super.destroy();
  27594. var me = this;
  27595. if (me.events) {
  27596. me.events.un(me.eventListeners);
  27597. me.events.listeners = null;
  27598. me.events.destroy();
  27599. me.events = null;
  27600. me.eventListeners = null;
  27601. }
  27602. }
  27603. /**
  27604. * @function MapService.prototype.processAsync
  27605. * @description 负责将客户端的设置的参数传递到服务端,与服务端完成异步通讯。
  27606. */
  27607. processAsync(callback) {
  27608. let eventId = ++this.eventCount;
  27609. let eventListeners = {
  27610. scope: this,
  27611. processCompleted: function(result) {
  27612. if (eventId === result.result.eventId && callback) {
  27613. delete result.result.eventId;
  27614. callback(result);
  27615. this.events && this.events.un(eventListeners);
  27616. return false;
  27617. }
  27618. },
  27619. processFailed: function(result) {
  27620. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  27621. callback(result);
  27622. this.events && this.events.un(eventListeners);
  27623. return false;
  27624. }
  27625. }
  27626. }
  27627. this.events.on(eventListeners);
  27628. var me = this;
  27629. me.request({
  27630. method: "GET",
  27631. scope: me,
  27632. success(result, options) {
  27633. result.eventId = eventId;
  27634. this.serviceProcessCompleted(result, options);
  27635. },
  27636. failure(result, options) {
  27637. if (result.error) {
  27638. result.error.eventId = eventId;
  27639. }
  27640. result.eventId = eventId;
  27641. this.serviceProcessFailed(result, options);
  27642. }
  27643. });
  27644. }
  27645. /*
  27646. * Method: getMapStatusCompleted
  27647. * 获取地图状态完成,执行此方法。
  27648. *
  27649. * Parameters:
  27650. * {Object} result - 服务器返回的结果对象。
  27651. */
  27652. serviceProcessCompleted(result, options) {
  27653. var me = this;
  27654. result = Util_Util.transformResult(result);
  27655. var codeStatus = (result.code >= 200 && result.code < 300) || result.code == 0 || result.code === 304;
  27656. var isCodeValid = result.code && codeStatus;
  27657. if (!result.code || isCodeValid) {
  27658. me.events && me.events.triggerEvent("processCompleted", {result: result, options});
  27659. } else {
  27660. ////在没有token是返回的是200,但是其实是没有权限,所以这里也应该是触发失败事件
  27661. me.events.triggerEvent("processFailed", {error: result, options});
  27662. }
  27663. }
  27664. }
  27665. ;// CONCATENATED MODULE: ./src/common/iServer/TilesetsService.js
  27666. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  27667. * This program are made available under the terms of the Apache License, Version 2.0
  27668. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27669. /**
  27670. * @class TilesetsService
  27671. * @deprecatedclass SuperMap.TilesetsService
  27672. * @category iServer Map Tilesets
  27673. * @classdesc 切片列表信息查询服务类;即查询切片地图服务的切片列表,返回切片集名称、地图切片元数据信息、切片版本集信息。
  27674. * @extends {CommonServiceBase}
  27675. * @param {string} url - 服务地址。URL 应为:
  27676. * http://{服务器地址}:{服务端口号}/iserver/services/{服务名}/rest/maps/map;
  27677. * 例如: "http://localhost:8090/iserver/services/test/rest/maps/tianlocal"。
  27678. * @param {Object} options - 参数。
  27679. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  27680. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  27681. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  27682. * @param {Object} [options.headers] - 请求头。
  27683. * @usage
  27684. */
  27685. class TilesetsService extends CommonServiceBase {
  27686. constructor(url, options) {
  27687. super(url, options);
  27688. this.CLASS_NAME = "SuperMap.TilesetsService";
  27689. }
  27690. /**
  27691. * @override
  27692. */
  27693. destroy() {
  27694. super.destroy();
  27695. }
  27696. /**
  27697. * @function TilesetsService.prototype.processAsync
  27698. * @description 负责将客户端的查询参数传递到服务端。
  27699. */
  27700. processAsync() {
  27701. if (!this.url) {
  27702. return;
  27703. }
  27704. var me = this;
  27705. me.url = Util_Util.urlPathAppend(me.url, 'tilesets');
  27706. me.request({
  27707. method: "GET",
  27708. scope: me,
  27709. success: me.serviceProcessCompleted,
  27710. failure: me.serviceProcessFailed
  27711. });
  27712. }
  27713. }
  27714. ;// CONCATENATED MODULE: ./src/maplibregl/services/MapService.js
  27715. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  27716. * This program are made available under the terms of the Apache License, Version 2.0
  27717. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27718. /**
  27719. * @class MapService
  27720. * @category iServer Map
  27721. * @classdesc 地图信息服务类。
  27722. * @version 11.1.0
  27723. * @modulecategory Services
  27724. * @extends {ServiceBase}
  27725. * @param {string} url - 服务地址。
  27726. * @param {Object} options - 参数。
  27727. * @param {string} [options.proxy] - 服务代理地址。
  27728. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  27729. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  27730. * @param {Object} [options.headers] - 请求头。
  27731. * @example
  27732. * new MapService(url)
  27733. * .getMapInfo(function(result){
  27734. * //doSomething
  27735. * })
  27736. * @usage
  27737. */
  27738. class MapService extends ServiceBase {
  27739. constructor(url, options) {
  27740. super(url, options);
  27741. }
  27742. /**
  27743. * @function MapService.prototype.getMapInfo
  27744. * @description 地图信息查询服务。
  27745. * @param {RequestCallback} callback 回调函数。
  27746. * @returns {MapService} 获取服务信息。
  27747. */
  27748. getMapInfo(callback) {
  27749. var me = this;
  27750. var getMapStatusService = new MapService_MapService(me.url, {
  27751. proxy: me.options.proxy,
  27752. withCredentials: me.options.withCredentials,
  27753. crossOrigin: me.options.crossOrigin,
  27754. headers: me.options.headers,
  27755. projection: me.options.projection
  27756. });
  27757. getMapStatusService.processAsync(callback);
  27758. }
  27759. /**
  27760. * @function MapService.prototype.getTilesets
  27761. * @description 切片列表信息查询服务。
  27762. * @param {RequestCallback} callback - 回调函数 。
  27763. * @returns {MapService} 获取服务信息。
  27764. */
  27765. getTilesets(callback) {
  27766. var me = this;
  27767. var tilesetsService = new TilesetsService(me.url, {
  27768. proxy: me.options.proxy,
  27769. withCredentials: me.options.withCredentials,
  27770. crossOrigin: me.options.crossOrigin,
  27771. headers: me.options.headers,
  27772. eventListeners: {
  27773. scope: me,
  27774. processCompleted: callback,
  27775. processFailed: callback
  27776. }
  27777. });
  27778. tilesetsService.processAsync();
  27779. }
  27780. }
  27781. ;// CONCATENATED MODULE: ./src/common/iServer/MeasureParameters.js
  27782. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  27783. * This program are made available under the terms of the Apache License, Version 2.0
  27784. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27785. /**
  27786. * @class MeasureParameters
  27787. * @deprecatedclass SuperMap.MeasureParameters
  27788. * @category iServer Map Measure
  27789. * @classdesc 量算参数类。
  27790. * @param {GeoJSONObject} geometry - 要量算的几何对象。
  27791. * @param {Object} options - 可选参数。
  27792. * @param {Unit} [options.unit=Unit.METER] - 量算单位。
  27793. * @param {string} [options.prjCoordSys] - 用来指定该量算操作所使用的投影。
  27794. * @param {string} [options.distanceMode="Geodesic"] - 用来指定量算的方式为按球面长度 'Geodesic' 或者平面长度 'Planar' 来计算。
  27795. * @usage
  27796. */
  27797. class MeasureParameters {
  27798. constructor(geometry, options) {
  27799. if (!geometry) {
  27800. return;
  27801. }
  27802. /**
  27803. * @member {GeoJSONObject} MeasureParameters.prototype.geometry
  27804. * @description 要量算的几何对象。<br>
  27805. * 点类型可以是:{@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>
  27806. * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。<br>
  27807. * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。
  27808. */
  27809. this.geometry = geometry;
  27810. /**
  27811. * @member {Unit} [MeasureParameters.prototype.unit=Unit.METER]
  27812. * @description 量算单位。即量算结果以米为单位。
  27813. */
  27814. this.unit = Unit.METER;
  27815. /**
  27816. * @member {string} [MeasureParameters.prototype.prjCoordSys]
  27817. * @description 用来指定该量算操作所使用的投影。
  27818. */
  27819. this.prjCoordSys = null;
  27820. /**
  27821. * @member {string} [MeasureParameters.prototype.distanceMode="Geodesic"]
  27822. * @description 用来指定量算的方式为按球面长度 'Geodesic' 或者平面长度 'Planar' 来计算。
  27823. * @example
  27824. * var param = new MeasureParameters(getmetry,{distanceMode:'Planar'});
  27825. */
  27826. this.distanceMode = null;
  27827. if (options) {
  27828. Util_Util.extend(this, options);
  27829. }
  27830. this.CLASS_NAME = "SuperMap.MeasureParameters";
  27831. }
  27832. /**
  27833. * @function MeasureParameters.prototype.destroy
  27834. * @description 释放资源,将引用资源的属性置空。
  27835. */
  27836. destroy() {
  27837. var me = this;
  27838. me.geometry = null;
  27839. me.unit = null;
  27840. me.prjCoordSys = null;
  27841. }
  27842. }
  27843. ;// CONCATENATED MODULE: ./src/common/iServer/MeasureService.js
  27844. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  27845. * This program are made available under the terms of the Apache License, Version 2.0
  27846. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27847. /**
  27848. * @class MeasureService
  27849. * @deprecatedclass SuperMap.MeasureService
  27850. * @category iServer Map Measure
  27851. * @classdesc 量算服务类。
  27852. * 该类负责将量算参数传递到服务端,并获取服务端返回的量算结果。
  27853. * @extends {CommonServiceBase}
  27854. * @example
  27855. * var myMeasuerService = new MeasureService(url, {
  27856. * measureMode: MeasureMode.DISTANCE,
  27857. * eventListeners:{
  27858. * "processCompleted": measureCompleted
  27859. * }
  27860. * });
  27861. * @param {string} url - 服务地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 。
  27862. * @param {Object} options - 参数。
  27863. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  27864. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  27865. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  27866. * @param {Object} [options.headers] - 请求头。
  27867. * @param {MeasureMode} options.measureMode - 量算模式,包括距离量算模式和面积量算模式。
  27868. * @usage
  27869. */
  27870. class MeasureService_MeasureService extends CommonServiceBase {
  27871. constructor(url, options) {
  27872. super(url, options);
  27873. /**
  27874. * @member {MeasureMode} [MeasureService.prototype.measureMode=MeasureMode.DISTANCE]
  27875. * @description 量算模式,包括距离量算模式和面积量算模式。
  27876. */
  27877. this.measureMode = MeasureMode.DISTANCE;
  27878. if (options) {
  27879. Util_Util.extend(this, options);
  27880. }
  27881. this.eventCount = 0;
  27882. this.CLASS_NAME = "SuperMap.MeasureService";
  27883. }
  27884. /**
  27885. * @override
  27886. */
  27887. destroy() {
  27888. super.destroy();
  27889. var me = this;
  27890. me.measureMode = null;
  27891. }
  27892. /**
  27893. * @function MeasureService.prototype.processAsync
  27894. * @description 负责将客户端的量算参数传递到服务端。
  27895. * @param {MeasureParameters} params - 量算参数。
  27896. */
  27897. processAsync(params, callback) {
  27898. if (!(params instanceof MeasureParameters)) {
  27899. return;
  27900. }
  27901. let eventId = ++this.eventCount;
  27902. let eventListeners = {
  27903. scope: this,
  27904. processCompleted: function(result) {
  27905. if (eventId === result.result.eventId && callback) {
  27906. delete result.result.eventId;
  27907. callback(result);
  27908. this.events && this.events.un(eventListeners);
  27909. return false;
  27910. }
  27911. },
  27912. processFailed: function(result) {
  27913. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  27914. callback(result);
  27915. this.events && this.events.un(eventListeners);
  27916. return false;
  27917. }
  27918. }
  27919. }
  27920. this.events.on(eventListeners);
  27921. var me = this,
  27922. geometry = params.geometry,
  27923. pointsCount = 0,
  27924. point2ds = null;
  27925. if (!geometry) {
  27926. return;
  27927. }
  27928. me.url = Util_Util.urlPathAppend(me.url, me.measureMode === MeasureMode.AREA ? 'area' : 'distance');
  27929. var serverGeometry = ServerGeometry.fromGeometry(geometry);
  27930. if (!serverGeometry) {
  27931. return;
  27932. }
  27933. pointsCount = serverGeometry.parts[0];
  27934. point2ds = serverGeometry.points.splice(0, pointsCount);
  27935. var prjCoordSysTemp, prjCodeTemp, paramsTemp;
  27936. if (params.prjCoordSys) {
  27937. if (typeof (params.prjCoordSys) === "object") {
  27938. prjCodeTemp = params.prjCoordSys.projCode;
  27939. prjCoordSysTemp = '{"epsgCode"' + prjCodeTemp.substring(prjCodeTemp.indexOf(":"), prjCodeTemp.length) + "}";
  27940. } else if (typeof (params.prjCoordSys) === "string") {
  27941. prjCoordSysTemp = '{"epsgCode"' + params.prjCoordSys.substring(params.prjCoordSys.indexOf(":"), params.prjCoordSys.length) + "}";
  27942. }
  27943. paramsTemp = {
  27944. "point2Ds": Util_Util.toJSON(point2ds),
  27945. "unit": params.unit,
  27946. "prjCoordSys": prjCoordSysTemp,
  27947. "distanceMode": params.distanceMode || 'Geodesic'
  27948. };
  27949. } else {
  27950. paramsTemp = {"point2Ds": Util_Util.toJSON(point2ds), "unit": params.unit, "distanceMode": params.distanceMode || 'Geodesic'};
  27951. }
  27952. me.request({
  27953. method: "GET",
  27954. params: paramsTemp,
  27955. scope: me,
  27956. success(result, options) {
  27957. result.eventId = eventId;
  27958. this.serviceProcessCompleted(result, options);
  27959. },
  27960. failure(result, options) {
  27961. if (result.error) {
  27962. result.error.eventId = eventId;
  27963. }
  27964. result.eventId = eventId;
  27965. this.serviceProcessFailed(result, options);
  27966. }
  27967. });
  27968. }
  27969. }
  27970. ;// CONCATENATED MODULE: ./src/maplibregl/services/MeasureService.js
  27971. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  27972. * This program are made available under the terms of the Apache License, Version 2.0
  27973. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27974. /**
  27975. * @class MeasureService
  27976. * @category iServer Map Measure
  27977. * @classdesc 量算服务类。
  27978. * @version 11.1.0
  27979. * @modulecategory Services
  27980. * @extends {ServiceBase}
  27981. * @param {string} url - 服务地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map。
  27982. * @param {Object} options - 参数。
  27983. * @param {string} [options.proxy] - 服务代理地址。
  27984. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  27985. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  27986. * @param {Object} [options.headers] - 请求头。
  27987. * @param {MeasureMode} [options.measureMode=MeasureMode.DISTANCE] - 量算模式,包括距离量算模式和面积量算模式。
  27988. * @usage
  27989. */
  27990. class MeasureService extends ServiceBase {
  27991. constructor(url, options) {
  27992. super(url, options);
  27993. }
  27994. /**
  27995. * @function MeasureService.prototype.measureDistance
  27996. * @description 距离量算。
  27997. * @param {MeasureParameters} params - 量算参数类。
  27998. * @param {RequestCallback} callback 回调函数。
  27999. */
  28000. measureDistance(params, callback) {
  28001. this.measure(params, 'DISTANCE', callback);
  28002. }
  28003. /**
  28004. * @function MeasureService.prototype.measureArea
  28005. * @description 面积量算。
  28006. * @param {MeasureParameters} params - 量算参数类。
  28007. * @param {RequestCallback} callback 回调函数。
  28008. */
  28009. measureArea(params, callback) {
  28010. this.measure(params, 'AREA', callback);
  28011. }
  28012. /**
  28013. * @function MeasureService.prototype.measure
  28014. * @description 量算。
  28015. * @param {MeasureParameters} params - 量算参数类。
  28016. * @param {string} type - 量算类型。
  28017. * @param {RequestCallback} callback - 回调函数。
  28018. * @returns {MeasureService} 量算服务。
  28019. */
  28020. measure(params, type, callback) {
  28021. var me = this;
  28022. var measureService = new MeasureService_MeasureService(me.url, {
  28023. proxy: me.options.proxy,
  28024. withCredentials: me.options.withCredentials,
  28025. crossOrigin: me.options.crossOrigin,
  28026. headers: me.options.headers,
  28027. measureMode: type
  28028. });
  28029. measureService.processAsync(me._processParam(params), callback);
  28030. }
  28031. _processParam(params) {
  28032. if (params && !(params.geometry instanceof Geometry_Geometry)) {
  28033. params.geometry = core_Util_Util.toSuperMapGeometry(params.geometry);
  28034. }
  28035. return params;
  28036. }
  28037. }
  28038. ;// CONCATENATED MODULE: ./src/common/iServer/NetworkAnalystServiceBase.js
  28039. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28040. * This program are made available under the terms of the Apache License, Version 2.0
  28041. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28042. /**
  28043. * @class NetworkAnalystServiceBase
  28044. * @deprecatedclass SuperMap.NetworkAnalystServiceBase
  28045. * @category iServer Core
  28046. * @classdesc 网络分析服务基类。
  28047. * @extends {CommonServiceBase}
  28048. * @param {string} url - 服务地址。
  28049. * @param {Object} options - 可选参数。
  28050. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28051. * @param {Object} [options.headers] - 请求头。
  28052. * @usage
  28053. */
  28054. class NetworkAnalystServiceBase extends CommonServiceBase {
  28055. constructor(url, options) {
  28056. super(url, options);
  28057. /**
  28058. * @member {DataFormat} [NetworkAnalystServiceBase.prototype.format=DataFormat.GEOJSON]
  28059. * @description 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式,参数格式为 "ISERVER","GEOJSON"
  28060. */
  28061. this.format = DataFormat.GEOJSON;
  28062. this.CLASS_NAME = "SuperMap.NetworkAnalystServiceBase";
  28063. }
  28064. /**
  28065. * @function NetworkAnalystServiceBase.prototype.destroy
  28066. * @description 释放资源,将引用的资源属性置空。
  28067. */
  28068. destroy() {
  28069. super.destroy();
  28070. this.format = null;
  28071. }
  28072. /**
  28073. * @function NetworkAnalystServiceBase.prototype.serviceProcessCompleted
  28074. * @description 分析完成,执行此方法。
  28075. * @param {Object} result - 服务器返回的结果对象。
  28076. */
  28077. serviceProcessCompleted(result, options) {
  28078. var me = this, analystResult;
  28079. result = Util_Util.transformResult(result);
  28080. if (result && me.format === DataFormat.GEOJSON && typeof me.toGeoJSONResult === 'function') {
  28081. analystResult = me.toGeoJSONResult(result);
  28082. }
  28083. if (!analystResult) {
  28084. analystResult = result;
  28085. }
  28086. me.events.triggerEvent("processCompleted", {result: analystResult, options});
  28087. }
  28088. /**
  28089. * @function NetworkAnalystServiceBase.prototype.toGeoJSONResult
  28090. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。只处理结果中的路由,由子类实现。
  28091. * @param {Object} result - 服务器返回的结果对象。
  28092. * @returns {GeoJSONObject} GeoJSON 对象。
  28093. */
  28094. toGeoJSONResult(result) { // eslint-disable-line no-unused-vars
  28095. return null;
  28096. }
  28097. }
  28098. ;// CONCATENATED MODULE: ./src/common/iServer/BurstPipelineAnalystParameters.js
  28099. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28100. * This program are made available under the terms of the Apache License, Version 2.0
  28101. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28102. /**
  28103. * @class BurstPipelineAnalystParameters
  28104. * @deprecatedclass SuperMap.BurstPipelineAnalystParameters
  28105. * @category iServer NetworkAnalyst BurstAnalyse
  28106. * @classdesc 爆管分析参数类。
  28107. * @param {Object} options - 参数。
  28108. * @param {Array.<number>} options.sourceNodeIDs - 指定的设施点 ID 数组。
  28109. * @param {number} [options.edgeID] - 指定的弧段ID,edgeID 与 nodeID 必须指定一个。
  28110. * @param {number} [options.nodeID] - 指定的结点ID,edgeID 与 nodeID 必须指定一个。
  28111. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。
  28112. * @usage
  28113. */
  28114. class BurstPipelineAnalystParameters {
  28115. constructor(options) {
  28116. var me = this;
  28117. /**
  28118. * @member {Array.<number>} BurstPipelineAnalystParameters.prototype.sourceNodeIDs
  28119. * @description 指定的设施点 ID 数组。
  28120. */
  28121. this.sourceNodeIDs = null;
  28122. /**
  28123. * @member {number} [BurstPipelineAnalystParameters.prototype.edgeID]
  28124. * @description 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  28125. */
  28126. this.edgeID = null;
  28127. /**
  28128. * @member {number} [BurstPipelineAnalystParameters.prototype.nodeID]
  28129. * @description 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  28130. */
  28131. this.nodeID = null;
  28132. /**
  28133. * @member {boolean} [BurstPipelineAnalystParameters.prototype.isUncertainDirectionValid=false]
  28134. * @description 指定不确定流向是否有效。
  28135. * 指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行。
  28136. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  28137. */
  28138. this.isUncertainDirectionValid = false;
  28139. Util_Util.extend(me, options);
  28140. this.CLASS_NAME = "SuperMap.BurstPipelineAnalystParameters";
  28141. }
  28142. /**
  28143. * @function BurstPipelineAnalystParameters.prototype.destroy
  28144. * @description 释放资源,将引用资源的属性置空。
  28145. */
  28146. destroy() {
  28147. var me = this;
  28148. me.sourceNodeIDs = null;
  28149. me.edgeID = null;
  28150. me.nodeID = null;
  28151. me.isUncertainDirectionValid = null;
  28152. }
  28153. }
  28154. ;// CONCATENATED MODULE: ./src/common/iServer/BurstPipelineAnalystService.js
  28155. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28156. * This program are made available under the terms of the Apache License, Version 2.0
  28157. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28158. /**
  28159. * @class BurstPipelineAnalystService
  28160. * @deprecatedclass SuperMap.BurstPipelineAnalystService
  28161. * @category iServer NetworkAnalyst BurstAnalyse
  28162. * @classdesc 爆管分析服务类。即将给定弧段或节点作为爆管点来进行分析,返回关键结点 ID 数组、普通结点 ID 数组及其上下游弧段 ID 数组。
  28163. * @extends {NetworkAnalystServiceBase}
  28164. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  28165. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源},
  28166. * 例如: "http://localhost:8090/iserver/services/test/rest/networkanalyst/WaterNet@FacilityNet"。
  28167. * @param {Object} options - 参数。
  28168. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  28169. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28170. * @param {Object} [options.headers] - 请求头。
  28171. * @usage
  28172. */
  28173. class BurstPipelineAnalystService extends NetworkAnalystServiceBase {
  28174. constructor(url, options) {
  28175. super(url, options);
  28176. this.CLASS_NAME = "SuperMap.BurstPipelineAnalystService";
  28177. }
  28178. /**
  28179. * @function BurstPipelineAnalystService.prototype.destroy
  28180. * @override
  28181. */
  28182. destroy() {
  28183. super.destroy();
  28184. }
  28185. /**
  28186. * @function BurstPipelineAnalystService.prototype.processAsync
  28187. * @description 负责将客户端的查询参数传递到服务端。
  28188. * @params {BurstPipelineAnalystParameters} params - 爆管分析参数类
  28189. */
  28190. processAsync(params) {
  28191. if (!(params instanceof BurstPipelineAnalystParameters)) {
  28192. return null;
  28193. }
  28194. var me = this, jsonObject;
  28195. me.url = Util_Util.urlPathAppend(me.url, 'burstAnalyse');
  28196. jsonObject = {
  28197. sourceNodeIDs: params.sourceNodeIDs,
  28198. isUncertainDirectionValid: params.isUncertainDirectionValid
  28199. };
  28200. //必传参数不正确,就终止
  28201. if (params.edgeID !== null && params.nodeID !== null) {
  28202. throw new Error('edgeID and nodeID cannot be null at the same time.');
  28203. }
  28204. if (params.edgeID === null && params.nodeID === null) {
  28205. throw new Error('edgeID and nodeID cannot be null at the same time.');
  28206. }
  28207. if (params.edgeID !== null) {
  28208. jsonObject.edgeID = params.edgeID;
  28209. } else {
  28210. jsonObject.nodeID = params.nodeID;
  28211. }
  28212. me.request({
  28213. method: "GET",
  28214. params: jsonObject,
  28215. scope: me,
  28216. success: me.serviceProcessCompleted,
  28217. failure: me.serviceProcessFailed
  28218. });
  28219. }
  28220. }
  28221. ;// CONCATENATED MODULE: ./src/common/iServer/TransportationAnalystResultSetting.js
  28222. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28223. * This program are made available under the terms of the Apache License, Version 2.0
  28224. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28225. /**
  28226. * @class TransportationAnalystResultSetting
  28227. * @deprecatedclass SuperMap.TransportationAnalystResultSetting
  28228. * @category iServer NetworkAnalyst
  28229. * @classdesc 交通网络分析结果参数类。通过该类设置交通网络分析返回的结果,包括是否返回图片、是否返回弧段空间信息、是否返回结点空间信息等。
  28230. * @param {Object} options - 可选参数。
  28231. * @param {boolean} [options.returnEdgeFeatures=false] - 是否在分析结果中包含弧段要素集合。
  28232. * @param {boolean} [options.returnEdgeGeometry=false] - 返回的弧段要素集合中是否包含几何对象信息。
  28233. * @param {boolean} [options.returnEdgeIDs=false] - 返回结果中是否包含经过弧段 ID 集合。
  28234. * @param {boolean} [options.returnNodeFeatures=false] - 是否在分析结果中包含结点要素集合。
  28235. * @param {boolean} [options.returnNodeGeometry=false] - 返回的结点要素集合中是否包含几何对象信息。
  28236. * @param {boolean} [options.returnNodeIDs=false] - 返回结果中是否包含经过结点 ID 集合。
  28237. * @param {boolean} [options.returnPathGuides=false] - 返回分析结果中是否包含行驶导引集合。
  28238. * @param {boolean} [options.returnRoutes=false] - 返回分析结果中是否包含路由对象的集合。
  28239. * @usage
  28240. */
  28241. class TransportationAnalystResultSetting {
  28242. constructor(options) {
  28243. if (!options) {
  28244. return;
  28245. }
  28246. /**
  28247. * @member {boolean} TransportationAnalystResultSetting.prototype.returnEdgeFeatures
  28248. * @description 是否在分析结果中包含弧段要素集合。弧段要素包括弧段的空间信息和属性信息。
  28249. */
  28250. this.returnEdgeFeatures = false;
  28251. /**
  28252. * @member {boolean} [TransportationAnalystResultSetting.prototype.returnEdgeGeometry=false]
  28253. * @description 返回的弧段要素集合中是否包含几何对象信息。
  28254. */
  28255. this.returnEdgeGeometry = false;
  28256. /**
  28257. * @member {boolean} [TransportationAnalystResultSetting.prototype.returnEdgeIDs=false]
  28258. * @description 返回结果中是否包含经过弧段 ID 集合。
  28259. */
  28260. this.returnEdgeIDs = false;
  28261. /**
  28262. * @member {boolean} [TransportationAnalystResultSetting.prototype.returnNodeFeatures=false]
  28263. * @description 是否在分析结果中包含结点要素集合。
  28264. * 结点要素包括结点的空间信息和属性信息。其中返回的结点要素是否包含空间信息可通过 returnNodeGeometry 字段设置。
  28265. */
  28266. this.returnNodeFeatures = false;
  28267. /**
  28268. * @member {boolean} [TransportationAnalystResultSetting.prototype.returnNodeGeometry=false]
  28269. * @description 返回的结点要素集合中是否包含几何对象信息。
  28270. */
  28271. this.returnNodeGeometry = false;
  28272. /**
  28273. * @member {boolean} [TransportationAnalystResultSetting.prototype.returnNodeIDs=false]
  28274. * @description 返回结果中是否包含经过结点 ID 集合。
  28275. */
  28276. this.returnNodeIDs = false;
  28277. /**
  28278. * @member {boolean} TransportationAnalystResultSetting.prototype.returnPathGuides
  28279. * @description 返回分析结果中是否包含行驶导引集合。
  28280. */
  28281. this.returnPathGuides = false;
  28282. /**
  28283. * @member {boolean} TransportationAnalystResultSetting.prototype.returnRoutes
  28284. * @description 返回分析结果中是否包含路由对象的集合。
  28285. */
  28286. this.returnRoutes = false;
  28287. Util_Util.extend(this, options);
  28288. this.CLASS_NAME = "SuperMap.TransportationAnalystResultSetting";
  28289. }
  28290. /**
  28291. * @function TransportationAnalystResultSetting.prototype.destroy
  28292. * @description 释放资源,将引用资源的属性置空。
  28293. */
  28294. destroy() {
  28295. var me = this;
  28296. me.returnEdgeFeatures = null;
  28297. me.returnEdgeGeometry = null;
  28298. me.returnEdgeIDs = null;
  28299. me.returnNodeFeatures = null;
  28300. me.returnNodeGeometry = null;
  28301. me.returnNodeIDs = null;
  28302. me.returnPathGuides = null;
  28303. me.returnRoutes = null;
  28304. }
  28305. }
  28306. ;// CONCATENATED MODULE: ./src/common/iServer/TransportationAnalystParameter.js
  28307. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28308. * This program are made available under the terms of the Apache License, Version 2.0
  28309. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28310. /**
  28311. * @class TransportationAnalystParameter
  28312. * @deprecatedclass SuperMap.TransportationAnalystParameter
  28313. * @category iServer NetworkAnalyst
  28314. * @classdesc 交通网络分析通用参数类。该类主要用来提供交通网络分析所需的通用参数。
  28315. * 通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息,还可以对分析结果包含的内容进行一些设置。
  28316. * @param {Object} options - 参数。
  28317. * @param {Array.<number>} options.barrierEdgeIDs - 网络分析中障碍弧段的 ID 数组。
  28318. * @param {Array.<number>} options.barrierNodeIDs - 网络分析中障碍点的 ID 数组。
  28319. * @param {string} options.turnWeightField - 转向权重字段的名称。
  28320. * @param {TransportationAnalystResultSetting} options.resultSetting - 分析结果返回内容。
  28321. * @param {Array.<GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} [options.barrierPoints] - 网络分析中 Point2D 类型的障碍点数组。
  28322. * @param {string} [options.weightFieldName] - 阻力字段的名称。
  28323. * @usage
  28324. */
  28325. class TransportationAnalystParameter {
  28326. constructor(options) {
  28327. if (!options) {
  28328. return;
  28329. }
  28330. /**
  28331. * @member {Array.<number>} TransportationAnalystParameter.prototype.barrierEdgeIDs
  28332. * @description 网络分析中障碍弧段的 ID 数组。弧段设置为障碍边之后,表示双向都不通。
  28333. */
  28334. this.barrierEdgeIDs = null;
  28335. /**
  28336. * @member {Array.<number>} TransportationAnalystParameter.prototype.barrierNodeIDs
  28337. * @description 网络分析中障碍点的 ID 数组。结点设置为障碍点之后,表示任何方向都不能通过此结点。
  28338. */
  28339. this.barrierNodeIDs = null;
  28340. /**
  28341. * @member {Array.<GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} TransportationAnalystParameter.prototype.barrierPoints
  28342. * @description 网络分析中 Point2D 类型的障碍点数组。障碍点表示任何方向都不能通过此点。</br>
  28343. * 当各网络分析参数类中的 isAnalyzeById 属性设置为 false 时,该属性才生效。
  28344. */
  28345. this.barrierPoints = null;
  28346. /**
  28347. * @member {string} [TransportationAnalystParameter.prototype.weightFieldName]
  28348. * @description 阻力字段的名称,标识了进行网络分析时所使用的阻力字段,例如表示时间、长度等的字段都可以用作阻力字段。
  28349. * 该字段默值为服务器发布的所有耗费字段的第一个字段。
  28350. */
  28351. this.weightFieldName = null;
  28352. /**
  28353. * @member {string} TransportationAnalystParameter.prototype.turnWeightField
  28354. * @description 转向权重字段的名称。
  28355. */
  28356. this.turnWeightField = null;
  28357. /**
  28358. * @member {TransportationAnalystResultSetting} TransportationAnalystParameter.prototype.resultSetting
  28359. * @description 分析结果返回内容。
  28360. */
  28361. this.resultSetting = new TransportationAnalystResultSetting();
  28362. Util_Util.extend(this, options);
  28363. this.CLASS_NAME = "SuperMap.TransportationAnalystParameter";
  28364. }
  28365. /**
  28366. * @function TransportationAnalystParameter.prototype.destroy
  28367. * @description 释放资源,将引用资源的属性置空。
  28368. */
  28369. destroy() {
  28370. var me = this;
  28371. me.barrierEdgeIDs = null;
  28372. me.barrierNodeIDs = null;
  28373. me.weightFieldName = null;
  28374. me.turnWeightField = null;
  28375. if (me.resultSetting) {
  28376. me.resultSetting.destroy();
  28377. me.resultSetting = null;
  28378. }
  28379. if (me.barrierPoints && me.barrierPoints.length) {
  28380. for (var i in me.barrierPoints) {
  28381. me.barrierPoints[i].destroy();
  28382. }
  28383. }
  28384. me.barrierPoints = null;
  28385. }
  28386. }
  28387. ;// CONCATENATED MODULE: ./src/common/iServer/ComputeWeightMatrixParameters.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 ComputeWeightMatrixParameters
  28393. * @deprecatedclass SuperMap.ComputeWeightMatrixParameters
  28394. * @category iServer NetworkAnalyst WeightMatrix
  28395. * @classdesc 耗费矩阵分析参数类。根据交通网络分析参数中的耗费字段返回一个耗费矩阵。该矩阵是一个二维数组,用来存储任意两点间的资源消耗。
  28396. * @param {Object} options - 参数。
  28397. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 指定路径分析的结点。
  28398. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} options.nodes - 要计算耗费矩阵的点数组。
  28399. * @param {TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  28400. * @usage
  28401. */
  28402. class ComputeWeightMatrixParameters {
  28403. constructor(options) {
  28404. /**
  28405. * @member {boolean} [ComputeWeightMatrixParameters.prototype.isAnalyzeById=false]
  28406. * @description 是否通过节点 ID 指定路径分析的结点,即通过坐标点指定。
  28407. */
  28408. this.isAnalyzeById = false;
  28409. /**
  28410. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} ComputeWeightMatrixParameters.prototype.nodes
  28411. * @description 要计算耗费矩阵的点数组。
  28412. * 当 {@link ComputeWeightMatrixParameters.isAnalyzeById} = false 时,nodes 应为点的坐标数组;
  28413. * 当 {@link ComputeWeightMatrixParameters.isAnalyzeById} = true 时,nodes 应为点的 ID 数组。
  28414. */
  28415. this.nodes = null;
  28416. /**
  28417. * @member {TransportationAnalystParameter} ComputeWeightMatrixParameters.prototype.parameter
  28418. * @description 交通网络分析通用参数。
  28419. */
  28420. this.parameter = new TransportationAnalystParameter();
  28421. Util_Util.extend(this, options);
  28422. this.CLASS_NAME = "SuperMap.ComputeWeightMatrixParameters";
  28423. }
  28424. /**
  28425. * @function ComputeWeightMatrixParameters.prototype.destroy
  28426. * @description 释放资源,将引用资源的属性置空。
  28427. */
  28428. destroy() {
  28429. var me = this;
  28430. me.isAnalyzeById = null;
  28431. me.nodes = null;
  28432. if (me.parameter) {
  28433. me.parameter.destroy();
  28434. me.parameter = null;
  28435. }
  28436. }
  28437. }
  28438. ;// CONCATENATED MODULE: ./src/common/iServer/ComputeWeightMatrixService.js
  28439. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28440. * This program are made available under the terms of the Apache License, Version 2.0
  28441. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28442. /**
  28443. * @class ComputeWeightMatrixService
  28444. * @deprecatedclass SuperMap.ComputeWeightMatrixService
  28445. * @category iServer NetworkAnalyst WeightMatrix
  28446. * @classdesc 耗费矩阵分析服务类。
  28447. * 耗费矩阵是根据交通网络分析参数中的耗费字段来计算一个二维数组,
  28448. * 用来存储指定的任意两点间的资源消耗。
  28449. * 耗费矩阵分析结果通过该类支持的事件的监听函数参数获取
  28450. * @extends {NetworkAnalystServiceBase}
  28451. * @example
  28452. * var mycomputeWeightMatrixService = new ComputeWeightMatrixService(url,{
  28453. * eventListeners: {
  28454. * "processCompleted": computeWeightMatrixCompleted,
  28455. * "processFailed": computeWeightMatrixnError
  28456. * }
  28457. * });
  28458. * @param {string} url - 耗费矩阵分析服务地址。请求服务的URL应为:
  28459. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  28460. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  28461. * @param {Object} options - 参数。
  28462. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  28463. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28464. * @param {Object} [options.headers] - 请求头。
  28465. * @usage
  28466. */
  28467. class ComputeWeightMatrixService extends NetworkAnalystServiceBase {
  28468. constructor(url, options) {
  28469. super(url, options);
  28470. this.CLASS_NAME = "SuperMap.ComputeWeightMatrixService";
  28471. }
  28472. /**
  28473. * @function ComputeWeightMatrixService.prototype.destroy
  28474. * @override
  28475. */
  28476. destroy() {
  28477. super.destroy();
  28478. }
  28479. /**
  28480. * @function ComputeWeightMatrixService.prototype.processAsync
  28481. * @description 负责将客户端的查询参数传递到服务端。
  28482. * @param {ComputeWeightMatrixParameters} params - 耗费矩阵分析参数类
  28483. */
  28484. processAsync(params) {
  28485. if (!(params instanceof ComputeWeightMatrixParameters)) {
  28486. return;
  28487. }
  28488. var me = this,
  28489. jsonObject;
  28490. me.url = Util_Util.urlPathAppend(me.url, 'weightmatrix');
  28491. jsonObject = {
  28492. parameter: Util_Util.toJSON(params.parameter),
  28493. nodes: me.getJson(params.isAnalyzeById, params.nodes)
  28494. };
  28495. me.request({
  28496. method: "GET",
  28497. params: jsonObject,
  28498. scope: me,
  28499. success: me.serviceProcessCompleted,
  28500. failure: me.serviceProcessFailed
  28501. });
  28502. }
  28503. /**
  28504. * @function ComputeWeightMatrixService.prototype.getJson
  28505. * @description 将对象转化为JSON字符串。
  28506. * @param {boolean} isAnalyzeById - 是否通过id分析
  28507. * @param {Array.<ComputeWeightMatrixParameters>} params - 分析参数数组
  28508. * @returns {string} 转化后的JSON字符串。
  28509. */
  28510. getJson(isAnalyzeById, params) {
  28511. var jsonString = "[",
  28512. len = params ? params.length : 0;
  28513. if (isAnalyzeById === false) {
  28514. for (let i = 0; i < len; i++) {
  28515. if (i > 0) {
  28516. jsonString += ",";
  28517. }
  28518. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  28519. }
  28520. } else if (isAnalyzeById === true) {
  28521. for (let i = 0; i < len; i++) {
  28522. if (i > 0) {
  28523. jsonString += ",";
  28524. }
  28525. jsonString += params[i];
  28526. }
  28527. }
  28528. jsonString += ']';
  28529. return jsonString;
  28530. }
  28531. }
  28532. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystStreamParameters.js
  28533. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28534. * This program are made available under the terms of the Apache License, Version 2.0
  28535. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28536. /**
  28537. * @class FacilityAnalystStreamParameters
  28538. * @deprecatedclass SuperMap.FacilityAnalystStreamParameters
  28539. * @category iServer NetworkAnalyst UpstreamCirticalFaclilities
  28540. * @classdesc 上游/下游关键设施查找资源参数类。
  28541. * @param {Object} options - 参数。
  28542. * @param {Array.<number>} options.sourceNodeIDs - 指定的设施点 ID 数组。
  28543. * @param {number} options.queryType - 分析类型,只能是 0 (上游关键设施查询) 或者是 1(下游关键设施查询)。
  28544. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  28545. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  28546. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。
  28547. * @usage
  28548. */
  28549. class FacilityAnalystStreamParameters {
  28550. constructor(options) {
  28551. /**
  28552. * @member {Array.<number>} [FacilityAnalystStreamParameters.prototype.sourceNodeIDs]
  28553. * @description 指定的设施点 ID 数组。
  28554. */
  28555. this.sourceNodeIDs = null;
  28556. /**
  28557. * @member {number} [FacilityAnalystStreamParameters.prototype.edgeID]
  28558. * @description 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  28559. */
  28560. this.edgeID = null;
  28561. /**
  28562. * @member {number} [FacilityAnalystStreamParameters.prototype.nodeID]
  28563. * @description 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  28564. */
  28565. this.nodeID = null;
  28566. /**
  28567. * @member {boolean} [FacilityAnalystStreamParameters.prototype.isUncertainDirectionValid=false]
  28568. * @description 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  28569. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  28570. */
  28571. this.isUncertainDirectionValid = false;
  28572. /**
  28573. * @member {number} FacilityAnalystStreamParameters.prototype.queryType
  28574. * @description 分析类型,只能是 0 (上游关键设施查询) 或者是 1(下游关键设施查询)。
  28575. */
  28576. this.queryType = null;
  28577. Util_Util.extend(this, options);
  28578. this.CLASS_NAME = "SuperMap.FacilityAnalystStreamParameters";
  28579. }
  28580. /**
  28581. * @function FacilityAnalystStreamParameters.prototype.destroy
  28582. * @description 释放资源,将引用资源的属性置空。
  28583. */
  28584. destroy() {
  28585. var me = this;
  28586. me.edgeID = null;
  28587. me.nodeID = null;
  28588. me.weightName = null;
  28589. me.isUncertainDirectionValid = null;
  28590. me.type = null;
  28591. }
  28592. }
  28593. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystStreamService.js
  28594. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28595. * This program are made available under the terms of the Apache License, Version 2.0
  28596. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28597. /**
  28598. * @class FacilityAnalystStreamService
  28599. * @deprecatedclass SuperMap.FacilityAnalystStreamService
  28600. * @category iServer NetworkAnalyst UpstreamCirticalFaclilities
  28601. * @classdesc 上游/下游 关键设施查找资源服务类:即查找给定弧段或节点的上游/下游中的关键设施结点,返回关键结点 ID 数组及其下游弧段 ID 数组。
  28602. * @extends NetworkAnalystServiceBase
  28603. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  28604. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  28605. * 例如: "http://localhost:8090/iserver/services/test/rest/networkanalyst/WaterNet@FacilityNet";
  28606. * @param {Object} options - 参数。
  28607. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  28608. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28609. * @param {Object} [options.headers] - 请求头。
  28610. * @usage
  28611. */
  28612. class FacilityAnalystStreamService extends NetworkAnalystServiceBase {
  28613. constructor(url, options) {
  28614. super(url, options);
  28615. this.CLASS_NAME = "SuperMap.FacilityAnalystStreamService";
  28616. }
  28617. /**
  28618. * @function FacilityAnalystStreamService.prototype.destroy
  28619. * @override
  28620. */
  28621. destroy() {
  28622. super.destroy();
  28623. }
  28624. /**
  28625. * @function FacilityAnalystStreamService.prototype.processAsync
  28626. * @description 负责将客户端的查询参数传递到服务端。
  28627. * @param {FacilityAnalystStreamParameters} params - 上游/下游关键设施查找资源参数类。
  28628. */
  28629. processAsync(params) {
  28630. if (!(params instanceof FacilityAnalystStreamParameters)) {
  28631. return;
  28632. }
  28633. var me = this,
  28634. jsonObject;
  28635. //URL 通过参数类型来判断是 上游 还是下游 查询
  28636. if (params.queryType === 0) {
  28637. me.url = Util_Util.urlPathAppend(me.url, 'upstreamcirticalfaclilities');
  28638. } else if (params.queryType === 1) {
  28639. me.url = Util_Util.urlPathAppend(me.url, 'downstreamcirticalfaclilities');
  28640. } else {
  28641. return;
  28642. }
  28643. jsonObject = {
  28644. sourceNodeIDs: params.sourceNodeIDs,
  28645. isUncertainDirectionValid: params.isUncertainDirectionValid
  28646. };
  28647. if (params.edgeID !== null && params.nodeID !== null) {
  28648. return;
  28649. }
  28650. if (params.edgeID === null && params.nodeID === null) {
  28651. return;
  28652. }
  28653. if (params.edgeID !== null) {
  28654. jsonObject.edgeID = params.edgeID;
  28655. } else {
  28656. jsonObject.nodeID = params.nodeID;
  28657. }
  28658. me.request({
  28659. method: "GET",
  28660. params: jsonObject,
  28661. scope: me,
  28662. success: me.serviceProcessCompleted,
  28663. failure: me.serviceProcessFailed
  28664. });
  28665. }
  28666. }
  28667. ;// CONCATENATED MODULE: ./src/common/iServer/FindClosestFacilitiesParameters.js
  28668. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28669. * This program are made available under the terms of the Apache License, Version 2.0
  28670. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28671. /**
  28672. * @class FindClosestFacilitiesParameters
  28673. * @deprecatedclass SuperMap.FindClosestFacilitiesParameters
  28674. * @category iServer NetworkAnalyst ClosestFacility
  28675. * @classdesc 最近设施分析参数类。
  28676. * @param {Object} options - 参数。
  28677. * @param {GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} options.event - 事件点,一般为需要获得服务设施服务的事件位置。
  28678. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} options.facilities - 设施点集合,一般为提供服务的服务设施位置。
  28679. * @param {number} [options.expectFacilityCount=1] - 要查找的设施点数量。
  28680. * @param {boolean} [options.fromEvent=false] - 是否从事件点到设施点进行查找。
  28681. * @param {boolean} [options.isAnalyzeById=false] - 事件点和设施点是否通过节点 ID 号来指定。
  28682. * @param {number} [options.maxWeight=0] - 权值的最大限值。单位与该类中 parameter 字段(交通网络分析通用参数)中设置的耗费字段一致。
  28683. * @param {TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  28684. * @usage
  28685. */
  28686. class FindClosestFacilitiesParameters {
  28687. constructor(options) {
  28688. /**
  28689. * @member {GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} FindClosestFacilitiesParameters.prototype.event
  28690. * @description 事件点,一般为需要获得服务设施服务的事件位置。
  28691. * 可以通过两种方式赋予事件点:当该类中字段 isAnalyzeById = true 时,应输入事件点 ID 号;当 isAnalyzeById = false 时,应输入事件点坐标。
  28692. */
  28693. this.event = null;
  28694. /**
  28695. * @member {number} [FindClosestFacilitiesParameters.prototype.expectFacilityCount=1]
  28696. * @description 要查找的设施点数量。
  28697. */
  28698. this.expectFacilityCount = 1;
  28699. /**
  28700. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} [FindClosestFacilitiesParameters.prototype.facilities=false]
  28701. * @description 设施点集合,一般为提供服务的服务设施位置。
  28702. * 可以通过两种方式赋予设施点:当该类中字段 isAnalyzeById = true 时,应输入设施点 ID 号;当 isAnalyzeById = false 时,应输入设施点坐标。
  28703. */
  28704. this.facilities = null;
  28705. /**
  28706. * @member {boolean} [FindClosestFacilitiesParameters.prototype.fromEvent=false]
  28707. * @description 是否从事件点到设施点进行查找。最近设施分析主要是通过设施点和事件点之间最优的路线来分析在一定范围内哪个或哪些设施与事件点有最优路线的关系。
  28708. * 这个行走线路是通过网络图层进行网络分析算法计算出来的两点间的最优路线。由于存在从 A 点到 B 点与从 B 点到 A 点的耗费不一样的情况,因此起止点不同可能会得到不同的最优路线。因此在进行最近设施分析之前,需要设置获取的最优路线的方向,即是以事件点作为起点到最近设施点的方向分析,还是以最近设施点为起点到事件点的方向分析。如果需要以事件点作为起点到设施点方向进行查找,设置该字段值为 true;设置为 false,表示从设施点到事件点进行查找。
  28709. */
  28710. this.fromEvent = false;
  28711. /**
  28712. * @member {boolean} [FindClosestFacilitiesParameters.prototype.isAnalyzeById=false]
  28713. * @description 事件点和设施点是否通过节点 ID 号来指定,设置为 false,表示通过坐标点指定事件点和设施点。
  28714. */
  28715. this.isAnalyzeById = false;
  28716. /**
  28717. * @member {number} [FindClosestFacilitiesParameters.prototype.maxWeight=0]
  28718. * @description 权值的最大限值。单位与该类中 parameter 字段(交通网络分析通用参数)中设置的耗费字段一致。
  28719. * 例如事件发生点是一起交通事故,要求查找在 10 分钟内能到达的最近医院,超过 10 分钟能到达的都不予考虑。
  28720. * 那么需要将网络分析参数中 parameter.weightFieldName 设置为表示时间的字段,然后设置查找范围的半径值为10。
  28721. */
  28722. this.maxWeight = 0;
  28723. /**
  28724. * @member {TransportationAnalystParameter} [FindClosestFacilitiesParameters.prototype.parameter]
  28725. * @description 交通网络分析通用参数。通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息。
  28726. * 它为 TransportationAnalystParameter 类型,虽然为可选参数,但是如果不设置其中的 resultSetting 字段,
  28727. * 则返回结果空间信息等都为空。
  28728. */
  28729. this.parameter = new TransportationAnalystParameter();
  28730. Util_Util.extend(this, options);
  28731. this.CLASS_NAME = "SuperMap.FindClosestFacilitiesParameters";
  28732. }
  28733. /**
  28734. * @function FindClosestFacilitiesParameters.prototype.destroy
  28735. * @description 释放资源,将引用资源的属性置空。
  28736. */
  28737. destroy() {
  28738. var me = this;
  28739. me.event = null;
  28740. me.expectFacilityCount = null;
  28741. me.facilities = null;
  28742. me.fromEvent = null;
  28743. me.isAnalyzeById = null;
  28744. me.maxWeight = null;
  28745. if (me.parameter) {
  28746. me.parameter.destroy();
  28747. me.parameter = null;
  28748. }
  28749. }
  28750. }
  28751. ;// CONCATENATED MODULE: ./src/common/iServer/FindClosestFacilitiesService.js
  28752. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28753. * This program are made available under the terms of the Apache License, Version 2.0
  28754. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28755. /**
  28756. * @class FindClosestFacilitiesService
  28757. * @deprecatedclass SuperMap.FindClosestFacilitiesService
  28758. * @category iServer NetworkAnalyst ClosestFacility
  28759. * @classdesc 最近设施分析服务类。
  28760. * 最近设施分析是指在网络上给定一个事件点和一组设施点,
  28761. * 查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  28762. * 该类负责将客户端指定的最近设施分析参数传递给服务端,并接收服务端返回的结果数据。
  28763. * 最近设施分析结果通过该类支持的事件的监听函数参数获取
  28764. * @extends {NetworkAnalystServiceBase}
  28765. * @example
  28766. * var myfindClosestFacilitiesService = new FindClosestFacilitiesService(url, {
  28767. * eventListeners: {
  28768. * "processCompleted": findClosestFacilitiesCompleted,
  28769. * "processFailed": findClosestFacilitiesError
  28770. * }
  28771. * });
  28772. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  28773. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  28774. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  28775. * @param {Object} options - 参数。
  28776. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  28777. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28778. * @param {Object} [options.headers] - 请求头。
  28779. * @usage
  28780. */
  28781. class FindClosestFacilitiesService extends NetworkAnalystServiceBase {
  28782. constructor(url, options) {
  28783. super(url, options);
  28784. this.CLASS_NAME = "SuperMap.FindClosestFacilitiesService";
  28785. }
  28786. /**
  28787. * @function FindClosestFacilitiesService.prototype.destroy
  28788. * @override
  28789. */
  28790. destroy() {
  28791. super.destroy();
  28792. }
  28793. /**
  28794. * @function FindClosestFacilitiesService.prototype.processAsync
  28795. * @description 负责将客户端的查询参数传递到服务端。
  28796. * @param {FindClosestFacilitiesParameters} params - 最近设施分析服务参数类
  28797. */
  28798. processAsync(params) {
  28799. if (!(params instanceof FindClosestFacilitiesParameters)) {
  28800. return;
  28801. }
  28802. var me = this,
  28803. jsonObject;
  28804. me.url = Util_Util.urlPathAppend(me.url, 'closestfacility');
  28805. jsonObject = {
  28806. expectFacilityCount: params.expectFacilityCount,
  28807. fromEvent: params.fromEvent,
  28808. maxWeight: params.maxWeight,
  28809. parameter: Util_Util.toJSON(params.parameter),
  28810. event: Util_Util.toJSON(params.event),
  28811. facilities: me.getJson(params.isAnalyzeById, params.facilities)
  28812. };
  28813. me.request({
  28814. method: "GET",
  28815. params: jsonObject,
  28816. scope: me,
  28817. success: me.serviceProcessCompleted,
  28818. failure: me.serviceProcessFailed
  28819. });
  28820. }
  28821. /**
  28822. * @function FindClosestFacilitiesService.prototype.getJson
  28823. * @description 将对象转化为JSON字符串。
  28824. * @param {boolean} isAnalyzeById - 是否通过ID来分析
  28825. * @param {Array.<Object>} params - 分析参数数组
  28826. * @returns {Object} 转化后的JSON字符串。
  28827. */
  28828. getJson(isAnalyzeById, params) {
  28829. var jsonString = "[",
  28830. len = params ? params.length : 0;
  28831. if (isAnalyzeById === false) {
  28832. for (let i = 0; i < len; i++) {
  28833. if (i > 0) {
  28834. jsonString += ",";
  28835. }
  28836. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  28837. }
  28838. } else if (isAnalyzeById === true) {
  28839. for (let i = 0; i < len; i++) {
  28840. if (i > 0) {
  28841. jsonString += ",";
  28842. }
  28843. jsonString += params[i];
  28844. }
  28845. }
  28846. jsonString += ']';
  28847. return jsonString;
  28848. }
  28849. /**
  28850. * @function FindClosestFacilitiesService.prototype.toGeoJSONResult
  28851. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  28852. * @param {Object} result - 服务器返回的结果对象。
  28853. */
  28854. toGeoJSONResult(result) {
  28855. if (!result || !result.facilityPathList) {
  28856. return result;
  28857. }
  28858. var geoJSONFormat = new GeoJSON();
  28859. result.facilityPathList.map(function (path) {
  28860. if (path.route) {
  28861. path.route = geoJSONFormat.toGeoJSON(path.route);
  28862. }
  28863. if (path.pathGuideItems) {
  28864. path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
  28865. }
  28866. if (path.edgeFeatures) {
  28867. path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
  28868. }
  28869. if (path.nodeFeatures) {
  28870. path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
  28871. }
  28872. return path;
  28873. });
  28874. return result;
  28875. }
  28876. }
  28877. ;// CONCATENATED MODULE: ./src/common/iServer/FindLocationParameters.js
  28878. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28879. * This program are made available under the terms of the Apache License, Version 2.0
  28880. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28881. /**
  28882. * @class FindLocationParameters
  28883. * @deprecatedclass SuperMap.FindLocationParameters
  28884. * @category iServer NetworkAnalyst Location
  28885. * @classdesc 选址分区分析参数类。
  28886. * @param {Object} options - 参数。
  28887. * @param {string} options.turnWeightField - 转向权值字段的名称。
  28888. * @param {string} options.weightName - 阻力字段的名称,标识了进行网络分析时所使用的阻力字段。
  28889. * @param {Array.<SupplyCenter>} options.supplyCenters - 资源供给中心集合。
  28890. * @param {number} [options.expectedSupplyCenterCount=1] - 期望用于最终设施选址的资源供给中心数量。
  28891. * @param {boolean} [options.isFromCenter=false] - 是否从中心点开始分配资源。
  28892. * @usage
  28893. */
  28894. class FindLocationParameters {
  28895. constructor(options) {
  28896. /**
  28897. * @member {number} [FindLocationParameters.prototype.expectedSupplyCenterCount=1]
  28898. * @description 期望用于最终设施选址的资源供给中心数量。
  28899. * 当输入值为 0 时,最终设施选址的资源供给中心数量默认为覆盖分析区域内的所需最少的供给中心数。
  28900. */
  28901. this.expectedSupplyCenterCount = null;
  28902. /**
  28903. * @member {boolean} [FindLocationParameters.prototype.isFromCenter=false]
  28904. * @description 是否从中心点开始分配资源。
  28905. * 由于网路数据中的弧段具有正反阻力,即弧段的正向阻力值与其反向阻力值可能不同,
  28906. * 因此,在进行分析时,从资源供给中心开始分配资源到需求点与从需求点向资源供给中心分配这两种分配形式下,所得的分析结果会不同。
  28907. */
  28908. this.isFromCenter = false;
  28909. /**
  28910. * @member {Array.<SupplyCenter>} FindLocationParameters.prototype.supplyCenters
  28911. * @description 资源供给中心集合。
  28912. * 资源供给中心是提供资源和服务的设施,对应于网络结点,
  28913. * 资源供给中心的相关信息包括资源量、最大阻力值、资源供给中心类型,资源供给中心在网络中所处结点的 ID 等,以便在进行选址分区分析时使用。
  28914. */
  28915. this.supplyCenters = null;
  28916. /**
  28917. * @member {string} FindLocationParameters.prototype.turnWeightField
  28918. * @description 转向权值字段的名称。
  28919. */
  28920. this.turnWeightField = null;
  28921. /**
  28922. * @member {string} FindLocationParameters.prototype.weightName
  28923. * @description 阻力字段的名称,标识了进行网络分析时所使用的阻力字段。
  28924. */
  28925. this.weightName = null;
  28926. Util_Util.extend(this, options);
  28927. this.CLASS_NAME = "SuperMap.FindLocationParameters";
  28928. }
  28929. /**
  28930. * @function FindLocationParameters.prototype.destroy
  28931. * @description 释放资源,将引用资源的属性置空。
  28932. */
  28933. destroy() {
  28934. var me = this;
  28935. me.expectedSupplyCenterCount = null;
  28936. me.isFromCenter = null;
  28937. me.turnWeightField = null;
  28938. me.weightName = null;
  28939. if (me.supplyCenters) {
  28940. for (var i = 0, supplyCenters = me.supplyCenters, len = supplyCenters.length; i < len; i++) {
  28941. supplyCenters[i].destroy();
  28942. }
  28943. me.supplyCenters = null;
  28944. }
  28945. }
  28946. }
  28947. ;// CONCATENATED MODULE: ./src/common/iServer/FindLocationService.js
  28948. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  28949. * This program are made available under the terms of the Apache License, Version 2.0
  28950. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28951. /**
  28952. * @class FindLocationService
  28953. * @deprecatedclass SuperMap.FindLocationService
  28954. * @category iServer NetworkAnalyst Location
  28955. * @classdesc 选址分区分析服务类。
  28956. * 选址分区分析是为了确定一个或多个待建设施的最佳或最优位置,使得设施可以用一种最经济有效的方式为需求方提供服务或者商品。
  28957. * 选址分区不仅仅是一个选址过程,还要将需求点的需求分配到相应的新建设施的服务区中,因此称之为选址与分区。
  28958. * 选址分区分析结果通过该类支持的事件的监听函数参数获取
  28959. * @extends {NetworkAnalystServiceBase}
  28960. * @example
  28961. * (start code)
  28962. * var findLocationService = new FindLocationService(url, {
  28963. * eventListeners: {
  28964. * "processCompleted": findLocationCompleted,
  28965. * "processFailed": findLocationError
  28966. * }
  28967. * });
  28968. * (end)
  28969. * @param {string} url - 服务地址。
  28970. * 如 http://localhost:8090/iserver/services/transportationanalyst-sample/rest/networkanalyst/RoadNet@Changchun 。
  28971. * @param {Object} options - 参数。
  28972. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  28973. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28974. * @param {Object} [options.headers] - 请求头。
  28975. * @usage
  28976. */
  28977. class FindLocationService extends NetworkAnalystServiceBase {
  28978. constructor(url, options) {
  28979. super(url, options);
  28980. this.CLASS_NAME = "SuperMap.FindLocationService";
  28981. }
  28982. /**
  28983. * @function FindLocationService.prototype.destroy
  28984. * @override
  28985. */
  28986. destroy() {
  28987. super.destroy();
  28988. }
  28989. /**
  28990. * @function FindLocationService.prototype.processAsync
  28991. * @description 负责将客户端的查询参数传递到服务端。
  28992. * @param {FindLocationParameters} params - 选址分区分析服务参数类
  28993. */
  28994. processAsync(params) {
  28995. if (!(params instanceof FindLocationParameters)) {
  28996. return;
  28997. }
  28998. var me = this,
  28999. jsonObject;
  29000. me.url = Util_Util.urlPathAppend(me.url, 'location');
  29001. jsonObject = {
  29002. isFromCenter: params.isFromCenter,
  29003. expectedSupplyCenterCount: params.expectedSupplyCenterCount,
  29004. weightName: params.weightName,
  29005. turnWeightField: params.turnWeightField,
  29006. returnEdgeFeature: true,
  29007. returnEdgeGeometry: true,
  29008. returnNodeFeature: true,
  29009. mapParameter: Util_Util.toJSON(params.mapParameter),
  29010. supplyCenters: me.getCentersJson(params.supplyCenters)
  29011. };
  29012. me.request({
  29013. method: "GET",
  29014. params: jsonObject,
  29015. scope: me,
  29016. success: me.serviceProcessCompleted,
  29017. failure: me.serviceProcessFailed
  29018. });
  29019. }
  29020. /**
  29021. * @function FindLocationService.prototype.getCentersJson
  29022. * @description 将数组对象转化为JSON字符串。
  29023. * @param {Array} params - 需要转换的参数
  29024. * @returns {string} 转化后的JSON字符串。
  29025. */
  29026. getCentersJson(params) {
  29027. var json = "[",
  29028. len = params ? params.length : 0;
  29029. for (var i = 0; i < len; i++) {
  29030. if (i > 0) {
  29031. json += ",";
  29032. }
  29033. json += Util_Util.toJSON(params[i]);
  29034. }
  29035. json += "]";
  29036. return json;
  29037. }
  29038. /**
  29039. * @function FindLocationService.prototype.toGeoJSONResult
  29040. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  29041. * @param {Object} result - 服务器返回的结果对象。
  29042. */
  29043. toGeoJSONResult(result) {
  29044. if (!result) {
  29045. return null;
  29046. }
  29047. var geoJSONFormat = new GeoJSON();
  29048. if (result.demandResults) {
  29049. result.demandResults = geoJSONFormat.toGeoJSON(result.demandResults);
  29050. }
  29051. if (result.supplyResults) {
  29052. result.supplyResults = geoJSONFormat.toGeoJSON(result.supplyResults);
  29053. }
  29054. return result;
  29055. }
  29056. }
  29057. ;// CONCATENATED MODULE: ./src/common/iServer/FindMTSPPathsParameters.js
  29058. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29059. * This program are made available under the terms of the Apache License, Version 2.0
  29060. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29061. /**
  29062. * @class FindMTSPPathsParameters
  29063. * @deprecatedclass SuperMap.FindMTSPPathsParameters
  29064. * @category iServer NetworkAnalyst MTSPPath
  29065. * @classdesc 多旅行商分析参数类。
  29066. * @param {Object} options - 参数。
  29067. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} options.centers - 配送中心集合。
  29068. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} options.nodes - 配送目标集合。
  29069. * @param {boolean} [options.hasLeastTotalCost=false] - 配送模式是否为总花费最小方案。
  29070. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 号来指定配送中心点和配送目的点,即通过坐标点指定。
  29071. * @param {TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  29072. * @usage
  29073. */
  29074. class FindMTSPPathsParameters {
  29075. constructor(options) {
  29076. /**
  29077. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} FindMTSPPathsParameters.prototype.centers
  29078. * @description 配送中心集合。
  29079. * 当 FindMTSPPathsParameters.isAnalyzeById = false 时,centers 应为点的坐标数组;
  29080. * 当 FindMTSPPathsParameters.isAnalyzeById = true 时,centers 应为点的 ID 数组。
  29081. */
  29082. this.centers = null;
  29083. /**
  29084. * @member {boolean} [FindMTSPPathsParameters.prototype.hasLeastTotalCost=false]
  29085. * @description 配送模式是否为总花费最小方案。
  29086. * 若为 true,则按照总花费最小的模式进行配送,此时可能会出现某几个配送中心点配送的花费较多而其他配送中心点的花费很少的情况。
  29087. * 若为 false,则为局部最优,此方案会控制每个配送中心点的花费,使各个中心点花费相对平均,此时总花费不一定最小。
  29088. */
  29089. this.hasLeastTotalCost = false;
  29090. /**
  29091. * @member {boolean} [FindMTSPPathsParameters.prototype.isAnalyzeById=false]
  29092. * @description 是否通过节点 ID 号来指定配送中心点和配送目的点,即通过坐标点指定。
  29093. */
  29094. this.isAnalyzeById = false;
  29095. /**
  29096. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} FindMTSPPathsParameters.prototype.nodes
  29097. * @description 配送目标集合。
  29098. * 当 FindMTSPPathsParameters.isAnalyzeById = false 时,nodes 应为点的坐标数组;
  29099. * 当 FindMTSPPathsParameters.isAnalyzeById = true 时,nodes 应为点的 ID 数组。
  29100. */
  29101. this.nodes = null;
  29102. /**
  29103. * @member {TransportationAnalystParameter} [FindMTSPPathsParameters.prototype.parameter]
  29104. * @description 交通网络分析通用参数。
  29105. * 通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息。
  29106. * TransportationAnalystParameter 类型,它虽然为可选参数,但是如果不设置其中的 resultSetting 字段,则返回结果空间信息等都为空。
  29107. */
  29108. this.parameter = new TransportationAnalystParameter();
  29109. Util_Util.extend(this, options);
  29110. this.CLASS_NAME = "SuperMap.FindMTSPPathsParameters";
  29111. }
  29112. /**
  29113. * @function FindMTSPPathsParameters.prototype.destroy
  29114. * @description 释放资源,将引用资源的属性置空。
  29115. */
  29116. destroy() {
  29117. var me = this;
  29118. me.centers = null;
  29119. me.hasLeastTotalCost = null;
  29120. me.isAnalyzeById = null;
  29121. me.nodes = null;
  29122. me.maxWeight = null;
  29123. if (me.parameter) {
  29124. me.parameter.destroy();
  29125. me.parameter = null;
  29126. }
  29127. }
  29128. }
  29129. ;// CONCATENATED MODULE: ./src/common/iServer/FindMTSPPathsService.js
  29130. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29131. * This program are made available under the terms of the Apache License, Version 2.0
  29132. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29133. /**
  29134. * @class FindMTSPPathsService
  29135. * @deprecatedclass SuperMap.FindMTSPPathsService
  29136. * @category iServer NetworkAnalyst MTSPPath
  29137. * @classdesc 多旅行商分析服务类
  29138. * 多旅行商分析也称为物流配送,是指在网络数据集中,给定 M 个配送中心点和 N 个配送目的地(M,N 为大于零的整数)。
  29139. * 查找经济有效的配送路径,并给出相应的行走路线。
  29140. * 物流配送功能就是解决如何合理分配配送次序和送货路线,使配送总花费达到最小或每个配送中心的花费达到最小。
  29141. * 该类负责将客户端指定的多旅行商分析参数传递给服务端,并接收服务端返回的结果数据。
  29142. * 多旅行商分析结果通过该类支持的事件的监听函数参数获取。
  29143. * @extends {NetworkAnalystServiceBase}
  29144. * @example
  29145. * var myFindMTSPPathsService = new FindMTSPPathsService(url, {
  29146. * eventListeners: {
  29147. * "processCompleted": findMTSPPathsCompleted,
  29148. * "processFailed": findMTSPPathsError
  29149. * }
  29150. * });
  29151. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  29152. * http://{服务器地址}:{服务端口号}/iserver/services/网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  29153. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  29154. * @param {Object} options - 互服务时所需可选参数。如:
  29155. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  29156. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  29157. * @param {Object} [options.headers] - 请求头。
  29158. * @usage
  29159. */
  29160. class FindMTSPPathsService extends NetworkAnalystServiceBase {
  29161. constructor(url, options) {
  29162. super(url, options);
  29163. this.CLASS_NAME = "SuperMap.FindMTSPPathsService";
  29164. }
  29165. /**
  29166. * @function FindMTSPPathsService.prototype.destroy
  29167. * @override
  29168. */
  29169. destroy() {
  29170. super.destroy();
  29171. }
  29172. /**
  29173. * @function FindMTSPPathsService..prototype.processAsync
  29174. * @description 负责将客户端的查询参数传递到服务端。
  29175. * @param {FindMTSPPathsParameters} params - 多旅行商分析服务参数类
  29176. */
  29177. processAsync(params) {
  29178. if (!(params instanceof FindMTSPPathsParameters)) {
  29179. return;
  29180. }
  29181. var me = this,
  29182. jsonObject,
  29183. //end = me.url.substr(me.url.length - 1, 1),
  29184. centers = me.getJson(params.isAnalyzeById, params.centers),
  29185. nodes = me.getJson(params.isAnalyzeById, params.nodes);
  29186. me.url = Util_Util.urlPathAppend(me.url, 'mtsppath');
  29187. jsonObject = {
  29188. centers: centers,
  29189. nodes: nodes,
  29190. parameter: Util_Util.toJSON(params.parameter),
  29191. hasLeastTotalCost: params.hasLeastTotalCost
  29192. };
  29193. me.request({
  29194. method: "GET",
  29195. params: jsonObject,
  29196. scope: me,
  29197. success: me.serviceProcessCompleted,
  29198. failure: me.serviceProcessFailed
  29199. });
  29200. }
  29201. /**
  29202. * @function FindMTSPPathsService.prototype.getJson
  29203. * @description 将对象转化为JSON字符串。
  29204. * @param {boolean} isAnalyzeById - 是否通过id分析
  29205. * @param {Array} params - 需要转换的数字
  29206. * @returns {Object} 转化后的JSON字符串。
  29207. */
  29208. getJson(isAnalyzeById, params) {
  29209. var jsonString = "[",
  29210. len = params ? params.length : 0;
  29211. if (isAnalyzeById === false) {
  29212. for (let i = 0; i < len; i++) {
  29213. if (i > 0) {
  29214. jsonString += ",";
  29215. }
  29216. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  29217. }
  29218. } else if (isAnalyzeById === true) {
  29219. for (let i = 0; i < len; i++) {
  29220. if (i > 0) {
  29221. jsonString += ",";
  29222. }
  29223. jsonString += params[i];
  29224. }
  29225. }
  29226. jsonString += ']';
  29227. return jsonString;
  29228. }
  29229. /**
  29230. * @function FindMTSPPathsService.prototype.toGeoJSONResult
  29231. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  29232. * @param {Object} result - 服务器返回的结果对象。
  29233. */
  29234. toGeoJSONResult(result) {
  29235. if (!result || !result.pathList) {
  29236. return null;
  29237. }
  29238. var geoJSONFormat = new GeoJSON();
  29239. result.pathList.map(function (path) {
  29240. if (path.route) {
  29241. path.route = geoJSONFormat.toGeoJSON(path.route);
  29242. }
  29243. if (path.pathGuideItems) {
  29244. path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
  29245. }
  29246. if (path.edgeFeatures) {
  29247. path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
  29248. }
  29249. if (path.nodeFeatures) {
  29250. path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
  29251. }
  29252. return path;
  29253. });
  29254. return result;
  29255. }
  29256. }
  29257. ;// CONCATENATED MODULE: ./src/common/iServer/FindPathParameters.js
  29258. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29259. * This program are made available under the terms of the Apache License, Version 2.0
  29260. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29261. /**
  29262. * @class FindPathParameters
  29263. * @deprecatedclass SuperMap.FindPathParameters
  29264. * @category iServer NetworkAnalyst Path
  29265. * @classdesc 最佳路径分析参数类。最佳路径是在网络数据集中指定一些结点,按照顺序访问结点从而求解起止点之间阻抗最小的路径。
  29266. * 例如如果要顺序访问 1、2、3、4 四个结点,则需要分别找到1、2结点间的最佳路径 R1—2,2、3 间的最佳路径 R2—3 和 3、4 结点间的最佳路径 R3—4,
  29267. * 顺序访问 1、2、3、4 四个结点的最佳路径就是 R = R1—2 + R2—3 + R3—4。
  29268. * 阻抗就是指从一点到另一点的耗费,在实际应用中我们可以将距离、时间、花费等作为阻抗条件。
  29269. * 阻抗最小也就可以理解为从一点到另一点距离最短、时间最少、花费最低等。当两点间距离最短时为最短路径,它是最佳路径问题的一个特例。
  29270. * 阻抗值通过 {@link TransportationAnalystParameter#weightFieldName}设置。
  29271. * 计算最佳路径除了受阻抗影响外,还受转向字段的影响。转向值通过 {@link TransportationAnalystParameter#turnWeightField} 设置。
  29272. *
  29273. * @param {Object} options - 参数。
  29274. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} options.nodes - 最佳路径分析经过的结点或设施点数组。该字段至少包含两个点。
  29275. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 指定路径分析的结点。
  29276. * @param {boolean} [options.hasLeastEdgeCount=false] - 是否按照弧段数最少的进行最佳路径分析。
  29277. * @param {TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  29278. * @usage
  29279. */
  29280. class FindPathParameters {
  29281. constructor(options) {
  29282. /**
  29283. * @member {boolean} [FindPathParameters.prototype.isAnalyzeById=false]
  29284. * @description 是否通过节点 ID 指定路径分析的结点。
  29285. * 指定路径分析经过的结点或设施点有两种方式:输入结点 ID 号或直接输入点坐标。
  29286. * 当该字段为 true 时,表示通过结点 ID 指定途经点,即 FindPathParameters.nodes = [ID1,ID2,...];
  29287. * 反之表示通过结点坐标指定途经点,即 FindPathParameters.nodes = [{x1,y1},{x2,y2},...] 。
  29288. */
  29289. this.isAnalyzeById = false;
  29290. /**
  29291. * @member {boolean} [FindPathParameters.prototype.hasLeastEdgeCount=false]
  29292. * @description 是否按照弧段数最少的进行最佳路径分析。
  29293. * true 表示按照弧段数最少进行分析,返回弧段数最少的路径中一个阻抗最小的最佳路径;
  29294. * false 表示直接返回阻抗最小的路径,而不考虑弧段的多少。
  29295. */
  29296. this.hasLeastEdgeCount = null;
  29297. /**
  29298. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} FindPathParameters.prototype.nodes
  29299. * @description 最佳路径分析经过的结点或设施点数组,必设字段。该字段至少包含两个点。
  29300. * 当 FindPathParameters.isAnalyzeById = false 时,nodes 应为点的坐标数组;
  29301. * 当 FindPathParameters.isAnalyzeById = true 时,nodes 应为点的 ID 数组。
  29302. */
  29303. this.nodes = null;
  29304. /**
  29305. * @member {TransportationAnalystParameter} FindPathParameters.prototype.parameter
  29306. * @description 交通网络分析通用参数。
  29307. */
  29308. this.parameter = new TransportationAnalystParameter();
  29309. Util_Util.extend(this, options);
  29310. this.CLASS_NAME = "SuperMap.FindPathParameters";
  29311. }
  29312. /**
  29313. * @function FindPathParameters.prototype.destroy
  29314. * @description 释放资源,将引用资源的属性置空。
  29315. */
  29316. destroy() {
  29317. var me = this;
  29318. me.isAnalyzeById = null;
  29319. me.hasLeastEdgeCount = null;
  29320. me.nodes = null;
  29321. if (me.parameter) {
  29322. me.parameter.destroy();
  29323. me.parameter = null;
  29324. }
  29325. }
  29326. }
  29327. ;// CONCATENATED MODULE: ./src/common/iServer/FindPathService.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 FindPathService
  29333. * @deprecatedclass SuperMap.FindPathService
  29334. * @category iServer NetworkAnalyst Path
  29335. * @classdesc 最佳路径分析服务类。
  29336. * 最佳路径是在网络数据集中指定一些节点,按照节点的选择顺序,
  29337. * 顺序访问这些节点从而求解起止点之间阻抗最小的路经。
  29338. * 该类负责将客户端指定的最佳路径分析参数传递给服务端,并接收服务端返回的结果数据。
  29339. * 最佳路径分析结果通过该类支持的事件的监听函数参数获取
  29340. * @extends {NetworkAnalystServiceBase}
  29341. * @example
  29342. * var myFindPathService = new FindPathService(url, {
  29343. * eventListeners: {
  29344. * "processCompleted": findPathCompleted,
  29345. * "processFailed": findPathError
  29346. * }
  29347. * });
  29348. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  29349. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  29350. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  29351. * @param {Object} options - 参数。
  29352. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  29353. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  29354. * @param {Object} [options.headers] - 请求头。
  29355. * @usage
  29356. */
  29357. class FindPathService extends NetworkAnalystServiceBase {
  29358. constructor(url, options) {
  29359. super(url, options);
  29360. this.CLASS_NAME = "SuperMap.FindPathService";
  29361. }
  29362. /**
  29363. * @function FindPathService.prototype.destroy
  29364. * @override
  29365. */
  29366. destroy() {
  29367. super.destroy();
  29368. }
  29369. /**
  29370. * @function FindPathService.prototype.processAsync
  29371. * @description 负责将客户端的查询参数传递到服务端。
  29372. * @param {FindPathParameters} params - 最佳路径分析服务参数类
  29373. */
  29374. processAsync(params) {
  29375. if (!(params instanceof FindPathParameters)) {
  29376. return;
  29377. }
  29378. var me = this, jsonObject;
  29379. me.url = Util_Util.urlPathAppend(me.url, 'path');
  29380. jsonObject = {
  29381. hasLeastEdgeCount: params.hasLeastEdgeCount,
  29382. parameter: Util_Util.toJSON(params.parameter),
  29383. nodes: me.getJson(params.isAnalyzeById, params.nodes)
  29384. };
  29385. me.request({
  29386. method: "GET",
  29387. params: jsonObject,
  29388. scope: me,
  29389. success: me.serviceProcessCompleted,
  29390. failure: me.serviceProcessFailed
  29391. });
  29392. }
  29393. /**
  29394. * @function FindPathService.prototype.getJson
  29395. * @description 将对象转化为JSON字符串。
  29396. * @param {boolean} isAnalyzeById - 是否通过id分析
  29397. * @param {Array} params - 需要转换的数字
  29398. * @returns {Object} 转化后的JSON字符串。
  29399. */
  29400. getJson(isAnalyzeById, params) {
  29401. var jsonString = "[",
  29402. len = params ? params.length : 0;
  29403. if (isAnalyzeById === false) {
  29404. for (let i = 0; i < len; i++) {
  29405. if (i > 0) {
  29406. jsonString += ",";
  29407. }
  29408. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  29409. }
  29410. } else if (isAnalyzeById === true) {
  29411. for (let i = 0; i < len; i++) {
  29412. if (i > 0) {
  29413. jsonString += ",";
  29414. }
  29415. jsonString += params[i];
  29416. }
  29417. }
  29418. jsonString += ']';
  29419. return jsonString;
  29420. }
  29421. /**
  29422. * @function FindMTSPPathsService.prototype.toGeoJSONResult
  29423. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  29424. * @param {Object} result - 服务器返回的结果对象。
  29425. */
  29426. toGeoJSONResult(result) {
  29427. if (!result || !result.pathList || result.pathList.length < 1) {
  29428. return null;
  29429. }
  29430. var geoJSONFormat = new GeoJSON();
  29431. result.pathList.forEach(function (path) {
  29432. if (path.route) {
  29433. path.route = geoJSONFormat.toGeoJSON(path.route);
  29434. }
  29435. if (path.pathGuideItems) {
  29436. path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
  29437. }
  29438. if (path.edgeFeatures) {
  29439. path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
  29440. }
  29441. if (path.nodeFeatures) {
  29442. path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
  29443. }
  29444. });
  29445. return result;
  29446. }
  29447. }
  29448. ;// CONCATENATED MODULE: ./src/common/iServer/FindServiceAreasParameters.js
  29449. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29450. * This program are made available under the terms of the Apache License, Version 2.0
  29451. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29452. /**
  29453. * @class FindServiceAreasParameters
  29454. * @deprecatedclass SuperMap.FindServiceAreasParameters
  29455. * @category iServer NetworkAnalyst ServiceArea
  29456. * @classdesc 服务区分析参数类。
  29457. * 服务区分析是以指定服务站点为中心,在一定服务范围内查找网络上服务站点能够提供服务的区域范围。
  29458. * 例如:计算某快餐店能够在30分钟内送达快餐的区域。
  29459. * @param {Object} options - 参数。
  29460. * @param {Array.<number>} options.weights - 每个服务站点提供服务的阻力半径,超过这个阻力半径的区域不予考虑,其单位与阻力字段一致。
  29461. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} options.centers - 服务站点数组。
  29462. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 指定路径分析的结点。
  29463. * @param {boolean} [options.isCenterMutuallyExclusive=false] - 是否中心点互斥。
  29464. * @param {boolean} [options.isFromCenter=false] - 是否从中心点开始分析。
  29465. * @param {TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  29466. * @usage
  29467. */
  29468. class FindServiceAreasParameters {
  29469. constructor(options) {
  29470. /**
  29471. * @member {boolean} [FindServiceAreasParameters.prototype.isAnalyzeById=false]
  29472. * @description 是否通过节点 ID 指定路径分析的结点。
  29473. * 指定路径分析经过的结点或设施点有两种方式:输入结点 ID 号或直接输入点坐标。
  29474. * 当该字段为 true 时,表示通过结点 ID 指定途经点,即 FindServiceAreasParameters.centers = [ID1,ID2,...];
  29475. * 反之表示通过结点坐标指定途经点,即 FindServiceAreasParameters.centers = [{x1,y1},{x2,y2},...]。
  29476. */
  29477. this.isAnalyzeById = false;
  29478. /**
  29479. * @member {boolean} [FindServiceAreasParameters.prototype.isCenterMutuallyExclusive=false]
  29480. * @description 是否中心点互斥,即按照中心点的距离进行判断是否要进行互斥处理。
  29481. * 若分析出的服务区有重叠的部分,则通过设置该参数进行互斥处理。
  29482. */
  29483. this.isCenterMutuallyExclusive = false;
  29484. /**
  29485. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} FindServiceAreasParameters.prototype.centers
  29486. * @description 服务站点数组。
  29487. * 当该类的 iSAnalyzeById = true 时,通过结点 ID 号指定服务站点;当 iSAnalyzeById = false 时,通过点坐标指定服务站点。
  29488. */
  29489. this.centers = null;
  29490. /**
  29491. * @member {boolean} [FindServiceAreasParameters.prototype.isFromCenter=false]
  29492. * @description 是否从中心点开始分析。
  29493. * 从中心点开始分析和不从中心点开始分析,体现了服务中心和需要该服务的需求地的关系模式。
  29494. * 从中心点开始分析,是一个服务中心向服务需求地提供服务;
  29495. * 而不从中心点开始分析,是一个服务需求地主动到服务中心获得服务。
  29496. */
  29497. this.isFromCenter = false;
  29498. /**
  29499. * APIProperty: weights
  29500. * @member {Array.<number>} FindServiceAreasParameters.prototype.weights
  29501. * @description 每个服务站点提供服务的阻力半径,即超过这个阻力半径的区域不予考虑,其单位与阻力字段一致。
  29502. * 该字段为一个数组,数组长度跟服务中心个数一致,按照索引顺序与站点一一对应,每个元素表示了在对每个服务中心进行服务区分析时,所用的服务半径。
  29503. */
  29504. this.weights = null;
  29505. /**
  29506. * @member {TransportationAnalystParameter} FindServiceAreasParameters.prototype.parameter
  29507. * @description 交通网络分析通用参数。
  29508. */
  29509. this.parameter = new TransportationAnalystParameter();
  29510. Util_Util.extend(this, options);
  29511. this.CLASS_NAME = "SuperMap.FindServiceAreasParameters";
  29512. }
  29513. /**
  29514. * @function FindServiceAreasParameters.prototype.destroy
  29515. * @description 释放资源,将引用资源的属性置空。
  29516. */
  29517. destroy() {
  29518. var me = this;
  29519. me.isAnalyzeById = null;
  29520. me.isCenterMutuallyExclusive = null;
  29521. me.centers = null;
  29522. me.isFromCenter = null;
  29523. me.weights = null;
  29524. if (me.parameter) {
  29525. me.parameter.destroy();
  29526. me.parameter = null;
  29527. }
  29528. }
  29529. }
  29530. ;// CONCATENATED MODULE: ./src/common/iServer/FindServiceAreasService.js
  29531. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29532. * This program are made available under the terms of the Apache License, Version 2.0
  29533. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29534. /**
  29535. * @class FindServiceAreasService
  29536. * @deprecatedclass SuperMap.FindServiceAreasService
  29537. * @category iServer NetworkAnalyst ServiceArea
  29538. * @classdesc 服务区分析服务类。
  29539. * 服务区分析是以指定服务站点为中心,
  29540. * 在一定服务范围内查找网络上服务站点能够提供服务的区域范围。
  29541. * 该类负责将客户端指定的服务区分析参数传递给服务端,并接收服务端返回的结果数据。
  29542. * 服务区分析结果通过该类支持的事件的监听函数参数获取
  29543. * @extends {NetworkAnalystServiceBase}
  29544. * @example
  29545. * var myFindServiceAreasService = new FindServiceAreasService(url, {
  29546. * eventListeners: {
  29547. * "processCompleted": findServiceAreasCompleted,
  29548. * "processFailed": findServiceAreasError
  29549. * }
  29550. * });
  29551. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  29552. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  29553. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  29554. * @param {Object} options - 互服务时所需可选参数。如:
  29555. * @param {Object} options.eventListeners - 需要被注册的监听器对象
  29556. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  29557. * @param {Object} [options.headers] - 请求头。
  29558. * @usage
  29559. */
  29560. class FindServiceAreasService extends NetworkAnalystServiceBase {
  29561. constructor(url, options) {
  29562. super(url, options);
  29563. this.CLASS_NAME = "SuperMap.FindServiceAreasService";
  29564. }
  29565. /**
  29566. * @function FindServiceAreasService.prototype.destroy
  29567. * @override
  29568. */
  29569. destroy() {
  29570. super.destroy();
  29571. }
  29572. /**
  29573. * @function FindServiceAreasService.prototype.processAsync
  29574. * @description 负责将客户端的查询参数传递到服务端。
  29575. * @param {FindServiceAreasParameters} params - 服务区分析服务参数类
  29576. */
  29577. processAsync(params) {
  29578. if (!(params instanceof FindServiceAreasParameters)) {
  29579. return;
  29580. }
  29581. var me = this, jsonObject;
  29582. me.url = Util_Util.urlPathAppend(me.url, 'servicearea');
  29583. jsonObject = {
  29584. isFromCenter: params.isFromCenter,
  29585. isCenterMutuallyExclusive: params.isCenterMutuallyExclusive,
  29586. parameter: Util_Util.toJSON(params.parameter),
  29587. centers: me.getJson(params.isAnalyzeById, params.centers),
  29588. weights: me.getJson(true, params.weights)
  29589. };
  29590. me.request({
  29591. method: "GET",
  29592. params: jsonObject,
  29593. scope: me,
  29594. success: me.serviceProcessCompleted,
  29595. failure: me.serviceProcessFailed
  29596. });
  29597. }
  29598. /**
  29599. * @function FindServiceAreasService.prototype.getJson
  29600. * @description 将对象转化为JSON字符串。
  29601. * @param {boolean} isAnalyzeById - 是否通过id分析
  29602. * @param {Array} params - 需要转换的数字
  29603. * @returns {Object} 转化后的JSON字符串。
  29604. */
  29605. getJson(isAnalyzeById, params) {
  29606. var jsonString = "[",
  29607. len = params ? params.length : 0;
  29608. if (isAnalyzeById === false) {
  29609. for (let i = 0; i < len; i++) {
  29610. if (i > 0) {
  29611. jsonString += ",";
  29612. }
  29613. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  29614. }
  29615. } else if (isAnalyzeById === true) {
  29616. for (let i = 0; i < len; i++) {
  29617. if (i > 0) {
  29618. jsonString += ",";
  29619. }
  29620. jsonString += params[i];
  29621. }
  29622. }
  29623. jsonString += ']';
  29624. return jsonString;
  29625. }
  29626. /**
  29627. * @function FindServiceAreasService.prototype.toGeoJSONResult
  29628. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  29629. * @param {Object} result - 服务器返回的结果对象。
  29630. */
  29631. toGeoJSONResult(result) {
  29632. if (!result || !result.serviceAreaList) {
  29633. return result;
  29634. }
  29635. var geoJSONFormat = new GeoJSON();
  29636. result.serviceAreaList.map(function (serviceArea) {
  29637. if (serviceArea.serviceRegion) {
  29638. serviceArea.serviceRegion = geoJSONFormat.toGeoJSON(serviceArea.serviceRegion);
  29639. }
  29640. if (serviceArea.edgeFeatures) {
  29641. serviceArea.edgeFeatures = geoJSONFormat.toGeoJSON(serviceArea.edgeFeatures);
  29642. }
  29643. if (serviceArea.nodeFeatures) {
  29644. serviceArea.nodeFeatures = geoJSONFormat.toGeoJSON(serviceArea.nodeFeatures);
  29645. }
  29646. if (serviceArea.routes) {
  29647. serviceArea.routes = geoJSONFormat.toGeoJSON(serviceArea.routes);
  29648. }
  29649. return serviceArea;
  29650. });
  29651. return result;
  29652. }
  29653. }
  29654. ;// CONCATENATED MODULE: ./src/common/iServer/FindTSPPathsParameters.js
  29655. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29656. * This program are made available under the terms of the Apache License, Version 2.0
  29657. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29658. /**
  29659. * @class FindTSPPathsParameters
  29660. * @deprecatedclass SuperMap.FindTSPPathsParameters
  29661. * @category iServer NetworkAnalyst TSPPath
  29662. * @classdesc 旅行商分析参数类。
  29663. * 旅行商分析是路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。
  29664. * 旅行商分析也可以指定到达的终点,这时查找从起点能够遍历所有途经点最后到达终点,且花费最小的路径。
  29665. * 旅行商分析和最佳路径分析都是在网络中寻找遍历所有站点的最经济的路径,区别是在遍历网络所有站点的过程中对结点访问顺序不同。
  29666. * 最佳路径分析必须按照指定顺序对站点进行访问,而旅行商分析是无序的路径分析。
  29667. * @param {Object} options - 参数。
  29668. * @param {boolean} [options.endNodeAssigned=false] - 是否指定终止点,将指定的途经点的最后一个点作为终止点。true 表示指定终止点,则旅行商必须最后一个访问终止点。
  29669. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 号来指定配送中心点和配送目的点。
  29670. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} options.nodes - 配送目标集合。
  29671. * @param {TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  29672. * @usage
  29673. */
  29674. class FindTSPPathsParameters {
  29675. constructor(options) {
  29676. /**
  29677. * @member {boolean} [FindTSPPathsParameters.prototype.endNodeAssigned=false]
  29678. * @description 是否指定终止点,将指定的途经点的最后一个点作为终止点。
  29679. * true 表示指定终止点,则旅行商必须最后一个访问终止点。
  29680. */
  29681. this.endNodeAssigned = false;
  29682. /**
  29683. * @member {boolean} [FindTSPPathsParameters.prototype.isAnalyzeById=false]
  29684. * @description 是否通过节点 ID 号来指定途经点。
  29685. */
  29686. this.isAnalyzeById = false;
  29687. /**
  29688. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>>} FindTSPPathsParameters.prototype.nodes
  29689. * @description 旅行商分析途经点数组。
  29690. * 当 FindTSPPathsParameters.isAnalyzeById = false 时,nodes 应为点的坐标数组;
  29691. * 当 FindTSPPathsParameters.isAnalyzeById = true 时,nodes 应为点的 ID 数组。
  29692. */
  29693. this.nodes = null;
  29694. /**
  29695. * @member {TransportationAnalystParameter} [FindTSPPathsParameters.prototype.parameter]
  29696. * @description 交通网络分析通用参数。通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息。
  29697. * TransportationAnalystParameter 类型,它虽然为可选参数,但是如果不设置其中的 resultSetting
  29698. * 字段,则返回结果空间信息等都为空。
  29699. */
  29700. this.parameter = new TransportationAnalystParameter();
  29701. Util_Util.extend(this, options);
  29702. this.CLASS_NAME = "SuperMap.FindTSPPathsParameters";
  29703. }
  29704. /**
  29705. * @function FindTSPPathsParameters.prototype.destroy
  29706. * @description 释放资源,将引用资源的属性置空。
  29707. */
  29708. destroy() {
  29709. var me = this;
  29710. me.endNodeAssigned = null;
  29711. me.isAnalyzeById = null;
  29712. me.nodes = null;
  29713. if (me.parameter) {
  29714. me.parameter.destroy();
  29715. me.parameter = null;
  29716. }
  29717. }
  29718. }
  29719. ;// CONCATENATED MODULE: ./src/common/iServer/FindTSPPathsService.js
  29720. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29721. * This program are made available under the terms of the Apache License, Version 2.0
  29722. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29723. /**
  29724. * @class FindTSPPathsService
  29725. * @deprecatedclass SuperMap.FindTSPPathsService
  29726. * @category iServer NetworkAnalyst TSPPath
  29727. * @classdesc 旅行商分析服务类
  29728. * 旅行商分析是路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。
  29729. * 旅行商分析也可以指定到达的终点,这时查找从起点能够遍历所有途经点最后到达终点,且花费最小的路径。
  29730. * 该类负责将客户端指定的旅行商分析参数传递给服务端,并接收服务端返回的结果数据。
  29731. * 旅行商分析结果通过该类支持的事件的监听函数参数获取
  29732. * @extends {NetworkAnalystServiceBase}
  29733. * @example
  29734. * (start code)
  29735. * var myFindTSPPathsService = new FindTSPPathsService(url, {
  29736. * eventListeners: {
  29737. * "processCompleted": findTSPPathsCompleted,
  29738. * "processFailed": findTSPPathsError
  29739. * }
  29740. * });
  29741. * (end)
  29742. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  29743. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  29744. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  29745. * @param {Object} options - 参数。
  29746. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  29747. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  29748. * @param {Object} [options.headers] - 请求头。
  29749. * @usage
  29750. */
  29751. class FindTSPPathsService extends NetworkAnalystServiceBase {
  29752. constructor(url, options) {
  29753. super(url, options);
  29754. this.CLASS_NAME = "SuperMap.FindTSPPathsService";
  29755. }
  29756. /**
  29757. * @function FindTSPPathsService.prototype.destroy
  29758. * @override
  29759. */
  29760. destroy() {
  29761. super.destroy();
  29762. }
  29763. /**
  29764. * @function FindTSPPathsService.prototype.processAsync
  29765. * @description 负责将客户端的查询参数传递到服务端。
  29766. * @param {FindTSPPathsParameters} params - 旅行商分析服务参数类。
  29767. */
  29768. processAsync(params) {
  29769. if (!(params instanceof FindTSPPathsParameters)) {
  29770. return;
  29771. }
  29772. var me = this, jsonObject;
  29773. me.url = Util_Util.urlPathAppend(me.url, 'tsppath');
  29774. jsonObject = {
  29775. parameter: Util_Util.toJSON(params.parameter),
  29776. endNodeAssigned: params.endNodeAssigned,
  29777. nodes: me.getNodesJson(params)
  29778. };
  29779. me.request({
  29780. method: "GET",
  29781. params: jsonObject,
  29782. scope: me,
  29783. success: me.serviceProcessCompleted,
  29784. failure: me.serviceProcessFailed
  29785. });
  29786. }
  29787. /**
  29788. * @function FindTSPPathsService.prototype.getNodesJson
  29789. * @description 将节点对象转化为JSON字符串。
  29790. * @param {FindTSPPathsParameters} params - 旅行商分析服务参数类。
  29791. * @returns {string} 转化后的JSON字符串。
  29792. */
  29793. getNodesJson(params) {
  29794. var jsonParameters = "", nodesString, i, len, nodes;
  29795. if (params.isAnalyzeById === false) {
  29796. for (nodesString = "[", i = 0, nodes = params.nodes, len = nodes.length; i < len; i++) {
  29797. if (i > 0) {
  29798. nodesString += ",";
  29799. }
  29800. nodesString += '{"x":' + nodes[i].x + ',"y":' + nodes[i].y + '}';
  29801. }
  29802. nodesString += ']';
  29803. jsonParameters += nodesString;
  29804. } else if (params.isAnalyzeById === true) {
  29805. let nodeIDsString = "[", nodes = params.nodes, len = nodes.length;
  29806. for (let i = 0; i < len; i++) {
  29807. if (i > 0) {
  29808. nodeIDsString += ",";
  29809. }
  29810. nodeIDsString += nodes[i];
  29811. }
  29812. nodeIDsString += ']';
  29813. jsonParameters += nodeIDsString;
  29814. }
  29815. return jsonParameters;
  29816. }
  29817. /**
  29818. * @function FindTSPPathsService.prototype.toGeoJSONResult
  29819. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  29820. * @param {Object} result - 服务器返回的结果对象。
  29821. */
  29822. toGeoJSONResult(result) {
  29823. if (!result || !result.tspPathList) {
  29824. return null;
  29825. }
  29826. var geoJSONFormat = new GeoJSON();
  29827. result.tspPathList.forEach(function (path) {
  29828. if (path.route) {
  29829. path.route = geoJSONFormat.toGeoJSON(path.route);
  29830. }
  29831. if (path.pathGuideItems) {
  29832. path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
  29833. }
  29834. if (path.edgeFeatures) {
  29835. path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
  29836. }
  29837. if (path.nodeFeatures) {
  29838. path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
  29839. }
  29840. });
  29841. return result;
  29842. }
  29843. }
  29844. ;// CONCATENATED MODULE: ./src/common/iServer/UpdateEdgeWeightParameters.js
  29845. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29846. * This program are made available under the terms of the Apache License, Version 2.0
  29847. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29848. /**
  29849. * @class UpdateEdgeWeightParameters
  29850. * @deprecatedclass SuperMap.UpdateEdgeWeightParameters
  29851. * @category iServer NetworkAnalyst EdgeWeight
  29852. * @classdesc 边的耗费权重更新服务参数类。
  29853. * @param {Object} options - 参数。
  29854. * @param {string} options.edgeId - 所在边的 ID。
  29855. * @param {string} options.fromNodeId - 起始转向点的 ID。
  29856. * @param {string} options.toNodeId - 终止转向点的 ID。
  29857. * @param {string} options.weightField - 边的耗费字段。
  29858. * @param {string} options.edgeWeight - 耗费权重。
  29859. * @usage
  29860. */
  29861. class UpdateEdgeWeightParameters {
  29862. constructor(options) {
  29863. if (!options) {
  29864. return;
  29865. }
  29866. /**
  29867. * @member {string} UpdateEdgeWeightParameters.prototype.edgeId
  29868. * @description 所在边的 ID。
  29869. */
  29870. this.edgeId = "";
  29871. /**
  29872. * @member {string} UpdateEdgeWeightParameters.prototype.fromNodeId
  29873. * @description 起始转向点的 ID。
  29874. */
  29875. this.fromNodeId = "";
  29876. /**
  29877. * @member {string} UpdateEdgeWeightParameters.prototype.toNodeId
  29878. * @description 终止转向点的 ID。
  29879. */
  29880. this.toNodeId = "";
  29881. /**
  29882. * @member {string} UpdateEdgeWeightParameters.prototype.weightField
  29883. * @description 边的耗费字段。
  29884. */
  29885. this.weightField = "";
  29886. /**
  29887. * @member {string} UpdateEdgeWeightParameters.prototype.edgeWeight
  29888. * @description 耗费权重。
  29889. */
  29890. this.edgeWeight = "";
  29891. Util_Util.extend(this, options);
  29892. this.CLASS_NAME = "SuperMap.UpdateEdgeWeightParameters";
  29893. }
  29894. /**
  29895. * @function UpdateEdgeWeightParameters.prototype.destroy
  29896. * @description 释放资源,将引用资源的属性置空。
  29897. */
  29898. destroy() {
  29899. this.edgeId = null;
  29900. this.fromNodeId = null;
  29901. this.toNodeId = null;
  29902. this.weightField = null;
  29903. this.edgeWeight = null;
  29904. }
  29905. }
  29906. ;// CONCATENATED MODULE: ./src/common/iServer/UpdateEdgeWeightService.js
  29907. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  29908. * This program are made available under the terms of the Apache License, Version 2.0
  29909. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29910. /**
  29911. * @class UpdateEdgeWeightService
  29912. * @deprecatedclass SuperMap.UpdateEdgeWeightService
  29913. * @category iServer NetworkAnalyst EdgeWeight
  29914. * @classdesc 更新边的边的耗费权重服务
  29915. * @extends {NetworkAnalystServiceBase}
  29916. * @example
  29917. *(start code)
  29918. * var updateEdgeWeightService = new UpdateEdgeWeightService(url, {
  29919. * eventListeners: {
  29920. * "processCompleted": UpdateEdgeWeightCompleted,
  29921. * "processFailed": UpdateEdgeWeightError
  29922. * }
  29923. * });
  29924. * (end)
  29925. * @param {string} url - 服务地址。如:http://localhost:8090/iserver/services/transportationanalyst-sample/rest/networkanalyst/RoadNet@Changchun 。
  29926. * @param {Object} options - 参数。
  29927. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  29928. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  29929. * @param {Object} [options.headers] - 请求头。
  29930. * @usage
  29931. */
  29932. class UpdateEdgeWeightService extends NetworkAnalystServiceBase {
  29933. constructor(url, options) {
  29934. super(url, options);
  29935. this.CLASS_NAME = "SuperMap.UpdateEdgeWeightService";
  29936. }
  29937. /**
  29938. * @override
  29939. */
  29940. destroy() {
  29941. super.destroy();
  29942. }
  29943. /**
  29944. * @function UpdateEdgeWeightService.prototype.processAsync
  29945. * @description 开始异步执行边的边的耗费权重的更新
  29946. * @param {UpdateEdgeWeightParameters} params - 边的耗费权重更新服务参数类
  29947. * @example
  29948. * (code)
  29949. * var updateEdgeWeightParam=new SuperMapUpdateEdgeWeightParameters({
  29950. * edgeId:"20",
  29951. * fromNodeId:"26",
  29952. * toNodeId:"109",
  29953. * weightField:"time",
  29954. * edgeWeight:"25"
  29955. * });
  29956. * updateEdgeWeightService.processAsync(updateEdgeWeightParam);
  29957. * (end)
  29958. */
  29959. processAsync(params) {
  29960. if (!(params instanceof UpdateEdgeWeightParameters)) {
  29961. return;
  29962. }
  29963. var me = this;
  29964. var paramStr = me.parse(params);
  29965. me.url = Util_Util.urlPathAppend(me.url, paramStr);
  29966. var data = params.edgeWeight ? params.edgeWeight : null;
  29967. me.request({
  29968. method: "PUT",
  29969. scope: me,
  29970. data: data,
  29971. success: me.serviceProcessCompleted,
  29972. failure: me.serviceProcessFailed
  29973. });
  29974. }
  29975. /**
  29976. * @function UpdateEdgeWeightService.prototype.parse
  29977. * @description 将更新服务参数解析为用‘/’做分隔的字符串
  29978. */
  29979. parse(params) {
  29980. if (!params) {
  29981. return;
  29982. }
  29983. var paramStr = "";
  29984. for (var attr in params) {
  29985. if (params[attr] === "" || params[attr] === "edgeWeight") {
  29986. continue;
  29987. }
  29988. switch (attr) {
  29989. case "edgeId":
  29990. paramStr += "/edgeweight/" + params[attr];
  29991. break;
  29992. case "fromNodeId":
  29993. paramStr += "/fromnode/" + params[attr];
  29994. break;
  29995. case "toNodeId":
  29996. paramStr += "/tonode/" + params[attr];
  29997. break;
  29998. case "weightField":
  29999. paramStr += "/weightfield/" + params[attr];
  30000. break;
  30001. default :
  30002. break;
  30003. }
  30004. }
  30005. return paramStr;
  30006. }
  30007. }
  30008. ;// CONCATENATED MODULE: ./src/common/iServer/UpdateTurnNodeWeightParameters.js
  30009. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30010. * This program are made available under the terms of the Apache License, Version 2.0
  30011. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30012. /**
  30013. * @class UpdateTurnNodeWeightParameters
  30014. * @deprecatedclass SuperMap.UpdateTurnNodeWeightParameters
  30015. * @category iServer NetworkAnalyst TurnNodeWeight
  30016. * @classdesc 转向耗费权重更新服务参数类。
  30017. * @param {Object} options - 参数。
  30018. * @param {string} options.nodeId - 转向结点的 ID。
  30019. * @param {string} options.fromEdgeId - 起始边的 ID。
  30020. * @param {string} options.toEdgeId - 终止边的 ID。
  30021. * @param {string} options.weightField - 转向结点的耗费字段。
  30022. * @param {string} options.turnNodeWeight - 耗费权重。
  30023. * @usage
  30024. */
  30025. class UpdateTurnNodeWeightParameters {
  30026. constructor(options) {
  30027. if (!options) {
  30028. return;
  30029. }
  30030. /**
  30031. * @member {string} UpdateTurnNodeWeightParameters.prototype.nodeId
  30032. * @description 转向结点的 ID。
  30033. */
  30034. this.nodeId = "";
  30035. /**
  30036. * @member {string} UpdateTurnNodeWeightParameters.prototype.fromEdgeId
  30037. * @description 起始边的 ID。
  30038. */
  30039. this.fromEdgeId = "";
  30040. /**
  30041. * @member {string} UpdateTurnNodeWeightParameters.prototype.toEdgeId
  30042. * @description 终止边的 ID。
  30043. */
  30044. this.toEdgeId = "";
  30045. /**
  30046. * @member {string} UpdateTurnNodeWeightParameters.prototype.weightField
  30047. * @description 转向结点的耗费字段。
  30048. */
  30049. this.weightField = "";
  30050. /**
  30051. * @member {string} UpdateTurnNodeWeightParameters.prototype.turnNodeWeight
  30052. * @description 耗费权重。
  30053. */
  30054. this.turnNodeWeight = "";
  30055. Util_Util.extend(this, options);
  30056. this.CLASS_NAME = "SuperMap.UpdateTurnNodeWeightParameters";
  30057. }
  30058. /**
  30059. * @function UpdateTurnNodeWeightParameters.prototype.destroy
  30060. * @description 释放资源,将引用资源的属性置空。
  30061. */
  30062. destroy() {
  30063. this.nodeId = null;
  30064. this.fromEdgeId = null;
  30065. this.toEdgeId = null;
  30066. this.weightField = null;
  30067. this.turnNodeWeight = null;
  30068. }
  30069. }
  30070. ;// CONCATENATED MODULE: ./src/common/iServer/UpdateTurnNodeWeightService.js
  30071. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30072. * This program are made available under the terms of the Apache License, Version 2.0
  30073. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30074. /**
  30075. * @class UpdateTurnNodeWeightService
  30076. * @deprecatedclass SuperMap.UpdateTurnNodeWeightService
  30077. * @category iServer NetworkAnalyst TurnNodeWeight
  30078. * @classdesc 转向耗费权重更新服务类
  30079. * @extends {NetworkAnalystServiceBase}
  30080. * @example
  30081. * var UpdateTurnNodeWeightService = new UpdateTurnNodeWeightService(url, {
  30082. * eventListeners: {
  30083. * "processCompleted": UpdateTurnNodeWeightCompleted,
  30084. * "processFailed": UpdateTurnNodeWeightError
  30085. * }
  30086. * });
  30087. * @param {string} url - 服务地址。如:
  30088. * http://localhost:8090/iserver/services/transportationanalyst-sample/rest/networkanalyst/RoadNet@Changchun 。
  30089. * @param {Object} options - 参数。
  30090. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  30091. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30092. * @param {Object} [options.headers] - 请求头。
  30093. * @usage
  30094. */
  30095. class UpdateTurnNodeWeightService extends NetworkAnalystServiceBase {
  30096. constructor(url, options) {
  30097. super(url, options);
  30098. this.CLASS_NAME = "SuperMap.UpdateTurnNodeWeightService";
  30099. }
  30100. /**
  30101. * @override
  30102. */
  30103. destroy() {
  30104. super.destroy();
  30105. }
  30106. /**
  30107. * @function UpdateTurnNodeWeightService.prototype.processAsync
  30108. * @description 开始异步执行转向耗费权重的更新
  30109. * @param {UpdateTurnNodeWeightParameters} params - 转向耗费权重更新服务参数类
  30110. * @example
  30111. * (code)
  30112. * var updateTurnNodeWeightParam=new UpdateTurnNodeWeightParameters({
  30113. * nodeId:"106",
  30114. * fromEdgeId:"6508",
  30115. * toEdgeId:"6504",
  30116. * weightField:"TurnCost",
  30117. * turnNodeWeight:"50"
  30118. * });
  30119. * updateTurnNodeWeightService.processAsync(updateTurnNodeWeightParam);
  30120. * (end)
  30121. **/
  30122. processAsync(params) {
  30123. if (!(params instanceof UpdateTurnNodeWeightParameters)) {
  30124. return;
  30125. }
  30126. var me = this;
  30127. var paramStr = me.parse(params);
  30128. me.url = Util_Util.urlPathAppend(me.url, paramStr);
  30129. var data = params.turnNodeWeight ? params.turnNodeWeight : null;
  30130. me.request({
  30131. method: "PUT",
  30132. scope: me,
  30133. data: data,
  30134. success: me.serviceProcessCompleted,
  30135. failure: me.serviceProcessFailed
  30136. });
  30137. }
  30138. /**
  30139. * @function UpdateTurnNodeWeightService.prototype.parse
  30140. * @description 将更新服务参数解析为用‘/’做分隔的字符串
  30141. */
  30142. parse(params) {
  30143. if (!params) {
  30144. return;
  30145. }
  30146. var paramStr = "";
  30147. for (var attr in params) {
  30148. if (params[attr] === "" || params[attr] === "turnNodeWeight") {
  30149. continue;
  30150. }
  30151. switch (attr) {
  30152. case "nodeId":
  30153. paramStr += "/turnnodeweight/" + params[attr];
  30154. break;
  30155. case "fromEdgeId":
  30156. paramStr += "/fromedge/" + params[attr];
  30157. break;
  30158. case "toEdgeId":
  30159. paramStr += "/toedge/" + params[attr];
  30160. break;
  30161. case "weightField":
  30162. paramStr += "/weightfield/" + params[attr];
  30163. break;
  30164. default :
  30165. break;
  30166. }
  30167. }
  30168. return paramStr;
  30169. }
  30170. }
  30171. ;// CONCATENATED MODULE: ./src/common/iServer/NetworkAnalystService.js
  30172. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30173. * This program are made available under the terms of the Apache License, Version 2.0
  30174. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30175. /**
  30176. * @class NetworkAnalystService
  30177. * @category iServer NetworkAnalyst
  30178. * @classdesc 网络分析服务类。
  30179. * @extends {ServiceBase}
  30180. * @example
  30181. * new NetworkAnalystService(url)
  30182. * .findPath(params,function(result){
  30183. * //doSomething
  30184. * })
  30185. * @param {string} url - 服务地址。请求网络分析服务,URL应为:</br>
  30186. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源}。
  30187. * 例如: "http://localhost:8090/iserver/services/test/rest/networkanalyst/WaterNet@FacilityNet"。
  30188. * @param {Object} options - 参数。
  30189. * @param {string} [options.proxy] - 服务代理地址。
  30190. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  30191. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30192. * @param {Object} [options.headers] - 请求头。
  30193. * @usage
  30194. */
  30195. class NetworkAnalystService_NetworkAnalystService {
  30196. constructor(url, options) {
  30197. this.url = url;
  30198. this.options = options || {};
  30199. }
  30200. /**
  30201. * @function NetworkAnalystService.prototype.burstPipelineAnalyst
  30202. * @description 爆管分析服务:即将给定弧段或节点作为爆管点来进行分析,返回关键结点 ID 数组,普通结点 ID 数组及其上下游弧段 ID 数组。
  30203. * @param {BurstPipelineAnalystParameters} params - 爆管分析服务参数类。
  30204. * @param {RequestCallback} callback 回调函数。
  30205. */
  30206. burstPipelineAnalyst(params, callback) {
  30207. var me = this;
  30208. var burstPipelineAnalystService = new BurstPipelineAnalystService(me.url, {
  30209. proxy: me.options.proxy,
  30210. withCredentials: me.options.withCredentials,
  30211. crossOrigin: me.options.crossOrigin,
  30212. headers: me.options.headers,
  30213. eventListeners: {
  30214. scope: me,
  30215. processCompleted: callback,
  30216. processFailed: callback
  30217. }
  30218. });
  30219. burstPipelineAnalystService.processAsync(params);
  30220. }
  30221. /**
  30222. * @function NetworkAnalystService.prototype.computeWeightMatrix
  30223. * @description 耗费矩阵分析服务:根据交通网络分析参数中的耗费字段返回一个耗费矩阵。该矩阵是一个二维数组,用来存储任意两点间的资源消耗。
  30224. * @param {ComputeWeightMatrixParameters} params - 耗费矩阵分析服务参数类。
  30225. * @param {RequestCallback} callback - 回调函数。
  30226. */
  30227. computeWeightMatrix(params, callback) {
  30228. var me = this;
  30229. var computeWeightMatrixService = new ComputeWeightMatrixService(me.url, {
  30230. proxy: me.options.proxy,
  30231. withCredentials: me.options.withCredentials,
  30232. crossOrigin: me.options.crossOrigin,
  30233. headers: me.options.headers,
  30234. eventListeners: {
  30235. scope: me,
  30236. processCompleted: callback,
  30237. processFailed: callback
  30238. }
  30239. });
  30240. computeWeightMatrixService.processAsync(params);
  30241. }
  30242. /**
  30243. * @function NetworkAnalystService.prototype.findClosestFacilities
  30244. * @description 最近设施分析服务:指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  30245. * @param {FindClosestFacilitiesParameters} params - 最近设施分析服务参数类。
  30246. * @param {RequestCallback} callback 回调函数。
  30247. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  30248. */
  30249. findClosestFacilities(params, callback, resultFormat) {
  30250. var me = this;
  30251. var findClosestFacilitiesService = new FindClosestFacilitiesService(me.url, {
  30252. proxy: me.options.proxy,
  30253. withCredentials: me.options.withCredentials,
  30254. crossOrigin: me.options.crossOrigin,
  30255. headers: me.options.headers,
  30256. eventListeners: {
  30257. scope: me,
  30258. processCompleted: callback,
  30259. processFailed: callback
  30260. },
  30261. format: me._processFormat(resultFormat)
  30262. });
  30263. findClosestFacilitiesService.processAsync(params);
  30264. }
  30265. /**
  30266. * @function NetworkAnalystService.prototype.streamFacilityAnalyst
  30267. * @description 上游/下游 关键设施查找资源服务:查找给定弧段或节点的上游/下游中的关键设施结点,返回关键结点 ID 数组及其下游弧段 ID 数组。
  30268. * @param {FacilityAnalystStreamParameters} params - 上游/下游 关键设施查找资源服务参数类。
  30269. * @param {RequestCallback} callback 回调函数。
  30270. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  30271. */
  30272. streamFacilityAnalyst(params, callback, resultFormat) {
  30273. var me = this;
  30274. var facilityAnalystStreamService = new FacilityAnalystStreamService(me.url, {
  30275. proxy: me.options.proxy,
  30276. withCredentials: me.options.withCredentials,
  30277. crossOrigin: me.options.crossOrigin,
  30278. headers: me.options.headers,
  30279. eventListeners: {
  30280. scope: me,
  30281. processCompleted: callback,
  30282. processFailed: callback
  30283. },
  30284. format: me._processFormat(resultFormat)
  30285. });
  30286. facilityAnalystStreamService.processAsync(params);
  30287. }
  30288. /**
  30289. * @function NetworkAnalystService.prototype.findLocation
  30290. * @description 选址分区分析服务:确定一个或多个待建设施的最佳或最优位置。
  30291. * @param {FindLocationParameters} params - 选址分区分析服务参数类。
  30292. * @param {RequestCallback} callback 回调函数。
  30293. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  30294. */
  30295. findLocation(params, callback, resultFormat) {
  30296. var me = this;
  30297. var findLocationService = new FindLocationService(me.url, {
  30298. proxy: me.options.proxy,
  30299. withCredentials: me.options.withCredentials,
  30300. crossOrigin: me.options.crossOrigin,
  30301. headers: me.options.headers,
  30302. eventListeners: {
  30303. scope: me,
  30304. processCompleted: callback,
  30305. processFailed: callback
  30306. },
  30307. format: me._processFormat(resultFormat)
  30308. });
  30309. findLocationService.processAsync(params);
  30310. }
  30311. /**
  30312. * @function NetworkAnalystService.prototype.findPath
  30313. * @description 最佳路径分析服务:在网络数据集中指定一些节点,按照节点的选择顺序,顺序访问这些节点从而求解起止点之间阻抗最小的路经。
  30314. * @param {FindPathParameters} params - 最佳路径分析服务参数类。
  30315. * @param {RequestCallback} callback - 回调函数。
  30316. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  30317. */
  30318. findPath(params, callback, resultFormat) {
  30319. var me = this;
  30320. var findPathService = new FindPathService(me.url, {
  30321. proxy: me.options.proxy,
  30322. withCredentials: me.options.withCredentials,
  30323. crossOrigin: me.options.crossOrigin,
  30324. headers: me.options.headers,
  30325. eventListeners: {
  30326. scope: me,
  30327. processCompleted: callback,
  30328. processFailed: callback
  30329. },
  30330. format: me._processFormat(resultFormat)
  30331. });
  30332. findPathService.processAsync(params);
  30333. }
  30334. /**
  30335. * @function NetworkAnalystService.prototype.findTSPPaths
  30336. * @description 旅行商分析服务:路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。
  30337. * @param {FindTSPPathsParameters} params - 旅行商分析服务参数类。
  30338. * @param {RequestCallback} callback - 回调函数。
  30339. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  30340. */
  30341. findTSPPaths(params, callback, resultFormat) {
  30342. var me = this;
  30343. var findTSPPathsService = new FindTSPPathsService(me.url, {
  30344. proxy: me.options.proxy,
  30345. withCredentials: me.options.withCredentials,
  30346. crossOrigin: me.options.crossOrigin,
  30347. headers: me.options.headers,
  30348. eventListeners: {
  30349. scope: me,
  30350. processCompleted: callback,
  30351. processFailed: callback
  30352. },
  30353. format: me._processFormat(resultFormat)
  30354. });
  30355. findTSPPathsService.processAsync(params);
  30356. }
  30357. /**
  30358. * @function NetworkAnalystService.prototype.findMTSPPaths
  30359. * @description 多旅行商分析服务:也称为物流配送,是指在网络数据集中,给定 M 个配送中心点和 N 个配送目的地(M,N 为大于零的整数)。查找经济有效的配送路径,并给出相应的行走路线。
  30360. * @param {FindMTSPPathsParameters} params - 多旅行商分析服务参数类。
  30361. * @param {RequestCallback} callback - 回调函数。
  30362. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  30363. */
  30364. findMTSPPaths(params, callback, resultFormat) {
  30365. var me = this;
  30366. var findMTSPPathsService = new FindMTSPPathsService(me.url, {
  30367. proxy: me.options.proxy,
  30368. withCredentials: me.options.withCredentials,
  30369. crossOrigin: me.options.crossOrigin,
  30370. headers: me.options.headers,
  30371. eventListeners: {
  30372. scope: me,
  30373. processCompleted: callback,
  30374. processFailed: callback
  30375. },
  30376. format: me._processFormat(resultFormat)
  30377. });
  30378. findMTSPPathsService.processAsync(params);
  30379. }
  30380. /**
  30381. * @function NetworkAnalystService.prototype.findServiceAreas
  30382. * @description 服务区分析服务:以指定服务站点为中心,在一定服务范围内查找网络上服务站点能够提供服务的区域范围。
  30383. * @param {FindServiceAreasParameters} params - 服务区分析服务参数类。
  30384. * @param {RequestCallback} callback 回调函数。
  30385. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  30386. */
  30387. findServiceAreas(params, callback, resultFormat) {
  30388. var me = this;
  30389. var findServiceAreasService = new FindServiceAreasService(me.url, {
  30390. proxy: me.options.proxy,
  30391. withCredentials: me.options.withCredentials,
  30392. crossOrigin: me.options.crossOrigin,
  30393. headers: me.options.headers,
  30394. eventListeners: {
  30395. scope: me,
  30396. processCompleted: callback,
  30397. processFailed: callback
  30398. },
  30399. format: me._processFormat(resultFormat)
  30400. });
  30401. findServiceAreasService.processAsync(params);
  30402. }
  30403. /**
  30404. * @function NetworkAnalystService.prototype.updateEdgeWeight
  30405. * @description 更新边的耗费权重服务。
  30406. * @param {UpdateEdgeWeightParameters} params - 更新边的耗费权重服务参数类。
  30407. * @param {RequestCallback} callback 回调函数。
  30408. */
  30409. updateEdgeWeight(params, callback) {
  30410. var me = this;
  30411. var updateEdgeWeightService = new UpdateEdgeWeightService(me.url, {
  30412. proxy: me.options.proxy,
  30413. withCredentials: me.options.withCredentials,
  30414. crossOrigin: me.options.crossOrigin,
  30415. headers: me.options.headers,
  30416. eventListeners: {
  30417. scope: me,
  30418. processCompleted: callback,
  30419. processFailed: callback
  30420. }
  30421. });
  30422. updateEdgeWeightService.processAsync(params);
  30423. }
  30424. /**
  30425. * @function NetworkAnalystService.prototype.updateTurnNodeWeight
  30426. * @description 转向耗费权重更新服务。
  30427. * @param {UpdateTurnNodeWeightParameters} params - 转向耗费权重更新服务参数类。
  30428. * @param {RequestCallback} callback - 回调函数。
  30429. */
  30430. updateTurnNodeWeight(params, callback) {
  30431. var me = this;
  30432. var updateTurnNodeWeightService = new UpdateTurnNodeWeightService(me.url, {
  30433. proxy: me.options.proxy,
  30434. withCredentials: me.options.withCredentials,
  30435. crossOrigin: me.options.crossOrigin,
  30436. headers: me.options.headers,
  30437. eventListeners: {
  30438. scope: me,
  30439. processCompleted: callback,
  30440. processFailed: callback
  30441. }
  30442. });
  30443. updateTurnNodeWeightService.processAsync(params);
  30444. }
  30445. _processFormat(resultFormat) {
  30446. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  30447. }
  30448. }
  30449. ;// CONCATENATED MODULE: ./src/maplibregl/services/NetworkAnalystService.js
  30450. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30451. * This program are made available under the terms of the Apache License, Version 2.0
  30452. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30453. /**
  30454. * @class NetworkAnalystService
  30455. * @category iServer NetworkAnalyst
  30456. * @classdesc 网络分析服务类。
  30457. * @version 11.1.0
  30458. * @modulecategory Services
  30459. * @extends {ServiceBase}
  30460. * @example
  30461. * new NetworkAnalystService(url)
  30462. * .findPath(params,function(result){
  30463. * //doSomething
  30464. * })
  30465. * @param {string} url - 服务地址。请求网络分析服务,URL应为:</br>
  30466. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源}。
  30467. * 例如: "http://localhost:8090/iserver/services/test/rest/networkanalyst/WaterNet@FacilityNet"。
  30468. * @param {Object} options - 参数。
  30469. * @param {string} [options.proxy] - 服务代理地址。
  30470. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  30471. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30472. * @param {Object} [options.headers] - 请求头。
  30473. * @usage
  30474. */
  30475. class NetworkAnalystService extends ServiceBase {
  30476. constructor(url, options) {
  30477. super(url, options);
  30478. this._networkAnalystService = new NetworkAnalystService_NetworkAnalystService(url, options);
  30479. }
  30480. /**
  30481. * @function NetworkAnalystService.prototype.burstPipelineAnalyst
  30482. * @description 爆管分析服务:即将给定弧段或节点作为爆管点来进行分析,返回关键结点 ID 数组,普通结点 ID 数组及其上下游弧段 ID 数组。
  30483. * @param {BurstPipelineAnalystParameters} params - 爆管分析服务参数类。
  30484. * @param {RequestCallback} callback 回调函数。
  30485. */
  30486. burstPipelineAnalyst(params, callback) {
  30487. params = this._processParams(params);
  30488. this._networkAnalystService.burstPipelineAnalyst(params, callback);
  30489. }
  30490. /**
  30491. * @function NetworkAnalystService.prototype.computeWeightMatrix
  30492. * @description 耗费矩阵分析服务:根据交通网络分析参数中的耗费字段返回一个耗费矩阵。该矩阵是一个二维数组,用来存储任意两点间的资源消耗。
  30493. * @param {ComputeWeightMatrixParameters} params - 耗费矩阵分析服务参数类。
  30494. * @param {RequestCallback} callback - 回调函数。
  30495. */
  30496. computeWeightMatrix(params, callback) {
  30497. params = this._processParams(params);
  30498. this._networkAnalystService.computeWeightMatrix(params, callback);
  30499. }
  30500. /**
  30501. * @function NetworkAnalystService.prototype.findClosestFacilities
  30502. * @description 最近设施分析服务:指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  30503. * @param {FindClosestFacilitiesParameters} params - 最近设施分析服务参数类。
  30504. * @param {RequestCallback} callback 回调函数。
  30505. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  30506. */
  30507. findClosestFacilities(params, callback, resultFormat) {
  30508. params = this._processParams(params);
  30509. this._networkAnalystService.findClosestFacilities(params, callback, resultFormat);
  30510. }
  30511. /**
  30512. * @function NetworkAnalystService.prototype.streamFacilityAnalyst
  30513. * @description 上游/下游 关键设施查找资源服务:查找给定弧段或节点的上游/下游中的关键设施结点,返回关键结点 ID 数组及其下游弧段 ID 数组。
  30514. * @param {FacilityAnalystStreamParameters} params - 上游/下游 关键设施查找资源服务参数类。
  30515. * @param {RequestCallback} callback 回调函数。
  30516. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  30517. */
  30518. streamFacilityAnalyst(params, callback, resultFormat) {
  30519. params = this._processParams(params);
  30520. this._networkAnalystService.streamFacilityAnalyst(params, callback, resultFormat);
  30521. }
  30522. /**
  30523. * @function NetworkAnalystService.prototype.findLocation
  30524. * @description 选址分区分析服务:确定一个或多个待建设施的最佳或最优位置。
  30525. * @param {FindLocationParameters} params - 选址分区分析服务参数类。
  30526. * @param {RequestCallback} callback 回调函数。
  30527. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  30528. */
  30529. findLocation(params, callback, resultFormat) {
  30530. params = this._processParams(params);
  30531. this._networkAnalystService.findLocation(params, callback, resultFormat);
  30532. }
  30533. /**
  30534. * @function NetworkAnalystService.prototype.findPath
  30535. * @description 最佳路径分析服务:在网络数据集中指定一些节点,按照节点的选择顺序,顺序访问这些节点从而求解起止点之间阻抗最小的路经。
  30536. * @param {FindPathParameters} params - 最佳路径分析服务参数类。
  30537. * @param {RequestCallback} callback - 回调函数。
  30538. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  30539. */
  30540. findPath(params, callback, resultFormat) {
  30541. params = this._processParams(params);
  30542. this._networkAnalystService.findPath(params, callback, resultFormat);
  30543. }
  30544. /**
  30545. * @function NetworkAnalystService.prototype.findTSPPaths
  30546. * @description 旅行商分析服务:路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。
  30547. * @param {FindTSPPathsParameters} params - 旅行商分析服务参数类。
  30548. * @param {RequestCallback} callback - 回调函数。
  30549. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  30550. */
  30551. findTSPPaths(params, callback, resultFormat) {
  30552. params = this._processParams(params);
  30553. this._networkAnalystService.findTSPPaths(params, callback, resultFormat);
  30554. }
  30555. /**
  30556. * @function NetworkAnalystService.prototype.findMTSPPaths
  30557. * @description 多旅行商分析服务:也称为物流配送,是指在网络数据集中,给定 M 个配送中心点和 N 个配送目的地(M,N 为大于零的整数)。查找经济有效的配送路径,并给出相应的行走路线。
  30558. * @param {FindMTSPPathsParameters} params - 多旅行商分析服务参数类。
  30559. * @param {RequestCallback} callback - 回调函数。
  30560. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  30561. */
  30562. findMTSPPaths(params, callback, resultFormat) {
  30563. params = this._processParams(params);
  30564. this._networkAnalystService.findMTSPPaths(params, callback, resultFormat);
  30565. }
  30566. /**
  30567. * @function NetworkAnalystService.prototype.findServiceAreas
  30568. * @description 服务区分析服务:以指定服务站点为中心,在一定服务范围内查找网络上服务站点能够提供服务的区域范围。
  30569. * @param {FindServiceAreasParameters} params - 服务区分析服务参数类。
  30570. * @param {RequestCallback} callback 回调函数。
  30571. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  30572. */
  30573. findServiceAreas(params, callback, resultFormat) {
  30574. params = this._processParams(params);
  30575. this._networkAnalystService.findServiceAreas(params, callback, resultFormat);
  30576. }
  30577. /**
  30578. * @function NetworkAnalystService.prototype.updateEdgeWeight
  30579. * @description 更新边的耗费权重服务。
  30580. * @param {UpdateEdgeWeightParameters} params - 更新边的耗费权重服务参数类。
  30581. * @param {RequestCallback} callback 回调函数。
  30582. */
  30583. updateEdgeWeight(params, callback) {
  30584. this._networkAnalystService.updateEdgeWeight(params, callback);
  30585. }
  30586. /**
  30587. * @function NetworkAnalystService.prototype.updateTurnNodeWeight
  30588. * @description 转向耗费权重更新服务。
  30589. * @param {UpdateTurnNodeWeightParameters} params - 转向耗费权重更新服务参数类。
  30590. * @param {RequestCallback} callback - 回调函数。
  30591. */
  30592. updateTurnNodeWeight(params, callback) {
  30593. this._networkAnalystService.updateTurnNodeWeight(params, callback);
  30594. }
  30595. /**
  30596. * @description 所有 Point 考虑 MapLibreGL.lnglat、MapLibreGL.Point、[]三种形式。
  30597. * @param {Object} params - 待转换参数。
  30598. * @returns {Object}
  30599. * @private
  30600. */
  30601. _processParams(params) {
  30602. if (!params) {
  30603. return {};
  30604. }
  30605. var me = this;
  30606. if (params.centers && core_Util_Util.isArray(params.centers)) {
  30607. params.centers.map(function (point, key) {
  30608. params.centers[key] = me._toPointObject(point);
  30609. return params.centers[key];
  30610. });
  30611. }
  30612. if (params.nodes && core_Util_Util.isArray(params.nodes)) {
  30613. params.nodes.map(function (point, key) {
  30614. params.nodes[key] = me._toPointObject(point);
  30615. return params.nodes[key];
  30616. });
  30617. }
  30618. if (params.event) {
  30619. params.event = me._toPointObject(params.event);
  30620. }
  30621. if (params.facilities && core_Util_Util.isArray(params.facilities)) {
  30622. params.facilities.map(function (point, key) {
  30623. params.facilities[key] = me._toPointObject(point);
  30624. return params.facilities[key];
  30625. });
  30626. }
  30627. if (params.parameter && params.parameter.barrierPoints) {
  30628. var barrierPoints = params.parameter.barrierPoints;
  30629. if (core_Util_Util.isArray(barrierPoints)) {
  30630. barrierPoints.map(function (point, key) {
  30631. params.parameter[key] = me._toPointObject(point);
  30632. return params.parameter.barrierPoints[key];
  30633. });
  30634. } else {
  30635. params.parameter.barrierPoints = [(barrierPoints instanceof (external_maplibregl_default()).LngLat) ? {
  30636. x: barrierPoints.lng,
  30637. y: barrierPoints.lat
  30638. } : barrierPoints];
  30639. }
  30640. }
  30641. return params;
  30642. }
  30643. _toPointObject(point) {
  30644. if (core_Util_Util.isArray(point)) {
  30645. return {
  30646. x: point[0],
  30647. y: point[1]
  30648. };
  30649. }
  30650. if (point instanceof (external_maplibregl_default()).LngLat) {
  30651. return {
  30652. x: point.lng,
  30653. y: point.lat
  30654. };
  30655. }
  30656. return (point instanceof (external_maplibregl_default()).Point) ? {
  30657. x: point.x,
  30658. y: point.y
  30659. } : point;
  30660. }
  30661. _processFormat(resultFormat) {
  30662. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  30663. }
  30664. }
  30665. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalyst3DParameters.js
  30666. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30667. * This program are made available under the terms of the Apache License, Version 2.0
  30668. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30669. /**
  30670. * @class FacilityAnalyst3DParameters
  30671. * @deprecatedclass SuperMap.FacilityAnalyst3DParameters
  30672. * @category iServer FacilityAnalyst3D
  30673. * @classdesc 最近设施分析参数基类。最近设施分析是指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  30674. * 设施点一般为学校、超市、加油站等服务设施;事件点为需要服务设施的事件位置。例如事件发生点是一起交通事故,要求查找在 10 分钟内能到达的最近医院,
  30675. * 超过 10 分钟能到达的都不予考虑。此例中,事故发生地即是一个事件点,周边的医院则是设施点。最近设施查找实际上也是一种路径分析,因此对路径分析起作用的障碍边、障碍点、转向表、耗费等属性在最近设施分析时同样可设置。
  30676. * @param {Object} options - 参数。
  30677. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  30678. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  30679. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  30680. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  30681. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  30682. * @usage
  30683. */
  30684. class FacilityAnalyst3DParameters {
  30685. constructor(options) {
  30686. /**
  30687. * @member {number} [FacilityAnalyst3DParameters.prototype.edgeID]
  30688. * @description 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  30689. */
  30690. this.edgeID = null;
  30691. /**
  30692. * @member {number} [FacilityAnalyst3DParameters.prototype.nodeID]
  30693. * @description 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  30694. */
  30695. this.nodeID = null;
  30696. /**
  30697. * @member {string} FacilityAnalyst3DParameters.prototype.weightName
  30698. * @description 指定的权值字段信息对象的名称。
  30699. */
  30700. this.weightName = null;
  30701. /**
  30702. * @member {boolean} [FacilityAnalyst3DParameters.prototype.isUncertainDirectionValid=false]
  30703. * @description 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  30704. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  30705. */
  30706. this.isUncertainDirectionValid = false;
  30707. Util_Util.extend(this, options);
  30708. this.CLASS_NAME = "SuperMap.FacilityAnalyst3DParameters";
  30709. }
  30710. /**
  30711. * @function FacilityAnalyst3DParameters.prototype.destroy
  30712. * @description 释放资源,将资源的属性置空。
  30713. */
  30714. destroy() {
  30715. var me = this;
  30716. me.edgeID = null;
  30717. me.nodeID = null;
  30718. me.weightName = null;
  30719. me.isUncertainDirectionValid = null;
  30720. }
  30721. }
  30722. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSinks3DParameters.js
  30723. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30724. * This program are made available under the terms of the Apache License, Version 2.0
  30725. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30726. /**
  30727. * @class FacilityAnalystSinks3DParameters
  30728. * @deprecatedclass SuperMap.FacilityAnalystSinks3DParameters
  30729. * @category iServer FacilityAnalyst3D Sinks
  30730. * @classdesc 最近设施分析参数类(汇查找资源)。最近设施分析是指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  30731. * 设施点一般为学校、超市、加油站等服务设施;事件点为需要服务设施的事件位置。例如事件发生点是一起交通事故,要求查找在10分钟内能到达的最近医院,超过10分钟能到达的都不予考虑。此例中,事故发生地即是一个事件点,周边的医院则是设施点。最近设施查找实际上也是一种路径分析,因此对路径分析起作用的障碍边、障碍点、转向表、耗费等属性在最近设施分析时同样可设置。
  30732. * @extends {FacilityAnalyst3DParameters}
  30733. * @param {Object} options - 参数。
  30734. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  30735. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  30736. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  30737. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  30738. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  30739. * @usage
  30740. */
  30741. class FacilityAnalystSinks3DParameters extends FacilityAnalyst3DParameters {
  30742. constructor(options) {
  30743. super(options);
  30744. this.CLASS_NAME = "SuperMap.FacilityAnalystSinks3DParameters";
  30745. }
  30746. /**
  30747. * @function FacilityAnalystSinks3DParameters.prototype.destroy
  30748. * @override
  30749. */
  30750. destroy() {
  30751. super.destroy();
  30752. }
  30753. }
  30754. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSinks3DService.js
  30755. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30756. * This program are made available under the terms of the Apache License, Version 2.0
  30757. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30758. /**
  30759. * @class FacilityAnalystSinks3DService
  30760. * @deprecatedclass SuperMap.FacilityAnalystSinks3DService
  30761. * @category iServer FacilityAnalyst3D Sinks
  30762. * @classdesc 最近设施分析服务类(汇查找资源)<br>
  30763. * 最近设施分析是指在网络上给定一个事件点和一组设施点,
  30764. * 查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  30765. * 该类负责将客户端指定的最近设施分析参数传递给服务端,并接收服务端返回的结果数据。
  30766. * 最近设施分析结果通过该类支持的事件的监听函数参数获取
  30767. * @extends {CommonServiceBase}
  30768. * @example
  30769. * var myFacilityAnalystSinks3DService = new FacilityAnalystSinks3DService(url, {
  30770. * eventListeners: {
  30771. * "processCompleted": facilityAnalystSinks3DCompleted,
  30772. * "processFailed": facilityAnalystSinks3DError
  30773. * }
  30774. * });
  30775. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:<br>
  30776. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};<br>
  30777. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。<br>
  30778. * @param {Object} options - 参数。
  30779. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  30780. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30781. * @param {Object} [options.headers] - 请求头。
  30782. * @usage
  30783. */
  30784. class FacilityAnalystSinks3DService extends CommonServiceBase {
  30785. constructor(url, options) {
  30786. super(url, options);
  30787. this.CLASS_NAME = "SuperMap.FacilityAnalystSinks3DService";
  30788. }
  30789. /**
  30790. * @function FacilityAnalystSinks3DService.prototype.destroy
  30791. * @override
  30792. */
  30793. destroy() {
  30794. CommonServiceBase.prototype.destroy.apply(this, arguments);
  30795. }
  30796. /**
  30797. * @function FacilityAnalystSinks3DService.prototype.processAsync
  30798. * @description 负责将客户端的查询参数传递到服务端。
  30799. * @param {FacilityAnalystSinks3DParameters} params - 最近设施分析参数类(汇查找资源)
  30800. */
  30801. processAsync(params) {
  30802. if (!(params instanceof FacilityAnalystSinks3DParameters)) {
  30803. return;
  30804. }
  30805. var me = this, jsonObject;
  30806. me.url = Util_Util.urlPathAppend(me.url, 'sinks');
  30807. jsonObject = {
  30808. edgeID: params.edgeID,
  30809. nodeID: params.nodeID,
  30810. weightName: params.weightName,
  30811. isUncertainDirectionValid: params.isUncertainDirectionValid
  30812. };
  30813. me.request({
  30814. method: "GET",
  30815. params: jsonObject,
  30816. scope: me,
  30817. success: me.serviceProcessCompleted,
  30818. failure: me.serviceProcessFailed
  30819. });
  30820. }
  30821. }
  30822. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSources3DParameters.js
  30823. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30824. * This program are made available under the terms of the Apache License, Version 2.0
  30825. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30826. /**
  30827. * @class FacilityAnalystSources3DParameters
  30828. * @deprecatedclass SuperMap.FacilityAnalystSources3DParameters
  30829. * @category iServer FacilityAnalyst3D Sources
  30830. * @classdesc 最近设施分析参数类(源查找资源)。最近设施分析是指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  30831. * 设施点一般为学校、超市、加油站等服务设施;事件点为需要服务设施的事件位置。例如事件发生点是一起交通事故,要求查找在10分钟内能到达的最近医院,超过10分钟能到达的都不予考虑。此例中,事故发生地即是一个事件点,周边的医院则是设施点。最近设施查找实际上也是一种路径分析,因此对路径分析起作用的障碍边、障碍点、转向表、耗费等属性在最近设施分析时同样可设置。
  30832. * @extends {FacilityAnalyst3DParameters}
  30833. * @param {Object} options - 参数。
  30834. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  30835. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  30836. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  30837. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  30838. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  30839. * @usage
  30840. */
  30841. class FacilityAnalystSources3DParameters extends FacilityAnalyst3DParameters {
  30842. constructor(options) {
  30843. super(options);
  30844. this.CLASS_NAME = "SuperMap.FacilityAnalystSources3DParameters";
  30845. }
  30846. /**
  30847. * @function FacilityAnalystSources3DParameters.prototype.destroy
  30848. * @override
  30849. */
  30850. destroy() {
  30851. super.destroy();
  30852. }
  30853. }
  30854. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSources3DService.js
  30855. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30856. * This program are made available under the terms of the Apache License, Version 2.0
  30857. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30858. /**
  30859. * @class FacilityAnalystSources3DService
  30860. * @deprecatedclass SuperMap.FacilityAnalystSources3DService
  30861. * @category iServer FacilityAnalyst3D Sources
  30862. * @classdesc 最近设施分析服务类(源查找资源)
  30863. * 最近设施分析是指在网络上给定一个事件点和一组设施点,
  30864. * 查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  30865. * 该类负责将客户端指定的最近设施分析参数传递给服务端,并接收服务端返回的结果数据。
  30866. * 最近设施分析结果通过该类支持的事件的监听函数参数获取。
  30867. * @extends {CommonServiceBase}
  30868. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  30869. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  30870. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  30871. * @param {Object} options - 参数。
  30872. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  30873. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30874. * @param {Object} [options.headers] - 请求头。
  30875. * @usage
  30876. */
  30877. class FacilityAnalystSources3DService extends CommonServiceBase {
  30878. constructor(url, options) {
  30879. super(url, options);
  30880. this.CLASS_NAME = "SuperMap.FacilityAnalystSources3DService";
  30881. }
  30882. /**
  30883. * @function FacilityAnalystSources3DService.prototype.destroy
  30884. * @override
  30885. */
  30886. destroy() {
  30887. super.destroy();
  30888. }
  30889. /**
  30890. * @function FacilityAnalystSources3DService.prototype.processAsync
  30891. * @description 负责将客户端的查询参数传递到服务端。
  30892. * @param {FacilityAnalystSources3DParameters} params - 最近设施分析参数类(源查找资源)
  30893. */
  30894. processAsync(params) {
  30895. if (!(params instanceof FacilityAnalystSources3DParameters)) {
  30896. return;
  30897. }
  30898. var me = this, jsonObject;
  30899. me.url = Util_Util.urlPathAppend(me.url, 'sources');
  30900. jsonObject = {
  30901. edgeID: params.edgeID,
  30902. nodeID: params.nodeID,
  30903. weightName: params.weightName,
  30904. isUncertainDirectionValid: params.isUncertainDirectionValid
  30905. };
  30906. me.request({
  30907. method: "GET",
  30908. params: jsonObject,
  30909. scope: me,
  30910. success: me.serviceProcessCompleted,
  30911. failure: me.serviceProcessFailed
  30912. });
  30913. }
  30914. }
  30915. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTraceup3DParameters.js
  30916. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30917. * This program are made available under the terms of the Apache License, Version 2.0
  30918. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30919. /**
  30920. * @class FacilityAnalystTraceup3DParameters
  30921. * @deprecatedclass SuperMap.FacilityAnalystTraceup3DParameters
  30922. * @category iServer FacilityAnalyst3D TraceUpResult
  30923. * @classdesc 上游追踪资源参数类。
  30924. * @extends {FacilityAnalyst3DParameters}
  30925. * @param {Object} options - 参数。
  30926. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  30927. * @param {number} [options.edgeID] - 指定的弧段ID,edgeID 与 nodeID 必须指定一个。
  30928. * @param {number} [options.nodeID] - 指定的结点ID,edgeID 与 nodeID 必须指定一个。
  30929. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  30930. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  30931. * @usage
  30932. */
  30933. class FacilityAnalystTraceup3DParameters extends FacilityAnalyst3DParameters {
  30934. constructor(options) {
  30935. super(options);
  30936. this.CLASS_NAME = "SuperMap.FacilityAnalystTraceup3DParameters";
  30937. }
  30938. /**
  30939. * @function FacilityAnalystTraceup3DParameters.prototype.destroy
  30940. * @override
  30941. */
  30942. destroy() {
  30943. super.destroy();
  30944. }
  30945. }
  30946. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTraceup3DService.js
  30947. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  30948. * This program are made available under the terms of the Apache License, Version 2.0
  30949. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30950. /**
  30951. * @class FacilityAnalystTraceup3DService
  30952. * @deprecatedclass SuperMap.FacilityAnalystTraceup3DService
  30953. * @category iServer FacilityAnalyst3D TraceUpResult
  30954. * @classdesc 上游追踪资源服务类
  30955. * @extends {CommonServiceBase}
  30956. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  30957. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  30958. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  30959. * @param {Object} options - 参数。
  30960. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  30961. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30962. * @param {Object} [options.headers] - 请求头。
  30963. * @usage
  30964. */
  30965. class FacilityAnalystTraceup3DService extends CommonServiceBase {
  30966. constructor(url, options) {
  30967. super(url, options);
  30968. this.CLASS_NAME = "SuperMap.FacilityAnalystTraceup3DService";
  30969. }
  30970. /**
  30971. * @function FacilityAnalystTraceup3DService.prototype.destroy
  30972. * @override
  30973. */
  30974. destroy() {
  30975. super.destroy();
  30976. }
  30977. /**
  30978. * @function FacilityAnalystTraceup3DService.prototype.processAsync
  30979. * @description 负责将客户端的查询参数传递到服务端。
  30980. * @param {FacilityAnalystTraceup3DParameters} params - 上游追踪资源参数类
  30981. */
  30982. processAsync(params) {
  30983. if (!(params instanceof FacilityAnalystTraceup3DParameters)) {
  30984. return;
  30985. }
  30986. var me = this, jsonObject;
  30987. me.url = Util_Util.urlPathAppend(me.url, 'traceupresult');
  30988. jsonObject = {
  30989. edgeID: params.edgeID,
  30990. nodeID: params.nodeID,
  30991. weightName: params.weightName,
  30992. isUncertainDirectionValid: params.isUncertainDirectionValid
  30993. };
  30994. me.request({
  30995. method: "GET",
  30996. params: jsonObject,
  30997. scope: me,
  30998. success: me.serviceProcessCompleted,
  30999. failure: me.serviceProcessFailed
  31000. });
  31001. }
  31002. }
  31003. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTracedown3DParameters.js
  31004. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31005. * This program are made available under the terms of the Apache License, Version 2.0
  31006. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31007. /**
  31008. * @class FacilityAnalystTracedown3DParameters
  31009. * @deprecatedclass SuperMap.FacilityAnalystTracedown3DParameters
  31010. * @category iServer FacilityAnalyst3D TraceDownResult
  31011. * @classdesc 下游追踪资源参数类。
  31012. * @extends {FacilityAnalyst3DParameters}
  31013. * @param {Object} options - 参数。
  31014. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  31015. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  31016. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  31017. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  31018. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  31019. * @usage
  31020. */
  31021. class FacilityAnalystTracedown3DParameters extends FacilityAnalyst3DParameters {
  31022. constructor(options) {
  31023. super(options);
  31024. this.CLASS_NAME = "SuperMap.FacilityAnalystTracedown3DParameters";
  31025. }
  31026. /**
  31027. * @function FacilityAnalystTracedown3DParameters.prototype.destroy
  31028. * @override
  31029. */
  31030. destroy() {
  31031. super.destroy();
  31032. }
  31033. }
  31034. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTracedown3DService.js
  31035. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31036. * This program are made available under the terms of the Apache License, Version 2.0
  31037. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31038. /**
  31039. * @class FacilityAnalystTracedown3DService
  31040. * @deprecatedclass SuperMap.FacilityAnalystTracedown3DService
  31041. * @category iServer FacilityAnalyst3D TraceDownResult
  31042. * @classdesc 下游追踪资源服务类
  31043. * @extends {CommonServiceBase}
  31044. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  31045. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  31046. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  31047. * @param {Object} options - 参数。
  31048. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  31049. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31050. * @param {Object} [options.headers] - 请求头。
  31051. * @usage
  31052. */
  31053. class FacilityAnalystTracedown3DService extends CommonServiceBase {
  31054. constructor(url, options) {
  31055. super(url, options);
  31056. this.CLASS_NAME = "SuperMap.FacilityAnalystTracedown3DService";
  31057. }
  31058. /**
  31059. * @function FacilityAnalystTracedown3DService.prototype.destroy
  31060. * @override
  31061. */
  31062. destroy() {
  31063. super.destroy();
  31064. }
  31065. /**
  31066. * @function FacilityAnalystTracedown3DService.prototype.processAsync
  31067. * @description 负责将客户端的查询参数传递到服务端。
  31068. * @param {FacilityAnalystTracedown3DParameters} params - 下游追踪资源参数类。
  31069. */
  31070. processAsync(params) {
  31071. if (!(params instanceof FacilityAnalystTracedown3DParameters)) {
  31072. return;
  31073. }
  31074. var me = this, jsonObject;
  31075. me.url = Util_Util.urlPathAppend(me.url, 'tracedownresult');
  31076. jsonObject = {
  31077. edgeID: params.edgeID,
  31078. nodeID: params.nodeID,
  31079. weightName: params.weightName,
  31080. isUncertainDirectionValid: params.isUncertainDirectionValid
  31081. };
  31082. me.request({
  31083. method: "GET",
  31084. params: jsonObject,
  31085. scope: me,
  31086. success: me.serviceProcessCompleted,
  31087. failure: me.serviceProcessFailed
  31088. });
  31089. }
  31090. }
  31091. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystUpstream3DParameters.js
  31092. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31093. * This program are made available under the terms of the Apache License, Version 2.0
  31094. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31095. /**
  31096. * @class FacilityAnalystUpstream3DParameters
  31097. * @deprecatedclass SuperMap.FacilityAnalystUpstream3DParameters
  31098. * @category iServer FacilityAnalyst3D UpstreamCirticalFaclilities
  31099. * @classdesc 上游关键设施查找资源参数类。
  31100. * @extends {FacilityAnalyst3DParameters}
  31101. * @param {Object} options - 参数。
  31102. * @param {Array.<number>} options.sourceNodeIDs - 指定的设施点 ID 数组。
  31103. * @param {number} [options.edgeID] - 指定的弧段ID。edgeID 与 nodeID 必须指定一个。
  31104. * @param {number} [options.nodeID] - 指定的结点ID。edgeID 与 edgeID 必须指定一个。
  31105. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  31106. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  31107. * @usage
  31108. */
  31109. class FacilityAnalystUpstream3DParameters extends FacilityAnalyst3DParameters {
  31110. constructor(options) {
  31111. super(options);
  31112. options = options || {};
  31113. this.sourceNodeIDs = null;
  31114. Util_Util.extend(this, options);
  31115. this.CLASS_NAME = "SuperMap.FacilityAnalystUpstream3DParameters";
  31116. }
  31117. /**
  31118. * @function FacilityAnalystUpstream3DParameters.prototype.destroy
  31119. * @override
  31120. */
  31121. destroy() {
  31122. super.destroy();
  31123. this.sourceNodeIDs = null;
  31124. }
  31125. }
  31126. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystUpstream3DService.js
  31127. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31128. * This program are made available under the terms of the Apache License, Version 2.0
  31129. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31130. /**
  31131. * @class FacilityAnalystUpstream3DService
  31132. * @deprecatedclass SuperMap.FacilityAnalystUpstream3DService
  31133. * @category iServer FacilityAnalyst3D UpstreamCirticalFaclilities
  31134. * @classdesc 上游关键设施查找资源服务类
  31135. * @extends {CommonServiceBase}
  31136. * @param {string} url - 服务地址。请求网络分析服务,URL应为:
  31137. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  31138. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  31139. * @param {Object} options - 参数。
  31140. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  31141. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31142. * @param {Object} [options.headers] - 请求头。
  31143. * @usage
  31144. */
  31145. class FacilityAnalystUpstream3DService extends CommonServiceBase {
  31146. constructor(url, options) {
  31147. super(url, options);
  31148. this.CLASS_NAME = "SuperMap.FacilityAnalystUpstream3DService";
  31149. }
  31150. /**
  31151. * @function FacilityAnalystUpstream3DService.prototype.destroy
  31152. * @override
  31153. */
  31154. destroy() {
  31155. super.destroy();
  31156. }
  31157. /**
  31158. * @function FacilityAnalystUpstream3DService.prototype.processAsync
  31159. * @description 负责将客户端的查询参数传递到服务端。
  31160. * @param {FacilityAnalystUpstream3DParameters} params - 上游关键设施查找资源参数类
  31161. */
  31162. processAsync(params) {
  31163. if (!(params instanceof FacilityAnalystUpstream3DParameters)) {
  31164. return;
  31165. }
  31166. var me = this, jsonObject;
  31167. me.url = Util_Util.urlPathAppend(me.url, 'upstreamcirticalfaclilities');
  31168. jsonObject = {
  31169. sourceNodeIDs: params.sourceNodeIDs,
  31170. edgeID: params.edgeID,
  31171. nodeID: params.nodeID,
  31172. isUncertainDirectionValid: params.isUncertainDirectionValid
  31173. };
  31174. me.request({
  31175. method: "GET",
  31176. params: jsonObject,
  31177. scope: me,
  31178. success: me.serviceProcessCompleted,
  31179. failure: me.serviceProcessFailed
  31180. });
  31181. }
  31182. }
  31183. ;// CONCATENATED MODULE: ./src/common/iServer/NetworkAnalyst3DService.js
  31184. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31185. * This program are made available under the terms of the Apache License, Version 2.0
  31186. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31187. /**
  31188. * @class NetworkAnalyst3DService
  31189. * @category iServer FacilityAnalyst3D
  31190. * @classdesc 3D 网络分析服务类。
  31191. * @extends {ServiceBase}
  31192. * @example
  31193. * new NetworkAnalyst3DService(url).sinksFacilityAnalyst(params,function(result){
  31194. * //doSomething
  31195. * })
  31196. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL 应为:
  31197. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  31198. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  31199. * @param {Object} options - 参数。
  31200. * @param {string} [options.proxy] - 服务代理地址。
  31201. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  31202. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31203. * @param {Object} [options.headers] - 请求头。
  31204. * @usage
  31205. */
  31206. class NetworkAnalyst3DService_NetworkAnalyst3DService {
  31207. constructor(url, options) {
  31208. this.url = url;
  31209. this.options = options || {};
  31210. }
  31211. /**
  31212. * @function NetworkAnalyst3DService.prototype.sinksFacilityAnalyst
  31213. * @description 汇查找服务
  31214. * @param {FacilityAnalystSinks3DParameters} params- 最近设施分析参数类(汇查找资源)。
  31215. * @param {RequestCallback} callback - 回调函数。
  31216. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  31217. */
  31218. sinksFacilityAnalyst(params, callback) {
  31219. var me = this;
  31220. var facilityAnalystSinks3DService = new FacilityAnalystSinks3DService(me.url, {
  31221. proxy: me.options.proxy,
  31222. withCredentials: me.options.withCredentials,
  31223. crossOrigin: me.options.crossOrigin,
  31224. headers: me.options.headers,
  31225. eventListeners: {
  31226. scope: me,
  31227. processCompleted: callback,
  31228. processFailed: callback
  31229. }
  31230. });
  31231. facilityAnalystSinks3DService.processAsync(params);
  31232. }
  31233. /**
  31234. * @function NetworkAnalyst3DService.prototype.sourcesFacilityAnalyst
  31235. * @description 源查找服务。
  31236. * @param {FacilityAnalystSources3DParameters} params - 最近设施分析参数类(源查找服务)。
  31237. * @param {RequestCallback} callback - 回调函数。
  31238. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  31239. */
  31240. sourcesFacilityAnalyst(params, callback) {
  31241. var me = this;
  31242. var facilityAnalystSources3DService = new FacilityAnalystSources3DService(me.url, {
  31243. proxy: me.options.proxy,
  31244. withCredentials: me.options.withCredentials,
  31245. crossOrigin: me.options.crossOrigin,
  31246. headers: me.options.headers,
  31247. eventListeners: {
  31248. scope: me,
  31249. processCompleted: callback,
  31250. processFailed: callback
  31251. }
  31252. });
  31253. facilityAnalystSources3DService.processAsync(params);
  31254. }
  31255. /**
  31256. * @function NetworkAnalyst3DService.prototype.traceUpFacilityAnalyst
  31257. * @description 上游追踪资源服务。
  31258. * @param {FacilityAnalystTraceup3DParameters} params - 上游追踪资源参数类。
  31259. * @param {RequestCallback} callback - 回调函数。
  31260. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  31261. */
  31262. traceUpFacilityAnalyst(params, callback) {
  31263. var me = this;
  31264. var facilityAnalystTraceup3DService = new FacilityAnalystTraceup3DService(me.url, {
  31265. proxy: me.options.proxy,
  31266. withCredentials: me.options.withCredentials,
  31267. crossOrigin: me.options.crossOrigin,
  31268. headers: me.options.headers,
  31269. eventListeners: {
  31270. scope: me,
  31271. processCompleted: callback,
  31272. processFailed: callback
  31273. }
  31274. });
  31275. facilityAnalystTraceup3DService.processAsync(params);
  31276. }
  31277. /**
  31278. * @function NetworkAnalyst3DService.prototype.traceDownFacilityAnalyst
  31279. * @description 下游追踪资源服务。
  31280. * @param {FacilityAnalystTracedown3DParameters} params - 下游追踪资源服务参数类。
  31281. * @param {RequestCallback} callback - 回调函数。
  31282. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  31283. */
  31284. traceDownFacilityAnalyst(params, callback) {
  31285. var me = this;
  31286. var facilityAnalystTracedown3DService = new FacilityAnalystTracedown3DService(me.url, {
  31287. proxy: me.options.proxy,
  31288. withCredentials: me.options.withCredentials,
  31289. crossOrigin: me.options.crossOrigin,
  31290. headers: me.options.headers,
  31291. eventListeners: {
  31292. scope: me,
  31293. processCompleted: callback,
  31294. processFailed: callback
  31295. }
  31296. });
  31297. facilityAnalystTracedown3DService.processAsync(params);
  31298. }
  31299. /**
  31300. * @function NetworkAnalyst3DService.prototype.upstreamFacilityAnalyst
  31301. * @description 上游关键设施查找服务。
  31302. * @param {FacilityAnalystUpstream3DParameters} params - 上游关键设施查找服务参数类。
  31303. * @param {RequestCallback} callback - 回调函数。
  31304. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  31305. */
  31306. upstreamFacilityAnalyst(params, callback) {
  31307. var me = this;
  31308. var facilityAnalystUpstream3DService = new FacilityAnalystUpstream3DService(me.url, {
  31309. proxy: me.options.proxy,
  31310. withCredentials: me.options.withCredentials,
  31311. crossOrigin: me.options.crossOrigin,
  31312. headers: me.options.headers,
  31313. eventListeners: {
  31314. scope: me,
  31315. processCompleted: callback,
  31316. processFailed: callback
  31317. }
  31318. });
  31319. facilityAnalystUpstream3DService.processAsync(params);
  31320. }
  31321. }
  31322. ;// CONCATENATED MODULE: ./src/maplibregl/services/NetworkAnalyst3DService.js
  31323. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31324. * This program are made available under the terms of the Apache License, Version 2.0
  31325. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31326. /**
  31327. * @class NetworkAnalyst3DService
  31328. * @category iServer FacilityAnalyst3D
  31329. * @classdesc 3D 网络分析服务类。
  31330. * @version 11.1.0
  31331. * @modulecategory Services
  31332. * @extends {ServiceBase}
  31333. * @example
  31334. * new NetworkAnalyst3DService(url)
  31335. * .sinksFacilityAnalyst(params,function(result){
  31336. * //doSomething
  31337. * })
  31338. * @param {string} url - 服务地址。请求网络分析服务,URL应为:</br>
  31339. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源}。
  31340. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  31341. * @param {Object} options - 参数。
  31342. * @param {string} [options.proxy] - 服务代理地址。
  31343. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  31344. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31345. * @param {Object} [options.headers] - 请求头。
  31346. * @usage
  31347. */
  31348. class NetworkAnalyst3DService extends ServiceBase {
  31349. constructor(url, options) {
  31350. super(url, options);
  31351. this._networkAnalyst3DService = new NetworkAnalyst3DService_NetworkAnalyst3DService(url, options);
  31352. }
  31353. /**
  31354. * @function NetworkAnalyst3DService.prototype.sinksFacilityAnalyst
  31355. * @description 汇查找服务。
  31356. * @param {FacilityAnalystSinks3DParameters} params - 最近设施分析参数类(汇查找资源)。
  31357. * @param {RequestCallback} callback - 回调函数。
  31358. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  31359. */
  31360. sinksFacilityAnalyst(params, callback) {
  31361. this._networkAnalyst3DService.sinksFacilityAnalyst(params, callback);
  31362. }
  31363. /**
  31364. * @function NetworkAnalyst3DService.prototype.sourcesFacilityAnalyst
  31365. * @description 源查找服务。
  31366. * @param {FacilityAnalystSources3DParameters} params - 最近设施分析参数类(源查找服务)。
  31367. * @param {RequestCallback} callback - 回调函数。
  31368. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  31369. */
  31370. sourcesFacilityAnalyst(params, callback) {
  31371. this._networkAnalyst3DService.sourcesFacilityAnalyst(params, callback);
  31372. }
  31373. /**
  31374. * @function NetworkAnalyst3DService.prototype.traceUpFacilityAnalyst
  31375. * @description 上游追踪资源服务。
  31376. * @param {FacilityAnalystTraceup3DParameters} params - 上游追踪资源参数类。
  31377. * @param {RequestCallback} callback 回调函数。
  31378. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  31379. */
  31380. traceUpFacilityAnalyst(params, callback) {
  31381. this._networkAnalyst3DService.traceUpFacilityAnalyst(params, callback);
  31382. }
  31383. /**
  31384. * @function NetworkAnalyst3DService.prototype.traceDownFacilityAnalyst
  31385. * @description 下游追踪资源服务。
  31386. * @param {FacilityAnalystTracedown3DParameters} params - 下游追踪资源服务参数类。
  31387. * @param {RequestCallback} callback 回调函数。
  31388. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  31389. */
  31390. traceDownFacilityAnalyst(params, callback) {
  31391. this._networkAnalyst3DService.traceDownFacilityAnalyst(params, callback);
  31392. }
  31393. /**
  31394. * @function NetworkAnalyst3DService.prototype.upstreamFacilityAnalyst
  31395. * @description 上游关键设施查找服务。
  31396. * @param {FacilityAnalystUpstream3DParameters} params - 上游关键设施查找服务参数类。
  31397. * @param {RequestCallback} callback 回调函数。
  31398. * @returns {NetworkAnalyst3DService} 3D 网络分析服务。
  31399. */
  31400. upstreamFacilityAnalyst(params, callback) {
  31401. this._networkAnalyst3DService.upstreamFacilityAnalyst(params, callback);
  31402. }
  31403. }
  31404. ;// CONCATENATED MODULE: ./src/common/iServer/ProcessingServiceBase.js
  31405. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31406. * This program are made available under the terms of the Apache License, Version 2.0
  31407. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31408. /**
  31409. * @class ProcessingServiceBase
  31410. * @deprecatedclass SuperMap.ProcessingServiceBase
  31411. * @category iServer Core
  31412. * @classdesc 分布式分析服务基类
  31413. * @extends {CommonServiceBase}
  31414. * @param {string} url - 服务地址。
  31415. * @param {Object} options - 参数。
  31416. * @param {Events} options.events - 处理所有事件的对象。
  31417. * @param {number} options.index - 服务访问地址在数组中的位置。
  31418. * @param {number} options.length - 服务访问地址数组长度。
  31419. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  31420. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31421. * @param {Object} [options.headers] - 请求头。
  31422. * @usage
  31423. */
  31424. class ProcessingServiceBase extends CommonServiceBase {
  31425. constructor(url, options) {
  31426. options = options || {};
  31427. /*
  31428. * Constant: EVENT_TYPES
  31429. * {Array.<string>}
  31430. * 此类支持的事件类型
  31431. * - *processCompleted* 创建成功后触发的事件。
  31432. * - *processFailed* 创建失败后触发的事件 。
  31433. * - *processRunning* 创建过程的整个阶段都会触发的事件,用于获取创建过程的状态 。
  31434. */
  31435. options.EVENT_TYPES = ["processCompleted", "processFailed", "processRunning"];
  31436. super(url, options);
  31437. this.CLASS_NAME = "SuperMap.ProcessingServiceBase";
  31438. }
  31439. /**
  31440. * @function ProcessingServiceBase.prototype.destroy
  31441. * @override
  31442. */
  31443. destroy() {
  31444. super.destroy();
  31445. }
  31446. /**
  31447. * @function ProcessingServiceBase.prototype.getJobs
  31448. * @description 获取分布式分析任务。
  31449. * @param {string} url - 资源地址。
  31450. */
  31451. getJobs(url) {
  31452. var me = this;
  31453. FetchRequest.get(SecurityManager.appendCredential(url), null, {
  31454. proxy: me.proxy
  31455. }).then(function (response) {
  31456. return response.json();
  31457. }).then(function (result) {
  31458. me.events.triggerEvent("processCompleted", {
  31459. result: result
  31460. });
  31461. }).catch(function (e) {
  31462. me.eventListeners.processFailed({
  31463. error: e
  31464. });
  31465. });
  31466. }
  31467. /**
  31468. * @function ProcessingServiceBase.prototype.addJob
  31469. * @description 添加分布式分析任务。
  31470. * @param {string} url - 资源根地址。
  31471. * @param {Object} params - 创建一个空间分析的请求参数。
  31472. * @param {string} paramType - 请求参数类型。
  31473. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  31474. */
  31475. addJob(url, params, paramType, seconds) {
  31476. var me = this,
  31477. parameterObject = null;
  31478. if (params && params instanceof paramType) {
  31479. parameterObject = new Object();
  31480. paramType.toObject(params, parameterObject);
  31481. }
  31482. let headers = Object.assign({
  31483. 'Content-Type': 'application/x-www-form-urlencoded'
  31484. }, me.headers || {})
  31485. var options = {
  31486. proxy: me.proxy,
  31487. headers,
  31488. withCredentials: me.withCredentials,
  31489. crossOrigin: me.crossOrigin,
  31490. isInTheSameDomain: me.isInTheSameDomain
  31491. };
  31492. FetchRequest.post(SecurityManager.appendCredential(url), JSON.stringify(parameterObject), options).then(function (response) {
  31493. return response.json();
  31494. }).then(function (result) {
  31495. if (result.succeed) {
  31496. me.serviceProcessCompleted(result, seconds);
  31497. } else {
  31498. me.serviceProcessFailed(result);
  31499. }
  31500. }).catch(function (e) {
  31501. me.serviceProcessFailed({
  31502. error: e
  31503. });
  31504. });
  31505. }
  31506. serviceProcessCompleted(result, seconds) {
  31507. result = Util_Util.transformResult(result);
  31508. seconds = seconds || 1000;
  31509. var me = this;
  31510. if (result) {
  31511. var id = setInterval(function () {
  31512. FetchRequest.get(SecurityManager.appendCredential(result.newResourceLocation), {
  31513. _t: new Date().getTime()
  31514. })
  31515. .then(function (response) {
  31516. return response.json();
  31517. }).then(function (job) {
  31518. me.events.triggerEvent("processRunning", {
  31519. id: job.id,
  31520. state: job.state
  31521. });
  31522. if (job.state.runState === 'LOST' || job.state.runState === 'KILLED' || job.state.runState === 'FAILED') {
  31523. clearInterval(id);
  31524. me.events.triggerEvent("processFailed", {
  31525. error: job.state.errorMsg,
  31526. state: job.state.runState
  31527. });
  31528. }
  31529. if (job.state.runState === 'FINISHED' && job.setting.serviceInfo) {
  31530. clearInterval(id);
  31531. me.events.triggerEvent("processCompleted", {
  31532. result: job
  31533. });
  31534. }
  31535. }).catch(function (e) {
  31536. clearInterval(id);
  31537. me.events.triggerEvent("processFailed", {
  31538. error: e
  31539. });
  31540. });
  31541. }, seconds);
  31542. }
  31543. }
  31544. serviceProcessFailed(result) {
  31545. super.serviceProcessFailed(result);
  31546. }
  31547. }
  31548. ;// CONCATENATED MODULE: ./src/common/iServer/DatasourceConnectionInfo.js
  31549. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31550. * This program are made available under the terms of the Apache License, Version 2.0
  31551. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31552. // eslint-disable-line no-unused-vars
  31553. /**
  31554. * @class DatasourceConnectionInfo
  31555. * @deprecatedclass SuperMap.DatasourceConnectionInfo
  31556. * @category iServer Data Datasource
  31557. * @classdesc 数据源连接信息类。该类包括了进行数据源连接的所有信息,如所要连接的服务器名称、数据库名称、用户名以及密码等。
  31558. * 当保存为工作空间时,工作空间中的数据源的连接信息都将存储到工作空间文件中。对于不同类型的数据源,其连接信息有所区别。
  31559. * 所以在使用该类所包含的成员时,请注意该成员所适用的数据源类型。对于从数据源对象中返回的数据连接信息对象,只有 connect 方法可以被修改,
  31560. * 其他内容是不可以被修改的。对于用户创建的数据源连接信息对象,其内容都可以修改。
  31561. * @param {Object} options - 参数。
  31562. * @param {string} options.alias - 数据源别名。
  31563. * @param {string} options.dataBase - 数据源连接的数据库名。
  31564. * @param {boolean} [options.connect] - 数据源是否自动连接数据。
  31565. * @param {string} [options.driver] - 使用 ODBC(Open Database Connectivity,开放数据库互连)的数据库的驱动程序名。
  31566. * @param {EngineType} [options.engineType] - 数据源连接的引擎类型。
  31567. * @param {boolean} [options.exclusive] - 是否以独占方式打开数据源。
  31568. * @param {boolean} [options.OpenLinkTable] - 是否把数据库中的其他非 SuperMap 数据表作为 LinkTable 打开。
  31569. * @param {string} [options.password] - 登录数据源连接的数据库或文件的密码。
  31570. * @param {boolean} [options.readOnly] - 是否以只读方式打开数据源。
  31571. * @param {string} [options.server] - 数据库服务器名或 SDB 文件名。
  31572. * @param {string} [options.user] - 登录数据库的用户名。
  31573. * @usage
  31574. */
  31575. class DatasourceConnectionInfo {
  31576. constructor(options) {
  31577. /**
  31578. * @member {string} DatasourceConnectionInfo.prototype.alias
  31579. * @description 数据源别名。
  31580. */
  31581. this.alias = null;
  31582. /**
  31583. * @member {boolean} [DatasourceConnectionInfo.prototype.connect]
  31584. * @description 数据源是否自动连接数据。
  31585. */
  31586. this.connect = null;
  31587. /**
  31588. * @member {string} DatasourceConnectionInfo.prototype.dataBase
  31589. * @description 数据源连接的数据库名。
  31590. */
  31591. this.dataBase = null;
  31592. /**
  31593. * @member {string} [DatasourceConnectionInfo.prototype.driver]
  31594. * @description 使用 ODBC(Open Database Connectivity,开放数据库互连) 的数据库的驱动程序名。
  31595. * 其中,对于 SQL Server 数据库与 iServer 发布的 WMTS 服务,此为必设参数。
  31596. * 对于 SQL Server 数据库,它使用 ODBC 连接,所设置的驱动程序名为 "SQL Server" 或 "SQL Native Client";
  31597. * 对于 iServer 发布的 WMTS 服务,设置的驱动名称为 "WMTS"。
  31598. */
  31599. this.driver = null;
  31600. /**
  31601. * @member {EngineType} [DatasourceConnectionInfo.prototype.engineType]
  31602. * @description 数据源连接的引擎类型。
  31603. */
  31604. this.engineType = null;
  31605. /**
  31606. * @member {boolean} [DatasourceConnectionInfo.prototype.exclusive]
  31607. * @description 是否以独占方式打开数据源。
  31608. */
  31609. this.exclusive = null;
  31610. /**
  31611. * @member {boolean} [DatasourceConnectionInfo.prototype.OpenLinkTable]
  31612. * @description 是否把数据库中的其他非 SuperMap 数据表作为 LinkTable 打开。
  31613. */
  31614. this.OpenLinkTable = null;
  31615. /**
  31616. * @member {string} [DatasourceConnectionInfo.prototype.password]
  31617. * @description 登录数据源连接的数据库或文件的密码。
  31618. */
  31619. this.password = null;
  31620. /**
  31621. * @member {boolean} [DatasourceConnectionInfo.prototype.readOnly]
  31622. * @description 是否以只读方式打开数据源。
  31623. */
  31624. this.readOnly = null;
  31625. /**
  31626. * @member {string} [DatasourceConnectionInfo.prototype.server]
  31627. * @description 数据库服务器名、文件名或服务地址。
  31628. * 1.对于 SDB 和 UDB 文件,为其文件的绝对路径。注意:当绝对路径的长度超过 UTF-8 编码格式的 260 字节长度,该数据源无法打开。
  31629. * 2.对于 Oracle 数据库,其服务器名为其 TNS 服务名称。
  31630. * 3.对于 SQL Server 数据库,其服务器名为其系统的 DSN(Database Source Name) 名称。
  31631. * 4.对于 PostgreSQL 数据库,其服务器名为 “IP:端口号”,默认的端口号是 5432。
  31632. * 5.对于 DB2 数据库,已经进行了编目,所以不需要进行服务器的设置。
  31633. * 6.对于 Kingbase 数据库,其服务器名为其 IP 地址。
  31634. * 7.对于 GoogleMaps 数据源,其服务器地址,默认设置为 “{@link http://maps.google.com}”,且不可更改。
  31635. * 8.对于 SuperMapCould 数据源,为其服务地址。
  31636. * 9.对于 MAPWORLD 数据源,为其服务地址,默认设置为 “{@link http://www.tianditu.cn}”,且不可更改。
  31637. * 10.对于 OGC 和 REST 数据源,为其服务地址。
  31638. */
  31639. this.server = null;
  31640. /**
  31641. * @member {string} DatasourceConnectionInfo.prototype.user
  31642. * @description 登录数据库的用户名。
  31643. */
  31644. this.user = null;
  31645. if (options) {
  31646. Util_Util.extend(this, options);
  31647. }
  31648. this.CLASS_NAME = "SuperMap.DatasourceConnectionInfo";
  31649. }
  31650. /**
  31651. * @function DatasourceConnectionInfo.prototype.destroy
  31652. * @description 释放资源,将引用资源的属性置空。
  31653. */
  31654. destroy() {
  31655. var me = this;
  31656. me.alias = null;
  31657. me.connect = null;
  31658. me.dataBase = null;
  31659. me.driver = null;
  31660. me.engineType = null;
  31661. me.exclusive = null;
  31662. me.OpenLinkTable = null;
  31663. me.password = null;
  31664. me.readOnly = null;
  31665. me.server = null;
  31666. me.user = null;
  31667. }
  31668. }
  31669. ;// CONCATENATED MODULE: ./src/common/iServer/OutputSetting.js
  31670. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31671. * This program are made available under the terms of the Apache License, Version 2.0
  31672. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31673. /**
  31674. * @class OutputSetting
  31675. * @deprecatedclass SuperMap.OutputSetting
  31676. * @category iServer ProcessingService
  31677. * @classdesc 分布式分析输出类型设置类。
  31678. * @param {Object} options - 参数。
  31679. * @param {DatasourceConnectionInfo} options.datasourceInfo - 数据源连接信息。
  31680. * @param {string} [options.datasetName='analystResult'] - 结果数据集名称。
  31681. * @param {OutputType} [options.type=OutputType.UDB] - 输出类型。
  31682. * @param {string} [options.outputPath] - 分析结果输出路径。
  31683. * @usage
  31684. */
  31685. class OutputSetting {
  31686. constructor(options) {
  31687. /**
  31688. * @member {OutputType} OutputSetting.prototype.type
  31689. * @description 分布式分析的输出类型。
  31690. */
  31691. this.type = OutputType.UDB;
  31692. /**
  31693. * @member {string} [OutputSetting.prototype.datasetName='analystResult']
  31694. * @description 分布式分析的输出结果数据集名称。
  31695. */
  31696. this.datasetName = "analystResult";
  31697. /**
  31698. * @member {DatasourceConnectionInfo} OutputSetting.prototype.datasourceInfo
  31699. * @description 分布式分析的输出结果数据源连接信息。
  31700. */
  31701. this.datasourceInfo = null;
  31702. /**
  31703. * @member {string} [OutputSetting.prototype.outputPath]
  31704. * @description 分布式分析的分析结果输出路径。
  31705. */
  31706. this.outputPath = "";
  31707. Util_Util.extend(this, options);
  31708. this.CLASS_NAME = "SuperMap.OutputSetting";
  31709. }
  31710. /**
  31711. * @function OutputSetting.prototype.destroy
  31712. * @description 释放资源,将引用资源的属性置空。
  31713. */
  31714. destroy() {
  31715. var me = this;
  31716. me.type = null;
  31717. me.datasetName = null;
  31718. me.outputPath = null;
  31719. if (me.datasourceInfo instanceof DatasourceConnectionInfo) {
  31720. me.datasourceInfo.destroy();
  31721. me.datasourceInfo = null;
  31722. }
  31723. }
  31724. }
  31725. ;// CONCATENATED MODULE: ./src/common/iServer/MappingParameters.js
  31726. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31727. * This program are made available under the terms of the Apache License, Version 2.0
  31728. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31729. /**
  31730. * @class MappingParameters
  31731. * @deprecatedclass SuperMap.MappingParameters
  31732. * @category iServer ProcessingService
  31733. * @classdesc 分析后结果可视化的参数类。
  31734. * @param {Object} options - 参数。
  31735. * @param {Array.<ThemeGridRangeItem>} [options.items] - 栅格分段专题图子项数组。
  31736. * @param {number} [options.numericPrecision=1] - 精度,此字段用于设置分析结果标签专题图中标签数值的精度,如“1”表示精确到小数点的后一位。
  31737. * @param {RangeMode} [options.rangeMode=RangeMode.EQUALINTERVAL] - 专题图分段模式。
  31738. * @param {number} [options.rangeCount] - 专题图分段个数。
  31739. * @param {ColorGradientType} [options.colorGradientType=ColorGradientType.YELLOW_RED] - 专题图颜色渐变模式。
  31740. * @usage
  31741. */
  31742. class MappingParameters {
  31743. constructor(options) {
  31744. /**
  31745. * @member {Array.<ThemeGridRangeItem>} [MappingParameters.prototype.items]
  31746. * @description 栅格分段专题图子项数组。
  31747. */
  31748. this.items = null;
  31749. /**
  31750. * @member {number} [MappingParameters.prototype.numericPrecision=1]
  31751. * @description 精度,此字段用于设置分析结果标签专题图中标签数值的精度,如“1”表示精确到小数点的后一位。
  31752. */
  31753. this.numericPrecision = 1;
  31754. /**
  31755. * @member {RangeMode} [MappingParameters.prototype.RangeMode=RangeMode.EQUALINTERVAL]
  31756. * @description 专题图分段模式。
  31757. */
  31758. this.rangeMode = RangeMode.EQUALINTERVAL;
  31759. /**
  31760. * @member {number} [MappingParameters.prototype.rangeCount]
  31761. * @description 专题图分段个数。
  31762. */
  31763. this.rangeCount = "";
  31764. /**
  31765. * @member {ColorGradientType} [MappingParameters.prototype.colorGradientType=ColorGradientType.YELLOW_RED]
  31766. * @description 专题图颜色渐变模式。
  31767. */
  31768. this.colorGradientType = ColorGradientType.YELLOW_RED;
  31769. Util_Util.extend(this, options);
  31770. this.CLASS_NAME = "SuperMap.MappingParameters";
  31771. }
  31772. /**
  31773. * @function MappingParameters.prototype.destroy
  31774. * @description 释放资源,将引用资源的属性置空。
  31775. */
  31776. destroy() {
  31777. var me = this;
  31778. if (me.items) {
  31779. if (me.items.length > 0) {
  31780. for (var item in me.items) {
  31781. me.items[item].destroy();
  31782. me.items[item] = null;
  31783. }
  31784. }
  31785. me.items = null;
  31786. }
  31787. me.numericPrecision = null;
  31788. me.rangeMode = null;
  31789. me.rangeCount = null;
  31790. me.colorGradientType = null;
  31791. }
  31792. }
  31793. ;// CONCATENATED MODULE: ./src/common/iServer/KernelDensityJobParameter.js
  31794. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31795. * This program are made available under the terms of the Apache License, Version 2.0
  31796. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31797. /**
  31798. * @class KernelDensityJobParameter
  31799. * @deprecatedclass SuperMap.KernelDensityJobParameter
  31800. * @category iServer ProcessingService DensityAnalyst
  31801. * @classdesc 核密度分析服务参数类。
  31802. * @param {Object} options - 参数。
  31803. * @param {string} options.datasetName - 数据集名。
  31804. * @param {string} options.fields - 权重索引。
  31805. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} [options.query] - 分析范围(默认为全图范围)。
  31806. * @param {number} [options.resolution=80] - 分辨率。
  31807. * @param {number} [options.method=0] - 分析方法。
  31808. * @param {number} [options.meshType=0] - 分析类型。
  31809. * @param {number} [options.radius=300] - 分析的影响半径。
  31810. * @param {AnalystSizeUnit} [options.meshSizeUnit=AnalystSizeUnit.METER] - 网格大小单位。
  31811. * @param {AnalystSizeUnit} [options.radiusUnit=AnalystSizeUnit.METER] - 搜索半径单位。
  31812. * @param {AnalystAreaUnit} [options.areaUnit=AnalystAreaUnit.SQUAREMILE] - 面积单位。
  31813. * @param {OutputSetting} [options.output] - 输出参数设置。
  31814. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  31815. * @usage
  31816. */
  31817. class KernelDensityJobParameter {
  31818. constructor(options) {
  31819. if (!options) {
  31820. return;
  31821. }
  31822. /**
  31823. * @member {string} KernelDensityJobParameter.prototype.datasetName
  31824. * @description 数据集名。
  31825. */
  31826. this.datasetName = "";
  31827. /**
  31828. * @member {SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject} [KernelDensityJobParameter.prototype.query]
  31829. * @description 分析范围。
  31830. */
  31831. this.query = "";
  31832. /**
  31833. * @member {number} [KernelDensityJobParameter.prototype.resolution=80]
  31834. * @description 网格大小。
  31835. */
  31836. this.resolution = 80;
  31837. /**
  31838. * @member {number} [KernelDensityJobParameter.prototype.method=0]
  31839. * @description 分析方法。
  31840. */
  31841. this.method = 0;
  31842. /**
  31843. * @member {number} [KernelDensityJobParameter.prototype.meshType=0]
  31844. * @description 分析类型。
  31845. */
  31846. this.meshType = 0;
  31847. /**
  31848. * @member {string} KernelDensityJobParameter.prototype.fields
  31849. * @description 权重索引。
  31850. */
  31851. this.fields = "";
  31852. /**
  31853. * @member {number} [KernelDensityJobParameter.prototype.radius=300]
  31854. * @description 分析的影响半径。
  31855. */
  31856. this.radius = 300;
  31857. /**
  31858. * @member {AnalystSizeUnit} [KernelDensityJobParameter.prototype.meshSizeUnit=AnalystSizeUnit.METER]
  31859. * @description 网格大小单位。
  31860. */
  31861. this.meshSizeUnit = AnalystSizeUnit.METER;
  31862. /**
  31863. * @member {AnalystSizeUnit} [KernelDensityJobParameter.prototype.radiusUnit=AnalystSizeUnit.METER]
  31864. * @description 搜索半径单位。
  31865. */
  31866. this.radiusUnit = AnalystSizeUnit.METER;
  31867. /**
  31868. * @member {AnalystAreaUnit} [KernelDensityJobParameter.prototype.areaUnit=AnalystAreaUnit.SQUAREMILE]
  31869. * @description 面积单位。
  31870. */
  31871. this.areaUnit = AnalystAreaUnit.SQUAREMILE;
  31872. /**
  31873. * @member {OutputSetting} KernelDensityJobParameter.prototype.output
  31874. * @description 输出参数设置类。
  31875. */
  31876. this.output = null;
  31877. /**
  31878. * @member {MappingParameters} [KernelDensityJobParameter.prototype.mappingParameters]
  31879. * @description 分析后结果可视化的参数类。
  31880. */
  31881. this.mappingParameters = null;
  31882. Util_Util.extend(this, options);
  31883. this.CLASS_NAME = "SuperMap.KernelDensityJobParameter";
  31884. }
  31885. /**
  31886. * @function KernelDensityJobParameter.prototype.destroy
  31887. * @description 释放资源,将引用资源的属性置空。
  31888. */
  31889. destroy() {
  31890. this.datasetName = null;
  31891. this.query = null;
  31892. this.resolution = null;
  31893. this.method = null;
  31894. this.radius = null;
  31895. this.meshType = null;
  31896. this.fields = null;
  31897. this.meshSizeUnit = null;
  31898. this.radiusUnit = null;
  31899. this.areaUnit = null;
  31900. if (this.output instanceof OutputSetting) {
  31901. this.output.destroy();
  31902. this.output = null;
  31903. }
  31904. if (this.mappingParameters instanceof MappingParameters) {
  31905. this.mappingParameters.destroy();
  31906. this.mappingParameters = null;
  31907. }
  31908. }
  31909. /**
  31910. * @function KernelDensityJobParameter.toObject
  31911. * @param {KernelDensityJobParameter} kernelDensityJobParameter - 核密度分析服务参数类。
  31912. * @param {KernelDensityJobParameter} tempObj - 核密度分析服务参数对象。
  31913. * @description 将核密度分析服务参数对象转换为 JSON 对象。
  31914. * @returns JSON 对象。
  31915. */
  31916. static toObject(kernelDensityJobParameter, tempObj) {
  31917. for (var name in kernelDensityJobParameter) {
  31918. if (name === "datasetName") {
  31919. tempObj['input'] = tempObj['input'] || {};
  31920. tempObj['input'][name] = kernelDensityJobParameter[name];
  31921. continue;
  31922. }
  31923. if (name === "output") {
  31924. tempObj['output'] = tempObj['output'] || {};
  31925. tempObj['output'] = kernelDensityJobParameter[name];
  31926. continue;
  31927. }
  31928. tempObj['analyst'] = tempObj['analyst'] || {};
  31929. if (name === 'query' && kernelDensityJobParameter[name]) {
  31930. tempObj['analyst'][name] = kernelDensityJobParameter[name].toBBOX();
  31931. } else {
  31932. tempObj['analyst'][name] = kernelDensityJobParameter[name];
  31933. }
  31934. if (name === 'mappingParameters') {
  31935. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  31936. tempObj['analyst']['mappingParameters'] = kernelDensityJobParameter[name];
  31937. }
  31938. }
  31939. }
  31940. }
  31941. ;// CONCATENATED MODULE: ./src/common/iServer/KernelDensityJobsService.js
  31942. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31943. * This program are made available under the terms of the Apache License, Version 2.0
  31944. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31945. /**
  31946. * @class KernelDensityJobsService
  31947. * @deprecatedclass SuperMap.KernelDensityJobsService
  31948. * @category iServer ProcessingService DensityAnalyst
  31949. * @classdesc 核密度分析服务类
  31950. * @extends {ProcessingServiceBase}
  31951. * @param {string} url - 服务地址。
  31952. * @param {Object} options - 可选参数。
  31953. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31954. * @param {Object} [options.headers] - 请求头。
  31955. * @usage
  31956. */
  31957. class KernelDensityJobsService extends ProcessingServiceBase {
  31958. constructor(url, options) {
  31959. super(url, options);
  31960. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/density');
  31961. this.CLASS_NAME = "SuperMap.KernelDensityJobsService";
  31962. }
  31963. /**
  31964. * @function KernelDensityJobsService.prototype.destroy
  31965. * @override
  31966. */
  31967. destroy() {
  31968. super.destroy();
  31969. }
  31970. /**
  31971. * @function KernelDensityJobsService.prototype.getKernelDensityJobs
  31972. * @description 获取核密度分析任务
  31973. */
  31974. getKernelDensityJobs() {
  31975. super.getJobs(this.url);
  31976. }
  31977. /**
  31978. * @function KernelDensityJobsService.prototype.getKernelDensityJobs
  31979. * @description 获取指定id的核密度分析服务
  31980. * @param {string} id - 指定要获取数据的id
  31981. */
  31982. getKernelDensityJob(id) {
  31983. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  31984. }
  31985. /**
  31986. * @function KernelDensityJobsService.prototype.addKernelDensityJob
  31987. * @description 新建核密度分析服务
  31988. * @param {KernelDensityJobParameter} params - 核密度分析服务参数类。
  31989. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  31990. */
  31991. addKernelDensityJob(params, seconds) {
  31992. super.addJob(this.url, params, KernelDensityJobParameter, seconds);
  31993. }
  31994. }
  31995. ;// CONCATENATED MODULE: ./src/common/iServer/SingleObjectQueryJobsParameter.js
  31996. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  31997. * This program are made available under the terms of the Apache License, Version 2.0
  31998. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31999. /**
  32000. * @class SingleObjectQueryJobsParameter
  32001. * @deprecatedclass SuperMap.SingleObjectQueryJobsParameter
  32002. * @category iServer ProcessingService Query
  32003. * @classdesc 单对象空间查询分析任务参数类。
  32004. * @param {Object} options - 参数。
  32005. * @param {string} options.datasetName - 数据集名。
  32006. * @param {string} options.datasetQuery - 查询对象所在的数据集名称。
  32007. * @param {SpatialQueryMode} [options.mode=SpatialQueryMode.CONTAIN] - 空间查询模式。
  32008. * @param {OutputSetting} [options.output] - 输出参数设置。
  32009. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  32010. * @usage
  32011. */
  32012. class SingleObjectQueryJobsParameter {
  32013. constructor(options) {
  32014. if (!options) {
  32015. return;
  32016. }
  32017. /**
  32018. * @member {string} SingleObjectQueryJobsParameter.prototype.datasetName
  32019. * @description 数据集名。
  32020. */
  32021. this.datasetName = "";
  32022. /**
  32023. * @member {string} SingleObjectQueryJobsParameter.prototype.datasetQuery
  32024. * @description 查询对象所在的数据集名称。
  32025. */
  32026. this.datasetQuery = "";
  32027. /**
  32028. * @member {string} SingleObjectQueryJobsParameter.prototype.geometryQuery
  32029. * @description 查询对象所在的几何对象。
  32030. */
  32031. this.geometryQuery = "";
  32032. /**
  32033. * @member {SpatialQueryMode} [SingleObjectQueryJobsParameter.prototype.mode=SpatialQueryMode.CONTAIN]
  32034. * @description 空间查询模式 。
  32035. */
  32036. this.mode = SpatialQueryMode.CONTAIN;
  32037. /**
  32038. * @member {OutputSetting} [SingleObjectQueryJobsParameter.prototype.output]
  32039. * @description 输出参数设置类。
  32040. */
  32041. this.output = null;
  32042. /**
  32043. * @member {MappingParameters} [SingleObjectQueryJobsParameter.prototype.mappingParameters]
  32044. * @description 分析后结果可视化的参数类。
  32045. */
  32046. this.mappingParameters = null;
  32047. Util_Util.extend(this, options);
  32048. this.CLASS_NAME = "SuperMap.SingleObjectQueryJobsParameter";
  32049. }
  32050. /**
  32051. * @function SingleObjectQueryJobsParameter.prototype.destroy
  32052. * @description 释放资源,将引用资源的属性置空。
  32053. */
  32054. destroy() {
  32055. this.datasetName = null;
  32056. this.datasetQuery = null;
  32057. this.geometryQuery = null;
  32058. this.mode = null;
  32059. if (this.output instanceof OutputSetting) {
  32060. this.output.destroy();
  32061. this.output = null;
  32062. }
  32063. if (this.mappingParameters instanceof MappingParameters){
  32064. this.mappingParameters.destroy();
  32065. this.mappingParameters = null;
  32066. }
  32067. }
  32068. /**
  32069. * @function SingleObjectQueryJobsParameter.toObject
  32070. * @param {Object} singleObjectQueryJobsParameter - 单对象空间查询分析任务参数。
  32071. * @param {Object} tempObj - 目标对象。
  32072. * @description 生成单对象空间查询分析任务对象。
  32073. */
  32074. static toObject(singleObjectQueryJobsParameter, tempObj) {
  32075. for (var name in singleObjectQueryJobsParameter) {
  32076. if (name === "datasetName") {
  32077. tempObj['input'] = tempObj['input'] || {};
  32078. tempObj['input'][name] = singleObjectQueryJobsParameter[name];
  32079. continue;
  32080. }
  32081. if (name === "output"){
  32082. tempObj['output'] = tempObj['output'] || {};
  32083. tempObj['output'] = singleObjectQueryJobsParameter[name];
  32084. continue;
  32085. }
  32086. tempObj['analyst'] = tempObj['analyst'] || {};
  32087. tempObj['analyst'][name] = singleObjectQueryJobsParameter[name];
  32088. if(name === 'mappingParameters'){
  32089. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  32090. tempObj['analyst']['mappingParameters'] = singleObjectQueryJobsParameter[name];
  32091. }
  32092. }
  32093. }
  32094. }
  32095. ;// CONCATENATED MODULE: ./src/common/iServer/SingleObjectQueryJobsService.js
  32096. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32097. * This program are made available under the terms of the Apache License, Version 2.0
  32098. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32099. /**
  32100. * @class SingleObjectQueryJobsService
  32101. * @deprecatedclass SuperMap.SingleObjectQueryJobsService
  32102. * @category iServer ProcessingService Query
  32103. * @classdesc 单对象查询分析服务类
  32104. * @extends {ProcessingServiceBase}
  32105. * @param {string} url - 服务地址。
  32106. * @param {Object} options - 可选参数。
  32107. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  32108. * @param {Object} [options.headers] - 请求头。
  32109. * @usage
  32110. */
  32111. class SingleObjectQueryJobsService extends ProcessingServiceBase {
  32112. constructor(url, options) {
  32113. super(url, options);
  32114. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/query');
  32115. this.CLASS_NAME = 'SuperMap.SingleObjectQueryJobsService';
  32116. }
  32117. /**
  32118. *@override
  32119. */
  32120. destroy() {
  32121. super.destroy();
  32122. }
  32123. /**
  32124. * @function SingleObjectQueryJobsService.protitype.getQueryJobs
  32125. * @description 获取单对象空间查询分析所有任务
  32126. */
  32127. getQueryJobs() {
  32128. super.getJobs(this.url);
  32129. }
  32130. /**
  32131. * @function KernelDensityJobsService.protitype.getQueryJob
  32132. * @description 获取指定id的单对象空间查询分析服务
  32133. * @param {string} id - 指定要获取数据的id
  32134. */
  32135. getQueryJob(id) {
  32136. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  32137. }
  32138. /**
  32139. * @function SingleObjectQueryJobsService.protitype.addQueryJob
  32140. * @description 新建单对象空间查询分析服务
  32141. * @param {SingleObjectQueryJobsParameter} params - 创建一个空间分析的请求参数。
  32142. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  32143. */
  32144. addQueryJob(params, seconds) {
  32145. super.addJob(this.url, params, SingleObjectQueryJobsParameter, seconds);
  32146. }
  32147. }
  32148. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryMeshJobParameter.js
  32149. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32150. * This program are made available under the terms of the Apache License, Version 2.0
  32151. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32152. /**
  32153. * @class SummaryMeshJobParameter
  32154. * @deprecatedclass SuperMap.SummaryMeshJobParameter
  32155. * @category iServer ProcessingService AggregatePoints
  32156. * @classdesc 点聚合分析任务参数类。
  32157. * @param {Object} options - 参数。
  32158. * @param {string} options.datasetName - 数据集名。
  32159. * @param {string} [options.regionDataset ] - 聚合面数据集(聚合类型为多边形聚合时使用的参数)
  32160. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} [options.query] - 分析范围(默认为全图范围)。
  32161. * @param {number} options.fields - 权重索引。
  32162. * @param {number} [options.resolution=100] - 分辨率。
  32163. * @param {StatisticAnalystMode} [options.statisticModes=StatisticAnalystMode.AVERAGE] - 分析模式。
  32164. * @param {number} [options.meshType=0] - 分析类型。
  32165. * @param {SummaryType} [options.type=SummaryType.SUMMARYMESH] - 聚合类型。
  32166. * @param {OutputSetting} [options.output] - 输出参数设置。
  32167. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  32168. * @usage
  32169. */
  32170. class SummaryMeshJobParameter {
  32171. constructor(options) {
  32172. if (!options) {
  32173. return;
  32174. }
  32175. /**
  32176. * @member {string} SummaryMeshJobParameter.prototype.datasetName
  32177. * @description 数据集名。
  32178. */
  32179. this.datasetName = "";
  32180. /**
  32181. * @member {string} SummaryMeshJobParameter.prototype.regionDataset
  32182. * @description 聚合面数据集(聚合类型为多边形聚合时使用的参数)。
  32183. */
  32184. this.regionDataset = "";
  32185. /**
  32186. * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} SummaryMeshJobParameter.prototype.query
  32187. * @description 分析范围(聚合类型为网格面聚合时使用的参数)。
  32188. */
  32189. this.query = "";
  32190. /**
  32191. * @member {number} [SummaryMeshJobParameter.prototype.resolution=100]
  32192. * @description 分辨率(聚合类型为网格面聚合时使用的参数)。
  32193. */
  32194. this.resolution = 100;
  32195. /**
  32196. * @member {number} [SummaryMeshJobParameter.prototype.meshType=0]
  32197. * @description 网格面类型(聚合类型为网格面聚合时使用的参数),取值:0 或 1。
  32198. */
  32199. this.meshType = 0;
  32200. /**
  32201. * @member {StatisticAnalystMode} [SummaryMeshJobParameter.prototype.statisticModes=StatisticAnalystMode.AVERAGE]
  32202. * @description 统计模式。
  32203. */
  32204. this.statisticModes = StatisticAnalystMode.AVERAGE;
  32205. /**
  32206. * @member {number} SummaryMeshJobParameter.prototype.fields
  32207. * @description 权重字段。
  32208. */
  32209. this.fields = "";
  32210. /**
  32211. * @member {SummaryType} [SummaryMeshJobParameter.prototype.type=SummaryType.SUMMARYMESH]
  32212. * @description 聚合类型。
  32213. */
  32214. this.type = SummaryType.SUMMARYMESH;
  32215. /**
  32216. * @member {OutputSetting} [SummaryMeshJobParameter.prototype.output]
  32217. * @description 输出参数设置类。
  32218. */
  32219. this.output = null;
  32220. /**
  32221. * @member {MappingParameters} [SummaryMeshJobParameter.prototype.mappingParameters]
  32222. * @description 分析后结果可视化的参数类。
  32223. */
  32224. this.mappingParameters = null;
  32225. Util_Util.extend(this, options);
  32226. this.CLASS_NAME = "SuperMap.SummaryMeshJobParameter";
  32227. }
  32228. /**
  32229. * @function SummaryMeshJobParameter.prototype.destroy
  32230. * @description 释放资源,将资源的属性置空。
  32231. */
  32232. destroy() {
  32233. this.datasetName = null;
  32234. this.query = null;
  32235. this.resolution = null;
  32236. this.statisticModes = null;
  32237. this.meshType = null;
  32238. this.fields = null;
  32239. this.regionDataset = null;
  32240. this.type = null;
  32241. if (this.output instanceof OutputSetting) {
  32242. this.output.destroy();
  32243. this.output = null;
  32244. }
  32245. if (this.mappingParameters instanceof MappingParameters){
  32246. this.mappingParameters.destroy();
  32247. this.mappingParameters = null;
  32248. }
  32249. }
  32250. /**
  32251. * @function SummaryMeshJobParameter.toObject
  32252. * @param {Object} summaryMeshJobParameter - 点聚合分析任务参数。
  32253. * @param {Object} tempObj - 目标对象。
  32254. * @description 生成点聚合分析任务对象。
  32255. */
  32256. static toObject(summaryMeshJobParameter, tempObj) {
  32257. for (var name in summaryMeshJobParameter) {
  32258. if (name === "datasetName") {
  32259. tempObj['input'] = tempObj['input'] || {};
  32260. tempObj['input'][name] = summaryMeshJobParameter[name];
  32261. continue;
  32262. }
  32263. if (name === "type") {
  32264. tempObj['type'] = summaryMeshJobParameter[name];
  32265. continue;
  32266. }
  32267. if (name === "output") {
  32268. tempObj['output'] = tempObj['output'] || {};
  32269. tempObj['output'] = summaryMeshJobParameter[name];
  32270. continue;
  32271. }
  32272. if (summaryMeshJobParameter.type === 'SUMMARYMESH' && name !== 'regionDataset' || summaryMeshJobParameter.type === 'SUMMARYREGION' && !contains(['meshType', 'resolution', 'query'], name)) {
  32273. tempObj['analyst'] = tempObj['analyst'] || {};
  32274. if (name === 'query' && summaryMeshJobParameter[name]) {
  32275. tempObj['analyst'][name] = summaryMeshJobParameter[name].toBBOX();
  32276. } else {
  32277. tempObj['analyst'][name] = summaryMeshJobParameter[name];
  32278. }
  32279. if(name === 'mappingParameters'){
  32280. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  32281. tempObj['analyst']['mappingParameters'] = summaryMeshJobParameter[name];
  32282. }
  32283. }
  32284. }
  32285. function contains(arr, obj) {
  32286. var i = arr.length;
  32287. while (i--) {
  32288. if (arr[i] === obj) {
  32289. return true;
  32290. }
  32291. }
  32292. return false;
  32293. }
  32294. }
  32295. }
  32296. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryMeshJobsService.js
  32297. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32298. * This program are made available under the terms of the Apache License, Version 2.0
  32299. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32300. /**
  32301. * @class SummaryMeshJobsService
  32302. * @deprecatedclass SuperMap.SummaryMeshJobsService
  32303. * @category iServer ProcessingService AggregatePoints
  32304. * @classdesc 点聚合分析任务类。
  32305. * @param {string} url - 服务地址。
  32306. * @param {Object} options - 参数。
  32307. * @param {Events} options.events - 处理所有事件的对象。
  32308. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  32309. * @param {number} options.index - 服务地址在数组中的位置。
  32310. * @param {number} options.length - 服务地址数组长度。
  32311. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  32312. * @param {Object} [options.headers] - 请求头。
  32313. * @usage
  32314. */
  32315. class SummaryMeshJobsService extends ProcessingServiceBase {
  32316. constructor(url, options) {
  32317. super(url, options);
  32318. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/aggregatepoints');
  32319. this.CLASS_NAME = 'SuperMap.SummaryMeshJobsService';
  32320. }
  32321. /**
  32322. * @override
  32323. */
  32324. destroy() {
  32325. super.destroy();
  32326. }
  32327. /**
  32328. * @function SummaryMeshJobsService.prototype.getSummaryMeshJobs
  32329. * @description 获取点聚合分析任务
  32330. */
  32331. getSummaryMeshJobs() {
  32332. super.getJobs(this.url);
  32333. }
  32334. /**
  32335. * @function SummaryMeshJobsService.prototype.getSummaryMeshJob
  32336. * @description 获取指定ip的点聚合分析任务
  32337. * @param {string} id - 指定要获取数据的id
  32338. */
  32339. getSummaryMeshJob(id) {
  32340. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  32341. }
  32342. /**
  32343. * @function SummaryMeshJobsService.prototype.addSummaryMeshJob
  32344. * @description 新建点聚合分析服务
  32345. * @param {SummaryMeshJobParameter} params - 创建一个空间分析的请求参数。
  32346. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  32347. */
  32348. addSummaryMeshJob(params, seconds) {
  32349. super.addJob(this.url, params, SummaryMeshJobParameter, seconds);
  32350. }
  32351. }
  32352. ;// CONCATENATED MODULE: ./src/common/iServer/VectorClipJobsParameter.js
  32353. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32354. * This program are made available under the terms of the Apache License, Version 2.0
  32355. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32356. /**
  32357. * @class VectorClipJobsParameter
  32358. * @deprecatedclass SuperMap.VectorClipJobsParameter
  32359. * @category iServer ProcessingService VectorClip
  32360. * @classdesc 矢量裁剪分析任务参数类。
  32361. * @param {Object} options - 参数。
  32362. * @param {string} options.datasetName - 数据集名。
  32363. * @param {string} options.datasetOverlay - 裁剪对象数据集。
  32364. * @param {ClipAnalystMode} [options.mode=ClipAnalystMode.CLIP] - 裁剪分析模式。
  32365. * @param {string} [options.geometryClip] - 裁剪几何对象。
  32366. * @param {OutputSetting} [options.output] - 输出参数设置。
  32367. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  32368. * @usage
  32369. */
  32370. class VectorClipJobsParameter {
  32371. constructor(options) {
  32372. options = options || {};
  32373. /**
  32374. * @member {string} VectorClipJobsParameter.prototype.datasetName
  32375. * @description 数据集名。
  32376. */
  32377. this.datasetName = "";
  32378. /**
  32379. * @member {string} VectorClipJobsParameter.prototype.datasetOverlay
  32380. * @description 裁剪对象数据集。
  32381. */
  32382. this.datasetVectorClip = "";
  32383. /**
  32384. * @member {string} VectorClipJobsParameter.prototype.geometryClip
  32385. * @description 裁剪几何对象。
  32386. */
  32387. this.geometryClip = "";
  32388. /**
  32389. * @member {ClipAnalystMode} [VectorClipJobsParameter.prototype.mode=ClipAnalystMode.CLIP]
  32390. * @description 裁剪分析模式 。
  32391. */
  32392. this.mode = ClipAnalystMode.CLIP;
  32393. /**
  32394. * @member {OutputSetting} VectorClipJobsParameter.prototype.output
  32395. * @description 输出参数设置类。
  32396. */
  32397. this.output = null;
  32398. /**
  32399. * @member {MappingParameters} [VectorClipJobsParameter.prototype.mappingParameters]
  32400. * @description 分析后结果可视化的参数类。
  32401. */
  32402. this.mappingParameters = null;
  32403. Util_Util.extend(this, options);
  32404. this.CLASS_NAME = "SuperMap.VectorClipJobsParameter";
  32405. }
  32406. /**
  32407. * @function VectorClipJobsParameter.prototype.destroy
  32408. * @description 释放资源,将引用资源的属性置空。
  32409. */
  32410. destroy() {
  32411. this.datasetName = null;
  32412. this.datasetVectorClip = null;
  32413. this.geometryClip = null;
  32414. this.mode = null;
  32415. if (this.output instanceof OutputSetting) {
  32416. this.output.destroy();
  32417. this.output = null;
  32418. }
  32419. if (this.mappingParameters instanceof MappingParameters) {
  32420. this.mappingParameters.destroy();
  32421. this.mappingParameters = null;
  32422. }
  32423. }
  32424. /**
  32425. * @function VectorClipJobsParameter.toObject
  32426. * @param {Object} vectorClipJobsParameter - 区域汇总分析服务参数。
  32427. * @param {Object} tempObj - 目标对象。
  32428. * @description 矢量裁剪分析任务对象。
  32429. */
  32430. static toObject(vectorClipJobsParameter, tempObj) {
  32431. for (var name in vectorClipJobsParameter) {
  32432. if (name === "datasetName") {
  32433. tempObj['input'] = tempObj['input'] || {};
  32434. tempObj['input'][name] = vectorClipJobsParameter[name];
  32435. continue;
  32436. }
  32437. if (name === "output"){
  32438. tempObj['output'] = tempObj['output'] || {};
  32439. tempObj['output'] = vectorClipJobsParameter[name];
  32440. continue;
  32441. }
  32442. tempObj['analyst'] = tempObj['analyst'] || {};
  32443. tempObj['analyst'][name] = vectorClipJobsParameter[name];
  32444. if(name === 'mappingParameters'){
  32445. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  32446. tempObj['analyst']['mappingParameters'] = vectorClipJobsParameter[name];
  32447. }
  32448. }
  32449. }
  32450. }
  32451. ;// CONCATENATED MODULE: ./src/common/iServer/VectorClipJobsService.js
  32452. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32453. * This program are made available under the terms of the Apache License, Version 2.0
  32454. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32455. /**
  32456. * @class VectorClipJobsService
  32457. * @deprecatedclass SuperMap.VectorClipJobsService
  32458. * @category iServer ProcessingService VectorClip
  32459. * @classdesc 矢量裁剪分析服务类
  32460. * @extends {ProcessingServiceBase}
  32461. * @param {string} url -服务地址。
  32462. * @param {Object} options - 可选参数。
  32463. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  32464. * @param {Object} [options.headers] - 请求头。
  32465. * @usage
  32466. */
  32467. class VectorClipJobsService extends ProcessingServiceBase {
  32468. constructor(url, options) {
  32469. super(url, options);
  32470. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/vectorclip');
  32471. this.CLASS_NAME = 'SuperMap.VectorClipJobsService';
  32472. }
  32473. /**
  32474. *@override
  32475. */
  32476. destroy() {
  32477. super.destroy();
  32478. }
  32479. /**
  32480. * @function VectorClipJobsService.protitype.getVectorClipJobs
  32481. * @description 获取矢量裁剪分析所有任务
  32482. */
  32483. getVectorClipJobs() {
  32484. super.getJobs(this.url);
  32485. }
  32486. /**
  32487. * @function KernelDensityJobsService.protitype.getVectorClipJob
  32488. * @description 获取指定id的矢量裁剪分析服务
  32489. * @param {string} id - 指定要获取数据的id
  32490. */
  32491. getVectorClipJob(id) {
  32492. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  32493. }
  32494. /**
  32495. * @function VectorClipJobsService.protitype.addVectorClipJob
  32496. * @description 新建矢量裁剪分析服务
  32497. * @param {VectorClipJobsParameter} params - 创建一个空间分析的请求参数。
  32498. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  32499. */
  32500. addVectorClipJob(params, seconds) {
  32501. super.addJob(this.url, params, VectorClipJobsParameter, seconds);
  32502. }
  32503. }
  32504. ;// CONCATENATED MODULE: ./src/common/iServer/OverlayGeoJobParameter.js
  32505. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32506. * This program are made available under the terms of the Apache License, Version 2.0
  32507. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32508. /**
  32509. * @class OverlayGeoJobParameter
  32510. * @deprecatedclass SuperMap.OverlayGeoJobParameter
  32511. * @category iServer ProcessingService OverlayAnalyst
  32512. * @classdesc 叠加分析任务参数类。
  32513. * @param {Object} options - 参数。
  32514. * @param {string} options.datasetName - 数据集名。
  32515. * @param {string} options.datasetOverlay - 叠加对象所在的数据集名称。
  32516. * @param {string} options.srcFields - 输入数据需要保留的字段。
  32517. * @param {string} [options.overlayFields] - 叠加数据需要保留的字段。对分析模式为 clip、update、erase 时,此参数无效。
  32518. * @param {string} [options.mode] - 叠加分析模式。
  32519. * @param {OutputSetting} [options.output] - 输出参数设置。
  32520. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  32521. * @usage
  32522. */
  32523. class OverlayGeoJobParameter {
  32524. constructor(options) {
  32525. if (!options) {
  32526. return;
  32527. }
  32528. /**
  32529. * @member {string} OverlayGeoJobParameter.prototype.datasetName
  32530. * @description 数据集名。
  32531. */
  32532. this.datasetName = "";
  32533. /**
  32534. * @member {string} OverlayGeoJobParameter.prototype.datasetOverlay
  32535. * @description 叠加对象所在的数据集名称。
  32536. */
  32537. this.datasetOverlay = "";
  32538. /**
  32539. * @member {string} [OverlayGeoJobParameter.prototype.mode]
  32540. * @description 叠加分析模式。
  32541. */
  32542. this.mode = "";
  32543. /**
  32544. * @member {string} OverlayGeoJobParameter.prototype.srcFields
  32545. * @description 输入数据需要保留的字段。
  32546. */
  32547. this.srcFields = "";
  32548. /**
  32549. * @member {string} OverlayGeoJobParameter.prototype.overlayFields
  32550. * @description 叠加数据需要保留的字段,对分析模式为 clip、update、erase 时,此参数无效。
  32551. */
  32552. this.overlayFields = "";
  32553. /**
  32554. * @member {OutputSetting} [OverlayGeoJobParameter.prototype.output]
  32555. * @description 输出参数设置类。
  32556. */
  32557. this.output = null;
  32558. /**
  32559. * @member {MappingParameters} [OverlayGeoJobParameter.prototype.mappingParameters]
  32560. * @description 分析后结果可视化的参数类。
  32561. */
  32562. this.mappingParameters = null;
  32563. Util_Util.extend(this, options);
  32564. this.CLASS_NAME = "SuperMap.OverlayGeoJobParameter";
  32565. }
  32566. /**
  32567. * @function OverlayGeoJobParameter.prototype.destroy
  32568. * @description 释放资源,将资源的属性置空。
  32569. */
  32570. destroy() {
  32571. this.datasetName = null;
  32572. this.datasetOverlay = null;
  32573. this.mode = null;
  32574. this.srcFields = null;
  32575. this.overlayFields = null;
  32576. if (this.output instanceof OutputSetting) {
  32577. this.output.destroy();
  32578. this.output = null;
  32579. }
  32580. if (this.mappingParameters instanceof MappingParameters) {
  32581. this.mappingParameters.destroy();
  32582. this.mappingParameters = null;
  32583. }
  32584. }
  32585. /**
  32586. * @function OverlayGeoJobParameter.toObject
  32587. * @param {Object} OverlayGeoJobParameter - 点聚合分析任务参数。
  32588. * @param {Object} tempObj - 目标对象。
  32589. * @description 生成点聚合分析任务对象。
  32590. */
  32591. static toObject(OverlayGeoJobParameter, tempObj) {
  32592. for (var name in OverlayGeoJobParameter) {
  32593. if (name == "datasetName") {
  32594. tempObj['input'] = tempObj['input'] || {};
  32595. tempObj['input'][name] = OverlayGeoJobParameter[name];
  32596. continue;
  32597. }
  32598. if (name === "output") {
  32599. tempObj['output'] = tempObj['output'] || {};
  32600. tempObj['output'] = OverlayGeoJobParameter[name];
  32601. continue;
  32602. }
  32603. tempObj['analyst'] = tempObj['analyst'] || {};
  32604. tempObj['analyst'][name] = OverlayGeoJobParameter[name];
  32605. if(name === 'mappingParameters'){
  32606. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  32607. tempObj['analyst']['mappingParameters'] = OverlayGeoJobParameter[name];
  32608. }
  32609. }
  32610. }
  32611. }
  32612. ;// CONCATENATED MODULE: ./src/common/iServer/OverlayGeoJobsService.js
  32613. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32614. * This program are made available under the terms of the Apache License, Version 2.0
  32615. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32616. /**
  32617. * @class OverlayGeoJobsService
  32618. * @deprecatedclass SuperMap.OverlayGeoJobsService
  32619. * @category iServer ProcessingService OverlayAnalyst
  32620. * @classdesc 叠加分析任务类。
  32621. * @param {string} url - 服务地址。
  32622. * @param {Object} options - 参数。
  32623. * @param {Events} options.events - 处理所有事件的对象。
  32624. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  32625. * @param {number} options.index - 服务访问地址在数组中的位置。
  32626. * @param {number} options.length - 服务访问地址数组长度。
  32627. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  32628. * @param {Object} [options.headers] - 请求头。
  32629. * @usage
  32630. */
  32631. class OverlayGeoJobsService extends ProcessingServiceBase {
  32632. constructor(url, options) {
  32633. super(url, options);
  32634. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/overlay');
  32635. this.CLASS_NAME = 'SuperMap.OverlayGeoJobsService';
  32636. }
  32637. /**
  32638. * @override
  32639. */
  32640. destroy() {
  32641. super.destroy();
  32642. }
  32643. /**
  32644. * @function OverlayGeoJobsService.prototype.getOverlayGeoJobs
  32645. * @description 获取叠加分析任务
  32646. */
  32647. getOverlayGeoJobs() {
  32648. super.getJobs(this.url);
  32649. }
  32650. /**
  32651. * @function OverlayGeoJobsService.prototype.getOverlayGeoJob
  32652. * @description 获取指定id的叠加分析任务
  32653. * @param {string} id - 指定要获取数据的id
  32654. */
  32655. getOverlayGeoJob(id) {
  32656. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  32657. }
  32658. /**
  32659. * @function OverlayGeoJobsService.prototype.addOverlayGeoJob
  32660. * @description 新建点叠加析服务
  32661. * @param {OverlayGeoJobParameter} params - 创建一个叠加分析的请求参数。
  32662. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  32663. */
  32664. addOverlayGeoJob(params, seconds) {
  32665. super.addJob(this.url, params, OverlayGeoJobParameter, seconds);
  32666. }
  32667. }
  32668. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryRegionJobParameter.js
  32669. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32670. * This program are made available under the terms of the Apache License, Version 2.0
  32671. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32672. /**
  32673. * @class SummaryRegionJobParameter
  32674. * @deprecatedclass SuperMap.SummaryRegionJobParameter
  32675. * @category iServer ProcessingService SummaryRegion
  32676. * @classdesc 区域汇总分析任务参数类。
  32677. * @param {Object} options - 参数。
  32678. * @param {string} options.datasetName - 数据集名。
  32679. * @param {string} [options.regionDataset] - 汇总数据源(多边形汇总时用到的参数)。
  32680. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} [options.query] - 分析范围(默认为全图范围)。
  32681. * @param {string} [options.standardFields] - 标准属性字段名称。
  32682. * @param {string} [options.weightedFields] - 权重字段名称。
  32683. * @param {StatisticAnalystMode} [options.standardStatisticModes] - 标准属性字段的统计模式。standardSummaryFields 为 true 时必填。
  32684. * @param {StatisticAnalystMode} [options.weightedStatisticModes] - 权重字段的统计模式。weightedSummaryFields 为 true 时必填。
  32685. * @param {boolean} [options.sumShape=true] - 是否统计长度或面积。
  32686. * @param {boolean} [options.standardSummaryFields=false] - 是否以标准属性字段统计。
  32687. * @param {boolean} [options.weightedSummaryFields=false] - 是否以权重字段统计。
  32688. * @param {number} [options.resolution=100] - 网格大小。
  32689. * @param {number} [options.meshType=0] - 网格面汇总类型。
  32690. * @param {AnalystSizeUnit} [options.meshSizeUnit=AnalystSizeUnit.METER] - 网格大小单位。
  32691. * @param {SummaryType} [options.type=SummaryType.SUMMARYMESH] - 汇总类型。
  32692. * @param {OutputSetting} [options.output] - 输出参数设置。
  32693. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  32694. * @usage
  32695. */
  32696. class SummaryRegionJobParameter {
  32697. constructor(options) {
  32698. if (!options) {
  32699. return;
  32700. }
  32701. /**
  32702. * @member {string} SummaryRegionJobParameter.prototype.datasetName
  32703. * @description 数据集名。
  32704. */
  32705. this.datasetName = "";
  32706. /**
  32707. * @member {string} SummaryRegionJobParameter.prototype.regionDataset
  32708. * @description 汇总数据源(多边形汇总时用到的参数)。
  32709. */
  32710. this.regionDataset = "";
  32711. /**
  32712. * @member {boolean} [SummaryRegionJobParameter.prototype.sumShape=true]
  32713. * @description 是否统计长度或面积。
  32714. */
  32715. this.sumShape = true;
  32716. /**
  32717. * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} SummaryRegionJobParameter.prototype.query
  32718. * @description 分析范围。
  32719. */
  32720. this.query = "";
  32721. /**
  32722. * @member {boolean} [SummaryRegionJobParameter.prototype.standardSummaryFields=false]
  32723. * @description 是否以标准属字段统计。
  32724. */
  32725. this.standardSummaryFields = false;
  32726. /**
  32727. * @member {string} SummaryRegionJobParameter.prototype.standardFields
  32728. * @description 标准属性字段名称。仅支持系统字段以外的整形、长整形、浮点型的字段的名称。standardSummaryFields 为 true 时必填。
  32729. */
  32730. this.standardFields = "";
  32731. /**
  32732. * @member {StatisticAnalystMode} SummaryRegionJobParameter.prototype.standardStatisticModes
  32733. * @description 标准属性字段的统计模式。standardSummaryFields 为 true 时必填。
  32734. */
  32735. this.standardStatisticModes = "";
  32736. /**
  32737. * @member {boolean} [SummaryRegionJobParameter.prototype.weightedSummaryFields=false]
  32738. * @description 是否以权重字段统计。
  32739. */
  32740. this.weightedSummaryFields = false;
  32741. /**
  32742. * @member {string} SummaryRegionJobParameter.prototype.weightedFields
  32743. * @description 权重字段名称。仅支持系统字段以外的整形、长整形、浮点型的字段的名称。weightedSummaryFields 为 true 时必填。
  32744. */
  32745. this.weightedFields = "";
  32746. /**
  32747. * @member {StatisticAnalystMode} SummaryRegionJobParameter.prototype.weightedStatisticModes
  32748. * @description 以权重字段统计的统计模式。权重字段的统计模式。weightedSummaryFields 为 true 时必填。
  32749. */
  32750. this.weightedStatisticModes = "";
  32751. /**
  32752. * @member {number} [SummaryRegionJobParameter.prototype.meshType=0]
  32753. * @description 网格面汇总类型。
  32754. */
  32755. this.meshType = 0;
  32756. /**
  32757. * @member {number} [SummaryRegionJobParameter.prototype.resolution=100]
  32758. * @description 网格大小。
  32759. */
  32760. this.resolution = 100;
  32761. /**
  32762. * @member {AnalystSizeUnit} [SummaryRegionJobParameter.prototype.meshSizeUnit=AnalystSizeUnit.METER]
  32763. * @description 网格大小单位。
  32764. */
  32765. this.meshSizeUnit = AnalystSizeUnit.METER;
  32766. /**
  32767. * @member {SummaryType} [SummaryRegionJobParameter.prototype.type=SummaryType.SUMMARYMESH]
  32768. * @description 汇总类型。
  32769. */
  32770. this.type = SummaryType.SUMMARYMESH;
  32771. /**
  32772. * @member {OutputSetting} SummaryRegionJobParameter.prototype.output
  32773. * @description 输出参数设置类。
  32774. */
  32775. this.output = null;
  32776. /**
  32777. * @member {MappingParameters} [SummaryRegionJobParameter.prototype.mappingParameters]
  32778. * @description 分析后结果可视化的参数类。
  32779. */
  32780. this.mappingParameters = null;
  32781. Util_Util.extend(this, options);
  32782. this.CLASS_NAME = "SuperMap.SummaryRegionJobParameter";
  32783. }
  32784. /**
  32785. * @function SummaryRegionJobParameter.prototype.destroy
  32786. * @description 释放资源,将引用资源的属性置空。
  32787. */
  32788. destroy() {
  32789. this.datasetName = null;
  32790. this.sumShape = null;
  32791. this.regionDataset = null;
  32792. this.query = null;
  32793. this.standardSummaryFields = null;
  32794. this.standardFields = null;
  32795. this.standardStatisticModes = null;
  32796. this.weightedSummaryFields = null;
  32797. this.weightedFields = null;
  32798. this.weightedStatisticModes = null;
  32799. this.meshType = null;
  32800. this.resolution = null;
  32801. this.meshSizeUnit = null;
  32802. this.type = null;
  32803. if (this.output instanceof OutputSetting) {
  32804. this.output.destroy();
  32805. this.output = null;
  32806. }
  32807. if (this.mappingParameters instanceof MappingParameters){
  32808. this.mappingParameters.destroy();
  32809. this.mappingParameters = null;
  32810. }
  32811. }
  32812. /**
  32813. * @function SummaryRegionJobParameter.toObject
  32814. * @param {Object} summaryRegionJobParameter - 矢量裁剪分析任务参数。
  32815. * @param {Object} tempObj - 目标对象。
  32816. * @description 生成区域汇总分析服务对象。
  32817. */
  32818. static toObject(summaryRegionJobParameter, tempObj) {
  32819. for (var name in summaryRegionJobParameter) {
  32820. if (name === "datasetName") {
  32821. tempObj['input'] = tempObj['input'] || {};
  32822. tempObj['input'][name] = summaryRegionJobParameter[name];
  32823. continue;
  32824. }
  32825. if (name === "type") {
  32826. tempObj['type'] = summaryRegionJobParameter[name];
  32827. continue;
  32828. }
  32829. if (name === "type") {
  32830. tempObj['type'] = summaryRegionJobParameter[name];
  32831. continue;
  32832. }
  32833. if (name === "output") {
  32834. tempObj['output'] = tempObj['output'] || {};
  32835. tempObj['output'] = summaryRegionJobParameter[name];
  32836. continue;
  32837. }
  32838. if (summaryRegionJobParameter.type === "SUMMARYREGION" || summaryRegionJobParameter.type === "SUMMARYMESH" && name !== "regionDataset") {
  32839. tempObj['analyst'] = tempObj['analyst'] || {};
  32840. if (name === 'query' && summaryRegionJobParameter[name]) {
  32841. tempObj['analyst'][name] = summaryRegionJobParameter[name].toBBOX();
  32842. } else {
  32843. tempObj['analyst'][name] = summaryRegionJobParameter[name];
  32844. }
  32845. if(name === 'mappingParameters'){
  32846. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  32847. tempObj['analyst']['mappingParameters'] = summaryRegionJobParameter[name];
  32848. }
  32849. }
  32850. }
  32851. }
  32852. }
  32853. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryRegionJobsService.js
  32854. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32855. * This program are made available under the terms of the Apache License, Version 2.0
  32856. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32857. /**
  32858. * @class SummaryRegionJobsService
  32859. * @deprecatedclass SuperMap.SummaryRegionJobsService
  32860. * @category iServer ProcessingService SummaryRegion
  32861. * @classdesc 区域汇总分析服务类
  32862. * @extends {ProcessingServiceBase}
  32863. * @param {string} url - 服务地址。
  32864. * @param {Object} options - 可选参数。
  32865. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  32866. * @param {Object} [options.headers] - 请求头。
  32867. * @usage
  32868. */
  32869. class SummaryRegionJobsService extends ProcessingServiceBase {
  32870. constructor(url, options) {
  32871. super(url, options);
  32872. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/summaryregion');
  32873. this.CLASS_NAME = 'SuperMap.SummaryRegionJobsService';
  32874. }
  32875. /**
  32876. *@override
  32877. */
  32878. destroy() {
  32879. super.destroy();
  32880. }
  32881. /**
  32882. * @function SummaryRegionJobsService.prototype.getSummaryRegionJobs
  32883. * @description 获取区域汇总分析任务集合。
  32884. */
  32885. getSummaryRegionJobs() {
  32886. super.getJobs(this.url);
  32887. }
  32888. /**
  32889. * @function SummaryRegionJobsService.prototype.getSummaryRegionJob
  32890. * @description 获取指定id的区域汇总分析任务。
  32891. * @param {string} id -要获取区域汇总分析任务的id
  32892. */
  32893. getSummaryRegionJob(id) {
  32894. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  32895. }
  32896. /**
  32897. * @function SummaryRegionJobsService.prototype.addSummaryRegionJob
  32898. * @description 新建区域汇总任务。
  32899. * @param {SummaryRegionJobParameter} params - 区域汇总分析任务参数类。
  32900. * @param {number} seconds - 创建成功结果的时间间隔。
  32901. */
  32902. addSummaryRegionJob(params, seconds) {
  32903. super.addJob(this.url, params, SummaryRegionJobParameter, seconds);
  32904. }
  32905. }
  32906. ;// CONCATENATED MODULE: ./src/common/iServer/BuffersAnalystJobsParameter.js
  32907. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  32908. * This program are made available under the terms of the Apache License, Version 2.0
  32909. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32910. /**
  32911. * @class BuffersAnalystJobsParameter
  32912. * @deprecatedclass SuperMap.BuffersAnalystJobsParameter
  32913. * @category iServer ProcessingService BufferAnalyst
  32914. * @classdesc 缓冲区分析任务参数类。
  32915. * @param {Object} options - 参数。
  32916. * @param {string} options.datasetName - 数据集名。
  32917. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} [options.bounds] - 分析范围(默认为全图范围)。
  32918. * @param {string} [options.distance='15'] - 缓冲距离,或缓冲区半径。
  32919. * @param {string} [options.distanceField='pickup_latitude'] - 缓冲区分析距离字段。
  32920. * @param {AnalystSizeUnit} [options.distanceUnit=AnalystSizeUnit.METER] - 缓冲距离单位单位。
  32921. * @param {OutputSetting} [options.output] - 输出参数设置。
  32922. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  32923. * @usage
  32924. */
  32925. class BuffersAnalystJobsParameter {
  32926. constructor(options) {
  32927. /**
  32928. * @member {string} BuffersAnalystJobsParameter.prototype.datasetName
  32929. * @description 数据集名。
  32930. */
  32931. this.datasetName = '';
  32932. /**
  32933. * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} BuffersAnalystJobsParameter.prototype.bounds
  32934. * @description 分析范围。
  32935. */
  32936. this.bounds = '';
  32937. /**
  32938. * @member {string} [BuffersAnalystJobsParameter.prototype.distance='15']
  32939. * @description 缓冲距离,或称为缓冲区半径。当缓冲距离字段为空时,此参数有效。
  32940. */
  32941. this.distance = '';
  32942. /**
  32943. * @member {string} [BuffersAnalystJobsParameter.prototype.distanceField='pickup_latitude']
  32944. * @description 缓冲距离字段。
  32945. */
  32946. this.distanceField = '';
  32947. /**
  32948. * @member {AnalystSizeUnit} [BuffersAnalystJobsParameter.prototype.distanceUnit=AnalystSizeUnit.METER]
  32949. * @description 缓冲距离单位。
  32950. */
  32951. this.distanceUnit = AnalystSizeUnit.METER;
  32952. /**
  32953. * @member {string} BuffersAnalystJobsParameter.prototype.dissolveField
  32954. * @description 融合字段,根据字段值对缓冲区结果面对象进行融合。
  32955. */
  32956. this.dissolveField = '';
  32957. /**
  32958. * @member {OutputSetting} [BuffersAnalystJobsParameter.prototype.output]
  32959. * @description 输出参数设置类。
  32960. */
  32961. this.output = null;
  32962. /**
  32963. * @member {MappingParameters} [BuffersAnalystJobsParameter.prototype.mappingParameters]
  32964. * @description 分析后结果可视化的参数类。
  32965. */
  32966. this.mappingParameters = null;
  32967. if (!options) {
  32968. return this;
  32969. }
  32970. Util_Util.extend(this, options);
  32971. this.CLASS_NAME = 'SuperMap.BuffersAnalystJobsParameter';
  32972. }
  32973. /**
  32974. * @function BuffersAnalystJobsParameter.prototype.destroy
  32975. * @description 释放资源,将引用资源的属性置空。
  32976. */
  32977. destroy() {
  32978. this.datasetName = null;
  32979. this.bounds = null;
  32980. this.distance = null;
  32981. this.distanceField = null;
  32982. this.distanceUnit = null;
  32983. this.dissolveField = null;
  32984. if (this.output instanceof OutputSetting) {
  32985. this.output.destroy();
  32986. this.output = null;
  32987. }
  32988. if (this.mappingParameters instanceof MappingParameters) {
  32989. this.mappingParameters.destroy();
  32990. this.mappingParameters = null;
  32991. }
  32992. }
  32993. /**
  32994. * @function BuffersAnalystJobsParameter.toObject
  32995. * @param {BuffersAnalystJobsParameter} BuffersAnalystJobsParameter - 缓冲区分析任务参数。
  32996. * @param {Object} tempObj - 目标对象。
  32997. * @description 生成缓冲区分析任务对象。
  32998. */
  32999. static toObject(BuffersAnalystJobsParameter, tempObj) {
  33000. for (var name in BuffersAnalystJobsParameter) {
  33001. if (name === 'datasetName') {
  33002. tempObj['input'] = tempObj['input'] || {};
  33003. tempObj['input'][name] = BuffersAnalystJobsParameter[name];
  33004. continue;
  33005. }
  33006. if (name === 'output') {
  33007. tempObj['output'] = tempObj['output'] || {};
  33008. tempObj['output'] = BuffersAnalystJobsParameter[name];
  33009. continue;
  33010. }
  33011. tempObj['analyst'] = tempObj['analyst'] || {};
  33012. if (name === 'bounds' && BuffersAnalystJobsParameter[name]) {
  33013. tempObj['analyst'][name] = BuffersAnalystJobsParameter[name].toBBOX();
  33014. } else {
  33015. tempObj['analyst'][name] = BuffersAnalystJobsParameter[name];
  33016. }
  33017. if (name === 'mappingParameters') {
  33018. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  33019. tempObj['analyst']['mappingParameters'] = BuffersAnalystJobsParameter[name];
  33020. }
  33021. }
  33022. }
  33023. }
  33024. ;// CONCATENATED MODULE: ./src/common/iServer/BuffersAnalystJobsService.js
  33025. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33026. * This program are made available under the terms of the Apache License, Version 2.0
  33027. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33028. /**
  33029. * @class BuffersAnalystJobsService
  33030. * @deprecatedclass SuperMap.BuffersAnalystJobsService
  33031. * @category iServer ProcessingService BufferAnalyst
  33032. * @classdesc 缓冲区分析服务类。
  33033. * @extends {ProcessingServiceBase}
  33034. * @param {string} url - 服务地址。
  33035. * @param {Object} options - 参数。
  33036. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  33037. * @param {Object} [options.headers] - 请求头。
  33038. * @usage
  33039. */
  33040. class BuffersAnalystJobsService extends ProcessingServiceBase {
  33041. constructor(url, options) {
  33042. super(url, options);
  33043. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/buffers');
  33044. this.CLASS_NAME = 'SuperMap.BuffersAnalystJobsService';
  33045. }
  33046. /**
  33047. *@override
  33048. */
  33049. destroy() {
  33050. super.destroy();
  33051. }
  33052. /**
  33053. * @function BuffersAnalystJobsService.prototype.getBufferJobs
  33054. * @description 获取缓冲区分析所有任务
  33055. */
  33056. getBuffersJobs() {
  33057. super.getJobs(this.url);
  33058. }
  33059. /**
  33060. * @function BuffersAnalystJobsService.prototype.getBufferJob
  33061. * @description 获取指定id的缓冲区分析服务
  33062. * @param {string} id - 指定要获取数据的id。
  33063. */
  33064. getBuffersJob(id) {
  33065. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  33066. }
  33067. /**
  33068. * @function BuffersAnalystJobsService.prototype.addBufferJob
  33069. * @description 新建缓冲区分析服务
  33070. * @param {BuffersAnalystJobsParameter} params - 创建一个空间分析的请求参数。
  33071. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  33072. */
  33073. addBuffersJob(params, seconds) {
  33074. super.addJob(this.url, params, BuffersAnalystJobsParameter, seconds);
  33075. }
  33076. }
  33077. ;// CONCATENATED MODULE: ./src/common/iServer/TopologyValidatorJobsParameter.js
  33078. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33079. * This program are made available under the terms of the Apache License, Version 2.0
  33080. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33081. /**
  33082. * @class TopologyValidatorJobsParameter
  33083. * @deprecatedclass SuperMap.TopologyValidatorJobsParameter
  33084. * @category iServer ProcessingService TopologyValidator
  33085. * @classdesc 拓扑检查分析任务参数类。
  33086. * @param {Object} options - 参数。
  33087. * @param {string} options.datasetName - 数据集名。
  33088. * @param {string} options.datasetTopology -检查对象所在的数据集名称。
  33089. * @param {TopologyValidatorRule} [options.rule=TopologyValidatorRule.REGIONNOOVERLAP] - 拓扑检查规则。
  33090. * @param {string} [options.tolerance] - 容限。
  33091. * @param {OutputSetting} [options.output] - 输出参数设置。
  33092. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  33093. * @usage
  33094. */
  33095. class TopologyValidatorJobsParameter {
  33096. constructor(options) {
  33097. if (!options) {
  33098. return;
  33099. }
  33100. /**
  33101. * @member {string} TopologyValidatorJobsParameter.prototype.datasetName
  33102. * @description 数据集名。
  33103. */
  33104. this.datasetName = "";
  33105. /**
  33106. * @member {string} TopologyValidatorJobsParameter.prototype.datasetTopology
  33107. * @description 拓扑检查对象所在的数据集名称。
  33108. */
  33109. this.datasetTopology = "";
  33110. /**
  33111. * @member {string} [TopologyValidatorJobsParameter.prototype.tolerance]
  33112. * @description 容限,指定的拓扑错误检查时使用的容限。
  33113. */
  33114. this.tolerance = "";
  33115. /**
  33116. * @member {TopologyValidatorRule} [TopologyValidatorJobsParameter.prototype.rule=TopologyValidatorRule.REGIONNOOVERLAP]
  33117. * @description 拓扑检查模式。
  33118. */
  33119. this.rule = TopologyValidatorRule.REGIONNOOVERLAP;
  33120. /**
  33121. * @member {OutputSetting} [TopologyValidatorJobsParameter.prototype.output]
  33122. * @description 输出参数设置类。
  33123. */
  33124. this.output = null;
  33125. /**
  33126. * @member {MappingParameters} [TopologyValidatorJobsParameter.prototype.mappingParameters]
  33127. * @description 分析后结果可视化的参数类。
  33128. */
  33129. this.mappingParameters = null;
  33130. Util_Util.extend(this, options);
  33131. this.CLASS_NAME = "SuperMap.TopologyValidatorJobsParameter";
  33132. }
  33133. /**
  33134. * @function TopologyValidatorJobsParameter.prototype.destroy
  33135. * @description 释放资源,将引用资源的属性置空。
  33136. */
  33137. destroy() {
  33138. this.datasetName = null;
  33139. this.datasetTopology = null;
  33140. this.tolerance = null;
  33141. this.rule = null;
  33142. if (this.output instanceof OutputSetting) {
  33143. this.output.destroy();
  33144. this.output = null;
  33145. }
  33146. if (this.mappingParameters instanceof MappingParameters) {
  33147. this.mappingParameters.destroy();
  33148. this.mappingParameters = null;
  33149. }
  33150. }
  33151. /**
  33152. * @function TopologyValidatorJobsParameter.toObject
  33153. * @param {Object} TopologyValidatorJobsParameter -拓扑检查分析任务参数。
  33154. * @param {Object} tempObj - 目标对象。
  33155. * @description 生成拓扑检查分析任务对象。
  33156. */
  33157. static toObject(TopologyValidatorJobsParameter, tempObj) {
  33158. for (var name in TopologyValidatorJobsParameter) {
  33159. if (name === "datasetName") {
  33160. tempObj['input'] = tempObj['input'] || {};
  33161. tempObj['input'][name] = TopologyValidatorJobsParameter[name];
  33162. continue;
  33163. }
  33164. if (name === "output") {
  33165. tempObj['output'] = tempObj['output'] || {};
  33166. tempObj['output'] = TopologyValidatorJobsParameter[name];
  33167. continue;
  33168. }
  33169. tempObj['analyst'] = tempObj['analyst'] || {};
  33170. tempObj['analyst'][name] = TopologyValidatorJobsParameter[name];
  33171. if(name === 'mappingParameters'){
  33172. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  33173. tempObj['analyst']['mappingParameters'] = TopologyValidatorJobsParameter[name];
  33174. }
  33175. }
  33176. }
  33177. }
  33178. ;// CONCATENATED MODULE: ./src/common/iServer/TopologyValidatorJobsService.js
  33179. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33180. * This program are made available under the terms of the Apache License, Version 2.0
  33181. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33182. /**
  33183. * @class TopologyValidatorJobsService
  33184. * @deprecatedclass SuperMap.TopologyValidatorJobsService
  33185. * @category iServer ProcessingService TopologyValidator
  33186. * @classdesc 拓扑检查分析服务类
  33187. * @extends {ProcessingServiceBase}
  33188. * @param {string} url - 服务地址。
  33189. * @param {Object} options - 可选参数。
  33190. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  33191. * @param {Object} [options.headers] - 请求头。
  33192. * @usage
  33193. */
  33194. class TopologyValidatorJobsService extends ProcessingServiceBase {
  33195. constructor(url, options) {
  33196. super(url, options);
  33197. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/topologyvalidator');
  33198. this.CLASS_NAME = "SuperMap.TopologyValidatorJobsService";
  33199. }
  33200. /**
  33201. *@override
  33202. */
  33203. destroy() {
  33204. super.destroy();
  33205. }
  33206. /**
  33207. * @function TopologyValidatorJobsService.protitype.getTopologyValidatorJobs
  33208. * @description 获取拓扑检查分析所有任务
  33209. */
  33210. getTopologyValidatorJobs() {
  33211. super.getJobs(this.url);
  33212. }
  33213. /**
  33214. * @function TopologyValidatorJobsService.protitype.getTopologyValidatorJob
  33215. * @description 获取指定id的拓扑检查分析服务
  33216. * @param {string} id - 指定要获取数据的id
  33217. */
  33218. getTopologyValidatorJob(id) {
  33219. super.getJobs( Util_Util.urlPathAppend(this.url, id));
  33220. }
  33221. /**
  33222. * @function TopologyValidatorJobsService.protitype.addTopologyValidatorJob
  33223. * @description 新建拓扑检查分析服务
  33224. * @param {TopologyValidatorJobsParameter} params - 拓扑检查分析任务参数类。
  33225. * @param {number} seconds -创建成功结果的时间间隔。
  33226. */
  33227. addTopologyValidatorJob(params, seconds) {
  33228. super.addJob(this.url, params, TopologyValidatorJobsParameter, seconds);
  33229. }
  33230. }
  33231. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryAttributesJobsParameter.js
  33232. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33233. * This program are made available under the terms of the Apache License, Version 2.0
  33234. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33235. /**
  33236. * @class SummaryAttributesJobsParameter
  33237. * @deprecatedclass SuperMap.SummaryAttributesJobsParameter
  33238. * @category iServer ProcessingService SummaryAttributes
  33239. * @classdesc 属性汇总分析任务参数类。
  33240. * @param {Object} options - 参数。
  33241. * @param {string} options.datasetName - 数据集名。
  33242. * @param {string} options.groupField - 分组字段。
  33243. * @param {string} options.attributeField - 属性字段。
  33244. * @param {string} options.statisticModes - 统计模式。
  33245. * @param {OutputSetting} [options.output] -输出参数设置。
  33246. * @param {MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  33247. * @usage
  33248. */
  33249. class SummaryAttributesJobsParameter {
  33250. constructor(options) {
  33251. if (!options) {
  33252. return;
  33253. }
  33254. /**
  33255. * @member {string} SummaryAttributesJobsParameter.prototype.datasetName
  33256. * @description 汇总数据集名称。
  33257. */
  33258. this.datasetName = "";
  33259. /**
  33260. * @member {string} SummaryAttributesJobsParameter.prototype.groupField
  33261. * @description 分组字段。
  33262. */
  33263. this.groupField = "";
  33264. /**
  33265. * @member {string} SummaryAttributesJobsParameter.prototype.attributeField
  33266. * @description 属性字段。
  33267. */
  33268. this.attributeField = "";
  33269. /**
  33270. * @member {string} SummaryAttributesJobsParameter.prototype.statisticModes
  33271. * @description 属性汇总统计模式。
  33272. */
  33273. this.statisticModes = "";
  33274. /**
  33275. * @member {OutputSetting} SummaryAttributesJobsParameter.prototype.output
  33276. * @description 输出参数设置类。
  33277. */
  33278. this.output = null;
  33279. /**
  33280. * @member {MappingParameters} [SummaryAttributesJobsParameter.prototype.mappingParameters]
  33281. * @description 分析后结果可视化的参数类。
  33282. */
  33283. this.mappingParameters = null;
  33284. Util_Util.extend(this, options);
  33285. this.CLASS_NAME = "SuperMap.SummaryAttributesJobsParameter";
  33286. }
  33287. /**
  33288. * @function SummaryAttributesJobsParameter.prototype.destroy
  33289. * @description 释放资源,将资源的属性置空。
  33290. */
  33291. destroy() {
  33292. this.datasetName = null;
  33293. this.groupField = null;
  33294. this.attributeField = null;
  33295. this.statisticModes = null;
  33296. if (this.output instanceof OutputSetting) {
  33297. this.output.destroy();
  33298. this.output = null;
  33299. }
  33300. if (this.mappingParameters instanceof MappingParameters){
  33301. this.mappingParameters.destroy();
  33302. this.mappingParameters = null;
  33303. }
  33304. }
  33305. /**
  33306. * @function SummaryAttributesJobsParameter.toObject
  33307. * @param {Object} SummaryAttributesJobsParameter - 属性汇总任务参数。
  33308. * @param {Object} tempObj - 目标对象。
  33309. * @description 生成属性汇总分析任务对象。
  33310. */
  33311. static toObject(SummaryAttributesJobsParameter, tempObj) {
  33312. for (var name in SummaryAttributesJobsParameter) {
  33313. if (name === "datasetName") {
  33314. tempObj['input'] = tempObj['input'] || {};
  33315. tempObj['input'][name] = SummaryAttributesJobsParameter[name];
  33316. continue;
  33317. }
  33318. if (name === "output") {
  33319. tempObj['output'] = tempObj['output'] || {};
  33320. tempObj['output'] = SummaryAttributesJobsParameter[name];
  33321. continue;
  33322. }
  33323. tempObj['analyst'] = tempObj['analyst'] || {};
  33324. tempObj['analyst'][name] = SummaryAttributesJobsParameter[name];
  33325. if(name === 'mappingParameters'){
  33326. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  33327. tempObj['analyst']['mappingParameters'] = SummaryAttributesJobsParameter[name];
  33328. }
  33329. }
  33330. }
  33331. }
  33332. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryAttributesJobsService.js
  33333. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33334. * This program are made available under the terms of the Apache License, Version 2.0
  33335. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33336. /**
  33337. * @class SummaryAttributesJobsService
  33338. * @deprecatedclass SuperMap.SummaryAttributesJobsService
  33339. * @category iServer ProcessingService SummaryAttributes
  33340. * @classdesc 属性汇总分析服务类
  33341. * @extends {ProcessingServiceBase}
  33342. * @param {string} url - 服务地址。
  33343. * @param {Object} options - 可选参数。
  33344. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  33345. * @param {Object} [options.headers] - 请求头。
  33346. * @usage
  33347. */
  33348. class SummaryAttributesJobsService extends ProcessingServiceBase {
  33349. constructor(url, options) {
  33350. super(url, options);
  33351. this.url = Util_Util.urlPathAppend(this.url, 'spatialanalyst/summaryattributes');
  33352. this.CLASS_NAME = "SuperMap.SummaryAttributesJobsService";
  33353. }
  33354. /**
  33355. *@override
  33356. */
  33357. destroy() {
  33358. super.destroy();
  33359. }
  33360. /**
  33361. * @function SummaryAttributesJobsService.protitype.getSummaryAttributesJobs
  33362. * @description 获取属性汇总分析所有任务
  33363. */
  33364. getSummaryAttributesJobs (){
  33365. super.getJobs(this.url);
  33366. }
  33367. /**
  33368. * @function SummaryAttributesJobsService.protitype.getSummaryAttributesJob
  33369. * @description 获取指定id的属性汇总分析服务
  33370. * @param {string} id - 指定要获取数据的id
  33371. */
  33372. getSummaryAttributesJob(id) {
  33373. super.getJobs(Util_Util.urlPathAppend(this.url, id));
  33374. }
  33375. /**
  33376. * @function SummaryAttributesJobsService.protitype.addSummaryAttributesJob
  33377. * @description 新建属性汇总分析服务
  33378. * @param {SummaryAttributesJobsParameter} params - 属性汇总分析任务参数类。
  33379. * @param {number} seconds - 创建成功结果的时间间隔。
  33380. */
  33381. addSummaryAttributesJob(params, seconds) {
  33382. super.addJob(this.url, params, SummaryAttributesJobsParameter, seconds);
  33383. }
  33384. }
  33385. ;// CONCATENATED MODULE: ./src/common/iServer/ProcessingService.js
  33386. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  33387. * This program are made available under the terms of the Apache License, Version 2.0
  33388. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33389. /**
  33390. * @class ProcessingService
  33391. * @category iServer ProcessingService
  33392. * @classdesc 分布式分析相关服务类。
  33393. * @extends {ServiceBase}
  33394. * @example
  33395. * new ProcessingService(url,options)
  33396. * .getKernelDensityJobs(function(result){
  33397. * //doSomething
  33398. * })
  33399. * @param {string} url - 服务地址。
  33400. * @param {Object} options - 参数。
  33401. * @param {string} [options.proxy] - 服务代理地址。
  33402. * @param {boolean} [options.withCredentials=false] - 请求是否携带cookie。
  33403. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  33404. * @param {Object} [options.headers] - 请求头。
  33405. * @usage
  33406. */
  33407. class ProcessingService_ProcessingService {
  33408. constructor(url, options) {
  33409. this.url = url;
  33410. this.options = options || {};
  33411. this.kernelDensityJobs = {};
  33412. this.summaryMeshJobs = {};
  33413. this.queryJobs = {};
  33414. this.summaryRegionJobs = {};
  33415. this.vectorClipJobs = {};
  33416. this.overlayGeoJobs = {};
  33417. this.buffersJobs = {};
  33418. this.topologyValidatorJobs = {};
  33419. this.summaryAttributesJobs = {};
  33420. }
  33421. /**
  33422. * @function ProcessingService.prototype.getKernelDensityJobs
  33423. * @description 获取密度分析的列表。
  33424. * @param {RequestCallback} callback - 回调函数。
  33425. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  33426. */
  33427. getKernelDensityJobs(callback, resultFormat) {
  33428. var me = this,
  33429. format = me._processFormat(resultFormat);
  33430. var kernelDensityJobsService = new KernelDensityJobsService(me.url, {
  33431. proxy: me.options.proxy,
  33432. withCredentials: me.options.withCredentials,
  33433. crossOrigin: me.options.crossOrigin,
  33434. headers: me.options.headers,
  33435. eventListeners: {
  33436. scope: me,
  33437. processCompleted: callback,
  33438. processFailed: callback
  33439. },
  33440. format: format
  33441. });
  33442. kernelDensityJobsService.getKernelDensityJobs();
  33443. }
  33444. /**
  33445. * @function ProcessingService.prototype.getKernelDensityJob
  33446. * @description 获取某个密度分析。
  33447. * @param {string} id - 空间分析的ID。
  33448. * @param {RequestCallback} callback - 回调函数。
  33449. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  33450. */
  33451. getKernelDensityJob(id, callback, resultFormat) {
  33452. var me = this,
  33453. format = me._processFormat(resultFormat);
  33454. var kernelDensityJobsService = new KernelDensityJobsService(me.url, {
  33455. proxy: me.options.proxy,
  33456. withCredentials: me.options.withCredentials,
  33457. crossOrigin: me.options.crossOrigin,
  33458. headers: me.options.headers,
  33459. eventListeners: {
  33460. scope: me,
  33461. processCompleted: callback,
  33462. processFailed: callback
  33463. },
  33464. format: format
  33465. });
  33466. kernelDensityJobsService.getKernelDensityJob(id);
  33467. }
  33468. /**
  33469. * @function ProcessingService.prototype.addKernelDensityJob
  33470. * @description 密度分析。
  33471. * @param {KernelDensityJobParameter} params -密度分析参数类。
  33472. * @param {RequestCallback} callback 回调函数。
  33473. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  33474. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  33475. */
  33476. addKernelDensityJob(params, callback, seconds, resultFormat) {
  33477. var me = this,
  33478. format = me._processFormat(resultFormat);
  33479. var kernelDensityJobsService = new KernelDensityJobsService(me.url, {
  33480. proxy: me.options.proxy,
  33481. withCredentials: me.options.withCredentials,
  33482. crossOrigin: me.options.crossOrigin,
  33483. headers: me.options.headers,
  33484. eventListeners: {
  33485. scope: me,
  33486. processCompleted: callback,
  33487. processFailed: callback,
  33488. processRunning: function (job) {
  33489. me.kernelDensityJobs[job.id] = job.state;
  33490. }
  33491. },
  33492. format: format
  33493. });
  33494. kernelDensityJobsService.addKernelDensityJob(params, seconds);
  33495. }
  33496. /**
  33497. * @function ProcessingService.prototype.getKernelDensityJobState
  33498. * @description 获取密度分析的状态。
  33499. * @param {string} id - 密度分析的id。
  33500. * @returns {Object} 密度分析的状态。
  33501. */
  33502. getKernelDensityJobState(id) {
  33503. return this.kernelDensityJobs[id];
  33504. }
  33505. /**
  33506. * @function ProcessingService.prototype.getSummaryMeshJobs
  33507. * @description 获取点聚合分析的列表。
  33508. * @param {RequestCallback} callback - 回调函数。
  33509. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  33510. */
  33511. getSummaryMeshJobs(callback, resultFormat) {
  33512. var me = this,
  33513. format = me._processFormat(resultFormat);
  33514. var summaryMeshJobsService = new SummaryMeshJobsService(me.url, {
  33515. proxy: me.options.proxy,
  33516. withCredentials: me.options.withCredentials,
  33517. crossOrigin: me.options.crossOrigin,
  33518. headers: me.options.headers,
  33519. eventListeners: {
  33520. scope: me,
  33521. processCompleted: callback,
  33522. processFailed: callback
  33523. },
  33524. format: format
  33525. });
  33526. summaryMeshJobsService.getSummaryMeshJobs();
  33527. }
  33528. /**
  33529. * @function ProcessingService.prototype.getSummaryMeshJob
  33530. * @description 获取某个点聚合分析。
  33531. * @param {string} id - 空间分析的 ID。
  33532. * @param {RequestCallback} callback - 回调函数。
  33533. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  33534. */
  33535. getSummaryMeshJob(id, callback, resultFormat) {
  33536. var me = this,
  33537. format = me._processFormat(resultFormat);
  33538. var summaryMeshJobsService = new SummaryMeshJobsService(me.url, {
  33539. proxy: me.options.proxy,
  33540. withCredentials: me.options.withCredentials,
  33541. crossOrigin: me.options.crossOrigin,
  33542. headers: me.options.headers,
  33543. eventListeners: {
  33544. scope: me,
  33545. processCompleted: callback,
  33546. processFailed: callback
  33547. },
  33548. format: format
  33549. });
  33550. summaryMeshJobsService.getSummaryMeshJob(id);
  33551. }
  33552. /**
  33553. * @function ProcessingService.prototype.addSummaryMeshJob
  33554. * @description 点聚合分析。
  33555. * @param {SummaryMeshJobParameter} params - 点聚合分析任务参数类。
  33556. * @param {RequestCallback} callback 回调函数。
  33557. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  33558. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  33559. */
  33560. addSummaryMeshJob(params, callback, seconds, resultFormat) {
  33561. var me = this,
  33562. format = me._processFormat(resultFormat);
  33563. var summaryMeshJobsService = new SummaryMeshJobsService(me.url, {
  33564. proxy: me.options.proxy,
  33565. withCredentials: me.options.withCredentials,
  33566. crossOrigin: me.options.crossOrigin,
  33567. headers: me.options.headers,
  33568. eventListeners: {
  33569. scope: me,
  33570. processCompleted: callback,
  33571. processFailed: callback,
  33572. processRunning: function (job) {
  33573. me.summaryMeshJobs[job.id] = job.state;
  33574. }
  33575. },
  33576. format: format
  33577. });
  33578. summaryMeshJobsService.addSummaryMeshJob(params, seconds);
  33579. }
  33580. /**
  33581. * @function ProcessingService.prototype.getSummaryMeshJobState
  33582. * @description 获取点聚合分析的状态。
  33583. * @param {string} id - 点聚合分析的 ID。
  33584. * @returns {Object} 点聚合分析的状态。
  33585. */
  33586. getSummaryMeshJobState(id) {
  33587. return this.summaryMeshJobs[id];
  33588. }
  33589. /**
  33590. * @function ProcessingService.prototype.getQueryJobs
  33591. * @description 获取单对象查询分析的列表。
  33592. * @param {RequestCallback} callback - 回调函数。
  33593. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  33594. */
  33595. getQueryJobs(callback, resultFormat) {
  33596. var me = this,
  33597. format = me._processFormat(resultFormat);
  33598. var singleObjectQueryJobsService = new SingleObjectQueryJobsService(me.url, {
  33599. proxy: me.options.proxy,
  33600. withCredentials: me.options.withCredentials,
  33601. crossOrigin: me.options.crossOrigin,
  33602. headers: me.options.headers,
  33603. eventListeners: {
  33604. scope: me,
  33605. processCompleted: callback,
  33606. processFailed: callback
  33607. },
  33608. format: format
  33609. });
  33610. singleObjectQueryJobsService.getQueryJobs();
  33611. }
  33612. /**
  33613. * @function ProcessingService.prototype.getQueryJob
  33614. * @description 获取某个单对象查询分析。
  33615. * @param {string} id - 空间分析的 ID。
  33616. * @param {RequestCallback} callback - 回调函数。
  33617. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  33618. */
  33619. getQueryJob(id, callback, resultFormat) {
  33620. var me = this,
  33621. format = me._processFormat(resultFormat);
  33622. var singleObjectQueryJobsService = new SingleObjectQueryJobsService(me.url, {
  33623. proxy: me.options.proxy,
  33624. withCredentials: me.options.withCredentials,
  33625. crossOrigin: me.options.crossOrigin,
  33626. headers: me.options.headers,
  33627. eventListeners: {
  33628. scope: me,
  33629. processCompleted: callback,
  33630. processFailed: callback
  33631. },
  33632. format: format
  33633. });
  33634. singleObjectQueryJobsService.getQueryJob(id);
  33635. }
  33636. /**
  33637. * @function ProcessingService.prototype.addQueryJob
  33638. * @description 单对象查询分析。
  33639. * @param {SingleObjectQueryJobsParameter} params - 单对象查询分析的请求参数。
  33640. * @param {RequestCallback} callback - 回调函数。
  33641. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  33642. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  33643. */
  33644. addQueryJob(params, callback, seconds, resultFormat) {
  33645. var me = this,
  33646. format = me._processFormat(resultFormat);
  33647. var singleObjectQueryJobsService = new SingleObjectQueryJobsService(me.url, {
  33648. proxy: me.options.proxy,
  33649. withCredentials: me.options.withCredentials,
  33650. crossOrigin: me.options.crossOrigin,
  33651. headers: me.options.headers,
  33652. eventListeners: {
  33653. scope: me,
  33654. processCompleted: callback,
  33655. processFailed: callback,
  33656. processRunning: function (job) {
  33657. me.queryJobs[job.id] = job.state;
  33658. }
  33659. },
  33660. format: format
  33661. });
  33662. singleObjectQueryJobsService.addQueryJob(params, seconds);
  33663. }
  33664. /**
  33665. * @function ProcessingService.prototype.getQueryJobState
  33666. * @description 获取单对象查询分析的状态。
  33667. * @param {string} id - 单对象查询分析的 ID。
  33668. * @returns {Object} 单对象查询分析的状态。
  33669. */
  33670. getQueryJobState(id) {
  33671. return this.queryJobs[id];
  33672. }
  33673. /**
  33674. * @function ProcessingService.prototype.getSummaryRegionJobs
  33675. * @description 获取区域汇总分析的列表。
  33676. * @param {RequestCallback} callback - 回调函数。
  33677. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  33678. */
  33679. getSummaryRegionJobs(callback, resultFormat) {
  33680. var me = this,
  33681. format = me._processFormat(resultFormat);
  33682. var summaryRegionJobsService = new SummaryRegionJobsService(me.url, {
  33683. proxy: me.options.proxy,
  33684. withCredentials: me.options.withCredentials,
  33685. crossOrigin: me.options.crossOrigin,
  33686. headers: me.options.headers,
  33687. eventListeners: {
  33688. scope: me,
  33689. processCompleted: callback,
  33690. processFailed: callback
  33691. },
  33692. format: format
  33693. });
  33694. summaryRegionJobsService.getSummaryRegionJobs();
  33695. }
  33696. /**
  33697. * @function ProcessingService.prototype.getSummaryRegionJob
  33698. * @description 获取某个区域汇总分析。
  33699. * @param {string} id - 区域汇总分析的 ID。
  33700. * @param {RequestCallback} callback - 回调函数。
  33701. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  33702. */
  33703. getSummaryRegionJob(id, callback, resultFormat) {
  33704. var me = this,
  33705. format = me._processFormat(resultFormat);
  33706. var summaryRegionJobsService = new SummaryRegionJobsService(me.url, {
  33707. proxy: me.options.proxy,
  33708. withCredentials: me.options.withCredentials,
  33709. crossOrigin: me.options.crossOrigin,
  33710. headers: me.options.headers,
  33711. eventListeners: {
  33712. scope: me,
  33713. processCompleted: callback,
  33714. processFailed: callback
  33715. },
  33716. format: format
  33717. });
  33718. summaryRegionJobsService.getSummaryRegionJob(id);
  33719. }
  33720. /**
  33721. * @function ProcessingService.prototype.addSummaryRegionJob
  33722. * @description 区域汇总分析。
  33723. * @param {SummaryRegionJobParameter} params - 区域汇总分析参数类。
  33724. * @param {RequestCallback} callback - 回调函数。
  33725. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  33726. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  33727. */
  33728. addSummaryRegionJob(params, callback, seconds, resultFormat) {
  33729. var me = this,
  33730. format = me._processFormat(resultFormat);
  33731. var summaryRegionJobsService = new SummaryRegionJobsService(me.url, {
  33732. proxy: me.options.proxy,
  33733. withCredentials: me.options.withCredentials,
  33734. crossOrigin: me.options.crossOrigin,
  33735. headers: me.options.headers,
  33736. eventListeners: {
  33737. scope: me,
  33738. processCompleted: callback,
  33739. processFailed: callback,
  33740. processRunning: function (job) {
  33741. me.summaryRegionJobs[job.id] = job.state;
  33742. }
  33743. },
  33744. format: format
  33745. });
  33746. summaryRegionJobsService.addSummaryRegionJob(params, seconds);
  33747. }
  33748. /**
  33749. * @function ProcessingService.prototype.getSummaryRegionJobState
  33750. * @description 获取区域汇总分析的状态。
  33751. * @param {string} id - 生成区域汇总分析的 ID。
  33752. * @returns {Object} 区域汇总分析的状态。
  33753. */
  33754. getSummaryRegionJobState(id) {
  33755. return this.summaryRegionJobs[id];
  33756. }
  33757. /**
  33758. * @function ProcessingService.prototype.getVectorClipJobs
  33759. * @description 获取矢量裁剪分析的列表。
  33760. * @param {RequestCallback} callback - 回调函数。
  33761. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  33762. */
  33763. getVectorClipJobs(callback, resultFormat) {
  33764. var me = this,
  33765. format = me._processFormat(resultFormat);
  33766. var vectorClipJobsService = new VectorClipJobsService(me.url, {
  33767. proxy: me.options.proxy,
  33768. withCredentials: me.options.withCredentials,
  33769. crossOrigin: me.options.crossOrigin,
  33770. headers: me.options.headers,
  33771. eventListeners: {
  33772. scope: me,
  33773. processCompleted: callback,
  33774. processFailed: callback
  33775. },
  33776. format: format
  33777. });
  33778. vectorClipJobsService.getVectorClipJobs();
  33779. }
  33780. /**
  33781. * @function ProcessingService.prototype.getVectorClipJob
  33782. * @description 获取某个矢量裁剪分析。
  33783. * @param {string} id - 空间分析的 ID。
  33784. * @param {RequestCallback} callback - 回调函数。
  33785. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  33786. */
  33787. getVectorClipJob(id, callback, resultFormat) {
  33788. var me = this,
  33789. format = me._processFormat(resultFormat);
  33790. var vectorClipJobsService = new VectorClipJobsService(me.url, {
  33791. proxy: me.options.proxy,
  33792. withCredentials: me.options.withCredentials,
  33793. crossOrigin: me.options.crossOrigin,
  33794. headers: me.options.headers,
  33795. eventListeners: {
  33796. scope: me,
  33797. processCompleted: callback,
  33798. processFailed: callback
  33799. },
  33800. format: format
  33801. });
  33802. vectorClipJobsService.getVectorClipJob(id);
  33803. }
  33804. /**
  33805. * @function ProcessingService.prototype.addVectorClipJob
  33806. * @description 矢量裁剪分析。
  33807. * @param {VectorClipJobsParameter} params - 矢量裁剪分析请求参数类。
  33808. * @param {RequestCallback} callback - 回调函数。
  33809. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  33810. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  33811. */
  33812. addVectorClipJob(params, callback, seconds, resultFormat) {
  33813. var me = this,
  33814. format = me._processFormat(resultFormat);
  33815. var vectorClipJobsService = new VectorClipJobsService(me.url, {
  33816. proxy: me.options.proxy,
  33817. withCredentials: me.options.withCredentials,
  33818. crossOrigin: me.options.crossOrigin,
  33819. headers: me.options.headers,
  33820. eventListeners: {
  33821. scope: me,
  33822. processCompleted: callback,
  33823. processFailed: callback,
  33824. processRunning: function (job) {
  33825. me.vectorClipJobs[job.id] = job.state;
  33826. }
  33827. },
  33828. format: format
  33829. });
  33830. vectorClipJobsService.addVectorClipJob(params, seconds);
  33831. }
  33832. /**
  33833. * @function ProcessingService.prototype.getVectorClipJobState
  33834. * @description 获取矢量裁剪分析的状态。
  33835. * @param {number} id - 矢量裁剪分析的ID。
  33836. * @returns {Object} 矢量裁剪分析的状态。
  33837. */
  33838. getVectorClipJobState(id) {
  33839. return this.vectorClipJobs[id];
  33840. }
  33841. /**
  33842. * @function ProcessingService.prototype.getOverlayGeoJobs
  33843. * @description 获取叠加分析的列表。
  33844. * @param {RequestCallback} callback - 回调函数。
  33845. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  33846. */
  33847. getOverlayGeoJobs(callback, resultFormat) {
  33848. var me = this,
  33849. format = me._processFormat(resultFormat);
  33850. var overlayGeoJobsService = new OverlayGeoJobsService(me.url, {
  33851. proxy: me.options.proxy,
  33852. withCredentials: me.options.withCredentials,
  33853. crossOrigin: me.options.crossOrigin,
  33854. headers: me.options.headers,
  33855. eventListeners: {
  33856. scope: me,
  33857. processCompleted: callback,
  33858. processFailed: callback
  33859. },
  33860. format: format
  33861. });
  33862. overlayGeoJobsService.getOverlayGeoJobs();
  33863. }
  33864. /**
  33865. * @function ProcessingService.prototype.getOverlayGeoJob
  33866. * @description 获取某个叠加分析。
  33867. * @param {string} id - 空间分析的 ID。
  33868. * @param {RequestCallback} callback - 回调函数。
  33869. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  33870. */
  33871. getOverlayGeoJob(id, callback, resultFormat) {
  33872. var me = this,
  33873. format = me._processFormat(resultFormat);
  33874. var overlayGeoJobsService = new OverlayGeoJobsService(me.url, {
  33875. proxy: me.options.proxy,
  33876. withCredentials: me.options.withCredentials,
  33877. crossOrigin: me.options.crossOrigin,
  33878. headers: me.options.headers,
  33879. eventListeners: {
  33880. scope: me,
  33881. processCompleted: callback,
  33882. processFailed: callback
  33883. },
  33884. format: format
  33885. });
  33886. overlayGeoJobsService.getOverlayGeoJob(id);
  33887. }
  33888. /**
  33889. * @function ProcessingService.prototype.addOverlayGeoJob
  33890. * @description 叠加分析。
  33891. * @param {OverlayGeoJobParameter} params - 叠加分析请求参数类。
  33892. * @param {RequestCallback} callback - 回调函数。
  33893. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  33894. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  33895. */
  33896. addOverlayGeoJob(params, callback, seconds, resultFormat) {
  33897. var me = this,
  33898. format = me._processFormat(resultFormat);
  33899. var overlayGeoJobsService = new OverlayGeoJobsService(me.url, {
  33900. proxy: me.options.proxy,
  33901. withCredentials: me.options.withCredentials,
  33902. crossOrigin: me.options.crossOrigin,
  33903. headers: me.options.headers,
  33904. eventListeners: {
  33905. scope: me,
  33906. processCompleted: callback,
  33907. processFailed: callback,
  33908. processRunning: function (job) {
  33909. me.overlayGeoJobs[job.id] = job.state;
  33910. }
  33911. },
  33912. format: format
  33913. });
  33914. overlayGeoJobsService.addOverlayGeoJob(params, seconds);
  33915. }
  33916. /**
  33917. * @function ProcessingService.prototype.getoverlayGeoJobState
  33918. * @description 获取叠加分析的状态。
  33919. * @param {string} id - 叠加分析的 ID。
  33920. * @returns {Object} 叠加分析的状态。
  33921. */
  33922. getoverlayGeoJobState(id) {
  33923. return this.overlayGeoJobs[id];
  33924. }
  33925. /**
  33926. * @function ProcessingService.prototype.getBuffersJobs
  33927. * @description 获取缓冲区分析的列表。
  33928. * @param {RequestCallback} callback - 回调函数。
  33929. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  33930. */
  33931. getBuffersJobs(callback, resultFormat) {
  33932. var me = this,
  33933. format = me._processFormat(resultFormat);
  33934. var buffersAnalystJobsService = new BuffersAnalystJobsService(me.url, {
  33935. proxy: me.options.proxy,
  33936. withCredentials: me.options.withCredentials,
  33937. crossOrigin: me.options.crossOrigin,
  33938. headers: me.options.headers,
  33939. eventListeners: {
  33940. scope: me,
  33941. processCompleted: callback,
  33942. processFailed: callback
  33943. },
  33944. format: format
  33945. });
  33946. buffersAnalystJobsService.getBuffersJobs();
  33947. }
  33948. /**
  33949. * @function ProcessingService.prototype.getBuffersJob
  33950. * @description 获取某个缓冲区分析。
  33951. * @param {string} id - 空间分析的 ID。
  33952. * @param {RequestCallback} callback - 回调函数。
  33953. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  33954. */
  33955. getBuffersJob(id, callback, resultFormat) {
  33956. var me = this,
  33957. format = me._processFormat(resultFormat);
  33958. var buffersAnalystJobsService = new BuffersAnalystJobsService(me.url, {
  33959. proxy: me.options.proxy,
  33960. withCredentials: me.options.withCredentials,
  33961. crossOrigin: me.options.crossOrigin,
  33962. headers: me.options.headers,
  33963. eventListeners: {
  33964. scope: me,
  33965. processCompleted: callback,
  33966. processFailed: callback
  33967. },
  33968. format: format
  33969. });
  33970. buffersAnalystJobsService.getBuffersJob(id);
  33971. }
  33972. /**
  33973. * @function ProcessingService.prototype.addBuffersJob
  33974. * @description 缓冲区分析。
  33975. * @param {BuffersAnalystJobsParameter} params - 缓冲区分析请求参数类。
  33976. * @param {RequestCallback} callback - 回调函数。
  33977. * @param {number} seconds - 获取创建成功结果的时间间隔。
  33978. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  33979. */
  33980. addBuffersJob(params, callback, seconds, resultFormat) {
  33981. var me = this,
  33982. format = me._processFormat(resultFormat);
  33983. var buffersAnalystJobsService = new BuffersAnalystJobsService(me.url, {
  33984. proxy: me.options.proxy,
  33985. withCredentials: me.options.withCredentials,
  33986. crossOrigin: me.options.crossOrigin,
  33987. headers: me.options.headers,
  33988. eventListeners: {
  33989. scope: me,
  33990. processCompleted: callback,
  33991. processFailed: callback,
  33992. processRunning: function (job) {
  33993. me.buffersJobs[job.id] = job.state;
  33994. }
  33995. },
  33996. format: format
  33997. });
  33998. buffersAnalystJobsService.addBuffersJob(params, seconds);
  33999. }
  34000. /**
  34001. * @function ProcessingService.prototype.getBuffersJobState
  34002. * @description 获取缓冲区分析的状态。
  34003. * @param {string} id - 缓冲区分析的 ID。
  34004. * @returns {Object} 缓冲区分析的状态。
  34005. */
  34006. getBuffersJobState(id) {
  34007. return this.buffersJobs[id];
  34008. }
  34009. /**
  34010. * @function ProcessingService.prototype.getTopologyValidatorJobs
  34011. * @description 获取拓扑检查分析的列表。
  34012. * @param {RequestCallback} callback - 回调函数。
  34013. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34014. */
  34015. getTopologyValidatorJobs(callback, resultFormat) {
  34016. var me = this,
  34017. format = me._processFormat(resultFormat);
  34018. var topologyValidatorJobsService = new TopologyValidatorJobsService(me.url, {
  34019. proxy: me.options.proxy,
  34020. withCredentials: me.options.withCredentials,
  34021. crossOrigin: me.options.crossOrigin,
  34022. headers: me.options.headers,
  34023. eventListeners: {
  34024. scope: me,
  34025. processCompleted: callback,
  34026. processFailed: callback
  34027. },
  34028. format: format
  34029. });
  34030. topologyValidatorJobsService.getTopologyValidatorJobs();
  34031. }
  34032. /**
  34033. * @function ProcessingService.prototype.getTopologyValidatorJob
  34034. * @description 获取某个拓扑检查分析。
  34035. * @param {string} id - 空间分析的 ID。
  34036. * @param {RequestCallback} callback - 回调函数。
  34037. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34038. */
  34039. getTopologyValidatorJob(id, callback, resultFormat) {
  34040. var me = this,
  34041. format = me._processFormat(resultFormat);
  34042. var topologyValidatorJobsService = new TopologyValidatorJobsService(me.url, {
  34043. proxy: me.options.proxy,
  34044. withCredentials: me.options.withCredentials,
  34045. crossOrigin: me.options.crossOrigin,
  34046. headers: me.options.headers,
  34047. eventListeners: {
  34048. scope: me,
  34049. processCompleted: callback,
  34050. processFailed: callback
  34051. },
  34052. format: format
  34053. });
  34054. topologyValidatorJobsService.getTopologyValidatorJob(id);
  34055. }
  34056. /**
  34057. * @function ProcessingService.prototype.addTopologyValidatorJob
  34058. * @description 拓扑检查分析。
  34059. * @param {TopologyValidatorJobsParameter} params - 拓扑检查分析请求参数类。
  34060. * @param {RequestCallback} callback - 回调函数。
  34061. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  34062. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34063. */
  34064. addTopologyValidatorJob(params, callback, seconds, resultFormat) {
  34065. var me = this,
  34066. format = me._processFormat(resultFormat);
  34067. var topologyValidatorJobsService = new TopologyValidatorJobsService(me.url, {
  34068. proxy: me.options.proxy,
  34069. withCredentials: me.options.withCredentials,
  34070. crossOrigin: me.options.crossOrigin,
  34071. headers: me.options.headers,
  34072. eventListeners: {
  34073. scope: me,
  34074. processCompleted: callback,
  34075. processFailed: callback,
  34076. processRunning: function (job) {
  34077. me.topologyValidatorJobs[job.id] = job.state;
  34078. }
  34079. },
  34080. format: format
  34081. });
  34082. topologyValidatorJobsService.addTopologyValidatorJob(params, seconds);
  34083. }
  34084. /**
  34085. * @function ProcessingService.prototype.getTopologyValidatorJobState
  34086. * @description 获取拓扑检查分析的状态。
  34087. * @param {string} id - 拓扑检查分析的 ID。
  34088. * @returns {Object} 拓扑检查分析的状态。
  34089. */
  34090. getTopologyValidatorJobState(id) {
  34091. return this.topologyValidatorJobs[id];
  34092. }
  34093. /**
  34094. * @function ProcessingService.prototype.getSummaryAttributesJobs
  34095. * @description 获取属性汇总分析的列表。
  34096. * @param {RequestCallback} callback - 回调函数。
  34097. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34098. */
  34099. getSummaryAttributesJobs(callback, resultFormat) {
  34100. var me = this,
  34101. format = me._processFormat(resultFormat);
  34102. var summaryAttributesJobsService = new SummaryAttributesJobsService(me.url, {
  34103. proxy: me.options.proxy,
  34104. withCredentials: me.options.withCredentials,
  34105. crossOrigin: me.options.crossOrigin,
  34106. headers: me.options.headers,
  34107. eventListeners: {
  34108. scope: me,
  34109. processCompleted: callback,
  34110. processFailed: callback
  34111. },
  34112. format: format
  34113. });
  34114. summaryAttributesJobsService.getSummaryAttributesJobs();
  34115. }
  34116. /**
  34117. * @function ProcessingService.prototype.getSummaryAttributesJob
  34118. * @description 获取某个属性汇总分析。
  34119. * @param {string} id - 空间分析的 ID。
  34120. * @param {RequestCallback} callback - 回调函数。
  34121. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34122. */
  34123. getSummaryAttributesJob(id, callback, resultFormat) {
  34124. var me = this,
  34125. format = me._processFormat(resultFormat);
  34126. var summaryAttributesJobsService = new SummaryAttributesJobsService(me.url, {
  34127. proxy: me.options.proxy,
  34128. withCredentials: me.options.withCredentials,
  34129. crossOrigin: me.options.crossOrigin,
  34130. headers: me.options.headers,
  34131. eventListeners: {
  34132. scope: me,
  34133. processCompleted: callback,
  34134. processFailed: callback
  34135. },
  34136. format: format
  34137. });
  34138. summaryAttributesJobsService.getSummaryAttributesJob(id);
  34139. }
  34140. /**
  34141. * @function ProcessingService.prototype.addSummaryAttributesJob
  34142. * @description 属性汇总分析。
  34143. * @param {SummaryAttributesJobsParameter} params - 属性汇总分析参数类。
  34144. * @param {RequestCallback} callback - 回调函数。
  34145. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  34146. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34147. */
  34148. addSummaryAttributesJob(params, callback, seconds, resultFormat) {
  34149. var me = this,
  34150. format = me._processFormat(resultFormat);
  34151. var summaryAttributesJobsService = new SummaryAttributesJobsService(me.url, {
  34152. proxy: me.options.proxy,
  34153. withCredentials: me.options.withCredentials,
  34154. crossOrigin: me.options.crossOrigin,
  34155. headers: me.options.headers,
  34156. eventListeners: {
  34157. scope: me,
  34158. processCompleted: callback,
  34159. processFailed: callback,
  34160. processRunning: function (job) {
  34161. me.summaryAttributesJobs[job.id] = job.state;
  34162. }
  34163. },
  34164. format: format
  34165. });
  34166. summaryAttributesJobsService.addSummaryAttributesJob(params, seconds);
  34167. }
  34168. /**
  34169. * @function ProcessingService.prototype.getSummaryAttributesJobState
  34170. * @description 获取属性汇总分析的状态。
  34171. * @param {string} id - 属性汇总分析的 ID。
  34172. * @returns {Object} 属性汇总分析的状态
  34173. */
  34174. getSummaryAttributesJobState(id) {
  34175. return this.summaryAttributesJobs[id];
  34176. }
  34177. _processFormat(resultFormat) {
  34178. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  34179. }
  34180. }
  34181. ;// CONCATENATED MODULE: ./src/maplibregl/services/ProcessingService.js
  34182. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34183. * This program are made available under the terms of the Apache License, Version 2.0
  34184. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34185. /**
  34186. * @class ProcessingService
  34187. * @category iServer ProcessingService
  34188. * @classdesc 分布式分析相关服务类。
  34189. * @version 11.1.0
  34190. * @modulecategory Services
  34191. * @extends {ServiceBase}
  34192. * @example
  34193. * new ProcessingService(url,options)
  34194. * .getKernelDensityJobs(function(result){
  34195. * //doSomething
  34196. * })
  34197. * @param {string} url - 服务地址。
  34198. * @param {Object} options - 参数。
  34199. * @param {string} [options.proxy] - 服务代理地址。
  34200. * @param {boolean} [options.withCredentials=false] - 请求是否携带cookie。
  34201. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  34202. * @param {Object} [options.headers] - 请求头。
  34203. * @usage
  34204. */
  34205. class ProcessingService extends ServiceBase {
  34206. constructor(url, options) {
  34207. super(url, options);
  34208. this._processingService = new ProcessingService_ProcessingService(url, options);
  34209. }
  34210. /**
  34211. * @function ProcessingService.prototype.getKernelDensityJobs
  34212. * @description 获取密度分析的列表。
  34213. * @param {RequestCallback} callback - 回调函数。
  34214. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34215. */
  34216. getKernelDensityJobs(callback, resultFormat) {
  34217. this._processingService.getKernelDensityJobs(callback, resultFormat);
  34218. }
  34219. /**
  34220. * @function ProcessingService.prototype.getKernelDensityJob
  34221. * @description 获取某个密度分析。
  34222. * @param {string} id - 空间分析的ID。
  34223. * @param {RequestCallback} callback - 回调函数。
  34224. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34225. */
  34226. getKernelDensityJob(id, callback, resultFormat) {
  34227. this._processingService.getKernelDensityJob(id, callback, resultFormat);
  34228. }
  34229. /**
  34230. * @function ProcessingService.prototype.addKernelDensityJob
  34231. * @description 密度分析。
  34232. * @param {KernelDensityJobParameter} params -密度分析参数类。
  34233. * @param {RequestCallback} callback 回调函数。
  34234. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  34235. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34236. */
  34237. addKernelDensityJob(params, callback, seconds, resultFormat) {
  34238. params = this._processParams(params);
  34239. this._processingService.addKernelDensityJob(params, callback, seconds, resultFormat);
  34240. }
  34241. /**
  34242. * @function ProcessingService.prototype.getKernelDensityJobState
  34243. * @description 获取密度分析的状态。
  34244. * @param {string} id - 密度分析的id。
  34245. * @returns {Object} 密度分析的状态。
  34246. */
  34247. getKernelDensityJobState(id) {
  34248. return this._processingService.getKernelDensityJobState(id);
  34249. }
  34250. /**
  34251. * @function ProcessingService.prototype.getSummaryMeshJobs
  34252. * @description 获取点聚合分析的列表。
  34253. * @param {RequestCallback} callback - 回调函数。
  34254. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34255. */
  34256. getSummaryMeshJobs(callback, resultFormat) {
  34257. this._processingService.getSummaryMeshJobs(callback, resultFormat);
  34258. }
  34259. /**
  34260. * @function ProcessingService.prototype.getSummaryMeshJob
  34261. * @description 获取某个点聚合分析。
  34262. * @param {string} id - 空间分析的 ID。
  34263. * @param {RequestCallback} callback - 回调函数。
  34264. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34265. */
  34266. getSummaryMeshJob(id, callback, resultFormat) {
  34267. this._processingService.getSummaryMeshJob(id, callback, resultFormat);
  34268. }
  34269. /**
  34270. * @function ProcessingService.prototype.addSummaryMeshJob
  34271. * @description 点聚合分析。
  34272. * @param {SummaryMeshJobParameter} params - 点聚合分析任务参数类。
  34273. * @param {RequestCallback} callback 回调函数。
  34274. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  34275. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34276. */
  34277. addSummaryMeshJob(params, callback, seconds, resultFormat) {
  34278. params = this._processParams(params);
  34279. this._processingService.addSummaryMeshJob(params, callback, seconds, resultFormat);
  34280. }
  34281. /**
  34282. * @function ProcessingService.prototype.getSummaryMeshJobState
  34283. * @description 获取点聚合分析的状态。
  34284. * @param {string} id - 点聚合分析的 ID。
  34285. * @returns {Object} 点聚合分析的状态。
  34286. */
  34287. getSummaryMeshJobState(id) {
  34288. return this._processingService.getSummaryMeshJobState(id);
  34289. }
  34290. /**
  34291. * @function ProcessingService.prototype.getQueryJobs
  34292. * @description 获取单对象查询分析的列表。
  34293. * @param {RequestCallback} callback - 回调函数。
  34294. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34295. */
  34296. getQueryJobs(callback, resultFormat) {
  34297. this._processingService.getQueryJobs(callback, resultFormat);
  34298. }
  34299. /**
  34300. * @function ProcessingService.prototype.getQueryJob
  34301. * @description 获取某个单对象查询分析。
  34302. * @param {string} id - 空间分析的 ID。
  34303. * @param {RequestCallback} callback - 回调函数。
  34304. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34305. */
  34306. getQueryJob(id, callback, resultFormat) {
  34307. this._processingService.getQueryJob(id, callback, resultFormat);
  34308. }
  34309. /**
  34310. * @function ProcessingService.prototype.addQueryJob
  34311. * @description 单对象查询分析。
  34312. * @param {SingleObjectQueryJobsParameter} params - 单对象查询分析的请求参数。
  34313. * @param {RequestCallback} callback - 回调函数。
  34314. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  34315. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34316. */
  34317. addQueryJob(params, callback, seconds, resultFormat) {
  34318. params = this._processParams(params);
  34319. this._processingService.addQueryJob(params, callback, seconds, resultFormat);
  34320. }
  34321. /**
  34322. * @function ProcessingService.prototype.getQueryJobState
  34323. * @description 获取单对象查询分析的状态。
  34324. * @param {string} id - 单对象查询分析的 ID。
  34325. * @returns {Object} 单对象查询分析的状态。
  34326. */
  34327. getQueryJobState(id) {
  34328. return this._processingService.getQueryJobState(id);
  34329. }
  34330. /**
  34331. * @function ProcessingService.prototype.getSummaryRegionJobs
  34332. * @description 获取区域汇总分析的列表。
  34333. * @param {RequestCallback} callback - 回调函数。
  34334. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34335. */
  34336. getSummaryRegionJobs(callback, resultFormat) {
  34337. this._processingService.getSummaryRegionJobs(callback, resultFormat);
  34338. }
  34339. /**
  34340. * @function ProcessingService.prototype.getSummaryRegionJob
  34341. * @description 获取某个区域汇总分析。
  34342. * @param {string} id - 区域汇总分析的 ID。
  34343. * @param {RequestCallback} callback - 回调函数。
  34344. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34345. */
  34346. getSummaryRegionJob(id, callback, resultFormat) {
  34347. this._processingService.getSummaryRegionJob(id, callback, resultFormat);
  34348. }
  34349. /**
  34350. * @function ProcessingService.prototype.addSummaryRegionJob
  34351. * @description 区域汇总分析。
  34352. * @param {SummaryRegionJobParameter} params - 区域汇总分析参数类。
  34353. * @param {RequestCallback} callback - 回调函数。
  34354. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  34355. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34356. */
  34357. addSummaryRegionJob(params, callback, seconds, resultFormat) {
  34358. params = this._processParams(params);
  34359. this._processingService.addSummaryRegionJob(params, callback, seconds, resultFormat);
  34360. }
  34361. /**
  34362. * @function ProcessingService.prototype.getSummaryRegionJobState
  34363. * @description 获取区域汇总分析的状态。
  34364. * @param {string} id - 生成区域汇总分析的 ID。
  34365. * @returns {Object} 区域汇总分析的状态。
  34366. */
  34367. getSummaryRegionJobState(id) {
  34368. return this._processingService.getSummaryRegionJobState(id);
  34369. }
  34370. /**
  34371. * @function ProcessingService.prototype.getVectorClipJobs
  34372. * @description 获取矢量裁剪分析的列表。
  34373. * @param {RequestCallback} callback - 回调函数。
  34374. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34375. */
  34376. getVectorClipJobs(callback, resultFormat) {
  34377. this._processingService.getVectorClipJobs(callback, resultFormat);
  34378. }
  34379. /**
  34380. * @function ProcessingService.prototype.getVectorClipJob
  34381. * @description 获取某个矢量裁剪分析。
  34382. * @param {string} id - 空间分析的 ID。
  34383. * @param {RequestCallback} callback - 回调函数。
  34384. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34385. */
  34386. getVectorClipJob(id, callback, resultFormat) {
  34387. this._processingService.getVectorClipJob(id, callback, resultFormat);
  34388. }
  34389. /**
  34390. * @function ProcessingService.prototype.addVectorClipJob
  34391. * @description 矢量裁剪分析。
  34392. * @param {VectorClipJobsParameter} params - 矢量裁剪分析请求参数类。
  34393. * @param {RequestCallback} callback - 回调函数。
  34394. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  34395. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34396. */
  34397. addVectorClipJob(params, callback, seconds, resultFormat) {
  34398. params = this._processParams(params);
  34399. this._processingService.addVectorClipJob(params, callback, seconds, resultFormat);
  34400. }
  34401. /**
  34402. * @function ProcessingService.prototype.getVectorClipJobState
  34403. * @description 获取矢量裁剪分析的状态。
  34404. * @param {number} id - 矢量裁剪分析的ID。
  34405. * @returns {Object} 矢量裁剪分析的状态。
  34406. */
  34407. getVectorClipJobState(id) {
  34408. return this._processingService.getVectorClipJobState(id);
  34409. }
  34410. /**
  34411. * @function ProcessingService.prototype.getOverlayGeoJobs
  34412. * @description 获取叠加分析的列表。
  34413. * @param {RequestCallback} callback - 回调函数。
  34414. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34415. */
  34416. getOverlayGeoJobs(callback, resultFormat) {
  34417. this._processingService.getOverlayGeoJobs(callback, resultFormat);
  34418. }
  34419. /**
  34420. * @function ProcessingService.prototype.getOverlayGeoJob
  34421. * @description 获取某个叠加分析。
  34422. * @param {string} id - 空间分析的 ID。
  34423. * @param {RequestCallback} callback - 回调函数。
  34424. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34425. */
  34426. getOverlayGeoJob(id, callback, resultFormat) {
  34427. this._processingService.getOverlayGeoJob(id, callback, resultFormat);
  34428. }
  34429. /**
  34430. * @function ProcessingService.prototype.addOverlayGeoJob
  34431. * @description 叠加分析。
  34432. * @param {OverlayGeoJobParameter} params - 叠加分析请求参数类。
  34433. * @param {RequestCallback} callback - 回调函数。
  34434. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  34435. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34436. */
  34437. addOverlayGeoJob(params, callback, seconds, resultFormat) {
  34438. params = this._processParams(params);
  34439. this._processingService.addOverlayGeoJob(params, callback, seconds, resultFormat);
  34440. }
  34441. /**
  34442. * @function ProcessingService.prototype.getoverlayGeoJobState
  34443. * @description 获取叠加分析的状态。
  34444. * @param {string} id - 叠加分析的 ID。
  34445. * @returns {Object} 叠加分析的状态。
  34446. */
  34447. getoverlayGeoJobState(id) {
  34448. return this._processingService.getoverlayGeoJobState(id);
  34449. }
  34450. /**
  34451. * @function ProcessingService.prototype.getBuffersJobs
  34452. * @description 获取缓冲区分析的列表。
  34453. * @param {RequestCallback} callback - 回调函数。
  34454. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34455. */
  34456. getBuffersJobs(callback, resultFormat) {
  34457. this._processingService.getBuffersJobs(callback, resultFormat);
  34458. }
  34459. /**
  34460. * @function ProcessingService.prototype.getBuffersJob
  34461. * @description 获取某个缓冲区分析。
  34462. * @param {string} id - 空间分析的 ID。
  34463. * @param {RequestCallback} callback - 回调函数。
  34464. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34465. */
  34466. getBuffersJob(id, callback, resultFormat) {
  34467. this._processingService.getBuffersJob(id, callback, resultFormat);
  34468. }
  34469. /**
  34470. * @function ProcessingService.prototype.addBuffersJob
  34471. * @description 缓冲区分析。
  34472. * @param {BuffersAnalystJobsParameter} params - 缓冲区分析请求参数类。
  34473. * @param {RequestCallback} callback - 回调函数。
  34474. * @param {number} seconds - 获取创建成功结果的时间间隔。
  34475. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34476. */
  34477. addBuffersJob(params, callback, seconds, resultFormat) {
  34478. params = this._processParams(params);
  34479. this._processingService.addBuffersJob(params, callback, seconds, resultFormat);
  34480. }
  34481. /**
  34482. * @function ProcessingService.prototype.getBuffersJobState
  34483. * @description 获取缓冲区分析的状态。
  34484. * @param {string} id - 缓冲区分析的 ID。
  34485. * @returns {Object} 缓冲区分析的状态。
  34486. */
  34487. getBuffersJobState(id) {
  34488. return this._processingService.getBuffersJobState(id);
  34489. }
  34490. /**
  34491. * @function ProcessingService.prototype.getTopologyValidatorJobs
  34492. * @description 获取拓扑检查分析的列表。
  34493. * @param {RequestCallback} callback - 回调函数。
  34494. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34495. */
  34496. getTopologyValidatorJobs(callback, resultFormat) {
  34497. this._processingService.getTopologyValidatorJobs(callback, resultFormat);
  34498. }
  34499. /**
  34500. * @function ProcessingService.prototype.getTopologyValidatorJob
  34501. * @description 获取某个拓扑检查分析。
  34502. * @param {string} id - 空间分析的 ID。
  34503. * @param {RequestCallback} callback - 回调函数。
  34504. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34505. */
  34506. getTopologyValidatorJob(id, callback, resultFormat) {
  34507. this._processingService.getTopologyValidatorJob(id, callback, resultFormat);
  34508. }
  34509. /**
  34510. * @function ProcessingService.prototype.addTopologyValidatorJob
  34511. * @description 拓扑检查分析。
  34512. * @param {TopologyValidatorJobsParameter} params - 拓扑检查分析请求参数类。
  34513. * @param {RequestCallback} callback - 回调函数。
  34514. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  34515. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34516. */
  34517. addTopologyValidatorJob(params, callback, seconds, resultFormat) {
  34518. params = this._processParams(params);
  34519. this._processingService.addTopologyValidatorJob(params, callback, seconds, resultFormat);
  34520. }
  34521. /**
  34522. * @function ProcessingService.prototype.getTopologyValidatorJobState
  34523. * @description 获取拓扑检查分析的状态。
  34524. * @param {string} id - 拓扑检查分析的 ID。
  34525. * @returns {Object} 拓扑检查分析的状态。
  34526. */
  34527. getTopologyValidatorJobState(id) {
  34528. return this._processingService.getTopologyValidatorJobState(id);
  34529. }
  34530. /**
  34531. * @function ProcessingService.prototype.getSummaryAttributesJobs
  34532. * @description 获取属性汇总分析的列表。
  34533. * @param {RequestCallback} callback - 回调函数。
  34534. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34535. */
  34536. getSummaryAttributesJobs(callback, resultFormat) {
  34537. this._processingService.getSummaryAttributesJobs(callback, resultFormat);
  34538. }
  34539. /**
  34540. * @function ProcessingService.prototype.getSummaryAttributesJob
  34541. * @description 获取某个属性汇总分析。
  34542. * @param {string} id - 空间分析的 ID。
  34543. * @param {RequestCallback} callback - 回调函数。
  34544. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34545. */
  34546. getSummaryAttributesJob(id, callback, resultFormat) {
  34547. this._processingService.getSummaryAttributesJob(id, callback, resultFormat);
  34548. }
  34549. /**
  34550. * @function ProcessingService.prototype.addSummaryAttributesJob
  34551. * @description 属性汇总分析。
  34552. * @param {SummaryAttributesJobsParameter} params - 属性汇总分析参数类。
  34553. * @param {RequestCallback} callback - 回调函数。
  34554. * @param {number} [seconds=1000] - 获取创建成功结果的时间间隔。
  34555. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  34556. */
  34557. addSummaryAttributesJob(params, callback, seconds, resultFormat) {
  34558. params = this._processParams(params);
  34559. this._processingService.addSummaryAttributesJob(params, callback, seconds, resultFormat);
  34560. }
  34561. /**
  34562. * @function ProcessingService.prototype.getSummaryAttributesJobState
  34563. * @description 获取属性汇总分析的状态。
  34564. * @param {string} id - 属性汇总分析的 ID。
  34565. * @returns {Object} 属性汇总分析的状态
  34566. */
  34567. getSummaryAttributesJobState(id) {
  34568. return this._processingService.getSummaryAttributesJobState(id);
  34569. }
  34570. _processFormat(resultFormat) {
  34571. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  34572. }
  34573. _processParams(params) {
  34574. if (!params) {
  34575. return {};
  34576. }
  34577. if (params.bounds) {
  34578. params.bounds = core_Util_Util.toSuperMapBounds(params.bounds);
  34579. }
  34580. //这里只允许传端的bounds
  34581. if (params.query) {
  34582. params.query = core_Util_Util.toSuperMapBounds(params.query);
  34583. }
  34584. if (params.geometryQuery) {
  34585. params.geometryQuery = core_Util_Util.toProcessingParam(params.geometryQuery);
  34586. }
  34587. if (params.geometryClip) {
  34588. params.geometryClip = core_Util_Util.toProcessingParam(params.geometryClip);
  34589. }
  34590. return params;
  34591. }
  34592. }
  34593. ;// CONCATENATED MODULE: ./src/common/iServer/QueryServiceBase.js
  34594. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34595. * This program are made available under the terms of the Apache License, Version 2.0
  34596. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34597. /**
  34598. * @class QueryService
  34599. * @deprecatedclass SuperMap.QueryService
  34600. * @category iServer Map QueryResults
  34601. * @classdesc 查询服务基类。
  34602. * @extends {CommonServiceBase}
  34603. * @param {string} url - 服务地址。请求地图查询服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  34604. * @param {Object} options - 参数。
  34605. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  34606. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  34607. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  34608. * @param {Object} [options.headers] - 请求头。
  34609. * @example
  34610. * var myService = new QueryService(url, {
  34611. * eventListeners: {
  34612. * "processCompleted": queryCompleted,
  34613. * "processFailed": queryError
  34614. * }
  34615. * };
  34616. * @usage
  34617. */
  34618. class QueryServiceBase extends CommonServiceBase {
  34619. constructor(url, options) {
  34620. super(url, options);
  34621. /**
  34622. * @member {boolean} QueryService.prototype.returnContent
  34623. * @description 是否立即返回新创建资源的表述还是返回新资源的URI。
  34624. */
  34625. this.returnContent = false;
  34626. /**
  34627. * @member {string} QueryService.prototype.format
  34628. * @description 查询结果返回格式,目前支持iServerJSON、GeoJSON、FGB三种格式。参数格式为"ISERVER","GEOJSON","FGB"。
  34629. */
  34630. this.format = DataFormat.GEOJSON;
  34631. this.returnFeatureWithFieldCaption = false;
  34632. if (options) {
  34633. Util_Util.extend(this, options);
  34634. }
  34635. this.CLASS_NAME = "SuperMap.QueryService";
  34636. if (!this.url) {
  34637. return;
  34638. }
  34639. if (options && options.format) {
  34640. this.format = options.format.toUpperCase();
  34641. }
  34642. this.url = Util_Util.urlPathAppend(this.url,'queryResults');
  34643. }
  34644. /**
  34645. * @function QueryService.prototype.destroy
  34646. * @description 释放资源,将引用资源的属性置空。
  34647. */
  34648. destroy() {
  34649. super.destroy();
  34650. var me = this;
  34651. me.returnContent = null;
  34652. me.format = null;
  34653. }
  34654. /**
  34655. * @function QueryService.prototype.processAsync
  34656. * @description 负责将客户端的查询参数传递到服务端。
  34657. * @param {QueryParameters} params - 查询参数。
  34658. */
  34659. processAsync(params) {
  34660. if (!(params instanceof QueryParameters)) {
  34661. return;
  34662. }
  34663. var me = this,
  34664. returnCustomResult = null,
  34665. jsonParameters = null;
  34666. me.returnContent = params.returnContent;
  34667. jsonParameters = me.getJsonParameters(params);
  34668. if (!me.returnContent) {
  34669. //仅供三维使用 获取高亮图片的bounds
  34670. returnCustomResult = params.returnCustomResult;
  34671. if (returnCustomResult) {
  34672. me.url = Util_Util.urlAppend(me.url, 'returnCustomResult=' + returnCustomResult);
  34673. }
  34674. }
  34675. me.returnFeatureWithFieldCaption = params.returnFeatureWithFieldCaption;
  34676. me.request({
  34677. method: "POST",
  34678. data: jsonParameters,
  34679. scope: me,
  34680. success: me.serviceProcessCompleted,
  34681. failure: me.serviceProcessFailed
  34682. });
  34683. }
  34684. /**
  34685. * @function QueryService.prototype.serviceProcessCompleted
  34686. * @description 查询完成,执行此方法。
  34687. * @param {Object} result - 服务器返回的结果对象。
  34688. */
  34689. serviceProcessCompleted(result, options) {
  34690. var me = this;
  34691. result = Util_Util.transformResult(result);
  34692. var geoJSONFormat = new GeoJSON();
  34693. if (result && result.recordsets) {
  34694. for (var i = 0, recordsets = result.recordsets, len = recordsets.length; i < len; i++) {
  34695. if (recordsets[i].features) {
  34696. if (me.returnFeatureWithFieldCaption === true) {
  34697. recordsets[i].features.map((feature) => {
  34698. feature.fieldNames = recordsets[i].fieldCaptions;
  34699. return feature;
  34700. })
  34701. }
  34702. if (me.format === DataFormat.GEOJSON) {
  34703. recordsets[i].features = geoJSONFormat.toGeoJSON(recordsets[i].features);
  34704. }
  34705. }
  34706. }
  34707. }
  34708. me.events.triggerEvent("processCompleted", {
  34709. result: result,
  34710. options
  34711. });
  34712. }
  34713. dataFormat() {
  34714. return [DataFormat.GEOJSON, DataFormat.ISERVER, DataFormat.FGB];
  34715. }
  34716. /**
  34717. * @function QueryService.prototype.getQueryParameters
  34718. * @description 将 JSON 对象表示的查询参数转化为 QueryParameters 对象。
  34719. * @param {Object} params - JSON 字符串表示的查询参数。
  34720. * @returns {QueryParameters} 返回转化后的 QueryParameters 对象。
  34721. */
  34722. getQueryParameters(params) {
  34723. return new QueryParameters({
  34724. customParams: params.customParams,
  34725. expectCount: params.expectCount,
  34726. networkType: params.networkType,
  34727. queryOption: params.queryOption,
  34728. queryParams: params.queryParams,
  34729. startRecord: params.startRecord,
  34730. prjCoordSys: params.prjCoordSys,
  34731. holdTime: params.holdTime
  34732. });
  34733. }
  34734. }
  34735. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByBoundsParameters.js
  34736. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34737. * This program are made available under the terms of the Apache License, Version 2.0
  34738. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34739. /**
  34740. * @class QueryByBoundsParameters
  34741. * @deprecatedclass SuperMap.QueryByBoundsParameters
  34742. * @category iServer Map QueryResults
  34743. * @classdesc Bounds 查询参数类。该类用于设置 Bounds 查询的相关参数。
  34744. * @extends {QueryParameters}
  34745. * @param {Object} options - 参数。
  34746. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 指定的查询范围。
  34747. * @param {Array.<FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  34748. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  34749. * @param {Object} [options.prjCoordSys] -自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  34750. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  34751. * @param {GeometryType} [options.networkType=GeometryType.LINE] - 网络数据集对应的查询类型。
  34752. * @param {QueryOption} [options.queryOption=QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  34753. * @param {number} [options.startRecord=0] - 查询起始记录号。
  34754. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  34755. * @param {boolean} [options.returnCustomResult=false] - 仅供三维使用。
  34756. * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
  34757. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  34758. * @usage
  34759. */
  34760. class QueryByBoundsParameters extends QueryParameters {
  34761. constructor(options) {
  34762. options = options || {};
  34763. super(options);
  34764. /**
  34765. * @member {boolean} [QueryByBoundsParameters.prototype.returnContent=true]
  34766. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  34767. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  34768. * 为 false,则返回的是查询结果资源的 URI。
  34769. */
  34770. this.returnContent = true;
  34771. /**
  34772. * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} QueryByBoundsParameters.prototype.bounds
  34773. * @description 指定的查询范围。
  34774. */
  34775. this.bounds = null;
  34776. Util_Util.extend(this, options);
  34777. this.CLASS_NAME = "SuperMap.QueryByBoundsParameters";
  34778. }
  34779. /**
  34780. * @function QueryByBoundsParameters.prototype.destroy
  34781. * @description 释放资源,将引用资源的属性置空。
  34782. */
  34783. destroy() {
  34784. super.destroy();
  34785. var me = this;
  34786. me.returnContent = null;
  34787. if (me.bounds) {
  34788. me.bounds = null;
  34789. }
  34790. }
  34791. }
  34792. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByBoundsService.js
  34793. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34794. * This program are made available under the terms of the Apache License, Version 2.0
  34795. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34796. /**
  34797. * @class QueryByBoundsService
  34798. * @deprecatedclass SuperMap.QueryByBoundsService
  34799. * @category iServer Map QueryResults
  34800. * @classdesc Bounds 查询服务类。
  34801. * @augments {QueryService}
  34802. * @example
  34803. * (start end)
  34804. * var myQueryByBoundsService = new QueryByBoundsService(url, {
  34805. * eventListeners: {
  34806. * "processCompleted": queryCompleted,
  34807. * "processFailed": queryError
  34808. * }
  34809. * });
  34810. * function queryCompleted(object){//todo};
  34811. * function queryError(object){//todo};
  34812. * (end)
  34813. * @param {string} url - 服务地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  34814. * @param {Object} options - 参数。
  34815. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。<br>
  34816. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  34817. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  34818. * @param {Object} [options.headers] - 请求头。
  34819. * @usage
  34820. */
  34821. class QueryByBoundsService extends QueryServiceBase {
  34822. constructor(url, options) {
  34823. super(url, options);
  34824. this.CLASS_NAME = "SuperMap.QueryByBoundsService";
  34825. }
  34826. /**
  34827. * @override
  34828. */
  34829. destroy() {
  34830. super.destroy();
  34831. }
  34832. /**
  34833. * @function QueryByBoundsService.prototype.getJsonParameters
  34834. * @description 将查询参数转化为 JSON 字符串。
  34835. * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds 等)。
  34836. * @param {QueryByBoundsParameters} params - Bounds 查询参数。
  34837. * @returns {Object} 转化后的 JSON 字符串。
  34838. */
  34839. getJsonParameters(params) {
  34840. if (!(params instanceof QueryByBoundsParameters)) {
  34841. return null;
  34842. }
  34843. var me = this,
  34844. jsonParameters = "",
  34845. qp = null,
  34846. bounds = params.bounds;
  34847. qp = me.getQueryParameters(params);
  34848. jsonParameters += "'queryMode':'BoundsQuery','queryParameters':";
  34849. jsonParameters += Util_Util.toJSON(qp);
  34850. jsonParameters += ",'bounds': {'rightTop':{'y':" + bounds.top + ",'x':" +
  34851. bounds.right + "},'leftBottom':{'y':" + bounds.bottom + ",'x':" + bounds.left + "}}";
  34852. jsonParameters = "{" + jsonParameters + "}";
  34853. return jsonParameters;
  34854. }
  34855. }
  34856. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByDistanceParameters.js
  34857. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34858. * This program are made available under the terms of the Apache License, Version 2.0
  34859. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34860. /**
  34861. * @class QueryByDistanceParameters
  34862. * @deprecatedclass SuperMap.QueryByDistanceParameters
  34863. * @category iServer Map QueryResults
  34864. * @classdesc Distance 查询参数类。
  34865. * 该类用于设置 Distance 查询的相关参数。
  34866. * @extends {QueryParameters}
  34867. * @param {Object} options - 参数。
  34868. * @param {GeoJSONObject} options.geometry - 用于查询的几何对象。
  34869. * @param {Array.<FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  34870. * @param {number} options.distance - 查询距离,单位与所查询图层对应的数据集单位相同。距离查询时,表示距离地物的距离。最近地物查询时,表示搜索的范围。此为必选参数。
  34871. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  34872. * @param {Object} [options.prjCoordSys] -自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  34873. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  34874. * @param {GeometryType} [options.networkType=GeometryType.LINE] - 网络数据集对应的查询类型。
  34875. * @param {QueryOption} [options.queryOption=QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  34876. * @param {number} [options.startRecord=0] - 查询起始记录号。
  34877. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  34878. * @param {boolean} [options.returnCustomResult=false] -仅供三维使用。
  34879. * @param {boolean} [options.isNearest=false] - 是否为最近距离查询。
  34880. * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
  34881. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  34882. * @usage
  34883. */
  34884. class QueryByDistanceParameters extends QueryParameters {
  34885. constructor(options) {
  34886. options = options || {};
  34887. super(options);
  34888. /**
  34889. * @member {number} [QueryByDistanceParameters.prototype.distance=0]
  34890. * @description 查询距离,单位与所查询图层对应的数据集单位相同。
  34891. * 距离查询时,表示距离地物的距离。最近地物查询时,表示搜索的范围。
  34892. */
  34893. /**
  34894. * @member {GeoJSONObject} QueryByDistanceParameters.prototype.geometry
  34895. * @description 用于查询的地理对象。<br>
  34896. * 点类型可以是:{@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>
  34897. * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。<br>
  34898. * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}|{@link mapboxgl.LngLatBounds}|{@link GeoJSONObject}。
  34899. */
  34900. this.geometry = null;
  34901. /**
  34902. * @member {boolean} [QueryByDistanceParameters.prototype.isNearest=false]
  34903. * @description 是否为最近距离查询。<br>
  34904. * 建议该属性与 expectCount(继承自 {@link QueryParameters})属性联合使用。
  34905. * 当该属性为 true 时,即表示查找最近地物,如果查询结果数大于期望返回的结果记录数(expectCount),
  34906. * 则查找结果为查询总记录中距离中心最近的 expectCount 个地物。
  34907. * 当该属性为不为 true 时,如果查询结果数大于期望返回的结果记录数(expectCount),
  34908. * 则查找结果为从查询总记录中随机抽取的 expectCount 个地物。
  34909. * 目前查询结果不支持按远近距离排序。
  34910. */
  34911. this.isNearest = null;
  34912. /**
  34913. * @member {boolean} [QueryByDistanceParameters.prototype.returnContent=true]
  34914. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  34915. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  34916. * 为 false,则返回的是查询结果资源的 URI。
  34917. */
  34918. this.returnContent = true;
  34919. Util_Util.extend(this, options);
  34920. this.CLASS_NAME = "SuperMap.QueryByDistanceParameters";
  34921. }
  34922. /**
  34923. * @function QueryByDistanceParameters.prototype.destroy
  34924. * @description 释放资源,将引用资源的属性置空。
  34925. */
  34926. destroy() {
  34927. super.destroy();
  34928. var me = this;
  34929. me.returnContent = null;
  34930. me.distance = null;
  34931. me.isNearest = null;
  34932. if (me.geometry) {
  34933. me.geometry.destroy();
  34934. me.geometry = null;
  34935. }
  34936. }
  34937. }
  34938. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByDistanceService.js
  34939. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  34940. * This program are made available under the terms of the Apache License, Version 2.0
  34941. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34942. /**
  34943. * @class QueryByDistanceService
  34944. * @deprecatedclass SuperMap.QueryByDistanceService
  34945. * @category iServer Map QueryResults
  34946. * @classdesc Distance查询服务类。
  34947. * @extends {QueryServiceBase}
  34948. * @example
  34949. * var myQueryByDistService = new QueryByDistanceService(url, {
  34950. * eventListeners: {
  34951. * "processCompleted": queryCompleted,
  34952. * "processFailed": queryError
  34953. * }
  34954. * });
  34955. * function queryCompleted(object){//todo};
  34956. * function queryError(object){//todo};
  34957. * @param {string} url - 服务地址。如访问World Map服务,只需将url设为:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  34958. * @param {Object} options - 参数。
  34959. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  34960. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  34961. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  34962. * @param {Object} [options.headers] - 请求头。
  34963. * @usage
  34964. */
  34965. class QueryByDistanceService extends QueryServiceBase {
  34966. constructor(url, options) {
  34967. super(url, options);
  34968. this.CLASS_NAME = "SuperMap.QueryByDistanceService";
  34969. }
  34970. /**
  34971. * @override
  34972. */
  34973. destroy() {
  34974. super.destroy();
  34975. }
  34976. /**
  34977. * @function QueryByDistanceService.prototype.getJsonParameters
  34978. * @description 将查询参数转化为 JSON 字符串。
  34979. * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds等)。
  34980. * @param {QueryByDistanceParameters} params - Distance 查询参数类。
  34981. * @returns {Object} 转化后的 JSON 字符串。
  34982. */
  34983. getJsonParameters(params) {
  34984. if (!(params instanceof QueryByDistanceParameters)) {
  34985. return;
  34986. }
  34987. var me = this,
  34988. jsonParameters = "",
  34989. qp = me.getQueryParameters(params);
  34990. var sg = ServerGeometry.fromGeometry(params.geometry);
  34991. jsonParameters += params.isNearest ? "'queryMode':'FindNearest','queryParameters':" : "'queryMode':'DistanceQuery','queryParameters':";
  34992. jsonParameters += Util_Util.toJSON(qp);
  34993. jsonParameters += ",'geometry':" + Util_Util.toJSON(sg) + ",'distance':" + params.distance;
  34994. jsonParameters = "{" + jsonParameters + "}";
  34995. return jsonParameters;
  34996. }
  34997. }
  34998. ;// CONCATENATED MODULE: ./src/common/iServer/QueryBySQLParameters.js
  34999. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35000. * This program are made available under the terms of the Apache License, Version 2.0
  35001. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35002. /**
  35003. * @class QueryBySQLParameters
  35004. * @deprecatedclass SuperMap.QueryBySQLParameters
  35005. * @category iServer Map QueryResults
  35006. * @classdesc SQL 查询参数类。
  35007. * 该类用于设置 SQL 查询的相关参数。
  35008. * @extends {QueryParameters}
  35009. * @param {Object} options - 参数。
  35010. * @param {Array.<FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  35011. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  35012. * @param {Object} [options.prjCoordSys] - 自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  35013. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  35014. * @param {GeometryType} [options.networkType=GeometryType.LINE] - 网络数据集对应的查询类型。
  35015. * @param {QueryOption} [options.queryOption=QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  35016. * @param {number} [options.startRecord=0] - 查询起始记录号。
  35017. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  35018. * @param {boolean} [options.returnCustomResult=false] - 仅供三维使用。
  35019. * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
  35020. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  35021. * @usage
  35022. */
  35023. class QueryBySQLParameters extends QueryParameters {
  35024. constructor(options) {
  35025. options = options || {};
  35026. super(options);
  35027. /**
  35028. * @member {boolean} [QueryBySQLParameters.prototype.returnContent=true]
  35029. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  35030. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  35031. * 为 false,则返回的是查询结果资源的 URI。
  35032. */
  35033. this.returnContent = true;
  35034. Util_Util.extend(this, options);
  35035. this.CLASS_NAME = "SuperMap.QueryBySQLParameters";
  35036. }
  35037. /**
  35038. * @function QueryBySQLParameters.prototype.destroy
  35039. * @description 释放资源,将引用资源的属性置空。
  35040. */
  35041. destroy() {
  35042. super.destroy();
  35043. var me = this;
  35044. me.returnContent = null;
  35045. }
  35046. }
  35047. ;// CONCATENATED MODULE: ./src/common/iServer/QueryBySQLService.js
  35048. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35049. * This program are made available under the terms of the Apache License, Version 2.0
  35050. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35051. /**
  35052. * @class QueryBySQLService
  35053. * @deprecatedclass SuperMap.QueryBySQLService
  35054. * @category iServer Map QueryResults
  35055. * @classdesc SQL 查询服务类。在一个或多个指定的图层上查询符合 SQL 条件的空间地物信息。
  35056. * @extends {QueryServiceBase}
  35057. * @example
  35058. * var queryParam = new FilterParameter({
  35059. * name: "Countries@World.1",
  35060. * attributeFilter: "Pop_1994>1000000000 and SmArea>900"
  35061. * });
  35062. * var queryBySQLParams = new QueryBySQLParameters({
  35063. * queryParams: [queryParam]
  35064. * });
  35065. * var myQueryBySQLService = new QueryBySQLService(url, {eventListeners: {
  35066. * "processCompleted": queryCompleted,
  35067. * "processFailed": queryError
  35068. * }
  35069. * });
  35070. * queryBySQLService.processAsync(queryBySQLParams);
  35071. * function queryCompleted(object){//todo};
  35072. * function queryError(object){//todo};
  35073. * @param {string} url - 服务地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  35074. * @param {Object} options - 参数。
  35075. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  35076. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  35077. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  35078. * @param {Object} [options.headers] - 请求头。
  35079. * @usage
  35080. */
  35081. class QueryBySQLService extends QueryServiceBase {
  35082. constructor(url, options) {
  35083. super(url, options);
  35084. this.CLASS_NAME = "SuperMap.QueryBySQLService";
  35085. }
  35086. /**
  35087. * @override
  35088. */
  35089. destroy() {
  35090. super.destroy();
  35091. }
  35092. /**
  35093. * @function QueryBySQLService.prototype.getJsonParameters
  35094. * @description 将查询参数转化为 JSON 字符串。
  35095. * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds等)。
  35096. * @param {QueryBySQLParameters} params - SQL 查询参数类。
  35097. * @returns {Object} 转化后的 JSON 字符串。
  35098. */
  35099. getJsonParameters(params) {
  35100. if (!(params instanceof QueryBySQLParameters)) {
  35101. return;
  35102. }
  35103. var me = this,
  35104. jsonParameters = "",
  35105. qp = null;
  35106. qp = me.getQueryParameters(params);
  35107. jsonParameters += "'queryMode':'SqlQuery','queryParameters':";
  35108. jsonParameters += Util_Util.toJSON(qp);
  35109. jsonParameters = "{" + jsonParameters + "}";
  35110. return jsonParameters;
  35111. }
  35112. }
  35113. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByGeometryParameters.js
  35114. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35115. * This program are made available under the terms of the Apache License, Version 2.0
  35116. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35117. /**
  35118. * @class QueryByGeometryParameters
  35119. * @deprecatedclass SuperMap.QueryByGeometryParameters
  35120. * @category iServer Map QueryResults
  35121. * @classdesc Geometry 查询参数类。
  35122. * 该类用于设置 Geometry查询的相关参数。
  35123. * @extends {QueryParameters}
  35124. * @param {Object} options - 参数。
  35125. * @param {Array.<FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  35126. * @param {GeoJSONObject} options.geometry - 查询的几何对象。
  35127. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  35128. * @param {QueryOption} [options.queryOption=QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  35129. * @param {Object} [options.prjCoordSys] -自定义参数,供SuperMap Online提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  35130. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  35131. * @param {GeometryType} [options.networkType=GeometryType.LINE] - 网络数据集对应的查询类型。
  35132. * @param {boolean} [options.returnCustomResult=false] -仅供三维使用。
  35133. * @param {number} [options.startRecord=0] - 查询起始记录号。
  35134. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  35135. * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
  35136. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  35137. * @param {SpatialQueryMode} [spatialQueryMode=SpatialQueryMode.INTERSECT] - 空间查询模式。
  35138. * @usage
  35139. */
  35140. class QueryByGeometryParameters extends QueryParameters {
  35141. constructor(options) {
  35142. options = options || {};
  35143. super(options);
  35144. /**
  35145. * @member {boolean} [QueryByGeometryParameters.prototype.returnContent=true]
  35146. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。<br>
  35147. * 如果为 true,则直接返回新创建资源,即查询结果的表述。<br>
  35148. * 为 false,则返回的是查询结果资源的 URI。
  35149. */
  35150. this.returnContent = true;
  35151. /**
  35152. * @member {GeoJSONObject} QueryByGeometryParameters.prototype.geometry
  35153. * @description 用于查询的几何对象。<br>
  35154. * 点类型可以是:{@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>
  35155. * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}|{@link GeoJSONObject}。<br>
  35156. * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}|{@link mapboxgl.LngLatBounds}|{@link GeoJSONObject}。
  35157. */
  35158. this.geometry = null;
  35159. /**
  35160. * @member {SpatialQueryMode} [QueryByGeometryParameters.prototype.spatialQueryMode=SpatialQueryMode.INTERSECT]
  35161. * @description 空间查询模式。
  35162. */
  35163. this.spatialQueryMode = SpatialQueryMode.INTERSECT;
  35164. Util_Util.extend(this, options);
  35165. this.CLASS_NAME = "SuperMap.QueryByGeometryParameters";
  35166. }
  35167. /**
  35168. * @function QueryByGeometryParameters.prototype.destroy
  35169. * @description 释放资源,将引用资源的属性置空。
  35170. */
  35171. destroy() {
  35172. super.destroy();
  35173. var me = this;
  35174. me.returnContent = null;
  35175. me.geometry = null;
  35176. me.spatialQueryMode = null;
  35177. }
  35178. }
  35179. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByGeometryService.js
  35180. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35181. * This program are made available under the terms of the Apache License, Version 2.0
  35182. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35183. /**
  35184. * @class QueryByGeometryService
  35185. * @deprecatedclass SuperMap.QueryByGeometryService
  35186. * @category iServer Map QueryResults
  35187. * @classdesc Geometry查询服务类。
  35188. * @extends {QueryServiceBase}
  35189. * @example
  35190. * var myQueryByGeometryService = new QueryByGeometryService(url, {
  35191. * eventListeners: {
  35192. * "processCompleted": queryCompleted,
  35193. * "processFailed": queryError
  35194. * }
  35195. * });
  35196. * function queryCompleted(object){//todo};
  35197. * function queryError(object){//todo};
  35198. * @param {string} url - 服务地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  35199. * @param {Object} options - 参数。
  35200. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  35201. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  35202. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  35203. * @param {Object} [options.headers] - 请求头。
  35204. * @usage
  35205. */
  35206. class QueryByGeometryService extends QueryServiceBase {
  35207. constructor(url, options) {
  35208. super(url, options);
  35209. this.CLASS_NAME = "SuperMap.QueryByGeometryService";
  35210. }
  35211. /**
  35212. * @override
  35213. */
  35214. destroy() {
  35215. super.destroy();
  35216. }
  35217. /**
  35218. * @function QueryByGeometryService.prototype.getJsonParameters
  35219. * @description 将查询参数转化为 JSON 字符串。
  35220. * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds等)。
  35221. * @param {QueryByGeometryParameters} params - Geometry 查询参数类。
  35222. * @returns {Object} 转化后的 JSON 字符串。
  35223. */
  35224. getJsonParameters(params) {
  35225. if (!(params instanceof QueryByGeometryParameters)) {
  35226. return;
  35227. }
  35228. var me = this,
  35229. jsonParameters = "",
  35230. qp = null,
  35231. geometry = params.geometry,
  35232. sg = ServerGeometry.fromGeometry(geometry);
  35233. qp = me.getQueryParameters(params);
  35234. jsonParameters += "'queryMode':'SpatialQuery','queryParameters':";
  35235. jsonParameters += Util_Util.toJSON(qp) + ",'geometry':" + Util_Util.toJSON(sg)
  35236. + ",'spatialQueryMode':" + Util_Util.toJSON(params.spatialQueryMode);
  35237. jsonParameters = "{" + jsonParameters + "}";
  35238. return jsonParameters;
  35239. }
  35240. }
  35241. ;// CONCATENATED MODULE: ./src/common/iServer/QueryService.js
  35242. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35243. * This program are made available under the terms of the Apache License, Version 2.0
  35244. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35245. /**
  35246. * @class QueryService
  35247. * @category iServer Map QueryResults
  35248. * @classdesc 地图查询服务类。
  35249. * 提供:范围查询,SQL 查询,几何查询,距离查询。
  35250. * @extends {ServiceBase}
  35251. * @param {string} url - 服务地址。
  35252. * @param {Object} options - 参数。
  35253. * @param {string} [options.proxy] - 服务代理地址。
  35254. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  35255. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  35256. * @param {Object} [options.headers] - 请求头。
  35257. * @example
  35258. * new QueryService(url)
  35259. * .queryByBounds(param,function(result){
  35260. * //doSomething
  35261. * })
  35262. * @usage
  35263. */
  35264. class QueryService_QueryService {
  35265. constructor(url, options) {
  35266. this.options = options || {};
  35267. this.url = url;
  35268. }
  35269. /**
  35270. * @function QueryService.prototype.queryByBounds
  35271. * @description Bounds 查询地图服务。
  35272. * @param {QueryByBoundsParameters} params - Bounds 查询参数类。
  35273. * @param {RequestCallback} callback - 回调函数。
  35274. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  35275. */
  35276. queryByBounds(params, callback, resultFormat) {
  35277. var me = this;
  35278. var queryService = new QueryByBoundsService(me.url, {
  35279. proxy: me.options.proxy,
  35280. withCredentials: me.options.withCredentials,
  35281. crossOrigin: me.options.crossOrigin,
  35282. headers: me.options.headers,
  35283. eventListeners: {
  35284. scope: me,
  35285. processCompleted: callback,
  35286. processFailed: callback
  35287. },
  35288. format: me._processFormat(resultFormat)
  35289. });
  35290. queryService.processAsync(params);
  35291. }
  35292. /**
  35293. * @function QueryService.prototype.queryByDistance
  35294. * @description 地图距离查询服务。
  35295. * @param {QueryByDistanceParameters} params - Distance 查询参数类。
  35296. * @param {RequestCallback} callback - 回调函数。
  35297. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型
  35298. */
  35299. queryByDistance(params, callback, resultFormat) {
  35300. var me = this;
  35301. var queryByDistanceService = new QueryByDistanceService(me.url, {
  35302. proxy: me.options.proxy,
  35303. withCredentials: me.options.withCredentials,
  35304. crossOrigin: me.options.crossOrigin,
  35305. headers: me.options.headers,
  35306. eventListeners: {
  35307. scope: me,
  35308. processCompleted: callback,
  35309. processFailed: callback
  35310. },
  35311. format: resultFormat
  35312. });
  35313. queryByDistanceService.processAsync(params);
  35314. }
  35315. /**
  35316. * @function QueryService.prototype.queryBySQL
  35317. * @description 地图 SQL 查询服务。
  35318. * @param {QueryBySQLParameters} params - SQL 查询参数类。
  35319. * @param {RequestCallback} callback - 回调函数。
  35320. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  35321. */
  35322. queryBySQL(params, callback, resultFormat) {
  35323. var me = this;
  35324. var queryBySQLService = new QueryBySQLService(me.url, {
  35325. proxy: me.options.proxy,
  35326. withCredentials: me.options.withCredentials,
  35327. crossOrigin: me.options.crossOrigin,
  35328. headers: me.options.headers,
  35329. eventListeners: {
  35330. scope: me,
  35331. processCompleted: callback,
  35332. processFailed: callback
  35333. },
  35334. format: resultFormat
  35335. });
  35336. queryBySQLService.processAsync(params);
  35337. }
  35338. /**
  35339. * @function QueryService.prototype.queryByGeometry
  35340. * @description 地图几何查询服务。
  35341. * @param {QueryByGeometryParameters} params - Geometry 查询参数类。
  35342. * @param {RequestCallback} callback - 回调函数。
  35343. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  35344. */
  35345. queryByGeometry(params, callback, resultFormat) {
  35346. var me = this;
  35347. var queryByGeometryService = new QueryByGeometryService(me.url, {
  35348. proxy: me.options.proxy,
  35349. withCredentials: me.options.withCredentials,
  35350. crossOrigin: me.options.crossOrigin,
  35351. headers: me.options.headers,
  35352. eventListeners: {
  35353. scope: me,
  35354. processCompleted: callback,
  35355. processFailed: callback
  35356. },
  35357. format: resultFormat
  35358. });
  35359. queryByGeometryService.processAsync(params);
  35360. }
  35361. _processFormat(resultFormat) {
  35362. return resultFormat ? resultFormat : DataFormat.GEOJSON;
  35363. }
  35364. }
  35365. ;// CONCATENATED MODULE: ./src/maplibregl/services/QueryService.js
  35366. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35367. * This program are made available under the terms of the Apache License, Version 2.0
  35368. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35369. /**
  35370. * @class QueryService
  35371. * @category iServer Map QueryResults
  35372. * @classdesc 地图查询服务类。
  35373. * 提供:范围查询,SQL 查询,几何查询,距离查询。
  35374. * @version 11.1.0
  35375. * @modulecategory Services
  35376. * @extends {ServiceBase}
  35377. * @param {string} url - 服务地址。
  35378. * @param {Object} options - 参数。
  35379. * @param {string} [options.proxy] - 服务代理地址。
  35380. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  35381. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  35382. * @param {Object} [options.headers] - 请求头。
  35383. * @example
  35384. * new QueryService(url)
  35385. * .queryByBounds(param,function(result){
  35386. * //doSomething
  35387. * })
  35388. * @usage
  35389. */
  35390. class QueryService extends ServiceBase {
  35391. constructor(url, options) {
  35392. super(url, options);
  35393. this._queryService = new QueryService_QueryService(url, options);
  35394. }
  35395. /**
  35396. * @function QueryService.prototype.queryByBounds
  35397. * @description Bounds 查询地图服务。
  35398. * @param {QueryByBoundsParameters} params - Bounds 查询参数类。
  35399. * @param {RequestCallback} callback - 回调函数。
  35400. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  35401. */
  35402. queryByBounds(params, callback, resultFormat) {
  35403. params = this._processParams(params);
  35404. this._queryService.queryByBounds(params, callback, resultFormat);
  35405. }
  35406. /**
  35407. * @function QueryService.prototype.queryByDistance
  35408. * @description 地图距离查询服务。
  35409. * @param {QueryByDistanceParameters} params - Distance 查询参数类。
  35410. * @param {RequestCallback} callback - 回调函数。
  35411. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型
  35412. */
  35413. queryByDistance(params, callback, resultFormat) {
  35414. params = this._processParams(params);
  35415. this._queryService.queryByDistance(params, callback, resultFormat);
  35416. }
  35417. /**
  35418. * @function QueryService.prototype.queryBySQL
  35419. * @description 地图 SQL 查询服务。
  35420. * @param {QueryBySQLParameters} params - SQL 查询参数类。
  35421. * @param {RequestCallback} callback - 回调函数。
  35422. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  35423. */
  35424. queryBySQL(params, callback, resultFormat) {
  35425. params = this._processParams(params);
  35426. this._queryService.queryBySQL(params, callback, resultFormat);
  35427. }
  35428. /**
  35429. * @function QueryService.prototype.queryByGeometry
  35430. * @description 地图几何查询服务。
  35431. * @param {QueryByGeometryParameters} params - Geometry 查询参数类。
  35432. * @param {RequestCallback} callback - 回调函数。
  35433. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  35434. */
  35435. queryByGeometry(params, callback, resultFormat) {
  35436. params = this._processParams(params);
  35437. this._queryService.queryByGeometry(params, callback, resultFormat);
  35438. }
  35439. _processParams(params) {
  35440. if (!params) {
  35441. return {};
  35442. }
  35443. params.returnContent = params.returnContent == null ? true : params.returnContent;
  35444. if (params.queryParams && !core_Util_Util.isArray(params.queryParams)) {
  35445. params.queryParams = [params.queryParams];
  35446. }
  35447. if (params.bounds) {
  35448. if (params.bounds instanceof Array) {
  35449. params.bounds = new Bounds(params.bounds[0], params.bounds[1], params.bounds[2], params.bounds[3]);
  35450. }
  35451. if (params.bounds instanceof (external_maplibregl_default()).LngLatBounds) {
  35452. params.bounds = new Bounds(
  35453. params.bounds.getSouthWest().lng,
  35454. params.bounds.getSouthWest().lat,
  35455. params.bounds.getNorthEast().lng,
  35456. params.bounds.getNorthEast().lat
  35457. );
  35458. }
  35459. }
  35460. if (params.geometry) {
  35461. if (params.geometry instanceof (external_maplibregl_default()).LngLat) {
  35462. params.geometry = new Point(params.geometry.lng, params.geometry.lat);
  35463. }
  35464. if (params.geometry instanceof (external_maplibregl_default()).Point) {
  35465. params.geometry = new Point(params.geometry.x, params.geometry.y);
  35466. }
  35467. if (params.geometry instanceof (external_maplibregl_default()).LngLatBounds) {
  35468. params.geometry = core_Util_Util.toSuperMapPolygon(params.geometry);
  35469. }
  35470. if (!(params.geometry instanceof Geometry_Geometry)) {
  35471. params.geometry = core_Util_Util.toSuperMapGeometry(params.geometry);
  35472. }
  35473. }
  35474. return params;
  35475. }
  35476. }
  35477. ;// CONCATENATED MODULE: ./src/common/iServer/SpatialAnalystBase.js
  35478. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35479. * This program are made available under the terms of the Apache License, Version 2.0
  35480. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35481. /**
  35482. * @class SpatialAnalystBase
  35483. * @deprecatedclass SuperMap.SpatialAnalystBase
  35484. * @category iServer Core
  35485. * @classdesc 空间分析服务基类。
  35486. * @param {string} url - 地址。
  35487. * @param {Object} options - 可选参数。
  35488. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  35489. * @param {Object} [options.headers] - 请求头。
  35490. * @extends {CommonServiceBase}
  35491. * @usage
  35492. */
  35493. class SpatialAnalystBase extends CommonServiceBase {
  35494. constructor(url, options) {
  35495. super(url, options);
  35496. /**
  35497. * @member {DataFormat} [SpatialAnalystBase.prototype.format=DataFormat.GEOJSON]
  35498. * @description 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  35499. */
  35500. this.format = options.format || DataFormat.GEOJSON;
  35501. this.CLASS_NAME = "SuperMap.SpatialAnalystBase";
  35502. }
  35503. /**
  35504. * @function SpatialAnalystBase.prototype.destroy
  35505. * @override
  35506. */
  35507. destroy() {
  35508. super.destroy();
  35509. this.format = null;
  35510. }
  35511. /**
  35512. * @function SpatialAnalystBase.prototype.serviceProcessCompleted
  35513. * @description 分析完成,执行此方法。
  35514. * @param {Object} result - 服务器返回的结果对象。
  35515. */
  35516. serviceProcessCompleted(result, options) {
  35517. var me = this, analystResult;
  35518. result = Util_Util.transformResult(result);
  35519. if (result && me.format === DataFormat.GEOJSON && typeof me.toGeoJSONResult === 'function') {
  35520. //批量分析时会返回多个结果
  35521. if (Util_Util.isArray(result)) {
  35522. for (var i = 0; i < result.length; i++) {
  35523. result[i] = me.toGeoJSONResult(result[i])
  35524. }
  35525. analystResult = result;
  35526. } else {
  35527. analystResult = me.toGeoJSONResult(result);
  35528. }
  35529. }
  35530. if (!analystResult) {
  35531. analystResult = result;
  35532. }
  35533. me.events.triggerEvent("processCompleted", {result: analystResult, options});
  35534. }
  35535. /**
  35536. * @function SpatialAnalystBase.prototype.toGeoJSONResult
  35537. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  35538. * @param {Object} result - 服务器返回的结果对象。
  35539. *
  35540. */
  35541. toGeoJSONResult(result) {
  35542. if (!result) {
  35543. return null;
  35544. }
  35545. //批量叠加分析时结果这样处理
  35546. if (result.result && result.result.resultGeometry) {
  35547. result = result.result
  35548. }
  35549. var geoJSONFormat = new GeoJSON();
  35550. if (result.recordsets) {
  35551. for (var i = 0, recordsets = result.recordsets, len = recordsets.length; i < len; i++) {
  35552. if (recordsets[i].features) {
  35553. recordsets[i].features = geoJSONFormat.toGeoJSON(recordsets[i].features);
  35554. }
  35555. }
  35556. } else if (result.recordset && result.recordset.features) {
  35557. result.recordset.features =geoJSONFormat.toGeoJSON(result.recordset.features);
  35558. }
  35559. if (result.resultGeometry) {
  35560. result.resultGeometry = geoJSONFormat.toGeoJSON(result.resultGeometry);
  35561. }
  35562. if (result.regions) {
  35563. result.regions = geoJSONFormat.toGeoJSON(result.regions);
  35564. }
  35565. return result;
  35566. }
  35567. }
  35568. ;// CONCATENATED MODULE: ./src/common/iServer/AreaSolarRadiationParameters.js
  35569. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35570. * This program are made available under the terms of the Apache License, Version 2.0
  35571. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35572. /**
  35573. * @class AreaSolarRadiationParameters
  35574. * @deprecatedclass SuperMap.AreaSolarRadiationParameters
  35575. * @category iServer SpatialAnalyst SolarRadiationAnalyst
  35576. * @classdesc 地区太阳辐射参数类。
  35577. * @param {Object} options - 参数。
  35578. * @param {string} options.dataset - 要用来做地区太阳辐射数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"的形式来表示,例如:JingjinTerrain@Jingjin。
  35579. * @param {string} options.targetDatasourceName - 指定的存储结果数据集的数据源名称, 例如:"Jingjin"。
  35580. * @param {string} options.totalGridName - 指定地区太阳辐射总辐射量数据集的名称。
  35581. * @param {string} options.diffuseDatasetGridName - 指定地区太阳辐射散射辐射量数据集的名称。
  35582. * @param {string} options.durationDatasetGridName - 指定地区太阳辐射太阳直射持续时间数据集的名称。
  35583. * @param {string} options.directDatasetGridName - 指定地区太阳辐射直射辐射量数据集的名称。
  35584. * @param {number} options.latitude - 待计算区域的纬度值。
  35585. * @param {string} [options.timeMode = 'MULTIDAYS'] - 时间模式。可选值"WITHINDAY"(单日)或"MULTIDAYS"(多日)。
  35586. * @param {number} options.dayStart - 起始日期(年内的第几天)。
  35587. * @param {number} options.dayEnd - 结束日期(年内的第几天)。
  35588. * @param {number} [options.hourStart] - 起始时间(一天中的第几个小时)。
  35589. * @param {number} [options.hourEnd] - 结束时间(一天中的第几个小时)。
  35590. * @param {number} [options.transmittance] - 太阳辐射穿过大气的透射率。
  35591. * @param {number} [options.hourInterval=0.5] - 计算时的小时间隔(设置的越小计算量越大并且计算结果更精确,如果修改此参数,必须使用整数)。
  35592. * @param {number} [options.dayInterval=5] - 计算时的天数间隔(设置的越小计算量越大并且计算结果更精确,必须使用整数)。
  35593. * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  35594. * @usage
  35595. */
  35596. class AreaSolarRadiationParameters {
  35597. constructor(options) {
  35598. /**
  35599. * @member {string} AreaSolarRadiationParameters.prototype.dataset
  35600. * @description 要用来做地区太阳辐射数据源中数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示,例如:JingjinTerrain@Jingjin。注:地区太阳辐射数据必须为栅格数据集。
  35601. */
  35602. this.dataset = null;
  35603. /**
  35604. * @member {string} AreaSolarRadiationParameters.prototype.targetDatasourceName
  35605. * @description 指定的存储结果数据集的数据源名称,例如:"Jingjin"。
  35606. */
  35607. this.targetDatasourceName = null;
  35608. /**
  35609. * @member {string} AreaSolarRadiationParameters.prototype.totalGridName
  35610. * @description 指定地区太阳辐射总辐射量数据集的名称。
  35611. */
  35612. this.totalGridName = null;
  35613. /**
  35614. * @member {string} AreaSolarRadiationParameters.prototype.diffuseDatasetGridName
  35615. * @description 指定地区太阳辐射散射辐射量数据集的名称。
  35616. */
  35617. this.diffuseDatasetGridName = null;
  35618. /**
  35619. * @member {string} AreaSolarRadiationParameters.prototype.durationDatasetGridName
  35620. * @description 指定地区太阳辐射太阳直射持续时间数据集的名称。
  35621. */
  35622. this.durationDatasetGridName = null;
  35623. /**
  35624. * @member {string} AreaSolarRadiationParameters.prototype.directDatasetGridName
  35625. * @description 指定地区太阳辐射直射辐射量数据集的名称。
  35626. */
  35627. this.directDatasetGridName = null;
  35628. /**
  35629. * @member {number} AreaSolarRadiationParameters.prototype.latitude
  35630. * @description 待计算区域的纬度值。
  35631. */
  35632. this.latitude = null;
  35633. /**
  35634. * @member {string} [AreaSolarRadiationParameters.prototype.timeMode='MULTIDAYS']
  35635. * @description 时间模式。可选值"WITHINDAY"(单日)或"MULTIDAYS"(多日)。
  35636. */
  35637. this.timeMode = "MULTIDAYS";
  35638. /**
  35639. * @member {number} AreaSolarRadiationParameters.prototype.dayStart
  35640. * @description 起始日期(年内的第几天)。
  35641. */
  35642. this.dayStart = null;
  35643. /**
  35644. * @member {number} AreaSolarRadiationParameters.prototype.dayEnd
  35645. * @description 结束日期(年内的第几天)。
  35646. */
  35647. this.dayEnd = null;
  35648. /**
  35649. * @member {number} [AreaSolarRadiationParameters.prototype.hourStart]
  35650. * @description 起始时间(一天中的第几个小时)。
  35651. */
  35652. this.hourStart = null;
  35653. /**
  35654. * @member {number} [AreaSolarRadiationParameters.prototype.hourEnd]
  35655. * @description 结束时间(一天中的第几个小时)。
  35656. */
  35657. this.hourEnd = null;
  35658. /**
  35659. * @member {number} [AreaSolarRadiationParameters.prototype.transmittance]
  35660. * @description 太阳辐射穿过大气的透射率。
  35661. */
  35662. this.transmittance = null;
  35663. /**
  35664. * @member {number} [AreaSolarRadiationParameters.prototype.hourInterval=0.5]
  35665. * @description 计算时的小时间隔(设置的越小计算量越大并且计算结果更精确, 如果修改此参数,必须使用整数)
  35666. */
  35667. this.hourInterval = null;
  35668. /**
  35669. * @member {number} [AreaSolarRadiationParameters.prototype.dayInterval=5]
  35670. * @description 计算时的天数间隔(设置的越小计算量越大并且计算结果更精确, 必须使用整数)
  35671. */
  35672. this.dayInterval = null;
  35673. /**
  35674. * @member {boolean} [AreaSolarRadiationParameters.prototype.deleteExistResultDataset=false]
  35675. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  35676. */
  35677. this.deleteExistResultDataset = false;
  35678. Util_Util.extend(this, options);
  35679. this.CLASS_NAME = "SuperMap.AreaSolarRadiationParameters";
  35680. }
  35681. /**
  35682. * @function AreaSolarRadiationParameters.prototype.destroy
  35683. * @description 释放资源,将引用资源的属性置空。
  35684. */
  35685. destroy() {
  35686. var me = this;
  35687. me.dataset = null;
  35688. me.zFactor = 1.0;
  35689. me.averageCurvatureName = null;
  35690. me.profileCurvatureName = null;
  35691. me.planCurvatureName = null;
  35692. me.deleteExistResultDataset = true;
  35693. }
  35694. /**
  35695. * @function AreaSolarRadiationParameters.toObject
  35696. * @param {AreaSolarRadiationParameters} param - 地区太阳辐射参数类。
  35697. * @param {AreaSolarRadiationParameters} tempObj - 地区太阳辐射参数对象。
  35698. * @returns {Object} JSON对象。
  35699. * @description 将AreaSolarRadiationParameters对象转换成JSON对象。
  35700. */
  35701. static toObject(param, tempObj) {
  35702. var parameter = {};
  35703. for (var name in param) {
  35704. if (name !== "dataset") {
  35705. var name1 = (name === "latitude" || name === "timeMode" || name === "dayStart");
  35706. var name2 = (name === "dayEnd" || name === "hourStart" || name === "hourEnd");
  35707. var name3 = (name === "transmittance" || name === "hourInterval" || name === "dayInterval");
  35708. if (name1 || name2 || name3) {
  35709. parameter[name] = param[name];
  35710. } else {
  35711. tempObj[name] = param[name];
  35712. }
  35713. }
  35714. }
  35715. tempObj["parameter"] = parameter;
  35716. }
  35717. }
  35718. ;// CONCATENATED MODULE: ./src/common/iServer/AreaSolarRadiationService.js
  35719. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35720. * This program are made available under the terms of the Apache License, Version 2.0
  35721. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35722. /**
  35723. * @class AreaSolarRadiationService
  35724. * @deprecatedclass SuperMap.AreaSolarRadiationService
  35725. * @category iServer SpatialAnalyst SolarRadiationAnalyst
  35726. * @classdesc 地区太阳辐射服务类。
  35727. * @param {string} url - 服务的访问地址。如:</br>http://localhost:8090/iserver/services/spatialanalyst-sample/restjsr/spatialanalyst。</br>
  35728. * @param {Object} options - 参数。</br>
  35729. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  35730. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  35731. * @param {Object} [options.headers] - 请求头。
  35732. * @extends {SpatialAnalystBase}
  35733. * @example 例如:
  35734. * (start code)
  35735. * var myAreaSolarRadiationService = new AreaSolarRadiationService(url);
  35736. * myAreaSolarRadiationService.on({
  35737. * "processCompleted": processCompleted,
  35738. * "processFailed": processFailed
  35739. * }
  35740. * );
  35741. * (end)
  35742. * @usage
  35743. */
  35744. class AreaSolarRadiationService extends SpatialAnalystBase {
  35745. constructor(url, options) {
  35746. super(url, options);
  35747. this.CLASS_NAME = "SuperMap.AreaSolarRadiationService";
  35748. }
  35749. /**
  35750. * @function AreaSolarRadiationService.prototype.destroy
  35751. * @override
  35752. */
  35753. destroy() {
  35754. super.destroy();
  35755. }
  35756. /**
  35757. * @function AreaSolarRadiationService.prototype.processAsync
  35758. * @description 负责将客户端的查询参数传递到服务端。
  35759. * @param {AreaSolarRadiationParameters} parameter - 地区太阳辐射参数。
  35760. */
  35761. processAsync(parameter) {
  35762. if (!(parameter instanceof AreaSolarRadiationParameters)) {
  35763. return;
  35764. }
  35765. var me = this;
  35766. var parameterObject = {};
  35767. if (parameter instanceof AreaSolarRadiationParameters) {
  35768. me.url = Util_Util.urlPathAppend(me.url, `datasets/${parameter.dataset}/solarradiation`);
  35769. }
  35770. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  35771. AreaSolarRadiationParameters.toObject(parameter, parameterObject);
  35772. var jsonParameters = Util_Util.toJSON(parameterObject);
  35773. me.request({
  35774. method: 'POST',
  35775. data: jsonParameters,
  35776. scope: me,
  35777. success: me.serviceProcessCompleted,
  35778. failure: me.serviceProcessFailed
  35779. });
  35780. }
  35781. }
  35782. ;// CONCATENATED MODULE: ./src/common/iServer/BufferDistance.js
  35783. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35784. * This program are made available under the terms of the Apache License, Version 2.0
  35785. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35786. /**
  35787. * @class BufferDistance
  35788. * @deprecatedclass SuperMap.BufferDistance
  35789. * @category iServer SpatialAnalyst BufferAnalyst
  35790. * @classdesc 缓冲区分析的缓冲距离类。通过该类可以设置缓冲区分析的缓冲距离,距离可以是数值也可以是数值型的字段表达式。
  35791. * @param {Object} options - 可选参数。
  35792. * @param {string} [options.exp] - 以数值型的字段表达式作为缓冲区分析的距离值。
  35793. * @param {number} [options.value=100] - 以数值作为缓冲区分析的距离值。单位:米。
  35794. * @usage
  35795. */
  35796. class BufferDistance {
  35797. constructor(options) {
  35798. /**
  35799. * @member {string} [BufferDistance.prototype.exp]
  35800. * @description 以数值型的字段表达式作为缓冲区分析的距离值。
  35801. */
  35802. this.exp = null;
  35803. /**
  35804. * @member {number} [BufferDistance.prototype.value=100]
  35805. * @description 以数值作为缓冲区分析的距离值。单位:米。
  35806. */
  35807. this.value = 100;
  35808. Util_Util.extend(this, options);
  35809. this.CLASS_NAME = "SuperMap.BufferDistance";
  35810. }
  35811. /**
  35812. * @function BufferDistance.prototype.destroy
  35813. * @description 释放资源,将引用资源的属性置空。
  35814. */
  35815. destroy() {
  35816. this.exp = null;
  35817. this.value = null;
  35818. }
  35819. }
  35820. ;// CONCATENATED MODULE: ./src/common/iServer/BufferSetting.js
  35821. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35822. * This program are made available under the terms of the Apache License, Version 2.0
  35823. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35824. /**
  35825. * @class BufferSetting
  35826. * @deprecatedclass SuperMap.BufferSetting
  35827. * @category iServer SpatialAnalyst BufferAnalyst
  35828. * @classdesc 缓冲区分析通用设置类。
  35829. * @param {Object} options - 可选参数。
  35830. * @param {BufferEndType} [options.endType=BufferEndType.FLAT] - 缓冲区端点枚举值。
  35831. * @param {BufferDistance} [options.leftDistance=100] - 左侧缓冲距离。
  35832. * @param {BufferDistance} [options.rightDistance=100] - 右侧缓冲距离。
  35833. * @param {number} [options.semicircleLineSegment=4] - 圆头缓冲圆弧处线段的个数。
  35834. * @param {BufferRadiusUnit} [options.radiusUnit=BufferRadiusUnit.METER] - 缓冲半径单位。
  35835. * @usage
  35836. */
  35837. class BufferSetting {
  35838. constructor(options) {
  35839. /**
  35840. * @member {BufferEndType} [BufferSetting.prototype.endType = BufferEndType.FLAT]
  35841. * @description 缓冲区端点枚举值。分为平头和圆头两种。
  35842. */
  35843. this.endType = BufferEndType.FLAT;
  35844. /**
  35845. * @member {BufferDistance} [BufferSetting.prototype.leftDistance=100]
  35846. * @description 左侧缓冲距离。
  35847. * 当为 GeometryBufferAnalyst 时,单位为默认地图的投影系的单位(如3857为米,4326为度),
  35848. * 当为 DatasetBufferAnalyst 时,单位通过{@link BufferSetting.radiusUnit}设置(默认全部为米)。
  35849. */
  35850. this.leftDistance = new BufferDistance();
  35851. /**
  35852. * @member {BufferDistance} [BufferSetting.prototype.rightDistance=100]
  35853. * @description 右侧缓冲距离。
  35854. * 当为 GeometryBufferAnalyst 时,单位为默认地图的投影系的单位(如3857为米,4326为度),
  35855. * 当为 DatasetBufferAnalyst 时,单位通过{@link BufferSetting#radiusUnit}设置(默认全部为米)。
  35856. */
  35857. this.rightDistance = new BufferDistance();
  35858. /**
  35859. * @member {number} [BufferSetting.prototype.semicircleLineSegment=4]
  35860. * @description 圆头缓冲圆弧处线段的个数。即用多少个线段来模拟一个半圆。
  35861. */
  35862. this.semicircleLineSegment = 4;
  35863. /**
  35864. * @member {BufferRadiusUnit} [BufferSetting.prototype.radiusUnit = BufferRadiusUnit.METER]
  35865. * @description 缓冲半径单位,可以是{@link BufferRadiusUnit.METER}、{@link BufferRadiusUnit.MILLIMETER}、
  35866. * {@link BufferRadiusUnit.CENTIMETER}、{@link BufferRadiusUnit.DECIMETER}、{@link BufferRadiusUnit.KILOMETER}、
  35867. * {@link BufferRadiusUnit.FOOT}、{@link BufferRadiusUnit.INCH}、{@link BufferRadiusUnit.MILE}、{@link BufferRadiusUnit.YARD}。
  35868. * 仅对BufferAnalyst有效。
  35869. */
  35870. this.radiusUnit = BufferRadiusUnit.METER;
  35871. if (options) {
  35872. Util_Util.extend(this, options);
  35873. }
  35874. this.CLASS_NAME = "SuperMap.BufferSetting";
  35875. }
  35876. /**
  35877. * @function BufferSetting.prototype.destroy
  35878. * @description 释放资源,将引用资源的属性置空。
  35879. */
  35880. destroy() {
  35881. let me = this;
  35882. me.endType = null;
  35883. if (me.leftDistance) {
  35884. me.leftDistance.destroy();
  35885. me.leftDistance = null;
  35886. }
  35887. if (me.rightDistance) {
  35888. me.rightDistance.destroy();
  35889. me.rightDistance = null;
  35890. }
  35891. me.semicircleLineSegment = null;
  35892. me.radiusUnit = null;
  35893. }
  35894. }
  35895. ;// CONCATENATED MODULE: ./src/common/iServer/BufferAnalystParameters.js
  35896. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35897. * This program are made available under the terms of the Apache License, Version 2.0
  35898. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35899. /**
  35900. * @class BufferAnalystParameters
  35901. * @deprecatedclass SuperMap.BufferAnalystParameters
  35902. * @category iServer SpatialAnalyst BufferAnalyst
  35903. * @classdesc 缓冲区分析参数基类。
  35904. * @param {Object} options - 参数。
  35905. * @param {BufferSetting} [options.bufferSetting] - 设置缓冲区通用参数。为缓冲区分析提供必要的参数信息,包括左缓冲距离、右缓冲距离、端点类型、圆头缓冲圆弧处线段的个数信息。
  35906. * @usage
  35907. */
  35908. class BufferAnalystParameters {
  35909. constructor(options) {
  35910. var me = this;
  35911. /**
  35912. * @member {BufferSetting} [BufferAnalystParameters.prototype.bufferSetting]
  35913. * @description 设置缓冲区通用参数。为缓冲区分析提供必要的参数信息,包括左缓冲距离、右缓冲距离、端点类型、圆头缓冲圆弧处线段的个数信息。
  35914. */
  35915. me.bufferSetting = new BufferSetting();
  35916. Util_Util.extend(this, options);
  35917. this.CLASS_NAME = "SuperMap.BufferAnalystParameters";
  35918. }
  35919. /**
  35920. * @function BufferAnalystParameters.prototype.destroy
  35921. * @description 释放资源,将引用资源的属性置空。
  35922. */
  35923. destroy() {
  35924. var me = this;
  35925. if (me.bufferSetting) {
  35926. me.bufferSetting.destroy();
  35927. me.bufferSetting = null;
  35928. }
  35929. }
  35930. }
  35931. ;// CONCATENATED MODULE: ./src/common/iServer/DataReturnOption.js
  35932. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35933. * This program are made available under the terms of the Apache License, Version 2.0
  35934. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35935. /**
  35936. * @class DataReturnOption
  35937. * @deprecatedclass SuperMap.DataReturnOption
  35938. * @category iServer Data Dataset
  35939. * @classdesc 数据返回设置类。
  35940. * @param {Object} options - 参数。
  35941. * @param {number} [options.expectCount=1000] - 设置返回的最大记录数,小于或者等于 0 时表示返回所有记录数。
  35942. * @param {string} [options.dataset] - 设置结果数据集标识,当 dataReturnMode 为 {@link DataReturnMode.DATASET_ONLY}或{@link DataReturnMode.DATASET_AND_RECORDSET}时有效,
  35943. * 作为返回数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示。
  35944. * @param {DataReturnMode} [options.dataReturnMode=DataReturnMode.RECORDSET_ONLY] - 数据返回模式。
  35945. * @param {boolean} [options.deleteExistResultDataset=true] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  35946. * @usage
  35947. */
  35948. class DataReturnOption {
  35949. constructor(options) {
  35950. /**
  35951. * @member {number} [DataReturnOption.prototype.expectCount=1000]
  35952. * @description 设置返回的最大记录数,小于或者等于0时表示返回所有记录数。
  35953. */
  35954. this.expectCount = 1000;
  35955. /**
  35956. * @member {string} [DataReturnOption.prototype.dataset]
  35957. * @description 设置结果数据集标识,当dataReturnMode为 {@link DataReturnMode.DATASET_ONLY}
  35958. * 或{@link DataReturnMode.DATASET_AND_RECORDSET}时有效,
  35959. * 作为返回数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示。
  35960. */
  35961. this.dataset = null;
  35962. /**
  35963. * @member {DataReturnMode} [DataReturnOption.prototype.dataReturnMode=DataReturnMode.RECORDSET_ONLY]
  35964. * @description 数据返回模式。
  35965. */
  35966. this.dataReturnMode = DataReturnMode.RECORDSET_ONLY;
  35967. /**
  35968. * @member {boolean} [DataReturnOption.prototype.deleteExistResultDataset=true]
  35969. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  35970. */
  35971. this.deleteExistResultDataset = true;
  35972. Util_Util.extend(this, options);
  35973. this.CLASS_NAME = "SuperMap.DataReturnOption";
  35974. }
  35975. /**
  35976. * @function DataReturnOption.prototype.destroy
  35977. * @description 释放资源,将引用资源的属性置空。
  35978. */
  35979. destroy() {
  35980. var me = this;
  35981. me.expectCount = null;
  35982. me.dataset = null;
  35983. me.dataReturnMode = null;
  35984. me.deleteExistResultDataset = null;
  35985. }
  35986. }
  35987. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetBufferAnalystParameters.js
  35988. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  35989. * This program are made available under the terms of the Apache License, Version 2.0
  35990. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35991. /**
  35992. * @class DatasetBufferAnalystParameters
  35993. * @deprecatedclass SuperMap.DatasetBufferAnalystParameters
  35994. * @category iServer SpatialAnalyst BufferAnalyst
  35995. * @classdesc 数据集缓冲区分析参数类。
  35996. * @param {Object} options - 参数。
  35997. * @param {string} options.dataset - 要用来做缓冲区分析的数据源中数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示。
  35998. * @param {FilterParameter} [options.filterQueryParameter] - 设置数据集中几何对象的过滤条件。只有满足此条件的几何对象才参与缓冲区分析。
  35999. * @param {DataReturnOption} [options.resultSetting] - 结果返回设置类。
  36000. * @param {boolean} [options.isAttributeRetained=true] - 是否保留进行缓冲区分析的对象的字段属性。当 isUnion 字段为 false 时该字段有效。
  36001. * @param {boolean} [options.isUnion=false] - 是否将缓冲区与源记录集中的对象合并后返回。对于面对象而言,要求源数据集中的面对象不相交。
  36002. * @param {BufferSetting} [options.bufferSetting] - 设置缓冲区通用参数。
  36003. *
  36004. * @extends {BufferAnalystParameters}
  36005. * @usage
  36006. */
  36007. class DatasetBufferAnalystParameters extends BufferAnalystParameters {
  36008. constructor(options) {
  36009. super(options);
  36010. /**
  36011. * @member {string} DatasetBufferAnalystParameters.prototype.dataset
  36012. * @description 要用来做缓冲区分析的数据源中数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示。
  36013. */
  36014. this.dataset = null;
  36015. /**
  36016. * @member {FilterParameter} [DatasetBufferAnalystParameters.prototype.filterQueryParameter]
  36017. * @description 设置数据集中几何对象的过滤条件。只有满足此条件的几何对象才参与缓冲区分析。
  36018. */
  36019. this.filterQueryParameter = new FilterParameter();
  36020. /**
  36021. * @member {DataReturnOption} [DatasetBufferAnalystParameters.prototype.resultSetting]
  36022. * @description 结果返回设置类。
  36023. */
  36024. this.resultSetting = new DataReturnOption();
  36025. /**
  36026. * @member {boolean} [DatasetBufferAnalystParameters.prototype.isAttributeRetained=true]
  36027. * @description 是否保留进行缓冲区分析的对象的字段属性。当 isUnion 字段为 false 时该字段有效。
  36028. */
  36029. this.isAttributeRetained = true;
  36030. /**
  36031. * @member {boolean} [DatasetBufferAnalystParameters.prototype.isUnion=false]
  36032. * @description 是否将缓冲区与源记录集中的对象合并后返回。对于面对象而言,要求源数据集中的面对象不相交。
  36033. */
  36034. this.isUnion = false;
  36035. Util_Util.extend(this, options);
  36036. this.CLASS_NAME = "SuperMap.DatasetBufferAnalystParameters";
  36037. }
  36038. /**
  36039. * @function DatasetBufferAnalystParameters.prototype.destroy
  36040. * @override
  36041. */
  36042. destroy() {
  36043. super.destroy();
  36044. var me = this;
  36045. me.dataset = null;
  36046. if (me.filterQueryParameter) {
  36047. me.filterQueryParameter.destroy();
  36048. me.filterQueryParameter = null;
  36049. }
  36050. if (me.resultSetting) {
  36051. me.resultSetting.destroy();
  36052. me.resultSetting = null;
  36053. }
  36054. me.isAttributeRetained = null;
  36055. me.isUnion = null;
  36056. }
  36057. /**
  36058. * @function DatasetBufferAnalystParameters.toObject
  36059. * @param {DatasetBufferAnalystParameters} datasetBufferAnalystParameters - 数据集缓冲区分析参数类。
  36060. * @param {DatasetBufferAnalystParameters} tempObj - 数据集缓冲区分析参数对象。
  36061. * @description 将数据集缓冲区分析参数对象转换为 JSON 对象。
  36062. * @returns {Object} JSON 对象。
  36063. */
  36064. static toObject(datasetBufferAnalystParameters, tempObj) {
  36065. for (var name in datasetBufferAnalystParameters) {
  36066. if (name === "bufferSetting") {
  36067. datasetBufferAnalystParameters.bufferSetting.radiusUnit = datasetBufferAnalystParameters.bufferSetting.radiusUnit.toUpperCase();
  36068. tempObj.bufferAnalystParameter = datasetBufferAnalystParameters.bufferSetting;
  36069. } else if (name === "resultSetting") {
  36070. tempObj.dataReturnOption = datasetBufferAnalystParameters.resultSetting;
  36071. } else if (name === "dataset") {
  36072. continue;
  36073. } else {
  36074. tempObj[name] = datasetBufferAnalystParameters[name];
  36075. }
  36076. }
  36077. }
  36078. }
  36079. ;// CONCATENATED MODULE: ./src/common/iServer/GeometryBufferAnalystParameters.js
  36080. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  36081. * This program are made available under the terms of the Apache License, Version 2.0
  36082. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36083. /**
  36084. * @class GeometryBufferAnalystParameters
  36085. * @deprecatedclass SuperMap.GeometryBufferAnalystParameters
  36086. * @category iServer SpatialAnalyst BufferAnalyst
  36087. * @classdesc 几何对象缓冲区分析参数类。
  36088. * 对指定的某个几何对象做缓冲区分析。通过该类可以指定要做缓冲区分析的几何对象、缓冲区参数等。
  36089. * @param {Object} options - 参数。
  36090. * @param {GeoJSONObject} options.sourceGeometry - 要做缓冲区分析的几何对象。
  36091. * @param {number} options.sourceGeometrySRID - 缓冲区几何对象投影坐标参数, 如 4326,3857。
  36092. * @param {BufferSetting} [options.bufferSetting] - 设置缓冲区通用参数。
  36093. * @extends {BufferAnalystParameters}
  36094. * @usage
  36095. */
  36096. class GeometryBufferAnalystParameters extends BufferAnalystParameters {
  36097. constructor(options) {
  36098. super(options);
  36099. /**
  36100. * @member {GeoJSONObject} GeometryBufferAnalystParameters.prototype.sourceGeometry
  36101. * @description 要做缓冲区分析的几何对象。<br>
  36102. * 点类型可以是:{@link GeometryPoint}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}。</br>
  36103. * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}。</br>
  36104. * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}。
  36105. */
  36106. this.sourceGeometry = null;
  36107. /**
  36108. * @member {number} GeometryBufferAnalystParameters.prototype.sourceGeometrySRID
  36109. * @description 缓冲区几何对象投影坐标参数, 如 4326,3857。
  36110. */
  36111. this.sourceGeometrySRID = null;
  36112. if (options) {
  36113. Util_Util.extend(this, options);
  36114. }
  36115. this.CLASS_NAME = " SuperMap.GeometryBufferAnalystParameters";
  36116. }
  36117. /**
  36118. * @function GeometryBufferAnalystParameters.prototype.destroy
  36119. * @override
  36120. */
  36121. destroy() {
  36122. super.destroy();
  36123. var me = this;
  36124. if (me.sourceGeometry) {
  36125. me.sourceGeometry.destroy();
  36126. me.sourceGeometry = null;
  36127. }
  36128. }
  36129. /**
  36130. * @function GeometryBufferAnalystParameters.toObject
  36131. * @param {GeometryBufferAnalystParameters} geometryBufferAnalystParameters - 几何对象缓冲区分析参数类。
  36132. * @param {GeometryBufferAnalystParameters} tempObj - 几何对象缓冲区分析参数对象。
  36133. * @description 将几何对象缓冲区分析参数对象转换为 JSON 对象。
  36134. * @returns {Object} JSON 对象。
  36135. */
  36136. static toObject(geometryBufferAnalystParameters, tempObj) {
  36137. for (var name in geometryBufferAnalystParameters) {
  36138. if (name === "bufferSetting") {
  36139. var tempBufferSetting = {};
  36140. for (var key in geometryBufferAnalystParameters.bufferSetting) {
  36141. tempBufferSetting[key] = geometryBufferAnalystParameters.bufferSetting[key];
  36142. }
  36143. tempObj.analystParameter = tempBufferSetting;
  36144. } else if (name === "sourceGeometry") {
  36145. tempObj.sourceGeometry = ServerGeometry.fromGeometry(geometryBufferAnalystParameters.sourceGeometry);
  36146. } else {
  36147. tempObj[name] = geometryBufferAnalystParameters[name];
  36148. }
  36149. }
  36150. }
  36151. }
  36152. ;// CONCATENATED MODULE: ./src/common/iServer/BufferAnalystService.js
  36153. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  36154. * This program are made available under the terms of the Apache License, Version 2.0
  36155. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36156. /**
  36157. * @class BufferAnalystService
  36158. * @deprecatedclass SuperMap.BufferAnalystService
  36159. * @category iServer SpatialAnalyst BufferAnalyst
  36160. * @classdesc 缓冲区分析服务类。
  36161. * 该类负责将客户设置的缓冲区分析参数传递给服务端,并接收服务端返回的缓冲区分析结果数据。
  36162. * 缓冲区分析结果通过该类支持的事件的监听函数参数获取。
  36163. * @param {string} url - 服务的访问地址。如:http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  36164. * @param {Object} options - 参数。
  36165. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  36166. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  36167. * @param {Object} [options.headers] - 请求头。
  36168. * @extends {SpatialAnalystBase}
  36169. * @example 例如:
  36170. * (start code)
  36171. * var myBufferAnalystService = new BufferAnalystService(url, {
  36172. * eventListeners: {
  36173. * "processCompleted": bufferCompleted,
  36174. * "processFailed": bufferFailed
  36175. * }
  36176. * });
  36177. * (end)
  36178. * @usage
  36179. */
  36180. class BufferAnalystService extends SpatialAnalystBase {
  36181. constructor(url, options) {
  36182. super(url, options);
  36183. /**
  36184. * @member {string} BufferAnalystService.prototype.mode
  36185. * @description 缓冲区分析类型
  36186. */
  36187. this.mode = null;
  36188. if (options) {
  36189. Util_Util.extend(this, options);
  36190. }
  36191. this.CLASS_NAME = "SuperMap.BufferAnalystService";
  36192. }
  36193. /**
  36194. * @function BufferAnalystService.prototype.destroy
  36195. * @override
  36196. */
  36197. destroy() {
  36198. super.destroy();
  36199. this.mode = null;
  36200. }
  36201. /**
  36202. * @method BufferAnalystService.prototype.processAsync
  36203. * @description 负责将客户端的查询参数传递到服务端。
  36204. * @param {BufferAnalystParameters} parameter - 缓冲区分析参数
  36205. */
  36206. processAsync(parameter) {
  36207. var parameterObject = {};
  36208. var me = this;
  36209. if (parameter instanceof DatasetBufferAnalystParameters) {
  36210. me.mode = 'datasets';
  36211. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/buffer');
  36212. DatasetBufferAnalystParameters.toObject(parameter, parameterObject);
  36213. } else if (parameter instanceof GeometryBufferAnalystParameters) {
  36214. me.mode = 'geometry';
  36215. me.url = Util_Util.urlPathAppend(me.url, 'geometry/buffer');
  36216. GeometryBufferAnalystParameters.toObject(parameter, parameterObject);
  36217. }
  36218. var jsonParameters = Util_Util.toJSON(parameterObject);
  36219. this.returnContent = true;
  36220. me.request({
  36221. method: "POST",
  36222. data: jsonParameters,
  36223. scope: me,
  36224. success: me.serviceProcessCompleted,
  36225. failure: me.serviceProcessFailed
  36226. });
  36227. }
  36228. dataFormat() {
  36229. return [DataFormat.GEOJSON, DataFormat.ISERVER, DataFormat.FGB];
  36230. }
  36231. }
  36232. ;// CONCATENATED MODULE: ./src/common/iServer/DensityKernelAnalystParameters.js
  36233. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  36234. * This program are made available under the terms of the Apache License, Version 2.0
  36235. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36236. /**
  36237. * @class DensityKernelAnalystParameters
  36238. * @deprecatedclass SuperMap.DensityKernelAnalystParameters
  36239. * @category iServer SpatialAnalyst DensityAnalyst
  36240. * @classdesc 核密度分析参数类。
  36241. * @param {Object} options - 参数。
  36242. * @param {string} options.dataset - 要用来做核密度分析数据源中数据集的名称。该名称用形如 "数据集名称@数据源别名" 形式来表示,例如:BaseMap_P@Jingjin。
  36243. * @param {string} options.fieldName - 用于进行核密度分析的测量值的字段名称,核密度分析不支持文本类型的字段。
  36244. * @param {string} options.resultGridName - 指定结果数据集名称。
  36245. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} [options.bounds] - 核密度分析的范围,用于确定结果栅格数据集的范围。如果缺省,则默认为原数据集的范围。
  36246. * @param {number} [options.searchRadius] - 栅格邻域内用于计算密度的查找半径,单位与当前数据集相同。默认值为当前数据集的长宽中的最大值除30。
  36247. * @param {number} [options.resultGridDatasetResolution] - 密度分析结果栅格数据的分辨率,单位与当前数据集相同。默认值为当前数据集的长宽中的最小值除500。
  36248. * @param {string} [options.targetDatasource] - 指定的存储结果数据集的数据源,默认为当前分析的数据集所在的数据源。
  36249. * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  36250. * @usage
  36251. */
  36252. class DensityKernelAnalystParameters {
  36253. constructor(options) {
  36254. /**
  36255. * @member {string} DensityKernelAnalystParameters.prototype.dataset
  36256. * @description 要用来做核密度分析数据源中数据集的名称。
  36257. * 该名称用形如 "数据集名称@数据源别名" 形式来表示,例如:Railway@Changchun。
  36258. * 注:核密度分析支持点数据集和线数据集。
  36259. */
  36260. this.dataset = null;
  36261. /**
  36262. * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} [DensityKernelAnalystParameters.prototype.bounds]
  36263. * @description 核密度分析的范围,用于确定结果栅格数据集的范围。
  36264. * 如果缺省,则默认为原数据集的范围。
  36265. */
  36266. this.bounds = null;
  36267. /**
  36268. * @member {string} DensityKernelAnalystParameters.prototype.fieldName
  36269. * @description 用于进行核密度分析的测量值的字段名称,核密度分析不支持文本类型的字段。
  36270. */
  36271. this.fieldName = null;
  36272. /**
  36273. * @member {number} [DensityKernelAnalystParameters.prototype.resultGridDatasetResolution]
  36274. * @description 密度分析结果栅格数据的分辨率,单位与当前数据集相同。默认值为当前数据集的长宽中的最小值除500。
  36275. */
  36276. this.resultGridDatasetResolution = null;
  36277. /**
  36278. * @member {number} [DensityKernelAnalystParameters.prototype.searchRadius]
  36279. * @description 栅格邻域内用于计算密度的查找半径,单位与当前数据集相同。默认值为当前数据集的长宽中的最大值除30。
  36280. */
  36281. this.searchRadius = null;
  36282. /**
  36283. * @member {string} [DensityKernelAnalystParameters.prototype.targetDatasource]
  36284. * @description 指定的存储结果数据集的数据源,默认为当前分析的数据集所在的数据源。
  36285. */
  36286. this.targetDatasource = null;
  36287. /**
  36288. * @member {string} DensityKernelAnalystParameters.prototype.resultGridName
  36289. * @description 指定结果数据集名称。
  36290. */
  36291. this.resultGridName = null;
  36292. /**
  36293. * @member {boolean} [DensityKernelAnalystParameters.prototype.deleteExistResultDataset=false]
  36294. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  36295. */
  36296. this.deleteExistResultDataset = false;
  36297. Util_Util.extend(this, options);
  36298. this.CLASS_NAME = "SuperMap.DensityKernelAnalystParameters";
  36299. }
  36300. /**
  36301. * @function DensityKernelAnalystParameters.prototype.destroy
  36302. * @description 释放资源,将引用资源的属性置空。
  36303. */
  36304. destroy() {
  36305. var me = this;
  36306. me.dataset = null;
  36307. me.bounds = null;
  36308. me.fieldName = null;
  36309. me.resultGridDatasetResolution = null;
  36310. me.searchRadius = null;
  36311. me.targetDatasource = null;
  36312. me.resultGridName = null;
  36313. me.deleteExistResultDataset = null;
  36314. }
  36315. /**
  36316. * @function DensityKernelAnalystParameters.toObject
  36317. * @param {DensityKernelAnalystParameters} densityKernelAnalystParameters -核密度分析参数类。
  36318. * @param {DensityKernelAnalystParameters} tempObj - 核密度分析参数对象。
  36319. * @description 将核密度分析参数对象转换成 JSON 对象。
  36320. * @returns JSON 对象。
  36321. */
  36322. static toObject(densityKernelAnalystParameters, tempObj) {
  36323. for (var name in densityKernelAnalystParameters) {
  36324. if (name !== "dataset") {
  36325. tempObj[name] = densityKernelAnalystParameters[name];
  36326. }
  36327. }
  36328. }
  36329. }
  36330. ;// CONCATENATED MODULE: ./src/common/iServer/DensityAnalystService.js
  36331. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  36332. * This program are made available under the terms of the Apache License, Version 2.0
  36333. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36334. /**
  36335. * @class DensityAnalystService
  36336. * @deprecatedclass SuperMap.DensityAnalystService
  36337. * @category iServer SpatialAnalyst DensityAnalyst
  36338. * @classdesc
  36339. * 密度分析服务类,密度分析可计算每个输出栅格像元周围圆形邻域内输入的点或线对象的密度。
  36340. * 密度分析,在某种意义上来说,相当于在表面上将输入的点线对象的测量值散开来,将每个点或线对象的测量量分布在整个研究区域,并计算输出栅格中每个像元的密度值。目前提供1种密度分析:核密度分析(Kernel)。
  36341. * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst 。
  36342. * @param {Object} options - 参数。
  36343. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  36344. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  36345. * @param {Object} [options.headers] - 请求头。
  36346. * @extends {SpatialAnalystBase}
  36347. * @example 例如:
  36348. * var myDensityAnalystService = new DensityAnalystService(url);
  36349. * myDensityAnalystService.on({
  36350. * "processCompleted": processCompleted,
  36351. * "processFailed": processFailed
  36352. * }
  36353. * );
  36354. * @usage
  36355. */
  36356. class DensityAnalystService extends SpatialAnalystBase {
  36357. constructor(url, options) {
  36358. super(url, options);
  36359. /**
  36360. * @member {string} DensityAnalystService.prototype.mode
  36361. * @description 密度分析类型。
  36362. */
  36363. this.mode = null;
  36364. if (options) {
  36365. Util_Util.extend(this, options);
  36366. }
  36367. this.CLASS_NAME = "SuperMap.DensityAnalystService";
  36368. }
  36369. /**
  36370. * @function DensityAnalystService.prototype.destroy
  36371. * @description 释放资源,将引用资源的属性置空。
  36372. */
  36373. destroy() {
  36374. super.destroy();
  36375. this.mode = null;
  36376. }
  36377. /**
  36378. * @function DensityAnalystService.prototype.processAsync
  36379. * @description 负责将客户端的查询参数传递到服务端。
  36380. * @param {DensityKernelAnalystParameters} parameter - 核密度分析参数。
  36381. */
  36382. processAsync(parameter) {
  36383. var me = this;
  36384. var parameterObject = new Object();
  36385. if (parameter instanceof DensityKernelAnalystParameters) {
  36386. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/densityanalyst/kernel');
  36387. me.mode = "kernel";
  36388. }
  36389. DensityKernelAnalystParameters.toObject(parameter, parameterObject);
  36390. var jsonParameters = Util_Util.toJSON(parameterObject);
  36391. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  36392. me.request({
  36393. method: "POST",
  36394. data: jsonParameters,
  36395. scope: me,
  36396. success: me.serviceProcessCompleted,
  36397. failure: me.serviceProcessFailed
  36398. });
  36399. }
  36400. }
  36401. ;// CONCATENATED MODULE: ./src/common/iServer/GenerateSpatialDataParameters.js
  36402. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  36403. * This program are made available under the terms of the Apache License, Version 2.0
  36404. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36405. /**
  36406. * @class GenerateSpatialDataParameters
  36407. * @deprecatedclass SuperMap.GenerateSpatialDataParameters
  36408. * @category iServer SpatialAnalyst GenerateSpatialData
  36409. * @classdesc 动态分段操作参数类。通过该类可以为动态分段提供参数信息。
  36410. * @param {Object} options - 参数。
  36411. * @param {string} options.routeTable - 路由数据集。
  36412. * @param {string} options.routeIDField - 路由数据集的标识字段。
  36413. * @param {string} options.eventTable - 用于生成空间数据的事件表名。
  36414. * @param {DataReturnOption} options.dataReturnOption - 设置数据返回选项。
  36415. * @param {string} [options.attributeFilter] - 属性过滤条件。
  36416. * @param {string} options.eventRouteIDField - 用于生成空间数据的事件表的路由标识字段。
  36417. * @param {string} [options.measureField] - 用于生成空间数据的事件表的刻度字段,只有当事件为点事件的时候该属性才有意义。
  36418. * @param {string} [options.measureStartField] - 用于生成空间数据的事件表的起始刻度字段,只有当事件为线事件的时候该属性才有意义。
  36419. * @param {string} [options.measureEndField] - 用于生成空间数据的事件表的终止刻度字段,只有当事件为线事件的时候该属性才有意义。
  36420. * @param {string} [options.measureOffsetField] - 刻度偏移量字段。
  36421. * @param {string} [options.errorInfoField] - 错误信息字段,直接写入原事件表,用于描述事件未能生成对应的点或线时的错误信息。
  36422. * @param {Array.<string>} [options.retainedFields] - 欲保留到结果空间数据中的字段集合(系统字段除外)。
  36423. * @usage
  36424. */
  36425. class GenerateSpatialDataParameters {
  36426. constructor(options) {
  36427. /**
  36428. * @member {string} GenerateSpatialDataParameters.prototype.routeTable
  36429. * @description 路由数据集。
  36430. */
  36431. this.routeTable = null;
  36432. /**
  36433. * @member {string} GenerateSpatialDataParameters.prototype.routeIDField
  36434. * @description 路由数据集的标识字段。
  36435. */
  36436. this.routeIDField = null;
  36437. /**
  36438. * @member {string} [GenerateSpatialDataParameters.prototype.attributeFilter]
  36439. * @description 属性过滤条件。
  36440. * 当 {@link GenerateSpatialDataParameters.prototype.dataReturnOption.dataReturnMode} 为 {@link DataReturnMode.DATASET_AND_RECORDSET} 或 {@link DataReturnMode.RECORDSET_ONLY} 时有效。
  36441. */
  36442. this.attributeFilter = null;
  36443. /**
  36444. * @member {string} GenerateSpatialDataParameters.prototype.eventTable
  36445. * @description 用于生成空间数据的事件表名。
  36446. */
  36447. this.eventTable = null;
  36448. /**
  36449. * @member {string} GenerateSpatialDataParameters.prototype.eventRouteIDField
  36450. * @description 用于生成空间数据的事件表的路由标识字段。
  36451. */
  36452. this.eventRouteIDField = null;
  36453. /**
  36454. * @member {string} [GenerateSpatialDataParameters.prototype.measureField]
  36455. * @description 用于生成空间数据的事件表的刻度字段,只有当事件为点事件的时候该属性才有意义。
  36456. */
  36457. this.measureField = null;
  36458. /**
  36459. * @member {string} [GenerateSpatialDataParameters.prototype.measureStartField]
  36460. * @description 用于生成空间数据的事件表的起始刻度字段,只有当事件为线事件的时候该属性才有意义。
  36461. */
  36462. this.measureStartField = null;
  36463. /**
  36464. * @member {string} [GenerateSpatialDataParameters.prototype.measureEndField]
  36465. * @description 用于生成空间数据的事件表的终止刻度字段,只有当事件为线事件的时候该属性才有意义。
  36466. */
  36467. this.measureEndField = null;
  36468. /**
  36469. * @member {string} [GenerateSpatialDataParameters.prototype.measureOffsetField]
  36470. * @description 刻度偏移量字段。
  36471. */
  36472. this.measureOffsetField = null;
  36473. /**
  36474. * @member {string} [GenerateSpatialDataParameters.prototype.errorInfoField]
  36475. * @description 错误信息字段,直接写入原事件表,用于描述事件未能生成对应的点或线时的错误信息。
  36476. */
  36477. this.errorInfoField = null;
  36478. /**
  36479. * @member {Array.<string>} [GenerateSpatialDataParameters.prototype.retainedFields]
  36480. * @description 欲保留到结果空间数据中的字段集合(系统字段除外)。
  36481. * 生成空间数据时,无论是否指定保留字段,路由 ID 字段、刻度偏移量字段、刻度值字段(点事件为刻度字段,线事件是起始和终止刻度字段)都会保留到结果空间数据中;
  36482. * 如果没有指定 retainedFields 参数或者 retainedFields 参数数组长度为 0,则返回所有用户字段。
  36483. */
  36484. this.retainedFields = null;
  36485. /**
  36486. * @member {DataReturnOption} GenerateSpatialDataParameters.prototype.dataReturnOption
  36487. * @description 设置数据返回的选项。
  36488. */
  36489. this.dataReturnOption = null;
  36490. if (options) {
  36491. Util_Util.extend(this, options);
  36492. }
  36493. this.CLASS_NAME = "SuperMap.GenerateSpatialDataParameters";
  36494. }
  36495. /**
  36496. * @function GenerateSpatialDataParameters.prototype.destroy
  36497. * @description 释放资源,将引用资源的属性置空。
  36498. */
  36499. destroy() {
  36500. var me = this;
  36501. if (me.routeTable) {
  36502. me.routeTable = null;
  36503. }
  36504. me.routeIDField = null;
  36505. me.attributeFilter = null;
  36506. me.eventTable = null;
  36507. me.eventRouteIDField = null;
  36508. me.measureField = null;
  36509. me.measureStartField = null;
  36510. me.measureEndField = null;
  36511. me.measureOffsetField = null;
  36512. me.errorInfoField = null;
  36513. if (me.dataReturnOption) {
  36514. me.dataReturnOption.destroy();
  36515. me.dataReturnOption = null;
  36516. }
  36517. }
  36518. }
  36519. ;// CONCATENATED MODULE: ./src/common/iServer/GenerateSpatialDataService.js
  36520. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  36521. * This program are made available under the terms of the Apache License, Version 2.0
  36522. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36523. /**
  36524. * @class GenerateSpatialDataService
  36525. * @deprecatedclass SuperMap.GenerateSpatialDataService
  36526. * @category iServer SpatialAnalyst GenerateSpatialData
  36527. * @classdesc 动态分段分析服务类。该类负责将客户设置的动态分段分析服务参数传递给服务端,并接收服务端返回的动态分段分析结果数据。
  36528. * 获取的结果数据包括 originResult 、result 两种,其中,originResult 为服务端返回的用 JSON 对象表示的动态分段分析结果数据,result 为服务端返回的动态分段分析结果数据。
  36529. * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  36530. * @param {Object} options - 参数。</br>
  36531. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  36532. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  36533. * @param {Object} [options.headers] - 请求头。
  36534. * @extends {SpatialAnalystBase}
  36535. * @example 实例化该类如下例所示:
  36536. * (start code)
  36537. * function GenerateSpatialData(){
  36538. *
  36539. * //配置数据返回选项(option)
  36540. * var option = new DataReturnOption({
  36541. * expectCount: 1000,
  36542. * dataset: "generateSpatialData",
  36543. * deleteExistResultDataset: true,
  36544. * dataReturnMode: DataReturnMode.DATASET_ONLY
  36545. * }),
  36546. * //配置动态分段参数(Parameters)
  36547. * parameters = new GenerateSpatialDataParameters({
  36548. * routeTable: "RouteDT_road@Changchun",
  36549. * routeIDField: "RouteID",
  36550. * eventTable: "LinearEventTabDT@Changchun",
  36551. * eventRouteIDField: "RouteID",
  36552. * measureField: "",
  36553. * measureStartField: "LineMeasureFrom",
  36554. * measureEndField: "LineMeasureTo",
  36555. * measureOffsetField: "",
  36556. * errorInfoField: "",
  36557. * retainedFields:[],
  36558. * dataReturnOption: option
  36559. * }),
  36560. * //配置动态分段iService
  36561. * iService = new GenerateSpatialDataService(Changchun_spatialanalyst, {
  36562. * eventListeners: {
  36563. * processCompleted: generateCompleted,
  36564. * processFailed: generateFailded
  36565. * }
  36566. * });
  36567. * //执行
  36568. * iService.processAsync(parameters);
  36569. * function Completed(generateSpatialDataEventArgs){//todo};
  36570. * function Error(generateSpatialDataEventArgs){//todo};
  36571. * (end)
  36572. * @usage
  36573. */
  36574. class GenerateSpatialDataService extends SpatialAnalystBase {
  36575. constructor(url, options) {
  36576. super(url, options);
  36577. this.CLASS_NAME = "SuperMap.GenerateSpatialDataService";
  36578. }
  36579. /**
  36580. * @function GenerateSpatialDataService.prototype.destroy
  36581. * @override
  36582. */
  36583. destroy() {
  36584. super.destroy();
  36585. }
  36586. /**
  36587. * @function GenerateSpatialDataService.prototype.processAsync
  36588. * @description 负责将客户端的动态分段服务参数传递到服务端。
  36589. * @param {GenerateSpatialDataParameters} params - 动态分段操作参数类。
  36590. */
  36591. processAsync(params) {
  36592. if (!(params instanceof GenerateSpatialDataParameters)) {
  36593. return;
  36594. }
  36595. var me = this,
  36596. jsonParameters;
  36597. jsonParameters = me.getJsonParameters(params);
  36598. me.request({
  36599. method: "POST",
  36600. data: jsonParameters,
  36601. scope: me,
  36602. success: me.serviceProcessCompleted,
  36603. failure: me.serviceProcessFailed
  36604. });
  36605. }
  36606. /**
  36607. * @function GenerateSpatialDataService.prototype.getJsonParameters
  36608. * @description 将参数转化为 JSON 字符串。
  36609. * @param {GenerateSpatialDataParameters} params - 动态分段操作参数类。
  36610. * @returns {string}转化后的JSON字符串。
  36611. */
  36612. getJsonParameters(params) {
  36613. var jsonParameters = "",
  36614. jsonStr = "datasets/" + params.routeTable + "/linearreferencing/generatespatialdata",
  36615. me = this;
  36616. me.url = Util_Util.urlPathAppend(me.url, jsonStr);
  36617. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  36618. jsonParameters = Util_Util.toJSON(params);
  36619. return jsonParameters;
  36620. }
  36621. }
  36622. ;// CONCATENATED MODULE: ./src/common/iServer/GeoRelationAnalystParameters.js
  36623. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  36624. * This program are made available under the terms of the Apache License, Version 2.0
  36625. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36626. /**
  36627. * @class GeoRelationAnalystParameters
  36628. * @deprecatedclass SuperMap.GeoRelationAnalystParameters
  36629. * @category iServer SpatialAnalyst GeoRelationAnalyst
  36630. * @classdesc 空间关系分析服务参数类。使用该类可以为空间关系分析服务提供所需的参数信息。
  36631. * @param {Object} options - 参数。
  36632. * @param {FilterParameter} options.sourceFilter - 空间关系分析中的源数据集查询参数。仅 name, ids, attributeFilter 和 fields 字段有效。
  36633. * @param {FilterParameter} options.referenceFilter - 空间关系分析中的参考数据集查询参数。仅 name, ids, attributeFilter 和 fields 字段有效。
  36634. * @param {SpatialRelationType} options.spatialRelationType - 指定的空间关系类型。
  36635. * @param {boolean} [options.isBorderInside] - 边界处理方式,即位于面边线上的点是否被面包含。此参数仅用于空间关系为包含或被包含的情况。
  36636. * @param {boolean} [options.returnFeature] - 是否返回 Feature 信息。
  36637. * @param {boolean} [options.returnGeoRelatedOnly=true] - 仅返回满足指定空间关系的空间对象。
  36638. * @param {number} [options.startRecord=0] - 分析结果起始记录位置。
  36639. * @param {number} [options.expectCount=500] - 空间关系分析期望返回结果记录数,如果实际不足500条结果则返回所有分析结果。
  36640. * @usage
  36641. */
  36642. class GeoRelationAnalystParameters {
  36643. constructor(options) {
  36644. /**
  36645. * @member {string} GeoRelationAnalystParameters.prototype.dataset
  36646. * @description 源数据集名称。
  36647. */
  36648. this.dataset = null;
  36649. /**
  36650. * @member {FilterParameter} GeoRelationAnalystParameters.prototype.sourceFilter
  36651. * @description 空间关系分析中的源数据集查询参数。仅 ids、attributeFilter 和 fields 字段有效。
  36652. */
  36653. this.sourceFilter = null;
  36654. /**
  36655. * @member {FilterParameter} GeoRelationAnalystParameters.prototype.referenceFilter
  36656. * @description 空间关系分析中的参考数据集查询参数。仅 name,ids,attributeFilter 和 fields 字段有效。
  36657. */
  36658. this.referenceFilter = null;
  36659. /**
  36660. * @member {SpatialRelationType} GeoRelationAnalystParameters.prototype.spatialRelationType
  36661. * @description 指定的空间关系类型。
  36662. */
  36663. this.spatialRelationType = null;
  36664. /**
  36665. * @member {boolean} [GeoRelationAnalystParameters.prototype.isBorderInside]
  36666. * @description 边界处理方式,即位于面边线上的点是否被面包含。此参数仅用于空间关系为包含或被包含的情况。
  36667. */
  36668. this.isBorderInside = null;
  36669. /**
  36670. * @member {boolean} [GeoRelationAnalystParameters.prototype.returnFeature]
  36671. * @description 是否返回 Feature 信息。
  36672. */
  36673. this.returnFeature = null;
  36674. /**
  36675. * @member {boolean} [GeoRelationAnalystParameters.prototype.returnGeoRelatedOnly=true]
  36676. * @description 是否仅返回满足指定空间关系的空间对象。
  36677. */
  36678. this.returnGeoRelatedOnly = null;
  36679. /**
  36680. * @member {number} [GeoRelationAnalystParameters.prototype.returnGeoRelatedOnly=0]
  36681. * @description 分析结果起始记录位置。
  36682. */
  36683. this.startRecord = 0;
  36684. /**
  36685. * @member {number} [GeoRelationAnalystParameters.prototype.expectCount=500]
  36686. * @description 空间关系分析期望返回结果记录数,如果实际不足 500 条结果则返回所有分析结果。
  36687. */
  36688. this.expectCount = 500;
  36689. if (options) {
  36690. Util_Util.extend(this, options);
  36691. }
  36692. this.CLASS_NAME = "SuperMap.GeoRelationAnalystParameters";
  36693. }
  36694. /**
  36695. * @function GeoRelationAnalystParameters.prototype.destroy
  36696. * @description 释放资源,将引用资源的属性置空。
  36697. */
  36698. destroy() {
  36699. var me = this;
  36700. if (me.sourceFilter) {
  36701. me.sourceFilter.destroy();
  36702. }
  36703. me.sourceFilter = null;
  36704. if (me.referenceFilter) {
  36705. me.referenceFilter.destroy();
  36706. }
  36707. me.referenceFilter = null;
  36708. me.dataset = null;
  36709. me.spatialRelationType = null;
  36710. me.isBorderInside = null;
  36711. me.returnFeature = null;
  36712. me.returnGeoRelatedOnly = null;
  36713. me.startRecord = null;
  36714. me.expectCount = null;
  36715. }
  36716. }
  36717. ;// CONCATENATED MODULE: ./src/common/iServer/GeoRelationAnalystService.js
  36718. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  36719. * This program are made available under the terms of the Apache License, Version 2.0
  36720. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36721. /**
  36722. * @class GeoRelationAnalystService
  36723. * @deprecatedclass SuperMap.GeoRelationAnalystService
  36724. * @category iServer SpatialAnalyst GeoRelationAnalyst
  36725. * @classdesc 空间关系分析服务类。该类负责将客户设置的空间关系分析服务参数传递给服务端,并接收服务端返回的空间关系分析结果数据。
  36726. * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  36727. * @param {Object} options - 参数。
  36728. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  36729. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  36730. * @param {Object} [options.headers] - 请求头。
  36731. * @extends {SpatialAnalystBase}
  36732. * @example 实例化该类如下例所示:
  36733. * (start code)
  36734. * function datasetGeoRelationAnalystProcess() {
  36735. * var referenceFilter = new FilterParameter({
  36736. * name:"Frame_R@Changchun",
  36737. * attributeFilter:"SmID>0"});
  36738. * var sourceFilter = new FilterParameter({
  36739. * attributeFilter:"SmID>0"});
  36740. * //初始化服务类
  36741. * var datasetGeoRelationService = new GeoRelationAnalystService(
  36742. * "http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst/"),
  36743. * //构建参数类
  36744. * datasetGeoRelationParameters = new GeoRelationAnalystParameters({
  36745. * dataset: "Park@Changchun",
  36746. * startRecord: 0,
  36747. * expectCount: 20,
  36748. * sourceFilter: sourceFilter,
  36749. * referenceFilter: referenceFilter,
  36750. * spatialRelationType: SpatialRelationType.INTERSECT,
  36751. * isBorderInside: true,
  36752. * returnFeature: true,
  36753. * returnGeoRelatedOnly: true
  36754. * });
  36755. * datasetGeoRelationService.events.on({
  36756. * "processCompleted": datasetGeoRelationAnalystCompleted,
  36757. * "processFailed": datasetGeoRelationAnalystFailed});
  36758. * //执行
  36759. * datasetGeoRelationService.processAsync(datasetGeoRelationParameters);
  36760. * }
  36761. * function Completed(datasetGeoRelationAnalystCompleted){//todo};
  36762. * function Error(datasetGeoRelationAnalystFailed){//todo};
  36763. * (end)
  36764. * @usage
  36765. */
  36766. class GeoRelationAnalystService extends SpatialAnalystBase {
  36767. constructor(url, options) {
  36768. super(url, options);
  36769. this.CLASS_NAME = "SuperMap.GeoRelationAnalystService";
  36770. }
  36771. /**
  36772. * @function GeoRelationAnalystService.prototype.destroy
  36773. * @override
  36774. */
  36775. destroy() {
  36776. super.destroy();
  36777. }
  36778. /**
  36779. * @function GeoRelationAnalystService.prototype.processAsync
  36780. * @description 负责将客户端的空间关系分析参数传递到服务端
  36781. * @param {GeoRelationAnalystParameters} parameter - 空间关系分析所需的参数信息。
  36782. */
  36783. processAsync(parameter) {
  36784. if (!(parameter instanceof GeoRelationAnalystParameters)) {
  36785. return;
  36786. }
  36787. var me = this;
  36788. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/georelation');
  36789. var jsonParameters = Util_Util.toJSON(parameter);
  36790. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  36791. me.request({
  36792. method: "POST",
  36793. data: jsonParameters,
  36794. scope: me,
  36795. success: me.serviceProcessCompleted,
  36796. failure: me.serviceProcessFailed
  36797. });
  36798. }
  36799. }
  36800. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationAnalystParameters.js
  36801. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  36802. * This program are made available under the terms of the Apache License, Version 2.0
  36803. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36804. /**
  36805. * @class InterpolationAnalystParameters
  36806. * @deprecatedclass SuperMap.InterpolationAnalystParameters
  36807. * @category iServer SpatialAnalyst InterpolationAnalyst
  36808. * @classdesc 插值分析参数类。
  36809. * @param {Object} options - 参数。
  36810. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  36811. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  36812. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  36813. * @param {string} [options.zValueFieldName] - 进行插值分析的字段名称,插值分析不支持文本类型的字段。
  36814. * @param {string} [options.dataset] - 待分析的数据集名称。当插值分析类型(InterpolationAnalystType)为 dataset 时,此为必选参数。
  36815. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(InterpolationAnalystType)为 geometry 时,此参数为必设参数。
  36816. * @param {number} [options.searchRadius=0] - 查找半径,即参与运算点的查找范围,与点数据集单位相同。
  36817. * @param {number} [options.zValueScale=1] - 进行插值分析值的缩放比率。
  36818. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  36819. * @param {FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  36820. * @param {PixelFormat} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  36821. * @param {string} [options.InterpolationAnalystType="dataset"] - 插值分析类型("dataset" 或 "geometry")。
  36822. * @usage
  36823. */
  36824. class InterpolationAnalystParameters {
  36825. constructor(options) {
  36826. if (!options) {
  36827. return;
  36828. }
  36829. /**
  36830. * @member {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} InterpolationAnalystParameters.prototype.bounds
  36831. * @description 插值分析的范围,用于确定结果栅格数据集的范围。
  36832. * 如果缺省,则默认为原数据集的范围。鉴于此插值方法为内插方法,原数据集的范围内的插值结果才相对有参考价值,
  36833. * 因此建议此参数不大于原数据集范围。
  36834. */
  36835. this.bounds = null;
  36836. /**
  36837. * @member {number} [InterpolationAnalystParameters.prototype.searchRadius=0]
  36838. * @description 查找半径,即参与运算点的查找范围,与点数据集单位相同。
  36839. * 计算某个位置的 Z 值时,会以该位置为圆心,以查找范围的值为半径,落在这个范围内的采样点都将参与运算。
  36840. * 该值需要根据待插值点数据的分布状况和点数据集范围进行设置。
  36841. */
  36842. this.searchRadius = 0;
  36843. /**
  36844. * @member {string} InterpolationAnalystParameters.prototype.zValueFieldName
  36845. * @description 数据集插值分析中,用于指定进行插值分析的目标字段名,插值分析不支持文本类型的字段。
  36846. * 含义为每个插值点在插值过程中的权重,可以将所有点此字段值设置为 1,即所有点在整体插值中权重相同。
  36847. * 当插值分析类型(InterpolationAnalystType)为 dataset 时,此为必选参数。
  36848. */
  36849. this.zValueFieldName = null;
  36850. /**
  36851. * @member {number} [InterpolationAnalystParameters.prototype.zValueScale=1]
  36852. * @description 用于进行插值分析值的缩放比率。
  36853. * 参加插值分析的值将乘以该参数值后再进行插值,也就是对进行插值分析的值进行统一的扩大或缩小。
  36854. */
  36855. this.zValueScale = 1;
  36856. /**
  36857. * @member {number} InterpolationAnalystParameters.prototype.resolution
  36858. * @description 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  36859. * 该值不能超过待分析数据集的范围边长。
  36860. * 且该值设置时,应该考虑点数据集范围大小来取值,一般为结果栅格行列值(即结果栅格数据集范围除以分辨率),在 500 以内可以较好地体现密度走势。
  36861. */
  36862. this.resolution = null;
  36863. /**
  36864. * @member {FilterParameter} [InterpolationAnalystParameters.prototype.filterQueryParameter]
  36865. * @description 过滤条件,对分析数据集中的点进行过滤,设置为 null 表示对数据集中的所有点进行分析。
  36866. */
  36867. this.filterQueryParameter = null;
  36868. /**
  36869. * @member {string} InterpolationAnalystParameters.prototype.outputDatasetName
  36870. * @description 插值分析结果数据集的名称。
  36871. */
  36872. this.outputDatasetName = null;
  36873. /**
  36874. * @member {string} InterpolationAnalystParameters.prototype.outputDatasourceName
  36875. * @description 插值分析结果数据源的名称。
  36876. */
  36877. this.outputDatasourceName = null;
  36878. /**
  36879. * @member {PixelFormat} [InterpolationAnalystParameters.prototype.pixelFormat]
  36880. * @description 指定结果栅格数据集存储的像素格式。支持存储的像素格式有 BIT16、BIT32、DOUBLE、SINGLE、UBIT1、UBIT4、UBIT8、UBIT24、UBIT32。
  36881. */
  36882. this.pixelFormat = null;
  36883. /**
  36884. * @member {string} [InterpolationAnalystParameters.prototype.dataset]
  36885. * @description 用来做插值分析的数据源中数据集的名称,该名称用形如 "数据集名称@数据源别名" 形式来表示。
  36886. * 当插值分析类型(InterpolationAnalystType)为 dataset 时,此为必选参数。
  36887. */
  36888. this.dataset = null;
  36889. /**
  36890. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} [InterpolationAnalystParameters.prototype.inputPoints]
  36891. * @description 用于做插值分析的离散点(离散点包括Z值)集合。
  36892. * 当插值分析类型(InterpolationAnalystType)为 geometry 时,此参数为必设参数。
  36893. * 通过离散点直接进行插值分析不需要指定输入数据集inputDatasourceName,inputDatasetName以及zValueFieldName。
  36894. */
  36895. this.inputPoints = null;
  36896. /**
  36897. * @member {string} [InterpolationAnalystParameters.prototype.InterpolationAnalystType="dataset"]
  36898. * @description 插值分析类型。插值分析包括数据集插值分析和几何插值分析两类,
  36899. * "dataset" 表示对数据集进行插值分析,"geometry" 表示对离散点数组进行插值分析。
  36900. */
  36901. this.InterpolationAnalystType = "dataset";
  36902. /**
  36903. * @member {ClipParameter} InterpolationAnalystParameters.prototype.clipParam
  36904. * @description 对插值分析结果进行裁剪的参数。
  36905. */
  36906. this.clipParam = null;
  36907. Util_Util.extend(this, options);
  36908. this.CLASS_NAME = "SuperMap.InterpolationAnalystParameters";
  36909. }
  36910. /**
  36911. * @function InterpolationAnalystParameters.prototype.destroy
  36912. * @description 释放资源,将引用资源的属性置空。
  36913. */
  36914. destroy() {
  36915. var me = this;
  36916. me.bounds = null;
  36917. me.searchRadius = null;
  36918. me.zValueFieldName = null;
  36919. me.zValueScale = null;
  36920. me.resolution = null;
  36921. me.filterQueryParameter = null;
  36922. me.outputDatasetName = null;
  36923. me.pixelFormat = null;
  36924. }
  36925. /**
  36926. * @function InterpolationAnalystParameters.toObject
  36927. * @param {InterpolationAnalystParameters} interpolationAnalystParameters - 插值分析参数类。
  36928. * @param {InterpolationAnalystParameters} tempObj - 插值分析参数对象。
  36929. * @description 将插值分析参数对象转换成 JSON 对象。
  36930. * @returns JSON 对象。
  36931. */
  36932. static toObject(interpolationAnalystParameters, tempObj) {
  36933. for (var name in interpolationAnalystParameters) {
  36934. if (name === "inputPoints" && interpolationAnalystParameters.InterpolationAnalystType === "geometry") {
  36935. var objs = [];
  36936. for (var i = 0; i < interpolationAnalystParameters.inputPoints.length; i++) {
  36937. var item = interpolationAnalystParameters.inputPoints[i];
  36938. var obj = {
  36939. x: item.x,
  36940. y: item.y,
  36941. z: item.tag
  36942. };
  36943. objs.push(obj);
  36944. }
  36945. tempObj[name] = objs;
  36946. } else {
  36947. tempObj[name] = interpolationAnalystParameters[name];
  36948. }
  36949. }
  36950. }
  36951. }
  36952. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationRBFAnalystParameters.js
  36953. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  36954. * This program are made available under the terms of the Apache License, Version 2.0
  36955. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36956. /**
  36957. * @class InterpolationRBFAnalystParameters
  36958. * @deprecatedclass SuperMap.InterpolationRBFAnalystParameters
  36959. * @category iServer SpatialAnalyst InterpolationAnalyst
  36960. * @classdesc 样条插值(径向基函数插值法)分析参数类。
  36961. * @extends {InterpolationAnalystParameters}
  36962. * @param {Object} options - 参数。
  36963. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  36964. * @param {string} options.searchMode - 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。
  36965. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  36966. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  36967. * @param {string} [options.zValueFieldName] - 存储用于进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,此为必选参数。
  36968. * @param {number} [options.smooth=0.1] - 光滑系数,该值表示插值函数曲线与点的逼近程度,值域为0到1。
  36969. * @param {number} [options.tension=40] - 张力系数,用于调整结果栅格数据表面的特性。
  36970. * @param {number} [options.expectedCount=12] - 【固定点数查找】方式下,设置参与插值运算的点数。
  36971. * @param {number} [options.searchRadius=0] - 【定长查找】方式下,设置参与运算点的查找范围。
  36972. * @param {number} [options.maxPointCountForInterpolation=200] - 【块查找】方式下,设置最多参与插值的点数。
  36973. * @param {number} [options.maxPointCountInNode=50] - 【块查找】方式下,设置单个块内最多参与运算点数。
  36974. * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
  36975. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  36976. * @param {FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  36977. * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  36978. * @param {string} [options.dataset] - 要用来做插值分析的数据源中数据集的名称。该名称用形如”数据集名称@数据源别名”形式来表示。当插值分析类型(InterpolationAnalystType)为 dataset 时。此为必选参数。
  36979. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(InterpolationAnalystType)为 geometry 时。此为必选参数。
  36980. * @example
  36981. * var myInterpolationRBFAnalystParameters = new InterpolationRBFAnalystParameters({
  36982. * dataset:"SamplesP@Interpolation",
  36983. * smooth: 0.1,
  36984. * tension: 40,
  36985. * searchMode: "QUADTREE",
  36986. * maxPointCountForInterpolation: 20,
  36987. * maxPointCountInNode: 5,
  36988. * pixelFormat: "BIT16",
  36989. * zValueFieldName: "AVG_TMP",
  36990. * resolution: 3000,
  36991. * filterQueryParameter: {
  36992. * attributeFilter: ""
  36993. * },
  36994. * outputDatasetName: "myRBF"
  36995. * });
  36996. * @usage
  36997. */
  36998. class InterpolationRBFAnalystParameters extends InterpolationAnalystParameters {
  36999. constructor(options) {
  37000. super(options);
  37001. /**
  37002. * @member {number} [InterpolationRBFAnalystParameters.prototype.smooth=0.1]
  37003. * @description 光滑系数,值域为 0 到 1,常用取值如 0、0.001、0.01、0.1、和 0.5。
  37004. * 该值表示插值函数曲线与点的逼近程度,此数值越大,函数曲线与点的偏差越大,反之越小。
  37005. */
  37006. this.smooth = 0.1;
  37007. /**
  37008. * @member {number} [InterpolationRBFAnalystParameters.prototype.tension=40]
  37009. * @description 张力系数,常用取值如 0、1、5 和 10。
  37010. * 用于调整结果栅格数据表面的特性,张力越大,插值时每个点对计算结果影响越小,反之越大。
  37011. */
  37012. this.tension = 40;
  37013. /**
  37014. * @member {SearchMode} InterpolationRBFAnalystParameters.prototype.searchMode
  37015. * @description 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。必设参数。
  37016. * 具体如下:
  37017. * {KDTREE_FIXED_COUNT} 使用 KDTREE 的固定点数方式查找参与内插分析的点。
  37018. * {KDTREE_FIXED_RADIUS} 使用 KDTREE 的定长方式查找参与内插分析的点。
  37019. * {QUADTREE} 使用 QUADTREE 方式查找参与内插分析的点(块查找)。
  37020. */
  37021. this.searchMode = null;
  37022. /**
  37023. * @member {number} [InterpolationRBFAnalystParameters.prototype.expectedCount=12]
  37024. * @description 【固定点数查找】方式下,设置待查找的点数,即参与插值运算的点数。
  37025. */
  37026. this.expectedCount = 12;
  37027. /**
  37028. * @member {number} [InterpolationRBFAnalystParameters.prototype.maxPointCountForInterpolation=200]
  37029. * @description 【块查找】方式下,最多参与插值的点数。
  37030. */
  37031. this.maxPointCountForInterpolation = 200;
  37032. /**
  37033. * @member {number} [InterpolationRBFAnalystParameters.prototype.maxPointCountInNode=50]
  37034. * @description 【块查找】方式下,单个块内最多参与运算点数。
  37035. */
  37036. this.maxPointCountInNode = 50;
  37037. if (options) {
  37038. Util_Util.extend(this, options);
  37039. }
  37040. this.CLASS_NAME = "SuperMap.InterpolationRBFAnalystParameters";
  37041. }
  37042. /**
  37043. * @function InterpolationRBFAnalystParameters.prototype.destroy
  37044. * @description 释放资源,将引用资源的属性置空。
  37045. */
  37046. destroy() {
  37047. super.destroy();
  37048. var me = this;
  37049. me.smooth = null;
  37050. me.tension = null;
  37051. me.searchMode = null;
  37052. me.expectedCount = null;
  37053. me.maxPointCountForInterpolation = null;
  37054. me.maxPointCountInNode = null;
  37055. }
  37056. /**
  37057. * @function InterpolationRBFAnalystParameters.toObject
  37058. * @param {InterpolationRBFAnalystParameters} datasetInterpolationRBFAnalystParameters - 样条插值(径向基函数插值法)分析参数类。
  37059. * @param {InterpolationRBFAnalystParameters} tempObj - 样条插值(径向基函数插值法)分析参数对象。
  37060. * @description 将样条插值(径向基函数插值法)分析参数对象转换为 JSON 对象。
  37061. * @returns JSON 对象。
  37062. */
  37063. static toObject(datasetInterpolationRBFAnalystParameters, tempObj) {
  37064. for (var name in datasetInterpolationRBFAnalystParameters) {
  37065. tempObj[name] = datasetInterpolationRBFAnalystParameters[name];
  37066. }
  37067. }
  37068. }
  37069. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationDensityAnalystParameters.js
  37070. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37071. * This program are made available under the terms of the Apache License, Version 2.0
  37072. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37073. /**
  37074. * @class InterpolationDensityAnalystParameters
  37075. * @deprecatedclass SuperMap.InterpolationDensityAnalystParameters
  37076. * @category iServer SpatialAnalyst InterpolationAnalyst
  37077. * @classdesc 点密度插值分析参数类。
  37078. * @param {Object} options - 参数。
  37079. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  37080. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  37081. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  37082. * @param {number} [options.searchRadius=0] - 查找半径,即参与运算点的查找范围,与点数据集单位相同。
  37083. * @param {string} [options.zValueFieldName] - 进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型(InterpolationAnalystParameters.prototype.InterpolationAnalystType)为 dataset 时。此为必选参数。
  37084. * @param {number} [options.zValueScale=1] - 进行插值分析值的缩放比率。
  37085. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  37086. * @param {FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  37087. * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  37088. * @param {string} [options.dataset] - 用来做插值分析的数据源中数据集的名称,该名称用形如 "数据集名称@数据源别名" 形式来表示。当插值分析类型(InterpolationAnalystParameters.prototype.InterpolationAnalystType)为 dataset 时,此为必选参数。
  37089. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(InterpolationAnalystParameters.prototype.InterpolationAnalystType)为 geometry 时,此为必选参数。
  37090. * @extends {InterpolationAnalystParameters}
  37091. * @example
  37092. * var myInterpolationDensityAnalystParameters = new InterpolationDensityAnalystParameters({
  37093. * dataset: "SamplesP@Interpolation",
  37094. * searchRadius: "100000",
  37095. * pixelFormat: "BIT16",
  37096. * zValueFieldName: "AVG_TMP",
  37097. * resolution: 3000,
  37098. * filterQueryParameter: {
  37099. * attributeFilter: ""
  37100. * },
  37101. * outputDatasetName: "myDensity"
  37102. * });
  37103. * @usage
  37104. */
  37105. class InterpolationDensityAnalystParameters extends InterpolationAnalystParameters {
  37106. constructor(options) {
  37107. super(options);
  37108. if (options) {
  37109. Util_Util.extend(this, options);
  37110. }
  37111. this.CLASS_NAME = "SuperMap.InterpolationDensityAnalystParameters";
  37112. }
  37113. /**
  37114. * @function InterpolationDensityAnalystParameters.prototype.destroy
  37115. * @description 释放资源,将引用资源的属性置空。
  37116. */
  37117. destroy() {
  37118. super.destroy();
  37119. }
  37120. }
  37121. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationIDWAnalystParameters.js
  37122. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37123. * This program are made available under the terms of the Apache License, Version 2.0
  37124. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37125. /**
  37126. * @class InterpolationIDWAnalystParameters
  37127. * @deprecatedclass SuperMap.InterpolationIDWAnalystParameters
  37128. * @category iServer SpatialAnalyst InterpolationAnalyst
  37129. * @classdesc 反距离加权插值(IDW)分析参数类。
  37130. * @param {Object} options - 参数。
  37131. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  37132. * @param {string} options.searchMode - 插值运算时,查找参与运算点的方式,支持固定点数查找、定长查找。
  37133. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  37134. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  37135. * @param {string} [options.zValueFieldName] - 进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,此为必选参数。
  37136. * @param {number} [options.expectedCount=12] - 【固定点数查找】方式下,设置待查找的点数,即参与插值运算的点数。
  37137. * @param {number} [options.searchRadius=0] - 【定长查找】方式下,设置查找半径,即参与运算点的查找范围,与点数据集单位相同。
  37138. * @param {number} [options.power=2] - 距离权重计算的幂次。
  37139. * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
  37140. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  37141. * @param {FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  37142. * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  37143. * @param {string} [options.dataset] - 要用来做插值分析的数据源中数据集的名称。该名称用形如”数据集名称@数据源别名”形式来表示。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,此为必选参数。
  37144. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(SuperMap.InterpolationAnalystType)为 geometry 时,此为必选参数。
  37145. * @extends {InterpolationAnalystParameters}
  37146. * @example 例如:
  37147. * var myInterpolationIDWAnalystParameters = new InterpolationIDWAnalystParameters({
  37148. * dataset:"SamplesP@Interpolation",
  37149. * power: 2,
  37150. * searchMode: "KDTREE_FIXED_COUNT",
  37151. * expectedCount: 12,
  37152. * pixelFormat: "BIT16",
  37153. * zValueFieldName: "AVG_TMP",
  37154. * resolution: 3000,
  37155. * filterQueryParameter: {
  37156. * attributeFilter: ""
  37157. * },
  37158. * outputDatasetName: "myIDW"
  37159. * });
  37160. * @usage
  37161. */
  37162. class InterpolationIDWAnalystParameters extends InterpolationAnalystParameters {
  37163. constructor(options) {
  37164. super(options);
  37165. /**
  37166. * @member {number} [InterpolationIDWAnalystParameters.prototype.power=2]
  37167. * @description 距离权重计算的幂次。
  37168. * 该值决定了权值下降的速度,幂次越大,随距离的增大权值下降越快,距离预测点越远的点的权值也越小。
  37169. * 理论上,参数值必须大于0,但是0.5到3之间时运算结果更合理,因此推荐值为0.5~3。
  37170. */
  37171. this.power = 2;
  37172. /**
  37173. * @member {SearchMode} InterpolationIDWAnalystParameters.prototype.searchMode
  37174. * @description 插值运算时,查找参与运算点的方式,支持固定点数查找、定长查找。
  37175. * 具体如下:
  37176. * {KDTREE_FIXED_COUNT} 使用 KDTREE 的固定点数方式查找参与内插分析的点。
  37177. * {KDTREE_FIXED_RADIUS} 使用 KDTREE 的定长方式查找参与内插分析的点。
  37178. */
  37179. this.searchMode = null;
  37180. /**
  37181. * @member {number} [InterpolationIDWAnalystParameters.prototype.expectedCount=12]
  37182. * @description 【固定点数查找】方式下,设置待查找的点数,即参与插值运算的点数。
  37183. */
  37184. this.expectedCount = 12;
  37185. if (options) {
  37186. Util_Util.extend(this, options);
  37187. }
  37188. this.CLASS_NAME = "SuperMap.InterpolationIDWAnalystParameters";
  37189. }
  37190. /**
  37191. * @function InterpolationIDWAnalystParameters.prototype.destroy
  37192. * @description 释放资源,将引用资源的属性置空。
  37193. */
  37194. destroy() {
  37195. super.destroy();
  37196. var me = this;
  37197. me.power = null;
  37198. me.searchMode = null;
  37199. me.expectedCount = null;
  37200. }
  37201. }
  37202. ;// CONCATENATED MODULE: ./src/common/iServer/ThiessenAnalystParameters.js
  37203. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37204. * This program are made available under the terms of the Apache License, Version 2.0
  37205. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37206. /**
  37207. * @class ThiessenAnalystParameters
  37208. * @deprecatedclass SuperMap.ThiessenAnalystParameters
  37209. * @category iServer SpatialAnalyst ThiessenPolygonAnalyst
  37210. * @classdesc 泰森多边形分析参数基类。
  37211. * @param {Object} options - 可选参数。
  37212. * @param {GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject} [options.clipRegion] - 结果数据裁剪区域,可以为 null,表示不对结果进行裁剪。
  37213. * @param {boolean} [options.createResultDataset=false] - 是否返回结果数据集。
  37214. * @param {string} [options.resultDatasetName] - 指定结果数据集名称。
  37215. * @param {string} [options.resultDatasourceName] - 指定结果数据集所在数据源,默认为当前数据源。
  37216. * @param {boolean} [options.returnResultRegion=true] - 是否返回分析得到的多边形面数组。
  37217. * @usage
  37218. */
  37219. class ThiessenAnalystParameters {
  37220. constructor(options) {
  37221. if (!options) {
  37222. return;
  37223. }
  37224. /**
  37225. * @member {GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject} [ThiessenAnalystParameters.prototype.clipRegion]
  37226. * @description 结果数据裁剪区域,可以为 null,表示不对结果进行裁剪。
  37227. */
  37228. this.clipRegion = null;
  37229. /**
  37230. * @member {boolean} [ThiessenAnalystParameters.prototype.createResultDataset=false]
  37231. * @description 是否返回结果数据集。如果为 true,则必须设置属性 resultDatasetName 和 resultDatasourceName。
  37232. */
  37233. this.createResultDataset = false;
  37234. /**
  37235. * @member {string} ThiessenAnalystParameters.prototype.resultDatasetName
  37236. * @description 指定结果数据集名称。
  37237. */
  37238. this.resultDatasetName = null;
  37239. /**
  37240. * @member {string} ThiessenAnalystParameters.prototype.resultDatasourceName
  37241. * @description 指定结果数据集所在数据源。
  37242. */
  37243. this.resultDatasourceName = null;
  37244. /**
  37245. * @member {boolean} ThiessenAnalystParameters.prototype.returnResultRegion
  37246. * @description 是否返回分析得到的多边形面数组。
  37247. */
  37248. this.returnResultRegion = true;
  37249. Util_Util.extend(this, options);
  37250. this.CLASS_NAME = "SuperMap.ThiessenAnalystParameters";
  37251. }
  37252. /**
  37253. * @function ThiessenAnalystParameters.prototype.destroy
  37254. * @description 释放资源,将引用资源的属性置空。
  37255. */
  37256. destroy() {
  37257. var me = this;
  37258. if (me.clipRegion) {
  37259. me.clipRegion.destroy();
  37260. me.clipRegion = null;
  37261. }
  37262. me.createResultDataset = null;
  37263. me.resultDatasetName = null;
  37264. me.resultDatasourceName = null;
  37265. me.returnResultRegion = null;
  37266. }
  37267. }
  37268. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationKrigingAnalystParameters.js
  37269. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37270. * This program are made available under the terms of the Apache License, Version 2.0
  37271. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37272. /**
  37273. * @class InterpolationKrigingAnalystParameters
  37274. * @deprecatedclass SuperMap.InterpolationKrigingAnalystParameters
  37275. * @category iServer SpatialAnalyst InterpolationAnalyst
  37276. * @classdesc 克吕金插值分析参数类。通过该类可以设置克吕金插值分析所需的参数。
  37277. * 克吕金(Kriging)法为地统计学上一种空间数据内插处理方法,主要的目的是利用各数据点间变异数(variance)的大小来推求某一未知点与各已知点的权重关系,
  37278. * 再由各数据点的值和其与未知点的权重关系推求未知点的值。Kriging 法最大的特色不仅是提供一个最小估计误差的预测值,并且可明确地指出误差值的大小。
  37279. * 一般而言,许多地质参数,如地形面,本身即具有连续性,故在一段距离内的任两点必有空间上的关系。反之,在一不规则面上的两点若相距甚远,
  37280. * 则在统计意义上可视为互为独立 (stastically indepedent)。这种随距离而改变的空间上连续性,可用半变异图 (semivariogram) 来表现。
  37281. * 因此,若想由已知的散乱点来推求某一未知点的值,则可利用半变异图推求各已知点与未知点的空间关系,即以下四个参数:<br>
  37282. * 1.块金值(nugget):当采样点间距为0时,理论上半变异函数值为0,但时间上两采样点非常接近时半变异函数值并不为0,即产生了块金效应,
  37283. * 对应的半变异函数值为块金值。块金值可能由于测量误差或者空间变异产生。<br>
  37284. * 2.基台值(sill):随着采样点间距的不断增大,半变异函数的值趋向一个稳定的常数,该常数成为基台值。到达基台值后,半变异函数的值不再随采样点间距而改变,
  37285. * 即大于此间距的采样点不再具有空间相关性。<br>
  37286. * 3.偏基台值:基台值与块金值的差值。<br>
  37287. * 4.自相关阈值(range):也称变程,是半变异函数值达到基台值时,采样点的间距。超过自相关阈值的采样点不再具有空间相关性,将不对预测结果产生影响。<br>
  37288. * 然后,由此空间参数推求半变异数,由各数据点间的半变异数可推求未知点与已知点间的权重关系,进而推求出未知点的值。
  37289. * 克吕金法的优点是以空间统计学作为其坚实的理论基础,物理含义明确;不但能估计测定参数的空间变异分布,而且还可以估算参数的方差分布。克吕金法的缺点是计算步骤较烦琐,
  37290. * 计算量大,且变异函数有时需要根据经验人为选定。
  37291. *
  37292. * 由上述可知,半变异函数是克吕金插值的关键,因此选择合适的半变异函数模型非常重要,SuperMap 提供了以下三种半变异函数模型:<br>
  37293. * 1.指数型(EXPONENTIAL):适用于空间相关关系随样本间距的增加呈指数递减的情况,其空间自相关关系在样本间距的无穷远处完全消失。<br>
  37294. * 2.球型(SPHERICAL):适用于空间自相关关系随样本间距的增加而逐渐减少,直到超出一定的距离时空间自相关关系消失的情况。<br>
  37295. * 3.高斯型(GAUSSIAN):适用于半变异函数值渐进地逼近基台值的情况。<br>
  37296. *
  37297. * 半变异函数中,有一个关键参数即插值的字段值的期望(平均值),由于对于此参数的不同处理方法而衍生出了不同的 Kriging 方法。SuperMap的插值功能基于以下三种常用 Kriging 算法:<br>
  37298. * 1.简单克吕金(Simple Kriging):该方法假定用于插值的字段值的期望(平均值)为已知的某一常数。<br>
  37299. * 2.普通克吕金(Kriging):该方法假定用于插值的字段值的期望(平均值)未知且恒定。它利用一定的数学函数,通过对给定的空间点进行拟合来估算单元格的值,
  37300. * 生成格网数据集。它不仅可以生成一个表面,还可以给出预测结果的精度或者确定性的度量。因此,此方法计算精度较高,常用于地学领域。<br>
  37301. * 3.泛克吕金(Universal Kriging):该方法假定用于插值的字段值的期望(平均值)是未知的变量。在样点数据中存在某种主导趋势且该趋势可以通过某一个确定
  37302. * 的函数或者多项式进行拟合的情况下,适用泛克吕金插值法。<br>
  37303. * @param {Object} options - 参数。
  37304. * @param {string} options.type - 克吕金插值的类型。
  37305. * @param {(SuperMap.Bounds|L.Bounds|L.LatLngBounds|ol.extent|mapboxgl.LngLatBounds|GeoJSONObject)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  37306. * @param {string} options.searchMode - 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。
  37307. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  37308. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  37309. * @param {string} [options.zValueFieldName] - 存储用于进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型(InterpolationAnalystParameters.prototype.InterpolationAnalystType)为 dataset 时,此为必选参数。
  37310. * @param {number} [options.mean] - 【简单克吕金】类型下,插值字段的平均值。
  37311. * @param {number} [options.angle=0] - 克吕金算法中旋转角度值。
  37312. * @param {number} [options.nugget=0] - 克吕金算法中块金效应值。
  37313. * @param {number} [options.range=0] - 克吕金算法中自相关阈值,单位与原数据集单位相同。
  37314. * @param {number} [options.sill=0] - 克吕金算法中基台值。
  37315. * @param {string} [options.variogramMode="SPHERICAL"] - 克吕金插值时的半变函数类型。
  37316. * @param {string} [options.exponent='exp1'] - 【泛克吕金】类型下,用于插值的样点数据中趋势面方程的阶数,可选值为 exp1、exp2。
  37317. * @param {number} [options.expectedCount=12] - 【固定点数查找】方式下,设置待查找的点数;【定长查找】方式下,设置查找的最小点数。
  37318. * @param {number} [options.searchRadius=0] - 【定长查找】方式下,设置参与运算点的查找范围。
  37319. * @param {number} [options.maxPointCountForInterpolation=200] - 【块查找】方式下,设置最多参与插值的点数。
  37320. * @param {number} [options.maxPointCountInNode=50] - 【块查找】方式下,设置单个块内最多参与运算点数。
  37321. * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
  37322. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  37323. * @param {FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  37324. * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  37325. * @param {string} [options.dataset] - 要用来做插值分析的数据源中数据集的名称。该名称用形如 ”数据集名称@数据源别名” 形式来表示。当插值分析类型(InterpolationAnalystParameters.prototype.InterpolationAnalystType)为 dataset 时。
  37326. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(InterpolationAnalystParameters.prototype.InterpolationAnalystType)为 geometry 时。
  37327. * @extends {InterpolationAnalystParameters}
  37328. * @example 例如:
  37329. * var myInterpolationKrigingAnalystParameters = new InterpolationKrigingAnalystParameters({
  37330. * dataset:"SamplesP@Interpolation",
  37331. * type: "KRIGING",
  37332. * angle: 0,
  37333. * mean: 5,
  37334. * nugget: 30,
  37335. * range: 50,
  37336. * sill: 300,
  37337. * variogramMode: "EXPONENTIAL",
  37338. * searchMode: "QUADTREE",
  37339. * maxPointCountForInterpolation: 20,
  37340. * maxPointCountInNode: 5,
  37341. * pixelFormat: "BIT16",
  37342. * zValueFieldName: "AVG_TMP",
  37343. * resolution: 30000,
  37344. * filterQueryParameter: {
  37345. * attributeFilter: ""
  37346. * },
  37347. * outputDatasetName: "myKriging"
  37348. * });
  37349. * @usage
  37350. */
  37351. class InterpolationKrigingAnalystParameters extends InterpolationAnalystParameters {
  37352. constructor(options) {
  37353. super(options);
  37354. /**
  37355. * @member {InterpolationAlgorithmType} InterpolationKrigingAnalystParameters.prototype.type
  37356. * @description 克吕金插值的类型。
  37357. * 具体如下:<br>
  37358. * {KRIGING} 普通克吕金插值法。
  37359. * {SimpleKriging} 简单克吕金插值法。
  37360. * {UniversalKriging} 泛克吕金插值法。
  37361. */
  37362. this.type = null;
  37363. /**
  37364. * @member {number} InterpolationKrigingAnalystParameters.prototype.mean
  37365. * @description 【简单克吕金】方式下,插值字段的平均值。
  37366. * 即采样点插值字段值总和除以采样点数目。
  37367. */
  37368. this.mean = null;
  37369. /**
  37370. * @member {number} [InterpolationKrigingAnalystParameters.prototype.angle=0]
  37371. * @description 克吕金算法中旋转角度值。
  37372. * 此角度值指示了每个查找邻域相对于水平方向逆时针旋转的角度。
  37373. */
  37374. this.angle = 0;
  37375. /**
  37376. * @member {number} [InterpolationKrigingAnalystParameters.prototype.nugget=0]
  37377. * @description 克吕金算法中块金效应值。
  37378. */
  37379. this.nugget = 0;
  37380. /**
  37381. * @member {number} [InterpolationKrigingAnalystParameters.prototype.range=0]
  37382. * @description 克吕金算法中自相关阈值,单位与原数据集单位相同。
  37383. */
  37384. this.range = 0;
  37385. /**
  37386. * @member {number} [InterpolationKrigingAnalystParameters.prototype.sill=0]
  37387. * @description 克吕金算法中基台值。
  37388. */
  37389. this.sill = 0;
  37390. /**
  37391. * @member {VariogramMode} [InterpolationKrigingAnalystParameters.prototype.variogramMode=VariogramMode.SPHERICAL]
  37392. * @description 克吕金插值时的半变函数类型。
  37393. * 用户所选择的半变函数类型会影响未知点的预测,特别是曲线在原点处的不同形状有重要意义。
  37394. * 曲线在原点处越陡,则较近领域对该预测值的影响就越大,因此输出表面就会越不光滑。
  37395. */
  37396. this.variogramMode = VariogramMode.SPHERICAL;
  37397. /**
  37398. * @member {Exponent} [InterpolationKrigingAnalystParameters.prototype.exponent=Exponent.EXP1]
  37399. * @description 【泛克吕金】类型下,用于插值的样点数据中趋势面方程的阶数。
  37400. */
  37401. this.exponent = Exponent.EXP1;
  37402. /**
  37403. * @member {SearchMode} InterpolationKrigingAnalystParameters.prototype.searchMode
  37404. * @description 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。此为必选参数。
  37405. * 简单克吕金和泛克吕金不支持块查找。
  37406. * 具体如下:<br>
  37407. * {KDTREE_FIXED_COUNT} 使用 KDTREE 的固定点数方式查找参与内插分析的点。<br>
  37408. * {KDTREE_FIXED_RADIUS} 使用 KDTREE 的定长方式查找参与内插分析的点。<br>
  37409. * {QUADTREE} 使用 QUADTREE 方式查找参与内插分析的点(块查找)。
  37410. */
  37411. this.searchMode = null;
  37412. /**
  37413. * @member {number} [InterpolationKrigingAnalystParameters.prototype.expectedCount=12]
  37414. * @description 【固定点数查找】方式下,设置待查找的点数,即参与插值运算的点数,默认值为12。
  37415. * 【定长查找】方式下,设置查找的最小点数,默认值为12。
  37416. */
  37417. this.expectedCount = 12;
  37418. /**
  37419. * @member {number} [InterpolationKrigingAnalystParameters.prototype.maxPointCountForInterpolation=200]
  37420. * @description 【块查找】方式下,最多参与插值的点数。
  37421. * 仅用于普通克吕金插值,简单克吕金和泛克吕金不支持块查找。
  37422. */
  37423. this.maxPointCountForInterpolation = 200;
  37424. /**
  37425. * @member {number} [InterpolationKrigingAnalystParameters.prototype.maxPointCountInNode=50]
  37426. * @description 【块查找】方式下,设置单个块内最多参与运算点数。
  37427. * 仅用于普通克吕金插值,简单克吕金和泛克吕金不支持块查找。
  37428. */
  37429. this.maxPointCountInNode = 50;
  37430. if (options) {
  37431. Util_Util.extend(this, options);
  37432. }
  37433. this.CLASS_NAME = "SuperMap.InterpolationKrigingAnalystParameters";
  37434. }
  37435. /**
  37436. * @function InterpolationKrigingAnalystParameters.prototype.destroy
  37437. * @description 释放资源,将引用资源的属性置空。
  37438. */
  37439. destroy() {
  37440. super.destroy();
  37441. var me = this;
  37442. me.type = null;
  37443. me.mean = null;
  37444. me.angle = null;
  37445. me.nugget = null;
  37446. me.range = null;
  37447. me.sill = null;
  37448. me.variogramMode = null;
  37449. me.exponent = null;
  37450. me.searchMode = null;
  37451. me.expectedCount = null;
  37452. me.maxPointCountForInterpolation = null;
  37453. me.maxPointCountInNode = null;
  37454. }
  37455. }
  37456. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationAnalystService.js
  37457. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37458. * This program are made available under the terms of the Apache License, Version 2.0
  37459. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37460. /**
  37461. * @class InterpolationAnalystService
  37462. * @deprecatedclass SuperMap.InterpolationAnalystService
  37463. * @category iServer SpatialAnalyst InterpolationAnalyst
  37464. * @classdesc 插值分析服务类。
  37465. * 插值分析可以将有限的采样点数据,通过插值算法对采样点周围的数值情况进行预测,可以掌握研究区域内数据的总体分布状况,从而使采样的离散点不仅仅反映其所在位置的数值情况,
  37466. * 还可以反映区域的数值分布。目前SuperMap iServer的插值功能提供从点数据集插值得到栅格数据集的功能,支持以下常用的内插方法,
  37467. * 包括:反距离加权插值、克吕金(Kriging)插值法、样条(径向基函数,Radial Basis Function)插值、点密度插值。
  37468. * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  37469. * @param {Object} options - 参数。
  37470. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  37471. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  37472. * @param {Object} [options.headers] - 请求头。
  37473. * @extends {SpatialAnalystBase}
  37474. * @example 例如:
  37475. * (start code)
  37476. * var myTInterpolationAnalystService = new InterpolationAnalystService(url);
  37477. * myTInterpolationAnalystService.events.on({
  37478. * "processCompleted": processCompleted,
  37479. * "processFailed": processFailed
  37480. * }
  37481. * );
  37482. * (end)
  37483. * @usage
  37484. */
  37485. class InterpolationAnalystService extends SpatialAnalystBase {
  37486. constructor(url, options) {
  37487. super(url, options);
  37488. /**
  37489. * @member {string} InterpolationAnalystService.prototype.mode
  37490. * @description 插值分析类型。
  37491. */
  37492. this.mode = null;
  37493. if (options) {
  37494. Util_Util.extend(this, options);
  37495. }
  37496. }
  37497. /**
  37498. * @function InterpolationAnalystService.prototype.destroy
  37499. * @description 释放资源,将引用资源的属性置空。
  37500. */
  37501. destroy() {
  37502. super.destroy();
  37503. this.mode = null;
  37504. this.CLASS_NAME = "SuperMap.InterpolationAnalystService";
  37505. }
  37506. /**
  37507. * @function InterpolationAnalystService.prototype.processAsync
  37508. * @description 负责将客户端的查询参数传递到服务端。
  37509. * @param {InterpolationDensityAnalystParameters|InterpolationIDWAnalystParameters|InterpolationRBFAnalystParameters|InterpolationKrigingAnalystParameters} parameter - 插值分析参数类。
  37510. */
  37511. processAsync(parameter) {
  37512. var parameterObject = {};
  37513. var me = this;
  37514. if (parameter instanceof InterpolationDensityAnalystParameters) {
  37515. me.mode = 'Density';
  37516. if (parameter.InterpolationAnalystType === 'geometry') {
  37517. me.url = Util_Util.urlPathAppend(me.url, 'geometry/interpolation/density');
  37518. } else {
  37519. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/density');
  37520. }
  37521. } else if (parameter instanceof InterpolationIDWAnalystParameters) {
  37522. me.mode = 'IDW';
  37523. if (parameter.InterpolationAnalystType === 'geometry') {
  37524. me.url = Util_Util.urlPathAppend(me.url, 'geometry/interpolation/idw');
  37525. } else {
  37526. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/idw');
  37527. }
  37528. } else if (parameter instanceof InterpolationRBFAnalystParameters) {
  37529. me.mode = 'RBF';
  37530. if (parameter.InterpolationAnalystType === 'geometry') {
  37531. me.url = Util_Util.urlPathAppend(me.url, 'geometry/interpolation/rbf');
  37532. } else {
  37533. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/rbf');
  37534. }
  37535. } else if (parameter instanceof InterpolationKrigingAnalystParameters) {
  37536. me.mode = 'Kriging';
  37537. if (parameter.InterpolationAnalystType === 'geometry') {
  37538. me.url = Util_Util.urlPathAppend(me.url, 'geometry/interpolation/kriging');
  37539. } else {
  37540. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/kriging');
  37541. }
  37542. }
  37543. InterpolationAnalystParameters.toObject(parameter, parameterObject);
  37544. var jsonParameters = Util_Util.toJSON(parameterObject);
  37545. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  37546. me.request({
  37547. method: "POST",
  37548. data: jsonParameters,
  37549. scope: me,
  37550. success: me.serviceProcessCompleted,
  37551. failure: me.serviceProcessFailed
  37552. });
  37553. }
  37554. }
  37555. ;// CONCATENATED MODULE: ./src/common/iServer/MathExpressionAnalysisParameters.js
  37556. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37557. * This program are made available under the terms of the Apache License, Version 2.0
  37558. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37559. /**
  37560. * @class MathExpressionAnalysisParameters
  37561. * @deprecatedclass SuperMap.MathExpressionAnalysisParameters
  37562. * @category iServer SpatialAnalyst GridMathAnalyst
  37563. * @classdesc 栅格代数运算参数类。
  37564. * @param {Object} options - 参数。
  37565. * @param {string} options.dataset - 指定栅格代数运算数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示,例如:BaseMap_P@Jingjin。
  37566. * @param {string} options.resultGridName - 指定结果数据集名称。
  37567. * @param {string} options.expression - 指定的栅格运算表达式。如:[DatasourceAlias1.Raster1]*2-10。
  37568. * @param {string} options.targetDatasource - 指定存储结果数据集的数据源。
  37569. * @param {GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject} [options.extractRegion] - 栅格代数运算的范围,指定数据集中参与栅格代数运算的区域。
  37570. * 如果缺省,则计算全部区域,如果参与运算的数据集范围不一致,将使用所有数据集的范围的交集作为计算区域 。
  37571. * @param {boolean} [options.isZip=false] - 是否对结果数据集进行压缩处理。
  37572. * @param {boolean} [options.ignoreNoValue=false] - 是否忽略无值栅格数据。true 表示忽略无值数据,即无值栅格不参与运算。
  37573. * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  37574. * @usage
  37575. */
  37576. class MathExpressionAnalysisParameters {
  37577. constructor(options) {
  37578. if (!options) {
  37579. return;
  37580. }
  37581. /**
  37582. * @member {string} MathExpressionAnalysisParameters.prototype.dataset
  37583. * @description 要用来做栅格代数运算数据源中数据集的名称。
  37584. * 该名称用形如"数据集名称@数据源别名"形式来表示,例如:JingjinTerrain@Jingjin。
  37585. *
  37586. */
  37587. this.dataset = null;
  37588. /**
  37589. * @member {GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject} [MathExpressionAnalysisParameters.prototype.extractRegion]
  37590. * @description 栅格代数运算的范围,指定数据集中参与栅格代数运算的区域。
  37591. * 如果缺省,则计算全部区域,如果参与运算的数据集范围不一致,将使用所有数据集的范围的交集作为计算区域 。
  37592. */
  37593. this.extractRegion = null;
  37594. /**
  37595. * @member {string} MathExpressionAnalysisParameters.prototype.expression
  37596. * @description 指定的栅格运算表达式。如:"[DatasourceAlias1.Raster1]*2-10"。
  37597. */
  37598. this.expression = null;
  37599. /**
  37600. * @member {boolean} [MathExpressionAnalysisParameters.prototype.isZip=false]
  37601. * @description 是否对结果数据集进行压缩处理。
  37602. */
  37603. this.isZip = false;
  37604. /**
  37605. * @member {boolean} [MathExpressionAnalysisParameters.prototype.ignoreNoValue=false]
  37606. * @description 是否忽略无值栅格数据。
  37607. */
  37608. this.ignoreNoValue = false;
  37609. /**
  37610. * @member {string} MathExpressionAnalysisParameters.prototype.targetDatasource
  37611. * @description 指定存储结果数据集的数据源。
  37612. */
  37613. this.targetDatasource = null;
  37614. /**
  37615. * @member {string} MathExpressionAnalysisParameters.prototype.resultGridName
  37616. * @description 指定结果数据集名称。
  37617. */
  37618. this.resultGridName = null;
  37619. /**
  37620. * @member {boolean} [MathExpressionAnalysisParameters.prototype.deleteExistResultDataset=false]
  37621. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  37622. */
  37623. this.deleteExistResultDataset = false;
  37624. Util_Util.extend(this, options);
  37625. this.CLASS_NAME = "SuperMap.MathExpressionAnalysisParameters"
  37626. }
  37627. /**
  37628. * @function MathExpressionAnalysisParameters.prototype.destroy
  37629. * @description 释放资源,将引用资源的属性置空。
  37630. */
  37631. destroy() {
  37632. var me = this;
  37633. me.dataset = null;
  37634. me.bounds = null;
  37635. me.expression = null;
  37636. me.isZip = true;
  37637. me.ignoreNoValue = true;
  37638. me.targetDatasource = null;
  37639. me.resultGridName = null;
  37640. me.deleteExistResultDataset = null;
  37641. }
  37642. /**
  37643. * @function MathExpressionAnalysisParameters.toObject
  37644. * @param {Object} mathExpressionAnalysisParameters - 栅格代数运算参数。
  37645. * @param {Object} tempObj - 目标对象。
  37646. * @description 生成栅格代数运算对象。
  37647. */
  37648. static toObject(mathExpressionAnalysisParameters, tempObj) {
  37649. for (var name in mathExpressionAnalysisParameters) {
  37650. if (name !== "dataset") {
  37651. tempObj[name] = mathExpressionAnalysisParameters[name];
  37652. }
  37653. if (name === "extractRegion") {
  37654. if (mathExpressionAnalysisParameters[name]) {
  37655. var bs = mathExpressionAnalysisParameters[name].components[0].components;
  37656. var region = {},
  37657. points = [],
  37658. type = "REGION";
  37659. var len = bs.length;
  37660. for (var i = 0; i < len - 1; i++) {
  37661. var poi = {};
  37662. poi["x"] = bs[i].x;
  37663. poi["y"] = bs[i].y;
  37664. points.push(poi);
  37665. }
  37666. region["points"] = points;
  37667. region["type"] = type;
  37668. tempObj[name] = region;
  37669. }
  37670. }
  37671. }
  37672. }
  37673. }
  37674. ;// CONCATENATED MODULE: ./src/common/iServer/MathExpressionAnalysisService.js
  37675. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37676. * This program are made available under the terms of the Apache License, Version 2.0
  37677. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37678. /**
  37679. * @class MathExpressionAnalysisService
  37680. * @deprecatedclass SuperMap.MathExpressionAnalysisService
  37681. * @category iServer SpatialAnalyst GridMathAnalyst
  37682. * @classdesc 栅格代数运算服务类。
  37683. * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst
  37684. * @param {Object} options - 参数。
  37685. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  37686. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  37687. * @param {Object} [options.headers] - 请求头。
  37688. * @extends {SpatialAnalystBase}
  37689. * @example 例如:
  37690. * (start code)
  37691. * var myMathExpressionAnalysisService = new MathExpressionAnalysisService(url);
  37692. * myMathExpressionAnalysisService.on({
  37693. * "processCompleted": processCompleted,
  37694. * "processFailed": processFailed
  37695. * }
  37696. * );
  37697. * (end)
  37698. * @usage
  37699. */
  37700. class MathExpressionAnalysisService extends SpatialAnalystBase {
  37701. constructor(url, options) {
  37702. super(url, options);
  37703. this.CLASS_NAME = "SuperMap.MathExpressionAnalysisService";
  37704. }
  37705. /**
  37706. * @override
  37707. */
  37708. destroy() {
  37709. super.destroy();
  37710. }
  37711. /**
  37712. * @function MathExpressionAnalysisService.prototype.processAsync
  37713. * @description 负责将客户端的查询参数传递到服务端。
  37714. * @param {MathExpressionAnalysisParameters} parameter - 栅格代数运算参数类。
  37715. */
  37716. processAsync(parameter) {
  37717. var me = this;
  37718. var parameterObject = {};
  37719. if (parameter instanceof MathExpressionAnalysisParameters) {
  37720. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/mathanalyst');
  37721. }
  37722. MathExpressionAnalysisParameters.toObject(parameter, parameterObject);
  37723. var jsonParameters = Util_Util.toJSON(parameterObject);
  37724. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  37725. me.request({
  37726. method: "POST",
  37727. data: jsonParameters,
  37728. scope: me,
  37729. success: me.serviceProcessCompleted,
  37730. failure: me.serviceProcessFailed
  37731. });
  37732. }
  37733. }
  37734. ;// CONCATENATED MODULE: ./src/common/iServer/OverlayAnalystParameters.js
  37735. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37736. * This program are made available under the terms of the Apache License, Version 2.0
  37737. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37738. /**
  37739. * @class OverlayAnalystParameters
  37740. * @deprecatedclass SuperMap.OverlayAnalystParameters
  37741. * @category iServer SpatialAnalyst OverlayAnalyst
  37742. * @classdesc 叠加分析参数基类。数据集叠加分析参数和几何对象叠加分析参数均继承此基类。
  37743. * @param {Object} options - 参数。
  37744. * @usage
  37745. */
  37746. class OverlayAnalystParameters {
  37747. constructor(options) {
  37748. /**
  37749. * @member {OverlayOperationType} [OverlayAnalystParameters.prototype.operation=OverlayOperationType.UNION]
  37750. * @description 指定叠加分析操作类型。
  37751. */
  37752. this.operation = OverlayOperationType.UNION;
  37753. if (options) {
  37754. Util_Util.extend(this, options);
  37755. }
  37756. this.CLASS_NAME = "SuperMap.OverlayAnalystParameters";
  37757. }
  37758. /**
  37759. * @function OverlayAnalystParameters.prototype.destroy
  37760. * @description 释放资源,将引用资源的属性置空。
  37761. */
  37762. destroy() {
  37763. var me = this;
  37764. me.operation = null;
  37765. }
  37766. }
  37767. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetOverlayAnalystParameters.js
  37768. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37769. * This program are made available under the terms of the Apache License, Version 2.0
  37770. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37771. /**
  37772. * @class DatasetOverlayAnalystParameters
  37773. * @deprecatedclass SuperMap.DatasetOverlayAnalystParameters
  37774. * @category iServer SpatialAnalyst OverlayAnalyst
  37775. * @classdesc 数据集叠加分析参数类。
  37776. * @param {Object} options - 参数。
  37777. * @param {string} options.operateDataset -数据集名称。
  37778. * @param {string} options.sourceDataset - 源数据集名称。
  37779. * @param {Array.<string>} [options.operateDatasetFields] - 叠加分析中操作数据集保留在结果数据集中的字段名列表。
  37780. * @param {FilterParameter} [options.operateDatasetFilter] - 设置操作数据集中空间对象过滤条件。
  37781. * @param {Array.<GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject>} [options.operateRegions] - 操作面对象集合,表示与这些面对象进行叠加分析。与 operateDataset 参数互斥,冲突时以 operateDataset 为准。
  37782. * @param {Array.<string>} [options.sourceDatasetFields] - 叠加分析中源数据集保留在结果数据集中的字段名列表。
  37783. * @param {FilterParameter} [options.sourceDatasetFilter] - 设置源数据集中空间对象过滤条件。
  37784. * @param {number} [options.tolerance=0] - 容限。
  37785. * @param {OverlayOperationType} options.operation - 叠加操作枚举值。
  37786. * @param {DataReturnOption} [options.resultSetting] - 结果返回设置类。
  37787. * @extends {GetFeaturesParametersBase}
  37788. * @usage
  37789. */
  37790. class DatasetOverlayAnalystParameters extends OverlayAnalystParameters {
  37791. constructor(options) {
  37792. super(options);
  37793. /**
  37794. * @member {string} DatasetOverlayAnalystParameters.prototype.operateDataset
  37795. * @description 叠加分析中操作数据集的名称。
  37796. */
  37797. this.operateDataset = null;
  37798. /**
  37799. * @member {Array.<string>} [DatasetOverlayAnalystParameters.prototype.operateDatasetFields]
  37800. * @description 叠加分析中操作数据集保留在结果数据集中的字段名列表。
  37801. */
  37802. this.operateDatasetFields = [];
  37803. /**
  37804. * @member {FilterParameter} DatasetOverlayAnalystParameters.prototype.operateDatasetFilter
  37805. * @description 设置操作数据集中空间对象过滤条件。
  37806. */
  37807. this.operateDatasetFilter = new FilterParameter();
  37808. /**
  37809. * @member {Array.<GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject>} [DatasetOverlayAnalystParameters.prototype.operateRegions]
  37810. * @description 操作面对象集合,表示与这些面对象进行叠加分析。与 operateDataset 参数互斥,冲突时以 operateDataset 为准。
  37811. */
  37812. this.operateRegions = [];
  37813. /**
  37814. * @member {string} DatasetOverlayAnalystParameters.prototype.sourceDataset
  37815. * @description 叠加分析中源数据集的名称。
  37816. */
  37817. this.sourceDataset = null;
  37818. /**
  37819. * @member {Array.<string>} [DatasetOverlayAnalystParameters.prototype.sourceDatasetFields]
  37820. * @description 叠加分析中源数据集保留在结果数据集中的字段名列表。
  37821. */
  37822. this.sourceDatasetFields = [];
  37823. /**
  37824. * @member {FilterParameter} [DatasetOverlayAnalystParameters.prototype.filterQueryParameter]
  37825. * @description 设置源数据集中空间对象过滤条件。
  37826. */
  37827. this.sourceDatasetFilter = new FilterParameter();
  37828. /**
  37829. * @member {number} [DatasetOverlayAnalystParameters.prototype.tolerance=0]
  37830. * @description 容限。
  37831. */
  37832. this.tolerance = 0;
  37833. /**
  37834. * @member {DataReturnOption} [DatasetOverlayAnalystParameters.prototype.resultSetting]
  37835. * @description 结果返回设置类。
  37836. */
  37837. this.resultSetting = new DataReturnOption();
  37838. Util_Util.extend(this, options);
  37839. this.CLASS_NAME = "SuperMap.DatasetOverlayAnalystParameters";
  37840. }
  37841. /**
  37842. * @function DatasetOverlayAnalystParameters.prototype.destroy
  37843. * @override
  37844. */
  37845. destroy() {
  37846. super.destroy();
  37847. var me = this;
  37848. me.operateDataset = null;
  37849. me.operateDatasetFields = null;
  37850. if (me.operateDatasetFilter) {
  37851. me.operateDatasetFilter.destroy();
  37852. me.operateDatasetFilter = null;
  37853. }
  37854. if (me.operateRegions) {
  37855. for (var i = 0, opRegions = me.operateRegions, len = opRegions.length; i < len; i++) {
  37856. opRegions[i].destroy();
  37857. }
  37858. me.operateRegions = null;
  37859. }
  37860. me.sourceDataset = null;
  37861. me.sourceDatasetFields = null;
  37862. if (me.sourceDatasetFilter) {
  37863. me.sourceDatasetFilter.destroy();
  37864. me.sourceDatasetFilter = null;
  37865. }
  37866. me.tolerance = null;
  37867. if (me.resultSetting) {
  37868. me.resultSetting.destroy();
  37869. me.resultSetting = null;
  37870. }
  37871. }
  37872. /**
  37873. * @function DatasetOverlayAnalystParameters.toObject
  37874. * @param {DatasetOverlayAnalystParameters} datasetOverlayAnalystParameters - 数据集叠加分析参数类。
  37875. * @param {DatasetOverlayAnalystParameters} tempObj - 数据集叠加分析参数对象。
  37876. * @description 将数据集叠加分析参数类转换为 JSON 对象。
  37877. * @returns {Object} JSON 对象。
  37878. */
  37879. static toObject(datasetOverlayAnalystParameters, tempObj) {
  37880. for (var name in datasetOverlayAnalystParameters) {
  37881. if (name === "sourceDataset") {
  37882. continue;
  37883. } else if (name === "operateRegions") {
  37884. tempObj.operateRegions = [];
  37885. var ors = datasetOverlayAnalystParameters.operateRegions;
  37886. for (var index in ors) {
  37887. if (ors.hasOwnProperty(index)) { //icl542
  37888. tempObj.operateRegions[index] = ServerGeometry.fromGeometry(ors[index]);
  37889. }
  37890. }
  37891. } else if (name === "resultSetting") {
  37892. tempObj.dataReturnOption = datasetOverlayAnalystParameters.resultSetting;
  37893. } else {
  37894. tempObj[name] = datasetOverlayAnalystParameters[name];
  37895. }
  37896. }
  37897. }
  37898. }
  37899. ;// CONCATENATED MODULE: ./src/common/iServer/GeometryOverlayAnalystParameters.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 GeometryOverlayAnalystParameters
  37905. * @deprecatedclass SuperMap.GeometryOverlayAnalystParameters
  37906. * @category iServer SpatialAnalyst OverlayAnalyst
  37907. * @classdesc
  37908. * 几何对象叠加分析参数类。对指定的某两个几何对象做叠加分析。通过该类可以指定要做叠加分析的几何对象、叠加操作类型。
  37909. * @param {Object} options - 参数。
  37910. * @param {GeoJSONObject} options.operateGeometry - 叠加分析的操作几何对象。<br>
  37911. * 点类型可以是:{@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>
  37912. * 线类型可以是:{@link GeometryLineString}|{@link GeometryLinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link GeoJSONObject}。<br>
  37913. * 面类型可以是:{@link GeometryPolygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link GeoJSONObject}。<br>
  37914. * @param {GeoJSONObject} options.sourceGeometry - 叠加分析的源几何对象。
  37915. * @param {Array.<GeoJSONFeature>} [options.operateGeometries] - 批量叠加分析的操作几何对象数组。
  37916. * @param {Array.<GeoJSONFeature>} [options.sourceGeometries] -批量叠加分析的源几何对象数组。
  37917. * @param {OverlayOperationType} [options.operation] - 叠加操作枚举值。
  37918. * @extends {OverlayAnalystParameters}
  37919. * @usage
  37920. */
  37921. class GeometryOverlayAnalystParameters extends OverlayAnalystParameters {
  37922. constructor(options) {
  37923. super(options);
  37924. if (options && options.operateGeometry) {
  37925. this.operateGeometry = options.operateGeometry;
  37926. }
  37927. if (options && options.sourceGeometry) {
  37928. this.sourceGeometry = options.sourceGeometry;
  37929. }
  37930. if (options && options.operateGeometries) {
  37931. this.operateGeometries = options.operateGeometries;
  37932. }
  37933. if (options && options.sourceGeometries) {
  37934. this.sourceGeometries = options.sourceGeometries;
  37935. }
  37936. if (options) {
  37937. Util_Util.extend(this, options);
  37938. }
  37939. this.CLASS_NAME = "SuperMap.GeometryOverlayAnalystParameters";
  37940. }
  37941. /**
  37942. * @function GeometryOverlayAnalystParameters.prototype.destroy
  37943. * @override
  37944. */
  37945. destroy() {
  37946. super.destroy();
  37947. var me = this;
  37948. if (me.sourceGeometry) {
  37949. me.sourceGeometry.destroy();
  37950. me.sourceGeometry = null;
  37951. }
  37952. if (me.sourceGeometries) {
  37953. me.sourceGeometries.destroy();
  37954. me.sourceGeometries = null;
  37955. }
  37956. if (me.sourceGeometry) {
  37957. me.sourceGeometry.destroy();
  37958. me.sourceGeometry = null;
  37959. }
  37960. if (me.operateGeometries) {
  37961. me.operateGeometries.destroy();
  37962. me.operateGeometries = null;
  37963. }
  37964. }
  37965. /**
  37966. * @function GeometryOverlayAnalystParameters.toObject
  37967. * @param {GeometryOverlayAnalystParameters} geometryOverlayAnalystParameters - 几何对象叠加分析参数类。
  37968. * @param {GeometryOverlayAnalystParameters} tempObj - 几何对象叠加分析参数对象。
  37969. * @description 将几何对象叠加分析参数对象转换为 JSON 对象。
  37970. * @returns {Object} JSON 对象。
  37971. */
  37972. static toObject(geometryOverlayAnalystParameters, tempObj) {
  37973. for (var name in geometryOverlayAnalystParameters) {
  37974. if (name === "sourceGeometry") {
  37975. tempObj.sourceGeometry = ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.sourceGeometry);
  37976. } else if (name === "sourceGeometries") {
  37977. var sourceGeometries = [];
  37978. for (var i = 0; i < geometryOverlayAnalystParameters.sourceGeometries.length; i++) {
  37979. sourceGeometries.push(ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.sourceGeometries[i]));
  37980. }
  37981. tempObj.sourceGeometries = sourceGeometries;
  37982. } else if (name === "operateGeometry") {
  37983. tempObj.operateGeometry = ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.operateGeometry);
  37984. } else if (name === "operateGeometries") {
  37985. var operateGeometries = [];
  37986. for (var j = 0; j < geometryOverlayAnalystParameters.operateGeometries.length; j++) {
  37987. operateGeometries.push(ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.operateGeometries[j]));
  37988. }
  37989. tempObj.operateGeometries = operateGeometries;
  37990. } else {
  37991. tempObj[name] = geometryOverlayAnalystParameters[name];
  37992. }
  37993. }
  37994. }
  37995. }
  37996. ;// CONCATENATED MODULE: ./src/common/iServer/OverlayAnalystService.js
  37997. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  37998. * This program are made available under the terms of the Apache License, Version 2.0
  37999. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38000. /**
  38001. * @class OverlayAnalystService
  38002. * @deprecatedclass SuperMap.OverlayAnalystService
  38003. * @category iServer SpatialAnalyst OverlayAnalyst
  38004. * @classdesc 叠加分析服务类。
  38005. * 该类负责将客户设置的叠加分析参数传递给服务端,并接收服务端返回的叠加分析结果数据。
  38006. * 叠加分析结果通过该类支持的事件的监听函数参数获取
  38007. * @param {string} url - 服务地址。如http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  38008. * @param {Object} options - 参数。
  38009. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  38010. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  38011. * @param {DataFormat} [options.format=DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON、GeoJSON、FGB 三种格式。参数格式为 "ISERVER","GEOJSON","FGB"。
  38012. * @param {Object} [options.headers] - 请求头。
  38013. * @extends {CommonServiceBase}
  38014. * @example 例如:
  38015. * (start code)
  38016. * var myOverlayAnalystService = new OverlayAnalystService(url, {
  38017. * eventListeners: {
  38018. * "processCompleted": OverlayCompleted,
  38019. * "processFailed": OverlayFailed
  38020. * }
  38021. * });
  38022. * (end)
  38023. * @usage
  38024. */
  38025. class OverlayAnalystService extends SpatialAnalystBase {
  38026. constructor(url, options) {
  38027. super(url, options);
  38028. /**
  38029. * @member {string} OverlayAnalystService.prototype.mode
  38030. * @description 叠加分析类型
  38031. */
  38032. this.mode = null;
  38033. if (options) {
  38034. Util_Util.extend(this, options);
  38035. }
  38036. this.CLASS_NAME = "SuperMap.OverlayAnalystService";
  38037. }
  38038. /**
  38039. * @override
  38040. */
  38041. destroy() {
  38042. super.destroy();
  38043. this.mode = null;
  38044. }
  38045. /**
  38046. * @function OverlayAnalystService.prototype.processAsync
  38047. * @description 负责将客户端的查询参数传递到服务端。
  38048. * @param {OverlayAnalystParameters} parameter - 叠加分析参数类。
  38049. */
  38050. processAsync(parameter) {
  38051. var parameterObject = {};
  38052. var me = this;
  38053. if (parameter instanceof DatasetOverlayAnalystParameters) {
  38054. me.mode = "datasets";
  38055. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.sourceDataset + '/overlay');
  38056. DatasetOverlayAnalystParameters.toObject(parameter, parameterObject);
  38057. } else if (parameter instanceof GeometryOverlayAnalystParameters) {
  38058. me.mode = "geometry";
  38059. //支持传入多个几何要素进行叠加分析
  38060. if(parameter.operateGeometries && parameter.sourceGeometries){
  38061. me.url = Util_Util.urlPathAppend(me.url, 'geometry/overlay/batch');
  38062. me.url = Util_Util.urlAppend(me.url, 'ignoreAnalystParam=true');
  38063. }else {
  38064. me.url = Util_Util.urlPathAppend(me.url, 'geometry/overlay');
  38065. }
  38066. GeometryOverlayAnalystParameters.toObject(parameter, parameterObject);
  38067. }
  38068. this.returnContent = true;
  38069. var jsonParameters = Util_Util.toJSON(parameterObject);
  38070. me.request({
  38071. method: "POST",
  38072. data: jsonParameters,
  38073. scope: me,
  38074. success: me.serviceProcessCompleted,
  38075. failure: me.serviceProcessFailed
  38076. });
  38077. }
  38078. dataFormat() {
  38079. return [DataFormat.GEOJSON, DataFormat.ISERVER, DataFormat.FGB];
  38080. }
  38081. }
  38082. ;// CONCATENATED MODULE: ./src/common/iServer/RouteCalculateMeasureParameters.js
  38083. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38084. * This program are made available under the terms of the Apache License, Version 2.0
  38085. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38086. /**
  38087. * @class RouteCalculateMeasureParameters
  38088. * @deprecatedclass SuperMap.RouteCalculateMeasureParameters
  38089. * @category iServer SpatialAnalyst RouteCalculateMeasure
  38090. * @classdesc 基于路由对象计算指定点 M 值操作的参数类。通过该类提供参数信息。
  38091. * @param {Object} options - 参数。
  38092. * @param {(Route|L.Polyline|ol.geom.LineString|GeoJSONObject)} options.sourceRoute - 路由对象。该对象可以是用户自己生成或在数据源中查询得到的符合标准的路由对象。
  38093. * @param {GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>} options.point - 二维地理坐标点对象,包含 x,y 坐标值属性的对象。
  38094. * @param {number} [options.tolerance] - 容限值。
  38095. * @param {boolean} [options.isIgnoreGap=false] - 是否忽略子对象之间的距离。
  38096. * @usage
  38097. */
  38098. class RouteCalculateMeasureParameters {
  38099. constructor(options) {
  38100. if (!options) {
  38101. return this;
  38102. }
  38103. /**
  38104. * @member {(Route|L.Polyline|ol.geom.LineString|GeoJSONObject)} RouteCalculateMeasureParameters.prototype.sourceRoute
  38105. * @description 路由对象。该对象可以是用户自己生成或在数据源中查询得到的符合标准的路由对象。
  38106. */
  38107. this.sourceRoute = null;
  38108. /**
  38109. * @member {GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>} RouteCalculateMeasureParameters.prototype.point
  38110. * @description 二维地理坐标点对象,包含 x,y 坐标值属性的对象。
  38111. */
  38112. this.point = null;
  38113. /**
  38114. * @member {number} [RouteCalculateMeasureParameters.prototype.tolerance]
  38115. * @description 容限值。
  38116. */
  38117. this.tolerance = null;
  38118. /**
  38119. * @member {boolean} [RouteCalculateMeasureParameters.prototype.isIgnoreGap=false]
  38120. * @description 是否忽略子对象之间的距离。
  38121. */
  38122. this.isIgnoreGap = false;
  38123. Util_Util.extend(this, options);
  38124. this.CLASS_NAME = "SuperMap.RouteCalculateMeasureParameters";
  38125. }
  38126. /**
  38127. * @function RouteCalculateMeasureParameters.prototype.destroy
  38128. * @description 释放资源,将引用资源的属性置空。
  38129. */
  38130. destroy() {
  38131. var me = this;
  38132. me.sourceRoute = null;
  38133. me.point = null;
  38134. if (me.tolerance) {
  38135. me.tolerance = null;
  38136. }
  38137. if (me.isIgnoreGap) {
  38138. me.isIgnoreGap = false;
  38139. }
  38140. }
  38141. }
  38142. ;// CONCATENATED MODULE: ./src/common/iServer/RouteCalculateMeasureService.js
  38143. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38144. * This program are made available under the terms of the Apache License, Version 2.0
  38145. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38146. /**
  38147. * @class RouteCalculateMeasureService
  38148. * @deprecatedclass SuperMap.RouteCalculateMeasureService
  38149. * @category iServer SpatialAnalyst RouteCalculateMeasure
  38150. * @classdesc 基于路由对象计算指定点 M 值操作的服务类。
  38151. * 该类负责将客户设置的计算指定点的 M 值参数传递给服务端,并接收服务端返回的
  38152. * 指定点的 M 值。通过该类支持的事件的监听函数参数获取。
  38153. * @extends {SpatialAnalystBase}
  38154. * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst
  38155. * @param {Object} options - 参数。
  38156. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  38157. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  38158. * @param {Object} [options.headers] - 请求头。
  38159. * @example 实例化该类如下例所示:
  38160. * (start code)
  38161. * var parameters = new RouteCalculateMeasureParameters({
  38162. * "sourceRoute":{
  38163. * "type":"LINEM",
  38164. * "parts":[4],
  38165. * "points":[
  38166. * {
  38167. * "measure":0,
  38168. * "y":-6674.466867067764,
  38169. * "x":3817.3527876130133
  38170. * },
  38171. * {
  38172. * "measure":199.57954019411724,
  38173. * "y":-6670.830929417594,
  38174. * "x":3617.806369901496
  38175. * },
  38176. * {
  38177. * "measure":609.3656478634477,
  38178. * "y":-6877.837541432356,
  38179. * "x":3264.1498746678444
  38180. * },
  38181. * {
  38182. * "measure":936.0174126282958,
  38183. * "y":-7038.687780615184,
  38184. * "x":2979.846206068903
  38185. * }
  38186. * ]
  38187. * },
  38188. * "tolerance":1,
  38189. * "point":{
  38190. * "x":3330.7754269417,
  38191. * "y":-6838.8394457216
  38192. * },
  38193. * "isIgnoreGap":false
  38194. * });
  38195. *
  38196. * var routeCalculateMeasureService = new RouteCalculateMeasureService(spatialAnalystURL, {
  38197. * eventListeners:{
  38198. * processCompleted:calculateCompleted,
  38199. * processFailed:calculateFailded
  38200. * }
  38201. * );
  38202. * routeCalculateMeasureService.processAsync(parameters);
  38203. *
  38204. * //执行
  38205. * function calculateCompleted(){todo}
  38206. * function calculateFailded(){todo}
  38207. * (end)
  38208. * @usage
  38209. */
  38210. class RouteCalculateMeasureService extends SpatialAnalystBase {
  38211. constructor(url, options) {
  38212. super(url, options);
  38213. this.CLASS_NAME = "SuperMap.RouteCalculateMeasureService";
  38214. }
  38215. /**
  38216. * @override
  38217. */
  38218. destroy() {
  38219. super.destroy();
  38220. }
  38221. /**
  38222. * @function RouteCalculateMeasureService.prototype.processAsync
  38223. * @description 负责将客户端的基于路由对象计算指定点 M 值操作的参数传递到服务端。
  38224. * @param {RouteCalculateMeasureParameters} params - 基于路由对象计算指定点 M 值操作的参数类。
  38225. */
  38226. processAsync(params) {
  38227. if (!(params instanceof RouteCalculateMeasureParameters)) {
  38228. return;
  38229. }
  38230. var me = this, jsonParameters;
  38231. jsonParameters = me.getJsonParameters(params);
  38232. me.request({
  38233. method: "POST",
  38234. data: jsonParameters,
  38235. scope: me,
  38236. success: me.serviceProcessCompleted,
  38237. failure: me.serviceProcessFailed
  38238. });
  38239. }
  38240. /**
  38241. * @function RouteCalculateMeasureService.prototype.getJsonParameters
  38242. * @description 将参数转化为 JSON 字符串。
  38243. * @param {RouteCalculateMeasureParameters} params - 基于路由对象计算指定点 M 值操作的参数类。
  38244. * @returns {Object} 转化后的 JSON 字符串。
  38245. */
  38246. getJsonParameters(params) {
  38247. var jsonParameters, jsonStr = "geometry/calculatemeasure", me = this;
  38248. me.url = Util_Util.urlPathAppend(me.url, jsonStr);
  38249. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  38250. jsonParameters = Util_Util.toJSON(params);
  38251. return jsonParameters;
  38252. }
  38253. }
  38254. ;// CONCATENATED MODULE: ./src/common/iServer/RouteLocatorParameters.js
  38255. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38256. * This program are made available under the terms of the Apache License, Version 2.0
  38257. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38258. /**
  38259. * @class RouteLocatorParameters
  38260. * @deprecatedclass SuperMap.RouteLocatorParameters
  38261. * @category iServer SpatialAnalyst RouteLocator
  38262. * @classdesc 路由对象定位空间对象的参数类。
  38263. * 参数有两种方式,分别为 Geometry 和 Dataset 两种,前者需要指定 sourceRoute 对象作为参数,后者需要 dataset,routeIDField,routeID 三个参数。如果用户两种参数均设置,优先选择 Dataset 方式。
  38264. * @param {Object} options - 参数。
  38265. * @param {(Route|L.Polyline|ol.geom.LineString|GeoJSONObject)} options.sourceRoute - 路由对象。
  38266. * @param {number} options.measure - 定位点的 M 值。只当路由对象定位点时有意义。
  38267. * @param {string} [options.type] - 类型:点 or 线。
  38268. * @param {number} [options.offset=0] - 定位点偏移量。只当路由对象定位点时有意义。
  38269. * @param {boolean} [options.isIgnoreGap=false] - 是否忽略子对象之间的距离。即不忽略子对象之间的距离。
  38270. * @param {number} [options.startMeasure] - 定位线的起始 M 值。只当路由对象定位线时有意义。
  38271. * @param {number} [options.endMeasure] - 定位线的终止 M 值。只当路由对象定位线时有意义。
  38272. * @usage
  38273. */
  38274. class RouteLocatorParameters {
  38275. constructor(options) {
  38276. if (!options) {
  38277. return this;
  38278. }
  38279. /**
  38280. * @member {(Route|L.Polyline|ol.geom.LineString|GeoJSONObject)} RouteLocatorParameters.prototype.sourceRoute
  38281. * @description 路由对象。
  38282. */
  38283. this.sourceRoute = null;
  38284. /**
  38285. * @member {string} RouteLocatorParameters.prototype.dataset
  38286. * @description 要用来做缓冲区分析的数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示。
  38287. */
  38288. this.dataset = null;
  38289. /**
  38290. * @member {string} RouteLocatorParameters.prototype.routeIDField
  38291. * @description 路由对象所在的字段名称。
  38292. *
  38293. */
  38294. this.routeIDField = null;
  38295. /**
  38296. * @member {number} RouteLocatorParameters.prototype.routeID
  38297. * @description 路由对象标识。
  38298. *
  38299. */
  38300. this.routeID = null;
  38301. /**
  38302. * @member {string} [RouteLocatorParameters.prototype.type]
  38303. * @description 类型:点 or 线。
  38304. * 可选值为:
  38305. * LINE :根据起始 M 值及终止 M 值定位线对象。
  38306. * POINT : 根据 M 值定位点对象。
  38307. */
  38308. this.type = null;
  38309. /**
  38310. * @member {number} RouteLocatorParameters.prototype.measure
  38311. * @description 定位点的 M 值。只当路由对象定位点时有意义。
  38312. */
  38313. this.measure = null;
  38314. /**
  38315. * @member {number} [RouteLocatorParameters.prototype.offset=0]
  38316. * @description 定位点偏移量。只当路由对象定位点时有意义。
  38317. */
  38318. this.offset = 0;
  38319. /**
  38320. * @member {boolean} [RouteLocatorParameters.prototype.isIgnoreGap=false]
  38321. * @description 是否忽略子对象之间的距离。
  38322. */
  38323. this.isIgnoreGap = false;
  38324. /**
  38325. * @member {number} [RouteLocatorParameters.prototype.startMeasure]
  38326. * @description 定位线的起始 M 值。只当路由对象定位线时有意义。
  38327. */
  38328. this.startMeasure = null;
  38329. /**
  38330. * @member {number} [RouteLocatorParameters.prototype.endMeasure]
  38331. * @description 定位线的终止 M 值。只当路由对象定位线时有意义。
  38332. */
  38333. this.endMeasure = null;
  38334. var routeFromClient = options.sourceRoute;
  38335. var routeHandle = {};
  38336. if (routeFromClient && routeFromClient instanceof Geometry_Geometry && routeFromClient.components) {
  38337. routeHandle.type = routeFromClient.type;
  38338. routeHandle.parts = routeFromClient.parts;
  38339. var parts = [];
  38340. for (var i = 0, len = routeFromClient.components.length; i < len; i++) {
  38341. parts = parts.concat(routeFromClient.components[i].components);
  38342. }
  38343. routeHandle.points = parts;
  38344. options.sourceRoute = routeHandle;
  38345. }
  38346. Util_Util.extend(this, options);
  38347. this.CLASS_NAME = "SuperMap.RouteLocatorParameters";
  38348. }
  38349. /**
  38350. * @function RouteLocatorParameters.prototype.destroy
  38351. * @description 释放资源,将引用资源的属性置空。
  38352. */
  38353. destroy() {
  38354. var me = this;
  38355. me.sourceRoute = null;
  38356. me.type = null;
  38357. me.measure = null;
  38358. me.offset = 0;
  38359. me.isIgnoreGap = false;
  38360. me.startMeasure = null;
  38361. me.endMeasure = null;
  38362. me.dataset = null;
  38363. me.routeID = null;
  38364. me.routeIDField = null;
  38365. }
  38366. }
  38367. ;// CONCATENATED MODULE: ./src/common/iServer/RouteLocatorService.js
  38368. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38369. * This program are made available under the terms of the Apache License, Version 2.0
  38370. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38371. /**
  38372. * @class RouteLocatorService
  38373. * @deprecatedclass SuperMap.RouteLocatorService
  38374. * @category iServer SpatialAnalyst RouteLocator
  38375. * @classdesc 路由对象定位空间对象的服务类。
  38376. * @extends {SpatialAnalystBase}
  38377. * @param {string} url -服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  38378. * @param {Object} options - 参数。
  38379. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  38380. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  38381. * @param {Object} [options.headers] - 请求头。
  38382. * @example 实例化该类如下例所示:
  38383. * (start code)
  38384. * var routeLocatorParameters_point = new RouteLocatorParameters({
  38385. * "sourceRoute":{
  38386. * "type":"LINEM",
  38387. * "parts":[4],
  38388. * "points":[
  38389. * {
  38390. * "measure":0,
  38391. * "y":-6674.466867067764,
  38392. * "x":3817.3527876130133
  38393. * },
  38394. * {
  38395. * "measure":199.57954019411724,
  38396. * "y":-6670.830929417594,
  38397. * "x":3617.806369901496
  38398. * },
  38399. * {
  38400. * "measure":609.3656478634477,
  38401. * "y":-6877.837541432356,
  38402. * "x":3264.1498746678444
  38403. * },
  38404. * {
  38405. * "measure":936.0174126282958,
  38406. * "y":-7038.687780615184,
  38407. * "x":2979.846206068903
  38408. * }
  38409. * ]
  38410. * },
  38411. * "type":"POINT",
  38412. * "measure":10,
  38413. * "offset":3,
  38414. * "isIgnoreGap":true
  38415. * });
  38416. * var routeLocatorService = new RouteLocatorService(spatialAnalystURL, {
  38417. * eventListeners:{
  38418. * processCompleted:routeLocatorCompleted,
  38419. * processFailed:routeLocatorFailded
  38420. * }
  38421. * );
  38422. * routeLocatorService.processAsync(routeLocatorParameters_point);
  38423. *
  38424. * //执行
  38425. * function routeLocatorCompleted(){todo}
  38426. * function routeLocatorFailded(){todo}
  38427. * (end)
  38428. * @usage
  38429. */
  38430. class RouteLocatorService extends SpatialAnalystBase {
  38431. constructor(url, options) {
  38432. super(url, options);
  38433. this.CLASS_NAME = "SuperMap.RouteLocatorService";
  38434. }
  38435. /**
  38436. * @override
  38437. */
  38438. destroy() {
  38439. super.destroy();
  38440. }
  38441. /**
  38442. * @function RouteLocatorService.prototype.processAsync
  38443. * @description 负责将客户端的基于路由对象计算指定点 M 值操作的参数传递到服务端。
  38444. * @param {RouteLocatorParameters} params - 路由对象定位空间对象的参数类。
  38445. */
  38446. processAsync(params) {
  38447. if (!(params instanceof RouteLocatorParameters)) {
  38448. return;
  38449. }
  38450. var me = this, jsonParameters;
  38451. jsonParameters = me.getJsonParameters(params);
  38452. me.request({
  38453. method: "POST",
  38454. data: jsonParameters,
  38455. scope: me,
  38456. success: me.serviceProcessCompleted,
  38457. failure: me.serviceProcessFailed
  38458. });
  38459. }
  38460. /**
  38461. * @function RouteLocatorService.prototype.processAsync
  38462. * @description 将参数转化为 JSON 字符串。
  38463. * @param {RouteLocatorParameters} params - 路由对象定位空间对象的参数类。
  38464. * @returns {Object} 转化后的JSON字符串。
  38465. */
  38466. getJsonParameters(params) {
  38467. var jsonParameters, jsonStr = "geometry/routelocator", me = this;
  38468. if (params.dataset) {
  38469. jsonStr = "datasets/" + params.dataset + "/linearreferencing/routelocator";
  38470. params.sourceRoute = null;
  38471. }
  38472. me.url = Util_Util.urlPathAppend(me.url, jsonStr);
  38473. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  38474. jsonParameters = Util_Util.toJSON(params);
  38475. return jsonParameters;
  38476. }
  38477. }
  38478. ;// CONCATENATED MODULE: ./src/common/iServer/SurfaceAnalystParametersSetting.js
  38479. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38480. * This program are made available under the terms of the Apache License, Version 2.0
  38481. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38482. /**
  38483. * @class SurfaceAnalystParametersSetting
  38484. * @deprecatedclass SuperMap.SurfaceAnalystParametersSetting
  38485. * @category iServer SpatialAnalyst SurfaceAnalyst
  38486. * @classdesc 表面分析参数设置类。
  38487. * 通过该类可以设置表面分析提取等值线、提取等值面的一些参数,包括基准值、等值距、光滑度、光滑方法等。
  38488. * @param {Object} options - 参数。
  38489. * @param {GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject} [options.clipRegion] - 裁剪面对象,如果不需要对操作结果进行裁剪,可以使用 null 值取代该参数。
  38490. * @param {number} [options.datumValue=0] - 提取等值线、提取等值面的基准值。
  38491. * @param {Array.<number>} options.expectedZValues - 期望分析结果的 Z 值集合。
  38492. * @param {number} [options.interval=0] - 等值距。等值距是两条等值线之间的间隔值。
  38493. * @param {number} [options.resampleTolerance=0] - 重采样容限。
  38494. * @param {SmoothMethod} [options.smoothMethod=SmoothMethod.BSPLINE] - 光滑处理所使用的方法。
  38495. * @param {number} [options.smoothness=0] - 等值线或等值面的边界线的光滑度。
  38496. * @usage
  38497. */
  38498. class SurfaceAnalystParametersSetting {
  38499. constructor(options) {
  38500. /**
  38501. * @member {GeometryPolygon|L.Polygon|ol.geom.Polygon|GeoJSONObject} [SurfaceAnalystParametersSetting.prototype.clipRegion]
  38502. * @description 获取或设置裁剪面对象,如果不需要对操作结果进行裁剪,可以使用 null 值取代该参数。
  38503. */
  38504. this.clipRegion = null;
  38505. /**
  38506. * @member {number} [SurfaceAnalystParametersSetting.prototype.datumValue=0]
  38507. * @description 获取或设置表面分析中提取等值线、提取等值面的基准值。
  38508. * 基准值是作为一个生成等值线的初始起算值,并不一定是最小等值线的值。例如,高程范围为 220 -1550 的 DEM 栅格数据,
  38509. * 如果设基准值为 0,等值距为 50,则提取等值线时,以基准值 0 为起点,等值距 50 为间隔提取等值线,
  38510. * 因为给定高程的最小值是 220,所以,在给定范围内提取等值线的最小高程是 250。
  38511. * 提取等值线的结果是:最小等值线值为 250,最大等值线值为 1550。
  38512. */
  38513. this.datumValue = 0;
  38514. /**
  38515. * @member {Array.<number>} SurfaceAnalystParametersSetting.prototype.expectedZValues
  38516. * @description 获取或设置期望分析结果的 Z 值集合。
  38517. * Z 值集合存储一系列数值,该数值为待提取等值线的值。即仅高程值在 Z 值集合中的等值线会被提取。
  38518. */
  38519. this.expectedZValues = null;
  38520. /**
  38521. * @member {number} [SurfaceAnalystParametersSetting.prototype.interval=0]
  38522. * @description 获取或设置等值距。等值距是两条等值线之间的间隔值。
  38523. */
  38524. this.interval = 0;
  38525. /**
  38526. * @member {number} [SurfaceAnalystParametersSetting.prototype.resampleTolerance=0]
  38527. * @description 获取或设置重采样容限。
  38528. * 容限值越大,采样结果数据越简化。当分析结果出现交叉时,可通过调整重采样容限为较小的值来处理。
  38529. */
  38530. this.resampleTolerance = 0;
  38531. /**
  38532. * @member {SmoothMethod} [SurfaceAnalystParametersSetting.prototype.smoothMethod=SmoothMethod.BSPLINE]
  38533. * @description 获取或设置光滑处理所使用的方法。
  38534. */
  38535. this.smoothMethod = SmoothMethod.BSPLINE;
  38536. /**
  38537. * @member {number} [SurfaceAnalystParametersSetting.prototype.smoothness=0]
  38538. * @description 获取或设置表面分析中等值线或等值面的边界线的光滑度。
  38539. * 以为 0-5 为例,光滑度为 0 表示不进行光滑操作,值越大表示光滑度越高。
  38540. * 随着光滑度的增加,提取的等值线越光滑,当然光滑度越大,
  38541. * 计算所需的时间和占用的内存也就越大。而且,当等值距较小时,
  38542. * 光滑度太高会出现等值线相交的问题。
  38543. */
  38544. this.smoothness = 0;
  38545. if (options) {
  38546. Util_Util.extend(this, options);
  38547. }
  38548. this.CLASS_NAME = "SuperMap.SurfaceAnalystParametersSetting";
  38549. }
  38550. /**
  38551. * @function SurfaceAnalystParametersSetting.prototype.destroy
  38552. * @description 释放资源,将引用资源的属性置空。
  38553. */
  38554. destroy() {
  38555. var me = this;
  38556. if (me.clipRegion) {
  38557. me.clipRegion.destroy();
  38558. me.clipRegion = null;
  38559. }
  38560. me.datumValue = null;
  38561. me.expectedZValues = null;
  38562. me.interval = null;
  38563. me.resampleTolerance = null;
  38564. me.smoothMethod = null;
  38565. me.smoothness = null;
  38566. }
  38567. /**
  38568. * @function SurfaceAnalystParametersSetting.prototype.toJSON
  38569. * @description 将对象转化为 JSON 字符串。
  38570. * @returns {string} 对象 JSON 字符串。
  38571. */
  38572. toJSON() {
  38573. let json = "'datumValue':" + Util_Util.toJSON(this.datumValue);
  38574. json += ",'interval':" + Util_Util.toJSON(this.interval);
  38575. json += ",'resampleTolerance':" + Util_Util.toJSON(this.resampleTolerance);
  38576. json += ",'smoothMethod':" + Util_Util.toJSON(this.smoothMethod);
  38577. json += ",'smoothness':" + Util_Util.toJSON(this.smoothness);
  38578. if (this.expectedZValues != null) {
  38579. json += "," + "'expectedZValues':" + Util_Util.toJSON(this.expectedZValues);
  38580. }
  38581. if (this.clipRegion != null) {
  38582. var serverGeometry = this.clipRegion;
  38583. if (this.clipRegion instanceof Geometry_Geometry && this.clipRegion.components) {
  38584. serverGeometry = ServerGeometry.fromGeometry(this.clipRegion)
  38585. }
  38586. json += ",'clipRegion':" + Util_Util.toJSON(serverGeometry);
  38587. }
  38588. return "{" + json + "}";
  38589. }
  38590. }
  38591. ;// CONCATENATED MODULE: ./src/common/iServer/SurfaceAnalystParameters.js
  38592. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38593. * This program are made available under the terms of the Apache License, Version 2.0
  38594. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38595. /**
  38596. * @class SurfaceAnalystParameters
  38597. * @deprecatedclass SuperMap.SurfaceAnalystParameters
  38598. * @category iServer SpatialAnalyst SurfaceAnalyst
  38599. * @classdesc 表面分析提取操作参数类。通过该类可以为进行表面分析提供参数信息,包括表面分析的方法提取等值线、提取等值面和中间结果的分辨率,
  38600. * {@link DatasetSurfaceAnalystParameters} 和 {@link GeometrySurfaceAnalystParameters} 继承自该类。
  38601. * @param {Object} options - 参数。
  38602. * @param {SurfaceAnalystParametersSetting} options.extractParameter - 表面分析参数设置类。
  38603. * @param {number} options.resolution - 指定中间结果(栅格数据集)的分辨率。
  38604. * @param {DataReturnOption} options.resultSetting - 结果返回设置类。
  38605. * @param {SurfaceAnalystMethod} [options.surfaceAnalystMethod=SurfaceAnalystMethod.ISOLINE] - 获取或设置表面分析的提取方法,提取等值线和提取等值面。
  38606. * @usage
  38607. */
  38608. class SurfaceAnalystParameters {
  38609. constructor(options) {
  38610. /**
  38611. * @member {number} SurfaceAnalystParameters.prototype.resolution
  38612. * @description 获取或设置指定中间结果(栅格数据集)的分辨率。
  38613. */
  38614. this.resolution = 0;
  38615. /**
  38616. * @member {SurfaceAnalystParametersSetting} SurfaceAnalystParameters.prototype.extractParameter
  38617. * @description 获取或设置表面分析参数。
  38618. * 在进行点数据集进行提取等值面分析时,暂时不支持 SurfaceAnalystParametersSetting 类中的 expectedZValues 字段。
  38619. */
  38620. this.extractParameter = new SurfaceAnalystParametersSetting();
  38621. /**
  38622. * @member {DataReturnOption} SurfaceAnalystParameters.prototype.resultSetting
  38623. * @description 结果返回设置类。
  38624. */
  38625. this.resultSetting = new DataReturnOption();
  38626. /**
  38627. * @member {SurfaceAnalystMethod} [SurfaceAnalystParameters.prototype.surfaceAnalystMethod=SurfaceAnalystMethod.ISOLINE]
  38628. * @description 获取或设置表面分析的提取方法,提取等值线和提取等值面。
  38629. */
  38630. this.surfaceAnalystMethod = SurfaceAnalystMethod.ISOLINE;
  38631. if (options) {
  38632. Util_Util.extend(this, options);
  38633. }
  38634. this.CLASS_NAME = "SuperMap.SurfaceAnalystParameters";
  38635. }
  38636. /**
  38637. * @function SurfaceAnalystParameters.prototype.destroy
  38638. * @description 释放资源,将引用资源的属性置空。
  38639. */
  38640. destroy() {
  38641. var me = this;
  38642. me.resolution = null;
  38643. if (me.extractParameter) {
  38644. me.extractParameter.destroy();
  38645. me.extractParameter = null;
  38646. }
  38647. if (me.resultSetting) {
  38648. me.resultSetting.destroy();
  38649. me.resultSetting = null;
  38650. }
  38651. me.surfaceAnalystMethod = null;
  38652. }
  38653. }
  38654. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetSurfaceAnalystParameters.js
  38655. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38656. * This program are made available under the terms of the Apache License, Version 2.0
  38657. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38658. /**
  38659. * @class DatasetSurfaceAnalystParameters
  38660. * @deprecatedclass SuperMap.DatasetSurfaceAnalystParameters
  38661. * @category iServer SpatialAnalyst SurfaceAnalyst
  38662. * @classdesc 数据集表面分析参数类。该类对数据集表面分析所用到的参数进行设置。
  38663. * @param {Object} options - 参数。
  38664. * @param {string} options.dataset - 数据集名称。
  38665. * @param {string} options.zValueFieldName - 字段名称。
  38666. * @param {number} options.resolution - 指定中间结果(栅格数据集)的分辨率。
  38667. * @param {SurfaceAnalystParametersSetting} options.extractParameter - 表面分析参数设置类。获取或设置表面分析参数。
  38668. * @param {FilterParameter} [options.filterQueryParameter] - 查询过滤条件参数。
  38669. * @param {DataReturnOption} [options.resultSetting] - 结果返回设置类。
  38670. * @param {SurfaceAnalystMethod} [options.surfaceAnalystMethod=SurfaceAnalystMethod.ISOLINE] - 表面分析的提取方法,提取等值线和提取等值面。
  38671. * @extends {SurfaceAnalystParameters}
  38672. * @usage
  38673. */
  38674. class DatasetSurfaceAnalystParameters extends SurfaceAnalystParameters {
  38675. constructor(options) {
  38676. super(options);
  38677. /**
  38678. * @member {string} DatasetSurfaceAnalystParameters.prototype.dataset
  38679. * @description 要用来做数据集表面分析的数据源中数据集的名称。该名称用形如 "数据集名称@数据源别名" 形式来表示,例如:Country@World。
  38680. */
  38681. this.dataset = null;
  38682. /**
  38683. * @member {FilterParameter} DatasetSurfaceAnalystParameters.prototype.filterQueryParameter
  38684. * @description 获取或设置查询过滤条件参数。
  38685. */
  38686. this.filterQueryParameter = new FilterParameter();
  38687. /**
  38688. * @member {string} DatasetSurfaceAnalystParameters.prototype.zValueFieldName
  38689. * @description 获取或设置用于提取操作的字段名称。提取等值线时,将使用该字段中的值,对点记录集中的点数据进行插值分析,得到栅格数据集(中间结果),接着从栅格数据集提取等值线。
  38690. */
  38691. this.zValueFieldName = null;
  38692. if (options) {
  38693. Util_Util.extend(this, options);
  38694. }
  38695. this.CLASS_NAME = "SuperMap.DatasetSurfaceAnalystParameters";
  38696. }
  38697. /**
  38698. * @function DatasetSurfaceAnalystParameters.prototype.destroy
  38699. * @override
  38700. */
  38701. destroy() {
  38702. super.destroy();
  38703. var me = this;
  38704. me.dataset = null;
  38705. if (me.filterQueryParameter) {
  38706. me.filterQueryParameter.destroy();
  38707. me.filterQueryParameter = null;
  38708. }
  38709. me.zValueFieldName = null;
  38710. }
  38711. /**
  38712. * @function DatasetSurfaceAnalystParameters.toObject
  38713. * @param {DatasetSurfaceAnalystParameters} datasetSurfaceAnalystParameters - 数据集表面分析参数类。
  38714. * @param {DatasetSurfaceAnalystParameters} tempObj - 数据集表面分析参数对象。
  38715. * @description 将数据集表面分析参数对象转换为 JSON 对象。
  38716. * @returns JSON 对象。
  38717. */
  38718. static toObject(datasetSurfaceAnalystParameters, tempObj) {
  38719. for (var name in datasetSurfaceAnalystParameters) {
  38720. if (name === "filterQueryParameter") {
  38721. tempObj.filterQueryParameter = datasetSurfaceAnalystParameters.filterQueryParameter;
  38722. }
  38723. if (name === "extractParameter") {
  38724. if (datasetSurfaceAnalystParameters.extractParameter.clipRegion instanceof Geometry_Geometry && datasetSurfaceAnalystParameters.extractParameter.clipRegion.components) {
  38725. datasetSurfaceAnalystParameters.extractParameter.clipRegion = ServerGeometry.fromGeometry(datasetSurfaceAnalystParameters.extractParameter.clipRegion);
  38726. }
  38727. tempObj.extractParameter = datasetSurfaceAnalystParameters.extractParameter;
  38728. } else if (name === "dataset") {
  38729. continue;
  38730. } else if (name === "surfaceAnalystMethod") {
  38731. continue;
  38732. } else {
  38733. tempObj[name] = datasetSurfaceAnalystParameters[name];
  38734. }
  38735. }
  38736. }
  38737. }
  38738. ;// CONCATENATED MODULE: ./src/common/iServer/GeometrySurfaceAnalystParameters.js
  38739. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38740. * This program are made available under the terms of the Apache License, Version 2.0
  38741. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38742. /**
  38743. * @class GeometrySurfaceAnalystParameters
  38744. * @deprecatedclass SuperMap.GeometrySurfaceAnalystParameters
  38745. * @category iServer SpatialAnalyst SurfaceAnalyst
  38746. * @classdesc 几何对象表面分析参数类。该类对几何对象表面分析所用到的参数进行设置。
  38747. * @param {Object} options - 参数。
  38748. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} options.points - 表面分析的坐标点数组。
  38749. * @param {Array.<number>} options.zValues - 表面分析的坐标点的 Z 值数组。
  38750. * @param {number} [options.resolution] - 获取或设置指定中间结果(栅格数据集)的分辨率。
  38751. * @param {DataReturnOption} [options.resultSetting] - 结果返回设置类。
  38752. * @param {SurfaceAnalystParametersSetting} options.extractParameter - 获取或设置表面分析参数。
  38753. * @param {SurfaceAnalystMethod} [options.surfaceAnalystMethod = SurfaceAnalystMethod.ISOLINE] - 获取或设置表面分析的提取方法,提取等值线和提取等值面。
  38754. * @extends {SurfaceAnalystParameters}
  38755. * @usage
  38756. */
  38757. class GeometrySurfaceAnalystParameters extends SurfaceAnalystParameters {
  38758. constructor(options) {
  38759. super(options);
  38760. /**
  38761. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} GeometrySurfaceAnalystParameters.prototype.points
  38762. * @description 获取或设置用于表面分析的坐标点数组。
  38763. */
  38764. this.points = null;
  38765. /**
  38766. * @member {Array.<number>} GeometrySurfaceAnalystParameters.prototype.zValues
  38767. * @description 获取或设置用于提取操作的值。提取等值线时,将使用该数组中的值,
  38768. * 对几何对象中的坐标点数组进行插值分析,得到栅格数据集(中间结果),接着从栅格数据集提取等值线。
  38769. */
  38770. this.zValues = null;
  38771. if (options) {
  38772. Util_Util.extend(this, options);
  38773. }
  38774. this.CLASS_NAME = "SuperMap.GeometrySurfaceAnalystParameters";
  38775. }
  38776. /**
  38777. * @function GeometrySurfaceAnalystParameters.prototype.destroy
  38778. * @override
  38779. */
  38780. destroy() {
  38781. super.destroy();
  38782. var me = this;
  38783. if (me.points) {
  38784. for (var i = 0, points = me.points, len = points.length; i < len; i++) {
  38785. points[i].destroy();
  38786. }
  38787. me.points = null;
  38788. }
  38789. me.zValues = null;
  38790. }
  38791. }
  38792. ;// CONCATENATED MODULE: ./src/common/iServer/SurfaceAnalystService.js
  38793. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38794. * This program are made available under the terms of the Apache License, Version 2.0
  38795. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38796. /**
  38797. * @class SurfaceAnalystService
  38798. * @deprecatedclass SuperMap.SurfaceAnalystService
  38799. * @category iServer SpatialAnalyst SurfaceAnalyst
  38800. * @classdesc 表面分析服务类。
  38801. * 该类负责将客户设置的表面分析服务参数传递给服务端,并接收服务端返回的表面分析服务分析结果数据。
  38802. * 表面分析结果通过该类支持的事件的监听函数参数获取
  38803. * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst
  38804. * @param {Object} options - 参数。
  38805. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  38806. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  38807. * @param {Object} [options.headers] - 请求头。
  38808. * @extends {SpatialAnalystBase}
  38809. * @example 例如:
  38810. * (start code)
  38811. * var mySurfaceAnalystService = new SurfaceAnalystService(url, {
  38812. * eventListeners: {
  38813. * "processCompleted": surfaceAnalysCompleted,
  38814. * "processFailed": surfaceAnalysFailed
  38815. * }
  38816. * });
  38817. * (end)
  38818. * @usage
  38819. */
  38820. class SurfaceAnalystService extends SpatialAnalystBase {
  38821. constructor(url, options) {
  38822. super(url, options);
  38823. this.CLASS_NAME = "SuperMap.SurfaceAnalystService";
  38824. }
  38825. /**
  38826. * @function SurfaceAnalystService.prototype.destroy
  38827. * @description 释放资源,将引用的资源属性置空。
  38828. */
  38829. destroy() {
  38830. super.destroy();
  38831. }
  38832. /**
  38833. * @function SurfaceAnalystService.prototype.processAsync
  38834. * @description 负责将客户端的表面分析服务参数传递到服务端。
  38835. * @param {SurfaceAnalystParameters} params - 表面分析提取操作参数类。
  38836. */
  38837. processAsync(params) {
  38838. if (!(params instanceof SurfaceAnalystParameters)) {
  38839. return;
  38840. }
  38841. var me = this, jsonParameters;
  38842. jsonParameters = me.getJsonParameters(params);
  38843. me.request({
  38844. method: "POST",
  38845. data: jsonParameters,
  38846. scope: me,
  38847. success: me.serviceProcessCompleted,
  38848. failure: me.serviceProcessFailed
  38849. });
  38850. }
  38851. /**
  38852. * @function SurfaceAnalystService.prototype.getJsonParameters
  38853. * @description 将参数转化为 JSON 字符串。
  38854. * @param {SurfaceAnalystParameters} params - 表面分析提取操作参数类。
  38855. * @returns {Object} 转化后的JSON字符串。
  38856. */
  38857. getJsonParameters(params) {
  38858. var jsonParameters = '';
  38859. var parameterObject = {};
  38860. var me = this;
  38861. if (params instanceof DatasetSurfaceAnalystParameters) {
  38862. me.url = Util_Util.urlPathAppend(
  38863. me.url,
  38864. 'datasets/' + params.dataset + '/' + params.surfaceAnalystMethod.toLowerCase()
  38865. );
  38866. DatasetSurfaceAnalystParameters.toObject(params, parameterObject);
  38867. jsonParameters = Util_Util.toJSON(parameterObject);
  38868. } else if (params instanceof GeometrySurfaceAnalystParameters) {
  38869. me.url = Util_Util.urlPathAppend(me.url, 'geometry/' + params.surfaceAnalystMethod.toLowerCase());
  38870. jsonParameters = Util_Util.toJSON(params);
  38871. } else {
  38872. return;
  38873. }
  38874. this.returnContent = true;
  38875. return jsonParameters;
  38876. }
  38877. dataFormat() {
  38878. return [DataFormat.GEOJSON, DataFormat.ISERVER, DataFormat.FGB];
  38879. }
  38880. }
  38881. ;// CONCATENATED MODULE: ./src/common/iServer/TerrainCurvatureCalculationParameters.js
  38882. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38883. * This program are made available under the terms of the Apache License, Version 2.0
  38884. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38885. /**
  38886. * @class TerrainCurvatureCalculationParameters
  38887. * @deprecatedclass SuperMap.TerrainCurvatureCalculationParameters
  38888. * @category iServer SpatialAnalyst TerrainCalculation
  38889. * @classdesc 地形曲率计算参数类。
  38890. * @param {Object} options - 参数。
  38891. * @param {string} options.dataset - 地形曲率计算数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示,例如:JingjinTerrain@Jingjin。
  38892. * @param {string} options.averageCurvatureName - 结果数据集:平均曲率数据集的名称。
  38893. * @param {string} options.profileCurvatureName - 结果数据集:剖面曲率数据集的名称。
  38894. * @param {string} options.planCurvatureName - 结果数据集:平面曲率数据集的名称。
  38895. * @param {number} [options.zFactor=1.0] - 指定的高程缩放系数。1.0 表示不缩放。
  38896. * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  38897. * @usage
  38898. */
  38899. class TerrainCurvatureCalculationParameters {
  38900. constructor(options) {
  38901. if (!options) {
  38902. return;
  38903. }
  38904. /**
  38905. * @member {string} TerrainCurvatureCalculationParameters.prototype.dataset
  38906. * @description 要用来做地形曲率计算数据源中数据集的名称。
  38907. * 该名称用形如"数据集名称@数据源别名"形式来表示,例如:JingjinTerrain@Jingjin。
  38908. * 注:地形曲率计算必须为栅格数据集。
  38909. */
  38910. this.dataset = null;
  38911. /**
  38912. * @member {number} [TerrainCurvatureCalculationParameters.prototype.zFactor=1.0]
  38913. * @description 指定的高程缩放系数。1.0 表示不缩放。
  38914. * 该值是指在 DEM 栅格数据中,栅格值( Z 坐标,即高程值)相对于 X 和 Y 坐标的单位变换系数。
  38915. * 通常有 X,Y,Z 都参加的计算中,需要将高程值乘以一个高程缩放系数,使得三者单位一致。
  38916. * 例如,X、Y 方向上的单位是米,而 Z 方向的单位是英尺,由于 1 英尺等于 0.3048 米,则需要指定缩放系数为 0.3048。
  38917. */
  38918. this.zFactor = 1.0;
  38919. /**
  38920. * @member {string} TerrainCurvatureCalculationParameters.prototype.averageCurvatureName
  38921. * @description 结果数据集:平均曲率数据集的名称。
  38922. */
  38923. this.averageCurvatureName = null;
  38924. /**
  38925. * @member {string} TerrainCurvatureCalculationParameters.prototype.profileCurvatureName
  38926. * @description 结果数据集:剖面曲率数据集的名称。
  38927. */
  38928. this.profileCurvatureName = "";
  38929. /**
  38930. * @member {string} TerrainCurvatureCalculationParameters.prototype.planCurvatureName
  38931. * @description 结果数据集:平面曲率数据集的名称。
  38932. */
  38933. this.planCurvatureName = "";
  38934. /**
  38935. * @member {boolean} [TerrainCurvatureCalculationParameters.prototype.deleteExistResultDataset=false]
  38936. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  38937. */
  38938. this.deleteExistResultDataset = false;
  38939. Util_Util.extend(this, options);
  38940. this.CLASS_NAME = "SuperMap.TerrainCurvatureCalculationParameters";
  38941. }
  38942. /**
  38943. * @function TerrainCurvatureCalculationParameters.prototype.destroy
  38944. * @description 释放资源,将引用资源的属性置空。
  38945. */
  38946. destroy() {
  38947. var me = this;
  38948. me.dataset = null;
  38949. me.zFactor = 1.0;
  38950. me.averageCurvatureName = null;
  38951. me.profileCurvatureName = null;
  38952. me.planCurvatureName = null;
  38953. me.deleteExistResultDataset = true;
  38954. }
  38955. /**
  38956. * @function TerrainCurvatureCalculationParameters.toObject
  38957. * @param {Object} derrainCurvatureCalculationParameters - 地形曲率计算参数。
  38958. * @param {Object} tempObj - 目标对象。
  38959. * @description 生成地形曲率计算对象。
  38960. */
  38961. static toObject(derrainCurvatureCalculationParameters, tempObj) {
  38962. for (var name in derrainCurvatureCalculationParameters) {
  38963. if (name !== "dataset") {
  38964. tempObj[name] = derrainCurvatureCalculationParameters[name];
  38965. }
  38966. }
  38967. }
  38968. }
  38969. ;// CONCATENATED MODULE: ./src/common/iServer/TerrainCurvatureCalculationService.js
  38970. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  38971. * This program are made available under the terms of the Apache License, Version 2.0
  38972. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  38973. /**
  38974. * @class TerrainCurvatureCalculationService
  38975. * @deprecatedclass SuperMap.TerrainCurvatureCalculationService
  38976. * @category iServer SpatialAnalyst TerrainCalculation
  38977. * @classdesc 地形曲率计算服务类。
  38978. * @extends {SpatialAnalystBase}
  38979. * @param {Object} options - 参数。
  38980. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  38981. * @param {string} options.url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst 。
  38982. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  38983. * @param {Object} [options.headers] - 请求头。
  38984. * @example 例如:
  38985. * (start code)
  38986. * var myTerrainCurvatureCalculationService = new TerrainCurvatureCalculationService(url);
  38987. * myTerrainCurvatureCalculationService.on({
  38988. * "processCompleted": processCompleted,
  38989. * "processFailed": processFailed
  38990. * }
  38991. * );
  38992. * (end)
  38993. * @usage
  38994. */
  38995. class TerrainCurvatureCalculationService extends SpatialAnalystBase {
  38996. constructor(url, options) {
  38997. super(url, options);
  38998. this.CLASS_NAME = "SuperMap.TerrainCurvatureCalculationService";
  38999. }
  39000. /**
  39001. *@override
  39002. */
  39003. destroy() {
  39004. super.destroy();
  39005. }
  39006. /**
  39007. * @function TerrainCurvatureCalculationService.prototype.processAsync
  39008. * @description 负责将客户端的查询参数传递到服务端。
  39009. * @param {TerrainCurvatureCalculationParameters} parameter - 地形曲率计算参数类。
  39010. */
  39011. processAsync(parameter) {
  39012. var me = this;
  39013. var parameterObject = {};
  39014. if (parameter instanceof TerrainCurvatureCalculationParameters) {
  39015. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/terraincalculation/curvature');
  39016. }
  39017. TerrainCurvatureCalculationParameters.toObject(parameter, parameterObject);
  39018. var jsonParameters = Util_Util.toJSON(parameterObject);
  39019. me.url = Util_Util.urlAppend(me.url, 'returnContent=true');
  39020. me.request({
  39021. method: "POST",
  39022. data: jsonParameters,
  39023. scope: me,
  39024. success: me.serviceProcessCompleted,
  39025. failure: me.serviceProcessFailed
  39026. });
  39027. }
  39028. }
  39029. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetThiessenAnalystParameters.js
  39030. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  39031. * This program are made available under the terms of the Apache License, Version 2.0
  39032. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  39033. /**
  39034. * @class DatasetThiessenAnalystParameters
  39035. * @deprecatedclass SuperMap.DatasetThiessenAnalystParameters
  39036. * @category iServer SpatialAnalyst ThiessenAnalyst
  39037. * @classdesc 数据集泰森多边形分析参数类。
  39038. * @param {Object} options - 参数。
  39039. * @param {FilterParameter} [options.filterQueryParameter] - 过滤参数类,即对数据集中的所有点进行分析。
  39040. * @extends {ThiessenAnalystParameters}
  39041. * @usage
  39042. */
  39043. class DatasetThiessenAnalystParameters extends ThiessenAnalystParameters {
  39044. constructor(options) {
  39045. super(options);
  39046. /**
  39047. * @member {FilterParameter} [DatasetThiessenAnalystParameters.prototype.filterQueryParameter]
  39048. * @description 过滤条件,对待分析数据集中的点进行过滤,即对数据集中的所有点进行分析。
  39049. * @example
  39050. * var filterQueryParameter = new FilterParameter({
  39051. * name: "Countries@World",
  39052. * attributeFilter: "SmID>100"
  39053. * });
  39054. */
  39055. this.filterQueryParameter = null;
  39056. /**
  39057. * @member {string} DatasetThiessenAnalystParameters.prototype.dataset
  39058. * @description 数据集名称待分析的数据集名称,请使用 "datasetName@datasourceName" 格式来表示。
  39059. */
  39060. this.dataset = null;
  39061. if (options) {
  39062. Util_Util.extend(this, options);
  39063. }
  39064. this.CLASS_NAME = "SuperMap.DatasetThiessenAnalystParameters";
  39065. }
  39066. /**
  39067. * @function DatasetThiessenAnalystParameters.prototype.destroy
  39068. * @override
  39069. */
  39070. destroy() {
  39071. super.destroy();
  39072. var me = this;
  39073. if (me.filterQueryParameter) {
  39074. me.filterQueryParameter.destroy();
  39075. me.filterQueryParameter = null;
  39076. }
  39077. }
  39078. /**
  39079. * @function DatasetThiessenAnalystParameters.toObject
  39080. * @param {DatasetThiessenAnalystParameters} datasetThiessenAnalystParameters - 泰森多边形分析服务参数类。
  39081. * @param {DatasetThiessenAnalystParameters} tempObj - 泰森多边形分析服务参数对象。
  39082. * @description 将泰森多边形分析服务参数对象转换为 JSON 对象。
  39083. * @returns JSON 对象。
  39084. */
  39085. static toObject(datasetThiessenAnalystParameters, tempObj) {
  39086. for (var name in datasetThiessenAnalystParameters) {
  39087. if (name === "clipRegion") {
  39088. tempObj.clipRegion = ServerGeometry.fromGeometry(datasetThiessenAnalystParameters.clipRegion);
  39089. } else {
  39090. tempObj[name] = datasetThiessenAnalystParameters[name];
  39091. }
  39092. }
  39093. }
  39094. }
  39095. ;// CONCATENATED MODULE: ./src/common/iServer/GeometryThiessenAnalystParameters.js
  39096. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  39097. * This program are made available under the terms of the Apache License, Version 2.0
  39098. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  39099. /**
  39100. * @class GeometryThiessenAnalystParameters
  39101. * @deprecatedclass SuperMap.GeometryThiessenAnalystParameters
  39102. * @constructs GeometryThiessenAnalystParameters
  39103. * @category iServer SpatialAnalyst ThiessenPolygonAnalyst
  39104. * @classdesc 几何对象泰森多边形分析参数类。对指定的某个几何对象做泰森多边形分析。通过该类可以指定要做泰森多边形分析的几何对象、返回数据集名称等。
  39105. * @param {Object} options - 参数。
  39106. * @param {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} options.points - 使用点数组进行分析时使用的几何对象。
  39107. * @extends {ThiessenAnalystParameters}
  39108. * @usage
  39109. */
  39110. class GeometryThiessenAnalystParameters extends ThiessenAnalystParameters {
  39111. constructor(options) {
  39112. super(options);
  39113. /**
  39114. * @member {Array.<GeometryPoint|L.LatLng|L.Point|ol.geom.Point|mapboxgl.LngLat|Array.<number>>} GeometryThiessenAnalystParameters.prototype.points
  39115. * @description 使用点数组进行分析时使用的几何对象。
  39116. */
  39117. this.points = null;
  39118. if (options) {
  39119. Util_Util.extend(this, options);
  39120. }
  39121. this.CLASS_NAME = "SuperMap.GeometryThiessenAnalystParameters";
  39122. }
  39123. /**
  39124. * @function GeometryThiessenAnalystParameters.prototype.destroy
  39125. * @override
  39126. */
  39127. destroy() {
  39128. super.destroy();
  39129. var me = this;
  39130. if (me.points) {
  39131. for (var i = me.points.length - 1; i >= 0; i--) {
  39132. me.points[i].destroy();
  39133. }
  39134. me.points = null;
  39135. }
  39136. }
  39137. /**
  39138. * @function GeometryThiessenAnalystParameters.toObject
  39139. * @param {GeometryThiessenAnalystParameters} geometryThiessenAnalystParameters - 几何对象泰森多边形分析参数类。
  39140. * @param {GeometryThiessenAnalystParameters} tempObj - 几何对象泰森多边形分析参数对象。
  39141. * @description 将几何对象泰森多边形分析参数对象转换为 JSON 对象。
  39142. * @returns {Object} JSON 对象。
  39143. */
  39144. static toObject(geometryThiessenAnalystParameters, tempObj) {
  39145. for (var name in geometryThiessenAnalystParameters) {
  39146. if (name === "clipRegion") {
  39147. tempObj.clipRegion = ServerGeometry.fromGeometry(geometryThiessenAnalystParameters.clipRegion);
  39148. } else {
  39149. tempObj[name] = geometryThiessenAnalystParameters[name];
  39150. }
  39151. }
  39152. }
  39153. }
  39154. ;// CONCATENATED MODULE: ./src/common/iServer/ThiessenAnalystService.js
  39155. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  39156. * This program are made available under the terms of the Apache License, Version 2.0
  39157. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  39158. /**
  39159. * @class ThiessenAnalystService
  39160. * @deprecatedclass SuperMap.ThiessenAnalystService
  39161. * @category iServer SpatialAnalyst ThiessenPolygonAnalyst
  39162. * @classdesc
  39163. * 泰森多边形分析服务类
  39164. * 该类负责将客户设置的泰森多边形分析参数传递给服务端,并接收服务端返回的分析结果数据。
  39165. * 泰森多边形分析结果通过该类支持的事件的监听函数参数获取
  39166. * 泰森多边形分析的参数支持两种,当参数为 {@link DatasetThiessenAnalystParameters} 类型
  39167. * 时,执行数据集泰森多边形分析,当参数为 {@link GeometryThiessenAnalystParameters} 类型时,
  39168. * 执行几何对象泰森多边形分析。
  39169. * @param {string} url - 服务地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  39170. * @param {Object} options - 参数。
  39171. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  39172. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  39173. * @param {Object} [options.headers] - 请求头。
  39174. * @extends {SpatialAnalystBase}
  39175. * @example 例如:
  39176. * (start code)
  39177. * var myThiessenAnalystService = new ThiessenAnalystService(url, {
  39178. * eventListeners: {
  39179. * "processCompleted": bufferCompleted,
  39180. * "processFailed": bufferFailed
  39181. * }
  39182. * });
  39183. * (end)
  39184. * @usage
  39185. */
  39186. class ThiessenAnalystService extends SpatialAnalystBase {
  39187. constructor(url, options) {
  39188. super(url, options);
  39189. /**
  39190. * @member {string} ThiessenAnalystService.prototype.mode
  39191. * @description 缓冲区分析类型
  39192. */
  39193. this.mode = null;
  39194. if (options) {
  39195. Util_Util.extend(this, options);
  39196. }
  39197. this.CLASS_NAME = "SuperMap.ThiessenAnalystService";
  39198. }
  39199. /**
  39200. * @override
  39201. */
  39202. destroy() {
  39203. super.destroy();
  39204. this.mode = null;
  39205. }
  39206. /**
  39207. * @function ThiessenAnalystService.prototype.processAsync
  39208. * @description 负责将客户端的查询参数传递到服务端。
  39209. * @param {DatasetThiessenAnalystParameters|GeometryThiessenAnalystParameters} parameter - 泰森多边形分析参数基类。
  39210. */
  39211. processAsync(parameter) {
  39212. var parameterObject = {};
  39213. var me = this;
  39214. if (parameter instanceof DatasetThiessenAnalystParameters) {
  39215. me.mode = "datasets";
  39216. me.url = Util_Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/thiessenpolygon');
  39217. DatasetThiessenAnalystParameters.toObject(parameter, parameterObject);
  39218. } else if (parameter instanceof GeometryThiessenAnalystParameters) {
  39219. me.mode = "geometry";
  39220. me.url = Util_Util.urlPathAppend(me.url, 'geometry/thiessenpolygon');
  39221. GeometryThiessenAnalystParameters.toObject(parameter, parameterObject);
  39222. }
  39223. var jsonParameters = Util_Util.toJSON(parameterObject);
  39224. this.returnContent = true;
  39225. me.request({
  39226. method: "POST",
  39227. data: jsonParameters,
  39228. scope: me,
  39229. success: me.serviceProcessCompleted,
  39230. failure: me.serviceProcessFailed
  39231. });
  39232. }
  39233. dataFormat() {
  39234. return [DataFormat.GEOJSON, DataFormat.ISERVER, DataFormat.FGB];
  39235. }
  39236. }
  39237. ;// CONCATENATED MODULE: ./src/common/iServer/GeometryBatchAnalystService.js
  39238. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  39239. * This program are made available under the terms of the Apache License, Version 2.0
  39240. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  39241. /**
  39242. * @class GeometryBatchAnalystService
  39243. * @deprecatedclass SuperMap.GeometryBatchAnalystService
  39244. * @category iServer SpatialAnalyst BatchAnalyst
  39245. * @classdesc 批量空间分析服务类
  39246. * @description 该类负责将客户设置的叠加分析参数传递给服务端,并接收服务端返回的叠加分析结果数据。
  39247. * 获取的结果数据包括 originResult 、result 两种,
  39248. * 其中,originResult 为服务端返回的用 JSON 对象表示的量算结果数据,result 为服务端返回的量算结果数据。
  39249. * @extends {SpatialAnalystBase}
  39250. * @param {string} url - 服务地址。如:http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  39251. * @param {Object} options - 参数。
  39252. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  39253. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  39254. * @param {Object} [options.headers] - 请求头。
  39255. * @example
  39256. * var myOverlayAnalystService = new GeometryBatchAnalystService(url, {
  39257. * eventListeners: {
  39258. * "processCompleted": OverlayCompleted,
  39259. * "processFailed": OverlayFailed
  39260. * }
  39261. * });
  39262. * @usage
  39263. */
  39264. class GeometryBatchAnalystService extends SpatialAnalystBase {
  39265. constructor(url, options) {
  39266. super(url, options);
  39267. if (options) {
  39268. Util_Util.extend(this, options);
  39269. }
  39270. this.CLASS_NAME = "SuperMap.GeometryBatchAnalystService";
  39271. }
  39272. /**
  39273. * @function GeometryBatchAnalystService.prototype.processAsync
  39274. * @description 负责将客户端的查询参数传递到服务端。
  39275. * @param {GeometryOverlayAnalystParameter} parameter - 批量几何对象叠加分析参数类
  39276. *
  39277. */
  39278. processAsync(parameters) {
  39279. var me = this;
  39280. me.url = Util_Util.urlPathAppend(me.url, 'geometry/batchanalyst');
  39281. me.url = Util_Util.urlAppend(me.url, 'returnContent=true&ignoreAnalystParam=true');
  39282. var parameterObjects = me._processParams(parameters);
  39283. var jsonParameters = Util_Util.toJSON(parameterObjects);
  39284. me.request({
  39285. method: "POST",
  39286. data: jsonParameters,
  39287. scope: me,
  39288. success: me.serviceProcessCompleted,
  39289. failure: me.serviceProcessFailed
  39290. });
  39291. }
  39292. _processParams(parameters) {
  39293. var me = this;
  39294. if (!Util_Util.isArray(parameters)) {
  39295. return;
  39296. }
  39297. var processParams = [];
  39298. parameters.map(function (item) {
  39299. processParams.push(me._toJSON(item));
  39300. return item;
  39301. });
  39302. return processParams;
  39303. }
  39304. _toJSON(parameter) {
  39305. var tempObj = {};
  39306. if(parameter.analystName ==="buffer"){
  39307. tempObj.analystName = "buffer";
  39308. tempObj.param = {};
  39309. //几何对象的批量空间分析,
  39310. GeometryBufferAnalystParameters.toObject(parameter.param, tempObj.param);
  39311. }else if(parameter.analystName ==="overlay"){
  39312. tempObj.analystName = "overlay";
  39313. tempObj.param = {};
  39314. GeometryOverlayAnalystParameters.toObject(parameter.param, tempObj.param);
  39315. }else if(parameter.analystName ==="interpolationDensity"){
  39316. tempObj.analystName = "interpolationDensity";
  39317. tempObj.param = {};
  39318. InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
  39319. }else if(parameter.analystName ==="interpolationidw"){
  39320. tempObj.analystName = "interpolationidw";
  39321. tempObj.param = {};
  39322. InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
  39323. }else if(parameter.analystName ==="interpolationRBF"){
  39324. tempObj.analystName = "interpolationRBF";
  39325. tempObj.param = {};
  39326. InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
  39327. }else if(parameter.analystName ==="interpolationKriging"){
  39328. tempObj.analystName = "interpolationKriging";
  39329. tempObj.param = {};
  39330. InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
  39331. }else if(parameter.analystName ==="thiessenpolygon"){
  39332. tempObj.analystName = "thiessenpolygon";
  39333. tempObj.param = {};
  39334. GeometryThiessenAnalystParameters.toObject(parameter.param, tempObj.param);
  39335. }else {
  39336. //isoline; isoregion; calculatemeasure; routelocator 四种分析不需要再处理参数
  39337. return parameter;
  39338. }
  39339. return tempObj;
  39340. }
  39341. /**
  39342. * @override
  39343. */
  39344. destroy() {
  39345. super.destroy();
  39346. }
  39347. }
  39348. ;// CONCATENATED MODULE: ./src/common/iServer/SpatialAnalystService.js
  39349. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  39350. * This program are made available under the terms of the Apache License, Version 2.0
  39351. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  39352. /**
  39353. * @class SpatialAnalystService
  39354. * @extends {ServiceBase}
  39355. * @category iServer SpatialAnalyst
  39356. * @classdesc 空间分析服务类。提供:地区太阳辐射、缓冲区分析、点密度分析、动态分段分析、空间关系分析、插值分析、栅格代数运算、叠加分析、路由定位、路由测量计算、表面分析、地形曲率计算、泰森多边形分析。
  39357. * @example
  39358. * new SpatialAnalystService(url).bufferAnalysis(params,function(result){
  39359. * //doSomething
  39360. * })
  39361. * @param {string} url - 服务地址。
  39362. * @param {Object} options - 参数。
  39363. * @param {string} [options.proxy] - 服务代理地址。
  39364. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  39365. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  39366. * @param {Object} [options.headers] - 请求头。
  39367. * @usage
  39368. */
  39369. class SpatialAnalystService_SpatialAnalystService {
  39370. constructor(url, options) {
  39371. this.url = url;
  39372. this.options = options || {};
  39373. }
  39374. /**
  39375. * @function SpatialAnalystService.prototype.getAreaSolarRadiationResult
  39376. * @description 地区太阳辐射。
  39377. * @param {AreaSolarRadiationParameters} params - 地区太阳辐射参数类。
  39378. * @param {RequestCallback} callback 回调函数。
  39379. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  39380. */
  39381. getAreaSolarRadiationResult(params, callback, resultFormat) {
  39382. var me = this;
  39383. var areaSolarRadiationService = new AreaSolarRadiationService(me.url, {
  39384. proxy: me.options.proxy,
  39385. withCredentials: me.options.withCredentials,
  39386. crossOrigin: me.options.crossOrigin,
  39387. headers: me.options.headers,
  39388. eventListeners: {
  39389. scope: me,
  39390. processCompleted: callback,
  39391. processFailed: callback
  39392. },
  39393. format: me._processFormat(resultFormat)
  39394. });
  39395. areaSolarRadiationService.processAsync(params);
  39396. }
  39397. /**
  39398. * @function SpatialAnalystService.prototype.bufferAnalysis
  39399. * @description 缓冲区分析。
  39400. * @param {DatasetBufferAnalystParameters} params - 数据集缓冲区分析参数类。
  39401. * @param {RequestCallback} callback 回调函数。
  39402. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  39403. */
  39404. bufferAnalysis(params, callback, resultFormat) {
  39405. var me = this;
  39406. var bufferAnalystService = new BufferAnalystService(me.url, {
  39407. proxy: me.options.proxy,
  39408. withCredentials: me.options.withCredentials,
  39409. crossOrigin: me.options.crossOrigin,
  39410. headers: me.options.headers,
  39411. eventListeners: {
  39412. scope: me,
  39413. processCompleted: callback,
  39414. processFailed: callback
  39415. },
  39416. format: me._processFormat(resultFormat)
  39417. });
  39418. bufferAnalystService.processAsync(params);
  39419. }
  39420. /**
  39421. * @function SpatialAnalystService.prototype.densityAnalysis
  39422. * @description 点密度分析。
  39423. * @param {DensityKernelAnalystParameters} params - 核密度分析参数类。
  39424. * @param {RequestCallback} callback 回调函数。
  39425. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  39426. */
  39427. densityAnalysis(params, callback, resultFormat) {
  39428. var me = this;
  39429. var densityAnalystService = new DensityAnalystService(me.url, {
  39430. proxy: me.options.proxy,
  39431. withCredentials: me.options.withCredentials,
  39432. crossOrigin: me.options.crossOrigin,
  39433. headers: me.options.headers,
  39434. eventListeners: {
  39435. scope: me,
  39436. processCompleted: callback,
  39437. processFailed: callback
  39438. },
  39439. format: me._processFormat(resultFormat)
  39440. });
  39441. densityAnalystService.processAsync(params);
  39442. }
  39443. /**
  39444. * @function SpatialAnalystService.prototype.generateSpatialData
  39445. * @description 动态分段分析。
  39446. * @param {GenerateSpatialDataParameters} params - 动态分段操作参数类。
  39447. * @param {RequestCallback} callback 回调函数。
  39448. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  39449. */
  39450. generateSpatialData(params, callback, resultFormat) {
  39451. var me = this;
  39452. var generateSpatialDataService = new GenerateSpatialDataService(me.url, {
  39453. proxy: me.options.proxy,
  39454. withCredentials: me.options.withCredentials,
  39455. crossOrigin: me.options.crossOrigin,
  39456. headers: me.options.headers,
  39457. eventListeners: {
  39458. scope: me,
  39459. processCompleted: callback,
  39460. processFailed: callback
  39461. },
  39462. format: me._processFormat(resultFormat)
  39463. });
  39464. generateSpatialDataService.processAsync(params);
  39465. }
  39466. /**
  39467. * @function SpatialAnalystService.prototype.geoRelationAnalysis
  39468. * @description 空间关系分析。
  39469. * @param {GeoRelationAnalystParameters} params - 空间关系分析服务参数类。
  39470. * @param {RequestCallback} callback 回调函数。
  39471. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  39472. */
  39473. geoRelationAnalysis(params, callback, resultFormat) {
  39474. var me = this;
  39475. var geoRelationAnalystService = new GeoRelationAnalystService(me.url, {
  39476. proxy: me.options.proxy,
  39477. withCredentials: me.options.withCredentials,
  39478. crossOrigin: me.options.crossOrigin,
  39479. headers: me.options.headers,
  39480. eventListeners: {
  39481. scope: me,
  39482. processCompleted: callback,
  39483. processFailed: callback
  39484. },
  39485. format: me._processFormat(resultFormat)
  39486. });
  39487. geoRelationAnalystService.processAsync(params);
  39488. }
  39489. /**
  39490. * @function SpatialAnalystService.prototype.interpolationAnalysis
  39491. * @description 插值分析。
  39492. * @param {InterpolationRBFAnalystParameters|InterpolationDensityAnalystParameters|InterpolationIDWAnalystParameters|InterpolationKrigingAnalystParameters} params - 样条插值分析参数类。
  39493. * @param {RequestCallback} callback 回调函数。
  39494. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  39495. */
  39496. interpolationAnalysis(params, callback, resultFormat) {
  39497. var me = this;
  39498. var interpolationAnalystService = new InterpolationAnalystService(me.url, {
  39499. proxy: me.options.proxy,
  39500. withCredentials: me.options.withCredentials,
  39501. crossOrigin: me.options.crossOrigin,
  39502. headers: me.options.headers,
  39503. eventListeners: {
  39504. scope: me,
  39505. processCompleted: callback,
  39506. processFailed: callback
  39507. },
  39508. format: me._processFormat(resultFormat)
  39509. });
  39510. interpolationAnalystService.processAsync(params);
  39511. }
  39512. /**
  39513. * @function SpatialAnalystService.prototype.mathExpressionAnalysis
  39514. * @description 栅格代数运算。
  39515. * @param {MathExpressionAnalysisParameters} params - 栅格代数运算参数类。
  39516. * @param {RequestCallback} callback 回调函数。
  39517. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  39518. */
  39519. mathExpressionAnalysis(params, callback, resultFormat) {
  39520. var me = this;
  39521. var mathExpressionAnalysisService = new MathExpressionAnalysisService(me.url, {
  39522. proxy: me.options.proxy,
  39523. withCredentials: me.options.withCredentials,
  39524. crossOrigin: me.options.crossOrigin,
  39525. headers: me.options.headers,
  39526. eventListeners: {
  39527. scope: me,
  39528. processCompleted: callback,
  39529. processFailed: callback
  39530. },
  39531. format: me._processFormat(resultFormat)
  39532. });
  39533. mathExpressionAnalysisService.processAsync(params);
  39534. }
  39535. /**
  39536. * @function SpatialAnalystService.prototype.overlayAnalysis
  39537. * @description 叠加分析。
  39538. * @param {DatasetOverlayAnalystParameters|GeometryOverlayAnalystParameters} params - 数据集叠加分析参数类或几何对象叠加分析参数类。
  39539. * @param {RequestCallback} callback 回调函数。
  39540. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  39541. */
  39542. overlayAnalysis(params, callback, resultFormat) {
  39543. var me = this;
  39544. var overlayAnalystService = new OverlayAnalystService(me.url, {
  39545. proxy: me.options.proxy,
  39546. withCredentials: me.options.withCredentials,
  39547. crossOrigin: me.options.crossOrigin,
  39548. headers: me.options.headers,
  39549. eventListeners: {
  39550. scope: me,
  39551. processCompleted: callback,
  39552. processFailed: callback
  39553. },
  39554. format: me._processFormat(resultFormat)
  39555. });
  39556. overlayAnalystService.processAsync(params);
  39557. }
  39558. /**
  39559. * @function SpatialAnalystService.prototype.routeCalculateMeasure
  39560. * @description 路由测量计算。
  39561. * @param {RouteCalculateMeasureParameters} params - 基于路由对象计算指定点 M 值操作的参数类。
  39562. * @param {RequestCallback} callback 回调函数。
  39563. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  39564. */
  39565. routeCalculateMeasure(params, callback, resultFormat) {
  39566. var me = this;
  39567. var routeCalculateMeasureService = new RouteCalculateMeasureService(me.url, {
  39568. proxy: me.options.proxy,
  39569. withCredentials: me.options.withCredentials,
  39570. crossOrigin: me.options.crossOrigin,
  39571. headers: me.options.headers,
  39572. eventListeners: {
  39573. scope: me,
  39574. processCompleted: callback,
  39575. processFailed: callback
  39576. },
  39577. format: me._processFormat(resultFormat)
  39578. });
  39579. routeCalculateMeasureService.processAsync(params);
  39580. }
  39581. /**
  39582. * @function SpatialAnalystService.prototype.routeLocate
  39583. * @description 路由定位。
  39584. * @param {RouteLocatorParameters} params - 路由对象定位空间对象的参数类。
  39585. * @param {RequestCallback} callback 回调函数。
  39586. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  39587. */
  39588. routeLocate(params, callback, resultFormat) {
  39589. var me = this;
  39590. var routeLocatorService = new RouteLocatorService(me.url, {
  39591. proxy: me.options.proxy,
  39592. withCredentials: me.options.withCredentials,
  39593. crossOrigin: me.options.crossOrigin,
  39594. headers: me.options.headers,
  39595. eventListeners: {
  39596. scope: me,
  39597. processCompleted: callback,
  39598. processFailed: callback
  39599. },
  39600. format: me._processFormat(resultFormat)
  39601. });
  39602. routeLocatorService.processAsync(params);
  39603. }
  39604. /**
  39605. * @function SpatialAnalystService.prototype.surfaceAnalysis
  39606. * @description 表面分析。
  39607. * @param {SurfaceAnalystParameters} params - 表面分析提取操作参数类。
  39608. * @param {RequestCallback} callback 回调函数。
  39609. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  39610. */
  39611. surfaceAnalysis(params, callback, resultFormat) {
  39612. var me = this;
  39613. var surfaceAnalystService = new SurfaceAnalystService(me.url, {
  39614. proxy: me.options.proxy,
  39615. withCredentials: me.options.withCredentials,
  39616. crossOrigin: me.options.crossOrigin,
  39617. headers: me.options.headers,
  39618. eventListeners: {
  39619. scope: me,
  39620. processCompleted: callback,
  39621. processFailed: callback
  39622. },
  39623. format: me._processFormat(resultFormat)
  39624. });
  39625. surfaceAnalystService.processAsync(params);
  39626. }
  39627. /**
  39628. * @function SpatialAnalystService.prototype.terrainCurvatureCalculate
  39629. * @description 地形曲率计算。
  39630. * @param {TerrainCurvatureCalculationParameters} params - 地形曲率计算参数类。
  39631. * @param {RequestCallback} callback 回调函数。
  39632. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  39633. */
  39634. terrainCurvatureCalculate(params, callback, resultFormat) {
  39635. var me = this;
  39636. var terrainCurvatureCalculationService = new TerrainCurvatureCalculationService(me.url, {
  39637. proxy: me.options.proxy,
  39638. withCredentials: me.options.withCredentials,
  39639. crossOrigin: me.options.crossOrigin,
  39640. headers: me.options.headers,
  39641. eventListeners: {
  39642. scope: me,
  39643. processCompleted: callback,
  39644. processFailed: callback
  39645. },
  39646. format: me._processFormat(resultFormat)
  39647. });
  39648. terrainCurvatureCalculationService.processAsync(params);
  39649. }
  39650. /**
  39651. * @function SpatialAnalystService.prototype.thiessenAnalysis
  39652. * @description 泰森多边形分析。
  39653. * @param {DatasetThiessenAnalystParameters|GeometryThiessenAnalystParameters} params - 数据集泰森多边形分析参数类。
  39654. * @param {RequestCallback} callback 回调函数。
  39655. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  39656. */
  39657. thiessenAnalysis(params, callback, resultFormat) {
  39658. var me = this;
  39659. var thiessenAnalystService = new ThiessenAnalystService(me.url, {
  39660. proxy: me.options.proxy,
  39661. withCredentials: me.options.withCredentials,
  39662. crossOrigin: me.options.crossOrigin,
  39663. headers: me.options.headers,
  39664. eventListeners: {
  39665. scope: me,
  39666. processCompleted: callback,
  39667. processFailed: callback
  39668. },
  39669. format: me._processFormat(resultFormat)
  39670. });
  39671. thiessenAnalystService.processAsync(params);
  39672. }
  39673. /**
  39674. * @function SpatialAnalystService.prototype.geometrybatchAnalysis
  39675. * @description 批量空间分析。
  39676. * @param {Array.<Object>} params - 批量分析参数对象数组。
  39677. * @param {Array.<Object>} params.analystName - 空间分析方法的名称。包括:</br>
  39678. * "buffer","overlay","interpolationDensity","interpolationidw","interpolationRBF","interpolationKriging","isoregion","isoline"。
  39679. * @param {Object} params.param - 空间分析类型对应的请求参数,包括:</br>
  39680. * {@link GeometryBufferAnalystParameters} 缓冲区分析参数类。</br>
  39681. * {@link GeometryOverlayAnalystParameters} 叠加分析参数类。</br>
  39682. * {@link InterpolationAnalystParameters} 插值分析参数类。</br>
  39683. * {@link SurfaceAnalystParameters} 表面分析参数类。</br>
  39684. * @param {RequestCallback} callback - 回调函数。
  39685. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回的结果类型。
  39686. */
  39687. geometrybatchAnalysis(params, callback, resultFormat) {
  39688. var me = this;
  39689. var geometryBatchAnalystService = new GeometryBatchAnalystService(me.url, {
  39690. eventListeners: {
  39691. scope: me,
  39692. processCompleted: callback,
  39693. processFailed: callback
  39694. },
  39695. format: me._processFormat(resultFormat)
  39696. });
  39697. //处理批量分析中各个分类类型的参数:
  39698. var analystParameters = [];
  39699. for (var i = 0; i < params.length; i++) {
  39700. var tempParameter = params[i];
  39701. analystParameters.push({
  39702. analystName: tempParameter.analystName,
  39703. param: tempParameter.param
  39704. })
  39705. }
  39706. geometryBatchAnalystService.processAsync(analystParameters);
  39707. }
  39708. _processFormat(resultFormat) {
  39709. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  39710. }
  39711. }
  39712. ;// CONCATENATED MODULE: ./src/maplibregl/services/SpatialAnalystService.js
  39713. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  39714. * This program are made available under the terms of the Apache License, Version 2.0
  39715. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  39716. /**
  39717. * @class SpatialAnalystService
  39718. * @extends {ServiceBase}
  39719. * @category iServer SpatialAnalyst
  39720. * @version 11.1.0
  39721. * @modulecategory Services
  39722. * @classdesc 空间分析服务类。提供:地区太阳辐射、缓冲区分析、点密度分析、动态分段分析、空间关系分析、插值分析、栅格代数运算、叠加分析、路由定位、路由测量计算、表面分析、地形曲率计算、泰森多边形分析。
  39723. * @example
  39724. * new SpatialAnalystService(url)
  39725. * .bufferAnalysis(params,function(result){
  39726. * //doSomething
  39727. * })
  39728. * @param {string} url - 服务地址。
  39729. * @param {Object} options - 参数。
  39730. * @param {string} [options.proxy] - 服务代理地址。
  39731. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  39732. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  39733. * @param {Object} [options.headers] - 请求头。
  39734. * @usage
  39735. */
  39736. class SpatialAnalystService extends ServiceBase {
  39737. constructor(url, options) {
  39738. super(url, options);
  39739. this._spatialAnalystService = new SpatialAnalystService_SpatialAnalystService(url, options);
  39740. }
  39741. /**
  39742. * @function SpatialAnalystService.prototype.getAreaSolarRadiationResult
  39743. * @description 地区太阳辐射。
  39744. * @param {AreaSolarRadiationParameters} params -查询相关参数类。
  39745. * @param {RequestCallback} callback - 回调函数。
  39746. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  39747. */
  39748. getAreaSolarRadiationResult(params, callback, resultFormat) {
  39749. this._spatialAnalystService.getAreaSolarRadiationResult(params, callback, resultFormat);
  39750. }
  39751. /**
  39752. * @function SpatialAnalystService.prototype.bufferAnalysis
  39753. * @description 缓冲区分析。
  39754. * @param {DatasetBufferAnalystParameters} params - 数据集缓冲区分析参数类。
  39755. * @param {RequestCallback} callback - 回调函数。
  39756. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  39757. */
  39758. bufferAnalysis(params, callback, resultFormat) {
  39759. params = this._processParams(params);
  39760. this._spatialAnalystService.bufferAnalysis(params, callback, resultFormat);
  39761. }
  39762. /**
  39763. * @function SpatialAnalystService.prototype.densityAnalysis
  39764. * @description 点密度分析。
  39765. * @param {DensityKernelAnalystParameters} params - 核密度分析参数类。
  39766. * @param {RequestCallback} callback - 回调函数。
  39767. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  39768. */
  39769. densityAnalysis(params, callback, resultFormat) {
  39770. params = this._processParams(params);
  39771. this._spatialAnalystService.densityAnalysis(params, callback, resultFormat);
  39772. }
  39773. /**
  39774. * @function SpatialAnalystService.prototype.generateSpatialData
  39775. * @description 动态分段分析。
  39776. * @param {GenerateSpatialDataParameters} params - 动态分段操作参数类。
  39777. * @param {RequestCallback} callback - 回调函数。
  39778. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  39779. */
  39780. generateSpatialData(params, callback, resultFormat) {
  39781. this._spatialAnalystService.generateSpatialData(params, callback, resultFormat);
  39782. }
  39783. /**
  39784. * @function SpatialAnalystService.prototype.geoRelationAnalysis
  39785. * @description 空间关系分析。
  39786. * @param {GeoRelationAnalystParameters} params - 空间关系分析服务参数类。
  39787. * @param {RequestCallback} callback - 回调函数。
  39788. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  39789. */
  39790. geoRelationAnalysis(params, callback, resultFormat) {
  39791. params = this._processParams(params);
  39792. this._spatialAnalystService.geoRelationAnalysis(params, callback, resultFormat);
  39793. }
  39794. /**
  39795. * @function SpatialAnalystService.prototype.interpolationAnalysis
  39796. * @description 插值分析。
  39797. * @param {InterpolationDensityAnalystParameters|InterpolationIDWAnalystParameters|InterpolationRBFAnalystParameters|InterpolationKrigingAnalystParameters} params - 样条插值(径向基函数插值法)分析参数类。
  39798. * @param {RequestCallback} callback - 回调函数。
  39799. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  39800. */
  39801. interpolationAnalysis(params, callback, resultFormat) {
  39802. params = this._processParams(params);
  39803. this._spatialAnalystService.interpolationAnalysis(params, callback, resultFormat);
  39804. }
  39805. /**
  39806. * @function SpatialAnalystService.prototype.mathExpressionAnalysis
  39807. * @description 栅格代数运算。
  39808. * @param {MathExpressionAnalysisParameters} params - 栅格代数运算参数类。
  39809. * @param {RequestCallback} callback - 回调函数。
  39810. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  39811. */
  39812. mathExpressionAnalysis(params, callback, resultFormat) {
  39813. params = this._processParams(params);
  39814. this._spatialAnalystService.mathExpressionAnalysis(params, callback, resultFormat);
  39815. }
  39816. /**
  39817. * @function SpatialAnalystService.prototype.overlayAnalysis
  39818. * @description 叠加分析。
  39819. * @param {DatasetOverlayAnalystParameters|GeometryOverlayAnalystParameters} params - 数据集叠加分析参数类或者几何对象叠加分析参数类。
  39820. * @param {RequestCallback} callback - 回调函数。
  39821. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  39822. */
  39823. overlayAnalysis(params, callback, resultFormat) {
  39824. params = this._processParams(params);
  39825. this._spatialAnalystService.overlayAnalysis(params, callback, resultFormat);
  39826. }
  39827. /**
  39828. * @function SpatialAnalystService.prototype.routeCalculateMeasure
  39829. * @description 路由测量计算。
  39830. * @param {RouteCalculateMeasureParameters} params - 基于路由对象计算指定点 M 值操作的参数类。
  39831. * @param {RequestCallback} callback - 回调函数。
  39832. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  39833. */
  39834. routeCalculateMeasure(params, callback, resultFormat) {
  39835. params = this._processParams(params);
  39836. this._spatialAnalystService.routeCalculateMeasure(params, callback, resultFormat);
  39837. }
  39838. /**
  39839. * @function SpatialAnalystService.prototype.routeLocate
  39840. * @description 路由定位。
  39841. * @param {RouteLocatorParameters} params - 路由对象定位空间对象的参数类。
  39842. * @param {RequestCallback} callback - 回调函数。
  39843. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  39844. */
  39845. routeLocate(params, callback, resultFormat) {
  39846. params = this._processParams(params);
  39847. this._spatialAnalystService.routeLocate(params, callback, resultFormat);
  39848. }
  39849. /**
  39850. * @function SpatialAnalystService.prototype.surfaceAnalysis
  39851. * @description 表面分析。
  39852. * @param {SurfaceAnalystParameters} params - 表面分析提取操作参数类。
  39853. * @param {RequestCallback} callback - 回调函数。
  39854. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  39855. */
  39856. surfaceAnalysis(params, callback, resultFormat) {
  39857. params = this._processParams(params);
  39858. this._spatialAnalystService.surfaceAnalysis(params, callback, resultFormat);
  39859. }
  39860. /**
  39861. * @function SpatialAnalystService.prototype.terrainCurvatureCalculate
  39862. * @description 地形曲率计算。
  39863. * @param {TerrainCurvatureCalculationParameters} params - 地形曲率计算参数类。
  39864. * @param {RequestCallback} callback - 回调函数。
  39865. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  39866. */
  39867. terrainCurvatureCalculate(params, callback, resultFormat) {
  39868. this._spatialAnalystService.terrainCurvatureCalculate(params, callback, resultFormat);
  39869. }
  39870. /**
  39871. * @function SpatialAnalystService.prototype.thiessenAnalysis
  39872. * @description 泰森多边形分析。
  39873. * @param {DatasetThiessenAnalystParameters|GeometryThiessenAnalystParameters} params - 数据集泰森多边形分析参数类。
  39874. * @param {RequestCallback} callback - 回调函数。
  39875. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  39876. */
  39877. thiessenAnalysis(params, callback, resultFormat) {
  39878. params = this._processParams(params);
  39879. this._spatialAnalystService.thiessenAnalysis(params, callback, resultFormat);
  39880. }
  39881. /**
  39882. * @function SpatialAnalystService.prototype.geometrybatchAnalysis
  39883. * @description 批量空间分析。
  39884. * @param {Array.<Object>} params - 批量分析参数对象数组,包括:
  39885. * @param {string} params.analystName - 空间分析方法的名称。包括:</br>
  39886. * "buffer","overlay","interpolationDensity","interpolationidw","interpolationRBF","interpolationKriging","isoregion","isoline"。
  39887. * @param {Object} params.param - 空间分析类型对应的请求参数,包括:</br>
  39888. * {@link GeometryBufferAnalystParameters} 缓冲区分析参数类。</br>
  39889. * {@link GeometryOverlayAnalystParameters} 叠加分析参数类。</br>
  39890. * {@link InterpolationAnalystParameters} 插值分析参数类。</br>
  39891. * {@link SurfaceAnalystParameters} 表面分析参数类。</br>
  39892. * @param {RequestCallback} callback - 回调函数。
  39893. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 返回结果类型。
  39894. */
  39895. geometrybatchAnalysis(params, callback, resultFormat) {
  39896. for (var i = 0; i < params.length; i++) {
  39897. params[i].param = this._processParams(params[i].param)
  39898. }
  39899. this._spatialAnalystService.geometrybatchAnalysis(params, callback, resultFormat);
  39900. }
  39901. _processParams(params) {
  39902. if (!params) {
  39903. return {};
  39904. }
  39905. if (params.bounds) {
  39906. params.bounds = core_Util_Util.toSuperMapBounds(params.bounds);
  39907. }
  39908. //插值分析点数组转换
  39909. if (params.inputPoints) {
  39910. for (var i = 0; i < params.inputPoints.length; i++) {
  39911. var inputPoint = params.inputPoints[i];
  39912. if (core_Util_Util.isArray(inputPoint)) {
  39913. params.inputPoints[i] = {x: inputPoint[0], y: inputPoint[1], tag: inputPoint[2]};
  39914. }
  39915. }
  39916. }
  39917. //点数组转换
  39918. if (params.points) {
  39919. for (let i = 0; i < params.points.length; i++) {
  39920. var point = params.points[i];
  39921. params.points[i] = core_Util_Util.toSuperMapPoint(point);
  39922. }
  39923. }
  39924. //maplibregl点对象转SuperMap点对象
  39925. if (params.point) {
  39926. params.point = core_Util_Util.toSuperMapPoint(params.point);
  39927. }
  39928. //初步判断maplibre数据就为geojson格式 ,进行转json格式即可
  39929. //栅格代数运算的范围
  39930. if (params.extractRegion) {
  39931. params.extractRegion = core_Util_Util.toSuperMapGeometry(params.extractRegion);
  39932. }
  39933. //获取或设置表面分析参数
  39934. if (params.extractParameter && params.extractParameter.clipRegion) {
  39935. params.extractParameter.clipRegion = core_Util_Util.toSuperMapGeometry(params.extractParameter.clipRegion);
  39936. }
  39937. if (params.clipParam && params.clipParam.clipRegion) {
  39938. params.clipParam.clipRegion = core_Util_Util.toSuperMapGeometry(params.clipParam.clipRegion);
  39939. }
  39940. //sourceRoute 路由对象。用于里程分析,该对象可以是用户自己生 成或在数据源中查询得到的符合标准的路由对象;geojson格式
  39941. if (params.sourceRoute) {
  39942. if (params.sourceRoute) {
  39943. var target = {};
  39944. target.type = "LINEM";
  39945. target.parts = [params.sourceRoute.geometry.coordinates.length];
  39946. target.points = [];
  39947. for (let i = 0; i < params.sourceRoute.geometry.coordinates.length; i++) {
  39948. var lnglat = params.sourceRoute.geometry.coordinates[i];
  39949. //measure 应该在传值时设置,
  39950. target.points = target.points.concat({x: lnglat[0], y: lnglat[1], measure: lnglat[2]})
  39951. }
  39952. params.sourceRoute = target;
  39953. }
  39954. }
  39955. //operateRegions 操作面对象集合,数据集叠加分析,表示与这些面对象进行叠加分析
  39956. if (params.operateRegions && core_Util_Util.isArray(params.operateRegions)) {
  39957. params.operateRegions.map(function (geometry, key) {
  39958. params.operateRegions[key] = core_Util_Util.toSuperMapGeometry(geometry);
  39959. return params.operateRegions[key];
  39960. });
  39961. }
  39962. //叠加分析,几何数据源 支持格式:GeoJson
  39963. if (params.sourceGeometry) {
  39964. var SRID = null;
  39965. if (params.sourceGeometrySRID) {
  39966. SRID = params.sourceGeometrySRID;
  39967. }
  39968. params.sourceGeometry = core_Util_Util.toSuperMapGeometry(params.sourceGeometry);
  39969. if (SRID) {
  39970. params.sourceGeometry.SRID = SRID;
  39971. }
  39972. delete params.sourceGeometry.sourceGeometrySRID;
  39973. }
  39974. if (params.operateGeometry) {
  39975. params.operateGeometry = core_Util_Util.toSuperMapGeometry(params.operateGeometry);
  39976. }
  39977. //支持传入多个几何要素进行叠加分析:
  39978. if (params.sourceGeometries) {
  39979. var sourceGeometries = [];
  39980. for (var k = 0; k < params.sourceGeometries.length; k++) {
  39981. sourceGeometries.push(core_Util_Util.toSuperMapGeometry(params.sourceGeometries[k]));
  39982. }
  39983. params.sourceGeometries = sourceGeometries;
  39984. }
  39985. //支持传入多个几何要素进行叠加分析:
  39986. if (params.operateGeometries) {
  39987. var operateGeometries = [];
  39988. for (var j = 0; j < params.operateGeometries.length; j++) {
  39989. operateGeometries.push(core_Util_Util.toSuperMapGeometry(params.operateGeometries[j]));
  39990. }
  39991. params.operateGeometries = operateGeometries;
  39992. }
  39993. //components 几何对象数组 Route
  39994. if (params.sourceRoute && params.sourceRoute.components && core_Util_Util.isArray(params.sourceRoute.components)) {
  39995. params.sourceRoute.components.map(function (geometry, key) {
  39996. params.sourceRoute.components[key] = core_Util_Util.toSuperMapGeometry(geometry);
  39997. return params.sourceRoute.components[key];
  39998. });
  39999. }
  40000. return params;
  40001. }
  40002. _processFormat(resultFormat) {
  40003. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  40004. }
  40005. }
  40006. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeParameters.js
  40007. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  40008. * This program are made available under the terms of the Apache License, Version 2.0
  40009. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40010. /**
  40011. * @class ThemeParameters
  40012. * @deprecatedclass SuperMap.ThemeParameters
  40013. * @category iServer Map Theme
  40014. * @classdesc 专题图参数类。
  40015. * 该类存储了制作专题所需的参数,包括数据源、数据集名称和专题图对象。
  40016. * @param {Object} options - 参数。
  40017. * @param {Array.<string>} options.datasetNames - 数据集数组。
  40018. * @param {Array.<string>} options.dataSourceNames - 数据源数组。
  40019. * @param {Array.<JoinItem>} [options.joinItems] - 专题图外部表的连接信息 JoinItem 数组。
  40020. * @param {Array.<CommonTheme>} options.themes - 专题图对象列表。
  40021. * @param {Array.<string>} [options.displayFilters] - 专题图属性过滤条件。
  40022. * @param {Array.<string>} [options.displayOrderBys] - 专题图对象生成符号叠加次序排序字段。
  40023. * @param {Object} [options.fieldValuesDisplayFilter] - 图层要素的显示和隐藏的过滤属性,其带有三个属性,分别是:values、fieldName、fieldValuesDisplayMode。
  40024. * @usage
  40025. */
  40026. class ThemeParameters {
  40027. constructor(options) {
  40028. /**
  40029. * @member {Array.<string>} ThemeParameters.prototype.datasetNames
  40030. * @description 要制作专题图的数据集数组。
  40031. */
  40032. this.datasetNames = null;
  40033. /**
  40034. * @member {Array.<string>} ThemeParameters.prototype.dataSourceNames
  40035. * @description 要制作专题图的数据集所在的数据源数组。
  40036. */
  40037. this.dataSourceNames = null;
  40038. /**
  40039. * @member {Array.<JoinItem>} [ThemeParameters.prototype.joinItems]
  40040. * @description 设置与外部表的连接信息 JoinItem 数组。
  40041. * 使用此属性可以制作与外部表连接的专题图。
  40042. */
  40043. this.joinItems = null;
  40044. /**
  40045. * @member {Array.<CommonTheme>} ThemeParameters.prototype.themes
  40046. * @description 专题图对象列表。
  40047. * 该参数为实例化的各类专题图对象的集合。
  40048. */
  40049. this.themes = null;
  40050. /**
  40051. * @member {Array.<string>} [ThemeParameters.prototype.displayFilters]
  40052. * @description 专题图属性过滤条件。
  40053. */
  40054. this.displayFilters = null;
  40055. /**
  40056. * @member {Array.<string>} [ThemeParameters.prototype.displayOrderBys]
  40057. * @description 专题图对象生成符号叠加次序排序字段。
  40058. */
  40059. this.displayOrderBys = null;
  40060. /**
  40061. * @member {Object} [ThemeParameters.prototype.fieldValuesDisplayFilter]
  40062. * @property {Array.<number>} values - 待过滤的值。
  40063. * @property {string} fieldName - 待过滤的字段名称只支持数字类型的字段。
  40064. * @property {string} fieldValuesDisplayMode - 目前为 DISPLAY/DISABLE。当为 DISPLAY 时,表示只显示以上设置的相应属性值的要素,否则表示不显示以上设置的相应属性值的要素。
  40065. */
  40066. this.fieldValuesDisplayFilter = null;
  40067. if (options) {
  40068. Util_Util.extend(this, options);
  40069. }
  40070. this.CLASS_NAME = "SuperMap.ThemeParameters";
  40071. }
  40072. /**
  40073. * @function ThemeParameters.prototype.destroy
  40074. * @description 释放资源,将引用资源的属性置空。
  40075. */
  40076. destroy() {
  40077. var me = this;
  40078. me.datasetNames = null;
  40079. me.dataSourceNames = null;
  40080. if (me.joinItems) {
  40081. for (let i = 0, joinItems = me.joinItems, len = joinItems.length; i < len; i++) {
  40082. joinItems[i].destroy();
  40083. }
  40084. me.joinItems = null;
  40085. }
  40086. if (me.themes) {
  40087. for (let i = 0, themes = me.themes, len = themes.length; i < len; i++) {
  40088. themes[i].destroy();
  40089. }
  40090. me.themes = null;
  40091. }
  40092. }
  40093. }
  40094. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeService.js
  40095. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  40096. * This program are made available under the terms of the Apache License, Version 2.0
  40097. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40098. /**
  40099. * @class ThemeService
  40100. * @deprecatedclass SuperMap.ThemeService
  40101. * @category iServer Map Theme
  40102. * @classdesc 专题图服务类。
  40103. * @extends {CommonServiceBase}
  40104. * @example
  40105. * var myThemeService = new ThemeService(url, {
  40106. * eventListeners: {
  40107. * "processCompleted": themeCompleted,
  40108. * "processFailed": themeFailed
  40109. * }
  40110. * });
  40111. * @param {string} url - 服务地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 。
  40112. * @param {Object} options - 参数。
  40113. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  40114. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  40115. * @param {Object} [options.headers] - 请求头。
  40116. * @usage
  40117. */
  40118. class ThemeService_ThemeService extends CommonServiceBase {
  40119. constructor(url, options) {
  40120. super(url, options);
  40121. if (options) {
  40122. Util_Util.extend(this, options);
  40123. }
  40124. this.eventCount = 0;
  40125. this.url = Util_Util.urlPathAppend(this.url, 'tempLayersSet');
  40126. this.CLASS_NAME = 'SuperMap.ThemeService';
  40127. }
  40128. /**
  40129. * @override
  40130. */
  40131. destroy() {
  40132. super.destroy();
  40133. }
  40134. /**
  40135. * @function ThemeService.prototype.processAsync
  40136. * @description 负责将客户端的专题图参数传递到服务端。
  40137. * @param {ThemeParameters} params - 专题图参数类。
  40138. */
  40139. processAsync(params, callback) {
  40140. if (!(params instanceof ThemeParameters)) {
  40141. return;
  40142. }
  40143. var me = this,
  40144. jsonParameters = null;
  40145. jsonParameters = me.getJsonParameters(params);
  40146. let eventId = ++this.eventCount;
  40147. let eventListeners = {
  40148. scope: this,
  40149. processCompleted: function(result) {
  40150. if (eventId === result.result.eventId && callback) {
  40151. delete result.result.eventId;
  40152. callback(result);
  40153. this.events && this.events.un(eventListeners);
  40154. return false;
  40155. }
  40156. },
  40157. processFailed: function(result) {
  40158. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  40159. callback(result);
  40160. this.events && this.events.un(eventListeners);
  40161. return false;
  40162. }
  40163. }
  40164. }
  40165. this.events.on(eventListeners);
  40166. me.request({
  40167. method: "POST",
  40168. data: jsonParameters,
  40169. scope: me,
  40170. success(result, options) {
  40171. result.eventId = eventId;
  40172. this.serviceProcessCompleted(result, options);
  40173. },
  40174. failure(result, options) {
  40175. if (result.error) {
  40176. result.error.eventId = eventId;
  40177. }
  40178. result.eventId = eventId;
  40179. this.serviceProcessFailed(result, options);
  40180. }
  40181. });
  40182. }
  40183. /**
  40184. * @function ThemeService.prototype.getJsonParameters
  40185. * @description 将专题图参数参数转化为 JSON 字符串。
  40186. * @param {ThemeParameters} parameter - 专题图参数类。
  40187. * @returns {Object} 转化后的JSON字符串。
  40188. */
  40189. getJsonParameters(parameter) {
  40190. var jsonParameters = "",
  40191. themeObj = null,
  40192. filters = null,
  40193. orderBys = null,
  40194. fieldValuesDisplayFilter;
  40195. jsonParameters += "[{'type': 'UGC','subLayers': {'layers': [";
  40196. for (var i = 0; i < parameter.themes.length; i++) {
  40197. themeObj = parameter.themes[i];
  40198. var jsonTheme = Util_Util.toJSON(themeObj);
  40199. jsonTheme = jsonTheme.slice(0, -1);
  40200. jsonParameters += "{'theme': " + jsonTheme + "},'type': 'UGC','ugcLayerType': 'THEME',";
  40201. filters = parameter.displayFilters;
  40202. if (filters && filters.length > 0) {
  40203. if (filters.length === 1) {
  40204. jsonParameters += "'displayFilter':\"" + filters[0] + "\",";
  40205. } else {
  40206. jsonParameters += "'displayFilter':\"" + filters[i] + "\",";
  40207. }
  40208. }
  40209. orderBys = parameter.displayOrderBy;
  40210. if (orderBys && orderBys.length > 0) {
  40211. if (orderBys.length === 1) {
  40212. jsonParameters += "'displayOrderBy':'" + orderBys[0] + "',";
  40213. } else {
  40214. jsonParameters += "'displayOrderBy':'" + orderBys[i] + "',";
  40215. }
  40216. }
  40217. fieldValuesDisplayFilter = parameter.fieldValuesDisplayFilter;
  40218. if (fieldValuesDisplayFilter) {
  40219. jsonParameters += "'fieldValuesDisplayFilter':" + Util_Util.toJSON(fieldValuesDisplayFilter) + ",";
  40220. }
  40221. if (parameter.joinItems && parameter.joinItems.length > 0 && parameter.joinItems[i]) {
  40222. jsonParameters += "'joinItems':[" + Util_Util.toJSON(parameter.joinItems[i]) + "],";
  40223. }
  40224. if (parameter.datasetNames && parameter.dataSourceNames) {
  40225. var datasetID = parameter.datasetNames[i] ? i : (parameter.datasetNames.length - 1);
  40226. var dataSourceID = parameter.dataSourceNames[i] ? i : (parameter.dataSourceNames.length - 1);
  40227. jsonParameters += "'datasetInfo': {'name': '" + parameter.datasetNames[datasetID] +
  40228. "','dataSourceName': '" + parameter.dataSourceNames[dataSourceID] + "'}},";
  40229. } else {
  40230. jsonParameters += "},";
  40231. }
  40232. }
  40233. //去除多余的逗号
  40234. if (parameter.themes && parameter.themes.length > 0) {
  40235. jsonParameters = jsonParameters.substring(0, jsonParameters.length - 1);
  40236. }
  40237. jsonParameters += "]},";
  40238. var urlArray = this.url.split("/");
  40239. var jsonMapName = urlArray[urlArray.length - 2];
  40240. jsonParameters += "'name': '" + jsonMapName + "'}]";
  40241. return jsonParameters;
  40242. }
  40243. }
  40244. ;// CONCATENATED MODULE: ./src/maplibregl/services/ThemeService.js
  40245. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  40246. * This program are made available under the terms of the Apache License, Version 2.0
  40247. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40248. /**
  40249. * @class ThemeService
  40250. * @category iServer Map Theme
  40251. * @classdesc 专题图服务类。
  40252. * @version 11.1.0
  40253. * @extends {ServiceBase}
  40254. * @example
  40255. * new ThemeService(url,{
  40256. * projection:projection
  40257. * }).getThemeInfo(params,function(result){
  40258. * //doSomething
  40259. * });
  40260. * @param {string} url - 服务地址。
  40261. * @param {Object} options - 参数。
  40262. * @param {string} [options.proxy] - 服务代理地址。
  40263. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  40264. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  40265. * @param {Object} [options.headers] - 请求头。
  40266. * @usage
  40267. */
  40268. class ThemeService extends ServiceBase {
  40269. constructor(url, options) {
  40270. super(url, options);
  40271. this._commonThemeService = new ThemeService_ThemeService(url, options);
  40272. }
  40273. /**
  40274. * @function ThemeService.prototype.getThemeInfo
  40275. * @description 获取专题图信息。
  40276. * @param {ThemeParameters} params - 专题图参数类。
  40277. * @param {RequestCallback} callback - 回调函数。
  40278. */
  40279. getThemeInfo(params, callback) {
  40280. this._commonThemeService.processAsync(params, callback);
  40281. }
  40282. }
  40283. ;// CONCATENATED MODULE: ./src/common/iServer/StopQueryParameters.js
  40284. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  40285. * This program are made available under the terms of the Apache License, Version 2.0
  40286. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40287. /**
  40288. * @class StopQueryParameters
  40289. * @deprecatedclass SuperMap.StopQueryParameters
  40290. * @category iServer TrafficTransferAnalyst TransferStops
  40291. * @classdesc 站点查询参数类。
  40292. * @param {Object} options - 参数。
  40293. * @param {string} options.keyWord - 站点名称关键字。
  40294. * @param {boolean} [options.returnPosition=false] - 是否返回站点坐标信息。
  40295. * @usage
  40296. */
  40297. class StopQueryParameters {
  40298. constructor(options) {
  40299. options = options || {};
  40300. /**
  40301. * @member {string} StopQueryParameters.prototype.keyWord
  40302. * @description 站点名称关键字。
  40303. */
  40304. this.keyWord = null;
  40305. /**
  40306. * @member {boolean} [StopQueryParameters.prototype.returnPosition=false]
  40307. * @description 是否返回站点坐标信息。
  40308. */
  40309. this.returnPosition = false;
  40310. Util_Util.extend(this, options);
  40311. this.CLASS_NAME = "SuperMap.StopQueryParameters";
  40312. }
  40313. /**
  40314. * @function StopQueryParameters.prototype.destroy
  40315. * @description 释放资源,将引用资源的属性置空。
  40316. */
  40317. destroy() {
  40318. Util_Util.reset(this);
  40319. }
  40320. }
  40321. ;// CONCATENATED MODULE: ./src/common/iServer/StopQueryService.js
  40322. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  40323. * This program are made available under the terms of the Apache License, Version 2.0
  40324. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40325. /**
  40326. * @class StopQueryService
  40327. * @deprecatedclass SuperMap.StopQueryService
  40328. * @category iServer TrafficTransferAnalyst TransferStops
  40329. * @classdesc 站点查询服务类。
  40330. * 返回结果通过该类支持的事件的监听函数参数获取
  40331. * @extends {CommonServiceBase}
  40332. * @param {string} url - 服务地址。
  40333. * 例如:</br>"http://localhost:8090/iserver/services/traffictransferanalyst-sample/restjsr/traffictransferanalyst/Traffic-Changchun"。
  40334. * @param {Object} options - 参数。
  40335. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  40336. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  40337. * @param {Object} [options.headers] - 请求头。
  40338. * @example 例如:
  40339. * (start code)
  40340. * var myService = new StopQueryService(url, {eventListeners: {
  40341. * "processCompleted": StopQueryCompleted,
  40342. * "processFailed": StopQueryError
  40343. * }
  40344. * };
  40345. * (end)
  40346. * @usage
  40347. *
  40348. */
  40349. class StopQueryService extends CommonServiceBase {
  40350. constructor(url, options) {
  40351. super(url, options);
  40352. options = options || {};
  40353. Util_Util.extend(this, options);
  40354. this.CLASS_NAME = "SuperMap.StopQueryService";
  40355. }
  40356. /**
  40357. *@override
  40358. */
  40359. destroy() {
  40360. super.destroy();
  40361. Util_Util.reset(this);
  40362. }
  40363. /**
  40364. * @function StopQueryService.prototype.processAsync
  40365. * @description 负责将客户端的更新参数传递到服务端。
  40366. * @param {StopQueryParameters} params - 交通换乘参数。
  40367. */
  40368. processAsync(params) {
  40369. if (!(params instanceof StopQueryParameters)) {
  40370. return;
  40371. }
  40372. var me = this;
  40373. me.url = Util_Util.urlPathAppend(me.url, 'stops/keyword/' + params.keyWord);
  40374. me.request({
  40375. method: "GET",
  40376. params: {returnPosition: params.returnPosition},
  40377. scope: me,
  40378. success: me.serviceProcessCompleted,
  40379. failure: me.serviceProcessFailed
  40380. });
  40381. }
  40382. }
  40383. ;// CONCATENATED MODULE: ./src/common/iServer/TransferPathParameters.js
  40384. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  40385. * This program are made available under the terms of the Apache License, Version 2.0
  40386. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40387. /**
  40388. * @class TransferPathParameters
  40389. * @deprecatedclass SuperMap.TransferPathParameters
  40390. * @category iServer TrafficTransferAnalyst TransferPath
  40391. * @classdesc 交通换乘线路查询参数类。
  40392. * @param {Object} options - 参数。
  40393. * @param {Array.<TransferLine>} options.transferLines - 本换乘分段内可乘车的路线集合。
  40394. * @param {Array.<GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|Array.<number>|number>} options.points - 两种查询方式:按照公交站点的起止 ID 进行查询和按照起止点的坐标进行查询。
  40395. * @usage
  40396. */
  40397. class TransferPathParameters {
  40398. constructor(options) {
  40399. options = options || {};
  40400. /**
  40401. * @member {Array.<TransferLine>} TransferPathParameters.prototype.transferLines
  40402. * @description 本换乘分段内可乘车的路线集合,通过交通换乘方案查询得到。
  40403. */
  40404. this.transferLines = null;
  40405. /**
  40406. * @member {Array.<GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|Array.<number>|number>} TransferPathParameters.prototype.points
  40407. * @description 两种查询方式:<br>
  40408. * 1. 按照公交站点的起止ID进行查询,则 points 参数的类型为 int[],形如:[起点ID、终点ID],公交站点的 ID 对应服务提供者配置中的站点 ID 字段;
  40409. * 2. 按照起止点的坐标进行查询,则 points 参数的类型为 Point2D[],形如:[{"x":44,"y":39},{"x":45,"y":40}]。
  40410. */
  40411. this.points = null;
  40412. Util_Util.extend(this, options);
  40413. this.CLASS_NAME = "SuperMap.TransferPathParameters";
  40414. }
  40415. /**
  40416. * @function TransferPathParameters.prototype.destroy
  40417. * @description 释放资源,将引用资源的属性置空。
  40418. */
  40419. destroy() {
  40420. Util_Util.reset(this);
  40421. }
  40422. /**
  40423. * @function TransferPathParameters.toJson
  40424. * @description 将 {@link TransferPathParameters} 对象参数转换为 JSON 字符串。
  40425. * @param {TransferPathParameters} params - 交通换乘参数。
  40426. * @returns {string} 转化后的 JSON 字符串。
  40427. */
  40428. static toJson(params) {
  40429. if (params) {
  40430. return Util_Util.toJSON(params);
  40431. }
  40432. }
  40433. }
  40434. ;// CONCATENATED MODULE: ./src/common/iServer/TransferPathService.js
  40435. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  40436. * This program are made available under the terms of the Apache License, Version 2.0
  40437. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40438. /**
  40439. * @class TransferPathService
  40440. * @deprecatedclass SuperMap.TransferPathService
  40441. * @category iServer TrafficTransferAnalyst TransferPath
  40442. * @classdesc 交通换乘线路查询服务类,根据交通换乘分析结果(TransferSolutionResult),获取某一条乘车路线的详细信息。
  40443. * 返回结果通过该类支持的事件的监听函数参数获取
  40444. * @extends {CommonServiceBase}
  40445. * @example 例如:
  40446. * var myService = new TransferPathService(url, {eventListeners: {
  40447. * "processCompleted": TrafficTransferCompleted,
  40448. * "processFailed": TrafficTransferError
  40449. * }
  40450. * };
  40451. * @param {string} url - 服务地址。
  40452. * 例如:</br>"http://localhost:8090/iserver/services/traffictransferanalyst-sample/restjsr/traffictransferanalyst/Traffic-Changchun"。
  40453. * @param {Object} options - 参数。
  40454. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  40455. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  40456. * @param {Object} [options.headers] - 请求头。
  40457. * @usage
  40458. */
  40459. class TransferPathService extends CommonServiceBase {
  40460. constructor(url, options) {
  40461. super(url, options);
  40462. this.CLASS_NAME = "SuperMap.TransferPathService";
  40463. }
  40464. /**
  40465. * @override
  40466. */
  40467. destroy() {
  40468. super.destroy();
  40469. }
  40470. /**
  40471. * @function TransferPathService.prototype.processAsync
  40472. * @description 负责将客户端的更新参数传递到服务端。
  40473. * @param {TransferPathParameters} params - 交通换乘参数。
  40474. */
  40475. processAsync(params) {
  40476. if (!(params instanceof TransferPathParameters)) {
  40477. return;
  40478. }
  40479. var me = this,
  40480. method = "GET",
  40481. jsonParameters;
  40482. me.url = Util_Util.urlPathAppend(me.url, 'path');
  40483. jsonParameters = {
  40484. points: Util_Util.toJSON(params.points),
  40485. transferLines: Util_Util.toJSON(params['transferLines'])
  40486. };
  40487. me.request({
  40488. method: method,
  40489. params: jsonParameters,
  40490. scope: me,
  40491. success: me.serviceProcessCompleted,
  40492. failure: me.serviceProcessFailed
  40493. });
  40494. }
  40495. }
  40496. ;// CONCATENATED MODULE: ./src/common/iServer/TransferSolutionParameters.js
  40497. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  40498. * This program are made available under the terms of the Apache License, Version 2.0
  40499. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40500. /**
  40501. * @class TransferSolutionParameters
  40502. * @deprecatedclass SuperMap.TransferSolutionParameters
  40503. * @category iServer TrafficTransferAnalyst TransferSolutions
  40504. * @classdesc 交通换乘方案查询参数类。
  40505. * @param {Object} options - 参数。
  40506. * @param {Array.<GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|Array.<number>|number>} options.points - 两种查询方式:按照公交站点的起止ID进行查询和按照起止点的坐标进行查询。
  40507. * @param {number} [options.solutionCount=6] - 乘车方案的数量。
  40508. * @param {TransferTactic} [options.transferTactic=TransferTactic.LESS_TIME] - 交通换乘策略类型,包括时间最短、距离最短、最少换乘、最少步行四种选择。
  40509. * @param {TransferPreference} [options.transferPreference=TransferPreference.NONE] - 乘车偏好枚举。
  40510. * @param {number} [options.walkingRatio=10] - 步行与公交的消耗权重比。
  40511. * @param {Array.<number>} [options.evadeLines] - 避让路线的 ID。
  40512. * @param {Array.<number>} [options.evadeStops] - 避让站点的 ID。
  40513. * @param {Array.<number>} [options.priorLines] - 优先路线的 ID。
  40514. * @param {Array.<number>} [options.priorStops] - 优先站点的 ID。
  40515. * @param {string} [options.travelTime] - 出行的时间。
  40516. * @usage
  40517. */
  40518. class TransferSolutionParameters {
  40519. constructor(options) {
  40520. options = options || {};
  40521. /**
  40522. * @member {number} [TransferSolutionParameters.prototype.solutionCount=6]
  40523. * @description 乘车方案的数量。
  40524. */
  40525. this.solutionCount = 6;
  40526. /**
  40527. * @member {TransferPreference} [TransferSolutionParameters.prototype.transferPreference=TransferPreference.NONE]
  40528. * @description 乘车偏好枚举。
  40529. */
  40530. this.transferPreference = TransferPreference.NONE;
  40531. /**
  40532. * @member {TransferTactic} [TransferSolutionParameters.prototype.transferTactic=TransferTactic|TransferTactic.LESS_TIME]
  40533. * @description 交通换乘策略类型,包括时间最短、距离最短、最少换乘、最少步行四种选择。
  40534. */
  40535. this.transferTactic = TransferTactic.LESS_TIME;
  40536. /**
  40537. * @member {number} [TransferSolutionParameters.prototype.walkingRatio=10]
  40538. * @description 步行与公交的消耗权重比。此值越大,则步行因素对于方案选择的影响越大。例如:</br>
  40539. * 例如现在有两种换乘方案(在仅考虑消耗因素的情况下):</br>
  40540. * 方案1:坐车 10 公里,走路 1 公里;</br>
  40541. * 方案2:坐车 15 公里,走路 0.5 公里;</br>
  40542. * 1. 假设权重比为 15:</br>
  40543. * •方案 1 的总消耗为:10 + 1*15 = 25</br>
  40544. * •方案 2 的总消耗为:15 + 0.5*15 = 22.5</br>
  40545. * 此时方案 2 消耗更低。</br>
  40546. * 2. 假设权重比为2:</br>
  40547. * •方案 1 的总消耗为:10+1*2 = 12</br>
  40548. * •方案 2 的总消耗为:15+0.5*2 = 17</br>
  40549. * 此时方案 1 消耗更低。</br>
  40550. */
  40551. this.walkingRatio = null;
  40552. /**
  40553. * @member {Array.<GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|Array.<number>|number>} TransferSolutionParameters.prototype.points
  40554. * @description 两种查询方式:</br>
  40555. * 1. 按照公交站点的起止 ID 进行查询,则 points 参数的类型为 int[],形如:[起点 ID、终点 ID],公交站点的 ID 对应服务提供者配置中的站点 ID 字段;
  40556. * 2. 按照起止点的坐标进行查询,则 points 参数的类型为 Point2D[],形如:[{"x":44,"y":39},{"x":45,"y":40}]。
  40557. */
  40558. this.points = false;
  40559. /**
  40560. * @member {Array.<number>} [TransferSolutionParameters.prototype.evadeLinesnull]
  40561. * @description 避让路线 ID。
  40562. * */
  40563. this.evadeLines = null;
  40564. /**
  40565. * @member {Array.<number>} [TransferSolutionParameters.prototype.evadeStops=TransferLine]
  40566. * @description 避让站点 ID。
  40567. * */
  40568. this.evadeStops = null;
  40569. /**
  40570. * @member {Array.<number>} [TransferSolutionParameters.prototype.priorLines]
  40571. * @description 优先路线 ID。
  40572. * */
  40573. this.priorLines = null;
  40574. /**
  40575. * @member {Array.<number>} [TransferSolutionParameters.prototype.priorStops]
  40576. * @description 优先站点 ID。
  40577. * */
  40578. this.priorStops = null;
  40579. /**
  40580. * @member {string} TransferSolutionParameters.prototype.travelTime
  40581. * @description 出行的时间;格式是:"小时:分钟",如:"08:30"。如果设置了该参数,在分析时,则会考虑线路的首末班车时间的限制,即在返回的结果中会提示公交的首末班发车时间。
  40582. */
  40583. this.travelTime = null;
  40584. Util_Util.extend(this, options);
  40585. this.CLASS_NAME = "SuperMap.TransferSolutionParameters";
  40586. }
  40587. /**
  40588. * @function TransferSolutionParameters.prototype.destroy
  40589. * @description 释放资源,将引用资源的属性置空。
  40590. */
  40591. destroy() {
  40592. Util_Util.reset(this);
  40593. }
  40594. /**
  40595. * @function TransferSolutionParameters.toJsonParameters
  40596. * @description 将 {@link TransferSolutionParameters} 对象参数转换为 JSON 字符串。
  40597. * @param {TransferSolutionParameters} params - 交通换乘参数。
  40598. * @returns {string} 转化后的 JSON 字符串。
  40599. */
  40600. static toJson(params) {
  40601. if (params) {
  40602. return Util_Util.toJSON(params);
  40603. }
  40604. }
  40605. }
  40606. ;// CONCATENATED MODULE: ./src/common/iServer/TransferSolutionService.js
  40607. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  40608. * This program are made available under the terms of the Apache License, Version 2.0
  40609. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40610. /**
  40611. * @class TransferSolutionService
  40612. * @deprecatedclass SuperMap.TransferSolutionService
  40613. * @category iServer TrafficTransferAnalyst TransferSolutions
  40614. * @classdesc 交通换乘方案查询服务类。
  40615. * 返回结果通过该类支持的事件的监听函数参数获取。
  40616. * @param {string} url - 服务地址。
  40617. * 例如:</br>"http://localhost:8090/iserver/services/traffictransferanalyst-sample/restjsr/traffictransferanalyst/Traffic-Changchun"。
  40618. * @param {Object} options - 参数。</br>
  40619. * @param {Object} options.eventListeners - 需要被注册的监听器对象。</br>
  40620. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  40621. * @param {Object} [options.headers] - 请求头。
  40622. * @extends {CommonServiceBase}
  40623. * @example 例如:
  40624. * (start code)
  40625. * var myService = new TransferSolutionService(url, {eventListeners: {
  40626. * "processCompleted": trafficTransferCompleted,
  40627. * "processFailed": trafficTransferError
  40628. * }
  40629. * };
  40630. * (end)
  40631. * @usage
  40632. */
  40633. class TransferSolutionService extends CommonServiceBase {
  40634. constructor(url, options) {
  40635. super(url, options);
  40636. this.CLASS_NAME = "SuperMap.TransferSolutionService";
  40637. }
  40638. /**
  40639. * @override
  40640. */
  40641. destroy() {
  40642. super.destroy();
  40643. }
  40644. /**
  40645. * @function TransferSolutionService.prototype.processAsync
  40646. * @description 负责将客户端的更新参数传递到服务端。
  40647. * @param {TransferSolutionParameters} params - 交通换乘参数。
  40648. */
  40649. processAsync(params) {
  40650. if (!(params instanceof TransferSolutionParameters)) {
  40651. return;
  40652. }
  40653. var me = this,
  40654. method = "GET",
  40655. jsonParameters;
  40656. me.url = Util_Util.urlPathAppend(me.url, 'solutions');
  40657. jsonParameters = {
  40658. points: Util_Util.toJSON(params.points),
  40659. walkingRatio: params['walkingRatio'],
  40660. transferTactic: params['transferTactic'],
  40661. solutionCount: params['solutionCount'],
  40662. transferPreference: params["transferPreference"]
  40663. };
  40664. if (params.evadeLines) {
  40665. jsonParameters["evadeLines"] = Util_Util.toJSON(params.evadeLines);
  40666. }
  40667. if (params.evadeStops) {
  40668. jsonParameters["evadeStops"] = Util_Util.toJSON(params.evadeStops);
  40669. }
  40670. if (params.priorLines) {
  40671. jsonParameters["priorLines"] = Util_Util.toJSON(params.priorLines);
  40672. }
  40673. if (params.priorStops) {
  40674. jsonParameters["priorStops"] = Util_Util.toJSON(params.priorStops);
  40675. }
  40676. if (params.travelTime) {
  40677. jsonParameters["travelTime"] = params.travelTime;
  40678. }
  40679. me.request({
  40680. method: method,
  40681. params: jsonParameters,
  40682. scope: me,
  40683. success: me.serviceProcessCompleted,
  40684. failure: me.serviceProcessFailed
  40685. });
  40686. }
  40687. }
  40688. ;// CONCATENATED MODULE: ./src/common/iServer/TrafficTransferAnalystService.js
  40689. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  40690. * This program are made available under the terms of the Apache License, Version 2.0
  40691. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40692. /**
  40693. * @class TrafficTransferAnalystService
  40694. * @extends {ServiceBase}
  40695. * @category iServer TrafficTransferAnalyst
  40696. * @classdesc 交通换乘分析服务类。
  40697. * @example
  40698. * new TrafficTransferAnalystService(url).queryStop(params,function(result){
  40699. * //doSomething
  40700. * })
  40701. * @param {string} url - 服务地址。
  40702. * @param {Object} options - 参数。
  40703. * @param {string} [options.proxy] - 服务代理地址。
  40704. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  40705. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  40706. * @param {Object} [options.headers] - 请求头。
  40707. * @usage
  40708. */
  40709. class TrafficTransferAnalystService_TrafficTransferAnalystService {
  40710. constructor(url, options) {
  40711. this.url = url;
  40712. this.options = options || {};
  40713. }
  40714. /**
  40715. * @function TrafficTransferAnalystService.prototype.queryStop
  40716. * @description 站点查询服务。
  40717. * @param {StopQueryParameters} params - 查询相关参数类。
  40718. * @param {RequestCallback} callback - 回调函数。
  40719. */
  40720. queryStop(params, callback) {
  40721. var me = this;
  40722. var stopQueryService = new StopQueryService(me.url, {
  40723. proxy: me.options.proxy,
  40724. withCredentials: me.options.withCredentials,
  40725. crossOrigin: me.options.crossOrigin,
  40726. headers: me.options.headers,
  40727. eventListeners: {
  40728. scope: me,
  40729. processCompleted: callback,
  40730. processFailed: callback
  40731. }
  40732. });
  40733. stopQueryService.processAsync(params);
  40734. }
  40735. /**
  40736. * @function TrafficTransferAnalystService.prototype.analysisTransferPath
  40737. * @description 交通换乘线路查询服务。
  40738. * @param {TransferPathParameters} params - 查询相关参数类。
  40739. * @param {RequestCallback} callback - 回调函数。
  40740. */
  40741. analysisTransferPath(params, callback) {
  40742. var me = this;
  40743. var transferPathService = new TransferPathService(me.url, {
  40744. proxy: me.options.proxy,
  40745. withCredentials: me.options.withCredentials,
  40746. crossOrigin: me.options.crossOrigin,
  40747. headers: me.options.headers,
  40748. eventListeners: {
  40749. scope: me,
  40750. processCompleted: callback,
  40751. processFailed: callback
  40752. }
  40753. });
  40754. transferPathService.processAsync(params);
  40755. }
  40756. /**
  40757. * @function TrafficTransferAnalystService.prototype.analysisTransferSolution
  40758. * @description 交通换乘方案查询服务。
  40759. * @param {TransferSolutionParameters} params - 查询相关参数类。
  40760. * @param {RequestCallback} callback - 回调函数。
  40761. */
  40762. analysisTransferSolution(params, callback) {
  40763. var me = this;
  40764. var transferSolutionService = new TransferSolutionService(me.url, {
  40765. proxy: me.options.proxy,
  40766. withCredentials: me.options.withCredentials,
  40767. crossOrigin: me.options.crossOrigin,
  40768. headers: me.options.headers,
  40769. eventListeners: {
  40770. scope: me,
  40771. processCompleted: callback,
  40772. processFailed: callback
  40773. }
  40774. });
  40775. transferSolutionService.processAsync(params);
  40776. }
  40777. }
  40778. ;// CONCATENATED MODULE: ./src/maplibregl/services/TrafficTransferAnalystService.js
  40779. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  40780. * This program are made available under the terms of the Apache License, Version 2.0
  40781. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40782. /**
  40783. * @class TrafficTransferAnalystService
  40784. * @extends ServiceBase
  40785. * @category iServer TrafficTransferAnalyst
  40786. * @classdesc 交通换乘分析服务类。
  40787. * @version 11.1.0
  40788. * @modulecategory Services
  40789. * @example
  40790. * new TrafficTransferAnalystService(url)
  40791. * .queryStop(params,function(result){
  40792. * //doSomething
  40793. * })
  40794. * @param {string} url - 服务地址。
  40795. * @param {Object} options - 参数。
  40796. * @param {string} [options.proxy] - 服务代理地址。
  40797. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  40798. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  40799. * @param {Object} [options.headers] - 请求头。
  40800. * @usage
  40801. */
  40802. class TrafficTransferAnalystService extends ServiceBase {
  40803. constructor(url, options) {
  40804. super(url, options);
  40805. this._trafficTransferAnalystServiceBase = new TrafficTransferAnalystService_TrafficTransferAnalystService(url, options);
  40806. }
  40807. /**
  40808. * @function TrafficTransferAnalystService.prototype.queryStop
  40809. * @description 站点查询服务。
  40810. * @param {StopQueryParameters} params - 站点查询参数类。
  40811. * @param {RequestCallback} callback - 回调函数。
  40812. */
  40813. queryStop(params, callback) {
  40814. this._trafficTransferAnalystServiceBase.queryStop(params, callback);
  40815. }
  40816. /**
  40817. * @function TrafficTransferAnalystService.prototype.analysisTransferPath
  40818. * @description 交通换乘线路查询服务。
  40819. * @param {TransferPathParameters} params - 交通换乘线路查询参数类。
  40820. * @param {RequestCallback} callback - 回调函数。
  40821. */
  40822. analysisTransferPath(params, callback) {
  40823. this._trafficTransferAnalystServiceBase.analysisTransferPath(params, callback);
  40824. }
  40825. /**
  40826. * @function TrafficTransferAnalystService.prototype.analysisTransferSolution
  40827. * @description 交通换乘方案查询服务。
  40828. * @param {TransferSolutionParameters} params - 交通换乘方案查询参数类。
  40829. * @param {RequestCallback} callback - 回调函数。
  40830. */
  40831. analysisTransferSolution(params, callback) {
  40832. this._trafficTransferAnalystServiceBase.analysisTransferSolution(params, callback);
  40833. }
  40834. _processParams(params) {
  40835. if (!params) {
  40836. return {};
  40837. }
  40838. if (params.transferLines && !core_Util_Util.isArray(params.transferLines)) {
  40839. params.transferLines = [params.transferLines];
  40840. }
  40841. if (params.points && core_Util_Util.isArray(params.points)) {
  40842. params.points.map(function (point, key) {
  40843. params.points[key] = (point instanceof (external_maplibregl_default()).LngLat) ? {
  40844. x: point.lng,
  40845. y: point.lat
  40846. } : point;
  40847. return params.points[key];
  40848. });
  40849. }
  40850. return params;
  40851. }
  40852. }
  40853. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingService.js
  40854. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  40855. * This program are made available under the terms of the Apache License, Version 2.0
  40856. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  40857. /**
  40858. * @class WebPrintingService
  40859. * @deprecatedclass SuperMap.WebPrintingService
  40860. * @category iServer WebPrintingJob
  40861. * @version 10.1.0
  40862. * @classdesc 打印地图服务基类。
  40863. * @extends {CommonServiceBase}
  40864. * @param {string} url - 服务地址。请求打印地图服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/webprinting/rest/webprinting/v1。
  40865. * @param {Object} options - 参数。
  40866. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  40867. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  40868. * @param {Object} [options.headers] - 请求头。
  40869. * @usage
  40870. */
  40871. class WebPrintingService extends CommonServiceBase {
  40872. constructor(url, options) {
  40873. super(url, options);
  40874. if (options) {
  40875. Util_Util.extend(this, options);
  40876. }
  40877. this.eventCount = 0;
  40878. this.CLASS_NAME = 'SuperMap.WebPrintingService';
  40879. if (!this.url) {
  40880. return;
  40881. }
  40882. }
  40883. /**
  40884. * @function WebPrintingService.prototype.destroy
  40885. * @description 释放资源,将引用资源的属性置空。
  40886. */
  40887. destroy() {
  40888. super.destroy();
  40889. }
  40890. /**
  40891. * @function WebPrintingService.prototype.createWebPrintingJob
  40892. * @description 创建 Web 打印任务。
  40893. * @param {WebPrintingJobParameters} params - Web 打印的请求参数。
  40894. */
  40895. createWebPrintingJob(params, callback) {
  40896. if (!params) {
  40897. return;
  40898. }
  40899. if (params.layoutOptions) {
  40900. if (params.layoutOptions.legendOptions) {
  40901. !params.layoutOptions.legendOptions.title && (params.layoutOptions.legendOptions.title = '');
  40902. params.layoutOptions.legendOptions.picAsBase64 =
  40903. params.layoutOptions.legendOptions.picAsBase64 &&
  40904. params.layoutOptions.legendOptions.picAsBase64.replace(/^data:.+;base64,/, '');
  40905. if (
  40906. params.layoutOptions.legendOptions.customItems &&
  40907. params.layoutOptions.legendOptions.customItems.hasOwnProperty('picAsBase64')
  40908. ) {
  40909. params.layoutOptions.legendOptions.customItems.picAsBase64 = params.layoutOptions.legendOptions.customItems.picAsBase64.replace(
  40910. /^data:.+;base64,/,
  40911. ''
  40912. );
  40913. }
  40914. }
  40915. }
  40916. this.processAsync('jobs', 'POST', callback, params)
  40917. }
  40918. /**
  40919. * @function WebPrintingService.prototype.getPrintingJob
  40920. * @description 获取 Web 打印输出文档任务。
  40921. * @param {string} jobId - Web 打印任务 ID
  40922. */
  40923. getPrintingJob(jobId, callback) {
  40924. var me = this;
  40925. me.processAsync(`jobs/${jobId}`, 'GET', function(result) {
  40926. me.rollingProcess(result, me._processUrl(`jobs/${jobId}`), callback);
  40927. });
  40928. }
  40929. /**
  40930. * @function WebPrintingService.prototype.getPrintingJobResult
  40931. * @description 获取 Web 打印任务的输出文档。
  40932. * @param {string} jobId - Web 打印输入文档任务 ID。
  40933. */
  40934. getPrintingJobResult(jobId, callback) {
  40935. this.processAsync(`jobs/${jobId}/result`, 'GET', callback);
  40936. }
  40937. /**
  40938. * @function WebPrintingService.prototype.getLayoutTemplates
  40939. * @description 查询 Web 打印服务所有可用的模板信息。
  40940. */
  40941. getLayoutTemplates(callback) {
  40942. this.processAsync('layouts', 'GET', callback);
  40943. }
  40944. /**
  40945. * @function WebPrintingService.prototype.rollingProcess
  40946. * @description 轮询查询 Web 打印任务。
  40947. * @param {Object} result - 服务器返回的结果对象。
  40948. */
  40949. rollingProcess(result, url, callback) {
  40950. var me = this;
  40951. if (!result) {
  40952. return;
  40953. }
  40954. var id = setInterval(function () {
  40955. let eventId = ++me.eventCount;
  40956. let eventListeners = {
  40957. scope: this,
  40958. processCompleted: function(result) {
  40959. if (eventId === result.result.eventId && callback) {
  40960. delete result.result.eventId;
  40961. callback(result);
  40962. me.events.un(eventListeners);
  40963. return false;
  40964. }
  40965. },
  40966. processFailed: function(result) {
  40967. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  40968. callback(result);
  40969. me.events.un(eventListeners);
  40970. return false;
  40971. }
  40972. }
  40973. }
  40974. me.events.on(eventListeners);
  40975. me.request({
  40976. url,
  40977. method: 'GET',
  40978. scope: me,
  40979. success: function (result, options) {
  40980. result.eventId = eventId;
  40981. switch (result.status) {
  40982. case 'FINISHED':
  40983. clearInterval(id);
  40984. me.serviceProcessCompleted(result, options);
  40985. break;
  40986. case 'ERROR':
  40987. clearInterval(id);
  40988. me.serviceProcessFailed(result, options);
  40989. break;
  40990. case 'RUNNING':
  40991. me.events.triggerEvent('processRunning', result);
  40992. break;
  40993. }
  40994. },
  40995. failure: me.serviceProcessFailed
  40996. });
  40997. }, 1000);
  40998. }
  40999. processAsync(url, method, callback, params) {
  41000. let eventId = ++this.eventCount;
  41001. let eventListeners = {
  41002. scope: this,
  41003. processCompleted: function(result) {
  41004. if (eventId === result.result.eventId && callback) {
  41005. delete result.result.eventId;
  41006. callback(result);
  41007. this.events && this.events.un(eventListeners);
  41008. return false;
  41009. }
  41010. },
  41011. processFailed: function(result) {
  41012. if (eventId === result.error.eventId || eventId === result.eventId) {
  41013. callback(result);
  41014. this.events && this.events.un(eventListeners);
  41015. return false;
  41016. }
  41017. }
  41018. }
  41019. this.events.on(eventListeners);
  41020. var me = this;
  41021. let requestConfig = {
  41022. url: me._processUrl(url),
  41023. method,
  41024. scope: me,
  41025. success(result, options) {
  41026. result.eventId = eventId;
  41027. this.serviceProcessCompleted(result, options);
  41028. },
  41029. failure(result, options) {
  41030. if (result.error) {
  41031. result.error.eventId = eventId;
  41032. }
  41033. result.eventId = eventId;
  41034. this.serviceProcessFailed(result, options);
  41035. }
  41036. };
  41037. params && (requestConfig.data = Util_Util.toJSON(params));
  41038. me.request(requestConfig);
  41039. }
  41040. _processUrl(appendContent) {
  41041. if (appendContent) {
  41042. return Util_Util.urlPathAppend(this.url, appendContent);
  41043. }
  41044. return this.url;
  41045. }
  41046. }
  41047. ;// CONCATENATED MODULE: ./src/maplibregl/services/WebPrintingJobService.js
  41048. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  41049. * This program are made available under the terms of the Apache License, Version 2.0
  41050. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41051. /**
  41052. * @class WebPrintingJobService
  41053. * @category iServer WebPrintingJob
  41054. * @version 11.1.0
  41055. * @modulecategory Services
  41056. * @classdesc Web 打印服务类。
  41057. * 提供:创建 Web 打印任务,获取 Web 打印任务内容,获取 Web 打印输出文档流,获取 Web 打印服务的布局模板信息。
  41058. * @extends {ServiceBase}
  41059. * @param {string} url - 资源根地址。请求打印地图服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/webprinting/rest/webprinting/v1。
  41060. * @param {Object} options - 参数。
  41061. * @param {string} [options.proxy] - 服务代理地址。
  41062. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  41063. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  41064. * @param {Object} [options.headers] - 请求头。
  41065. * @example
  41066. * new WebPrintingJobService(url)
  41067. * .createWebPrintingJob(param,function(result){
  41068. * //doSomething
  41069. * })
  41070. * @usage
  41071. */
  41072. class WebPrintingJobService extends ServiceBase {
  41073. constructor(url, options) {
  41074. super(url, options);
  41075. this._webPrintingService = new WebPrintingService(url, options);
  41076. }
  41077. /**
  41078. * @function WebPrintingJobService.prototype.createWebPrintingJob
  41079. * @description 创建 Web 打印任务。
  41080. * @param {WebPrintingJobParameters} params - Web 打印参数类。
  41081. * @param {RequestCallback} callback - 回调函数。
  41082. */
  41083. createWebPrintingJob(params, callback) {
  41084. if (!params) {
  41085. return;
  41086. }
  41087. this._webPrintingService.createWebPrintingJob(this._processParams(params), callback);
  41088. }
  41089. /**
  41090. * @function WebPrintingJobService.prototype.getPrintingJob
  41091. * @description 获取 Web 打印输出文档任务。
  41092. * @param {string} jobId - Web 打印输入文档任务 ID。
  41093. * @param {RequestCallback} callback - 回调函数。
  41094. */
  41095. getPrintingJob(jobId, callback) {
  41096. this._webPrintingService.getPrintingJob(jobId, callback);
  41097. }
  41098. /**
  41099. * @function WebPrintingJobService.prototype.getPrintingJobResult
  41100. * @description 获取 Web 打印任务的输出文档。
  41101. * @param {string} jobId - Web 打印输入文档任务 ID。
  41102. * @param {RequestCallback} callback - 回调函数。
  41103. */
  41104. getPrintingJobResult(jobId, callback) {
  41105. this._webPrintingService.getPrintingJobResult(jobId, callback);
  41106. }
  41107. /**
  41108. * @function WebPrintingJobService.prototype.getLayoutTemplates
  41109. * @description 查询 Web 打印服务所有可用的模板信息。
  41110. * @param {RequestCallback} callback - 回调函数。
  41111. */
  41112. getLayoutTemplates(callback) {
  41113. this._webPrintingService.getLayoutTemplates(callback);
  41114. }
  41115. _processParams(params) {
  41116. if (params.layoutOptions && params.layoutOptions.littleMapOptions) {
  41117. params.layoutOptions.littleMapOptions.center = this._toPointObject(params.layoutOptions.littleMapOptions.center);
  41118. }
  41119. if (params.exportOptions) {
  41120. params.exportOptions.center = this._toPointObject(params.exportOptions.center);
  41121. }
  41122. return params;
  41123. }
  41124. _toPointObject(point) {
  41125. if (core_Util_Util.isArray(point)) {
  41126. return {
  41127. x: point[0],
  41128. y: point[1]
  41129. };
  41130. } else if (point instanceof Point || point instanceof (external_maplibregl_default()).Point) {
  41131. return {
  41132. x: point.x,
  41133. y: point.y
  41134. };
  41135. } else if (point instanceof (external_maplibregl_default()).LngLat) {
  41136. return {
  41137. x: point.lng,
  41138. y: point.lat
  41139. };
  41140. }
  41141. return point;
  41142. }
  41143. }
  41144. ;// CONCATENATED MODULE: ./src/common/iServer/ImageService.js
  41145. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  41146. * This program are made available under the terms of the Apache License, Version 2.0
  41147. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41148. /**
  41149. * @class ImageService
  41150. * @deprecatedclass SuperMap.ImageService
  41151. * @classdesc 影像服务类。
  41152. * @version 10.2.0
  41153. * @category iServer Image
  41154. * @param {string} url - 服务地址。例如: http://{ip}:{port}/iserver/{imageservice-imageserviceName}/restjsr/
  41155. * @param {Object} options - 可选参数。
  41156. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  41157. * @param {Object} [options.headers] - 请求头。
  41158. * @extends {CommonServiceBase}
  41159. * @usage
  41160. */
  41161. class ImageService_ImageService extends CommonServiceBase {
  41162. constructor(url, options) {
  41163. super(url, options);
  41164. this.options = options || {};
  41165. if (options) {
  41166. Util_Util.extend(this, options);
  41167. }
  41168. this.eventCount = 0;
  41169. this.CLASS_NAME = 'SuperMap.ImageService';
  41170. }
  41171. /**
  41172. * @function ImageService.prototype.destroy
  41173. * @override
  41174. */
  41175. destroy() {
  41176. super.destroy();
  41177. }
  41178. /**
  41179. * @function ImageService.prototype.getCollections
  41180. * @description 返回当前影像服务中的影像集合列表(Collections)。
  41181. */
  41182. getCollections(callback) {
  41183. var me = this;
  41184. var path = Util_Util.convertPath('/collections');
  41185. var url = Util_Util.urlPathAppend(me.url, path);
  41186. this._processAsync({ url, mehtod: 'GET', callback });
  41187. }
  41188. /**
  41189. * @function ImageService.prototype.getCollectionByID
  41190. * @description ID值等于`collectionId`参数值的影像集合(Collection)。ID值用于在服务中唯一标识该影像集合。
  41191. * @param {string} collectionId 影像集合(Collection)的ID,在一个影像服务中唯一标识影像集合。
  41192. */
  41193. getCollectionByID(collectionId, callback) {
  41194. var pathParams = {
  41195. collectionId: collectionId
  41196. };
  41197. var me = this;
  41198. var path = Util_Util.convertPath('/collections/{collectionId}', pathParams);
  41199. var url = Util_Util.urlPathAppend(me.url, path);
  41200. this._processAsync({ url, mehtod: 'GET', callback });
  41201. }
  41202. /**
  41203. * @function ImageSearchService.prototype.search
  41204. * @description 查询与过滤条件匹配的影像数据。
  41205. * @param {ImageSearchParameter} [imageSearchParameter] 查询参数。
  41206. */
  41207. search(imageSearchParameter, callback) {
  41208. var postBody = { ...(imageSearchParameter || {}) };
  41209. var me = this;
  41210. var path = Util_Util.convertPath('/search');
  41211. var url = Util_Util.urlPathAppend(me.url, path);
  41212. this._processAsync({ url, method: 'POST', data: postBody, callback });
  41213. }
  41214. _processAsync({ url, method, callback, data }) {
  41215. let eventId = ++this.eventCount;
  41216. let me = this;
  41217. let eventListeners = {
  41218. scope: this,
  41219. processCompleted: function (result) {
  41220. if (eventId === result.result.eventId && callback) {
  41221. delete result.result.eventId;
  41222. callback(result);
  41223. this.events && this.events.un(eventListeners);
  41224. return false;
  41225. }
  41226. },
  41227. processFailed: function (result) {
  41228. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  41229. callback(result);
  41230. this.events && this.events.un(eventListeners);
  41231. return false;
  41232. }
  41233. }
  41234. };
  41235. this.events.on(eventListeners);
  41236. this.request({
  41237. method: method || 'GET',
  41238. url,
  41239. data,
  41240. scope: this,
  41241. success(result, options) {
  41242. result.eventId = eventId;
  41243. me.serviceProcessCompleted(result, options);
  41244. },
  41245. failure(result, options) {
  41246. if (result.error) {
  41247. result.error.eventId = eventId;
  41248. }
  41249. result.eventId = eventId;
  41250. me.serviceProcessFailed(result, options);
  41251. }
  41252. });
  41253. }
  41254. }
  41255. ;// CONCATENATED MODULE: ./src/maplibregl/services/ImageService.js
  41256. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  41257. * This program are made available under the terms of the Apache License, Version 2.0
  41258. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41259. /**
  41260. * @class ImageService
  41261. * @version 11.1.0
  41262. * @constructs ImageService
  41263. * @classdesc 影像服务类。
  41264. * @category iServer Image
  41265. * @modulecategory Services
  41266. * @example
  41267. * new ImageService(url,options)
  41268. * .getCollections(function(result){
  41269. * //doSomething
  41270. * })
  41271. * @param {string} url - 服务地址。例如: http://{ip}:{port}/iserver/{imageservice-imageserviceName}/restjsr/
  41272. * @param {Object} options - 参数。
  41273. * @param {string} [options.proxy] - 服务代理地址。
  41274. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  41275. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  41276. * @param {Object} [options.headers] - 请求头。
  41277. * @extends {ServiceBase}
  41278. * @usage
  41279. */
  41280. class ImageService extends ServiceBase {
  41281. constructor(url, options) {
  41282. super(url, options);
  41283. this._imageService = new ImageService_ImageService(this.url, {
  41284. proxy: this.options.proxy,
  41285. withCredentials: this.options.withCredentials,
  41286. crossOrigin: this.options.crossOrigin,
  41287. headers: this.options.headers
  41288. });
  41289. }
  41290. /**
  41291. * @function ImageService.prototype.getCollections
  41292. * @description 返回当前影像服务中的影像集合列表(Collections)。
  41293. * @param {RequestCallback} callback - 回调函数。
  41294. */
  41295. getCollections(callback) {
  41296. this._imageService.getCollections(callback);
  41297. }
  41298. /**
  41299. * @function ImageService.prototype.getCollectionByID
  41300. * @description ID值等于`collectionId`参数值的影像集合(Collection)。ID值用于在服务中唯一标识该影像集合。
  41301. * @param {string} collectionId 影像集合(Collection)的ID,在一个影像服务中唯一标识影像集合。
  41302. * @param {RequestCallback} callback - 回调函数。
  41303. */
  41304. getCollectionByID(collectionId, callback) {
  41305. this._imageService.getCollectionByID(collectionId, callback);
  41306. }
  41307. /**
  41308. * @function ImageService.prototype.search
  41309. * @description 查询与过滤条件匹配的影像数据。
  41310. * @param {ImageSearchParameter} [itemSearch] 影像服务查询参数类。
  41311. * @param {RequestCallback} callback - 回调函数。
  41312. */
  41313. search(itemSearch, callback) {
  41314. this._imageService.search(itemSearch, callback);
  41315. }
  41316. }
  41317. ;// CONCATENATED MODULE: ./src/common/iServer/ImageCollectionService.js
  41318. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  41319. * This program are made available under the terms of the Apache License, Version 2.0
  41320. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41321. /**
  41322. * @class ImageCollectionService
  41323. * @deprecatedclass SuperMap.ImageCollectionService
  41324. * @classdesc 影像集合服务类。
  41325. * @version 10.2.0
  41326. * @category iServer Image
  41327. * @param {string} url - 服务地址。例如: http://{ip}:{port}/iserver/{imageservice-imageserviceName}/restjsr/
  41328. * @param {Object} options - 参数。
  41329. * @param {string} options.collectionId 影像集合(Collection)的ID,在一个影像服务中唯一标识影像集合。
  41330. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  41331. * @param {Object} [options.headers] - 请求头。
  41332. * @extends {CommonServiceBase}
  41333. * @usage
  41334. */
  41335. class ImageCollectionService_ImageCollectionService extends CommonServiceBase {
  41336. constructor(url, options) {
  41337. super(url, options);
  41338. this.options = options || {};
  41339. if (options) {
  41340. Util_Util.extend(this, options);
  41341. }
  41342. this.eventCount = 0;
  41343. this.CLASS_NAME = 'SuperMap.ImageCollectionService';
  41344. }
  41345. /**
  41346. * @function ImageCollectionService.prototype.destroy
  41347. * @override
  41348. */
  41349. destroy() {
  41350. super.destroy();
  41351. }
  41352. /**
  41353. * @function ImageCollectionService.prototype.getLegend
  41354. * @description 返回当前影像集合的图例信息。默认为服务发布所配置的风格,支持根据风格参数生成新的图例。
  41355. * @param {Object} queryParams query参数。
  41356. * @param {ImageRenderingRule} [queryParams.renderingRule] renderingRule 对象,用来指定影像的渲染风格,从而确定图例内容。影像的渲染风格包含拉伸显示方式、颜色表、波段组合以及应用栅格函数进行快速处理等。该参数未设置时,将使用发布服务时所配置的风格。
  41357. */
  41358. getLegend(queryParams, callback) {
  41359. var me = this;
  41360. var pathParams = {
  41361. collectionId: me.options.collectionId
  41362. };
  41363. var path = Util_Util.convertPath('/collections/{collectionId}/legend', pathParams);
  41364. var url = Util_Util.urlPathAppend(me.url, path);
  41365. this._processAsync({ url, method: 'GET', params: queryParams, callback });
  41366. }
  41367. /**
  41368. * @function ImageCollectionService.prototype.getStatistics
  41369. * @description 返回当前影像集合的统计信息。包括文件数量,文件大小等信息。
  41370. */
  41371. getStatistics(callback) {
  41372. var me = this;
  41373. var pathParams = {
  41374. collectionId: me.options.collectionId
  41375. };
  41376. var path = Util_Util.convertPath('/collections/{collectionId}/statistics', pathParams);
  41377. var url = Util_Util.urlPathAppend(me.url, path);
  41378. this._processAsync({ url, method: 'GET', callback });
  41379. }
  41380. /**
  41381. * @function ImageCollectionService.prototype.getTileInfo
  41382. * @description 返回影像集合所提供的服务瓦片的信息,包括:每层瓦片的分辨率,比例尺等信息,方便前端进行图层叠加。
  41383. */
  41384. getTileInfo(callback) {
  41385. var me = this;
  41386. var pathParams = {
  41387. collectionId: me.options.collectionId
  41388. };
  41389. var path = Util_Util.convertPath('/collections/{collectionId}/tileInfo', pathParams);
  41390. var url = Util_Util.urlPathAppend(me.url, path);
  41391. this._processAsync({ url, method: 'GET', callback });
  41392. }
  41393. /**
  41394. * @function ImageCollectionService.prototype.deleteItemByID
  41395. * @description 删除影像集合中指定 ID 的 Item,即从影像集合中删除指定的影像。
  41396. * @param {string} featureId Feature 的本地标识符。
  41397. */
  41398. deleteItemByID(featureId, callback) {
  41399. var me = this;
  41400. var pathParams = {
  41401. collectionId: me.options.collectionId,
  41402. featureId: featureId
  41403. };
  41404. var path = Util_Util.convertPath('/collections/{collectionId}/items/{featureId}', pathParams);
  41405. var url = Util_Util.urlPathAppend(me.url, path);
  41406. this._processAsync({ url, method: 'DELETE', callback });
  41407. }
  41408. /**
  41409. * @function ImageCollectionService.prototype.getItemByID
  41410. * @description 返回指定ID(`collectionId`)的影像集合中的指定ID(`featureId`)的Item对象,即返回影像集合中指定的影像。
  41411. * @param {string} featureId Feature 的本地标识符。
  41412. */
  41413. getItemByID(featureId, callback) {
  41414. var me = this;
  41415. var pathParams = {
  41416. collectionId: me.options.collectionId,
  41417. featureId: featureId
  41418. };
  41419. var path = Util_Util.convertPath('/collections/{collectionId}/items/{featureId}', pathParams);
  41420. var url = Util_Util.urlPathAppend(me.url, path);
  41421. this._processAsync({ url, method: 'GET', callback });
  41422. }
  41423. _processAsync({ url, method, callback, params}) {
  41424. let eventId = ++this.eventCount;
  41425. let eventListeners = {
  41426. scope: this,
  41427. processCompleted: function(result) {
  41428. if (eventId === result.result.eventId && callback) {
  41429. delete result.result.eventId;
  41430. callback(result);
  41431. this.events && this.events.un(eventListeners);
  41432. return false;
  41433. }
  41434. },
  41435. processFailed: function(result) {
  41436. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  41437. callback(result);
  41438. this.events && this.events.un(eventListeners);
  41439. return false;
  41440. }
  41441. }
  41442. }
  41443. this.events.on(eventListeners);
  41444. this.request({
  41445. method: method || 'GET',
  41446. url,
  41447. params,
  41448. scope: this,
  41449. success(result, options) {
  41450. result.eventId = eventId;
  41451. this.serviceProcessCompleted(result, options);
  41452. },
  41453. failure(result, options) {
  41454. if (result.error) {
  41455. result.error.eventId = eventId;
  41456. }
  41457. result.eventId = eventId;
  41458. this.serviceProcessFailed(result, options);
  41459. }
  41460. });
  41461. }
  41462. }
  41463. ;// CONCATENATED MODULE: ./src/maplibregl/services/ImageCollectionService.js
  41464. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  41465. * This program are made available under the terms of the Apache License, Version 2.0
  41466. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41467. /**
  41468. * @class ImageCollectionService
  41469. * @version 11.1.0
  41470. * @constructs ImageCollectionService
  41471. * @classdesc 影像集合服务类。
  41472. * @category iServer Image
  41473. * @modulecategory Services
  41474. * @extends {ServiceBase}
  41475. * @example
  41476. * new ImageCollectionService(url,options)
  41477. * .getLegend(collectionId, queryParams, function(result){
  41478. * //doSomething
  41479. * })
  41480. * @param {string} url - 服务地址。例如: http://{ip}:{port}/iserver/{imageservice-imageserviceName}/restjsr/
  41481. * @param {Object} options - 参数。
  41482. * @param {string} options.collectionId 影像集合(Collection)的ID,在一个影像服务中唯一标识影像集合。
  41483. * @param {string} [options.proxy] - 服务代理地址。
  41484. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  41485. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  41486. * @param {Object} [options.headers] - 请求头。
  41487. * @usage
  41488. */
  41489. class ImageCollectionService extends ServiceBase {
  41490. constructor(url, options) {
  41491. super(url, options);
  41492. this._imageCollectionService = new ImageCollectionService_ImageCollectionService(this.url, {
  41493. collectionId: this.options.collectionId,
  41494. proxy: this.options.proxy,
  41495. withCredentials: this.options.withCredentials,
  41496. crossOrigin: this.options.crossOrigin,
  41497. headers: this.options.headers
  41498. });
  41499. }
  41500. /**
  41501. * @function ImageCollectionService.prototype.getLegend
  41502. * @param {Object} queryParams query参数。
  41503. * @param {ImageRenderingRule} [queryParams.renderingRule] 指定影像显示的风格,包含拉伸显示方式、颜色表、波段组合以及应用栅格函数进行快速处理等。不指定时,使用发布服务时所配置的风格。
  41504. * @param {RequestCallback} callback - 回调函数。
  41505. */
  41506. getLegend(queryParams, callback) {
  41507. this._imageCollectionService.getLegend(queryParams, callback);
  41508. }
  41509. /**
  41510. * @function ImageCollectionService.prototype.getStatistics
  41511. * @description 返回当前影像集合的统计信息。包括文件数量,文件大小等信息。
  41512. * @param {RequestCallback} callback - 回调函数。
  41513. */
  41514. getStatistics(callback) {
  41515. this._imageCollectionService.getStatistics(callback);
  41516. }
  41517. /**
  41518. * @function ImageCollectionService.prototype.getTileInfo
  41519. * @description 返回影像集合所提供的服务瓦片的信息,包括:每层瓦片的分辨率,比例尺等信息,方便前端进行图层叠加。
  41520. * @param {RequestCallback} callback - 回调函数。
  41521. */
  41522. getTileInfo(callback) {
  41523. this._imageCollectionService.getTileInfo(callback);
  41524. }
  41525. /**
  41526. * @function ImageCollectionService.prototype.deleteItemByID
  41527. * @description 删除影像集合中指定ID (`featureId`) 的Item对象,即从影像集合中删除指定的影像。
  41528. * @param {string} featureId Feature 的本地标识符。
  41529. * @param {RequestCallback} callback - 回调函数。
  41530. */
  41531. deleteItemByID(featureId, callback) {
  41532. this._imageCollectionService.deleteItemByID(featureId, callback);
  41533. }
  41534. /**
  41535. * @function ImageCollectionService.prototype.getItemByID
  41536. * @description 返回影像集合中的指定ID(`featureId`)的Item对象,即返回影像集合中指定的影像。
  41537. * @param {string} featureId Feature 的本地标识符。
  41538. * @param {RequestCallback} callback - 回调函数。
  41539. */
  41540. getItemByID(featureId, callback) {
  41541. this._imageCollectionService.getItemByID(featureId, callback);
  41542. }
  41543. }
  41544. ;// CONCATENATED MODULE: ./src/common/iServer/KnowledgeGraphService.js
  41545. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  41546. * This program are made available under the terms of the Apache License, Version 2.0
  41547. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41548. /**
  41549. * @class KnowledgeGraphService
  41550. * @category iServer KnowledgeGraph
  41551. * @classdesc 知识图谱服务类
  41552. * @version 11.1.0
  41553. * @extends {ProcessingServiceBase}
  41554. * @param {string} url - 服务地址。
  41555. * @param {Object} options - 可选参数。
  41556. * @param {string} [options.proxy] - 服务代理地址。
  41557. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  41558. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  41559. * @param {Object} [options.headers] - 请求头。
  41560. * @usage
  41561. */
  41562. class KnowledgeGraphService_KnowledgeGraphService extends CommonServiceBase {
  41563. constructor(url, options) {
  41564. super(url, options);
  41565. this.options = options || {};
  41566. this.eventCount = 0;
  41567. this.CLASS_NAME = 'SuperMap.KnowledgeGraphService';
  41568. }
  41569. /**
  41570. * @function KnowledgeGraphService.prototype.destroy
  41571. * @override
  41572. */
  41573. destroy() {
  41574. super.destroy();
  41575. }
  41576. /**
  41577. * @function KnowledgeGraphService.prototype.query
  41578. * @description 通过查询语句查询知识图谱数据。
  41579. * @param {string} params - 查询条件。
  41580. * @param {RequestCallback} callback 回调函数。
  41581. */
  41582. query(params, callback) {
  41583. const paramKey = 'cypherQuery';
  41584. const url = Util_Util.urlAppend(this.url + '/query.json', `${paramKey}=${params}`);
  41585. this.processAsync({ url, method: 'GET', callback });
  41586. }
  41587. // /**
  41588. // * @function KnowledgeGraphService.prototype.queryById
  41589. // * @description 根据实体id查询关联节点。
  41590. // * @param {string} id - 实体id。
  41591. // * @param {RequestCallback} callback 回调函数。
  41592. // */
  41593. // queryById(id, callback) {
  41594. // const paramKey = 'cypherQuery';
  41595. // const url = Util.urlAppend(this.url + '/query.json', `${paramKey}=match p=(n)-[]-(m) where id(n)=${id} return p;`);
  41596. // this.processAsync({ url, method: 'GET', callback });
  41597. // }
  41598. // /**
  41599. // * @function KnowledgeGraphService.prototype.getMetaData
  41600. // * @description 获取元信息(展示所有实体类型和关系类型。)
  41601. // * @param {RequestCallback} callback 回调函数。
  41602. // */
  41603. // getMetaData(callback) {
  41604. // const url = this.url + 'management/metadata.json';
  41605. // this.processAsync({ url, method: 'GET', callback });
  41606. // }
  41607. /**
  41608. * @function KnowledgeGraphService.prototype.getGraphMaps
  41609. * @description 获取图谱列表
  41610. * @param {RequestCallback} callback 回调函数。
  41611. */
  41612. getGraphMaps(callback) {
  41613. const url = this.url + '/graphmaps.json';
  41614. this.processAsync({ url, method: 'GET', callback });
  41615. }
  41616. /**
  41617. * @function KnowledgeGraphService.prototype.getGraphMap
  41618. * @description 获取图谱图序列化数据
  41619. * @param {string} graphMapName 图谱名称
  41620. * @param {RequestCallback} callback 回调函数
  41621. */
  41622. getGraphMap(graphMapName, callback) {
  41623. const url = this.url + `/graphmaps/${graphMapName}.json`;
  41624. this.processAsync({ url, method: 'GET', callback });
  41625. }
  41626. /**
  41627. * @function KnowledgeGraphService.prototype.getGraphMapData
  41628. * @description 将iServer GraphMap服务的数据格式转换为KnowledgeGraph的数据格式。
  41629. * @param {string} graphMapName - 图谱名称
  41630. * @returns {Promise} Promise 对象。
  41631. */
  41632. async getGraphMapData(graphMapName) {
  41633. let data = [];
  41634. const graphMap = await this._getGraphMapData(graphMapName);
  41635. if (!graphMap) {
  41636. return;
  41637. }
  41638. const query = (graphMap.dataContent.queries && graphMap.dataContent.queries.query) || [];
  41639. let queries = [];
  41640. if (typeof query === 'string') {
  41641. queries = [query];
  41642. } else {
  41643. queries = query;
  41644. }
  41645. const expandQueries = this._getGraphMapExpandQuery(graphMap);
  41646. if (expandQueries.length) {
  41647. queries.push(...expandQueries);
  41648. }
  41649. for (let j = 0; j < queries.length; j++) {
  41650. const cypherQuery = queries[j];
  41651. const res = await this._queryDataBySql(cypherQuery);
  41652. data = data.concat([], res);
  41653. }
  41654. return { data, graphMap };
  41655. }
  41656. /**
  41657. * @private
  41658. * @function KnowledgeGraphService.prototype._getGraphMapExpandQuery
  41659. * @description 获取graphMap图谱展开节点的query条件
  41660. * @param {Object} graphMap -将iServer GraphMap图谱服务的数据
  41661. * @param {Array.<string>} 查询条件
  41662. */
  41663. _getGraphMapExpandQuery(graphMap) {
  41664. const queries = [];
  41665. const expandIds = (graphMap.dataContent.expand && JSON.parse(graphMap.dataContent.expand)) || [];
  41666. expandIds.forEach((id) => {
  41667. queries.push(`match p=(n)-[]-(m) where id(n)=${id} return p;`);
  41668. });
  41669. return queries;
  41670. }
  41671. // /**
  41672. // * @private
  41673. // * @function KnowledgeGraphService.prototype.getEntities
  41674. // * @description 获取实体。
  41675. // * @param {Object} params - 查询条件。{type:'院落', count:1}
  41676. // * @param {number} [params.count] - 返回个数
  41677. // * @param {RequestCallback} callback 回调函数
  41678. // */
  41679. // getEntities(params, callback) {
  41680. // const url = Util.urlAppend(this.url + '/entities.json', params);
  41681. // this.processAsync({ url, params, method: 'GET', callback });
  41682. // }
  41683. // /**
  41684. // * @private
  41685. // * @function KnowledgeGraphService.prototype.getEdges
  41686. // * @description 获取实体。
  41687. // * @param {Object} params - 查询条件。{type:'院落', count:1}
  41688. // * @param {number} [params.count] - 返回个数
  41689. // * @param {RequestCallback} callback 回调函数
  41690. // */
  41691. // getEdges(params, callback) {
  41692. // const url = Util.urlAppend(this.url + '/edges.json', params);
  41693. // this.processAsync({ url, params, method: 'GET', callback });
  41694. // }
  41695. // /**
  41696. // * @private
  41697. // * @function KnowledgeGraphService.prototype.getEntities
  41698. // * @description 获取实体。
  41699. // * @param {number} id - 查询条件。{type:'院落', count:1}
  41700. // * @param {RequestCallback} callback 回调函数
  41701. // */
  41702. // deleteEntitiy(id, callback) {
  41703. // const url = Util.urlAppend(this.url + '/entities.json', `id=${id}`);
  41704. // this.processAsync({ url, method: 'DELETE', callback });
  41705. // }
  41706. // /**
  41707. // * @private
  41708. // * @function KnowledgeGraphService.prototype.addNode
  41709. // * @description 获取实体。
  41710. // * @param {Object} params - 查询条件
  41711. // * @param {number} [params.count] - 返回个数
  41712. // * @param {RequestCallback} callback 回调函数
  41713. // */
  41714. // addNode(params, callback) {
  41715. // if (!(params instanceof KnowledgeGraphNodeParameter)) {
  41716. // return;
  41717. // }
  41718. // const url = Util.urlAppend(this.url + '/entities.json', params);
  41719. // this.processAsync({ url, params, method: 'PUT', callback });
  41720. // }
  41721. // /**
  41722. // * @private
  41723. // * @function KnowledgeGraphService.prototype.addEdge
  41724. // * @description 获取实体。
  41725. // * @param {Object} params - 查询条件
  41726. // * @param {number} [params.count] - 返回个数
  41727. // * @param {RequestCallback} callback 回调函数
  41728. // */
  41729. // addEdge(params, callback) {
  41730. // if (!(params instanceof KnowledgeGraphEdgeParameter)) {
  41731. // return;
  41732. // }
  41733. // const url = Util.urlAppend(this.url + '/edges.json', params);
  41734. // this.processAsync({ url, params, method: 'PUT', callback });
  41735. // }
  41736. /**
  41737. * @function KnowledgeGraphService.prototype.processAsync
  41738. * @description 负责将客户端的动态分段服务参数传递到服务端。
  41739. * @param {string} url - 服务地址
  41740. * @param {Object} params - 参数
  41741. */
  41742. processAsync({ url, params, method, callback }) {
  41743. let eventId = ++this.eventCount;
  41744. let eventListeners = {
  41745. scope: this,
  41746. processCompleted: function (result) {
  41747. if (eventId === result.result.eventId && callback) {
  41748. delete result.result.eventId;
  41749. callback(result);
  41750. this.events && this.events.un(eventListeners);
  41751. return false;
  41752. }
  41753. },
  41754. processFailed: function (result) {
  41755. if ((eventId === result.error.eventId || eventId === result.eventId) && callback) {
  41756. delete result.eventId;
  41757. callback(result);
  41758. this.events && this.events.un(eventListeners);
  41759. return false;
  41760. }
  41761. }
  41762. };
  41763. this.events.on(eventListeners);
  41764. const requestParams = {
  41765. method,
  41766. url,
  41767. scope: this,
  41768. success(result, options) {
  41769. result.eventId = eventId;
  41770. this.serviceProcessCompleted(result, options);
  41771. },
  41772. failure(result, options) {
  41773. result.eventId = eventId;
  41774. this.serviceProcessFailed(result, options);
  41775. }
  41776. };
  41777. if (params) {
  41778. requestParams.params = params;
  41779. }
  41780. this.request(requestParams);
  41781. }
  41782. /**
  41783. * @private
  41784. * @function _getGraphMapData
  41785. * @description 获取图谱信息
  41786. * @param {string} graphMapName - 图谱名称
  41787. * @returns {Promise} Promise 对象
  41788. */
  41789. _getGraphMapData(graphMapName) {
  41790. return new Promise((resolve, reject) => {
  41791. this.getGraphMap(graphMapName, (res) => {
  41792. if (res.type === 'processFailed') {
  41793. reject(res.error);
  41794. } else {
  41795. if (res.result.data === '') {
  41796. reject('无数据');
  41797. } else {
  41798. resolve(res.result.graphMap);
  41799. }
  41800. }
  41801. });
  41802. });
  41803. }
  41804. /**
  41805. * @private
  41806. * @function _queryDataBySql
  41807. * @description 查询实体和关系数据。
  41808. * @param {string} cypherQuery - 查询语句
  41809. * @returns {Promise} Promise 对象。
  41810. */
  41811. _queryDataBySql(cypherQuery) {
  41812. return new Promise((resolve, reject) => {
  41813. this.query(cypherQuery, (res) => {
  41814. if (res.type === 'processFailed') {
  41815. reject(res.error);
  41816. } else {
  41817. resolve(res.result);
  41818. }
  41819. });
  41820. });
  41821. }
  41822. }
  41823. ;// CONCATENATED MODULE: ./src/maplibregl/services/KnowledgeGraphService.js
  41824. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  41825. * This program are made available under the terms of the Apache License, Version 2.0
  41826. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41827. /**
  41828. * @class KnowledgeGraphService
  41829. * @category iServer KnowledgeGraph
  41830. * @classdesc 知识图谱服务类。
  41831. * @version 11.1.0
  41832. * @example
  41833. * new KnowledgeGraphService(url)
  41834. * .query(param,function(result){
  41835. * //doSomething
  41836. * })
  41837. * @extends {ServiceBase}
  41838. * @param {string} url - 服务地址。
  41839. * @param {Object} options -参数。
  41840. * @param {string} [options.proxy] - 服务代理地址。
  41841. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  41842. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  41843. * @param {Object} [options.headers] - 请求头。
  41844. * @usage
  41845. */
  41846. class KnowledgeGraphService extends ServiceBase {
  41847. constructor(url, options) {
  41848. super(url, options);
  41849. this._knowledgeGraphService = new KnowledgeGraphService_KnowledgeGraphService(url, options);
  41850. }
  41851. /**
  41852. * @function KnowledgeGraphService.prototype.query
  41853. * @description 通过查询语句查询知识图谱数据。
  41854. * @param {string} cypherQuery - 查询条件。
  41855. * @param {RequestCallback} callback - 回调函数。
  41856. */
  41857. query(cypherQuery, callback) {
  41858. this._knowledgeGraphService.query(cypherQuery, callback);
  41859. }
  41860. // /**
  41861. // * @function KnowledgeGraphService.prototype.getMetaData
  41862. // * @description 获取元信息(展示所有实体类型和关系类型)。
  41863. // * @param {RequestCallback} callback 回调函数。
  41864. // */
  41865. // getMetaData(callback) {
  41866. // this._knowledgeGraphService.getMetaData(callback);
  41867. // }
  41868. /**
  41869. * @function KnowledgeGraphService.prototype.getGraphMaps
  41870. * @description 获取图谱列表。
  41871. * @param {RequestCallback} callback 回调函数。
  41872. */
  41873. getGraphMaps(callback) {
  41874. this._knowledgeGraphService.getGraphMaps(callback);
  41875. }
  41876. /**
  41877. * @function KnowledgeGraphService.prototype.getGraphMap
  41878. * @description 获取图谱图序列化数据。
  41879. * @param {string} params 图谱名称。
  41880. * @param {RequestCallback} callback 回调函数。
  41881. */
  41882. getGraphMap(params, callback) {
  41883. this._knowledgeGraphService.getGraphMap(params, callback);
  41884. }
  41885. /**
  41886. * @function KnowledgeGraphService.prototype.getGraphMapData
  41887. * @description 将iServer GraphMap服务的数据格式转换为KnowledgeGraph的数据格式。
  41888. * @param {string} graphMapName - 图谱名称。
  41889. * @returns {Promise} Promise 对象。
  41890. */
  41891. async getGraphMapData(graphMapName) {
  41892. const res = await this._knowledgeGraphService.getGraphMapData(graphMapName);
  41893. return res;
  41894. }
  41895. }
  41896. ;// CONCATENATED MODULE: ./src/maplibregl/services/index.js
  41897. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  41898. * This program are made available under the terms of the Apache License, Version 2.0
  41899. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41900. // EXTERNAL MODULE: ./node_modules/lodash.uniqby/index.js
  41901. var lodash_uniqby = __webpack_require__(618);
  41902. var lodash_uniqby_default = /*#__PURE__*/__webpack_require__.n(lodash_uniqby);
  41903. ;// CONCATENATED MODULE: ./src/common/overlay/knowledge-graph/format.js
  41904. function transformGraphMap(data, graphMap) {
  41905. const style = graphMap && graphMap.styles && graphMap.styles.style;
  41906. const captionField = graphMap && graphMap.captionFields && graphMap.captionFields.captionField;
  41907. const rst = { nodes: [], edges: [] };
  41908. data.forEach((item) => {
  41909. const pathData = item.path;
  41910. if (pathData) {
  41911. const { nodes, edges } = transformPath(pathData, style, captionField);
  41912. rst.nodes.push(...nodes);
  41913. rst.edges.push(...edges);
  41914. } else if (isEdge(item)) {
  41915. const edge = edgeFromGraphMap(item, style);
  41916. rst.edges.push(edge);
  41917. } else {
  41918. const node = nodeFromGraphMap(item, style, captionField);
  41919. rst.nodes.push(node);
  41920. }
  41921. });
  41922. return { nodes: uniqData(rst.nodes), edges: uniqData(rst.edges, 'edgeId') };
  41923. }
  41924. function uniqData(data, paramName = 'id') {
  41925. return lodash_uniqby_default()(data, paramName);
  41926. }
  41927. function isEdge(entity) {
  41928. return entity.hasOwnProperty('start') && entity.hasOwnProperty('end');
  41929. }
  41930. function transformPath(pathData, style, captionField) {
  41931. const rst = { nodes: [], edges: [] };
  41932. pathData.forEach((item) => {
  41933. if (isEdge(item)) {
  41934. const edge = edgeFromGraphMap(item, style);
  41935. rst.edges.push(edge);
  41936. } else {
  41937. const node = nodeFromGraphMap(item, style, captionField);
  41938. rst.nodes.push(node);
  41939. }
  41940. });
  41941. return rst;
  41942. }
  41943. function nodeFromGraphMap(entity, style, captionField) {
  41944. const { id, properties, lables } = entity;
  41945. const styleData = style ? getNodeStyle(entity, style) : {};
  41946. const label = getNodeLabel(entity, captionField);
  41947. const fillColor = styleData.fillColor || '';
  41948. const node = {
  41949. id: id + '',
  41950. label: label,
  41951. properties,
  41952. lables
  41953. };
  41954. if (styleData.size) {
  41955. node.size = styleData.size;
  41956. delete styleData.size;
  41957. }
  41958. if (styleData.fillColor) {
  41959. node.style = {
  41960. fill: fillColor,
  41961. stroke: fillColor
  41962. };
  41963. delete styleData.fillColor;
  41964. }
  41965. if (Object.keys(styleData).length !== 0) {
  41966. node.labelCfg = {
  41967. style: styleData
  41968. };
  41969. }
  41970. return node;
  41971. }
  41972. function edgeFromGraphMap(entity, style) {
  41973. const { start, end, id, type, properties } = entity;
  41974. const styleData = style ? getEdgeStyle(entity, style) : {};
  41975. return {
  41976. source: start + '',
  41977. target: end + '',
  41978. edgeId: id + '',
  41979. label: type,
  41980. labelCfg: {
  41981. style: styleData
  41982. },
  41983. properties
  41984. };
  41985. }
  41986. function getEdgeStyle(entity, style) {
  41987. if (!style) {
  41988. return {};
  41989. }
  41990. const { id, type } = entity;
  41991. const data = style.filter((item) => item.type === 'relationShip');
  41992. for (let i = 0; i < data.length; i++) {
  41993. const { textColor, font, relationTypes, relationIds } = data[i];
  41994. const ids = JSON.parse(relationIds || '[]');
  41995. const types = JSON.parse(relationTypes || '[]');
  41996. if (ids.includes(id) || types.includes(type)) {
  41997. return {
  41998. fontSize: compileFontSize(font.fontSize),
  41999. fontFamily: font.fontName,
  42000. fill: textColor,
  42001. ...formatFontStyle(font.fontStyle)
  42002. };
  42003. }
  42004. }
  42005. return {};
  42006. }
  42007. function getNodeStyle(entity, style) {
  42008. if (!style) {
  42009. return {};
  42010. }
  42011. const { id, labels } = entity;
  42012. const data = style.filter((item) => item.type === 'entity');
  42013. for (let i = 0; i < data.length; i++) {
  42014. const { color, textColor, font, size, entityTypes, entityIds } = data[i];
  42015. const ids = JSON.parse(entityIds || '[]');
  42016. const types = JSON.parse(entityTypes || '[]');
  42017. if (ids.includes(id) || types.includes(labels[0])) {
  42018. return {
  42019. fillColor: color,
  42020. fontSize: compileFontSize(font.fontSize),
  42021. fontFamily: font.fontName,
  42022. fill: textColor,
  42023. size: size,
  42024. // stroke: color,
  42025. ...formatFontStyle(font.fontStyle)
  42026. };
  42027. }
  42028. }
  42029. return {};
  42030. }
  42031. function getNodeLabel(entity, captionField) {
  42032. const { id, labels, properties } = entity;
  42033. if (captionField) {
  42034. const data = captionField instanceof Array ? captionField : [captionField];
  42035. for (let i = 0; i < data.length; i++) {
  42036. const { name, entityTypes, entityIds } = data[i];
  42037. const ids = JSON.parse(entityIds || '[]');
  42038. const types = JSON.parse(entityTypes || '[]');
  42039. if (ids.includes(id) || types.includes(labels[0])) {
  42040. return properties[name] || '';
  42041. }
  42042. }
  42043. }
  42044. return properties[properties._labelfieldname] || '';
  42045. }
  42046. function formatFontStyle(fontStyle) {
  42047. if (fontStyle === 1) {
  42048. return { fontWeight: 600 };
  42049. }
  42050. if (fontStyle === 2) {
  42051. return { fontStyle: 'italic' };
  42052. }
  42053. return {};
  42054. }
  42055. function compileFontSize(fontSize) {
  42056. return fontSize * 0.8;
  42057. }
  42058. // 处理graphMap数据的展开 折叠 隐藏的实体数据
  42059. function transformExpandCollapseHiddenData(graphMap) {
  42060. const { expand, collapse, hidden } = graphMap.dataContent;
  42061. return {
  42062. expand: expand && JSON.parse(expand),
  42063. collapse: collapse && JSON.parse(collapse),
  42064. hidden: hidden && JSON.parse(hidden)
  42065. };
  42066. }
  42067. ;// CONCATENATED MODULE: external "function(){try{return G6}catch(e){return {}}}()"
  42068. const external_function_try_return_G6_catch_e_return_namespaceObject = function(){try{return G6}catch(e){return {}}}();
  42069. var external_function_try_return_G6_catch_e_return_default = /*#__PURE__*/__webpack_require__.n(external_function_try_return_G6_catch_e_return_namespaceObject);
  42070. // EXTERNAL MODULE: ./node_modules/insert-css/index.js
  42071. var insert_css = __webpack_require__(186);
  42072. var insert_css_default = /*#__PURE__*/__webpack_require__.n(insert_css);
  42073. ;// CONCATENATED MODULE: ./src/common/overlay/knowledge-graph/G6Render.js
  42074. /**
  42075. * @private
  42076. * @class G6Render
  42077. * @category iServer G6Render
  42078. * @classdesc G6Render
  42079. * @param {KnowledgeGraph.Data} data - 创建graph实例的数据项。
  42080. * @param {KnowledgeGraph.Config} [config] - 创建graph实例的配置项。
  42081. * @private
  42082. */
  42083. class G6Render {
  42084. constructor() {
  42085. this.config = null;
  42086. this.graph = null;
  42087. this.data = null;
  42088. this.collpasedData = {};
  42089. this.importG6();
  42090. this.CLASS_NAME = 'SuperMap.G6Render';
  42091. }
  42092. importG6() {
  42093. if (!(external_function_try_return_G6_catch_e_return_default())) {
  42094. console.log('please import g6, eg:https://gw.alipayobjects.com/os/lib/antv/g6/4.3.2/dist/g6.min.js');
  42095. }
  42096. }
  42097. /**
  42098. * @function G6Render.prototype.initGraph
  42099. * @description 创建KnowledgeGraph实例
  42100. * @param {KnowledgeGraph.Config} config - graph配置项。
  42101. * @returns {Object} graph实例。
  42102. */
  42103. initGraph(config) {
  42104. const graph = new (external_function_try_return_G6_catch_e_return_default()).Graph(config);
  42105. this.graph = graph;
  42106. if (!config || config.highlightNode !== false) {
  42107. this.highlightNode(graph);
  42108. }
  42109. if (!config || config.highlightEdge !== false) {
  42110. this.highlightEdge(graph);
  42111. }
  42112. if (config.dragCanvas !== false || config.dragNode !== false) {
  42113. // 阻止事件冒泡
  42114. this.stopDefaultEventPropagation();
  42115. }
  42116. return graph;
  42117. }
  42118. _getContextMenu() {
  42119. const contextMenu = new (external_function_try_return_G6_catch_e_return_default()).Menu({
  42120. shouldBegin(evt) {
  42121. if (evt.target && evt.target.isCanvas && evt.target.isCanvas()) {
  42122. return true;
  42123. }
  42124. if (evt.item) {
  42125. return true;
  42126. }
  42127. return false;
  42128. },
  42129. getContent: (evt) => {
  42130. const { item } = evt;
  42131. if (evt.target && evt.target.isCanvas && evt.target.isCanvas()) {
  42132. return;
  42133. }
  42134. if (!item) {
  42135. return;
  42136. }
  42137. const itemType = item.getType();
  42138. const model = item.getModel();
  42139. if (itemType && model) {
  42140. if (itemType === 'node') {
  42141. if (this.isCollpased(model.id)) {
  42142. return `<ul>
  42143. <li id='expand'>展开</li>
  42144. <li id='hide'>隐藏</li>
  42145. </ul>`;
  42146. } else {
  42147. return `<ul>
  42148. <li id='collapse'>折叠</li>
  42149. <li id='hide'>隐藏</li>
  42150. </ul>`;
  42151. }
  42152. }
  42153. }
  42154. },
  42155. handleMenuClick: (target, item) => {
  42156. const liIdStrs = target.id.split('-');
  42157. switch (liIdStrs[0]) {
  42158. case 'hide':
  42159. this.hideItem(item);
  42160. break;
  42161. case 'expand':
  42162. this.expandNode(item);
  42163. break;
  42164. case 'collapse':
  42165. this.collapseNode(item);
  42166. break;
  42167. case 'show':
  42168. this.showItem(item);
  42169. break;
  42170. default:
  42171. break;
  42172. }
  42173. },
  42174. // 需要加上父级容器的 padding-left 16 与自身偏移量 10
  42175. offsetX: 16 + 10,
  42176. // 需要加上父级容器的 padding-top 24 、画布兄弟元素高度、与自身偏移量 10
  42177. offsetY: 0,
  42178. // 在哪些类型的元素上响应
  42179. itemTypes: ['node', 'edge', 'canvas']
  42180. });
  42181. return contextMenu;
  42182. }
  42183. _getGraphConfig(config) {
  42184. const animateConfig = {
  42185. speed: 120,
  42186. maxIteration: 83,
  42187. tick: () => {
  42188. this.refreshPositions()
  42189. }
  42190. };
  42191. const defaultLayout = {
  42192. type: 'fruchterman',
  42193. gravity: 5
  42194. };
  42195. const defaultNode = {};
  42196. const defaultEdge = {
  42197. type: 'line',
  42198. style: {
  42199. endArrow: {
  42200. path: 'M 0,0 L 2,1 L 2,-1 Z'
  42201. },
  42202. lineWidth: 0.5
  42203. },
  42204. labelCfg: {
  42205. autoRotate: true,
  42206. style: {
  42207. fontSize: 4,
  42208. fill: '#333'
  42209. }
  42210. }
  42211. };
  42212. const defaultMode = {
  42213. default: ['drag-canvas', 'zoom-canvas', 'drag-node']
  42214. };
  42215. const contextMenu = this._getContextMenu();
  42216. const defaultPlugins = [new (external_function_try_return_G6_catch_e_return_default()).ToolBar(), contextMenu];
  42217. const hoverColor = '#b4d6ff';
  42218. const defaultNodeHighlightStyle = {
  42219. lineWidth: 3,
  42220. stroke: hoverColor
  42221. };
  42222. const defaultEdgeHighlightStyle = {
  42223. stroke: hoverColor,
  42224. lineWidth: 2,
  42225. endArrow: {
  42226. path: 'M 0,0 L 2,1 L 2,-1 Z',
  42227. fill: hoverColor
  42228. }
  42229. };
  42230. const defaultGraphConfig = (container = 'knowledgeGraph') => {
  42231. const dom = document.querySelector(`#${container}`);
  42232. return {
  42233. container: container, // String | HTMLElement,必须,在 Step 1 中创建的容器 id 或容器本身
  42234. width: dom.scrollWidth, // Number,必须,图的宽度
  42235. height: dom.scrollHeight, // Number,必须,图的高度
  42236. plugins: defaultPlugins,
  42237. modes: defaultMode,
  42238. layout: { ...defaultLayout, ...animateConfig },
  42239. defaultNode,
  42240. defaultEdge,
  42241. nodeStateStyles: {
  42242. hover: defaultNodeHighlightStyle
  42243. },
  42244. edgeStateStyles: {
  42245. hover: defaultEdgeHighlightStyle
  42246. }
  42247. };
  42248. };
  42249. if (!config) {
  42250. this._setToolBarStyle();
  42251. return defaultGraphConfig();
  42252. }
  42253. config.container = config.container || 'knowledgeGraph';
  42254. const dom =
  42255. typeof config.container === 'string' ? document.querySelector(`#${config.container}`) : config.container;
  42256. config.width = config.width || dom.scrollWidth;
  42257. config.height = config.height || dom.scrollHeight;
  42258. config.layout = { ...defaultLayout, ...(config.layout || {}), ...(config.animate !== false ? animateConfig : {}) };
  42259. config.defaultNode = { ...defaultNode, ...(config.defaultNode || {}) };
  42260. config.defaultEdge = { ...defaultEdge, ...(config.defaultEdge || {}) };
  42261. config.modes = {
  42262. default: [
  42263. config.dragCanvas !== false && 'drag-canvas',
  42264. config.zoomCanvas !== false && 'zoom-canvas',
  42265. config.dragNode !== false && 'drag-node'
  42266. ]
  42267. };
  42268. config.nodeStateStyles = {
  42269. hover: { ...defaultNodeHighlightStyle, ...(config.nodeHighlightStyle || {}) }
  42270. };
  42271. config.edgeStateStyles = {
  42272. hover: { ...defaultEdgeHighlightStyle, ...(config.edgeHighlightStyle || {}) }
  42273. };
  42274. if (config.showToolBar !== false) {
  42275. config.plugins = [new (external_function_try_return_G6_catch_e_return_default()).ToolBar()];
  42276. this._setToolBarStyle();
  42277. }
  42278. if (config.showContextMenu !== false) {
  42279. config.plugins = [...(config.plugins || []), contextMenu];
  42280. this._setToolBarStyle();
  42281. }
  42282. return config;
  42283. }
  42284. /**
  42285. * @function KnowledgeGraph.prototype.changeSize
  42286. * @description 当源数据中现有节点/边 的数据项发生配置的变更时,根据新数据刷新视图。
  42287. * @param {number} width - 宽度。
  42288. * @param {number} height - 高度。
  42289. */
  42290. changeSize(width, height) {
  42291. return this.graph.changeSize(width, height);
  42292. }
  42293. /**
  42294. * @function G6Render.prototype.autoResize
  42295. * @description 浏览器窗口大小发生改变时,重新渲染;
  42296. */
  42297. autoResize() {
  42298. const dom = this.getContainer();
  42299. window.addEventListener('resize', () => {
  42300. const width = dom.scrollWidth;
  42301. const height = dom.scrollHeight;
  42302. this.graph.changeSize(width, height);
  42303. this.graph.refresh();
  42304. });
  42305. }
  42306. /**
  42307. * @function G6Render.prototype.zoom
  42308. * @description 改变视口的缩放比例,在当前画布比例下缩放,是相对比例。
  42309. * @param {number} ratio 缩放比例。
  42310. * @param {Object} [center] 以 center 的 x、y 坐标为中心缩放,如果省略了 center 参数,则以元素当前位置为中心缩放。
  42311. * @param {boolean} [animate] 是否开启动画。
  42312. * @param {KnowledgeGraph.AnimateConfig} [animateCfg] 若带有动画,可配置动画。若未配置,则跟随 graph 的 animateCfg 参数。
  42313. */
  42314. zoom(ratio, center, animate, animateCfg) {
  42315. this.graph.zoom(ratio, center, animate, animateCfg);
  42316. }
  42317. /**
  42318. * @function G6Render.prototype.zoomTo
  42319. * @description 改变视口的缩放比例,在当前画布比例下缩放,是相对比例。
  42320. * @param {number} ratio 缩放比例。
  42321. * @param {Object} [center] 以 center 的 x、y 坐标为中心缩放,如果省略了 center 参数,则以元素当前位置为中心缩放。
  42322. * @param {boolean} [animate] 是否开启动画。
  42323. * @param {KnowledgeGraph.AnimateConfig} [animateCfg] 若带有动画,可配置动画。若未配置,则跟随 graph 的 animateCfg 参数。
  42324. */
  42325. zoomTo(ratio, center, animate, animateCfg) {
  42326. this.graph.zoomTo(ratio, center, animate, animateCfg);
  42327. }
  42328. /**
  42329. * @function G6Render.prototype.fitView
  42330. * @description 让画布内容适应视口。
  42331. * @param {Array.<number>|number} [padding] [top, right, bottom, left] 四个方向上的间距值。
  42332. * @param {Object} [rules] fitView 的规则,参数如下:{ onlyOutOfViewPort?: boolean; direction?: 'x' / 'y' / 'both'; ratioRule?: 'max' / 'min}。
  42333. * @param {boolean} [animate] 是否开启动画。
  42334. * @param {KnowledgeGraph.AnimateConfig} [animateCfg] 若带有动画,可配置动画。若未配置,则跟随 graph 的 animateCfg 参数。
  42335. */
  42336. fitView(padding, rules, animate, animateCfg) {
  42337. this.graph.fitView(padding, rules, animate, animateCfg);
  42338. }
  42339. /**
  42340. * @function G6Render.prototype.fitCenter
  42341. * @description 平移图到中心将对齐到画布中心,但不缩放。优先级低于 fitView。
  42342. * @param {boolean} [animate] 是否开启动画。
  42343. * @param {KnowledgeGraph.AnimateConfig} [animateCfg] 若带有动画,可配置动画,参见基础动画教程。若未配置,则跟随 graph 的 animateCfg 参数。
  42344. */
  42345. fitCenter(animate, animateCfg) {
  42346. this.graph.fitCenter(animate, animateCfg);
  42347. }
  42348. /**
  42349. * @function G6Render.prototype.getGraphCenterPoint
  42350. * @description 获取图内容的中心绘制坐标。
  42351. * @return {Object} 包含的属性:x 和 y 属性,分别表示渲染坐标下的 x、y 值。
  42352. */
  42353. getGraphCenterPoint() {
  42354. return this.graph.getGraphCenterPoint();
  42355. }
  42356. /**
  42357. * @function G6Render.prototype.getViewPortCenterPoint
  42358. * @description 获取视口中心绘制坐标。
  42359. * @return {Object} 包含的属性:x 和 y 属性,分别表示渲染坐标下的 x、y 值。
  42360. */
  42361. getViewPortCenterPoint() {
  42362. return this.graph.getViewPortCenterPoint();
  42363. }
  42364. /**
  42365. * @function G6Render.prototype.getZoom
  42366. * @description 获取当前视口的缩放比例。
  42367. * @return {number} 返回值表示当前视口的缩放比例, 默认值为 1。
  42368. */
  42369. getZoom() {
  42370. return this.graph.getZoom();
  42371. }
  42372. /**
  42373. * @function G6Render.prototype.getMinZoom
  42374. * @description 获取 graph 当前允许的最小缩放比例。
  42375. * @return {number} 返回值表示当前视口的最小缩放比例。
  42376. */
  42377. getMinZoom() {
  42378. return this.graph.getMinZoom();
  42379. }
  42380. /**
  42381. * @function G6Render.prototype.setMinZoom
  42382. * @description 设置 graph 当前允许的最小缩放比例。
  42383. * @param {number} ratio 缩放比例。
  42384. */
  42385. setMinZoom(ratio) {
  42386. this.graph.setMinZoom(ratio);
  42387. }
  42388. /**
  42389. * @function G6Render.prototype.getMaxZoom
  42390. * @description 获取 graph 当前允许的最大缩放比例。
  42391. * @return {number} 返回值表示当前视口的最大缩放比例。
  42392. */
  42393. getMaxZoom() {
  42394. return this.graph.getMaxZoom();
  42395. }
  42396. /**
  42397. * @function G6Render.prototype.setMaxZoom
  42398. * @description 设置 graph 当前允许的最大缩放比例。
  42399. * @param {number} ratio 缩放比例。
  42400. */
  42401. setMaxZoom(ratio) {
  42402. this.graph.setMaxZoom(ratio);
  42403. }
  42404. /**
  42405. * @function G6Render.prototype.getWidth
  42406. * @description获取 graph 当前的宽度。
  42407. * @return {number} graph 当前的宽度。
  42408. */
  42409. getWidth() {
  42410. return this.graph.getWidth();
  42411. }
  42412. /**
  42413. * @function G6Render.prototype.getHeight
  42414. * @description 获取 graph 当前的高度。
  42415. * @return {number} graph 当前的高度。
  42416. */
  42417. getHeight() {
  42418. return this.graph.getHeight();
  42419. }
  42420. setCenter(centerDrawPoint) {
  42421. var centerCanvasPointX = this.graph.getWidth() / 2;
  42422. var centerCanvasPointY = this.graph.getHeight() / 2;
  42423. var centerCanvasPointNew = this.graph.getCanvasByPoint(centerDrawPoint.x, centerDrawPoint.y);
  42424. this.graph.translate(centerCanvasPointX - centerCanvasPointNew.x, centerCanvasPointY - centerCanvasPointNew.y);
  42425. }
  42426. /**
  42427. * @function G6Render.prototype._setToolBarStyle
  42428. * @description 隐藏工具栏的redo undo realZoom按钮
  42429. * @private
  42430. */
  42431. _setToolBarStyle() {
  42432. insert_css_default()(`
  42433. .g6-component-toolbar li[code='redo'],
  42434. .g6-component-toolbar li[code='undo'],
  42435. .g6-component-toolbar li[code='realZoom'] {
  42436. display: none;
  42437. }
  42438. .g6-component-contextmenu {
  42439. position: absolute;
  42440. z-index: 2;
  42441. list-style-type: none;
  42442. border-radius: 6px;
  42443. font-size: 14px;
  42444. width: fit-content;
  42445. transition: opacity .2s;
  42446. text-align: center;
  42447. box-shadow: 0 5px 18px 0 rgba(0, 0, 0, 0.6);
  42448. border: 0px;
  42449. }
  42450. .g6-component-contextmenu ul {
  42451. padding-left: 0px;
  42452. margin: 0;
  42453. }
  42454. .g6-component-contextmenu li {
  42455. cursor: pointer;
  42456. list-style-type: none;
  42457. list-style: none;
  42458. margin-left: 0;
  42459. line-height: 38px;
  42460. padding: 0px 35px;
  42461. }
  42462. .g6-component-contextmenu li:hover {
  42463. color: #333;
  42464. background: #aaaaaa45;
  42465. }
  42466. `);
  42467. }
  42468. /**
  42469. * @function G6Render.prototype.highlightNode
  42470. * @description 鼠标移入节点,节点高亮
  42471. * @param {Object} graph - graph实例。
  42472. */
  42473. highlightNode(graph = this.graph) {
  42474. function clearAllStats() {
  42475. graph.setAutoPaint(false);
  42476. graph.getNodes().forEach(function (node) {
  42477. graph.clearItemStates(node);
  42478. });
  42479. graph.paint();
  42480. graph.setAutoPaint(true);
  42481. }
  42482. graph.on('node:mouseenter', function (e) {
  42483. const item = e.item;
  42484. graph.setAutoPaint(false);
  42485. graph.getNodes().forEach(function (node) {
  42486. graph.clearItemStates(node);
  42487. });
  42488. graph.setItemState(item, 'hover', true);
  42489. graph.paint();
  42490. graph.setAutoPaint(true);
  42491. });
  42492. graph.on('node:mouseleave', clearAllStats);
  42493. }
  42494. /**
  42495. * @function G6Render.prototype.highlightNode
  42496. * @description 鼠标移入节点,节点高亮
  42497. * @param {Object} graph - graph实例。
  42498. */
  42499. highlightEdge(graph = this.graph) {
  42500. function clearAllStats() {
  42501. graph.setAutoPaint(false);
  42502. graph.getEdges().forEach(function (edge) {
  42503. graph.clearItemStates(edge);
  42504. });
  42505. graph.paint();
  42506. graph.setAutoPaint(true);
  42507. }
  42508. graph.on('edge:mouseenter', function (e) {
  42509. const item = e.item;
  42510. graph.setAutoPaint(false);
  42511. graph.getNodes().forEach(function (node) {
  42512. graph.clearItemStates(node);
  42513. });
  42514. graph.setItemState(item, 'hover', true);
  42515. graph.paint();
  42516. graph.setAutoPaint(true);
  42517. });
  42518. graph.on('edge:mouseleave', clearAllStats);
  42519. }
  42520. /**
  42521. * @function G6Render.prototype.setData
  42522. * @description 设置数据
  42523. * @param {KnowledgeGraph.Data} data - graph数据。
  42524. * @param {Object} [graph] - graph实例。
  42525. */
  42526. setData(data, graph = this.graph) {
  42527. if (!this.data) {
  42528. graph.data(data);
  42529. } else {
  42530. graph.changeData(data);
  42531. }
  42532. this.data = data;
  42533. }
  42534. /**
  42535. * @function G6Render.prototype.render
  42536. * @description 根据提供的数据渲染视图。
  42537. */
  42538. render(graph = this.graph) {
  42539. return graph.render();
  42540. }
  42541. /**
  42542. * @function G6Render.prototype.updateGraph
  42543. * @description 更新数据
  42544. * @param {Object} graph - graph实例。
  42545. * @param {KnowledgeGraph.Data} data - graph数据。
  42546. */
  42547. updateGraph(data, graph = this.graph) {
  42548. this.data = data;
  42549. graph.changeData(data);
  42550. }
  42551. /**
  42552. * @function G6Render.prototype.refresh
  42553. * @description 当源数据中现有节点/边的数据项发生配置的变更时,根据新数据刷新视图。
  42554. * @param {Object} graph - graph实例。
  42555. */
  42556. refresh(graph = this.graph) {
  42557. graph.refresh();
  42558. }
  42559. /**
  42560. * @function G6Render.prototype.getContainer
  42561. * @description 获取 Graph 的 DOM 容器。
  42562. * @param {Object} graph - graph实例。
  42563. * @return {HTMLElement} DOM 容器。
  42564. */
  42565. getContainer(graph = this.graph) {
  42566. return graph.getContainer();
  42567. }
  42568. /**
  42569. * @function G6Render.prototype.getCanvas
  42570. * @description 获取canvas。
  42571. * @param {Object} graph - graph实例。
  42572. * @return {HTMLElement} canvas。
  42573. */
  42574. getCanvas(graph = this.graph) {
  42575. return graph.get('canvas');
  42576. }
  42577. /**
  42578. * @function G6Render.prototype.getNodes
  42579. * @description 获取图中所有节点的实例。
  42580. * @param {Object} graph - graph实例。
  42581. * @return {Array} 返回值表示图中所有节点的实例。
  42582. */
  42583. getNodes(graph = this.graph) {
  42584. return graph.getNodes();
  42585. }
  42586. /**
  42587. * @function G6Render.prototype.getEdges
  42588. * @description 获取图中所有节点的实例。这里返回的是边的实例,而不是边的数据项。
  42589. * @param {Object} graph - graph实例。
  42590. * @return {Array} 返回值表示图中所有边的实例。
  42591. */
  42592. getEdges(graph = this.graph) {
  42593. return graph.getEdges();
  42594. }
  42595. /**
  42596. * @function G6Render.prototype.getNeighbors
  42597. * @description 获取邻居节点数组。
  42598. * @param {Object} graph - graph实例。
  42599. * @param {string | INode} node - 节点 ID 或节点实例。
  42600. * @param {string|undefined} type -['source'| 'target' |undefined] 邻居类型, 'source' 只获取当前节点的源节点,'target' 只获取当前节点指向的目标节点, 若不指定则返回所有类型的邻居。
  42601. * @return {Array} 返回值符合要求的节点数组。
  42602. */
  42603. getNeighbors(node, type, graph = this.graph) {
  42604. return graph.getNeighbors(node, type);
  42605. }
  42606. /**
  42607. * @function G6Render.prototype.findById
  42608. * @description 根据 ID,查询对应的元素实例。
  42609. * @param {Object} graph - graph实例。
  42610. * @param {string} id - 元素 ID
  42611. * @return {Object} 如果有符合规则的元素实例,则返回第一个匹配的元素实例,否则返回 undefined 。
  42612. */
  42613. findById(id, graph = this.graph) {
  42614. return graph.findById(id);
  42615. }
  42616. /**
  42617. * @function G6Render.prototype.find
  42618. * @description 获取邻居节点数组。
  42619. * @param {Object} graph - graph实例。
  42620. * @param {string} type - 元素类型,可选值为 'node'、'edge'
  42621. * @param {Function} fn - 查找的规则。
  42622. * @return {Object} 如果有符合规则的元素实例,则返回第一个匹配的元素实例,否则返回 undefined 。
  42623. */
  42624. find(type, fn, graph = this.graph) {
  42625. return graph.find(type, fn);
  42626. }
  42627. /**
  42628. * @function G6Render.prototype.findAll
  42629. * @description 获取邻居节点数组。
  42630. * @param {Object} graph - graph实例。
  42631. * @param {string} type - 元素类型,可选值为 'node'、'edge'
  42632. * @param {Function} fn - 查找的规则。
  42633. * @return {Object} 如果有符合规则的元素实例,则返回所有元素实例,否则返回 undefined。
  42634. */
  42635. findAll(type, fn, graph = this.graph) {
  42636. return graph.findAll(type, fn);
  42637. }
  42638. /**
  42639. * @function G6Render.prototype.getEdgesByNode
  42640. * @description 获取与当前节点有关联的所有边。
  42641. * @param {Object} node - node实例。
  42642. * @return {Array} edge实例数组。
  42643. */
  42644. getEdgesByNode(node) {
  42645. return node.getEdges();
  42646. }
  42647. /**
  42648. * @function G6Render.prototype.getEdgesByNode
  42649. * @description 获取与当前节点关联的所有入边。
  42650. * @param {Object} node - node实例。
  42651. * @return {Array} edge实例数组。
  42652. */
  42653. getInEdges(node) {
  42654. return node.getInEdges();
  42655. }
  42656. /**
  42657. * @function G6Render.prototype.getEdgesByNode
  42658. * @description 获取与当前节点关联的所有出边。
  42659. * @param {Object} node - node实例。
  42660. * @return {Array} edge实例数组。
  42661. */
  42662. getOutEdges(node) {
  42663. return node.getOutEdges();
  42664. }
  42665. /**
  42666. * @function G6Render.prototype.getSourceByEdge
  42667. * @description 获取当前边的起始节点
  42668. * @param {Object} edge - node实例。
  42669. * @return {Object} 返回值为起始节点的实例。
  42670. */
  42671. getSourceByEdge(edge) {
  42672. return edge.getSource();
  42673. }
  42674. /**
  42675. * @function G6Render.prototype.getTargetByEdge
  42676. * @description 获取当前边的终止节点。
  42677. * @param {Object} edge - node实例。
  42678. * @return {Object} 终止节点的实例。
  42679. */
  42680. getTargetByEdge(edge) {
  42681. return edge.getTarget();
  42682. }
  42683. /**
  42684. * @function G6Render.prototype.expandNode
  42685. * @description 展开当前节点。
  42686. * @param {Object} item - 元素 ID 或元素实例。
  42687. */
  42688. expandNode(item) {
  42689. const id = item.getModel().id;
  42690. this._expandCollapseNode(this.collpasedData[id], 'show');
  42691. delete this.collpasedData[id];
  42692. }
  42693. /**
  42694. * @function G6Render.prototype.collapseNode
  42695. * @description 收起当前节点。
  42696. * @param {Object} item - 元素 ID 或元素实例。
  42697. * @param {Object} graph - graph实例。
  42698. */
  42699. collapseNode(item) {
  42700. const id = item.getModel().id;
  42701. const result = [];
  42702. this._collapseFunc(item, result);
  42703. this.collpasedData[id] = result;
  42704. this._expandCollapseNode(result);
  42705. }
  42706. isCollpased(id) {
  42707. return !!this.collpasedData[id];
  42708. }
  42709. _collapseFunc(item, res = []) {
  42710. const sourceNodes = this.getNeighbors(item, 'target');
  42711. const targetNodes = this.getNeighbors(item, 'source');
  42712. // 指出节点, 如果没有其他链接,隐藏
  42713. for (let i = 0; i < sourceNodes.length; i++) {
  42714. const sourceNode = sourceNodes[i];
  42715. const model = sourceNode.getModel();
  42716. let nodes = this.getNeighbors(sourceNode);
  42717. // if (nodes && exceptNode) {
  42718. // nodes = nodes.filter((item) => item.id !== exceptNode);
  42719. // }
  42720. if (nodes.length === 1) {
  42721. res.push({ id: model.id });
  42722. }
  42723. }
  42724. // 指入节点, 如果没有其他链接或者没有指入节点隐藏,隐藏
  42725. for (let i = 0; i < targetNodes.length; i++) {
  42726. const targetNode = targetNodes[i];
  42727. const model = targetNode.getModel();
  42728. let nodes = this.getNeighbors(targetNode);
  42729. let targetNodeNodes = this.getNeighbors(targetNode, 'source');
  42730. // if (nodes && exceptNode) {
  42731. // nodes = nodes.filter((item) => item.id !== exceptNode);
  42732. // }
  42733. // if (targetNodeNodes && exceptNode) {
  42734. // targetNodeNodes = targetNodeNodes.filter((item) => item.id !== exceptNode);
  42735. // }
  42736. if (nodes.length === 1 || targetNodeNodes.length === 0) {
  42737. res.push({ id: model.id });
  42738. } else {
  42739. const result = [];
  42740. this._collapseFunc(targetNode, result);
  42741. res.push({ id: model.id, children: result });
  42742. }
  42743. }
  42744. return res;
  42745. }
  42746. _expandCollapseNode(data, type = 'hide') {
  42747. if (!data) {
  42748. return;
  42749. }
  42750. data.forEach((item) => {
  42751. if (type === 'hide') {
  42752. this.hideItem(item.id);
  42753. } else {
  42754. this.showItem(item.id);
  42755. // 如果是把之前的折叠也展开了, 就要把之前的折叠数据删除
  42756. if (this.isCollpased(item.id)) {
  42757. delete this.collpasedData[item.id];
  42758. }
  42759. }
  42760. if (item.children) {
  42761. this._expandCollapseNode(item.children, type);
  42762. }
  42763. });
  42764. }
  42765. /**
  42766. * @function G6Render.prototype.showItem
  42767. * @description 显示指定的元素。若 item 为节点,则相关边也会随之显示。而show() 则将只显示自身。
  42768. * @param {string|Object} item - 元素 ID 或元素实例。
  42769. * @param {boolean} [stack] - 操作是否入 undo & redo 栈,当实例化 Graph 时设置 enableStack 为 true 时,默认情况下会自动入栈,入栈以后,就支持 undo & redo 操作,如果不需要,则设置该参数为 false 即可。
  42770. * @param {Object} graph - graph实例。
  42771. */
  42772. showItem(item, stack, graph = this.graph) {
  42773. graph.showItem(item, stack);
  42774. }
  42775. /**
  42776. * @function G6Render.prototype.showItem
  42777. * @description 隐藏指定元素。若 item 为节点,则相关边也会随之隐藏。而 hide() 则将只隐藏自身。
  42778. * @param {string|Object} item - 元素 ID 或元素实例。
  42779. * @param {boolean} [stack] -操作是否入 undo & redo 栈,当实例化 Graph 时设置 enableStack 为 true 时,默认情况下会自动入栈,入栈以后,就支持 undo & redo 操作,如果不需要,则设置该参数为 false 即可。
  42780. * @param {Object} graph - graph实例。
  42781. */
  42782. hideItem(item, stack, graph = this.graph) {
  42783. graph.hideItem(item, stack);
  42784. }
  42785. /**
  42786. * @function G6Render.prototype.show
  42787. * @description 显示元素。只显示 item 自身,若需要在显示节点的同时显示相关边,应调用showItem(item)。
  42788. * @param {Object} item - 元素实例。
  42789. */
  42790. show(item) {
  42791. item.show();
  42792. }
  42793. /**
  42794. * @function G6Render.prototype.hide
  42795. * @description 隐藏元素。只隐藏 item 自身,若需要在隐藏节点的同时隐藏相关边,应调用 hideItem(item)。
  42796. * @param {Object} item - 元素实例。
  42797. */
  42798. hide(item) {
  42799. item.hide();
  42800. }
  42801. /**
  42802. * @function G6Render.prototype.changeVisibility
  42803. * @description 更改元素是否显示。
  42804. * @param {Object} item - 元素实例。
  42805. * @param {boolean} visible - 是否显示元素,true 为显示,false 为隐藏。
  42806. */
  42807. changeVisibility(item, visible) {
  42808. item.changeVisibility(visible);
  42809. }
  42810. /**
  42811. * @function G6Render.prototype.isVisible
  42812. * @description 查询元素显示状态。
  42813. * @param {Object} item - 元素实例。
  42814. * @return {boolean} - 返回值为 true,则表示当前元素处于显示状态,否则处于隐藏状态。
  42815. */
  42816. isVisible(item) {
  42817. return item.isVisible();
  42818. }
  42819. /**
  42820. * @function G6Render.prototype.getModel
  42821. * @description 获取元素的数据模型。
  42822. * @param {Object} item - 元素实例。
  42823. * @return {KnowledgeGraph.Data} - 返回值为节点的数据模型。
  42824. */
  42825. getModel(item) {
  42826. return item.getModel();
  42827. }
  42828. /**
  42829. * @function G6Render.prototype.addItem
  42830. * @description 新增元素(节点和边)。
  42831. * @param {Object} graph - graph实例。
  42832. * @param {string} type - 元素类型,可选值为 'node'、'edge'
  42833. * @param {Object} model - 元素的数据模型,具体内容参见元素配置项。
  42834. */
  42835. addItem(type, model, graph = this.graph) {
  42836. graph.addItem(type, model);
  42837. }
  42838. /**
  42839. * @function G6Render.prototype.addItem
  42840. * @description 删除元素。
  42841. * @param {string|Object} item - 元素 ID 或元素实例
  42842. * @param {Object} graph - graph实例。
  42843. */
  42844. removeItem(item, graph = this.graph) {
  42845. graph.removeItem(item);
  42846. }
  42847. /**
  42848. * @function G6Render.prototype.updateItem
  42849. * @description 更新元素,包括更新数据、样式等。
  42850. * @param {Object} graph - graph实例。
  42851. * @param {string|Object} item - 元素 ID 或元素实例。
  42852. * @param {Object} model - 元素的数据模型,具体内容参见元素配置项。
  42853. */
  42854. updateItem(item, model, graph = this.graph) {
  42855. graph.updateItem(item, model);
  42856. }
  42857. /**
  42858. * @function G6Render.prototype.refreshItem
  42859. * @description 刷新指定元素。
  42860. * @param {Object} graph - graph实例。
  42861. * @param {string|Object} item - 元素 ID 或元素实例。
  42862. */
  42863. refreshItem(item, graph = this.graph) {
  42864. graph.refreshItem(item);
  42865. }
  42866. /**
  42867. * @function G6Render.prototype.refreshPositions
  42868. * @description 当节点位置发生变化时,刷新所有节点位置,并重计算边的位置。
  42869. * @param {Object} graph - graph实例。
  42870. */
  42871. refreshPositions(graph = this.graph) {
  42872. graph.refreshPositions();
  42873. }
  42874. /**
  42875. * @function G6Render.prototype.on
  42876. * @description graph监听事件
  42877. * @param {Object} graph - graph实例。
  42878. * @param {string} eventName - 事件名,可选事件名参见 Event。
  42879. * @param {Function} handler - 监听函数。
  42880. */
  42881. on(eventName, handler, graph = this.graph) {
  42882. graph.on(eventName, handler);
  42883. }
  42884. /**
  42885. * @function G6Render.prototype.off
  42886. * @description graph关闭事件
  42887. * @param {Object} graph - graph实例。
  42888. * @param {string} eventName - 事件名,可选事件名参见 Event。
  42889. * @param {Function} handler - 监听函数。
  42890. */
  42891. off(eventName, handler, graph = this.graph) {
  42892. graph.off(eventName, handler);
  42893. }
  42894. /**
  42895. * @function G6Render.prototype.toDataURL
  42896. * @description 转换成图片
  42897. * @param {Object} graph - graph实例。
  42898. * @param {string} type - 图片类型 'image/png' / 'image/jpeg' / 'image/webp' / 'image/bmp'。
  42899. * @param {string} [backgroundColor] - 图片的背景色,可选,不传值时将导出透明背景的图片。
  42900. * @return {string} 返回值表示生成的图片的 URL。
  42901. */
  42902. toDataURL(type, backgroundColor, graph = this.graph) {
  42903. graph.toDataURL(type, backgroundColor);
  42904. }
  42905. /**
  42906. * @function G6Render.prototype.bindNodeDefaultDragEvent
  42907. * @description 给graph的节点绑定默认的拖拽事件
  42908. *
  42909. * @param {Object} graph - graph实例。
  42910. */
  42911. bindNodeDefaultDragEvent(graph = this.graph) {
  42912. graph.on('node:dragstart', function (e) {
  42913. refreshDragedNodePosition(e);
  42914. });
  42915. graph.on('node:drag', function (e) {
  42916. refreshDragedNodePosition(e);
  42917. });
  42918. graph.on('node:dragend', function (e) {
  42919. e.item.get('model').fx = null;
  42920. e.item.get('model').fy = null;
  42921. });
  42922. }
  42923. /**
  42924. * @function G6Render.prototype.stopDefaultEventPropagation
  42925. * @description 阻止点击事件冒泡
  42926. * @param {Object} graph - graph实例。
  42927. */
  42928. stopDefaultEventPropagation(graph = this.graph) {
  42929. graph.on('click', function (e) {
  42930. e.stopPropagation();
  42931. });
  42932. graph.on('mousedown', function (e) {
  42933. e.stopPropagation();
  42934. });
  42935. graph.on('mouseover', function (e) {
  42936. e.stopPropagation();
  42937. });
  42938. graph.on('mouseout', function (e) {
  42939. e.stopPropagation();
  42940. });
  42941. }
  42942. /**
  42943. * @function G6Render.prototype.clear
  42944. * @description 清除画布元素
  42945. * @param {Object} graph - graph实例。
  42946. */
  42947. clear(graph = this.graph) {
  42948. graph.clear();
  42949. }
  42950. /**
  42951. * @function G6Render.prototype.destroy
  42952. * @description 销毁画布
  42953. * @param {Object} graph - graph实例。
  42954. */
  42955. destroy(graph = this.graph) {
  42956. graph.destroy();
  42957. }
  42958. }
  42959. /**
  42960. * @description 更新拖拽后节点的x ,y
  42961. */
  42962. function refreshDragedNodePosition(e) {
  42963. const model = e.item.get('model');
  42964. model.fx = e.x;
  42965. model.fy = e.y;
  42966. model.x = e.x;
  42967. model.y = e.y;
  42968. return model;
  42969. }
  42970. // EXTERNAL MODULE: ./node_modules/lodash.clonedeep/index.js
  42971. var lodash_clonedeep = __webpack_require__(465);
  42972. var lodash_clonedeep_default = /*#__PURE__*/__webpack_require__.n(lodash_clonedeep);
  42973. ;// CONCATENATED MODULE: ./src/common/overlay/KnowledgeGraph.js
  42974. /**
  42975. * @class KnowledgeGraph
  42976. * @category iServer KnowledgeGraph
  42977. * @classdesc KnowledgeGraph知识图谱
  42978. * @version 11.1.0
  42979. * @param { KnowledgeGraph.Config } config - 创建graph实例的配置项。
  42980. * @usage
  42981. */
  42982. /**
  42983. * @typedef {Object} KnowledgeGraph.Data - 创建graph实例的数据项。
  42984. * @property {Array.<KnowledgeGraph.Node>} data.nodes - 创建graph节点。
  42985. * @property {Array.<KnowledgeGraph.Edge>} data.edges - 创建graph边。
  42986. */
  42987. /**
  42988. * @typedef {Object} KnowledgeGraph.Config - 创建graph实例的配置项。
  42989. * @property {string | HTMLElement} container - 创建的容器 id 或容器本身, 默认是'knowledgeGraph'。
  42990. * @property {number} width - 图的宽度, 默认是container的width。
  42991. * @property {number} height - 图的高度,默认是container的height。
  42992. * @property {Array.<number>} [center] - 中心点的渲染坐标。可以通过KnowledgeGraph.prototype.getViewPortCenterPoint获取。
  42993. * @property {number} [zoom] - 缩放比例。
  42994. * @property {number} [minZoom] - 最小缩放比例。若 fitView、zoom、zoomTo 等操作导致图的缩放比例小于该值,则将使用该值进行缩放,并返回 false。
  42995. * @property {number} [maxZoom] - 最大缩放比例。若 fitView、zoom、zoomTo 等操作导致图的缩放比例大于该值,则将使用该值进行缩放,并返回 false。
  42996. * @property {KnowledgeGraph.Layout} [layout] - 布局。
  42997. * @property {boolean} [animate=true] - 是否开启动画。
  42998. * @property {boolean} [autoResize=true] - 当视口变换时,是否自动重绘。
  42999. * @property {KnowledgeGraph.NodeStyle} [defaultNode] - 默认状态下节点的配置,比如 type, size, color。会被写入的 data 覆盖。
  43000. * @property {KnowledgeGraph.EdgeStyle} [defaultEdge] - 默认状态下边的配置,比如 type, size, color。会被写入的 data 覆盖。
  43001. * @property {KnowledgeGraph.NodeStyle} [nodeHighlightStyle] - 鼠标移入节点高亮样式。默认样式:{strokeColor: 'blue',stroke: 10, opacity: 0.8}。
  43002. * @property {KnowledgeGraph.EdgeStyle} [edgeHighlightStyle] - 鼠标移入边高亮样式。默认样式:{strokeColor: 'blue',stroke: 10, opacity: 0.8}。
  43003. * @property {boolean} [highlightNode = true] - 鼠标移入是否高亮节点。
  43004. * @property {boolean} [highlightEdge = true] - 鼠标移入是否高亮边。
  43005. * @property {boolean} [showToolBar = true] - 是否打开工具条, 包含放大,缩小,切换到实际大小功能。
  43006. * @property {boolean} [showContextMenu = true] - 是否打开节点的右键菜单, 包含展开\折叠、隐藏功能。
  43007. * @property {boolean} [dragCanvas = true] - 是否可以拖拽canvas。
  43008. * @property {boolean} [zoomCanvas = true] - 是否可以缩放canvas。
  43009. * @property {boolean} [dragNode = true] - 是否可以拖拽node节点。
  43010. * @property {number} [nodeLabelMaxWidth] - node节点的标签开启省略号配置项,大于该宽度使用省略号。
  43011. */
  43012. /**
  43013. * @typedef {Object} KnowledgeGraph.Layout - 布局。
  43014. * @property {string} [type='fruchterman'] - 布局类型, 可选值:['fruchterman']。 默认'fruchterman'。
  43015. */
  43016. /**
  43017. * @typedef {Object} KnowledgeGraph.Node - node节点配置项。
  43018. * @property {string} id - 元素的标识 ID,必须是唯一的 string
  43019. * @property {string} [category] - 分类。
  43020. * @property {number} [x] - x坐标。
  43021. * @property {number} [y] - y坐标。
  43022. * @property {number} [size=20] - 节点的大小。
  43023. * @property {Array.<number>|number} [anchorPoints=20] - 指定边连入节点的连接点的位置(相对于该节点而言),可以为空。例如: [0, 0],代表节点左上角的锚点,[1, 1],代表节点右下角的锚点。
  43024. * @property {string} [type] - 元素的类型,不传则使用默认值,节点默认类型为 'circle'。可选值['circle','rect','ellipse','diamond', 'image']
  43025. * @property {string} [label] - 元素的文本标签,有该字段时默认会渲染 label 。
  43026. * @property {KnowledgeGraph.NodeLabelCfg} [labelCfg] - 元素文本标签的配置项,详见各子模块内容。
  43027. * @property {KnowledgeGraph.NodeStyle} [style] - 样式属性。
  43028. */
  43029. /**
  43030. * @typedef {Object} KnowledgeGraph.Edge - edge边配置项。
  43031. * @property {string} [source] -起始点 id 。
  43032. * @property {string} [target] - 结束点 id 。
  43033. * @property {number} [sourceAnchor] - 边的起始节点上的锚点的索引值。
  43034. * @property {number} [targetAnchor] - 边的终止节点上的锚点的索引值。
  43035. * @property {string} [type='line'] - 指定边的类型,可以是内置边的类型名称,也可以是自定义边的名称。默认为 'line'。可选值['line','arc','polyline','quadratic']。
  43036. * @property {string} [label] - 文本文字,如果没有则不会显示。
  43037. * @property {KnowledgeGraph.EdgeLabelCfg} [labelCfg] - 配置标签文本。
  43038. * @property {KnowledgeGraph.EdgeStyle} [style] - 通过 style 配置来修改边的填充色、边框颜色、阴影等属性,具体配置属性见:图形样式属性。
  43039. */
  43040. /**
  43041. * @typedef {Object} KnowledgeGraph.NodeLabelCfg - node节点配置项。
  43042. * @property {string} [position] - 文本相对于节点的位置,目前支持的位置有:'center','top','left','right','bottom'。默认为 'center'。modelRect 节点不支持该属性。
  43043. * @property {KnowledgeGraph.TextStyle} [style] - 标签的样式属性。
  43044. * @property {number} [offset] - 文本的偏移,position 为 'bottom' 时,文本的上方偏移量;position 为 'left' 时,文本的右方偏移量;以此类推在其他 position 时的情况。modelRect 节点的 offset 为左边距。
  43045. */
  43046. /**
  43047. * @typedef {Object} KnowledgeGraph.NodeStyle - 节点样式通用配置项。
  43048. * @property {string} [fill] - 节点填充色。
  43049. * @property {string} [stroke] - 节点的描边颜色。
  43050. * @property {number} [lineWidth] - 描边宽度。
  43051. * @property {Array.<number>} [lineDash] -描边虚线,数组代表实、虚长度。
  43052. * @property {number} [fillOpacity] - 设置填充的 alpha 或透明值。
  43053. * @property {string} [shadowColor] - 阴影颜色。
  43054. * @property {number} [shadowBlur] - 阴影范围。
  43055. * @property {number} [shadowOffsetX] - 阴影 x 方向偏移量。
  43056. * @property {number} [shadowOffsetY] - 阴影 y 方向偏移量。
  43057. * @property {number} [opacity] - 设置绘图的当前 alpha 或透明值。
  43058. * @property {string} [cursor] - 鼠标在该边上时的鼠标样式,CSS 的 cursor 选项都支持。
  43059. */
  43060. /**
  43061. * @typedef {Object} KnowledgeGraph.TextStyle - 文本样式。
  43062. * @property {string} [textAlign] - 设置文本内容的当前对齐方式。支持的属性:center / end / left / right / start,默认值为 start。
  43063. * @property {string} [textBaseline] - 设置在绘制文本时使用的当前文本基线。支持的属性:top / middle / bottom / alphabetic / hanging。默认值为 bottom。
  43064. * @property {string} [fontStyle] - 字体样式。对应 font-style。
  43065. * @property {string} [fontVariant] - 设置为小型大写字母字体。对应 font-variant。
  43066. * @property {number} [fontWeight] - 字体粗细。对应 font-weight。
  43067. * @property {number} [fontSize] - 字体大小。对应 font-size, 边标签文本默认大小是7。
  43068. * @property {string} [fontFamily] - 字体系列。对应 font-family。
  43069. * @property {number} [lineHeight] - 行高。对应 line-height。
  43070. */
  43071. /**
  43072. * @typedef {Object} KnowledgeGraph.EdgeLabelCfg - node节点配置项。
  43073. * @property {string} [position] - 文本相对于边的位置,目前支持的位置有:'start','middle','end'。默认为'middle'。
  43074. * @property {number} [refX] - 标签在 x 方向的偏移量。
  43075. * @property {number} [refY] -标签在 y 方向的偏移量。
  43076. * @property {boolean} [autoRotate=true] - 标签文字是否跟随边旋转,默认: true。
  43077. * @property { KnowledgeGraph.TextStyle} [style] - 标签的样式属性,默认: {fontSize: 3,fill: '#333'}。
  43078. */
  43079. /**
  43080. * @typedef {Object} KnowledgeGraph.EdgeStyle - 边样式通用配置项。
  43081. * @property {string} [stroke] - 边的颜色。
  43082. * @property {number} [lineWidth] - 边宽度。
  43083. * @property {number} [lineAppendWidth] -边响应鼠标事件时的检测宽度,当 lineWidth 太小而不易选中时,可以通过该参数提升击中范围。
  43084. * @property {boolean|Object} [endArrow=true] - 为 true 时在边的结束端绘制默认箭头,为 false 时不绘制结束端箭头, 默认值{path: 'M 0,0 L 2,1 L 2,-1 Z'}
  43085. * @property {boolean|Object} [startArrow] - 为 true 时在边的开始端绘制默认箭头,为 false 时不绘制结束端箭头。
  43086. * @property {number} [strokeOpacity] - 边透明度。
  43087. * @property {string} [shadowColor] - 阴影颜色。
  43088. * @property {number} [shadowBlur] - 阴影模糊程度。
  43089. * @property {number} [shadowOffsetX] - 阴影 x 方向偏移量。
  43090. * @property {number} [shadowOffsetY] - 阴影 y 方向偏移量。
  43091. * @property {Array.<number>} [lineDash] - 设置线的虚线样式,可以指定一个数组。一组描述交替绘制线段和间距(坐标空间单位)长度的数字。 如果数组元素的数量是奇数, 数组的元素会被复制并重复。例如, [5, 15, 25] 会变成 [5, 15, 25, 5, 15, 25]。
  43092. * @property {string} [cursor] - 鼠标在该边上时的鼠标样式,CSS 的 cursor 选项都支持。
  43093. */
  43094. /**
  43095. * @typedef {Object} KnowledgeGraph.AnimateConfig - 动画配置项。
  43096. * @property {number} [duration= 500] - 一次动画的时长。
  43097. * @property {string} [easing='linearEasing'] - 动画函数。
  43098. * @property {number} [delay=0] - 是否重复执行动画。
  43099. * @property {boolean} [repeat=false] - 边透明度。
  43100. * @property {string} [shadowColor] - 阴影颜色。
  43101. */
  43102. class KnowledgeGraph {
  43103. constructor(config, type = 'G6') {
  43104. /**
  43105. * @member {string} KnowledgeGraph.prototype.graph
  43106. * @description graph实例。
  43107. */
  43108. this.graph = null;
  43109. this.config = lodash_clonedeep_default()(config);
  43110. this.graphRender = null;
  43111. this.type = type;
  43112. this.createGraphRender(this.type);
  43113. this.config = this.graphRender._getGraphConfig(this.config);
  43114. this.createGraph(this.config);
  43115. this.CLASS_NAME = 'SuperMap.KnowledgeGraph';
  43116. }
  43117. /**
  43118. * @function KnowledgeGraph.dataFromGraphMap
  43119. * @description 将iServer GraphMap数据转换成KnowledgeGraph数据。
  43120. * @param {Object} queryResult - iServer知识图谱服务query数据。
  43121. * @param {Object} graphMap - iServer知识图谱服务GraphMap数据(data.graphMap)。
  43122. * @return {KnowledgeGraph.Data} 返回数据。
  43123. */
  43124. static dataFromGraphMap(queryResult, graphMap) {
  43125. return transformGraphMap(queryResult, graphMap);
  43126. }
  43127. /**
  43128. * @function KnowledgeGraph.dataFromKnowledgeGraphQuery
  43129. * @description 将iServer KnowledgeGraphService query数据转换成KnowledgeGraph数据。
  43130. * @param {Object} queryResult - iServer知识图谱服务query数据。
  43131. * @return {KnowledgeGraph.Data} 返回数据。
  43132. */
  43133. static dataFromKnowledgeGraphQuery(queryResult) {
  43134. return transformGraphMap(queryResult);
  43135. }
  43136. /**
  43137. * @function KnowledgeGraph.prototype.handleNodeStatus
  43138. * @description 展开、折叠、隐藏节点
  43139. * @param {Object} data - 展开 折叠 隐藏的对象, eg: {expand:['id1'], collapse:['id2'], hidden:['id3']}
  43140. */
  43141. handleNodeStatus(data) {
  43142. const { expand, collapse, hidden } = data;
  43143. // 解析expand参数,里面的节点再执行一次查询显示出来
  43144. this.expandNodes(expand);
  43145. // 解析collapse参数,折叠这个里面的节点
  43146. this.collapseNodes(collapse);
  43147. // 解析hidden,隐藏这个里面额的节点
  43148. this.hideNodes(hidden);
  43149. }
  43150. /**
  43151. * @function KnowledgeGraph.prototype.expandNodes
  43152. * @description 展开节点。
  43153. * @param {Array.<string>} expandData - 元素 ID 数组。
  43154. */
  43155. expandNodes(expandData) {
  43156. if (!expandData) {
  43157. return;
  43158. }
  43159. expandData.forEach((item) => {
  43160. this.expandNode(item + '');
  43161. });
  43162. }
  43163. /**
  43164. * @function KnowledgeGraph.prototype.collapseNodes
  43165. * @description 折叠节点。
  43166. * @param {Array.<string>} collapseData - 元素 ID 数组。
  43167. */
  43168. collapseNodes(collapseData) {
  43169. if (!collapseData) {
  43170. return;
  43171. }
  43172. collapseData.forEach((item) => {
  43173. this.collapseNode(item + '');
  43174. });
  43175. }
  43176. /**
  43177. * @function KnowledgeGraph.prototype.hideNodes
  43178. * @description 隐藏节点。
  43179. * @param {Array.<string>} hiddenData - 元素 ID 数组。
  43180. */
  43181. hideNodes(hiddenData) {
  43182. if (!hiddenData) {
  43183. return;
  43184. }
  43185. hiddenData.forEach((item) => {
  43186. this.hideItem(item + '');
  43187. });
  43188. }
  43189. /**
  43190. * @function KnowledgeGraph.prototype.createGraphRender
  43191. * @description 创建KnowledgeGraphRender
  43192. * @param {string} type -类型, 默认是G6。
  43193. * @private
  43194. */
  43195. createGraphRender(type) {
  43196. if (type === 'G6') {
  43197. this.graphRender = new G6Render();
  43198. }
  43199. }
  43200. /**
  43201. * @function KnowledgeGraph.prototype.createGraph
  43202. * @description 创建KnowledgeGraph的guaph实例。
  43203. * @param {Object} config - graph配置项。
  43204. * @returns {Object} graph实例。
  43205. */
  43206. createGraph(config) {
  43207. const graph = this.initGraph(config);
  43208. this.graph = graph;
  43209. this.autoResize();
  43210. return graph;
  43211. }
  43212. /**
  43213. * @function KnowledgeGraph.prototype.getGraph
  43214. * @description 获取KnowledgeGraph的guaph实例。
  43215. * @returns {Object} graph实例。
  43216. */
  43217. getGraph() {
  43218. return this.graph;
  43219. }
  43220. /**
  43221. * @function KnowledgeGraph.prototype.autoResize
  43222. * @description 浏览器窗口大小发生改变时,重新设置canvas画布的大小,重新渲染。
  43223. */
  43224. autoResize() {
  43225. if (this.config && this.config.autoResize !== false) {
  43226. this.graphRender.autoResize();
  43227. }
  43228. }
  43229. /**
  43230. * @function KnowledgeGraph.prototype.zoom
  43231. * @description 改变视口的缩放比例,在当前画布比例下缩放,是相对比例。
  43232. * @param {number} ratio 缩放比例。
  43233. * @param {Object} [center] 以 center 的 x、y 坐标为中心缩放,如果省略了 center 参数,则以元素当前位置为中心缩放。
  43234. * @param {boolean} [animate] 是否开启动画。
  43235. * @param {KnowledgeGraph.AnimateConfig} [animateCfg] 若带有动画,可配置动画。若未配置,则跟随 graph 的 animateCfg 参数。
  43236. */
  43237. zoom(ratio, center, animate, animateCfg) {
  43238. this.graphRender.zoom(ratio, center, animate, animateCfg);
  43239. }
  43240. /**
  43241. * @function KnowledgeGraph.prototype.zoomTo
  43242. * @description 改变视口的缩放比例,在当前画布比例下缩放,是相对比例。
  43243. * @param {number} ratio 缩放比例。
  43244. * @param {Object} [center] 以 center 的 x、y 坐标为中心缩放,如果省略了 center 参数,则以元素当前位置为中心缩放。
  43245. * @param {boolean} [animate] 是否开启动画。
  43246. * @param {KnowledgeGraph.AnimateConfig} [animateCfg] 若带有动画,可配置动画。若未配置,则跟随 graph 的 animateCfg 参数。
  43247. */
  43248. zoomTo(ratio, center, animate, animateCfg) {
  43249. this.graphRender.zoomTo(ratio, center, animate, animateCfg);
  43250. }
  43251. /**
  43252. * @function KnowledgeGraph.prototype.fitView
  43253. * @description 让画布内容适应视口。
  43254. * @param {Array.<number>|number} [padding] [top, right, bottom, left] 四个方向上的间距值。
  43255. * @param {Object} [rules] fitView 的规则,参数如下:{ onlyOutOfViewPort?: boolean; direction?: 'x' / 'y' / 'both'; ratioRule?: 'max' / 'min}。
  43256. * @param {boolean} [animate] 是否开启动画。
  43257. * @param {KnowledgeGraph.AnimateConfig} [animateCfg] 若带有动画,可配置动画。若未配置,则跟随 graph 的 animateCfg 参数。
  43258. */
  43259. fitView(padding, rules, animate, animateCfg) {
  43260. this.graphRender.fitView(padding, rules, animate, animateCfg);
  43261. }
  43262. /**
  43263. * @function KnowledgeGraph.prototype.fitCenter
  43264. * @description 平移图到中心将对齐到画布中心,但不缩放。优先级低于 fitView。
  43265. * @param {boolean} [animate] 是否开启动画。
  43266. * @param {KnowledgeGraph.AnimateConfig} [animateCfg] 若带有动画,可配置动画,参见基础动画教程。若未配置,则跟随 graph 的 animateCfg 参数。
  43267. */
  43268. fitCenter(animate, animateCfg) {
  43269. this.graphRender.fitCenter(animate, animateCfg);
  43270. }
  43271. /**
  43272. * @function KnowledgeGraph.prototype.getGraphCenterPoint
  43273. * @description 获取图内容的中心绘制坐标。
  43274. * @return {Object} 包含的属性:x 和 y 属性,分别表示渲染坐标下的 x、y 值。
  43275. */
  43276. getGraphCenterPoint() {
  43277. return this.graphRender.getGraphCenterPoint();
  43278. }
  43279. /**
  43280. * @function KnowledgeGraph.prototype.getViewPortCenterPoint
  43281. * @description 获取窗口的中心绘制坐标。
  43282. * @return {Object} 包含的属性:x 和 y 属性,分别表示渲染坐标下的 x、y 值。
  43283. */
  43284. getViewPortCenterPoint() {
  43285. return this.graphRender.getViewPortCenterPoint();
  43286. }
  43287. /**
  43288. * @function KnowledgeGraph.prototype.getZoom
  43289. * @description 获取当前视口的缩放比例。
  43290. * @return {number} 返回值表示当前视口的缩放比例, 默认值为 1。
  43291. */
  43292. getZoom() {
  43293. return this.graphRender.getZoom();
  43294. }
  43295. /**
  43296. * @function KnowledgeGraph.prototype.getMinZoom
  43297. * @description 获取 graph 当前允许的最小缩放比例。
  43298. * @return {number} 返回值表示当前视口的最小缩放比例。
  43299. */
  43300. getMinZoom() {
  43301. return this.graphRender.getMinZoom();
  43302. }
  43303. /**
  43304. * @function KnowledgeGraph.prototype.setMinZoom
  43305. * @description 设置 graph 当前允许的最小缩放比例。
  43306. * @param {number} ratio 缩放比例。
  43307. */
  43308. setMinZoom(ratio) {
  43309. this.graphRender.setMinZoom(ratio);
  43310. }
  43311. /**
  43312. * @function KnowledgeGraph.prototype.getMaxZoom
  43313. * @description 获取 graph 当前允许的最大缩放比例。
  43314. * @return {number} 返回值表示当前视口的最大缩放比例。
  43315. */
  43316. getMaxZoom() {
  43317. return this.graphRender.getMaxZoom();
  43318. }
  43319. /**
  43320. * @function KnowledgeGraph.prototype.setMaxZoom
  43321. * @description 设置 graph 当前允许的最大缩放比例。
  43322. * @param {number} ratio 缩放比例。
  43323. */
  43324. setMaxZoom(ratio) {
  43325. this.graphRender.setMaxZoom(ratio);
  43326. }
  43327. /**
  43328. * @function KnowledgeGraph.prototype.getWidth
  43329. * @description获取 graph 当前的宽度。
  43330. * @return {number} graph 当前的宽度。
  43331. */
  43332. getWidth() {
  43333. return this.graphRender.getWidth();
  43334. }
  43335. /**
  43336. * @function KnowledgeGraph.prototype.getHeight
  43337. * @description 获取 graph 当前的高度。
  43338. * @return {number} graph 当前的高度。
  43339. */
  43340. getHeight() {
  43341. return this.graphRender.getHeight();
  43342. }
  43343. /**
  43344. * @function KnowledgeGraph.prototype.initGraph
  43345. * @description 创建KnowledgeGraph实例
  43346. * @param {Object} config - graph配置项。
  43347. * @returns {Object} graph实例。
  43348. */
  43349. initGraph(config) {
  43350. const graph = this.graphRender.initGraph(config);
  43351. this.graph = graph;
  43352. const cb = () => {
  43353. if (this.config.zoom !== undefined) {
  43354. this.zoom(this.config.zoom);
  43355. }
  43356. if (this.config.center !== undefined) {
  43357. this.graphRender.setCenter({ x: this.config.center[0], y: this.config.center[1] });
  43358. }
  43359. };
  43360. this.graph.on('beforelayout', cb);
  43361. return graph;
  43362. }
  43363. /**
  43364. * @function KnowledgeGraph.prototype.setData
  43365. * @description 设置默认数据
  43366. * @param {KnowledgeGraph.Data} data - graph数据。
  43367. * @param {Object} [graph = this.graph] - graph实例。
  43368. */
  43369. setData(data, graph = this.graph) {
  43370. data = data || { nodes: [], edges: [] };
  43371. if (this.config && this.config.nodeLabelMaxWidth) {
  43372. data.nodes = this.nodeLabelOpenEllipsis(this.config.nodeLabelMaxWidth, data.nodes);
  43373. }
  43374. this.graphRender.setData(data, graph);
  43375. this.render(graph); // 渲染图
  43376. this.data = data;
  43377. }
  43378. /**
  43379. * @function KnowledgeGraph.prototype.render
  43380. * @description 根据提供的数据渲染视图。
  43381. * @param {Object} [graph = this.graph] - graph实例。
  43382. */
  43383. render(graph = this.graph) {
  43384. graph && this.graphRender.render(graph);
  43385. }
  43386. /**
  43387. * @function KnowledgeGraph.prototype.updateGraph
  43388. * @description 更新数据
  43389. * @param {KnowledgeGraph.Data} data - graph数据。
  43390. * @param {Object} [graph = this.graph] - graph实例。
  43391. */
  43392. updateGraph(data, graph = this.graph) {
  43393. graph && this.graphRender.updateGraph(data, graph);
  43394. }
  43395. /**
  43396. * @function KnowledgeGraph.prototype.refresh
  43397. * @description 改变画布大小。
  43398. */
  43399. refresh() {
  43400. return this.graphRender.refresh();
  43401. }
  43402. /**
  43403. * @function KnowledgeGraph.prototype.changeSize
  43404. * @description 改变画布大小。
  43405. * @param {number} width - 宽度。
  43406. * @param {number} height - 高度。
  43407. */
  43408. changeSize(width, height) {
  43409. return this.graphRender.changeSize(width, height);
  43410. }
  43411. /**
  43412. * @function KnowledgeGraph.prototype.resize
  43413. * @description 改变画布大小后,重新渲染。
  43414. * @param {number} width - 宽度。
  43415. * @param {number} height - 高度。
  43416. */
  43417. resize(width, height) {
  43418. this.graphRender.changeSize(width, height);
  43419. this.graphRender.refresh();
  43420. }
  43421. /**
  43422. * @function KnowledgeGraph.prototype.getContainer
  43423. * @description 获取 Graph 的 DOM 容器。
  43424. * @return {HTMLElement} DOM 容器。
  43425. */
  43426. getContainer() {
  43427. return this.graphRender.getContainer();
  43428. }
  43429. /**
  43430. * @function KnowledgeGraph.prototype.getCanvas
  43431. * @description 获取canvas。
  43432. * @return {HTMLElement} canvas。
  43433. */
  43434. getCanvas() {
  43435. return this.graphRender.getCanvas();
  43436. }
  43437. /**
  43438. * @function KnowledgeGraph.prototype.getNodes
  43439. * @description 获取图中所有节点的实例。
  43440. * @return {Array} 返回值表示图中所有节点的实例。
  43441. */
  43442. getNodes() {
  43443. return this.graphRender.getNodes();
  43444. }
  43445. /**
  43446. * @function KnowledgeGraph.prototype.getEdges
  43447. * @description 获取图中所有节点的实例。这里返回的是边的实例,而不是边的数据项。
  43448. * @return {Array} 返回值表示图中所有边的实例。
  43449. */
  43450. getEdges() {
  43451. return this.graphRender.getEdges();
  43452. }
  43453. /**
  43454. * @function KnowledgeGraph.prototype.getNeighbors
  43455. * @description 获取邻居节点数组。
  43456. * @param {string | INode} node - 节点 ID 或节点实例。
  43457. * @param {string | undefined} type - ['source'| 'target' | undefined] 邻居类型, 'source' 只获取当前节点的源节点,'target' 只获取当前节点指向的目标节点, 若不指定则返回所有类型的邻居。
  43458. * @return {Array} 返回值符合要求的节点数组。
  43459. */
  43460. getNeighbors(node, type) {
  43461. return this.graphRender.getNeighbors(node, type);
  43462. }
  43463. /**
  43464. * @function KnowledgeGraph.prototype.findById
  43465. * @description 根据 ID,查询对应的元素实例。
  43466. * @param {string} id - 元素 ID。
  43467. * @return {Object} 如果有符合规则的元素实例,则返回第一个匹配的元素实例,否则返回 undefined 。
  43468. */
  43469. findById(id) {
  43470. return this.graphRender.findById(id);
  43471. }
  43472. /**
  43473. * @function KnowledgeGraph.prototype.find
  43474. * @description 获取邻居节点数组。
  43475. * @param {string} type - 元素类型,可选值为 'node'、'edge'
  43476. * @param {Function} fn - 查找的规则。
  43477. * @return {Object} 如果有符合规则的元素实例,则返回第一个匹配的元素实例,否则返回 undefined 。
  43478. */
  43479. find(type, fn) {
  43480. return this.graphRender.find(type, fn);
  43481. }
  43482. /**
  43483. * @function KnowledgeGraph.prototype.findAll
  43484. * @description 获取邻居节点数组。
  43485. * @param {string} type - 元素类型,可选值为 'node'、'edge'。
  43486. * @param {Function} fn - 查找的规则。
  43487. * @return {Object} 如果有符合规则的元素实例,则返回所有元素实例,否则返回 undefined。
  43488. */
  43489. findAll(type, fn) {
  43490. return this.graphRender.findAll(type, fn);
  43491. }
  43492. /**
  43493. * @function KnowledgeGraph.prototype.getEdgesByNode
  43494. * @description 获取与当前节点有关联的所有边。
  43495. * @param {Object} node - node实例。
  43496. * @return {Array} edge实例数组。
  43497. */
  43498. getEdgesByNode(node) {
  43499. return this.graphRender.getEdgesByNode(node);
  43500. }
  43501. /**
  43502. * @function KnowledgeGraph.prototype.getInEdges
  43503. * @description 获取与当前节点关联的所有入边。
  43504. * @param {Object} node - node实例。
  43505. * @return {Array} edge实例数组。
  43506. */
  43507. getInEdges(node) {
  43508. return this.graphRender.getInEdges(node);
  43509. }
  43510. /**
  43511. * @function KnowledgeGraph.prototype.getOutEdges
  43512. * @description 获取与当前节点关联的所有出边。
  43513. * @param {Object} node - node实例。
  43514. * @return {Array} edge实例数组。
  43515. */
  43516. getOutEdges(node) {
  43517. return this.graphRender.getOutEdges(node);
  43518. }
  43519. /**
  43520. * @function KnowledgeGraph.prototype.getSourceByEdge
  43521. * @description 获取当前边的起始节点
  43522. * @param {Object} edge - node实例。
  43523. * @return {Object} 返回值为起始节点的实例。
  43524. */
  43525. getSourceByEdge(edge) {
  43526. return this.graphRender.getSourceByEdge(edge);
  43527. }
  43528. /**
  43529. * @function KnowledgeGraph.prototype.getTargetByEdge
  43530. * @description 获取当前边的终止节点。
  43531. * @param {Object} edge - node实例。
  43532. * @return {Object} 终止节点的实例。
  43533. */
  43534. getTargetByEdge(edge) {
  43535. return this.graphRender.getTargetByEdge(edge);
  43536. }
  43537. /**
  43538. * @function KnowledgeGraph.prototype.expandNode
  43539. * @description 展开当前节点。
  43540. * @param {string} id - 元素 ID。
  43541. */
  43542. expandNode(id) {
  43543. const item = this.findById(id);
  43544. item && this.graphRender.expandNode(item);
  43545. }
  43546. /**
  43547. * @function KnowledgeGraph.prototype.collapseNode
  43548. * @description 收起当前节点。
  43549. * @param {string} id - 元素 ID。
  43550. */
  43551. collapseNode(id) {
  43552. const item = this.findById(id);
  43553. item && this.graphRender.collapseNode(item);
  43554. }
  43555. /**
  43556. * @function KnowledgeGraph.prototype.showItem
  43557. * @description 显示指定的元素。若 item 为节点,则相关边也会随之显示。而show() 则将只显示自身。
  43558. * @param {string|Object} item - 元素 ID 或元素实例。
  43559. * @param {boolean} [stack] - 操作是否入 undo & redo 栈,当实例化 Graph 时设置 enableStack 为 true 时,默认情况下会自动入栈,入栈以后,就支持 undo & redo 操作,如果不需要,则设置该参数为 false 即可。
  43560. */
  43561. showItem(item, stack) {
  43562. this.graphRender.showItem(item, stack);
  43563. }
  43564. /**
  43565. * @function KnowledgeGraph.prototype.showItem
  43566. * @description 隐藏指定元素。若 item 为节点,则相关边也会随之隐藏。而 hide() 则将只隐藏自身。
  43567. * @param {string|Object} item - 元素 ID 或元素实例。
  43568. * @param {boolean} [stack] -操作是否入 undo & redo 栈,当实例化 Graph 时设置 enableStack 为 true 时,默认情况下会自动入栈,入栈以后,就支持 undo & redo 操作,如果不需要,则设置该参数为 false 即可。
  43569. */
  43570. hideItem(item, stack) {
  43571. this.graphRender.hideItem(item, stack);
  43572. }
  43573. /**
  43574. * @function KnowledgeGraph.prototype.show
  43575. * @description 显示元素。只显示 item 自身,若需要在显示节点的同时显示相关边,应调用showItem(item)。
  43576. * @param {Object} item - 元素实例。
  43577. */
  43578. show(item) {
  43579. this.graphRender.show(item);
  43580. }
  43581. /**
  43582. * @function KnowledgeGraph.prototype.hide
  43583. * @description 隐藏元素。只隐藏 item 自身,若需要在隐藏节点的同时隐藏相关边,应调用 hideItem(item)。
  43584. * @param {Object} item - 元素实例。
  43585. */
  43586. hide(item) {
  43587. this.graphRender.hide(item);
  43588. }
  43589. /**
  43590. * @function KnowledgeGraph.prototype.changeVisibility
  43591. * @description 更改元素是否显示。
  43592. * @param {Object} item - 元素实例。
  43593. * @param {boolean} visible - 是否显示元素,true 为显示,false 为隐藏。
  43594. */
  43595. changeVisibility(item, visible) {
  43596. this.graphRender.changeVisibility(item, visible);
  43597. }
  43598. /**
  43599. * @function KnowledgeGraph.prototype.isVisible
  43600. * @description 查询元素显示状态。
  43601. * @param {Object} item - 元素实例。
  43602. * @return {boolean} - 返回值为 true,则表示当前元素处于显示状态,否则处于隐藏状态。
  43603. */
  43604. isVisible(item) {
  43605. return this.graphRender.isVisible(item);
  43606. }
  43607. /**
  43608. * @function KnowledgeGraph.prototype.getModel
  43609. * @description 获取元素的数据模型。
  43610. * @param {Object} item - 元素实例。
  43611. * @return {Object} - 返回值为节点的数据模型。
  43612. */
  43613. getModel(item) {
  43614. return this.graphRender.getModel(item);
  43615. }
  43616. /**
  43617. * @function KnowledgeGraph.prototype.addItem
  43618. * @description 新增元素(节点和边)。
  43619. * @param {string} type - 元素类型,可选值为 'node'、'edge'。
  43620. * @param {Object} model - 元素的数据模型,具体内容参见元素配置项。
  43621. */
  43622. addItem(type, model) {
  43623. return this.graphRender.addItem(type, model);
  43624. }
  43625. /**
  43626. * @function KnowledgeGraph.prototype.removeItem
  43627. * @description 删除元素。
  43628. * @param {string|Object} item - 元素 ID 或元素实例。
  43629. */
  43630. removeItem(item) {
  43631. return this.graphRender.removeItem(item);
  43632. }
  43633. /**
  43634. * @function KnowledgeGraph.prototype.updateItem
  43635. * @description 更新元素,包括更新数据、样式等。
  43636. * @param {string|Object} item - 元素 ID 或元素实例。
  43637. * @param {Object} model - 元素的数据模型,具体内容参见元素配置项。
  43638. */
  43639. updateItem(item, model) {
  43640. return this.graphRender.updateItem(item, model);
  43641. }
  43642. /**
  43643. * @function KnowledgeGraph.prototype.refreshItem
  43644. * @description 刷新指定元素。
  43645. * @param {string|Object} item - 元素 ID 或元素实例。
  43646. */
  43647. refreshItem(item) {
  43648. return this.graphRender.refreshItem(item);
  43649. }
  43650. /**
  43651. * @function KnowledgeGraph.prototype.refreshPositions
  43652. * @description 当节点位置发生变化时,刷新所有节点位置,并重计算边的位置。
  43653. */
  43654. refreshPositions() {
  43655. return this.graphRender.refreshPositions();
  43656. }
  43657. /**
  43658. * @function KnowledgeGraph.prototype.on
  43659. * @description graph监听事件
  43660. * @param {string} eventName - 事件名,可选事件名参见: Node交互事件名、Edge交互事件名、Canvas交互事件名 时机事件
  43661. * 通用事件名: click dbclick mouseenter mousemove mouseout mouseover mouseleave mousedown mouseup contextmenu dragstart drag dragend dragenter dragleave drop keydown keyup wheel touchstart touchmove touchend
  43662. * Node交互事件名: node:通用事件名, 例如 node:click
  43663. * Edge交互事件名: edge:通用事件名, 例如 edge:click
  43664. * Canvas交互事件名: canvas:通用事件名,例如 canvas:click
  43665. * 时机事件:用于监听图的某方法调用前后的时机。
  43666. * beforerender 调用 render 方法之前触发
  43667. * afterrender 调用 render 方法之后触发
  43668. * beforeadditem 调用 addItem 方法之前触发
  43669. * afteradditem 调用 addItem 方法之后触发
  43670. * beforeremoveitem 调用 removeItem 方法之前触发
  43671. * afterremoveitem 调用 removeItem 方法之后触发
  43672. * beforeupdateitem 调用 updateItem 方法之前触发
  43673. * afterupdateitem 调用 updateItem 方法之后触发
  43674. * beforegraphrefresh 调用 refresh 方法之前触发
  43675. * aftergraphrefresh 调用 refresh 方法之后触发
  43676. * beforelayout 布局前触发。调用 graph.render 时会进行布局,因此 render 时会触发。或用户主动调用图的 graph.layout 时触发
  43677. * afterlayout 布局完成后触发。调用 graph.render 时会进行布局,因此 render 时布局完成后会触发。或用户主动调用图的 graph.layout 时布局完成后触发
  43678. * viewportchange 调用 graph.moveTo 或 graph.zoom 均会触发该事件
  43679. * @param {Function} handler - 监听函数。
  43680. */
  43681. on(eventName, handler) {
  43682. this.graphRender.on(eventName, handler);
  43683. }
  43684. /**
  43685. * @function KnowledgeGraph.prototype.off
  43686. * @description graph关闭事件。
  43687. * @param {string} eventName - 事件名,参考on方法的事件名。
  43688. * @param {Function} handler - 监听函数。
  43689. */
  43690. off(eventName, handler) {
  43691. this.graphRender.off(eventName, handler);
  43692. }
  43693. /**
  43694. * @function KnowledgeGraph.prototype.toDataURL
  43695. * @description 转换成图片。
  43696. * @param {string} type - 图片类型 'image/png' / 'image/jpeg' / 'image/webp' / 'image/bmp'。
  43697. * @param {string} [backgroundColor] - 图片的背景色,可选,不传值时将导出透明背景的图片。
  43698. * @return {string} 返回值表示生成的图片的 URL。
  43699. */
  43700. toDataURL(type, backgroundColor) {
  43701. this.graphRender.toDataURL(type, backgroundColor);
  43702. }
  43703. /**
  43704. * @function KnowledgeGraph.prototype.nodeLabelOpenEllipsis
  43705. * @description 转换label的省略号。
  43706. * @param {Object} nodeLabelMaxWidth - node节点标签是否开启省略号
  43707. * @param {Object} nodes - graph的nodes数据。
  43708. * @return {Array} nodes
  43709. */
  43710. nodeLabelOpenEllipsis(nodeLabelMaxWidth, nodes) {
  43711. if (!nodes) {
  43712. return [];
  43713. }
  43714. if (!nodeLabelMaxWidth) {
  43715. return nodes;
  43716. }
  43717. return nodes.map((node) => {
  43718. const fontSize =
  43719. (node.labelCfg && node.labelCfg.fontSize) ||
  43720. (this.defaultNode && this.defaultNode.labelCfg && this.defaultNode.labelCfg.fontSize) ||
  43721. 14;
  43722. node.label = fittingStr(node.label, nodeLabelMaxWidth, fontSize);
  43723. return node;
  43724. });
  43725. }
  43726. /**
  43727. * @function KnowledgeGraph.prototype.clear
  43728. * @description 清除画布元素。
  43729. * @param {Object} [graph = this.graph] - graph实例。
  43730. */
  43731. clear(graph = this.graph) {
  43732. graph && graph.clear();
  43733. }
  43734. /**
  43735. * @function KnowledgeGraph.prototype.destroy
  43736. * @description 销毁画布。
  43737. * @param {Object} [graph = this.graph] - graph实例。
  43738. */
  43739. destroy(graph = this.graph) {
  43740. graph && graph.destroy();
  43741. }
  43742. }
  43743. /**
  43744. * @private
  43745. * @description 大于最大宽度的字符串会返回带有省略号的字符串 xxx...。
  43746. * @param {string} label - 需要处理的字符串。
  43747. * @param {number} maxWidth - 最大宽度。
  43748. * @param {number} fontSize - 字体大小。
  43749. * @returns {string} 处理之后的字符串。
  43750. */
  43751. function fittingStr(label, maxWidth, fontSize) {
  43752. const calcLabelLength = (label) => {
  43753. let len = 0;
  43754. for (let i = 0; i < label.length; i++) {
  43755. if (label.charCodeAt(i) > 0 && label.charCodeAt(i) < 128) {
  43756. len++;
  43757. } else {
  43758. len += 2;
  43759. }
  43760. }
  43761. return len;
  43762. };
  43763. const fontWidth = fontSize * 1; //字号+边距
  43764. maxWidth = maxWidth * 1.6; // 需要根据自己项目调整
  43765. const width = calcLabelLength(label) * fontWidth;
  43766. const ellipsis = '…';
  43767. if (width > maxWidth) {
  43768. const len = Math.floor((maxWidth - 20) / fontWidth);
  43769. const result = label.substring(0, len);
  43770. if ((label.substring(len).length + ellipsis.length) * fontWidth > maxWidth) {
  43771. return result + '\n' + label.substring(len, len + len - 2) + ellipsis;
  43772. } else if (label.substring(len).length == 0) {
  43773. return result;
  43774. } else {
  43775. return result + '\n' + label.substring(len);
  43776. }
  43777. } else {
  43778. return label;
  43779. }
  43780. }
  43781. ;// CONCATENATED MODULE: ./src/maplibregl/overlay/GraphMap.js
  43782. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  43783. * This program are made available under the terms of the Apache License, Version 2.0
  43784. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43785. /**
  43786. * @class GraphMap
  43787. * @classdesc 对接 iServer GraphMap。
  43788. * @category iServer KnowledgeGraph
  43789. * @version 11.1.0
  43790. * @param {string} serverUrl - GraphMap服务地址, 例如:http://{iserver}/services/{knowledgeGraph-provider}/restjsr/graph/graphmaps/{graphmap}。
  43791. * @param {Object} [options] - 参数。
  43792. * @param {KnowledgeGraph.Config} [options.config] - KnowledgeGraph的配置项。
  43793. * @param {string} [options.proxy] - 服务代理地址。
  43794. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  43795. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  43796. * @param {Object} [options.headers] - 请求头。
  43797. * @fires GraphMap#loaded
  43798. * @extends {maplibregl.Evented}
  43799. * @usage
  43800. */
  43801. class GraphMap extends (external_maplibregl_default()).Evented {
  43802. constructor(serverUrl, options) {
  43803. super(serverUrl, options);
  43804. /**
  43805. * @member GraphMap.prototype.graph
  43806. * @description KnowledgeGraph的实例.
  43807. *
  43808. */
  43809. this.graph = null;
  43810. /**
  43811. * @member GraphMap.prototype.EVENT_TYPES
  43812. * @description 监听一个自定义事件可用如下方式:
  43813. *
  43814. * 支持的事件如下:
  43815. * loaded - 渲染完成时触发。
  43816. */
  43817. this.EVENT_TYPES = ['loaded'];
  43818. const graphMapName = serverUrl.split('/').pop();
  43819. this.url = serverUrl.replace(`/graphmaps/${graphMapName}`, '');
  43820. this.createGraphMap(graphMapName, options);
  43821. }
  43822. /**
  43823. * @private
  43824. * @function GraphMap.prototype.createGraphMap
  43825. * @description 创建图谱。
  43826. * @param {string} graphMapName - 图谱名称
  43827. * @param {Object} options - 配置项
  43828. * @param {string} [options.proxy] - 服务代理地址
  43829. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie
  43830. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求
  43831. * @param {Object} [options.headers] - 请求头
  43832. * @param {KnowledgeGraph.Config} [options.config] - knowledgegrah配置项
  43833. */
  43834. async createGraphMap(graphMapName, options) {
  43835. this.knowledgeGraphService = this.createKnowledgeGraphService(this.url, options);
  43836. const res = await this.knowledgeGraphService.getGraphMapData(graphMapName);
  43837. const result = KnowledgeGraph.dataFromGraphMap(res.data, res.graphMap);
  43838. this.graph = new KnowledgeGraph(options && options.config);
  43839. this.graph.on('beforelayout', () => {
  43840. /**
  43841. * @event GraphMap#loaded
  43842. * @description 渲染完成时触发。
  43843. */
  43844. this.fire(this.EVENT_TYPES[0]);
  43845. });
  43846. this.graph.setData(result);
  43847. this.graph.handleNodeStatus(transformExpandCollapseHiddenData(res.graphMap));
  43848. }
  43849. /**
  43850. * @private
  43851. * @function GraphMap.prototype.createKnowledgeGraphService
  43852. * @description 创建KnowledgeGraphService实例。
  43853. * @param {string} serviceUrl - GraphMap服务地址, 例如:http://{iserver}/services/knowledgeGraph-test/restjsr/graph
  43854. * @param {Object} options - 参数。
  43855. * @param {string} [options.proxy] - 服务代理地址。
  43856. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  43857. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  43858. * @param {Object} [options.headers] - 请求头。
  43859. */
  43860. createKnowledgeGraphService(serviceUrl, options) {
  43861. return new KnowledgeGraphService(serviceUrl, options);
  43862. }
  43863. }
  43864. ;// CONCATENATED MODULE: external "function(){try{return mapv}catch(e){return {}}}()"
  43865. const external_function_try_return_mapv_catch_e_return_namespaceObject = function(){try{return mapv}catch(e){return {}}}();
  43866. ;// CONCATENATED MODULE: ./src/common/overlay/mapv/MapvRenderer.js
  43867. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  43868. * This program are made available under the terms of the Apache License, Version 2.0
  43869. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43870. var BaseLayer = external_function_try_return_mapv_catch_e_return_namespaceObject.baiduMapLayer ? external_function_try_return_mapv_catch_e_return_namespaceObject.baiduMapLayer.__proto__ : Function;
  43871. /**
  43872. * @private
  43873. * @class MapvRenderer
  43874. * @classdesc MapV图层渲染。
  43875. * @param {Object} map - 地图。
  43876. * @param {Object} layer - 图层。
  43877. * @param {Mapv.DataSet} dataSet - 数据集。
  43878. * @param {Object} options - 参数。
  43879. * @param {Object} [functions] - 图层传递给渲染器调用的方法。
  43880. * @param {Object} [mapOptions] - 图层传递给渲染器的地图元素信息。
  43881. * @extends {MapV.BaseLayer}
  43882. *
  43883. */
  43884. class MapvRenderer extends BaseLayer {
  43885. constructor(map, dataSet, options, functions, mapOptions) {
  43886. super(map, dataSet, options);
  43887. if (!BaseLayer) {
  43888. return;
  43889. }
  43890. this.options = options || {};
  43891. this.transferCoordinate = functions.transferCoordinate;
  43892. this.getCenterPixel = functions.getCenterPixel;
  43893. this.getResolution = functions.getResolution;
  43894. this.validZoom = functions.validZoom;
  43895. let { mapElement, targetElement, id } = mapOptions;
  43896. this.targetElement = targetElement;
  43897. this.canvas = this._createCanvas(id, mapElement);
  43898. this.canvasLayer = {
  43899. canvas: this.canvas,
  43900. devicePixelRatio: this.devicePixelRatio
  43901. }
  43902. this.init(options);
  43903. this.argCheck(options);
  43904. this.stopAniamation = false;
  43905. this.animation = options.animation;
  43906. this.clickEvent = this.clickEvent.bind(this);
  43907. this.mousemoveEvent = this.mousemoveEvent.bind(this);
  43908. this._canvasUpdate();
  43909. this.targetElement.appendChild(this.canvas);
  43910. this._expectShow = true;
  43911. this.isShow = true;
  43912. }
  43913. /**
  43914. * @function MapvRenderer.prototype.clickEvent
  43915. * @description 点击绑定事件。
  43916. * @param {Object} e - 事件。
  43917. */
  43918. clickEvent(e) {
  43919. var pixel = e.point;
  43920. super.clickEvent(pixel, e);
  43921. }
  43922. /**
  43923. * @function MapvRenderer.prototype.mousemoveEvent
  43924. * @description 鼠标移动事件。
  43925. * @param {Object} e - 事件。
  43926. */
  43927. mousemoveEvent(e) {
  43928. var pixel = e.point;
  43929. super.mousemoveEvent(pixel, e);
  43930. }
  43931. /**
  43932. * @function MapvRenderer.prototype.getContext
  43933. * @description 获取信息。
  43934. */
  43935. getContext() {
  43936. return this.canvas.getContext(this.context);
  43937. }
  43938. /**
  43939. * @function MapvRenderer.prototype.addData
  43940. * @description 添加数据。
  43941. * @param {Object} data - 待添加的数据。
  43942. * @param {Object} options - 待添加的数据信息。
  43943. */
  43944. addData(data, options) {
  43945. var _data = data;
  43946. if (data && data.get) {
  43947. _data = data.get();
  43948. }
  43949. this.dataSet.add(_data);
  43950. this.update({
  43951. options: options
  43952. });
  43953. }
  43954. /**
  43955. * @function MapvRenderer.prototype.update
  43956. * @description 更新图层。
  43957. * @param {Object} opt - 待更新的数据。
  43958. * @param {Object} opt.data - mapv 数据集。
  43959. * @param {Object} opt.options - mapv 绘制参数。
  43960. */
  43961. update(opt) {
  43962. var update = opt || {};
  43963. var _data = update.data;
  43964. if (_data && _data.get) {
  43965. _data = _data.get();
  43966. }
  43967. if (_data != undefined) {
  43968. this.dataSet.set(_data);
  43969. }
  43970. super.update({
  43971. options: update.options
  43972. });
  43973. }
  43974. /**
  43975. * @function MapvRenderer.prototype.getData
  43976. * @description 获取数据。
  43977. */
  43978. getData() {
  43979. return this.dataSet;
  43980. }
  43981. /**
  43982. * @function MapvRenderer.prototype.removeData
  43983. * @description 删除符合过滤条件的数据。
  43984. * @param {function} [filter] - 过滤条件。条件参数为数据项,返回值为true,表示删除该元素;否则表示不删除。
  43985. */
  43986. removeData(filter) {
  43987. if (!this.dataSet) {
  43988. return;
  43989. }
  43990. var newData = this.dataSet.get({
  43991. filter: function (data) {
  43992. return filter != null && typeof filter === 'function' ? !filter(data) : true;
  43993. }
  43994. });
  43995. this.dataSet.set(newData);
  43996. this.update({
  43997. options: null
  43998. });
  43999. }
  44000. /**
  44001. * @function MapVRenderer.prototype.clearData
  44002. * @description 清除数据。
  44003. */
  44004. clearData() {
  44005. this.dataSet && this.dataSet.clear();
  44006. this.update({
  44007. options: null
  44008. });
  44009. }
  44010. /**
  44011. * @function MapVRenderer.prototype.updateData
  44012. * @param {Object} dataSet - 数据集。
  44013. * @param {Object} options - 数据项配置。
  44014. * @description 更新数据。
  44015. */
  44016. updateData(dataSet, options) {
  44017. if (dataSet && dataSet.get) {
  44018. this.dataSet.set(dataSet.get());
  44019. }
  44020. this.update({
  44021. options: options
  44022. });
  44023. }
  44024. _createCanvas(id, mapElement) {
  44025. const { width, height } = mapElement.style;
  44026. var canvas = document.createElement('canvas');
  44027. canvas.style.position = 'absolute';
  44028. canvas.style.top = '0px';
  44029. canvas.style.left = '0px';
  44030. canvas.id = id;
  44031. var global$2 = typeof window === 'undefined' ? {} : window;
  44032. var devicePixelRatio = this.devicePixelRatio = global$2.devicePixelRatio || 1;
  44033. canvas.width = parseInt(width) * devicePixelRatio;
  44034. canvas.height = parseInt(height) * devicePixelRatio;
  44035. if (!this.options.context || this.options.context == '2d') {
  44036. canvas.getContext('2d').scale(devicePixelRatio, devicePixelRatio);
  44037. }
  44038. canvas.style.width = width;
  44039. canvas.style.height = height;
  44040. return canvas;
  44041. }
  44042. _canvasUpdate(time) {
  44043. if (this.stopAniamation) {
  44044. return;
  44045. }
  44046. var self = this;
  44047. var animationOptions = self.options.animation;
  44048. var context = this.getContext();
  44049. if (self.isEnabledTime()) {
  44050. if (time === undefined) {
  44051. this.clear(context);
  44052. return;
  44053. }
  44054. if (this.context === '2d') {
  44055. context.save();
  44056. context.globalCompositeOperation = 'destination-out';
  44057. context.fillStyle = 'rgba(0, 0, 0, .1)';
  44058. context.fillRect(0, 0, context.canvas.width, context.canvas.height);
  44059. context.restore();
  44060. }
  44061. } else {
  44062. this.clear(context);
  44063. }
  44064. if (this.context === '2d') {
  44065. for (var key in self.options) {
  44066. context[key] = self.options[key];
  44067. }
  44068. } else {
  44069. context.clear(context.COLOR_BUFFER_BIT);
  44070. }
  44071. if (!this.validZoom()) {
  44072. return;
  44073. }
  44074. var dataGetOptions = {
  44075. transferCoordinate: this.transferCoordinate()
  44076. };
  44077. var zoomUnit = this.getResolution();
  44078. if (time !== undefined) {
  44079. dataGetOptions.filter = function (item) {
  44080. var trails = animationOptions.trails || 10;
  44081. return time && item.time > time - trails && item.time < time;
  44082. };
  44083. }
  44084. var data = self.dataSet.get(dataGetOptions);
  44085. this.processData(data);
  44086. // 兼容unit为'm'的情况
  44087. if (self.options.unit === 'm') {
  44088. if (self.options.size) {
  44089. self.options._size = self.options.size / zoomUnit;
  44090. }
  44091. if (self.options.width) {
  44092. self.options._width = self.options.width / zoomUnit;
  44093. }
  44094. if (self.options.height) {
  44095. self.options._height = self.options.height / zoomUnit;
  44096. }
  44097. } else {
  44098. self.options._size = self.options.size;
  44099. self.options._height = self.options.height;
  44100. self.options._width = self.options.width;
  44101. }
  44102. var worldPoint = this.getCenterPixel();
  44103. this.drawContext(context, data, self.options, worldPoint);
  44104. self.options.updateCallback && self.options.updateCallback(time);
  44105. }
  44106. init(options) {
  44107. var self = this;
  44108. self.options = options;
  44109. this.initDataRange(options);
  44110. this.context = self.options.context || '2d';
  44111. if (self.options.zIndex) {
  44112. this.setZIndex(self.options.zIndex);
  44113. }
  44114. this.initAnimator();
  44115. }
  44116. /**
  44117. * @function MapVRenderer.prototype.destroy
  44118. * @description 释放资源。
  44119. */
  44120. destroy() {
  44121. this.targetElement.removeChild(this.canvas);
  44122. this.clearData();
  44123. this.animator && this.animator.stop();
  44124. this.animator = null;
  44125. }
  44126. /**
  44127. * @function MapvRenderer.prototype.addAnimatorEvent
  44128. * @description 添加动画事件。
  44129. */
  44130. addAnimatorEvent() {}
  44131. moveEndEvent() {
  44132. this.stopAniamation = false;
  44133. this._canvasUpdate();
  44134. }
  44135. /**
  44136. * @function MapvRenderer.prototype.draw
  44137. * @description 渲染绘制。
  44138. */
  44139. draw() {
  44140. this._canvasUpdate();
  44141. }
  44142. visible() {
  44143. return this.isShow;
  44144. }
  44145. hide() {
  44146. this.isShow = false;
  44147. this.canvas.style.display = 'none';
  44148. }
  44149. show() {
  44150. this.isShow = true;
  44151. this.canvas.style.display = 'block';
  44152. }
  44153. setZIndex(z) {
  44154. this.canvas.style.zIndex = z;
  44155. }
  44156. /**
  44157. * @function MapvRenderer.prototype.clear
  44158. * @param {Object} context - 当前环境。
  44159. * @description 清除环境。
  44160. */
  44161. clear(context) {
  44162. context &&
  44163. context.clearRect &&
  44164. context.clearRect(
  44165. 0,
  44166. 0,
  44167. parseInt(this.map.getCanvas().style.width),
  44168. parseInt(this.map.getCanvas().style.height)
  44169. );
  44170. }
  44171. }
  44172. ;// CONCATENATED MODULE: ./src/common/util/MapCalculateUtil.js
  44173. /**
  44174. * @function getMeterPerMapUnit
  44175. * @description 单位换算,把米|度|千米|英寸|英尺换成米。
  44176. * @category BaseTypes Util
  44177. * @param {string} mapUnit 地图单位。
  44178. * @returns {number} 返回地图的距离单位。
  44179. * @usage
  44180. * ```
  44181. * // 浏览器
  44182. * <script type="text/javascript" src="{cdn}"></script>
  44183. * <script>
  44184. * const result = {namespace}.getMeterPerMapUnit(mapUnit);
  44185. *
  44186. * </script>
  44187. *
  44188. * // ES6 Import
  44189. * import { getMeterPerMapUnit } from '{npm}';
  44190. *
  44191. * const result = getMeterPerMapUnit(mapUnit);
  44192. * ```
  44193. */
  44194. var getMeterPerMapUnit = function(mapUnit) {
  44195. var earchRadiusInMeters = 6378137;
  44196. var meterPerMapUnit;
  44197. if (mapUnit === Unit.METER) {
  44198. meterPerMapUnit = 1;
  44199. } else if (mapUnit === Unit.DEGREE) {
  44200. // 每度表示多少米。
  44201. meterPerMapUnit = (Math.PI * 2 * earchRadiusInMeters) / 360;
  44202. } else if (mapUnit === Unit.KILOMETER) {
  44203. meterPerMapUnit = 1.0e-3;
  44204. } else if (mapUnit === Unit.INCH) {
  44205. meterPerMapUnit = 1 / 2.5399999918e-2;
  44206. } else if (mapUnit === Unit.FOOT) {
  44207. meterPerMapUnit = 0.3048;
  44208. } else {
  44209. return meterPerMapUnit;
  44210. }
  44211. return meterPerMapUnit;
  44212. };
  44213. /**
  44214. * @function getWrapNum
  44215. * @description 获取该坐标系的经纬度范围的经度或纬度。
  44216. * @category BaseTypes Util
  44217. * @param {number} x 经度或纬度。
  44218. * @param {boolean} includeMax 是否获取经度或纬度的最大值。
  44219. * @param {boolean} includeMin 是否获取经度或纬度的最小值。
  44220. * @param {number} range 坐标系的经纬度范围。
  44221. * @returns {number} 返回经度或纬度的值。
  44222. * @usage
  44223. * ```
  44224. * // 浏览器
  44225. * <script type="text/javascript" src="{cdn}"></script>
  44226. * <script>
  44227. * const result = {namespace}.getWrapNum(x, includeMax, includeMin, range);
  44228. *
  44229. * </script>
  44230. *
  44231. * // ES6 Import
  44232. * import { getWrapNum } from '{npm}';
  44233. *
  44234. * const result = getWrapNum(x, includeMax, includeMin, range);
  44235. * ```
  44236. */
  44237. function getWrapNum(x, includeMax = true, includeMin = true, range = [-180, 180]) {
  44238. var max = range[1],
  44239. min = range[0],
  44240. d = max - min;
  44241. if (x === max && includeMax) {
  44242. return x;
  44243. }
  44244. if (x === min && includeMin) {
  44245. return x;
  44246. }
  44247. var tmp = (((x - min) % d) + d) % d;
  44248. if (tmp === 0 && includeMax) {
  44249. return max;
  44250. }
  44251. return ((((x - min) % d) + d) % d) + min;
  44252. }
  44253. /**
  44254. * @function conversionDegree
  44255. * @description 转换经纬度。
  44256. * @category BaseTypes Util
  44257. * @param {number} degrees 经度或纬度。
  44258. * @returns {string} 返回度分秒。
  44259. * @usage
  44260. * ```
  44261. * // 浏览器
  44262. * <script type="text/javascript" src="{cdn}"></script>
  44263. * <script>
  44264. * const result = {namespace}.conversionDegree(degrees);
  44265. *
  44266. * </script>
  44267. *
  44268. * // ES6 Import
  44269. * import { conversionDegree } from '{npm}';
  44270. *
  44271. * const result = conversionDegree(degrees);
  44272. * ```
  44273. */
  44274. function conversionDegree(degrees) {
  44275. const degree = parseInt(degrees);
  44276. let fraction = parseInt((degrees - degree) * 60);
  44277. let second = parseInt(((degrees - degree) * 60 - fraction) * 60);
  44278. fraction = parseInt(fraction / 10) === 0 ? `0${fraction}` : fraction;
  44279. second = parseInt(second / 10) === 0 ? `0${second}` : second;
  44280. return `${degree}°${fraction}'${second}`;
  44281. }
  44282. /**
  44283. * @function scalesToResolutions
  44284. * @description 通过比例尺数组计算分辨率数组,没有传入比例尺数组时通过地图范围与地图最大级别进行计算。
  44285. * @version 11.0.1
  44286. * @param {Array} scales - 比例尺数组。
  44287. * @param {Object} bounds - 地图范围。
  44288. * @param {number} dpi - 屏幕分辨率。
  44289. * @param {string} mapUnit - 地图单位。
  44290. * @param {number} [level=22] - 地图最大级别。
  44291. * @returns {number} 分辨率。
  44292. * @usage
  44293. * ```
  44294. * // 浏览器
  44295. * <script type="text/javascript" src="{cdn}"></script>
  44296. * <script>
  44297. * const result = {namespace}.scalesToResolutions(scales, bounds, dpi, mapUnit);
  44298. *
  44299. * </script>
  44300. *
  44301. * // ES6 Import
  44302. * import { scalesToResolutions } from '{npm}';
  44303. *
  44304. * const result = scalesToResolutions(scales, bounds, dpi, mapUnit);
  44305. * ```
  44306. */
  44307. function scalesToResolutions(scales, bounds, dpi, mapUnit, level = 22) {
  44308. var resolutions = [];
  44309. if (scales && scales.length > 0) {
  44310. for (let i = 0; i < scales.length; i++) {
  44311. resolutions.push(scaleToResolution(scales[i], dpi, mapUnit));
  44312. }
  44313. } else {
  44314. const maxReolution = Math.abs(bounds.left - bounds.right) / 256;
  44315. for (let i = 0; i < level; i++) {
  44316. resolutions.push(maxReolution / Math.pow(2, i));
  44317. }
  44318. }
  44319. return resolutions.sort(function (a, b) {
  44320. return b - a;
  44321. });
  44322. }
  44323. /**
  44324. * @function getZoomByResolution
  44325. * @description 通过分辨率获取地图级别。
  44326. * @version 11.0.1
  44327. * @param {number} resolution - 分辨率。
  44328. * @param {Array} resolutions - 分辨率数组。
  44329. * @returns {number} 地图级别。
  44330. * @usage
  44331. * ```
  44332. * // 浏览器
  44333. * <script type="text/javascript" src="{cdn}"></script>
  44334. * <script>
  44335. * const result = {namespace}.getZoomByResolution(resolution, resolutions);
  44336. *
  44337. * </script>
  44338. *
  44339. * // ES6 Import
  44340. * import { getZoomByResolution } from '{npm}';
  44341. *
  44342. * const result = getZoomByResolution(resolution, resolutions);
  44343. * ```
  44344. */
  44345. function getZoomByResolution(resolution, resolutions) {
  44346. let zoom = 0;
  44347. let minDistance;
  44348. for (let i = 0; i < resolutions.length; i++) {
  44349. if (i === 0) {
  44350. minDistance = Math.abs(resolution - resolutions[i]);
  44351. }
  44352. if (minDistance > Math.abs(resolution - resolutions[i])) {
  44353. minDistance = Math.abs(resolution - resolutions[i]);
  44354. zoom = i;
  44355. }
  44356. }
  44357. return zoom;
  44358. }
  44359. /**
  44360. * @function scaleToResolution
  44361. * @description 通过比例尺计算分辨率。
  44362. * @version 11.0.1
  44363. * @param {number} scale - 比例尺。
  44364. * @param {number} dpi - 屏幕分辨率。
  44365. * @param {string} mapUnit - 地图单位。
  44366. * @returns {number} 分辨率。
  44367. * @usage
  44368. * ```
  44369. * // 浏览器
  44370. * <script type="text/javascript" src="{cdn}"></script>
  44371. * <script>
  44372. * const result = {namespace}.scaleToResolution(scale, dpi, mapUnit);
  44373. *
  44374. * </script>
  44375. *
  44376. * // ES6 Import
  44377. * import { scaleToResolution } from '{npm}';
  44378. *
  44379. * const result = scaleToResolution(scale, dpi, mapUnit);
  44380. * ```
  44381. */
  44382. function scaleToResolution(scale, dpi, mapUnit) {
  44383. const inchPerMeter = 1 / 0.0254;
  44384. const meterPerMapUnitValue = getMeterPerMapUnit(mapUnit);
  44385. const resolution = 1 / (scale * dpi * inchPerMeter * meterPerMapUnitValue);
  44386. return resolution;
  44387. }
  44388. /**
  44389. * 范围是否相交
  44390. * @param {Array} extent1 范围1
  44391. * @param {Array} extent2 范围2
  44392. * @return {boolean} 范围是否相交。
  44393. */
  44394. function intersects(extent1, extent2) {
  44395. return (
  44396. extent1[0] <= extent2[2] &&
  44397. extent1[2] >= extent2[0] &&
  44398. extent1[1] <= extent2[3] &&
  44399. extent1[3] >= extent2[1]
  44400. );
  44401. }
  44402. /**
  44403. * 获取两个范围的交集
  44404. * @param {Array} extent1 Extent 1
  44405. * @param {Array} extent2 Extent 2
  44406. * @return {Array} 相交范围数组.
  44407. * @api
  44408. */
  44409. function getIntersection(extent1, extent2) {
  44410. const intersection = [];
  44411. if (intersects(extent1, extent2)) {
  44412. if (extent1[0] > extent2[0]) {
  44413. intersection[0] = extent1[0];
  44414. } else {
  44415. intersection[0] = extent2[0];
  44416. }
  44417. if (extent1[1] > extent2[1]) {
  44418. intersection[1] = extent1[1];
  44419. } else {
  44420. intersection[1] = extent2[1];
  44421. }
  44422. if (extent1[2] < extent2[2]) {
  44423. intersection[2] = extent1[2];
  44424. } else {
  44425. intersection[2] = extent2[2];
  44426. }
  44427. if (extent1[3] < extent2[3]) {
  44428. intersection[3] = extent1[3];
  44429. } else {
  44430. intersection[3] = extent2[3];
  44431. }
  44432. }
  44433. return intersection;
  44434. }
  44435. ;// CONCATENATED MODULE: ./src/maplibregl/overlay/MapvLayer.js
  44436. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  44437. * This program are made available under the terms of the Apache License, Version 2.0
  44438. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44439. /**
  44440. * @class MapvLayer
  44441. * @category Visualization MapV
  44442. * @classdesc Mapv 图层类。
  44443. * @version 11.1.0
  44444. * @modulecategory Overlay
  44445. * @param {maplibregl.Map} map - MapLibreGL Map 对象,将在下个版本弃用,请用 map.addLayer() 方法添加图层。
  44446. * @param {Mapv.DataSet} dataSet - MapV 图层数据集。
  44447. * @param {Object} options - Mapv 参数。
  44448. * @param {string} [options.layerID] - 图层 ID。默认使用 CommonUtil.createUniqueID("mapvLayer_") 创建专题图层 ID。
  44449. * @usage
  44450. */
  44451. class MapvLayer {
  44452. constructor(dataSet, options) {
  44453. this.id = options.layerID ? options.layerID : Util_Util.createUniqueID('mapvLayer_');
  44454. delete options['layerID'];
  44455. this.options = options;
  44456. this.dataSet = dataSet;
  44457. this.type = 'custom';
  44458. this.isPitching = false;
  44459. this.pitchStartEvent = this._pitchStart.bind(this);
  44460. this.pitchEndEvent = this._pitchEnd.bind(this);
  44461. this.renderingMode = '3d';
  44462. this.context = this.options.context || '2d';
  44463. this.overlay = true;
  44464. }
  44465. /**
  44466. * @function MapvLayer.prototype.onAdd
  44467. * @description 添加该图层
  44468. */
  44469. onAdd(map) {
  44470. this.map = map;
  44471. this.mapContainer = map.getCanvasContainer();
  44472. this.renderer = new MapvRenderer(map, this.dataSet, this.options, {
  44473. transferCoordinate: this._transferCoordinate,
  44474. getCenterPixel: this._getCenterPixel,
  44475. getResolution: this._getResolution,
  44476. validZoom: this._validZoom.bind(this)
  44477. }, { id: this.id, targetElement: this.mapContainer, mapElement: this.map.getCanvas() });
  44478. this.mapContainer.style.perspective = this.map.transform.cameraToCenterDistance + 'px';
  44479. this._bindEvent();
  44480. }
  44481. /**
  44482. * @function MapvLayer.prototype.onRemove
  44483. * @description 添加该图层
  44484. */
  44485. onRemove() {
  44486. this.renderer.destroy();
  44487. this._unbindEvent();
  44488. }
  44489. /**
  44490. * @function MapvLayer.prototype.render
  44491. * @description 添加该图层
  44492. */
  44493. render() {
  44494. if (this.map.isZooming() || this.map.isRotating() || this.isPitching) {
  44495. this.renderer.visible() && this.renderer.hide();
  44496. return;
  44497. }
  44498. !this.renderer.visible() && this.renderer.show();
  44499. this.renderer.draw();
  44500. }
  44501. /**
  44502. * @function MapvLayer.prototype.hide
  44503. * @description 隐藏该图层
  44504. */
  44505. hide() {
  44506. this.renderer && this.renderer.hide();
  44507. return this;
  44508. }
  44509. /**
  44510. * @function MapvLayer.prototype.show
  44511. * @description 显示该图层
  44512. */
  44513. show() {
  44514. this.renderer && this.renderer.show();
  44515. return this;
  44516. }
  44517. _validZoom() {
  44518. var self = this;
  44519. if (
  44520. (self.options.minZoom && this.map.getZoom() < self.options.minZoom) ||
  44521. (self.options.maxZoom && this.map.getZoom() > self.options.maxZoom)
  44522. ) {
  44523. return false;
  44524. }
  44525. return true;
  44526. }
  44527. _transferCoordinate() {
  44528. let map = this.map;
  44529. var bounds = map.getBounds(),
  44530. dw = bounds.getEast() - bounds.getWest(),
  44531. dh = bounds.getNorth() - bounds.getSouth();
  44532. var resolutionX = dw / this.map.getCanvas().getBoundingClientRect().width,
  44533. resolutionY = dh / this.map.getCanvas().getBoundingClientRect().height;
  44534. // 一个像素是多少米
  44535. var center = map.getCenter();
  44536. var centerPx = map.project(center);
  44537. var self = this;
  44538. return function (coordinate) {
  44539. if (map.transform.rotationMatrix || self.context === '2d') {
  44540. var worldPoint = map.project(new (external_maplibregl_default()).LngLat(coordinate[0], coordinate[1]));
  44541. return [worldPoint.x, worldPoint.y];
  44542. }
  44543. var pixel = [(coordinate[0] - center.lng) / resolutionX, (center.lat - coordinate[1]) / resolutionY];
  44544. return [pixel[0] + centerPx.x, pixel[1] + centerPx.y];
  44545. }
  44546. }
  44547. _getResolution() {
  44548. var bounds = this.map.getBounds();
  44549. var dw = bounds.getEast() - bounds.getWest();
  44550. var rect = this.map.getCanvas().getBoundingClientRect();
  44551. var resolutionX = dw / rect.width;
  44552. // 一个像素是多少米
  44553. return getMeterPerMapUnit('DEGREE') * resolutionX;
  44554. }
  44555. _getCenterPixel() {
  44556. return this.map.project(new (external_maplibregl_default()).LngLat(0, 0));
  44557. }
  44558. /**
  44559. * @function MapvLayer.prototype.getTopLeft
  44560. * @description 获取左上的坐标。
  44561. */
  44562. getTopLeft() {
  44563. var map = this.map;
  44564. var topLeft;
  44565. if (map) {
  44566. var bounds = map.getBounds();
  44567. topLeft = bounds.getNorthWest();
  44568. }
  44569. return topLeft;
  44570. }
  44571. /**
  44572. * @function MapvLayer.prototype.addData
  44573. * @description 追加数据。
  44574. * @param {Object} data - 要追加的数据。
  44575. * @param {Object} options - 要追加的值。
  44576. */
  44577. addData(data, options) {
  44578. this.renderer.addData(data, options);
  44579. }
  44580. /**
  44581. * @function MapvLayer.prototype.update
  44582. * @description 更新图层。
  44583. * @param {Object} opt - 待更新的数据。
  44584. * @param {Object} opt.data - mapv 数据集。
  44585. * @param {Object} opt.options - mapv 绘制参数。
  44586. */
  44587. update(opt) {
  44588. this.renderer.update(opt);
  44589. }
  44590. /**
  44591. * @function MapvLayer.prototype.getData
  44592. * @description 获取数据。
  44593. * @returns {Mapv.DataSet} mapv 数据集。
  44594. */
  44595. getData() {
  44596. if (this.renderer) {
  44597. this.dataSet = this.renderer.getData();
  44598. }
  44599. return this.dataSet;
  44600. }
  44601. /**
  44602. * @function MapvLayer.prototype.removeData
  44603. * @description 删除符合过滤条件的数据。
  44604. * @param {function} [filter] - 过滤条件。条件参数为数据项,返回值为 true,表示删除该元素;否则表示不删除。
  44605. * @example
  44606. * filter=function(data){
  44607. * if(data.id=="1"){
  44608. * return true
  44609. * }
  44610. * return false;
  44611. * }
  44612. */
  44613. removeData(filter) {
  44614. this.renderer && this.renderer.removeData(filter);
  44615. }
  44616. /**
  44617. * @function MapvLayer.prototype.clearData
  44618. * @description 清除数据。
  44619. */
  44620. clearData() {
  44621. this.renderer.clearData();
  44622. }
  44623. _bindEvent() {
  44624. var map = this.map;
  44625. map.on('pitchstart', this.pitchStartEvent);
  44626. map.on('pitchend', this.pitchEndEvent);
  44627. if (this.options.methods) {
  44628. if (this.options.methods.click) {
  44629. map.on('click', this.renderer.clickEvent);
  44630. }
  44631. if (this.options.methods.mousemove) {
  44632. map.on('mousemove', this.renderer.mousemoveEvent);
  44633. }
  44634. }
  44635. }
  44636. _unbindEvent() {
  44637. let map = this.map;
  44638. map.off('pitchstart', this.pitchStartEvent);
  44639. map.off('pitchend', this.pitchEndEvent);
  44640. if (this.options.methods) {
  44641. if (this.options.methods.click) {
  44642. map.off('click', this.renderer.clickEvent);
  44643. }
  44644. if (this.options.methods.mousemove) {
  44645. map.off('mousemove', this.renderer.mousemoveEvent);
  44646. }
  44647. }
  44648. }
  44649. /**
  44650. * @function MapvLayer.prototype.setVisibility
  44651. * @description 设置图层可见性。
  44652. * @param {boolean} [visibility] - 是否显示图层(当前地图的 resolution 在最大最小 resolution 之间)。
  44653. */
  44654. setVisibility(visibility) {
  44655. if (visibility !== this.visibility) {
  44656. this.visibility = visibility;
  44657. if (visibility) {
  44658. this.show();
  44659. } else {
  44660. this.hide();
  44661. }
  44662. }
  44663. }
  44664. /**
  44665. * @function MapvLayer.prototype.setZIndex
  44666. * @description 设置 canvas 层级。
  44667. * @param {number} zIndex - canvas 层级。
  44668. */
  44669. setZIndex(z) {
  44670. this.renderer.setZIndex(z);
  44671. }
  44672. _pitchStart() {
  44673. this.isPitching = true;
  44674. }
  44675. _pitchEnd() {
  44676. this.isPitching = false;
  44677. }
  44678. }
  44679. ;// CONCATENATED MODULE: external "function(){try{return THREE}catch(e){return {}}}()"
  44680. const external_function_try_return_THREE_catch_e_return_namespaceObject = function(){try{return THREE}catch(e){return {}}}();
  44681. ;// CONCATENATED MODULE: ./src/common/overlay/threejs/Transform.js
  44682. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  44683. * This program are made available under the terms of the Apache License, Version 2.0
  44684. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44685. function wrap(source, min, max) {
  44686. if (source === max || source === min) {
  44687. return source;
  44688. }
  44689. let len = max - min;
  44690. return ((source - min) % len + len) % len + min
  44691. }
  44692. function rad(angle) {
  44693. return angle * Math.PI / 180;
  44694. }
  44695. var Projection = {
  44696. R: 6378137,
  44697. minZoom: 0,
  44698. maxZoom: 22,
  44699. nativeMaxZoom: 19,
  44700. RAD: Math.PI / 180,
  44701. METERS_PER_DEGREE: 6378137 * Math.PI / 180,
  44702. MAX_LATITUDE: 85.0511287798,
  44703. project: function (lngLat) {
  44704. const rad = this.RAD,
  44705. metersPerDegree = this.METERS_PER_DEGREE,
  44706. max = this.MAX_LATITUDE;
  44707. let ll = (lngLat instanceof Array)
  44708. ? {lng: lngLat[0], lat: lngLat[1]}
  44709. : {lng: lngLat.lng, lat: lngLat.lat};
  44710. let lng = ll.lng, lat = Math.max(Math.min(max, ll.lat), -max);
  44711. let c;
  44712. if (lat === 0) {
  44713. c = 0;
  44714. } else {
  44715. c = Math.log(Math.tan((90 + lat) * rad / 2)) / rad;
  44716. }
  44717. return {x: lng * metersPerDegree, y: c * metersPerDegree};
  44718. },
  44719. unproject: function (point) {
  44720. const x = point.x,
  44721. y = point.y;
  44722. const rad = this.RAD,
  44723. metersPerDegree = this.METERS_PER_DEGREE;
  44724. let c;
  44725. if (y === 0) {
  44726. c = 0;
  44727. } else {
  44728. c = y / metersPerDegree;
  44729. c = (2 * Math.atan(Math.exp(c * rad)) - Math.PI / 2) / rad;
  44730. }
  44731. return {lng: wrap(x / metersPerDegree, -180, 180), lat: wrap(c, -this.MAX_LATITUDE, this.MAX_LATITUDE)};
  44732. },
  44733. locate: function (lngLat, dx, dy) {
  44734. if (!lngLat) {
  44735. return null;
  44736. }
  44737. dx = !dx ? 0 : dx;
  44738. dy = !dy ? 0 : dy;
  44739. if (!dx && !dy) {
  44740. return lngLat;
  44741. }
  44742. let lng = lngLat.lng;
  44743. if (dx !== 0) {
  44744. let ndx = Math.abs(dx), radLng = rad(lngLat.lng);
  44745. let sLng = 2 * Math.sqrt(Math.pow(Math.sin(ndx / (2 * this.R)), 2) / Math.pow(Math.cos(radLng), 2));
  44746. radLng = radLng + sLng * (ndx > 0 ? 1 : -1);
  44747. lng = wrap(radLng * 180 / Math.PI, -180, 180);
  44748. }
  44749. let lat = lngLat.lat;
  44750. if (dy !== 0) {
  44751. let ndy = Math.abs(dy), radLat = rad(lngLat.lat);
  44752. let sLat = Math.sin(ndy / (2 * this.R)) * 2;
  44753. radLat = radLat + sLat * (ndy > 0 ? 1 : -1);
  44754. lat = wrap(radLat * 180 / Math.PI, -90, 90);
  44755. }
  44756. return {lng, lat};
  44757. },
  44758. getResolution: function (zoom) {
  44759. if (!this.resolutions) {
  44760. var resolutions = [];
  44761. var d = 2 * 6378137 * Math.PI;
  44762. for (var i = 0; i <= this.maxZoom; i++) {
  44763. resolutions[i] = d / (256 * Math.pow(2, i));
  44764. }
  44765. this.resolutions = resolutions;
  44766. }
  44767. let z = (zoom | 0), length = this.resolutions.length;
  44768. z = z < 0 ? 0 : z > length - 1 ? length - 1 : z;
  44769. const res = this.resolutions[z];
  44770. if ((zoom | 0) !== zoom && z !== length - 1) {
  44771. const next = this.resolutions[z + 1];
  44772. return res + (next - res) * (zoom - z);
  44773. }
  44774. return res;
  44775. }
  44776. };
  44777. var Transform = {
  44778. matrix: [1, -1, 0, 0],
  44779. projection: Projection,
  44780. project: function (lngLat) {
  44781. return this.projection.project(lngLat);
  44782. },
  44783. unproject: function (point) {
  44784. return this.projection.unproject(point);
  44785. },
  44786. lngLatToPoint: function (lngLat, zoom) {
  44787. var pt = this.project(lngLat);
  44788. return this.transform(pt, this.projection.getResolution(zoom));
  44789. },
  44790. locate: function (lngLat, dx, dy) {
  44791. return this.projection.locate(lngLat, dx, dy);
  44792. },
  44793. transform: function (point, scale) {
  44794. return {
  44795. x: this.matrix[0] * (point.x - this.matrix[2]) / scale,
  44796. y: this.matrix[1] * (point.y - this.matrix[3]) / scale
  44797. };
  44798. }
  44799. };
  44800. ;// CONCATENATED MODULE: ./src/common/overlay/threejs/ThreeLayerRenderer.js
  44801. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  44802. * This program are made available under the terms of the Apache License, Version 2.0
  44803. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44804. /**
  44805. * reference and modification
  44806. * maptalks.three
  44807. * (https://github.com/maptalks/maptalks.three)
  44808. * Apache Licene 2.0
  44809. * thanks maptalks
  44810. */
  44811. const projection = Transform.projection;
  44812. const {
  44813. Color,
  44814. Scene,
  44815. WebGLRenderer,
  44816. PerspectiveCamera,
  44817. Vector3,
  44818. Shape: ThreeLayerRenderer_Shape,
  44819. Mesh,
  44820. ExtrudeGeometry
  44821. } = external_function_try_return_THREE_catch_e_return_namespaceObject;
  44822. const RADIAN = Math.PI / 180;
  44823. const ThreeLayerRenderer_frame = window.requestAnimationFrame ||
  44824. window.mozRequestAnimationFrame ||
  44825. window.webkitRequestAnimationFrame ||
  44826. window.msRequestAnimationFrame;
  44827. const cancel = window.cancelAnimationFrame ||
  44828. window.mozCancelAnimationFrame ||
  44829. window.webkitCancelAnimationFrame ||
  44830. window.msCancelAnimationFrame;
  44831. /**
  44832. * @private
  44833. * @class ThreeLayerRenderer
  44834. * @category Visualization Three
  44835. * @classdesc Three 图层渲染器
  44836. * @param {ThreeLayer} layer - ThreeJs图层。
  44837. * @param {string} [renderer="gl"] - 图层渲染器,仅支持"gl"。'canvas'在v11.1.0后被弃用。
  44838. * @param {Object} options - threejs渲染器初始化参数对象。参数内容详见:
  44839. * [WebGLRenderer]{@link https://threejs.org/docs/index.html#api/renderers/WebGLRenderer}
  44840. *
  44841. */
  44842. class ThreeLayerRenderer {
  44843. constructor(layer, renderer, options) {
  44844. this._layer = layer;
  44845. this.renderer = renderer || "gl";
  44846. this.options = options;
  44847. }
  44848. setMap(map) {
  44849. this.map = map;
  44850. }
  44851. //开始渲染
  44852. render() {
  44853. if (!this._layer) {
  44854. return;
  44855. }
  44856. this.prepare();
  44857. /**
  44858. * @event ThreeLayer#initialized
  44859. * @description three 初始化之后后触发。
  44860. */
  44861. this._layer.fire("initialized");
  44862. this._layer && this._layer.draw(this.context, this.scene, this.camera);
  44863. /**
  44864. * @event ThreeLayer#draw
  44865. * @description draw 绘制事件,调用提供给外部绘制的接口后触发。
  44866. */
  44867. this._layer.fire("draw");
  44868. this.renderScene();
  44869. }
  44870. update() {
  44871. this.remove();
  44872. this.render();
  44873. }
  44874. //渲染场景(模型已经添加到图层)
  44875. renderScene() {
  44876. this.locationCamera();
  44877. this.animationFrame = this.renderFrame((function () {
  44878. this.animationFrame = null;
  44879. this.context && this.context.render(this.scene, this.camera);
  44880. }).bind(this));
  44881. }
  44882. renderFrame(fn) {
  44883. var render = function () {
  44884. fn && typeof fn === "function" && fn();
  44885. };
  44886. return ThreeLayerRenderer_frame(render);
  44887. }
  44888. resize() {
  44889. this._resetElementSize(this.container);
  44890. this._resetElementSize(this.canvas);
  44891. let width = this.canvas.width,
  44892. height = this.canvas.height;
  44893. let size = this.getMapSize();
  44894. this.camera.aspect = width / height;
  44895. this.camera.updateProjectionMatrix();
  44896. this.context.setSize(size.width, size.height);
  44897. this.renderScene();
  44898. }
  44899. //创建画布、初始化渲染器、初始化相机等
  44900. prepare() {
  44901. if (!this.map) {
  44902. return new Error("map object is necessary");
  44903. }
  44904. if (!this.canvas) {
  44905. this._initContainer();
  44906. this._initThreeRenderer();
  44907. /**
  44908. * @event ThreeLayer#rendererinitialized
  44909. * @description rendererinitialized 事件,初始化 three 渲染器后触发。
  44910. */
  44911. this._layer.fire("rendererinitialized");
  44912. } else {
  44913. this.clear(this.context);
  44914. }
  44915. }
  44916. getMapSize() {
  44917. let container = this.map.getContainer();
  44918. return { width: container.clientWidth, height: container.clientHeight };
  44919. }
  44920. cancelFrame() {
  44921. if (this.animationFrame != null) {
  44922. cancel(this.animationFrame);
  44923. }
  44924. }
  44925. remove() {
  44926. if (this.animationFrame != null) {
  44927. cancel(this.animationFrame);
  44928. }
  44929. this.container.removeChild(this.canvas);
  44930. this.container.parentNode.removeChild(this.container);
  44931. this.context = null;
  44932. this.canvas = null;
  44933. this.container = null;
  44934. }
  44935. //清理画布内容
  44936. clear(context) {
  44937. context && context.clear && context.clear();
  44938. context && context.clearRect && context.clearRect(0, 0, context.canvas.width, context.canvas.height);
  44939. }
  44940. //计算缩放比例
  44941. getScale(zoom) {
  44942. let map = this.map;
  44943. let z = zoom == null ? map.getZoom() : zoom;
  44944. let max = projection.getResolution(projection.nativeMaxZoom),
  44945. res = projection.getResolution(z);
  44946. return res / max;
  44947. }
  44948. getCanvasContainer() {
  44949. return this.container;
  44950. }
  44951. getCanvas() {
  44952. return this.canvas;
  44953. }
  44954. //重新设置相机位置
  44955. locationCamera() {
  44956. let map = this.map;
  44957. let size = this.getMapSize();
  44958. let scale = map.transform.zoomScale(projection.nativeMaxZoom - map.getZoom() - 1);
  44959. let fovRatio = Math.tan(map.transform.fov / 2 * RADIAN);
  44960. let camera = this.camera;
  44961. //倾斜时,相机位置低于Z轴
  44962. let pitch = map.getPitch() * RADIAN;
  44963. let pZ = -scale * size.height / 2 / fovRatio;
  44964. camera.position.z = pZ * Math.cos(pitch);
  44965. let centerPoint = Transform.lngLatToPoint(map.getCenter(), projection.nativeMaxZoom);
  44966. let distance = Math.sin(pitch) * pZ;
  44967. let bearing = map.getBearing() * RADIAN;
  44968. camera.position.x = centerPoint.x + distance * Math.sin(bearing);
  44969. camera.position.y = centerPoint.y - distance * Math.cos(bearing);
  44970. camera.up.set(Math.sin(bearing), -Math.cos(bearing), 0);
  44971. camera.lookAt(new external_function_try_return_THREE_catch_e_return_namespaceObject.Vector3(centerPoint.x, centerPoint.y, 0));
  44972. camera.updateProjectionMatrix();
  44973. }
  44974. /**
  44975. * @function ThreeLayerRenderer.prototype.toThreeShape
  44976. * @description 创建 threejs shape 对象。
  44977. * @param {Array} coordinates - 坐标点数组。
  44978. * @returns {THREE.Shape} threejs shape 对象。
  44979. */
  44980. toThreeShape(coordinates) {
  44981. if (!coordinates) {
  44982. return null;
  44983. }
  44984. let center = this.getCoordinatesCenter(coordinates);
  44985. let centerPoint = this.lngLatToPosition(center);
  44986. let outer = coordinates.map(coords => this.lngLatToPosition({
  44987. lng: coords[0],
  44988. lat: coords[1]
  44989. }).sub(centerPoint));
  44990. return new ThreeLayerRenderer_Shape(outer);
  44991. }
  44992. /**
  44993. * @function ThreeLayerRenderer.prototype.toThreeMesh
  44994. * @description 创建 threejs Mesh 对象。将地理坐标转换成 threejs 3D 模型(适用于挤压模型,如城市建筑)。
  44995. * @param {Array.<Object>} coordinates - 坐标点数组。
  44996. * @param {number} amount - 高度。
  44997. * @param {THREE.Material} material - Threejs 材质对象。
  44998. * @param {boolean} [removeDuplicated] - 是否移除重复的坐标点。
  44999. * @returns {THREE.Mesh} threejs Mesh 对象。
  45000. */
  45001. toThreeMesh(coordinates, amount, material, removeDuplicated) {
  45002. if (!coordinates) {
  45003. return null;
  45004. }
  45005. let coords = coordinates;
  45006. if (removeDuplicated) {
  45007. coords = this.removeDuplicatedCoordinates(coordinates)
  45008. }
  45009. let targetAmount = this.distanceToThreeVector3(amount, amount).x;
  45010. let shape = this.toThreeShape(coords);
  45011. let geometry = new ExtrudeGeometry(shape, {
  45012. 'amount': targetAmount,
  45013. 'bevelEnabled': true
  45014. });
  45015. let mesh = new Mesh(geometry, material);
  45016. let center = this.lngLatToPosition(this.getCoordinatesCenter(coords));
  45017. mesh.position.set(center.x, center.y, -targetAmount);
  45018. return mesh;
  45019. }
  45020. /**
  45021. * @function ThreeLayerRenderer.prototype.addObject
  45022. * @description 设置threejs 3D 对象的坐标(经纬度)。
  45023. * @param {THREE.Object3D} object3D - threejs 3D 对象及子类对象。
  45024. * @param {(Array.<number>|Object)} coordinate - 添加的 three 对象坐标(经纬度)。
  45025. * @returns {ThreeLayer} ThreeLayer的实例对象。
  45026. */
  45027. addObject(object3D, coordinate) {
  45028. if (coordinate && object3D) {
  45029. this.setPosition(object3D, coordinate);
  45030. }
  45031. this.scene.add(object3D);
  45032. }
  45033. /**
  45034. * @function ThreeLayerRenderer.prototype.clearMesh
  45035. * @description 清除所有 threejs mesh 对象。
  45036. * @returns {ThreeLayer} ThreeLayer的实例对象。
  45037. */
  45038. clearMesh() {
  45039. let scene = this.scene;
  45040. if (!scene) {
  45041. return this;
  45042. }
  45043. for (let i = scene.children.length - 1; i >= 0; i--) {
  45044. if (scene.children[i] instanceof external_function_try_return_THREE_catch_e_return_namespaceObject.Mesh) {
  45045. scene.remove(scene.children[i]);
  45046. }
  45047. }
  45048. return this;
  45049. }
  45050. /**
  45051. * @function ThreeLayerRenderer.prototype.clearAll
  45052. * @description 清除所有 threejs 对象。
  45053. * @param {boolean} clearCamera - 是否清除相机。
  45054. * @returns {ThreeLayer} ThreeLayer的实例对象。
  45055. */
  45056. clearAll(clearCamera) {
  45057. let scene = this.scene;
  45058. if (!scene) {
  45059. return this;
  45060. }
  45061. for (let i = scene.children.length - 1; i >= 0; i--) {
  45062. if (!clearCamera && scene.children[i] instanceof external_function_try_return_THREE_catch_e_return_namespaceObject.Camera) {
  45063. continue;
  45064. }
  45065. scene.remove(scene.children[i]);
  45066. }
  45067. return this;
  45068. }
  45069. /**
  45070. * @function ThreeLayerRenderer.prototype.setPosition
  45071. * @description 设置 threejs 3D 对象的坐标(经纬度)。
  45072. * @param {THREE.Object3D} object3D - threejs 3D 对象及子类对象。
  45073. * @param {(Array.<number>|Object)} coordinate - 添加的 three 对象坐标(经纬度)。
  45074. * @returns {ThreeLayer} ThreeLayer的实例对象。
  45075. */
  45076. setPosition(object3D, coordinate) {
  45077. if (!object3D || !coordinate) {
  45078. return this;
  45079. }
  45080. var pos = this.lngLatToPosition(coordinate);
  45081. object3D.position.set(pos.x, pos.y, pos.z);
  45082. return this;
  45083. }
  45084. /**
  45085. * @function ThreeLayerRenderer.prototype.lngLatToPosition
  45086. * @description 经纬度转threejs 3D 矢量对象。
  45087. * @param {(Array.<number>|Object)} lngLat - 经纬度坐标。
  45088. * @returns {THREE.Vector3} threejs 3D 矢量对象。
  45089. */
  45090. lngLatToPosition(lngLat) {
  45091. let zoom = Transform.projection.nativeMaxZoom;
  45092. let point = Transform.lngLatToPoint(lngLat, zoom);
  45093. return new Vector3(point.x, point.y, -0);
  45094. }
  45095. /**
  45096. * @function ThreeLayerRenderer.prototype.distanceToThreeVector3
  45097. * @description 计算距离指定坐标给定距离的新坐标的 threejs 3D 矢量对象。
  45098. * @param {number} x - x 轴距离,单位米。
  45099. * @param {number} y - y 轴距离,单位米。
  45100. * @param {(Array.<number>|Object)} lngLat - 源坐标。
  45101. * @returns {THREE.Vector3} 目标点的 threejs 3D 矢量对象。
  45102. */
  45103. distanceToThreeVector3(x, y, lngLat) {
  45104. let map = this.map;
  45105. let center = lngLat || map.getCenter(),
  45106. maxZoom = Transform.projection.nativeMaxZoom,
  45107. targetLngLat = Transform.locate(center, x, y);
  45108. let point1 = Transform.lngLatToPoint(center, maxZoom),
  45109. point2 = Transform.lngLatToPoint(targetLngLat, maxZoom);
  45110. let targetX = Math.abs(point2.x - point1.x) * Math.sign(x);
  45111. let targetY = Math.abs(point2.y - point1.y) * Math.sign(y);
  45112. return new Vector3(targetX, targetY, 0);
  45113. }
  45114. /**
  45115. * @function ThreeLayerRenderer.prototype.removeDuplicatedCoordinates
  45116. * @description 移除数组中的重复坐标。
  45117. * @param {(Array.<Array.<number>>)} coordinates - 坐标数组。
  45118. * @returns {(Array.<Array.<number>>)} 新的坐标数组。
  45119. */
  45120. removeDuplicatedCoordinates(coordinates) {
  45121. function equals(point1, point2) {
  45122. return point1[0] === point2[0] && point1[1] === point2[1]
  45123. }
  45124. let coords = [].concat(coordinates);
  45125. let length = coords.length;
  45126. for (let i = length - 1; i >= 1; i--) {
  45127. if (equals(coords[i], coords[i - 1])) {
  45128. coords.splice(i, 1);
  45129. }
  45130. }
  45131. let isClose = equals(coords[0], coords[coords.length - 1]);
  45132. isClose && coords.splice(coords.length - 1, 1);
  45133. return coords;
  45134. }
  45135. /**
  45136. * @function ThreeLayerRenderer.prototype.getCoordinatesCenter
  45137. * @description 获取给定坐标数组的中心坐标。
  45138. * @param {(Array.<Array.<number>>)} coordinates - 坐标数组。
  45139. * @returns {Object} 包含经纬度的坐标对象。
  45140. */
  45141. // 提工具
  45142. getCoordinatesCenter(coordinates) {
  45143. let sumX = 0, sumY = 0, count = 0;
  45144. let i = 0, len = coordinates.length;
  45145. for (; i < len; i++) {
  45146. if (coordinates[i]) {
  45147. sumX += coordinates[i][0];
  45148. sumY += coordinates[i][1];
  45149. count++;
  45150. }
  45151. }
  45152. return {
  45153. lng: sumX / count,
  45154. lat: sumY / count
  45155. };
  45156. }
  45157. _initContainer() {
  45158. var canvas = this._createCanvas();
  45159. var container = this.container = document.createElement("div");
  45160. container.id = this._layer.id;
  45161. container.className = "threejs-wrapper";
  45162. container.style.position = "absolute";
  45163. container.style.left = "0px";
  45164. container.style.top = "0px";
  45165. container.style.overflow = "hidden";
  45166. this._resetElementSize(container);
  45167. container.appendChild(canvas);
  45168. var targetElement = this.map.getCanvasContainer();
  45169. targetElement.appendChild(container)
  45170. }
  45171. _createCanvas() {
  45172. if (this.canvas) {
  45173. return;
  45174. }
  45175. const canvas = this.canvas = document.createElement('canvas');
  45176. canvas.className = "threejs-overlay";
  45177. canvas.style.outline = "none";
  45178. this._resetElementSize(canvas);
  45179. return canvas;
  45180. }
  45181. _resetElementSize(element) {
  45182. if (!element) {
  45183. return;
  45184. }
  45185. const size = this.getMapSize();
  45186. const dpr = window.devicePixelRatio ? window.devicePixelRatio : 1;
  45187. const width = dpr * size.width;
  45188. const height = dpr * size.height;
  45189. element.width = width;
  45190. element.height = height;
  45191. element.style.width = size.width + 'px';
  45192. element.style.height = size.height + 'px';
  45193. }
  45194. _initThreeRenderer() {
  45195. let map = this.map;
  45196. let size = this.getMapSize();
  45197. let renderer = this.renderer || 'gl';
  45198. let context;
  45199. if (renderer === 'gl') {
  45200. context = new WebGLRenderer({
  45201. 'canvas': this.canvas,
  45202. 'alpha': true,
  45203. 'antialias': true,
  45204. 'preserveDrawingBuffer': true
  45205. }, this.options);
  45206. context.autoClear = true;
  45207. context.clear();
  45208. }
  45209. context.setClearColor(new Color(1, 1, 1), 0);
  45210. context.canvas = this.canvas;
  45211. this.context = context;
  45212. let fov = map.transform.fov;
  45213. let fovRatio = Math.tan(fov / 2 * RADIAN);
  45214. let maxScale = this.getScale(projection.minZoom) / this.getScale(projection.nativeMaxZoom);
  45215. let far = maxScale * size.height / 2 / fovRatio;
  45216. this.camera = new PerspectiveCamera(fov, size.width / size.height, 1, far);
  45217. this.scene = new Scene();
  45218. this.scene.add(this.camera);
  45219. }
  45220. }
  45221. ;// CONCATENATED MODULE: ./src/maplibregl/overlay/ThreeLayer.js
  45222. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  45223. * This program are made available under the terms of the Apache License, Version 2.0
  45224. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45225. /**
  45226. * reference and modification
  45227. * maptalks.three
  45228. * (https://github.com/maptalks/maptalks.three)
  45229. * Apache Licene 2.0
  45230. * thanks maptalks
  45231. */
  45232. /**
  45233. * @class ThreeLayer
  45234. * @category Visualization Three
  45235. * @classdesc Three 图层类。
  45236. * @version 11.1.0
  45237. * @modulecategory Overlay
  45238. * @param {string} id - 图层 ID。
  45239. * @param {string} [renderer="gl"] - 图层渲染器,仅支持"gl"。'canvas'在v11.1.0后被弃用。
  45240. * @param {Object} options - 初始化参数。
  45241. * @param {Object} options.threeOptions - threejs 渲染器初始化参数对象。参数内容详见:
  45242. * {@link THREE.WebGLRenderer}。
  45243. *
  45244. * @extends {maplibregl.Evented}
  45245. * @fires ThreeLayer#render
  45246. * @fires ThreeLayer#renderscene
  45247. * @example
  45248. * var threeLayer = new ThreeLayer('three');
  45249. * //模型绘制
  45250. * threeLayer.on("initialized", draw);
  45251. * threeLayer.addTo(map);
  45252. *
  45253. * function draw() {
  45254. * var scene=threeLayer.getScene();
  45255. * camera=threeLayer.getCamera();
  45256. * var light = new THREE.PointLight(0xffffff);
  45257. * camera.add(light);
  45258. * var material = new THREE.MeshPhongMaterial({color: 0xff0000});
  45259. * //根据坐标点转换成模型
  45260. * var mesh = this.toThreeMesh(feature.geometry.coordinates, 10, material, true);
  45261. * //模型添加到3D场景
  45262. * scene.add(mesh);
  45263. * }
  45264. *
  45265. * 叠加模型可以通过两种方式:</br>
  45266. * 1.调用 threeLayer.toThreeMesh 直接将地理坐标转换成 threejs 3D 模型(适用于挤压模型,如城市建筑),然后添加到 3D 场景
  45267. * 2.使用 ThreeJS 的接口创建好 Mesh,然后调用 threeLayer.setPosition 设置地理位置,然后添加到 3D 场景
  45268. *
  45269. * @usage
  45270. */
  45271. class ThreeLayer extends (external_maplibregl_default()).Evented {
  45272. //options.threeOptions是初始化threejs renderer的参数对象
  45273. constructor(id, renderer, options) {
  45274. super();
  45275. this.id = id;
  45276. this.options = options;
  45277. this.type = 'custom';
  45278. this.renderingMode = '3d';
  45279. this.overlay = true;
  45280. let threeOptions = options && options.threeOptions;
  45281. this.renderer = new ThreeLayerRenderer(this, renderer, threeOptions);
  45282. }
  45283. /**
  45284. * @function ThreeLayer.prototype.toThreeShape
  45285. * @description 创建 threejs shape 对象。
  45286. * @param {Array} coordinates - 坐标点数组。
  45287. * @returns {THREE.Shape} threejs shape 对象。
  45288. */
  45289. toThreeShape(coordinates) {
  45290. return this.renderer.toThreeShape(coordinates);
  45291. }
  45292. /**
  45293. * @function ThreeLayer.prototype.toThreeMesh
  45294. * @description 创建 threejs Mesh 对象。将地理坐标转换成 threejs 3D 模型(适用于挤压模型,如城市建筑)。
  45295. * @param {Array.<Object>} coordinates - 坐标点数组。
  45296. * @param {number} amount - 高度。
  45297. * @param {THREE.Material} material - Threejs 材质对象。
  45298. * @param {boolean} [removeDuplicated] - 是否移除重复的坐标点。
  45299. * @returns {THREE.Mesh} threejs Mesh 对象。
  45300. */
  45301. toThreeMesh(coordinates, amount, material, removeDuplicated) {
  45302. return this.renderer.toThreeMesh(coordinates, amount, material, removeDuplicated);
  45303. }
  45304. /**
  45305. * @function ThreeLayer.prototype.addObject
  45306. * @description 设置threejs 3D 对象的坐标(经纬度)。
  45307. * @param {THREE.Object3D} object3D - threejs 3D 对象及子类对象。
  45308. * @param {(Array.<number>|Object)} coordinate - 添加的 three 对象坐标(经纬度)。
  45309. * @returns {ThreeLayer} ThreeLayer的实例对象。
  45310. */
  45311. addObject(object3D, coordinate) {
  45312. this.renderer && this.renderer.addObject(object3D, coordinate);
  45313. }
  45314. /**
  45315. * @function ThreeLayer.prototype.getScene
  45316. * @description 获取 threejs 场景对象。
  45317. * @returns {THREE.Scene} threejs 场景对象。
  45318. */
  45319. getScene() {
  45320. return this.renderer.scene;
  45321. }
  45322. /**
  45323. * @function ThreeLayer.prototype.getCamera
  45324. * @description 获取 threejs 相机。
  45325. * @returns {THREE.Camera} threejs 相机。
  45326. */
  45327. getCamera() {
  45328. return this.renderer.camera;
  45329. }
  45330. /**
  45331. * @function ThreeLayer.prototype.getThreeRenderer
  45332. * @description 获取 threejs renderer。
  45333. * @returns {THREE.WebGLRenderer} threejs renderer。
  45334. */
  45335. getThreeRenderer() {
  45336. return this.renderer.context;
  45337. }
  45338. /**
  45339. * @function ThreeLayer.prototype.clearMesh
  45340. * @description 清除所有 threejs mesh 对象。
  45341. * @returns {ThreeLayer} ThreeLayer的实例对象。
  45342. */
  45343. clearMesh() {
  45344. this.renderer.clearMesh();
  45345. return this;
  45346. }
  45347. /**
  45348. * @function ThreeLayer.prototype.clearAll
  45349. * @description 清除所有 threejs 对象。
  45350. * @param {boolean} clearCamera - 是否清除相机。
  45351. * @returns {ThreeLayer} ThreeLayer的实例对象。
  45352. */
  45353. clearAll(clearCamera) {
  45354. this.renderer.clearAll(clearCamera);
  45355. return this;
  45356. }
  45357. /**
  45358. * @function ThreeLayer.prototype.setPosition
  45359. * @description 设置 threejs 3D 对象的坐标(经纬度)。
  45360. * @param {THREE.Object3D} object3D - threejs 3D 对象及子类对象。
  45361. * @param {(Array.<number>|Object)} coordinate - 添加的 three 对象坐标(经纬度)。
  45362. * @returns {ThreeLayer} ThreeLayer的实例对象。
  45363. */
  45364. setPosition(object3D, coordinate) {
  45365. return this.renderer.setPosition(object3D, coordinate);
  45366. }
  45367. /**
  45368. * @function ThreeLayer.prototype.lngLatToPosition
  45369. * @description 经纬度转threejs 3D 矢量对象。
  45370. * @param {(Array.<number>|Object)} lngLat - 经纬度坐标。
  45371. * @returns {THREE.Vector3} threejs 3D 矢量对象。
  45372. */
  45373. lngLatToPosition(lngLat) {
  45374. return this.renderer.lngLatToPosition(lngLat);
  45375. }
  45376. /**
  45377. * @function ThreeLayer.prototype.distanceToThreeVector3
  45378. * @description 计算距离指定坐标给定距离的新坐标的 threejs 3D 矢量对象。
  45379. * @param {number} x - x 轴距离,单位米。
  45380. * @param {number} y - y 轴距离,单位米。
  45381. * @param {(Array.<number>|Object)} lngLat - 源坐标。
  45382. * @returns {THREE.Vector3} 目标点的 threejs 3D 矢量对象。
  45383. */
  45384. distanceToThreeVector3(x, y, lngLat) {
  45385. let map = this._map;
  45386. let center = lngLat || map.getCenter();
  45387. return this.renderer.distanceToThreeVector3(x, y, center);
  45388. }
  45389. /**
  45390. * @function ThreeLayer.prototype.removeDuplicatedCoordinates
  45391. * @description 移除数组中的重复坐标。
  45392. * @param {(Array.<Array.<number>>)} coordinates - 坐标数组。
  45393. * @returns {(Array.<Array.<number>>)} 新的坐标数组。
  45394. */
  45395. removeDuplicatedCoordinates(coordinates) {
  45396. return this.renderer.removeDuplicatedCoordinates(coordinates);
  45397. }
  45398. /**
  45399. * @function ThreeLayer.prototype.getCoordinatesCenter
  45400. * @description 获取给定坐标数组的中心坐标。
  45401. * @param {(Array.<Array.<number>>)} coordinates - 坐标数组。
  45402. * @returns {Object} 包含经纬度的坐标对象。
  45403. */
  45404. getCoordinatesCenter(coordinates) {
  45405. return this.renderer.getCoordinatesCenter(coordinates);
  45406. }
  45407. /**
  45408. * @function ThreeLayer.prototype.onAdd
  45409. * @description 添加图层到地图。
  45410. * @param {Object} map - 地图对象。
  45411. */
  45412. onAdd(map) {
  45413. var me = this;
  45414. me._map = map;
  45415. me.renderer.setMap(map);
  45416. me.renderer.render();
  45417. me.on('render', (function () {
  45418. this.context && this.context.render(this.scene, this.camera);
  45419. }).bind(me.renderer));
  45420. return this;
  45421. }
  45422. /**
  45423. * @function ThreeLayer.prototype.addTo
  45424. * @deprecated
  45425. * @description 添加图层到地图。
  45426. * @param {Object} map - 地图对象。
  45427. * @returns {ThreeLayer} ThreeLayer的实例对象。
  45428. */
  45429. addTo(map) {
  45430. map.addLayer(this);
  45431. return this;
  45432. }
  45433. /**
  45434. * @function ThreeLayer.prototype.render
  45435. */
  45436. render() {
  45437. this._update();
  45438. }
  45439. /**
  45440. * @function ThreeLayer.prototype.getCanvasContainer
  45441. * @description 获取 three 图层容器。
  45442. * @returns {HTMLElement} three 图层的容器。
  45443. */
  45444. getCanvasContainer() {
  45445. return this.renderer.getCanvasContainer();
  45446. }
  45447. /**
  45448. * @function ThreeLayer.prototype.getCanvas
  45449. * @description 获取 three 图层画布。
  45450. * @returns {HTMLCanvasElement} three 图层画布。
  45451. */
  45452. getCanvas() {
  45453. return this.renderer.getCanvas();
  45454. }
  45455. /**
  45456. * @function ThreeLayer.prototype.remove
  45457. * @description 移除图层。
  45458. */
  45459. remove() {
  45460. this.renderer.remove();
  45461. this._map = null;
  45462. }
  45463. /**
  45464. * @function ThreeLayer.prototype.draw
  45465. * @description 提供给外部的 threejs 模型绘制接口。
  45466. * @returns {ThreeLayer} ThreeLayer的实例对象。
  45467. * @example
  45468. * var threeLayer = new ThreeLayer('three');
  45469. * //可以通过重写 draw 实现模型绘制
  45470. * threeLayer.draw = function (gl, scene, camera) {
  45471. * //TODO 绘制操作
  45472. * }
  45473. * threeLayer.addTo(map);
  45474. */
  45475. draw() {
  45476. return this;
  45477. }
  45478. /**
  45479. * @function ThreeLayer.prototype.renderScene
  45480. * @description 渲染场景。
  45481. * @returns {ThreeLayer} ThreeLayer的实例对象。
  45482. */
  45483. renderScene() {
  45484. this.renderer.renderScene();
  45485. /**
  45486. * @event ThreeLayer#renderscene
  45487. * @description renderScene 事件,场景渲染后触发。
  45488. */
  45489. this.fire("renderscene");
  45490. return this;
  45491. }
  45492. _resize() {
  45493. this.renderer.resize();
  45494. }
  45495. _update() {
  45496. /**
  45497. * @event ThreeLayer#render
  45498. * @description render 事件,地图渲染时(地图状态改变时)触发。
  45499. */
  45500. this.renderScene();
  45501. this.fire('render');
  45502. return this;
  45503. }
  45504. }
  45505. ;// CONCATENATED MODULE: ./src/common/overlay/deckgl/DeckglLayerBase.js
  45506. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  45507. * This program are made available under the terms of the Apache License, Version 2.0
  45508. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45509. /**
  45510. * @class DeckglLayerBase
  45511. * @category Visualization DeckGL
  45512. * @classdesc Deckgl 高效率图层,该图图层为综合图层,通过该图层可创建 高效率点图层、路径图层(线图层)、高效率面图层、曲线图层、
  45513. * 正六边形图层(蜂巢图层)、网格图层,只需给定相依配置,因此,在创建图层之前,请仔细阅读参数配置。
  45514. * @param {string} layerTypeID - 高效率图层类型 ID,包括 "scatter-plot" 高效率点图层、"path-layer" 路径图层(线图层)、
  45515. * "polygon-layer" 高效率面图层、"arc-layer" 曲线图层、"hexagon-layer" 正六边形图层(蜂巢图层)、"screen-grid-layer" 网格图层。
  45516. *
  45517. * @param {Object} options - 图层配置项,包括以下参数:
  45518. * @param {Object} [options.layerId] - DeckglLayerBase 图层 Dom 元素 ID。默认使用 CommonUtil.createUniqueID("graphicLayer_" + this.layerTypeID + "_") 创建专题图层 ID。
  45519. * @param {Array.<GeoJSONObject>} options.data - 图层数据,支持 GeoJSON 规范数据类型。
  45520. * @param {Object} options.callback - deckgl 图层回调函数配置项。
  45521. * @param {Object} options.props - deckgl 图层配置项, 在该参数下配置图层配置项:
  45522. * @param {boolean} options.props.coverage - "hexagon-layer" 配置项:六边形半径乘数,介于0 - 1之间。六边形的最终半径通过覆盖半径计算。注意:覆盖范围不会影响分数的分配方式。分配方式的半径仅由半径属性确定;
  45523. * @param {boolean} options.props.hexagonAggregator - "hexagon-layer" 配置项:* @param {boolean}
  45524. * @param {Object} options.props.lightSettings - 光照配置项。
  45525. * @param {Array} options.props.lightSettings.lightsPosition - 光照配置项:指定为`[x,y,z]`的光在平面阵列中的位置`, 在一个平面阵列。长度应该是 `3 x numberOfLights`。
  45526. * @param {Array} options.props.lightSettings.lightsStrength - 光照配置项:平面阵列中指定为“[x,y]`的灯的强度。长度应该是`2 x numberOfLights`。
  45527. * @param {number} [options.props.lightSettings.numberOfLights=1] - 光照配置项:光照值,最大值为 `5`。
  45528. * @param {number} [options.props.lightSettings.coordinateSystem=COORDINATE_SYSTEM.LNGLAT] - 光照配置项:指定灯位置的坐标系。
  45529. * @param {number} [options.props.lightSettings.coordinateOrigin=[0, 0, 0]] - 光照配置项:指定灯位置的坐标原点。
  45530. * @param {number} [options.props.lightSettings.modelMatrix] - 光照配置项:光位置的变换矩阵。
  45531. * @param {number} [options.props.lightSettings.ambientRatio=0.4] - 光照配置项:光照的环境比例。
  45532. * @param {number} [options.props.lightSettings.diffuseRatio=0.6] - 光照配置项:光的漫反射率。
  45533. * @param {number} [options.props.lightSettings.specularRatio=0.8] - 光照配置项:光的镜面反射率。
  45534. * @param {number} [options.props.opacity=1] - 公共配置项:图层不透明度度。
  45535. * @param {boolean} [options.props.pickable=false] - 公共配置项:是否响应鼠标事件(鼠标点击,鼠标滑动)。
  45536. * @param {function} [options.props.autoHighlight=false] - 公共配置项:鼠标滑动高亮要素。
  45537. * @param {function} [options.props.highlightColor=[0, 0, 128, 128]] - 公共配置项:鼠标滑动高亮颜色。
  45538. * @param {function} [options.props.onClick] - 公共配置项:鼠标点击事件。
  45539. * @param {function} [options.props.onHover] - 公共配置项:鼠标滑动事件。
  45540. * @param {number} [options.props.radiusScale=1] - "scatter-plot" 配置项:散点半径比例。
  45541. * @param {boolean} [options.props.outline=false] - "scatter-plot" 配置项:是否边线显示。
  45542. * @param {number} [options.props.strokeWidth=1] - "scatter-plot" 配置项:边线宽度。
  45543. * @param {number} [options.props.radiusMinPixels=0] - "scatter-plot" 配置项:半径最小像素值。
  45544. * @param {number} [options.props.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - "scatter-plot" 配置项:半径最大像素值。
  45545. * @param {boolean} [options.props.fp64=false] - "scatter-plot" 配置项:否应以高精度64位模式呈现图层。
  45546. * @param {number} [options.props.widthScale=1] - "path-layer" 配置项:线宽比例。
  45547. * @param {number} [options.props.widthMinPixels=0] - "path-layer" 配置项:线宽最小像素值。
  45548. * @param {number} [options.props.widthMaxPixels=Number.MAX_SAFE_INTEGER] - "path-layer" 配置项:线宽最大像素值。
  45549. * @param {boolean} [options.props.rounded=false] - "path-layer" 配置项:节点是否绘制为弧形。
  45550. * @param {number} [options.props.miterLimit=4] - "path-layer" 配置项:节点相对于线宽的最大范围,仅在 rounded 为 false 时有效;
  45551. * @param {boolean} [options.props.fp64=false] - "path-layer" 配置项:否应以高精度64位模式呈现图层。
  45552. * @param {boolean} [options.props.dashJustified=false] - "path-layer" 配置项:是否虚线形式显示,仅在 getDashArray() 回调函数被指定时有效。
  45553. * @param {boolean} [options.props.filled=true] - "polygon-layer" 配置项:是否填充面。
  45554. * @param {boolean} [options.props.stroked=true] - "polygon-layer" 配置项:是否绘制边线。
  45555. * @param {boolean} [options.props.extruded=false] - "polygon-layer" 配置项:是否拉伸建筑。
  45556. * @param {boolean} [options.props.wireframe=false] - "polygon-layer" 配置项:当面被拉伸为建筑时,是否描绘建筑物边线。
  45557. * @param {boolean} [options.props.elevationScale=1] - "polygon-layer" 配置项:海拔比例。
  45558. * @param {boolean} [options.props.lineWidthScale=1] - "polygon-layer" 配置项:线宽比例。
  45559. * @param {boolean} [options.props.lineWidthMinPixels=0] - "polygon-layer" 配置项:线宽最小像素值。
  45560. * @param {boolean} [options.props.lineWidthMaxPixels=Number.MAX_SAFE_INTEGER] - "polygon-layer" 配置项:线宽最大像素值。
  45561. * @param {boolean} [options.props.lineJointRounded=false] - "polygon-layer" 配置项:节点是否绘制为弧形。
  45562. * @param {boolean} [options.props.lineMiterLimit=4] - "polygon-layer" 配置项:节点相对于线宽的最大范围,仅在 lineJointRounded 为 false 时有效。
  45563. * @param {boolean} [options.props.lineDashJustified=false] - "polygon-layer" 配置项:是否虚线形式显示,仅在 getLineDashArray() 回调函数被指定时有效。
  45564. * @param {boolean} [options.props.fp64=false] - "polygon-layer" 配置项:否应以高精度64位模式呈现图层。
  45565. * @param {boolean} [options.props.fp64=false] - "arc-layer" 配置项:否应以高精度64位模式呈现图层。
  45566. * @param {boolean} [options.props.strokeWidth=1] - "arc-layer" 配置项:线宽。
  45567. * @param {boolean} [options.props.radius=1000] - "hexagon-layer" 配置项:六边形半径值。
  45568. * @param {boolean} [options.props.extruded=false] - "hexagon-layer" 配置项:是否拉伸要素。
  45569. * @param {boolean} [options.props.upperPercentile=100] - "hexagon-layer" 配置项:筛选箱并通过upperPercentile重新计算颜色。颜色值大于upperPercentile的六边形将被隐藏。
  45570. * @param {boolean} [options.props.elevationScale=1] - "hexagon-layer" 配置项:高程乘数,实际海拔高度由 elevationScale * getElevation(d)计算。 elevationScale是一个方便的属性,可以在不更新数据的情况下缩放所有六边形。
  45571. * @param {boolean} [options.props.colorDomain=false] - "hexagon-layer" 配置项:色阶。
  45572. * @param {boolean} [options.props.colorRange=[[255,255,178,255],[254,217,118,255],[254,178,76,255],[253,141,60,255],[240,59,32,255],[189,0,38,255]]] - "hexagon-layer" 配置项:色带。
  45573. * @usage
  45574. */
  45575. class DeckglLayerBase {
  45576. constructor(layerTypeID, options) {
  45577. /**
  45578. * @member {string} DeckglLayerBase.prototype.id
  45579. * @description 高效率点图层 ID。
  45580. */
  45581. this.layerTypeID = layerTypeID;
  45582. /**
  45583. * @member {Array.<Graphic>} DeckglLayerBase.prototype.graphics
  45584. * @description 点要素对象数组。
  45585. *
  45586. */
  45587. this.data = [].concat(options.data);
  45588. this.props = options.props ? options.props : {};
  45589. this.callback = options.callback ? options.callback : {};
  45590. this.id = options.layerId
  45591. ? options.layerId
  45592. : Util_Util.createUniqueID('graphicLayer_' + this.layerTypeID + '_');
  45593. }
  45594. /**
  45595. * @function DeckglLayerBase.prototype.onAdd
  45596. */
  45597. onAdd() {
  45598. }
  45599. /**
  45600. * @function DeckglLayerBase.prototype.render
  45601. */
  45602. render() {
  45603. }
  45604. /**
  45605. * @function DeckglLayerBase.prototype.setStyle
  45606. * @description 设置图层整体样式。
  45607. * @param {Object} styleOptions - 样式对象。
  45608. * @param {Array.<number>} [styleOptions.color=[0, 0, 0, 255]] - 点颜色。
  45609. * @param {number} [styleOptions.radius=10] - 点半径。
  45610. * @param {number} [styleOptions.opacity=0.8] - 不透明度。
  45611. * @param {Array.<number>} [styleOptions.highlightColor] - 高亮颜色,目前只支持 rgba 数组。
  45612. * @param {number} [styleOptions.radiusScale=1] - 点放大倍数。
  45613. * @param {number} [styleOptions.radiusMinPixels=0] - 半径最小值(像素)。
  45614. * @param {number} [styleOptions.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - 半径最大值(像素)。
  45615. * @param {number} [styleOptions.strokeWidth=12] - 边框大小。
  45616. * @param {boolean} [styleOptions.outline=false] - 是否显示边框。
  45617. */
  45618. setStyle(styleOptions) {
  45619. Util_Util.extend(this.props, styleOptions);
  45620. this._createLayerByLayerTypeID();
  45621. this.update();
  45622. }
  45623. /**
  45624. * @function DeckglLayerBase.prototype.setData
  45625. * @description 设置绘制的点要素数据,会覆盖之前的所有要素。
  45626. * @param {Array.<Object>} data - 点要素对象数组。
  45627. */
  45628. setData(data) {
  45629. this.data = this.data || [];
  45630. this.data.length = 0;
  45631. let dataTemp = !Util_Util.isArray(data) ? [data] : [].concat(data);
  45632. //this.layer.props.data不能被重新赋值,只能在原数组上进行操作
  45633. if (!this.layer.props.data) {
  45634. this.layer.props.data = [];
  45635. }
  45636. this.layer.props.data.length = 0;
  45637. for (let i = 0; i < dataTemp.length; i++) {
  45638. this.layer.props.data.push(dataTemp[i]);
  45639. }
  45640. this.data = this.layer.props.data;
  45641. this.update();
  45642. }
  45643. /**
  45644. * @function DeckglLayerBase.prototype.addData
  45645. * @description 添加点要素,不会覆盖之前的要素。
  45646. * @param {Array.<Object>} data - 点要素对象数组。
  45647. */
  45648. addData(data) {
  45649. this.data = this.data || [];
  45650. let dataTemp = !Util_Util.isArray(data) ? [data] : [].concat(data);
  45651. //this.layer.props.data不能被重新赋值,只能在原数组上进行操作
  45652. if (!this.layer.props.data) {
  45653. this.layer.props.data = [];
  45654. }
  45655. for (let i = 0; i < dataTemp.length; i++) {
  45656. this.layer.props.data.push(dataTemp[i]);
  45657. }
  45658. this.update();
  45659. }
  45660. /**
  45661. * @function DeckglLayerBase.prototype.update
  45662. * @description 更新图层。
  45663. */
  45664. update() {
  45665. if (this.layer.lifecycle !== 'Awaiting state') {
  45666. let changeFlags = {
  45667. dataChanged: true,
  45668. propsChanged: true,
  45669. viewportChanged: true,
  45670. updateTriggersChanged: true
  45671. };
  45672. this.layer.setChangeFlags(changeFlags);
  45673. }
  45674. this._draw();
  45675. }
  45676. /**
  45677. * @function DeckglLayerBase.prototype.clear
  45678. * @description 释放图层资源。
  45679. */
  45680. // todo 还有哪些资源应该被释放?
  45681. clear() {
  45682. this.removeData();
  45683. this.deckGL.finalize();
  45684. }
  45685. /**
  45686. * @function DeckglLayerBase.prototype.removeData
  45687. * @description 移除所有要素。
  45688. */
  45689. removeData() {
  45690. this.data.length = 0;
  45691. if (this.layer.props.data) {
  45692. this.layer.props.data.length = 0;
  45693. }
  45694. this.update();
  45695. }
  45696. /**
  45697. * @function DeckglLayerBase.prototype.moveTo
  45698. * @description 将图层移动到某个图层之前。
  45699. * @param {string} layerID - 待插入的图层 ID。
  45700. * @param {boolean} [before=true] - 是否将本图层插入到图层 ID 为 layerID 的图层之前。
  45701. */
  45702. moveTo(layerID, before) {
  45703. var layer = document.getElementById(this.id);
  45704. before = before !== undefined ? before : true;
  45705. if (before) {
  45706. var beforeLayer = document.getElementById(layerID);
  45707. if (layer && beforeLayer) {
  45708. beforeLayer.parentNode.insertBefore(layer, beforeLayer);
  45709. }
  45710. return;
  45711. }
  45712. var nextLayer = document.getElementById(layerID);
  45713. if (layer) {
  45714. if (nextLayer.nextSibling) {
  45715. nextLayer.parentNode.insertBefore(layer, nextLayer.nextSibling);
  45716. return;
  45717. }
  45718. nextLayer.parentNode.appendChild(layer);
  45719. }
  45720. }
  45721. /**
  45722. * @function DeckglLayerBase.prototype.setVisibility
  45723. * @description 设置图层可见性。
  45724. * @param {boolean} [visibility] - 是否显示图层(当前地图的 resolution 在最大最小 resolution 之间)。
  45725. */
  45726. setVisibility(visibility) {
  45727. if (this.canvas && visibility !== this.visibility) {
  45728. this.visibility = visibility;
  45729. this.canvas.style.display = visibility ? 'block' : 'none';
  45730. }
  45731. }
  45732. _draw() {
  45733. let deckOptions = this._getState();
  45734. deckOptions.layers = [this.layer];
  45735. deckOptions.canvas = this.canvas;
  45736. this.deckGL.setProps(deckOptions);
  45737. }
  45738. _getState() {
  45739. //获取地图信息构建state
  45740. let width = parseInt(this.canvas.style.width);
  45741. let height = parseInt(this.canvas.style.height);
  45742. const mapInfo = this.getMapInfo();
  45743. let mapViewport = {
  45744. width: width,
  45745. height: height,
  45746. ...mapInfo
  45747. };
  45748. let state = {};
  45749. //克隆 mapViewport
  45750. for (let key in mapViewport) {
  45751. state[key] = mapViewport[key];
  45752. }
  45753. //克隆 props
  45754. for (let key in this.props) {
  45755. state[key] = this.props[key];
  45756. }
  45757. if (this._isEPSG3857 && this._isEPSG3857()) {
  45758. state.coordinateSystem = this.coordinateSystem;
  45759. state.isGeographicCoordinateSystem = this.isGeographicCoordinateSystem;
  45760. } else {
  45761. state.coordinateSystem = 1;
  45762. state.isGeographicCoordinateSystem = false
  45763. }
  45764. //更行数据
  45765. state.data = this.data;
  45766. return state;
  45767. }
  45768. /**
  45769. * @function DeckglLayerBase.prototype._createLayerByLayerTypeID
  45770. * @description 判别当前创建图层类型。
  45771. * @private
  45772. */
  45773. _createLayerByLayerTypeID() {
  45774. //统一处理公共属性:
  45775. this.props.data = this.data;
  45776. this.props.isGeographicCoordinateSystem = this.isGeographicCoordinateSystem;
  45777. this.props.coordinateSystem = this.coordinateSystem;
  45778. //添加事件监听
  45779. this.props.pickable = Boolean(this.props.onClick) || Boolean(this.props.onHover);
  45780. //各类型各自从 defaultProps 取出相形的参数:
  45781. if (this.layerTypeID === 'scatter-plot') {
  45782. this.props.id = 'scatter-plot';
  45783. this._createScatterPlotLayer();
  45784. } else if (this.layerTypeID === 'path-layer') {
  45785. this.props.id = 'path-layer';
  45786. this._createPathLayer();
  45787. } else if (this.layerTypeID === 'polygon-layer') {
  45788. this.props.id = 'polygon-layer';
  45789. this._createPolygonLayer();
  45790. } else if (this.layerTypeID === 'arc-layer') {
  45791. this.props.id = 'arc-layer';
  45792. this._createArcLineLayer();
  45793. } else if (this.layerTypeID === 'hexagon-layer') {
  45794. this.props.id = 'hexagon-layer';
  45795. this._createHexagonLayer();
  45796. } else {
  45797. throw new Error(this.layerTypeID + ' does not support');
  45798. }
  45799. }
  45800. /**
  45801. * @description scatter-plot
  45802. * @private
  45803. */
  45804. _createScatterPlotLayer() {
  45805. //处理回调
  45806. /* this.props.getPosition = this.callback.getPosition ? this.callback.getPosition : function (point) {
  45807. if (!point) {
  45808. return [0, 0, 0];
  45809. }
  45810. return point.geometry.coordinates;
  45811. };*/
  45812. var me = this;
  45813. this.props.getPosition = this.callback.getPosition
  45814. ? this.callback.getPosition
  45815. : function (point) {
  45816. if (!point) {
  45817. return [0, 0, 0];
  45818. }
  45819. let lngLat = point.getLngLat();
  45820. return lngLat && [lngLat.lng, lngLat.lat, 0];
  45821. };
  45822. if (this.callback.getColor) {
  45823. this.props.getColor = this.callback.getColor
  45824. ? this.callback.getColor
  45825. : function (point) {
  45826. let style = point && point.getStyle();
  45827. return (style && style.color) || me.props.color;
  45828. };
  45829. }
  45830. if (this.callback.getRadius) {
  45831. this.props.getRadius = this.callback.getRadius
  45832. ? this.callback.getRadius
  45833. : function (point) {
  45834. let style = point && point.getStyle();
  45835. return (style && style.radius) || me.props.radius;
  45836. };
  45837. }
  45838. if (this.props.color || this.props.radius) {
  45839. this.props.updateTriggers = {};
  45840. if (this.props.radius) {
  45841. this.props.updateTriggers.getRadius = [this.props.radius];
  45842. }
  45843. if (this.props.color) {
  45844. this.props.updateTriggers.getColor = [this.props.color];
  45845. }
  45846. }
  45847. this.layer = new window.DeckGL.ScatterplotLayer(this.props);
  45848. }
  45849. /**
  45850. * @description path-layer
  45851. * @private
  45852. */
  45853. _createPathLayer() {
  45854. this.props.getPath = this.callback.getPath
  45855. ? this.callback.getPath
  45856. : function (feature) {
  45857. return feature.geometry.coordinates;
  45858. };
  45859. //以下几个函数也可走默认值
  45860. if (this.callback.getColor) {
  45861. this.props.getColor = this.callback.getColor;
  45862. }
  45863. if (this.callback.getWidth) {
  45864. this.props.getWidth = this.callback.getWidth;
  45865. }
  45866. if (this.callback.getDashArray) {
  45867. this.props.getDashArray = this.callback.getDashArray;
  45868. }
  45869. this.layer = new window.DeckGL.PathLayer(this.props);
  45870. }
  45871. /**
  45872. * @description polygon-layer
  45873. * @private
  45874. */
  45875. _createPolygonLayer() {
  45876. this.props.getPolygon = this.callback.getPolygon
  45877. ? this.callback.getPolygon
  45878. : function (feature) {
  45879. return feature.geometry.coordinates;
  45880. };
  45881. //todo 思考下真的让用户配这么多回调么,或者先判断下数据属性里面有没有配置的属性值?
  45882. if (this.callback.getElevation) {
  45883. this.props.getElevation = this.callback.getElevation;
  45884. }
  45885. if (this.callback.getFillColor) {
  45886. this.props.getFillColor = this.callback.getFillColor;
  45887. }
  45888. if (this.callback.getLineColor) {
  45889. this.props.getLineColor = this.callback.getLineColor;
  45890. }
  45891. if (this.callback.getLineWidth) {
  45892. this.props.getLineWidth = this.callback.getLineWidth;
  45893. }
  45894. this.props.updateTriggers = {};
  45895. this.props.updateTriggers.getColor = this.props.color ? this.props.color : [0, 0, 128, 128];
  45896. this.layer = new window.DeckGL.PolygonLayer(this.props);
  45897. }
  45898. /**
  45899. * @description arc-layer
  45900. * @private
  45901. */
  45902. _createArcLineLayer() {
  45903. //todo ArcLineLayer geojson coordinates数组中只能有一个线段
  45904. this.props.getSourcePosition = this.callback.getSourcePosition
  45905. ? this.callback.getSourcePosition
  45906. : function (feature) {
  45907. if (!feature) {
  45908. return [0, 0, 0];
  45909. }
  45910. return feature.geometry.coordinates[0];
  45911. };
  45912. this.props.getTargetPosition = this.callback.getTargetPosition
  45913. ? this.callback.getTargetPosition
  45914. : function (feature) {
  45915. if (!feature) {
  45916. return [0, 0, 0];
  45917. }
  45918. return feature.geometry.coordinates[1];
  45919. };
  45920. if (this.callback.getStrokeWidth) {
  45921. this.props.getStrokeWidth = this.callback.getStrokeWidth;
  45922. }
  45923. if (this.callback.getSourceColor) {
  45924. this.props.getSourceColor = this.callback.getSourceColor;
  45925. }
  45926. if (this.callback.getTargetColor) {
  45927. this.props.getTargetColor = this.callback.getTargetColor;
  45928. }
  45929. this.layer = new window.DeckGL.ArcLayer(this.props);
  45930. }
  45931. /**
  45932. * @description hexagon-layer
  45933. * @private
  45934. */
  45935. _createHexagonLayer() {
  45936. this.props.getPosition = this.callback.getPosition
  45937. ? this.callback.getPosition
  45938. : function (feature) {
  45939. if (!feature) {
  45940. return [0, 0, 0];
  45941. }
  45942. return feature.geometry.coordinates;
  45943. };
  45944. if (this.callback.getColorValue) {
  45945. this.props.getColorValue = this.callback.getColorValue;
  45946. }
  45947. if (this.callback.getElevationValue) {
  45948. this.props.getElevationValue = this.callback.getElevationValue;
  45949. }
  45950. this.layer = new window.DeckGL.HexagonLayer(this.props);
  45951. }
  45952. _initContainer(targetElement, mapElement) {
  45953. const { width, height } = mapElement.style;
  45954. this.canvas = this._createCanvas(width, height);
  45955. targetElement.appendChild(this.canvas);
  45956. }
  45957. _createCanvas(width, height) {
  45958. let canvas = document.createElement('canvas');
  45959. canvas.id = this.id;
  45960. canvas.style.position = 'absolute';
  45961. canvas.style.top = 0 + 'px';
  45962. canvas.style.left = 0 + 'px';
  45963. canvas.style.cursor = '';
  45964. canvas.width = parseInt(width);
  45965. canvas.height = parseInt(height);
  45966. canvas.style.width = width;
  45967. canvas.style.height = height;
  45968. return canvas;
  45969. }
  45970. }
  45971. ;// CONCATENATED MODULE: ./src/maplibregl/overlay/DeckglLayer.js
  45972. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  45973. * This program are made available under the terms of the Apache License, Version 2.0
  45974. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45975. /**
  45976. * @class DeckglLayer
  45977. * @category Visualization DeckGL
  45978. * @classdesc Deckgl 高效率图层类。该图图层为综合图层,通过该图层可创建 高效率点图层、路径图层(线图层)、高效率面图层、曲线图层、
  45979. * 正六边形图层(蜂巢图层)、网格图层,只需给定相依配置,因此,在创建图层之前,请仔细阅读参数配置。
  45980. * @version 11.1.0
  45981. * @modulecategory Overlay
  45982. * @param {string} layerTypeID - 高效率图层类型 ID,包括 "scatter-plot" 高效率点图层、"path-layer" 路径图层(线图层)、
  45983. * "polygon-layer" 高效率面图层、"arc-layer" 曲线图层、"hexagon-layer" 正六边形图层(蜂巢图层)、"screen-grid-layer" 网格图层。
  45984. *
  45985. * @param {Object} options - 图层配置项,包括以下参数:
  45986. * @param {Object} [options.layerId] - DeckglLayer 图层 Dom 元素 ID。默认使用 CommonUtil.createUniqueID("graphicLayer_" + this.layerTypeID + "_") 创建专题图层 ID。
  45987. * @param {Array.<GeoJSONObject>} options.data - 图层数据,支持 GeoJSON 规范数据类型。
  45988. * @param {Object} options.callback - deckgl 图层回调函数配置项。
  45989. * @param {Object} options.props - deckgl 图层配置项, 在该参数下配置图层配置项:
  45990. * @param {boolean} options.props.coverage - "hexagon-layer" 配置项:六边形半径乘数,介于0 - 1之间。六边形的最终半径通过覆盖半径计算。注意:覆盖范围不会影响分数的分配方式。分配方式的半径仅由半径属性确定;
  45991. * @param {boolean} options.props.hexagonAggregator - "hexagon-layer" 配置项:* @param {boolean}
  45992. * @param {Object} options.props.lightSettings - 光照配置项。
  45993. * @param {Array} options.props.lightSettings.lightsPosition - 光照配置项:指定为`[x,y,z]`的光在平面阵列中的位置`, 在一个平面阵列。长度应该是 `3 x numberOfLights`。
  45994. * @param {Array} options.props.lightSettings.lightsStrength - 光照配置项:平面阵列中指定为“[x,y]`的灯的强度。长度应该是`2 x numberOfLights`。
  45995. * @param {number} [options.props.lightSettings.numberOfLights=1] - 光照配置项:光照值,最大值为 `5`。
  45996. * @param {number} [options.props.lightSettings.coordinateSystem=COORDINATE_SYSTEM.LNGLAT] - 光照配置项:指定灯位置的坐标系。
  45997. * @param {number} [options.props.lightSettings.coordinateOrigin=[0, 0, 0]] - 光照配置项:指定灯位置的坐标原点。
  45998. * @param {number} [options.props.lightSettings.modelMatrix] - 光照配置项:光位置的变换矩阵。
  45999. * @param {number} [options.props.lightSettings.ambientRatio=0.4] - 光照配置项:光照的环境比例。
  46000. * @param {number} [options.props.lightSettings.diffuseRatio=0.6] - 光照配置项:光的漫反射率。
  46001. * @param {number} [options.props.lightSettings.specularRatio=0.8] - 光照配置项:光的镜面反射率。
  46002. * @param {number} [options.props.opacity=1] - 公共配置项:图层不透明度度。
  46003. * @param {boolean} [options.props.pickable=false] - 公共配置项:是否响应鼠标事件(鼠标点击,鼠标滑动)。
  46004. * @param {function} [options.props.autoHighlight=false] - 公共配置项:鼠标滑动高亮要素。
  46005. * @param {function} [options.props.highlightColor=[0, 0, 128, 128]] - 公共配置项:鼠标滑动高亮颜色。
  46006. * @param {function} [options.props.onClick] - 公共配置项:鼠标点击事件。
  46007. * @param {function} [options.props.onHover] - 公共配置项:鼠标滑动事件。
  46008. * @param {number} [options.props.radiusScale=1] - "scatter-plot" 配置项:散点半径比例。
  46009. * @param {boolean} [options.props.outline=false] - "scatter-plot" 配置项:是否边线显示。
  46010. * @param {number} [options.props.strokeWidth=1] - "scatter-plot" 配置项:边线宽度。
  46011. * @param {number} [options.props.radiusMinPixels=0] - "scatter-plot" 配置项:半径最小像素值。
  46012. * @param {number} [options.props.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - "scatter-plot" 配置项:半径最大像素值。
  46013. * @param {boolean} [options.props.fp64=false] - "scatter-plot" 配置项:否应以高精度64位模式呈现图层。
  46014. * @param {number} [options.props.widthScale=1] - "path-layer" 配置项:线宽比例。
  46015. * @param {number} [options.props.widthMinPixels=0] - "path-layer" 配置项:线宽最小像素值。
  46016. * @param {number} [options.props.widthMaxPixels=Number.MAX_SAFE_INTEGER] - "path-layer" 配置项:线宽最大像素值。
  46017. * @param {boolean} [options.props.rounded=false] - "path-layer" 配置项:节点是否绘制为弧形。
  46018. * @param {number} [options.props.miterLimit=4] - "path-layer" 配置项:节点相对于线宽的最大范围,仅在 rounded 为 false 时有效;
  46019. * @param {boolean} [options.props.fp64=false] - "path-layer" 配置项:否应以高精度64位模式呈现图层。
  46020. * @param {boolean} [options.props.dashJustified=false] - "path-layer" 配置项:是否虚线形式显示,仅在 getDashArray() 回调函数被指定时有效。
  46021. * @param {boolean} [options.props.filled=true] - "polygon-layer" 配置项:是否填充面。
  46022. * @param {boolean} [options.props.stroked=true] - "polygon-layer" 配置项:是否绘制边线。
  46023. * @param {boolean} [options.props.extruded=false] - "polygon-layer" 配置项:是否拉伸建筑。
  46024. * @param {boolean} [options.props.wireframe=false] - "polygon-layer" 配置项:当面被拉伸为建筑时,是否描绘建筑物边线。
  46025. * @param {boolean} [options.props.elevationScale=1] - "polygon-layer" 配置项:海拔比例。
  46026. * @param {boolean} [options.props.lineWidthScale=1] - "polygon-layer" 配置项:线宽比例。
  46027. * @param {boolean} [options.props.lineWidthMinPixels=0] - "polygon-layer" 配置项:线宽最小像素值。
  46028. * @param {boolean} [options.props.lineWidthMaxPixels=Number.MAX_SAFE_INTEGER] - "polygon-layer" 配置项:线宽最大像素值。
  46029. * @param {boolean} [options.props.lineJointRounded=false] - "polygon-layer" 配置项:节点是否绘制为弧形。
  46030. * @param {boolean} [options.props.lineMiterLimit=4] - "polygon-layer" 配置项:节点相对于线宽的最大范围,仅在 lineJointRounded 为 false 时有效。
  46031. * @param {boolean} [options.props.lineDashJustified=false] - "polygon-layer" 配置项:是否虚线形式显示,仅在 getLineDashArray() 回调函数被指定时有效。
  46032. * @param {boolean} [options.props.fp64=false] - "polygon-layer" 配置项:否应以高精度64位模式呈现图层。
  46033. * @param {boolean} [options.props.fp64=false] - "arc-layer" 配置项:否应以高精度64位模式呈现图层。
  46034. * @param {boolean} [options.props.strokeWidth=1] - "arc-layer" 配置项:线宽。
  46035. * @param {boolean} [options.props.radius=1000] - "hexagon-layer" 配置项:六边形半径值。
  46036. * @param {boolean} [options.props.extruded=false] - "hexagon-layer" 配置项:是否拉伸要素。
  46037. * @param {boolean} [options.props.upperPercentile=100] - "hexagon-layer" 配置项:筛选箱并通过upperPercentile重新计算颜色。颜色值大于upperPercentile的六边形将被隐藏。
  46038. * @param {boolean} [options.props.elevationScale=1] - "hexagon-layer" 配置项:高程乘数,实际海拔高度由 elevationScale * getElevation(d)计算。 elevationScale是一个方便的属性,可以在不更新数据的情况下缩放所有六边形。
  46039. * @param {boolean} [options.props.colorDomain=false] - "hexagon-layer" 配置项:色阶。
  46040. * @param {boolean} [options.props.colorRange=[[255,255,178,255],[254,217,118,255],[254,178,76,255],[253,141,60,255],[240,59,32,255],[189,0,38,255]]] - "hexagon-layer" 配置项:色带。
  46041. * @extends {DeckglLayerBase}
  46042. * @usage
  46043. */
  46044. class DeckglLayer extends DeckglLayerBase {
  46045. constructor(layerTypeID, options) {
  46046. super(layerTypeID, options);
  46047. this.type='custom';
  46048. this.renderingMode = '3d';
  46049. this.overlay = true;
  46050. }
  46051. /**
  46052. * @function DeckglLayer.prototype.onAdd
  46053. * @param {maplibregl.Map} map - MapLibreGL Map 对象。
  46054. */
  46055. onAdd(map) {
  46056. this.map = map;
  46057. if (this.canvas) {
  46058. this.mapContainer = this.map.getCanvasContainer();
  46059. return this;
  46060. }
  46061. if (this._isEPSG3857()) {
  46062. this.coordinateSystem = 3;
  46063. this.isGeographicCoordinateSystem = true;
  46064. } else {
  46065. this.coordinateSystem = 1;
  46066. this.isGeographicCoordinateSystem = false;
  46067. }
  46068. //创建图层容器
  46069. this._initContainer(this.map.getCanvasContainer(), this.map.getCanvas());
  46070. //创建 deckgl 图层
  46071. this._createLayerByLayerTypeID();
  46072. var mapState = this._getState();
  46073. let deckOptions = {};
  46074. for (let key in mapState) {
  46075. deckOptions[key] = mapState[key];
  46076. }
  46077. deckOptions.layers = [this.layer];
  46078. deckOptions.canvas = this.canvas;
  46079. this.deckGL = new window.DeckGL.experimental.DeckGLJS(deckOptions);
  46080. this._draw();
  46081. }
  46082. /**
  46083. * @function DeckglLayer.prototype.onRemove
  46084. */
  46085. onRemove() {
  46086. this.map.getCanvasContainer().removeChild(this.canvas);
  46087. this.clear();
  46088. }
  46089. getMapInfo() {
  46090. let center = this.map.getCenter();
  46091. let zoom = this.map.getZoom();
  46092. let maxZoom = this.map.getMaxZoom();
  46093. let pitch = this.map.getPitch();
  46094. let bearing = this.map.getBearing();
  46095. let longitude = center.lng;
  46096. let latitude = center.lat;
  46097. return { center, zoom, maxZoom, pitch, bearing, longitude, latitude };
  46098. }
  46099. /**
  46100. * @function DeckglLayer.prototype.render
  46101. */
  46102. render() {
  46103. this._draw();
  46104. }
  46105. _isEPSG3857() {
  46106. return this.map.getCRS && this.map.getCRS() !== (external_maplibregl_default()).CRS.EPSG3857
  46107. }
  46108. }
  46109. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/GeoText.js
  46110. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46111. * This program are made available under the terms of the Apache License, Version 2.0
  46112. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46113. /**
  46114. * @class GeometryGeoText
  46115. * @aliasclass Geometry.GeoText
  46116. * @deprecatedclass SuperMap.Geometry.GeoText
  46117. * @classdesc 文本标签类。
  46118. * @category BaseTypes Geometry
  46119. * @extends {Geometry}
  46120. * @param {number} x - x 坐标。
  46121. * @param {number} y - y 坐标。
  46122. * @param {string} text - 标签中的文本内容。
  46123. * @usage
  46124. */
  46125. class GeoText extends Geometry_Geometry {
  46126. constructor(x, y, text) {
  46127. super(x, y, text);
  46128. /**
  46129. * @member {number} GeometryGeoText.prototype.x
  46130. * @description 横坐标。
  46131. */
  46132. this.x = parseFloat(x);
  46133. /**
  46134. * @member {number} GeometryGeoText.prototype.y
  46135. * @description 纵坐标。
  46136. */
  46137. this.y = parseFloat(y);
  46138. /**
  46139. * @member {string} GeometryGeoText.prototype.text
  46140. * @description 标签中的文本内容。
  46141. */
  46142. this.text = text.toString();
  46143. /**
  46144. * @member {Object} GeometryGeoText.prototype.bsInfo
  46145. * @description 标签范围的基础信息。
  46146. * @property {number} w - bounds 的宽度。
  46147. * @property {number} h - bounds 的高度。
  46148. */
  46149. this.bsInfo = {
  46150. "h": null,
  46151. "w": null
  46152. };
  46153. this.element = document.createElement('span');
  46154. this.CLASS_NAME = "SuperMap.Geometry.GeoText";
  46155. this.geometryType = "GeoText";
  46156. }
  46157. /**
  46158. * @function GeometryGeoText.prototype.destroy
  46159. * @description 销毁文本标签类。
  46160. */
  46161. destroy() {
  46162. super.destroy();
  46163. this.x = null;
  46164. this.y = null;
  46165. this.text = null;
  46166. }
  46167. /**
  46168. * @function GeometryGeoText.prototype.getCentroid
  46169. * @description 获取标签对象的质心。
  46170. * @returns {GeometryPoint} 标签对象的质心。
  46171. */
  46172. getCentroid() {
  46173. return new Point(this.x, this.y);
  46174. }
  46175. /**
  46176. * @function GeometryGeoText.prototype.clone
  46177. * @description 克隆标签对象。
  46178. * @returns {GeometryGeoText} 克隆后的标签对象。
  46179. */
  46180. clone(obj) {
  46181. if (obj == null) {
  46182. obj = new GeoText(this.x, this.y, this.text);
  46183. }
  46184. Util_Util.applyDefaults(obj, this);
  46185. return obj;
  46186. }
  46187. /**
  46188. * @function GeometryGeoText.prototype.calculateBounds
  46189. * @description 计算标签对象的范围。
  46190. */
  46191. calculateBounds() {
  46192. this.bounds = new Bounds(this.x, this.y,
  46193. this.x, this.y);
  46194. }
  46195. /**
  46196. * @function GeometryGeoText.prototype.getLabelPxBoundsByLabel
  46197. * @description 根据绘制好的标签获取文字标签的像素范围,参数的单位是像素;此方法相对于 getLabelPxBoundsByText 效率较低,但支持所有格式的文本。
  46198. * @param {Object} locationPixel - 标签的位置点,该对象含有属性 x(横坐标),属性 y(纵坐标)。
  46199. * @param {string} labelWidth - 标签的宽度,如:“90px”。
  46200. * @param {string} labelHeight - 标签的高度。
  46201. * @param {Object} style - 标签的 style。
  46202. * @returns {Bounds} 标签的像素范围。
  46203. */
  46204. getLabelPxBoundsByLabel(locationPixel, labelWidth, labelHeight, style) {
  46205. var labelPxBounds, left, bottom, top, right;
  46206. var locationPx = Util_Util.cloneObject(locationPixel);
  46207. //计算文本行数
  46208. var theText = style.label || this.text;
  46209. var textRows = theText.split('\n');
  46210. var laberRows = textRows.length;
  46211. //处理文字对齐
  46212. labelWidth = parseFloat(labelWidth);
  46213. labelHeight = parseFloat(labelHeight);
  46214. if (laberRows > 1) {
  46215. labelHeight = parseFloat(labelHeight) * laberRows;
  46216. }
  46217. if (style.labelAlign && style.labelAlign !== "cm") {
  46218. switch (style.labelAlign) {
  46219. case "lt":
  46220. locationPx.x += labelWidth / 2;
  46221. locationPx.y += labelHeight / 2;
  46222. break;
  46223. case "lm":
  46224. locationPx.x += labelWidth / 2;
  46225. break;
  46226. case "lb":
  46227. locationPx.x += labelWidth / 2;
  46228. locationPx.y -= labelHeight / 2;
  46229. break;
  46230. case "ct":
  46231. locationPx.y += labelHeight / 2;
  46232. break;
  46233. case "cb":
  46234. locationPx.y -= labelHeight / 2;
  46235. break;
  46236. case "rt":
  46237. locationPx.x -= labelWidth / 2;
  46238. locationPx.y += labelHeight / 2;
  46239. break;
  46240. case "rm":
  46241. locationPx.x -= labelWidth / 2;
  46242. break;
  46243. case "rb":
  46244. locationPx.x -= labelWidth / 2;
  46245. locationPx.y -= labelHeight / 2;
  46246. break;
  46247. default:
  46248. break;
  46249. }
  46250. }
  46251. this.bsInfo.h = labelHeight;
  46252. this.bsInfo.w = labelWidth;
  46253. //bounds的四边
  46254. left = locationPx.x - parseFloat(labelWidth) / 2;
  46255. bottom = locationPx.y + parseFloat(labelHeight) / 2;
  46256. right = locationPx.x + parseFloat(labelWidth) / 2;
  46257. top = locationPx.y - parseFloat(labelHeight) / 2;
  46258. labelPxBounds = new Bounds(left, bottom, right, top);
  46259. return labelPxBounds;
  46260. }
  46261. /**
  46262. * @function GeometryGeoText.prototype.getLabelPxBoundsByText
  46263. * @description 根据文本内容获取文字标签的像素范围。
  46264. * @param {Object} locationPixel - 标签的位置点,该对象含有属性 x(横坐标),属性 y(纵坐标)。
  46265. * @param {Object} style - 标签的样式。
  46266. * @returns {Bounds} 标签的像素范围。
  46267. */
  46268. getLabelPxBoundsByText(locationPixel, style) {
  46269. var labelPxBounds, left, bottom, top, right;
  46270. var labelSize = this.getLabelPxSize(style);
  46271. var locationPx = Util_Util.cloneObject(locationPixel);
  46272. //处理文字对齐
  46273. if (style.labelAlign && style.labelAlign !== "cm") {
  46274. switch (style.labelAlign) {
  46275. case "lt":
  46276. locationPx.x += labelSize.w / 2;
  46277. locationPx.y += labelSize.h / 2;
  46278. break;
  46279. case "lm":
  46280. locationPx.x += labelSize.w / 2;
  46281. break;
  46282. case "lb":
  46283. locationPx.x += labelSize.w / 2;
  46284. locationPx.y -= labelSize.h / 2;
  46285. break;
  46286. case "ct":
  46287. locationPx.y += labelSize.h / 2;
  46288. break;
  46289. case "cb":
  46290. locationPx.y -= labelSize.h / 2;
  46291. break;
  46292. case "rt":
  46293. locationPx.x -= labelSize.w / 2;
  46294. locationPx.y += labelSize.h / 2;
  46295. break;
  46296. case "rm":
  46297. locationPx.x -= labelSize.w / 2;
  46298. break;
  46299. case "rb":
  46300. locationPx.x -= labelSize.w / 2;
  46301. locationPx.y -= labelSize.h / 2;
  46302. break;
  46303. default:
  46304. break;
  46305. }
  46306. }
  46307. this.bsInfo.h = labelSize.h;
  46308. this.bsInfo.w = labelSize.w;
  46309. left = locationPx.x - labelSize.w / 2;
  46310. bottom = locationPx.y + labelSize.h / 2;
  46311. //处理斜体字
  46312. if (style.fontStyle && style.fontStyle === "italic") {
  46313. right = locationPx.x + labelSize.w / 2 + parseInt(parseFloat(style.fontSize) / 2);
  46314. } else {
  46315. right = locationPx.x + labelSize.w / 2;
  46316. }
  46317. top = locationPx.y - labelSize.h / 2;
  46318. labelPxBounds = new Bounds(left, bottom, right, top);
  46319. return labelPxBounds;
  46320. }
  46321. /**
  46322. * @function GeometryGeoText.prototype.getLabelPxSize
  46323. * @description 获取 label 的像素大小。
  46324. * @param {Object} style - 标签样式。
  46325. * @returns {Object} 标签大小对象,属性 w 表示标签的宽度,属性 h 表示标签的高度。
  46326. */
  46327. getLabelPxSize(style) {
  46328. var text,//文本内容
  46329. fontSize,//字体大小
  46330. spacing = 1,//两个字符间的间距(单位:px)
  46331. lineSpacing = 0.2,
  46332. bgstrokeWidth = parseFloat(style.strokeWidth);//标签背景框边框的宽度
  46333. text = style.label || this.text;
  46334. if (style.fontSize) {
  46335. fontSize = parseFloat(style.fontSize);
  46336. } else {
  46337. fontSize = parseFloat("12px");
  46338. }
  46339. //标签宽高
  46340. var labelW, labelH;
  46341. var textRows = text.split('\n');
  46342. var numRows = textRows.length;
  46343. if (numRows > 1) {
  46344. labelH = fontSize * numRows + numRows + bgstrokeWidth + lineSpacing * fontSize;
  46345. } else {
  46346. labelH = fontSize + bgstrokeWidth + lineSpacing * fontSize + 1;
  46347. }
  46348. //取最大宽度
  46349. labelW = 0;
  46350. if (this.labelWTmp && labelW < this.labelWTmp) {
  46351. labelW = this.labelWTmp;
  46352. }
  46353. for (var i = 0; i < numRows; i++) {
  46354. var textCharC = this.getTextCount(textRows[i]);
  46355. var labelWTmp = this.labelWTmp = Util_Util.getTextBounds(style, textRows[i], this.element).textWidth + textCharC.textC * spacing + bgstrokeWidth;
  46356. if (labelW < labelWTmp) {
  46357. labelW = labelWTmp;
  46358. }
  46359. }
  46360. var labelSize = new Object(); //标签大小
  46361. labelSize.h = labelH;
  46362. labelSize.w = labelW;
  46363. return labelSize;
  46364. }
  46365. /**
  46366. * @function GeometryGeoText.prototype.getTextCount
  46367. * @description 获取 text 中的字符个数。
  46368. * @param {string} text - 字符串。
  46369. * @returns {Object} 字符个数统计结果,属性 cnC 表示中文字符个数,属性 enC 表示英文字符个数,属性 textC 表示字符总个数。
  46370. */
  46371. getTextCount(text) {
  46372. var textCharCount = {};
  46373. var cnCount = 0;
  46374. var enCount = 0;
  46375. for (var i = 0; i < text.length; i++) {
  46376. if (text.charCodeAt(i) > 255) { //遍历判断字符串中每个字符的Unicode码,大于255则为中文
  46377. cnCount++;
  46378. } else {
  46379. enCount++;
  46380. }
  46381. }
  46382. //中午字符个数
  46383. textCharCount.cnC = cnCount;
  46384. //英文字符个数
  46385. textCharCount.enC = enCount;
  46386. //字符总个数
  46387. textCharCount.textC = text.length;
  46388. return textCharCount;
  46389. }
  46390. }
  46391. ;// CONCATENATED MODULE: ./src/common/iServer/ServerFeature.js
  46392. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46393. * This program are made available under the terms of the Apache License, Version 2.0
  46394. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46395. /**
  46396. * @class ServerFeature
  46397. * @deprecatedclass SuperMap.ServerFeature
  46398. * @category iServer Data Feature
  46399. * @classdesc 服务端矢量要素类。该类描述了服务端返回的矢量要素的相关信息,包括字段和几何信息。
  46400. * @param {ServerGeometry} geometry - 矢量要素的几何信息。
  46401. * @param {Object} options - 参数。
  46402. * @param {Array.<string>} [options.fieldNames] - 矢量要素的属性字段名集合。
  46403. * @param {Array.<string>} [options.fieldValues] - 矢量要素的属性字段值集合。
  46404. * @usage
  46405. */
  46406. class ServerFeature {
  46407. constructor(options) {
  46408. /**
  46409. * @member {Array.<string>} [ServerFeature.prototype.fieldNames]
  46410. * @description 矢量要素的属性字段名集合。
  46411. */
  46412. this.fieldNames = null;
  46413. /**
  46414. * @member {Array.<string>} [ServerFeature.prototype.fieldValues]
  46415. * @description 矢量要素的属性字段值集合。
  46416. */
  46417. this.fieldValues = null;
  46418. /**
  46419. * @member {ServerGeometry} ServerFeature.prototype.geometry
  46420. * @description 矢量要素的几何信息。
  46421. */
  46422. this.geometry = null;
  46423. if (options) {
  46424. Util_Util.extend(this, options);
  46425. }
  46426. this.CLASS_NAME = "SuperMap.ServerFeature";
  46427. }
  46428. /**
  46429. * @function ServerFeature.prototype.destroy
  46430. * @description 释放资源,将引用资源的属性置空。
  46431. */
  46432. destroy() {
  46433. var me = this;
  46434. me.fieldNames = null;
  46435. me.fieldValues = null;
  46436. if (me.geometry) {
  46437. me.geometry.destroy();
  46438. me.geometry = null;
  46439. }
  46440. }
  46441. /**
  46442. * @function ServerFeature.prototype.toFeature
  46443. * @description 将服务端矢量要素 ServerFeature 转换为客户端矢量要素 Feature。
  46444. * @returns {Vector} 转换后的客户端矢量要素。
  46445. */
  46446. toFeature() {
  46447. var names, values, geo,
  46448. attr = {},
  46449. me = this,
  46450. feature;
  46451. names = me.fieldNames;
  46452. values = me.fieldValues;
  46453. for (var i in names) {
  46454. attr[names[i]] = values[i];
  46455. }
  46456. if (me.geometry) {
  46457. geo = me.geometry.toGeometry();
  46458. }
  46459. feature = new Vector(geo, attr);
  46460. if (me.geometry && me.geometry.id) {
  46461. feature.fid = me.geometry.id;
  46462. }
  46463. return feature;
  46464. }
  46465. /**
  46466. * @function ServerFeature.prototype.fromJson
  46467. * @description 将 JSON 对象表示服务端矢量要素转换为 ServerFeature。
  46468. * @param {Object} jsonObject - 要转换的 JSON 对象。
  46469. * @returns {ServerFeature} 转化后的 ServerFeature 对象。
  46470. */
  46471. static fromJson(jsonObject) {
  46472. var geo = null;
  46473. if (!jsonObject) {
  46474. return;
  46475. }
  46476. geo = jsonObject.geometry;
  46477. if (geo) {
  46478. geo = ServerGeometry.fromJson(geo);
  46479. }
  46480. return new ServerFeature({
  46481. fieldNames: jsonObject.fieldNames,
  46482. fieldValues: jsonObject.fieldValues,
  46483. geometry: geo
  46484. });
  46485. }
  46486. }
  46487. ;// CONCATENATED MODULE: ./src/common/overlay/heatmap/HeatMapLayerRenderer.js
  46488. /**
  46489. * @private
  46490. * @class HeatMapLayerRenderer
  46491. * @classdesc 热力图层渲染器类。
  46492. * @category Visualization HeatMap
  46493. * @param {string} name - 图层名称。
  46494. * @param {Object} options - 构造参数。
  46495. * @param {string} options.featureWeight - 对应 feature 属性中的热点权重字段名称,权重值类型为 float。
  46496. * @param {string} [options.id] - 专题图层ID。默认使用 CommonUtil.createUniqueID("HeatMapLayer_") 创建专题图层 ID。
  46497. * @param {number} [options.radius=50] - 热点渲染的最大半径(热点像素半径),单位为 px,当 useGeoUnit参数 为 true 时,单位使用当前图层地理坐标单位。热点显示的时候以精确点为中心点开始往四周辐射衰减,其衰减半径和权重值成比列。
  46498. * @param {boolean} [options.loadWhileAnimating=true] - 是否实时重绘。(当绘制大数据量要素的情况下会出现卡顿,建议把该参数设为false)。
  46499. * @param {number} [options.opacity=1] - 图层不透明度。
  46500. * @param {Array.<string>} [options.colors=['blue','cyan','lime','yellow','red']] - 颜色线性渐变数组,颜色值必须为canvas所支。
  46501. * @param {boolean} [options.useGeoUnit=false] - 使用地理单位,即默认热点半径默认使用像素单位。当设置为 true 时,热点半径和图层地理坐标保持一致。
  46502. * @usage
  46503. */
  46504. class HeatMapLayerRenderer {
  46505. constructor(options) {
  46506. this.options = options;
  46507. /**
  46508. * @member {Object} HeatMapLayerRenderer.prototype.rootCanvas
  46509. * @description 热点图主绘制面板。
  46510. */
  46511. this.rootCanvas = null;
  46512. /**
  46513. * @member {Array.<FeatureVector>} HeatMapLayerRenderer.prototype.features
  46514. * @description 热点信息数组,记录存储图层上添加的所有热点信息。
  46515. */
  46516. this.features = [];
  46517. /**
  46518. * @member {boolean} [HeatMapLayerRenderer.prototype.visibility=true]
  46519. * @description 图层显示状态属性。
  46520. */
  46521. this.visibility = true;
  46522. /**
  46523. * @member {number} [HeatMapLayerRenderer.prototype.opacity=1]
  46524. * @description 图层不透明度,取值范围[0,1]。
  46525. */
  46526. this.opacity = options.opacity ? options.opacity : 1;
  46527. /**
  46528. * @member {Array.<string>} [HeatMapLayerRenderer.prototype.colors=['blue','cyan','lime','yellow','red']]
  46529. * @description 颜色线性渐变数组。
  46530. */
  46531. this.colors = options.colors ? options.colors : ['blue', 'cyan', 'lime', 'yellow', 'red'];
  46532. /**
  46533. * @member {boolean} [HeatMapLayerRenderer.prototype.useGeoUnit=false]
  46534. * @description 使用地理单位,即默认热点半径默认使用像素单位。当设置为 true 时,热点半径和图层地理坐标保持一致。
  46535. */
  46536. this.useGeoUnit = options.useGeoUnit ? options.useGeoUnit : false;
  46537. /**
  46538. * @member {number} [HeatMapLayerRenderer.prototype.radius=50]
  46539. * @description 热点渲染的最大半径(热点像素半径),
  46540. * 热点显示的时候以精确点为中心点开始往四周辐射衰减,
  46541. * 其衰减半径和权重值成比列。
  46542. */
  46543. this.radius = options.radius ? options.radius : 50;
  46544. /**
  46545. * @member {string} HeatMapLayerRenderer.prototype.featureWeight
  46546. * @description 对应 feature 属性中的热点权重字段名称,权重值类型为 number。
  46547. * @example
  46548. * //feature.attributes中表示权重的字段为 height,则在 HeatMapLayer 的 featureWeight 参数赋值为 "height"。
  46549. * feature1.attributes.height = 7.0;
  46550. * feature2.attributes.height = 6.0;
  46551. * var heatMapLayer = new HeatMapLayer("heatmaplayer",{"featureWeight":"height"});
  46552. * heatMapLayer.addFeatures([feature1,feature2]);
  46553. */
  46554. this.featureWeight = options.featureWeight ? options.featureWeight : null;
  46555. /**
  46556. * @member {number} HeatMapLayerRenderer.prototype.maxWeight
  46557. * @description 设置权重最大值。默认将按照当前屏幕范围内热点所拥有的权重最大值绘制热点图。
  46558. */
  46559. this.maxWeight = null;
  46560. /**
  46561. * @member {number} HeatMapLayerRenderer.prototype.minWeight
  46562. * @description 设置权重最小值。默认将按照当前屏幕范围内热点所拥有的权重最小值绘制热点图。
  46563. */
  46564. this.minWeight = null;
  46565. /**
  46566. * @member {Object} HeatMapLayerRenderer.prototype.canvasContext
  46567. * @description 热点图主绘制对象。
  46568. */
  46569. this.canvasContext = null;
  46570. /**
  46571. * @member {number} HeatMapLayerRenderer.prototype.maxWidth
  46572. * @description 当前绘制面板宽度。默认和当前 map 窗口宽度一致。
  46573. */
  46574. this.maxWidth = null;
  46575. /**
  46576. * @member {number} HeatMapLayerRenderer.prototype.maxHeight
  46577. * @description 当前绘制面板宽度。默认和当前 map 窗口高度一致。
  46578. */
  46579. this.maxHeight = null;
  46580. this.extent = {};
  46581. this.mapElement = options.mapElement;
  46582. this._createCanvasContainer(options.targetElement, options.size);
  46583. }
  46584. /**
  46585. * @function HeatMapLayerRenderer.prototype.addFeatures
  46586. * @description 添加热点信息。
  46587. * @param {GeoJSONObject} features - 待添加的要素数组。
  46588. * @example
  46589. * var geojson = {
  46590. * "type": "FeatureCollection",
  46591. * "features": [
  46592. * {
  46593. * "type": "feature",
  46594. * "geometry": {
  46595. * "type": "Point", //只支持point类型
  46596. * "coordinates": [0, 0]
  46597. * },
  46598. * "properties": {
  46599. * "height": Math.random()*9,
  46600. * "geoRadius": useGeoRadius?radius:null
  46601. * }
  46602. * }
  46603. * ]
  46604. * };
  46605. * var HeatMapLayerRenderer = new HeatMapLayerRenderer("HeatMapLayerRenderer",{"featureWeight":"height"}); pLayer = new HeatMapLayerRenderer("HeatMapLayerRenderer",{"featureWeight":"height"});
  46606. * HeatMapLayerRenderer.addFeatures(geojson);
  46607. * map.addLayer(HeatMapLayerRenderer);
  46608. */
  46609. addFeatures(features) {
  46610. this.features = this.toiClientFeature(features);
  46611. //支持更新features,刷新底图
  46612. this.refresh();
  46613. }
  46614. /**
  46615. * @function HeatMapLayerRenderer.prototype.refresh
  46616. * @description 强制刷新当前热点显示,在图层热点数组发生变化后调用,更新显示。
  46617. */
  46618. refresh() {
  46619. if (this.features.length === 0) {
  46620. return;
  46621. }
  46622. this.updateHeatPoints(this.extent);
  46623. }
  46624. /**
  46625. * @function HeatMapLayerRenderer.prototype.setOpacity
  46626. * @description 设置图层的不透明度,取值[0-1]之间。
  46627. * @param {number} [opacity] - 不透明度。
  46628. */
  46629. setOpacity(opacity) {
  46630. if (opacity !== this.opacity) {
  46631. this.opacity = opacity;
  46632. Util_Util.modifyDOMElement(this.rootCanvas, null, null, null,
  46633. null, null, null, opacity);
  46634. }
  46635. }
  46636. /**
  46637. * @function HeatMapLayerRenderer.prototype.updateHeatPoints
  46638. * @description 刷新热点图显示。
  46639. * @param {mapboxgl.LngLatBounds} bounds - 当前显示范围。
  46640. */
  46641. updateHeatPoints(bounds) {
  46642. if (this.features && this.features.length > 0) {
  46643. this.convertFastToPixelPoints(bounds);
  46644. } else {
  46645. this.canvasContext.clearRect(0, 0, this.maxWidth, this.maxWidth);
  46646. }
  46647. }
  46648. /**
  46649. * @function HeatMapLayerRenderer.prototype.convertFastToPixelPoints
  46650. * @description 过滤位于当前显示范围内的热点,并转换其为当前分辨率下的像素坐标。
  46651. * @param {mapboxgl.LngLatBounds} bounds - 当前显示范围。
  46652. * @private
  46653. */
  46654. convertFastToPixelPoints(bounds) {
  46655. var data = [], x, y, k, resolution, maxTemp, minTemp, maxWeightTemp;
  46656. //获取当前像素下的地理范围
  46657. var dw = bounds.getEast() - bounds.getWest();
  46658. var dh = bounds.getNorth() - bounds.getSouth();
  46659. var mapElement = this.mapElement;
  46660. if (dw / mapElement.width > dh / mapElement.height) {
  46661. resolution = dw / mapElement.width;
  46662. } else {
  46663. resolution = dh / mapElement.height;
  46664. }
  46665. //热点半径
  46666. this.useRadius = this.useGeoUnit ? parseInt(this.radius / resolution) : this.radius;
  46667. for (var i = 0; i < this.features.length; i++) {
  46668. var feature = this.features[i];
  46669. var point = feature.geometry;
  46670. //可通过bounds过滤需绘制的features以优化性能,但mapboxgl旋转获取得bounds不适
  46671. var pixelPoint = this.getPixelXY(new LonLat(point.x, point.y));
  46672. if (this.featureWeight) {
  46673. pixelPoint.weight = feature.attributes[this.featureWeight];//point.value;
  46674. if (!this.maxWeight) {
  46675. //找出最大最小权重值
  46676. maxTemp = maxTemp ? maxTemp : pixelPoint.weight;
  46677. minTemp = minTemp ? minTemp : pixelPoint.weight;
  46678. maxTemp = Math.max(maxTemp, pixelPoint.weight);
  46679. minTemp = Math.min(minTemp, pixelPoint.weight);
  46680. }
  46681. } else {
  46682. pixelPoint.weight = 1;
  46683. }
  46684. x = Math.floor(pixelPoint.x);
  46685. y = Math.floor(pixelPoint.y);
  46686. k = pixelPoint.weight;
  46687. data.push([x, y, k]);
  46688. }
  46689. //无最大权重设置
  46690. if (!this.maxWeight) {
  46691. if (maxTemp && minTemp) {
  46692. maxWeightTemp = (maxTemp + minTemp) / 2;
  46693. } else {
  46694. maxWeightTemp = 1;
  46695. }
  46696. this.draw(data, maxWeightTemp);
  46697. } else {
  46698. this.draw(data, this.maxWeight);
  46699. }
  46700. }
  46701. /**
  46702. * @function HeatMapLayerRenderer.prototype.draw
  46703. * @description 绘制热点图。
  46704. * @param {Array} data - convertToPixelPoints方法计算出的点。
  46705. * @private
  46706. */
  46707. draw(data, maxWeight) {
  46708. if (this.maxHeight > 0 && this.maxWidth > 0) {
  46709. //清空
  46710. var ctx = this.canvasContext;
  46711. ctx.setTransform(1, 0, 0, 1, 0, 0);
  46712. this.canvasContext.clearRect(0, 0, this.maxWidth, this.maxHeight);
  46713. this.drawCircle(this.useRadius);
  46714. this.createGradient();
  46715. for (var i = 0; i < data.length; i++) {
  46716. var p = data[i];
  46717. this.canvasContext.globalAlpha = Math.max(p[2] / maxWeight, 0.05);
  46718. this.canvasContext.drawImage(this.circle, p[0] - this.useRadius, p[1] - this.useRadius);
  46719. }
  46720. var colored = ctx.getImageData(0, 0, this.maxWidth, this.maxHeight);
  46721. this.colorize(colored.data, this.grad);
  46722. ctx.putImageData(colored, 0, 0);
  46723. } else {
  46724. return false;
  46725. }
  46726. }
  46727. /**
  46728. * @function HeatMapLayerRenderer.prototype.colorize
  46729. * @description 根据渐变色重置热点图rgb值。
  46730. * @param {Array} pixels - 像素 RGBA 值。
  46731. * @param {Array} gradient - 渐变 canvas.getImageData.data。
  46732. * @private
  46733. */
  46734. colorize(pixels, gradient) {
  46735. for (var i = 0, j; i < pixels.length; i += 4) {
  46736. j = pixels[i + 3] * 4;
  46737. if (j) {
  46738. pixels[i] = gradient[j];
  46739. pixels[i + 1] = gradient[j + 1];
  46740. pixels[i + 2] = gradient[j + 2];
  46741. }
  46742. }
  46743. }
  46744. /**
  46745. * @function HeatMapLayerRenderer.drawCircle
  46746. * @description 绘制热点半径圆。
  46747. * @param {number} r - 热点半径。
  46748. * @private
  46749. */
  46750. drawCircle(r) {
  46751. var blur = r / 2;
  46752. var circle = this.circle = document.createElement('canvas'),
  46753. ctx = circle.getContext("2d");
  46754. circle.height = 2 * r;
  46755. circle.width = 2 * r;
  46756. ctx.shadowOffsetX = ctx.shadowOffsetY = 2 * r;
  46757. ctx.shadowBlur = blur;
  46758. ctx.shadowColor = "#000000";
  46759. ctx.beginPath();
  46760. ctx.arc(-r, -r, r / 2, 0, Math.PI * 2, true);
  46761. ctx.closePath();
  46762. ctx.fill();
  46763. }
  46764. /**
  46765. * @function HeatMapLayerRenderer.createGradient
  46766. * @description 根据 options.colors 设置渐变。
  46767. * @private
  46768. */
  46769. createGradient() {
  46770. var colors = this.colors;
  46771. var canvas = document.createElement('canvas'),
  46772. ctx = canvas.getContext("2d"),
  46773. gradient = ctx.createLinearGradient(0, 0, 0, 256);
  46774. canvas.height = 256;
  46775. canvas.width = 1;
  46776. var index = 1;
  46777. for (var i = 0, len = colors.length; i < len; i++) {
  46778. gradient.addColorStop(index / len, colors[i]);
  46779. index++;
  46780. }
  46781. ctx.fillStyle = gradient;
  46782. ctx.fillRect(0, 0, 1, 256);
  46783. this.grad = ctx.getImageData(0, 0, 1, 256).data;
  46784. }
  46785. /**
  46786. * @function HeatMapLayerRenderer.prototype.getPixelXY
  46787. * @description 转换地理坐标为相对于当前窗口左上角的像素坐标。
  46788. * @param {number} x - 热点的像素 x 坐标。
  46789. * @param {number} y - 热点的像素 y 坐标。
  46790. */
  46791. getPixelXY(coordinate) {
  46792. let pixelP;
  46793. if (coordinate instanceof Point || coordinate instanceof GeoText) {
  46794. let tempPoint = this.options.convertLatlonToPixel({ lon: coordinate.x, lat: coordinate.y });
  46795. pixelP = { x: parseInt(tempPoint.x), y: parseInt(tempPoint.y) };
  46796. }
  46797. if (coordinate instanceof LonLat) {
  46798. let tempPoint = this.options.convertLatlonToPixel(coordinate);
  46799. pixelP = { x: parseInt(tempPoint.x), y: parseInt(tempPoint.y) };
  46800. }
  46801. return pixelP;
  46802. }
  46803. /**
  46804. * @function HeatMapLayerRenderer.prototype._createCanvasContainer
  46805. * @description 创建热力图绘制容器。
  46806. * @private
  46807. */
  46808. _createCanvasContainer(targetElement) {
  46809. //热点图要求使用canvas绘制,判断是否支持
  46810. this.rootCanvas = document.createElement("canvas");
  46811. this.rootCanvas.id = this.options.id;
  46812. this.rootCanvas.width = this.maxWidth = parseInt(this.mapElement.style.width);
  46813. this.rootCanvas.height = this.maxHeight = parseInt(this.mapElement.style.height);
  46814. this.canvasContext = this.rootCanvas.getContext('2d');
  46815. const devicePixelRatio = window.devicePixelRatio || 1;
  46816. devicePixelRatio !== 1 && this.canvasContext && this.canvasContext.scale(devicePixelRatio, devicePixelRatio);
  46817. Util_Util.modifyDOMElement(this.rootCanvas, null, { x: 0, y: 0 }, { w: this.maxWidth, h: this.maxHeight },
  46818. "absolute", null, null, this.opacity);
  46819. targetElement.appendChild(this.rootCanvas);
  46820. }
  46821. /**
  46822. * @function HeatMapLayerRenderer.prototype.toiClientFeature
  46823. * @description 转为 iClient 要素。
  46824. * @param {GeoJSONObject} features - 待添加的要素数组。
  46825. */
  46826. // 提到 common
  46827. toiClientFeature(features) {
  46828. if (!Util_Util.isArray(features)) {
  46829. features = [features];
  46830. }
  46831. let featuresTemp = [];
  46832. for (let i = 0; i < features.length; i++) {
  46833. if (features[i] instanceof Vector) {
  46834. // 若是 FeatureVector 直接返回
  46835. featuresTemp.push(features[i]);
  46836. } else if (["FeatureCollection", "Feature", "Geometry"].indexOf(features[i].type) != -1) {
  46837. //GeoJSON 规范数据类型
  46838. let format = new GeoJSON();
  46839. featuresTemp = featuresTemp.concat(format.read(features[i]));
  46840. } else if (features[i].geometry && features[i].geometry.parts) {
  46841. //iServer服务器返回数据格式
  46842. featuresTemp.push(ServerFeature.fromJson(features[i]).toFeature());
  46843. } else {
  46844. throw new Error(`Features[${i}]'s type does not match, please check.`);
  46845. }
  46846. }
  46847. return featuresTemp;
  46848. }
  46849. /**
  46850. * @function HeatMapLayerRenderer.prototype.removeFeatures
  46851. * @description 移除指定的热点信息。
  46852. * @param {Array.<FeatureVector>|FeatureVector} features - 热点信息数组。
  46853. */
  46854. removeFeatures(features) {
  46855. if (!features || features.length === 0 || !this.features || this.features.length === 0) {
  46856. return;
  46857. }
  46858. if (features === this.features) {
  46859. return this.removeAllFeatures();
  46860. }
  46861. if (!(Util_Util.isArray(features))) {
  46862. features = [features];
  46863. }
  46864. var heatPoint, index, heatPointsFailedRemoved = [];
  46865. for (var i = 0, len = features.length; i < len; i++) {
  46866. heatPoint = features[i];
  46867. index = Util_Util.indexOf(this.features, heatPoint);
  46868. //找不到视为删除失败
  46869. if (index === -1) {
  46870. heatPointsFailedRemoved.push(heatPoint);
  46871. continue;
  46872. }
  46873. //删除热点
  46874. this.features.splice(index, 1);
  46875. }
  46876. var succeed = heatPointsFailedRemoved.length == 0 ? true : false;
  46877. //派发删除features成功的事件
  46878. /**
  46879. * @event HeatMapLayerRenderer#featuresremoved
  46880. * @description 要素删除之后触发。
  46881. * @property {Array.<FeatureVector>} features - 需要被删除的要素。
  46882. * @property {boolean} succeed - 要素删除成功与否。
  46883. */
  46884. this.refresh();
  46885. return { succeed, heatPointsFailedRemoved }
  46886. }
  46887. /**
  46888. * @function HeatMapLayerRenderer.prototype.removeAllFeatures
  46889. * @description 移除全部的热点信息。
  46890. */
  46891. removeAllFeatures() {
  46892. this.features = [];
  46893. this.refresh();
  46894. }
  46895. /**
  46896. * @function HeatMapLayerRenderer.prototype.removeFromMap
  46897. * @description 删除该图层。
  46898. */
  46899. removeFromMap() {
  46900. this.removeAllFeatures();
  46901. this.options.targetElement.removeChild(this.rootCanvas);
  46902. }
  46903. /**
  46904. * @function HeatMapLayerRenderer.prototype.setVisibility
  46905. * @description 设置图层可见性。
  46906. * @param {boolean} [visibility] - 是否显示图层(当前地图的 resolution 在最大最小 resolution 之间)。
  46907. */
  46908. setVisibility(visibility) {
  46909. if (this.rootCanvas && visibility !== this.visibility) {
  46910. this.visibility = visibility;
  46911. this.rootCanvas.style.display = visibility ? "block" : "none";
  46912. }
  46913. }
  46914. setExtent(extent) {
  46915. this.extent = extent;
  46916. }
  46917. _hide() {
  46918. this.rootCanvas.style.display = 'none';
  46919. }
  46920. _show() {
  46921. this.rootCanvas.style.display = 'block';
  46922. }
  46923. }
  46924. ;// CONCATENATED MODULE: ./src/maplibregl/overlay/HeatMapLayer.js
  46925. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  46926. * This program are made available under the terms of the Apache License, Version 2.0
  46927. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46928. /**
  46929. * @class HeatMapLayer
  46930. * @classdesc 热力图层类。
  46931. * @category Visualization HeatMap
  46932. * @version 11.1.0
  46933. * @modulecategory Overlay
  46934. * @param {string} name - 图层名称。
  46935. * @param {Object} options - 构造参数。
  46936. * @param {maplibregl.Map} options.map - MapLibreGL Map 对象。
  46937. * @param {string} options.featureWeight - 对应 feature 属性中的热点权重字段名称,权重值类型为 float。
  46938. * @param {string} [options.id] - 专题图层ID。默认使用 CommonUtil.createUniqueID("HeatMapLayer_") 创建专题图层 ID。
  46939. * @param {number} [options.radius=50] - 热点渲染的最大半径(热点像素半径),单位为 px,当 useGeoUnit参数 为 true 时,单位使用当前图层地理坐标单位。热点显示的时候以精确点为中心点开始往四周辐射衰减,其衰减半径和权重值成比列。
  46940. * @param {boolean} [options.loadWhileAnimating=true] - 是否实时重绘。(当绘制大数据量要素的情况下会出现卡顿,建议把该参数设为false)。
  46941. * @param {number} [options.opacity=1] - 图层不透明度。
  46942. * @param {Array.<string>} [options.colors=['blue','cyan','lime','yellow','red']] - 颜色线性渐变数组,颜色值必须为canvas所支。
  46943. * @param {boolean} [options.useGeoUnit=false] - 使用地理单位,即默认热点半径默认使用像素单位。当设置为 true 时,热点半径和图层地理坐标保持一致。
  46944. * @extends {maplibregl.Evented}
  46945. * @fires HeatMapLayer#featuresadded
  46946. * @fires HeatMapLayer#changelayer
  46947. * @fires HeatMapLayer#featuresremoved
  46948. * @usage
  46949. */
  46950. class HeatMapLayer extends (external_maplibregl_default()).Evented {
  46951. constructor(name, options) {
  46952. super();
  46953. var _options = options ? options : {};
  46954. this.options = _options;
  46955. /**
  46956. * @member {string} HeatMapLayer.prototype.name
  46957. * @description 图层名字。
  46958. */
  46959. this.name = name;
  46960. /**
  46961. * @member {string} HeatMapLayer.prototype.id
  46962. * @description 热力图图层 ID。
  46963. */
  46964. this.id = _options.id ? _options.id : Util_Util.createUniqueID("HeatMapLayer_");
  46965. /**
  46966. * @member {boolean} [HeatMapLayer.prototype.loadWhileAnimating=true]
  46967. * @description 是否实时重绘。(当绘制大数据量要素的情况下会出现卡顿,建议把该参数设为false)。
  46968. */
  46969. this.loadWhileAnimating = _options.loadWhileAnimating === undefined ? true : _options.loadWhileAnimating;
  46970. /**
  46971. * @member {Array.<FeatureVector>} HeatMapLayer.prototype.features
  46972. * @description 热点信息数组,记录存储图层上添加的所有热点信息。
  46973. */
  46974. this.features = {};
  46975. /**
  46976. * @member HeatMapLayer.prototype.EVENT_TYPES
  46977. * @description 监听一个自定义事件可用如下方式:
  46978. * 热点图自定义事件信息,事件调用时的属性与具体事件类型相对应。
  46979. *
  46980. * 支持的事件如下 (另外包含 <Layer 中定义的其他事件>):
  46981. * featuresadded - 热点添加完成时触发。回调参数为添加的热点信息数组和操作成功与否信息。
  46982. * 参数类型:{features: features, succeed: succeed}
  46983. * featuresremoved - 热点被删除时触发。回调参数为删除的热点信息数组和操作成功与否信息。
  46984. * 参数类型:{features: features, succeed: succeed}
  46985. * featuresdrawcompleted - 热点图渲染完成时触发。
  46986. */
  46987. this.EVENT_TYPES = ["featuresadded", "featuresremoved", "featuresdrawcompleted"];
  46988. this.type = 'custom';
  46989. this.renderingMode = '3d';
  46990. this.overlay = true;
  46991. }
  46992. /**
  46993. * @function HeatMapLayer.prototype.onAdd
  46994. * @description 添加该图层
  46995. */
  46996. onAdd(map) {
  46997. this.map = map;
  46998. const targetElement = this.map.getCanvasContainer();
  46999. const mapElement = this.map.getCanvas();
  47000. this.renderer = new HeatMapLayerRenderer({ id: this.id, ...this.options, convertLatlonToPixel: this._convertLatlonToPixel.bind(this), targetElement, mapElement });
  47001. if (this.features.features && this.features.features.length) {
  47002. this.renderer.setExtent(this.map.getBounds());
  47003. this.renderer.addFeatures(this.features);
  47004. }
  47005. }
  47006. /**
  47007. * @function HeatMapLayer.prototype.onRemove
  47008. * @description 移除该图层
  47009. */
  47010. onRemove() {
  47011. this.removeAllFeatures();
  47012. this.renderer.removeFromMap();
  47013. this.features = {};
  47014. this.renderer = null;
  47015. }
  47016. /**
  47017. * @function HeatMapLayer.prototype.render
  47018. * @description 渲染图层
  47019. */
  47020. render() {
  47021. this.refresh();
  47022. }
  47023. /**
  47024. * @function HeatMapLayer.prototype.addFeatures
  47025. * @description 添加热点信息。
  47026. * @param {GeoJSONObject} features - 待添加的要素数组。
  47027. *
  47028. * @example
  47029. * var geojson = {
  47030. * "type": "FeatureCollection",
  47031. * "features": [
  47032. * {
  47033. * "type": "feature",
  47034. * "geometry": {
  47035. * "type": "Point", //只支持point类型
  47036. * "coordinates": [0, 0]
  47037. * },
  47038. * "properties": {
  47039. * "height": Math.random()*9,
  47040. * "geoRadius": useGeoRadius?radius:null
  47041. * }
  47042. * }
  47043. * ]
  47044. * };
  47045. * var heatMapLayer = new HeatMapLayer("heatmaplayer",{"featureWeight":"height"}); pLayer = new HeatMapLayer("heatmaplayer",{"featureWeight":"height"});
  47046. * heatMapLayer.addFeatures(geojson);
  47047. * map.addLayer(heatMapLayer);
  47048. */
  47049. addFeatures(features) {
  47050. if (this.renderer) {
  47051. this.renderer.addFeatures(features);
  47052. } else {
  47053. this.features = features;
  47054. }
  47055. /**
  47056. * @event HeatMapLayer#featuresadded
  47057. * @description 要素添加完成之后触发。
  47058. * @property {GeoJSONObject} features - 被添加的要素。
  47059. * @property {boolean} succeed - 要素是否成功添加。
  47060. */
  47061. this.fire(this.EVENT_TYPES[0], { features: features, succeed: true });
  47062. }
  47063. /**
  47064. * @function HeatMapLayer.prototype.refresh
  47065. * @description 强制刷新当前热点显示,在图层热点数组发生变化后调用,更新显示。
  47066. */
  47067. refresh() {
  47068. if (this.map) {
  47069. this.renderer.setExtent(this.map.getBounds());
  47070. this.renderer.refresh();
  47071. }
  47072. }
  47073. /**
  47074. * @function HeatMapLayer.prototype.setOpacity
  47075. * @description 设置图层的不透明度,取值[0-1]之间。
  47076. * @param {number} [opacity] - 不透明度。
  47077. */
  47078. setOpacity(opacity) {
  47079. if (opacity !== this.opacity) {
  47080. this.renderer.setOpacity(opacity);
  47081. if (this.map !== null) {
  47082. /**
  47083. * @event HeatMapLayer#changelayer
  47084. * @description 图层属性改变之后触发。
  47085. * @property {Object} layer - 图层。
  47086. * @property {string} property - 被改变的图层属性。
  47087. */
  47088. this.fire('changelayer', { layer: this, property: "opacity" });
  47089. }
  47090. }
  47091. }
  47092. /**
  47093. * @function HeatMapLayer.prototype.updateHeatPoints
  47094. * @description 刷新热点图显示。
  47095. * @param {maplibregl.LngLatBounds} bounds - 当前显示范围。
  47096. */
  47097. updateHeatPoints(bounds) {
  47098. this.renderer.updateHeatPoints(bounds);
  47099. }
  47100. /**
  47101. * @function HeatMapLayer.prototype.getPixelXY
  47102. * @description 转换地理坐标为相对于当前窗口左上角的像素坐标。
  47103. * @param {number} x - 热点的像素 x 坐标。
  47104. * @param {number} y - 热点的像素 y 坐标。
  47105. */
  47106. getPixelXY(coordinate) {
  47107. return this.renderer.getPixelXY(coordinate);
  47108. }
  47109. /**
  47110. * @function HeatMapLayer.prototype.removeFeatures
  47111. * @description 移除指定的热点信息。
  47112. * @param {Array.<FeatureVector>|FeatureVector} features - 热点信息数组。
  47113. */
  47114. removeFeatures(features) {
  47115. const removeFeaturesRes = this.renderer.removeFeatures(features);
  47116. if(!removeFeaturesRes) {
  47117. return;
  47118. }
  47119. const { heatPointsFailedRemoved, succeed } = removeFeaturesRes;
  47120. //派发删除features成功的事件
  47121. /**
  47122. * @event HeatMapLayer#featuresremoved
  47123. * @description 要素删除之后触发。
  47124. * @property {Array.<FeatureVector>} features - 需要被删除的要素。
  47125. * @property {boolean} succeed - 要素删除成功与否。
  47126. */
  47127. this.fire(this.EVENT_TYPES[1], { features: heatPointsFailedRemoved, succeed });
  47128. }
  47129. /**
  47130. * @function HeatMapLayer.prototype.removeAllFeatures
  47131. * @description 移除全部的热点信息。
  47132. */
  47133. removeAllFeatures() {
  47134. this.renderer.removeAllFeatures();
  47135. }
  47136. /**
  47137. * @function HeatMapLayer.prototype.moveTo
  47138. * @description 将图层移动到某个图层之前。
  47139. * @param {string} layerID - 待插入的图层ID。
  47140. * @param {boolean} [before=true] - 是否将本图层插入到图层 ID 为 layerID 的图层之前(如果为 false 则将本图层插入到图层 ID 为 layerID 的图层之后)。
  47141. */
  47142. moveTo(layerID, before) {
  47143. var layer = document.getElementById(this.renderer.rootCanvas.id);
  47144. before = before !== undefined ? before : true;
  47145. if (before) {
  47146. var beforeLayer = document.getElementById(layerID);
  47147. if (layer && beforeLayer) {
  47148. beforeLayer.parentNode.insertBefore(layer, beforeLayer);
  47149. }
  47150. return;
  47151. }
  47152. var nextLayer = document.getElementById(layerID);
  47153. if (layer) {
  47154. if (nextLayer.nextSibling) {
  47155. nextLayer.parentNode.insertBefore(layer, nextLayer.nextSibling);
  47156. return;
  47157. }
  47158. nextLayer.parentNode.appendChild(layer);
  47159. }
  47160. }
  47161. /**
  47162. * @function HeatMapLayer.prototype.setVisibility
  47163. * @description 设置图层可见性。
  47164. * @param {boolean} [visibility] - 是否显示图层(当前地图的 resolution 在最大最小 resolution 之间)。
  47165. */
  47166. setVisibility(visibility) {
  47167. this.renderer.setVisibility(visibility);
  47168. }
  47169. _convertLatlonToPixel(coordinate) {
  47170. return this.map.project(new (external_maplibregl_default()).LngLat(coordinate.lon, coordinate.lat));
  47171. }
  47172. }
  47173. ;// CONCATENATED MODULE: ./src/common/overlay/graphic/GraphicLayerRenderer.js
  47174. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47175. * This program are made available under the terms of the Apache License, Version 2.0
  47176. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47177. const defaultProps = {
  47178. color: [0, 0, 0, 255],
  47179. opacity: 0.8,
  47180. radius: 10,
  47181. radiusScale: 1,
  47182. radiusMinPixels: 0,
  47183. radiusMaxPixels: Number.MAX_SAFE_INTEGER,
  47184. strokeWidth: 1,
  47185. outline: false
  47186. };
  47187. /**
  47188. * @private
  47189. * @class GraphicLayerRenderer
  47190. * @category Visualization Graphic
  47191. * @classdesc 高效率点图层。
  47192. * @param {string} [id] - 图层id。
  47193. * @param {Object} options - 参数。
  47194. * @param {Array.<Graphic>} options.graphics - 点要素对象数组 。
  47195. * @param {Array.<number>} [options.color=[0, 0, 0, 255]] - 颜色,目前只支持 rgba 数组。
  47196. * @param {number} [options.radius=10] - 半径。
  47197. * @param {number} [options.opacity=0.8] - 不透明度。
  47198. * @param {Array.<number>} [options.highlightColor=[0, 0, 128, 128]] - 高亮颜色,目前只支持 rgba 数组。
  47199. * @param {number} [options.radiusScale=1] - 点放大倍数。
  47200. * @param {number} [options.radiusMinPixels=0] - 半径最小值(像素)。
  47201. * @param {number} [options.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - 半径最大值(像素)。
  47202. * @param {number} [options.strokeWidth=1] - 边框大小。
  47203. * @param {boolean} [options.outline=false] - 是否显示边框。
  47204. * @param {Object} [functions] - 图层传递给渲染器调用的方法。
  47205. * @param {Object} [mapOptions] - 图层传递给渲染器的地图元素信息。
  47206. * @usage
  47207. */
  47208. class GraphicLayerRenderer {
  47209. constructor(id, options, functions, mapOptions) {
  47210. let opt = Util_Util.assign(this, defaultProps, options);
  47211. /**
  47212. * @member {string} GraphicLayerRenderer.prototype.id
  47213. * @description 高效率点图层 ID。
  47214. */
  47215. this.id = id;
  47216. /**
  47217. * @member {Array.<Graphic>} GraphicLayerRenderer.prototype.graphics
  47218. * @description 点要素对象数组。
  47219. */
  47220. this.graphics = [].concat(opt.graphics);
  47221. /**
  47222. * @member {boolean} [GraphicLayerRenderer.prototype.visibility=true]
  47223. * @description 图层显示状态属性。
  47224. */
  47225. this.mapOptions = mapOptions;
  47226. this.functions = functions;
  47227. this.visibility = true;
  47228. this.init();
  47229. }
  47230. init() {
  47231. if (this.canvas) {
  47232. this.mapOptions.targetElement.appendChild(this.canvas);
  47233. }
  47234. this._initContainer();
  47235. let mapState = this.getState();
  47236. let {
  47237. data,
  47238. color,
  47239. radius,
  47240. opacity,
  47241. highlightColor,
  47242. radiusScale,
  47243. radiusMinPixels,
  47244. radiusMaxPixels,
  47245. strokeWidth,
  47246. outline
  47247. } = mapState;
  47248. let me = this;
  47249. let layerOptions = {
  47250. id: 'scatter-plot',
  47251. data,
  47252. pickable: Boolean(this.onClick) || Boolean(this.onHover),
  47253. autoHighlight: true,
  47254. color: color,
  47255. opacity: opacity,
  47256. radius: radius,
  47257. radiusScale: radiusScale,
  47258. highlightColor: highlightColor,
  47259. radiusMinPixels: radiusMinPixels,
  47260. radiusMaxPixels: radiusMaxPixels,
  47261. strokeWidth: strokeWidth,
  47262. outline: outline,
  47263. isGeographicCoordinateSystem: this.isGeographicCoordinateSystem,
  47264. coordinateSystem: this.coordinateSystem,
  47265. getPosition: function (point) {
  47266. if (!point) {
  47267. return [0, 0, 0];
  47268. }
  47269. let lngLat = point.getLngLat();
  47270. return lngLat && [lngLat.lng, lngLat.lat, 0];
  47271. },
  47272. getColor: function (point) {
  47273. let style = point && point.getStyle();
  47274. let color1 = style && style.color || me.color;
  47275. return color1;
  47276. },
  47277. getRadius: function (point) {
  47278. let style = point && point.getStyle();
  47279. return style && style.radius || me.radius
  47280. },
  47281. updateTriggers: {
  47282. getColor: [color],
  47283. getRadius: [radius]
  47284. }
  47285. };
  47286. if (this.onClick) {
  47287. layerOptions.onClick = this.onClick;
  47288. }
  47289. if (this.onHover) {
  47290. layerOptions.onHover = this.onHover;
  47291. }
  47292. this.layer = new window.DeckGL.ScatterplotLayer(layerOptions);
  47293. let deckOptions = {};
  47294. for (let key in mapState) {
  47295. deckOptions[key] = mapState[key];
  47296. }
  47297. let width = parseInt(this.canvas.style.width);
  47298. let height = parseInt(this.canvas.style.height);
  47299. deckOptions.width = width;
  47300. deckOptions.height = height;
  47301. deckOptions.layers = [this.layer];
  47302. deckOptions.canvas = this.canvas;
  47303. this.deckGL = new window.DeckGL.experimental.DeckGLJS(deckOptions);
  47304. this.draw();
  47305. }
  47306. /**
  47307. * @function GraphicLayerRenderer.prototype.setStyle
  47308. * @description 设置图层整体样式。
  47309. * @param {Object} styleOptions - 样式对象。
  47310. * @param {Array.<number>} [styleOptions.color=[0, 0, 0, 255]] - 点颜色。
  47311. * @param {number} [styleOptions.radius=10] - 点半径。
  47312. * @param {number} [styleOptions.opacity=0.8] - 不透明度。
  47313. * @param {Array.<number>} [styleOptions.highlightColor=[0, 0, 128, 128]] - 高亮颜色,目前只支持 rgba 数组。
  47314. * @param {number} [styleOptions.radiusScale=1] - 点放大倍数。
  47315. * @param {number} [styleOptions.radiusMinPixels=0] - 半径最小值(像素)。
  47316. * @param {number} [styleOptions.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - 半径最大值(像素)。
  47317. * @param {number} [styleOptions.strokeWidth=1] - 边框大小。
  47318. * @param {boolean} [styleOptions.outline=false] - 是否显示边框。
  47319. */
  47320. setStyle(styleOptions) {
  47321. let styleOpt = {
  47322. color: this.color,
  47323. radius: this.radius,
  47324. opacity: this.opacity,
  47325. highlightColor: this.highlightColor,
  47326. radiusScale: this.radiusScale,
  47327. radiusMinPixels: this.radiusMinPixels,
  47328. radiusMaxPixels: this.radiusMaxPixels,
  47329. strokeWidth: this.strokeWidth,
  47330. outline: this.outline
  47331. };
  47332. Util_Util.assign(this, styleOpt, styleOptions);
  47333. this.update();
  47334. }
  47335. /**
  47336. * @function GraphicLayerRenderer.prototype.setGraphics
  47337. * @description 设置绘制的点要素数据,会覆盖之前的所有要素。
  47338. * @param {Array.<Graphic>} graphics - 点要素对象数组。
  47339. */
  47340. setGraphics(graphics) {
  47341. this.graphics = this.graphics || [];
  47342. this.graphics.length = 0;
  47343. let sGraphics = !Util_Util.isArray(graphics) ? [graphics] : [].concat(graphics);
  47344. //this.layer.props.data不能被重新赋值,只能在原数组上进行操作
  47345. if (!this.layer.props.data) {
  47346. this.layer.props.data = [];
  47347. }
  47348. this.layer.props.data.length = 0;
  47349. for (let i = 0; i < sGraphics.length; i++) {
  47350. this.layer.props.data.push(sGraphics[i]);
  47351. }
  47352. this.update();
  47353. }
  47354. /**
  47355. * @function GraphicLayerRenderer.prototype.addGraphics
  47356. * @description 添加点要素,不会覆盖之前的要素。
  47357. * @param {Array.<Graphic>} graphics - 点要素对象数组。
  47358. */
  47359. addGraphics(graphics) {
  47360. this.graphics = this.graphics || [];
  47361. let sGraphics = !Util_Util.isArray(graphics) ? [graphics] : [].concat(graphics);
  47362. //this.layer.props.data不能被重新赋值,只能在原数组上进行操作
  47363. if (!this.layer.props.data) {
  47364. this.layer.props.data = [];
  47365. }
  47366. for (let i = 0; i < sGraphics.length; i++) {
  47367. this.layer.props.data.push(sGraphics[i]);
  47368. }
  47369. this.update();
  47370. }
  47371. /**
  47372. * @function GraphicLayerRenderer.prototype.getGraphicBy
  47373. * @description 在 Vector 的要素数组 graphics 里面遍历每一个 graphic,当 graphic[property]===value 时,返回此 graphic(并且只返回第一个)。
  47374. * @param {string} property - graphic 的某个属性名称。
  47375. * @param {string} value - property 所对应的值。
  47376. * @returns {Graphic} 一个匹配的 graphic。
  47377. */
  47378. getGraphicBy(property, value) {
  47379. let graphic = null;
  47380. for (let index in this.graphics) {
  47381. if (this.graphics[index][property] === value) {
  47382. graphic = this.graphics[index];
  47383. break;
  47384. }
  47385. }
  47386. return graphic;
  47387. }
  47388. /**
  47389. * @function GraphicLayerRenderer.prototype.getGraphicById
  47390. * @description 通过给定一个 ID,返回对应的矢量要素。
  47391. * @param {string} graphicId - 矢量要素的属性 ID。
  47392. * @returns {Graphic} 一个匹配的 graphic。
  47393. */
  47394. getGraphicById(graphicId) {
  47395. return this.getGraphicBy("id", graphicId);
  47396. }
  47397. /**
  47398. * @function GraphicLayerRenderer.prototype.getGraphicsByAttribute
  47399. * @description 通过给定一个属性的 key 值和 value 值,返回所有匹配的要素数组。
  47400. * @param {string} attrName - graphic 的某个属性名称。
  47401. * @param {string} attrValue - property 所对应的值。
  47402. * @returns {Array.<Graphic>} 一个匹配的 graphic 数组。
  47403. */
  47404. getGraphicsByAttribute(attrName, attrValue) {
  47405. var graphic,
  47406. foundgraphics = [];
  47407. for (let index in this.graphics) {
  47408. graphic = this.graphics[index];
  47409. if (graphic && graphic.attributes) {
  47410. if (graphic.attributes[attrName] === attrValue) {
  47411. foundgraphics.push(graphic);
  47412. }
  47413. }
  47414. }
  47415. return foundgraphics;
  47416. }
  47417. /**
  47418. * @function GraphicLayerRenderer.prototype.removeGraphics
  47419. * @description 删除要素数组,默认将删除所有要素
  47420. * @param {Array.<Graphic>} [graphics=null] - 删除的 graphics 数组
  47421. */
  47422. removeGraphics(graphics = null) {
  47423. //当 graphics 为 null 、为空数组,或 === this.graphics,则清除所有要素
  47424. if (!graphics || graphics.length === 0 || graphics === this.graphics) {
  47425. this.graphics.length = 0;
  47426. if (this.layer.props.data) {
  47427. this.layer.props.data.length = 0;
  47428. }
  47429. this.update();
  47430. return;
  47431. }
  47432. if (!(Util_Util.isArray(graphics))) {
  47433. graphics = [graphics];
  47434. }
  47435. for (let i = graphics.length - 1; i >= 0; i--) {
  47436. let graphic = graphics[i];
  47437. //如果我们传入的grapchic在graphics数组中没有的话,则不进行删除,
  47438. //并将其放入未删除的数组中。
  47439. let findex = Util_Util.indexOf(this.graphics, graphic);
  47440. if (findex === -1) {
  47441. continue;
  47442. }
  47443. this.graphics.splice(findex, 1);
  47444. }
  47445. //删除完成后重新设置 setGraphics,以更新
  47446. this.update();
  47447. }
  47448. /**
  47449. * @function GraphicLayerRenderer.prototype.update
  47450. * @description 更新图层。
  47451. */
  47452. update() {
  47453. if (this.layer.lifecycle !== 'Awaiting state') {
  47454. this.layer.setChangeFlags({
  47455. dataChanged: true,
  47456. propsChanged: true,
  47457. viewportChanged: true,
  47458. updateTriggersChanged: true
  47459. });
  47460. let state = this.getState();
  47461. let width = parseInt(this.canvas.style.width);
  47462. let height = parseInt(this.canvas.style.height);
  47463. state.width = width;
  47464. state.height = height;
  47465. this.layer.setState(state);
  47466. }
  47467. }
  47468. /**
  47469. * @function GraphicLayerRenderer.prototype.clear
  47470. * @description 释放图层资源。
  47471. */
  47472. clear() {
  47473. this.removeGraphics();
  47474. this.deckGL.finalize();
  47475. }
  47476. /**
  47477. * @function GraphicLayerRenderer.prototype.remove
  47478. * @description 删除该图层。
  47479. */
  47480. remove() {
  47481. this.mapOptions.targetElement.removeChild(this.canvas);
  47482. }
  47483. /**
  47484. * @function GraphicLayerRenderer.prototype.destroy
  47485. * @deprecated
  47486. * @description 删除该图层,并释放图层资源。
  47487. */
  47488. destroy() {
  47489. this.remove();
  47490. this.clear();
  47491. }
  47492. /**
  47493. * @function GraphicLayerRenderer.prototype.moveTo
  47494. * @description 将图层移动到某个图层之前。
  47495. * @param {string} layerID - 待插入的图层 ID。
  47496. * @param {boolean} [before=true] - 是否将本图层插入到图层 ID 为 layerID 的图层之前。
  47497. */
  47498. moveTo(layerID, before) {
  47499. var layer = document.getElementById(this.id);
  47500. before = before !== undefined ? before : true;
  47501. if (before) {
  47502. var beforeLayer = document.getElementById(layerID);
  47503. if (layer && beforeLayer) {
  47504. beforeLayer.parentNode.insertBefore(layer, beforeLayer);
  47505. }
  47506. return;
  47507. }
  47508. var nextLayer = document.getElementById(layerID);
  47509. if (layer) {
  47510. if (nextLayer.nextSibling) {
  47511. nextLayer.parentNode.insertBefore(layer, nextLayer.nextSibling);
  47512. return;
  47513. }
  47514. nextLayer.parentNode.appendChild(layer);
  47515. }
  47516. }
  47517. /**
  47518. * @function GraphicLayerRenderer.prototype.setVisibility
  47519. * @description 设置图层可见性。
  47520. * @param {boolean} [visibility] - 是否显示图层(当前地图的 resolution 在最大最小 resolution 之间)。
  47521. */
  47522. setVisibility(visibility) {
  47523. if (this.canvas && visibility !== this.visibility) {
  47524. this.visibility = visibility;
  47525. this.canvas.style.display = visibility ? "block" : "none";
  47526. }
  47527. }
  47528. /**
  47529. * @function GraphicLayerRenderer.prototype.draw
  47530. * @description 绘制图层。
  47531. */
  47532. draw() {
  47533. let mapState = this.getState();
  47534. let deckOptions = {};
  47535. for (let key in mapState) {
  47536. deckOptions[key] = mapState[key];
  47537. }
  47538. let width = parseInt(this.canvas.style.width);
  47539. let height = parseInt(this.canvas.style.height);
  47540. deckOptions.width = width;
  47541. deckOptions.height = height;
  47542. deckOptions.layers = [this.layer];
  47543. deckOptions.canvas = this.canvas;
  47544. this.deckGL.setProps(deckOptions);
  47545. }
  47546. _initContainer() {
  47547. this.canvas = this._createCanvas(this.mapOptions.mapElement);
  47548. this.mapOptions.targetElement.appendChild(this.canvas);
  47549. }
  47550. _createCanvas(mapElement) {
  47551. let canvas = document.createElement('canvas');
  47552. if (this.id) {
  47553. canvas.id = this.id;
  47554. }
  47555. canvas.style.position = 'absolute';
  47556. canvas.style.top = 0 + "px";
  47557. canvas.style.left = 0 + "px";
  47558. canvas.style.cursor = "";
  47559. canvas.width = parseInt(mapElement.style.width);
  47560. canvas.height = parseInt(mapElement.style.height);
  47561. canvas.style.width = mapElement.style.width;
  47562. canvas.style.height = mapElement.style.height;
  47563. return canvas;
  47564. }
  47565. getState() {
  47566. let mapState = this.functions.getMapState();
  47567. return {
  47568. data: this.graphics,
  47569. color: this.color,
  47570. radius: this.radius,
  47571. opacity: this.opacity,
  47572. highlightColor: this.highlightColor,
  47573. radiusScale: this.radiusScale,
  47574. radiusMinPixels: this.radiusMinPixels,
  47575. radiusMaxPixels: this.radiusMaxPixels,
  47576. strokeWidth: this.strokeWidth,
  47577. outline: this.outline,
  47578. ...mapState
  47579. };
  47580. }
  47581. }
  47582. ;// CONCATENATED MODULE: ./src/maplibregl/overlay/GraphicLayer.js
  47583. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47584. * This program are made available under the terms of the Apache License, Version 2.0
  47585. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47586. /**
  47587. * @class GraphicLayer
  47588. * @category Visualization Graphic
  47589. * @classdesc 高效率点图层类。
  47590. * @version 11.1.0
  47591. * @modulecategory Overlay
  47592. * @param {string} [id] - 图层id。默认使用 CommonUtil.createUniqueID("graphicLayer_") 创建专题图层 ID。
  47593. * @param {Object} options - 参数。
  47594. * @param {Array.<Graphic>} options.graphics - 点要素对象数组 。
  47595. * @param {Array.<number>} [options.color=[0, 0, 0, 255]] - 颜色,目前只支持 rgba 数组。
  47596. * @param {number} [options.radius=10] - 半径。
  47597. * @param {number} [options.opacity=0.8] - 不透明度。
  47598. * @param {Array.<number>} [options.highlightColor=[0, 0, 128, 128]] - 高亮颜色,目前只支持 rgba 数组。
  47599. * @param {number} [options.radiusScale=1] - 点放大倍数。
  47600. * @param {number} [options.radiusMinPixels=0] - 半径最小值(像素)。
  47601. * @param {number} [options.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - 半径最大值(像素)。
  47602. * @param {number} [options.strokeWidth=1] - 边框大小。
  47603. * @param {boolean} [options.outline=false] - 是否显示边框。
  47604. * @usage
  47605. */
  47606. class GraphicLayer {
  47607. constructor(id, options) {
  47608. this.options = options;
  47609. /**
  47610. * @member {string} GraphicLayer.prototype.id
  47611. * @description 高效率点图层 ID。
  47612. */
  47613. this.id = id || Util_Util.createUniqueID("graphicLayer_");
  47614. this.type = 'custom';
  47615. this.renderingMode = '3d';
  47616. this.overlay = true;
  47617. }
  47618. /**
  47619. * @function GraphicLayer.prototype.addTo
  47620. * @deprecated
  47621. * @description 添加该图层,将在下个版本废弃,请使用 onAdd() 代替。
  47622. * @param {maplibregl.Map} map - MapLibreGL Map 对象。
  47623. * @returns this
  47624. */
  47625. addTo(map) {
  47626. this.onAdd(map);
  47627. return this;
  47628. }
  47629. /**
  47630. * @function GraphicLayer.prototype.onAdd
  47631. * @description 添加该图层。
  47632. * @param {maplibregl.Map} map - MapLibreGL Map 对象。
  47633. */
  47634. onAdd(map) {
  47635. this.map = map;
  47636. this.renderer = new GraphicLayerRenderer(this.id, this.options, {
  47637. getMapState: this.getMapState.bind(this)
  47638. }, { targetElement: this.map.getCanvasContainer(), mapElement: this.map.getCanvas() });
  47639. }
  47640. /**
  47641. * @function GraphicLayer.prototype.onAdd
  47642. * @description 添加该图层。
  47643. */
  47644. render() {
  47645. this.renderer.draw();
  47646. }
  47647. /**
  47648. * @function GraphicLayer.prototype.setStyle
  47649. * @description 设置图层整体样式。
  47650. * @param {Object} styleOptions - 样式对象。
  47651. * @param {Array.<number>} [styleOptions.color=[0, 0, 0, 255]] - 点颜色。
  47652. * @param {number} [styleOptions.radius=10] - 点半径。
  47653. * @param {number} [styleOptions.opacity=0.8] - 不透明度。
  47654. * @param {Array.<number>} [styleOptions.highlightColor=[0, 0, 128, 128]] - 高亮颜色,目前只支持 rgba 数组。
  47655. * @param {number} [styleOptions.radiusScale=1] - 点放大倍数。
  47656. * @param {number} [styleOptions.radiusMinPixels=0] - 半径最小值(像素)。
  47657. * @param {number} [styleOptions.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - 半径最大值(像素)。
  47658. * @param {number} [styleOptions.strokeWidth=1] - 边框大小。
  47659. * @param {boolean} [styleOptions.outline=false] - 是否显示边框。
  47660. */
  47661. setStyle(styleOptions) {
  47662. this.renderer && this.renderer.setStyle(styleOptions);
  47663. }
  47664. /**
  47665. * @function GraphicLayer.prototype.setGraphics
  47666. * @description 设置绘制的点要素数据,会覆盖之前的所有要素。
  47667. * @param {Array.<Graphic>} graphics - 点要素对象数组。
  47668. */
  47669. setGraphics(graphics) {
  47670. this.renderer && this.renderer.setGraphics(graphics);
  47671. }
  47672. /**
  47673. * @function GraphicLayer.prototype.addGraphics
  47674. * @description 添加点要素,不会覆盖之前的要素。
  47675. * @param {Array.<Graphic>} graphics - 点要素对象数组。
  47676. */
  47677. addGraphics(graphics) {
  47678. this.renderer && this.renderer.addGraphics(graphics);
  47679. }
  47680. /**
  47681. * @function GraphicLayer.prototype.getGraphicBy
  47682. * @description 在 Vector 的要素数组 graphics 里面遍历每一个 graphic,当 graphic[property]===value 时,返回此 graphic(并且只返回第一个)。
  47683. * @param {string} property - graphic 的某个属性名称。
  47684. * @param {string} value - property 所对应的值。
  47685. * @returns {Graphic} 一个匹配的 graphic。
  47686. */
  47687. getGraphicBy(property, value) {
  47688. return this.renderer && this.renderer.getGraphicBy(property, value);
  47689. }
  47690. /**
  47691. * @function GraphicLayer.prototype.getGraphicById
  47692. * @description 通过给定一个 ID,返回对应的矢量要素。
  47693. * @param {string} graphicId - 矢量要素的属性 ID。
  47694. * @returns {Graphic} 一个匹配的 graphic。
  47695. */
  47696. getGraphicById(graphicId) {
  47697. return this.getGraphicBy("id", graphicId);
  47698. }
  47699. /**
  47700. * @function GraphicLayer.prototype.getGraphicsByAttribute
  47701. * @description 通过给定一个属性的 key 值和 value 值,返回所有匹配的要素数组。
  47702. * @param {string} attrName - graphic 的某个属性名称。
  47703. * @param {string} attrValue - property 所对应的值。
  47704. * @returns {Array.<Graphic>} 一个匹配的 graphic 数组。
  47705. */
  47706. getGraphicsByAttribute(attrName, attrValue) {
  47707. return this.renderer && this.renderer.getGraphicsByAttribute(attrName, attrValue);
  47708. }
  47709. /**
  47710. * @function GraphicLayer.prototype.removeGraphics
  47711. * @description 删除要素数组,默认将删除所有要素
  47712. * @param {Array.<Graphic>} [graphics=null] - 删除的 graphics 数组
  47713. */
  47714. removeGraphics(graphics = null) {
  47715. this.renderer && this.renderer.removeGraphics(graphics);
  47716. }
  47717. /**
  47718. * @function GraphicLayer.prototype.clear
  47719. * @description 释放图层资源。
  47720. */
  47721. clear() {
  47722. this.renderer && this.renderer.clear();
  47723. }
  47724. /**
  47725. * @function GraphicLayer.prototype.remove
  47726. * @description 删除该图层。
  47727. */
  47728. remove() {
  47729. this.renderer && this.renderer.remove();
  47730. }
  47731. /**
  47732. * @function GraphicLayer.prototype.onRemove
  47733. * @deprecated
  47734. * @description 删除该图层,并释放图层资源。
  47735. */
  47736. onRemove() {
  47737. this.remove();
  47738. this.clear();
  47739. }
  47740. /**
  47741. * @function GraphicLayer.prototype.moveTo
  47742. * @description 将图层移动到某个图层之前。
  47743. * @param {string} layerID - 待插入的图层 ID。
  47744. * @param {boolean} [before=true] - 是否将本图层插入到图层 ID 为 layerID 的图层之前。
  47745. */
  47746. moveTo(layerID, before) {
  47747. this.renderer.moveTo(layerID, before);
  47748. }
  47749. /**
  47750. * @function GraphicLayer.prototype.setVisibility
  47751. * @description 设置图层可见性。
  47752. * @param {boolean} [visibility] - 是否显示图层(当前地图的 resolution 在最大最小 resolution 之间)。
  47753. */
  47754. setVisibility(visibility) {
  47755. this.renderer.setVisibility(visibility);
  47756. }
  47757. /**
  47758. * @function GraphicLayer.prototype.getState
  47759. * @description 获取当前地图及图层状态。
  47760. * @returns {Object} 地图及图层状态,包含地图状态信息和本图层相关状态。
  47761. */
  47762. getState() {
  47763. return this.renderer.getState();
  47764. }
  47765. /**
  47766. * @function GraphicLayer.prototype.getMapState
  47767. * @description 获取当前地图状态。
  47768. * @returns {Object} 地图状态,包含地图状态信息。
  47769. */
  47770. getMapState() {
  47771. let state = {};
  47772. let center = this.map.getCenter();
  47773. let longitude = center.lng;
  47774. let latitude = center.lat;
  47775. let zoom = this.map.getZoom();
  47776. let maxZoom = this.map.getMaxZoom();
  47777. let pitch = this.map.getPitch();
  47778. let bearing = this.map.getBearing();
  47779. let mapViewport = {
  47780. longitude: longitude,
  47781. latitude: latitude,
  47782. zoom: zoom,
  47783. maxZoom: maxZoom,
  47784. pitch: pitch,
  47785. bearing: bearing
  47786. };
  47787. for (let key in mapViewport) {
  47788. state[key] = mapViewport[key];
  47789. }
  47790. //当使用扩展的maplibregl代码时有效
  47791. if (this.map.getCRS && this.map.getCRS() !== (external_maplibregl_default()).CRS.EPSG3857) {
  47792. state.coordinateSystem = this.coordinateSystem;
  47793. state.isGeographicCoordinateSystem = this.isGeographicCoordinateSystem;
  47794. }
  47795. return state;
  47796. }
  47797. }
  47798. ;// CONCATENATED MODULE: ./src/common/overlay/graticule/GraticuleLayerRenderer.js
  47799. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  47800. * This program are made available under the terms of the Apache License, Version 2.0
  47801. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47802. /**
  47803. * reference and modification
  47804. * dereklieu/cool-grid, cloudybay/leaflet.latlng-graticule
  47805. * (https://github.com/dereklieu/cool-grid, https://github.com/cloudybay/leaflet.latlng-graticule)
  47806. * Apache Licene 2.0
  47807. * thanks dereklieu, cloudybay
  47808. */
  47809. /**
  47810. * @private
  47811. * @class GraticuleLayerRenderer
  47812. * @classdesc 经纬网。
  47813. * @version 11.1.1
  47814. * @param {Object} options - 参数。
  47815. * @param {boolean} [options.visible=true] - 是否显示经纬网。
  47816. * @param {boolean} [options.showLabel=true] - 是否显示标签。
  47817. * @param {number} [options.opacity=1] - 画布不透明度。
  47818. * @param {number|function} [options.interval = 10] - 经纬度的间隔(以度为单位),可以是数字,也可以是函数,参数是map。
  47819. * @param {Array.<number>} [options.extent] - 经纬网渲染的边界范围([minx, miny, maxx, maxy]),不传为整个地图范围。
  47820. * @param {number} [options.minZoom] - 最小视图缩放级别(不包括此级别),在该级别之上,该层将可见。
  47821. * @param {number} [options.maxZoom] - 该图层可见的最大视图缩放级别(含)。
  47822. * @param {function} [options.lngLabelFormatter = null] - 经度标签转换函数。
  47823. * @param {function} [options.latLabelFormatter = null] - 纬度标签转换函数。
  47824. * @param {GraticuleLayerRenderer.LabelStyle} [options.lngLabelStyle] - 经度标签样式。
  47825. * @param {GraticuleLayerRenderer.LabelStyle} [options.latLabelStyle] - 纬度标签样式。
  47826. * @param {GraticuleLayerRenderer.StrokeStyle} [options.strokeStyle] - 绘制经纬线的样式。
  47827. * @param {Object} [functions] - 图层传递给渲染器调用的方法。
  47828. * @param {Object} [mapOptions] - 图层传递给渲染器的地图元素信息。
  47829. * @usage
  47830. */
  47831. const defaultTextStyle = {
  47832. textSize: '12px',
  47833. textFont: ['12px Calibri', 'sans-serif'],
  47834. textAnchor: 'bottom',
  47835. textColor: 'rgba(0,0,0,1)',
  47836. textHaloColor: 'rgba(255,255,255,1)',
  47837. textHaloWidth: 1
  47838. };
  47839. const defaultStrokeStyle = {
  47840. lineColor: 'red',
  47841. lineCap: 'round', // butt, round, square
  47842. lineJoin: 'round', // bevel, round, miter
  47843. lindDasharray: [0.4, 5], // 数组|function
  47844. lineDashOffset: 0,
  47845. lineWidth: 1 // 数字|function
  47846. };
  47847. const defaultOptions = {
  47848. showLabel: true,
  47849. opacity: 1,
  47850. visible: true,
  47851. interval: 10, // function|number
  47852. extent: null,
  47853. minZoom: 0,
  47854. maxZoom: 50,
  47855. wrapX: true,
  47856. strokeStyle: defaultStrokeStyle,
  47857. lngLabelFormatter: null,
  47858. latLabelFormatter: null,
  47859. lngLabelStyle: defaultTextStyle,
  47860. latLabelStyle: defaultTextStyle
  47861. };
  47862. class GraticuleLayerRenderer {
  47863. constructor(map, options, functions, mapOptions) {
  47864. this.map = map;
  47865. this.id = mapOptions && mapOptions.id;
  47866. this.sourceId = this.id + '_line';
  47867. this.canvasId = this.id;
  47868. this.options = options;
  47869. this.mapElement = mapOptions.mapElement;
  47870. this.targetElement = mapOptions.targetElement;
  47871. this.getMapStateByKey = functions.getMapStateByKey;
  47872. this.getDefaultExtent = functions.getDefaultExtent;
  47873. this.setVisibility = functions.setVisibility;
  47874. this.updateGraticuleLayer = functions.updateGraticuleLayer;
  47875. this.init();
  47876. }
  47877. init() {
  47878. this._initialize();
  47879. this._createCanvas();
  47880. this._drawCanvas();
  47881. this.setVisibility();
  47882. this._drawLabel();
  47883. }
  47884. onRemove() {
  47885. this.targetElement.removeChild(this.canvas);
  47886. this.canvas = null;
  47887. }
  47888. /**
  47889. * @function GraticuleLayerRenderer.prototype.setMinZoom
  47890. * @description 设置最小视图缩放级别。
  47891. * @param {number} minZoom - 最小视图缩放级别(不包括此级别),在该级别之上,该层将可见。
  47892. */
  47893. setMinZoom(minZoom) {
  47894. this.options.minZoom = minZoom;
  47895. this.setVisibility();
  47896. }
  47897. /**
  47898. * @function GraticuleLayerRenderer.prototype.setMaxZoom
  47899. * @description 该图层可见的最大视图缩放级别。
  47900. * @param {number} maxZoom - 该图层可见的最大视图缩放级别(含)。
  47901. */
  47902. setMaxZoom(maxZoom) {
  47903. this.options.maxZoom = maxZoom;
  47904. this.setVisibility();
  47905. }
  47906. /**
  47907. * @function GraticuleLayerRenderer.prototype.setShowLabel
  47908. * @description 设置显示标签。
  47909. * @param {boolean} showLabel - 是否显示标签。
  47910. */
  47911. setShowLabel(showLabel) {
  47912. this.options.showLabel = showLabel;
  47913. this._drawLabel();
  47914. }
  47915. /**
  47916. * @function GraticuleLayerRenderer.prototype.setExtent
  47917. * @description 设置经纬网渲染的边界范围。
  47918. * @param {Array.<number>} extent - 经纬网渲染的边界范围。
  47919. */
  47920. setExtent(extent) {
  47921. this.options.extent = this.getDefaultExtent(extent);
  47922. this.features = this._getGraticuleFeatures();
  47923. this.updateGraticuleLayer();
  47924. this._drawLabel();
  47925. }
  47926. /**
  47927. * @function GraticuleLayerRenderer.prototype.setLngLabelStyle
  47928. * @description 设置经度标签样式。
  47929. * @param {GraticuleLayerRenderer.LabelStyle} labelStyle - 标签样式。
  47930. */
  47931. setLngLabelStyle(labelStyle) {
  47932. this.options.lngLabelStyle = labelStyle;
  47933. this._drawLabel();
  47934. }
  47935. /**
  47936. * @function GraticuleLayerRenderer.prototype.setLatLabelStyle
  47937. * @description 设置纬度标签样式。
  47938. * @param {GraticuleLayerRenderer.LabelStyle} labelStyle - 标签样式。
  47939. */
  47940. setLatLabelStyle(labelStyle) {
  47941. this.options.latLabelStyle = labelStyle;
  47942. this._drawLabel();
  47943. }
  47944. /**
  47945. * @function GraticuleLayerRenderer.prototype.setIntervals
  47946. * @description 设置经纬度的间隔(以度为单位)。
  47947. * @param {number|function} interval - 经纬度的间隔(以度为单位),可以是数字,也可以是函数,参数是map。
  47948. */
  47949. setIntervals(interval) {
  47950. this.options.interval = interval;
  47951. this._calcInterval();
  47952. this.features = this._getGraticuleFeatures();
  47953. this.updateGraticuleLayer();
  47954. this._drawLabel();
  47955. }
  47956. draw() {
  47957. this._reset();
  47958. }
  47959. _initialize(options = this.options) {
  47960. options = options || {};
  47961. options.strokeStyle = Object.assign({}, defaultStrokeStyle, options.strokeStyle || {});
  47962. options.lngLabelStyle = Object.assign({}, defaultTextStyle, options.lngLabelStyle || {});
  47963. options.latLabelStyle = Object.assign({}, defaultTextStyle, options.latLabelStyle || {});
  47964. this.options = Object.assign({}, defaultOptions, options, {
  47965. extent: this.getDefaultExtent(options.extent),
  47966. // 提出去
  47967. wrapX: options.wrapX
  47968. });
  47969. this.oldExtent = this.options.extent;
  47970. this._calcInterval();
  47971. this.isRotate = false;
  47972. this.visible = true;
  47973. this.features = this._getGraticuleFeatures();
  47974. }
  47975. _createCanvas() {
  47976. if (this.canvas) {
  47977. return;
  47978. }
  47979. const mapElement = this.mapElement;
  47980. this.canvas = document.createElement('canvas');
  47981. this.canvas.id = this.canvasId;
  47982. this.canvas.style.position = 'absolute';
  47983. this.canvas.style.top = 0 + 'px';
  47984. this.canvas.style.left = 0 + 'px';
  47985. var global$2 = typeof window === 'undefined' ? {} : window;
  47986. var devicePixelRatio = global$2.devicePixelRatio || 1;
  47987. this.canvas.width = parseInt(mapElement.style.width) * devicePixelRatio;
  47988. this.canvas.height = parseInt(mapElement.style.height) * devicePixelRatio;
  47989. this.canvas.style.width = mapElement.style.width;
  47990. this.canvas.style.height = mapElement.style.height;
  47991. this.canvas.globalAlpha = this.options.opacity;
  47992. this.targetElement.appendChild(this.canvas);
  47993. }
  47994. _drawCanvas() {
  47995. if (!this.canvas) {
  47996. this._createCanvas();
  47997. }
  47998. this.setVisibility();
  47999. this._reset();
  48000. }
  48001. _resizeCallback() {
  48002. this.targetElement && this.targetElement.removeChild(this.canvas);
  48003. this.canvas = null;
  48004. this._drawCanvas();
  48005. }
  48006. _reset() {
  48007. this._updateRotate();
  48008. this._updateExtent();
  48009. this._calcInterval();
  48010. this._drawLabel();
  48011. }
  48012. _updateRotate() {
  48013. const bearing = this.getMapStateByKey('getBearing');
  48014. this.isRotate = (bearing > -180 && bearing <= -90) || (bearing >= 90 && bearing < 180);
  48015. }
  48016. _updateExtent() {
  48017. if (this.options.wrapX && !this.oldExtent) {
  48018. const { _ne, _sw } = this.getMapStateByKey('getBounds');
  48019. this.options.extent = [_sw.lng, _sw.lat, _ne.lng, _ne.lat];
  48020. }
  48021. }
  48022. _calcInterval(interval = this.options.interval) {
  48023. if (typeof interval === 'function') {
  48024. interval = interval(this.map);
  48025. this._currLngInterval = interval;
  48026. this._currLatInterval = interval;
  48027. } else {
  48028. this._currLngInterval = interval;
  48029. this._currLatInterval = interval;
  48030. }
  48031. }
  48032. _formatLat(lat) {
  48033. if (this.options.latFormatTickLabel) {
  48034. return this.options.latLabelFormatter(lat);
  48035. }
  48036. if (lat < 0) {
  48037. return '' + conversionDegree(lat * -1) + 'S';
  48038. } else if (lat > 0) {
  48039. return '' + conversionDegree(lat) + 'N';
  48040. }
  48041. return '' + conversionDegree(lat);
  48042. }
  48043. _formatLng(lng) {
  48044. if (this.options.lngLabelFormatter) {
  48045. return this.options.lngLabelFormatter(lng);
  48046. }
  48047. lng = getWrapNum(lng);
  48048. if (lng > 0 && lng <= 180) {
  48049. return '' + conversionDegree(lng) + 'E';
  48050. } else if (lng < 0 && lng >= -180) {
  48051. return '' + conversionDegree(lng * -1) + 'W';
  48052. }
  48053. return '' + conversionDegree(lng);
  48054. }
  48055. _parsePxToInt(txt) {
  48056. if (txt.length > 2) {
  48057. if (txt.charAt(txt.length - 2) === 'p') {
  48058. txt = txt.substr(0, txt.length - 2);
  48059. }
  48060. }
  48061. try {
  48062. return parseInt(txt, 10);
  48063. } catch (e) {
  48064. console.log(e);
  48065. }
  48066. return 0;
  48067. }
  48068. _drawLabel(visible = this.visible) {
  48069. const canvas = this.canvas;
  48070. const ctx = canvas.getContext('2d');
  48071. if (!visible || !this.options.showLabel) {
  48072. ctx.clearRect(0, 0, canvas.width, canvas.height);
  48073. return;
  48074. }
  48075. if (this.mapElement) {
  48076. if (!this._currLngInterval || !this._currLatInterval) {
  48077. this._calcInterval();
  48078. }
  48079. ctx.clearRect(0, 0, canvas.width, canvas.height);
  48080. const { lngLabelStyle, latLabelStyle } = this.options;
  48081. const { lngPoints, latPonits } = this._getGridiculePoints();
  48082. lngPoints.forEach(point => {
  48083. this._drawLng(ctx, point[0], point[1], point[2], lngLabelStyle);
  48084. });
  48085. latPonits.forEach(point => {
  48086. this._drawLat(ctx, point[0], point[1], point[2], latLabelStyle);
  48087. });
  48088. }
  48089. }
  48090. _drawLat(ctx, latTick, bb, isIntersect, latLabelStyle) {
  48091. ctx = this._setLabelStyle(ctx, latLabelStyle);
  48092. const ww = this.canvas.width;
  48093. let txtHeight = 12;
  48094. try {
  48095. const fontSize = ctx.font.split(' ')[0];
  48096. txtHeight = this._parsePxToInt(fontSize);
  48097. } catch (e) {
  48098. console.log(e);
  48099. }
  48100. if (!isIntersect) {
  48101. const lngR = latTick;
  48102. latTick = bb;
  48103. bb = this.getMapStateByKey('project', [lngR, latTick]);
  48104. }
  48105. const latstr = this._formatLat(latTick);
  48106. const txtWidth = ctx.measureText(latstr).width;
  48107. ctx.strokeText(latstr, (isIntersect ? ww : bb.x) - txtWidth, (isIntersect ? bb : bb.y) + txtHeight / 2);
  48108. ctx.fillText(latstr, (isIntersect ? ww : bb.x) - txtWidth, (isIntersect ? bb : bb.y) + txtHeight / 2);
  48109. }
  48110. _drawLng(ctx, lngTick, bb, isIntersect, lngLabelStyle) {
  48111. ctx = this._setLabelStyle(ctx, lngLabelStyle);
  48112. const hh = this.canvas.height;
  48113. if (!isIntersect) {
  48114. const latTick = bb;
  48115. bb = this.getMapStateByKey('project', [lngTick, latTick]);
  48116. }
  48117. const lngstr = this._formatLng(lngTick);
  48118. const txtWidth = ctx.measureText(lngstr).width;
  48119. ctx.strokeText(lngstr, (isIntersect ? bb : bb.x) - txtWidth / 2, isIntersect ? hh : bb.y);
  48120. ctx.fillText(lngstr, (isIntersect ? bb : bb.x) - txtWidth / 2, isIntersect ? hh : bb.y);
  48121. }
  48122. _getLatPoints(lngRange = [-180, 180], firstLng, lastLng, features = this.features) {
  48123. if (!features) {
  48124. return;
  48125. }
  48126. if (this.options.wrapX && lngRange[0] === -180 && lngRange[1] === 180) {
  48127. return [];
  48128. }
  48129. let points = [];
  48130. features.forEach(feature => {
  48131. const lat = feature.geometry.coordinates[0][1];
  48132. const isLatFeature = feature.geometry.coordinates[1][1] === lat;
  48133. if (isLatFeature) {
  48134. let lng = typeof lastLng === 'number' ? lastLng : lngRange[1];
  48135. if (this.isRotate) {
  48136. lng = typeof firstLng === 'number' ? firstLng : lngRange[0];
  48137. }
  48138. if (this.options.wrapX) {
  48139. points = points.concat(this._getWrapPoints(lng, lat, [lng, lng]));
  48140. }
  48141. points.push([lng, lat]);
  48142. }
  48143. });
  48144. return points;
  48145. }
  48146. _getLngPoints(latRange = [-90, 90], firstLat, lastLat, features = this.features) {
  48147. if (!features) {
  48148. return;
  48149. }
  48150. let lat = typeof firstLat === 'number' ? firstLat : latRange[0];
  48151. if (this.isRotate) {
  48152. lat = typeof lastLat === 'number' ? lastLat : latRange[1];
  48153. }
  48154. let points = [];
  48155. features.forEach(feature => {
  48156. let lng = feature.geometry.coordinates[0][0];
  48157. const isLngFeature = feature.geometry.coordinates[1][0] === lng;
  48158. if (isLngFeature) {
  48159. points.push([lng, lat]);
  48160. if (this.options.wrapX) {
  48161. points = points.concat(this._getWrapPoints(lng, lat));
  48162. }
  48163. }
  48164. });
  48165. return points;
  48166. }
  48167. _getWrapPoints(lng, lat, extent = this.oldExtent) {
  48168. const points = [];
  48169. const { _ne, _sw } = this.getMapStateByKey('getBounds');
  48170. const lastLng = extent.length > 2 ? extent[2] : extent[1];
  48171. while (lng >= _sw.lng) {
  48172. const wrapNum = getWrapNum(lng, lastLng === 180, extent[0] === -180);
  48173. if (!extent || (wrapNum >= extent[0] && wrapNum <= lastLng)) {
  48174. points.push([lng, lat]);
  48175. }
  48176. lng -= 360;
  48177. }
  48178. while (lng <= _ne.lng) {
  48179. const wrapNum = getWrapNum(lng, lastLng === 180, extent[0] === -180);
  48180. if (!extent || (wrapNum >= extent[0] && wrapNum <= lastLng)) {
  48181. points.push([lng, lat]);
  48182. }
  48183. lng += 360;
  48184. }
  48185. return points;
  48186. }
  48187. _getGridiculePoints() {
  48188. const intersectLatPoints = this._getEdgeLat();
  48189. const intersectLngPoints = this._getEdgeLng();
  48190. const { latRange, lngRange, firstLat, firstLng, lastLat, lastLng } = this._getRange();
  48191. const latPonits = this._getUniquePoint(this._getLatPoints(lngRange, firstLng, lastLng), intersectLatPoints, 1);
  48192. const lngPoints = this._getUniquePoint(this._getLngPoints(latRange, firstLat, lastLat), intersectLngPoints, 0);
  48193. return { latPonits, lngPoints };
  48194. }
  48195. _getEdgeLat(_currLatInterval = this._currLatInterval) {
  48196. let latPoints = [];
  48197. let latCoordinates = [];
  48198. let firstLat;
  48199. const ww = this.canvas.width;
  48200. const hh = this.canvas.height;
  48201. const { extent } = this._getRange();
  48202. const { _ne } = this.getMapStateByKey('getBounds');
  48203. if (this.options.wrapX && getWrapNum(_ne.lng) > extent[2]) {
  48204. return [];
  48205. }
  48206. const countDecimals = this._countDecimals(_currLatInterval);
  48207. for (let i = 0; i <= hh; i++) {
  48208. const point = this.getMapStateByKey('unproject', [ww, i]);
  48209. const wrapNum = getWrapNum(point.lng);
  48210. const lngEdge = this.options.wrapX
  48211. ? wrapNum >= extent[0] && wrapNum <= extent[2]
  48212. : point.lng >= extent[0] && point.lng <= extent[2];
  48213. if (lngEdge && point.lat >= extent[1] && point.lat <= extent[3]) {
  48214. latPoints.push([point.lat, i]);
  48215. latCoordinates.push(point.lat);
  48216. if (firstLat === undefined && point.lat.toFixed(countDecimals) % _currLatInterval === 0) {
  48217. firstLat = Number(point.lat.toFixed(countDecimals));
  48218. }
  48219. }
  48220. }
  48221. const { first, last, coordinates, points } = this._getIntersectRange(
  48222. firstLat,
  48223. latCoordinates,
  48224. latPoints,
  48225. _currLatInterval
  48226. );
  48227. firstLat = Math.min(Math.max(first, -90), 90);
  48228. const lastLat = Math.max(Math.min(Math.round(last), 90), -90);
  48229. if (firstLat !== -90 || lastLat !== -90) {
  48230. return this._getClosestCoordinate(firstLat, lastLat, coordinates, points, _currLatInterval);
  48231. }
  48232. return [];
  48233. }
  48234. _getEdgeLng(_currLngInterval = this._currLngInterval) {
  48235. let lngPoints = [];
  48236. let lngCoordinates = [];
  48237. let firstLng;
  48238. const ww = this.canvas.width;
  48239. const hh = this.canvas.height;
  48240. const extent = this.options.extent;
  48241. const countDecimals = this._countDecimals(_currLngInterval);
  48242. const { _sw } = this.getMapStateByKey('getBounds');
  48243. if (this.options.wrapX && getWrapNum(_sw.lat) > extent[3]) {
  48244. return [];
  48245. }
  48246. for (let i = 0; i <= ww; i++) {
  48247. const point = this.getMapStateByKey('unproject', [i, hh]);
  48248. const wrapNum = getWrapNum(point.lng);
  48249. const lngEdge = this.options.wrapX
  48250. ? wrapNum >= extent[0] && wrapNum <= extent[2]
  48251. : point.lng >= extent[0] && point.lng <= extent[2];
  48252. if (lngEdge && point.lat >= extent[1] && point.lat <= extent[3]) {
  48253. lngPoints.push([point.lng, i]);
  48254. lngCoordinates.push(point.lng);
  48255. if (firstLng === undefined && point.lng.toFixed(countDecimals) % _currLngInterval === 0) {
  48256. firstLng = Number(point.lng.toFixed(countDecimals));
  48257. }
  48258. }
  48259. }
  48260. const { first, last: lastLng, coordinates, points } = this._getIntersectRange(
  48261. firstLng,
  48262. lngCoordinates,
  48263. lngPoints,
  48264. _currLngInterval
  48265. );
  48266. firstLng = first;
  48267. return this._getClosestCoordinate(firstLng, lastLng, coordinates, points, _currLngInterval);
  48268. }
  48269. _getIntersectRange(first, coordinates, points, interval) {
  48270. let last = coordinates[coordinates.length - 1];
  48271. if (first > last) {
  48272. last = first;
  48273. coordinates.reverse();
  48274. points.reverse();
  48275. const countDecimals = this._countDecimals(interval);
  48276. for (let i = 0; i <= coordinates.length; i++) {
  48277. const point = coordinates[i];
  48278. if (point.toFixed(countDecimals) % interval === 0) {
  48279. first = Number(point.toFixed(countDecimals));
  48280. break;
  48281. }
  48282. }
  48283. }
  48284. return { first, last, coordinates, points };
  48285. }
  48286. _getClosestCoordinate(first, last, coordinates, points, interval) {
  48287. let result = [];
  48288. let graticule = first;
  48289. while (graticule <= last) {
  48290. const index = this._getClosestNumberIndex(graticule, coordinates);
  48291. const point = points[index];
  48292. result.push([Math.round(point[0]), point[1], true]);
  48293. graticule += interval;
  48294. coordinates = coordinates.slice(index);
  48295. points = points.slice(index);
  48296. }
  48297. return result;
  48298. }
  48299. _getClosestNumberIndex(num, arr) {
  48300. var index = 0;
  48301. var diffValue = Number.MAX_VALUE;
  48302. for (var i = 0; i < arr.length; i++) {
  48303. var newDiffValue = Math.abs(arr[i] - num);
  48304. if (newDiffValue <= diffValue) {
  48305. if (newDiffValue === diffValue && arr[i] < arr[index]) {
  48306. continue;
  48307. }
  48308. index = i;
  48309. diffValue = newDiffValue;
  48310. }
  48311. }
  48312. return index;
  48313. }
  48314. _getUniquePoint(points, intersectPoints, index = 0) {
  48315. if (this.options.wrapX) {
  48316. return points.concat(intersectPoints);
  48317. }
  48318. if (!intersectPoints || intersectPoints.length === 0) {
  48319. return points;
  48320. }
  48321. var tmp = intersectPoints;
  48322. const width = this.canvas.width;
  48323. const height = this.canvas.height;
  48324. for (var i in points) {
  48325. const edgePoint = this.getMapStateByKey('project', points[i]);
  48326. const intersetIndex = tmp.findIndex(item => item[0] === points[i][index]);
  48327. if (intersetIndex <= -1) {
  48328. tmp.push(points[i]);
  48329. } else if (
  48330. edgePoint &&
  48331. edgePoint.x >= 0 &&
  48332. edgePoint.x <= width &&
  48333. edgePoint.y >= 0 &&
  48334. edgePoint.y <= height
  48335. ) {
  48336. tmp[intersetIndex] = points[i];
  48337. }
  48338. }
  48339. return tmp;
  48340. }
  48341. _countDecimals(value) {
  48342. if (Math.floor(value) !== value) {
  48343. return value.toString().split('.')[1].length || 0;
  48344. }
  48345. return 0;
  48346. }
  48347. _getGraticuleFeatures() {
  48348. const _currLngInterval = this._currLngInterval || 10;
  48349. const _currLatInterval = this._currLatInterval || 10;
  48350. const features = [];
  48351. let { latRange, lngRange, firstLat, firstLng, lastLat, lastLng } = this._getRange();
  48352. if (this.options.wrapX && !this.oldExtent) {
  48353. latRange = [-90, 90];
  48354. lngRange = [-180, 180];
  48355. firstLat = firstLng = lastLat = lastLng = null;
  48356. }
  48357. if (typeof firstLng === 'number') {
  48358. features.unshift(this._makeLineFeature(this._makeLineCoords(firstLng, latRange, firstLat, lastLat)));
  48359. }
  48360. if (typeof lastLng === 'number') {
  48361. features.unshift(this._makeLineFeature(this._makeLineCoords(lastLng, latRange, firstLat, lastLat)));
  48362. }
  48363. for (var lng = lngRange[0]; lng <= lngRange[1]; lng += _currLngInterval) {
  48364. features.unshift(this._makeLineFeature(this._makeLineCoords(lng, latRange, firstLat, lastLat)));
  48365. }
  48366. if (typeof firstLat === 'number') {
  48367. features.unshift(this._makeLineFeature(this._makeLineCoords(firstLat, lngRange, firstLng, lastLng, 'lat')));
  48368. }
  48369. if (typeof lastLat === 'number') {
  48370. features.unshift(this._makeLineFeature(this._makeLineCoords(lastLat, lngRange, firstLng, lastLng, 'lat')));
  48371. }
  48372. for (var lat = latRange[0]; lat <= latRange[1]; lat += _currLatInterval) {
  48373. features.unshift(this._makeLineFeature(this._makeLineCoords(lat, lngRange, firstLng, lastLng, 'lat')));
  48374. }
  48375. return features;
  48376. }
  48377. _getRange(extent = this.options.extent && [...this.options.extent]) {
  48378. if (!extent || extent.length === 0) {
  48379. extent = this.getDefaultExtent();
  48380. }
  48381. extent = extent.map(item => {
  48382. return Number(item.toFixed(6));
  48383. });
  48384. const realExtent = {};
  48385. if (extent[1] % this._currLatInterval !== 0) {
  48386. realExtent.firstLat = extent[1];
  48387. const intNumber = Math.ceil(extent[1] / this._currLatInterval);
  48388. extent[1] = intNumber * this._currLatInterval;
  48389. }
  48390. if (extent[3] % this._currLatInterval !== 0) {
  48391. realExtent.lastLat = extent[3];
  48392. const intNumber = Math.floor(extent[3] / this._currLatInterval);
  48393. extent[3] = intNumber * this._currLatInterval;
  48394. }
  48395. if (extent[0] % this._currLngInterval !== 0) {
  48396. realExtent.firstLng = extent[0];
  48397. const intNumber = Math.ceil(extent[0] / this._currLngInterval);
  48398. extent[0] = intNumber * this._currLngInterval;
  48399. }
  48400. if (extent[2] % this._currLngInterval !== 0) {
  48401. realExtent.lastLng = extent[2];
  48402. const intNumber = Math.floor(extent[2] / this._currLngInterval);
  48403. extent[2] = intNumber * this._currLngInterval;
  48404. }
  48405. const result = Object.assign(
  48406. { latRange: [extent[1], extent[3]], lngRange: [extent[0], extent[2]], extent },
  48407. realExtent
  48408. );
  48409. return result;
  48410. }
  48411. _makeLineCoords(fixedDegree, range = [-90, 90], first, last, type = 'lng') {
  48412. fixedDegree = type === 'lng' ? this._lngFix(fixedDegree) : fixedDegree;
  48413. first = typeof first === 'number' ? first : range[0];
  48414. last = typeof last === 'number' ? last : range[1];
  48415. const interval = Math.abs(first - last);
  48416. const coords = [];
  48417. for (var changedDegree = first; changedDegree <= last; changedDegree += interval) {
  48418. if (type === 'lng') {
  48419. coords.push([fixedDegree, changedDegree]);
  48420. } else {
  48421. coords.push([changedDegree, fixedDegree]);
  48422. }
  48423. }
  48424. return coords;
  48425. }
  48426. _makeLineFeature(coordinates, type = 'LineString') {
  48427. return {
  48428. type: 'Feature',
  48429. geometry: {
  48430. type,
  48431. coordinates
  48432. }
  48433. };
  48434. }
  48435. _lngFix(lng) {
  48436. if (lng >= 180) {
  48437. return 180;
  48438. }
  48439. if (lng <= -180) {
  48440. return -180;
  48441. }
  48442. return lng;
  48443. }
  48444. _transformStrokeStyle(strokeStyle = this.options.strokeStyle) {
  48445. if (!strokeStyle || typeof strokeStyle === 'string') {
  48446. return { paint: { 'line-color': strokeStyle || 'rgba(0,0,0,0.2)' } };
  48447. }
  48448. const layout = {
  48449. visibility: this.visible ? 'visible' : 'none',
  48450. 'line-join': strokeStyle.lineJoin || 'round',
  48451. 'line-cap': strokeStyle.lineCap || 'round'
  48452. };
  48453. const paint = {
  48454. 'line-color': strokeStyle.lineColor || 'rgba(0,0,0,0.2)',
  48455. 'line-width': strokeStyle.lineWidth || 1,
  48456. 'line-offset': strokeStyle.lineDashOffset || 0,
  48457. 'line-translate-anchor': 'viewport'
  48458. };
  48459. if (strokeStyle.lineWidth) {
  48460. if (typeof strokeStyle.lineWidth === 'function') {
  48461. paint['line-width'] = strokeStyle.lineWidth(this.map);
  48462. } else {
  48463. paint['line-width'] = strokeStyle.lineWidth;
  48464. }
  48465. }
  48466. if (strokeStyle.lindDasharray) {
  48467. if (typeof strokeStyle.lindDasharray === 'function') {
  48468. paint['line-dasharray'] = strokeStyle.lindDasharray(this.map);
  48469. } else {
  48470. paint['line-dasharray'] = strokeStyle.lindDasharray;
  48471. }
  48472. }
  48473. return { layout, paint };
  48474. }
  48475. _setLabelStyle(ctx, labelStyle) {
  48476. if (labelStyle.textColor) {
  48477. ctx.fillStyle = labelStyle.textColor;
  48478. }
  48479. if (labelStyle.textSize) {
  48480. ctx.font = labelStyle.textSize + ' ' + (labelStyle.textFont || ['Calibri', 'sans-serif']).join(',');
  48481. }
  48482. if (labelStyle.textHaloColor) {
  48483. ctx.strokeStyle = labelStyle.textHaloColor;
  48484. ctx.lineWidth = labelStyle.textHaloWidth || 1;
  48485. }
  48486. if (labelStyle.textAnchor) {
  48487. ctx.textBaseline = this._getTxetBaseline(labelStyle.textAnchor);
  48488. ctx.textAligin = this._getTxetAlign(labelStyle.textAligin);
  48489. }
  48490. return ctx;
  48491. }
  48492. _getTxetBaseline(textAnchor) {
  48493. if (!textAnchor) {
  48494. return 'bottom';
  48495. }
  48496. const textStyle = textAnchor.split('-');
  48497. if (textStyle.includes('bottom')) {
  48498. return 'bottom';
  48499. }
  48500. if (textStyle.includes('top')) {
  48501. return 'top';
  48502. }
  48503. if (textStyle.includes('center')) {
  48504. return 'middle';
  48505. }
  48506. }
  48507. _getTxetAlign(textAnchor) {
  48508. if (!textAnchor) {
  48509. return 'center';
  48510. }
  48511. const textStyle = textAnchor.split('-');
  48512. if (textStyle.includes('left')) {
  48513. return 'left';
  48514. }
  48515. if (textStyle.includes('right')) {
  48516. return 'right';
  48517. }
  48518. if (textStyle.includes('center')) {
  48519. return 'center';
  48520. }
  48521. }
  48522. }
  48523. ;// CONCATENATED MODULE: ./src/maplibregl/overlay/GraticuleLayer.js
  48524. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  48525. * This program are made available under the terms of the Apache License, Version 2.0
  48526. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48527. /**
  48528. * reference and modification
  48529. * dereklieu/cool-grid, cloudybay/leaflet.latlng-graticule
  48530. * (https://github.com/dereklieu/cool-grid, https://github.com/cloudybay/leaflet.latlng-graticule)
  48531. * Apache Licene 2.0
  48532. * thanks dereklieu, cloudybay
  48533. */
  48534. /**
  48535. * @class GraticuleLayer
  48536. * @category Visualization GraticuleLayer
  48537. * @classdesc 经纬网类。
  48538. * @version 11.1.0
  48539. * @modulecategory Overlay
  48540. * @param {Object} options - 参数。
  48541. * @param {string} [options.layerID] - 图层 ID。默认使用 CommonUtil.createUniqueID("graticuleLayer_") 创建图层 ID。
  48542. * @param {boolean} [options.visible=true] - 是否显示经纬网。
  48543. * @param {boolean} [options.showLabel=true] - 是否显示标签。
  48544. * @param {number} [options.opacity=1] - 画布不透明度。
  48545. * @param {number|function} [options.interval = 10] - 经纬度的间隔(以度为单位),可以是数字,也可以是函数,参数是map。
  48546. * @param {maplibregl.LngLatBounds} [options.extent] - 经纬网渲染的边界范围([minx, miny, maxx, maxy]),不传为整个地图范围。
  48547. * @param {number} [options.minZoom] - 最小视图缩放级别(不包括此级别),在该级别之上,该层将可见。
  48548. * @param {number} [options.maxZoom] - 该图层可见的最大视图缩放级别(含)。
  48549. * @param {function} [options.lngLabelFormatter = null] - 经度标签转换函数。
  48550. * @param {function} [options.latLabelFormatter = null] - 纬度标签转换函数。
  48551. * @param {GraticuleLayer.LabelStyle} [options.lngLabelStyle] - 经度标签样式。
  48552. * @param {GraticuleLayer.LabelStyle} [options.latLabelStyle] - 纬度标签样式。
  48553. * @param {GraticuleLayer.StrokeStyle} [options.strokeStyle] - 绘制经纬线的样式。
  48554. * @usage
  48555. */
  48556. /**
  48557. * @typedef {Object} GraticuleLayer.LabelStyle - 标签样式。
  48558. * @property {Array.<string>} [textFont = ['Calibri','sans-serif']] - 字体样式。
  48559. * @property {string} [textSize = '12px'] - 字体大小。
  48560. * @property {string} [textColor ='rgba(0,0,0,1)'] - 字体颜色。
  48561. * @property {string} [textHaloColor ='rgba(255,255,255,1)'] - 描边颜色。
  48562. * @property {number} [textHaloWidth = 1] - 描边宽度。
  48563. * @property {string} [textAnchor = 'bottom'] - 字体基线: "center", "left", "right", "top", "bottom", "top-left", "top-right", "bottom-left", "bottom-right"。
  48564. */
  48565. /**
  48566. * @typedef {Object} GraticuleLayer.StrokeStyle - 线样式。
  48567. * @property {string} [lineColor = 'red'] - 线颜色。
  48568. * @property {string} [lineCap = 'round'] - 线端点风格:butt, round, square。
  48569. * @property {string} [lineJoin = round] - 线连接样式:bevel, round, miter。
  48570. * @property {Array.<number>} [lindDasharray = [0.5,4]] - 虚线样式。
  48571. * @property {number} [lineWidth = 1] - 线宽。
  48572. */
  48573. const GraticuleLayer_defaultTextStyle = {
  48574. textSize: '12px',
  48575. textFont: ['12px Calibri', 'sans-serif'],
  48576. textAnchor: 'bottom',
  48577. textColor: 'rgba(0,0,0,1)',
  48578. textHaloColor: 'rgba(255,255,255,1)',
  48579. textHaloWidth: 1
  48580. };
  48581. const GraticuleLayer_defaultStrokeStyle = {
  48582. lineColor: 'red',
  48583. lineCap: 'round', // butt, round, square
  48584. lineJoin: 'round', // bevel, round, miter
  48585. lindDasharray: [0.4, 5], // 数组|function
  48586. lineDashOffset: 0,
  48587. lineWidth: 1 // 数字|function
  48588. };
  48589. const GraticuleLayer_defaultOptions = {
  48590. showLabel: true,
  48591. opacity: 1,
  48592. visible: true,
  48593. interval: 10, // function|number
  48594. extent: null,
  48595. minZoom: 0,
  48596. maxZoom: 50,
  48597. wrapX: true,
  48598. strokeStyle: GraticuleLayer_defaultStrokeStyle,
  48599. lngLabelFormatter: null,
  48600. latLabelFormatter: null,
  48601. lngLabelStyle: GraticuleLayer_defaultTextStyle,
  48602. latLabelStyle: GraticuleLayer_defaultTextStyle
  48603. };
  48604. class GraticuleLayer {
  48605. constructor(options) {
  48606. this.id = options && options.layerID ? options.layerID : Util_Util.createUniqueID('graticuleLayer_');
  48607. this.sourceId = this.id + '_line';
  48608. options = options || {};
  48609. options.strokeStyle = Object.assign({}, GraticuleLayer_defaultStrokeStyle, options.strokeStyle || {});
  48610. options.lngLabelStyle = Object.assign({}, GraticuleLayer_defaultTextStyle, options.lngLabelStyle || {});
  48611. options.latLabelStyle = Object.assign({}, GraticuleLayer_defaultTextStyle, options.latLabelStyle || {});
  48612. this.options = Object.assign({}, GraticuleLayer_defaultOptions, options);
  48613. this.type = 'custom';
  48614. this.renderingMode = '3d';
  48615. this.overlay = true;
  48616. this.styleDataEevent = this._setLayerTop.bind(this);
  48617. }
  48618. /**
  48619. * @function GraphicLayer.prototype.onAdd
  48620. * @description 添加该图层。
  48621. * @param {maplibregl.Map} map - MapLibreGL Map 对象。
  48622. */
  48623. onAdd(map) {
  48624. this.map = map;
  48625. this.renderer = new GraticuleLayerRenderer(this.map, this.options, {
  48626. getMapStateByKey: this.getMapStateByKey,
  48627. getDefaultExtent: this.getDefaultExtent,
  48628. updateGraticuleLayer: this.updateGraticuleLayer.bind(this),
  48629. setVisibility: this.setVisibility.bind(this)
  48630. }, {
  48631. mapElement: this.map.getCanvas(),
  48632. targetElement: this.map.getCanvasContainer(),
  48633. id: this.id
  48634. });
  48635. this.addGraticuleLayer();
  48636. this.resizeEvent = this.renderer._resizeCallback.bind(this.renderer);
  48637. this.zoomendEvent = this.setVisibility.bind(this);
  48638. this._bindEvent()
  48639. }
  48640. render() {
  48641. this.renderer.draw();
  48642. }
  48643. /**
  48644. * @function GraticuleLayer.prototype.getMapStateByKey
  48645. * @description 根据方法名与参数获取地图状态。
  48646. * @param {string} key - map 方法名。
  48647. * @param {Object} params - 参数。
  48648. */
  48649. getMapStateByKey(key, params) {
  48650. if (key === 'getBearing') {
  48651. return this.map.getBearing();
  48652. } else if (key === 'getBounds') {
  48653. return this.map.getBounds();
  48654. } else if (key === 'project') {
  48655. return this.map.project(params);
  48656. } else if(key === 'unproject') {
  48657. return this.map.unproject(params);
  48658. }
  48659. }
  48660. /**
  48661. * @function GraticuleLayer.prototype.onRemove
  48662. * @description 移除图层回调。
  48663. */
  48664. onRemove() {
  48665. this.renderer.onRemove();
  48666. this._unbindEvent();
  48667. }
  48668. /**
  48669. * @function GraticuleLayer.prototype.setVisibility
  48670. * @description 设置可见性。
  48671. * @param {boolean} visible - 是否可见。
  48672. */
  48673. setVisibility(visible) {
  48674. const zoom = this.map && this.map.getZoom();
  48675. this.options.visible = typeof visible === 'boolean' ? visible : this.options.visible;
  48676. this.visible =
  48677. typeof visible === 'boolean'
  48678. ? visible
  48679. : this.options.visible && zoom >= this.options.minZoom && zoom <= this.options.maxZoom;
  48680. if (this.renderer) {
  48681. this.renderer.visible = this.visible;
  48682. }
  48683. if (this.map.getLayer(this.sourceId)) {
  48684. this.map.setLayoutProperty(this.sourceId, 'visibility', this.visible ? 'visible' : 'none');
  48685. }
  48686. this.renderer && this.renderer._drawLabel();
  48687. }
  48688. /**
  48689. * @function GraticuleLayer.prototype.setMinZoom
  48690. * @description 设置最小视图缩放级别。
  48691. * @param {number} minZoom - 最小视图缩放级别(不包括此级别),在该级别之上,该层将可见。
  48692. */
  48693. setMinZoom(minZoom) {
  48694. this.options.minZoom = minZoom;
  48695. this.setVisibility();
  48696. }
  48697. /**
  48698. * @function GraticuleLayer.prototype.setMaxZoom
  48699. * @description 该图层可见的最大视图缩放级别。
  48700. * @param {number} maxZoom - 该图层可见的最大视图缩放级别(含)。
  48701. */
  48702. setMaxZoom(maxZoom) {
  48703. this.options.maxZoom = maxZoom;
  48704. this.setVisibility();
  48705. }
  48706. /**
  48707. * @function GraticuleLayer.prototype.setShowLabel
  48708. * @description 设置显示标签。
  48709. * @param {boolean} showLabel - 是否显示标签。
  48710. */
  48711. setShowLabel(showLabel) {
  48712. this.options.showLabel = showLabel;
  48713. this.renderer._drawLabel();
  48714. }
  48715. /**
  48716. * @function GraticuleLayer.prototype.setExtent
  48717. * @description 设置经纬网渲染的边界范围。
  48718. * @param {maplibregl.LngLatBounds} extent - 经纬网渲染的边界范围。
  48719. */
  48720. setExtent(extent) {
  48721. this.options.extent = this.getDefaultExtent(extent, this.map);
  48722. // this.features = this._getGraticuleFeatures();
  48723. this.updateGraticuleLayer();
  48724. this.renderer._drawLabel();
  48725. }
  48726. /**
  48727. * @function GraticuleLayer.prototype.setStrokeStyle
  48728. * @description 设置经纬线样式。
  48729. * @param {GraticuleLayer.StrokeStyle} strokeStyle - 经纬线样式。
  48730. */
  48731. setStrokeStyle(strokeStyle) {
  48732. if (!this.map || !this.map.getLayer(this.sourceId)) {
  48733. return;
  48734. }
  48735. this.options.strokeStyle = strokeStyle;
  48736. const { layout, paint } = this.renderer._transformStrokeStyle(strokeStyle);
  48737. for (let key in layout) {
  48738. this.map.setLayoutProperty(this.sourceId, key, layout[key]);
  48739. }
  48740. for (let key in paint) {
  48741. this.map.setPaintProperty(this.sourceId, key, paint[key]);
  48742. }
  48743. }
  48744. /**
  48745. * @function GraticuleLayer.prototype.setLngLabelStyle
  48746. * @description 设置经度标签样式。
  48747. * @param {GraticuleLayer.LabelStyle} labelStyle - 标签样式。
  48748. */
  48749. setLngLabelStyle(labelStyle) {
  48750. this.options.lngLabelStyle = labelStyle;
  48751. this.renderer._drawLabel();
  48752. }
  48753. /**
  48754. * @function GraticuleLayer.prototype.setLatLabelStyle
  48755. * @description 设置纬度标签样式。
  48756. * @param {GraticuleLayer.LabelStyle} labelStyle - 标签样式。
  48757. */
  48758. setLatLabelStyle(labelStyle) {
  48759. this.options.latLabelStyle = labelStyle;
  48760. this.renderer._drawLabel();
  48761. }
  48762. /**
  48763. * @function GraticuleLayer.prototype.setIntervals
  48764. * @description 设置经纬度的间隔(以度为单位)。
  48765. * @param {number|function} interval - 经纬度的间隔(以度为单位),可以是数字,也可以是函数,参数是map。
  48766. */
  48767. setIntervals(interval) {
  48768. if (this.renderer) {
  48769. this.renderer.setIntervals(interval);
  48770. }
  48771. }
  48772. getDefaultExtent(extent, map = this.map) {
  48773. const crs = (map.getCRS && map.getCRS()) || {};
  48774. let { extent: crsExtent } = crs;
  48775. if (!crsExtent) {
  48776. crsExtent = [-180, -85.05119, 180, 85.05119];
  48777. }
  48778. if (!extent || extent.length === 0) {
  48779. return crsExtent;
  48780. }
  48781. const { _sw, _ne } = external_maplibregl_default().LngLatBounds.convert(extent);
  48782. extent = [_sw.lng, _sw.lat, _ne.lng, _ne.lat];
  48783. extent = [
  48784. Math.max(crsExtent[0], extent[0]),
  48785. Math.max(crsExtent[1], extent[1]),
  48786. Math.min(crsExtent[2], extent[2]),
  48787. Math.min(crsExtent[3], extent[3])
  48788. ];
  48789. return extent;
  48790. }
  48791. addGraticuleLayer() {
  48792. if (!this.map.getSource(this.sourceId)) {
  48793. const source = {
  48794. type: 'geojson',
  48795. data: {
  48796. type: 'FeatureCollection',
  48797. features: this.renderer.features
  48798. }
  48799. };
  48800. this.map.addSource(this.sourceId, source);
  48801. }
  48802. if (!this.map.getLayer(this.sourceId)) {
  48803. const layer = Object.assign(
  48804. { id: this.sourceId, type: 'line', source: this.sourceId },
  48805. this.renderer._transformStrokeStyle()
  48806. );
  48807. this.map.addLayer(layer);
  48808. }
  48809. }
  48810. updateGraticuleLayer(features = this.features) {
  48811. if (this.map.getSource(this.sourceId)) {
  48812. const geoJSONData = {
  48813. type: 'FeatureCollection',
  48814. features
  48815. };
  48816. this.map.getSource(this.sourceId).setData(geoJSONData);
  48817. }
  48818. this.addGraticuleLayer();
  48819. }
  48820. _bindEvent() {
  48821. this.map.on('styledata', this.styleDataEevent);
  48822. this.map.on('resize', this.resizeEvent);
  48823. this.map.on('zoomend', this.zoomendEvent);
  48824. }
  48825. _unbindEvent() {
  48826. this.map.off('styledata', this.styleDataEevent);
  48827. this.map.off('resize', this.resizeEvent);
  48828. this.map.off('zoomend', this.zoomendEvent);
  48829. }
  48830. _setLayerTop() {
  48831. const map = this.map;
  48832. if (!map) {
  48833. return;
  48834. }
  48835. const layersOnMap = map.getStyle && map.getStyle().layers;
  48836. if (
  48837. layersOnMap &&
  48838. layersOnMap.length &&
  48839. layersOnMap.findIndex(item => item.id === this.sourceId) !== layersOnMap.length - 1
  48840. ) {
  48841. if (map.getLayer(this.sourceId)) {
  48842. map.removeLayer(this.sourceId);
  48843. this.addGraticuleLayer();
  48844. }
  48845. }
  48846. }
  48847. _getLatPoints(lngRange, firstLng, lastLng, features) {
  48848. return this.renderer._getLatPoints(lngRange, firstLng, lastLng, features);
  48849. }
  48850. }
  48851. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/flat-geobuf/geometry-type.js
  48852. var geometry_type_GeometryType;
  48853. (function (GeometryType) {
  48854. GeometryType[GeometryType["Unknown"] = 0] = "Unknown";
  48855. GeometryType[GeometryType["Point"] = 1] = "Point";
  48856. GeometryType[GeometryType["LineString"] = 2] = "LineString";
  48857. GeometryType[GeometryType["Polygon"] = 3] = "Polygon";
  48858. GeometryType[GeometryType["MultiPoint"] = 4] = "MultiPoint";
  48859. GeometryType[GeometryType["MultiLineString"] = 5] = "MultiLineString";
  48860. GeometryType[GeometryType["MultiPolygon"] = 6] = "MultiPolygon";
  48861. GeometryType[GeometryType["GeometryCollection"] = 7] = "GeometryCollection";
  48862. GeometryType[GeometryType["CircularString"] = 8] = "CircularString";
  48863. GeometryType[GeometryType["CompoundCurve"] = 9] = "CompoundCurve";
  48864. GeometryType[GeometryType["CurvePolygon"] = 10] = "CurvePolygon";
  48865. GeometryType[GeometryType["MultiCurve"] = 11] = "MultiCurve";
  48866. GeometryType[GeometryType["MultiSurface"] = 12] = "MultiSurface";
  48867. GeometryType[GeometryType["Curve"] = 13] = "Curve";
  48868. GeometryType[GeometryType["Surface"] = 14] = "Surface";
  48869. GeometryType[GeometryType["PolyhedralSurface"] = 15] = "PolyhedralSurface";
  48870. GeometryType[GeometryType["TIN"] = 16] = "TIN";
  48871. GeometryType[GeometryType["Triangle"] = 17] = "Triangle";
  48872. })(geometry_type_GeometryType || (geometry_type_GeometryType = {}));
  48873. // EXTERNAL MODULE: ./node_modules/flatbuffers/js/flatbuffers.js
  48874. var js_flatbuffers = __webpack_require__(903);
  48875. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/flat-geobuf/geometry.js
  48876. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  48877. 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); } }
  48878. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  48879. var geometry_Geometry = /*#__PURE__*/function () {
  48880. function Geometry() {
  48881. _classCallCheck(this, Geometry);
  48882. this.bb = null;
  48883. this.bb_pos = 0;
  48884. }
  48885. _createClass(Geometry, [{
  48886. key: "__init",
  48887. value: function __init(i, bb) {
  48888. this.bb_pos = i;
  48889. this.bb = bb;
  48890. return this;
  48891. }
  48892. }, {
  48893. key: "ends",
  48894. value: function ends(index) {
  48895. var offset = this.bb.__offset(this.bb_pos, 4);
  48896. return offset ? this.bb.readUint32(this.bb.__vector(this.bb_pos + offset) + index * 4) : 0;
  48897. }
  48898. }, {
  48899. key: "endsLength",
  48900. value: function endsLength() {
  48901. var offset = this.bb.__offset(this.bb_pos, 4);
  48902. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  48903. }
  48904. }, {
  48905. key: "endsArray",
  48906. value: function endsArray() {
  48907. var offset = this.bb.__offset(this.bb_pos, 4);
  48908. 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;
  48909. }
  48910. }, {
  48911. key: "xy",
  48912. value: function xy(index) {
  48913. var offset = this.bb.__offset(this.bb_pos, 6);
  48914. return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
  48915. }
  48916. }, {
  48917. key: "xyLength",
  48918. value: function xyLength() {
  48919. var offset = this.bb.__offset(this.bb_pos, 6);
  48920. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  48921. }
  48922. }, {
  48923. key: "xyArray",
  48924. value: function xyArray() {
  48925. var offset = this.bb.__offset(this.bb_pos, 6);
  48926. 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;
  48927. }
  48928. }, {
  48929. key: "z",
  48930. value: function z(index) {
  48931. var offset = this.bb.__offset(this.bb_pos, 8);
  48932. return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
  48933. }
  48934. }, {
  48935. key: "zLength",
  48936. value: function zLength() {
  48937. var offset = this.bb.__offset(this.bb_pos, 8);
  48938. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  48939. }
  48940. }, {
  48941. key: "zArray",
  48942. value: function zArray() {
  48943. var offset = this.bb.__offset(this.bb_pos, 8);
  48944. 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;
  48945. }
  48946. }, {
  48947. key: "m",
  48948. value: function m(index) {
  48949. var offset = this.bb.__offset(this.bb_pos, 10);
  48950. return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
  48951. }
  48952. }, {
  48953. key: "mLength",
  48954. value: function mLength() {
  48955. var offset = this.bb.__offset(this.bb_pos, 10);
  48956. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  48957. }
  48958. }, {
  48959. key: "mArray",
  48960. value: function mArray() {
  48961. var offset = this.bb.__offset(this.bb_pos, 10);
  48962. 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;
  48963. }
  48964. }, {
  48965. key: "t",
  48966. value: function t(index) {
  48967. var offset = this.bb.__offset(this.bb_pos, 12);
  48968. return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
  48969. }
  48970. }, {
  48971. key: "tLength",
  48972. value: function tLength() {
  48973. var offset = this.bb.__offset(this.bb_pos, 12);
  48974. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  48975. }
  48976. }, {
  48977. key: "tArray",
  48978. value: function tArray() {
  48979. var offset = this.bb.__offset(this.bb_pos, 12);
  48980. 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;
  48981. }
  48982. }, {
  48983. key: "tm",
  48984. value: function tm(index) {
  48985. var offset = this.bb.__offset(this.bb_pos, 14);
  48986. return offset ? this.bb.readUint64(this.bb.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);
  48987. }
  48988. }, {
  48989. key: "tmLength",
  48990. value: function tmLength() {
  48991. var offset = this.bb.__offset(this.bb_pos, 14);
  48992. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  48993. }
  48994. }, {
  48995. key: "type",
  48996. value: function type() {
  48997. var offset = this.bb.__offset(this.bb_pos, 16);
  48998. return offset ? this.bb.readUint8(this.bb_pos + offset) : geometry_type_GeometryType.Unknown;
  48999. }
  49000. }, {
  49001. key: "parts",
  49002. value: function parts(index, obj) {
  49003. var offset = this.bb.__offset(this.bb_pos, 18);
  49004. return offset ? (obj || new Geometry()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
  49005. }
  49006. }, {
  49007. key: "partsLength",
  49008. value: function partsLength() {
  49009. var offset = this.bb.__offset(this.bb_pos, 18);
  49010. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  49011. }
  49012. }], [{
  49013. key: "getRootAsGeometry",
  49014. value: function getRootAsGeometry(bb, obj) {
  49015. return (obj || new Geometry()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  49016. }
  49017. }, {
  49018. key: "getSizePrefixedRootAsGeometry",
  49019. value: function getSizePrefixedRootAsGeometry(bb, obj) {
  49020. bb.setPosition(bb.position() + js_flatbuffers/* SIZE_PREFIX_LENGTH */.XU);
  49021. return (obj || new Geometry()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  49022. }
  49023. }, {
  49024. key: "startGeometry",
  49025. value: function startGeometry(builder) {
  49026. builder.startObject(8);
  49027. }
  49028. }, {
  49029. key: "addEnds",
  49030. value: function addEnds(builder, endsOffset) {
  49031. builder.addFieldOffset(0, endsOffset, 0);
  49032. }
  49033. }, {
  49034. key: "createEndsVector",
  49035. value: function createEndsVector(builder, data) {
  49036. builder.startVector(4, data.length, 4);
  49037. for (var i = data.length - 1; i >= 0; i--) {
  49038. builder.addInt32(data[i]);
  49039. }
  49040. return builder.endVector();
  49041. }
  49042. }, {
  49043. key: "startEndsVector",
  49044. value: function startEndsVector(builder, numElems) {
  49045. builder.startVector(4, numElems, 4);
  49046. }
  49047. }, {
  49048. key: "addXy",
  49049. value: function addXy(builder, xyOffset) {
  49050. builder.addFieldOffset(1, xyOffset, 0);
  49051. }
  49052. }, {
  49053. key: "createXyVector",
  49054. value: function createXyVector(builder, data) {
  49055. builder.startVector(8, data.length, 8);
  49056. for (var i = data.length - 1; i >= 0; i--) {
  49057. builder.addFloat64(data[i]);
  49058. }
  49059. return builder.endVector();
  49060. }
  49061. }, {
  49062. key: "startXyVector",
  49063. value: function startXyVector(builder, numElems) {
  49064. builder.startVector(8, numElems, 8);
  49065. }
  49066. }, {
  49067. key: "addZ",
  49068. value: function addZ(builder, zOffset) {
  49069. builder.addFieldOffset(2, zOffset, 0);
  49070. }
  49071. }, {
  49072. key: "createZVector",
  49073. value: function createZVector(builder, data) {
  49074. builder.startVector(8, data.length, 8);
  49075. for (var i = data.length - 1; i >= 0; i--) {
  49076. builder.addFloat64(data[i]);
  49077. }
  49078. return builder.endVector();
  49079. }
  49080. }, {
  49081. key: "startZVector",
  49082. value: function startZVector(builder, numElems) {
  49083. builder.startVector(8, numElems, 8);
  49084. }
  49085. }, {
  49086. key: "addM",
  49087. value: function addM(builder, mOffset) {
  49088. builder.addFieldOffset(3, mOffset, 0);
  49089. }
  49090. }, {
  49091. key: "createMVector",
  49092. value: function createMVector(builder, data) {
  49093. builder.startVector(8, data.length, 8);
  49094. for (var i = data.length - 1; i >= 0; i--) {
  49095. builder.addFloat64(data[i]);
  49096. }
  49097. return builder.endVector();
  49098. }
  49099. }, {
  49100. key: "startMVector",
  49101. value: function startMVector(builder, numElems) {
  49102. builder.startVector(8, numElems, 8);
  49103. }
  49104. }, {
  49105. key: "addT",
  49106. value: function addT(builder, tOffset) {
  49107. builder.addFieldOffset(4, tOffset, 0);
  49108. }
  49109. }, {
  49110. key: "createTVector",
  49111. value: function createTVector(builder, data) {
  49112. builder.startVector(8, data.length, 8);
  49113. for (var i = data.length - 1; i >= 0; i--) {
  49114. builder.addFloat64(data[i]);
  49115. }
  49116. return builder.endVector();
  49117. }
  49118. }, {
  49119. key: "startTVector",
  49120. value: function startTVector(builder, numElems) {
  49121. builder.startVector(8, numElems, 8);
  49122. }
  49123. }, {
  49124. key: "addTm",
  49125. value: function addTm(builder, tmOffset) {
  49126. builder.addFieldOffset(5, tmOffset, 0);
  49127. }
  49128. }, {
  49129. key: "createTmVector",
  49130. value: function createTmVector(builder, data) {
  49131. builder.startVector(8, data.length, 8);
  49132. for (var i = data.length - 1; i >= 0; i--) {
  49133. builder.addInt64(data[i]);
  49134. }
  49135. return builder.endVector();
  49136. }
  49137. }, {
  49138. key: "startTmVector",
  49139. value: function startTmVector(builder, numElems) {
  49140. builder.startVector(8, numElems, 8);
  49141. }
  49142. }, {
  49143. key: "addType",
  49144. value: function addType(builder, type) {
  49145. builder.addFieldInt8(6, type, geometry_type_GeometryType.Unknown);
  49146. }
  49147. }, {
  49148. key: "addParts",
  49149. value: function addParts(builder, partsOffset) {
  49150. builder.addFieldOffset(7, partsOffset, 0);
  49151. }
  49152. }, {
  49153. key: "createPartsVector",
  49154. value: function createPartsVector(builder, data) {
  49155. builder.startVector(4, data.length, 4);
  49156. for (var i = data.length - 1; i >= 0; i--) {
  49157. builder.addOffset(data[i]);
  49158. }
  49159. return builder.endVector();
  49160. }
  49161. }, {
  49162. key: "startPartsVector",
  49163. value: function startPartsVector(builder, numElems) {
  49164. builder.startVector(4, numElems, 4);
  49165. }
  49166. }, {
  49167. key: "endGeometry",
  49168. value: function endGeometry(builder) {
  49169. var offset = builder.endObject();
  49170. return offset;
  49171. }
  49172. }, {
  49173. key: "createGeometry",
  49174. value: function createGeometry(builder, endsOffset, xyOffset, zOffset, mOffset, tOffset, tmOffset, type, partsOffset) {
  49175. Geometry.startGeometry(builder);
  49176. Geometry.addEnds(builder, endsOffset);
  49177. Geometry.addXy(builder, xyOffset);
  49178. Geometry.addZ(builder, zOffset);
  49179. Geometry.addM(builder, mOffset);
  49180. Geometry.addT(builder, tOffset);
  49181. Geometry.addTm(builder, tmOffset);
  49182. Geometry.addType(builder, type);
  49183. Geometry.addParts(builder, partsOffset);
  49184. return Geometry.endGeometry(builder);
  49185. }
  49186. }]);
  49187. return Geometry;
  49188. }();
  49189. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/generic/geometry.js
  49190. function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
  49191. 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."); }
  49192. function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
  49193. function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
  49194. 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; } } }; }
  49195. 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); }
  49196. 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; }
  49197. function geometry_buildGeometry(builder, parsedGeometry) {
  49198. var xy = parsedGeometry.xy,
  49199. z = parsedGeometry.z,
  49200. ends = parsedGeometry.ends,
  49201. parts = parsedGeometry.parts,
  49202. type = parsedGeometry.type;
  49203. if (parts) {
  49204. var partOffsets = parts.map(function (part) {
  49205. return geometry_buildGeometry(builder, part);
  49206. });
  49207. var partsOffset = Geometry.createPartsVector(builder, partOffsets);
  49208. Geometry.startGeometry(builder);
  49209. Geometry.addParts(builder, partsOffset);
  49210. Geometry.addType(builder, type);
  49211. return Geometry.endGeometry(builder);
  49212. }
  49213. var xyOffset = Geometry.createXyVector(builder, xy);
  49214. var zOffset;
  49215. if (z) zOffset = Geometry.createZVector(builder, z);
  49216. var endsOffset;
  49217. if (ends) endsOffset = Geometry.createEndsVector(builder, ends);
  49218. Geometry.startGeometry(builder);
  49219. if (endsOffset) Geometry.addEnds(builder, endsOffset);
  49220. Geometry.addXy(builder, xyOffset);
  49221. if (zOffset) Geometry.addZ(builder, zOffset);
  49222. Geometry.addType(builder, type);
  49223. return Geometry.endGeometry(builder);
  49224. }
  49225. function geometry_flat(a, xy, z) {
  49226. if (a.length === 0) return;
  49227. if (Array.isArray(a[0])) {
  49228. var _iterator = _createForOfIteratorHelper(a),
  49229. _step;
  49230. try {
  49231. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  49232. var sa = _step.value;
  49233. geometry_flat(sa, xy, z);
  49234. }
  49235. } catch (err) {
  49236. _iterator.e(err);
  49237. } finally {
  49238. _iterator.f();
  49239. }
  49240. } else {
  49241. if (a.length === 2) xy.push.apply(xy, _toConsumableArray(a));else {
  49242. xy.push(a[0], a[1]);
  49243. z.push(a[2]);
  49244. }
  49245. }
  49246. }
  49247. function geometry_parseGeometry(geometry, headerGeomType) {
  49248. var xy;
  49249. var ends;
  49250. var parts;
  49251. var type = headerGeomType;
  49252. if (type === GeometryType.Unknown) {
  49253. type = geometry_toGeometryType(geometry.getType());
  49254. }
  49255. if (type === GeometryType.MultiLineString) {
  49256. if (geometry.getFlatCoordinates) xy = geometry.getFlatCoordinates();
  49257. var mlsEnds = geometry.getEnds();
  49258. if (mlsEnds.length > 1) ends = mlsEnds.map(function (e) {
  49259. return e >> 1;
  49260. });
  49261. } else if (type === GeometryType.Polygon) {
  49262. if (geometry.getFlatCoordinates) xy = geometry.getFlatCoordinates();
  49263. var pEnds = geometry.getEnds();
  49264. if (pEnds.length > 1) ends = pEnds.map(function (e) {
  49265. return e >> 1;
  49266. });
  49267. } else if (type === GeometryType.MultiPolygon) {
  49268. var mp = geometry;
  49269. parts = mp.getPolygons().map(function (p) {
  49270. return geometry_parseGeometry(p, GeometryType.Polygon);
  49271. });
  49272. } else {
  49273. if (geometry.getFlatCoordinates) xy = geometry.getFlatCoordinates();
  49274. }
  49275. return {
  49276. xy: xy,
  49277. ends: ends,
  49278. type: type,
  49279. parts: parts
  49280. };
  49281. }
  49282. function pairFlatCoordinates(xy, z) {
  49283. var newArray = [];
  49284. for (var i = 0; i < xy.length; i += 2) {
  49285. var a = [xy[i], xy[i + 1]];
  49286. if (z) a.push(z[i >> 1]);
  49287. newArray.push(a);
  49288. }
  49289. return newArray;
  49290. }
  49291. function geometry_toGeometryType(name) {
  49292. if (!name) return GeometryType.Unknown;
  49293. var type = GeometryType[name];
  49294. return type;
  49295. }
  49296. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/geojson/geometry.js
  49297. function geojson_geometry_parseGeometry(geometry) {
  49298. var cs = geometry.coordinates;
  49299. var xy = [];
  49300. var z = [];
  49301. var ends;
  49302. var parts;
  49303. var type = toGeometryType(geometry.type);
  49304. var end = 0;
  49305. switch (geometry.type) {
  49306. case 'Point':
  49307. flat(cs, xy, z);
  49308. break;
  49309. case 'MultiPoint':
  49310. case 'LineString':
  49311. flat(cs, xy, z);
  49312. break;
  49313. case 'MultiLineString':
  49314. case 'Polygon':
  49315. {
  49316. var css = cs;
  49317. flat(css, xy, z);
  49318. if (css.length > 1) ends = css.map(function (c) {
  49319. return end += c.length;
  49320. });
  49321. break;
  49322. }
  49323. case 'MultiPolygon':
  49324. {
  49325. var csss = cs;
  49326. var geometries = csss.map(function (coordinates) {
  49327. return {
  49328. type: 'Polygon',
  49329. coordinates: coordinates
  49330. };
  49331. });
  49332. parts = geometries.map(geojson_geometry_parseGeometry);
  49333. break;
  49334. }
  49335. }
  49336. return {
  49337. xy: xy,
  49338. z: z.length > 0 ? z : undefined,
  49339. ends: ends,
  49340. type: type,
  49341. parts: parts
  49342. };
  49343. }
  49344. function geometry_parseGC(geometry) {
  49345. var type = toGeometryType(geometry.type);
  49346. var parts = [];
  49347. for (var i = 0; i < geometry.geometries.length; i++) {
  49348. var g = geometry.geometries[i];
  49349. if (g.type === 'GeometryCollection') parts.push(geometry_parseGC(g));else parts.push(geojson_geometry_parseGeometry(g));
  49350. }
  49351. return {
  49352. type: type,
  49353. parts: parts
  49354. };
  49355. }
  49356. function extractParts(xy, z, ends) {
  49357. if (!ends || ends.length === 0) return [pairFlatCoordinates(xy, z)];
  49358. var s = 0;
  49359. var xySlices = Array.from(ends).map(function (e) {
  49360. return xy.slice(s, s = e << 1);
  49361. });
  49362. var zSlices;
  49363. if (z) {
  49364. s = 0;
  49365. zSlices = Array.from(ends).map(function (e) {
  49366. return z.slice(s, s = e);
  49367. });
  49368. }
  49369. return xySlices.map(function (xy, i) {
  49370. return pairFlatCoordinates(xy, zSlices ? zSlices[i] : undefined);
  49371. });
  49372. }
  49373. function toGeoJsonCoordinates(geometry, type) {
  49374. var xy = geometry.xyArray();
  49375. var z = geometry.zArray();
  49376. switch (type) {
  49377. case geometry_type_GeometryType.Point:
  49378. {
  49379. var a = Array.from(xy);
  49380. if (z) a.push(z[0]);
  49381. return a;
  49382. }
  49383. case geometry_type_GeometryType.MultiPoint:
  49384. case geometry_type_GeometryType.LineString:
  49385. return pairFlatCoordinates(xy, z);
  49386. case geometry_type_GeometryType.MultiLineString:
  49387. return extractParts(xy, z, geometry.endsArray());
  49388. case geometry_type_GeometryType.Polygon:
  49389. return extractParts(xy, z, geometry.endsArray());
  49390. }
  49391. }
  49392. function fromGeometry(geometry, headerType) {
  49393. var type = headerType;
  49394. if (type === geometry_type_GeometryType.Unknown) {
  49395. type = geometry.type();
  49396. }
  49397. if (type === geometry_type_GeometryType.GeometryCollection) {
  49398. var geometries = [];
  49399. for (var i = 0; i < geometry.partsLength(); i++) {
  49400. var part = geometry.parts(i);
  49401. var partType = part.type();
  49402. geometries.push(fromGeometry(part, partType));
  49403. }
  49404. return {
  49405. type: geometry_type_GeometryType[type],
  49406. geometries: geometries
  49407. };
  49408. } else if (type === geometry_type_GeometryType.MultiPolygon) {
  49409. var _geometries = [];
  49410. for (var _i2 = 0; _i2 < geometry.partsLength(); _i2++) _geometries.push(fromGeometry(geometry.parts(_i2), geometry_type_GeometryType.Polygon));
  49411. return {
  49412. type: geometry_type_GeometryType[type],
  49413. coordinates: _geometries.map(function (g) {
  49414. return g.coordinates;
  49415. })
  49416. };
  49417. }
  49418. var coordinates = toGeoJsonCoordinates(geometry, type);
  49419. return {
  49420. type: geometry_type_GeometryType[type],
  49421. coordinates: coordinates
  49422. };
  49423. }
  49424. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/flat-geobuf/column-type.js
  49425. var column_type_ColumnType;
  49426. (function (ColumnType) {
  49427. ColumnType[ColumnType["Byte"] = 0] = "Byte";
  49428. ColumnType[ColumnType["UByte"] = 1] = "UByte";
  49429. ColumnType[ColumnType["Bool"] = 2] = "Bool";
  49430. ColumnType[ColumnType["Short"] = 3] = "Short";
  49431. ColumnType[ColumnType["UShort"] = 4] = "UShort";
  49432. ColumnType[ColumnType["Int"] = 5] = "Int";
  49433. ColumnType[ColumnType["UInt"] = 6] = "UInt";
  49434. ColumnType[ColumnType["Long"] = 7] = "Long";
  49435. ColumnType[ColumnType["ULong"] = 8] = "ULong";
  49436. ColumnType[ColumnType["Float"] = 9] = "Float";
  49437. ColumnType[ColumnType["Double"] = 10] = "Double";
  49438. ColumnType[ColumnType["String"] = 11] = "String";
  49439. ColumnType[ColumnType["Json"] = 12] = "Json";
  49440. ColumnType[ColumnType["DateTime"] = 13] = "DateTime";
  49441. ColumnType[ColumnType["Binary"] = 14] = "Binary";
  49442. })(column_type_ColumnType || (column_type_ColumnType = {}));
  49443. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/flat-geobuf/column.js
  49444. function column_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  49445. 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); } }
  49446. 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; }
  49447. var column_Column = /*#__PURE__*/function () {
  49448. function Column() {
  49449. column_classCallCheck(this, Column);
  49450. this.bb = null;
  49451. this.bb_pos = 0;
  49452. }
  49453. column_createClass(Column, [{
  49454. key: "__init",
  49455. value: function __init(i, bb) {
  49456. this.bb_pos = i;
  49457. this.bb = bb;
  49458. return this;
  49459. }
  49460. }, {
  49461. key: "name",
  49462. value: function name(optionalEncoding) {
  49463. var offset = this.bb.__offset(this.bb_pos, 4);
  49464. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  49465. }
  49466. }, {
  49467. key: "type",
  49468. value: function type() {
  49469. var offset = this.bb.__offset(this.bb_pos, 6);
  49470. return offset ? this.bb.readUint8(this.bb_pos + offset) : column_type_ColumnType.Byte;
  49471. }
  49472. }, {
  49473. key: "title",
  49474. value: function title(optionalEncoding) {
  49475. var offset = this.bb.__offset(this.bb_pos, 8);
  49476. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  49477. }
  49478. }, {
  49479. key: "description",
  49480. value: function description(optionalEncoding) {
  49481. var offset = this.bb.__offset(this.bb_pos, 10);
  49482. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  49483. }
  49484. }, {
  49485. key: "width",
  49486. value: function width() {
  49487. var offset = this.bb.__offset(this.bb_pos, 12);
  49488. return offset ? this.bb.readInt32(this.bb_pos + offset) : -1;
  49489. }
  49490. }, {
  49491. key: "precision",
  49492. value: function precision() {
  49493. var offset = this.bb.__offset(this.bb_pos, 14);
  49494. return offset ? this.bb.readInt32(this.bb_pos + offset) : -1;
  49495. }
  49496. }, {
  49497. key: "scale",
  49498. value: function scale() {
  49499. var offset = this.bb.__offset(this.bb_pos, 16);
  49500. return offset ? this.bb.readInt32(this.bb_pos + offset) : -1;
  49501. }
  49502. }, {
  49503. key: "nullable",
  49504. value: function nullable() {
  49505. var offset = this.bb.__offset(this.bb_pos, 18);
  49506. return offset ? !!this.bb.readInt8(this.bb_pos + offset) : true;
  49507. }
  49508. }, {
  49509. key: "unique",
  49510. value: function unique() {
  49511. var offset = this.bb.__offset(this.bb_pos, 20);
  49512. return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
  49513. }
  49514. }, {
  49515. key: "primaryKey",
  49516. value: function primaryKey() {
  49517. var offset = this.bb.__offset(this.bb_pos, 22);
  49518. return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
  49519. }
  49520. }, {
  49521. key: "metadata",
  49522. value: function metadata(optionalEncoding) {
  49523. var offset = this.bb.__offset(this.bb_pos, 24);
  49524. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  49525. }
  49526. }], [{
  49527. key: "getRootAsColumn",
  49528. value: function getRootAsColumn(bb, obj) {
  49529. return (obj || new Column()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  49530. }
  49531. }, {
  49532. key: "getSizePrefixedRootAsColumn",
  49533. value: function getSizePrefixedRootAsColumn(bb, obj) {
  49534. bb.setPosition(bb.position() + js_flatbuffers/* SIZE_PREFIX_LENGTH */.XU);
  49535. return (obj || new Column()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  49536. }
  49537. }, {
  49538. key: "startColumn",
  49539. value: function startColumn(builder) {
  49540. builder.startObject(11);
  49541. }
  49542. }, {
  49543. key: "addName",
  49544. value: function addName(builder, nameOffset) {
  49545. builder.addFieldOffset(0, nameOffset, 0);
  49546. }
  49547. }, {
  49548. key: "addType",
  49549. value: function addType(builder, type) {
  49550. builder.addFieldInt8(1, type, column_type_ColumnType.Byte);
  49551. }
  49552. }, {
  49553. key: "addTitle",
  49554. value: function addTitle(builder, titleOffset) {
  49555. builder.addFieldOffset(2, titleOffset, 0);
  49556. }
  49557. }, {
  49558. key: "addDescription",
  49559. value: function addDescription(builder, descriptionOffset) {
  49560. builder.addFieldOffset(3, descriptionOffset, 0);
  49561. }
  49562. }, {
  49563. key: "addWidth",
  49564. value: function addWidth(builder, width) {
  49565. builder.addFieldInt32(4, width, -1);
  49566. }
  49567. }, {
  49568. key: "addPrecision",
  49569. value: function addPrecision(builder, precision) {
  49570. builder.addFieldInt32(5, precision, -1);
  49571. }
  49572. }, {
  49573. key: "addScale",
  49574. value: function addScale(builder, scale) {
  49575. builder.addFieldInt32(6, scale, -1);
  49576. }
  49577. }, {
  49578. key: "addNullable",
  49579. value: function addNullable(builder, nullable) {
  49580. builder.addFieldInt8(7, +nullable, +true);
  49581. }
  49582. }, {
  49583. key: "addUnique",
  49584. value: function addUnique(builder, unique) {
  49585. builder.addFieldInt8(8, +unique, +false);
  49586. }
  49587. }, {
  49588. key: "addPrimaryKey",
  49589. value: function addPrimaryKey(builder, primaryKey) {
  49590. builder.addFieldInt8(9, +primaryKey, +false);
  49591. }
  49592. }, {
  49593. key: "addMetadata",
  49594. value: function addMetadata(builder, metadataOffset) {
  49595. builder.addFieldOffset(10, metadataOffset, 0);
  49596. }
  49597. }, {
  49598. key: "endColumn",
  49599. value: function endColumn(builder) {
  49600. var offset = builder.endObject();
  49601. builder.requiredField(offset, 4);
  49602. return offset;
  49603. }
  49604. }, {
  49605. key: "createColumn",
  49606. value: function createColumn(builder, nameOffset, type, titleOffset, descriptionOffset, width, precision, scale, nullable, unique, primaryKey, metadataOffset) {
  49607. Column.startColumn(builder);
  49608. Column.addName(builder, nameOffset);
  49609. Column.addType(builder, type);
  49610. Column.addTitle(builder, titleOffset);
  49611. Column.addDescription(builder, descriptionOffset);
  49612. Column.addWidth(builder, width);
  49613. Column.addPrecision(builder, precision);
  49614. Column.addScale(builder, scale);
  49615. Column.addNullable(builder, nullable);
  49616. Column.addUnique(builder, unique);
  49617. Column.addPrimaryKey(builder, primaryKey);
  49618. Column.addMetadata(builder, metadataOffset);
  49619. return Column.endColumn(builder);
  49620. }
  49621. }]);
  49622. return Column;
  49623. }();
  49624. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/flat-geobuf/feature.js
  49625. function feature_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  49626. 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); } }
  49627. 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; }
  49628. var feature_Feature = /*#__PURE__*/function () {
  49629. function Feature() {
  49630. feature_classCallCheck(this, Feature);
  49631. this.bb = null;
  49632. this.bb_pos = 0;
  49633. }
  49634. feature_createClass(Feature, [{
  49635. key: "__init",
  49636. value: function __init(i, bb) {
  49637. this.bb_pos = i;
  49638. this.bb = bb;
  49639. return this;
  49640. }
  49641. }, {
  49642. key: "geometry",
  49643. value: function geometry(obj) {
  49644. var offset = this.bb.__offset(this.bb_pos, 4);
  49645. return offset ? (obj || new geometry_Geometry()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
  49646. }
  49647. }, {
  49648. key: "properties",
  49649. value: function properties(index) {
  49650. var offset = this.bb.__offset(this.bb_pos, 6);
  49651. return offset ? this.bb.readUint8(this.bb.__vector(this.bb_pos + offset) + index) : 0;
  49652. }
  49653. }, {
  49654. key: "propertiesLength",
  49655. value: function propertiesLength() {
  49656. var offset = this.bb.__offset(this.bb_pos, 6);
  49657. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  49658. }
  49659. }, {
  49660. key: "propertiesArray",
  49661. value: function propertiesArray() {
  49662. var offset = this.bb.__offset(this.bb_pos, 6);
  49663. 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;
  49664. }
  49665. }, {
  49666. key: "columns",
  49667. value: function columns(index, obj) {
  49668. var offset = this.bb.__offset(this.bb_pos, 8);
  49669. return offset ? (obj || new column_Column()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
  49670. }
  49671. }, {
  49672. key: "columnsLength",
  49673. value: function columnsLength() {
  49674. var offset = this.bb.__offset(this.bb_pos, 8);
  49675. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  49676. }
  49677. }], [{
  49678. key: "getRootAsFeature",
  49679. value: function getRootAsFeature(bb, obj) {
  49680. return (obj || new Feature()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  49681. }
  49682. }, {
  49683. key: "getSizePrefixedRootAsFeature",
  49684. value: function getSizePrefixedRootAsFeature(bb, obj) {
  49685. bb.setPosition(bb.position() + js_flatbuffers/* SIZE_PREFIX_LENGTH */.XU);
  49686. return (obj || new Feature()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  49687. }
  49688. }, {
  49689. key: "startFeature",
  49690. value: function startFeature(builder) {
  49691. builder.startObject(3);
  49692. }
  49693. }, {
  49694. key: "addGeometry",
  49695. value: function addGeometry(builder, geometryOffset) {
  49696. builder.addFieldOffset(0, geometryOffset, 0);
  49697. }
  49698. }, {
  49699. key: "addProperties",
  49700. value: function addProperties(builder, propertiesOffset) {
  49701. builder.addFieldOffset(1, propertiesOffset, 0);
  49702. }
  49703. }, {
  49704. key: "createPropertiesVector",
  49705. value: function createPropertiesVector(builder, data) {
  49706. builder.startVector(1, data.length, 1);
  49707. for (var i = data.length - 1; i >= 0; i--) {
  49708. builder.addInt8(data[i]);
  49709. }
  49710. return builder.endVector();
  49711. }
  49712. }, {
  49713. key: "startPropertiesVector",
  49714. value: function startPropertiesVector(builder, numElems) {
  49715. builder.startVector(1, numElems, 1);
  49716. }
  49717. }, {
  49718. key: "addColumns",
  49719. value: function addColumns(builder, columnsOffset) {
  49720. builder.addFieldOffset(2, columnsOffset, 0);
  49721. }
  49722. }, {
  49723. key: "createColumnsVector",
  49724. value: function createColumnsVector(builder, data) {
  49725. builder.startVector(4, data.length, 4);
  49726. for (var i = data.length - 1; i >= 0; i--) {
  49727. builder.addOffset(data[i]);
  49728. }
  49729. return builder.endVector();
  49730. }
  49731. }, {
  49732. key: "startColumnsVector",
  49733. value: function startColumnsVector(builder, numElems) {
  49734. builder.startVector(4, numElems, 4);
  49735. }
  49736. }, {
  49737. key: "endFeature",
  49738. value: function endFeature(builder) {
  49739. var offset = builder.endObject();
  49740. return offset;
  49741. }
  49742. }, {
  49743. key: "finishFeatureBuffer",
  49744. value: function finishFeatureBuffer(builder, offset) {
  49745. builder.finish(offset);
  49746. }
  49747. }, {
  49748. key: "finishSizePrefixedFeatureBuffer",
  49749. value: function finishSizePrefixedFeatureBuffer(builder, offset) {
  49750. builder.finish(offset, undefined, true);
  49751. }
  49752. }, {
  49753. key: "createFeature",
  49754. value: function createFeature(builder, geometryOffset, propertiesOffset, columnsOffset) {
  49755. Feature.startFeature(builder);
  49756. Feature.addGeometry(builder, geometryOffset);
  49757. Feature.addProperties(builder, propertiesOffset);
  49758. Feature.addColumns(builder, columnsOffset);
  49759. return Feature.endFeature(builder);
  49760. }
  49761. }]);
  49762. return Feature;
  49763. }();
  49764. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/generic/feature.js
  49765. var textEncoder = new TextEncoder();
  49766. var textDecoder = new TextDecoder();
  49767. function fromFeature(feature, header, createGeometry, createFeature) {
  49768. var columns = header.columns;
  49769. var geometry = feature.geometry();
  49770. var simpleGeometry = createGeometry(geometry, header.geometryType);
  49771. var properties = parseProperties(feature, columns);
  49772. return createFeature(simpleGeometry, properties);
  49773. }
  49774. function feature_buildFeature(geometry, properties, header) {
  49775. var columns = header.columns;
  49776. var builder = new flatbuffers.Builder();
  49777. var offset = 0;
  49778. var capacity = 1024;
  49779. var bytes = new Uint8Array(capacity);
  49780. var view = new DataView(bytes.buffer);
  49781. var prep = function prep(size) {
  49782. if (offset + size < capacity) return;
  49783. capacity = Math.max(capacity + size, capacity * 2);
  49784. var newBytes = new Uint8Array(capacity);
  49785. newBytes.set(bytes);
  49786. bytes = newBytes;
  49787. view = new DataView(bytes.buffer);
  49788. };
  49789. if (columns) {
  49790. for (var i = 0; i < columns.length; i++) {
  49791. var column = columns[i];
  49792. var value = properties[column.name];
  49793. if (value === null) continue;
  49794. prep(2);
  49795. view.setUint16(offset, i, true);
  49796. offset += 2;
  49797. switch (column.type) {
  49798. case ColumnType.Bool:
  49799. prep(1);
  49800. view.setUint8(offset, value);
  49801. offset += 1;
  49802. break;
  49803. case ColumnType.Short:
  49804. prep(2);
  49805. view.setInt16(offset, value, true);
  49806. offset += 2;
  49807. break;
  49808. case ColumnType.UShort:
  49809. prep(2);
  49810. view.setUint16(offset, value, true);
  49811. offset += 2;
  49812. break;
  49813. case ColumnType.Int:
  49814. prep(4);
  49815. view.setInt32(offset, value, true);
  49816. offset += 4;
  49817. break;
  49818. case ColumnType.UInt:
  49819. prep(4);
  49820. view.setUint32(offset, value, true);
  49821. offset += 4;
  49822. break;
  49823. case ColumnType.Long:
  49824. prep(8);
  49825. view.setBigInt64(offset, BigInt(value), true);
  49826. offset += 8;
  49827. break;
  49828. case ColumnType.Float:
  49829. prep(4);
  49830. view.setFloat32(offset, value, true);
  49831. offset += 4;
  49832. break;
  49833. case ColumnType.Double:
  49834. prep(8);
  49835. view.setFloat64(offset, value, true);
  49836. offset += 8;
  49837. break;
  49838. case ColumnType.DateTime:
  49839. case ColumnType.String:
  49840. {
  49841. var str = textEncoder.encode(value);
  49842. prep(4);
  49843. view.setUint32(offset, str.length, true);
  49844. offset += 4;
  49845. prep(str.length);
  49846. bytes.set(str, offset);
  49847. offset += str.length;
  49848. break;
  49849. }
  49850. case ColumnType.Json:
  49851. {
  49852. var _str = textEncoder.encode(JSON.stringify(value));
  49853. prep(4);
  49854. view.setUint32(offset, _str.length, true);
  49855. offset += 4;
  49856. prep(_str.length);
  49857. bytes.set(_str, offset);
  49858. offset += _str.length;
  49859. break;
  49860. }
  49861. default:
  49862. throw new Error('Unknown type ' + column.type);
  49863. }
  49864. }
  49865. }
  49866. var propertiesOffset = null;
  49867. if (offset > 0) propertiesOffset = Feature.createPropertiesVector(builder, bytes.slice(0, offset));
  49868. var geometryOffset = buildGeometry(builder, geometry);
  49869. Feature.startFeature(builder);
  49870. Feature.addGeometry(builder, geometryOffset);
  49871. if (propertiesOffset) Feature.addProperties(builder, propertiesOffset);
  49872. var featureOffset = Feature.endFeature(builder);
  49873. builder.finishSizePrefixed(featureOffset);
  49874. return builder.asUint8Array();
  49875. }
  49876. function parseProperties(feature, columns) {
  49877. var properties = {};
  49878. if (!columns || columns.length === 0) return properties;
  49879. var array = feature.propertiesArray();
  49880. if (!array) return properties;
  49881. var view = new DataView(array.buffer, array.byteOffset);
  49882. var length = feature.propertiesLength();
  49883. var offset = 0;
  49884. while (offset < length) {
  49885. var i = view.getUint16(offset, true);
  49886. offset += 2;
  49887. var column = columns[i];
  49888. var name = column.name;
  49889. switch (column.type) {
  49890. case column_type_ColumnType.Bool:
  49891. {
  49892. properties[name] = !!view.getUint8(offset);
  49893. offset += 1;
  49894. break;
  49895. }
  49896. case column_type_ColumnType.Byte:
  49897. {
  49898. properties[name] = view.getInt8(offset);
  49899. offset += 1;
  49900. break;
  49901. }
  49902. case column_type_ColumnType.UByte:
  49903. {
  49904. properties[name] = view.getUint8(offset);
  49905. offset += 1;
  49906. break;
  49907. }
  49908. case column_type_ColumnType.Short:
  49909. {
  49910. properties[name] = view.getInt16(offset, true);
  49911. offset += 2;
  49912. break;
  49913. }
  49914. case column_type_ColumnType.UShort:
  49915. {
  49916. properties[name] = view.getUint16(offset, true);
  49917. offset += 2;
  49918. break;
  49919. }
  49920. case column_type_ColumnType.Int:
  49921. {
  49922. properties[name] = view.getInt32(offset, true);
  49923. offset += 4;
  49924. break;
  49925. }
  49926. case column_type_ColumnType.UInt:
  49927. {
  49928. properties[name] = view.getUint32(offset, true);
  49929. offset += 4;
  49930. break;
  49931. }
  49932. case column_type_ColumnType.Long:
  49933. {
  49934. properties[name] = Number(view.getBigInt64(offset, true));
  49935. offset += 8;
  49936. break;
  49937. }
  49938. case column_type_ColumnType.ULong:
  49939. {
  49940. properties[name] = Number(view.getBigUint64(offset, true));
  49941. offset += 8;
  49942. break;
  49943. }
  49944. case column_type_ColumnType.Float:
  49945. {
  49946. properties[name] = view.getFloat32(offset, true);
  49947. offset += 4;
  49948. break;
  49949. }
  49950. case column_type_ColumnType.Double:
  49951. {
  49952. properties[name] = view.getFloat64(offset, true);
  49953. offset += 8;
  49954. break;
  49955. }
  49956. case column_type_ColumnType.DateTime:
  49957. case column_type_ColumnType.String:
  49958. {
  49959. var _length = view.getUint32(offset, true);
  49960. offset += 4;
  49961. properties[name] = textDecoder.decode(array.subarray(offset, offset + _length));
  49962. offset += _length;
  49963. break;
  49964. }
  49965. case column_type_ColumnType.Json:
  49966. {
  49967. var _length2 = view.getUint32(offset, true);
  49968. offset += 4;
  49969. var str = textDecoder.decode(array.subarray(offset, offset + _length2));
  49970. properties[name] = JSON.parse(str);
  49971. offset += _length2;
  49972. break;
  49973. }
  49974. default:
  49975. throw new Error('Unknown type ' + column.type);
  49976. }
  49977. }
  49978. return properties;
  49979. }
  49980. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/geojson/feature.js
  49981. function feature_fromFeature(feature, header) {
  49982. var columns = header.columns;
  49983. var geometry = fromGeometry(feature.geometry(), header.geometryType);
  49984. var geoJsonfeature = {
  49985. type: 'Feature',
  49986. geometry: geometry,
  49987. properties: parseProperties(feature, columns)
  49988. };
  49989. return geoJsonfeature;
  49990. }
  49991. // EXTERNAL MODULE: ./node_modules/slice-source/dist/slice-source.js
  49992. var slice_source = __webpack_require__(901);
  49993. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/flat-geobuf/crs.js
  49994. function crs_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  49995. 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); } }
  49996. 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; }
  49997. var Crs = /*#__PURE__*/function () {
  49998. function Crs() {
  49999. crs_classCallCheck(this, Crs);
  50000. this.bb = null;
  50001. this.bb_pos = 0;
  50002. }
  50003. crs_createClass(Crs, [{
  50004. key: "__init",
  50005. value: function __init(i, bb) {
  50006. this.bb_pos = i;
  50007. this.bb = bb;
  50008. return this;
  50009. }
  50010. }, {
  50011. key: "org",
  50012. value: function org(optionalEncoding) {
  50013. var offset = this.bb.__offset(this.bb_pos, 4);
  50014. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  50015. }
  50016. }, {
  50017. key: "code",
  50018. value: function code() {
  50019. var offset = this.bb.__offset(this.bb_pos, 6);
  50020. return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;
  50021. }
  50022. }, {
  50023. key: "name",
  50024. value: function name(optionalEncoding) {
  50025. var offset = this.bb.__offset(this.bb_pos, 8);
  50026. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  50027. }
  50028. }, {
  50029. key: "description",
  50030. value: function description(optionalEncoding) {
  50031. var offset = this.bb.__offset(this.bb_pos, 10);
  50032. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  50033. }
  50034. }, {
  50035. key: "wkt",
  50036. value: function wkt(optionalEncoding) {
  50037. var offset = this.bb.__offset(this.bb_pos, 12);
  50038. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  50039. }
  50040. }, {
  50041. key: "codeString",
  50042. value: function codeString(optionalEncoding) {
  50043. var offset = this.bb.__offset(this.bb_pos, 14);
  50044. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  50045. }
  50046. }], [{
  50047. key: "getRootAsCrs",
  50048. value: function getRootAsCrs(bb, obj) {
  50049. return (obj || new Crs()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  50050. }
  50051. }, {
  50052. key: "getSizePrefixedRootAsCrs",
  50053. value: function getSizePrefixedRootAsCrs(bb, obj) {
  50054. bb.setPosition(bb.position() + js_flatbuffers/* SIZE_PREFIX_LENGTH */.XU);
  50055. return (obj || new Crs()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  50056. }
  50057. }, {
  50058. key: "startCrs",
  50059. value: function startCrs(builder) {
  50060. builder.startObject(6);
  50061. }
  50062. }, {
  50063. key: "addOrg",
  50064. value: function addOrg(builder, orgOffset) {
  50065. builder.addFieldOffset(0, orgOffset, 0);
  50066. }
  50067. }, {
  50068. key: "addCode",
  50069. value: function addCode(builder, code) {
  50070. builder.addFieldInt32(1, code, 0);
  50071. }
  50072. }, {
  50073. key: "addName",
  50074. value: function addName(builder, nameOffset) {
  50075. builder.addFieldOffset(2, nameOffset, 0);
  50076. }
  50077. }, {
  50078. key: "addDescription",
  50079. value: function addDescription(builder, descriptionOffset) {
  50080. builder.addFieldOffset(3, descriptionOffset, 0);
  50081. }
  50082. }, {
  50083. key: "addWkt",
  50084. value: function addWkt(builder, wktOffset) {
  50085. builder.addFieldOffset(4, wktOffset, 0);
  50086. }
  50087. }, {
  50088. key: "addCodeString",
  50089. value: function addCodeString(builder, codeStringOffset) {
  50090. builder.addFieldOffset(5, codeStringOffset, 0);
  50091. }
  50092. }, {
  50093. key: "endCrs",
  50094. value: function endCrs(builder) {
  50095. var offset = builder.endObject();
  50096. return offset;
  50097. }
  50098. }, {
  50099. key: "createCrs",
  50100. value: function createCrs(builder, orgOffset, code, nameOffset, descriptionOffset, wktOffset, codeStringOffset) {
  50101. Crs.startCrs(builder);
  50102. Crs.addOrg(builder, orgOffset);
  50103. Crs.addCode(builder, code);
  50104. Crs.addName(builder, nameOffset);
  50105. Crs.addDescription(builder, descriptionOffset);
  50106. Crs.addWkt(builder, wktOffset);
  50107. Crs.addCodeString(builder, codeStringOffset);
  50108. return Crs.endCrs(builder);
  50109. }
  50110. }]);
  50111. return Crs;
  50112. }();
  50113. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/flat-geobuf/header.js
  50114. function header_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  50115. 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); } }
  50116. 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; }
  50117. var header_Header = /*#__PURE__*/function () {
  50118. function Header() {
  50119. header_classCallCheck(this, Header);
  50120. this.bb = null;
  50121. this.bb_pos = 0;
  50122. }
  50123. header_createClass(Header, [{
  50124. key: "__init",
  50125. value: function __init(i, bb) {
  50126. this.bb_pos = i;
  50127. this.bb = bb;
  50128. return this;
  50129. }
  50130. }, {
  50131. key: "name",
  50132. value: function name(optionalEncoding) {
  50133. var offset = this.bb.__offset(this.bb_pos, 4);
  50134. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  50135. }
  50136. }, {
  50137. key: "envelope",
  50138. value: function envelope(index) {
  50139. var offset = this.bb.__offset(this.bb_pos, 6);
  50140. return offset ? this.bb.readFloat64(this.bb.__vector(this.bb_pos + offset) + index * 8) : 0;
  50141. }
  50142. }, {
  50143. key: "envelopeLength",
  50144. value: function envelopeLength() {
  50145. var offset = this.bb.__offset(this.bb_pos, 6);
  50146. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  50147. }
  50148. }, {
  50149. key: "envelopeArray",
  50150. value: function envelopeArray() {
  50151. var offset = this.bb.__offset(this.bb_pos, 6);
  50152. 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;
  50153. }
  50154. }, {
  50155. key: "geometryType",
  50156. value: function geometryType() {
  50157. var offset = this.bb.__offset(this.bb_pos, 8);
  50158. return offset ? this.bb.readUint8(this.bb_pos + offset) : geometry_type_GeometryType.Unknown;
  50159. }
  50160. }, {
  50161. key: "hasZ",
  50162. value: function hasZ() {
  50163. var offset = this.bb.__offset(this.bb_pos, 10);
  50164. return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
  50165. }
  50166. }, {
  50167. key: "hasM",
  50168. value: function hasM() {
  50169. var offset = this.bb.__offset(this.bb_pos, 12);
  50170. return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
  50171. }
  50172. }, {
  50173. key: "hasT",
  50174. value: function hasT() {
  50175. var offset = this.bb.__offset(this.bb_pos, 14);
  50176. return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
  50177. }
  50178. }, {
  50179. key: "hasTm",
  50180. value: function hasTm() {
  50181. var offset = this.bb.__offset(this.bb_pos, 16);
  50182. return offset ? !!this.bb.readInt8(this.bb_pos + offset) : false;
  50183. }
  50184. }, {
  50185. key: "columns",
  50186. value: function columns(index, obj) {
  50187. var offset = this.bb.__offset(this.bb_pos, 18);
  50188. return offset ? (obj || new column_Column()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;
  50189. }
  50190. }, {
  50191. key: "columnsLength",
  50192. value: function columnsLength() {
  50193. var offset = this.bb.__offset(this.bb_pos, 18);
  50194. return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;
  50195. }
  50196. }, {
  50197. key: "featuresCount",
  50198. value: function featuresCount() {
  50199. var offset = this.bb.__offset(this.bb_pos, 20);
  50200. return offset ? this.bb.readUint64(this.bb_pos + offset) : BigInt('0');
  50201. }
  50202. }, {
  50203. key: "indexNodeSize",
  50204. value: function indexNodeSize() {
  50205. var offset = this.bb.__offset(this.bb_pos, 22);
  50206. return offset ? this.bb.readUint16(this.bb_pos + offset) : 16;
  50207. }
  50208. }, {
  50209. key: "crs",
  50210. value: function crs(obj) {
  50211. var offset = this.bb.__offset(this.bb_pos, 24);
  50212. return offset ? (obj || new Crs()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
  50213. }
  50214. }, {
  50215. key: "title",
  50216. value: function title(optionalEncoding) {
  50217. var offset = this.bb.__offset(this.bb_pos, 26);
  50218. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  50219. }
  50220. }, {
  50221. key: "description",
  50222. value: function description(optionalEncoding) {
  50223. var offset = this.bb.__offset(this.bb_pos, 28);
  50224. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  50225. }
  50226. }, {
  50227. key: "metadata",
  50228. value: function metadata(optionalEncoding) {
  50229. var offset = this.bb.__offset(this.bb_pos, 30);
  50230. return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;
  50231. }
  50232. }], [{
  50233. key: "getRootAsHeader",
  50234. value: function getRootAsHeader(bb, obj) {
  50235. return (obj || new Header()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  50236. }
  50237. }, {
  50238. key: "getSizePrefixedRootAsHeader",
  50239. value: function getSizePrefixedRootAsHeader(bb, obj) {
  50240. bb.setPosition(bb.position() + js_flatbuffers/* SIZE_PREFIX_LENGTH */.XU);
  50241. return (obj || new Header()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
  50242. }
  50243. }, {
  50244. key: "startHeader",
  50245. value: function startHeader(builder) {
  50246. builder.startObject(14);
  50247. }
  50248. }, {
  50249. key: "addName",
  50250. value: function addName(builder, nameOffset) {
  50251. builder.addFieldOffset(0, nameOffset, 0);
  50252. }
  50253. }, {
  50254. key: "addEnvelope",
  50255. value: function addEnvelope(builder, envelopeOffset) {
  50256. builder.addFieldOffset(1, envelopeOffset, 0);
  50257. }
  50258. }, {
  50259. key: "createEnvelopeVector",
  50260. value: function createEnvelopeVector(builder, data) {
  50261. builder.startVector(8, data.length, 8);
  50262. for (var i = data.length - 1; i >= 0; i--) {
  50263. builder.addFloat64(data[i]);
  50264. }
  50265. return builder.endVector();
  50266. }
  50267. }, {
  50268. key: "startEnvelopeVector",
  50269. value: function startEnvelopeVector(builder, numElems) {
  50270. builder.startVector(8, numElems, 8);
  50271. }
  50272. }, {
  50273. key: "addGeometryType",
  50274. value: function addGeometryType(builder, geometryType) {
  50275. builder.addFieldInt8(2, geometryType, geometry_type_GeometryType.Unknown);
  50276. }
  50277. }, {
  50278. key: "addHasZ",
  50279. value: function addHasZ(builder, hasZ) {
  50280. builder.addFieldInt8(3, +hasZ, +false);
  50281. }
  50282. }, {
  50283. key: "addHasM",
  50284. value: function addHasM(builder, hasM) {
  50285. builder.addFieldInt8(4, +hasM, +false);
  50286. }
  50287. }, {
  50288. key: "addHasT",
  50289. value: function addHasT(builder, hasT) {
  50290. builder.addFieldInt8(5, +hasT, +false);
  50291. }
  50292. }, {
  50293. key: "addHasTm",
  50294. value: function addHasTm(builder, hasTm) {
  50295. builder.addFieldInt8(6, +hasTm, +false);
  50296. }
  50297. }, {
  50298. key: "addColumns",
  50299. value: function addColumns(builder, columnsOffset) {
  50300. builder.addFieldOffset(7, columnsOffset, 0);
  50301. }
  50302. }, {
  50303. key: "createColumnsVector",
  50304. value: function createColumnsVector(builder, data) {
  50305. builder.startVector(4, data.length, 4);
  50306. for (var i = data.length - 1; i >= 0; i--) {
  50307. builder.addOffset(data[i]);
  50308. }
  50309. return builder.endVector();
  50310. }
  50311. }, {
  50312. key: "startColumnsVector",
  50313. value: function startColumnsVector(builder, numElems) {
  50314. builder.startVector(4, numElems, 4);
  50315. }
  50316. }, {
  50317. key: "addFeaturesCount",
  50318. value: function addFeaturesCount(builder, featuresCount) {
  50319. builder.addFieldInt64(8, featuresCount, BigInt('0'));
  50320. }
  50321. }, {
  50322. key: "addIndexNodeSize",
  50323. value: function addIndexNodeSize(builder, indexNodeSize) {
  50324. builder.addFieldInt16(9, indexNodeSize, 16);
  50325. }
  50326. }, {
  50327. key: "addCrs",
  50328. value: function addCrs(builder, crsOffset) {
  50329. builder.addFieldOffset(10, crsOffset, 0);
  50330. }
  50331. }, {
  50332. key: "addTitle",
  50333. value: function addTitle(builder, titleOffset) {
  50334. builder.addFieldOffset(11, titleOffset, 0);
  50335. }
  50336. }, {
  50337. key: "addDescription",
  50338. value: function addDescription(builder, descriptionOffset) {
  50339. builder.addFieldOffset(12, descriptionOffset, 0);
  50340. }
  50341. }, {
  50342. key: "addMetadata",
  50343. value: function addMetadata(builder, metadataOffset) {
  50344. builder.addFieldOffset(13, metadataOffset, 0);
  50345. }
  50346. }, {
  50347. key: "endHeader",
  50348. value: function endHeader(builder) {
  50349. var offset = builder.endObject();
  50350. return offset;
  50351. }
  50352. }, {
  50353. key: "finishHeaderBuffer",
  50354. value: function finishHeaderBuffer(builder, offset) {
  50355. builder.finish(offset);
  50356. }
  50357. }, {
  50358. key: "finishSizePrefixedHeaderBuffer",
  50359. value: function finishSizePrefixedHeaderBuffer(builder, offset) {
  50360. builder.finish(offset, undefined, true);
  50361. }
  50362. }]);
  50363. return Header;
  50364. }();
  50365. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/header-meta.js
  50366. function fromByteBuffer(bb) {
  50367. var header = header_Header.getRootAsHeader(bb);
  50368. var featuresCount = header.featuresCount();
  50369. var indexNodeSize = header.indexNodeSize();
  50370. var columns = [];
  50371. for (var j = 0; j < header.columnsLength(); j++) {
  50372. var column = header.columns(j);
  50373. if (!column) throw new Error('Column unexpectedly missing');
  50374. if (!column.name()) throw new Error('Column name unexpectedly missing');
  50375. columns.push({
  50376. name: column.name(),
  50377. type: column.type(),
  50378. title: column.title(),
  50379. description: column.description(),
  50380. width: column.width(),
  50381. precision: column.precision(),
  50382. scale: column.scale(),
  50383. nullable: column.nullable(),
  50384. unique: column.unique(),
  50385. primary_key: column.primaryKey()
  50386. });
  50387. }
  50388. var crs = header.crs();
  50389. var crsMeta = crs ? {
  50390. org: crs.org(),
  50391. code: crs.code(),
  50392. name: crs.name(),
  50393. description: crs.description(),
  50394. wkt: crs.wkt(),
  50395. code_string: crs.codeString()
  50396. } : null;
  50397. var headerMeta = {
  50398. geometryType: header.geometryType(),
  50399. columns: columns,
  50400. envelope: null,
  50401. featuresCount: Number(featuresCount),
  50402. indexNodeSize: indexNodeSize,
  50403. crs: crsMeta,
  50404. title: header.title(),
  50405. description: header.description(),
  50406. metadata: header.metadata()
  50407. };
  50408. return headerMeta;
  50409. }
  50410. // EXTERNAL MODULE: ./node_modules/@repeaterjs/repeater/cjs/repeater.js
  50411. var repeater = __webpack_require__(982);
  50412. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/config.js
  50413. function config_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  50414. 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); } }
  50415. 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; }
  50416. var Config = /*#__PURE__*/function () {
  50417. function Config() {
  50418. config_classCallCheck(this, Config);
  50419. this._extraRequestThreshold = 256 * 1024;
  50420. }
  50421. config_createClass(Config, [{
  50422. key: "extraRequestThreshold",
  50423. value: function extraRequestThreshold() {
  50424. return this._extraRequestThreshold;
  50425. }
  50426. }, {
  50427. key: "setExtraRequestThreshold",
  50428. value: function setExtraRequestThreshold(bytes) {
  50429. if (bytes < 0) {
  50430. throw new Error('extraRequestThreshold cannot be negative');
  50431. }
  50432. this._extraRequestThreshold = bytes;
  50433. }
  50434. }]);
  50435. return Config;
  50436. }();
  50437. Config.global = new Config();
  50438. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/logger.js
  50439. function logger_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  50440. 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); } }
  50441. 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; }
  50442. var LogLevel;
  50443. (function (LogLevel) {
  50444. LogLevel[LogLevel["Debug"] = 0] = "Debug";
  50445. LogLevel[LogLevel["Info"] = 1] = "Info";
  50446. LogLevel[LogLevel["Warn"] = 2] = "Warn";
  50447. LogLevel[LogLevel["Error"] = 3] = "Error";
  50448. })(LogLevel || (LogLevel = {}));
  50449. var Logger = /*#__PURE__*/function () {
  50450. function Logger() {
  50451. logger_classCallCheck(this, Logger);
  50452. }
  50453. logger_createClass(Logger, null, [{
  50454. key: "debug",
  50455. value: function debug() {
  50456. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  50457. args[_key] = arguments[_key];
  50458. }
  50459. this.log.apply(this, [LogLevel.Debug].concat(args));
  50460. }
  50461. }, {
  50462. key: "info",
  50463. value: function info() {
  50464. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  50465. args[_key2] = arguments[_key2];
  50466. }
  50467. this.log.apply(this, [LogLevel.Info].concat(args));
  50468. }
  50469. }, {
  50470. key: "warn",
  50471. value: function warn() {
  50472. for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  50473. args[_key3] = arguments[_key3];
  50474. }
  50475. this.log.apply(this, [LogLevel.Warn].concat(args));
  50476. }
  50477. }, {
  50478. key: "error",
  50479. value: function error() {
  50480. for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  50481. args[_key4] = arguments[_key4];
  50482. }
  50483. this.log.apply(this, [LogLevel.Error].concat(args));
  50484. }
  50485. }, {
  50486. key: "log",
  50487. value: function log(level) {
  50488. if (this.logLevel > level) {
  50489. return;
  50490. }
  50491. for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
  50492. args[_key5 - 1] = arguments[_key5];
  50493. }
  50494. switch (level) {
  50495. case LogLevel.Debug:
  50496. {
  50497. var _console;
  50498. (_console = console).debug.apply(_console, args);
  50499. break;
  50500. }
  50501. case LogLevel.Info:
  50502. {
  50503. var _console2;
  50504. (_console2 = console).info.apply(_console2, args);
  50505. break;
  50506. }
  50507. case LogLevel.Warn:
  50508. {
  50509. var _console3;
  50510. (_console3 = console).warn.apply(_console3, args);
  50511. break;
  50512. }
  50513. case LogLevel.Error:
  50514. {
  50515. var _console4;
  50516. (_console4 = console).error.apply(_console4, args);
  50517. break;
  50518. }
  50519. }
  50520. }
  50521. }]);
  50522. return Logger;
  50523. }();
  50524. Logger.logLevel = LogLevel.Info;
  50525. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/packedrtree.js
  50526. 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); }
  50527. 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; }
  50528. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || packedrtree_unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
  50529. 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."); }
  50530. 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); }
  50531. 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; }
  50532. 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; }
  50533. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  50534. function packedrtree_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  50535. 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); } }
  50536. 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; }
  50537. function _awaitAsyncGenerator(value) { return new _OverloadYield(value, 0); }
  50538. function _wrapAsyncGenerator(fn) { return function () { return new _AsyncGenerator(fn.apply(this, arguments)); }; }
  50539. 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); }
  50540. _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); };
  50541. function _OverloadYield(value, kind) { this.v = value, this.k = kind; }
  50542. var NODE_ITEM_LEN = 8 * 4 + 8;
  50543. var DEFAULT_NODE_SIZE = 16;
  50544. function calcTreeSize(numItems, nodeSize) {
  50545. nodeSize = Math.min(Math.max(+nodeSize, 2), 65535);
  50546. var n = numItems;
  50547. var numNodes = n;
  50548. do {
  50549. n = Math.ceil(n / nodeSize);
  50550. numNodes += n;
  50551. } while (n !== 1);
  50552. return numNodes * NODE_ITEM_LEN;
  50553. }
  50554. function generateLevelBounds(numItems, nodeSize) {
  50555. if (nodeSize < 2) throw new Error('Node size must be at least 2');
  50556. if (numItems === 0) throw new Error('Number of items must be greater than 0');
  50557. var n = numItems;
  50558. var numNodes = n;
  50559. var levelNumNodes = [n];
  50560. do {
  50561. n = Math.ceil(n / nodeSize);
  50562. numNodes += n;
  50563. levelNumNodes.push(n);
  50564. } while (n !== 1);
  50565. var levelOffsets = [];
  50566. n = numNodes;
  50567. for (var _i = 0, _levelNumNodes = levelNumNodes; _i < _levelNumNodes.length; _i++) {
  50568. var size = _levelNumNodes[_i];
  50569. levelOffsets.push(n - size);
  50570. n -= size;
  50571. }
  50572. levelOffsets.reverse();
  50573. levelNumNodes.reverse();
  50574. var levelBounds = [];
  50575. for (var i = 0; i < levelNumNodes.length; i++) levelBounds.push([levelOffsets[i], levelOffsets[i] + levelNumNodes[i]]);
  50576. levelBounds.reverse();
  50577. return levelBounds;
  50578. }
  50579. function streamSearch(_x, _x2, _x3, _x4) {
  50580. return _streamSearch.apply(this, arguments);
  50581. }
  50582. function _streamSearch() {
  50583. _streamSearch = _wrapAsyncGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(numItems, nodeSize, rect, readNode) {
  50584. var NodeRange, minX, minY, maxX, maxY, levelBounds, leafNodesOffset, rootNodeRange, queue, _loop;
  50585. return _regeneratorRuntime().wrap(function _callee$(_context3) {
  50586. while (1) switch (_context3.prev = _context3.next) {
  50587. case 0:
  50588. NodeRange = /*#__PURE__*/function () {
  50589. function NodeRange(nodes, level) {
  50590. packedrtree_classCallCheck(this, NodeRange);
  50591. this._level = level;
  50592. this.nodes = nodes;
  50593. }
  50594. packedrtree_createClass(NodeRange, [{
  50595. key: "level",
  50596. value: function level() {
  50597. return this._level;
  50598. }
  50599. }, {
  50600. key: "startNode",
  50601. value: function startNode() {
  50602. return this.nodes[0];
  50603. }
  50604. }, {
  50605. key: "endNode",
  50606. value: function endNode() {
  50607. return this.nodes[1];
  50608. }
  50609. }, {
  50610. key: "extendEndNodeToNewOffset",
  50611. value: function extendEndNodeToNewOffset(newOffset) {
  50612. console.assert(newOffset > this.nodes[1]);
  50613. this.nodes[1] = newOffset;
  50614. }
  50615. }, {
  50616. key: "toString",
  50617. value: function toString() {
  50618. return "[NodeRange level: ".concat(this._level, ", nodes: ").concat(this.nodes[0], "-").concat(this.nodes[1], "]");
  50619. }
  50620. }]);
  50621. return NodeRange;
  50622. }();
  50623. minX = rect.minX, minY = rect.minY, maxX = rect.maxX, maxY = rect.maxY;
  50624. Logger.info("tree items: ".concat(numItems, ", nodeSize: ").concat(nodeSize));
  50625. levelBounds = generateLevelBounds(numItems, nodeSize);
  50626. leafNodesOffset = levelBounds[0][0];
  50627. rootNodeRange = function () {
  50628. var range = [0, 1];
  50629. var level = levelBounds.length - 1;
  50630. return new NodeRange(range, level);
  50631. }();
  50632. queue = [rootNodeRange];
  50633. Logger.debug("starting stream search with queue: ".concat(queue, ", numItems: ").concat(numItems, ", nodeSize: ").concat(nodeSize, ", levelBounds: ").concat(levelBounds));
  50634. _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
  50635. var nodeRange, nodeIndex, isLeafNode, _levelBounds$nodeRang, levelBound, end, length, buffer, float64Array, uint32Array, _loop2, _ret, pos;
  50636. return _regeneratorRuntime().wrap(function _loop$(_context2) {
  50637. while (1) switch (_context2.prev = _context2.next) {
  50638. case 0:
  50639. nodeRange = queue.shift();
  50640. Logger.debug("popped node: ".concat(nodeRange, ", queueLength: ").concat(queue.length));
  50641. nodeIndex = nodeRange.startNode();
  50642. isLeafNode = nodeIndex >= leafNodesOffset;
  50643. _levelBounds$nodeRang = _slicedToArray(levelBounds[nodeRange.level()], 2), levelBound = _levelBounds$nodeRang[1];
  50644. end = Math.min(nodeRange.endNode() + nodeSize, levelBound);
  50645. length = end - nodeIndex;
  50646. _context2.next = 9;
  50647. return _awaitAsyncGenerator(readNode(nodeIndex * NODE_ITEM_LEN, length * NODE_ITEM_LEN));
  50648. case 9:
  50649. buffer = _context2.sent;
  50650. float64Array = new Float64Array(buffer);
  50651. uint32Array = new Uint32Array(buffer);
  50652. _loop2 = /*#__PURE__*/_regeneratorRuntime().mark(function _loop2(pos) {
  50653. var nodePos, low32Offset, high32Offset, offset, featureLength, extraRequestThresholdNodes, nearestNodeRange, newNodeRange;
  50654. return _regeneratorRuntime().wrap(function _loop2$(_context) {
  50655. while (1) switch (_context.prev = _context.next) {
  50656. case 0:
  50657. nodePos = (pos - nodeIndex) * 5;
  50658. if (!(maxX < float64Array[nodePos + 0])) {
  50659. _context.next = 3;
  50660. break;
  50661. }
  50662. return _context.abrupt("return", 0);
  50663. case 3:
  50664. if (!(maxY < float64Array[nodePos + 1])) {
  50665. _context.next = 5;
  50666. break;
  50667. }
  50668. return _context.abrupt("return", 0);
  50669. case 5:
  50670. if (!(minX > float64Array[nodePos + 2])) {
  50671. _context.next = 7;
  50672. break;
  50673. }
  50674. return _context.abrupt("return", 0);
  50675. case 7:
  50676. if (!(minY > float64Array[nodePos + 3])) {
  50677. _context.next = 9;
  50678. break;
  50679. }
  50680. return _context.abrupt("return", 0);
  50681. case 9:
  50682. low32Offset = uint32Array[(nodePos << 1) + 8];
  50683. high32Offset = uint32Array[(nodePos << 1) + 9];
  50684. offset = readUint52(high32Offset, low32Offset);
  50685. if (!isLeafNode) {
  50686. _context.next = 17;
  50687. break;
  50688. }
  50689. featureLength = function () {
  50690. if (pos < numItems - 1) {
  50691. var nextPos = (pos - nodeIndex + 1) * 5;
  50692. var _low32Offset = uint32Array[(nextPos << 1) + 8];
  50693. var _high32Offset = uint32Array[(nextPos << 1) + 9];
  50694. var nextOffset = readUint52(_high32Offset, _low32Offset);
  50695. return nextOffset - offset;
  50696. } else {
  50697. return null;
  50698. }
  50699. }();
  50700. _context.next = 16;
  50701. return [offset, pos - leafNodesOffset, featureLength];
  50702. case 16:
  50703. return _context.abrupt("return", 0);
  50704. case 17:
  50705. extraRequestThresholdNodes = Config.global.extraRequestThreshold() / NODE_ITEM_LEN;
  50706. nearestNodeRange = queue[queue.length - 1];
  50707. if (!(nearestNodeRange !== undefined && nearestNodeRange.level() == nodeRange.level() - 1 && offset < nearestNodeRange.endNode() + extraRequestThresholdNodes)) {
  50708. _context.next = 23;
  50709. break;
  50710. }
  50711. Logger.debug("Merging \"nodeRange\" request into existing range: ".concat(nearestNodeRange, ", newOffset: ").concat(nearestNodeRange.endNode(), " -> ").concat(offset));
  50712. nearestNodeRange.extendEndNodeToNewOffset(offset);
  50713. return _context.abrupt("return", 0);
  50714. case 23:
  50715. newNodeRange = function () {
  50716. var level = nodeRange.level() - 1;
  50717. var range = [offset, offset + 1];
  50718. return new NodeRange(range, level);
  50719. }();
  50720. if (nearestNodeRange !== undefined && nearestNodeRange.level() == newNodeRange.level()) {
  50721. Logger.info("Same level, but too far away. Pushing new request at offset: ".concat(offset, " rather than merging with distant ").concat(nearestNodeRange));
  50722. } else {
  50723. Logger.info("Pushing new level for ".concat(newNodeRange, " onto queue with nearestNodeRange: ").concat(nearestNodeRange, " since there's not already a range for this level."));
  50724. }
  50725. queue.push(newNodeRange);
  50726. case 26:
  50727. case "end":
  50728. return _context.stop();
  50729. }
  50730. }, _loop2);
  50731. });
  50732. pos = nodeIndex;
  50733. case 14:
  50734. if (!(pos < end)) {
  50735. _context2.next = 22;
  50736. break;
  50737. }
  50738. return _context2.delegateYield(_loop2(pos), "t0", 16);
  50739. case 16:
  50740. _ret = _context2.t0;
  50741. if (!(_ret === 0)) {
  50742. _context2.next = 19;
  50743. break;
  50744. }
  50745. return _context2.abrupt("continue", 19);
  50746. case 19:
  50747. pos++;
  50748. _context2.next = 14;
  50749. break;
  50750. case 22:
  50751. case "end":
  50752. return _context2.stop();
  50753. }
  50754. }, _loop);
  50755. });
  50756. case 9:
  50757. if (!(queue.length != 0)) {
  50758. _context3.next = 13;
  50759. break;
  50760. }
  50761. return _context3.delegateYield(_loop(), "t0", 11);
  50762. case 11:
  50763. _context3.next = 9;
  50764. break;
  50765. case 13:
  50766. case "end":
  50767. return _context3.stop();
  50768. }
  50769. }, _callee);
  50770. }));
  50771. return _streamSearch.apply(this, arguments);
  50772. }
  50773. function readUint52(high32Bits, low32Bits) {
  50774. if ((high32Bits & 0xfff00000) != 0) {
  50775. throw Error('integer is too large to be safely represented');
  50776. }
  50777. var result = low32Bits + high32Bits * Math.pow(2, 32);
  50778. return result;
  50779. }
  50780. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/constants.js
  50781. var constants_magicbytes = new Uint8Array([0x66, 0x67, 0x62, 0x03, 0x66, 0x67, 0x62, 0x00]);
  50782. var SIZE_PREFIX_LEN = 4;
  50783. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/http-reader.js
  50784. 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); }
  50785. 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; } } }; }
  50786. function http_reader_slicedToArray(arr, i) { return http_reader_arrayWithHoles(arr) || http_reader_iterableToArrayLimit(arr, i) || http_reader_unsupportedIterableToArray(arr, i) || http_reader_nonIterableRest(); }
  50787. 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."); }
  50788. 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); }
  50789. 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; }
  50790. 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; }
  50791. function http_reader_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  50792. 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; }
  50793. 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); } }
  50794. 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); }); }; }
  50795. function http_reader_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  50796. 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); } }
  50797. 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; }
  50798. function http_reader_wrapAsyncGenerator(fn) { return function () { return new http_reader_AsyncGenerator(fn.apply(this, arguments)); }; }
  50799. 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); }
  50800. 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); };
  50801. function http_reader_awaitAsyncGenerator(value) { return new http_reader_OverloadYield(value, 0); }
  50802. 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; }
  50803. function http_reader_OverloadYield(value, kind) { this.v = value, this.k = kind; }
  50804. 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"); }
  50805. 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); }
  50806. var HttpReader = /*#__PURE__*/function () {
  50807. function HttpReader(headerClient, header, headerLength, indexLength) {
  50808. http_reader_classCallCheck(this, HttpReader);
  50809. this.headerClient = headerClient;
  50810. this.header = header;
  50811. this.headerLength = headerLength;
  50812. this.indexLength = indexLength;
  50813. }
  50814. http_reader_createClass(HttpReader, [{
  50815. key: "selectBbox",
  50816. value: function selectBbox(rect) {
  50817. var _this = this;
  50818. return http_reader_wrapAsyncGenerator( /*#__PURE__*/http_reader_regeneratorRuntime().mark(function _callee2() {
  50819. var lengthBeforeTree, bufferedClient, readNode, batches, currentBatch, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, searchResult, _searchResult2, featureOffset, _searchResult4, featureLength, guessLength, prevFeature, gap, promises;
  50820. return http_reader_regeneratorRuntime().wrap(function _callee2$(_context2) {
  50821. while (1) switch (_context2.prev = _context2.next) {
  50822. case 0:
  50823. lengthBeforeTree = _this.lengthBeforeTree();
  50824. bufferedClient = _this.headerClient;
  50825. readNode = /*#__PURE__*/function () {
  50826. var _ref = _asyncToGenerator( /*#__PURE__*/http_reader_regeneratorRuntime().mark(function _callee(offsetIntoTree, size) {
  50827. var minReqLength;
  50828. return http_reader_regeneratorRuntime().wrap(function _callee$(_context) {
  50829. while (1) switch (_context.prev = _context.next) {
  50830. case 0:
  50831. minReqLength = 0;
  50832. return _context.abrupt("return", bufferedClient.getRange(lengthBeforeTree + offsetIntoTree, size, minReqLength, 'index'));
  50833. case 2:
  50834. case "end":
  50835. return _context.stop();
  50836. }
  50837. }, _callee);
  50838. }));
  50839. return function readNode(_x, _x2) {
  50840. return _ref.apply(this, arguments);
  50841. };
  50842. }();
  50843. batches = [];
  50844. currentBatch = [];
  50845. _iteratorAbruptCompletion = false;
  50846. _didIteratorError = false;
  50847. _context2.prev = 7;
  50848. _iterator = _asyncIterator(streamSearch(_this.header.featuresCount, _this.header.indexNodeSize, rect, readNode));
  50849. case 9:
  50850. _context2.next = 11;
  50851. return http_reader_awaitAsyncGenerator(_iterator.next());
  50852. case 11:
  50853. if (!(_iteratorAbruptCompletion = !(_step = _context2.sent).done)) {
  50854. _context2.next = 26;
  50855. break;
  50856. }
  50857. searchResult = _step.value;
  50858. _searchResult2 = http_reader_slicedToArray(searchResult, 2), featureOffset = _searchResult2[0];
  50859. _searchResult4 = http_reader_slicedToArray(searchResult, 3), featureLength = _searchResult4[2];
  50860. if (!featureLength) {
  50861. Logger.info('final feature');
  50862. guessLength = Config.global.extraRequestThreshold();
  50863. featureLength = guessLength;
  50864. }
  50865. if (!(currentBatch.length == 0)) {
  50866. _context2.next = 19;
  50867. break;
  50868. }
  50869. currentBatch.push([featureOffset, featureLength]);
  50870. return _context2.abrupt("continue", 23);
  50871. case 19:
  50872. prevFeature = currentBatch[currentBatch.length - 1];
  50873. gap = featureOffset - (prevFeature[0] + prevFeature[1]);
  50874. if (gap > Config.global.extraRequestThreshold()) {
  50875. Logger.info("Pushing new feature batch, since gap ".concat(gap, " was too large"));
  50876. batches.push(currentBatch);
  50877. currentBatch = [];
  50878. }
  50879. currentBatch.push([featureOffset, featureLength]);
  50880. case 23:
  50881. _iteratorAbruptCompletion = false;
  50882. _context2.next = 9;
  50883. break;
  50884. case 26:
  50885. _context2.next = 32;
  50886. break;
  50887. case 28:
  50888. _context2.prev = 28;
  50889. _context2.t0 = _context2["catch"](7);
  50890. _didIteratorError = true;
  50891. _iteratorError = _context2.t0;
  50892. case 32:
  50893. _context2.prev = 32;
  50894. _context2.prev = 33;
  50895. if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
  50896. _context2.next = 37;
  50897. break;
  50898. }
  50899. _context2.next = 37;
  50900. return http_reader_awaitAsyncGenerator(_iterator["return"]());
  50901. case 37:
  50902. _context2.prev = 37;
  50903. if (!_didIteratorError) {
  50904. _context2.next = 40;
  50905. break;
  50906. }
  50907. throw _iteratorError;
  50908. case 40:
  50909. return _context2.finish(37);
  50910. case 41:
  50911. return _context2.finish(32);
  50912. case 42:
  50913. _this.headerClient.logUsage('header+index');
  50914. if (currentBatch.length > 0) {
  50915. batches.push(currentBatch);
  50916. }
  50917. promises = batches.flatMap(function (batch) {
  50918. return _this.readFeatureBatch(batch);
  50919. });
  50920. return _context2.delegateYield(_asyncGeneratorDelegate(_asyncIterator(repeater/* Repeater */.ZN.merge(promises)), http_reader_awaitAsyncGenerator), "t1", 46);
  50921. case 46:
  50922. case "end":
  50923. return _context2.stop();
  50924. }
  50925. }, _callee2, null, [[7, 28, 32, 42], [33,, 37, 41]]);
  50926. }))();
  50927. }
  50928. }, {
  50929. key: "lengthBeforeTree",
  50930. value: function lengthBeforeTree() {
  50931. return constants_magicbytes.length + SIZE_PREFIX_LEN + this.headerLength;
  50932. }
  50933. }, {
  50934. key: "lengthBeforeFeatures",
  50935. value: function lengthBeforeFeatures() {
  50936. return this.lengthBeforeTree() + this.indexLength;
  50937. }
  50938. }, {
  50939. key: "buildFeatureClient",
  50940. value: function buildFeatureClient() {
  50941. return new BufferedHttpRangeClient(this.headerClient.httpClient);
  50942. }
  50943. }, {
  50944. key: "readFeatureBatch",
  50945. value: function readFeatureBatch(batch) {
  50946. var _this2 = this;
  50947. return http_reader_wrapAsyncGenerator( /*#__PURE__*/http_reader_regeneratorRuntime().mark(function _callee3() {
  50948. var _batch$, firstFeatureOffset, _batch, lastFeatureOffset, lastFeatureLength, batchStart, batchEnd, batchSize, featureClient, _iterator2, _step2, _step2$value2, featureOffset;
  50949. return http_reader_regeneratorRuntime().wrap(function _callee3$(_context3) {
  50950. while (1) switch (_context3.prev = _context3.next) {
  50951. case 0:
  50952. _batch$ = http_reader_slicedToArray(batch[0], 1), firstFeatureOffset = _batch$[0];
  50953. _batch = http_reader_slicedToArray(batch[batch.length - 1], 2), lastFeatureOffset = _batch[0], lastFeatureLength = _batch[1];
  50954. batchStart = firstFeatureOffset;
  50955. batchEnd = lastFeatureOffset + lastFeatureLength;
  50956. batchSize = batchEnd - batchStart;
  50957. featureClient = _this2.buildFeatureClient();
  50958. _iterator2 = http_reader_createForOfIteratorHelper(batch);
  50959. _context3.prev = 7;
  50960. _iterator2.s();
  50961. case 9:
  50962. if ((_step2 = _iterator2.n()).done) {
  50963. _context3.next = 17;
  50964. break;
  50965. }
  50966. _step2$value2 = http_reader_slicedToArray(_step2.value, 1), featureOffset = _step2$value2[0];
  50967. _context3.next = 13;
  50968. return http_reader_awaitAsyncGenerator(_this2.readFeature(featureClient, featureOffset, batchSize));
  50969. case 13:
  50970. _context3.next = 15;
  50971. return _context3.sent;
  50972. case 15:
  50973. _context3.next = 9;
  50974. break;
  50975. case 17:
  50976. _context3.next = 22;
  50977. break;
  50978. case 19:
  50979. _context3.prev = 19;
  50980. _context3.t0 = _context3["catch"](7);
  50981. _iterator2.e(_context3.t0);
  50982. case 22:
  50983. _context3.prev = 22;
  50984. _iterator2.f();
  50985. return _context3.finish(22);
  50986. case 25:
  50987. featureClient.logUsage('feature');
  50988. case 26:
  50989. case "end":
  50990. return _context3.stop();
  50991. }
  50992. }, _callee3, null, [[7, 19, 22, 25]]);
  50993. }))();
  50994. }
  50995. }, {
  50996. key: "readFeature",
  50997. value: function () {
  50998. var _readFeature = _asyncToGenerator( /*#__PURE__*/http_reader_regeneratorRuntime().mark(function _callee4(featureClient, featureOffset, minFeatureReqLength) {
  50999. var offset, featureLength, _bytes, byteBuffer, bytes, bytesAligned, bb;
  51000. return http_reader_regeneratorRuntime().wrap(function _callee4$(_context4) {
  51001. while (1) switch (_context4.prev = _context4.next) {
  51002. case 0:
  51003. offset = featureOffset + this.lengthBeforeFeatures();
  51004. _context4.next = 3;
  51005. return featureClient.getRange(offset, 4, minFeatureReqLength, 'feature length');
  51006. case 3:
  51007. _bytes = _context4.sent;
  51008. featureLength = new DataView(_bytes).getUint32(0, true);
  51009. _context4.next = 7;
  51010. return featureClient.getRange(offset + 4, featureLength, minFeatureReqLength, 'feature data');
  51011. case 7:
  51012. byteBuffer = _context4.sent;
  51013. bytes = new Uint8Array(byteBuffer);
  51014. bytesAligned = new Uint8Array(featureLength + SIZE_PREFIX_LEN);
  51015. bytesAligned.set(bytes, SIZE_PREFIX_LEN);
  51016. bb = new js_flatbuffers/* ByteBuffer */.cZ(bytesAligned);
  51017. bb.setPosition(SIZE_PREFIX_LEN);
  51018. return _context4.abrupt("return", feature_Feature.getRootAsFeature(bb));
  51019. case 14:
  51020. case "end":
  51021. return _context4.stop();
  51022. }
  51023. }, _callee4, this);
  51024. }));
  51025. function readFeature(_x3, _x4, _x5) {
  51026. return _readFeature.apply(this, arguments);
  51027. }
  51028. return readFeature;
  51029. }()
  51030. }], [{
  51031. key: "open",
  51032. value: function () {
  51033. var _open = _asyncToGenerator( /*#__PURE__*/http_reader_regeneratorRuntime().mark(function _callee5(url) {
  51034. var assumedHeaderLength, headerClient, assumedIndexLength, minReqLength, _bytes2, headerLength, _bytes3, HEADER_MAX_BUFFER_SIZE, bytes, bb, header, indexLength;
  51035. return http_reader_regeneratorRuntime().wrap(function _callee5$(_context5) {
  51036. while (1) switch (_context5.prev = _context5.next) {
  51037. case 0:
  51038. assumedHeaderLength = 2024;
  51039. headerClient = new BufferedHttpRangeClient(url);
  51040. assumedIndexLength = function () {
  51041. var assumedBranchingFactor = DEFAULT_NODE_SIZE;
  51042. var prefetchedLayers = 3;
  51043. var result = 0;
  51044. var i;
  51045. for (i = 0; i < prefetchedLayers; i++) {
  51046. var layer_width = Math.pow(assumedBranchingFactor, i) * NODE_ITEM_LEN;
  51047. result += layer_width;
  51048. }
  51049. return result;
  51050. }();
  51051. minReqLength = assumedHeaderLength + assumedIndexLength;
  51052. Logger.debug("fetching header. minReqLength: ".concat(minReqLength, " (assumedHeaderLength: ").concat(assumedHeaderLength, ", assumedIndexLength: ").concat(assumedIndexLength, ")"));
  51053. _context5.t0 = Uint8Array;
  51054. _context5.next = 8;
  51055. return headerClient.getRange(0, 8, minReqLength, 'header');
  51056. case 8:
  51057. _context5.t1 = _context5.sent;
  51058. _bytes2 = new _context5.t0(_context5.t1);
  51059. if (_bytes2.subarray(0, 3).every(function (v, i) {
  51060. return constants_magicbytes[i] === v;
  51061. })) {
  51062. _context5.next = 13;
  51063. break;
  51064. }
  51065. Logger.error("bytes: ".concat(_bytes2, " != ").concat(constants_magicbytes));
  51066. throw new Error('Not a FlatGeobuf file');
  51067. case 13:
  51068. Logger.debug('magic bytes look good');
  51069. _context5.next = 16;
  51070. return headerClient.getRange(8, 4, minReqLength, 'header');
  51071. case 16:
  51072. _bytes3 = _context5.sent;
  51073. headerLength = new DataView(_bytes3).getUint32(0, true);
  51074. HEADER_MAX_BUFFER_SIZE = 1048576 * 10;
  51075. if (!(headerLength > HEADER_MAX_BUFFER_SIZE || headerLength < 8)) {
  51076. _context5.next = 21;
  51077. break;
  51078. }
  51079. throw new Error('Invalid header size');
  51080. case 21:
  51081. Logger.debug("headerLength: ".concat(headerLength));
  51082. _context5.next = 24;
  51083. return headerClient.getRange(12, headerLength, minReqLength, 'header');
  51084. case 24:
  51085. bytes = _context5.sent;
  51086. bb = new js_flatbuffers/* ByteBuffer */.cZ(new Uint8Array(bytes));
  51087. header = fromByteBuffer(bb);
  51088. indexLength = calcTreeSize(header.featuresCount, header.indexNodeSize);
  51089. Logger.debug('completed: opening http reader');
  51090. return _context5.abrupt("return", new HttpReader(headerClient, header, headerLength, indexLength));
  51091. case 30:
  51092. case "end":
  51093. return _context5.stop();
  51094. }
  51095. }, _callee5);
  51096. }));
  51097. function open(_x6) {
  51098. return _open.apply(this, arguments);
  51099. }
  51100. return open;
  51101. }()
  51102. }]);
  51103. return HttpReader;
  51104. }();
  51105. var BufferedHttpRangeClient = /*#__PURE__*/function () {
  51106. function BufferedHttpRangeClient(source) {
  51107. http_reader_classCallCheck(this, BufferedHttpRangeClient);
  51108. this.bytesEverUsed = 0;
  51109. this.bytesEverFetched = 0;
  51110. this.buffer = new ArrayBuffer(0);
  51111. this.head = 0;
  51112. if (typeof source === 'string') {
  51113. this.httpClient = new HttpRangeClient(source);
  51114. } else {
  51115. this.httpClient = source;
  51116. }
  51117. }
  51118. http_reader_createClass(BufferedHttpRangeClient, [{
  51119. key: "getRange",
  51120. value: function () {
  51121. var _getRange = _asyncToGenerator( /*#__PURE__*/http_reader_regeneratorRuntime().mark(function _callee6(start, length, minReqLength, purpose) {
  51122. var start_i, end_i, lengthToFetch;
  51123. return http_reader_regeneratorRuntime().wrap(function _callee6$(_context6) {
  51124. while (1) switch (_context6.prev = _context6.next) {
  51125. case 0:
  51126. this.bytesEverUsed += length;
  51127. start_i = start - this.head;
  51128. end_i = start_i + length;
  51129. if (!(start_i >= 0 && end_i <= this.buffer.byteLength)) {
  51130. _context6.next = 5;
  51131. break;
  51132. }
  51133. return _context6.abrupt("return", this.buffer.slice(start_i, end_i));
  51134. case 5:
  51135. lengthToFetch = Math.max(length, minReqLength);
  51136. this.bytesEverFetched += lengthToFetch;
  51137. Logger.debug("requesting for new Range: ".concat(start, "-").concat(start + length - 1));
  51138. _context6.next = 10;
  51139. return this.httpClient.getRange(start, lengthToFetch, purpose);
  51140. case 10:
  51141. this.buffer = _context6.sent;
  51142. this.head = start;
  51143. return _context6.abrupt("return", this.buffer.slice(0, length));
  51144. case 13:
  51145. case "end":
  51146. return _context6.stop();
  51147. }
  51148. }, _callee6, this);
  51149. }));
  51150. function getRange(_x7, _x8, _x9, _x10) {
  51151. return _getRange.apply(this, arguments);
  51152. }
  51153. return getRange;
  51154. }()
  51155. }, {
  51156. key: "logUsage",
  51157. value: function logUsage(purpose) {
  51158. var category = purpose.split(' ')[0];
  51159. var used = this.bytesEverUsed;
  51160. var requested = this.bytesEverFetched;
  51161. var efficiency = (100.0 * used / requested).toFixed(2);
  51162. Logger.info("".concat(category, " bytes used/requested: ").concat(used, " / ").concat(requested, " = ").concat(efficiency, "%"));
  51163. }
  51164. }]);
  51165. return BufferedHttpRangeClient;
  51166. }();
  51167. var HttpRangeClient = /*#__PURE__*/function () {
  51168. function HttpRangeClient(url) {
  51169. http_reader_classCallCheck(this, HttpRangeClient);
  51170. this.requestsEverMade = 0;
  51171. this.bytesEverRequested = 0;
  51172. this.url = url;
  51173. }
  51174. http_reader_createClass(HttpRangeClient, [{
  51175. key: "getRange",
  51176. value: function () {
  51177. var _getRange2 = _asyncToGenerator( /*#__PURE__*/http_reader_regeneratorRuntime().mark(function _callee7(begin, length, purpose) {
  51178. var range, response;
  51179. return http_reader_regeneratorRuntime().wrap(function _callee7$(_context7) {
  51180. while (1) switch (_context7.prev = _context7.next) {
  51181. case 0:
  51182. this.requestsEverMade += 1;
  51183. this.bytesEverRequested += length;
  51184. range = "bytes=".concat(begin, "-").concat(begin + length - 1);
  51185. Logger.info("request: #".concat(this.requestsEverMade, ", purpose: ").concat(purpose, "), bytes: (this_request: ").concat(length, ", ever: ").concat(this.bytesEverRequested, "), Range: ").concat(range));
  51186. _context7.next = 6;
  51187. return fetch(this.url, {
  51188. headers: {
  51189. Range: range
  51190. }
  51191. });
  51192. case 6:
  51193. response = _context7.sent;
  51194. return _context7.abrupt("return", response.arrayBuffer());
  51195. case 8:
  51196. case "end":
  51197. return _context7.stop();
  51198. }
  51199. }, _callee7, this);
  51200. }));
  51201. function getRange(_x11, _x12, _x13) {
  51202. return _getRange2.apply(this, arguments);
  51203. }
  51204. return getRange;
  51205. }()
  51206. }]);
  51207. return HttpRangeClient;
  51208. }();
  51209. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/generic/header.js
  51210. 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; } } }; }
  51211. 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); }
  51212. 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; }
  51213. function featureGeomType(feature) {
  51214. if (feature.getGeometry) {
  51215. return toGeometryType(feature.getGeometry().getType());
  51216. } else {
  51217. return toGeometryType(feature.geometry.type);
  51218. }
  51219. }
  51220. function header_inferGeometryType(features) {
  51221. var geometryType = undefined;
  51222. var _iterator = header_createForOfIteratorHelper(features),
  51223. _step;
  51224. try {
  51225. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  51226. var f = _step.value;
  51227. if (geometryType === GeometryType.Unknown) {
  51228. break;
  51229. }
  51230. var gtype = featureGeomType(f);
  51231. if (geometryType === undefined) {
  51232. geometryType = gtype;
  51233. } else if (geometryType !== gtype) {
  51234. geometryType = GeometryType.Unknown;
  51235. }
  51236. }
  51237. } catch (err) {
  51238. _iterator.e(err);
  51239. } finally {
  51240. _iterator.f();
  51241. }
  51242. if (geometryType === undefined) {
  51243. throw new Error('Could not infer geometry type for collection of features.');
  51244. }
  51245. return geometryType;
  51246. }
  51247. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/generic/featurecollection.js
  51248. 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); }
  51249. 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; }
  51250. 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); } }
  51251. 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); }); }; }
  51252. 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; } } }; }
  51253. 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); }
  51254. 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; }
  51255. 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"); }
  51256. 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); }
  51257. function featurecollection_awaitAsyncGenerator(value) { return new featurecollection_OverloadYield(value, 0); }
  51258. function featurecollection_wrapAsyncGenerator(fn) { return function () { return new featurecollection_AsyncGenerator(fn.apply(this, arguments)); }; }
  51259. 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); }
  51260. 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); };
  51261. function featurecollection_OverloadYield(value, kind) { this.v = value, this.k = kind; }
  51262. function serialize(features) {
  51263. var headerMeta = introspectHeaderMeta(features);
  51264. var header = featurecollection_buildHeader(headerMeta);
  51265. var featureBuffers = features.map(function (f) {
  51266. if (!f.getGeometry) throw new Error('Missing getGeometry implementation');
  51267. if (!f.getProperties) throw new Error('Missing getProperties implementation');
  51268. return buildFeature(parseGeometry(f.getGeometry(), headerMeta.geometryType), f.getProperties(), headerMeta);
  51269. });
  51270. var featuresLength = featureBuffers.map(function (f) {
  51271. return f.length;
  51272. }).reduce(function (a, b) {
  51273. return a + b;
  51274. });
  51275. var uint8 = new Uint8Array(magicbytes.length + header.length + featuresLength);
  51276. uint8.set(header, magicbytes.length);
  51277. var offset = magicbytes.length + header.length;
  51278. var _iterator2 = featurecollection_createForOfIteratorHelper(featureBuffers),
  51279. _step2;
  51280. try {
  51281. for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
  51282. var feature = _step2.value;
  51283. uint8.set(feature, offset);
  51284. offset += feature.length;
  51285. }
  51286. } catch (err) {
  51287. _iterator2.e(err);
  51288. } finally {
  51289. _iterator2.f();
  51290. }
  51291. uint8.set(magicbytes);
  51292. return uint8;
  51293. }
  51294. function deserialize(bytes, fromFeature, headerMetaFn) {
  51295. if (!bytes.subarray(0, 3).every(function (v, i) {
  51296. return constants_magicbytes[i] === v;
  51297. })) throw new Error('Not a FlatGeobuf file');
  51298. var bb = new js_flatbuffers/* ByteBuffer */.cZ(bytes);
  51299. var headerLength = bb.readUint32(constants_magicbytes.length);
  51300. bb.setPosition(constants_magicbytes.length + SIZE_PREFIX_LEN);
  51301. var headerMeta = fromByteBuffer(bb);
  51302. if (headerMetaFn) headerMetaFn(headerMeta);
  51303. var offset = constants_magicbytes.length + SIZE_PREFIX_LEN + headerLength;
  51304. var indexNodeSize = headerMeta.indexNodeSize,
  51305. featuresCount = headerMeta.featuresCount;
  51306. if (indexNodeSize > 0) offset += calcTreeSize(featuresCount, indexNodeSize);
  51307. var features = [];
  51308. while (offset < bb.capacity()) {
  51309. var featureLength = bb.readUint32(offset);
  51310. bb.setPosition(offset + SIZE_PREFIX_LEN);
  51311. var feature = feature_Feature.getRootAsFeature(bb);
  51312. features.push(fromFeature(feature, headerMeta));
  51313. offset += SIZE_PREFIX_LEN + featureLength;
  51314. }
  51315. return features;
  51316. }
  51317. function deserializeStream(_x, _x2, _x3) {
  51318. return _deserializeStream.apply(this, arguments);
  51319. }
  51320. function _deserializeStream() {
  51321. _deserializeStream = featurecollection_wrapAsyncGenerator( /*#__PURE__*/featurecollection_regeneratorRuntime().mark(function _callee2(stream, fromFeature, headerMetaFn) {
  51322. var reader, read, bytes, bb, headerLength, headerMeta, indexNodeSize, featuresCount, treeSize, feature;
  51323. return featurecollection_regeneratorRuntime().wrap(function _callee2$(_context2) {
  51324. while (1) switch (_context2.prev = _context2.next) {
  51325. case 0:
  51326. reader = slice_source(stream);
  51327. read = /*#__PURE__*/function () {
  51328. var _ref = featurecollection_asyncToGenerator( /*#__PURE__*/featurecollection_regeneratorRuntime().mark(function _callee(size) {
  51329. return featurecollection_regeneratorRuntime().wrap(function _callee$(_context) {
  51330. while (1) switch (_context.prev = _context.next) {
  51331. case 0:
  51332. _context.next = 2;
  51333. return reader.slice(size);
  51334. case 2:
  51335. return _context.abrupt("return", _context.sent);
  51336. case 3:
  51337. case "end":
  51338. return _context.stop();
  51339. }
  51340. }, _callee);
  51341. }));
  51342. return function read(_x8) {
  51343. return _ref.apply(this, arguments);
  51344. };
  51345. }();
  51346. _context2.t0 = Uint8Array;
  51347. _context2.next = 5;
  51348. return featurecollection_awaitAsyncGenerator(read(8, 'magic bytes'));
  51349. case 5:
  51350. _context2.t1 = _context2.sent;
  51351. bytes = new _context2.t0(_context2.t1);
  51352. if (bytes.subarray(0, 3).every(function (v, i) {
  51353. return constants_magicbytes[i] === v;
  51354. })) {
  51355. _context2.next = 9;
  51356. break;
  51357. }
  51358. throw new Error('Not a FlatGeobuf file');
  51359. case 9:
  51360. _context2.t2 = Uint8Array;
  51361. _context2.next = 12;
  51362. return featurecollection_awaitAsyncGenerator(read(4, 'header length'));
  51363. case 12:
  51364. _context2.t3 = _context2.sent;
  51365. bytes = new _context2.t2(_context2.t3);
  51366. bb = new js_flatbuffers/* ByteBuffer */.cZ(bytes);
  51367. headerLength = bb.readUint32(0);
  51368. _context2.t4 = Uint8Array;
  51369. _context2.next = 19;
  51370. return featurecollection_awaitAsyncGenerator(read(headerLength, 'header data'));
  51371. case 19:
  51372. _context2.t5 = _context2.sent;
  51373. bytes = new _context2.t4(_context2.t5);
  51374. bb = new js_flatbuffers/* ByteBuffer */.cZ(bytes);
  51375. headerMeta = fromByteBuffer(bb);
  51376. if (headerMetaFn) headerMetaFn(headerMeta);
  51377. indexNodeSize = headerMeta.indexNodeSize, featuresCount = headerMeta.featuresCount;
  51378. if (!(indexNodeSize > 0)) {
  51379. _context2.next = 29;
  51380. break;
  51381. }
  51382. treeSize = calcTreeSize(featuresCount, indexNodeSize);
  51383. _context2.next = 29;
  51384. return featurecollection_awaitAsyncGenerator(read(treeSize, 'entire index, w/o rect'));
  51385. case 29:
  51386. _context2.next = 31;
  51387. return featurecollection_awaitAsyncGenerator(readFeature(read, headerMeta, fromFeature));
  51388. case 31:
  51389. if (!(feature = _context2.sent)) {
  51390. _context2.next = 36;
  51391. break;
  51392. }
  51393. _context2.next = 34;
  51394. return feature;
  51395. case 34:
  51396. _context2.next = 29;
  51397. break;
  51398. case 36:
  51399. case "end":
  51400. return _context2.stop();
  51401. }
  51402. }, _callee2);
  51403. }));
  51404. return _deserializeStream.apply(this, arguments);
  51405. }
  51406. function deserializeFiltered(_x4, _x5, _x6, _x7) {
  51407. return _deserializeFiltered.apply(this, arguments);
  51408. }
  51409. function _deserializeFiltered() {
  51410. _deserializeFiltered = featurecollection_wrapAsyncGenerator( /*#__PURE__*/featurecollection_regeneratorRuntime().mark(function _callee3(url, rect, fromFeature, headerMetaFn) {
  51411. var reader, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, feature;
  51412. return featurecollection_regeneratorRuntime().wrap(function _callee3$(_context3) {
  51413. while (1) switch (_context3.prev = _context3.next) {
  51414. case 0:
  51415. _context3.next = 2;
  51416. return featurecollection_awaitAsyncGenerator(HttpReader.open(url));
  51417. case 2:
  51418. reader = _context3.sent;
  51419. Logger.debug('opened reader');
  51420. if (headerMetaFn) headerMetaFn(reader.header);
  51421. _iteratorAbruptCompletion = false;
  51422. _didIteratorError = false;
  51423. _context3.prev = 7;
  51424. _iterator = featurecollection_asyncIterator(reader.selectBbox(rect));
  51425. case 9:
  51426. _context3.next = 11;
  51427. return featurecollection_awaitAsyncGenerator(_iterator.next());
  51428. case 11:
  51429. if (!(_iteratorAbruptCompletion = !(_step = _context3.sent).done)) {
  51430. _context3.next = 18;
  51431. break;
  51432. }
  51433. feature = _step.value;
  51434. _context3.next = 15;
  51435. return fromFeature(feature, reader.header);
  51436. case 15:
  51437. _iteratorAbruptCompletion = false;
  51438. _context3.next = 9;
  51439. break;
  51440. case 18:
  51441. _context3.next = 24;
  51442. break;
  51443. case 20:
  51444. _context3.prev = 20;
  51445. _context3.t0 = _context3["catch"](7);
  51446. _didIteratorError = true;
  51447. _iteratorError = _context3.t0;
  51448. case 24:
  51449. _context3.prev = 24;
  51450. _context3.prev = 25;
  51451. if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
  51452. _context3.next = 29;
  51453. break;
  51454. }
  51455. _context3.next = 29;
  51456. return featurecollection_awaitAsyncGenerator(_iterator["return"]());
  51457. case 29:
  51458. _context3.prev = 29;
  51459. if (!_didIteratorError) {
  51460. _context3.next = 32;
  51461. break;
  51462. }
  51463. throw _iteratorError;
  51464. case 32:
  51465. return _context3.finish(29);
  51466. case 33:
  51467. return _context3.finish(24);
  51468. case 34:
  51469. case "end":
  51470. return _context3.stop();
  51471. }
  51472. }, _callee3, null, [[7, 20, 24, 34], [25,, 29, 33]]);
  51473. }));
  51474. return _deserializeFiltered.apply(this, arguments);
  51475. }
  51476. function readFeature(_x9, _x10, _x11) {
  51477. return _readFeature.apply(this, arguments);
  51478. }
  51479. function _readFeature() {
  51480. _readFeature = featurecollection_asyncToGenerator( /*#__PURE__*/featurecollection_regeneratorRuntime().mark(function _callee4(read, headerMeta, fromFeature) {
  51481. var bytes, bb, featureLength, bytesAligned, feature;
  51482. return featurecollection_regeneratorRuntime().wrap(function _callee4$(_context4) {
  51483. while (1) switch (_context4.prev = _context4.next) {
  51484. case 0:
  51485. _context4.t0 = Uint8Array;
  51486. _context4.next = 3;
  51487. return read(4, 'feature length');
  51488. case 3:
  51489. _context4.t1 = _context4.sent;
  51490. bytes = new _context4.t0(_context4.t1);
  51491. if (!(bytes.byteLength === 0)) {
  51492. _context4.next = 7;
  51493. break;
  51494. }
  51495. return _context4.abrupt("return");
  51496. case 7:
  51497. bb = new js_flatbuffers/* ByteBuffer */.cZ(bytes);
  51498. featureLength = bb.readUint32(0);
  51499. _context4.t2 = Uint8Array;
  51500. _context4.next = 12;
  51501. return read(featureLength, 'feature data');
  51502. case 12:
  51503. _context4.t3 = _context4.sent;
  51504. bytes = new _context4.t2(_context4.t3);
  51505. bytesAligned = new Uint8Array(featureLength + 4);
  51506. bytesAligned.set(bytes, 4);
  51507. bb = new js_flatbuffers/* ByteBuffer */.cZ(bytesAligned);
  51508. bb.setPosition(SIZE_PREFIX_LEN);
  51509. feature = feature_Feature.getRootAsFeature(bb);
  51510. return _context4.abrupt("return", fromFeature(feature, headerMeta));
  51511. case 20:
  51512. case "end":
  51513. return _context4.stop();
  51514. }
  51515. }, _callee4);
  51516. }));
  51517. return _readFeature.apply(this, arguments);
  51518. }
  51519. function buildColumn(builder, column) {
  51520. var nameOffset = builder.createString(column.name);
  51521. Column.startColumn(builder);
  51522. Column.addName(builder, nameOffset);
  51523. Column.addType(builder, column.type);
  51524. return Column.endColumn(builder);
  51525. }
  51526. function featurecollection_buildHeader(header) {
  51527. var builder = new flatbuffers.Builder();
  51528. var columnOffsets = null;
  51529. if (header.columns) columnOffsets = Header.createColumnsVector(builder, header.columns.map(function (c) {
  51530. return buildColumn(builder, c);
  51531. }));
  51532. var nameOffset = builder.createString('L1');
  51533. Header.startHeader(builder);
  51534. Header.addFeaturesCount(builder, BigInt(header.featuresCount));
  51535. Header.addGeometryType(builder, header.geometryType);
  51536. Header.addIndexNodeSize(builder, 0);
  51537. if (columnOffsets) Header.addColumns(builder, columnOffsets);
  51538. Header.addName(builder, nameOffset);
  51539. var offset = Header.endHeader(builder);
  51540. builder.finishSizePrefixed(offset);
  51541. return builder.asUint8Array();
  51542. }
  51543. function valueToType(value) {
  51544. if (typeof value === 'boolean') return ColumnType.Bool;else if (typeof value === 'number') {
  51545. if (value % 1 === 0) return ColumnType.Int;else return ColumnType.Double;
  51546. } 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, "')"));
  51547. }
  51548. function featurecollection_mapColumn(properties, k) {
  51549. return {
  51550. name: k,
  51551. type: valueToType(properties[k]),
  51552. title: null,
  51553. description: null,
  51554. width: -1,
  51555. precision: -1,
  51556. scale: -1,
  51557. nullable: true,
  51558. unique: false,
  51559. primary_key: false
  51560. };
  51561. }
  51562. function introspectHeaderMeta(features) {
  51563. var sampleFeature = features[0];
  51564. var properties = sampleFeature.getProperties ? sampleFeature.getProperties() : {};
  51565. var columns = null;
  51566. if (properties) columns = Object.keys(properties).filter(function (key) {
  51567. return key !== 'geometry';
  51568. }).map(function (k) {
  51569. return featurecollection_mapColumn(properties, k);
  51570. });
  51571. var geometryType = inferGeometryType(features);
  51572. var headerMeta = {
  51573. geometryType: geometryType,
  51574. columns: columns,
  51575. envelope: null,
  51576. featuresCount: features.length,
  51577. indexNodeSize: 0,
  51578. crs: null,
  51579. title: null,
  51580. description: null,
  51581. metadata: null
  51582. };
  51583. return headerMeta;
  51584. }
  51585. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/geojson/featurecollection.js
  51586. 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; } } }; }
  51587. 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); }
  51588. 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; }
  51589. function featurecollection_serialize(featurecollection) {
  51590. var headerMeta = featurecollection_introspectHeaderMeta(featurecollection);
  51591. var header = buildHeader(headerMeta);
  51592. var features = featurecollection.features.map(function (f) {
  51593. return buildFeature(f.geometry.type === 'GeometryCollection' ? parseGC(f.geometry) : parseGeometry(f.geometry), f.properties, headerMeta);
  51594. });
  51595. var featuresLength = features.map(function (f) {
  51596. return f.length;
  51597. }).reduce(function (a, b) {
  51598. return a + b;
  51599. });
  51600. var uint8 = new Uint8Array(magicbytes.length + header.length + featuresLength);
  51601. uint8.set(header, magicbytes.length);
  51602. var offset = magicbytes.length + header.length;
  51603. var _iterator = geojson_featurecollection_createForOfIteratorHelper(features),
  51604. _step;
  51605. try {
  51606. for (_iterator.s(); !(_step = _iterator.n()).done;) {
  51607. var feature = _step.value;
  51608. uint8.set(feature, offset);
  51609. offset += feature.length;
  51610. }
  51611. } catch (err) {
  51612. _iterator.e(err);
  51613. } finally {
  51614. _iterator.f();
  51615. }
  51616. uint8.set(magicbytes);
  51617. return uint8;
  51618. }
  51619. function featurecollection_deserialize(bytes, headerMetaFn) {
  51620. var features = deserialize(bytes, feature_fromFeature, headerMetaFn);
  51621. return {
  51622. type: 'FeatureCollection',
  51623. features: features
  51624. };
  51625. }
  51626. function featurecollection_deserializeStream(stream, headerMetaFn) {
  51627. return deserializeStream(stream, feature_fromFeature, headerMetaFn);
  51628. }
  51629. function featurecollection_deserializeFiltered(url, rect, headerMetaFn) {
  51630. return deserializeFiltered(url, rect, feature_fromFeature, headerMetaFn);
  51631. }
  51632. function featurecollection_introspectHeaderMeta(featurecollection) {
  51633. var feature = featurecollection.features[0];
  51634. var properties = feature.properties;
  51635. var columns = null;
  51636. if (properties) columns = Object.keys(properties).map(function (k) {
  51637. return mapColumn(properties, k);
  51638. });
  51639. var geometryType = inferGeometryType(featurecollection.features);
  51640. var headerMeta = {
  51641. geometryType: geometryType,
  51642. columns: columns,
  51643. envelope: null,
  51644. featuresCount: featurecollection.features.length,
  51645. indexNodeSize: 0,
  51646. crs: null,
  51647. title: null,
  51648. description: null,
  51649. metadata: null
  51650. };
  51651. return headerMeta;
  51652. }
  51653. ;// CONCATENATED MODULE: ./node_modules/flatgeobuf/lib/mjs/geojson.js
  51654. function geojson_serialize(geojson) {
  51655. var bytes = fcSerialize(geojson);
  51656. return bytes;
  51657. }
  51658. function geojson_deserialize(input, rect, headerMetaFn) {
  51659. 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);
  51660. }
  51661. // EXTERNAL MODULE: ./node_modules/rbush/index.js
  51662. var rbush = __webpack_require__(510);
  51663. var rbush_default = /*#__PURE__*/__webpack_require__.n(rbush);
  51664. ;// CONCATENATED MODULE: ./src/common/overlay/fgb/FGBLayerRenderer.js
  51665. function FGBLayerRenderer_typeof(obj) { "@babel/helpers - typeof"; return FGBLayerRenderer_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; }, FGBLayerRenderer_typeof(obj); }
  51666. function FGBLayerRenderer_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ FGBLayerRenderer_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" == FGBLayerRenderer_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; }
  51667. function FGBLayerRenderer_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); } }
  51668. function FGBLayerRenderer_asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { FGBLayerRenderer_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { FGBLayerRenderer_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
  51669. function FGBLayerRenderer_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  51670. function FGBLayerRenderer_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); } }
  51671. function FGBLayerRenderer_createClass(Constructor, protoProps, staticProps) { if (protoProps) FGBLayerRenderer_defineProperties(Constructor.prototype, protoProps); if (staticProps) FGBLayerRenderer_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  51672. function FGBLayerRenderer_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 FGBLayerRenderer_AsyncFromSyncIterator(method.call(iterable)); async = "@@asyncIterator", sync = "@@iterator"; } throw new TypeError("Object is not async iterable"); }
  51673. function FGBLayerRenderer_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 FGBLayerRenderer_AsyncFromSyncIterator = function AsyncFromSyncIterator(s) { this.s = s, this.n = s.next; }, FGBLayerRenderer_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 FGBLayerRenderer_AsyncFromSyncIterator(s); }
  51674. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  51675. * This program are made available under the terms of the Apache License, Version 2.0
  51676. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51677. /**
  51678. * @private
  51679. * @class FGBLayerRenderer
  51680. * @classdesc FGB。
  51681. * @version 11.1.0
  51682. * @param {Object} options - 参数。
  51683. * @param {string} [options.layerID] - 图层 ID。默认使用 CommonUtil.createUniqueID("FGBlayer_") 创建图层 ID。
  51684. * @param {boolean} [options.strategy='bbox'] - 指定加载策略,可选值为 all,bbox。 all为全量加载, bbox为当前可见范围加载。
  51685. * @param {Array} [options.extent] - 加载范围, 参数规范为: [minX, minY, maxX, maxY], 传递此参数后, 图层将使用局部加载。
  51686. * @param {function} [options.featureLoader] - 要素自定义方法,接收要素作为参数,需返回要素。
  51687. * @usage
  51688. */
  51689. var GEOMETRY_TYPE_MAP = {
  51690. 1: 'circle',
  51691. 2: 'line',
  51692. 3: 'fill',
  51693. 5: 'line',
  51694. 4: 'circle',
  51695. 6: 'fill',
  51696. 'MultiPolygon': 'fill',
  51697. 'Point': 'circle',
  51698. 'MultiLineString': 'line',
  51699. 'MultiPoint': 'circle',
  51700. 'LineString': 'line',
  51701. 'Polygon': 'fill'
  51702. };
  51703. var FGBLayerRenderer = /*#__PURE__*/function () {
  51704. function FGBLayerRenderer() {
  51705. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  51706. FGBLayerRenderer_classCallCheck(this, FGBLayerRenderer);
  51707. this.id = options.layerID ? options.layerID : Util_Util.createUniqueID('FGBLayer_');
  51708. this.layerId = this.id + 'outer';
  51709. this.sourceId = this.layerId;
  51710. this.options = options;
  51711. this.strategy = options.strategy || 'bbox';
  51712. this.url = options.url;
  51713. this.layerType = '';
  51714. this.extent = options.extent;
  51715. this.init();
  51716. }
  51717. FGBLayerRenderer_createClass(FGBLayerRenderer, [{
  51718. key: "init",
  51719. value: function init() {
  51720. if (this.strategy === 'bbox') {
  51721. this.loadedExtentsRtree_ = new (rbush_default())();
  51722. }
  51723. }
  51724. }, {
  51725. key: "iterateFeatures",
  51726. value: function () {
  51727. var _iterateFeatures = FGBLayerRenderer_asyncToGenerator( /*#__PURE__*/FGBLayerRenderer_regeneratorRuntime().mark(function _callee(iterator) {
  51728. var features, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, feature;
  51729. return FGBLayerRenderer_regeneratorRuntime().wrap(function _callee$(_context) {
  51730. while (1) switch (_context.prev = _context.next) {
  51731. case 0:
  51732. features = {
  51733. type: 'FeatureCollection',
  51734. features: []
  51735. };
  51736. _iteratorAbruptCompletion = false;
  51737. _didIteratorError = false;
  51738. _context.prev = 3;
  51739. _iterator = FGBLayerRenderer_asyncIterator(iterator);
  51740. case 5:
  51741. _context.next = 7;
  51742. return _iterator.next();
  51743. case 7:
  51744. if (!(_iteratorAbruptCompletion = !(_step = _context.sent).done)) {
  51745. _context.next = 15;
  51746. break;
  51747. }
  51748. feature = _step.value;
  51749. if (this.options.featureLoader && typeof this.options.featureLoader === 'function') {
  51750. feature = this.options.featureLoader(feature);
  51751. }
  51752. if (!this.layerType) {
  51753. this.layerType = GEOMETRY_TYPE_MAP[feature.geometry.type];
  51754. }
  51755. features.features.push(feature);
  51756. case 12:
  51757. _iteratorAbruptCompletion = false;
  51758. _context.next = 5;
  51759. break;
  51760. case 15:
  51761. _context.next = 21;
  51762. break;
  51763. case 17:
  51764. _context.prev = 17;
  51765. _context.t0 = _context["catch"](3);
  51766. _didIteratorError = true;
  51767. _iteratorError = _context.t0;
  51768. case 21:
  51769. _context.prev = 21;
  51770. _context.prev = 22;
  51771. if (!(_iteratorAbruptCompletion && _iterator["return"] != null)) {
  51772. _context.next = 26;
  51773. break;
  51774. }
  51775. _context.next = 26;
  51776. return _iterator["return"]();
  51777. case 26:
  51778. _context.prev = 26;
  51779. if (!_didIteratorError) {
  51780. _context.next = 29;
  51781. break;
  51782. }
  51783. throw _iteratorError;
  51784. case 29:
  51785. return _context.finish(26);
  51786. case 30:
  51787. return _context.finish(21);
  51788. case 31:
  51789. return _context.abrupt("return", features);
  51790. case 32:
  51791. case "end":
  51792. return _context.stop();
  51793. }
  51794. }, _callee, this, [[3, 17, 21, 31], [22,, 26, 30]]);
  51795. }));
  51796. function iterateFeatures(_x) {
  51797. return _iterateFeatures.apply(this, arguments);
  51798. }
  51799. return iterateFeatures;
  51800. }()
  51801. }, {
  51802. key: "_loadData",
  51803. value: function () {
  51804. var _loadData2 = FGBLayerRenderer_asyncToGenerator( /*#__PURE__*/FGBLayerRenderer_regeneratorRuntime().mark(function _callee2(bounds) {
  51805. var _this = this;
  51806. var fgbStream, rect;
  51807. return FGBLayerRenderer_regeneratorRuntime().wrap(function _callee2$(_context2) {
  51808. while (1) switch (_context2.prev = _context2.next) {
  51809. case 0:
  51810. rect = {
  51811. minX: bounds[0],
  51812. minY: bounds[1],
  51813. maxX: bounds[2],
  51814. maxY: bounds[3]
  51815. };
  51816. if (bounds.length) {
  51817. _context2.next = 7;
  51818. break;
  51819. }
  51820. _context2.next = 4;
  51821. return this._getStream(this.url);
  51822. case 4:
  51823. fgbStream = _context2.sent;
  51824. _context2.next = 9;
  51825. break;
  51826. case 7:
  51827. rect.value = {
  51828. extent: bounds.slice()
  51829. };
  51830. this.loadedExtentsRtree_.insert(rect);
  51831. case 9:
  51832. _context2.next = 11;
  51833. return geojson_deserialize(fgbStream && fgbStream.body || this.url, rect, function (headerMeta) {
  51834. _this.layerType = GEOMETRY_TYPE_MAP[headerMeta.geometryType];
  51835. });
  51836. case 11:
  51837. return _context2.abrupt("return", _context2.sent);
  51838. case 12:
  51839. case "end":
  51840. return _context2.stop();
  51841. }
  51842. }, _callee2, this);
  51843. }));
  51844. function _loadData(_x2) {
  51845. return _loadData2.apply(this, arguments);
  51846. }
  51847. return _loadData;
  51848. }()
  51849. }, {
  51850. key: "_getStream",
  51851. value: function () {
  51852. var _getStream2 = FGBLayerRenderer_asyncToGenerator( /*#__PURE__*/FGBLayerRenderer_regeneratorRuntime().mark(function _callee3(url) {
  51853. return FGBLayerRenderer_regeneratorRuntime().wrap(function _callee3$(_context3) {
  51854. while (1) switch (_context3.prev = _context3.next) {
  51855. case 0:
  51856. _context3.next = 2;
  51857. return FetchRequest.get(url, {}, {
  51858. withoutFormatSuffix: true
  51859. }).then(function (response) {
  51860. return response;
  51861. });
  51862. case 2:
  51863. return _context3.abrupt("return", _context3.sent);
  51864. case 3:
  51865. case "end":
  51866. return _context3.stop();
  51867. }
  51868. }, _callee3);
  51869. }));
  51870. function _getStream(_x3) {
  51871. return _getStream2.apply(this, arguments);
  51872. }
  51873. return _getStream;
  51874. }()
  51875. }, {
  51876. key: "_containsExtent",
  51877. value: function _containsExtent(extent1, extent2) {
  51878. return extent1[0] <= extent2[0] && extent2[2] <= extent1[2] && extent1[1] <= extent2[1] && extent2[3] <= extent1[3];
  51879. }
  51880. }, {
  51881. key: "_getInExtent",
  51882. value: function _getInExtent(extent) {
  51883. var bbox = {
  51884. minX: extent[0],
  51885. minY: extent[1],
  51886. maxX: extent[2],
  51887. maxY: extent[3]
  51888. };
  51889. var items = this.loadedExtentsRtree_.search(bbox);
  51890. return items.map(function (item) {
  51891. return item.value;
  51892. });
  51893. }
  51894. }, {
  51895. key: "_forEachInExtent",
  51896. value: function _forEachInExtent(extent, callback) {
  51897. return this._forEach(this._getInExtent(extent), callback);
  51898. }
  51899. }, {
  51900. key: "_forEach",
  51901. value: function _forEach(values, callback) {
  51902. var result;
  51903. for (var i = 0, l = values.length; i < l; i++) {
  51904. result = callback(values[i]);
  51905. if (result) {
  51906. return result;
  51907. }
  51908. }
  51909. return result;
  51910. }
  51911. }]);
  51912. return FGBLayerRenderer;
  51913. }();
  51914. ;// CONCATENATED MODULE: ./src/maplibregl/overlay/FGBLayer.js
  51915. function FGBLayer_typeof(obj) { "@babel/helpers - typeof"; return FGBLayer_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, FGBLayer_typeof(obj); }
  51916. function FGBLayer_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ FGBLayer_regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == FGBLayer_typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
  51917. function FGBLayer_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
  51918. function FGBLayer_asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { FGBLayer_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { FGBLayer_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
  51919. function FGBLayer_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  51920. function FGBLayer_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); } }
  51921. function FGBLayer_createClass(Constructor, protoProps, staticProps) { if (protoProps) FGBLayer_defineProperties(Constructor.prototype, protoProps); if (staticProps) FGBLayer_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
  51922. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  51923. * This program are made available under the terms of the Apache License, Version 2.0
  51924. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51925. /**
  51926. * reference and modification
  51927. * dereklieu/cool-grid, cloudybay/leaflet.latlng-graticule
  51928. * (https://github.com/dereklieu/cool-grid, https://github.com/cloudybay/leaflet.latlng-graticule)
  51929. * Apache Licene 2.0
  51930. * thanks dereklieu, cloudybay
  51931. */
  51932. /**
  51933. * @class FGBLayer
  51934. * @category Visualization FGB
  51935. * @classdesc FGB 图层类。
  51936. * @version 11.1.0
  51937. * @modulecategory Overlay
  51938. * @param {Object} options - 参数。
  51939. * @param {string} [options.layerID] - 图层 ID。默认使用 CommonUtil.createUniqueID("FGBlayer_") 创建图层 ID。
  51940. * @param {boolean} [options.strategy='bbox'] - 指定加载策略,可选值为 all,bbox。 all为全量加载, bbox为当前可见范围加载。
  51941. * @param {Array} [options.extent] - 加载范围, 参数规范为: [minX, minY, maxX, maxY], 传递此参数后, 图层将使用局部加载。
  51942. * @param {function} [options.featureLoader] - 要素自定义方法,接收要素作为参数,需返回要素。
  51943. * @param {Object} [options.paint] - 参数内容详见: {@link https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#paint-property}
  51944. * @param {Object} [options.layout] - 参数内容详见: {@link https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#layout-property}
  51945. * @param {Object} [options.sourceOptions] - 参数内容详见: {@link mapboxgl.source}
  51946. * @usage
  51947. */
  51948. var PAINT_MAP = {
  51949. circle: {
  51950. 'circle-radius': 6,
  51951. 'circle-color': '#3fb1e3',
  51952. 'circle-opacity': 1,
  51953. 'circle-blur': 0,
  51954. 'circle-translate': [0, 0],
  51955. 'circle-stroke-width': 0,
  51956. 'circle-stroke-color': '#000',
  51957. 'circle-stroke-opacity': 1
  51958. },
  51959. line: {
  51960. 'line-opacity': 1,
  51961. 'line-color': '#3fb1e3',
  51962. 'line-width': 3,
  51963. 'line-blur': 1
  51964. },
  51965. fill: {
  51966. 'fill-opacity': 0.8,
  51967. 'fill-color': '#3fb1e3',
  51968. 'fill-translate': [0, 0],
  51969. 'fill-antialias': true,
  51970. 'fill-outline-color': '#3fb1e3'
  51971. }
  51972. };
  51973. var FGBLayer = /*#__PURE__*/function () {
  51974. function FGBLayer() {
  51975. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  51976. FGBLayer_classCallCheck(this, FGBLayer);
  51977. this.id = options.layerID ? options.layerID : Util_Util.createUniqueID('FGBLayer_');
  51978. this.layerId = this.id + 'outer';
  51979. this.sourceId = this.layerId;
  51980. this.options = options;
  51981. this.strategy = options.strategy || 'bbox';
  51982. this.url = options.url;
  51983. this.layerType = '';
  51984. this.type = 'custom';
  51985. this.renderingMode = '3d';
  51986. this.overlay = true;
  51987. this.extent = options.extent;
  51988. this._updateFeaturesFn = this._updateFeatures.bind(this);
  51989. }
  51990. /**
  51991. * @function FGBLayer.prototype.onAdd
  51992. * @param {maplibregl.Map} map - MapLibreGL Map 对象。
  51993. */
  51994. FGBLayer_createClass(FGBLayer, [{
  51995. key: "onAdd",
  51996. value: function onAdd(map) {
  51997. this.map = map;
  51998. var extent = [];
  51999. if (this.strategy === 'bbox') {
  52000. var bounds = this.map.getBounds().toArray();
  52001. extent = [bounds[0][0], bounds[0][1], bounds[1][0], bounds[1][1]];
  52002. this.map.on('moveend', this._updateFeaturesFn);
  52003. }
  52004. if (this.extent) {
  52005. var intersectExtent = getIntersection(this.extent, extent);
  52006. if (intersectExtent && intersectExtent.length) {
  52007. extent = intersectExtent;
  52008. } else {
  52009. extent = this.extent;
  52010. }
  52011. }
  52012. this.renderer = new FGBLayerRenderer(this.options);
  52013. this._handleFeatures(extent);
  52014. }
  52015. /**
  52016. * @function FGBLayer.prototype.render
  52017. */
  52018. }, {
  52019. key: "render",
  52020. value: function render() {}
  52021. /**
  52022. * @function FGBLayer.prototype.onRemove
  52023. */
  52024. }, {
  52025. key: "onRemove",
  52026. value: function onRemove() {
  52027. this.map.off('moveend', this._updateFeaturesFn);
  52028. }
  52029. /**
  52030. * @function FGBLayer.prototype.moveLayer
  52031. * @description 设置图层可见性。
  52032. * @param {string} layerID - 待插入的图层 ID。
  52033. * @param {boolean} [beforeId=true] - 将本图层插入到图层 ID 为layerID 的图层之前。
  52034. */
  52035. }, {
  52036. key: "moveLayer",
  52037. value: function moveLayer(id, beforeId) {
  52038. this.map.moveLayer(id, beforeId);
  52039. }
  52040. /**
  52041. * @function FGBLayer.prototype.setVisibility
  52042. * @description 设置图层可见性。
  52043. * @param {boolean} [visibility] - 是否显示图层(当前地图的 resolution 在最大最小 resolution 之间)。
  52044. */
  52045. }, {
  52046. key: "setVisibility",
  52047. value: function setVisibility(visibility) {
  52048. var visible = visibility ? 'visible' : 'none';
  52049. this.map.setLayoutProperty(this.layerId, 'visibility', visible);
  52050. }
  52051. }, {
  52052. key: "_handleFeatures",
  52053. value: function () {
  52054. var _handleFeatures2 = FGBLayer_asyncToGenerator( /*#__PURE__*/FGBLayer_regeneratorRuntime().mark(function _callee(bounds) {
  52055. var iter, features, layer;
  52056. return FGBLayer_regeneratorRuntime().wrap(function _callee$(_context) {
  52057. while (1) switch (_context.prev = _context.next) {
  52058. case 0:
  52059. _context.next = 2;
  52060. return this.renderer._loadData(bounds);
  52061. case 2:
  52062. iter = _context.sent;
  52063. _context.next = 5;
  52064. return this.renderer.iterateFeatures(iter);
  52065. case 5:
  52066. features = _context.sent;
  52067. if (!this.map.getSource(this.sourceId)) {
  52068. this.map.addSource(this.sourceId, {
  52069. type: 'geojson',
  52070. data: features
  52071. });
  52072. } else {
  52073. this.map.getSource(this.sourceId).setData(features);
  52074. }
  52075. if (!this.map.getLayer(this.layerId)) {
  52076. this.layerType = this.renderer.layerType;
  52077. layer = Object.assign({
  52078. id: this.layerId,
  52079. type: this.layerType,
  52080. source: this.sourceId,
  52081. paint: Object.assign(PAINT_MAP[this.layerType], this.options.paint) || {},
  52082. layout: this.options.layout || {}
  52083. });
  52084. this.map.addLayer(layer);
  52085. }
  52086. case 8:
  52087. case "end":
  52088. return _context.stop();
  52089. }
  52090. }, _callee, this);
  52091. }));
  52092. function _handleFeatures(_x) {
  52093. return _handleFeatures2.apply(this, arguments);
  52094. }
  52095. return _handleFeatures;
  52096. }()
  52097. }, {
  52098. key: "_updateFeatures",
  52099. value: function () {
  52100. var _updateFeatures2 = FGBLayer_asyncToGenerator( /*#__PURE__*/FGBLayer_regeneratorRuntime().mark(function _callee2() {
  52101. var _this = this;
  52102. var bounds, extentToLoad, alreadyLoaded, iter, features;
  52103. return FGBLayer_regeneratorRuntime().wrap(function _callee2$(_context2) {
  52104. while (1) switch (_context2.prev = _context2.next) {
  52105. case 0:
  52106. bounds = this.map.getBounds().toArray();
  52107. extentToLoad = [bounds[0][0], bounds[0][1], bounds[1][0], bounds[1][1]];
  52108. alreadyLoaded = this.renderer._forEachInExtent(extentToLoad, function (object) {
  52109. return _this.renderer._containsExtent(object.extent, extentToLoad);
  52110. });
  52111. if (alreadyLoaded) {
  52112. _context2.next = 11;
  52113. break;
  52114. }
  52115. _context2.next = 6;
  52116. return this.renderer._loadData(extentToLoad);
  52117. case 6:
  52118. iter = _context2.sent;
  52119. _context2.next = 9;
  52120. return this.renderer.iterateFeatures(iter);
  52121. case 9:
  52122. features = _context2.sent;
  52123. this.map.getSource(this.sourceId).setData(features);
  52124. case 11:
  52125. case "end":
  52126. return _context2.stop();
  52127. }
  52128. }, _callee2, this);
  52129. }));
  52130. function _updateFeatures() {
  52131. return _updateFeatures2.apply(this, arguments);
  52132. }
  52133. return _updateFeatures;
  52134. }()
  52135. }]);
  52136. return FGBLayer;
  52137. }();
  52138. ;// CONCATENATED MODULE: ./src/maplibregl/overlay/graphic/Graphic.js
  52139. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  52140. * This program are made available under the terms of the Apache License, Version 2.0
  52141. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52142. /**
  52143. * @class Graphic
  52144. * @classdesc 高效率点图层点要素类。
  52145. * @category Visualization Graphic
  52146. * @param {(Object|Array.<number>)} lngLat - 坐标。格式:经纬度数组或包含{lng,lat}格式对象。
  52147. * @param {Object} style - 图形参数。
  52148. * @param {Array.<number>} [style.color] - 点颜色。目前只支持 rgba 数组。
  52149. * @param {Object} [style.radius] - 点半径。
  52150. * @param {Object} [attributes] - 属性信息。
  52151. * @example
  52152. * var graphic = new Graphic(
  52153. * {
  52154. * lng:116,
  52155. * lat:39
  52156. * },{
  52157. * color:[255,0,0],
  52158. * radius:30
  52159. * }
  52160. * });
  52161. * @usage
  52162. */
  52163. class Graphic {
  52164. constructor(lngLat, style, attributes) {
  52165. this.lngLat = core_Util_Util.isArray(lngLat) ? {lng: lngLat[0], lat: lngLat[1]} : lngLat;
  52166. this.style = core_Util_Util.extend({}, style);
  52167. this.attributes = attributes;
  52168. }
  52169. /**
  52170. * @function Graphic.prototype.getId
  52171. * @description 获取当前 ID。
  52172. * @returns {string} ID。
  52173. */
  52174. getId() {
  52175. return this.id;
  52176. }
  52177. /**
  52178. * @function Graphic.prototype.setId
  52179. * @description 设置当前要素 ID。
  52180. * @param {string} id - 要素 ID。
  52181. */
  52182. setId(id) {
  52183. this.id = id;
  52184. }
  52185. /**
  52186. * @function Graphic.prototype.getLngLat
  52187. * @description 获取经纬度坐标。
  52188. * @returns {Object} 经纬度坐标,数据格式{lng,lat}。
  52189. */
  52190. getLngLat() {
  52191. return this.lngLat;
  52192. }
  52193. /**
  52194. * @function Graphic.prototype.setLngLat
  52195. * @description 设置经纬度坐标。
  52196. * @param {Object} lngLat - 经纬度坐标,数据格式{lng,lat}。
  52197. */
  52198. setLngLat(lngLat) {
  52199. this.lngLat = core_Util_Util.isArray(lngLat) ? {lng: lngLat[0], lat: lngLat[1]} : lngLat;
  52200. }
  52201. /**
  52202. * @function Graphic.prototype.setStyle
  52203. * @description 设置点样式。
  52204. * @param {Object} style -样式选项。
  52205. * @param {Array} [style.color] - 颜色。
  52206. * @param {number} [style.radius] - 半径。
  52207. */
  52208. setStyle(style) {
  52209. this.style = core_Util_Util.extend(this.style, style);
  52210. }
  52211. /**
  52212. * @function Graphic.prototype.getStyle
  52213. * @description 获取样式。
  52214. * @returns {Object} 点样式。
  52215. */
  52216. getStyle() {
  52217. return this.style;
  52218. }
  52219. /**
  52220. * @function Graphic.prototype.setAttributes
  52221. * @description 设置属性信息。
  52222. * @param {Object} [attributes] - 属性信息。
  52223. */
  52224. setAttributes(attributes) {
  52225. this.attributes = core_Util_Util.extend({}, this.attributes, attributes);
  52226. }
  52227. /**
  52228. * @function Graphic.prototype.getAttributes
  52229. * @description 获取属性信息。
  52230. * @returns {Object} 属性信息。
  52231. */
  52232. getAttributes() {
  52233. return this.attributes;
  52234. }
  52235. }
  52236. ;// CONCATENATED MODULE: ./src/maplibregl/overlay/graphic/index.js
  52237. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  52238. * This program are made available under the terms of the Apache License, Version 2.0
  52239. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52240. ;// CONCATENATED MODULE: ./src/maplibregl/overlay/index.js
  52241. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  52242. * This program are made available under the terms of the Apache License, Version 2.0
  52243. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52244. ;// CONCATENATED MODULE: ./src/common/SuperMap.js
  52245. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  52246. * This program are made available under the terms of the Apache License, Version 2.0
  52247. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52248. var SuperMap = window.SuperMap = window.SuperMap || {};
  52249. SuperMap.Components = window.SuperMap.Components || {};
  52250. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Rectangle.js
  52251. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  52252. * This program are made available under the terms of the Apache License, Version 2.0
  52253. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52254. /**
  52255. * @class GeometryRectangle
  52256. * @aliasclass Geometry.Rectangle
  52257. * @deprecatedclass SuperMap.Geometry.Rectangle
  52258. * @classdesc 矩形几何对象类。
  52259. * @category BaseTypes Geometry
  52260. * @param {number} x - 矩形左下角点的横坐标。
  52261. * @param {number} y - 矩形左下角点的纵坐标。
  52262. * @param {number} width - 矩形的宽度。
  52263. * @param {number} height - 矩形的高度。
  52264. * @extends {Geometry}
  52265. * @example
  52266. * //x 为矩形左下角点的横坐标;y 为矩形左下角点的纵坐标;w 为矩形的宽度;h 为矩形的高度
  52267. * var x = 1;
  52268. * var y = 2;
  52269. * var w = 10;
  52270. * var h = 20;
  52271. * var recttangle = new GeometryRectangle(x, y, w, h);
  52272. * @usage
  52273. */
  52274. class Rectangle extends Geometry_Geometry {
  52275. constructor(x, y, width, height) {
  52276. super(x, y, width, height);
  52277. /**
  52278. * @member {number} GeometryRectangle.prototype.x
  52279. * @description 矩形左下角点的横坐标。
  52280. */
  52281. this.x = x;
  52282. /**
  52283. * @member {number} GeometryRectangle.prototype.y
  52284. * @description 矩形左下角点的纵坐标。
  52285. */
  52286. this.y = y;
  52287. /**
  52288. * @member {number} GeometryRectangle.prototype.width
  52289. * @description 矩形的宽度。
  52290. */
  52291. this.width = width;
  52292. /**
  52293. * @member {number} GeometryRectangle.prototype.height
  52294. * @description 矩形的高度。
  52295. */
  52296. this.height = height;
  52297. this.CLASS_NAME = "SuperMap.Geometry.Rectangle";
  52298. this.geometryType = "Rectangle";
  52299. }
  52300. /**
  52301. * @function GeometryRectangle.prototype.calculateBounds
  52302. * @description 计算出此矩形对象的 bounds。
  52303. */
  52304. calculateBounds() {
  52305. this.bounds = new Bounds(this.x, this.y,
  52306. this.x + this.width,
  52307. this.y + this.height);
  52308. }
  52309. /**
  52310. * @function GeometryRectangle.prototype.getArea
  52311. * @description 获取矩形对象的面积。
  52312. * @returns {number} 矩形对象面积。
  52313. */
  52314. getArea() {
  52315. var area = this.width * this.height;
  52316. return area;
  52317. }
  52318. }
  52319. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/index.js
  52320. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  52321. * This program are made available under the terms of the Apache License, Version 2.0
  52322. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52323. ;// CONCATENATED MODULE: ./src/common/commontypes/Date.js
  52324. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  52325. * This program are made available under the terms of the Apache License, Version 2.0
  52326. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52327. /**
  52328. * @name Date
  52329. * @namespace
  52330. * @category BaseTypes Util
  52331. * @description 包含 parse、toISOString 方法的实现,两个方法用来解析 RFC 3339 日期,遵循 ECMAScript 5 规范。
  52332. * @private
  52333. */
  52334. var DateExt = {
  52335. /**
  52336. * @description 生成代表一个具体的日期字符串,该日期遵循 ISO 8601 标准(详情查看{@link http://tools.ietf.org/html/rfc3339})。
  52337. * @example
  52338. * var dateString = DateExt.toISOString(new Date());
  52339. * @param {Date} date - 日期对象。
  52340. * @returns {string} 一个代表日期的字符串。(例如 "2010-08-07T16:58:23.123Z")。
  52341. */
  52342. toISOString: (function () {
  52343. //标准的Date会存在toISOString方法,可以直接调用
  52344. if ("toISOString" in Date.prototype) {
  52345. return function (date) {
  52346. return date.toISOString();
  52347. };
  52348. } else {// 部分浏览器没有,就得自己组合,组合后的字符串规则不变
  52349. function pad(num, len) {
  52350. var str = num + "";
  52351. while (str.length < len) {
  52352. str = "0" + str;
  52353. }
  52354. return str;
  52355. }
  52356. return function (date) {
  52357. var str;
  52358. if (isNaN(date.getTime())) {
  52359. // ECMA-262 says throw RangeError, Firefox returns
  52360. // "Invalid Date"
  52361. str = "Invalid Date";
  52362. } else {
  52363. str =
  52364. date.getUTCFullYear() + "-" +
  52365. pad(date.getUTCMonth() + 1, 2) + "-" +
  52366. pad(date.getUTCDate(), 2) + "T" +
  52367. pad(date.getUTCHours(), 2) + ":" +
  52368. pad(date.getUTCMinutes(), 2) + ":" +
  52369. pad(date.getUTCSeconds(), 2) + "." +
  52370. pad(date.getUTCMilliseconds(), 3) + "Z";
  52371. }
  52372. return str;
  52373. };
  52374. }
  52375. })(),
  52376. /**
  52377. * @description 从一个字符串生成一个日期对象。
  52378. * @example
  52379. * var date = DateExt.parse("2010-08-07");
  52380. * @param {string} str - 日期的字符串。(例如: "2010", "2010-08", "2010-08-07", "2010-08-07T16:58:23.123Z","2010-08-07T11:58:23.123-06")。
  52381. * @returns {Date} 日期对象,如果字符串无法被解析,则返回一个无效的日期。(例如 isNaN(date.getTime()))。
  52382. */
  52383. parse: function (str) {
  52384. var date;
  52385. 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)?$/);
  52386. if (match && (match[1] || match[7])) { // must have at least year or time
  52387. var year = parseInt(match[1], 10) || 0;
  52388. var month = (parseInt(match[2], 10) - 1) || 0;
  52389. var day = parseInt(match[3], 10) || 1;
  52390. date = new Date(Date.UTC(year, month, day));
  52391. // optional time
  52392. var type = match[7];
  52393. if (type) {
  52394. var hours = parseInt(match[4], 10);
  52395. var minutes = parseInt(match[5], 10);
  52396. var secFrac = parseFloat(match[6]);
  52397. var seconds = secFrac | 0;
  52398. var milliseconds = Math.round(1000 * (secFrac - seconds));
  52399. date.setUTCHours(hours, minutes, seconds, milliseconds);
  52400. // check offset
  52401. if (type !== "Z") {
  52402. var hoursOffset = parseInt(type, 10);
  52403. var minutesOffset = parseInt(match[8], 10) || 0;
  52404. var offset = -1000 * (60 * (hoursOffset * 60) + minutesOffset * 60);
  52405. date = new Date(date.getTime() + offset);
  52406. }
  52407. }
  52408. } else {
  52409. date = new Date("invalid");
  52410. }
  52411. return date;
  52412. }
  52413. };
  52414. ;// CONCATENATED MODULE: ./src/common/commontypes/index.js
  52415. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  52416. * This program are made available under the terms of the Apache License, Version 2.0
  52417. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52418. ;// CONCATENATED MODULE: ./src/common/format/WKT.js
  52419. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  52420. * This program are made available under the terms of the Apache License, Version 2.0
  52421. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52422. /**
  52423. * @class WKTFormat
  52424. * @aliasclass Format.WKT
  52425. * @deprecatedclass SuperMap.Format.WKT
  52426. * @classdesc 用于读写常见文本的类。通过 {@link WKTFormat} 构造器来创建一个新的实例。
  52427. * @category BaseTypes Format
  52428. * @extends {Format}
  52429. * @param {Object} options - 可选的选项对象,其属性将被设置到实例。option 具体配置项继承自 {@link Format}。
  52430. * @usage
  52431. */
  52432. class WKT extends Format {
  52433. constructor(options) {
  52434. super(options);
  52435. this.regExes = {
  52436. 'typeStr': /^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,
  52437. 'spaces': /\s+/,
  52438. 'parenComma': /\)\s*,\s*\(/,
  52439. 'doubleParenComma': /\)\s*\)\s*,\s*\(\s*\(/, // can't use {2} here
  52440. 'trimParens': /^\s*\(?(.*?)\)?\s*$/
  52441. };
  52442. this.CLASS_NAME = "SuperMap.Format.WKT"; /**
  52443. * @private
  52444. * @description Object with properties corresponding to the geometry types.
  52445. * Property values are functions that do the actual data extraction.
  52446. */
  52447. this.extract = {
  52448. /**
  52449. * @description Return a space delimited string of point coordinates.
  52450. * @param {GeometryPoint} point
  52451. * @returns {string} A string of coordinates representing the point
  52452. */
  52453. 'point': function (point) {
  52454. return point.x + ' ' + point.y;
  52455. },
  52456. /**
  52457. * @description Return a comma delimited string of point coordinates from a multipoint.
  52458. * @param {GeometryMultiPoint} multipoint
  52459. * @returns {string} A string of point coordinate strings representing
  52460. * the multipoint
  52461. */
  52462. 'multipoint'(multipoint) {
  52463. var array = [];
  52464. for (var i = 0, len = multipoint.components.length; i < len; ++i) {
  52465. array.push('(' +
  52466. this.extract.point.apply(this, [multipoint.components[i]]) +
  52467. ')');
  52468. }
  52469. return array.join(',');
  52470. },
  52471. /**
  52472. * @description Return a comma delimited string of point coordinates from a line.
  52473. * @param {GeometryLineString} linestring
  52474. * @returns {string} A string of point coordinate strings representing
  52475. * the linestring
  52476. */
  52477. 'linestring'(linestring) {
  52478. var array = [];
  52479. for (var i = 0, len = linestring.components.length; i < len; ++i) {
  52480. array.push(this.extract.point.apply(this, [linestring.components[i]]));
  52481. }
  52482. return array.join(',');
  52483. },
  52484. /**
  52485. * @description Return a comma delimited string of linestring strings from a multilinestring.
  52486. * @param {GeometryMultiLineString} multilinestring
  52487. * @returns {string} A string of of linestring strings representing
  52488. * the multilinestring
  52489. */
  52490. 'multilinestring'(multilinestring) {
  52491. var array = [];
  52492. for (var i = 0, len = multilinestring.components.length; i < len; ++i) {
  52493. array.push('(' +
  52494. this.extract.linestring.apply(this, [multilinestring.components[i]]) +
  52495. ')');
  52496. }
  52497. return array.join(',');
  52498. },
  52499. /**
  52500. * @description Return a comma delimited string of linear ring arrays from a polygon.
  52501. * @param {GeometryPolygon} polygon
  52502. * @returns {string} An array of linear ring arrays representing the polygon
  52503. */
  52504. 'polygon'(polygon) {
  52505. var array = [];
  52506. for (var i = 0, len = polygon.components.length; i < len; ++i) {
  52507. array.push('(' +
  52508. this.extract.linestring.apply(this, [polygon.components[i]]) +
  52509. ')');
  52510. }
  52511. return array.join(',');
  52512. },
  52513. /**
  52514. * @description Return an array of polygon arrays from a multipolygon.
  52515. * @param {GeometryMultiPolygon} multipolygon
  52516. * @returns {string} An array of polygon arrays representing
  52517. * the multipolygon
  52518. */
  52519. 'multipolygon'(multipolygon) {
  52520. var array = [];
  52521. for (var i = 0, len = multipolygon.components.length; i < len; ++i) {
  52522. array.push('(' +
  52523. this.extract.polygon.apply(this, [multipolygon.components[i]]) +
  52524. ')');
  52525. }
  52526. return array.join(',');
  52527. },
  52528. /**
  52529. * @description Return the WKT portion between 'GEOMETRYCOLLECTION(' and ')' for an <GeometryCollection>
  52530. * @param {GeometryCollection} collection
  52531. * @returns {string} internal WKT representation of the collection
  52532. */
  52533. 'collection'(collection) {
  52534. var array = [];
  52535. for (var i = 0, len = collection.components.length; i < len; ++i) {
  52536. array.push(this.extractGeometry.apply(this, [collection.components[i]]));
  52537. }
  52538. return array.join(',');
  52539. }
  52540. };
  52541. /**
  52542. * @private
  52543. * @description Object with properties corresponding to the geometry types.
  52544. * Property values are functions that do the actual parsing.
  52545. */
  52546. this.parse = {
  52547. /**
  52548. * @private
  52549. * @description Return point feature given a point WKT fragment.
  52550. * @param {string} str A WKT fragment representing the point
  52551. * @returns {FeatureVector} A point feature
  52552. *
  52553. */
  52554. 'point': function (str) {
  52555. var coords = StringExt.trim(str).split(this.regExes.spaces);
  52556. return new Vector(new Point(coords[0], coords[1])
  52557. );
  52558. },
  52559. /**
  52560. * @description Return a multipoint feature given a multipoint WKT fragment.
  52561. * @param {string} A WKT fragment representing the multipoint
  52562. * @returns {FeatureVector} A multipoint feature
  52563. * @private
  52564. */
  52565. 'multipoint': function (str) {
  52566. var point;
  52567. var points = StringExt.trim(str).split(',');
  52568. var components = [];
  52569. for (var i = 0, len = points.length; i < len; ++i) {
  52570. point = points[i].replace(this.regExes.trimParens, '$1');
  52571. components.push(this.parse.point.apply(this, [point]).geometry);
  52572. }
  52573. return new Vector(
  52574. new MultiPoint(components)
  52575. );
  52576. },
  52577. /**
  52578. * @description Return a linestring feature given a linestring WKT fragment.
  52579. * @param {string} A WKT fragment representing the linestring
  52580. * @returns {FeatureVector} A linestring feature
  52581. * @private
  52582. */
  52583. 'linestring': function (str) {
  52584. var points = StringExt.trim(str).split(',');
  52585. var components = [];
  52586. for (var i = 0, len = points.length; i < len; ++i) {
  52587. components.push(this.parse.point.apply(this, [points[i]]).geometry);
  52588. }
  52589. return new Vector(
  52590. new LineString(components)
  52591. );
  52592. },
  52593. /**
  52594. * @description Return a multilinestring feature given a multilinestring WKT fragment.
  52595. * @param {string} A WKT fragment representing the multilinestring
  52596. * @returns {FeatureVector} A multilinestring feature
  52597. * @private
  52598. */
  52599. 'multilinestring': function (str) {
  52600. var line;
  52601. var lines = StringExt.trim(str).split(this.regExes.parenComma);
  52602. var components = [];
  52603. for (var i = 0, len = lines.length; i < len; ++i) {
  52604. line = lines[i].replace(this.regExes.trimParens, '$1');
  52605. components.push(this.parse.linestring.apply(this, [line]).geometry);
  52606. }
  52607. return new Vector(
  52608. new MultiLineString(components)
  52609. );
  52610. },
  52611. /**
  52612. * @description Return a polygon feature given a polygon WKT fragment.
  52613. * @param {string} A WKT fragment representing the polygon
  52614. * @returns {FeatureVector} A polygon feature
  52615. * @private
  52616. */
  52617. 'polygon': function (str) {
  52618. var ring, linestring, linearring;
  52619. var rings = StringExt.trim(str).split(this.regExes.parenComma);
  52620. var components = [];
  52621. for (var i = 0, len = rings.length; i < len; ++i) {
  52622. ring = rings[i].replace(this.regExes.trimParens, '$1');
  52623. linestring = this.parse.linestring.apply(this, [ring]).geometry;
  52624. linearring = new LinearRing_LinearRing(linestring.components);
  52625. components.push(linearring);
  52626. }
  52627. return new Vector(
  52628. new Polygon_Polygon(components)
  52629. );
  52630. },
  52631. /**
  52632. * @private
  52633. * @description Return a multipolygon feature given a multipolygon WKT fragment.
  52634. * @param {string} A WKT fragment representing the multipolygon
  52635. * @returns {FeatureVector} A multipolygon feature
  52636. *
  52637. */
  52638. 'multipolygon': function (str) {
  52639. var polygon;
  52640. var polygons = StringExt.trim(str).split(this.regExes.doubleParenComma);
  52641. var components = [];
  52642. for (var i = 0, len = polygons.length; i < len; ++i) {
  52643. polygon = polygons[i].replace(this.regExes.trimParens, '$1');
  52644. components.push(this.parse.polygon.apply(this, [polygon]).geometry);
  52645. }
  52646. return new Vector(
  52647. new MultiPolygon(components)
  52648. );
  52649. },
  52650. /**
  52651. * @description Return an array of features given a geometrycollection WKT fragment.
  52652. * @param {string} A WKT fragment representing the geometrycollection
  52653. * @returns {Array} An array of FeatureVector
  52654. * @private
  52655. */
  52656. 'geometrycollection': function (str) {
  52657. // separate components of the collection with |
  52658. str = str.replace(/,\s*([A-Za-z])/g, '|$1');
  52659. var wktArray = StringExt.trim(str).split('|');
  52660. var components = [];
  52661. for (var i = 0, len = wktArray.length; i < len; ++i) {
  52662. components.push(this.read(wktArray[i]));
  52663. }
  52664. return components;
  52665. }
  52666. };
  52667. }
  52668. /**
  52669. * @function WKTFormat.prototype.read
  52670. * @description 反序列化 WKT 字符串并返回向量特征或向量特征数组。支持 POINT、MULTIPOINT、LINESTRING、MULTILINESTRING、POLYGON、MULTIPOLYGON 和 GEOMETRYCOLLECTION 的 WKT。
  52671. * @param {string} wkt - WKT 字符串。
  52672. * @returns {FeatureVector|Array} GEOMETRYCOLLECTION WKT 的矢量要素或者矢量要素数组。
  52673. */
  52674. read(wkt) {
  52675. var features, type, str;
  52676. wkt = wkt.replace(/[\n\r]/g, " ");
  52677. var matches = this.regExes.typeStr.exec(wkt);
  52678. if (matches) {
  52679. type = matches[1].toLowerCase();
  52680. str = matches[2];
  52681. if (this.parse[type]) {
  52682. features = this.parse[type].apply(this, [str]);
  52683. }
  52684. }
  52685. return features;
  52686. }
  52687. /**
  52688. * @function WKTFormat.prototype.write
  52689. * @description 将矢量要素或矢量要素数组序列化为 WKT 字符串。
  52690. * @param {(FeatureVector|Array)} features - 矢量要素或矢量要素数组。
  52691. * @returns {string} 表示几何的 WKT 字符串。
  52692. */
  52693. write(features) {
  52694. var collection, geometry, isCollection;
  52695. if (features.constructor === Array) {
  52696. collection = features;
  52697. isCollection = true;
  52698. } else {
  52699. collection = [features];
  52700. isCollection = false;
  52701. }
  52702. var pieces = [];
  52703. if (isCollection) {
  52704. pieces.push('GEOMETRYCOLLECTION(');
  52705. }
  52706. for (var i = 0, len = collection.length; i < len; ++i) {
  52707. if (isCollection && i > 0) {
  52708. pieces.push(',');
  52709. }
  52710. geometry = collection[i].geometry;
  52711. pieces.push(this.extractGeometry(geometry));
  52712. }
  52713. if (isCollection) {
  52714. pieces.push(')');
  52715. }
  52716. return pieces.join('');
  52717. }
  52718. /**
  52719. * @function WKTFormat.prototype.extractGeometry
  52720. * @description 为单个 Geometry 对象构造 WKT 的入口点。
  52721. * @param {Geometry} geometry - Geometry 对象。
  52722. * @returns {string} 表示几何的 WKT 字符串。
  52723. */
  52724. extractGeometry(geometry) {
  52725. var type = geometry.CLASS_NAME.split('.')[2].toLowerCase();
  52726. if (!this.extract[type]) {
  52727. return null;
  52728. }
  52729. var wktType = type === 'collection' ? 'GEOMETRYCOLLECTION' : type.toUpperCase();
  52730. var data = wktType + '(' + this.extract[type].apply(this, [geometry]) + ')';
  52731. return data;
  52732. }
  52733. }
  52734. ;// CONCATENATED MODULE: ./src/common/format/index.js
  52735. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  52736. * This program are made available under the terms of the Apache License, Version 2.0
  52737. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52738. ;// CONCATENATED MODULE: ./src/common/control/TimeControlBase.js
  52739. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  52740. * This program are made available under the terms of the Apache License, Version 2.0
  52741. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52742. /**
  52743. * @class TimeControlBase
  52744. * @deprecatedclass SuperMap.TimeControlBase
  52745. * @classdesc 时间控制基类。
  52746. * @modulecategory Control
  52747. * @category Control
  52748. * @param {Object} options - 可选参数。
  52749. * @param {number} [options.speed=1] - 速度。不能小于 0,(每帧渲染的数据之间的间隔为1),设置越大速度越快。
  52750. * @param {number} [options.frequency=1000] - 刷新频率(单位 ms),服务器刷新的时间间隔。
  52751. * @param {number} [options.startTime=0] - 起始时间,必须为数字,且小于等于 endTime。如果不设置,初始化时为 0,建议设置。
  52752. * @param {number} [options.endTime] - 结束时间,必须为数字,且大于等于 startTime。如果不设置,初始化时以当前时间进行设置,建议设置。
  52753. * @param {boolean} [options.repeat=true] - 是否重复循环。
  52754. * @param {boolean} [options.reverse=false] - 是否反向。
  52755. * @usage
  52756. */
  52757. class TimeControlBase {
  52758. constructor(options) {
  52759. //设置步长,刷新频率、开始结束时间、是否循环、是否反向
  52760. var me = this;
  52761. options = options || {};
  52762. /**
  52763. * @member {number} [TimeControlBase.prototype.speed=1]
  52764. * @description 步长,必须为非负数,默认为1(表示前后两次渲染的数据之间的间隔为1)。
  52765. */
  52766. this.speed = (options.speed && options.speed >= 0) ? options.speed : 1;
  52767. /**
  52768. * @member {number} [TimeControlBase.prototype.frequency=1000]
  52769. * @description 刷新频率(单位ms),服务器刷新的时间间隔。
  52770. */
  52771. this.frequency = (options.speed && options.frequency >= 0) ? options.frequency : 1000;
  52772. /**
  52773. * @member {number} [TimeControlBase.prototype.startTime=0]
  52774. * @description 记录的起始时间,必须为数字,
  52775. * 如果不设置,初始化时为0,建议设置。
  52776. */
  52777. this.startTime = (options.startTime && options.startTime != null) ? options.startTime : 0;
  52778. /**
  52779. * @member {number} TimeControlBase.prototype.endTime
  52780. * @description 记录的结束时间,必须为数字,
  52781. * 如果不设置,初始化时以当前时间进行设置,建议设置。
  52782. */
  52783. this.endTime = (options.endTime && options.endTime != null && options.endTime >= me.startTime) ? options.endTime : +new Date();
  52784. /**
  52785. * @member {boolean} [TimeControlBase.prototype.repeat=true]
  52786. * @description 是否重复循环。
  52787. */
  52788. this.repeat = (options.repeat !== undefined) ? options.repeat : true;
  52789. /**
  52790. * @member {boolean} [TimeControlBase.prototype.reverse=false]
  52791. * @description 是否反向。
  52792. */
  52793. this.reverse = (options.reverse !== undefined) ? options.reverse : false;
  52794. /**
  52795. * @member {number} TimeControlBase.prototype.currentTime
  52796. * @description 记录近期的时间,也就是当前帧运行到的时间。
  52797. */
  52798. this.currentTime = null;
  52799. /**
  52800. * @member {number} TimeControlBase.prototype.oldTime
  52801. * @description 记录上一帧的时间,也就是之前运行到的时间。
  52802. */
  52803. this.oldTime = null;
  52804. /**
  52805. * @member {boolean} [TimeControlBase.prototype.running=false]
  52806. * @description 记录当前是否处于运行中。
  52807. */
  52808. this.running = false;
  52809. /**
  52810. * @private
  52811. * @member {Array.<string>} TimeControlBase.prototype.EVENT_TYPES
  52812. * @description 此类支持的事件类型。
  52813. *
  52814. */
  52815. this.EVENT_TYPES = ["start", "pause", "stop"];
  52816. /**
  52817. * @private
  52818. * @member {Events} TimeControlBase.prototype.events
  52819. * @description 事件
  52820. */
  52821. me.events = new Events(this, null, this.EVENT_TYPES);
  52822. me.speed = Number(me.speed);
  52823. me.frequency = Number(me.frequency);
  52824. me.startTime = Number(me.startTime);
  52825. me.endTime = Number(me.endTime);
  52826. me.startTime = Date.parse(new Date(me.startTime));
  52827. me.endTime = Date.parse(new Date(me.endTime));
  52828. //初始化当前时间
  52829. me.currentTime = me.startTime;
  52830. this.CLASS_NAME = "SuperMap.TimeControlBase";
  52831. }
  52832. /**
  52833. * @function TimeControlBase.prototype.updateOptions
  52834. * @description 更新参数。
  52835. * @param {Object} options - 设置参数的可选参数。设置步长,刷新频率、开始结束时间、是否循环、是否反向。
  52836. */
  52837. updateOptions(options) {
  52838. //设置步长,刷新频率、开始结束时间、是否循环、是否反向
  52839. var me = this;
  52840. options = options || {};
  52841. if (options.speed && options.speed >= 0) {
  52842. me.speed = options.speed;
  52843. me.speed = Number(me.speed);
  52844. }
  52845. if (options.speed && options.frequency >= 0) {
  52846. me.frequency = options.frequency;
  52847. me.frequency = Number(me.frequency);
  52848. }
  52849. if (options.startTime && options.startTime != null) {
  52850. me.startTime = options.startTime;
  52851. me.startTime = Date.parse(new Date(me.startTime));
  52852. }
  52853. if (options.endTime && options.endTime != null && options.endTime >= me.startTime) {
  52854. me.endTime = options.endTime;
  52855. me.endTime = Date.parse(new Date(me.endTime));
  52856. }
  52857. if (options.repeat != null) {
  52858. me.repeat = options.repeat;
  52859. }
  52860. if (options.reverse != null) {
  52861. me.reverse = options.reverse;
  52862. }
  52863. }
  52864. /**
  52865. * @function TimeControlBase.prototype.start
  52866. * @description 开始。
  52867. */
  52868. start() {
  52869. var me = this;
  52870. if (!me.running) {
  52871. me.running = true;
  52872. me.tick();
  52873. me.events.triggerEvent('start', me.currentTime);
  52874. }
  52875. }
  52876. /**
  52877. * @function TimeControlBase.prototype.pause
  52878. * @description 暂停。
  52879. */
  52880. pause() {
  52881. var me = this;
  52882. me.running = false;
  52883. me.events.triggerEvent('pause', me.currentTime);
  52884. }
  52885. /**
  52886. * @function TimeControlBase.prototype.stop
  52887. * @description 停止,停止后返回起始状态。
  52888. */
  52889. stop() {
  52890. var me = this;
  52891. //停止时 时间设置为开始时间
  52892. me.currentTime = me.startTime;
  52893. //如果正在运行,修改为初始时间即可绘制一帧
  52894. if (me.running) {
  52895. me.running = false;
  52896. }
  52897. me.events.triggerEvent('stop', me.currentTime);
  52898. }
  52899. /**
  52900. * @function TimeControlBase.prototype.toggle
  52901. * @description 开关切换,切换的是开始和暂停。
  52902. */
  52903. toggle() {
  52904. var me = this;
  52905. if (me.running) {
  52906. me.pause();
  52907. } else {
  52908. me.start();
  52909. }
  52910. }
  52911. /**
  52912. * @function TimeControlBase.prototype.setSpeed
  52913. * @description 设置步长。
  52914. * @param {number} [speed=1] - 步长,必须为非负数。
  52915. * @returns {boolean} true 代表设置成功,false 设置失败(speed 小于 0 时失败)。
  52916. */
  52917. setSpeed(speed) {
  52918. var me = this;
  52919. if (speed >= 0) {
  52920. me.speed = speed;
  52921. return true;
  52922. }
  52923. return false;
  52924. }
  52925. /**
  52926. * @function TimeControlBase.prototype.getSpeed
  52927. * @description 获取步长。
  52928. * @returns {number} 返回当前的步长。
  52929. */
  52930. getSpeed() {
  52931. return this.speed;
  52932. }
  52933. /**
  52934. * @function TimeControlBase.prototype.setFrequency
  52935. * @description 设置刷新频率。
  52936. * @param {number} [frequency=1000] - 刷新频率,单位为 ms。
  52937. * @returns {boolean} true 代表设置成功,false 设置失败(frequency 小于 0 时失败)。
  52938. */
  52939. setFrequency(frequency) {
  52940. var me = this;
  52941. if (frequency >= 0) {
  52942. me.frequency = frequency;
  52943. return true;
  52944. }
  52945. return false;
  52946. }
  52947. /**
  52948. * @function TimeControlBase.prototype.getFrequency
  52949. * @description 获取刷新频率。
  52950. * @returns {number} 返回当前的刷新频率。
  52951. */
  52952. getFrequency() {
  52953. return this.frequency;
  52954. }
  52955. /**
  52956. * @function TimeControlBase.prototype.setStartTime
  52957. * @description 设置起始时间,设置完成后如果当前时间小于起始时间,则从起始时间开始。
  52958. * @param {number} startTime - 需要设置的起始时间。
  52959. * @returns {boolean} true 代表设置成功,false 设置失败(startTime 大于结束时间时失败)。
  52960. */
  52961. setStartTime(startTime) {
  52962. var me = this;
  52963. startTime = Date.parse(new Date(startTime));
  52964. //起始时间不得大于结束时间
  52965. if (startTime > me.endTime) {
  52966. return false;
  52967. }
  52968. me.startTime = startTime;
  52969. //如果当前时间小于了起始时间,则从当前起始时间开始
  52970. if (me.currentTime < me.startTime) {
  52971. me.currentTime = me.startTime;
  52972. me.tick();
  52973. }
  52974. return true;
  52975. }
  52976. /**
  52977. * @function TimeControlBase.prototype.getStartTime
  52978. * @description 获取起始时间。
  52979. * @returns {number} 返回当前的起始时间。
  52980. */
  52981. getStartTime() {
  52982. return this.startTime;
  52983. }
  52984. /**
  52985. * @function TimeControlBase.prototype.setEndTime
  52986. * @description 设置结束时间,设置完成后如果当前时间大于结束,则从起始时间开始。
  52987. * @param {number} endTime - 需要设置的结束时间。
  52988. * @returns {boolean} true 代表设置成功,false 设置失败(endTime 小于开始时间时失败)。
  52989. */
  52990. setEndTime(endTime) {
  52991. var me = this;
  52992. me.endTime = Date.parse(new Date(me.endTime));
  52993. //结束时间不得小于开始时间
  52994. if (endTime < me.startTime) {
  52995. return false;
  52996. }
  52997. me.endTime = endTime;
  52998. //如果当前时间大于了结束时间,则从起始时间开始
  52999. if (me.currentTime >= me.endTime) {
  53000. me.currentTime = me.startTime;
  53001. me.tick();
  53002. }
  53003. return true;
  53004. }
  53005. /**
  53006. * @function TimeControlBase.prototype.getEndTime
  53007. * @description 获取结束时间。
  53008. * @returns {number} 返回当前的结束时间。
  53009. */
  53010. getEndTime() {
  53011. return this.endTime;
  53012. }
  53013. /**
  53014. * @function TimeControlBase.prototype.setCurrentTime
  53015. * @description 设置当前时间。
  53016. * @param {number} currentTime - 需要设置的当前时间。
  53017. * @returns {boolean} true 代表设置成功,false 设置失败。
  53018. */
  53019. setCurrentTime(currentTime) {
  53020. var me = this;
  53021. me.currentTime = Date.parse(new Date(me.currentTime));
  53022. //结束时间不得小于开始时间
  53023. if (currentTime >= me.startTime && currentTime <= me.endTime) {
  53024. me.currentTime = currentTime;
  53025. me.startTime = me.currentTime;
  53026. me.tick();
  53027. return true;
  53028. }
  53029. return false;
  53030. }
  53031. /**
  53032. * @function TimeControlBase.prototype.getCurrentTime
  53033. * @description 获取当前时间。
  53034. * @returns {number} 返回当前时间。
  53035. */
  53036. getCurrentTime() {
  53037. return this.currentTime;
  53038. }
  53039. /**
  53040. * @function TimeControlBase.prototype.setRepeat
  53041. * @description 设置是否重复循环。
  53042. * @param {boolean} [repeat=true] - 是否重复循环。
  53043. */
  53044. setRepeat(repeat) {
  53045. this.repeat = repeat;
  53046. }
  53047. /**
  53048. * @function TimeControlBase.prototype.getRepeat
  53049. * @description 获取是否重复循环,默认是 true。
  53050. * @returns {boolean} 返回是否重复循环。
  53051. */
  53052. getRepeat() {
  53053. return this.repeat;
  53054. }
  53055. /**
  53056. * @function TimeControlBase.prototype.setReverse
  53057. * @description 设置是否反向。
  53058. * @param {boolean} [reverse=false] - 是否反向。
  53059. */
  53060. setReverse(reverse) {
  53061. this.reverse = reverse;
  53062. }
  53063. /**
  53064. * @function TimeControlBase.prototype.getReverse
  53065. * @description 获取是否反向,默认是false。
  53066. * @returns {boolean} 返回是否反向。
  53067. */
  53068. getReverse() {
  53069. return this.reverse;
  53070. }
  53071. /**
  53072. * @function TimeControlBase.prototype.getRunning
  53073. * @description 获取运行状态。
  53074. * @returns {boolean} true 代表正在运行,false 发表没有运行。
  53075. */
  53076. getRunning() {
  53077. return this.running;
  53078. }
  53079. /**
  53080. * @function TimeControlBase.prototype.destroy
  53081. * @description 销毁 Animator 对象,释放资源。
  53082. */
  53083. destroy() {
  53084. var me = this;
  53085. me.speed = null;
  53086. me.frequency = null;
  53087. me.startTime = null;
  53088. me.endTime = null;
  53089. me.currentTime = null;
  53090. me.repeat = null;
  53091. me.running = false;
  53092. me.reverse = null;
  53093. }
  53094. tick() {
  53095. //TODO 每次刷新执行的操作。子类实现
  53096. }
  53097. }
  53098. ;// CONCATENATED MODULE: ./src/common/control/TimeFlowControl.js
  53099. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53100. * This program are made available under the terms of the Apache License, Version 2.0
  53101. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53102. /**
  53103. * @class TimeFlowControl
  53104. * @deprecatedclass SuperMap.TimeFlowControl
  53105. * @category Control
  53106. * @classdesc 时间管理类。此类只负责时间上的控制,具体执行的操作需要用户在初始化时的回调函数内部进行实现。
  53107. * 如设置起始时间为 1000,结束时间是 2000,步长设置为 1,
  53108. * 那么表示按照每次1年(可以通过 setSpeed 进行修改)的变化从公元 1000 年开始到公元 2000 年为止,默认每 1 秒会变化 1 次(通过 setFrequency 修改)
  53109. * @modulecategory Control
  53110. * @extends {TimeControlBase}
  53111. * @param {function} callback - 每次刷新回调函数。具体的效果需要用户在此回调函数里面实现。
  53112. * @param {Object} options - 可选参数。
  53113. * @param {number} [options.speed=1] - 步长(单位 ms)。不能小于 0,(每次刷新的数据之间的间隔为 1ms)。
  53114. * @param {number} [options.frequency=1000] - 刷新频率(单位 ms)。
  53115. * @param {number} [options.startTime=0] - 起始时间,必须为数字,且小于等于 endTime。如果不设置,初始化时为 0,建议设置。
  53116. * @param {number} [options.endTime] - 结束时间,必须为数字,且大于等于 startTime。如果不设置,初始化时使用 new Date() 以当前时间进行设置,建议设置。
  53117. * @param {boolean} [options.repeat=true] - 是否重复循环。
  53118. * @param {boolean} [options.reverse=false] - 是否反向。
  53119. * @usage
  53120. */
  53121. class TimeFlowControl extends TimeControlBase {
  53122. constructor(callback, options) {
  53123. super(options);
  53124. var me = this;
  53125. /**
  53126. * @member TimeFlowControl.prototype.callback -{function}
  53127. * @description 每次刷新执行的回调函数。
  53128. */
  53129. me.callback = callback;
  53130. //先让IE下支持bind方法
  53131. if (!Function.prototype.bind) {
  53132. Function.prototype.bind = function (oThis) {
  53133. if (typeof this !== "function") {
  53134. throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
  53135. }
  53136. var aArgs = Array.prototype.slice.call(arguments, 1),
  53137. fToBind = this,
  53138. fNOP = function () {
  53139. //empty Function
  53140. },
  53141. fBound = function () {
  53142. return fToBind.apply(this instanceof fNOP && oThis
  53143. ? this
  53144. : oThis,
  53145. aArgs.concat(Array.prototype.slice.call(arguments)));
  53146. };
  53147. fNOP.prototype = this.prototype;
  53148. fBound.prototype = new fNOP();
  53149. return fBound;
  53150. };
  53151. }
  53152. //保证 this.tick 的上下文还是 TimeControl 这个对象
  53153. me.update = me.update.bind(me);
  53154. me.oldTime = me.currentTime;
  53155. me.CLASS_NAME = "SuperMap.TimeFlowControl";
  53156. }
  53157. /**
  53158. * @function TimeFlowControl.prototype.updateOptions
  53159. * @override
  53160. */
  53161. updateOptions(options) {
  53162. options = options || {};
  53163. super.updateOptions(options);
  53164. }
  53165. /**
  53166. * @function TimeFlowControl.prototype.start
  53167. * @override
  53168. */
  53169. start() {
  53170. var me = this;
  53171. if (me.running) {
  53172. return;
  53173. }
  53174. me.running = true;
  53175. if (me.reverse) {
  53176. if (me.currentTime === me.startTime) {
  53177. me.oldTime = me.endTime;
  53178. me.currentTime = me.oldTime;
  53179. }
  53180. } else {
  53181. if (me.oldTime === me.endTime) {
  53182. me.currentTime = me.startTime;
  53183. me.oldTime = me.currentTime;
  53184. }
  53185. }
  53186. me.tick();
  53187. }
  53188. /**
  53189. * @function TimeFlowControl.prototype.stop
  53190. * @override
  53191. */
  53192. stop() {
  53193. super.stop();
  53194. var me = this;
  53195. me.oldTime = me.currentTime;
  53196. if (me.running) {
  53197. me.running = false;
  53198. }
  53199. //清除定时tick
  53200. me.intervalId && window.clearTimeout(me.intervalId);
  53201. }
  53202. /**
  53203. * @function TimeFlowControl.prototype.destroy
  53204. * @override
  53205. */
  53206. destroy() {
  53207. super.destroy();
  53208. var me = this;
  53209. me.oldTime = null;
  53210. me.callback = null;
  53211. }
  53212. /**
  53213. * @function TimeFlowControl.prototype.tick
  53214. * @description 定时刷新。
  53215. */
  53216. tick() {
  53217. var me = this;
  53218. me.intervalId && window.clearInterval(me.intervalId);
  53219. me.intervalId = null;
  53220. me.update();
  53221. me.intervalId = window.setInterval(me.update, me.frequency);
  53222. }
  53223. /**
  53224. * @function TimeFlowControl.prototype.update
  53225. * @description 更新控件。
  53226. */
  53227. update() {
  53228. var me = this;
  53229. //判定是否还需要继续
  53230. if (!me.running) {
  53231. return;
  53232. }
  53233. //调用回调函数
  53234. me.callback && me.callback(me.currentTime); //destroy之后callback就为空,所以需要判定一下
  53235. if (!me.reverse) {
  53236. //如果相等,则代表上一帧已经运行到了最后,下一帧运行初始化的状态
  53237. if (me.currentTime === me.endTime) {
  53238. //不循环时
  53239. if (!me.repeat) {
  53240. me.running = false;
  53241. me.stop();
  53242. return null;
  53243. }
  53244. me.stop();
  53245. me.currentTime = me.startTime;
  53246. me.oldTime = me.currentTime;
  53247. me.start();
  53248. } else {//否则时间递增
  53249. me.oldTime = me.currentTime;
  53250. me.currentTime += me.speed;
  53251. }
  53252. if (me.currentTime >= me.endTime) {
  53253. me.currentTime = me.endTime;
  53254. }
  53255. } else {
  53256. //如果相等,则代表上一帧已经运行到了最前,下一帧运行结束的状态
  53257. if (me.currentTime === me.startTime) {
  53258. //不循环时
  53259. if (!me.repeat) {
  53260. me.running = false;
  53261. return null;
  53262. }
  53263. me.oldTime = me.endTime;
  53264. me.currentTime = me.oldTime;
  53265. } else {//否则时间递减
  53266. me.currentTime = me.oldTime;
  53267. me.oldTime -= me.speed;
  53268. }
  53269. if (me.oldTime <= me.startTime) {
  53270. me.oldTime = me.startTime;
  53271. }
  53272. }
  53273. }
  53274. }
  53275. ;// CONCATENATED MODULE: ./src/common/control/index.js
  53276. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53277. * This program are made available under the terms of the Apache License, Version 2.0
  53278. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53279. ;// CONCATENATED MODULE: ./src/common/iManager/iManagerServiceBase.js
  53280. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53281. * This program are made available under the terms of the Apache License, Version 2.0
  53282. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53283. /**
  53284. * @class IManagerServiceBase
  53285. * @aliasclass iManagerServiceBase
  53286. * @deprecatedclass SuperMap.iManagerServiceBase
  53287. * @classdesc iManager 服务基类(有权限限制的类需要实现此类)。
  53288. * @category iManager
  53289. * @param {string} url - iManager 首页地址,如:http://localhost:8390/imanager。
  53290. * @param {Object} options - 可选参数。
  53291. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  53292. * @param {Object} [options.headers] - 请求头。
  53293. * @usage
  53294. */
  53295. class IManagerServiceBase {
  53296. constructor(url,options) {
  53297. if (url) {
  53298. var end = url.substr(url.length - 1, 1);
  53299. this.serviceUrl = end === "/" ? url.substr(0, url.length - 2) : url;
  53300. }
  53301. this.options = options || {};
  53302. this.CLASS_NAME = "SuperMap.iManagerServiceBase";
  53303. }
  53304. /**
  53305. * @function IManagerServiceBase.prototype.request
  53306. * @description 子类统一通过该方法发送请求。
  53307. * @param {string} url - 请求 URL。
  53308. * @param {string} [method='GET'] - 请求类型。
  53309. * @param {Object} [requestOptions] - 请求选项。
  53310. * @param {Object} param - 请求参数。
  53311. * @description 发送请求。
  53312. * @returns {Promise} Promise 对象。
  53313. */
  53314. request(method, url, param, requestOptions) {
  53315. requestOptions = requestOptions || {
  53316. headers: {
  53317. 'Accept': '*/*',
  53318. 'Content-Type': 'application/json'
  53319. }
  53320. };
  53321. if (!requestOptions.hasOwnProperty("withCredentials")) {
  53322. requestOptions['withCredentials'] = true;
  53323. }
  53324. requestOptions['crossOrigin'] = this.options.crossOrigin;
  53325. requestOptions['headers'] = this.options.headers;
  53326. var token = SecurityManager.imanagerToken;
  53327. if (token) {
  53328. if (!requestOptions.headers) {
  53329. requestOptions.headers = [];
  53330. }
  53331. requestOptions.headers['X-Auth-Token'] = token;
  53332. }
  53333. if (param) {
  53334. param = JSON.stringify(param);
  53335. }
  53336. return FetchRequest.commit(method, url, param, requestOptions).then(function (response) {
  53337. return response.json();
  53338. });
  53339. }
  53340. }
  53341. ;// CONCATENATED MODULE: ./src/common/iManager/iManagerCreateNodeParam.js
  53342. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53343. * This program are made available under the terms of the Apache License, Version 2.0
  53344. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53345. /**
  53346. * @class IManagerCreateNodeParam
  53347. * @aliasclass iManagerCreateNodeParam
  53348. * @deprecatedclass SuperMap.iManagerCreateNodeParam
  53349. * @classdesc iManager 创建节点参数。
  53350. * @category iManager
  53351. * @param {Object} [params] - 节点参数。
  53352. * @usage
  53353. */
  53354. class IManagerCreateNodeParam {
  53355. constructor(params) {
  53356. params = params || {};
  53357. this.nodeSpec = 'SMALL'; //取值范围: ['SMALL','MEDIUM','LARGE'] 以及自定义的环境规格名称
  53358. this.nodeCount = 1; //要创建vm的个数
  53359. this.nodeName = ''; //vm名称
  53360. this.password = ''; //vm的密码,空表示随机分配
  53361. this.description = ''; //描述信息
  53362. this.physicalMachineName = ''; //vm所属的物理机名称.
  53363. this.ips = []; //vm的ip,空数组表示随机分配
  53364. this.userName = ''; //vm所属用户
  53365. Util_Util.extend(this, params);
  53366. }
  53367. }
  53368. ;// CONCATENATED MODULE: ./src/common/iManager/iManager.js
  53369. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53370. * This program are made available under the terms of the Apache License, Version 2.0
  53371. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53372. /**
  53373. * @class IManager
  53374. * @aliasclass iManager
  53375. * @deprecatedclass SuperMap.iManager
  53376. * @classdesc iManager 服务类。
  53377. * @category iManager
  53378. * @modulecategory Services
  53379. * @param {string} serviceUrl - iManager 首页地址。
  53380. * @usage
  53381. */
  53382. class IManager extends IManagerServiceBase {
  53383. constructor(iManagerUrl) {
  53384. super(iManagerUrl);
  53385. }
  53386. /**
  53387. * @function IManager.prototype.load
  53388. * @description 获取所有服务接口,验证是否已登录授权。
  53389. * @returns {Promise} Promise 对象。
  53390. */
  53391. load() {
  53392. return this.request("GET", this.serviceUrl + '/web/api/service.json');
  53393. }
  53394. /**
  53395. * @function IManager.prototype.createIServer
  53396. * @param {IManagerCreateNodeParam} createParam - 创建参数。
  53397. * @description 创建 iServer。
  53398. * @returns {Promise} Promise 对象。
  53399. */
  53400. createIServer(createParam) {
  53401. return this.request("POST", this.serviceUrl + '/icloud/web/nodes/server.json', new IManagerCreateNodeParam(createParam));
  53402. }
  53403. /**
  53404. * @function IManager.prototype.createIPortal
  53405. * @param {IManagerCreateNodeParam} createParam - 创建参数。
  53406. * @description 创建 iPortal。
  53407. * @returns {Promise} Promise 对象。
  53408. */
  53409. createIPortal(createParam) {
  53410. return this.request("POST", this.serviceUrl + '/icloud/web/nodes/portal.json', new IManagerCreateNodeParam(createParam));
  53411. }
  53412. /**
  53413. * @function IManager.prototype.iServerList
  53414. * @description 获取所有创建的 iServer。
  53415. * @returns {Promise} Promise 对象。
  53416. */
  53417. iServerList() {
  53418. return this.request("GET", this.serviceUrl + '/icloud/web/nodes/server.json');
  53419. }
  53420. /**
  53421. * @function IManager.prototype.iPortalList
  53422. * @description 获取所有创建的 iPortal。
  53423. * @returns {Promise} Promise 对象。
  53424. */
  53425. iPortalList() {
  53426. return this.request("GET", this.serviceUrl + '/icloud/web/nodes/portal.json');
  53427. }
  53428. /**
  53429. * @function IManager.prototype.startNodes
  53430. * @param {Array.<string>} ids - 需要启动节点的 ID 数组。e.g:['1']。
  53431. * @description 启动节点。
  53432. * @returns {Promise} Promise 对象。
  53433. */
  53434. startNodes(ids) {
  53435. return this.request("POST", this.serviceUrl + '/icloud/web/nodes/started.json', ids);
  53436. }
  53437. /**
  53438. * @function IManager.prototype.stopNodes
  53439. * @param {Array.<string>} ids - 需要停止节点的 ID 数组。e.g:['1']。
  53440. * @description 停止节点。
  53441. * @returns {Promise} Promise 对象。
  53442. */
  53443. stopNodes(ids) {
  53444. return this.request("POST", this.serviceUrl + '/icloud/web/nodes/stopped.json', ids);
  53445. }
  53446. }
  53447. ;// CONCATENATED MODULE: ./src/common/iManager/index.js
  53448. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53449. * This program are made available under the terms of the Apache License, Version 2.0
  53450. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53451. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalServiceBase.js
  53452. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53453. * This program are made available under the terms of the Apache License, Version 2.0
  53454. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53455. /**
  53456. * @class IPortalServiceBase
  53457. * @aliasclass iPortalServiceBase
  53458. * @deprecatedclass SuperMap.iPortalServiceBase
  53459. * @classdesc iPortal 服务基类(有权限限制的类需要实现此类)。
  53460. * @category iPortal/Online Core
  53461. * @param {string} url - 服务地址。
  53462. * @param {Object} options - 可选参数。
  53463. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  53464. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  53465. * @param {Object} [options.headers] - 请求头。
  53466. * @usage
  53467. */
  53468. class IPortalServiceBase {
  53469. constructor(url, options) {
  53470. options = options || {};
  53471. this.serviceUrl = url;
  53472. this.CLASS_NAME = "SuperMap.iPortalServiceBase";
  53473. this.withCredentials = options.withCredentials || false;
  53474. this.crossOrigin = options.crossOrigin
  53475. this.headers = options.headers
  53476. }
  53477. /**
  53478. * @function IPortalServiceBase.prototype.request
  53479. * @description 子类统一通过该方法发送请求。
  53480. * @param {string} [method='GET'] - 请求类型。
  53481. * @param {string} url - 服务地址。
  53482. * @param {Object} param - 请求参数。
  53483. * @param {Object} [requestOptions] - fetch 请求配置项。
  53484. * @returns {Promise} 返回包含请求结果的 Promise 对象。
  53485. */
  53486. request(method, url, param, requestOptions = {headers: this.headers, crossOrigin: this.crossOrigin, withCredentials: this.withCredentials }) {
  53487. url = SecurityManager.appendCredential(url);
  53488. return FetchRequest.commit(method, url, param, requestOptions).then(function (response) {
  53489. return response.json();
  53490. });
  53491. }
  53492. }
  53493. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalQueryParam.js
  53494. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53495. * This program are made available under the terms of the Apache License, Version 2.0
  53496. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53497. /**
  53498. * @class IPortalQueryParam
  53499. * @aliasclass iPortalQueryParam
  53500. * @deprecatedclass SuperMap.iPortalQueryParam
  53501. * @classdesc iPortal 资源查询参数。
  53502. * @version 10.0.1
  53503. * @category iPortal/Online Resources ResourcesQuery
  53504. * @param {Object} params - 可选参数。
  53505. * @param {ResourceType} [params.resourceType] - 资源类型。
  53506. * @param {number} [params.pageSize] - 分页中每页大小。
  53507. * @param {number} [params.currentPage] - 分页页码。
  53508. * @param {OrderBy} [params.orderBy] - 排序字段。
  53509. * @param {OrderType} [params.orderType] - 根据升序还是降序过滤。
  53510. * @param {SearchType} [params.searchType] - 根据查询的范围进行过滤。
  53511. * @param {Array} [params.tags] - 标签。
  53512. * @param {Array} [params.dirIds] - 目录 ID。
  53513. * @param {Array} [params.resourceSubTypes] - 根据资源的子类型进行过滤。
  53514. * @param {AggregationTypes} [params.aggregationTypes] - 聚合查询的类型。
  53515. * @param {string} [params.text] - 搜索的关键词。
  53516. * @param {Array} [params.groupIds] - 根据群组进行过滤。
  53517. * @param {Array} [params.departmentIds] - 根据部门进行过滤。
  53518. * @usage
  53519. */
  53520. class IPortalQueryParam {
  53521. constructor(params) {
  53522. params = params || {};
  53523. this.resourceType = ""; // 空为全部 MAP SERVICE SCENE DATA INSIGHTS_WORKSPACE MAP_DASHBOARD
  53524. this.pageSize = 12; // 每页多少条
  53525. this.currentPage = 1; // 第几页
  53526. this.orderBy = "UPDATETIME"; // UPDATETIME HEATLEVEL
  53527. this.orderType = "DESC"; // DESC ASC
  53528. this.searchType = "PUBLIC"; // PUBLIC SHARETOME_RES MYDEPARTMENT_RES MYGROUP_RES MY_RES
  53529. this.tags = []; // 标签
  53530. this.dirIds = []; // 类别
  53531. this.resourceSubTypes = []; // 类型
  53532. this.aggregationTypes = []; // TAG TYPE SUBTYPE
  53533. this.text = ""; // 搜索字段
  53534. this.groupIds = []; // 群组Id过滤
  53535. this.departmentIds = []; // 部门Id过滤
  53536. Util_Util.extend(this, params);
  53537. }
  53538. }
  53539. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalQueryResult.js
  53540. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53541. * This program are made available under the terms of the Apache License, Version 2.0
  53542. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53543. /**
  53544. * @class IPortalQueryResult
  53545. * @aliasclass iPortalQueryResult
  53546. * @deprecatedclass SuperMap.iPortalQueryResult
  53547. * @classdesc iPortal 资源结果集封装类。
  53548. * @version 10.0.1
  53549. * @category iPortal/Online Resources ResourcesQuery
  53550. * @param {Object} queryResult - 可选参数。
  53551. * @param {Array} [queryResult.content] - 页面内容。
  53552. * @param {number} [queryResult.total] - 总记录数。
  53553. * @param {number} [queryResult.currentPage] - 当前第几页。
  53554. * @param {number} [queryResult.pageSize] - 每页大小。
  53555. * @param {Object} [queryResult.aggregations] - 聚合查询的结果。
  53556. * @usage
  53557. */
  53558. class IPortalQueryResult {
  53559. constructor(queryResult) {
  53560. queryResult = queryResult || {};
  53561. this.content = [];
  53562. this.total = 0;
  53563. this.currentPage = 1;
  53564. this.pageSize = 12;
  53565. this.aggregations = null;
  53566. Util_Util.extend(this, queryResult);
  53567. }
  53568. }
  53569. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalResource.js
  53570. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53571. * This program are made available under the terms of the Apache License, Version 2.0
  53572. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53573. /**
  53574. * @class IPortalResource
  53575. * @aliasclass iPortalResource
  53576. * @deprecatedclass SuperMap.iPortalResource
  53577. * @classdesc iPortal 资源详情类。
  53578. * @version 10.0.1
  53579. * @category iPortal/Online Resources
  53580. * @param {string} portalUrl - 服务地址。
  53581. * @param {Object} resourceInfo - 可选参数。
  53582. * @param {Array} [resourceInfo.authorizeSetting] - 资源的授权信息。
  53583. * @param {string} [resourceInfo.bounds] - 资源的坐标范围。
  53584. * @param {string} [resourceInfo.bounds4326] - 资源的坐标范围,转换为EPSG 4326坐标系统后的地理范围。
  53585. * @param {string} [resourceInfo.checkStatus] - 资源的审核状态,可以是:空,SUCCESSFUL,UNCHECKED,FAILED。
  53586. * @param {Date} [resourceInfo.createTime] - 资源的创建时间。
  53587. * @param {string} [resourceInfo.description] - 资源描述。
  53588. * @param {number} [resourceInfo.dirId] - 资源所在的门户目录的ID。
  53589. * @param {number} [resourceInfo.epsgCode] - 门户资源基于的坐标系的EPSG值。
  53590. * @param {number} [resourceInfo.heatLevel] - 记录资源的访问量或下载量。
  53591. * @param {string} [resourceInfo.id] - 资源存储到ElasticSearch中的文档ID。
  53592. * @param {string} [resourceInfo.name] - 资源名称。
  53593. * @param {number} [resourceInfo.personalDirId] - 资源所在的个人目录的ID。
  53594. * @param {number} [resourceInfo.resourceId] - 资源表(maps,services等)里的ID。
  53595. * @param {string} [resourceInfo.resourceSubType] - 某类资源的具体子类型。
  53596. * @param {ResourceType} [resourceInfo.resourceType] - 资源类型。
  53597. * @param {number} [resourceInfo.serviceRootUrlId] - 批量注册服务时,服务根地址的ID。
  53598. * @param {Array} [resourceInfo.tags] - 资源的标签。
  53599. * @param {string} [resourceInfo.thumbnail] - 资源的缩略图。
  53600. * @param {Date} [resourceInfo.updateTime] - 资源的更新时间。
  53601. * @param {string} [resourceInfo.userName] - 搜索的关键词。
  53602. * @param {Object} [resourceInfo.sourceJSON] - 提供了门户项目返回的所有信息。
  53603. * @extends {IPortalServiceBase}
  53604. * @usage
  53605. */
  53606. class IPortalResource extends IPortalServiceBase {
  53607. constructor(portalUrl, resourceInfo) {
  53608. super(portalUrl);
  53609. resourceInfo = resourceInfo || {};
  53610. this.authorizeSetting = [];
  53611. this.bounds = "";
  53612. this.bounds4326 = "";
  53613. this.checkStatus = "";
  53614. this.createTime = 0;
  53615. this.description = null;
  53616. this.dirId = null;
  53617. this.epsgCode = 0;
  53618. this.heatLevel = 0;
  53619. this.id = 0;
  53620. this.name = "";
  53621. this.personalDirId = null;
  53622. this.resourceId = 0;
  53623. this.resourceSubType = null;
  53624. this.resourceType = null;
  53625. this.serviceRootUrlId = null;
  53626. this.tags = null;
  53627. this.thumbnail = null;
  53628. this.updateTime = 0;
  53629. this.userName = "";
  53630. this.sourceJSON = {};//返回门户资源详细信息
  53631. Util_Util.extend(this, resourceInfo); // INSIGHTS_WORKSPACE MAP_DASHBOARD
  53632. this.resourceUrl = portalUrl + "/web/"+this.resourceType.replace("_","").toLowerCase()+"s/" + this.resourceId;
  53633. if (this.withCredentials) {
  53634. this.resourceUrl = portalUrl + "/web/mycontent/"+this.resourceType.replace("_","").toLowerCase()+"s/" + this.resourceId;
  53635. }
  53636. // if (this.id) {
  53637. // this.mapUrl = mapUrl + "/" + this.id;
  53638. // }
  53639. }
  53640. /**
  53641. * @function IPortalResource.prototype.load
  53642. * @description 加载资源信息。
  53643. * @returns {Promise} 返回 Promise 对象。如果成功,Promise 没有返回值,请求返回结果自动填充到该类的属性中;如果失败,Promise 返回值包含错误信息。
  53644. */
  53645. load() {
  53646. var me = this;
  53647. return me.request("GET", me.resourceUrl + ".json")
  53648. .then(function (resourceInfo) {
  53649. if (resourceInfo.error) {
  53650. return resourceInfo;
  53651. }
  53652. me.sourceJSON = resourceInfo;
  53653. });
  53654. }
  53655. /**
  53656. * @function IPortalResource.prototype.update
  53657. * @description 更新资源属性信息。
  53658. * @returns {Promise} 返回包含更新操作状态的 Promise 对象。
  53659. */
  53660. update() {
  53661. var resourceName = this.resourceType.replace("_","").toLowerCase();
  53662. var options = {
  53663. headers: {'Content-Type': 'application/x-www-form-urlencoded'}
  53664. };
  53665. if( resourceName === 'data') {
  53666. this.resourceUrl = this.resourceUrl + "/attributes.json";
  53667. }
  53668. var entity = JSON.stringify(this.sourceJSON);
  53669. //对服务资源进行编辑时,请求体内容只留关键字字段(目前如果是全部字段 更新返回成功 但其实没有真正的更新)
  53670. if( resourceName === 'service') {
  53671. var serviceInfo = {
  53672. authorizeSetting:this.sourceJSON.authorizeSetting,
  53673. metadata:this.sourceJSON.metadata,
  53674. tags:this.sourceJSON.tags,
  53675. thumbnail:this.sourceJSON.thumbnail,
  53676. tokenRefreshUrl:this.sourceJSON.tokenRefreshUrl
  53677. };
  53678. entity = JSON.stringify(serviceInfo);
  53679. }
  53680. return this.request("PUT", this.resourceUrl, entity, options);
  53681. }
  53682. }
  53683. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalShareParam.js
  53684. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53685. * This program are made available under the terms of the Apache License, Version 2.0
  53686. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53687. /**
  53688. * @class IPortalShareParam
  53689. * @aliasclass iPortalShareParam
  53690. * @deprecatedclass SuperMap.iPortalShareParam
  53691. * @classdesc iPortal 资源共享参数。
  53692. * @version 10.0.1
  53693. * @category iPortal/Online Resources ResourcesShare
  53694. * @param {Object} params - 可选参数。
  53695. * @param {ResourceType} [params.resourceType] - 资源类型。
  53696. * @param {Array} [params.ids] - 资源的ID数组。
  53697. * @param {IPortalShareEntity} [params.entities] - 资源的实体共享参数。
  53698. * @usage
  53699. */
  53700. class IPortalShareParam {
  53701. constructor(params) {
  53702. params = params || {};
  53703. this.ids = [];
  53704. this.entities = [];
  53705. this.resourceType = ""; // MAP SERVICE SCENE DATA INSIGHTS_WORKSPACE MAP_DASHBOARD
  53706. Util_Util.extend(this, params);
  53707. }
  53708. }
  53709. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortal.js
  53710. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53711. * This program are made available under the terms of the Apache License, Version 2.0
  53712. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53713. /**
  53714. * @class IPortal
  53715. * @aliasclass iPortal
  53716. * @deprecatedclass SuperMap.iPortal
  53717. * @classdesc 对接 SuperMap iPortal 基础服务。
  53718. * @category iPortal/Online Resources
  53719. * @modulecategory Services
  53720. * @extends {IPortalServiceBase}
  53721. * @param {string} iportalUrl - 服务地址。
  53722. * @param {Object} options - 可选参数。
  53723. * @param {boolean} [options.withCredentials] - 请求是否携带 cookie。
  53724. * @usage
  53725. */
  53726. class IPortal extends IPortalServiceBase {
  53727. constructor(iportalUrl, options) {
  53728. super(iportalUrl, options);
  53729. this.iportalUrl = iportalUrl;
  53730. options = options || {};
  53731. this.withCredentials = options.withCredentials || false;
  53732. }
  53733. /**
  53734. * @function IPortal.prototype.load
  53735. * @description 加载页面。
  53736. * @returns {Promise} 包含 iportal web 资源信息的 Promise 对象。
  53737. */
  53738. load() {
  53739. return FetchRequest.get(this.iportalUrl + "/web");
  53740. }
  53741. /**
  53742. * @function IPortal.prototype.queryResources
  53743. * @description 查询资源。
  53744. * @version 10.0.1
  53745. * @param {IPortalQueryParam} queryParams - 查询参数。
  53746. * @returns {Promise} 包含所有资源结果的 Promise 对象。
  53747. */
  53748. queryResources(queryParams) {
  53749. if (!(queryParams instanceof IPortalQueryParam)) {
  53750. return new Promise( function(resolve){
  53751. resolve(
  53752. "queryParams is not instanceof iPortalQueryParam !"
  53753. );
  53754. });
  53755. }
  53756. var me = this;
  53757. var resourceUrl = this.iportalUrl + "/gateway/catalog/resource/search.json";
  53758. queryParams.t = new Date().getTime();
  53759. return this.request("GET", resourceUrl, queryParams).then(function(result) {
  53760. var content = [];
  53761. (result.content || []).forEach(function(item) {
  53762. content.push(new IPortalResource(me.iportalUrl, item));
  53763. });
  53764. let queryResult = new IPortalQueryResult();
  53765. queryResult.content = content;
  53766. queryResult.total = result.total;
  53767. queryResult.currentPage = result.currentPage;
  53768. queryResult.pageSize = result.pageSize;
  53769. queryResult.aggregations = result.aggregations;
  53770. return queryResult;
  53771. });
  53772. }
  53773. /**
  53774. * @function IPortal.prototype.updateResourcesShareSetting
  53775. * @description 更新共享设置。
  53776. * @version 10.0.1
  53777. * @param {IPortalShareParam} shareParams - 共享的参数。
  53778. * @returns {Promise} 包含共享资源结果的 Promise 对象。
  53779. */
  53780. updateResourcesShareSetting(shareParams) {
  53781. if (!(shareParams instanceof IPortalShareParam)) {
  53782. return new Promise( function(resolve){
  53783. resolve(
  53784. "shareParams is not instanceof iPortalShareParam !"
  53785. );
  53786. });
  53787. }
  53788. var resourceUrlName = shareParams.resourceType.replace("_","").toLowerCase()+"s";
  53789. if(resourceUrlName === "datas"){
  53790. resourceUrlName = "mycontent/"+resourceUrlName;
  53791. }
  53792. var cloneShareParams = {
  53793. ids: shareParams.ids,
  53794. entities: shareParams.entities
  53795. }
  53796. var shareUrl = this.iportalUrl + "/web/"+resourceUrlName+"/sharesetting.json";
  53797. return this.request("PUT", shareUrl, JSON.stringify(cloneShareParams)).then(function(result) {
  53798. return result;
  53799. });
  53800. }
  53801. }
  53802. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalShareEntity.js
  53803. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53804. * This program are made available under the terms of the Apache License, Version 2.0
  53805. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53806. /**
  53807. * @class IPortalShareEntity
  53808. * @aliasclass iPortalShareEntity
  53809. * @deprecatedclass SuperMap.iPortalShareEntity
  53810. * @classdesc iPortal 资源共享实体参数。
  53811. * @version 10.0.1
  53812. * @category iPortal/Online Resources ResourcesShare
  53813. * @param {Object} shareEntity - 可选参数。
  53814. * @param {PermissionType} [shareEntity.permissionType] - 权限类型。
  53815. * @param {EntityType} [shareEntity.entityType] - 实体类型。
  53816. * @param {string} [shareEntity.entityName] - 实体 Name。对应的 USER(用户)、ROLE(角色)、GROUP(用户组)、IPORTALGROUP(群组)的名称。
  53817. * @param {number} [shareEntity.entityId] - 实体的 ID。用于群组的授权。
  53818. * @usage
  53819. */
  53820. class IPortalShareEntity {
  53821. constructor(shareEntity) {
  53822. shareEntity = shareEntity || {};
  53823. this.permissionType = ""; // SEARCH READ READWRITE DOWNLOAD
  53824. this.entityType = ""; // USER DEPARTMENT IPORTALGROUP
  53825. this.entityName = "GUEST"; // GUEST or 具体用户 name
  53826. this.entityId = null;
  53827. Util_Util.extend(this, shareEntity);
  53828. }
  53829. }
  53830. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalAddResourceParam.js
  53831. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53832. * This program are made available under the terms of the Apache License, Version 2.0
  53833. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53834. /**
  53835. * @class IPortalAddResourceParam
  53836. * @aliasclass iPortalAddResourceParam
  53837. * @deprecatedclass SuperMap.iPortalAddResourceParam
  53838. * @classdesc iPortal 添加资源参数。
  53839. * @version 10.0.1
  53840. * @category iPortal/Online Resources ResourcesShare
  53841. * @param {Object} params - 可选参数。
  53842. * @param {string} [params.rootUrl] - 服务地址。
  53843. * @param {Array} [params.tags] - 标签。
  53844. * @param {IPortalShareEntity} [params.entities] - 资源的实体共享参数。
  53845. * @usage
  53846. */
  53847. class IPortalAddResourceParam {
  53848. constructor(params) {
  53849. params = params || {};
  53850. this.rootUrl = "";
  53851. this.tags = [];
  53852. this.entities = [];
  53853. Util_Util.extend(this, params);
  53854. }
  53855. }
  53856. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalRegisterServiceParam.js
  53857. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53858. * This program are made available under the terms of the Apache License, Version 2.0
  53859. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53860. /**
  53861. * @class IPortalRegisterServiceParam
  53862. * @aliasclass iPortalRegisterServiceParam
  53863. * @deprecatedclass SuperMap.iPortalRegisterServiceParam
  53864. * @classdesc iPortal 注册服务参数。
  53865. * @version 10.0.1
  53866. * @category iPortal/Online Resources Data
  53867. * @param {Object} params - 可选参数。
  53868. * @param {string} [params.type] - 服务类型。
  53869. * @param {Array} [params.tags] - 服务标签。
  53870. * @param {IPortalShareEntity} [params.entities] - 资源的实体共享参数。
  53871. * @param {Object} [params.metadata] - 服务元信息。
  53872. * @param {Array} [params.addedMapNames] - 地图服务列表。
  53873. * @param {Array} [params.addedSceneNames] - 场景服务列表。
  53874. * @usage
  53875. */
  53876. class IPortalRegisterServiceParam {
  53877. constructor(params) {
  53878. params = params || {};
  53879. this.type = ""; // SUPERMAP_REST ARCGIS_REST WMS WFS WCS WPS WMTS OTHERS
  53880. this.tags = [];
  53881. this.entities = [];
  53882. this.metadata = {};
  53883. this.addedMapNames = [];
  53884. this.addedSceneNames = [];
  53885. Util_Util.extend(this, params);
  53886. }
  53887. }
  53888. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalAddDataParam.js
  53889. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53890. * This program are made available under the terms of the Apache License, Version 2.0
  53891. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53892. /**
  53893. * @class IPortalAddDataParam
  53894. * @aliasclass iPortalAddDataParam
  53895. * @deprecatedclass SuperMap.iPortalAddDataParam
  53896. * @classdesc iPortal 上传/注册数据所需的参数。
  53897. * @version 10.0.1
  53898. * @category iPortal/Online Resources Data
  53899. * @param {Object} params - 参数。
  53900. * @param {string} params.fileName - 文件名称。
  53901. * @param {DataItemType} params.type - 数据类型。
  53902. * @param {Array} [params.tags] - 数据的标签。
  53903. * @param {IPortalDataMetaInfoParam} [params.dataMetaInfo] - 数据元信息。
  53904. * @usage
  53905. */
  53906. class IPortalAddDataParam {
  53907. constructor(params) {
  53908. params = params || {};
  53909. this.fileName = "";
  53910. this.type = "";
  53911. this.tags = [];
  53912. this.dataMetaInfo = {};
  53913. Util_Util.extend(this, params);
  53914. }
  53915. }
  53916. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalDataMetaInfoParam.js
  53917. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53918. * This program are made available under the terms of the Apache License, Version 2.0
  53919. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53920. /**
  53921. * @class IPortalDataMetaInfoParam
  53922. * @aliasclass iPortalDataMetaInfoParam
  53923. * @deprecatedclass SuperMap.iPortalDataMetaInfoParam
  53924. * @classdesc iPortal 上传数据/注册数据元信息所需的参数。
  53925. * @version 10.0.1
  53926. * @category iPortal/Online Resources Data
  53927. * @param {Object} params - 参数。
  53928. * @param {string} params.xField - X 坐标字段。
  53929. * @param {string} params.yField - Y 坐标字段。
  53930. * @param {number} params.xIndex - x所在列(关系型存储下CSV或EXCEL数据时必填)。
  53931. * @param {number} params.yIndex - y所在列(关系型存储下CSV或EXCEL数据时必填)。
  53932. * @param {Array.<string>} [params.fieldTypes] - 设置字段类型(关系型存储下CSV或EXCEL数据时可选填)。默认类型为:WTEXT。该参数按照CSV文件字段顺序从左到右依次设置,其中默认字段类型可省略不设置。例如,CSV文件中有10个字段,如果只需设定第1,2,4个字段,可设置为['a','b',,'c']。
  53933. * @param {string} params.separator - 分隔符(关系型存储下CSV数据时必填)。
  53934. * @param {boolean} params.firstRowIsHead - 是否带表头(关系型存储下CSV数据时必填)。
  53935. * @param {boolean} params.url - HDFS注册目录地址。
  53936. * @param {IPortalDataStoreInfoParam} params.dataStoreInfo - 注册数据时的数据存储信息。
  53937. * @usage
  53938. */
  53939. class IPortalDataMetaInfoParam {
  53940. constructor(params) {
  53941. params = params || {};
  53942. this.xField = "";
  53943. this.yField = "";
  53944. this.fileEncoding = "UTF-8";
  53945. this.xIndex = 1;
  53946. this.yIndex = 1;
  53947. this.fieldTypes = [];
  53948. this.separator = "";
  53949. this.firstRowIsHead = true;
  53950. this.url = "";
  53951. this.dataStoreInfo = {};
  53952. Util_Util.extend(this, params);
  53953. }
  53954. }
  53955. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalDataStoreInfoParam.js
  53956. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53957. * This program are made available under the terms of the Apache License, Version 2.0
  53958. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53959. /**
  53960. * @class IPortalDataStoreInfoParam
  53961. * @aliasclass iPortalDataStoreInfoParam
  53962. * @deprecatedclass SuperMap.iPortalDataStoreInfoParam
  53963. * @classdesc iPortal 注册一个HBASE HDFS数据存储类。
  53964. * @version 10.0.1
  53965. * @category iPortal/Online Resources Data
  53966. * @param {Object} params - 参数。
  53967. * @param {string} params.type - 大数据文件共享类型和空间数据库类型,包括大数据文件共享HDFS 目录(HDFS)和空间数据库HBASE。
  53968. * @param {string} params.url - HDFS数据存储目录地址。
  53969. * @param {IPortalDataConnectionInfoParam} [params.connectionInfo] - HBASE空间数据库服务的连接信息。
  53970. * @usage
  53971. */
  53972. class IPortalDataStoreInfoParam {
  53973. constructor(params) {
  53974. params = params || {};
  53975. this.type = "";
  53976. this.url = "";
  53977. this.connectionInfo = {};
  53978. Util_Util.extend(this, params);
  53979. }
  53980. }
  53981. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalDataConnectionInfoParam.js
  53982. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  53983. * This program are made available under the terms of the Apache License, Version 2.0
  53984. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53985. /**
  53986. * @class IPortalDataConnectionInfoParam
  53987. * @aliasclass iPortalDataConnectionInfoParam
  53988. * @deprecatedclass SuperMap.iPortalDataConnectionInfoParam
  53989. * @classdesc iPortal HBASE数据源连接信息类。
  53990. * @version 10.0.1
  53991. * @category iPortal/Online Resources Data
  53992. * @param {Object} params - 参数。
  53993. * @param {string} params.dataBase - 数据源连接的数据库名。
  53994. * @param {string} params.server - 服务地址。
  53995. * @usage
  53996. */
  53997. class IPortalDataConnectionInfoParam {
  53998. constructor(params) {
  53999. params = params || {};
  54000. this.dataBase = "";
  54001. this.server = "";
  54002. Util_Util.extend(this, params);
  54003. }
  54004. }
  54005. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalUser.js
  54006. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  54007. * This program are made available under the terms of the Apache License, Version 2.0
  54008. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  54009. /**
  54010. * @class IPortalUser
  54011. * @aliasclass iPortalUser
  54012. * @deprecatedclass SuperMap.iPortalUser
  54013. * @classdesc iPortal 门户中用户信息的封装类。用于管理用户资源,包括可删除,添加资源。
  54014. * @version 10.0.1
  54015. * @category iPortal/Online Resources
  54016. * @param {string} iportalUrl - 服务地址。
  54017. * @extends {IPortalServiceBase}
  54018. * @usage
  54019. */
  54020. class IPortalUser extends IPortalServiceBase {
  54021. constructor(iportalUrl) {
  54022. super(iportalUrl);
  54023. this.iportalUrl = iportalUrl;
  54024. }
  54025. /**
  54026. * @function IPortalUser.prototype.deleteResources
  54027. * @description 删除资源。
  54028. * @param {Object} params - 删除资源所需的参数对象:{ids,resourceType}。
  54029. * @returns {Promise} 返回包含删除操作状态的 Promise 对象。
  54030. */
  54031. deleteResources(params) {
  54032. var resourceName = params.resourceType.replace("_","").toLowerCase();
  54033. var deleteResourceUrl = this.iportalUrl+"/web/" + resourceName +"s.json?ids=" + encodeURI(JSON.stringify(params.ids));
  54034. if( resourceName === 'data') {
  54035. deleteResourceUrl = this.iportalUrl + "/web/mycontent/datas/delete.json";
  54036. return this.request("POST", deleteResourceUrl, JSON.stringify(params.ids));
  54037. }
  54038. return this.request("DELETE", deleteResourceUrl);
  54039. }
  54040. /**
  54041. * @function IPortalUser.prototype.addMap
  54042. * @description 添加地图。
  54043. * @version 10.1.0
  54044. * @param {IPortalAddResourceParam} addMapParams - 添加地图的参数。
  54045. * @returns {Promise} 返回包含添加地图结果的 Promise 对象。
  54046. */
  54047. addMap(addMapParams) {
  54048. if (!(addMapParams instanceof IPortalAddResourceParam)) {
  54049. return this.getErrMsgPromise("addMapParams is not instanceof IPortalAddResourceParam !");
  54050. }
  54051. let cloneAddMapParams = {
  54052. rootUrl: addMapParams.rootUrl,
  54053. tags: addMapParams.tags,
  54054. authorizeSetting: addMapParams.entities
  54055. }
  54056. let addMapUrl = this.iportalUrl + "/web/maps/batchaddmaps.json";
  54057. return this.request("POST", addMapUrl, JSON.stringify(cloneAddMapParams)).then(function(result) {
  54058. return result;
  54059. });
  54060. }
  54061. /**
  54062. * @function IPortalUser.prototype.addScene
  54063. * @description 添加场景。
  54064. * @version 10.1.0
  54065. * @param {IPortalAddResourceParam} addSceneParams - 添加场景的参数。
  54066. * @returns {Promise} 返回包含添加场景结果的 Promise 对象。
  54067. */
  54068. addScene(addSceneParams) {
  54069. if (!(addSceneParams instanceof IPortalAddResourceParam)) {
  54070. return this.getErrMsgPromise("addSceneParams is not instanceof IPortalAddResourceParam !");
  54071. }
  54072. let cloneAddSceneParams = {
  54073. rootUrl: addSceneParams.rootUrl,
  54074. tags: addSceneParams.tags,
  54075. authorizeSetting: addSceneParams.entities
  54076. }
  54077. let addSceneUrl = this.iportalUrl + "/web/scenes/batchaddscenes.json";
  54078. return this.request("POST", addSceneUrl, JSON.stringify(cloneAddSceneParams)).then(function(result) {
  54079. return result;
  54080. });
  54081. }
  54082. /**
  54083. * @function IPortalUser.prototype.registerService
  54084. * @description 注册服务。
  54085. * @version 10.1.0
  54086. * @param {IPortalRegisterServiceParam} registerParams - 注册服务的参数。
  54087. * @returns {Promise} 返回包含注册服务结果的 Promise 对象。
  54088. */
  54089. registerService(registerParams) {
  54090. if(!(registerParams instanceof IPortalRegisterServiceParam)) {
  54091. return this.getErrMsgPromise("registerParams is not instanceof IPortalRegisterServiceParam !");
  54092. }
  54093. let cloneRegisterParams = {
  54094. type: registerParams.type,
  54095. tags: registerParams.tags,
  54096. authorizeSetting: registerParams.entities,
  54097. metadata: registerParams.metadata,
  54098. addedMapNames: registerParams.addedMapNames,
  54099. addedSceneNames: registerParams.addedSceneNames
  54100. }
  54101. let registerUrl = this.iportalUrl + "/web/services.json";
  54102. return this.request("POST", registerUrl, JSON.stringify(cloneRegisterParams)).then(result => {
  54103. return result;
  54104. });
  54105. }
  54106. /**
  54107. * @function IPortalUser.prototype.getErrMsgPromise
  54108. * @description 获取包含错误信息的Promise对象。
  54109. * @version 10.1.0
  54110. * @param {string} errMsg - 传入的错误信息。
  54111. * @returns {Promise} 返回包含错误信息的 Promise 对象。
  54112. */
  54113. getErrMsgPromise(errMsg) {
  54114. return new Promise(resolve => {
  54115. resolve(errMsg);
  54116. })
  54117. }
  54118. /**
  54119. * @function IPortalUser.prototype.uploadDataRequest
  54120. * @description 上传数据。
  54121. * @version 10.1.0
  54122. * @param {number} id - 上传数据的资源ID。
  54123. * @param {Object} formData - 请求体为文本数据流。
  54124. * @returns {Promise} 返回包含上传数据操作的 Promise 对象。
  54125. */
  54126. uploadDataRequest(id,formData) {
  54127. var uploadDataUrl = this.iportalUrl + "/web/mycontent/datas/"+id+"/upload.json";
  54128. return this.request("POST",uploadDataUrl,formData);
  54129. }
  54130. /**
  54131. * @function IPortalUser.prototype.addData
  54132. * @description 上传/注册数据。
  54133. * @version 10.1.0
  54134. * @param {IPortalAddDataParam} params - 上传/注册数据所需的参数。
  54135. * @param {Object} [formData] - 请求体为文本数据流(上传数据时传入)。
  54136. * @returns {Promise} 返回上传/注册数据的 Promise 对象。
  54137. */
  54138. addData(params,formData) {
  54139. if(!(params instanceof IPortalAddDataParam)){
  54140. return this.getErrMsgPromise("params is not instanceof iPortalAddDataParam !");
  54141. }
  54142. var datasUrl = this.iportalUrl + "/web/mycontent/datas.json";
  54143. var entity = {
  54144. fileName:params.fileName,
  54145. tags:params.tags,
  54146. type:params.type
  54147. };
  54148. var type = params.type.toLowerCase();
  54149. var dataMetaInfo;
  54150. if(type === "excel" || type === "csv"){
  54151. if(!(params.dataMetaInfo instanceof IPortalDataMetaInfoParam)){
  54152. return this.getErrMsgPromise("params.dataMetaInfo is not instanceof iPortalDataMetaInfoParam !");
  54153. }
  54154. dataMetaInfo = {
  54155. xField:params.dataMetaInfo.xField,
  54156. yField:params.dataMetaInfo.yField
  54157. }
  54158. if(type === 'csv') {
  54159. dataMetaInfo.fileEncoding = params.dataMetaInfo.fileEncoding
  54160. }
  54161. entity.coordType = "WGS84";
  54162. entity.dataMetaInfo = dataMetaInfo;
  54163. }else if(type === "hdfs" || type === "hbase") {
  54164. if(!(params.dataMetaInfo instanceof IPortalDataMetaInfoParam)){
  54165. return this.getErrMsgPromise("params.dataMetaInfo is not instanceof iPortalDataMetaInfoParam !");
  54166. }
  54167. if(!(params.dataMetaInfo.dataStoreInfo instanceof IPortalDataStoreInfoParam)){
  54168. return this.getErrMsgPromise("params.dataMetaInfo.dataStoreInfo is not instanceof iPortalDataStoreInfoParam !");
  54169. }
  54170. var dataStoreInfo = {
  54171. type:params.dataMetaInfo.dataStoreInfo.type
  54172. }
  54173. switch (type) {
  54174. case "hdfs":
  54175. dataStoreInfo.url = params.dataMetaInfo.dataStoreInfo.url;
  54176. dataMetaInfo = {
  54177. url: params.dataMetaInfo.url,
  54178. dataStoreInfo:dataStoreInfo
  54179. }
  54180. break;
  54181. case "hbase":
  54182. if(!(params.dataMetaInfo.dataStoreInfo.connectionInfo instanceof IPortalDataConnectionInfoParam)){
  54183. return this.getErrMsgPromise("params.dataMetaInfo.dataStoreInfo.connectionInfo is not instanceof iPortalDataConnectionInfoParam !");
  54184. }
  54185. dataStoreInfo.connectionInfo = {
  54186. dataBase:params.dataMetaInfo.dataStoreInfo.connectionInfo.dataBase,
  54187. server:params.dataMetaInfo.dataStoreInfo.connectionInfo.server,
  54188. engineType:'HBASE'
  54189. }
  54190. dataStoreInfo.datastoreType = "SPATIAL";//该字段SPATIAL表示HBASE注册
  54191. dataMetaInfo = {
  54192. dataStoreInfo:dataStoreInfo
  54193. }
  54194. break;
  54195. }
  54196. entity.dataMetaInfo = dataMetaInfo;
  54197. }
  54198. return this.request("POST",datasUrl,JSON.stringify(entity)).then(res=>{
  54199. if(type === "hdfs" || type === "hbase"){
  54200. return res;
  54201. }else {
  54202. if(res.childID) {
  54203. return this.uploadDataRequest(res.childID,formData);
  54204. }else {
  54205. return res.customResult;
  54206. }
  54207. }
  54208. })
  54209. }
  54210. /**
  54211. * @function IPortalUser.prototype.publishOrUnpublish
  54212. * @description 发布/取消发布。
  54213. * @version 10.1.0
  54214. * @param {Object} options - 发布/取消发布数据服务所需的参数。
  54215. * @param {Object} options.dataId - 数据项ID。
  54216. * @param {Object} options.serviceType - 发布的服务类型,目前支持发布的服务类型包括:RESTDATA, RESTMAP, RESTREALSPACE, RESTSPATIALANALYST。
  54217. * @param {Object} [options.dataServiceId] - 发布的服务 ID。
  54218. * @param {boolean} forPublish - 是否取消发布。
  54219. * @returns {Promise} 返回发布/取消发布数据服务的 Promise 对象。
  54220. */
  54221. publishOrUnpublish(option,forPublish){
  54222. if(!option.dataId || !option.serviceType) {
  54223. return this.getErrMsgPromise("option.dataID and option.serviceType are Required!");
  54224. }
  54225. var dataId = option.dataId;
  54226. var dataServiceId = option.dataServiceId;
  54227. var serviceType = option.serviceType;
  54228. var publishUrl = this.iportalUrl + "/web/mycontent/datas/" + dataId + "/publishstatus.json?serviceType=" + serviceType;
  54229. if (dataServiceId) {
  54230. publishUrl += "&dataServiceId=" + dataServiceId;
  54231. }
  54232. return this.request("PUT",publishUrl,JSON.stringify(forPublish)).then(res=>{
  54233. // 发起服务状态查询
  54234. if(forPublish) {
  54235. // 发布服务的结果异步处理
  54236. // var publishStateUrl = this.iportalUrl + "web/mycontent/datas/" + dataId + "/publishstatus.rjson";
  54237. if (!dataServiceId) { // 发布服务时会回传serviceIDs,发布服务之前serviceIDs为空
  54238. dataServiceId = res.customResult;
  54239. }
  54240. return dataServiceId;
  54241. }else {
  54242. // 取消发布的结果同步处理
  54243. return res;
  54244. }
  54245. });
  54246. }
  54247. /**
  54248. * @function IPortalUser.prototype.getDataPublishedStatus
  54249. * @description 查询服务状态,发起服务状态查询。
  54250. * @version 10.1.0
  54251. * @param {number} dataId - 查询服务状态的数据项ID。
  54252. * @param {string} dataServiceId - 发布的服务ID。
  54253. * @returns {Promise} 返回查询服务状态的 Promise 对象。
  54254. */
  54255. getDataPublishedStatus(dataId,dataServiceId){
  54256. var publishStateUrl = this.iportalUrl + "/web/mycontent/datas/" + dataId + "/publishstatus.json?dataServiceId="+dataServiceId+"&forPublish=true";
  54257. return this.request("GET",publishStateUrl);
  54258. }
  54259. /**
  54260. * @function IPortalUser.prototype.unPublishedDataService
  54261. * @description 取消发布。
  54262. * @version 10.1.0
  54263. * @param {Object} options - 取消发布服务具体参数。
  54264. * @param {Object} options.dataId - 数据项ID。
  54265. * @param {Object} options.serviceType - 发布的服务类型,目前支持发布的服务类型包括:RESTDATA, RESTMAP, RESTREALSPACE, RESTSPATIALANALYST。
  54266. * @param {Object} [options.dataServiceId] - 发布的服务 ID。
  54267. * @returns {Promise} 返回取消发布数据服务的 Promise 对象。
  54268. */
  54269. unPublishDataService(option){
  54270. return this.publishOrUnpublish(option,false);
  54271. }
  54272. /**
  54273. * @function IPortalUser.prototype.publishedDataService
  54274. * @description 发布数据服务。
  54275. * @version 10.1.0
  54276. * @param {Object} options - 发布数据服务具体参数。
  54277. * @param {Object} options.dataId - 数据项ID。
  54278. * @param {Object} options.serviceType - 发布的服务类型,目前支持发布的服务类型包括:RESTDATA, RESTMAP, RESTREALSPACE, RESTSPATIALANALYST。
  54279. * @param {Object} [options.dataServiceId] - 发布的服务 ID。
  54280. * @returns {Promise} 返回发布数据服务的 Promise 对象。
  54281. */
  54282. publishDataService(option){
  54283. return this.publishOrUnpublish(option,true);
  54284. }
  54285. }
  54286. ;// CONCATENATED MODULE: ./src/common/iPortal/index.js
  54287. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  54288. * This program are made available under the terms of the Apache License, Version 2.0
  54289. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  54290. ;// CONCATENATED MODULE: ./src/common/iServer/AggregationParameter.js
  54291. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  54292. * This program are made available under the terms of the Apache License, Version 2.0
  54293. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  54294. /**
  54295. * @class AggregationParameter
  54296. * @deprecatedclass SuperMap.AggregationParameter
  54297. * @classdesc 聚合查询参数设置,该参数仅支持数据来源 Elasticsearch 服务的数据服务。
  54298. * @category iServer Data FeatureResults
  54299. * @param {Object} options - 参数。
  54300. * @param {string} options.aggName - 聚合名称。
  54301. * @param {string} options.aggFieldName - 聚合字段。
  54302. * @usage
  54303. */
  54304. class AggregationParameter {
  54305. constructor(options) {
  54306. /**
  54307. * @member {string} AggregationParameter.prototype.aggName
  54308. * @description 聚合名称。
  54309. */
  54310. this.aggName = null;
  54311. /**
  54312. * @member {string} AggregationParameter.prototype.aggFieldName
  54313. * @description 聚合字段。
  54314. */
  54315. this.aggFieldName = null;
  54316. this.CLASS_NAME = 'SuperMap.AggregationParameter';
  54317. Util_Util.extend(this, options);
  54318. }
  54319. destroy() {
  54320. var me = this;
  54321. me.aggName = null;
  54322. me.aggFieldName = null;
  54323. me.aggType = null;
  54324. }
  54325. }
  54326. ;// CONCATENATED MODULE: ./src/common/iServer/BucketAggParameter.js
  54327. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  54328. * This program are made available under the terms of the Apache License, Version 2.0
  54329. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  54330. /**
  54331. * @class BucketAggParameter
  54332. * @deprecatedclass SuperMap.BucketAggParameter
  54333. * @classdesc 子聚合类查询参数设置,该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  54334. * @category iServer Data FeatureResults
  54335. * @param {Object} options - 参数。
  54336. * @param {Array.<MetricsAggParameter>} options.subAggs - 子聚合类集合。
  54337. * @extends {AggregationParameter}
  54338. * @usage
  54339. */
  54340. class BucketAggParameter extends AggregationParameter {
  54341. constructor(options) {
  54342. super();
  54343. /**
  54344. * @member {Array.<MetricsAggParameter>} BucketAggParameter.prototype.subAggs
  54345. * @description 子聚合类集合。
  54346. */
  54347. this.subAggs = null;
  54348. this.aggType = null;
  54349. this.CLASS_NAME = 'SuperMap.BucketAggParameter';
  54350. Util_Util.extend(this, options);
  54351. }
  54352. destroy() {
  54353. var me = this;
  54354. if (me.subAggs) {
  54355. me.subAggs = null;
  54356. }
  54357. }
  54358. }
  54359. ;// CONCATENATED MODULE: ./src/common/iServer/MetricsAggParameter.js
  54360. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  54361. * This program are made available under the terms of the Apache License, Version 2.0
  54362. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  54363. /**
  54364. * @class MetricsAggParameter
  54365. * @deprecatedclass SuperMap.MetricsAggParameter
  54366. * @classdesc 指标聚合查询参数类,该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  54367. * @category iServer Data FeatureResults
  54368. * @param {Object} options - 可选参数。
  54369. * @param {MetricsAggType} [options.aggType = 'avg'] - 聚合类型。
  54370. * @extends {AggregationParameter}
  54371. * @usage
  54372. */
  54373. class MetricsAggParameter extends AggregationParameter {
  54374. constructor(option) {
  54375. super();
  54376. /**
  54377. * @member {MetricsAggType} [MetricsAggParameter.prototype.aggType=MetricsAggType.AVG]
  54378. * @description 指标聚合类型。
  54379. */
  54380. this.aggType = MetricsAggType.AVG;
  54381. Util_Util.extend(this, option);
  54382. this.CLASS_NAME = 'SuperMap.MetricsAggParameter';
  54383. }
  54384. destroy() {
  54385. super.destroy();
  54386. var me = this;
  54387. me.aggType = null;
  54388. }
  54389. }
  54390. ;// CONCATENATED MODULE: ./src/common/iServer/ClipParameter.js
  54391. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  54392. * This program are made available under the terms of the Apache License, Version 2.0
  54393. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  54394. /**
  54395. * @class ClipParameter
  54396. * @deprecatedclass SuperMap.ClipParameter
  54397. * @category iServer SpatialAnalyst InterpolationAnalyst
  54398. * @classdesc 用于裁剪的参数。优先使用用户指定的裁剪区域多边形进行裁剪,也可以通过指定数据源和数据集名,从而使用指定数据集的边界多边形进行裁剪。
  54399. * @param {Object} options - 可选参数。
  54400. * @param {string} [options.clipDatasetName] - 裁剪的数据集名。
  54401. * @param {string} [options.clipDatasourceName] - 裁剪的数据集所在数据源的名字。
  54402. * @param {GeometryPolygon|L.Polygon|L.GeoJSON|ol.geom.Polygon|ol.format.GeoJSON|GeoJSONObject} [options.clipRegion] - 用户指定的裁剪区域。
  54403. * @param {boolean} [options.isClipInRegion=true] - 是否对裁剪区内的数据集进行裁剪。
  54404. * @param {boolean} [options.isExactClip=true] - 是否使用精确裁剪。
  54405. * @usage
  54406. */
  54407. class ClipParameter {
  54408. constructor(options) {
  54409. /**
  54410. * @member {string} ClipParameter.prototype.clipDatasetName
  54411. * @description 用于裁剪的数据集名,clipDatasetName 与 clipRegion 必须设置一个。
  54412. */
  54413. this.clipDatasetName = null;
  54414. /**
  54415. * @member {string} ClipParameter.prototype.clipDatasourceName
  54416. * @description 用于裁剪的数据集所在数据源的名字。当 clipRegion 不设置时起作用。
  54417. */
  54418. this.clipDatasourceName = null;
  54419. /**
  54420. * @member {GeometryPolygon|L.Polygon|L.GeoJSON|ol.geom.Polygon|ol.format.GeoJSON|GeoJSONObject} ClipParameter.prototype.clipRegion
  54421. * @description 用户指定的裁剪区域,优先使用,clipDatasetName 与 clipRegion 必须设置一个。
  54422. */
  54423. this.clipRegion = null;
  54424. /**
  54425. * @member {boolean} [ClipParameter.prototype.isClipInRegion=true]
  54426. * @description 是否对裁剪区内的数据集进行裁剪。若为 true,则对裁剪区域内的结果进行裁剪,若为 false,则对裁剪区域外的结果进行裁剪。
  54427. */
  54428. this.isClipInRegion = true;
  54429. /**
  54430. * @member {boolean} [ClipParameter.prototype.isExactClip=true]
  54431. * @description 是否使用精确裁剪。
  54432. */
  54433. this.isExactClip = null;
  54434. if (options) {
  54435. Util_Util.extend(this, options);
  54436. }
  54437. this.CLASS_NAME = "SuperMap.ClipParameter";
  54438. }
  54439. /**
  54440. * @function ClipParameter.prototype.destroy
  54441. * @description 释放资源,将引用资源的属性置空。
  54442. */
  54443. destroy() {
  54444. var me = this;
  54445. me.clipDatasetName = null;
  54446. me.clipDatasourceName = null;
  54447. me.clipRegion = null;
  54448. me.isClipInRegion = null;
  54449. me.isExactClip = null;
  54450. }
  54451. /**
  54452. * @function ClipParameter.prototype.toJSON
  54453. * @description 将 ClipParameter 对象转化为 JSON 字符串。
  54454. * @returns {string} 返回转换后的 JSON 字符串。
  54455. */
  54456. toJSON() {
  54457. return Util_Util.toJSON({
  54458. isClipInRegion: this.isClipInRegion,
  54459. clipDatasetName: this.clipDatasetName,
  54460. clipDatasourceName: this.clipDatasourceName,
  54461. isExactClip: this.isExactClip,
  54462. clipRegion: ServerGeometry.fromGeometry(this.clipRegion)
  54463. });
  54464. }
  54465. }
  54466. ;// CONCATENATED MODULE: ./src/common/iServer/GeoHashGridAggParameter.js
  54467. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  54468. * This program are made available under the terms of the Apache License, Version 2.0
  54469. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  54470. /**
  54471. * @class GeoHashGridAggParameter
  54472. * @deprecatedclass SuperMap.GeoHashGridAggParameter
  54473. * @classdesc 格网聚合查询参数类,该参数仅支持数据来源 Elasticsearch 服务的Supermap iServer的rest数据服务。
  54474. * @category iServer Data FeatureResults
  54475. * @param {Object} options - 可选参数。
  54476. * @param {number} [options.precision=5] - 精度。
  54477. * @extends {BucketAggParameter}
  54478. * @usage
  54479. */
  54480. class GeoHashGridAggParameter extends BucketAggParameter {
  54481. constructor(options) {
  54482. super();
  54483. /**
  54484. * @member {number} [GeoHashGridAggParameter.prototype.precision=5]
  54485. * @description 网格中数字的精度。
  54486. */
  54487. this.precision = 5;
  54488. Util_Util.extend(this, options);
  54489. /**
  54490. * @member {BucketAggType} [GeoHashGridAggParameter.prototype.aggType=BucketAggType.GEOHASH_GRID]
  54491. * @description 格网聚合类型。
  54492. */
  54493. this.aggType = BucketAggType.GEOHASH_GRID;
  54494. this.CLASS_NAME = 'SuperMap.GeoHashGridAggParameter';
  54495. }
  54496. destroy() {
  54497. super.destroy();
  54498. this.aggType = null;
  54499. this.precision = null;
  54500. }
  54501. /**
  54502. * @function GeoHashGridAggParameter.toJsonParameters
  54503. * @description 将对象转为 JSON 格式。
  54504. * @param param 转换对象。
  54505. * @returns {Object}
  54506. */
  54507. static toJsonParameters(param) {
  54508. var parameters = {
  54509. aggName: param.aggName,
  54510. aggFieldName: param.aggFieldName,
  54511. aggType: param.aggType,
  54512. precision: param.precision
  54513. };
  54514. return Util_Util.toJson(parameters);
  54515. }
  54516. }
  54517. ;// CONCATENATED MODULE: ./src/common/iServer/LabelMatrixCell.js
  54518. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  54519. * This program are made available under the terms of the Apache License, Version 2.0
  54520. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  54521. /**
  54522. * @class LabelMatrixCell
  54523. * @deprecatedclass SuperMap.LabelMatrixCell
  54524. * @category iServer Map Theme
  54525. * @classdesc 矩阵标签元素抽象类。该类可以包含 n*n 个矩阵标签元素,矩阵标签元素的类型可以是图片,符号,标签专题图等。
  54526. * 符号类型的矩阵标签元素类、图片类型的矩阵标签元素类和专题图类型的矩阵标签元素类均继承自该类。
  54527. * @usage
  54528. */
  54529. class LabelMatrixCell {
  54530. constructor() {
  54531. this.CLASS_NAME = "LabelMatrixCell";
  54532. }
  54533. }
  54534. ;// CONCATENATED MODULE: ./src/common/iServer/LabelImageCell.js
  54535. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  54536. * This program are made available under the terms of the Apache License, Version 2.0
  54537. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  54538. /**
  54539. * @class LabelImageCell
  54540. * @deprecatedclass SuperMap.LabelImageCell
  54541. * @category iServer Map Theme
  54542. * @classdesc 图片类型的矩阵标签元素类。该类继承自 {@link LabelMatrixCell}类,主要对矩阵标签中的专题图类型的矩阵标签元素进行设置。
  54543. * 矩阵标签专题图是标签专题图(ThemeLabel)的一种,其中矩阵标签中的填充元素又可分为图片类型({@link LabelImageCell})、
  54544. * 符号类型({@link LabelSymbolCell})、专题图类型({@link LabelThemeCell})三种,该类是这三种类型的矩阵标签元素其中的一种,
  54545. * 用于定义符号类型的矩阵标签,如符号 ID 字段名称(符号 ID 与 SuperMap 桌面产品中点、线、面符号的 ID 对应)、大小等。
  54546. * 用户在实现矩阵标签专题图时只需将定义好的矩阵标签元素赋值予 {@link ThemeLabel#matrixCells} 属性即可。matrixCells 是一个二维数组,
  54547. * 每一维可以是任意类型的矩阵标签元素组成的数组(也可是单个标签元素组成的数组,即数组中只有一个元素)。
  54548. * @extends {LabelMatrixCell}
  54549. * @param {Object} options - 可选参数。
  54550. * @param {number} [options.height=0] - 设置图片的高度,单位为毫米。
  54551. * @param {string} [options.pathField] - 设置矩阵标签元素所使用图片的路径。
  54552. * @param {number} [options.rotation=0.0] - 图片的旋转角度。逆时针方向为正方向,单位为度,精确到0.1度。
  54553. * @param {number} [options.width=0] - 设置图片的宽度,单位为毫米。
  54554. * @param {boolean} [options.sizeFixed=false] - 是否固定图片的大小。
  54555. * @usage
  54556. */
  54557. class LabelImageCell extends LabelMatrixCell {
  54558. constructor(options) {
  54559. super(options);
  54560. /**
  54561. * @member {number} LabelImageCell.prototype.height
  54562. * @description 设置图片的高度,单位为毫米。
  54563. */
  54564. this.height = 0;
  54565. /**
  54566. * @member {string} LabelImageCell.prototype.pathField
  54567. * @description 设置矩阵标签元素所使用的图片路径对应的字段名。
  54568. */
  54569. this.pathField = null;
  54570. /**
  54571. * @member {number} [LabelImageCell.prototype.rotation=0.0]
  54572. * @description 图片的旋转角度。逆时针方向为正方向,单位为度,精确到0.1度。
  54573. */
  54574. this.rotation = 0.0;
  54575. /**
  54576. * @member {number} LabelImageCell.prototype.width
  54577. * @description 设置图片的宽度,单位为毫米。
  54578. */
  54579. this.width = 0;
  54580. /**
  54581. * @member {boolean} [LabelImageCell.prototype.sizeFixed=false]
  54582. * @description 是否固定图片的大小。
  54583. */
  54584. this.sizeFixed = false;
  54585. /**
  54586. * @member {string} LabelImageCell.prototype.type
  54587. * @description 制作矩阵专题图时是必须的。
  54588. */
  54589. this.type = "IMAGE";
  54590. if (options) {
  54591. Util_Util.extend(this, options);
  54592. }
  54593. this.CLASS_NAME = "SuperMap.LabelImageCell";
  54594. }
  54595. /**
  54596. * @function LabelImageCell.prototype.destroy
  54597. * @description 释放资源,将引用资源的属性置空。
  54598. */
  54599. destroy() {
  54600. var me = this;
  54601. me.height = null;
  54602. me.pathField = null;
  54603. me.rotation = null;
  54604. me.width = null;
  54605. me.sizeFixed = null;
  54606. }
  54607. }
  54608. ;// CONCATENATED MODULE: ./src/common/iServer/LabelSymbolCell.js
  54609. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  54610. * This program are made available under the terms of the Apache License, Version 2.0
  54611. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  54612. /**
  54613. * @class LabelSymbolCell
  54614. * @deprecatedclass SuperMap.LabelSymbolCell
  54615. * @category iServer Map Theme
  54616. * @classdesc 符号类型的矩阵标签元素类。
  54617. * 该类继承自 {@link LabelMatrixCell}类,主要对矩阵标签中的专题图类型的矩阵标签元素进行设置。
  54618. * 矩阵标签专题图是标签专题图({@link ThemeLabel})的一种,其中矩阵标签中的填充元素又可分为图片类型({@link LabelImageCell})、
  54619. * 符号类型({@link LabelSymbolCell})、专题图类型({@link LabelThemeCell})三种,该类是这三种类型的矩阵标签元素其中的一种,
  54620. * 用于定义符号类型的矩阵标签,如符号 ID 字段名称(符号 ID 与 SuperMap 桌面产品中点、线、面符号的 ID 对应)、大小等。
  54621. * 用户在实现矩阵标签专题图时只需将定义好的矩阵标签元素赋值予 {@link ThemeLabel#matrixCells} 属性即可。matrixCells 属性是一个二维数组,
  54622. * 每一维可以是任意类型的矩阵标签元素组成的数组(也可是单个标签元素组成的数组,即数组中只有一个元素)。
  54623. * @extends {LabelMatrixCell}
  54624. * @param {Object} options - 参数。
  54625. * @param {ServerStyle} options.style - 获取或设置符号样式。
  54626. * @param {string} options.symbolIDField - 符号 ID 或符号 ID 所对应的字段名称。
  54627. * @usage
  54628. */
  54629. class LabelSymbolCell extends LabelMatrixCell {
  54630. constructor(options) {
  54631. super(options);
  54632. /**
  54633. * @member {ServerStyle} LabelSymbolCell.prototype.style
  54634. * @description 获取或设置符号样式—— {@link ServerStyle} 对象,包括符号大小({@link ServerStyle#markerSize})
  54635. * 和符号旋转({@link ServerStyle#markerAngle})角度,其中用于设置符号 ID 的属性({@link ServerStyle#markerSymbolID})在此处不起作用。
  54636. */
  54637. this.style = new ServerStyle();
  54638. /**
  54639. * @member {string} LabelSymbolCell.prototype.symbolIDField
  54640. * @description 获取或设置符号 ID 或符号 ID 所对应的字段名称。
  54641. */
  54642. this.symbolIDField = null;
  54643. /**
  54644. * @member {string} LabelSymbolCell.prototype.type
  54645. * @description 制作矩阵专题图时是必须的。
  54646. */
  54647. this.type = "SYMBOL";
  54648. if (options) {
  54649. Util_Util.extend(this, options);
  54650. }
  54651. this.CLASS_NAME = "SuperMap.LabelSymbolCell";
  54652. }
  54653. /**
  54654. * @function LabelSymbolCell.prototype.destroy
  54655. * @description 释放资源,将引用资源的属性置空。
  54656. */
  54657. destroy() {
  54658. var me = this;
  54659. if (me.style) {
  54660. me.style.destroy();
  54661. me.style = null;
  54662. }
  54663. me.symbolIDField = null;
  54664. }
  54665. }
  54666. ;// CONCATENATED MODULE: ./src/common/iServer/LabelThemeCell.js
  54667. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  54668. * This program are made available under the terms of the Apache License, Version 2.0
  54669. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  54670. /**
  54671. * @class LabelThemeCell
  54672. * @deprecatedclass SuperMap.LabelThemeCell
  54673. * @category iServer Map Theme
  54674. * @classdesc 专题图类型的矩阵标签元素类。
  54675. * 该类继承自 {@link LabelMatrixCell} 类,主要对矩阵标签中的专题图类型的矩阵标签元素进行设置。
  54676. * 矩阵标签专题图是标签专题图({@link ThemeLabel})的一种,其中矩阵标签中的填充元素又可分为图片类型({@link LabelImageCell})、
  54677. * 符号类型({@link LabelSymbolCell})、专题图类型({@link LabelThemeCell})三种,该类是这三种类型的矩阵标签元素其中的一种,
  54678. * 用于定义符号类型的矩阵标签,如符号 ID 字段名称(符号 ID 与 SuperMap 桌面产品中点、线、面符号的 ID 对应)、大小等。
  54679. * 用户在实现矩阵标签专题图时只需将定义好的矩阵标签元素赋值予 {@link ThemeLabel#matrixCells} 属性即可。matrixCells 属性是一个二维数组,
  54680. * 每一维可以是任意类型的矩阵标签元素组成的数组(也可是单个标签元素组成的数组,即数组中只有一个元素)。
  54681. * @extends {LabelMatrixCell}
  54682. * @param {Object} options -参数。
  54683. * @param {ThemeLabel} options.themeLabel - 作为矩阵标签元素的标签专题图类。
  54684. * @usage
  54685. */
  54686. class LabelThemeCell extends LabelMatrixCell {
  54687. constructor(options) {
  54688. super(options);
  54689. /**
  54690. * @member {ThemeLabel} LabelThemeCell.prototype.themeLabel
  54691. * @description 使用专题图对象作为矩阵标签的一个元素。
  54692. */
  54693. this.themeLabel = new ThemeLabel();
  54694. /**
  54695. * @member {string} LabelThemeCell.prototype.type
  54696. * @description 制作矩阵专题图时是必须的。
  54697. */
  54698. this.type = "THEME";
  54699. if (options) {
  54700. Util_Util.extend(this, options);
  54701. }
  54702. this.CLASS_NAME = " SuperMap.LabelThemeCell";
  54703. }
  54704. /**
  54705. * @function LabelThemeCell.prototype.destroy
  54706. * @description 释放资源,将引用资源的属性置空。
  54707. */
  54708. destroy() {
  54709. var me = this;
  54710. if (me.themeLabel) {
  54711. me.themeLabel.destroy();
  54712. me.themeLabel = null;
  54713. }
  54714. }
  54715. }
  54716. ;// CONCATENATED MODULE: ./src/common/iServer/LayerStatus.js
  54717. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  54718. * This program are made available under the terms of the Apache License, Version 2.0
  54719. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  54720. /**
  54721. * @class LayerStatus
  54722. * @deprecatedclass SuperMap.LayerStatus
  54723. * @category iServer Map TempLayersSet
  54724. * @classdesc 子图层显示参数类。该类存储了各个子图层的名字和是否可见的状态。
  54725. * @param {Object} options - 参数。
  54726. * @param {string} options.layerName - 图层名称。
  54727. * @param {boolean} [options.isVisible=true] - 图层是否可见,true 表示可见。
  54728. * @param {string} [options.displayFilter] - 图层显示 SQL 过滤条件。
  54729. * @usage
  54730. */
  54731. class LayerStatus {
  54732. constructor(options) {
  54733. /**
  54734. * @member {string} LayerStatus.prototype.layerName
  54735. * @description 获取或设置图层名称。
  54736. */
  54737. this.layerName = null;
  54738. /**
  54739. * @member {boolean} LayerStatus.prototype.isVisible
  54740. * @description 获取或设置图层是否可见,true 表示可见。
  54741. */
  54742. this.isVisible = null;
  54743. /**
  54744. * @member {string} [LayerStatus.prototype.displayFilter]
  54745. * @description 图层显示 SQL 过滤条件,如 layerStatus.displayFilter = "smid < 10",表示仅显示 smid 值小于 10 的对象。
  54746. */
  54747. this.displayFilter = null;
  54748. /**
  54749. * @member {Object} [LayerStatus.prototype.fieldValuesDisplayFilter]
  54750. * @property {Array.<number>} values - 要过滤的值。
  54751. * @property {string} fieldName - 要过滤的字段名称只支持数字类型的字段。
  54752. * @property {string} fieldValuesDisplayMode - 目前有两个 DISPLAY/DISABLE。当为 DISPLAY 时,表示只显示以上设置的相应属性值的要素,否则表示不显示以上设置的相应属性值的要素。
  54753. */
  54754. this.fieldValuesDisplayFilter = null;
  54755. if (options) {
  54756. Util_Util.extend(this, options);
  54757. }
  54758. this.CLASS_NAME = "SuperMap.LayerStatus";
  54759. }
  54760. /**
  54761. * @function LayerStatus.prototype.destroy
  54762. * @description 释放资源,将引用资源的属性置空。
  54763. */
  54764. destroy() {
  54765. var me = this;
  54766. me.layerName = null;
  54767. me.isVisible = null;
  54768. me.displayFilter = null;
  54769. }
  54770. /**
  54771. * @function LayerStatus.prototype.toJSON
  54772. * @description 生成对应的 JSON。
  54773. * @returns {Object} 对应的 JSON。
  54774. */
  54775. toJSON() {
  54776. var json = '{';
  54777. json += '"type":"UGC",';
  54778. var v = [];
  54779. if (this.layerName) {
  54780. v.push('"name":"' + this.layerName + '"');
  54781. v.push('"visible":' + this.isVisible);
  54782. }
  54783. if (this.displayFilter) {
  54784. v.push('"displayFilter":"' + this.displayFilter + '"');
  54785. }
  54786. if (this.minScale || this.minScale == 0) {
  54787. v.push('"minScale":' + this.minScale);
  54788. }
  54789. if (this.maxScale || this.maxScale == 0) {
  54790. v.push('"maxScale":' + this.maxScale);
  54791. }
  54792. if (this.fieldValuesDisplayFilter) {
  54793. v.push('"fieldValuesDisplayFilter":' + Util_Util.toJSON(this.fieldValuesDisplayFilter));
  54794. }
  54795. json += v;
  54796. json += '}';
  54797. return json;
  54798. }
  54799. }
  54800. ;// CONCATENATED MODULE: ./src/common/iServer/LinkItem.js
  54801. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  54802. * This program are made available under the terms of the Apache License, Version 2.0
  54803. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  54804. /**
  54805. * @class LinkItem
  54806. * @deprecatedclass SuperMap.LinkItem
  54807. * @constructs LinkItem
  54808. * @category iServer Data FeatureResults
  54809. * @classdesc 关联信息类。该类用于矢量数据集与外部表的关联。外部表是另一个数据集(其中纯属性数据集中没有空间几何信息)中的 DBMS 表,
  54810. * 矢量数据集与外部表可以属于不同的数据源,但数据源类型目前只支持 SQL Server 和 Oracle 类型。使用 LinkItem 时,
  54811. * 空间数据和属性数据必须满足关联条件,即主空间数据集与外部属性表之间存在关联字段。{@link LinkItem}
  54812. * 只支持左连接,UDB、PostgreSQL 和 DB2 数据源不支持 {@link LinkItem};另外,用于建立关联关系的两个表可以不在同一个数据源下。注意:<br>
  54813. * 1.使用 {@link LinkItem} 的约束条件为:空间数据和属性数据必须有关联条件,即主空间数据集与外部属性表之间存在关联字段;<br>
  54814. * 2.使用外关联表制作专题图时,所关联的字段必须设置表名,例如,如果所关联的字段为 BaseMap_R 数据集的 SmID,就要写成 BaseMap_R.SMID。
  54815. * @param {Object} options - 参数。
  54816. * @param {DatasourceConnectionInfo} options.datasourceConnectionInfo - 关联的外部数据源信息。
  54817. * @param {Array.<string>} options.foreignKeys - 主空间数据集的外键。
  54818. * @param {string} options.foreignTable - 关联的外部属性表的名称。
  54819. * @param {Array.<string>} options.linkFields - 欲保留的外部属性表的字段。
  54820. * @param {string} options.linkFilter - 与外部属性表的连接条件。
  54821. * @param {string} options.name - 此关联信息对象的名称。
  54822. * @param {Array.<string>} options.primaryKeys - 关联的外部属性表的主键。
  54823. * @example 下面以 SQL 查询说明 linkitem 的使用方法:
  54824. * function queryBySQL() {
  54825. * // 设置关联的外部数据库信息,alias表示数据库别名
  54826. * var dc = new DatasourceConnectionInfo({
  54827. * dataBase: "RelQuery",
  54828. * server: "{ip}:{port}",
  54829. * user: "sa",
  54830. * password: "map",
  54831. * driver: "SQL Server",
  54832. * connect: true,
  54833. * OpenLinkTable: false,
  54834. * alias: "RelQuery",
  54835. * engineType: EngineType.SQLPLUS,
  54836. * readOnly: false,
  54837. * exclusive: false
  54838. * });
  54839. * // 设置关联信息
  54840. * var linkItem = new LinkItem({
  54841. * datasourceConnectionInfo: dc,
  54842. * foreignKeys: ["name"],
  54843. * foreignTable: "Pop_2011",
  54844. * linkFields: ["SmID as Pid","pop"],
  54845. * name: "link",
  54846. * primatryKeys: ["name"],
  54847. * });
  54848. * // 设置查询参数,在查询参数中添加linkItem关联条件信息
  54849. * var queryParam, queryBySQLParams, queryBySQLService;
  54850. * queryParam = new FilterParameter({
  54851. * name: "Province@RelQuery",
  54852. * fields: ["SmID","name"],
  54853. * attributeFilter: "SmID<7",
  54854. * linkItems: [linkItem]
  54855. * }),
  54856. * queryBySQLParams = new QueryBySQLParameters({
  54857. * queryParams: [queryParam]
  54858. * }),
  54859. * queryBySQLService = new QueryBySQLService(url, {
  54860. * eventListeners: {
  54861. * "processCompleted": processCompleted,
  54862. * "processFailed": processFailed
  54863. * }
  54864. * });
  54865. * queryBySQLService.processAsync(queryBySQLParams);
  54866. * }
  54867. * function processCompleted(queryEventArgs) {//todo}
  54868. * function processFailed(e) {//todo}
  54869. * @usage
  54870. */
  54871. class LinkItem {
  54872. constructor(options) {
  54873. /**
  54874. * @member {DatasourceConnectionInfo} LinkItem.prototype.datasourceConnectionInfo
  54875. * @description 关联的外部数据源信息。
  54876. */
  54877. this.datasourceConnectionInfo = null;
  54878. /**
  54879. * @member {Array.<string>} LinkItem.prototype.foreignKeys
  54880. * @description 主空间数据集的外键。
  54881. */
  54882. this.foreignKeys = null;
  54883. /**
  54884. * @member {string} LinkItem.prototype.foreignTable
  54885. * @description 关联的外部属性表的名称,目前仅支持 Supermap 管理的表,即另一个矢量数据集所对应的 DBMS 表。
  54886. */
  54887. this.foreignTable = null;
  54888. /**
  54889. * @member {Array.<string>} LinkItem.prototype.linkFields
  54890. * @description 欲保留的外部属性表的字段。如果不设置字段或者设置的字段在外部属性表中不存在的话则不返回任何外部属性表的属性信息。如果欲保留的外部表字段与主表字段存在同名,则还需要指定一个不存在字段名作为外部表的字段别名。
  54891. */
  54892. this.linkFields = null;
  54893. /**
  54894. * @member {string} LinkItem.prototype.linkFilter
  54895. * @description 与外部属性表的连接条件。
  54896. */
  54897. this.linkFilter = null;
  54898. /**
  54899. * @member {string} LinkItem.prototype.name
  54900. * @description 此关联信息对象的名称。
  54901. */
  54902. this.name = null;
  54903. /**
  54904. * @member {Array.<string>} LinkItem.prototype.primaryKeys
  54905. * @description 需要关联的外部属性表的主键。
  54906. */
  54907. this.primaryKeys = null;
  54908. if (options) {
  54909. Util_Util.extend(this, options);
  54910. }
  54911. this.CLASS_NAME = "SuperMap.LinkItem";
  54912. }
  54913. /**
  54914. * @function LinkItem.prototype.destroy
  54915. * @description 释放资源,将引用资源的属性置空。
  54916. */
  54917. destroy() {
  54918. var me = this;
  54919. if (me.datasourceConnectionInfo instanceof DatasourceConnectionInfo) {
  54920. me.datasourceConnectionInfo.destroy();
  54921. me.datasourceConnectionInfo = null;
  54922. }
  54923. me.foreignKeys = null;
  54924. me.foreignTable = null;
  54925. me.linkFields = null;
  54926. me.linkFilter = null;
  54927. me.name = null;
  54928. me.primaryKeys = null;
  54929. }
  54930. }
  54931. ;// CONCATENATED MODULE: ./src/common/iServer/OverlapDisplayedOptions.js
  54932. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  54933. * This program are made available under the terms of the Apache License, Version 2.0
  54934. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  54935. /**
  54936. * @class OverlapDisplayedOptions
  54937. * @deprecatedclass SuperMap.OverlapDisplayedOptions
  54938. * @category iServer Map Layer
  54939. * @classdesc 地图压盖过滤显示选项。在文本或专题图元素显示较密集的区域,文本之间或专题元素之间会发生相互压盖的现象,
  54940. * 该类可以分别控制各种类型的对象的压盖显示情况,进而很好地处理地图中各种类型对象的压盖显示问题。
  54941. * @param {Object} options - 可选参数。
  54942. * @param {boolean} [options.allowPointOverlap=true] - 点和点压盖时是否显示压盖的点对象。
  54943. * @param {boolean} [options.allowPointWithTextDisplay=true] - 标签和相应普通图层上的点是否一起过滤显示,如果过滤显示,
  54944. * 只以图层集合中对应数据集的索引最小的图层的点风格来绘制点。
  54945. * @param {boolean} [options.allowTextOverlap=false] - 文本压盖时是否显示压盖的文本对象。
  54946. * @param {boolean} [options.allowTextAndPointOverlap=true] - 文本和点压盖时是否显示压盖的文本或点对象(此属性不处理文本之间的压盖和点之间的压盖)。
  54947. * @param {boolean} [options.allowThemeGraduatedSymbolOverlap=false] - 等级符号元素压盖时是否显示压盖的等级符号元素。
  54948. * @param {boolean} [options.allowThemeGraphOverlap=false] - 统计专题图元素压盖时是否显示压盖的统计专题图元素。
  54949. * @param {number} [options.horizontalOverlappedSpaceSize=0] - 两个对象之间的横向压盖间距,单位为 0.1 毫米,跟 verticalOverlappedSpaceSize 结合使用,
  54950. * 当两个对象的横向间距小于该值,且纵向间距小于 verticalOverlappedSpaceSize 时认为压盖。
  54951. * @param {number} [options.verticalOverlappedSpaceSize=0] - 两个对象之间的纵向压盖间距,单位为 0.1 毫米,跟 horizontalOverlappedSpaceSize 结合使用,
  54952. * 当两个对象的纵向间距小于该值,且横向间距小于 horizontalOverlappedSpaceSize 时认为压盖。
  54953. * @usage
  54954. */
  54955. class OverlapDisplayedOptions {
  54956. constructor(options) {
  54957. options = options || {};
  54958. /**
  54959. * @member {boolean} [OverlapDisplayedOptions.prototype.allowPointOverlap=true]
  54960. * @description 点和点压盖时是否显示压盖的点对象。
  54961. */
  54962. this.allowPointOverlap = true;
  54963. /**
  54964. * @member {boolean} [OverlapDisplayedOptions.prototype.allowPointWithTextDisplay=true]
  54965. * @description 标签和相应普通图层上的点是否一起过滤显示,如果过滤显示,
  54966. * 只以图层集合中对应数据集的索引最小的图层的点风格来绘制点。
  54967. */
  54968. this.allowPointWithTextDisplay = true;
  54969. /**
  54970. * @member {boolean} [OverlapDisplayedOptions.prototype.allowTextOverlap=false]
  54971. * @description 文本压盖时是否显示压盖的文本对象。
  54972. */
  54973. this.allowTextOverlap = false;
  54974. /**
  54975. * @member {boolean} [OverlapDisplayedOptions.prototype.allowTextAndPointOverlap=true]
  54976. * @description 文本和点压盖时是否显示压盖的文本或点对象(此属性不处理文本之间的压盖和点之间的压盖)。
  54977. */
  54978. this.allowTextAndPointOverlap = true;
  54979. /**
  54980. * @member {boolean} [OverlapDisplayedOptions.prototype.allowThemeGraduatedSymbolOverlap=false]
  54981. * @description 等级符号元素压盖时是否显示压盖的等级符号元素。
  54982. */
  54983. this.allowThemeGraduatedSymbolOverlap = false;
  54984. /**
  54985. * @member {boolean} [OverlapDisplayedOptions.prototype.allowThemeGraphOverlap=false]
  54986. * @description 统计专题图元素压盖时是否显示压盖的统计专题图元素。
  54987. */
  54988. this.allowThemeGraphOverlap = false;
  54989. /**
  54990. * @member {number} [OverlapDisplayedOptions.prototype.horizontalOverlappedSpaceSize=0]
  54991. * @description 两个对象之间的横向压盖间距,单位为0.1毫米,跟 verticalOverlappedSpaceSize 结合使用,
  54992. * 当两个对象的横向间距小于该值,且纵向间距小于 verticalOverlappedSpaceSize 时认为压盖。
  54993. */
  54994. this.horizontalOverlappedSpaceSize = 0;
  54995. /**
  54996. * @member {number} [OverlapDisplayedOptions.prototype.verticalOverlappedSpaceSize=0]
  54997. * @description 两个对象之间的纵向压盖间距,单位为0.1毫米,跟 horizontalOverlappedSpaceSize 结合使用,
  54998. * 当两个对象的纵向间距小于该值,且横向间距小于 horizontalOverlappedSpaceSize 时认为压盖。
  54999. */
  55000. this.verticalOverlappedSpaceSize = 0;
  55001. Util_Util.extend(this, options);
  55002. this.ugcLayer = new UGCLayer(options);
  55003. this.CLASS_NAME = "SuperMap.OverlapDisplayedOptions";
  55004. }
  55005. /**
  55006. * @function OverlapDisplayedOptions.prototype.destroy
  55007. * @description 释放资源,将资源的属性置空。
  55008. */
  55009. destroy() {
  55010. Util_Util.reset(this);
  55011. }
  55012. /**
  55013. * @function OverlapDisplayedOptions.prototype.fromJson
  55014. * @description 将服务端 JSON 对象转换成当前客户端对象。
  55015. * @param {Object} jsonObject - 要转换的 JSON 对象。
  55016. */
  55017. fromJson(jsonObject) {
  55018. this.ugcLayer.fromJson.apply(this, [jsonObject]);
  55019. }
  55020. /**
  55021. * @function OverlapDisplayedOptions.prototype.toServerJSONObject
  55022. * @description 转换成对应的 JSON 格式对象。
  55023. * @returns {Object} 对应的 JSON 格式对象。
  55024. */
  55025. toServerJSONObject() {
  55026. var jsonObject = this.ugcLayer.toServerJSONObject.apply(this, arguments);
  55027. return jsonObject;
  55028. }
  55029. /**
  55030. * @function OverlapDisplayedOptions.prototype.toString
  55031. * @description 转换成对应的 tileLayer 请求瓦片时 overlapDisplayedOptions 参数。
  55032. * @returns {string} 对应的 tileLayer 请求瓦片时 overlapDisplayedOptions 参数。
  55033. */
  55034. toString() {
  55035. var jsonObject = this.ugcLayer.toServerJSONObject.apply(this, arguments);
  55036. var str = "{";
  55037. for (var attr in jsonObject) {
  55038. if (jsonObject.hasOwnProperty(attr)) {
  55039. str += "'" + attr + "':" + jsonObject[attr] + ",";
  55040. }
  55041. }
  55042. str = str.substr(0, str.length - 1);
  55043. str += "}";
  55044. return str;
  55045. }
  55046. }
  55047. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayerInfoParameters.js
  55048. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  55049. * This program are made available under the terms of the Apache License, Version 2.0
  55050. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55051. /**
  55052. * @class SetLayerInfoParameters
  55053. * @deprecatedclass SuperMap.SetLayerInfoParameters
  55054. * @category iServer Map TempLayersSet
  55055. * @classdesc 设置图层信息参数类。
  55056. * @param {Object} options - 参数。
  55057. * @param {string} options.resourceID - 临时图层的资源 ID。
  55058. * @param {string} options.tempLayerName - 临时图层下的子图层名。
  55059. * @param {string} options.layerInfo - 要更新的图层信息。
  55060. * @usage
  55061. */
  55062. class SetLayerInfoParameters {
  55063. constructor(options) {
  55064. options = options || {};
  55065. /**
  55066. * @member {string} SetLayerInfoParameters.prototype.resourceID
  55067. * @description 临时图层的资源 ID。
  55068. */
  55069. this.resourceID = null;
  55070. /**
  55071. * @member {string} SetLayerInfoParameters.prototype.tempLayerName
  55072. * @description 临时图层下子图层(或者其子图层)名,如:Countries@World.3@@World。
  55073. */
  55074. this.tempLayerName = null;
  55075. /**
  55076. * @member {Object} SetLayerInfoParameters.prototype.layerInfo
  55077. * @description 要更新的图层信息(包含修改和未修改的所有字段)。该参数可以通过图层信息服务获取,然后对返回值中 subLayers.layers[i] 图层信息属性进行修改。
  55078. */
  55079. this.layerInfo = null;
  55080. Util_Util.extend(this, options);
  55081. this.CLASS_NAME = "SuperMap.SetLayerInfoParameters";
  55082. }
  55083. /**
  55084. * @function SetLayerInfoParameters.prototype.destroy
  55085. * @description 释放资源,将引用资源的属性置空。
  55086. */
  55087. destroy() {
  55088. var me = this;
  55089. me.resourceID = null;
  55090. me.tempLayerName = null;
  55091. me.layerInfo = null;
  55092. }
  55093. }
  55094. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayersInfoParameters.js
  55095. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  55096. * This program are made available under the terms of the Apache License, Version 2.0
  55097. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55098. /**
  55099. * @class SetLayersInfoParameters
  55100. * @deprecatedclass SuperMap.SetLayersInfoParameters
  55101. * @category iServer Map TempLayersSet
  55102. * @classdesc 设置图层信息参数类。
  55103. * @param {Object} options - 参数。
  55104. * @param {boolean} [options.isTempLayers=false] - 是否是临时图层。
  55105. * @param {string} options.resourceID - 临时图层资源 ID。
  55106. * @param {Object} options.layersInfo - 要更新的图层信息。
  55107. * @usage
  55108. */
  55109. class SetLayersInfoParameters {
  55110. constructor(options) {
  55111. options = options || {};
  55112. /**
  55113. * @member {boolean} [SetLayersInfoParameters.prototype.isTempLayers=false]
  55114. * @description 是否是临时图层。
  55115. */
  55116. this.isTempLayers = null;
  55117. /**
  55118. * @member {string} SetLayersInfoParameters.prototype.resourceID
  55119. * @description 临时图层资源 ID。
  55120. */
  55121. this.resourceID = null;
  55122. /**
  55123. * @member {Object} SetLayersInfoParameters.prototype.layersInfo
  55124. * @description 要更新的图层信息(包含修改和未修改的所有字段)。该参数可以通过图层信息服务获取,然后对返回值中 subLayers.layers[i] 图层信息属性进行修改。
  55125. */
  55126. this.layersInfo = null;
  55127. Util_Util.extend(this, options);
  55128. this.CLASS_NAME = "SuperMap.SetLayersInfoParameters";
  55129. }
  55130. /**
  55131. * @function SetLayersInfoParameters.prototype.destroy
  55132. * @description 释放资源,将引用资源的属性置空。
  55133. */
  55134. destroy() {
  55135. var me = this;
  55136. me.isTempLayers = null;
  55137. me.resourceID = null;
  55138. me.layersInfo = null;
  55139. }
  55140. }
  55141. ;// CONCATENATED MODULE: ./src/common/iServer/SupplyCenter.js
  55142. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  55143. * This program are made available under the terms of the Apache License, Version 2.0
  55144. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55145. /**
  55146. * @class SupplyCenter
  55147. * @deprecatedclass SuperMap.SupplyCenter
  55148. * @category iServer NetworkAnalyst Location
  55149. * @classdesc 资源供给中心类。在资源分配和选址分区分析两个功能中使用。
  55150. * @param {Object} options - 参数。
  55151. * @param {number} options.maxWeight - 最大耗费值。
  55152. * @param {number} options.nodeID - 结点 ID 号。资源供给中心必须是结点。
  55153. * @param {number} options.resourceValue - 能提供的最大服务量或商品数量。
  55154. * @param {SupplyCenterType} [options.type] - 资源供给中心点的类型常量。
  55155. * @usage
  55156. */
  55157. class SupplyCenter {
  55158. constructor(options) {
  55159. /**
  55160. * @member {number} SupplyCenter.prototype.maxWeight
  55161. * @description 资源供给中心的最大耗费值。中心点最大阻值设置越小,表示中心点所提供的资源可影响范围越大。
  55162. * 最大阻力值是用来限制需求点到中心点的花费。
  55163. * 如果需求点(弧段或结点)到此中心的花费大于最大阻力值,则该需求点不属于该资源供给中心提供资源的范围。
  55164. */
  55165. this.maxWeight = null;
  55166. /**
  55167. * @member {number} SupplyCenter.prototype.nodeID
  55168. * @description 资源供给中心点的结点 ID 号,资源供给中心必须是结点。
  55169. */
  55170. this.nodeID = null;
  55171. /**
  55172. * @member {number} SupplyCenter.prototype.resourceValue
  55173. * @description 资源供给中心能提供的最大服务量或商品数量。例如资源中心为学校,资源中心资源量表示该学校能够接纳多少学生。
  55174. */
  55175. this.resourceValue = null;
  55176. /**
  55177. * @member {SupplyCenterType} [SupplyCenter.prototype.type]
  55178. * @description 资源供给中心点的类型常量。资源供给中心点的类型包括非中心,固定中心和可选中心。
  55179. * 固定中心用于资源分配分析;固定中心和可选中心用于选址分析;非中心在两种网络分析时都不予考虑。
  55180. */
  55181. this.type = null;
  55182. if (options) {
  55183. Util_Util.extend(this, options);
  55184. }
  55185. this.CLASS_NAME = "SuperMap.SupplyCenter";
  55186. }
  55187. /**
  55188. * @function SupplyCenter.prototype.destroy
  55189. * @description 释放资源,将引用资源的属性置空。
  55190. */
  55191. destroy() {
  55192. var me = this;
  55193. me.maxWeight = null;
  55194. me.nodeID = null;
  55195. me.resourceValue = null;
  55196. me.type = null;
  55197. }
  55198. /**
  55199. * @function SupplyCenter.fromJson
  55200. * @description 将服务端 JSON 对象转换成当前客户端对象。
  55201. * @param {Object} jsonObject - 要转换的 JSON 对象。
  55202. * @returns {SupplyCenter} SupplyCenter 对象。
  55203. */
  55204. static fromJson(jsonObject) {
  55205. if (!jsonObject) {
  55206. return;
  55207. }
  55208. return new SupplyCenter({
  55209. maxWeight: jsonObject.maxWeight,
  55210. nodeID: jsonObject.nodeID,
  55211. resourceValue: jsonObject.resourceValue,
  55212. type: jsonObject.type
  55213. });
  55214. }
  55215. }
  55216. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeFlow.js
  55217. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  55218. * This program are made available under the terms of the Apache License, Version 2.0
  55219. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55220. /**
  55221. * @class ThemeFlow
  55222. * @deprecatedclass SuperMap.ThemeFlow
  55223. * @private
  55224. * @category iServer Map Theme
  55225. * @classdesc 标签或符号流动显示和牵引线风格设置类。
  55226. * 通过该类可以设置专题图中符号是否流动显示、是否使用牵引线以及牵引线风格。
  55227. * @param {Object} options - 可选参数。
  55228. * @param {boolean} [options.flowEnabled=false] - 是否流动显示标签或符号。
  55229. * @param {boolean} [options.leaderLineDisplayed=false] - 是否显示标签或符号和它标注的对象之间的牵引线。
  55230. * @param {ServerStyle} [options.leaderLineStyle] - 标签或符号与其标注对象之间牵引线的风格。
  55231. * @usage
  55232. */
  55233. class ThemeFlow {
  55234. constructor(options) {
  55235. /**
  55236. * @member {boolean} [ThemeFlow.prototype.flowEnabled=false]
  55237. * @description 是否流动显示标签或符号。<br>
  55238. * 对于标签专题图而言,对于跨越比较大的区域和线条状的几何对象,在一个地图窗口中不能完全显示的情况下,如果其标签位置比较固定,
  55239. * 在当前地图窗口中该对象的标签不可见,则需要通过平移地图来查看对象的标签信息。如果采用了流动显示的效果,在当前地图窗口中,对象即使是部分显示,
  55240. * 其标签也会显示在当前地图窗口中。当平移地图时,对象的标签会随之移动,以保证在当前地图窗口中部分或全部显示的对象其标签都可见,从而可以方便地查看各要素的标签信息。
  55241. */
  55242. this.flowEnabled = false;
  55243. /**
  55244. * @member {boolean} [ThemeFlow.prototype.leaderLineDisplayed=false]
  55245. * @description 是否显示标签或符号和它标注的对象之间的牵引线。false表示不显示标签或符号和它标注的对象之间的牵引线。<br>
  55246. * 只有当 flowEnabled 为 true 时,牵引线才起作用。在当标签流动显示时,其位置不固定,由于牵引线始终指向要素的内点,
  55247. * 因而通过牵引线显示功能可以找到流动的标签或符号实际对应的要素。或者渲染符号偏移它所指向的对象时,图与对象之间可以采用牵引线进行连接。
  55248. */
  55249. this.leaderLineDisplayed = false;
  55250. /**
  55251. * @member {ServerStyle} ThemeFlow.prototype.leaderLineStyle
  55252. * @description 标签或符号与其标注对象之间牵引线的风格。
  55253. */
  55254. this.leaderLineStyle = new ServerStyle();
  55255. if (options) {
  55256. Util_Util.extend(this, options);
  55257. }
  55258. this.CLASS_NAME = "SuperMap.ThemeFlow";
  55259. }
  55260. /**
  55261. * @function ThemeFlow.prototype.destroy
  55262. * @description 释放资源,将引用资源的属性置空。
  55263. */
  55264. destroy() {
  55265. var me = this;
  55266. me.flowEnabled = null;
  55267. me.leaderLineDisplayed = null;
  55268. if (me.leaderLineStyle) {
  55269. me.leaderLineStyle.destroy();
  55270. me.leaderLineStyle = null;
  55271. }
  55272. }
  55273. /**
  55274. * @function ThemeFlow.fromObj
  55275. * @description 从传入对象获取标签或符号流动显示和牵引线风格设置类。
  55276. * @param {Object} obj - 传入对象。
  55277. * @returns {ThemeFlow} ThemeFlow 对象。
  55278. */
  55279. static fromObj(obj) {
  55280. if (!obj) {
  55281. return;
  55282. }
  55283. var res = new ThemeFlow();
  55284. Util_Util.copy(res, obj);
  55285. res.leaderLineStyle = ServerStyle.fromJson(obj.leaderLineStyle);
  55286. return res;
  55287. }
  55288. }
  55289. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGridRangeItem.js
  55290. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  55291. * This program are made available under the terms of the Apache License, Version 2.0
  55292. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55293. /**
  55294. * @class ThemeGridRangeItem
  55295. * @deprecatedclass SuperMap.ThemeGridRangeItem
  55296. * @category iServer Map Theme
  55297. * @classdesc 栅格分段专题图子项类。在栅格分段专题图中,将栅格值按照某种分段模式被分成多个范围段。
  55298. * 本类用来设置每个范围段的分段起始值、终止值、名称和颜色等。每个分段所表示的范围为 [Start,End)。
  55299. * @param {Object} options - 参数。
  55300. * @param {ServerColor} options.color - 栅格分段专题图中每一个分段专题图子项的对应的颜色。
  55301. * @param {string} [options.caption] - 栅格分段专题图子项的标题。
  55302. * @param {number} [options.end=0] - 栅格分段专题图子项的终止值。
  55303. * @param {number} [options.start=0] - 栅格分段专题图子项的起始值。
  55304. * @param {boolean} [options.visible=true] - 栅格分段专题图子项是否可见。
  55305. * @usage
  55306. */
  55307. class ThemeGridRangeItem {
  55308. constructor(options) {
  55309. /**
  55310. * @member {string} [ThemeGridRangeItem.prototype.caption]
  55311. * @description 栅格分段专题图子项的标题。
  55312. */
  55313. this.caption = null;
  55314. /**
  55315. * @member {ServerColor} ThemeGridRangeItem.prototype.color
  55316. * @description 栅格分段专题图中每一个分段专题图子项的对应的颜色。
  55317. */
  55318. this.color = new ServerColor();
  55319. /**
  55320. * @member {number} [ThemeGridRangeItem.prototype.end=0]
  55321. * @description 栅格分段专题图子项的终止值,即该段专题值范围的最大值。
  55322. */
  55323. this.end = 0;
  55324. /**
  55325. * @member {number} [ThemeGridRangeItem.prototype.start=0]
  55326. * @description 栅格分段专题图子项的起始值,即该段专题值范围的最小值。
  55327. */
  55328. this.start = 0;
  55329. /**
  55330. * @member {boolean} [ThemeGridRangeItem.prototype.visible=true]
  55331. * @description 栅格分段专题图子项是否可见。
  55332. */
  55333. this.visible = true;
  55334. if (options) {
  55335. Util_Util.extend(this, options);
  55336. }
  55337. this.CLASS_NAME = "SuperMap.ThemeGridRangeItem";
  55338. }
  55339. /**
  55340. * @function ThemeGridRangeItem.prototype.destroy
  55341. * @description 释放资源,将引用资源的属性置空。
  55342. */
  55343. destroy() {
  55344. var me = this;
  55345. me.caption = null;
  55346. me.end = null;
  55347. me.start = null;
  55348. //需要验证是够存在destroy方法
  55349. if (me.color) {
  55350. me.color.destroy();
  55351. me.color = null;
  55352. }
  55353. me.visible = null;
  55354. }
  55355. /**
  55356. * @function ThemeGridRangeItem.prototype.toServerJSONObject
  55357. * @description 转换成对应的 JSON 格式对象。
  55358. * @returns {Object} 对应的 JSON 格式对象。
  55359. */
  55360. toServerJSONObject() {
  55361. var obj = {};
  55362. obj = Util_Util.copyAttributes(obj, this);
  55363. if (obj.color) {
  55364. if (obj.color.toServerJSONObject) {
  55365. obj.color = obj.color.toServerJSONObject();
  55366. }
  55367. }
  55368. return obj;
  55369. }
  55370. /**
  55371. * @function ThemeGridRangeItem.fromObj
  55372. * @description 从传入对象获取栅格分段专题图子项类。
  55373. * @param {Object} obj - 传入对象。
  55374. * @returns {ThemeGridRangeItem} ThemeGridRangeItem 对象。
  55375. */
  55376. static fromObj(obj) {
  55377. if (!obj) {
  55378. return;
  55379. }
  55380. var res = new ThemeGridRangeItem();
  55381. Util_Util.copy(res, obj);
  55382. res.color = ServerColor.fromJson(obj.color);
  55383. return res;
  55384. }
  55385. }
  55386. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGridRange.js
  55387. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  55388. * This program are made available under the terms of the Apache License, Version 2.0
  55389. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55390. /**
  55391. * @class ThemeGridRange
  55392. * @deprecatedclass SuperMap.ThemeGridRange
  55393. * @category iServer Map Theme
  55394. * @classdesc 栅格分段专题图。栅格分段专题图,是将所有单元格的值按照某种分段方式分成多个范围段,值在同一个范围段中的单元格使用相同的颜色进行显示。一般用来反映连续分布现象的数量或程度特征。
  55395. * 比如某年的全国降水量分布图,将各气象站点的观测值经过内插之后生成的栅格数据进行分段显示。
  55396. * 该类类似于分段专题图类,不同点在于分段专题图的操作对象是矢量数据,而栅格分段专题图的操作对象是栅格数据。
  55397. * @extends {CommonTheme}
  55398. * @param {Object} options - 参数。
  55399. * @param {Array.<ThemeGridRangeItem>} options.items - 栅格分段专题图子项数组。
  55400. * @param {boolean} [options.reverseColor=false] - 是否对栅格分段专题图中分段的颜色风格进行反序显示。
  55401. * @param {RangeMode} [options.rangeMode=RangeMode.EQUALINTERVAL] - 分段专题图的分段模式。
  55402. * @param {number} [options.rangeParameter=0] - 分段参数。
  55403. * @param {ColorGradientType} [options.colorGradientType=ColorGradientType.YELLOW_RED] - 渐变颜色枚举类。
  55404. * @usage
  55405. */
  55406. class ThemeGridRange extends Theme {
  55407. constructor(options) {
  55408. super("GRIDRANGE", options);
  55409. /**
  55410. * @member {Array.<ThemeGridRangeItem>} ThemeGridRange.prototype.items
  55411. * @description 栅格分段专题图子项数组。<br>
  55412. * 在栅格分段专题图中,将栅格值按照某种分段模式被分成多个范围段。
  55413. * 本类用来设置每个栅格范围段的分段起始值、终止值、名称和颜色等。每个分段所表示的范围为 [Start,End)。
  55414. */
  55415. this.items = null;
  55416. /**
  55417. * @member {RangeMode} [ThemeGridRange.prototype.rangeMode=RangeMode.EQUALINTERVAL]
  55418. * @description 分段专题图的分段模式。<br>
  55419. * 在栅格分段专题图中,作为专题变量的字段或表达式的值按照某种分段方式被分成多个范围段。
  55420. * 目前 SuperMap 提供的分段方式包括:等距离分段法、平方根分段法、标准差分段法、对数分段法、等计数分段法和自定义距离法,
  55421. * 显然这些分段方法根据一定的距离进行分段,因而范围分段专题图所基于的专题变量必须为数值型。
  55422. */
  55423. this.rangeMode = RangeMode.EQUALINTERVAL;
  55424. /**
  55425. * @member {number} [ThemeGridRange.prototype.rangeParameter=0]
  55426. * @description 分段参数。<br>
  55427. * 当分段模式为等距离分段法,平方根分段,对数分段法,等计数分段法其中一种模式时,该参数用于设置分段个数,必设;当分段模式为标准差分段法时,
  55428. * 该参数不起作用;当分段模式为自定义距离时,该参数用于设置自定义距离。
  55429. */
  55430. this.rangeParameter = 0;
  55431. /**
  55432. * @member {ColorGradientType} [ThemeGridRange.prototype.colorGradientType=ColorGradientType.YELLOW_RED]
  55433. * @description 渐变颜色枚举类。
  55434. *
  55435. */
  55436. this.colorGradientType = ColorGradientType.YELLOW_RED;
  55437. /**
  55438. * @member {boolean} ThemeGridRange.prototype.reverseColor
  55439. * @description 是否对栅格分段专题图中分段的颜色风格进行反序显示。
  55440. */
  55441. this.reverseColor = false;
  55442. if (options) {
  55443. Util_Util.extend(this, options);
  55444. }
  55445. this.CLASS_NAME = "SuperMap.ThemeGridRange";
  55446. }
  55447. /**
  55448. * @function ThemeGridRange.prototype.destroy
  55449. * @override
  55450. */
  55451. destroy() {
  55452. super.destroy();
  55453. var me = this;
  55454. if (me.items) {
  55455. if (me.items.length > 0) {
  55456. for (var item in me.items) {
  55457. me.items[item].destroy();
  55458. me.items[item] = null;
  55459. }
  55460. }
  55461. me.items = null;
  55462. }
  55463. me.reverseColor = null;
  55464. me.rangeMode = null;
  55465. me.rangeParameter = null;
  55466. me.colorGradientType = null;
  55467. }
  55468. /**
  55469. * @function ThemeGridRange.fromObj
  55470. * @description 从传入对象获取栅格分段专题图。
  55471. * @param {Object} obj - 传入对象。
  55472. * @returns {ThemeGridRange} ThemeGridRange 对象。
  55473. */
  55474. static fromObj(obj) {
  55475. if (!obj) {
  55476. return;
  55477. }
  55478. var res = new ThemeGridRange();
  55479. Util_Util.copy(res, obj);
  55480. var itemsR = obj.items;
  55481. var len = itemsR ? itemsR.length : 0;
  55482. res.items = [];
  55483. for (var i = 0; i < len; i++) {
  55484. res.items.push(ThemeGridRangeItem.fromObj(itemsR[i]));
  55485. }
  55486. return res;
  55487. }
  55488. }
  55489. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGridUniqueItem.js
  55490. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  55491. * This program are made available under the terms of the Apache License, Version 2.0
  55492. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55493. /**
  55494. * @class ThemeGridUniqueItem
  55495. * @deprecatedclass SuperMap.ThemeGridUniqueItem
  55496. * @category iServer Map Theme
  55497. * @classdesc 栅格单值专题图子项类。
  55498. * 栅格单值专题图是将值相同的单元格归为一类,每一类是一个专题图子项。
  55499. * @param {Object} options - 可选参数。
  55500. * @param {string} [options.caption] - 子项的名称。
  55501. * @param {ServerColor} [options.color] - 子项的显示颜色。
  55502. * @param {number} options.unique - 子项的专题值,即单元格的值,值相同的单元格位于一个子项内。
  55503. * @param {boolean} [options.visible=true] - 子项是否可见。
  55504. * @usage
  55505. */
  55506. class ThemeGridUniqueItem {
  55507. constructor(options) {
  55508. /**
  55509. * @member {string} [ThemeGridUniqueItem.prototype.caption]
  55510. * @description 栅格单值专题图子项的名称。
  55511. */
  55512. this.caption = null;
  55513. /**
  55514. * @member {ServerColor} [ThemeGridUniqueItem.prototype.color]
  55515. * @description 栅格单值专题图子项的显示颜色。
  55516. */
  55517. this.color = new ServerColor();
  55518. /**
  55519. * @member {number} ThemeGridUniqueItem.prototype.unique
  55520. * @description 栅格单值专题图子项的专题值,即单元格的值,值相同的单元格位于一个子项内。
  55521. */
  55522. this.unique = null;
  55523. /**
  55524. * @member {boolean} [ThemeGridUniqueItem.prototype.visible=true]
  55525. * @description 栅格单值专题图子项是否可见。
  55526. */
  55527. this.visible = true;
  55528. if (options) {
  55529. Util_Util.extend(this, options);
  55530. }
  55531. this.CLASS_NAME = "SuperMap.ThemeGridUniqueItem";
  55532. }
  55533. /**
  55534. * @function ThemeGridUniqueItem.prototype.destroy
  55535. * @description 释放资源,将引用资源的属性置空。
  55536. */
  55537. destroy() {
  55538. var me = this;
  55539. me.caption = null;
  55540. me.unique = null;
  55541. if (me.color) {
  55542. me.color.destroy();
  55543. me.color = null;
  55544. }
  55545. me.visible = null;
  55546. }
  55547. /**
  55548. * @function ThemeGridUniqueItem.prototype.toServerJSONObject
  55549. * @description 转换成对应的 JSON 格式对象。
  55550. * @returns {Object} 对应的 JSON 格式对象。
  55551. */
  55552. toServerJSONObject() {
  55553. var obj = {};
  55554. obj = Util_Util.copyAttributes(obj, this);
  55555. if (obj.color) {
  55556. if (obj.color.toServerJSONObject) {
  55557. obj.color = obj.color.toServerJSONObject();
  55558. }
  55559. }
  55560. return obj;
  55561. }
  55562. /**
  55563. * @function ThemeGridUniqueItem.fromObj
  55564. * @description 从传入对象获取栅格单值专题图子项类。
  55565. * @param {Object} obj - 传入对象。
  55566. * @returns {ThemeGridUniqueItem} ThemeGridUniqueItem 对象。
  55567. */
  55568. static fromObj(obj) {
  55569. var res = new ThemeGridUniqueItem();
  55570. Util_Util.copy(res, obj);
  55571. res.color = ServerColor.fromJson(obj.color);
  55572. return res;
  55573. }
  55574. }
  55575. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGridUnique.js
  55576. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  55577. * This program are made available under the terms of the Apache License, Version 2.0
  55578. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55579. /**
  55580. * @class ThemeGridUnique
  55581. * @deprecatedclass SuperMap.ThemeGridUnique
  55582. * @category iServer Map Theme
  55583. * @classdesc 栅格单值专题图类。栅格单值专题图是将单元格值相同的归为一类,为每一类设定一种颜色,从而用来区分不同的类别。
  55584. * 适用于离散栅格数据和部分连续栅格数据,对于单元格值各不相同的那些连续栅格数据,使用栅格单值专题图不具有任何意义。
  55585. * @extends {CommonTheme}
  55586. * @param {Object} options - 参数。
  55587. * @param {Array.<ThemeGridUniqueItem>} options.items - 栅格单值专题图子项数组。
  55588. * @param {ServerColor} [options.defaultcolor] - 栅格单值专题图的默认颜色。
  55589. * @usage
  55590. */
  55591. class ThemeGridUnique extends Theme {
  55592. constructor(options) {
  55593. super("GRIDUNIQUE", options);
  55594. /**
  55595. * @member {ServerColor} ThemeGridUnique.prototype.defaultcolor
  55596. * @description 栅格单值专题图的默认颜色。
  55597. * 对于那些未在格网单值专题图子项之列的要素使用该颜色显示。
  55598. */
  55599. this.defaultcolor = new ServerColor();
  55600. /**
  55601. * @member {Array.<ThemeGridUniqueItem>} ThemeGridUnique.prototype.items
  55602. * @description 栅格单值专题图子项数组。
  55603. * 栅格单值专题图将值相同的单元格归为一类,每一类是一个专题图子项。
  55604. */
  55605. this.items = null;
  55606. if (options) {
  55607. Util_Util.extend(this, options);
  55608. }
  55609. this.CLASS_NAME = "SuperMap.ThemeGridUnique";
  55610. }
  55611. /**
  55612. * @function ThemeGridUnique.prototype.destroy
  55613. * @override
  55614. */
  55615. destroy() {
  55616. super.destroy();
  55617. var me = this;
  55618. if (me.items) {
  55619. if (me.items.length > 0) {
  55620. for (var item in me.items) {
  55621. me.items[item].destroy();
  55622. me.items[item] = null;
  55623. }
  55624. }
  55625. me.items = null;
  55626. }
  55627. if (me.defaultcolor) {
  55628. me.defaultcolor.destroy();
  55629. me.defaultcolor = null;
  55630. }
  55631. }
  55632. /**
  55633. * @function ThemeGridUnique.prototype.toServerJSONObject
  55634. * @description 转换成对应的 JSON 格式对象。
  55635. * @returns {Object} 对应的 JSON 格式对象
  55636. */
  55637. toServerJSONObject() {
  55638. var obj = {};
  55639. obj = Util_Util.copyAttributes(obj, this);
  55640. if (obj.defaultcolor) {
  55641. if (obj.defaultcolor.toServerJSONObject) {
  55642. obj.defaultcolor = obj.defaultcolor.toServerJSONObject();
  55643. }
  55644. }
  55645. if (obj.items) {
  55646. var items = [],
  55647. len = obj.items.length;
  55648. for (var i = 0; i < len; i++) {
  55649. items.push(obj.items[i].toServerJSONObject());
  55650. }
  55651. obj.items = items;
  55652. }
  55653. return obj;
  55654. }
  55655. /**
  55656. * @function ThemeGridUnique.fromObj
  55657. * @description 从传入对象获取栅格单值专题图类。
  55658. * @param {Object} obj - 传入对象
  55659. * @returns {ThemeGridUnique} ThemeGridUnique 对象
  55660. */
  55661. static fromObj(obj) {
  55662. var res = new ThemeGridUnique();
  55663. var uItems = obj.items;
  55664. var len = uItems ? uItems.length : 0;
  55665. Util_Util.extend(res, obj);
  55666. res.items = [];
  55667. res.defaultcolor = ServerColor.fromJson(obj.defaultcolor);
  55668. for (var i = 0; i < len; i++) {
  55669. res.items.push(ThemeGridUniqueItem.fromObj(uItems[i]));
  55670. }
  55671. return res;
  55672. }
  55673. }
  55674. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelUniqueItem.js
  55675. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  55676. * This program are made available under the terms of the Apache License, Version 2.0
  55677. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55678. /**
  55679. * @class ThemeLabelUniqueItem
  55680. * @deprecatedclass SuperMap.ThemeLabelUniqueItem
  55681. * @category iServer Map Theme
  55682. * @classdesc 单值标签专题图的子项。标签专题图用专题值对点、线、面等对象做标注,值得注意的是,单值标签专题图允许用户通过 uniqueExpression
  55683. * 字段指定用于单值的字段,同一值的标签具有相同的显示风格,其中每一个值就是一个专题图子项,
  55684. * 每一个子项都具有其名称、风格、指定的单值、X 方向偏移量和 Y 方向偏移量。
  55685. * @param {Object} options - 参数。
  55686. * @param {string} options.unique - 子项的值,可以为数字、字符串等。
  55687. * @param {string} [options.caption] - 子项的名称。
  55688. * @param {number} [options.offsetX=0] - 标签在 X 方向偏移量。
  55689. * @param {number} [options.offsetY=0] - 标签在 Y 方向偏移量。
  55690. * @param {boolean} [options.visible=true] - 子项是否可见。
  55691. * @param {ServerTextStyle} [options.style] - 子项文本的显示风格。
  55692. * @usage
  55693. */
  55694. class ThemeLabelUniqueItem {
  55695. constructor(options) {
  55696. /**
  55697. * @member {string} [ThemeLabelUniqueItem.prototype.caption]
  55698. * @description 标签专题子项的标题。
  55699. */
  55700. this.caption = null;
  55701. /**
  55702. * @member {string} ThemeLabelUniqueItem.prototype.unique
  55703. * @description 单值专题图子项的值,可以为数字、字符串等。
  55704. */
  55705. this.unique = null;
  55706. /**
  55707. * @member {number} [ThemeLabelUniqueItem.prototype.offsetX=0]
  55708. * @description 标签在 X 方向偏移量。
  55709. */
  55710. this.offsetX = 0;
  55711. /**
  55712. * @member {number} [ThemeLabelUniqueItem.prototype.offsetY=0]
  55713. * @description 标签在 Y 方向偏移量。
  55714. */
  55715. this.offsetY = 0;
  55716. /**
  55717. * @member {boolean} [ThemeLabelUniqueItem.prototype.visible=true]
  55718. * @description 标签专题图子项是否可见。如果标签专题图子项可见,则为 true,否则为 false。
  55719. */
  55720. this.visible = true;
  55721. /**
  55722. * @member {ServerTextStyle} ThemeLabelUniqueItem.prototype.style
  55723. * @description 标签专题图子项文本的显示风格。各种风格的优先级从高到低为:<br>
  55724. * uniformMixedStyle(标签文本的复合风格),ThemeLabelUniqueItem.style(单值子项的文本风格),uniformStyle(统一文本风格)。
  55725. */
  55726. this.style = new ServerTextStyle();
  55727. if (options) {
  55728. Util_Util.extend(this, options);
  55729. }
  55730. this.CLASS_NAME = "SuperMap.ThemeLabelUniqueItem";
  55731. }
  55732. /**
  55733. * @function ThemeLabelUniqueItem.prototype.destroy
  55734. * @description 释放资源,将引用资源的属性置空。
  55735. */
  55736. destroy() {
  55737. var me = this;
  55738. me.unique = null;
  55739. me.caption = null;
  55740. me.offsetX = null;
  55741. me.offsetY = null;
  55742. if (me.style) {
  55743. me.style.destroy();
  55744. me.style = null;
  55745. }
  55746. me.visible = null;
  55747. }
  55748. /**
  55749. * @function ThemeLabelUniqueItem.fromObj
  55750. * @description 从传入对象获取单值标签专题图的子项类。
  55751. * @param {Object} obj - 传入对象。
  55752. * @returns {ThemeLabelUniqueItem} ThemeLabelUniqueItem 对象。
  55753. */
  55754. static fromObj(obj) {
  55755. if (!obj) {
  55756. return;
  55757. }
  55758. var t = new ThemeLabelUniqueItem();
  55759. Util_Util.copy(t, obj);
  55760. return t;
  55761. }
  55762. }
  55763. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeMemoryData.js
  55764. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  55765. * This program are made available under the terms of the Apache License, Version 2.0
  55766. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55767. /**
  55768. * @class ThemeMemoryData
  55769. * @deprecatedclass SuperMap.ThemeMemoryData
  55770. * @category iServer Map Theme
  55771. * @classdesc 专题图内存数据类。
  55772. * @param {Array} srcData - 原始值数组。
  55773. * @param {Array} targetData - 外部值数组。
  55774. * @usage
  55775. */
  55776. class ThemeMemoryData {
  55777. constructor(srcData, targetData) {
  55778. /**
  55779. * @member {Array} ThemeMemoryData.prototype.srcData
  55780. * @description 原始值数组,该属性值将被 targetData 属性所指定的值替换掉,然后制作专题图,但数据库中的值并不会改变。
  55781. */
  55782. this.srcData = srcData;
  55783. /**
  55784. * @member {Array} ThemeMemoryData.prototype.targetData
  55785. * @description 外部值数组,即用于制作专题图的内存数据,设定该属性值后,会将 srcData 属性所指定的原始值替换掉制作专题图,但数据库中的值并不会改变。
  55786. */
  55787. this.targetData = targetData;
  55788. this.CLASS_NAME = "SuperMap.ThemeMemoryData";
  55789. }
  55790. /**
  55791. * @function ThemeMemoryData.prototype.destroy
  55792. * @description 释放资源,将引用资源的属性置空。
  55793. */
  55794. destroy() {
  55795. var me = this;
  55796. me.srcData = null;
  55797. me.targetData = null;
  55798. }
  55799. /**
  55800. * @function ThemeMemoryData.prototype.toJSON
  55801. * @description 将 ThemeMemoryData 对象转化为 JSON 字符串。
  55802. * @returns {string} 返回转换后的 JSON 字符串。
  55803. */
  55804. toJSON() {
  55805. if (this.srcData && this.targetData) {
  55806. var memoryDataStr = "";
  55807. var count = Math.min(this.srcData.length, this.targetData.length);
  55808. for (var i = 0; i < count; i++) {
  55809. memoryDataStr += "\'" + this.srcData[i] + "\':\'" + this.targetData[i] + "\',";
  55810. }
  55811. //去除多余的逗号
  55812. if (i > 0) {
  55813. memoryDataStr = memoryDataStr.substring(0, memoryDataStr.length - 1);
  55814. }
  55815. return "{" + memoryDataStr + "}";
  55816. } else {
  55817. return null;
  55818. }
  55819. }
  55820. }
  55821. ;// CONCATENATED MODULE: ./src/common/iServer/TransferLine.js
  55822. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  55823. * This program are made available under the terms of the Apache License, Version 2.0
  55824. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55825. /**
  55826. * @class TransferLine
  55827. * @deprecatedclass SuperMap.TransferLine
  55828. * @category iServer TrafficTransferAnalyst TransferPath
  55829. * @classdesc 换乘路线信息类。
  55830. * @param {Object} options - 参数。
  55831. * @param {number} options.lineID - 乘车路线 ID。
  55832. * @param {string} options.lineName - 乘车路线名称。
  55833. * @param {string} options.lineAliasName - 乘车路线别名。
  55834. * @param {number} options.startStopIndex - 上车站点在本公交路线中的索引。
  55835. * @param {string} options.startStopName - 上车站点名称。
  55836. * @param {string} options.startStopAliasName - 上车站点别名。
  55837. * @param {number} options.endStopIndex - 下车站点在本公交路线中的索引。
  55838. * @param {string} options.endStopName - 下车站点名称。
  55839. * @param {string} options.endStopAliasName - 下车站点别名。
  55840. * @usage
  55841. */
  55842. class TransferLine {
  55843. constructor(options) {
  55844. options = options || {};
  55845. /**
  55846. * @member {number} TransferLine.prototype.lineID
  55847. * @description 乘车路线 ID。
  55848. */
  55849. this.lineID = null;
  55850. /**
  55851. * @member {string} TransferLine.prototype.lineName
  55852. * @description 乘车路线名称。
  55853. */
  55854. this.lineName = null;
  55855. /**
  55856. * @member {string} TransferLine.prototype.lineAliasName
  55857. * @description 乘车路线别名。
  55858. */
  55859. this.lineAliasName = null;
  55860. /**
  55861. * @member {number} TransferLine.prototype.startStopIndex
  55862. * @description 上车站点在本公交路线中的索引。
  55863. */
  55864. this.startStopIndex = null;
  55865. /**
  55866. * @member {string} TransferLine.prototype.startStopName
  55867. * @description 上车站点名称。
  55868. */
  55869. this.startStopName = null;
  55870. /**
  55871. * @member {string} TransferLine.prototype.startStopAliasName
  55872. * @description 上车站点别名。
  55873. */
  55874. this.startStopAliasName = null;
  55875. /**
  55876. * @member {number} TransferLine.prototype.endStopIndex
  55877. * @description 下车站点在本公交路线中的索引。
  55878. */
  55879. this.endStopIndex = null;
  55880. /**
  55881. * @member {string} TransferLine.prototype.endStopName
  55882. * @description 下车站点名称。
  55883. */
  55884. this.endStopName = null;
  55885. /**
  55886. * @member {string} TransferLine.prototype.endStopAliasName
  55887. * @description 下车站点别名。
  55888. */
  55889. this.endStopAliasName = null;
  55890. Util_Util.extend(this, options);
  55891. this.CLASS_NAME = "SuperMap.TransferLine";
  55892. }
  55893. /**
  55894. * @function TransferLine.prototype.destroy
  55895. * @description 释放资源,将引用资源的属性置空。
  55896. */
  55897. destroy() {
  55898. Util_Util.reset(this);
  55899. }
  55900. /**
  55901. * @function TransferLine.fromJson
  55902. * @description 将返回结果转化为 {@link TransferLine} 对象。
  55903. * @param {Object} jsonObject - 新的返回结果。
  55904. * @returns {TransferLine} 转化后的 {@link TransferLine} 对象。
  55905. */
  55906. static fromJson(jsonObject) {
  55907. if (!jsonObject) {
  55908. return;
  55909. }
  55910. return new TransferLine({
  55911. lineID: jsonObject['lineID'],
  55912. lineName: jsonObject['lineName'],
  55913. lineAliasName: jsonObject['lineAliasName'],
  55914. startStopIndex: jsonObject['startStopIndex'],
  55915. startStopName: jsonObject['startStopName'],
  55916. startStopAliasName: jsonObject['startStopAliasName'],
  55917. endStopIndex: jsonObject['endStopIndex'],
  55918. endStopName: jsonObject['endStopName'],
  55919. endStopAliasName: jsonObject['endStopAliasName']
  55920. });
  55921. }
  55922. }
  55923. ;// CONCATENATED MODULE: ./src/common/iServer/RasterFunctionParameter.js
  55924. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  55925. * This program are made available under the terms of the Apache License, Version 2.0
  55926. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55927. /**
  55928. * @class RasterFunctionParameter
  55929. * @deprecatedclass SuperMap.RasterFunctionParameter
  55930. * @category iServer Map Tile
  55931. * @classdesc iServer 地图服务栅格分析参数基类。
  55932. * @param {Object} options - 参数。
  55933. * @param {RasterFunctionType} options.type - 栅格分析方法。
  55934. * @usage
  55935. */
  55936. class RasterFunctionParameter {
  55937. constructor(options) {
  55938. options = options || {};
  55939. /**
  55940. * @member {RasterFunctionType} [RasterFunctionParameter.prototype.type]
  55941. * @description 栅格分析方法。
  55942. */
  55943. this.type = null;
  55944. Util_Util.extend(this, options);
  55945. this.CLASS_NAME = 'SuperMap.RasterFunctionParameter';
  55946. }
  55947. /**
  55948. * @function RasterFunctionParameter.prototype.destroy
  55949. * @description 释放资源,将资源的属性置空。
  55950. */
  55951. destroy() {
  55952. this.type = null;
  55953. }
  55954. }
  55955. ;// CONCATENATED MODULE: ./src/common/iServer/NDVIParameter.js
  55956. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  55957. * This program are made available under the terms of the Apache License, Version 2.0
  55958. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55959. /**
  55960. * @class NDVIParameter
  55961. * @deprecatedclass SuperMap.NDVIParameter
  55962. * @category iServer Map Tile
  55963. * @classdesc 归一化植被指数参数类。
  55964. * @param {Object} options - 参数。
  55965. * @param {number} [options.redIndex=0] - 红光谱波段索引。
  55966. * @param {number} [options.nirIndex=1] - 近红外光谱波段索引。
  55967. * @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。仅单波段数据时设定。
  55968. * @extends {RasterFunctionParameter}
  55969. * @usage
  55970. */
  55971. class NDVIParameter extends RasterFunctionParameter {
  55972. constructor(options) {
  55973. super(options);
  55974. /**
  55975. * @member {number} [NDVIParameter.prototype.redIndex=0]
  55976. * @description 红光谱波段索引。
  55977. */
  55978. this.redIndex = 0;
  55979. /**
  55980. * @member {number} [NDVIParameter.prototype.nirIndex=1]
  55981. * @description 近红外光谱波段索引。
  55982. */
  55983. this.nirIndex = 1;
  55984. /**
  55985. * @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"]
  55986. * @description 颜色表。由栅格的中断值和颜色停止之间的映射组成的,如0.3->d9f0a3ff 指的是[0,0.3)显示d9f0a3ff。仅单波段数据时设定。
  55987. */
  55988. this.colorMap =
  55989. '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';
  55990. /**
  55991. * @member {RasterFunctionType} [NDVIParameter.prototype.type]
  55992. * @description 栅格分析方法。
  55993. */
  55994. this.type = RasterFunctionType.NDVI;
  55995. Util_Util.extend(this, options);
  55996. this.CLASS_NAME = 'SuperMap.NDVIParameter';
  55997. }
  55998. /**
  55999. * @function NDVIParameter.prototype.destroy
  56000. * @override
  56001. */
  56002. destroy() {
  56003. super.destroy();
  56004. this.redIndex = null;
  56005. this.nirIndex = null;
  56006. this.colorMap = null;
  56007. }
  56008. /**
  56009. * @function NDVIParameter.prototype.toJSON
  56010. * @description 将 NDVIParameter 对象转化为 JSON 字符串。
  56011. * @returns {string} 返回转换后的 JSON 字符串。
  56012. */
  56013. toJSON() {
  56014. return {
  56015. redIndex: this.redIndex,
  56016. nirIndex: this.nirIndex,
  56017. colorMap: this.colorMap,
  56018. type: this.type
  56019. };
  56020. }
  56021. }
  56022. ;// CONCATENATED MODULE: ./src/common/iServer/HillshadeParameter.js
  56023. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  56024. * This program are made available under the terms of the Apache License, Version 2.0
  56025. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56026. /**
  56027. * @class HillshadeParameter
  56028. * @deprecatedclass SuperMap.HillshadeParameter
  56029. * @category iServer Map Tile
  56030. * @classdesc 阴影面分析参数类。
  56031. * @param {Object} options - 可选参数。
  56032. * @param {number} [options.altitude=45] - 高于地平线的光源高度角。高度角由正度数表示,0 度代表地平线,而 90 度代表头顶正上方。
  56033. * @param {number} [options.azimuth=315] - 光源的方位角。方位角由0到360度之间的正度数表示,以北为基准方向按顺时针进行测量。
  56034. * @param {number} [options.zFactor=1] - 一个表面 z 单位中地面 x,y 单位的数量。z 单位与输入表面的 x,y 单位不同时,可使用 z 因子调整 z 单位的测量单位。计算最终输出表面时,将用 z 因子乘以输入表面的 z 值。
  56035. * z 单位与输入表面的 x,y 单位不同时,可使用 z 因子调整 z 单位的测量单位。计算最终输出表面时,将用 z 因子乘以输入表面的 z 值。
  56036. * 如果 x,y 单位和 z 单位采用相同的测量单位,则 z 因子为 1。这是默认设置。
  56037. * 如果 x,y 单位和 z 单位采用不同的测量单位,则必须将 z 因子设置为适当的因子,否则会得到错误的结果。例如,如果 z 单位是英尺而 x,y 单位是米,则应使用 z 因子 0.3048 将 z 单位从英尺转换为米(1 英尺 = 0.3048 米)。
  56038. * 如果输入栅格位于球面坐标系中(如十进制度球面坐标系),则生成的山体阴影可能看起来很独特。这是因为水平地面单位与高程 z 单位之间的测量值存在差异。由于经度的长度随着纬度而变化,因此需要为该纬度指定一个适当的 z 因子。如果 x,y 单位是十进制度而 Z 单位是米,特定纬度的一些合适的 Z 因子为:
  56039. * Latitude Z-factor
  56040. * 0 0.00000898
  56041. * 10 0.00000912
  56042. * 20 0.00000956
  56043. * 30 0.00001036
  56044. * 40 0.00001171
  56045. * 50 0.00001395
  56046. * 60 0.00001792
  56047. * 70 0.00002619
  56048. * 80 0.00005156
  56049. * @extends {RasterFunctionParameter}
  56050. * @usage
  56051. */
  56052. class HillshadeParameter extends RasterFunctionParameter {
  56053. constructor(options) {
  56054. super(options);
  56055. /**
  56056. * @member {number} [HillshadeParameter.prototype.altitude = 45]
  56057. * @description 高于地平线的光源高度角。高度角由正度数表示,0 度代表地平线,而 90 度代表头顶正上方。
  56058. */
  56059. this.altitude = 45;
  56060. /**
  56061. * @member {number} [HillshadeParameter.prototype.azimuth = 315]
  56062. * @description 光源的方位角。方位角由0到360度之间的正度数表示,以北为基准方向按顺时针进行测量。
  56063. */
  56064. this.azimuth = 315;
  56065. /**
  56066. * @member {number} [HillshadeParameter.prototype.zFactor = 1]
  56067. * @description 一个表面 z 单位中地面 x,y 单位的数量。z 单位与输入表面的 x,y 单位不同时,可使用 z 因子调整 z 单位的测量单位。计算最终输出表面时,将用 z 因子乘以输入表面的 z 值。
  56068. */
  56069. this.zFactor = 1;
  56070. /**
  56071. * @member {RasterFunctionType} HillshadeParameter.prototype.type
  56072. * @description 栅格分析方法。
  56073. */
  56074. this.type = RasterFunctionType.HILLSHADE;
  56075. Util_Util.extend(this, options);
  56076. this.CLASS_NAME = 'SuperMap.HillshadeParameter';
  56077. }
  56078. /**
  56079. * @function HillshadeParameter.prototype.destroy
  56080. * @override
  56081. */
  56082. destroy() {
  56083. super.destroy();
  56084. this.altitude = null;
  56085. this.azimuth = null;
  56086. this.zFactor = null;
  56087. }
  56088. /**
  56089. * @function HillshadeParameter.prototype.toJSON
  56090. * @description 将 HillshadeParameter 对象转化为 JSON 字符串。
  56091. * @returns {string} 返回转换后的 JSON 字符串。
  56092. */
  56093. toJSON() {
  56094. return {
  56095. altitude: this.altitude,
  56096. azimuth: this.azimuth,
  56097. zFactor: this.zFactor,
  56098. type: this.type
  56099. };
  56100. }
  56101. }
  56102. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobCustomItems.js
  56103. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  56104. * This program are made available under the terms of the Apache License, Version 2.0
  56105. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56106. /**
  56107. * @class WebPrintingJobCustomItems
  56108. * @deprecatedclass SuperMap.WebPrintingJobCustomItems
  56109. * @classdesc Web 打印图例元素参数类。
  56110. * @version 10.1.0
  56111. * @category iServer WebPrintingJob
  56112. * @param {Object} option - 参数。
  56113. * @param {string} option.name - 图例元素的名称。
  56114. * @param {string} option.picAsUrl - 图例元素 Base64 格式图片。
  56115. * @param {string} [option.picAsBase64] - 图例元素图片的获取地址。如果已填了 URL 参数,此参数可不传。
  56116. * @usage
  56117. */
  56118. class WebPrintingJobCustomItems {
  56119. constructor(option) {
  56120. /**
  56121. * @member {string} WebPrintingJobCustomItems.prototype.name
  56122. * @description 图例元素的名称。
  56123. */
  56124. this.name = null;
  56125. /**
  56126. * @member {string} [WebPrintingJobCustomItems.prototype.picAsUrl]
  56127. * @description 图例元素 Base64 格式图片。
  56128. */
  56129. this.picAsUrl = null;
  56130. /**
  56131. * @member {string} [WebPrintingJobCustomItems.prototype.picAsBase64]
  56132. * @description 图例元素图片的获取地址。
  56133. */
  56134. this.picAsBase64 = null;
  56135. this.CLASS_NAME = 'SuperMap.WebPrintingJobCustomItems';
  56136. Util_Util.extend(this, option);
  56137. }
  56138. /**
  56139. * @function WebPrintingJobCustomItems.prototype.destroy
  56140. * @description 释放资源,将引用资源的属性置空。
  56141. */
  56142. destroy() {
  56143. var me = this;
  56144. me.name = null;
  56145. me.picAsUrl = null;
  56146. me.picAsBase64 = null;
  56147. }
  56148. /**
  56149. * @function WebPrintingJobCustomItems.prototype.toJSON
  56150. * @description 将 WebPrintingJobCustomItems 对象转化为 JSON 字符串。
  56151. * @returns {string} 转换后的 JSON 字符串。
  56152. */
  56153. toJSON() {
  56154. var params = {
  56155. name: this.name
  56156. };
  56157. if (this.title) {
  56158. params.title = this.title;
  56159. }
  56160. if (this.picAsUrl) {
  56161. params.picAsUrl = this.picAsUrl;
  56162. } else if (this.picAsBase64) {
  56163. params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
  56164. }
  56165. return Util_Util.toJSON(params);
  56166. }
  56167. }
  56168. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobImage.js
  56169. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  56170. * This program are made available under the terms of the Apache License, Version 2.0
  56171. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56172. /**
  56173. * @class WebPrintingJobImage
  56174. * @deprecatedclass SuperMap.WebPrintingJobImage
  56175. * @classdesc 表达小地图的静态图片参数类。
  56176. * @version 10.1.0
  56177. * @category iServer WebPrintingJob
  56178. * @param {Object} option - 参数。
  56179. * @param {string} option.picAsUrl - 小地图的图片 URL 地址。
  56180. * @param {string} [option.picAsBase64] - 小地图的base64位图片信息。如果已填了 URL 参数,此参数可不传。
  56181. * @usage
  56182. */
  56183. class WebPrintingJobImage {
  56184. constructor(option) {
  56185. /**
  56186. * @member {string} [WebPrintingJobImage.prototype.picAsUrl]
  56187. * @description 小地图的图片 URL 地址。
  56188. */
  56189. this.picAsUrl = null;
  56190. /**
  56191. * @member {string} [WebPrintingJobImage.prototype.picAsBase64]
  56192. * @description 小地图的base64位图片信息。
  56193. */
  56194. this.picAsBase64 = null;
  56195. this.CLASS_NAME = 'SuperMap.WebPrintingJobImage';
  56196. Util_Util.extend(this, option);
  56197. }
  56198. /**
  56199. * @function WebPrintingJobImage.prototype.destroy
  56200. * @description 释放资源,将引用资源的属性置空。
  56201. */
  56202. destroy() {
  56203. this.picAsUrl = null;
  56204. this.picAsBase64 = null;
  56205. }
  56206. /**
  56207. * @function WebPrintingJobImage.prototype.toJSON
  56208. * @description 将 WebPrintingJobImage 对象转化为 JSON 字符串。
  56209. * @returns {string} 转换后的 JSON 字符串。
  56210. */
  56211. toJSON() {
  56212. var params = {};
  56213. if (this.picAsUrl) {
  56214. params.picAsUrl = this.picAsUrl;
  56215. }
  56216. if (this.picAsBase64) {
  56217. params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
  56218. }
  56219. return Util_Util.toJSON(params);
  56220. }
  56221. }
  56222. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLayers.js
  56223. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  56224. * This program are made available under the terms of the Apache License, Version 2.0
  56225. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56226. /**
  56227. * @class WebPrintingJobLayers
  56228. * @deprecatedclass SuperMap.WebPrintingJobLayers
  56229. * @classdesc 将图例添加到布局的业务图层参数类。
  56230. * @version 10.1.0
  56231. * @category iServer WebPrintingJob
  56232. * @param {Object} option - 参数。
  56233. * @param {string} option.name - 图层 name 的字符串。此 name 必须唯一,并且必须与定义业务图层的 LegendOptions_layers 元素中的图层 name 匹配。
  56234. * @usage
  56235. */
  56236. class WebPrintingJobLayers {
  56237. constructor(option) {
  56238. /**
  56239. * @member {string} WebPrintingJobLayers.prototype.name
  56240. * @description 图层 name。
  56241. */
  56242. this.name = null;
  56243. /**
  56244. * @member {string} WebPrintingJobLayers.prototype.layerType
  56245. * @description 图层 type。
  56246. */
  56247. this.layerType = null;
  56248. /**
  56249. * @member {string} WebPrintingJobLayers.prototype.url
  56250. * @description 图层 URL。
  56251. */
  56252. this.url = null;
  56253. this.CLASS_NAME = 'SuperMap.WebPrintingJobLayers';
  56254. Util_Util.extend(this, option);
  56255. }
  56256. /**
  56257. * @function WebPrintingJobLayers.prototype.destroy
  56258. * @description 释放资源,将引用资源的属性置空。
  56259. */
  56260. destroy() {
  56261. this.name = null;
  56262. this.layerType = null;
  56263. this.url = null;
  56264. }
  56265. }
  56266. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLegendOptions.js
  56267. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  56268. * This program are made available under the terms of the Apache License, Version 2.0
  56269. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56270. /**
  56271. * @class WebPrintingJobLegendOptions
  56272. * @deprecatedclass SuperMap.WebPrintingJobLegendOptions
  56273. * @classdesc Web 打印图例参数类。
  56274. * @version 10.1.0
  56275. * @category iServer WebPrintingJob
  56276. * @param {Object} option - 参数。
  56277. * @param {string} [option.title] - 图例名称。
  56278. * @param {string} [option.picAsUrl] - 图例的图片 URL 地址。
  56279. * @param {string} [option.picAsBase64] - 图例的 base64 位图片信息。
  56280. * @param {WebPrintingJobLayers} [option.layers] - 图例的布局业务图层参数类。
  56281. * @param {WebPrintingJobCustomItems} [option.customItems] - 自定义图例元素参数类。
  56282. * @usage
  56283. */
  56284. class WebPrintingJobLegendOptions {
  56285. constructor(option) {
  56286. /**
  56287. * @member {string} WebPrintingJobLegendOptions.prototype.title
  56288. * @description 图例名称。
  56289. */
  56290. this.title = null;
  56291. /**
  56292. * @member {string} [WebPrintingJobLegendOptions.prototype.picAsUrl]
  56293. * @description 图例的图片 URL 地址。
  56294. */
  56295. this.picAsUrl = null;
  56296. /**
  56297. * @member {string} [WebPrintingJobLegendOptions.prototype.picAsBase64]
  56298. * @description 图例的 base64 位图片信息。
  56299. */
  56300. this.picAsBase64 = null;
  56301. /**
  56302. * @member {WebPrintingJobLayers} [WebPrintingJobLegendOptions.prototype.layers]
  56303. * @description 图例的布局业务图层参数类。
  56304. */
  56305. this.layers = null;
  56306. /**
  56307. * @member {WebPrintingJobCustomItems} [WebPrintingJobLegendOptions.prototype.customItems]
  56308. * @description 自定义图例元素参数类。
  56309. */
  56310. this.customItems = null;
  56311. this.CLASS_NAME = 'SuperMap.WebPrintingJobLegendOptions';
  56312. Util_Util.extend(this, option);
  56313. }
  56314. /**
  56315. * @function WebPrintingJobLegendOptions.prototype.destroy
  56316. * @description 释放资源,将引用资源的属性置空。
  56317. */
  56318. destroy() {
  56319. this.title = null;
  56320. this.picAsUrl = null;
  56321. this.picAsBase64 = null;
  56322. if (this.layers instanceof WebPrintingJobLayers) {
  56323. this.layers.destroy();
  56324. this.layers = null;
  56325. }
  56326. if (this.customItems instanceof WebPrintingJobCustomItems) {
  56327. this.customItems.destroy();
  56328. this.customItems = null;
  56329. }
  56330. }
  56331. /**
  56332. * @function WebPrintingJobLegendOptions.prototype.toJSON
  56333. * @description 将 WebPrintingJobLegendOptions 对象转化为 JSON 字符串。
  56334. * @returns {string} 转换后的 JSON 字符串。
  56335. */
  56336. toJSON() {
  56337. var params = {
  56338. title: this.title || ""
  56339. };
  56340. if (this.picAsUrl) {
  56341. params.picAsUrl = this.picAsUrl;
  56342. } else if (this.picAsBase64) {
  56343. params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
  56344. } else if (this.customItems) {
  56345. params.customItems = this.customItems;
  56346. }
  56347. return Util_Util.toJSON(params);
  56348. }
  56349. }
  56350. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLittleMapOptions.js
  56351. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  56352. * This program are made available under the terms of the Apache License, Version 2.0
  56353. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56354. /**
  56355. * @class WebPrintingJobLittleMapOptions
  56356. * @deprecatedclass SuperMap.WebPrintingJobLittleMapOptions
  56357. * @classdesc Web 打印小地图参数类。
  56358. * @version 10.1.0
  56359. * @category iServer WebPrintingJob
  56360. * @param {Object} option - 参数。
  56361. * @param {GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} option.center - 小地图的中心点。
  56362. * @param {number} [option.scale] - 小地图的比例尺。
  56363. * @param {Array.<string>} [option.layerNames] - 指定 WebMap中图层名称的列表,用于渲染小地图。
  56364. * @param {WebPrintingJobImage} [option.image] - 表达小地图的静态图类。
  56365. * @param {WebPrintingJobLayers} [option.layers] - 指定 WebMap 中的 layers 图层类。
  56366. * @usage
  56367. */
  56368. class WebPrintingJobLittleMapOptions {
  56369. constructor(option) {
  56370. /**
  56371. * @member {GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} WebPrintingJobLittleMapOptions.prototype.center
  56372. * @description 小地图的中心点。
  56373. */
  56374. this.center = null;
  56375. /**
  56376. * @member {number} [WebPrintingJobLittleMapOptions.prototype.scale]
  56377. * @description 小地图的比例尺。
  56378. */
  56379. this.scale = null;
  56380. /**
  56381. * @member {Array.<string>} WebPrintingJobLittleMapOptions.prototype.layerNames
  56382. * @description 指定 WebMap中图层名称的列表,用于渲染小地图。
  56383. */
  56384. this.layerNames = null;
  56385. /**
  56386. * @member {WebPrintingJobImage} [WebPrintingJobLittleMapOptions.prototype.image]
  56387. * @description 表达小地图的静态图类。暂不支持。
  56388. */
  56389. this.image = null;
  56390. /**
  56391. * @member {WebPrintingJobLayers} [WebPrintingJobLittleMapOptions.prototype.layers]
  56392. * @description 指定 WebMap 中的 layers 图层类。
  56393. */
  56394. this.layers = null;
  56395. this.CLASS_NAME = 'SuperMap.WebPrintingJobLittleMapOptions';
  56396. Util_Util.extend(this, option);
  56397. }
  56398. /**
  56399. * @function WebPrintingJobLittleMapOptions.prototype.destroy
  56400. * @description 释放资源,将引用资源的属性置空。
  56401. */
  56402. destroy() {
  56403. this.center = null;
  56404. this.scale = null;
  56405. this.layerNames = null;
  56406. if (this.image instanceof WebPrintingJobImage) {
  56407. this.image.destroy();
  56408. this.image = null;
  56409. }
  56410. if (this.layers instanceof WebPrintingJobLayers) {
  56411. this.layers.destroy();
  56412. this.layers = null;
  56413. }
  56414. }
  56415. /**
  56416. * @function WebPrintingJobLittleMapOptions.prototype.toJSON
  56417. * @description 将 WebPrintingJobLittleMapOptions 对象转化为 JSON 字符串。
  56418. * @returns {string} 转换后的 JSON 字符串。
  56419. */
  56420. toJSON() {
  56421. var params = {
  56422. scale: this.scale,
  56423. center: this.center
  56424. };
  56425. if (this.layerNames) {
  56426. params.layerNames = this.layerNames;
  56427. } else if (this.layers) {
  56428. params.layers = this.layers;
  56429. }
  56430. if (this.image) {
  56431. params.image = this.image;
  56432. }
  56433. return Util_Util.toJSON(params);
  56434. }
  56435. }
  56436. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobNorthArrowOptions.js
  56437. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  56438. * This program are made available under the terms of the Apache License, Version 2.0
  56439. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56440. /**
  56441. * @class WebPrintingJobNorthArrowOptions
  56442. * @deprecatedclass SuperMap.WebPrintingJobNorthArrowOptions
  56443. * @classdesc Web 打印地图指北针参数类。
  56444. * @version 10.1.0
  56445. * @category iServer WebPrintingJob
  56446. * @param {Object} option - 参数。
  56447. * @param {string} option.picAsUrl - 指北针的图片 URL 地址。
  56448. * @param {string} [option.picAsBase64] - 指北针的base64位图片信息。
  56449. * @usage
  56450. */
  56451. class WebPrintingJobNorthArrowOptions {
  56452. constructor(option) {
  56453. /**
  56454. * @member {string} WebPrintingJobNorthArrowOptions.prototype.picAsUrl
  56455. * @description 指北针的图片 URL 地址。
  56456. */
  56457. this.picAsUrl = null;
  56458. /**
  56459. * @member {string} [WebPrintingJobNorthArrowOptions.prototype.picAsBase64]
  56460. * @description 指北针的base64位图片信息。
  56461. */
  56462. this.picAsBase64 = null;
  56463. this.CLASS_NAME = 'SuperMap.WebPrintingJobNorthArrowOptions';
  56464. Util_Util.extend(this, option);
  56465. }
  56466. /**
  56467. * @function WebPrintingJobNorthArrowOptions.prototype.destroy
  56468. * @description 释放资源,将引用资源的属性置空。
  56469. */
  56470. destroy() {
  56471. this.picAsUrl = null;
  56472. this.picAsBase64 = null;
  56473. }
  56474. /**
  56475. * @function WebPrintingJobNorthArrowOptions.prototype.toJSON
  56476. * @description 将 WebPrintingJobNorthArrowOptions 对象转化为 JSON 字符串。
  56477. * @returns {string} 转换后的 JSON 字符串。
  56478. */
  56479. toJSON() {
  56480. var params = {};
  56481. if (this.picAsUrl) {
  56482. params.picAsUrl = this.picAsUrl;
  56483. } else if (this.picAsBase64) {
  56484. params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
  56485. }
  56486. return Util_Util.toJSON(params);
  56487. }
  56488. }
  56489. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobScaleBarOptions.js
  56490. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  56491. * This program are made available under the terms of the Apache License, Version 2.0
  56492. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56493. /**
  56494. * @class WebPrintingJobScaleBarOptions
  56495. * @deprecatedclass SuperMap.WebPrintingJobScaleBarOptions
  56496. * @classdesc Web 打印比例尺参数类。
  56497. * @category iServer WebPrintingJob
  56498. * @version 10.1.0
  56499. * @param {Object} option - 参数。
  56500. * @param {string} [option.scaleText] - 比例尺文本信息。例如:1:1000000。
  56501. * @param {WebScaleOrientationType} [option.orientation] - 比例尺的方位样式。
  56502. * @param {WebScaleType} [option.type] - 比例尺的样式。
  56503. * @param {number} [option.intervals] - 比例尺条的段数。
  56504. * @param {WebScaleUnit} [option.unit] - 比例尺的单位制。
  56505. * @usage
  56506. */
  56507. class WebPrintingJobScaleBarOptions {
  56508. constructor(option) {
  56509. /**
  56510. * @member {string} WebPrintingJobScaleBarOptions.prototype.scaleText
  56511. * @description 比例尺文本信息。
  56512. */
  56513. this.scaleText = null;
  56514. /**
  56515. * @member {WebScaleOrientationType} [WebPrintingJobScaleBarOptions.prototype.orientation]
  56516. * @description 比例尺的方位样式。
  56517. */
  56518. this.orientation = null;
  56519. /**
  56520. * @member {WebScaleType} [WebPrintingJobScaleBarOptions.prototype.type]
  56521. * @description 比例尺的样式。
  56522. */
  56523. this.type = null;
  56524. /**
  56525. * @member {Object} [WebPrintingJobScaleBarOptions.prototype.intervals]
  56526. * @description 比例尺条的段数。
  56527. */
  56528. this.intervals = null;
  56529. /**
  56530. * @member {WebScaleUnit} [WebPrintingJobScaleBarOptions.prototype.unit]
  56531. * @description 比例尺的单位制。
  56532. */
  56533. this.unit = null;
  56534. this.CLASS_NAME = 'SuperMap.WebPrintingJobScaleBarOptions';
  56535. Util_Util.extend(this, option);
  56536. }
  56537. /**
  56538. * @function WebPrintingJobScaleBarOptions.prototype.destroy
  56539. * @description 释放资源,将引用资源的属性置空。
  56540. */
  56541. destroy() {
  56542. this.scaleText = null;
  56543. this.orientation = null;
  56544. this.type = null;
  56545. this.intervals = null;
  56546. this.unit = null;
  56547. }
  56548. /**
  56549. * @function WebPrintingJobScaleBarOptions.prototype.toJSON
  56550. * @description 将 WebPrintingJobScaleBarOptions 对象转化为 JSON 字符串。
  56551. * @returns {string} 转换后的 JSON 字符串。
  56552. */
  56553. toJSON() {
  56554. var params = {
  56555. scaleText: this.scaleText || "",
  56556. type: this.type || "BAR",
  56557. intervals: this.intervals || "",
  56558. unit: this.unit || "METER"
  56559. };
  56560. if (this.orientation) {
  56561. params.orientation = this.orientation;
  56562. }
  56563. return Util_Util.toJSON(params);
  56564. }
  56565. }
  56566. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobContent.js
  56567. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  56568. * This program are made available under the terms of the Apache License, Version 2.0
  56569. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56570. /**
  56571. * @class WebPrintingJobContent
  56572. * @deprecatedclass SuperMap.WebPrintingJobContent
  56573. * @classdesc Web 打印内容参数类。
  56574. * @version 10.1.0
  56575. * @category iServer WebPrintingJob
  56576. * @param {Object} option - 参数。
  56577. * @param {string} option.type - Web 打印内容支持的类型。目前支持的类型:WEBMAP。
  56578. * @param {string} [option.url] - 待打印的 SuperMap iPortal WebMap 的 URL 地址。例如:http://supermapiportal:8190/iportal/web/maps/{mapid}/map.rjson 。
  56579. * @param {string} [option.token] - 如果待打印的是 SuperMap iPortal 用户私有的 WebMap,需要提供 SuperMap iPortal 用户的 token。
  56580. * @param {WebMapSummaryObject} [option.value] - 传递的是一个符合 SuperMap WebMap 规范的 WebMap 的 JSON 表达,也可以是一个完整的 SuperMap iPortal 数据上图制作的 WebMap 的 JSON 表达。如果已填了 URL 参数,此参数可不传。
  56581. * @usage
  56582. */
  56583. class WebPrintingJobContent {
  56584. constructor(option) {
  56585. /**
  56586. * @member {string} WebPrintingJobContent.prototype.type
  56587. * @description Web 打印内容支持的类型。
  56588. */
  56589. this.type = null;
  56590. /**
  56591. * @member {string} [WebPrintingJobContent.prototype.url]
  56592. * @description 待打印的 SuperMap iPortal WebMap 的 URL 地址。
  56593. */
  56594. this.url = null;
  56595. /**
  56596. * @member {string} [WebPrintingJobContent.prototype.token]
  56597. * @description 如果待打印的是 SuperMap iPortal 用户私有的 WebMap,需要提供 SuperMap iPortal 用户的 token。
  56598. */
  56599. this.token = null;
  56600. /**
  56601. * @member {WebMapSummaryObject} [WebPrintingJobContent.prototype.value]
  56602. * @description 传递的是一个符合 SuperMap WebMap 规范的 WebMap 的 JSON 表达,也可以是一个完整的 SuperMap iPortal 数据上图制作的 WebMap 的 JSON 表达。
  56603. */
  56604. this.value = null;
  56605. this.CLASS_NAME = 'SuperMap.WebPrintingJobContent';
  56606. Util_Util.extend(this, option);
  56607. }
  56608. /**
  56609. * @function WebPrintingJobContent.prototype.destroy
  56610. * @description 释放资源,将引用资源的属性置空。
  56611. */
  56612. destroy() {
  56613. this.type = false || "WEBMAP";
  56614. this.url = null;
  56615. this.token = null;
  56616. this.value = null;
  56617. }
  56618. /**
  56619. * @function WebPrintingJobContent.prototype.toJSON
  56620. * @description 将 WebPrintingJobContent 对象转化为 JSON 字符串。
  56621. * @returns {string} 转换后的 JSON 字符串。
  56622. */
  56623. toJSON() {
  56624. var params = {
  56625. type: this.type
  56626. };
  56627. if (this.token) {
  56628. params.token = this.token;
  56629. }
  56630. if (this.url) {
  56631. params.url = this.url;
  56632. } else if (this.value) {
  56633. params.value = this.value;
  56634. }
  56635. return Util_Util.toJSON(params);
  56636. }
  56637. }
  56638. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLayoutOptions.js
  56639. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  56640. * This program are made available under the terms of the Apache License, Version 2.0
  56641. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56642. /**
  56643. * @class WebPrintingJobLayoutOptions
  56644. * @deprecatedclass SuperMap.WebPrintingJobLayoutOptions
  56645. * @classdesc Web 打印的布局参数类。
  56646. * @version 10.1.0
  56647. * @category iServer WebPrintingJob
  56648. * @param {Object} option - 参数。
  56649. * @param {string} option.templateName - 布局模板的名称。
  56650. * @param {string} option.title - 地图主标题名称。
  56651. * @param {string} option.subTitle - 地图副标题名称。
  56652. * @param {string} option.author - 作者名称。
  56653. * @param {string} option.copyright - 版权信息。
  56654. * @param {WebPrintingJobLittleMapOptions} option.littleMapOptions - 小地图参数类。
  56655. * @param {WebPrintingJobLegendOptions} option.legendOptions - 图例参数类。
  56656. * @param {WebPrintingJobScaleBarOptions} [option.scaleBarOptions] - 地图比例尺参数类。
  56657. * @param {WebPrintingJobNorthArrowOptions} [option.northArrowOptions] - 地图指北针参数类。
  56658. * @usage
  56659. */
  56660. class WebPrintingJobLayoutOptions {
  56661. constructor(option) {
  56662. /**
  56663. * @member {string} WebPrintingJobLayoutOptions.prototype.templateName
  56664. * @description 布局模板的名称。
  56665. */
  56666. this.templateName = null;
  56667. /**
  56668. * @member {string} WebPrintingJobLayoutOptions.prototype.title
  56669. * @description 地图主标题名称。
  56670. */
  56671. this.title = null;
  56672. /**
  56673. * @member {string} WebPrintingJobLayoutOptions.prototype.subTitle
  56674. * @description 地图副标题名称。
  56675. */
  56676. this.subTitle = null;
  56677. /**
  56678. * @member {string} WebPrintingJobLayoutOptions.prototype.author
  56679. * @description 地图作者名称。
  56680. */
  56681. this.author = null;
  56682. /**
  56683. * @member {string} WebPrintingJobLayoutOptions.prototype.copyright
  56684. * @description 地图版权信息。
  56685. */
  56686. this.copyright = null;
  56687. /**
  56688. * @member {WebPrintingJobScaleBarOptions} [WebPrintingJobLayoutOptions.prototype.scaleBarOptions]
  56689. * @description 地图比例尺参数类。
  56690. */
  56691. this.scaleBarOptions = null;
  56692. /**
  56693. * @member {WebPrintingJobNorthArrowOptions} [WebPrintingJobLayoutOptions.prototype.northArrowOptions]
  56694. * @description 地图指北针参数类。
  56695. */
  56696. this.northArrowOptions = null;
  56697. /**
  56698. * @member {WebPrintingJobLittleMapOptions} WebPrintingJobLayoutOptions.prototype.littleMapOptions
  56699. * @description 小地图参数类。
  56700. */
  56701. this.littleMapOptions = null;
  56702. /**
  56703. * @member {WebPrintingJobLegendOptions} WebPrintingJobLayoutOptions.prototype.legendOptions
  56704. * @description 图例参数类。
  56705. */
  56706. this.legendOptions = null;
  56707. this.CLASS_NAME = 'SuperMap.WebPrintingJobLayoutOptions';
  56708. Util_Util.extend(this, option);
  56709. }
  56710. /**
  56711. * @function WebPrintingJobLayoutOptions.prototype.destroy
  56712. * @description 释放资源,将引用资源的属性置空。
  56713. */
  56714. destroy() {
  56715. this.templateName = null;
  56716. this.title = null;
  56717. this.subTitle = null;
  56718. this.author = null;
  56719. this.copyright = null;
  56720. if (this.scaleBarOptions instanceof WebPrintingJobScaleBarOptions) {
  56721. this.scaleBarOptions.destroy();
  56722. this.scaleBarOptions = null;
  56723. }
  56724. if (this.northArrowOptions instanceof WebPrintingJobNorthArrowOptions) {
  56725. this.northArrowOptions.destroy();
  56726. this.northArrowOptions = null;
  56727. }
  56728. if (this.littleMapOptions instanceof WebPrintingJobLittleMapOptions) {
  56729. this.littleMapOptions.destroy();
  56730. this.littleMapOptions = null;
  56731. }
  56732. if (this.legendOptions instanceof WebPrintingJobLegendOptions) {
  56733. this.legendOptions.destroy();
  56734. this.legendOptions = null;
  56735. }
  56736. }
  56737. /**
  56738. * @function WebPrintingJobLayoutOptions.prototype.toJSON
  56739. * @description 将 WebPrintingJobLayoutOptions 对象转化为 JSON 字符串。
  56740. * @returns {string} 转换后的 JSON 字符串。
  56741. */
  56742. toJSON() {
  56743. var params = {
  56744. templateName: this.templateName,
  56745. title: this.title,
  56746. subTitle: this.subTitle,
  56747. author: this.author,
  56748. copyright: this.copyright
  56749. };
  56750. if (this.scaleBarOptions) {
  56751. params.scaleBarOptions = this.scaleBarOptions;
  56752. }
  56753. if (this.northArrowOptions) {
  56754. params.northArrowOptions = this.northArrowOptions;
  56755. }
  56756. if (this.littleMapOptions) {
  56757. params.littleMapOptions = this.littleMapOptions;
  56758. }
  56759. if (this.legendOptions) {
  56760. params.legendOptions = this.legendOptions;
  56761. }
  56762. return Util_Util.toJSON(params);
  56763. }
  56764. }
  56765. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobExportOptions.js
  56766. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  56767. * This program are made available under the terms of the Apache License, Version 2.0
  56768. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56769. /**
  56770. * @class WebPrintingJobExportOptions
  56771. * @deprecatedclass SuperMap.WebPrintingJobExportOptions
  56772. * @classdesc Web 打印的输出参数类。
  56773. * @version 10.1.0
  56774. * @category iServer WebPrintingJob
  56775. * @param {Object} option - 参数。
  56776. * @param {WebExportFormatType} option.format - Web 打印输出的格式,目前支持:PNG、PDF。
  56777. * @param {number} [option.dpi=96] - Web 打印输出的分辨率,单位为每英寸点数。默认值为 96 DPI。
  56778. * @param {number} [option.scale] - Web 打印输出的地图比例尺。
  56779. * @param {number} [option.rotation] - Web 打印输出的地图角度。
  56780. * @param {GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} [option.center] - Web 打印输出的地图中心点。
  56781. * @usage
  56782. */
  56783. class WebPrintingJobExportOptions {
  56784. constructor(option) {
  56785. /**
  56786. * @member {WebExportFormatType} WebPrintingJobExportOptions.prototype.format
  56787. * @description Web 打印输出的格式。
  56788. */
  56789. this.format = null;
  56790. /**
  56791. * @member {number} [WebPrintingJobExportOptions.prototype.dpi=96]
  56792. * @description Web 打印输出的分辨率,单位为每英寸点数。
  56793. */
  56794. this.dpi = 96;
  56795. /**
  56796. * @member {number} [WebPrintingJobExportOptions.prototype.scale]
  56797. * @description Web 打印输出的地图比例尺。
  56798. */
  56799. this.scale = null;
  56800. /**
  56801. * @member {number} [WebPrintingJobExportOptions.prototype.rotation]
  56802. * @description Web 打印输出的地图角度。
  56803. */
  56804. this.rotation = null;
  56805. /**
  56806. * @member {GeometryPoint|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} [WebPrintingJobExportOptions.prototype.center]
  56807. * @description Web 打印输出的地图中心点。
  56808. */
  56809. this.center = null;
  56810. this.CLASS_NAME = 'SuperMap.WebPrintingJobExportOptions';
  56811. Util_Util.extend(this, option);
  56812. }
  56813. /**
  56814. * @function WebPrintingJobExportOptions.prototype.destroy
  56815. * @description 释放资源,将引用资源的属性置空。
  56816. */
  56817. destroy() {
  56818. this.format = null;
  56819. this.dpi = null;
  56820. this.scale = null;
  56821. this.rotation = null;
  56822. this.center = null;
  56823. this.outputSize = null;
  56824. }
  56825. /**
  56826. * @function WebPrintingJobExportOptions.prototype.toJSON
  56827. * @description 将 WebPrintingJobExportOptions 对象转化为 JSON 字符串。
  56828. * @returns {string} 转换后的 JSON 字符串。
  56829. */
  56830. toJSON() {
  56831. var params = {
  56832. format: this.format || "PDF",
  56833. dpi: this.dpi,
  56834. scale: this.scale,
  56835. center: this.center
  56836. };
  56837. if (this.rotation) {
  56838. params.rotation = this.rotation;
  56839. }
  56840. if (this.outputSize) {
  56841. params.outputSize = this.outputSize;
  56842. }
  56843. return Util_Util.toJSON(params);
  56844. }
  56845. }
  56846. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobParameters.js
  56847. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  56848. * This program are made available under the terms of the Apache License, Version 2.0
  56849. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56850. /**
  56851. * @class WebPrintingJobParameters
  56852. * @deprecatedclass SuperMap.WebPrintingJobParameters
  56853. * @category iServer WebPrintingJob
  56854. * @version 10.1.0
  56855. * @classdesc Web 打印参数类。
  56856. * @param {Object} options - 参数。
  56857. * @param {WebPrintingJobContent} options.content - Web 打印的内容类。
  56858. * @param {WebPrintingJobLayoutOptions} options.layoutOptions - Web 打印的布局类,包含各种布局元素的设置。
  56859. * @param {WebPrintingJobExportOptions} options.exportOptions - Web 打印的输出类,包含 DPI、页面大小等。
  56860. * @usage
  56861. */
  56862. class WebPrintingJobParameters {
  56863. constructor(options) {
  56864. if (!options) {
  56865. return;
  56866. }
  56867. /**
  56868. * @member {WebPrintingJobContent} WebPrintingJobParameters.prototype.content
  56869. * @description Web 打印的内容类。
  56870. */
  56871. this.content = null;
  56872. /**
  56873. * @member {WebPrintingJobLayoutOptions} WebPrintingJobParameters.prototype.layoutOptions
  56874. * @description Web 打印的布局类,包含各种布局元素的设置。
  56875. */
  56876. this.layoutOptions = null;
  56877. /**
  56878. * @member {WebPrintingJobExportOptions} WebPrintingJobParameters.prototype.exportOptions
  56879. * @description Web 打印的输出类,包含 DPI、页面大小等。
  56880. */
  56881. this.exportOptions = null;
  56882. Util_Util.extend(this, options);
  56883. this.CLASS_NAME = 'SuperMap.WebPrintingJobParameters';
  56884. }
  56885. /**
  56886. * @function WebPrintingJobParameters.prototype.destroy
  56887. * @description 释放资源,将引用资源的属性置空。
  56888. */
  56889. destroy() {
  56890. if (this.content instanceof WebPrintingJobContent) {
  56891. this.content.destroy();
  56892. this.content = null;
  56893. }
  56894. if (this.layoutOptions instanceof WebPrintingJobLayoutOptions) {
  56895. this.layoutOptions.destroy();
  56896. this.layoutOptions = null;
  56897. }
  56898. if (this.exportOptions instanceof WebPrintingJobExportOptions) {
  56899. this.exportOptions.destroy();
  56900. this.exportOptions = null;
  56901. }
  56902. }
  56903. }
  56904. ;// CONCATENATED MODULE: ./src/common/iServer/FieldsFilter.js
  56905. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  56906. * This program are made available under the terms of the Apache License, Version 2.0
  56907. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56908. /**
  56909. * @class FieldsFilter
  56910. * @deprecatedclass SuperMap.FieldsFilter
  56911. * @category iServer Data Field
  56912. * @classdesc 指定返回的用于描述 Feature 的字段。
  56913. * @param {Object} options - 可选参数。
  56914. * @param {Array.<string>} [options.include] 对返回的字段内容进行过滤,需保留的字段列表。
  56915. * @param {Array.<string>} [options.exclude] 对返回的字段内容进行过滤,需排除的字段列表。
  56916. * @usage
  56917. */
  56918. class FieldsFilter {
  56919. constructor(options) {
  56920. /**
  56921. * @description 对返回的字段内容进行过滤,需保留的字段列表。
  56922. * @member {Array.<string>} FieldsFilter.prototype.include
  56923. */
  56924. this.include = undefined;
  56925. /**
  56926. * @description 对返回的字段内容进行过滤,需排除的字段列表。
  56927. * @member {Array.<string>} FieldsFilter.prototype.exclude
  56928. */
  56929. this.exclude = undefined;
  56930. this.CLASS_NAME = 'SuperMap.FieldsFilter';
  56931. Util_Util.extend(this, options);
  56932. }
  56933. /**
  56934. * @function FieldsFilter.prototype.destroy
  56935. * @description 释放资源,将引用资源的属性置空。
  56936. */
  56937. destroy() {
  56938. var me = this;
  56939. me.include = undefined;
  56940. me.exclude = undefined;
  56941. }
  56942. /**
  56943. * @function FieldsFilter.prototype.constructFromObject
  56944. * @description 目标对象新增该类的可选参数。
  56945. * @param {Object} data 要转换的数据。
  56946. * @param {FieldsFilter} obj 返回的模型。
  56947. * @return {FieldsFilter} 返回结果。
  56948. */
  56949. static constructFromObject(data, obj) {
  56950. if (data) {
  56951. obj = obj || new FieldsFilter();
  56952. if (data.hasOwnProperty('include')) {
  56953. obj.include = data.include
  56954. }
  56955. if (data.hasOwnProperty('exclude')) {
  56956. obj.exclude = data.exclude
  56957. }
  56958. }
  56959. return obj;
  56960. }
  56961. }
  56962. ;// CONCATENATED MODULE: ./src/common/iServer/Sortby.js
  56963. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  56964. * This program are made available under the terms of the Apache License, Version 2.0
  56965. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56966. /**
  56967. * @class Sortby
  56968. * @deprecatedclass SuperMap.Sortby
  56969. * @classdesc 通过指定字段进行排序的方法类。
  56970. * @category BaseTypes Util
  56971. * @param {Object} options - 参数。
  56972. * @param {string} options.field 属性名称。
  56973. * @param {Sortby.Direction} options.direction 排序规则,默认升序。
  56974. * @usage
  56975. */
  56976. class Sortby {
  56977. constructor(options) {
  56978. /**
  56979. * @description 属性名称。
  56980. * @member {string} Sortby.prototype.field
  56981. */
  56982. this.field = undefined;
  56983. /**
  56984. * @description 排序规则。
  56985. * @member {Sortby.Direction} Sortby.prototype.direction
  56986. * @default Sortby.Direction.ASC
  56987. */
  56988. this.direction = Sortby.Direction.ASC;
  56989. this.CLASS_NAME = 'SuperMap.Sortby';
  56990. Util_Util.extend(this, options);
  56991. }
  56992. /**
  56993. * @function Sortby.prototype.destroy
  56994. * @description 释放资源,将引用资源的属性置空。
  56995. */
  56996. destroy() {
  56997. var me = this;
  56998. me.field = undefined;
  56999. me.direction = 'ASC';
  57000. }
  57001. /**
  57002. * @function Sortby.prototype.constructFromObject
  57003. * @description 目标对象新增该类的可选参数。
  57004. * @param {Object} data 要转换的数据。
  57005. * @param {Sortby} obj 返回的模型。
  57006. * @return {Sortby} 返回结果。
  57007. */
  57008. static constructFromObject(data, obj) {
  57009. if (data) {
  57010. obj = obj || new Sortby();
  57011. if (data.hasOwnProperty('field')) {
  57012. obj.field = data.field;
  57013. }
  57014. if (data.hasOwnProperty('direction')) {
  57015. obj.direction = data.direction;
  57016. }
  57017. }
  57018. return obj;
  57019. }
  57020. }
  57021. /**
  57022. * @enum Direction
  57023. * @description 排序的类型枚举。
  57024. * @memberOf Sortby
  57025. * @readonly
  57026. * @type {string}
  57027. */
  57028. Sortby.Direction = {
  57029. /** 升序。 */
  57030. ASC: 'ASC',
  57031. /** 降序。 */
  57032. DESC: 'DESC'
  57033. };
  57034. ;// CONCATENATED MODULE: ./src/common/iServer/ImageSearchParameter.js
  57035. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  57036. * This program are made available under the terms of the Apache License, Version 2.0
  57037. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57038. /**
  57039. * @class ImageSearchParameter
  57040. * @deprecatedclass SuperMap.ImageSearchParameter
  57041. * @classdesc 影像服务查询参数类。
  57042. * @category iServer Image
  57043. * @param {Object} options - 可选参数。
  57044. * @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)属性,由服务器决定是否使用单一的空间几何对象属性,还是使用所有相关的几何对象作为最终的查询空间范围。
  57045. * @param {Array.<string>} [options.collections] 影像集合的ID数组,将在该指定的Collection中搜索Items。
  57046. * @param {Array.<string>} [options.ids] 只返回指定 Item 的 ID 数组中的Item。返回的 Item 的 ID 值数组。设置了该参数,所有其他过滤器参数(除了next和limit)将被忽略。
  57047. * @param {number} [options.limit] 返回的最大结果数,即响应文档包含的 Item 的数目。
  57048. * @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 属性都包含在查询结果中。
  57049. * @param {Object} [options.query] 定义查询哪些属性,查询运算符将应用于这些属性。运算符包括:eq、neq、gt、lt、gte、lte、startsWith、endsWith、contains、in。其中in是Array.<string>类型,例如:{ "SmFileName": { "eq":"B49C001002.tif" }}
  57050. * @param {Array.<Sortby>} [options.sortby] 由包含属性名称和排序规则的对象构成的数组。
  57051. * @usage
  57052. */
  57053. class ImageSearchParameter {
  57054. constructor(options) {
  57055. /**
  57056. * @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)属性,由服务器决定是否使用单一的空间几何对象属性,还是使用所有相关的几何对象作为最终的查询空间范围。
  57057. * @member {Array.<number>} ImageSearchParameter.prototype.bbox
  57058. */
  57059. this.bbox = undefined;
  57060. /**
  57061. * @description 影像集合的ID数组,将在该指定的Collection中搜索Items。
  57062. * @member {Array.<string>} ImageSearchParameter.prototype.collections
  57063. */
  57064. this.collections = undefined;
  57065. /**
  57066. * @description 返回的 Item 的 ID 值数组。设置了该参数,所有其他过滤器参数(除了next和limit)将被忽略。
  57067. * @member {Array.<string>} ImageSearchParameter.prototype.ids
  57068. */
  57069. this.ids = undefined;
  57070. /**
  57071. * @description 单页返回的最大结果数。最小值为1,最大值为10000。
  57072. * @member {number} ImageSearchParameter.prototype.limit
  57073. */
  57074. this.limit = undefined;
  57075. /**
  57076. * @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 属性都包含在查询结果中。
  57077. * @member {FieldsFilter} ImageSearchParameter.prototype.fields
  57078. */
  57079. this.fields = undefined;
  57080. /**
  57081. * @description 定义查询哪些属性,查询运算符将应用于这些属性。
  57082. * @member {Object} ImageSearchParameter.prototype.query
  57083. */
  57084. this.query = undefined;
  57085. /**
  57086. * @description 由包含属性名称和排序规则的对象构成的数组。
  57087. * @member {Array.<Sortby>} ImageSearchParameter.prototype.sortby
  57088. */
  57089. this.sortby = undefined;
  57090. this.CLASS_NAME = 'SuperMap.ImageSearchParameter';
  57091. Util_Util.extend(this, options);
  57092. }
  57093. /**
  57094. * @function ImageSearchParameter.prototype.destroy
  57095. * @description 释放资源,将引用资源的属性置空。
  57096. */
  57097. destroy() {
  57098. var me = this;
  57099. me.bbox = undefined;
  57100. me.collections = undefined;
  57101. me.ids = undefined;
  57102. me.limit = undefined;
  57103. me.fields = undefined;
  57104. me.query = undefined;
  57105. me.sortby = undefined;
  57106. }
  57107. /**
  57108. * @function ImageSearchParameter.prototype.constructFromObject
  57109. * @description 目标对象新增该类的可选参数。
  57110. * @param {Object} data 要转换的数据。
  57111. * @param {ImageSearchParameter} obj 返回的模型。
  57112. * @return {ImageSearchParameter} 返回结果。
  57113. */
  57114. static constructFromObject(data, obj) {
  57115. if (data) {
  57116. obj = obj || new ImageSearchParameter();
  57117. if (data.hasOwnProperty('bbox')) {
  57118. obj.bbox = data.bbox;
  57119. }
  57120. if (data.hasOwnProperty('collections')) {
  57121. obj.collections = data.collections;
  57122. }
  57123. if (data.hasOwnProperty('ids')) {
  57124. obj.ids = data.ids;
  57125. }
  57126. if (data.hasOwnProperty('limit')) {
  57127. obj.limit = data.limit;
  57128. }
  57129. if (data.hasOwnProperty('fields')) {
  57130. obj.fields = (FieldsFilter.constructFromObject && FieldsFilter.constructFromObject(data.fields, {})) || data.fields;
  57131. }
  57132. if (data.hasOwnProperty('query')) {
  57133. obj.query = data.query;
  57134. }
  57135. if (data.hasOwnProperty('sortby')) {
  57136. obj.sortby = data.sortby;
  57137. if (data.sortby) {
  57138. obj.sortby = data.sortby.map((item) => {
  57139. return (Sortby.constructFromObject && Sortby.constructFromObject(item, {})) || item;
  57140. });
  57141. }
  57142. }
  57143. }
  57144. return obj;
  57145. }
  57146. }
  57147. ;// CONCATENATED MODULE: ./src/common/iServer/ImageStretchOption.js
  57148. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  57149. * This program are made available under the terms of the Apache License, Version 2.0
  57150. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57151. /**
  57152. * @class ImageStretchOption
  57153. * @deprecatedclass SuperMap.ImageStretchOption
  57154. * @classdesc 影像拉伸类。
  57155. * @category iServer Image
  57156. * @param {Object} options - 可选参数。
  57157. * @param {ImageStretchOption.StretchType} [options.stretchType] 影像拉伸类型。该属性的值有以下几种情况:NONE,无拉伸;GAUSSIAN,高斯拉伸;PERCENTCLIP,百分比截断拉伸;MINIMUMMAXIMUM,最值拉伸;STANDARDDEVIATION,标准差拉伸。
  57158. * @param {number} [options.stdevCoefficient] 标准差系数。
  57159. * @param {number} [options.gaussianCoefficient] 高斯系数。
  57160. * @param {boolean} [options.useMedianValue] 高斯拉伸时,是否使用中间值,若该属性值为true,表示使用中间值;false,表示使用平均值。
  57161. * @param {number} [options.minPercent] 使用百分比截断拉伸时,排除影像直方图最低值区域的像元,该参数值为这部分像元占总像元百分比。
  57162. * @param {number} [options.maxPercent] 使用百分比截断拉伸时,排除影像直方图最高值区域的像元,该参数值为这部分像元占总像元百分比。
  57163. * @usage
  57164. */
  57165. class ImageStretchOption {
  57166. constructor(options) {
  57167. /**
  57168. * @description 影像拉伸类型。该属性的值有以下几种情况:NONE,无拉伸;GAUSSIAN,高斯拉伸;PERCENTCLIP,百分比截断拉伸;MINIMUMMAXIMUM,最值拉伸;STANDARDDEVIATION,标准差拉伸。
  57169. * @member {ImageStretchOption.StretchType} ImageStretchOption.prototype.stretchType
  57170. */
  57171. this.stretchType = undefined;
  57172. /**
  57173. * @description 标准差系数。
  57174. * @member {number} ImageStretchOption.prototype.stdevCoefficient
  57175. */
  57176. this.stdevCoefficient = undefined;
  57177. /**
  57178. * @description 高斯系数。
  57179. * @member {number} ImageStretchOption.prototype.gaussianCoefficient
  57180. */
  57181. this.gaussianCoefficient = undefined;
  57182. /**
  57183. * @description 高斯拉伸时,是否使用中间值,若该属性值为true,表示使用中间值;false,表示使用平均值。
  57184. * @member {boolean} ImageStretchOption.prototype.useMedianValue
  57185. */
  57186. this.useMedianValue = undefined;
  57187. /**
  57188. * @description 使用百分比截断拉伸时,排除影像直方图最低值区域的像元,该参数值为这部分像元占总像元百分比。
  57189. * @member {number} ImageStretchOption.prototype.minPercent
  57190. */
  57191. this.minPercent = undefined;
  57192. /**
  57193. * @description 使用百分比截断拉伸时,排除影像直方图最高值区域的像元,该参数值为这部分像元占总像元百分比。
  57194. * @member {number} ImageStretchOption.prototype.maxPercent
  57195. */
  57196. this.maxPercent = undefined;
  57197. this.CLASS_NAME = 'SuperMap.ImageStretchOption';
  57198. Util_Util.extend(this, options);
  57199. }
  57200. /**
  57201. * @function ImageStretchOption.prototype.destroy
  57202. * @description 释放资源,将引用资源的属性置空。
  57203. */
  57204. destroy() {
  57205. var me = this;
  57206. me.stretchType = undefined;
  57207. me.stdevCoefficient = undefined;
  57208. me.gaussianCoefficient = undefined;
  57209. me.useMedianValue = undefined;
  57210. me.minPercent = undefined;
  57211. me.maxPercent = undefined;
  57212. }
  57213. /**
  57214. * @function ImageStretchOption.prototype.constructFromObject
  57215. * @description 目标对象新增该类的可选参数。
  57216. * @param {Object} data 要转换的数据。
  57217. * @param {ImageStretchOption} obj 返回的模型。
  57218. * @return {ImageStretchOption} 返回结果。
  57219. */
  57220. static constructFromObject(data, obj) {
  57221. if (data) {
  57222. obj = obj || new ImageStretchOption();
  57223. if (data.hasOwnProperty('stretchType')) {
  57224. obj.stretchType = data.stretchType;
  57225. }
  57226. if (data.hasOwnProperty('stdevCoefficient')) {
  57227. obj.stdevCoefficient = data.stdevCoefficient;
  57228. }
  57229. if (data.hasOwnProperty('gaussianCoefficient')) {
  57230. obj.gaussianCoefficient = data.gaussianCoefficient;
  57231. }
  57232. if (data.hasOwnProperty('useMedianValue')) {
  57233. obj.useMedianValue = data.useMedianValue;
  57234. }
  57235. if (data.hasOwnProperty('minPercent')) {
  57236. obj.minPercent = data.minPercent;
  57237. }
  57238. if (data.hasOwnProperty('maxPercent')) {
  57239. obj.maxPercent = data.maxPercent;
  57240. }
  57241. }
  57242. return obj;
  57243. }
  57244. }
  57245. /**
  57246. * @enum StretchType
  57247. * @description 影像拉伸类型枚举。
  57248. * @memberOf ImageStretchOption
  57249. * @readonly
  57250. * @type {string}
  57251. */
  57252. ImageStretchOption.StretchType = {
  57253. /** 无拉伸。 */
  57254. NONE: 'NONE',
  57255. /** 高斯拉伸。 */
  57256. GAUSSIAN: 'GAUSSIAN',
  57257. /** 百分比截断拉伸。 */
  57258. PERCENTCLIP: 'PERCENTCLIP',
  57259. /** 最值拉伸。 */
  57260. MINIMUMMAXIMUM: 'MINIMUMMAXIMUM',
  57261. /** 标准差拉伸。 */
  57262. STANDARDDEVIATION: 'STANDARDDEVIATION'
  57263. };
  57264. ;// CONCATENATED MODULE: ./src/common/iServer/ImageRenderingRule.js
  57265. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  57266. * This program are made available under the terms of the Apache License, Version 2.0
  57267. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57268. /**
  57269. * @class ImageRenderingRule
  57270. * @deprecatedclass SuperMap.ImageRenderingRule
  57271. * @classdesc 定义请求的影像如何进行渲染或者处理,如:影像的拉伸显示方式、颜色表、波段组合以及应用栅格函数进行快速处理等。
  57272. * @category iServer Image
  57273. * @param {Object} options - 可选参数。
  57274. * @param {ImageRenderingRule.DisplayMode} [options.displayMode] 影像显示模式,其中:Composite表示多波段组合显示;Stretched表示单波段拉伸显示。
  57275. * @param {string} [options.displayBands] 影像显示的波段或者波段组合。若影像的显示模式为STRETCHED,该属性指定一个波段的索引号(波段索引号从0开始计数);若影像的显示模式为COMPOSITE,该属性为组合的波段索引号,例如:属性值3,2,1表示采用4波段、3波段、2波段分别对应 R、G、B颜色通道进行组合显示。
  57276. * @param {ImageStretchOption} [options.stretchOption] 影像的拉伸参数。
  57277. * @param {ImageRenderingRule.InterpolationMode} [options.interpolationMode] 影像显示时使用的插值算法。
  57278. * @param {Array.<string>} [options.colorScheme] 影像拉伸显示的颜色方案。颜色方案为RGBA颜色数组。RGBA是代表Red(红色)Green(绿色)Blue(蓝色)和Alpha的色彩空间。Alpha值可以省略不写,表示完全不透明。Alpha通道表示不透明度参数,若该值为0表示完全透明。例如:"255,0,0","0,255,0","0,0,255" 表示由红色、绿色、蓝色三种颜色构成的色带。
  57279. * @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"。
  57280. * @param {number} [options.brightness] 影像显示的亮度。数值范围为-100到100,增加亮度为正,降低亮度为负。
  57281. * @param {number} [options.contrast] 影像显示的对比度。数值范围为-100到100,增加对比度为正,降低对比度为负。
  57282. * @param {string} [options.noData] 影像的无值。影像为多波段时,通过逗号分隔 R,G,B 颜色通道对应波段的无值。
  57283. * @param {string} [options.noDataColor] 影像的无值的显示颜色,支持RGB颜色,例如:255,0,0(红色),那么无值将以指定的红色显示。
  57284. * @param {boolean} [options.noDataTransparent] 无值是否透明显示,true表示透明显示无值;否则为false。
  57285. * @param {string} [options.backgroundValue] 影像的背景值。影像为多波段时,通过逗号分隔 R,G,B 颜色通道对应波段的背景值。
  57286. * @param {string} [options.backgroundColor] 指定背景值的颜色。支持指定RGB颜色,例如:255,0,0(红色),那么背景值将以指定的红色显示。
  57287. * @param {boolean} [options.backgroundTransparent] 背景值是否透明显示,true表示透明显示背景值;否则为false。
  57288. * @param {Array.<ImageGFHillShade|ImageGFSlope|ImageGFAspect|ImageGFOrtho>} [options.gridFunctions] 栅格函数链。
  57289. * @usage
  57290. */
  57291. class ImageRenderingRule {
  57292. constructor(options) {
  57293. /**
  57294. * @description 影像显示模式,其中:Composite表示多波段组合显示;Stretched表示单波段拉伸显示。
  57295. * @member {ImageRenderingRule.DisplayMode} ImageRenderingRule.prototype.displayMode
  57296. */
  57297. this.displayMode = undefined;
  57298. /**
  57299. * @description 影像显示的波段或者波段组合。该参数为一个数组,数组元素为波段索引号。若影像的显示模式为Stretched,该属性指定一个显示的波段;若影像的显示模式为Composite,该属性为组合的波段索引号,例如:属性值4,3,2表示采用4波段、3波段、2波段分别对应 R、G、B颜色通道进行组合显示。
  57300. * @member {string} ImageRenderingRule.prototype.displayBands
  57301. */
  57302. this.displayBands = undefined;
  57303. /**
  57304. * @description 影像的拉伸参数。
  57305. * @member {ImageStretchOption} ImageRenderingRule.prototype.stretchOption
  57306. */
  57307. this.stretchOption = undefined;
  57308. /**
  57309. * @description 影像显示时使用的插值算法。
  57310. * @member {ImageRenderingRule.InterpolationMode} ImageRenderingRule.prototype.interpolationMode
  57311. */
  57312. this.interpolationMode = undefined;
  57313. /**
  57314. * @description 影像拉伸显示的颜色方案。颜色方案为RGBA颜色数组。RGBA是代表Red(红色)Green(绿色)Blue(蓝色)和Alpha的色彩空间。Alpha值可以省略不写,表示完全不透明。Alpha通道表示不透明度参数,若该值为0表示完全透明。例如:"255,0,0","0,255,0","0,0,255" 表示由红色、绿色、蓝色三种颜色构成的色带。
  57315. * @member {Array.<string>} ImageRenderingRule.prototype.colorScheme
  57316. */
  57317. this.colorScheme = undefined;
  57318. /**
  57319. * @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"
  57320. * @member {Array.<string>} ImageRenderingRule.prototype.colorTable
  57321. */
  57322. this.colorTable = undefined;
  57323. /**
  57324. * @description 影像显示的亮度。数值范围为-100到100,增加亮度为正,降低亮度为负。
  57325. * @member {number} ImageRenderingRule.prototype.brightness
  57326. */
  57327. this.brightness = undefined;
  57328. /**
  57329. * @description 影像显示的对比度。数值范围为-100到100,增加对比度为正,降低对比度为负。
  57330. * @member {number} ImageRenderingRule.prototype.contrast
  57331. */
  57332. this.contrast = undefined;
  57333. /**
  57334. * @description 影像的无值。影像为多波段时,通过逗号分隔 R,G,B 颜色通道对应波段的无值。
  57335. * @member {string} ImageRenderingRule.prototype.noData
  57336. */
  57337. this.noData = undefined;
  57338. /**
  57339. * @description 影像的无值的显示颜色,支持RGB颜色,例如:255,0,0(红色),那么无值将以指定的红色显示。
  57340. * @member {string} ImageRenderingRule.prototype.noDataColor
  57341. */
  57342. this.noDataColor = undefined;
  57343. /**
  57344. * @description 无值是否透明显示,true表示透明显示无值;否则为false。
  57345. * @member {boolean} ImageRenderingRule.prototype.noDataTransparent
  57346. */
  57347. this.noDataTransparent = undefined;
  57348. /**
  57349. * @description 影像的背景值。影像为多波段时,通过逗号分隔 R,G,B 颜色通道对应波段的背景值。
  57350. * @member {string} ImageRenderingRule.prototype.backgroundValue
  57351. */
  57352. this.backgroundValue = undefined;
  57353. /**
  57354. * @description 指定背景值的颜色。支持指定RGB颜色,例如:255,0,0(红色),那么背景值将以指定的红色显示。
  57355. * @member {string} ImageRenderingRule.prototype.backgroundColor
  57356. */
  57357. this.backgroundColor = undefined;
  57358. /**
  57359. * @description 背景值是否透明显示,true表示透明显示背景值;否则为false。
  57360. * @member {boolean} ImageRenderingRule.prototype.backgroundTransparent
  57361. */
  57362. this.backgroundTransparent = undefined;
  57363. /**
  57364. * @description 栅格函数选项,通过应用栅格函数,可以对影像进行快速显示处理。
  57365. * @member {Array.<ImageGFHillShade|ImageGFSlope|ImageGFAspect|ImageGFOrtho>} ImageRenderingRule.prototype.gridFunctions
  57366. */
  57367. this.gridFunctions = undefined;
  57368. this.CLASS_NAME = 'SuperMap.ImageRenderingRule';
  57369. Util_Util.extend(this, options);
  57370. }
  57371. /**
  57372. * @function ImageRenderingRule.prototype.destroy
  57373. * @description 释放资源,将引用资源的属性置空。
  57374. */
  57375. destroy() {
  57376. var me = this;
  57377. me.displayMode = undefined;
  57378. me.displayBands = undefined;
  57379. me.stretchOption = undefined;
  57380. me.interpolationMode = undefined;
  57381. me.colorScheme = undefined;
  57382. me.colorTable = undefined;
  57383. me.brightness = undefined;
  57384. me.contrast = undefined;
  57385. me.noData = undefined;
  57386. me.noDataColor = undefined;
  57387. me.noDataTransparent = undefined;
  57388. me.backgroundValue = undefined;
  57389. me.backgroundColor = undefined;
  57390. me.backgroundTransparent = undefined;
  57391. me.gridFuncOptions = undefined;
  57392. }
  57393. /**
  57394. * @function ImageRenderingRule.prototype.constructFromObject
  57395. * @description 目标对象新增该类的可选参数。
  57396. * @param {Object} data 要转换的数据。
  57397. * @param {ImageRenderingRule} obj 返回的模型。
  57398. * @return {ImageRenderingRule} 返回结果。
  57399. */
  57400. static constructFromObject(data, obj) {
  57401. if (data) {
  57402. obj = obj || new ImageRenderingRule();
  57403. if (data.hasOwnProperty('displayMode')) {
  57404. obj.displayMode = data.displayMode;
  57405. }
  57406. if (data.hasOwnProperty('displayBands')) {
  57407. obj.displayBands = data.displayBands;
  57408. }
  57409. if (data.hasOwnProperty('stretchOption')) {
  57410. obj.stretchOption =
  57411. (ImageStretchOption.constructFromObject && ImageStretchOption.constructFromObject(data.stretchOption, {})) ||
  57412. data.stretchOption;
  57413. }
  57414. if (data.hasOwnProperty('interpolationMode')) {
  57415. obj.interpolationMode = data.interpolationMode;
  57416. }
  57417. if (data.hasOwnProperty('colorScheme')) {
  57418. obj.colorScheme = data.colorScheme;
  57419. }
  57420. if (data.hasOwnProperty('colorTable')) {
  57421. obj.colorTable = data.colorTable;
  57422. }
  57423. if (data.hasOwnProperty('brightness')) {
  57424. obj.brightness = data.brightness;
  57425. }
  57426. if (data.hasOwnProperty('contrast')) {
  57427. obj.contrast = data.contrast;
  57428. }
  57429. if (data.hasOwnProperty('noData')) {
  57430. obj.noData = data.noData;
  57431. }
  57432. if (data.hasOwnProperty('noDataColor')) {
  57433. obj.noDataColor = data.noDataColor;
  57434. }
  57435. if (data.hasOwnProperty('backgroundValue')) {
  57436. obj.backgroundValue = data.backgroundValue;
  57437. }
  57438. if (data.hasOwnProperty('noDataTransparent')) {
  57439. obj.noDataTransparent = data.noDataTransparent;
  57440. }
  57441. if (data.hasOwnProperty('backgroundColor')) {
  57442. obj.backgroundColor = data.backgroundColor;
  57443. }
  57444. if (data.hasOwnProperty('backgroundTransparent')) {
  57445. obj.backgroundTransparent = data.backgroundTransparent;
  57446. }
  57447. if (data.hasOwnProperty('gridFunctions')) {
  57448. obj.gridFunctions = data.gridFunctions;
  57449. }
  57450. }
  57451. return obj;
  57452. }
  57453. }
  57454. /**
  57455. * @enum DisplayMode
  57456. * @description 影像显示模式。
  57457. * @memberOf ImageRenderingRule
  57458. * @readonly
  57459. * @type {string}
  57460. */
  57461. ImageRenderingRule.DisplayMode = {
  57462. COMPOSITE: 'COMPOSITE',
  57463. STRETCHED: 'Stretched'
  57464. };
  57465. /**
  57466. * @enum InterpolationMode
  57467. * @description 影像显示时使用的插值算法枚举。
  57468. * @memberOf ImageRenderingRule
  57469. * @readonly
  57470. * @type {string}
  57471. */
  57472. ImageRenderingRule.InterpolationMode = {
  57473. /** 最邻近插值模式。 */
  57474. NEARESTNEIGHBOR: 'NEARESTNEIGHBOR',
  57475. /** 高质量的双线性插值模式。 */
  57476. HIGHQUALITYBILINEAR: 'HIGHQUALITYBILINEAR',
  57477. /** 默认插值模式。 */
  57478. DEFAULT: 'DEFAULT'
  57479. };
  57480. ;// CONCATENATED MODULE: ./src/common/iServer/ImageGFHillShade.js
  57481. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  57482. * This program are made available under the terms of the Apache License, Version 2.0
  57483. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57484. /**
  57485. * @class ImageGFHillShade
  57486. * @deprecatedclass SuperMap.ImageGFHillShade
  57487. * @classdesc 栅格函数对象:对DEM数据生成三维晕渲图。
  57488. * @category iServer Image
  57489. * @param {Object} options - 可选参数。
  57490. * @param {string} [options.girdFuncName='GFHillShade'] 栅格函数名称,参数值为:GFHillShade。
  57491. * @param {number} [options.Azimuth = 315] 光源方位角。用于确定光源的方向,是从光源所在位置的正北方向线起,依顺时针方向到光源与目标方向线的夹角,范围为 0-360 度,以正北方向为 0 度,依顺时针方向递增。默认值为:315。
  57492. * @param {number} [options.Altitude = 45] 光源高度角。用于确定光源照射的倾斜角度,是光源与目标的方向线与水平面间的夹角,范围为 0-90 度。当光源高度角为 90 度时,光源正射地表。默认值为:45。
  57493. * @param {number} [options.ZFactor = 1] 高程缩放系数。如果设置为 1.0,表示不缩放。默认值为:1。
  57494. * @usage
  57495. */
  57496. class ImageGFHillShade {
  57497. constructor(options) {
  57498. /**
  57499. * @description 栅格函数名称,参数值为:GFHillShade。
  57500. * @member {string} ImageGFHillShade.prototype.girdFuncName
  57501. * @default 'GFHillShade'
  57502. */
  57503. this.girdFuncName = 'GFHillShade';
  57504. /**
  57505. * @description 光源方位角。用于确定光源的方向,是从光源所在位置的正北方向线起,依顺时针方向到光源与目标方向线的夹角,范围为 0-360 度,以正北方向为 0 度,依顺时针方向递增。默认值为:315。
  57506. * @member {number} ImageGFHillShade.prototype.Azimuth
  57507. */
  57508. this.Azimuth = 315;
  57509. /**
  57510. * @description 光源高度角。用于确定光源照射的倾斜角度,是光源与目标的方向线与水平面间的夹角,范围为 0-90 度。当光源高度角为 90 度时,光源正射地表。默认值为:45。
  57511. * @member {number} ImageGFHillShade.prototype.Altitude
  57512. */
  57513. this.Altitude = 45;
  57514. /**
  57515. * @description 高程缩放系数。如果设置为 1.0,表示不缩放。默认值为:1。
  57516. * @member {number} ImageGFHillShade.prototype.ZFactor
  57517. */
  57518. this.ZFactor = 1;
  57519. this.CLASS_NAME = 'SuperMap.ImageGFHillShade';
  57520. Util_Util.extend(this, options);
  57521. }
  57522. /**
  57523. * @function ImageGFHillShade.prototype.destroy
  57524. * @description 释放资源,将引用资源的属性置空。
  57525. */
  57526. destroy() {
  57527. var me = this;
  57528. me.girdFuncName = 'GFHillShade';
  57529. me.Azimuth = 315;
  57530. me.Altitude = 45;
  57531. me.ZFactor = 1;
  57532. }
  57533. /**
  57534. * @function ImageGFHillShade.prototype.constructFromObject
  57535. * @description 目标对象新增该类的可选参数。
  57536. * @param {Object} data 要转换的数据。
  57537. * @param {ImageGFHillShade} obj 返回的模型。
  57538. * @return {ImageGFHillShade} 返回结果。
  57539. */
  57540. static constructFromObject(data, obj) {
  57541. if (data) {
  57542. obj = obj || new ImageGFHillShade();
  57543. if (data.hasOwnProperty('girdFuncName')) {
  57544. obj.girdFuncName = data.girdFuncName
  57545. }
  57546. if (data.hasOwnProperty('Azimuth')) {
  57547. obj.Azimuth = data.Azimuth
  57548. }
  57549. if (data.hasOwnProperty('Altitude')) {
  57550. obj.Altitude = data.Altitude
  57551. }
  57552. if (data.hasOwnProperty('ZFactor')) {
  57553. obj.ZFactor = data.ZFactor
  57554. }
  57555. }
  57556. return obj;
  57557. }
  57558. }
  57559. ;// CONCATENATED MODULE: ./src/common/iServer/ImageGFAspect.js
  57560. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  57561. * This program are made available under the terms of the Apache License, Version 2.0
  57562. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57563. /**
  57564. * @class ImageGFAspect
  57565. * @deprecatedclass SuperMap.ImageGFAspect
  57566. * @classdesc 栅格函数对象:对DEM数据生成坡向渲图。
  57567. * @category iServer Image
  57568. * @param {Object} options -可选参数。
  57569. * @param {string} [options.girdFuncName='GFAspect'] 栅格函数名称,参数值为:GFAspect。
  57570. * @param {number} [options.Azimuth] 光源方位角,固定为360度。
  57571. * @usage
  57572. */
  57573. class ImageGFAspect {
  57574. constructor(options) {
  57575. /**
  57576. * @description 栅格函数名称,参数值为:GFAspect。
  57577. * @member {string} ImageGFAspect.prototype.girdFuncName
  57578. * @default 'GFAspect'
  57579. */
  57580. this.girdFuncName = 'GFAspect';
  57581. /**
  57582. * @description 光源方位角,固定为360度。
  57583. * @member {number} ImageGFAspect.prototype.Azimuth
  57584. */
  57585. this.Azimuth = undefined;
  57586. this.CLASS_NAME = 'SuperMap.ImageGFAspect';
  57587. Util_Util.extend(this, options);
  57588. }
  57589. /**
  57590. * @function ImageGFAspect.prototype.destroy
  57591. * @description 释放资源,将引用资源的属性置空。
  57592. */
  57593. destroy() {
  57594. var me = this;
  57595. me.girdFuncName = 'GFAspect';
  57596. me.Azimuth = undefined;
  57597. }
  57598. /**
  57599. * @function ImageGFAspect.prototype.constructFromObject
  57600. * @description 目标对象新增该类的可选参数。
  57601. * @param {Object} data 要转换的数据。
  57602. * @param {ImageGFAspect} obj 返回的模型。
  57603. * @return {ImageGFAspect} 返回结果。
  57604. */
  57605. static constructFromObject(data, obj) {
  57606. if (data) {
  57607. obj = obj || new ImageGFAspect();
  57608. if (data.hasOwnProperty('girdFuncName')) {
  57609. obj.girdFuncName = data.girdFuncName
  57610. }
  57611. if (data.hasOwnProperty('Azimuth')) {
  57612. obj.Azimuth = data.Azimuth
  57613. }
  57614. }
  57615. return obj;
  57616. }
  57617. }
  57618. ;// CONCATENATED MODULE: ./src/common/iServer/ImageGFOrtho.js
  57619. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  57620. * This program are made available under the terms of the Apache License, Version 2.0
  57621. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57622. /**
  57623. * @class ImageGFOrtho
  57624. * @deprecatedclass SuperMap.ImageGFOrtho
  57625. * @classdesc 栅格函数对象:对DEM数据生成三维晕渲图。该栅格函数不需要输入参数,采用系统默认设置。
  57626. * @category iServer Image
  57627. * @param {Object} options - 可选参数。
  57628. * @param {string} [options.girdFuncName='GFOrtho'] 栅格函数名称,参数值为:GFOrtho。
  57629. * @usage
  57630. */
  57631. class ImageGFOrtho {
  57632. constructor(options) {
  57633. /**
  57634. * @description 栅格函数名称,参数值为:GFOrtho。
  57635. * @member {string} ImageGFOrtho.prototype.girdFuncName
  57636. * @default 'GFOrtho'
  57637. */
  57638. this.girdFuncName = 'GFOrtho';
  57639. this.CLASS_NAME = 'SuperMap.ImageGFOrtho';
  57640. Util_Util.extend(this, options);
  57641. }
  57642. /**
  57643. * @function ImageGFOrtho.prototype.destroy
  57644. * @description 释放资源,将引用资源的属性置空。
  57645. */
  57646. destroy() {
  57647. var me = this;
  57648. me.girdFuncName = 'GFOrtho';
  57649. }
  57650. /**
  57651. * @function ImageGFOrtho.prototype.constructFromObject
  57652. * @description 目标对象新增该类的可选参数。
  57653. * @param {Object} data 要转换的数据。
  57654. * @param {ImageGFOrtho} obj 返回的模型。
  57655. * @return {ImageGFOrtho} 返回结果。
  57656. */
  57657. static constructFromObject(data, obj) {
  57658. if (data) {
  57659. obj = obj || new ImageGFOrtho();
  57660. if (data.hasOwnProperty('girdFuncName')) {
  57661. obj.girdFuncName = data.girdFuncName
  57662. }
  57663. }
  57664. return obj;
  57665. }
  57666. }
  57667. ;// CONCATENATED MODULE: ./src/common/iServer/ImageGFSlope.js
  57668. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  57669. * This program are made available under the terms of the Apache License, Version 2.0
  57670. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57671. /**
  57672. * @class ImageGFSlope
  57673. * @deprecatedclass SuperMap.ImageGFSlope
  57674. * @classdesc 栅格函数对象:对DEM数据生成坡度图。
  57675. * @category iServer Image
  57676. * @param {Object} options - 可选参数。
  57677. * @param {string} [options.girdFuncName='GFSlope'] 栅格函数名称,参数值为:GFSlope。
  57678. * @param {number} [options.Altitude = 45] 光源高度角。用于确定光源照射的倾斜角度,是光源与目标的方向线与水平面间的夹角,范围为 0-90 度。当光源高度角为 90 度时,光源正射地表。默认值为:45。
  57679. * @param {number} [options.ZFactor = 1] 高程缩放系数。如果设置为 1.0,表示不缩放。默认值为:1。
  57680. * @usage
  57681. */
  57682. class ImageGFSlope {
  57683. constructor(options) {
  57684. /**
  57685. * @description 栅格函数名称,参数值为:GFSlope。
  57686. * @member {string} ImageGFSlope.prototype.girdFuncName
  57687. * @default 'GFSlope'
  57688. */
  57689. this.girdFuncName = 'GFSlope';
  57690. /**
  57691. * @description 光源高度角。用于确定光源照射的倾斜角度,是光源与目标的方向线与水平面间的夹角,范围为 0-90 度。当光源高度角为 90 度时,光源正射地表。默认值为:45。
  57692. * @member {number} ImageGFSlope.prototype.Altitude
  57693. */
  57694. this.Altitude = 45;
  57695. /**
  57696. * @description 高程缩放系数。如果设置为 1.0,表示不缩放。默认值为:1。
  57697. * @member {number} ImageGFSlope.prototype.ZFactor
  57698. */
  57699. this.ZFactor = 1;
  57700. this.CLASS_NAME = 'SuperMap.ImageGFSlope';
  57701. Util_Util.extend(this, options);
  57702. }
  57703. /**
  57704. * @function ImageGFSlope.prototype.destroy
  57705. * @description 释放资源,将引用资源的属性置空。
  57706. */
  57707. destroy() {
  57708. var me = this;
  57709. me.girdFuncName = 'GFSlope';
  57710. me.Altitude = 45;
  57711. me.ZFactor = 1;
  57712. }
  57713. /**
  57714. * @function ImageGFSlope.prototype.constructFromObject
  57715. * @description 目标对象新增该类的可选参数。
  57716. * @param {Object} data 要转换的数据。
  57717. * @param {ImageGFSlope} obj 返回的模型。
  57718. * @return {ImageGFSlope} 返回结果。
  57719. */
  57720. static constructFromObject(data, obj) {
  57721. if (data) {
  57722. obj = obj || new ImageGFSlope();
  57723. if (data.hasOwnProperty('girdFuncName')) {
  57724. obj.girdFuncName = data.girdFuncName
  57725. }
  57726. if (data.hasOwnProperty('Altitude')) {
  57727. obj.Altitude = data.Altitude
  57728. }
  57729. if (data.hasOwnProperty('ZFactor')) {
  57730. obj.ZFactor = data.ZFactor
  57731. }
  57732. }
  57733. return obj;
  57734. }
  57735. }
  57736. ;// CONCATENATED MODULE: ./src/common/iServer/KnowledgeGraphNodeParameter.js
  57737. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  57738. * This program are made available under the terms of the Apache License, Version 2.0
  57739. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57740. /**
  57741. * @private
  57742. * @class KnowledgeGraphNodeParameter
  57743. * @deprecatedclass SuperMap.KnowledgeGraphNodeParameter
  57744. * @classdesc 知识图谱实体的参数设置。
  57745. * @category iServer KnowledgeGraph
  57746. * @version 11.1.0
  57747. * @param {Object} options - 参数。
  57748. * @param {string} options.id - 实体id。
  57749. * @param {Array.<string>} [options.labels] - 实体分类。
  57750. * @param {Object} [options.properties] - 属性。
  57751. * @usage
  57752. */
  57753. // {
  57754. // "id": 5348024557502471,
  57755. // "properties": {
  57756. // "server": "test1",
  57757. // "_labelfieldname": "FEATUREGUID",
  57758. // "_entityname": "院落",
  57759. // "_bindfindid": "院落@ST_YARDA@1",
  57760. // "FEATUREGUID": "{409E615B-A545-4E07-872D-B12EDA0B4A1A}",
  57761. // "_findid": 1,
  57762. // "ENTITYNAME": "公共管理与公共服务"
  57763. // },
  57764. // "labels": ["院落"]
  57765. // }
  57766. class KnowledgeGraphNodeParameter {
  57767. constructor(options) {
  57768. /**
  57769. * @member {string} KnowledgeGraphNodeParameter.prototype.id
  57770. * @description 实体ID。
  57771. */
  57772. this.id = null;
  57773. /**
  57774. * @member {Array.<string>} KnowledgeGraphNodeParameter.prototype.labels
  57775. * @description 实体分类。
  57776. */
  57777. this.labels = null;
  57778. /**
  57779. * @member {Object} KnowledgeGraphNodeParameter.prototype.properties
  57780. * @description 实体属性。
  57781. */
  57782. this.properties = null;
  57783. this.CLASS_NAME = 'SuperMap.KnowledgeGraphNodeParameter';
  57784. Util.extend(this, options);
  57785. }
  57786. destroy() {
  57787. var me = this;
  57788. me.id = null;
  57789. me.labels = null;
  57790. me.properties = null;
  57791. }
  57792. }
  57793. ;// CONCATENATED MODULE: ./src/common/iServer/KnowledgeGraphEdgeParameter.js
  57794. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  57795. * This program are made available under the terms of the Apache License, Version 2.0
  57796. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57797. /**
  57798. * @private
  57799. * @class KnowledgeGraphEdgeParameter
  57800. * @deprecatedclass SuperMap.KnowledgeGraphEdgeParameter
  57801. * @classdesc 知识图谱关系的参数设置。
  57802. * @category iServer KnowledgeGraph
  57803. * @version 11.1.0
  57804. * @param {Object} options - 参数。
  57805. * @param {string} options.id - 边id。
  57806. * @param {string} options.start - 开始实体id。
  57807. * @param {string} options.end - 结束实体id。
  57808. * @param {string} [options.type] - 标签,关系。
  57809. * @param {Object} [options.properties] - 属性。
  57810. * @usage
  57811. */
  57812. class KnowledgeGraphEdgeParameter {
  57813. constructor(options) {
  57814. /**
  57815. * @member {string} KnowledgeGraphEdgeParameter.prototype.id
  57816. * @description 边id。
  57817. */
  57818. this.id = null;
  57819. /**
  57820. * @member {string} KnowledgeGraphEdgeParameter.prototype.start
  57821. * @description 开始实体id。
  57822. */
  57823. this.start = null;
  57824. /**
  57825. * @member {string} KnowledgeGraphEdgeParameter.prototype.end
  57826. * @description 结束实体id。
  57827. */
  57828. this.end = null;
  57829. /**
  57830. * @member {string} KnowledgeGraphEdgeParameter.prototype.type
  57831. * @description 标签,关系。
  57832. */
  57833. this.type = null;
  57834. /**
  57835. * @member {Object} KnowledgeGraphEdgeParameter.prototype.properties
  57836. * @description 实体属性。
  57837. */
  57838. this.properties = null;
  57839. this.CLASS_NAME = 'SuperMap.KnowledgeGraphEdgeParameter';
  57840. Util.extend(this, options);
  57841. }
  57842. destroy() {
  57843. var me = this;
  57844. me.id = null;
  57845. me.start = null;
  57846. me.end = null;
  57847. me.type = null;
  57848. me.properties = null;
  57849. }
  57850. }
  57851. ;// CONCATENATED MODULE: ./src/common/iServer/index.js
  57852. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  57853. * This program are made available under the terms of the Apache License, Version 2.0
  57854. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57855. ;// CONCATENATED MODULE: ./src/common/online/OnlineResources.js
  57856. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  57857. * This program are made available under the terms of the Apache License, Version 2.0
  57858. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57859. /**
  57860. * @enum ServiceStatus
  57861. * @category BaseTypes Constant
  57862. * @description 服务发布状态。
  57863. * @usage
  57864. * ```
  57865. * // 浏览器
  57866. * <script type="text/javascript" src="{cdn}"></script>
  57867. * <script>
  57868. * const result = {namespace}.ServiceStatus.DOES_NOT_INVOLVE;
  57869. *
  57870. * </script>
  57871. * // ES6 Import
  57872. * import { ServiceStatus } from '{npm}';
  57873. *
  57874. * const result = ServiceStatus.DOES_NOT_INVOLVE;
  57875. * ```
  57876. */
  57877. var ServiceStatus = {
  57878. /** 不涉及,不可发布。 */
  57879. DOES_NOT_INVOLVE: "DOES_NOT_INVOLVE",
  57880. /** 发布失败。 */
  57881. PUBLISH_FAILED: "PUBLISH_FAILED",
  57882. /** 已发布。 */
  57883. PUBLISHED: "PUBLISHED",
  57884. /** 正在发布。 */
  57885. PUBLISHING: "PUBLISHING",
  57886. /** 未发布。 */
  57887. UNPUBLISHED: "UNPUBLISHED",
  57888. /** 取消服务失败。 */
  57889. UNPUBLISHED_FAILED: "UNPUBLISHED_FAILED"
  57890. };
  57891. /**
  57892. * @enum DataItemOrderBy
  57893. * @category BaseTypes Constant
  57894. * @description 数据排序字段。
  57895. * @usage
  57896. * ```
  57897. * // 浏览器
  57898. * <script type="text/javascript" src="{cdn}"></script>
  57899. * <script>
  57900. * const result = {namespace}.DataItemOrderBy.FILENAME;
  57901. *
  57902. * </script>
  57903. * // ES6 Import
  57904. * import { DataItemOrderBy } from '{npm}';
  57905. *
  57906. * const result = DataItemOrderBy.FILENAME;
  57907. * ```
  57908. */
  57909. var DataItemOrderBy = {
  57910. /** 文件名。 */
  57911. FILENAME: "FILENAME",
  57912. /** ID。 */
  57913. ID: "ID",
  57914. /** 最后修改时间。 */
  57915. LASTMODIFIEDTIME: "LASTMODIFIEDTIME",
  57916. /** 作者昵称。 */
  57917. NICKNAME: "NICKNAME",
  57918. /** SERVICESTATUS。 */
  57919. SERVICESTATUS: "SERVICESTATUS",
  57920. /** 大小。 */
  57921. SIZE: "SIZE",
  57922. /** 状态。 */
  57923. STATUS: "STATUS",
  57924. /** 类型。 */
  57925. TYPE: "TYPE",
  57926. /** 更新时间。 */
  57927. UPDATETIME: "UPDATETIME",
  57928. /** 作者名。 */
  57929. USERNAME: "USERNAME"
  57930. };
  57931. /**
  57932. * @enum FilterField {number}
  57933. * @category BaseTypes Constant
  57934. * @description 关键字查询时的过滤字段。
  57935. * @usage
  57936. * ```
  57937. * // 浏览器
  57938. * <script type="text/javascript" src="{cdn}"></script>
  57939. * <script>
  57940. * const result = {namespace}.FilterField.LINKPAGE;
  57941. *
  57942. * </script>
  57943. * // ES6 Import
  57944. * import { FilterField } from '{npm}';
  57945. *
  57946. * const result = FilterField.LINKPAGE;
  57947. * ```
  57948. */
  57949. var FilterField = {
  57950. /** 服务地址。 */
  57951. LINKPAGE: "LINKPAGE",
  57952. /** 服务中包含的地图的名称。 */
  57953. MAPTITLE: "MAPTITLE",
  57954. /** 服务创建者昵称。 */
  57955. NICKNAME: "NICKNAME",
  57956. /** 服务名称。 */
  57957. RESTITLE: "RESTITLE",
  57958. /** 服务创建者用户名。 */
  57959. USERNAME: "USERNAME"
  57960. };
  57961. ;// CONCATENATED MODULE: ./src/common/online/OnlineServiceBase.js
  57962. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  57963. * This program are made available under the terms of the Apache License, Version 2.0
  57964. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57965. /**
  57966. * @class OnlineServiceBase
  57967. * @deprecatedclass SuperMap.OnlineServiceBase
  57968. * @classdesc Online 服务基类(使用 key 作为权限限制的类需要实现此类)。
  57969. * @category iPortal/Online Core
  57970. * @param {Object} options - 可选参数。
  57971. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  57972. * @param {Object} [options.headers] - 请求头。
  57973. * @usage
  57974. */
  57975. class OnlineServiceBase {
  57976. constructor(options) {
  57977. options = options || {};
  57978. Util_Util.extend(this, options);
  57979. this.CLASS_NAME = "SuperMap.OnlineServiceBase";
  57980. }
  57981. /**
  57982. * @function OnlineServiceBase.prototype.request
  57983. * @description 请求 online 服务
  57984. * @param {string} [method='GET'] - 请求方式, 'GET', 'PUT', 'POST', 'DELETE'。
  57985. * @param {string} url - 服务地址。
  57986. * @param {Object} param - URL 查询参数。
  57987. * @param {Object} [requestOptions] - http 请求参数, 比如请求头,超时时间等。
  57988. * @returns {Promise} 包含请求结果的 Promise 对象。
  57989. */
  57990. request(method, url, param, requestOptions = {}) {
  57991. url = SecurityManager.appendCredential(url);
  57992. requestOptions['crossOrigin'] = this.options.crossOrigin;
  57993. requestOptions['headers'] = this.options.headers;
  57994. return FetchRequest.commit(method, url, param, requestOptions).then(function(response) {
  57995. return response.json();
  57996. });
  57997. }
  57998. }
  57999. ;// CONCATENATED MODULE: ./src/common/online/OnlineData.js
  58000. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  58001. * This program are made available under the terms of the Apache License, Version 2.0
  58002. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58003. /**
  58004. * @class OnlineData
  58005. * @deprecatedclass SuperMap.OnlineData
  58006. * @classdesc Online myData 服务。
  58007. * @category iPortal/Online Resources Data
  58008. * @param {string} serviceRootUrl - 服务地址。
  58009. * @param {Object} options - 可选参数。
  58010. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  58011. * @param {Object} [options.headers] - 请求头。
  58012. * @usage
  58013. * @extends OnlineServiceBase
  58014. */
  58015. class OnlineData extends OnlineServiceBase {
  58016. //TODO 目前并没有对接服务支持的所有操作,日后需要补充完整
  58017. constructor(serviceRootUrl, options) {
  58018. super(serviceRootUrl);
  58019. options = options || {};
  58020. //MD5
  58021. this.MD5 = null;
  58022. //文件类型。
  58023. this.type = null;
  58024. //数据上传者名称。
  58025. this.userName = null;
  58026. //文件名称。
  58027. this.fileName = null;
  58028. //文件大小,单位为 B 。
  58029. this.size = null;
  58030. //服务发布状态。
  58031. this.serviceStatus = null;
  58032. //服务 id 。
  58033. this.serviceId = null;
  58034. //数据项 id 。
  58035. this.id = null;
  58036. //最后修改时间。
  58037. this.lastModfiedTime = null;
  58038. //文件状态。
  58039. this.status = null;
  58040. //数据文件存储 id 。
  58041. this.storageId = null;
  58042. //数据的发布信息。
  58043. this.publishInfo = null;
  58044. //数据的权限信息。
  58045. this.authorizeSetting = null;
  58046. //用户的昵称。
  58047. this.nickname = null;
  58048. //数据的标签。
  58049. this.tags = [];
  58050. //数据的描述信息。
  58051. this.description = null;
  58052. //数据发布的服务信息集合。
  58053. this.dataItemServices = null;
  58054. //数据坐标类型。
  58055. this.coordType = null;
  58056. //数据审核信息
  58057. this.dataCheckResult = null;
  58058. //数据元数据信息
  58059. this.dataMetaInfo = null;
  58060. //数据的缩略图路径。
  58061. this.thumbnail = null;
  58062. Util_Util.extend(this, options);
  58063. if (this.id) {
  58064. this.serviceUrl = serviceRootUrl + "/" + this.id;
  58065. }
  58066. this.CLASS_NAME = "SuperMap.OnlineData";
  58067. }
  58068. /**
  58069. * @function OnlineData.prototype.load
  58070. * @description 通过 URL 请求获取该服务完整信息。
  58071. * @returns {Promise} 不包含请求结果的 Promise 对象,请求返回结果自动填充到该类属性中。
  58072. */
  58073. load() {
  58074. if (!this.serviceUrl) {
  58075. return;
  58076. }
  58077. var me = this;
  58078. return me.request("GET", this.serviceUrl).then(function (result) {
  58079. Util_Util.extend(me, result);
  58080. });
  58081. }
  58082. /**
  58083. * @function OnlineData.prototype.getPublishedServices
  58084. * @description 获取数据发布的所有服务。
  58085. * @returns {Object} 数据发布的所有服务。
  58086. */
  58087. getPublishedServices() {
  58088. return this.dataItemServices;
  58089. }
  58090. /**
  58091. * @function OnlineData.prototype.getAuthorizeSetting
  58092. * @description 获取数据的权限信息。
  58093. * @returns {Object} 权限信息。
  58094. */
  58095. getAuthorizeSetting() {
  58096. return this.authorizeSetting;
  58097. }
  58098. }
  58099. ;// CONCATENATED MODULE: ./src/common/online/Online.js
  58100. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  58101. * This program are made available under the terms of the Apache License, Version 2.0
  58102. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58103. /**
  58104. * @class Online
  58105. * @deprecatedclass SuperMap.Online
  58106. * @classdesc 对接 SuperMap Online 所有基础服务。
  58107. * @category iPortal/Online Resources
  58108. * @modulecategory Services
  58109. * @example
  58110. * var online=new Online();
  58111. * var services = online.queryDatas(param);
  58112. * service.then(function(services){
  58113. * var service= services[0];
  58114. * service.updateDataInfo();
  58115. * })
  58116. * @usage
  58117. */
  58118. class Online {
  58119. //TODO 目前并没有对接Online的所有操作,需要补充完整
  58120. //所有查询返回的是一个Promise,在外部使用的时候通过Promise的then方法获取异步结果
  58121. constructor() {
  58122. this.rootUrl = "https://www.supermapol.com";
  58123. this.webUrl = this.rootUrl + "/web";
  58124. var mContentUrl = this.webUrl + "/mycontent";
  58125. this.mDatasUrl = mContentUrl + "/datas";
  58126. this.CLASS_NAME = "SuperMap.Online";
  58127. }
  58128. /**
  58129. * @function Online.prototype.load
  58130. * @description 加载 online,验证 online 是否可用。
  58131. * @returns {Promise} 包含网络请求结果的 Promise 对象。
  58132. */
  58133. load() {
  58134. return FetchRequest.get(this.rootUrl).then(function (response) {
  58135. return response;
  58136. });
  58137. }
  58138. /**
  58139. * @function Online.prototype.login
  58140. * @description 登录Online
  58141. */
  58142. login() {
  58143. SecurityManager.loginOnline(this.rootUrl, true);
  58144. }
  58145. /**
  58146. * @function Online.prototype.queryDatas
  58147. * @description 查询 Online “我的内容” 下 “我的数据” 服务(需要登录状态获取),并返回可操作的服务对象。
  58148. * @param {OnlineQueryDatasParameter} parameter - myDatas 服务资源查询参数。
  58149. * @returns {Promise} 包含所有数据服务信息的 Promise 对象。
  58150. */
  58151. queryDatas(parameter) {
  58152. var me = this, url = me.mDatasUrl;
  58153. if (parameter) {
  58154. parameter = parameter.toJSON();
  58155. }
  58156. return FetchRequest.get(url, parameter).then(function (json) {
  58157. if (!json || !json.content || json.content.length < 1) {
  58158. return;
  58159. }
  58160. var services = [], contents = json.content, len = contents.length;
  58161. for (var i = 0; i < len; i++) {
  58162. var content = contents[i];
  58163. var service = new OnlineData(me.mDatasUrl, content);
  58164. services.push(service);
  58165. }
  58166. return services;
  58167. });
  58168. }
  58169. }
  58170. ;// CONCATENATED MODULE: ./src/common/online/OnlineQueryDatasParameter.js
  58171. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  58172. * This program are made available under the terms of the Apache License, Version 2.0
  58173. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58174. /**
  58175. * @class OnlineQueryDatasParameter
  58176. * @deprecatedclass SuperMap.OnlineQueryDatasParameter
  58177. * @classdesc myDatas 服务资源查询参数。
  58178. * @category iPortal/Online Resources Data
  58179. * @param {Object} options - 参数。
  58180. * @usage
  58181. */
  58182. class OnlineQueryDatasParameter {
  58183. constructor(options) {
  58184. options = options || {};
  58185. /**
  58186. * @member {Array.<string>} OnlineQueryDatasParameter.prototype.userNames
  58187. * @description 数据作者名。可以根据数据作者名查询,默认查询全部。
  58188. */
  58189. this.userNames = null;
  58190. /**
  58191. * @member {Array.<Object>} OnlineQueryDatasParameter.prototype.types
  58192. * @description 数据类型。
  58193. */
  58194. this.types = null;
  58195. /**
  58196. * @member {string} OnlineQueryDatasParameter.prototype.fileName
  58197. * @description 文件名称。
  58198. */
  58199. this.fileName = null;
  58200. /**
  58201. * @member {string} OnlineQueryDatasParameter.prototype.serviceStatuses
  58202. * @description 服务发布状态。
  58203. */
  58204. this.serviceStatuses = null;
  58205. /**
  58206. * @member {string} OnlineQueryDatasParameter.prototype.serviceId
  58207. * @description 服务 ID。
  58208. */
  58209. this.serviceId = null;
  58210. /**
  58211. * @member {Array.<number>} OnlineQueryDatasParameter.prototype.ids
  58212. * @description 由数据项 ID 组成的整型数组。
  58213. */
  58214. this.ids = null;
  58215. /**
  58216. * @member {Array.<string>} OnlineQueryDatasParameter.prototype.keywords
  58217. * @description 关键字。
  58218. */
  58219. this.keywords = null;
  58220. /**
  58221. * @member {string} OnlineQueryDatasParameter.prototype.orderBy
  58222. * @description 排序字段。
  58223. */
  58224. this.orderBy = null;
  58225. /**
  58226. * @member {Array.<string>} OnlineQueryDatasParameter.prototype.tags
  58227. * @description 数据的标签。
  58228. */
  58229. this.tags = null;
  58230. /**
  58231. * @member {Array.<string>} OnlineQueryDatasParameter.prototype.filterFields
  58232. * @description 用于关键字查询时的过滤字段。
  58233. */
  58234. this.filterFields = null;
  58235. Util_Util.extend(this, options)
  58236. this.CLASS_NAME = "SuperMap.OnlineQueryDatasParameter";
  58237. }
  58238. /**
  58239. * @function OnlineQueryDatasParameter.prototype.toJSON
  58240. * @description 返回对应的 JSON 对象。
  58241. * @returns {Object} 对应的 JSON 对象。
  58242. */
  58243. toJSON() {
  58244. var me = this;
  58245. var jsonObj = {
  58246. "types": me.types,
  58247. "fileName": me.fileName,
  58248. "serviceStatuses": me.serviceStatuses,
  58249. "serviceId": me.serviceId,
  58250. "ids": me.ids,
  58251. "keywords": me.keywords,
  58252. "orderBy": me.orderBy,
  58253. "tags": me.tags,
  58254. "filterFields": me.filterFields
  58255. };
  58256. for (var key in jsonObj) {
  58257. if (jsonObj[key] == null) {
  58258. delete jsonObj[key]
  58259. }
  58260. }
  58261. return jsonObj;
  58262. }
  58263. }
  58264. ;// CONCATENATED MODULE: ./src/common/online/index.js
  58265. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  58266. * This program are made available under the terms of the Apache License, Version 2.0
  58267. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58268. ;// CONCATENATED MODULE: ./src/common/security/KeyServiceParameter.js
  58269. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  58270. * This program are made available under the terms of the Apache License, Version 2.0
  58271. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58272. /**
  58273. * @class KeyServiceParameter
  58274. * @deprecatedclass SuperMap.KeyServiceParameter
  58275. * @classdesc key申请参数
  58276. * @category Security
  58277. * @param {Object} options - 参数。
  58278. * @param {string} options.name - 申请服务名称。
  58279. * @param {number} options.serviceIds - 服务 ID。
  58280. * @param {ClientType} [options.clientType=ClientType.SERVER] - 服务端类型。
  58281. * @param {number} options.limitation - 有效期
  58282. * @usage
  58283. */
  58284. class KeyServiceParameter {
  58285. constructor(options) {
  58286. this.name = null;
  58287. this.serviceIds = null;
  58288. this.clientType = ClientType.SERVER;
  58289. this.limitation = null;
  58290. Util_Util.extend(this, options);
  58291. this.CLASS_NAME = "SuperMap.KeyServiceParameter";
  58292. }
  58293. /**
  58294. * @function KeyServiceParameter.prototype.toJSON
  58295. * @description 转换成 JSON 对象
  58296. * @returns {Object} 参数的 JSON 对象
  58297. */
  58298. toJSON() {
  58299. return {
  58300. name: this.name,
  58301. serviceIds: this.serviceIds,
  58302. clientType: this.clientType,
  58303. limitation: this.limitation
  58304. }
  58305. }
  58306. }
  58307. ;// CONCATENATED MODULE: ./src/common/security/ServerInfo.js
  58308. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  58309. * This program are made available under the terms of the Apache License, Version 2.0
  58310. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58311. /**
  58312. * @class ServerInfo
  58313. * @deprecatedclass SuperMap.ServerInfo
  58314. * @classdesc 服务器信息(安全相关),包含服务器类型,服务地址,token服务地址等。
  58315. * @category Security
  58316. * @param {string} type - 服务器类型。
  58317. * @param {Object} options - 参数。
  58318. * @param {string} options.server - 服务器地址,如:http://supermapiserver:8090/iserver。
  58319. * @param {string} [options.tokenServiceUrl] - 如:http://supermapiserver:8090/iserver/services/security/tokens.json。
  58320. * @param {string} [options.keyServiceUrl] - 如:http://supermapiserver:8092/web/mycontent/keys/register.json。
  58321. * @usage
  58322. */
  58323. class ServerInfo {
  58324. constructor(type, options) {
  58325. /**
  58326. * @member {ServerType} ServerInfo.prototype.type
  58327. * @description 服务器类型。
  58328. */
  58329. this.type = type;
  58330. /**
  58331. * @member {string} ServerInfo.prototype.server
  58332. * @description 服务器地址。
  58333. */
  58334. this.server = null;
  58335. /**
  58336. * @member {string} [ServerInfo.prototype.tokenServiceUrl]
  58337. * @description 如:http://supermapiserver:8090/iserver/services/security/tokens.json。
  58338. */
  58339. this.tokenServiceUrl = null;
  58340. /**
  58341. * @member {string} [ServerInfo.prototype.keyServiceUrl]
  58342. * @description 如:http://supermapiserver:8092/web/mycontent/keys/register.json。
  58343. */
  58344. this.keyServiceUrl = null;
  58345. Util_Util.extend(this, options);
  58346. this.CLASS_NAME = "SuperMap.ServerInfo";
  58347. this.type = this.type || ServerType.ISERVER;
  58348. if (!this.server) {
  58349. console.error('server url require is not undefined')
  58350. }
  58351. // var patten = /http:\/\/([^\/]+)/i;
  58352. //this.server = this.server.match(patten)[0];
  58353. var tokenServiceSuffix = "/services/security/tokens";
  58354. if (this.type === ServerType.ISERVER && this.server.indexOf("iserver") < 0) {
  58355. tokenServiceSuffix = "/iserver" + tokenServiceSuffix;
  58356. }
  58357. if (!this.tokenServiceUrl) {
  58358. this.tokenServiceUrl = Util_Util.urlPathAppend(this.server, tokenServiceSuffix);
  58359. }
  58360. if (!this.keyServiceUrl) {
  58361. if (this.type === ServerType.IPORTAL) {
  58362. this.keyServiceUrl = Util_Util.urlPathAppend(this.server, "/web/mycontent/keys/register");
  58363. } else if (this.type === ServerType.ONLINE) {
  58364. this.keyServiceUrl = Util_Util.urlPathAppend(this.server, "/web/mycontent/keys");
  58365. }
  58366. }
  58367. }
  58368. }
  58369. ;// CONCATENATED MODULE: ./src/common/security/TokenServiceParameter.js
  58370. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  58371. * This program are made available under the terms of the Apache License, Version 2.0
  58372. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58373. /**
  58374. * @class TokenServiceParameter
  58375. * @deprecatedclass SuperMap.TokenServiceParameter
  58376. * @classdesc token 申请参数。
  58377. * @category Security
  58378. * @param {Object} options - 参数。
  58379. * @param {string} options.username - 用户名。
  58380. * @param {string} options.password - 密码。
  58381. * @param {ClientType} [options.clientType='ClientType.NONE'] - token 申请的客户端标识类型。
  58382. * @param {string} [options.ip] - clientType=IP 时,此为必选参数。
  58383. * @param {string} [options.referer] -clientType=Referer 时,此为必选参数。如果按照指定 URL 的方式申请令牌,则设置相应的 URL。
  58384. * @param {number} [options.expiration=60] - 申请令牌的有效期,从发布令牌的时间开始计算,单位为分钟。
  58385. * @usage
  58386. *
  58387. */
  58388. class TokenServiceParameter {
  58389. constructor(options) {
  58390. /**
  58391. * @member {string} TokenServiceParameter.prototype.userName
  58392. * @description 用户名。
  58393. */
  58394. this.userName = null;
  58395. /**
  58396. * @member {string} TokenServiceParameter.prototype.password
  58397. * @description 密码。
  58398. */
  58399. this.password = null;
  58400. /**
  58401. * @member {ClientType} TokenServiceParameter.prototype.clientType
  58402. * @description token 申请的客户端标识类型。
  58403. */
  58404. this.clientType = ClientType.NONE;
  58405. /**
  58406. * @member {string} [TokenServiceParameter.prototype.ip]
  58407. * @description clientType=IP 时,此为必选参数。
  58408. */
  58409. this.ip = null;
  58410. /**
  58411. * @member {string} [TokenServiceParameter.prototype.referer]
  58412. * @description clientType=Referer 时,此为必选参数。如果按照指定 URL 的方式申请令牌,则设置相应的 URL。
  58413. */
  58414. this.referer = null;
  58415. /**
  58416. * @member {number} TokenServiceParameter.prototype.expiration
  58417. * @description 申请令牌的有效期,从发布令牌的时间开始计算,单位为分钟。
  58418. */
  58419. this.expiration = 60;
  58420. Util_Util.extend(this, options);
  58421. this.CLASS_NAME = "SuperMap.TokenServiceParameter";
  58422. }
  58423. /**
  58424. * @function TokenServiceParameter.prototype.toJSON
  58425. * @description 将所有信息转成 JSON 字符串。
  58426. * @returns {string} 参数的 JSON 字符串。
  58427. */
  58428. toJSON() {
  58429. return {
  58430. userName: this.userName,
  58431. password: this.password,
  58432. clientType: this.clientType,
  58433. ip: this.ip,
  58434. referer: this.referer,
  58435. expiration: this.expiration
  58436. }
  58437. }
  58438. }
  58439. ;// CONCATENATED MODULE: ./src/common/security/index.js
  58440. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  58441. * This program are made available under the terms of the Apache License, Version 2.0
  58442. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58443. ;// CONCATENATED MODULE: external "function(){try{return elasticsearch}catch(e){return {}}}()"
  58444. const external_function_try_return_elasticsearch_catch_e_return_namespaceObject = function(){try{return elasticsearch}catch(e){return {}}}();
  58445. var external_function_try_return_elasticsearch_catch_e_return_default = /*#__PURE__*/__webpack_require__.n(external_function_try_return_elasticsearch_catch_e_return_namespaceObject);
  58446. ;// CONCATENATED MODULE: ./src/common/thirdparty/elasticsearch/ElasticSearch.js
  58447. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  58448. * This program are made available under the terms of the Apache License, Version 2.0
  58449. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58450. /**
  58451. * @class ElasticSearch
  58452. * @deprecatedclass SuperMap.ElasticSearch
  58453. * @classdesc ElasticSearch服务类。
  58454. * @category ElasticSearch
  58455. * @modulecategory Services
  58456. * @param {string} url - ElasticSearch服务地址。
  58457. * @param {Object} options - 参数。
  58458. * @param {function} [options.change] - 服务器返回数据后执行的函数。废弃,不建议使用。使用search或msearch方法。
  58459. * @param {boolean} [options.openGeoFence=false] - 是否开启地理围栏验证,默认为不开启。
  58460. * @param {function} [options.outOfGeoFence] - 数据超出地理围栏后执行的函数。
  58461. * @param {Object} [options.geoFence] - 地理围栏。
  58462. * @description
  58463. * <h3 style="font-size: 20px;margin-top: 20px;margin-bottom: 10px;">11.1.0</h3>
  58464. * 该功能依赖<a href="https://github.com/elastic/elasticsearch">@elastic/elasticsearch</a>, webpack5或其他不包含Node.js Polyfills的打包工具,需要加入相关配置,以webpack为例:<br/>
  58465. <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>
  58466. 然后配置webpack<pre><code>module.exports: {
  58467. resolve: {
  58468. alias: {
  58469. process: 'process/browser',
  58470. },
  58471. mainFields: ['browser', 'main'],
  58472. fallback: {
  58473. fs: false,
  58474. http: require.resolve('stream-http'),
  58475. https: require.resolve('https-browserify'),
  58476. os: require.resolve('os-browserify/browser'),
  58477. stream: require.resolve('stream-browserify'),
  58478. tty: require.resolve('tty-browserify'),
  58479. zlib: require.resolve('browserify-zlib')
  58480. }
  58481. }
  58482. plugins: [
  58483. new webpack.ProvidePlugin({
  58484. process: 'process/browser',
  58485. Buffer: ['buffer', 'Buffer']
  58486. }),
  58487. ]
  58488. }</code></pre>
  58489. * @usage
  58490. */
  58491. class ElasticSearch {
  58492. constructor(url, options) {
  58493. options = options || {};
  58494. /**
  58495. * @member {string} ElasticSearch.prototype.url
  58496. * @description ElasticSearch服务地址。
  58497. */
  58498. this.url = url;
  58499. /**
  58500. * @member {Object} ElasticSearch.prototype.client
  58501. * @description client ES客户端。
  58502. */
  58503. try {
  58504. // 老版本
  58505. this.client = new (external_function_try_return_elasticsearch_catch_e_return_default()).Client({
  58506. host: this.url
  58507. });
  58508. } catch (e) {
  58509. // 新版本
  58510. this.client = new (external_function_try_return_elasticsearch_catch_e_return_default()).Client({
  58511. node: {
  58512. url: new URL(this.url)
  58513. }
  58514. });
  58515. }
  58516. /**
  58517. * @deprecated
  58518. * @member {function} [ElasticSearch.prototype.change]
  58519. * @description 服务器返回数据后执行的函数。废弃,不建议使用。使用search或msearch方法。
  58520. */
  58521. this.change = null;
  58522. /**
  58523. * @member {boolean} [ElasticSearch.prototype.openGeoFence=false]
  58524. * @description 是否开启地理围栏验证,默认为不开启。
  58525. */
  58526. this.openGeoFence = false;
  58527. /**
  58528. * @member {function} [ElasticSearch.prototype.outOfGeoFence]
  58529. * @description 数据超出地理围栏后执行的函数。
  58530. */
  58531. this.outOfGeoFence = null;
  58532. /**
  58533. * @member {Object} [ElasticSearch.prototype.geoFence]
  58534. * @description 地理围栏。
  58535. * @example {
  58536. * radius: 1000,//单位是m
  58537. * center: [104.40, 30.43],
  58538. * unit: 'meter|degree'
  58539. * }
  58540. */
  58541. this.geoFence = null;
  58542. /*
  58543. * Constant: EVENT_TYPES
  58544. * {Array.<String>}
  58545. * 此类支持的事件类型。
  58546. *
  58547. */
  58548. this.EVENT_TYPES = ['change', 'error', 'outOfGeoFence'];
  58549. /**
  58550. * @member {Events} ElasticSearch.prototype.events
  58551. * @description 事件。
  58552. */
  58553. this.events = new Events(this, null, this.EVENT_TYPES);
  58554. /**
  58555. * @member {Object} ElasticSearch.prototype.eventListeners
  58556. * @description 监听器对象,在构造函数中设置此参数(可选),对 MapService 支持的两个事件 processCompleted 、processFailed 进行监听,
  58557. * 相当于调用 Events.on(eventListeners)。
  58558. */
  58559. this.eventListeners = null;
  58560. Util_Util.extend(this, options);
  58561. if (this.eventListeners instanceof Object) {
  58562. this.events.on(this.eventListeners);
  58563. }
  58564. }
  58565. /**
  58566. * @function ElasticSearch.prototype.setGeoFence
  58567. * @description 设置地理围栏,openGeoFence参数为true的时候,设置的地理围栏才生效。
  58568. * @param {Geometry} geoFence - 地理围栏。
  58569. */
  58570. setGeoFence(geoFence) {
  58571. this.geoFence = geoFence;
  58572. }
  58573. /**
  58574. * @function ElasticSearch.prototype.bulk
  58575. * @description 批量操作API,允许执行多个索引/删除操作。
  58576. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-bulk}</br>
  58577. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html}</br>
  58578. * @param {Object} params - 参数。
  58579. * @param {function} callback - 回调函数。
  58580. */
  58581. bulk(params, callback) {
  58582. return this.client.bulk(params, this._handleCallback(callback));
  58583. }
  58584. /**
  58585. * @function ElasticSearch.prototype.clearScroll
  58586. * @description 通过指定scroll参数进行查询来清除已经创建的scroll请求。
  58587. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-clearscroll}</br>
  58588. *更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html}</br>
  58589. * @param {Object} params - 参数。
  58590. * @param {function} callback - 回调函数。
  58591. */
  58592. clearScroll(params, callback) {
  58593. return this.client.clearScroll(params, this._handleCallback(callback));
  58594. }
  58595. /**
  58596. * @function ElasticSearch.prototype.count
  58597. * @description 获取集群、索引、类型或查询的文档个数。
  58598. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-count}</br>
  58599. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-count.html}</br>
  58600. * @param {Object} params - 参数。
  58601. * @param {function} callback - 回调函数。
  58602. */
  58603. count(params, callback) {
  58604. return this.client.count(params, this._handleCallback(callback));
  58605. }
  58606. /**
  58607. * @function ElasticSearch.prototype.create
  58608. * @description 在特定索引中添加一个类型化的JSON文档,使其可搜索。如果具有相同index,type且ID已经存在的文档将发生错误。</br>
  58609. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-create}
  58610. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html}
  58611. * @param {Object} params - 参数。
  58612. * @param {function} callback - 回调函数。
  58613. */
  58614. create(params, callback) {
  58615. return this.client.create(params, this._handleCallback(callback));
  58616. }
  58617. /**
  58618. * @function ElasticSearch.prototype.delete
  58619. * @description 根据其ID从特定索引中删除键入的JSON文档。
  58620. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-delete}</br>
  58621. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html}</br>
  58622. * @param {Object} params - 参数。
  58623. * @param {function} callback - 回调函数。
  58624. */
  58625. delete(params, callback) {
  58626. return this.client.delete(params, this._handleCallback(callback));
  58627. }
  58628. /**
  58629. * @function ElasticSearch.prototype.deleteByQuery
  58630. * @description 根据其ID从特定索引中删除键入的JSON文档。
  58631. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletebyquery}</br>
  58632. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html}</br>
  58633. * @param {Object} params - 参数。
  58634. * @param {function} callback - 回调函数。
  58635. */
  58636. deleteByQuery(params, callback) {
  58637. return this.client.deleteByQuery(params, this._handleCallback(callback));
  58638. }
  58639. /**
  58640. * @function ElasticSearch.prototype.deleteScript
  58641. * @description 根据其ID删除脚本。</br>
  58642. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletescript}</br>
  58643. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
  58644. * @param {Object} params - 参数。
  58645. * @param {function} callback - 回调函数。
  58646. */
  58647. deleteScript(params, callback) {
  58648. return this.client.deleteScript(params, this._handleCallback(callback));
  58649. }
  58650. /**
  58651. * @function ElasticSearch.prototype.deleteTemplate
  58652. * @description 根据其ID删除模板。</br>
  58653. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletetemplate}</br>
  58654. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  58655. * @param {Object} params - 参数。
  58656. * @param {function} callback - 回调函数。
  58657. */
  58658. deleteTemplate(params, callback) {
  58659. return this.client.deleteTemplate(params, this._handleCallback(callback));
  58660. }
  58661. /**
  58662. * @function ElasticSearch.prototype.exists
  58663. * @description 检查给定文档是否存在。</br>
  58664. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-exists}</br>
  58665. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  58666. * @param {Object} params - 参数。
  58667. * @param {function} callback - 回调函数。
  58668. */
  58669. exists(params, callback) {
  58670. return this.client.exists(params, this._handleCallback(callback));
  58671. }
  58672. /**
  58673. * @function ElasticSearch.prototype.existsSource
  58674. * @description 检查资源是否存在。</br>
  58675. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-existssource}</br>
  58676. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  58677. * @param {Object} params - 参数。
  58678. * @param {function} callback - 回调函数。
  58679. */
  58680. existsSource(params, callback) {
  58681. return this.client.existsSource(params, this._handleCallback(callback));
  58682. }
  58683. /**
  58684. * @function ElasticSearch.prototype.explain
  58685. * @description 提供与特定查询相关的特定文档分数的详细信息。它还会告诉您文档是否与指定的查询匹配。</br>
  58686. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-explain}</br>
  58687. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html}</br>
  58688. * @param {Object} params - 参数。
  58689. * @param {function} callback - 回调函数。
  58690. */
  58691. explain(params, callback) {
  58692. return this.client.explain(params, this._handleCallback(callback));
  58693. }
  58694. /**
  58695. * @function ElasticSearch.prototype.fieldCaps
  58696. * @description 允许检索多个索引之间的字段的功能。(实验性API,可能会在未来版本中删除)</br>
  58697. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-fieldcaps}</br>
  58698. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-field-caps.html}</br>
  58699. * @param {Object} params - 参数。
  58700. * @param {function} callback - 回调函数。
  58701. */
  58702. fieldCaps(params, callback) {
  58703. return this.client.fieldCaps(params, this._handleCallback(callback));
  58704. }
  58705. /**
  58706. * @function ElasticSearch.prototype.get
  58707. * @description 从索引获取一个基于其ID的类型的JSON文档。</br>
  58708. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-get}</br>
  58709. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  58710. * @param {Object} params - 参数。
  58711. * @param {function} callback - 回调函数。
  58712. */
  58713. get(params, callback) {
  58714. return this.client.get(params, this._handleCallback(callback));
  58715. }
  58716. /**
  58717. * @function ElasticSearch.prototype.getScript
  58718. * @description 获取脚本。</br>
  58719. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-getscript}</br>
  58720. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
  58721. * @param {Object} params - 参数。
  58722. * @param {function} callback - 回调函数。
  58723. */
  58724. getScript(params, callback) {
  58725. return this.client.getScript(params, this._handleCallback(callback));
  58726. }
  58727. /**
  58728. * @function ElasticSearch.prototype.getSource
  58729. * @description 通过索引,类型和ID获取文档的源。</br>
  58730. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-getsource}</br>
  58731. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  58732. * @param {Object} params - 参数。
  58733. * @param {function} callback - 回调函数。
  58734. */
  58735. getSource(params, callback) {
  58736. return this.client.getSource(params, this._handleCallback(callback));
  58737. }
  58738. /**
  58739. * @function ElasticSearch.prototype.getTemplate
  58740. * @description 获取模板。</br>
  58741. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-gettemplate}</br>
  58742. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  58743. * @param {Object} params - 参数。
  58744. * @param {function} callback - 回调函数。
  58745. */
  58746. getTemplate(params, callback) {
  58747. return this.client.getTemplate(params, this._handleCallback(callback));
  58748. }
  58749. /**
  58750. * @function ElasticSearch.prototype.index
  58751. * @description 在索引中存储一个键入的JSON文档,使其可搜索。</br>
  58752. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-index}</br>
  58753. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html}</br>
  58754. * @param {Object} params - 参数。
  58755. * @param {function} callback - 回调函数。
  58756. */
  58757. index(params, callback) {
  58758. return this.client.index(params, this._handleCallback(callback));
  58759. }
  58760. /**
  58761. * @function ElasticSearch.prototype.info
  58762. * @description 从当前集群获取基本信息。</br>
  58763. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-info}</br>
  58764. * 更多信息参考 {@link https://www.elastic.co/guide/index.html}</br>
  58765. * @param {Object} params - 参数。
  58766. * @param {function} callback - 回调函数。
  58767. */
  58768. info(params, callback) {
  58769. return this.client.info(params, this._handleCallback(callback));
  58770. }
  58771. /**
  58772. * @function ElasticSearch.prototype.mget
  58773. * @description 根据索引,类型(可选)和ids来获取多个文档。mget所需的主体可以采用两种形式:文档位置数组或文档ID数组。</br>
  58774. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-mget}</br>
  58775. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html}</br>
  58776. * @param {Object} params - 参数。
  58777. * @param {function} callback - 回调函数。
  58778. */
  58779. mget(params, callback) {
  58780. return this.client.mget(params, this._handleCallback(callback));
  58781. }
  58782. /**
  58783. * @function ElasticSearch.prototype.msearch
  58784. * @description 在同一请求中执行多个搜索请求。</br>
  58785. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-msearch}</br>
  58786. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html}</br>
  58787. * @param {Object} params - 参数。
  58788. * @param {function} callback - 请求返回的回调函数。也可以使用then表达式获取返回结果。
  58789. * 回调参数:error,response,结果存储在response.responses中。
  58790. */
  58791. msearch(params, callback) {
  58792. let me = this;
  58793. return me.client.msearch(params)
  58794. .then(function (resp) {
  58795. resp = resp.body || resp;
  58796. me._update(resp.responses, callback);
  58797. return resp;
  58798. }, function (err) {
  58799. callback(err);
  58800. me.events.triggerEvent('error', {error: err});
  58801. return err;
  58802. });
  58803. }
  58804. /**
  58805. * @function ElasticSearch.prototype.msearchTemplate
  58806. * @description 在同一请求中执行多个搜索模板请求。</br>
  58807. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-msearchtemplate}</br>
  58808. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  58809. * @param {Object} params - 参数。
  58810. * @param {function} callback - 回调函数。
  58811. */
  58812. msearchTemplate(params, callback) {
  58813. return this.client.msearchTemplate(params, this._handleCallback(callback));
  58814. }
  58815. /**
  58816. * @function ElasticSearch.prototype.mtermvectors
  58817. * @description 多termvectors API允许一次获得多个termvectors。</br>
  58818. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-mtermvectors}</br>
  58819. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-termvectors.html}</br>
  58820. * @param {Object} params - 参数。
  58821. * @param {function} callback - 回调函数。
  58822. */
  58823. mtermvectors(params, callback) {
  58824. return this.client.mtermvectors(params, this._handleCallback(callback));
  58825. }
  58826. /**
  58827. * @function ElasticSearch.prototype.ping
  58828. * @description 测试连接。</br>
  58829. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-ping}</br>
  58830. * 更多信息参考 {@link https://www.elastic.co/guide/index.html}</br>
  58831. * @param {Object} params - 参数。
  58832. * @param {function} callback - 回调函数。
  58833. */
  58834. ping(params, callback) {
  58835. return this.client.ping(params, this._handleCallback(callback));
  58836. }
  58837. /**
  58838. * @function ElasticSearch.prototype.putScript
  58839. * @description 添加脚本。</br>
  58840. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-putscript}</br>
  58841. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
  58842. * @param {Object} params - 参数。
  58843. * @param {function} callback - 回调函数。
  58844. */
  58845. putScript(params, callback) {
  58846. return this.client.putScript(params, this._handleCallback(callback));
  58847. }
  58848. /**
  58849. * @function ElasticSearch.prototype.putTemplate
  58850. * @description 添加模板。</br>
  58851. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-puttemplate}</br>
  58852. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  58853. * @param {Object} params - 参数。
  58854. * @param {function} callback - 回调函数。
  58855. */
  58856. putTemplate(params, callback) {
  58857. return this.client.putTemplate(params, this._handleCallback(callback));
  58858. }
  58859. /**
  58860. * @function ElasticSearch.prototype.reindex
  58861. * @description 重新索引。</br>
  58862. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-reindex}</br>
  58863. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html}</br>
  58864. * @param {Object} params - 参数。
  58865. * @param {function} callback - 回调函数。
  58866. */
  58867. reindex(params, callback) {
  58868. return this.client.reindex(params, this._handleCallback(callback));
  58869. }
  58870. /**
  58871. * @function ElasticSearch.prototype.reindexRessrottle
  58872. * @description 重新索引。</br>
  58873. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-reindexrethrottle}</br>
  58874. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html}</br>
  58875. * @param {Object} params - 参数。
  58876. * @param {function} callback - 回调函数。
  58877. */
  58878. reindexRessrottle(params, callback) {
  58879. return this.client.reindexRessrottle(params, this._handleCallback(callback));
  58880. }
  58881. /**
  58882. * @function ElasticSearch.prototype.renderSearchTemplate
  58883. * @description 搜索模板。</br>
  58884. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-rendersearchtemplate}</br>
  58885. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  58886. * @param {Object} params - 参数。
  58887. * @param {function} callback - 回调函数。
  58888. */
  58889. renderSearchTemplate(params, callback) {
  58890. return this.client.renderSearchTemplate(params, this._handleCallback(callback));
  58891. }
  58892. /**
  58893. * @function ElasticSearch.prototype.scroll
  58894. * @description 在search()调用中指定滚动参数之后,滚动搜索请求(检索下一组结果)。</br>
  58895. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-scroll}</br>
  58896. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html}</br>
  58897. * @param {Object} params - 参数。
  58898. * @param {function} callback - 回调函数。
  58899. */
  58900. scroll(params, callback) {
  58901. return this.client.scroll(params, this._handleCallback(callback));
  58902. }
  58903. /**
  58904. * @function ElasticSearch.prototype.search
  58905. * @description 在search()调用中指定滚动参数之后,滚动搜索请求(检索下一组结果)。
  58906. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-search}</br>
  58907. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html}</br>
  58908. * @param {Object} params - 参数。
  58909. * @param {function} callback - 请求返回的回调函数。也可以使用then表达式获取返回结果。
  58910. * 回调参数:error,response,结果存储在response.responses中。
  58911. */
  58912. search(params, callback) {
  58913. let me = this;
  58914. return me.client.search(params)
  58915. .then(function (resp) {
  58916. resp = resp.body || resp;
  58917. me._update(resp, callback);
  58918. return resp;
  58919. }, function (err) {
  58920. callback && callback(err);
  58921. me.events.triggerEvent('error', {error: err});
  58922. return err;
  58923. });
  58924. }
  58925. /**
  58926. * @function ElasticSearch.prototype.searchShards
  58927. * @description 返回要执行搜索请求的索引和分片。
  58928. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-searchshards}</br>
  58929. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-shards.html}</br>
  58930. * @param {Object} params - 参数。
  58931. * @param {function} callback - 回调函数。
  58932. */
  58933. searchShards(params, callback) {
  58934. return this.client.searchShards(params, this._handleCallback(callback));
  58935. }
  58936. /**
  58937. * @function ElasticSearch.prototype.searchTemplate
  58938. * @description 搜索模板。
  58939. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-searchtemplate}</br>
  58940. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html}</br>
  58941. * @param {Object} params - 参数。
  58942. * @param {function} callback - 回调函数。
  58943. */
  58944. searchTemplate(params, callback) {
  58945. return this.client.searchTemplate(params, this._handleCallback(callback));
  58946. }
  58947. /**
  58948. * @function ElasticSearch.prototype.suggest
  58949. * @description 该建议功能通过使用特定的建议者,基于所提供的文本来建议类似的术语。
  58950. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-suggest}</br>
  58951. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html}</br>
  58952. * @param {Object} params - 参数。
  58953. * @param {function} callback - 回调函数。
  58954. */
  58955. suggest(params, callback) {
  58956. return this.client.suggest(params, this._handleCallback(callback));
  58957. }
  58958. /**
  58959. * @function ElasticSearch.prototype.termvectors
  58960. * @description 返回有关特定文档字段中的术语的信息和统计信息。
  58961. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-termvectors}</br>
  58962. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-termvectors.html}</br>
  58963. * @param {Object} params - 参数。
  58964. * @param {function} callback - 回调函数。
  58965. */
  58966. termvectors(params, callback) {
  58967. return this.client.termvectors(params, this._handleCallback(callback));
  58968. }
  58969. /**
  58970. * @function ElasticSearch.prototype.update
  58971. * @description 更新文档的部分。
  58972. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-update}</br>
  58973. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html}</br>
  58974. * @param {Object} params - 参数。
  58975. * @param {function} callback - 回调函数。
  58976. */
  58977. update(params, callback) {
  58978. return this.client.update(params, this._handleCallback(callback));
  58979. }
  58980. /**
  58981. * @function ElasticSearch.prototype.updateByQuery
  58982. * @description 通过查询API来更新文档。
  58983. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-updatebyquery}</br>
  58984. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html}</br>
  58985. * @param {Object} params - 参数。
  58986. * @param {function} callback - 回调函数。
  58987. */
  58988. updateByQuery(params, callback) {
  58989. return this.client.updateByQuery(params, this._handleCallback(callback));
  58990. }
  58991. /**
  58992. * @function ElasticSearch.prototype._handleCallback
  58993. * @description 处理ElasticSearch 16.x和5.x的callback兼容。 5.x的回调参数多包了一层body
  58994. * @param {function} callback - 回调函数。
  58995. * @private
  58996. */
  58997. _handleCallback(callback) {
  58998. return function () {
  58999. let args = Array.from(arguments);
  59000. const error = args.shift();
  59001. let resp = args.shift();
  59002. const body = resp && resp.body;
  59003. if (body) {
  59004. const { statusCode, headers } = resp;
  59005. args = [statusCode, headers];
  59006. resp = body;
  59007. }
  59008. callback.call(this, error, resp, ...args);
  59009. };
  59010. }
  59011. _update(data, callback) {
  59012. let me = this;
  59013. if (!data) {
  59014. return;
  59015. }
  59016. me.data = data;
  59017. if (me.openGeoFence && me.geoFence) {
  59018. me._validateDatas(data);
  59019. }
  59020. me.events.triggerEvent('change', {data: me.data});
  59021. //change方法已废弃,不建议使用。建议使用search方法的第二个参数传入请求成功的回调
  59022. if (me.change) {
  59023. me.change && me.change(data);
  59024. } else {
  59025. //加responses是为了保持跟原来es自身的数据结构一致
  59026. callback && callback(undefined, {responses: data});
  59027. }
  59028. }
  59029. _validateDatas(datas) {
  59030. if (!datas) {
  59031. return;
  59032. }
  59033. if (!(datas instanceof Array)) {
  59034. datas = [datas];
  59035. }
  59036. var i, len = datas.length;
  59037. for (i = 0; i < len; i++) {
  59038. this._validateData(datas[i]);
  59039. }
  59040. }
  59041. _validateData(data) {
  59042. let me = this;
  59043. data.hits.hits.map(function (source) {
  59044. let content = source._source;
  59045. let meterUnit = me._getMeterPerMapUnit(me.geoFence.unit);
  59046. let geoFenceCX = me.geoFence.center[0] * meterUnit;
  59047. let geoFenceCY = me.geoFence.center[1] * meterUnit;
  59048. let contentX = content.x * meterUnit;
  59049. let contentY = content.y * meterUnit;
  59050. let distance = me._distance(contentX, contentY, geoFenceCX, geoFenceCY);
  59051. let radius = me.geoFence.radius;
  59052. if (distance > radius) {
  59053. me.outOfGeoFence && me.outOfGeoFence(data);
  59054. me.events.triggerEvent('outOfGeoFence', {data: data});
  59055. }
  59056. return source;
  59057. });
  59058. }
  59059. _distance(x1, y1, x2, y2) {
  59060. return Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  59061. }
  59062. _getMeterPerMapUnit(mapUnit) {
  59063. let earchRadiusInMeters = 6378137;
  59064. let meterPerMapUnit;
  59065. if (mapUnit === 'meter') {
  59066. meterPerMapUnit = 1;
  59067. } else if (mapUnit === 'degree') {
  59068. // 每度表示多少米。
  59069. meterPerMapUnit = Math.PI * 2 * earchRadiusInMeters / 360;
  59070. }
  59071. return meterPerMapUnit;
  59072. }
  59073. }
  59074. ;// CONCATENATED MODULE: ./src/common/thirdparty/elasticsearch/index.js
  59075. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  59076. * This program are made available under the terms of the Apache License, Version 2.0
  59077. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59078. ;// CONCATENATED MODULE: ./src/common/thirdparty/index.js
  59079. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  59080. * This program are made available under the terms of the Apache License, Version 2.0
  59081. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59082. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Util.js
  59083. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  59084. * This program are made available under the terms of the Apache License, Version 2.0
  59085. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59086. /**
  59087. * @private
  59088. * @class LevelRenderer.Tool.Util
  59089. * @category Visualization Theme
  59090. * LevelRenderer 基础工具类
  59091. *
  59092. */
  59093. class levelRenderer_Util_Util {
  59094. constructor() {
  59095. /**
  59096. * @member {Object} LevelRenderer.Tool.Util.prototype.BUILTIN_OBJECT
  59097. * @description 用于处理merge时无法遍历Date等对象的问题
  59098. */
  59099. this.BUILTIN_OBJECT = {
  59100. '[object Function]': 1,
  59101. '[object RegExp]': 1,
  59102. '[object Date]': 1,
  59103. '[object Error]': 1,
  59104. '[object CanvasGradient]': 1
  59105. };
  59106. /**
  59107. * @member {Object} LevelRenderer.Tool.Util.prototype._ctx
  59108. */
  59109. this._ctx = null;
  59110. /**
  59111. * Property: _canvas
  59112. * {Object}
  59113. */
  59114. this._canvas = null;
  59115. /**
  59116. * Property: _pixelCtx
  59117. * {Object}
  59118. */
  59119. this._pixelCtx = null;
  59120. /**
  59121. * Property: _width
  59122. * {Object}
  59123. */
  59124. this._width = null;
  59125. /**
  59126. * Property: _height
  59127. * {Object}
  59128. */
  59129. this._height = null;
  59130. /**
  59131. * Property: _offsetX
  59132. * {Object}
  59133. */
  59134. this._offsetX = 0;
  59135. /**
  59136. * Property: _offsetY
  59137. * {Object}
  59138. */
  59139. this._offsetY = 0;
  59140. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Util";
  59141. }
  59142. /**
  59143. * @function LevelRenderer.Tool.Util.prototype.clone
  59144. * @description 对一个object进行深度拷贝。
  59145. *
  59146. * @param {Object} source - 需要进行拷贝的对象。
  59147. * @return {Object} 拷贝后的新对象。
  59148. */
  59149. clone(source) {
  59150. var BUILTIN_OBJECT = this.BUILTIN_OBJECT;
  59151. if (typeof source == 'object' && source !== null) {
  59152. var result = source;
  59153. if (source instanceof Array) {
  59154. result = [];
  59155. for (var i = 0, len = source.length; i < len; i++) {
  59156. result[i] = this.clone(source[i]);
  59157. }
  59158. } else if (!BUILTIN_OBJECT[Object.prototype.toString.call(source)]) {
  59159. result = {};
  59160. for (var key in source) {
  59161. if (source.hasOwnProperty(key)) {
  59162. result[key] = this.clone(source[key]);
  59163. }
  59164. }
  59165. }
  59166. return result;
  59167. }
  59168. return source;
  59169. }
  59170. /**
  59171. * @function LevelRenderer.Tool.Util.prototype.mergeItem
  59172. * @description 合并源对象的单个属性到目标对象。
  59173. *
  59174. * @param {Object} target - 目标对象。
  59175. * @param {Object} source - 源对象。
  59176. * @param {string} key - 键。
  59177. * @param {boolean} overwrite - 是否覆盖。
  59178. * @return {Object} 目标对象
  59179. */
  59180. mergeItem(target, source, key, overwrite) {
  59181. var BUILTIN_OBJECT = this.BUILTIN_OBJECT;
  59182. if (source.hasOwnProperty(key)) {
  59183. if (typeof target[key] == 'object'
  59184. && !BUILTIN_OBJECT[Object.prototype.toString.call(target[key])]
  59185. ) {
  59186. // 如果需要递归覆盖,就递归调用merge
  59187. this.merge(
  59188. target[key],
  59189. source[key],
  59190. overwrite
  59191. );
  59192. } else if (overwrite || !(key in target)) {
  59193. // 否则只处理overwrite为true,或者在目标对象中没有此属性的情况
  59194. target[key] = source[key];
  59195. }
  59196. }
  59197. }
  59198. /**
  59199. * @function LevelRenderer.Tool.Util.prototype.merge
  59200. * @description 合并源对象的属性到目标对象。
  59201. *
  59202. * @param {Object} target - 目标对象。
  59203. * @param {Object} source - 源对象。
  59204. * @param {boolean} overwrite - 是否覆盖。
  59205. * @return {Object} 目标对象。
  59206. */
  59207. merge(target, source, overwrite) {
  59208. for (var i in source) {
  59209. this.mergeItem(target, source, i, overwrite);
  59210. }
  59211. return target;
  59212. }
  59213. /**
  59214. * @function LevelRenderer.Tool.Util.prototype.getContext
  59215. * @description 获取 Canvas 上下文。
  59216. * @return {Object} 上下文。
  59217. */
  59218. getContext() {
  59219. if (!this._ctx) {
  59220. this._ctx = document.createElement('canvas').getContext('2d');
  59221. }
  59222. return this._ctx;
  59223. }
  59224. /**
  59225. * @function LevelRenderer.Tool.Util.prototype.getPixelContext
  59226. * @description 获取像素拾取专用的上下文。
  59227. * @return {Object} 像素拾取专用的上下文。
  59228. */
  59229. getPixelContext() {
  59230. if (!this._pixelCtx) {
  59231. this._canvas = document.createElement('canvas');
  59232. this._width = this._canvas.width;
  59233. this._height = this._canvas.height;
  59234. this._pixelCtx = this._canvas.getContext('2d');
  59235. }
  59236. return this._pixelCtx;
  59237. }
  59238. /**
  59239. * @function LevelRenderer.Tool.Util.prototype.adjustCanvasSize
  59240. * @description 如果坐标处在_canvas外部,改变_canvas的大小,修改canvas的大小 需要重新设置translate
  59241. *
  59242. * @param {number} x - 横坐标。
  59243. * @param {number} y - 纵坐标。
  59244. *
  59245. */
  59246. adjustCanvasSize(x, y) {
  59247. var _canvas = this._canvas;
  59248. var _pixelCtx = this._pixelCtx;
  59249. var _width = this._width;
  59250. var _height = this._height;
  59251. var _offsetX = this._offsetX;
  59252. var _offsetY = this._offsetY;
  59253. // 每次加的长度
  59254. var _v = 100;
  59255. var _flag;
  59256. if (x + _offsetX > _width) {
  59257. _width = x + _offsetX + _v;
  59258. _canvas.width = _width;
  59259. _flag = true;
  59260. }
  59261. if (y + _offsetY > _height) {
  59262. _height = y + _offsetY + _v;
  59263. _canvas.height = _height;
  59264. _flag = true;
  59265. }
  59266. if (x < -_offsetX) {
  59267. _offsetX = Math.ceil(-x / _v) * _v;
  59268. _width += _offsetX;
  59269. _canvas.width = _width;
  59270. _flag = true;
  59271. }
  59272. if (y < -_offsetY) {
  59273. _offsetY = Math.ceil(-y / _v) * _v;
  59274. _height += _offsetY;
  59275. _canvas.height = _height;
  59276. _flag = true;
  59277. }
  59278. if (_flag) {
  59279. _pixelCtx.translate(_offsetX, _offsetY);
  59280. }
  59281. }
  59282. /**
  59283. * @function LevelRenderer.Tool.Util.prototype.getPixelOffset
  59284. * @description 获取像素canvas的偏移量。
  59285. * @return {Object} 偏移量。
  59286. */
  59287. getPixelOffset() {
  59288. return {
  59289. x: this._offsetX,
  59290. y: this._offsetY
  59291. };
  59292. }
  59293. /**
  59294. * @function LevelRenderer.Tool.Util.prototype.indexOf
  59295. * @description 查询数组中元素的index
  59296. * @return {Object} 偏移量。
  59297. */
  59298. indexOf(array, value) {
  59299. if (array.indexOf) {
  59300. return array.indexOf(value);
  59301. }
  59302. for (var i = 0, len = array.length; i < len; i++) {
  59303. if (array[i] === value) {
  59304. return i;
  59305. }
  59306. }
  59307. return -1;
  59308. }
  59309. /**
  59310. * @function LevelRenderer.Tool.Util.prototype.inherits
  59311. * @description 构造类继承关系
  59312. *
  59313. * @param {function} clazz - 源类。
  59314. * @param {function} baseClazz - 基类。
  59315. * @return {Object} 偏移量。
  59316. */
  59317. inherits(clazz, baseClazz) {
  59318. var clazzPrototype = clazz.prototype;
  59319. function F() {
  59320. }
  59321. F.prototype = baseClazz.prototype;
  59322. clazz.prototype = new F();
  59323. for (var prop in clazzPrototype) {
  59324. clazz.prototype[prop] = clazzPrototype[prop];
  59325. }
  59326. clazz.constructor = clazz;
  59327. }
  59328. }
  59329. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Color.js
  59330. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  59331. * This program are made available under the terms of the Apache License, Version 2.0
  59332. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59333. /**
  59334. * @class LevelRenderer.Tool.Color
  59335. * @category Visualization Theme
  59336. * @classdesc LevelRenderer 工具-颜色辅助类
  59337. * @private
  59338. */
  59339. class Color_Color {
  59340. constructor() {
  59341. /**
  59342. * @member {LevelRenderer.Tool.Util} LevelRenderer.Tool.Color.prototype.util
  59343. * @description LevelRenderer 基础工具对象。
  59344. */
  59345. this.util = new levelRenderer_Util_Util();
  59346. /**
  59347. * @member {Object} LevelRenderer.Tool.Color.prototype._ctx
  59348. * @description _ctx。
  59349. */
  59350. this._ctx = null;
  59351. /**
  59352. * @member {Array.<string>} LevelRenderer.Tool.Color.prototype.palette
  59353. * @description 默认色板。色板是一个包含图表默认颜色系列的数组,当色板中所有颜色被使用过后,又将从新回到色板中的第一个颜色。
  59354. */
  59355. this.palette = [
  59356. '#ff9277', ' #dddd00', ' #ffc877', ' #bbe3ff', ' #d5ffbb',
  59357. '#bbbbff', ' #ddb000', ' #b0dd00', ' #e2bbff', ' #ffbbe3',
  59358. '#ff7777', ' #ff9900', ' #83dd00', ' #77e3ff', ' #778fff',
  59359. '#c877ff', ' #ff77ab', ' #ff6600', ' #aa8800', ' #77c7ff',
  59360. '#ad77ff', ' #ff77ff', ' #dd0083', ' #777700', ' #00aa00',
  59361. '#0088aa', ' #8400dd', ' #aa0088', ' #dd0000', ' #772e00'
  59362. ];
  59363. /**
  59364. * @member {Array.<string>} LevelRenderer.Tool.Color.prototype._palette
  59365. * @description 复位色板,用于复位 palette
  59366. */
  59367. this._palette = this.palette;
  59368. /**
  59369. * @member {string} LevelRenderer.Tool.Color.prototype.highlightColor
  59370. * @description 高亮色
  59371. */
  59372. this.highlightColor = 'rgba(0,0,255,1)';
  59373. /**
  59374. * @member {string} LevelRenderer.Tool.Color.prototype._highlightColor
  59375. * @description 复位高亮色
  59376. */
  59377. this._highlightColor = this.highlightColor;
  59378. /**
  59379. * @member {string} LevelRenderer.Tool.Color.prototype.colorRegExp
  59380. * @description 颜色格式,正则表达式。
  59381. */
  59382. 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;
  59383. /**
  59384. * @member {string} LevelRenderer.Tool.Color.prototype._nameColors
  59385. * @description 颜色名。
  59386. */
  59387. this._nameColors = {
  59388. aliceblue: '#f0f8ff',
  59389. antiquewhite: '#faebd7',
  59390. aqua: '#0ff',
  59391. aquamarine: '#7fffd4',
  59392. azure: '#f0ffff',
  59393. beige: '#f5f5dc',
  59394. bisque: '#ffe4c4',
  59395. black: '#000',
  59396. blanchedalmond: '#ffebcd',
  59397. blue: '#00f',
  59398. blueviolet: '#8a2be2',
  59399. brown: '#a52a2a',
  59400. burlywood: '#deb887',
  59401. cadetblue: '#5f9ea0',
  59402. chartreuse: '#7fff00',
  59403. chocolate: '#d2691e',
  59404. coral: '#ff7f50',
  59405. cornflowerblue: '#6495ed',
  59406. cornsilk: '#fff8dc',
  59407. crimson: '#dc143c',
  59408. cyan: '#0ff',
  59409. darkblue: '#00008b',
  59410. darkcyan: '#008b8b',
  59411. darkgoldenrod: '#b8860b',
  59412. darkgray: '#a9a9a9',
  59413. darkgrey: '#a9a9a9',
  59414. darkgreen: '#006400',
  59415. darkkhaki: '#bdb76b',
  59416. darkmagenta: '#8b008b',
  59417. darkolivegreen: '#556b2f',
  59418. darkorange: '#ff8c00',
  59419. darkorchid: '#9932cc',
  59420. darkred: '#8b0000',
  59421. darksalmon: '#e9967a',
  59422. darkseagreen: '#8fbc8f',
  59423. darkslateblue: '#483d8b',
  59424. darkslategray: '#2f4f4f',
  59425. darkslategrey: '#2f4f4f',
  59426. darkturquoise: '#00ced1',
  59427. darkviolet: '#9400d3',
  59428. deeppink: '#ff1493',
  59429. deepskyblue: '#00bfff',
  59430. dimgray: '#696969',
  59431. dimgrey: '#696969',
  59432. dodgerblue: '#1e90ff',
  59433. firebrick: '#b22222',
  59434. floralwhite: '#fffaf0',
  59435. forestgreen: '#228b22',
  59436. fuchsia: '#f0f',
  59437. gainsboro: '#dcdcdc',
  59438. ghostwhite: '#f8f8ff',
  59439. gold: '#ffd700',
  59440. goldenrod: '#daa520',
  59441. gray: '#808080',
  59442. grey: '#808080',
  59443. green: '#008000',
  59444. greenyellow: '#adff2f',
  59445. honeydew: '#f0fff0',
  59446. hotpink: '#ff69b4',
  59447. indianred: '#cd5c5c',
  59448. indigo: '#4b0082',
  59449. ivory: '#fffff0',
  59450. khaki: '#f0e68c',
  59451. lavender: '#e6e6fa',
  59452. lavenderblush: '#fff0f5',
  59453. lawngreen: '#7cfc00',
  59454. lemonchiffon: '#fffacd',
  59455. lightblue: '#add8e6',
  59456. lightcoral: '#f08080',
  59457. lightcyan: '#e0ffff',
  59458. lightgoldenrodyellow: '#fafad2',
  59459. lightgray: '#d3d3d3',
  59460. lightgrey: '#d3d3d3',
  59461. lightgreen: '#90ee90',
  59462. lightpink: '#ffb6c1',
  59463. lightsalmon: '#ffa07a',
  59464. lightseagreen: '#20b2aa',
  59465. lightskyblue: '#87cefa',
  59466. lightslategray: '#789',
  59467. lightslategrey: '#789',
  59468. lightsteelblue: '#b0c4de',
  59469. lightyellow: '#ffffe0',
  59470. lime: '#0f0',
  59471. limegreen: '#32cd32',
  59472. linen: '#faf0e6',
  59473. magenta: '#f0f',
  59474. maroon: '#800000',
  59475. mediumaquamarine: '#66cdaa',
  59476. mediumblue: '#0000cd',
  59477. mediumorchid: '#ba55d3',
  59478. mediumpurple: '#9370d8',
  59479. mediumseagreen: '#3cb371',
  59480. mediumslateblue: '#7b68ee',
  59481. mediumspringgreen: '#00fa9a',
  59482. mediumturquoise: '#48d1cc',
  59483. mediumvioletred: '#c71585',
  59484. midnightblue: '#191970',
  59485. mintcream: '#f5fffa',
  59486. mistyrose: '#ffe4e1',
  59487. moccasin: '#ffe4b5',
  59488. navajowhite: '#ffdead',
  59489. navy: '#000080',
  59490. oldlace: '#fdf5e6',
  59491. olive: '#808000',
  59492. olivedrab: '#6b8e23',
  59493. orange: '#ffa500',
  59494. orangered: '#ff4500',
  59495. orchid: '#da70d6',
  59496. palegoldenrod: '#eee8aa',
  59497. palegreen: '#98fb98',
  59498. paleturquoise: '#afeeee',
  59499. palevioletred: '#d87093',
  59500. papayawhip: '#ffefd5',
  59501. peachpuff: '#ffdab9',
  59502. peru: '#cd853f',
  59503. pink: '#ffc0cb',
  59504. plum: '#dda0dd',
  59505. powderblue: '#b0e0e6',
  59506. purple: '#800080',
  59507. red: '#f00',
  59508. rosybrown: '#bc8f8f',
  59509. royalblue: '#4169e1',
  59510. saddlebrown: '#8b4513',
  59511. salmon: '#fa8072',
  59512. sandybrown: '#f4a460',
  59513. seagreen: '#2e8b57',
  59514. seashell: '#fff5ee',
  59515. sienna: '#a0522d',
  59516. silver: '#c0c0c0',
  59517. skyblue: '#87ceeb',
  59518. slateblue: '#6a5acd',
  59519. slategray: '#708090',
  59520. slategrey: '#708090',
  59521. snow: '#fffafa',
  59522. springgreen: '#00ff7f',
  59523. steelblue: '#4682b4',
  59524. tan: '#d2b48c',
  59525. teal: '#008080',
  59526. thistle: '#d8bfd8',
  59527. tomato: '#ff6347',
  59528. turquoise: '#40e0d0',
  59529. violet: '#ee82ee',
  59530. wheat: '#f5deb3',
  59531. white: '#fff',
  59532. whitesmoke: '#f5f5f5',
  59533. yellow: '#ff0',
  59534. yellowgreen: '#9acd32'
  59535. };
  59536. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Color";
  59537. }
  59538. /**
  59539. * @function LevelRenderer.Tool.Color.prototype.customPalette
  59540. * @description 自定义调色板。
  59541. * @param {Array.<string>} userPalete - 颜色板。
  59542. */
  59543. customPalette(userPalete) {
  59544. this.palette = userPalete;
  59545. }
  59546. /**
  59547. * @function LevelRenderer.Tool.Color.prototype.resetPalette
  59548. * @description 复位默认色板。
  59549. */
  59550. resetPalette() {
  59551. this.palette = this._palette;
  59552. }
  59553. /**
  59554. * @function LevelRenderer.Tool.Color.prototype.getColor
  59555. * @description 获取色板颜色。
  59556. * @param {number} idx - 色板位置。
  59557. * @param {Array.<string>} userPalete - 色板。
  59558. * @returns {string} 颜色值。
  59559. */
  59560. getColor(idx, userPalete) {
  59561. idx = idx | 0;
  59562. userPalete = userPalete || this.palette;
  59563. return userPalete[idx % userPalete.length];
  59564. }
  59565. /**
  59566. * @function LevelRenderer.Tool.Color.prototype.customHighlight
  59567. * @description 自定义默认高亮颜色。
  59568. * @param {string} userHighlightColor - 自定义高亮色。
  59569. */
  59570. customHighlight(userHighlightColor) {
  59571. this.highlightColor = userHighlightColor;
  59572. }
  59573. /**
  59574. * @function LevelRenderer.Tool.Color.prototype.resetHighlight
  59575. * @description 重置默认高亮颜色。将当前的高亮色作为默认高亮颜色
  59576. */
  59577. resetHighlight() {
  59578. this.highlightColor = this._highlightColor;
  59579. }
  59580. /**
  59581. * @function LevelRenderer.Tool.Color.prototype.getHighlightColor
  59582. * @description 获取默认高亮颜色
  59583. * @returns {string} 颜色值。
  59584. */
  59585. getHighlightColor() {
  59586. return this.highlightColor;
  59587. }
  59588. /**
  59589. * @function LevelRenderer.Tool.Color.prototype.getRadialGradient
  59590. * @description 径向渐变。
  59591. * @param {number} x0 - 渐变起点横坐标。
  59592. * @param {number} y0 - 渐变起点纵坐标。
  59593. * @param {number} r0 - 半径
  59594. * @param {number} x1 - 渐变终点横坐标。
  59595. * @param {number} y1 - 渐变终点纵坐标。
  59596. * @param {number} r1 - 半径
  59597. * @param {Array} colorList - 颜色列表。
  59598. * @returns {CanvasGradient} Cavans 渐变颜色。
  59599. */
  59600. getRadialGradient(x0, y0, r0, x1, y1, r1, colorList) {
  59601. var util = this.util;
  59602. if (!this._ctx) {
  59603. this._ctx = util.getContext();
  59604. }
  59605. var gradient = this._ctx.createRadialGradient(x0, y0, r0, x1, y1, r1);
  59606. for (var i = 0, l = colorList.length; i < l; i++) {
  59607. gradient.addColorStop(colorList[i][0], colorList[i][1]);
  59608. }
  59609. gradient.__nonRecursion = true;
  59610. return gradient;
  59611. }
  59612. /**
  59613. * @function LevelRenderer.Tool.Color.prototype.getLinearGradient
  59614. * @description 线性渐变。
  59615. * @param {number} x0 - 渐变起点横坐标。
  59616. * @param {number} y0 - 渐变起点纵坐标。
  59617. * @param {number} x1 - 渐变终点横坐标。
  59618. * @param {number} y1 - 渐变终点纵坐标。
  59619. * @param {Array} colorList - 颜色列表。
  59620. * @returns {CanvasGradient} Cavans 渐变颜色。
  59621. */
  59622. getLinearGradient(x0, y0, x1, y1, colorList) {
  59623. var util = this.util;
  59624. if (!this._ctx) {
  59625. this._ctx = util.getContext();
  59626. }
  59627. var gradient = this._ctx.createLinearGradient(x0, y0, x1, y1);
  59628. for (var i = 0, l = colorList.length; i < l; i++) {
  59629. gradient.addColorStop(colorList[i][0], colorList[i][1]);
  59630. }
  59631. gradient.__nonRecursion = true;
  59632. return gradient;
  59633. }
  59634. /**
  59635. * @function LevelRenderer.Tool.Color.prototype.getStepColors
  59636. * @description 获取两种颜色之间渐变颜色数组。
  59637. * @param {Object} start - 起始颜色对象。
  59638. * @param {Object} end - 结束颜色对象。
  59639. * @param {number} step - 渐变级数。
  59640. * @returns {Array} 颜色数组。
  59641. */
  59642. getStepColors(start, end, step) {
  59643. start = this.toRGBA(start);
  59644. end = this.toRGBA(end);
  59645. start = this.getData(start);
  59646. end = this.getData(end);
  59647. var colors = [];
  59648. var stepR = (end[0] - start[0]) / step;
  59649. var stepG = (end[1] - start[1]) / step;
  59650. var stepB = (end[2] - start[2]) / step;
  59651. var stepA = (end[3] - start[3]) / step;
  59652. // 生成颜色集合
  59653. // fix by linfeng 颜色堆积
  59654. for (var i = 0, r = start[0], g = start[1], b = start[2], a = start[3]; i < step; i++) {
  59655. colors[i] = this.toColor([
  59656. this.adjust(Math.floor(r), [0, 255]),
  59657. this.adjust(Math.floor(g), [0, 255]),
  59658. this.adjust(Math.floor(b), [0, 255]),
  59659. a.toFixed(4) - 0
  59660. ], 'rgba');
  59661. r += stepR;
  59662. g += stepG;
  59663. b += stepB;
  59664. a += stepA;
  59665. }
  59666. r = end[0];
  59667. g = end[1];
  59668. b = end[2];
  59669. a = end[3];
  59670. colors[i] = this.toColor([r, g, b, a], 'rgba');
  59671. return colors;
  59672. }
  59673. /**
  59674. * @function LevelRenderer.Tool.Color.prototype.getGradientColors
  59675. * @description 获取指定级数的渐变颜色数组。
  59676. * @param {Array.<string>} colors - 颜色数组。
  59677. * @param {number} [step=20] - 渐变级数。
  59678. * @returns {Array.<string>} 颜色数组。
  59679. */
  59680. getGradientColors(colors, step) {
  59681. var ret = [];
  59682. var len = colors.length;
  59683. if (step === undefined) {
  59684. step = 20;
  59685. }
  59686. if (len === 1) {
  59687. ret = this.getStepColors(colors[0], colors[0], step);
  59688. } else if (len > 1) {
  59689. for (var i = 0, n = len - 1; i < n; i++) {
  59690. var steps = this.getStepColors(colors[i], colors[i + 1], step);
  59691. if (i < n - 1) {
  59692. steps.pop();
  59693. }
  59694. ret = ret.concat(steps);
  59695. }
  59696. }
  59697. return ret;
  59698. }
  59699. /**
  59700. * @function LevelRenderer.Tool.Color.prototype.toColor
  59701. * @description 颜色值数组转为指定格式颜色。
  59702. * @param {Array} data - 颜色值数组。
  59703. * @param {string} format - 格式,默认'rgb'
  59704. * @returns {string} 颜色。
  59705. */
  59706. toColor(data, format) {
  59707. format = format || 'rgb';
  59708. if (data && (data.length === 3 || data.length === 4)) {
  59709. data = this.map(data,
  59710. function (c) {
  59711. return c > 1 ? Math.ceil(c) : c;
  59712. }
  59713. );
  59714. if (format.indexOf('hex') > -1) {
  59715. return '#' + ((1 << 24) + (data[0] << 16) + (data[1] << 8) + (+data[2])).toString(16).slice(1);
  59716. } else if (format.indexOf('hs') > -1) {
  59717. var sx = this.map(data.slice(1, 3),
  59718. function (c) {
  59719. return c + '%';
  59720. }
  59721. );
  59722. data[1] = sx[0];
  59723. data[2] = sx[1];
  59724. }
  59725. if (format.indexOf('a') > -1) {
  59726. if (data.length === 3) {
  59727. data.push(1);
  59728. }
  59729. data[3] = this.adjust(data[3], [0, 1]);
  59730. return format + '(' + data.slice(0, 4).join(',') + ')';
  59731. }
  59732. return format + '(' + data.slice(0, 3).join(',') + ')';
  59733. }
  59734. }
  59735. /**
  59736. * @function LevelRenderer.Tool.Color.prototype.toArray
  59737. * @description 颜色字符串转换为rgba数组。
  59738. * @param {string} color - 颜色。
  59739. * @returns {Array.<number>} 颜色值数组。
  59740. */
  59741. toArray(color) {
  59742. color = this.trim(color);
  59743. if (color.indexOf('rgba') < 0) {
  59744. color = this.toRGBA(color);
  59745. }
  59746. var data = [];
  59747. var i = 0;
  59748. color.replace(/[\d.]+/g, function (n) {
  59749. if (i < 3) {
  59750. n = n | 0;
  59751. } else {
  59752. // Alpha
  59753. n = +n;
  59754. }
  59755. data[i++] = n;
  59756. });
  59757. return data;
  59758. }
  59759. /**
  59760. * @function LevelRenderer.Tool.Color.prototype.convert
  59761. * @description 颜色格式转化。
  59762. * @param {Array} data - 颜色值数组。
  59763. * @param {string} format - 格式,默认'rgb'
  59764. * @returns {string} 颜色。
  59765. */
  59766. convert(color, format) {
  59767. if (!this.isCalculableColor(color)) {
  59768. return color;
  59769. }
  59770. var data = this.getData(color);
  59771. var alpha = data[3];
  59772. if (typeof alpha === 'undefined') {
  59773. alpha = 1;
  59774. }
  59775. if (color.indexOf('hsb') > -1) {
  59776. data = this._HSV_2_RGB(data);
  59777. } else if (color.indexOf('hsl') > -1) {
  59778. data = this._HSL_2_RGB(data);
  59779. }
  59780. if (format.indexOf('hsb') > -1 || format.indexOf('hsv') > -1) {
  59781. data = this._RGB_2_HSB(data);
  59782. } else if (format.indexOf('hsl') > -1) {
  59783. data = this._RGB_2_HSL(data);
  59784. }
  59785. data[3] = alpha;
  59786. return this.toColor(data, format);
  59787. }
  59788. /**
  59789. * @function LevelRenderer.Tool.Color.prototype.toRGBA
  59790. * @description 转换为rgba格式的颜色。
  59791. * @param {string} color - 颜色。
  59792. * @returns {string} 颜色。
  59793. */
  59794. toRGBA(color) {
  59795. return this.convert(color, 'rgba');
  59796. }
  59797. /**
  59798. * @function LevelRenderer.Tool.Color.prototype.toRGB
  59799. * @description 转换为rgb数字格式的颜色。
  59800. * @param {string} color - 颜色。
  59801. * @returns {string} 颜色。
  59802. */
  59803. toRGB(color) {
  59804. return this.convert(color, 'rgb');
  59805. }
  59806. /**
  59807. * @function LevelRenderer.Tool.Color.prototype.toHex
  59808. * @description 转换为16进制颜色。
  59809. * @param {string} color - 颜色。
  59810. * @returns {string} 16进制颜色,#rrggbb格式
  59811. */
  59812. toHex(color) {
  59813. return this.convert(color, 'hex');
  59814. }
  59815. /**
  59816. * @function LevelRenderer.Tool.Color.prototype.toHSVA
  59817. * @description 转换为HSV颜色。
  59818. * @param {string} color - 颜色。
  59819. * @returns {string} HSVA颜色,hsva(h,s,v,a)
  59820. */
  59821. toHSVA(color) {
  59822. return this.convert(color, 'hsva');
  59823. }
  59824. /**
  59825. * @function LevelRenderer.Tool.Color.prototype.toHSV
  59826. * @description 转换为HSV颜色。
  59827. * @param {string} color - 颜色。
  59828. * @returns {string} HSV颜色,hsv(h,s,v)
  59829. */
  59830. toHSV(color) {
  59831. return this.convert(color, 'hsv');
  59832. }
  59833. /**
  59834. * @function LevelRenderer.Tool.Color.prototype.toHSBA
  59835. * @description 转换为HSBA颜色。
  59836. * @param {string} color - 颜色。
  59837. * @returns {string} HSBA颜色,hsba(h,s,b,a)
  59838. */
  59839. toHSBA(color) {
  59840. return this.convert(color, 'hsba');
  59841. }
  59842. /**
  59843. * @function LevelRenderer.Tool.Color.prototype.toHSB
  59844. * @description 转换为HSB颜色。
  59845. * @param {string} color - 颜色。
  59846. * @returns {string} HSB颜色,hsb(h,s,b)
  59847. */
  59848. toHSB(color) {
  59849. return this.convert(color, 'hsb');
  59850. }
  59851. /**
  59852. * @function LevelRenderer.Tool.Color.prototype.toHSLA
  59853. * @description 转换为HSLA颜色。
  59854. * @param {string} color - 颜色。
  59855. * @returns {string} HSLA颜色,hsla(h,s,l,a)
  59856. */
  59857. toHSLA(color) {
  59858. return this.convert(color, 'hsla');
  59859. }
  59860. /**
  59861. * @function LevelRenderer.Tool.Color.prototype.toHSL
  59862. * @description 转换为HSL颜色。
  59863. * @param {string} color - 颜色。
  59864. * @returns {string} HSL颜色,hsl(h,s,l)
  59865. */
  59866. toHSL(color) {
  59867. return this.convert(color, 'hsl');
  59868. }
  59869. /**
  59870. * @function LevelRenderer.Tool.Color.prototype.toName
  59871. * @description 转换颜色名。
  59872. * @param {string} color - 颜色。
  59873. * @returns {string} 颜色名
  59874. */
  59875. toName(color) {
  59876. for (var key in this._nameColors) {
  59877. if (this.toHex(this._nameColors[key]) === this.toHex(color)) {
  59878. return key;
  59879. }
  59880. }
  59881. return null;
  59882. }
  59883. /**
  59884. * @function LevelRenderer.Tool.Color.prototype.trim
  59885. * @description 移除颜色中多余空格。
  59886. * @param {string} color - 颜色。
  59887. * @returns {string} 无空格颜色
  59888. */
  59889. trim(color) {
  59890. return String(color).replace(/\s+/g, '');
  59891. }
  59892. /**
  59893. * @function LevelRenderer.Tool.Color.prototype.normalize
  59894. * @description 颜色规范化。
  59895. * @param {string} color - 颜色。
  59896. * @returns {string} 规范化后的颜色
  59897. */
  59898. normalize(color) {
  59899. // 颜色名
  59900. if (this._nameColors[color]) {
  59901. color = this._nameColors[color];
  59902. }
  59903. // 去掉空格
  59904. color = this.trim(color);
  59905. // hsv与hsb等价
  59906. color = color.replace(/hsv/i, 'hsb');
  59907. // rgb转为rrggbb
  59908. if (/^#[\da-f]{3}$/i.test(color)) {
  59909. color = parseInt(color.slice(1), 16);
  59910. var r = (color & 0xf00) << 8;
  59911. var g = (color & 0xf0) << 4;
  59912. var b = color & 0xf;
  59913. color = '#' + ((1 << 24) + (r << 4) + r + (g << 4) + g + (b << 4) + b).toString(16).slice(1);
  59914. }
  59915. // 或者使用以下正则替换,不过 chrome 下性能相对差点
  59916. // color = color.replace(/^#([\da-f])([\da-f])([\da-f])$/i, '#$1$1$2$2$3$3');
  59917. return color;
  59918. }
  59919. /**
  59920. * @function LevelRenderer.Tool.Color.prototype.lift
  59921. * @description 颜色加深或减淡,当level>0加深,当level<0减淡。
  59922. * @param {string} color - 颜色。
  59923. * @param {number} level - 升降程度,取值区间[-1,1]。
  59924. * @returns {string} 加深或减淡后颜色值
  59925. */
  59926. lift(color, level) {
  59927. if (!this.isCalculableColor(color)) {
  59928. return color;
  59929. }
  59930. var direct = level > 0 ? 1 : -1;
  59931. if (typeof level === 'undefined') {
  59932. level = 0;
  59933. }
  59934. level = Math.abs(level) > 1 ? 1 : Math.abs(level);
  59935. color = this.toRGB(color);
  59936. var data = this.getData(color);
  59937. for (var i = 0; i < 3; i++) {
  59938. if (direct === 1) {
  59939. data[i] = data[i] * (1 - level) | 0;
  59940. } else {
  59941. data[i] = ((255 - data[i]) * level + data[i]) | 0;
  59942. }
  59943. }
  59944. return 'rgb(' + data.join(',') + ')';
  59945. }
  59946. /**
  59947. * @function LevelRenderer.Tool.Color.prototype.reverse
  59948. * @description 颜色翻转。[255-r,255-g,255-b,1-a]
  59949. * @param {string} color - 颜色。
  59950. * @returns {string} 翻转颜色
  59951. */
  59952. reverse(color) {
  59953. if (!this.isCalculableColor(color)) {
  59954. return color;
  59955. }
  59956. var data = this.getData(this.toRGBA(color));
  59957. data = this.map(data,
  59958. function (c) {
  59959. return 255 - c;
  59960. }
  59961. );
  59962. return this.toColor(data, 'rgb');
  59963. }
  59964. /**
  59965. * @function LevelRenderer.Tool.Color.prototype.mix
  59966. * @description 简单两种颜色混合
  59967. * @param {string} color1 - 第一种颜色。
  59968. * @param {string} color2 - 第二种颜色。
  59969. * @param {number} weight - 混合权重[0-1]。
  59970. * @returns {string} 结果色。rgb(r,g,b)或rgba(r,g,b,a)
  59971. */
  59972. mix(color1, color2, weight) {
  59973. if (!this.isCalculableColor(color1) || !this.isCalculableColor(color2)) {
  59974. return color1;
  59975. }
  59976. if (typeof weight === 'undefined') {
  59977. weight = 0.5;
  59978. }
  59979. weight = 1 - this.adjust(weight, [0, 1]);
  59980. var w = weight * 2 - 1;
  59981. var data1 = this.getData(this.toRGBA(color1));
  59982. var data2 = this.getData(this.toRGBA(color2));
  59983. var d = data1[3] - data2[3];
  59984. var weight1 = (((w * d === -1) ? w : (w + d) / (1 + w * d)) + 1) / 2;
  59985. var weight2 = 1 - weight1;
  59986. var data = [];
  59987. for (var i = 0; i < 3; i++) {
  59988. data[i] = data1[i] * weight1 + data2[i] * weight2;
  59989. }
  59990. var alpha = data1[3] * weight + data2[3] * (1 - weight);
  59991. alpha = Math.max(0, Math.min(1, alpha));
  59992. if (data1[3] === 1 && data2[3] === 1) {// 不考虑透明度
  59993. return this.toColor(data, 'rgb');
  59994. }
  59995. data[3] = alpha;
  59996. return this.toColor(data, 'rgba');
  59997. }
  59998. /**
  59999. * @function LevelRenderer.Tool.Color.prototype.random
  60000. * @description 随机颜色
  60001. * @returns {string} 颜色值,#rrggbb格式
  60002. */
  60003. random() {
  60004. return '#' + Math.random().toString(16).slice(2, 8);
  60005. }
  60006. /**
  60007. * @function LevelRenderer.Tool.Color.prototype.getData
  60008. * @description 获取颜色值数组,返回值范围。
  60009. * RGB 范围[0-255]
  60010. * HSL/HSV/HSB 范围[0-1]
  60011. * A透明度范围[0-1]
  60012. * 支持格式:
  60013. * #rgb
  60014. * #rrggbb
  60015. * rgb(r,g,b)
  60016. * rgb(r%,g%,b%)
  60017. * rgba(r,g,b,a)
  60018. * hsb(h,s,b) // hsv与hsb等价
  60019. * hsb(h%,s%,b%)
  60020. * hsba(h,s,b,a)
  60021. * hsl(h,s,l)
  60022. * hsl(h%,s%,l%)
  60023. * hsla(h,s,l,a)
  60024. * @param {string} color - 颜色。
  60025. * @returns {Array.<number>} 颜色值数组或null
  60026. */
  60027. getData(color) {
  60028. color = this.normalize(color);
  60029. var r = color.match(this.colorRegExp);
  60030. if (r === null) {
  60031. throw new Error('The color format error'); // 颜色格式错误
  60032. }
  60033. var d;
  60034. var a;
  60035. var data = [];
  60036. var rgb;
  60037. if (r[2]) {
  60038. // #rrggbb
  60039. d = r[2].replace('#', '').split('');
  60040. rgb = [d[0] + d[1], d[2] + d[3], d[4] + d[5]];
  60041. data = this.map(rgb,
  60042. function (c) {
  60043. return Color_Color.prototype.adjust.call(this, parseInt(c, 16), [0, 255]);
  60044. }
  60045. );
  60046. } else if (r[4]) {
  60047. // rgb rgba
  60048. var rgba = (r[4]).split(',');
  60049. a = rgba[3];
  60050. rgb = rgba.slice(0, 3);
  60051. data = this.map(
  60052. rgb,
  60053. function (c) {
  60054. c = Math.floor(
  60055. c.indexOf('%') > 0 ? parseInt(c, 0) * 2.55 : c
  60056. );
  60057. return Color_Color.prototype.adjust.call(this, c, [0, 255]);
  60058. }
  60059. );
  60060. if (typeof a !== 'undefined') {
  60061. data.push(this.adjust(parseFloat(a), [0, 1]));
  60062. }
  60063. } else if (r[5] || r[6]) {
  60064. // hsb hsba hsl hsla
  60065. var hsxa = (r[5] || r[6]).split(',');
  60066. var h = parseInt(hsxa[0], 0) / 360;
  60067. var s = hsxa[1];
  60068. var x = hsxa[2];
  60069. a = hsxa[3];
  60070. data = this.map([s, x],
  60071. function (c) {
  60072. return Color_Color.prototype.adjust.call(this, parseFloat(c) / 100, [0, 1]);
  60073. }
  60074. );
  60075. data.unshift(h);
  60076. if (typeof a !== 'undefined') {
  60077. data.push(this.adjust(parseFloat(a), [0, 1]));
  60078. }
  60079. }
  60080. return data;
  60081. }
  60082. /**
  60083. * @function LevelRenderer.Tool.Color.prototype.alpha
  60084. * @description 设置颜色透明度
  60085. * @param {string} color - 颜色。
  60086. * @param {number} a - 透明度,区间[0,1]。
  60087. * @returns {string} rgba颜色值
  60088. */
  60089. alpha(color, a) {
  60090. if (!this.isCalculableColor(color)) {
  60091. return color;
  60092. }
  60093. if (a === null) {
  60094. a = 1;
  60095. }
  60096. var data = this.getData(this.toRGBA(color));
  60097. data[3] = this.adjust(Number(a).toFixed(4), [0, 1]);
  60098. return this.toColor(data, 'rgba');
  60099. }
  60100. /**
  60101. * @function LevelRenderer.Tool.Color.prototype.map
  60102. * @description 数组映射
  60103. * @param {Array} array - 数组。
  60104. * @param {function} fun - 函数。
  60105. * @returns {string} 数组映射结果
  60106. */
  60107. map(array, fun) {
  60108. if (typeof fun !== 'function') {
  60109. throw new TypeError();
  60110. }
  60111. var len = array ? array.length : 0;
  60112. for (var i = 0; i < len; i++) {
  60113. array[i] = fun(array[i]);
  60114. }
  60115. return array;
  60116. }
  60117. /**
  60118. * @function LevelRenderer.Tool.Color.prototype.adjust
  60119. * @description 调整值区间
  60120. * @param {Array.<number>} value - 数组。
  60121. * @param {Array.<number>} region - 区间。
  60122. * @returns {number} 调整后的值
  60123. */
  60124. adjust(value, region) {
  60125. // < to <= & > to >=
  60126. // modify by linzhifeng 2014-05-25 because -0 == 0
  60127. if (value <= region[0]) {
  60128. value = region[0];
  60129. } else if (value >= region[1]) {
  60130. value = region[1];
  60131. }
  60132. return value;
  60133. }
  60134. /**
  60135. * @function LevelRenderer.Tool.Color.prototype.isCalculableColor
  60136. * @description 判断是否是可计算的颜色
  60137. * @param {string} color - 颜色。
  60138. * @returns {boolean} 是否是可计算的颜色
  60139. */
  60140. isCalculableColor(color) {
  60141. return color instanceof Array || typeof color === 'string';
  60142. }
  60143. /**
  60144. * @function LevelRenderer.Tool.Color.prototype._HSV_2_RGB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  60145. */
  60146. _HSV_2_RGB(data) {
  60147. var H = data[0];
  60148. var S = data[1];
  60149. var V = data[2];
  60150. // HSV from 0 to 1
  60151. var R;
  60152. var G;
  60153. var B;
  60154. if (S === 0) {
  60155. R = V * 255;
  60156. G = V * 255;
  60157. B = V * 255;
  60158. } else {
  60159. var h = H * 6;
  60160. if (h === 6) {
  60161. h = 0;
  60162. }
  60163. var i = h | 0;
  60164. var v1 = V * (1 - S);
  60165. var v2 = V * (1 - S * (h - i));
  60166. var v3 = V * (1 - S * (1 - (h - i)));
  60167. var r = 0;
  60168. var g = 0;
  60169. var b = 0;
  60170. if (i === 0) {
  60171. r = V;
  60172. g = v3;
  60173. b = v1;
  60174. } else if (i === 1) {
  60175. r = v2;
  60176. g = V;
  60177. b = v1;
  60178. } else if (i === 2) {
  60179. r = v1;
  60180. g = V;
  60181. b = v3;
  60182. } else if (i === 3) {
  60183. r = v1;
  60184. g = v2;
  60185. b = V;
  60186. } else if (i === 4) {
  60187. r = v3;
  60188. g = v1;
  60189. b = V;
  60190. } else {
  60191. r = V;
  60192. g = v1;
  60193. b = v2;
  60194. }
  60195. // RGB results from 0 to 255
  60196. R = r * 255;
  60197. G = g * 255;
  60198. B = b * 255;
  60199. }
  60200. return [R, G, B];
  60201. }
  60202. /**
  60203. * @function LevelRenderer.Tool.Color.prototype._HSL_2_RGB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  60204. */
  60205. _HSL_2_RGB(data) {
  60206. var H = data[0];
  60207. var S = data[1];
  60208. var L = data[2];
  60209. // HSL from 0 to 1
  60210. var R;
  60211. var G;
  60212. var B;
  60213. if (S === 0) {
  60214. R = L * 255;
  60215. G = L * 255;
  60216. B = L * 255;
  60217. } else {
  60218. var v2;
  60219. if (L < 0.5) {
  60220. v2 = L * (1 + S);
  60221. } else {
  60222. v2 = (L + S) - (S * L);
  60223. }
  60224. var v1 = 2 * L - v2;
  60225. R = 255 * this._HUE_2_RGB(v1, v2, H + (1 / 3));
  60226. G = 255 * this._HUE_2_RGB(v1, v2, H);
  60227. B = 255 * this._HUE_2_RGB(v1, v2, H - (1 / 3));
  60228. }
  60229. return [R, G, B];
  60230. }
  60231. /**
  60232. * @function LevelRenderer.Tool.Color.prototype._HUE_2_RGB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  60233. */
  60234. _HUE_2_RGB(v1, v2, vH) {
  60235. if (vH < 0) {
  60236. vH += 1;
  60237. }
  60238. if (vH > 1) {
  60239. vH -= 1;
  60240. }
  60241. if ((6 * vH) < 1) {
  60242. return (v1 + (v2 - v1) * 6 * vH);
  60243. }
  60244. if ((2 * vH) < 1) {
  60245. return (v2);
  60246. }
  60247. if ((3 * vH) < 2) {
  60248. return (v1 + (v2 - v1) * ((2 / 3) - vH) * 6);
  60249. }
  60250. return v1;
  60251. }
  60252. /**
  60253. * @function LevelRenderer.Tool.Color.prototype._RGB_2_HSB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  60254. */
  60255. _RGB_2_HSB(data) {
  60256. // RGB from 0 to 255
  60257. var R = (data[0] / 255);
  60258. var G = (data[1] / 255);
  60259. var B = (data[2] / 255);
  60260. var vMin = Math.min(R, G, B); // Min. value of RGB
  60261. var vMax = Math.max(R, G, B); // Max. value of RGB
  60262. var delta = vMax - vMin; // Delta RGB value
  60263. var V = vMax;
  60264. var H;
  60265. var S;
  60266. // HSV results from 0 to 1
  60267. if (delta === 0) {
  60268. H = 0;
  60269. S = 0;
  60270. } else {
  60271. S = delta / vMax;
  60272. var deltaR = (((vMax - R) / 6) + (delta / 2)) / delta;
  60273. var deltaG = (((vMax - G) / 6) + (delta / 2)) / delta;
  60274. var deltaB = (((vMax - B) / 6) + (delta / 2)) / delta;
  60275. if (R === vMax) {
  60276. H = deltaB - deltaG;
  60277. } else if (G === vMax) {
  60278. H = (1 / 3) + deltaR - deltaB;
  60279. } else if (B === vMax) {
  60280. H = (2 / 3) + deltaG - deltaR;
  60281. }
  60282. if (H < 0) {
  60283. H += 1;
  60284. }
  60285. if (H > 1) {
  60286. H -= 1;
  60287. }
  60288. }
  60289. H = H * 360;
  60290. S = S * 100;
  60291. V = V * 100;
  60292. return [H, S, V];
  60293. }
  60294. /**
  60295. * @function LevelRenderer.Tool.Color.prototype._RGB_2_HSL。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  60296. */
  60297. _RGB_2_HSL(data) {
  60298. // RGB from 0 to 255
  60299. var R = (data[0] / 255);
  60300. var G = (data[1] / 255);
  60301. var B = (data[2] / 255);
  60302. var vMin = Math.min(R, G, B); // Min. value of RGB
  60303. var vMax = Math.max(R, G, B); // Max. value of RGB
  60304. var delta = vMax - vMin; // Delta RGB value
  60305. var L = (vMax + vMin) / 2;
  60306. var H;
  60307. var S;
  60308. // HSL results from 0 to 1
  60309. if (delta === 0) {
  60310. H = 0;
  60311. S = 0;
  60312. } else {
  60313. if (L < 0.5) {
  60314. S = delta / (vMax + vMin);
  60315. } else {
  60316. S = delta / (2 - vMax - vMin);
  60317. }
  60318. var deltaR = (((vMax - R) / 6) + (delta / 2)) / delta;
  60319. var deltaG = (((vMax - G) / 6) + (delta / 2)) / delta;
  60320. var deltaB = (((vMax - B) / 6) + (delta / 2)) / delta;
  60321. if (R === vMax) {
  60322. H = deltaB - deltaG;
  60323. } else if (G === vMax) {
  60324. H = (1 / 3) + deltaR - deltaB;
  60325. } else if (B === vMax) {
  60326. H = (2 / 3) + deltaG - deltaR;
  60327. }
  60328. if (H < 0) {
  60329. H += 1;
  60330. }
  60331. if (H > 1) {
  60332. H -= 1;
  60333. }
  60334. }
  60335. H = H * 360;
  60336. S = S * 100;
  60337. L = L * 100;
  60338. return [H, S, L];
  60339. }
  60340. }
  60341. ;// CONCATENATED MODULE: ./src/common/util/ColorsPickerUtil.js
  60342. var ColorRender = new Color_Color();
  60343. // let "http://www.qzu.zj.cn": "#bd10e0"
  60344. // "www.qzct.net": "#7ed321" = new LevelRenderer.Tool.Color();
  60345. /**
  60346. * @name ColorsPickerUtil
  60347. * @namespace
  60348. * @category BaseTypes Util
  60349. * @classdesc 色带选择器工具类。用于1、创建canvas对象,2、从几种颜色中获取一定数量的渐变色。
  60350. * @usage
  60351. * ```
  60352. * // 浏览器
  60353. * <script type="text/javascript" src="{cdn}"></script>
  60354. * <script>
  60355. * const result = {namespace}.ColorsPickerUtil.createCanvas();
  60356. *
  60357. * // 弃用的写法
  60358. * const result = SuperMap.ColorsPickerUtil.createCanvas();
  60359. *
  60360. * </script>
  60361. *
  60362. * // ES6 Import
  60363. * import { ColorsPickerUtil } from '{npm}';
  60364. *
  60365. * const result = ColorsPickerUtil.createCanvas();
  60366. * ```
  60367. */
  60368. class ColorsPickerUtil {
  60369. /**
  60370. * @function ColorsPickerUtil.createCanvas
  60371. * @description 创建DOM canvas。
  60372. * @param {number} height - canvas 高度。
  60373. * @param {number} width - canvas 宽度。
  60374. */
  60375. static createCanvas (height, width){
  60376. var canvas = document.createElement("canvas");
  60377. canvas.height = height;
  60378. canvas.width = width;
  60379. return canvas.getContext("2d");
  60380. }
  60381. /**
  60382. * @function ColorsPickerUtil.getLinearGradient
  60383. * @description 线性渐变。
  60384. * @param {number} x0 - 渐变起点 x 坐标。
  60385. * @param {number} y0 - 渐变起点 y 坐标。
  60386. * @param {number} x1 - 渐变终点 x 坐标。
  60387. * @param {number} y1 - 渐变终点 y 坐标。
  60388. * @param {Array} colorList 颜色列表。
  60389. * @returns {CanvasGradient} Cavans 渐变颜色。
  60390. */
  60391. static getLinearGradient (x0, y0, x1, y1, colorList){
  60392. if (!this._ctx) {
  60393. this._ctx = this.getContext();
  60394. }
  60395. var gradient = this._ctx.createLinearGradient(x0, y0, x1, y1);
  60396. var leng = colorList.length;
  60397. var add = 1/(leng -1);
  60398. var offset = 0;
  60399. for (var i = 0; i < leng; i++) {
  60400. gradient.addColorStop(offset, colorList[i]);
  60401. offset += add;
  60402. }
  60403. gradient.__nonRecursion = true;
  60404. return gradient;
  60405. }
  60406. /**
  60407. * @function ColorsPickerUtil.getContext
  60408. * @description 获取 Cavans 上下文。
  60409. * @returns {Object} Cavans 上下文。
  60410. */
  60411. static getContext () {
  60412. if (!this._ctx) {
  60413. this._ctx = document.createElement('canvas').getContext('2d');
  60414. }
  60415. return this._ctx;
  60416. }
  60417. /**
  60418. * @function ColorsPickerUtil.getStepColors
  60419. * @description 获取两种颜色之间渐变颜色数组。
  60420. * @param {string} start - 起始颜色。
  60421. * @param {string} end - 结束颜色。
  60422. * @param {number} step - 渐变级数。
  60423. * @returns {Array} 颜色数组。
  60424. */
  60425. static getStepColors (start, end, step){
  60426. start = ColorRender.toRGBA(start);
  60427. end = ColorRender.toRGBA(end);
  60428. start = ColorRender.getData(start);
  60429. end = ColorRender.getData(end);
  60430. var colors = [];
  60431. var stepR = (end[0] - start[0]) / step;
  60432. var stepG = (end[1] - start[1]) / step;
  60433. var stepB = (end[2] - start[2]) / step;
  60434. var stepA = (end[3] - start[3]) / step;
  60435. // 生成颜色集合
  60436. // fix by linfeng 颜色堆积
  60437. for (var i = 0, r = start[0], g = start[1], b = start[2], a = start[3]; i < step; i++) {
  60438. colors[i] = ColorRender.toColor([
  60439. ColorRender.adjust(Math.floor(r), [ 0, 255 ]),
  60440. ColorRender.adjust(Math.floor(g), [ 0, 255 ]),
  60441. ColorRender.adjust(Math.floor(b), [ 0, 255 ]),
  60442. a.toFixed(4) - 0
  60443. ],'hex');
  60444. r += stepR;
  60445. g += stepG;
  60446. b += stepB;
  60447. a += stepA;
  60448. }
  60449. r = end[0];
  60450. g = end[1];
  60451. b = end[2];
  60452. a = end[3];
  60453. colors[i] = ColorRender.toColor([r, g, b, a], 'hex');
  60454. return colors;
  60455. }
  60456. /**
  60457. * @function ColorsPickerUtil.getGradientColors
  60458. * @description 获取指定级数的渐变颜色数组。
  60459. * @param {Array.<string>} colors - 颜色组。
  60460. * @param {number} total - 颜色总数。
  60461. * @param {string} themeType - 专题类型。
  60462. * @returns {Array.<string>} 颜色数组。
  60463. */
  60464. static getGradientColors (colors, total, themeType){
  60465. var ret = [], step;
  60466. var i, n, len = colors.length;
  60467. if (total === undefined) {
  60468. return;
  60469. }
  60470. if(len >= total){
  60471. if(themeType === 'RANGE'){
  60472. for(i = 0; i<total; i++){
  60473. ret.push(colors[i]);
  60474. }
  60475. }else {
  60476. //1/2前后取色
  60477. for(i = 0; i<total; i++){
  60478. let ii = Math.floor(i/2);
  60479. if(i%2 === 0){
  60480. ret.push(colors[ii]);
  60481. }else {
  60482. let index = colors.length -1 - ii;
  60483. ret.push(colors[index]);
  60484. }
  60485. }
  60486. }
  60487. } else {
  60488. step = Math.ceil(total/(len-1));
  60489. for (i = 0, n = len - 1; i < n; i++) {
  60490. var steps = this.getStepColors(colors[i], colors[i + 1], step);
  60491. if (i < n - 1) {
  60492. steps.pop();
  60493. }
  60494. ret = ret.concat(steps);
  60495. }
  60496. //删除多余元素
  60497. var nouse = ret.length - total;
  60498. for(var j = 0, index = 0; j< nouse; j++){
  60499. ret.splice(index+2,1);
  60500. }
  60501. }
  60502. return ret;
  60503. }
  60504. }
  60505. ;// CONCATENATED MODULE: ./src/common/util/ArrayStatistic.js
  60506. /**
  60507. * @name ArrayStatistic
  60508. * @namespace
  60509. * @category BaseTypes Util
  60510. * @classdesc 处理数组。
  60511. * @usage
  60512. * ```
  60513. * // 浏览器
  60514. * <script type="text/javascript" src="{cdn}"></script>
  60515. * <script>
  60516. * const result = {namespace}.ArrayStatistic.newInstance();
  60517. *
  60518. * // 弃用的写法
  60519. * const result = SuperMap.ArrayStatistic.newInstance();
  60520. *
  60521. * </script>
  60522. *
  60523. * // ES6 Import
  60524. * import { ArrayStatistic } from '{npm}';
  60525. *
  60526. * const result = ArrayStatistic.newInstance();
  60527. * ```
  60528. */
  60529. class ArrayStatistic {
  60530. // geostatsInstance: null,
  60531. /**
  60532. * @function ArrayStatistic.newInstance
  60533. * @description 初始化插件实例。
  60534. */
  60535. static newInstance() {
  60536. // if(!this.geostatsInstance) {
  60537. // // this.geostatsInstance = new geostats();
  60538. // // }
  60539. // window.dataList = [];
  60540. if(!this.geostatsInstance) {
  60541. this.geostatsInstance = new window.geostats();
  60542. }
  60543. return this.geostatsInstance;
  60544. }
  60545. /**
  60546. * @function ArrayStatistic.getInstance
  60547. * @description 设置需要被处理的数组。
  60548. * @param {Array} array - 数组。
  60549. */
  60550. static getInstance(array) {
  60551. let instance = this.newInstance();
  60552. instance.setSerie(array);
  60553. return instance;
  60554. }
  60555. /**
  60556. * @function ArrayStatistic.getArrayStatistic
  60557. * @description 获取数组统计的值。
  60558. * @param {Array.<number>} array - 需要统计的数组。
  60559. * @param {string} type - 统计方法。
  60560. */
  60561. static getArrayStatistic(array, type){
  60562. if(!array.length) {
  60563. return 0;
  60564. }
  60565. if(type === "Sum" || type === "求和"){
  60566. return this.getSum(array);
  60567. } else if(type === "Maximum" || type === "最大值"){
  60568. return this.getMax(array);
  60569. } else if(type === "Minimum" || type === "最小值"){
  60570. return this.getMin(array);
  60571. } else if(type === "Average" || type === "平均值"){
  60572. return this.getMean(array);
  60573. } else if(type === "Median" || type === "中位数"){
  60574. return this.getMedian(array);
  60575. } else if(type === "times" || type === "计数"){
  60576. return this.getTimes(array);
  60577. }
  60578. }
  60579. /**
  60580. * @function ArrayStatistic.getArraySegments
  60581. * @description 获取数组分段后的数值。
  60582. * @param {Array.<number>} array - 需要分段的数组。
  60583. * @param {string} type - 分段方法。
  60584. * @param {number} segNum - 分段个数。
  60585. */
  60586. static getArraySegments(array, type, segNum) {
  60587. if(type === "offset") {
  60588. return this.getEqInterval(array, segNum);
  60589. } else if(type === "jenks") {
  60590. return this.getJenks(array, segNum);
  60591. } else if(type === "square") {
  60592. // 数据都必须 >= 0
  60593. let minValue = this.getMin(array);
  60594. if(minValue >= 0){
  60595. return this.getSqrtInterval(array, segNum);
  60596. }else {
  60597. //console.log('数据都必须 >= 0');
  60598. // Util.showMessage(Language.hasNegValue + Language.noSupportRange, 'ERROR');
  60599. return false;
  60600. }
  60601. } else if(type === "logarithm") {
  60602. // 数据都必须 > 0
  60603. let minValue = this.getMin(array);
  60604. if(minValue > 0){
  60605. return this.getGeometricProgression(array, segNum);
  60606. }else {
  60607. //console.log('数据都必须 > 0');
  60608. // Util.showMessage(Language.hasZeroNegValue + Language.noSupportRange, 'ERROR');
  60609. return false;
  60610. }
  60611. }
  60612. }
  60613. /**
  60614. * @function ArrayStatistic.getSum
  60615. * @description 求和。
  60616. * @param {Array.<number>} array 需要求和的参数。
  60617. * @returns {number} 返回求和结果。
  60618. */
  60619. static getSum(array){
  60620. return this.getInstance(array).sum();
  60621. }
  60622. /**
  60623. * @function ArrayStatistic.getMax
  60624. * @description 最大值。
  60625. * @param {Array.<number>} array 需要求最大值的参数。
  60626. * @returns {number} 返回最大值。
  60627. */
  60628. static getMax(array){
  60629. return this.getInstance(array).max();
  60630. }
  60631. /**
  60632. * @function ArrayStatistic.getMin
  60633. * @description 最小值。
  60634. * @param {Array.<number>} array 需要求最小值的参数。
  60635. * @returns {number} 返回最小值。
  60636. */
  60637. static getMin(array){
  60638. return this.getInstance(array).min();
  60639. }
  60640. /**
  60641. * @function ArrayStatistic.getMean
  60642. * @description 求平均数。
  60643. * @param {Array.<number>} array 需要求平均数的参数。
  60644. * @returns {number} 返回平均数。
  60645. */
  60646. static getMean(array){
  60647. return this.getInstance(array).mean();
  60648. }
  60649. /**
  60650. * @function ArrayStatistic.getMedian
  60651. * @description 求中位数。
  60652. * @param {Array.<number>} array 需要求中位数的参数。
  60653. * @returns {number} 返回中位数。
  60654. */
  60655. static getMedian(array) {
  60656. return this.getInstance(array).median();
  60657. }
  60658. /**
  60659. * @function ArrayStatistic.getTimes
  60660. * @description 计数。
  60661. * @param {Array.<number>} array 需要计数的参数。
  60662. * @returns {number} 返回计数结果。
  60663. */
  60664. static getTimes(array) {
  60665. return array.length;
  60666. }
  60667. /**
  60668. * @function ArrayStatistic.getEqInterval
  60669. * @description 等距分段法。
  60670. * @param {Array} array 需要进行等距分段的数组。
  60671. * @param {number} segNum 分段个数。
  60672. */
  60673. static getEqInterval(array, segNum) {
  60674. return this.getInstance(array).getClassEqInterval(segNum);
  60675. }
  60676. /**
  60677. * @function ArrayStatistic.getJenks
  60678. * @description 自然断裂法。
  60679. * @param {Array} array 需要进行自然断裂的参数。
  60680. * @param {number} segNum 分段个数。
  60681. */
  60682. static getJenks(array, segNum) {
  60683. return this.getInstance(array).getClassJenks(segNum);
  60684. }
  60685. /**
  60686. * @function ArrayStatistic.getSqrtInterval
  60687. * @description 平方根分段法。
  60688. * @param {Array} array 需要进行平方根分段的参数。
  60689. * @param {number} segNum 分段个数。
  60690. */
  60691. static getSqrtInterval(array, segNum) {
  60692. array = array.map(function(value) {
  60693. return Math.sqrt(value);
  60694. });
  60695. let breaks = this.getInstance(array).getClassEqInterval(segNum);
  60696. return (
  60697. breaks.map(function(value) {
  60698. return value * value;
  60699. })
  60700. )
  60701. }
  60702. /**
  60703. * @function ArrayStatistic.getGeometricProgression
  60704. * @description 对数分段法。
  60705. * @param {Array} array 需要进行对数分段的参数。
  60706. * @param {number} segNum 分段个数。
  60707. */
  60708. static getGeometricProgression(array, segNum) {
  60709. return this.getInstance(array).getClassGeometricProgression(segNum);
  60710. }
  60711. }
  60712. ;// CONCATENATED MODULE: ./src/common/util/index.js
  60713. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  60714. * This program are made available under the terms of the Apache License, Version 2.0
  60715. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60716. function toSuperMapGeometry(geoJSON) {
  60717. if (geoJSON && geoJSON.type) {
  60718. var format = new GeoJSONFormat();
  60719. var result = format.read(geoJSON, "FeatureCollection");
  60720. return result[0].geometry;
  60721. }
  60722. }
  60723. function toSuperMapPolygon(lnglatBounds) {
  60724. const west = lnglatBounds.getWest();
  60725. const east = lnglatBounds.getEast();
  60726. const sourth = lnglatBounds.getSouth();
  60727. const north = lnglatBounds.getNorth();
  60728. return new Polygon([
  60729. new LinearRing([
  60730. new GeometryPoint(west, sourth),
  60731. new GeometryPoint(east, sourth),
  60732. new GeometryPoint(east, north),
  60733. new GeometryPoint(west, north)
  60734. ])
  60735. ]);
  60736. }
  60737. /**
  60738. * @function Util.extend
  60739. * @description 对象拷贝赋值。
  60740. * @param {Object} dest - 目标对象。
  60741. * @param {Object} arguments - 待拷贝的对象。
  60742. * @returns {Object} 赋值后的目标对象。
  60743. */
  60744. function extend(dest) {
  60745. for (var index = 0; index < Object.getOwnPropertyNames(arguments).length; index++) {
  60746. var arg = Object.getOwnPropertyNames(arguments)[index];
  60747. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  60748. continue;
  60749. }
  60750. var obj = arguments[arg];
  60751. if (obj) {
  60752. for (var j = 0; j < Object.getOwnPropertyNames(obj).length; j++) {
  60753. var key = Object.getOwnPropertyNames(obj)[j];
  60754. if (arg == "caller" || arg == "callee" || arg == "length" || arg == "arguments") {
  60755. continue;
  60756. }
  60757. dest[key] = obj[key];
  60758. }
  60759. }
  60760. }
  60761. return dest;
  60762. }
  60763. // EXTERNAL MODULE: ./node_modules/lodash.topairs/index.js
  60764. var lodash_topairs = __webpack_require__(52);
  60765. var lodash_topairs_default = /*#__PURE__*/__webpack_require__.n(lodash_topairs);
  60766. ;// CONCATENATED MODULE: ./src/common/style/CartoCSS.js
  60767. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  60768. * This program are made available under the terms of the Apache License, Version 2.0
  60769. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60770. /**
  60771. * @class CartoCSS
  60772. * @deprecatedclass SuperMap.CartoCSS
  60773. * @classdesc CartoCSS 解析类,其主要功能为将 CartoCSS 字符串解析为 CartoCSS 的 shader 属性风格对象。
  60774. * @category BaseTypes Style
  60775. * @param {string} cartoStr - 样式表字符串。
  60776. * @example
  60777. * var cartocss = "@provinceLineColor:#ddd;
  60778. * #China_Provinces_L___China400{
  60779. * line-dasharray:10,10;
  60780. * line-color:@provinceLineColor;
  60781. * line-width:1;
  60782. * }";
  60783. * new CartoCSS(cartocss);
  60784. * @usage
  60785. */
  60786. /*eslint no-useless-escape: "off"*/
  60787. class CartoCSS {
  60788. constructor(cartoStr) {
  60789. this.env = null;
  60790. /**
  60791. * @member CartoCSS.prototype.parser
  60792. * @description 解析器。
  60793. */
  60794. this.parser = null;
  60795. /**
  60796. * @member CartoCSS.prototype.ruleSet
  60797. * @description CartoCSS 规则对象。
  60798. */
  60799. this.ruleSet = null;
  60800. /**
  60801. * @member CartoCSS.prototype.cartoStr
  60802. * @description CartoCSS 样式表字符串。
  60803. */
  60804. this.cartoStr = "";
  60805. /**
  60806. * @member CartoCSS.prototype.shaders
  60807. * @description Carto 着色器集。
  60808. */
  60809. this.shaders = null;
  60810. if (typeof cartoStr === "string") {
  60811. this.cartoStr = cartoStr;
  60812. this.env = {
  60813. frames: [],
  60814. errors: [],
  60815. error: function (obj) {
  60816. this.errors.push(obj);
  60817. }
  60818. };
  60819. this.parser = this.getParser(this.env);
  60820. this.parse(cartoStr);
  60821. this.shaders = this.toShaders();
  60822. }
  60823. }
  60824. /**
  60825. * @function CartoCSS.prototype.getParser
  60826. * @description 获取 CartoCSS 解析器。
  60827. */
  60828. getParser(env) {
  60829. var input, // LeSS input string
  60830. i, // current index in `input`
  60831. j, // current chunk
  60832. temp, // temporarily holds a chunk's state, for backtracking
  60833. memo, // temporarily holds `i`, when backtracking
  60834. furthest, // furthest index the parser has gone to
  60835. chunks, // chunkified input
  60836. current, // index of current chunk, in `input`
  60837. parser;
  60838. var that = this;
  60839. // This function is called after all files
  60840. // have been imported through `@import`.
  60841. var finish = function () {//NOSONAR
  60842. //所有文件导入完成之后调用
  60843. };
  60844. function save() {
  60845. temp = chunks[j];
  60846. memo = i;
  60847. current = i;
  60848. }
  60849. function restore() {
  60850. chunks[j] = temp;
  60851. i = memo;
  60852. current = i;
  60853. }
  60854. function sync() {
  60855. if (i > current) {
  60856. chunks[j] = chunks[j].slice(i - current);
  60857. current = i;
  60858. }
  60859. }
  60860. //
  60861. // Parse from a token, regexp or string, and move forward if match
  60862. //
  60863. function _match(tok) {
  60864. var match, length, c, endIndex;
  60865. // Non-terminal
  60866. if (tok instanceof Function) {
  60867. return tok.call(parser.parsers);
  60868. // Terminal
  60869. // Either match a single character in the input,
  60870. // or match a regexp in the current chunk (chunk[j]).
  60871. } else if (typeof(tok) === 'string') {
  60872. match = input.charAt(i) === tok ? tok : null;
  60873. length = 1;
  60874. sync();
  60875. } else {
  60876. sync();
  60877. match = tok.exec(chunks[j]);
  60878. if (match) {
  60879. length = match[0].length;
  60880. } else {
  60881. return null;
  60882. }
  60883. }
  60884. // The match is confirmed, add the match length to `i`,
  60885. // and consume any extra white-space characters (' ' || '\n')
  60886. // which come after that. The reason for this is that LeSS's
  60887. // grammar is mostly white-space insensitive.
  60888. if (match) {
  60889. var mem = i += length;
  60890. endIndex = i + chunks[j].length - length;
  60891. while (i < endIndex) {
  60892. c = input.charCodeAt(i);
  60893. if (!(c === 32 || c === 10 || c === 9)) {
  60894. break;
  60895. }
  60896. i++;
  60897. }
  60898. chunks[j] = chunks[j].slice(length + (i - mem));
  60899. current = i;
  60900. if (chunks[j].length === 0 && j < chunks.length - 1) {
  60901. j++;
  60902. }
  60903. if (typeof(match) === 'string') {
  60904. return match;
  60905. } else {
  60906. return match.length === 1 ? match[0] : match;
  60907. }
  60908. }
  60909. }
  60910. // Same as _match(), but don't change the state of the parser,
  60911. // just return the match.
  60912. function peek(tok) {
  60913. if (typeof(tok) === 'string') {
  60914. return input.charAt(i) === tok;
  60915. } else {
  60916. return !!tok.test(chunks[j]);
  60917. }
  60918. }
  60919. // Make an error object from a passed set of properties.
  60920. // Accepted properties:
  60921. // - `message`: Text of the error message.
  60922. // - `filename`: Filename where the error occurred.
  60923. // - `index`: Char. index where the error occurred.
  60924. function makeError(err) {
  60925. var einput;
  60926. var defautls = {
  60927. index: furthest,
  60928. filename: env.filename,
  60929. message: 'Parse error.',
  60930. line: 0,
  60931. column: -1
  60932. };
  60933. for (var prop in defautls) {
  60934. if (err[prop] === 0) {
  60935. err[prop] = defautls[prop];
  60936. }
  60937. }
  60938. if (err.filename && that.env.inputs && that.env.inputs[err.filename]) {
  60939. einput = that.env.inputs[err.filename];
  60940. } else {
  60941. einput = input;
  60942. }
  60943. err.line = (einput.slice(0, err.index).match(/\n/g) || '').length + 1;
  60944. for (var n = err.index; n >= 0 && einput.charAt(n) !== '\n'; n--) {
  60945. err.column++;
  60946. }
  60947. return new Error([err.filename, err.line, err.column, err.message].join(";"));
  60948. }
  60949. this.env = env = env || {};
  60950. this.env.filename = this.env.filename || null;
  60951. this.env.inputs = this.env.inputs || {};
  60952. // The Parser
  60953. parser = {
  60954. // Parse an input string into an abstract syntax tree.
  60955. // Throws an error on parse errors.
  60956. parse: function (str) {
  60957. var root, error = null;
  60958. i = j = current = furthest = 0;
  60959. chunks = [];
  60960. input = str.replace(/\r\n/g, '\n');
  60961. if (env.filename) {
  60962. that.env.inputs[env.filename] = input;
  60963. }
  60964. // Split the input into chunks.
  60965. chunks = (function (chunks) {
  60966. var j = 0,
  60967. skip = /(?:@\{[\w-]+\}|[^"'`\{\}\/\(\)\\])+/g,
  60968. comment = /\/\*(?:[^*]|\*+[^\/*])*\*+\/|\/\/.*/g,
  60969. string = /"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'|`((?:[^`]|\\.)*)`/g,
  60970. level = 0,
  60971. match,
  60972. chunk = chunks[0],
  60973. inParam;
  60974. for (var i = 0, c, cc; i < input.length;) {
  60975. skip.lastIndex = i;
  60976. if (match = skip.exec(input)) {
  60977. if (match.index === i) {
  60978. i += match[0].length;
  60979. chunk.push(match[0]);
  60980. }
  60981. }
  60982. c = input.charAt(i);
  60983. comment.lastIndex = string.lastIndex = i;
  60984. if (match = string.exec(input)) {
  60985. if (match.index === i) {
  60986. i += match[0].length;
  60987. chunk.push(match[0]);
  60988. continue;
  60989. }
  60990. }
  60991. if (!inParam && c === '/') {
  60992. cc = input.charAt(i + 1);
  60993. if (cc === '/' || cc === '*') {
  60994. if (match = comment.exec(input)) {
  60995. if (match.index === i) {
  60996. i += match[0].length;
  60997. chunk.push(match[0]);
  60998. continue;
  60999. }
  61000. }
  61001. }
  61002. }
  61003. switch (c) {
  61004. case '{'://NOSONAR
  61005. if (!inParam) {
  61006. level++;
  61007. chunk.push(c);
  61008. break;
  61009. }
  61010. case '}'://NOSONAR
  61011. if (!inParam) {
  61012. level--;
  61013. chunk.push(c);
  61014. chunks[++j] = chunk = [];
  61015. break;
  61016. }
  61017. case '('://NOSONAR
  61018. if (!inParam) {
  61019. inParam = true;
  61020. chunk.push(c);
  61021. break;
  61022. }
  61023. case ')'://NOSONAR
  61024. if (inParam) {
  61025. inParam = false;
  61026. chunk.push(c);
  61027. break;
  61028. }
  61029. default:
  61030. chunk.push(c);
  61031. break;
  61032. }
  61033. i++;
  61034. }
  61035. if (level !== 0) {
  61036. error = {
  61037. index: i - 1,
  61038. type: 'Parse',
  61039. message: (level > 0) ? "missing closing `}`" : "missing opening `{`"
  61040. };
  61041. }
  61042. return chunks.map(function (c) {
  61043. return c.join('');
  61044. });
  61045. })([[]]);
  61046. if (error) {
  61047. throw makeError(error);
  61048. }
  61049. // Sort rules by specificity: this function expects selectors to be
  61050. // split already.
  61051. //
  61052. // Written to be used as a .sort(Function);
  61053. // argument.
  61054. //
  61055. // [1, 0, 0, 467] > [0, 0, 1, 520]
  61056. var specificitySort = function (a, b) {
  61057. var as = a.specificity;
  61058. var bs = b.specificity;
  61059. if (as[0] != bs[0]) {return bs[0] - as[0];}
  61060. if (as[1] != bs[1]) {return bs[1] - as[1];}
  61061. if (as[2] != bs[2]) {return bs[2] - as[2];}
  61062. return bs[3] - as[3];
  61063. };
  61064. // Start with the primary rule.
  61065. // The whole syntax tree is held under a Ruleset node,
  61066. // with the `root` property set to true, so no `{}` are
  61067. // output.
  61068. root = new CartoCSS.Tree.Ruleset([], _match(this.parsers.primary));
  61069. root.root = true;
  61070. // Get an array of Ruleset objects, flattened
  61071. // and sorted according to specificitySort
  61072. root.toList = (function () {
  61073. return function (env) {
  61074. env.error = function (e) {
  61075. if (!env.errors) {env.errors = new Error('');}
  61076. if (env.errors.message) {
  61077. env.errors.message += '\n' + makeError(e).message;
  61078. } else {
  61079. env.errors.message = makeError(e).message;
  61080. }
  61081. };
  61082. env.frames = env.frames || [];
  61083. // call populates Invalid-caused errors
  61084. var definitions = this.flatten([], [], env);
  61085. definitions.sort(specificitySort);
  61086. return definitions;
  61087. };
  61088. })();
  61089. return root;
  61090. },
  61091. // Here in, the parsing rules/functions
  61092. //
  61093. // The basic structure of the syntax tree generated is as follows:
  61094. //
  61095. // Ruleset -> Rule -> Value -> Expression -> Entity
  61096. //
  61097. // In general, most rules will try to parse a token with the `_match()` function, and if the return
  61098. // value is truly, will return a new node, of the relevant type. Sometimes, we need to check
  61099. // first, before parsing, that's when we use `peek()`.
  61100. parsers: {
  61101. // The `primary` rule is the *entry* and *exit* point of the parser.
  61102. // The rules here can appear at any level of the parse tree.
  61103. //
  61104. // The recursive nature of the grammar is an interplay between the `block`
  61105. // rule, which represents `{ ... }`, the `ruleset` rule, and this `primary` rule,
  61106. // as represented by this simplified grammar:
  61107. //
  61108. // primary → (ruleset | rule)+
  61109. // ruleset → selector+ block
  61110. // block → '{' primary '}'
  61111. //
  61112. // Only at one point is the primary rule not called from the
  61113. // block rule: at the root level.
  61114. primary: function () {
  61115. var node, root = [];
  61116. while ((node = _match(this.rule) || _match(this.ruleset) ||
  61117. _match(this.comment)) ||
  61118. _match(/^[\s\n]+/) || (node = _match(this.invalid))) {
  61119. if (node) {root.push(node);}
  61120. }
  61121. return root;
  61122. },
  61123. invalid: function () {
  61124. var chunk = _match(/^[^;\n]*[;\n]/);
  61125. // To fail gracefully, match everything until a semicolon or linebreak.
  61126. if (chunk) {
  61127. return new CartoCSS.Tree.Invalid(chunk, memo);
  61128. }
  61129. },
  61130. // We create a Comment node for CSS comments `/* */`,
  61131. // but keep the LeSS comments `//` silent, by just skipping
  61132. // over them.
  61133. comment: function () {
  61134. var comment;
  61135. if (input.charAt(i) !== '/') {return;}
  61136. if (input.charAt(i + 1) === '/') {
  61137. return new CartoCSS.Tree.Comment(_match(/^\/\/.*/), true);
  61138. } else if (comment = _match(/^\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/)) {
  61139. return new CartoCSS.Tree.Comment(comment);
  61140. }
  61141. },
  61142. // Entities are tokens which can be found inside an Expression
  61143. entities: {
  61144. // A string, which supports escaping " and ' "milky way" 'he\'s the one!'
  61145. quoted: function () {
  61146. if (input.charAt(i) !== '"' && input.charAt(i) !== "'") {return;}
  61147. var str = _match(/^"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/);
  61148. if (str) {
  61149. return new CartoCSS.Tree.Quoted(str[1] || str[2]);
  61150. }
  61151. },
  61152. // A reference to a Mapnik field, like [NAME]
  61153. // Behind the scenes, this has the same representation, but Carto
  61154. // needs to be careful to warn when unsupported operations are used.
  61155. field: function () {
  61156. var l = '[', r = ']';
  61157. if (!_match(l)) {return;}
  61158. var field_name = _match(/(^[^\]]+)/);
  61159. if (!_match(r)) {return;}
  61160. if (field_name) {return new CartoCSS.Tree.Field(field_name[1]);}
  61161. },
  61162. // This is a comparison operator
  61163. comparison: function () {
  61164. var str = _match(/^=~|=|!=|<=|>=|<|>/);
  61165. if (str) {
  61166. return str;
  61167. }
  61168. },
  61169. // A catch-all word, such as: hard-light
  61170. // These can start with either a letter or a dash (-),
  61171. // and then contain numbers, underscores, and letters.
  61172. keyword: function () {
  61173. var k = _match(/^[A-Za-z\u4e00-\u9fa5-]+[A-Za-z-0-9\u4e00-\u9fa5_]*/);
  61174. if (k) {
  61175. return new CartoCSS.Tree.Keyword(k);
  61176. }
  61177. },
  61178. // A function call like rgb(255, 0, 255)
  61179. // The arguments are parsed with the `entities.arguments` parser.
  61180. call: function () {
  61181. var name, args;
  61182. if (!(name = /^([\w\-]+|%)\(/.exec(chunks[j]))) {return;}
  61183. name = name[1];
  61184. if (name === 'url') {
  61185. // url() is handled by the url parser instead
  61186. return null;
  61187. } else {
  61188. i += name.length;
  61189. }
  61190. var l = '(', r = ')';
  61191. _match(l); // Parse the '(' and consume whitespace.
  61192. args = _match(this.entities['arguments']);
  61193. if (!_match(r)) {return;}
  61194. if (name) {
  61195. return new CartoCSS.Tree.Call(name, args, i);
  61196. }
  61197. },
  61198. // Arguments are comma-separated expressions
  61199. 'arguments': function () {
  61200. var args = [], arg;
  61201. while (arg = _match(this.expression)) {
  61202. args.push(arg);
  61203. var q = ',';
  61204. if (!_match(q)) {
  61205. break;
  61206. }
  61207. }
  61208. return args;
  61209. },
  61210. literal: function () {
  61211. return _match(this.entities.dimension) ||
  61212. _match(this.entities.keywordcolor) ||
  61213. _match(this.entities.hexcolor) ||
  61214. _match(this.entities.quoted);
  61215. },
  61216. // Parse url() tokens
  61217. //
  61218. // We use a specific rule for urls, because they don't really behave like
  61219. // standard function calls. The difference is that the argument doesn't have
  61220. // to be enclosed within a string, so it can't be parsed as an Expression.
  61221. url: function () {
  61222. var value;
  61223. if (input.charAt(i) !== 'u' || !_match(/^url\(/)) {return;}
  61224. value = _match(this.entities.quoted) || _match(this.entities.variable) ||
  61225. _match(/^[\-\w%@_match\/.&=:;#+?~]+/) || '';
  61226. var r = ')';
  61227. if (!_match(r)) {
  61228. return new CartoCSS.Tree.Invalid(value, memo, 'Missing closing ) in URL.');
  61229. } else {
  61230. return new CartoCSS.Tree.URL((typeof value.value !== 'undefined' ||
  61231. value instanceof CartoCSS.Tree.Variable) ?
  61232. value : new CartoCSS.Tree.Quoted(value));
  61233. }
  61234. },
  61235. // A Variable entity, such as `@fink`, in
  61236. //
  61237. // width: @fink + 2px
  61238. //
  61239. // We use a different parser for variable definitions,
  61240. // see `parsers.variable`.
  61241. variable: function () {
  61242. var name, index = i;
  61243. if (input.charAt(i) === '@' && (name = _match(/^@[\w-]+/))) {
  61244. return new CartoCSS.Tree.Variable(name, index, env.filename);
  61245. }
  61246. },
  61247. hexcolor: function () {
  61248. var rgb;
  61249. if (input.charAt(i) === '#' && (rgb = _match(/^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})/))) {
  61250. return new CartoCSS.Tree.Color(rgb[1]);
  61251. }
  61252. },
  61253. keywordcolor: function () {
  61254. var rgb = chunks[j].match(/^[a-z]+/);
  61255. if (rgb && rgb[0] in CartoCSS.Tree.Reference.data.colors) {
  61256. return new CartoCSS.Tree.Color(CartoCSS.Tree.Reference.data.colors[_match(/^[a-z]+/)]);
  61257. }
  61258. },
  61259. // A Dimension, that is, a number and a unit. The only
  61260. // unit that has an effect is %
  61261. dimension: function () {
  61262. var c = input.charCodeAt(i);
  61263. if ((c > 57 || c < 45) || c === 47) {return;}
  61264. var value = _match(/^(-?\d*\.?\d+(?:[eE][-+]?\d+)?)(\%|\w+)?/);
  61265. if (value) {
  61266. return new CartoCSS.Tree.Dimension(value[1], value[2], memo);
  61267. }
  61268. }
  61269. },
  61270. // The variable part of a variable definition.
  61271. // Used in the `rule` parser. Like @fink:
  61272. variable: function () {
  61273. var name;
  61274. if (input.charAt(i) === '@' && (name = _match(/^(@[\w-]+)\s*:/))) {
  61275. return name[1];
  61276. }
  61277. },
  61278. // Entities are the smallest recognized token,
  61279. // and can be found inside a rule's value.
  61280. entity: function () {
  61281. var property1 = _match(this.entities.call) || _match(this.entities.literal);
  61282. var property2 = _match(this.entities.field) || _match(this.entities.variable);
  61283. var property3 = _match(this.entities.url) || _match(this.entities.keyword);
  61284. return property1 || property2 || property3;
  61285. },
  61286. // A Rule terminator. Note that we use `peek()` to check for '}',
  61287. // because the `block` rule will be expecting it, but we still need to make sure
  61288. // it's there, if ';' was ommitted.
  61289. end: function () {
  61290. var q = ';';
  61291. return _match(q) || peek('}');
  61292. },
  61293. // Elements are the building blocks for Selectors. They consist of
  61294. // an element name, such as a tag a class, or `*`.
  61295. //增加对中文的支持,[\u4e00-\u9fa5]
  61296. element: function () {
  61297. var e = _match(/^(?:[.#][\w\u4e00-\u9fa5\-]+|\*|Map)/);
  61298. if (e) {return new CartoCSS.Tree.Element(e);}
  61299. },
  61300. // Attachments allow adding multiple lines, polygons etc. to an
  61301. // object. There can only be one attachment per selector.
  61302. attachment: function () {
  61303. var s = _match(/^::([\w\-]+(?:\/[\w\-]+)*)/);
  61304. if (s) {return s[1];}
  61305. },
  61306. // Selectors are made out of one or more Elements, see above.
  61307. selector: function () {
  61308. var a, attachment,
  61309. e, elements = [],
  61310. f, filters = new CartoCSS.Tree.Filterset(),
  61311. z, zooms = [],
  61312. segments = 0, conditions = 0;
  61313. while (
  61314. (e = _match(this.element)) ||
  61315. (z = _match(this.zoom)) ||
  61316. (f = _match(this.filter)) ||
  61317. (a = _match(this.attachment))
  61318. ) {
  61319. segments++;
  61320. if (e) {
  61321. elements.push(e);
  61322. } else if (z) {
  61323. zooms.push(z);
  61324. conditions++;
  61325. } else if (f) {
  61326. var err = filters.add(f);
  61327. if (err) {
  61328. throw makeError({
  61329. message: err,
  61330. index: i - 1
  61331. });
  61332. }
  61333. conditions++;
  61334. } else if (attachment) {
  61335. throw makeError({
  61336. message: 'Encountered second attachment name.',
  61337. index: i - 1
  61338. });
  61339. } else {
  61340. attachment = a;
  61341. }
  61342. var c = input.charAt(i);
  61343. if (c === '{' || c === '}' || c === ';' || c === ',') {
  61344. break;
  61345. }
  61346. }
  61347. if (segments) {
  61348. return new CartoCSS.Tree.Selector(filters, zooms, elements, attachment, conditions, memo);
  61349. }
  61350. },
  61351. filter: function () {
  61352. save();
  61353. var key, op, val, l = '[', r = ']';
  61354. if (!_match(l)) {return;}
  61355. if (key = _match(/^[a-zA-Z0-9\-_]+/) ||
  61356. _match(this.entities.quoted) ||
  61357. _match(this.entities.variable) ||
  61358. _match(this.entities.keyword) ||
  61359. _match(this.entities.field)) {
  61360. if (key instanceof CartoCSS.Tree.Quoted) {
  61361. key = new CartoCSS.Tree.Field(key.toString());
  61362. }
  61363. if ((op = _match(this.entities.comparison)) &&
  61364. (val = _match(this.entities.quoted) ||
  61365. _match(this.entities.variable) ||
  61366. _match(this.entities.dimension) ||
  61367. _match(this.entities.keyword) ||
  61368. _match(this.entities.field))) {
  61369. if (!_match(r)) {
  61370. throw makeError({
  61371. message: 'Missing closing ] of filter.',
  61372. index: memo - 1
  61373. });
  61374. }
  61375. if (!key.is) {key = new CartoCSS.Tree.Field(key);}
  61376. return new CartoCSS.Tree.Filter(key, op, val, memo, env.filename);
  61377. }
  61378. }
  61379. },
  61380. zoom: function () {
  61381. save();
  61382. var op, val, r = ']';
  61383. if (_match(/^\[\s*zoom/g) &&
  61384. (op = _match(this.entities.comparison)) &&
  61385. (val = _match(this.entities.variable) || _match(this.entities.dimension)) && _match(r)) {
  61386. return new CartoCSS.Tree.Zoom(op, val, memo);
  61387. } else {
  61388. // backtrack
  61389. restore();
  61390. }
  61391. },
  61392. // The `block` rule is used by `ruleset`
  61393. // It's a wrapper around the `primary` rule, with added `{}`.
  61394. block: function () {
  61395. var content, l = '{', r = '}';
  61396. if (_match(l) && (content = _match(this.primary)) && _match(r)) {
  61397. return content;
  61398. }
  61399. },
  61400. // div, .class, body > p {...}
  61401. ruleset: function () {
  61402. var selectors = [], s, rules, q = ',';
  61403. save();
  61404. while (s = _match(this.selector)) {
  61405. selectors.push(s);
  61406. while (_match(this.comment)) {//NOSONAR
  61407. }
  61408. if (!_match(q)) {
  61409. break;
  61410. }
  61411. while (_match(this.comment)) {//NOSONAR
  61412. }
  61413. }
  61414. if (s) {
  61415. while (_match(this.comment)) {//NOSONAR
  61416. }
  61417. }
  61418. if (selectors.length > 0 && (rules = _match(this.block))) {
  61419. if (selectors.length === 1 &&
  61420. selectors[0].elements.length &&
  61421. selectors[0].elements[0].value === 'Map') {
  61422. var rs = new CartoCSS.Tree.Ruleset(selectors, rules);
  61423. rs.isMap = true;
  61424. return rs;
  61425. }
  61426. return new CartoCSS.Tree.Ruleset(selectors, rules);
  61427. } else {
  61428. // Backtrack
  61429. restore();
  61430. }
  61431. },
  61432. rule: function () {
  61433. var name, value, c = input.charAt(i);
  61434. save();
  61435. if (c === '.' || c === '#') {
  61436. return;
  61437. }
  61438. if (name = _match(this.variable) || _match(this.property)) {
  61439. value = _match(this.value);
  61440. if (value && _match(this.end)) {
  61441. return new CartoCSS.Tree.Rule(name, value, memo, env.filename);
  61442. } else {
  61443. furthest = i;
  61444. restore();
  61445. }
  61446. }
  61447. },
  61448. font: function () {
  61449. var value = [], expression = [], e, q = ',';
  61450. while (e = _match(this.entity)) {
  61451. expression.push(e);
  61452. }
  61453. value.push(new CartoCSS.Tree.Expression(expression));
  61454. if (_match(q)) {
  61455. while (e = _match(this.expression)) {
  61456. value.push(e);
  61457. if (!_match(q)) {
  61458. break;
  61459. }
  61460. }
  61461. }
  61462. return new CartoCSS.Tree.Value(value);
  61463. },
  61464. // A Value is a comma-delimited list of Expressions
  61465. // In a Rule, a Value represents everything after the `:`,
  61466. // and before the `;`.
  61467. value: function () {
  61468. var e, expressions = [], q = ',';
  61469. while (e = _match(this.expression)) {
  61470. expressions.push(e);
  61471. if (!_match(q)) {
  61472. break;
  61473. }
  61474. }
  61475. if (expressions.length > 1) {
  61476. return new CartoCSS.Tree.Value(expressions.map(function (e) {
  61477. return e.value[0];
  61478. }));
  61479. } else if (expressions.length === 1) {
  61480. return new CartoCSS.Tree.Value(expressions);
  61481. }
  61482. },
  61483. // A sub-expression, contained by parenthensis
  61484. sub: function () {
  61485. var e, l = '(', r = ")";
  61486. if (_match(l) && (e = _match(this.expression)) && _match(r)) {
  61487. return e;
  61488. }
  61489. },
  61490. // This is a misnomer because it actually handles multiplication
  61491. // and division.
  61492. multiplication: function () {
  61493. var m, a, op, operation, q = '/';
  61494. if (m = _match(this.operand)) {
  61495. while ((op = (_match(q) || _match('*') || _match('%'))) && (a = _match(this.operand))) {
  61496. operation = new CartoCSS.Tree.Operation(op, [operation || m, a], memo);
  61497. }
  61498. return operation || m;
  61499. }
  61500. },
  61501. addition: function () {
  61502. var m, a, op, operation, plus = '+';
  61503. if (m = _match(this.multiplication)) {
  61504. while ((op = _match(/^[-+]\s+/) || (input.charAt(i - 1) != ' ' && (_match(plus) || _match('-')))) &&
  61505. (a = _match(this.multiplication))) {
  61506. operation = new CartoCSS.Tree.Operation(op, [operation || m, a], memo);
  61507. }
  61508. return operation || m;
  61509. }
  61510. },
  61511. // An operand is anything that can be part of an operation,
  61512. // such as a Color, or a Variable
  61513. operand: function () {
  61514. return _match(this.sub) || _match(this.entity);
  61515. },
  61516. // Expressions either represent mathematical operations,
  61517. // or white-space delimited Entities. @var * 2
  61518. expression: function () {
  61519. var e, entities = [];
  61520. while (e = _match(this.addition) || _match(this.entity)) {
  61521. entities.push(e);
  61522. }
  61523. if (entities.length > 0) {
  61524. return new CartoCSS.Tree.Expression(entities);
  61525. }
  61526. },
  61527. property: function () {
  61528. var name = _match(/^(([a-z][-a-z_0-9]*\/)?\*?-?[-a-z_0-9]+)\s*:/);
  61529. if (name) {return name[1];}
  61530. }
  61531. }
  61532. };
  61533. return parser;
  61534. }
  61535. /**
  61536. * @function CartoCSS.prototype.parse
  61537. * @description 利用CartoCSS解析器里面的parse方法,将CartoCSS样式表字符串转化为CartoCSS规则集。
  61538. * @returns {Object} CartoCSS规则集。
  61539. */
  61540. parse(str) {
  61541. var parser = this.parser;
  61542. var ruleSet = this.ruleSet = parser.parse(str);
  61543. return ruleSet;
  61544. }
  61545. /**
  61546. * @function CartoCSS.prototype.toShaders
  61547. * @description 将CartoCSS规则集转化为着色器。
  61548. * @returns {Array} CartoCSS着色器集。
  61549. */
  61550. toShaders() {
  61551. if (this.ruleSet) {
  61552. var ruleset = this.ruleSet;
  61553. if (ruleset) {
  61554. var defs = ruleset.toList(this.env);
  61555. defs.reverse();
  61556. var shaders = {};
  61557. var keys = [];
  61558. this._toShaders(shaders,keys,defs);
  61559. var ordered_shaders = [];
  61560. var done = {};
  61561. for (var i = 0, len0 = defs.length; i < len0; ++i) {
  61562. var def = defs[i];
  61563. var k = def.attachment;
  61564. var shader = shaders[keys[i]];
  61565. var shaderArray = [];
  61566. if (!done[k]) {
  61567. var j = 0;
  61568. for (var prop in shader) {
  61569. if (prop !== 'zoom' && prop !== 'frames' && prop !== "attachment" && prop != "elements") {
  61570. //对layer-index作特殊处理以实现图层的控制
  61571. if (prop === "layer-index") {
  61572. /*var getLayerIndex = Function("attributes", "zoom", "var _value = null;" + shader[prop].join('\n') + "; return _value; ");*/
  61573. var getLayerIndex = function (attributes, zoom) {//NOSONAR
  61574. var _value = null;
  61575. shader[prop].join('\n');
  61576. return _value;
  61577. };
  61578. var layerIndex = getLayerIndex();
  61579. Object.defineProperty(shaderArray, "layerIndex", {
  61580. configurable: true,
  61581. enumerable: false,
  61582. value: layerIndex
  61583. });
  61584. } else {
  61585. shaderArray[j++] = function (ops, shaderArray) {//NOSONAR
  61586. if (!Array.isArray(ops)) {
  61587. return ops;
  61588. }
  61589. var body = ops.join('\n');
  61590. var myKeyword = 'attributes["FEATUREID"]&&attributes["FEATUREID"]';
  61591. var index = body.indexOf(myKeyword);
  61592. if (index >= 0) {
  61593. //对featureID作一些特殊处理,以将featureID提取出来
  61594. if (!shaderArray.featureFilter) {
  61595. var featureFilterStart = index + myKeyword.length;
  61596. var featureFilterEnd = body.indexOf(")", featureFilterStart + 1);
  61597. var featureFilterStr = "featureId&&(featureId" + body.substring(featureFilterStart, featureFilterEnd) + ")";
  61598. /*var featureFilter = Function("featureId", "if(" + featureFilterStr + "){return true;}return false;");*/
  61599. var featureFilter = function (featureId) {
  61600. if (featureFilterStr) {
  61601. return true;
  61602. }
  61603. return false;
  61604. }
  61605. Object.defineProperty(shaderArray, "featureFilter", {
  61606. configurable: true,
  61607. enumerable: false,
  61608. value: featureFilter
  61609. });
  61610. }
  61611. return {
  61612. "property": prop,
  61613. "getValue": Function("attributes", "zoom", "seftFilter", "var _value = null; var isExcute=typeof seftFilter=='function'?sefgFilter():seftFilter;if(isExcute){" + body + ";} return _value; ")//NOSONAR
  61614. };
  61615. } else {
  61616. return {
  61617. "property": prop,
  61618. "getValue": Function("attributes", "zoom", "var _value = null;" + body + "; return _value; ")//NOSONAR
  61619. };
  61620. }
  61621. }(shader[prop], shaderArray);
  61622. }
  61623. }
  61624. }
  61625. Object.defineProperty(shaderArray, "attachment", {
  61626. configurable: true,
  61627. enumerable: false,
  61628. value: k
  61629. });
  61630. Object.defineProperty(shaderArray, "elements", {
  61631. configurable: true,
  61632. enumerable: false,
  61633. value: def.elements
  61634. });
  61635. ordered_shaders.push(shaderArray);
  61636. done[keys[i]] = true;
  61637. }
  61638. Object.defineProperty(shaderArray, "zoom", {
  61639. configurable: true,
  61640. enumerable: false,
  61641. value: def.zoom
  61642. });
  61643. //shader.frames.push(def.frame_offset);
  61644. }
  61645. return ordered_shaders;
  61646. }
  61647. }
  61648. return null;
  61649. }
  61650. _toShaders(shaders, keys,defs) {
  61651. for (let i = 0, len0 = defs.length; i < len0; ++i) {
  61652. let def = defs[i];
  61653. let element_str = [];
  61654. for (let j = 0, len1 = def.elements.length; j < len1; j++) {
  61655. element_str.push(def.elements[j]);
  61656. }
  61657. let filters = def.filters.filters;
  61658. let filterStr = [];
  61659. for (let attr in filters) {
  61660. filterStr.push(filters[attr].id);
  61661. }
  61662. let key = element_str.join("/") + "::" + def.attachment + "_" + filterStr.join("_");
  61663. keys.push(key);
  61664. let shader = shaders[key] = (shaders[key] || {});
  61665. //shader.frames = [];
  61666. shader.zoom = CartoCSS.Tree.Zoom.all;
  61667. let props = def.toJS(this.env);
  61668. for (let v in props) {
  61669. (shader[v] = (shader[v] || [])).push(props[v].join('\n'))
  61670. }
  61671. }
  61672. }
  61673. /**
  61674. * @function CartoCSS.prototype.getShaders
  61675. * @description 获取CartoCSS着色器。
  61676. * @returns {Array} 着色器集。
  61677. * @example
  61678. * //shaders的结构大概如下:
  61679. * var shaders=[
  61680. * {
  61681. * attachment:"one",
  61682. * elements:[],
  61683. * zoom:23,
  61684. * length:2,
  61685. * 0:{property:"line-color",value:function(attribute,zoom){var _value=null;if(zoom){_value="#123456"}return _vlaue;}},
  61686. * 1:{preoperty:"line-width",value:function(attribute,zoom){var _value=null;if(zoom){_value=3}return _vlaue;}}
  61687. * },
  61688. * {
  61689. * attachment:"two",
  61690. * elements:[],
  61691. * zoom:23,
  61692. * length:2,
  61693. * 0:{property:"polygon-color",value:function(attribute,zoom){var _value=null;if(zoom){_value="#123456"}return _vlaue;}},
  61694. * 1:{property:"line-width",value:function(attribute,zoom){var _value=null;if(zoom){_value=3}return _vlaue;}}
  61695. * }
  61696. * ];
  61697. */
  61698. getShaders() {
  61699. return this.shaders;
  61700. }
  61701. /**
  61702. * @function CartoCSS.prototype.destroy
  61703. * @description CartoCSS解析对象的析构函数,用于销毁CartoCSS解析对象。
  61704. */
  61705. destroy() {
  61706. this.cartoStr = null;
  61707. this.env = null;
  61708. this.ruleSet = null;
  61709. this.parser = null;
  61710. this.shaders = null;
  61711. }
  61712. }
  61713. var _mapnik_reference_latest = {
  61714. "version": "2.1.1",
  61715. "style": {
  61716. "filter-mode": {
  61717. "type": [
  61718. "all",
  61719. "first"
  61720. ],
  61721. "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)",
  61722. "default-value": "all",
  61723. "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."
  61724. },
  61725. "image-filters": {
  61726. "css": "image-filters",
  61727. "default-value": "none",
  61728. "default-meaning": "no filters",
  61729. "type": "functions",
  61730. "functions": [
  61731. ["agg-stack-blur", 2],
  61732. ["emboss", 0],
  61733. ["blur", 0],
  61734. ["gray", 0],
  61735. ["sobel", 0],
  61736. ["edge-detect", 0],
  61737. ["x-gradient", 0],
  61738. ["y-gradient", 0],
  61739. ["invert", 0],
  61740. ["sharpen", 0]
  61741. ],
  61742. "doc": "A list of image filters."
  61743. },
  61744. "comp-op": {
  61745. "css": "comp-op",
  61746. "default-value": "src-over",
  61747. "default-meaning": "add the current layer on top of other layers",
  61748. "doc": "Composite operation. This defines how this layer should behave relative to layers atop or below it.",
  61749. "type": ["clear",
  61750. "src",
  61751. "dst",
  61752. "src-over",
  61753. "dst-over",
  61754. "src-in",
  61755. "dst-in",
  61756. "src-out",
  61757. "dst-out",
  61758. "src-atop",
  61759. "dst-atop",
  61760. "xor",
  61761. "plus",
  61762. "minus",
  61763. "multiply",
  61764. "screen",
  61765. "overlay",
  61766. "darken",
  61767. "lighten",
  61768. "color-dodge",
  61769. "color-burn",
  61770. "hard-light",
  61771. "soft-light",
  61772. "difference",
  61773. "exclusion",
  61774. "contrast",
  61775. "invert",
  61776. "invert-rgb",
  61777. "grain-merge",
  61778. "grain-extract",
  61779. "hue",
  61780. "saturation",
  61781. "color",
  61782. "value"
  61783. ]
  61784. },
  61785. "opacity": {
  61786. "css": "opacity",
  61787. "type": "float",
  61788. "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)",
  61789. "default-value": 1,
  61790. "default-meaning": "no separate buffer will be used and no alpha will be applied to the style after rendering"
  61791. }
  61792. },
  61793. "layer": {
  61794. "name": {
  61795. "default-value": "",
  61796. "type": "string",
  61797. "required": true,
  61798. "default-meaning": "No layer name has been provided",
  61799. "doc": "The name of a layer. Can be anything you wish and is not strictly validated, but ideally unique in the map"
  61800. },
  61801. "srs": {
  61802. "default-value": "",
  61803. "type": "string",
  61804. "default-meaning": "No srs value is provided and the value will be inherited from the Map's srs",
  61805. "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'"
  61806. },
  61807. "status": {
  61808. "default-value": true,
  61809. "type": "boolean",
  61810. "default-meaning": "This layer will be marked as active and available for processing",
  61811. "doc": "A property that can be set to false to disable this layer from being processed"
  61812. },
  61813. "minzoom": {
  61814. "default-value": "0",
  61815. "type": "float",
  61816. "default-meaning": "The layer will be visible at the minimum possible scale",
  61817. "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"
  61818. },
  61819. "maxzoom": {
  61820. "default-value": "1.79769e+308",
  61821. "type": "float",
  61822. "default-meaning": "The layer will be visible at the maximum possible scale",
  61823. "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"
  61824. },
  61825. "queryable": {
  61826. "default-value": false,
  61827. "type": "boolean",
  61828. "default-meaning": "The layer will not be available for the direct querying of data values",
  61829. "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"
  61830. },
  61831. "clear-label-cache": {
  61832. "default-value": false,
  61833. "type": "boolean",
  61834. "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",
  61835. "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"
  61836. },
  61837. "group-by": {
  61838. "default-value": "",
  61839. "type": "string",
  61840. "default-meaning": "No special layer grouping will be used during rendering",
  61841. "doc": "https://github.com/mapnik/mapnik/wiki/Grouped-rendering"
  61842. },
  61843. "buffer-size": {
  61844. "default-value": "0",
  61845. "type": "float",
  61846. "default-meaning": "No buffer will be used",
  61847. "doc": "Extra tolerance around the Layer extent (in pixels) used to when querying and (potentially) clipping the layer data during rendering"
  61848. },
  61849. "maximum-extent": {
  61850. "default-value": "none",
  61851. "type": "bbox",
  61852. "default-meaning": "No clipping extent will be used",
  61853. "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."
  61854. }
  61855. },
  61856. "symbolizers": {
  61857. "*": {
  61858. "image-filters": {
  61859. "css": "image-filters",
  61860. "default-value": "none",
  61861. "default-meaning": "no filters",
  61862. "type": "functions",
  61863. "functions": [
  61864. ["agg-stack-blur", 2],
  61865. ["emboss", 0],
  61866. ["blur", 0],
  61867. ["gray", 0],
  61868. ["sobel", 0],
  61869. ["edge-detect", 0],
  61870. ["x-gradient", 0],
  61871. ["y-gradient", 0],
  61872. ["invert", 0],
  61873. ["sharpen", 0]
  61874. ],
  61875. "doc": "A list of image filters."
  61876. },
  61877. "comp-op": {
  61878. "css": "comp-op",
  61879. "default-value": "src-over",
  61880. "default-meaning": "add the current layer on top of other layers",
  61881. "doc": "Composite operation. This defines how this layer should behave relative to layers atop or below it.",
  61882. "type": ["clear",
  61883. "src",
  61884. "dst",
  61885. "src-over",
  61886. "dst-over",
  61887. "src-in",
  61888. "dst-in",
  61889. "src-out",
  61890. "dst-out",
  61891. "src-atop",
  61892. "dst-atop",
  61893. "xor",
  61894. "plus",
  61895. "minus",
  61896. "multiply",
  61897. "screen",
  61898. "overlay",
  61899. "darken",
  61900. "lighten",
  61901. "color-dodge",
  61902. "color-burn",
  61903. "hard-light",
  61904. "soft-light",
  61905. "difference",
  61906. "exclusion",
  61907. "contrast",
  61908. "invert",
  61909. "invert-rgb",
  61910. "grain-merge",
  61911. "grain-extract",
  61912. "hue",
  61913. "saturation",
  61914. "color",
  61915. "value"
  61916. ]
  61917. },
  61918. "opacity": {
  61919. "css": "opacity",
  61920. "type": "float",
  61921. "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)",
  61922. "default-value": 1,
  61923. "default-meaning": "no separate buffer will be used and no alpha will be applied to the style after rendering"
  61924. }
  61925. },
  61926. "map": {
  61927. "background-color": {
  61928. "css": "background-color",
  61929. "default-value": "none",
  61930. "default-meaning": "transparent",
  61931. "type": "color",
  61932. "doc": "Map Background color"
  61933. },
  61934. "background-image": {
  61935. "css": "background-image",
  61936. "type": "uri",
  61937. "default-value": "",
  61938. "default-meaning": "transparent",
  61939. "doc": "An image that is repeated below all features on a map as a background.",
  61940. "description": "Map Background image"
  61941. },
  61942. "srs": {
  61943. "css": "srs",
  61944. "type": "string",
  61945. "default-value": "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs",
  61946. "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",
  61947. "doc": "Map spatial reference (proj4 string)"
  61948. },
  61949. "buffer-size": {
  61950. "css": "buffer-size",
  61951. "default-value": "0",
  61952. "type": "float",
  61953. "default-meaning": "No buffer will be used",
  61954. "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\"."
  61955. },
  61956. "maximum-extent": {
  61957. "css": "",
  61958. "default-value": "none",
  61959. "type": "bbox",
  61960. "default-meaning": "No clipping extent will be used",
  61961. "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."
  61962. },
  61963. "base": {
  61964. "css": "base",
  61965. "default-value": "",
  61966. "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.",
  61967. "type": "string",
  61968. "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."
  61969. },
  61970. "paths-from-xml": {
  61971. "css": "",
  61972. "default-value": true,
  61973. "default-meaning": "Paths read from XML will be interpreted from the location of the XML",
  61974. "type": "boolean",
  61975. "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()"
  61976. },
  61977. "minimum-version": {
  61978. "css": "",
  61979. "default-value": "none",
  61980. "default-meaning": "Mapnik version will not be detected and no error will be thrown about compatibility",
  61981. "type": "string",
  61982. "doc": "The minumum Mapnik version (e.g. 0.7.2) needed to use certain functionality in the stylesheet"
  61983. },
  61984. "font-directory": {
  61985. "css": "font-directory",
  61986. "type": "uri",
  61987. "default-value": "none",
  61988. "default-meaning": "No map-specific fonts will be registered",
  61989. "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)."
  61990. }
  61991. },
  61992. "polygon": {
  61993. "fill": {
  61994. "css": "polygon-fill",
  61995. "type": "color",
  61996. "default-value": "rgba(128,128,128,1)",
  61997. "default-meaning": "gray and fully opaque (alpha = 1), same as rgb(128,128,128)",
  61998. "doc": "Fill color to assign to a polygon"
  61999. },
  62000. "fill-opacity": {
  62001. "css": "polygon-opacity",
  62002. "type": "float",
  62003. "doc": "The opacity of the polygon",
  62004. "default-value": 1,
  62005. "default-meaning": "opaque"
  62006. },
  62007. "gamma": {
  62008. "css": "polygon-gamma",
  62009. "type": "float",
  62010. "default-value": 1,
  62011. "default-meaning": "fully antialiased",
  62012. "range": "0-1",
  62013. "doc": "Level of antialiasing of polygon edges"
  62014. },
  62015. "gamma-method": {
  62016. "css": "polygon-gamma-method",
  62017. "type": [
  62018. "power",
  62019. "linear",
  62020. "none",
  62021. "threshold",
  62022. "multiply"
  62023. ],
  62024. "default-value": "power",
  62025. "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",
  62026. "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"
  62027. },
  62028. "clip": {
  62029. "css": "polygon-clip",
  62030. "type": "boolean",
  62031. "default-value": true,
  62032. "default-meaning": "geometry will be clipped to map bounds before rendering",
  62033. "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."
  62034. },
  62035. "smooth": {
  62036. "css": "polygon-smooth",
  62037. "type": "float",
  62038. "default-value": 0,
  62039. "default-meaning": "no smoothing",
  62040. "range": "0-1",
  62041. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  62042. },
  62043. "geometry-transform": {
  62044. "css": "polygon-geometry-transform",
  62045. "type": "functions",
  62046. "default-value": "none",
  62047. "default-meaning": "geometry will not be transformed",
  62048. "doc": "Allows transformation functions to be applied to the geometry.",
  62049. "functions": [
  62050. ["matrix", 6],
  62051. ["translate", 2],
  62052. ["scale", 2],
  62053. ["rotate", 3],
  62054. ["skewX", 1],
  62055. ["skewY", 1]
  62056. ]
  62057. },
  62058. "comp-op": {
  62059. "css": "polygon-comp-op",
  62060. "default-value": "src-over",
  62061. "default-meaning": "add the current symbolizer on top of other symbolizer",
  62062. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  62063. "type": ["clear",
  62064. "src",
  62065. "dst",
  62066. "src-over",
  62067. "dst-over",
  62068. "src-in",
  62069. "dst-in",
  62070. "src-out",
  62071. "dst-out",
  62072. "src-atop",
  62073. "dst-atop",
  62074. "xor",
  62075. "plus",
  62076. "minus",
  62077. "multiply",
  62078. "screen",
  62079. "overlay",
  62080. "darken",
  62081. "lighten",
  62082. "color-dodge",
  62083. "color-burn",
  62084. "hard-light",
  62085. "soft-light",
  62086. "difference",
  62087. "exclusion",
  62088. "contrast",
  62089. "invert",
  62090. "invert-rgb",
  62091. "grain-merge",
  62092. "grain-extract",
  62093. "hue",
  62094. "saturation",
  62095. "color",
  62096. "value"
  62097. ]
  62098. }
  62099. },
  62100. "line": {
  62101. "stroke": {
  62102. "css": "line-color",
  62103. "default-value": "rgba(0,0,0,1)",
  62104. "type": "color",
  62105. "default-meaning": "black and fully opaque (alpha = 1), same as rgb(0,0,0)",
  62106. "doc": "The color of a drawn line"
  62107. },
  62108. "stroke-width": {
  62109. "css": "line-width",
  62110. "default-value": 1,
  62111. "type": "float",
  62112. "doc": "The width of a line in pixels"
  62113. },
  62114. "stroke-opacity": {
  62115. "css": "line-opacity",
  62116. "default-value": 1,
  62117. "type": "float",
  62118. "default-meaning": "opaque",
  62119. "doc": "The opacity of a line"
  62120. },
  62121. "stroke-linejoin": {
  62122. "css": "line-join",
  62123. "default-value": "miter",
  62124. "type": [
  62125. "miter",
  62126. "round",
  62127. "bevel"
  62128. ],
  62129. "doc": "The behavior of lines when joining"
  62130. },
  62131. "stroke-linecap": {
  62132. "css": "line-cap",
  62133. "default-value": "butt",
  62134. "type": [
  62135. "butt",
  62136. "round",
  62137. "square"
  62138. ],
  62139. "doc": "The display of line endings"
  62140. },
  62141. "stroke-gamma": {
  62142. "css": "line-gamma",
  62143. "type": "float",
  62144. "default-value": 1,
  62145. "default-meaning": "fully antialiased",
  62146. "range": "0-1",
  62147. "doc": "Level of antialiasing of stroke line"
  62148. },
  62149. "stroke-gamma-method": {
  62150. "css": "line-gamma-method",
  62151. "type": [
  62152. "power",
  62153. "linear",
  62154. "none",
  62155. "threshold",
  62156. "multiply"
  62157. ],
  62158. "default-value": "power",
  62159. "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",
  62160. "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"
  62161. },
  62162. "stroke-dasharray": {
  62163. "css": "line-dasharray",
  62164. "type": "numbers",
  62165. "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.",
  62166. "default-value": "none",
  62167. "default-meaning": "solid line"
  62168. },
  62169. "stroke-dashoffset": {
  62170. "css": "line-dash-offset",
  62171. "type": "numbers",
  62172. "doc": "valid parameter but not currently used in renderers (only exists for experimental svg support in Mapnik which is not yet enabled)",
  62173. "default-value": "none",
  62174. "default-meaning": "solid line"
  62175. },
  62176. "stroke-miterlimit": {
  62177. "css": "line-miterlimit",
  62178. "type": "float",
  62179. "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.",
  62180. "default-value": 4.0,
  62181. "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 )'"
  62182. },
  62183. "clip": {
  62184. "css": "line-clip",
  62185. "type": "boolean",
  62186. "default-value": true,
  62187. "default-meaning": "geometry will be clipped to map bounds before rendering",
  62188. "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."
  62189. },
  62190. "smooth": {
  62191. "css": "line-smooth",
  62192. "type": "float",
  62193. "default-value": 0,
  62194. "default-meaning": "no smoothing",
  62195. "range": "0-1",
  62196. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  62197. },
  62198. "offset": {
  62199. "css": "line-offset",
  62200. "type": "float",
  62201. "default-value": 0,
  62202. "default-meaning": "no offset",
  62203. "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)."
  62204. },
  62205. "rasterizer": {
  62206. "css": "line-rasterizer",
  62207. "type": [
  62208. "full",
  62209. "fast"
  62210. ],
  62211. "default-value": "full",
  62212. "doc": "Exposes an alternate AGG rendering method that sacrifices some accuracy for speed."
  62213. },
  62214. "geometry-transform": {
  62215. "css": "line-geometry-transform",
  62216. "type": "functions",
  62217. "default-value": "none",
  62218. "default-meaning": "geometry will not be transformed",
  62219. "doc": "Allows transformation functions to be applied to the geometry.",
  62220. "functions": [
  62221. ["matrix", 6],
  62222. ["translate", 2],
  62223. ["scale", 2],
  62224. ["rotate", 3],
  62225. ["skewX", 1],
  62226. ["skewY", 1]
  62227. ]
  62228. },
  62229. "comp-op": {
  62230. "css": "line-comp-op",
  62231. "default-value": "src-over",
  62232. "default-meaning": "add the current symbolizer on top of other symbolizer",
  62233. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  62234. "type": ["clear",
  62235. "src",
  62236. "dst",
  62237. "src-over",
  62238. "dst-over",
  62239. "src-in",
  62240. "dst-in",
  62241. "src-out",
  62242. "dst-out",
  62243. "src-atop",
  62244. "dst-atop",
  62245. "xor",
  62246. "plus",
  62247. "minus",
  62248. "multiply",
  62249. "screen",
  62250. "overlay",
  62251. "darken",
  62252. "lighten",
  62253. "color-dodge",
  62254. "color-burn",
  62255. "hard-light",
  62256. "soft-light",
  62257. "difference",
  62258. "exclusion",
  62259. "contrast",
  62260. "invert",
  62261. "invert-rgb",
  62262. "grain-merge",
  62263. "grain-extract",
  62264. "hue",
  62265. "saturation",
  62266. "color",
  62267. "value"
  62268. ]
  62269. }
  62270. },
  62271. "markers": {
  62272. "file": {
  62273. "css": "marker-file",
  62274. "doc": "An SVG file that this marker shows at each placement. If no file is given, the marker will show an ellipse.",
  62275. "default-value": "",
  62276. "default-meaning": "An ellipse or circle, if width equals height",
  62277. "type": "uri"
  62278. },
  62279. "opacity": {
  62280. "css": "marker-opacity",
  62281. "doc": "The overall opacity of the marker, if set, overrides both the opacity of both the fill and stroke",
  62282. "default-value": 1,
  62283. "default-meaning": "The stroke-opacity and fill-opacity will be used",
  62284. "type": "float"
  62285. },
  62286. "fill-opacity": {
  62287. "css": "marker-fill-opacity",
  62288. "doc": "The fill opacity of the marker",
  62289. "default-value": 1,
  62290. "default-meaning": "opaque",
  62291. "type": "float"
  62292. },
  62293. "stroke": {
  62294. "css": "marker-line-color",
  62295. "doc": "The color of the stroke around a marker shape.",
  62296. "default-value": "black",
  62297. "type": "color"
  62298. },
  62299. "stroke-width": {
  62300. "css": "marker-line-width",
  62301. "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.",
  62302. "type": "float"
  62303. },
  62304. "stroke-opacity": {
  62305. "css": "marker-line-opacity",
  62306. "default-value": 1,
  62307. "default-meaning": "opaque",
  62308. "doc": "The opacity of a line",
  62309. "type": "float"
  62310. },
  62311. "placement": {
  62312. "css": "marker-placement",
  62313. "type": [
  62314. "point",
  62315. "line",
  62316. "interior"
  62317. ],
  62318. "default-value": "point",
  62319. "default-meaning": "Place markers at the center point (centroid) of the geometry",
  62320. "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"
  62321. },
  62322. "multi-policy": {
  62323. "css": "marker-multi-policy",
  62324. "type": [
  62325. "each",
  62326. "whole",
  62327. "largest"
  62328. ],
  62329. "default-value": "each",
  62330. "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",
  62331. "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)."
  62332. },
  62333. "marker-type": {
  62334. "css": "marker-type",
  62335. "type": [
  62336. "arrow",
  62337. "ellipse"
  62338. ],
  62339. "default-value": "ellipse",
  62340. "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)"
  62341. },
  62342. "width": {
  62343. "css": "marker-width",
  62344. "default-value": 10,
  62345. "doc": "The width of the marker, if using one of the default types.",
  62346. "type": "expression"
  62347. },
  62348. "height": {
  62349. "css": "marker-height",
  62350. "default-value": 10,
  62351. "doc": "The height of the marker, if using one of the default types.",
  62352. "type": "expression"
  62353. },
  62354. "fill": {
  62355. "css": "marker-fill",
  62356. "default-value": "blue",
  62357. "doc": "The color of the area of the marker.",
  62358. "type": "color"
  62359. },
  62360. "allow-overlap": {
  62361. "css": "marker-allow-overlap",
  62362. "type": "boolean",
  62363. "default-value": false,
  62364. "doc": "Control whether overlapping markers are shown or hidden.",
  62365. "default-meaning": "Do not allow makers to overlap with each other - overlapping markers will not be shown."
  62366. },
  62367. "ignore-placement": {
  62368. "css": "marker-ignore-placement",
  62369. "type": "boolean",
  62370. "default-value": false,
  62371. "default-meaning": "do not store the bbox of this geometry in the collision detector cache",
  62372. "doc": "value to control whether the placement of the feature will prevent the placement of other features"
  62373. },
  62374. "spacing": {
  62375. "css": "marker-spacing",
  62376. "doc": "Space between repeated labels",
  62377. "default-value": 100,
  62378. "type": "float"
  62379. },
  62380. "max-error": {
  62381. "css": "marker-max-error",
  62382. "type": "float",
  62383. "default-value": 0.2,
  62384. "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."
  62385. },
  62386. "transform": {
  62387. "css": "marker-transform",
  62388. "type": "functions",
  62389. "functions": [
  62390. ["matrix", 6],
  62391. ["translate", 2],
  62392. ["scale", 2],
  62393. ["rotate", 3],
  62394. ["skewX", 1],
  62395. ["skewY", 1]
  62396. ],
  62397. "default-value": "",
  62398. "default-meaning": "No transformation",
  62399. "doc": "SVG transformation definition"
  62400. },
  62401. "clip": {
  62402. "css": "marker-clip",
  62403. "type": "boolean",
  62404. "default-value": true,
  62405. "default-meaning": "geometry will be clipped to map bounds before rendering",
  62406. "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."
  62407. },
  62408. "smooth": {
  62409. "css": "marker-smooth",
  62410. "type": "float",
  62411. "default-value": 0,
  62412. "default-meaning": "no smoothing",
  62413. "range": "0-1",
  62414. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  62415. },
  62416. "geometry-transform": {
  62417. "css": "marker-geometry-transform",
  62418. "type": "functions",
  62419. "default-value": "none",
  62420. "default-meaning": "geometry will not be transformed",
  62421. "doc": "Allows transformation functions to be applied to the geometry.",
  62422. "functions": [
  62423. ["matrix", 6],
  62424. ["translate", 2],
  62425. ["scale", 2],
  62426. ["rotate", 3],
  62427. ["skewX", 1],
  62428. ["skewY", 1]
  62429. ]
  62430. },
  62431. "comp-op": {
  62432. "css": "marker-comp-op",
  62433. "default-value": "src-over",
  62434. "default-meaning": "add the current symbolizer on top of other symbolizer",
  62435. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  62436. "type": ["clear",
  62437. "src",
  62438. "dst",
  62439. "src-over",
  62440. "dst-over",
  62441. "src-in",
  62442. "dst-in",
  62443. "src-out",
  62444. "dst-out",
  62445. "src-atop",
  62446. "dst-atop",
  62447. "xor",
  62448. "plus",
  62449. "minus",
  62450. "multiply",
  62451. "screen",
  62452. "overlay",
  62453. "darken",
  62454. "lighten",
  62455. "color-dodge",
  62456. "color-burn",
  62457. "hard-light",
  62458. "soft-light",
  62459. "difference",
  62460. "exclusion",
  62461. "contrast",
  62462. "invert",
  62463. "invert-rgb",
  62464. "grain-merge",
  62465. "grain-extract",
  62466. "hue",
  62467. "saturation",
  62468. "color",
  62469. "value"
  62470. ]
  62471. }
  62472. },
  62473. "shield": {
  62474. "name": {
  62475. "css": "shield-name",
  62476. "type": "expression",
  62477. "serialization": "content",
  62478. "doc": "Value to use for a shield\"s text label. Data columns are specified using brackets like [column_name]"
  62479. },
  62480. "file": {
  62481. "css": "shield-file",
  62482. "required": true,
  62483. "type": "uri",
  62484. "default-value": "none",
  62485. "doc": "Image file to render behind the shield text"
  62486. },
  62487. "face-name": {
  62488. "css": "shield-face-name",
  62489. "type": "string",
  62490. "validate": "font",
  62491. "doc": "Font name and style to use for the shield text",
  62492. "default-value": "",
  62493. "required": true
  62494. },
  62495. "unlock-image": {
  62496. "css": "shield-unlock-image",
  62497. "type": "boolean",
  62498. "doc": "This parameter should be set to true if you are trying to position text beside rather than on top of the shield image",
  62499. "default-value": false,
  62500. "default-meaning": "text alignment relative to the shield image uses the center of the image as the anchor for text positioning."
  62501. },
  62502. "size": {
  62503. "css": "shield-size",
  62504. "type": "float",
  62505. "doc": "The size of the shield text in pixels"
  62506. },
  62507. "fill": {
  62508. "css": "shield-fill",
  62509. "type": "color",
  62510. "doc": "The color of the shield text"
  62511. },
  62512. "placement": {
  62513. "css": "shield-placement",
  62514. "type": [
  62515. "point",
  62516. "line",
  62517. "vertex",
  62518. "interior"
  62519. ],
  62520. "default-value": "point",
  62521. "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."
  62522. },
  62523. "avoid-edges": {
  62524. "css": "shield-avoid-edges",
  62525. "doc": "Tell positioning algorithm to avoid labeling near intersection edges.",
  62526. "type": "boolean",
  62527. "default-value": false
  62528. },
  62529. "allow-overlap": {
  62530. "css": "shield-allow-overlap",
  62531. "type": "boolean",
  62532. "default-value": false,
  62533. "doc": "Control whether overlapping shields are shown or hidden.",
  62534. "default-meaning": "Do not allow shields to overlap with other map elements already placed."
  62535. },
  62536. "minimum-distance": {
  62537. "css": "shield-min-distance",
  62538. "type": "float",
  62539. "default-value": 0,
  62540. "doc": "Minimum distance to the next shield symbol, not necessarily the same shield."
  62541. },
  62542. "spacing": {
  62543. "css": "shield-spacing",
  62544. "type": "float",
  62545. "default-value": 0,
  62546. "doc": "The spacing between repeated occurrences of the same shield on a line"
  62547. },
  62548. "minimum-padding": {
  62549. "css": "shield-min-padding",
  62550. "default-value": 0,
  62551. "doc": "Determines the minimum amount of padding that a shield gets relative to other shields",
  62552. "type": "float"
  62553. },
  62554. "wrap-width": {
  62555. "css": "shield-wrap-width",
  62556. "type": "unsigned",
  62557. "default-value": 0,
  62558. "doc": "Length of a chunk of text in characters before wrapping text"
  62559. },
  62560. "wrap-before": {
  62561. "css": "shield-wrap-before",
  62562. "type": "boolean",
  62563. "default-value": false,
  62564. "doc": "Wrap text before wrap-width is reached. If false, wrapped lines will be a bit longer than wrap-width."
  62565. },
  62566. "wrap-character": {
  62567. "css": "shield-wrap-character",
  62568. "type": "string",
  62569. "default-value": " ",
  62570. "doc": "Use this character instead of a space to wrap long names."
  62571. },
  62572. "halo-fill": {
  62573. "css": "shield-halo-fill",
  62574. "type": "color",
  62575. "default-value": "#FFFFFF",
  62576. "default-meaning": "white",
  62577. "doc": "Specifies the color of the halo around the text."
  62578. },
  62579. "halo-radius": {
  62580. "css": "shield-halo-radius",
  62581. "doc": "Specify the radius of the halo in pixels",
  62582. "default-value": 0,
  62583. "default-meaning": "no halo",
  62584. "type": "float"
  62585. },
  62586. "character-spacing": {
  62587. "css": "shield-character-spacing",
  62588. "type": "unsigned",
  62589. "default-value": 0,
  62590. "doc": "Horizontal spacing between characters (in pixels). Currently works for point placement only, not line placement."
  62591. },
  62592. "line-spacing": {
  62593. "css": "shield-line-spacing",
  62594. "doc": "Vertical spacing between lines of multiline labels (in pixels)",
  62595. "type": "unsigned"
  62596. },
  62597. "dx": {
  62598. "css": "shield-text-dx",
  62599. "type": "float",
  62600. "doc": "Displace text within shield by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right",
  62601. "default-value": 0
  62602. },
  62603. "dy": {
  62604. "css": "shield-text-dy",
  62605. "type": "float",
  62606. "doc": "Displace text within shield by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down",
  62607. "default-value": 0
  62608. },
  62609. "shield-dx": {
  62610. "css": "shield-dx",
  62611. "type": "float",
  62612. "doc": "Displace shield by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right",
  62613. "default-value": 0
  62614. },
  62615. "shield-dy": {
  62616. "css": "shield-dy",
  62617. "type": "float",
  62618. "doc": "Displace shield by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down",
  62619. "default-value": 0
  62620. },
  62621. "opacity": {
  62622. "css": "shield-opacity",
  62623. "type": "float",
  62624. "doc": "(Default 1.0) - opacity of the image used for the shield",
  62625. "default-value": 1
  62626. },
  62627. "text-opacity": {
  62628. "css": "shield-text-opacity",
  62629. "type": "float",
  62630. "doc": "(Default 1.0) - opacity of the text placed on top of the shield",
  62631. "default-value": 1
  62632. },
  62633. "horizontal-alignment": {
  62634. "css": "shield-horizontal-alignment",
  62635. "type": [
  62636. "left",
  62637. "middle",
  62638. "right",
  62639. "auto"
  62640. ],
  62641. "doc": "The shield's horizontal alignment from its centerpoint",
  62642. "default-value": "auto"
  62643. },
  62644. "vertical-alignment": {
  62645. "css": "shield-vertical-alignment",
  62646. "type": [
  62647. "top",
  62648. "middle",
  62649. "bottom",
  62650. "auto"
  62651. ],
  62652. "doc": "The shield's vertical alignment from its centerpoint",
  62653. "default-value": "middle"
  62654. },
  62655. "text-transform": {
  62656. "css": "shield-text-transform",
  62657. "type": [
  62658. "none",
  62659. "uppercase",
  62660. "lowercase",
  62661. "capitalize"
  62662. ],
  62663. "doc": "Transform the case of the characters",
  62664. "default-value": "none"
  62665. },
  62666. "justify-alignment": {
  62667. "css": "shield-justify-alignment",
  62668. "type": [
  62669. "left",
  62670. "center",
  62671. "right",
  62672. "auto"
  62673. ],
  62674. "doc": "Define how text in a shield's label is justified",
  62675. "default-value": "auto"
  62676. },
  62677. "clip": {
  62678. "css": "shield-clip",
  62679. "type": "boolean",
  62680. "default-value": true,
  62681. "default-meaning": "geometry will be clipped to map bounds before rendering",
  62682. "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."
  62683. },
  62684. "comp-op": {
  62685. "css": "shield-comp-op",
  62686. "default-value": "src-over",
  62687. "default-meaning": "add the current symbolizer on top of other symbolizer",
  62688. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  62689. "type": ["clear",
  62690. "src",
  62691. "dst",
  62692. "src-over",
  62693. "dst-over",
  62694. "src-in",
  62695. "dst-in",
  62696. "src-out",
  62697. "dst-out",
  62698. "src-atop",
  62699. "dst-atop",
  62700. "xor",
  62701. "plus",
  62702. "minus",
  62703. "multiply",
  62704. "screen",
  62705. "overlay",
  62706. "darken",
  62707. "lighten",
  62708. "color-dodge",
  62709. "color-burn",
  62710. "hard-light",
  62711. "soft-light",
  62712. "difference",
  62713. "exclusion",
  62714. "contrast",
  62715. "invert",
  62716. "invert-rgb",
  62717. "grain-merge",
  62718. "grain-extract",
  62719. "hue",
  62720. "saturation",
  62721. "color",
  62722. "value"
  62723. ]
  62724. }
  62725. },
  62726. "line-pattern": {
  62727. "file": {
  62728. "css": "line-pattern-file",
  62729. "type": "uri",
  62730. "default-value": "none",
  62731. "required": true,
  62732. "doc": "An image file to be repeated and warped along a line"
  62733. },
  62734. "clip": {
  62735. "css": "line-pattern-clip",
  62736. "type": "boolean",
  62737. "default-value": true,
  62738. "default-meaning": "geometry will be clipped to map bounds before rendering",
  62739. "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."
  62740. },
  62741. "smooth": {
  62742. "css": "line-pattern-smooth",
  62743. "type": "float",
  62744. "default-value": 0,
  62745. "default-meaning": "no smoothing",
  62746. "range": "0-1",
  62747. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  62748. },
  62749. "geometry-transform": {
  62750. "css": "line-pattern-geometry-transform",
  62751. "type": "functions",
  62752. "default-value": "none",
  62753. "default-meaning": "geometry will not be transformed",
  62754. "doc": "Allows transformation functions to be applied to the geometry.",
  62755. "functions": [
  62756. ["matrix", 6],
  62757. ["translate", 2],
  62758. ["scale", 2],
  62759. ["rotate", 3],
  62760. ["skewX", 1],
  62761. ["skewY", 1]
  62762. ]
  62763. },
  62764. "comp-op": {
  62765. "css": "line-pattern-comp-op",
  62766. "default-value": "src-over",
  62767. "default-meaning": "add the current symbolizer on top of other symbolizer",
  62768. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  62769. "type": ["clear",
  62770. "src",
  62771. "dst",
  62772. "src-over",
  62773. "dst-over",
  62774. "src-in",
  62775. "dst-in",
  62776. "src-out",
  62777. "dst-out",
  62778. "src-atop",
  62779. "dst-atop",
  62780. "xor",
  62781. "plus",
  62782. "minus",
  62783. "multiply",
  62784. "screen",
  62785. "overlay",
  62786. "darken",
  62787. "lighten",
  62788. "color-dodge",
  62789. "color-burn",
  62790. "hard-light",
  62791. "soft-light",
  62792. "difference",
  62793. "exclusion",
  62794. "contrast",
  62795. "invert",
  62796. "invert-rgb",
  62797. "grain-merge",
  62798. "grain-extract",
  62799. "hue",
  62800. "saturation",
  62801. "color",
  62802. "value"
  62803. ]
  62804. }
  62805. },
  62806. "polygon-pattern": {
  62807. "file": {
  62808. "css": "polygon-pattern-file",
  62809. "type": "uri",
  62810. "default-value": "none",
  62811. "required": true,
  62812. "doc": "Image to use as a repeated pattern fill within a polygon"
  62813. },
  62814. "alignment": {
  62815. "css": "polygon-pattern-alignment",
  62816. "type": [
  62817. "local",
  62818. "global"
  62819. ],
  62820. "default-value": "local",
  62821. "doc": "Specify whether to align pattern fills to the layer or to the map."
  62822. },
  62823. "gamma": {
  62824. "css": "polygon-pattern-gamma",
  62825. "type": "float",
  62826. "default-value": 1,
  62827. "default-meaning": "fully antialiased",
  62828. "range": "0-1",
  62829. "doc": "Level of antialiasing of polygon pattern edges"
  62830. },
  62831. "opacity": {
  62832. "css": "polygon-pattern-opacity",
  62833. "type": "float",
  62834. "doc": "(Default 1.0) - Apply an opacity level to the image used for the pattern",
  62835. "default-value": 1,
  62836. "default-meaning": "The image is rendered without modifications"
  62837. },
  62838. "clip": {
  62839. "css": "polygon-pattern-clip",
  62840. "type": "boolean",
  62841. "default-value": true,
  62842. "default-meaning": "geometry will be clipped to map bounds before rendering",
  62843. "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."
  62844. },
  62845. "smooth": {
  62846. "css": "polygon-pattern-smooth",
  62847. "type": "float",
  62848. "default-value": 0,
  62849. "default-meaning": "no smoothing",
  62850. "range": "0-1",
  62851. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  62852. },
  62853. "geometry-transform": {
  62854. "css": "polygon-pattern-geometry-transform",
  62855. "type": "functions",
  62856. "default-value": "none",
  62857. "default-meaning": "geometry will not be transformed",
  62858. "doc": "Allows transformation functions to be applied to the geometry.",
  62859. "functions": [
  62860. ["matrix", 6],
  62861. ["translate", 2],
  62862. ["scale", 2],
  62863. ["rotate", 3],
  62864. ["skewX", 1],
  62865. ["skewY", 1]
  62866. ]
  62867. },
  62868. "comp-op": {
  62869. "css": "polygon-pattern-comp-op",
  62870. "default-value": "src-over",
  62871. "default-meaning": "add the current symbolizer on top of other symbolizer",
  62872. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  62873. "type": ["clear",
  62874. "src",
  62875. "dst",
  62876. "src-over",
  62877. "dst-over",
  62878. "src-in",
  62879. "dst-in",
  62880. "src-out",
  62881. "dst-out",
  62882. "src-atop",
  62883. "dst-atop",
  62884. "xor",
  62885. "plus",
  62886. "minus",
  62887. "multiply",
  62888. "screen",
  62889. "overlay",
  62890. "darken",
  62891. "lighten",
  62892. "color-dodge",
  62893. "color-burn",
  62894. "hard-light",
  62895. "soft-light",
  62896. "difference",
  62897. "exclusion",
  62898. "contrast",
  62899. "invert",
  62900. "invert-rgb",
  62901. "grain-merge",
  62902. "grain-extract",
  62903. "hue",
  62904. "saturation",
  62905. "color",
  62906. "value"
  62907. ]
  62908. }
  62909. },
  62910. "raster": {
  62911. "opacity": {
  62912. "css": "raster-opacity",
  62913. "default-value": 1,
  62914. "default-meaning": "opaque",
  62915. "type": "float",
  62916. "doc": "The opacity of the raster symbolizer on top of other symbolizers."
  62917. },
  62918. "filter-factor": {
  62919. "css": "raster-filter-factor",
  62920. "default-value": -1,
  62921. "default-meaning": "Allow the datasource to choose appropriate downscaling.",
  62922. "type": "float",
  62923. "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."
  62924. },
  62925. "scaling": {
  62926. "css": "raster-scaling",
  62927. "type": [
  62928. "near",
  62929. "fast",
  62930. "bilinear",
  62931. "bilinear8",
  62932. "bicubic",
  62933. "spline16",
  62934. "spline36",
  62935. "hanning",
  62936. "hamming",
  62937. "hermite",
  62938. "kaiser",
  62939. "quadric",
  62940. "catrom",
  62941. "gaussian",
  62942. "bessel",
  62943. "mitchell",
  62944. "sinc",
  62945. "lanczos",
  62946. "blackman"
  62947. ],
  62948. "default-value": "near",
  62949. "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."
  62950. },
  62951. "mesh-size": {
  62952. "css": "raster-mesh-size",
  62953. "default-value": 16,
  62954. "default-meaning": "Reprojection mesh will be 1/16 of the resolution of the source image",
  62955. "type": "unsigned",
  62956. "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."
  62957. },
  62958. "comp-op": {
  62959. "css": "raster-comp-op",
  62960. "default-value": "src-over",
  62961. "default-meaning": "add the current symbolizer on top of other symbolizer",
  62962. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  62963. "type": ["clear",
  62964. "src",
  62965. "dst",
  62966. "src-over",
  62967. "dst-over",
  62968. "src-in",
  62969. "dst-in",
  62970. "src-out",
  62971. "dst-out",
  62972. "src-atop",
  62973. "dst-atop",
  62974. "xor",
  62975. "plus",
  62976. "minus",
  62977. "multiply",
  62978. "screen",
  62979. "overlay",
  62980. "darken",
  62981. "lighten",
  62982. "color-dodge",
  62983. "color-burn",
  62984. "hard-light",
  62985. "soft-light",
  62986. "difference",
  62987. "exclusion",
  62988. "contrast",
  62989. "invert",
  62990. "invert-rgb",
  62991. "grain-merge",
  62992. "grain-extract",
  62993. "hue",
  62994. "saturation",
  62995. "color",
  62996. "value"
  62997. ]
  62998. }
  62999. },
  63000. "point": {
  63001. "file": {
  63002. "css": "point-file",
  63003. "type": "uri",
  63004. "required": false,
  63005. "default-value": "none",
  63006. "doc": "Image file to represent a point"
  63007. },
  63008. "allow-overlap": {
  63009. "css": "point-allow-overlap",
  63010. "type": "boolean",
  63011. "default-value": false,
  63012. "doc": "Control whether overlapping points are shown or hidden.",
  63013. "default-meaning": "Do not allow points to overlap with each other - overlapping markers will not be shown."
  63014. },
  63015. "ignore-placement": {
  63016. "css": "point-ignore-placement",
  63017. "type": "boolean",
  63018. "default-value": false,
  63019. "default-meaning": "do not store the bbox of this geometry in the collision detector cache",
  63020. "doc": "value to control whether the placement of the feature will prevent the placement of other features"
  63021. },
  63022. "opacity": {
  63023. "css": "point-opacity",
  63024. "type": "float",
  63025. "default-value": 1.0,
  63026. "default-meaning": "Fully opaque",
  63027. "doc": "A value from 0 to 1 to control the opacity of the point"
  63028. },
  63029. "placement": {
  63030. "css": "point-placement",
  63031. "type": [
  63032. "centroid",
  63033. "interior"
  63034. ],
  63035. "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.",
  63036. "default-value": "centroid"
  63037. },
  63038. "transform": {
  63039. "css": "point-transform",
  63040. "type": "functions",
  63041. "functions": [
  63042. ["matrix", 6],
  63043. ["translate", 2],
  63044. ["scale", 2],
  63045. ["rotate", 3],
  63046. ["skewX", 1],
  63047. ["skewY", 1]
  63048. ],
  63049. "default-value": "",
  63050. "default-meaning": "No transformation",
  63051. "doc": "SVG transformation definition"
  63052. },
  63053. "comp-op": {
  63054. "css": "point-comp-op",
  63055. "default-value": "src-over",
  63056. "default-meaning": "add the current symbolizer on top of other symbolizer",
  63057. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  63058. "type": ["clear",
  63059. "src",
  63060. "dst",
  63061. "src-over",
  63062. "dst-over",
  63063. "src-in",
  63064. "dst-in",
  63065. "src-out",
  63066. "dst-out",
  63067. "src-atop",
  63068. "dst-atop",
  63069. "xor",
  63070. "plus",
  63071. "minus",
  63072. "multiply",
  63073. "screen",
  63074. "overlay",
  63075. "darken",
  63076. "lighten",
  63077. "color-dodge",
  63078. "color-burn",
  63079. "hard-light",
  63080. "soft-light",
  63081. "difference",
  63082. "exclusion",
  63083. "contrast",
  63084. "invert",
  63085. "invert-rgb",
  63086. "grain-merge",
  63087. "grain-extract",
  63088. "hue",
  63089. "saturation",
  63090. "color",
  63091. "value"
  63092. ]
  63093. }
  63094. },
  63095. "text": {
  63096. "name": {
  63097. "css": "text-name",
  63098. "type": "expression",
  63099. "required": true,
  63100. "default-value": "",
  63101. "serialization": "content",
  63102. "doc": "Value to use for a text label. Data columns are specified using brackets like [column_name]"
  63103. },
  63104. "face-name": {
  63105. "css": "text-face-name",
  63106. "type": "string",
  63107. "validate": "font",
  63108. "doc": "Font name and style to render a label in",
  63109. "required": true
  63110. },
  63111. "size": {
  63112. "css": "text-size",
  63113. "type": "float",
  63114. "default-value": 10,
  63115. "doc": "Text size in pixels"
  63116. },
  63117. "text-ratio": {
  63118. "css": "text-ratio",
  63119. "doc": "Define the amount of text (of the total) present on successive lines when wrapping occurs",
  63120. "default-value": 0,
  63121. "type": "unsigned"
  63122. },
  63123. "wrap-width": {
  63124. "css": "text-wrap-width",
  63125. "doc": "Length of a chunk of text in characters before wrapping text",
  63126. "default-value": 0,
  63127. "type": "unsigned"
  63128. },
  63129. "wrap-before": {
  63130. "css": "text-wrap-before",
  63131. "type": "boolean",
  63132. "default-value": false,
  63133. "doc": "Wrap text before wrap-width is reached. If false, wrapped lines will be a bit longer than wrap-width."
  63134. },
  63135. "wrap-character": {
  63136. "css": "text-wrap-character",
  63137. "type": "string",
  63138. "default-value": " ",
  63139. "doc": "Use this character instead of a space to wrap long text."
  63140. },
  63141. "spacing": {
  63142. "css": "text-spacing",
  63143. "type": "unsigned",
  63144. "doc": "Distance between repeated text labels on a line (aka. label-spacing)"
  63145. },
  63146. "character-spacing": {
  63147. "css": "text-character-spacing",
  63148. "type": "float",
  63149. "default-value": 0,
  63150. "doc": "Horizontal spacing adjustment between characters in pixels"
  63151. },
  63152. "line-spacing": {
  63153. "css": "text-line-spacing",
  63154. "default-value": 0,
  63155. "type": "unsigned",
  63156. "doc": "Vertical spacing adjustment between lines in pixels"
  63157. },
  63158. "label-position-tolerance": {
  63159. "css": "text-label-position-tolerance",
  63160. "default-value": 0,
  63161. "type": "unsigned",
  63162. "doc": "Allows the label to be displaced from its ideal position by a number of pixels (only works with placement:line)"
  63163. },
  63164. "max-char-angle-delta": {
  63165. "css": "text-max-char-angle-delta",
  63166. "type": "float",
  63167. "default-value": "22.5",
  63168. "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."
  63169. },
  63170. "fill": {
  63171. "css": "text-fill",
  63172. "doc": "Specifies the color for the text",
  63173. "default-value": "#000000",
  63174. "type": "color"
  63175. },
  63176. "opacity": {
  63177. "css": "text-opacity",
  63178. "doc": "A number from 0 to 1 specifying the opacity for the text",
  63179. "default-value": 1.0,
  63180. "default-meaning": "Fully opaque",
  63181. "type": "float"
  63182. },
  63183. "halo-fill": {
  63184. "css": "text-halo-fill",
  63185. "type": "color",
  63186. "default-value": "#FFFFFF",
  63187. "default-meaning": "white",
  63188. "doc": "Specifies the color of the halo around the text."
  63189. },
  63190. "halo-radius": {
  63191. "css": "text-halo-radius",
  63192. "doc": "Specify the radius of the halo in pixels",
  63193. "default-value": 0,
  63194. "default-meaning": "no halo",
  63195. "type": "float"
  63196. },
  63197. "dx": {
  63198. "css": "text-dx",
  63199. "type": "float",
  63200. "doc": "Displace text by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right",
  63201. "default-value": 0
  63202. },
  63203. "dy": {
  63204. "css": "text-dy",
  63205. "type": "float",
  63206. "doc": "Displace text by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down",
  63207. "default-value": 0
  63208. },
  63209. "vertical-alignment": {
  63210. "css": "text-vertical-alignment",
  63211. "type": [
  63212. "top",
  63213. "middle",
  63214. "bottom",
  63215. "auto"
  63216. ],
  63217. "doc": "Position of label relative to point position.",
  63218. "default-value": "auto",
  63219. "default-meaning": "Default affected by value of dy; \"bottom\" for dy>0, \"top\" for dy<0."
  63220. },
  63221. "avoid-edges": {
  63222. "css": "text-avoid-edges",
  63223. "doc": "Tell positioning algorithm to avoid labeling near intersection edges.",
  63224. "default-value": false,
  63225. "type": "boolean"
  63226. },
  63227. "minimum-distance": {
  63228. "css": "text-min-distance",
  63229. "doc": "Minimum permitted distance to the next text symbolizer.",
  63230. "type": "float"
  63231. },
  63232. "minimum-padding": {
  63233. "css": "text-min-padding",
  63234. "doc": "Determines the minimum amount of padding that a text symbolizer gets relative to other text",
  63235. "type": "float"
  63236. },
  63237. "minimum-path-length": {
  63238. "css": "text-min-path-length",
  63239. "type": "float",
  63240. "default-value": 0,
  63241. "default-meaning": "place labels on all paths",
  63242. "doc": "Place labels only on paths longer than this value."
  63243. },
  63244. "allow-overlap": {
  63245. "css": "text-allow-overlap",
  63246. "type": "boolean",
  63247. "default-value": false,
  63248. "doc": "Control whether overlapping text is shown or hidden.",
  63249. "default-meaning": "Do not allow text to overlap with other text - overlapping markers will not be shown."
  63250. },
  63251. "orientation": {
  63252. "css": "text-orientation",
  63253. "type": "expression",
  63254. "doc": "Rotate the text."
  63255. },
  63256. "placement": {
  63257. "css": "text-placement",
  63258. "type": [
  63259. "point",
  63260. "line",
  63261. "vertex",
  63262. "interior"
  63263. ],
  63264. "default-value": "point",
  63265. "doc": "Control the style of placement of a point versus the geometry it is attached to."
  63266. },
  63267. "placement-type": {
  63268. "css": "text-placement-type",
  63269. "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.",
  63270. "type": [
  63271. "dummy",
  63272. "simple"
  63273. ],
  63274. "default-value": "dummy"
  63275. },
  63276. "placements": {
  63277. "css": "text-placements",
  63278. "type": "string",
  63279. "default-value": "",
  63280. "doc": "If \"placement-type\" is set to \"simple\", use this \"POSITIONS,[SIZES]\" string. An example is `text-placements: \"E,NE,SE,W,NW,SW\";` "
  63281. },
  63282. "text-transform": {
  63283. "css": "text-transform",
  63284. "type": [
  63285. "none",
  63286. "uppercase",
  63287. "lowercase",
  63288. "capitalize"
  63289. ],
  63290. "doc": "Transform the case of the characters",
  63291. "default-value": "none"
  63292. },
  63293. "horizontal-alignment": {
  63294. "css": "text-horizontal-alignment",
  63295. "type": [
  63296. "left",
  63297. "middle",
  63298. "right",
  63299. "auto"
  63300. ],
  63301. "doc": "The text's horizontal alignment from its centerpoint",
  63302. "default-value": "auto"
  63303. },
  63304. "justify-alignment": {
  63305. "css": "text-align",
  63306. "type": [
  63307. "left",
  63308. "right",
  63309. "center",
  63310. "auto"
  63311. ],
  63312. "doc": "Define how text is justified",
  63313. "default-value": "auto",
  63314. "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"
  63315. },
  63316. "clip": {
  63317. "css": "text-clip",
  63318. "type": "boolean",
  63319. "default-value": true,
  63320. "default-meaning": "geometry will be clipped to map bounds before rendering",
  63321. "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."
  63322. },
  63323. "comp-op": {
  63324. "css": "text-comp-op",
  63325. "default-value": "src-over",
  63326. "default-meaning": "add the current symbolizer on top of other symbolizer",
  63327. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  63328. "type": ["clear",
  63329. "src",
  63330. "dst",
  63331. "src-over",
  63332. "dst-over",
  63333. "src-in",
  63334. "dst-in",
  63335. "src-out",
  63336. "dst-out",
  63337. "src-atop",
  63338. "dst-atop",
  63339. "xor",
  63340. "plus",
  63341. "minus",
  63342. "multiply",
  63343. "screen",
  63344. "overlay",
  63345. "darken",
  63346. "lighten",
  63347. "color-dodge",
  63348. "color-burn",
  63349. "hard-light",
  63350. "soft-light",
  63351. "difference",
  63352. "exclusion",
  63353. "contrast",
  63354. "invert",
  63355. "invert-rgb",
  63356. "grain-merge",
  63357. "grain-extract",
  63358. "hue",
  63359. "saturation",
  63360. "color",
  63361. "value"
  63362. ]
  63363. }
  63364. },
  63365. "building": {
  63366. "fill": {
  63367. "css": "building-fill",
  63368. "default-value": "#FFFFFF",
  63369. "doc": "The color of the buildings walls.",
  63370. "type": "color"
  63371. },
  63372. "fill-opacity": {
  63373. "css": "building-fill-opacity",
  63374. "type": "float",
  63375. "doc": "The opacity of the building as a whole, including all walls.",
  63376. "default-value": 1
  63377. },
  63378. "height": {
  63379. "css": "building-height",
  63380. "doc": "The height of the building in pixels.",
  63381. "type": "expression",
  63382. "default-value": "0"
  63383. }
  63384. }
  63385. },
  63386. "colors": {
  63387. "aliceblue": [240, 248, 255],
  63388. "antiquewhite": [250, 235, 215],
  63389. "aqua": [0, 255, 255],
  63390. "aquamarine": [127, 255, 212],
  63391. "azure": [240, 255, 255],
  63392. "beige": [245, 245, 220],
  63393. "bisque": [255, 228, 196],
  63394. "black": [0, 0, 0],
  63395. "blanchedalmond": [255, 235, 205],
  63396. "blue": [0, 0, 255],
  63397. "blueviolet": [138, 43, 226],
  63398. "brown": [165, 42, 42],
  63399. "burlywood": [222, 184, 135],
  63400. "cadetblue": [95, 158, 160],
  63401. "chartreuse": [127, 255, 0],
  63402. "chocolate": [210, 105, 30],
  63403. "coral": [255, 127, 80],
  63404. "cornflowerblue": [100, 149, 237],
  63405. "cornsilk": [255, 248, 220],
  63406. "crimson": [220, 20, 60],
  63407. "cyan": [0, 255, 255],
  63408. "darkblue": [0, 0, 139],
  63409. "darkcyan": [0, 139, 139],
  63410. "darkgoldenrod": [184, 134, 11],
  63411. "darkgray": [169, 169, 169],
  63412. "darkgreen": [0, 100, 0],
  63413. "darkgrey": [169, 169, 169],
  63414. "darkkhaki": [189, 183, 107],
  63415. "darkmagenta": [139, 0, 139],
  63416. "darkolivegreen": [85, 107, 47],
  63417. "darkorange": [255, 140, 0],
  63418. "darkorchid": [153, 50, 204],
  63419. "darkred": [139, 0, 0],
  63420. "darksalmon": [233, 150, 122],
  63421. "darkseagreen": [143, 188, 143],
  63422. "darkslateblue": [72, 61, 139],
  63423. "darkslategrey": [47, 79, 79],
  63424. "darkturquoise": [0, 206, 209],
  63425. "darkviolet": [148, 0, 211],
  63426. "deeppink": [255, 20, 147],
  63427. "deepskyblue": [0, 191, 255],
  63428. "dimgray": [105, 105, 105],
  63429. "dimgrey": [105, 105, 105],
  63430. "dodgerblue": [30, 144, 255],
  63431. "firebrick": [178, 34, 34],
  63432. "floralwhite": [255, 250, 240],
  63433. "forestgreen": [34, 139, 34],
  63434. "fuchsia": [255, 0, 255],
  63435. "gainsboro": [220, 220, 220],
  63436. "ghostwhite": [248, 248, 255],
  63437. "gold": [255, 215, 0],
  63438. "goldenrod": [218, 165, 32],
  63439. "gray": [128, 128, 128],
  63440. "grey": [128, 128, 128],
  63441. "green": [0, 128, 0],
  63442. "greenyellow": [173, 255, 47],
  63443. "honeydew": [240, 255, 240],
  63444. "hotpink": [255, 105, 180],
  63445. "indianred": [205, 92, 92],
  63446. "indigo": [75, 0, 130],
  63447. "ivory": [255, 255, 240],
  63448. "khaki": [240, 230, 140],
  63449. "lavender": [230, 230, 250],
  63450. "lavenderblush": [255, 240, 245],
  63451. "lawngreen": [124, 252, 0],
  63452. "lemonchiffon": [255, 250, 205],
  63453. "lightblue": [173, 216, 230],
  63454. "lightcoral": [240, 128, 128],
  63455. "lightcyan": [224, 255, 255],
  63456. "lightgoldenrodyellow": [250, 250, 210],
  63457. "lightgray": [211, 211, 211],
  63458. "lightgreen": [144, 238, 144],
  63459. "lightgrey": [211, 211, 211],
  63460. "lightpink": [255, 182, 193],
  63461. "lightsalmon": [255, 160, 122],
  63462. "lightseagreen": [32, 178, 170],
  63463. "lightskyblue": [135, 206, 250],
  63464. "lightslategray": [119, 136, 153],
  63465. "lightslategrey": [119, 136, 153],
  63466. "lightsteelblue": [176, 196, 222],
  63467. "lightyellow": [255, 255, 224],
  63468. "lime": [0, 255, 0],
  63469. "limegreen": [50, 205, 50],
  63470. "linen": [250, 240, 230],
  63471. "magenta": [255, 0, 255],
  63472. "maroon": [128, 0, 0],
  63473. "mediumaquamarine": [102, 205, 170],
  63474. "mediumblue": [0, 0, 205],
  63475. "mediumorchid": [186, 85, 211],
  63476. "mediumpurple": [147, 112, 219],
  63477. "mediumseagreen": [60, 179, 113],
  63478. "mediumslateblue": [123, 104, 238],
  63479. "mediumspringgreen": [0, 250, 154],
  63480. "mediumturquoise": [72, 209, 204],
  63481. "mediumvioletred": [199, 21, 133],
  63482. "midnightblue": [25, 25, 112],
  63483. "mintcream": [245, 255, 250],
  63484. "mistyrose": [255, 228, 225],
  63485. "moccasin": [255, 228, 181],
  63486. "navajowhite": [255, 222, 173],
  63487. "navy": [0, 0, 128],
  63488. "oldlace": [253, 245, 230],
  63489. "olive": [128, 128, 0],
  63490. "olivedrab": [107, 142, 35],
  63491. "orange": [255, 165, 0],
  63492. "orangered": [255, 69, 0],
  63493. "orchid": [218, 112, 214],
  63494. "palegoldenrod": [238, 232, 170],
  63495. "palegreen": [152, 251, 152],
  63496. "paleturquoise": [175, 238, 238],
  63497. "palevioletred": [219, 112, 147],
  63498. "papayawhip": [255, 239, 213],
  63499. "peachpuff": [255, 218, 185],
  63500. "peru": [205, 133, 63],
  63501. "pink": [255, 192, 203],
  63502. "plum": [221, 160, 221],
  63503. "powderblue": [176, 224, 230],
  63504. "purple": [128, 0, 128],
  63505. "red": [255, 0, 0],
  63506. "rosybrown": [188, 143, 143],
  63507. "royalblue": [65, 105, 225],
  63508. "saddlebrown": [139, 69, 19],
  63509. "salmon": [250, 128, 114],
  63510. "sandybrown": [244, 164, 96],
  63511. "seagreen": [46, 139, 87],
  63512. "seashell": [255, 245, 238],
  63513. "sienna": [160, 82, 45],
  63514. "silver": [192, 192, 192],
  63515. "skyblue": [135, 206, 235],
  63516. "slateblue": [106, 90, 205],
  63517. "slategray": [112, 128, 144],
  63518. "slategrey": [112, 128, 144],
  63519. "snow": [255, 250, 250],
  63520. "springgreen": [0, 255, 127],
  63521. "steelblue": [70, 130, 180],
  63522. "tan": [210, 180, 140],
  63523. "teal": [0, 128, 128],
  63524. "thistle": [216, 191, 216],
  63525. "tomato": [255, 99, 71],
  63526. "turquoise": [64, 224, 208],
  63527. "violet": [238, 130, 238],
  63528. "wheat": [245, 222, 179],
  63529. "white": [255, 255, 255],
  63530. "whitesmoke": [245, 245, 245],
  63531. "yellow": [255, 255, 0],
  63532. "yellowgreen": [154, 205, 50],
  63533. "transparent": [0, 0, 0, 0]
  63534. },
  63535. "filter": {
  63536. "value": [
  63537. "true",
  63538. "false",
  63539. "null",
  63540. "point",
  63541. "linestring",
  63542. "polygon",
  63543. "collection"
  63544. ]
  63545. }
  63546. };
  63547. CartoCSS['mapnik_reference'] = {
  63548. version: {
  63549. latest: _mapnik_reference_latest,
  63550. '2.1.1': _mapnik_reference_latest
  63551. }
  63552. };
  63553. CartoCSS.Tree = {};
  63554. CartoCSS.Tree.operate = function(op, a, b) {
  63555. switch (op) {
  63556. case '+': return a + b;
  63557. case '-': return a - b;
  63558. case '*': return a * b;
  63559. case '%': return a % b;
  63560. case '/': return a / b;
  63561. }
  63562. };
  63563. CartoCSS.Tree.functions = {
  63564. rgb: function (r, g, b) {
  63565. return this.rgba(r, g, b, 1.0);
  63566. },
  63567. rgba: function (r, g, b, a) {
  63568. var me = this;
  63569. var rgb = [r, g, b].map(function (c) {
  63570. return me.number(c);
  63571. });
  63572. a = me.number(a);
  63573. if (rgb.some(isNaN) || isNaN(a)) {return null;}
  63574. return new CartoCSS.Tree.Color(rgb, a);
  63575. },
  63576. // Only require val
  63577. stop: function (val) {
  63578. var color, mode;
  63579. if (arguments.length > 1) {color = arguments[1];}
  63580. if (arguments.length > 2) {mode = arguments[2];}
  63581. return {
  63582. is: 'tag',
  63583. val: val,
  63584. color: color,
  63585. mode: mode,
  63586. toString(env) {
  63587. return '\n\t<stop value="' + val.ev(env) + '"' +
  63588. (color ? ' color="' + color.ev(env) + '" ' : '') +
  63589. (mode ? ' mode="' + mode.ev(env) + '" ' : '') +
  63590. '/>';
  63591. }
  63592. };
  63593. },
  63594. hsl: function (h, s, l) {
  63595. return this.hsla(h, s, l, 1.0);
  63596. },
  63597. hsla: function (h, s, l, a) {
  63598. h = (this.number(h) % 360) / 360;
  63599. s = this.number(s);
  63600. l = this.number(l);
  63601. a = this.number(a);
  63602. if ([h, s, l, a].some(isNaN)) {return null;}
  63603. var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s,
  63604. m1 = l * 2 - m2;
  63605. return this.rgba(hue(h + 1 / 3) * 255,
  63606. hue(h) * 255,
  63607. hue(h - 1 / 3) * 255,
  63608. a);
  63609. function hue(h) {
  63610. h = h < 0 ? h + 1 : (h > 1 ? h - 1 : h);
  63611. 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;}
  63612. }
  63613. },
  63614. hue: function (color) {
  63615. if (!('toHSL' in color)) {return null;}
  63616. return new CartoCSS.Tree.Dimension(Math.round(color.toHSL().h));
  63617. },
  63618. saturation: function (color) {
  63619. if (!('toHSL' in color)) {return null;}
  63620. return new CartoCSS.Tree.Dimension(Math.round(color.toHSL().s * 100), '%');
  63621. },
  63622. lightness: function (color) {
  63623. if (!('toHSL' in color)) {return null;}
  63624. return new CartoCSS.Tree.Dimension(Math.round(color.toHSL().l * 100), '%');
  63625. },
  63626. alpha: function (color) {
  63627. if (!('toHSL' in color)) {return null;}
  63628. return new CartoCSS.Tree.Dimension(color.toHSL().a);
  63629. },
  63630. saturate: function (color, amount) {
  63631. if (!('toHSL' in color)) {return null;}
  63632. var hsl = color.toHSL();
  63633. hsl.s += amount.value / 100;
  63634. hsl.s = this.clamp(hsl.s);
  63635. return this.hsla_simple(hsl);
  63636. },
  63637. desaturate: function (color, amount) {
  63638. if (!('toHSL' in color)) {return null;}
  63639. var hsl = color.toHSL();
  63640. hsl.s -= amount.value / 100;
  63641. hsl.s = this.clamp(hsl.s);
  63642. return this.hsla_simple(hsl);
  63643. },
  63644. lighten: function (color, amount) {
  63645. if (!('toHSL' in color)) {return null;}
  63646. var hsl = color.toHSL();
  63647. hsl.l += amount.value / 100;
  63648. hsl.l = this.clamp(hsl.l);
  63649. return this.hsla_simple(hsl);
  63650. },
  63651. darken: function (color, amount) {
  63652. if (!('toHSL' in color)) {return null;}
  63653. var hsl = color.toHSL();
  63654. hsl.l -= amount.value / 100;
  63655. hsl.l = this.clamp(hsl.l);
  63656. return this.hsla_simple(hsl);
  63657. },
  63658. fadein: function (color, amount) {
  63659. if (!('toHSL' in color)) {return null;}
  63660. var hsl = color.toHSL();
  63661. hsl.a += amount.value / 100;
  63662. hsl.a = this.clamp(hsl.a);
  63663. return this.hsla_simple(hsl);
  63664. },
  63665. fadeout: function (color, amount) {
  63666. if (!('toHSL' in color)) {return null;}
  63667. var hsl = color.toHSL();
  63668. hsl.a -= amount.value / 100;
  63669. hsl.a = this.clamp(hsl.a);
  63670. return this.hsla_simple(hsl);
  63671. },
  63672. spin: function (color, amount) {
  63673. if (!('toHSL' in color)) {return null;}
  63674. var hsl = color.toHSL();
  63675. var hue = (hsl.h + amount.value) % 360;
  63676. hsl.h = hue < 0 ? 360 + hue : hue;
  63677. return this.hsla_simple(hsl);
  63678. },
  63679. replace: function (entity, a, b) {
  63680. if (entity.is === 'field') {
  63681. return entity.toString + '.replace(' + a.toString() + ', ' + b.toString() + ')';
  63682. } else {
  63683. return entity.replace(a, b);
  63684. }
  63685. },
  63686. //
  63687. // Copyright (c) 2006-2009 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein
  63688. // http://sass-lang.com
  63689. //
  63690. mix: function (color1, color2, weight) {
  63691. var p = weight.value / 100.0;
  63692. var w = p * 2 - 1;
  63693. var a = color1.toHSL().a - color2.toHSL().a;
  63694. var w1 = (((w * a == -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0;
  63695. var w2 = 1 - w1;
  63696. var rgb = [color1.rgb[0] * w1 + color2.rgb[0] * w2,
  63697. color1.rgb[1] * w1 + color2.rgb[1] * w2,
  63698. color1.rgb[2] * w1 + color2.rgb[2] * w2];
  63699. var alpha = color1.alpha * p + color2.alpha * (1 - p);
  63700. return new CartoCSS.Tree.Color(rgb, alpha);
  63701. },
  63702. greyscale: function (color) {
  63703. return this.desaturate(color, new CartoCSS.Tree.Dimension(100));
  63704. },
  63705. '%': function (quoted /* arg, arg, ...*/) {
  63706. var args = Array.prototype.slice.call(arguments, 1),
  63707. str = quoted.value;
  63708. for (var i = 0; i < args.length; i++) {
  63709. str = str.replace(/%s/, args[i].value)
  63710. .replace(/%[da]/, args[i].toString());
  63711. }
  63712. str = str.replace(/%%/g, '%');
  63713. return new CartoCSS.Tree.Quoted(str);
  63714. },
  63715. hsla_simple: function (h) {
  63716. return this.hsla(h.h, h.s, h.l, h.a);
  63717. },
  63718. number: function (n) {
  63719. if (n instanceof CartoCSS.Tree.Dimension) {
  63720. return parseFloat(n.unit === '%' ? n.value / 100 : n.value);
  63721. } else if (typeof(n) === 'number') {
  63722. return n;
  63723. } else {
  63724. return NaN;
  63725. }
  63726. },
  63727. clamp: function (val) {
  63728. return Math.min(1, Math.max(0, val));
  63729. }
  63730. };
  63731. CartoCSS.Tree.Call = class Call {
  63732. constructor(name, args, index) {
  63733. this.is = 'call';
  63734. this.name = name;
  63735. this.args = args;
  63736. this.index = index;
  63737. }
  63738. // When evuating a function call,
  63739. // we either find the function in `tree.functions` [1],
  63740. // in which case we call it, passing the evaluated arguments,
  63741. // or we simply print it out as it appeared originally [2].
  63742. // The *functions.js* file contains the built-in functions.
  63743. // The reason why we evaluate the arguments, is in the case where
  63744. // we try to pass a variable to a function, like: `saturate(@color)`.
  63745. // The function should receive the value, not the variable.
  63746. 'ev'(env) {
  63747. var args = this.args.map(function (a) {
  63748. return a.ev(env);
  63749. });
  63750. for (var i = 0; i < args.length; i++) {
  63751. if (args[i].is === 'undefined') {
  63752. return {
  63753. is: 'undefined',
  63754. value: 'undefined'
  63755. };
  63756. }
  63757. }
  63758. if (this.name in CartoCSS.Tree.functions) {
  63759. if (CartoCSS.Tree.functions[this.name].length <= args.length) {
  63760. var val = CartoCSS.Tree.functions[this.name].apply(CartoCSS.Tree.functions, args);
  63761. if (val === null) {
  63762. env.error({
  63763. message: 'incorrect arguments given to ' + this.name + '()',
  63764. index: this.index,
  63765. type: 'runtime',
  63766. filename: this.filename
  63767. });
  63768. return {is: 'undefined', value: 'undefined'};
  63769. }
  63770. return val;
  63771. } else {
  63772. env.error({
  63773. message: 'incorrect number of arguments for ' + this.name +
  63774. '(). ' + CartoCSS.Tree.functions[this.name].length + ' expected.',
  63775. index: this.index,
  63776. type: 'runtime',
  63777. filename: this.filename
  63778. });
  63779. return {
  63780. is: 'undefined',
  63781. value: 'undefined'
  63782. };
  63783. }
  63784. } else {
  63785. var fn = CartoCSS.Tree.Reference.mapnikFunctions[this.name];
  63786. if (fn === undefined) {
  63787. var functions = lodash_topairs_default()(CartoCSS.Tree.Reference.mapnikFunctions);
  63788. // cheap closest, needs improvement.
  63789. var name = this.name;
  63790. var mean = functions.map(function (f) {
  63791. return [f[0], CartoCSS.Tree.Reference.editDistance(name, f[0]), f[1]];
  63792. }).sort(function (a, b) {
  63793. return a[1] - b[1];
  63794. });
  63795. env.error({
  63796. message: 'unknown function ' + this.name + '(), did you mean ' +
  63797. mean[0][0] + '(' + mean[0][2] + ')',
  63798. index: this.index,
  63799. type: 'runtime',
  63800. filename: this.filename
  63801. });
  63802. return {
  63803. is: 'undefined',
  63804. value: 'undefined'
  63805. };
  63806. }
  63807. if (fn !== args.length &&
  63808. // support variable-arg functions like `colorize-alpha`
  63809. fn !== -1) {
  63810. env.error({
  63811. message: 'function ' + this.name + '() takes ' +
  63812. fn + ' arguments and was given ' + args.length,
  63813. index: this.index,
  63814. type: 'runtime',
  63815. filename: this.filename
  63816. });
  63817. return {
  63818. is: 'undefined',
  63819. value: 'undefined'
  63820. };
  63821. } else {
  63822. // Save the evaluated versions of arguments
  63823. this.args = args;
  63824. return this;
  63825. }
  63826. }
  63827. }
  63828. toString(env, format) {
  63829. if (this.args.length) {
  63830. return this.name + '(' + this.args.join(',') + ')';
  63831. } else {
  63832. return this.name;
  63833. }
  63834. }
  63835. };
  63836. CartoCSS.Tree.Color = class Color {
  63837. constructor(rgb, a) {
  63838. this.is = 'color';
  63839. // The end goal here, is to parse the arguments
  63840. // into an integer triplet, such as `128, 255, 0`
  63841. //
  63842. // This facilitates operations and conversions.
  63843. if (Array.isArray(rgb)) {
  63844. this.rgb = rgb.slice(0, 3);
  63845. } else if (rgb.length == 6) {
  63846. this.rgb = rgb.match(/.{2}/g).map(function (c) {
  63847. return parseInt(c, 16);
  63848. });
  63849. } else {
  63850. this.rgb = rgb.split('').map(function (c) {
  63851. return parseInt(c + c, 16);
  63852. });
  63853. }
  63854. if (typeof(a) === 'number') {
  63855. this.alpha = a;
  63856. } else if (rgb.length === 4) {
  63857. this.alpha = rgb[3];
  63858. } else {
  63859. this.alpha = 1;
  63860. }
  63861. }
  63862. 'ev'() {
  63863. return this;
  63864. }
  63865. // If we have some transparency, the only way to represent it
  63866. // is via `rgba`. Otherwise, we use the hex representation,
  63867. // which has better compatibility with older browsers.
  63868. // Values are capped between `0` and `255`, rounded and zero-padded.
  63869. toString() {
  63870. /* if (this.alpha < 1.0) {*/
  63871. return 'rgba(' + this.rgb.map(function (c) {
  63872. return Math.round(c);
  63873. }).concat(this.alpha).join(', ') + ')';
  63874. /*} else {
  63875. return '#' + this.rgb.map(function(i) {
  63876. i = Math.round(i);
  63877. i = (i > 255 ? 255 : (i < 0 ? 0 : i)).toString(16);
  63878. return i.length === 1 ? '0' + i : i;
  63879. }).join('');
  63880. }*/
  63881. }
  63882. // Operations have to be done per-channel, if not,
  63883. // channels will spill onto each other. Once we have
  63884. // our result, in the form of an integer triplet,
  63885. // we create a new Color node to hold the result.
  63886. operate(env, op, other) {
  63887. var result = [];
  63888. if (!(other instanceof CartoCSS.Tree.Color)) {
  63889. other = other.toColor();
  63890. }
  63891. for (var c = 0; c < 3; c++) {
  63892. result[c] = CartoCSS.Tree.operate(op, this.rgb[c], other.rgb[c]);
  63893. }
  63894. return new CartoCSS.Tree.Color(result);
  63895. }
  63896. toHSL() {
  63897. var r = this.rgb[0] / 255,
  63898. g = this.rgb[1] / 255,
  63899. b = this.rgb[2] / 255,
  63900. a = this.alpha;
  63901. var max = Math.max(r, g, b), min = Math.min(r, g, b);
  63902. var h, s, l = (max + min) / 2, d = max - min;
  63903. if (max === min) {
  63904. h = s = 0;
  63905. } else {
  63906. s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
  63907. switch (max) {
  63908. case r:
  63909. h = (g - b) / d + (g < b ? 6 : 0);
  63910. break;
  63911. case g:
  63912. h = (b - r) / d + 2;
  63913. break;
  63914. case b:
  63915. h = (r - g) / d + 4;
  63916. break;
  63917. default:
  63918. break;
  63919. }
  63920. h /= 6;
  63921. }
  63922. return {h: h * 360, s: s, l: l, a: a};
  63923. }
  63924. };
  63925. CartoCSS.Tree.Comment = class Comment {
  63926. constructor(value, silent) {
  63927. this.value = value;
  63928. this.silent = !!silent;
  63929. }
  63930. toString(env) {
  63931. return '<!--' + this.value + '-->';
  63932. }
  63933. 'ev'() {
  63934. return this;
  63935. }
  63936. };
  63937. CartoCSS.Tree.Definition = class Definition {
  63938. constructor(selector, rules) {
  63939. this.elements = selector.elements;
  63940. //assert.ok(selector.filters instanceof CartoCSS.Tree.Filterset);
  63941. this.rules = rules;
  63942. this.ruleIndex = {};
  63943. for (var i = 0; i < this.rules.length; i++) {
  63944. if ('zoom' in this.rules[i]) {this.rules[i] = this.rules[i].clone();}
  63945. this.rules[i].zoom = selector.zoom;
  63946. this.ruleIndex[this.rules[i].updateID()] = true;
  63947. }
  63948. this.filters = selector.filters;
  63949. this.zoom = selector.zoom;
  63950. this.attachment = selector.attachment || '__default__';
  63951. this.specificity = selector.specificity();
  63952. }
  63953. toString() {
  63954. var str = this.filters.toString();
  63955. for (var i = 0; i < this.rules.length; i++) {
  63956. str += '\n ' + this.rules[i];
  63957. }
  63958. return str;
  63959. }
  63960. toJS(env) {
  63961. var shaderAttrs = {};
  63962. // merge conditions from filters with zoom condition of the
  63963. // definition
  63964. var zoom = this.zoom;
  63965. //var frame_offset = this.frame_offset;
  63966. var _if = this.filters.toJS(env);
  63967. var filters = [zoom];
  63968. if (_if) {filters.push(_if);}
  63969. //if(frame_offset) filters.push('ctx["frame-offset"] === ' + frame_offset);
  63970. _if = filters.join(" && ");
  63971. function eachRule(rule) {
  63972. if (rule instanceof CartoCSS.Tree.Rule) {
  63973. shaderAttrs[rule.name] = shaderAttrs[rule.name] || [];
  63974. if (_if) {
  63975. shaderAttrs[rule.name].push(
  63976. "if(" + _if + "){" + rule.value.toJS(env) + "}"
  63977. );
  63978. } else {
  63979. shaderAttrs[rule.name].push(rule.value.toJS(env));
  63980. }
  63981. } else {
  63982. if (rule instanceof CartoCSS.Tree.Ruleset) {
  63983. var sh = rule.toJS(env);
  63984. for (var v in sh) {
  63985. shaderAttrs[v] = shaderAttrs[v] || [];
  63986. for (var attr in sh[v]) {
  63987. shaderAttrs[v].push(sh[v][attr]);
  63988. }
  63989. }
  63990. }
  63991. }
  63992. }
  63993. for (var id in this.rules) {
  63994. eachRule(this.rules[id]);
  63995. }
  63996. return shaderAttrs;
  63997. }
  63998. };
  63999. CartoCSS.Tree.Dimension = class Dimension {
  64000. constructor(value, unit, index) {
  64001. this.is = 'float';
  64002. this.physical_units = ['m', 'cm', 'in', 'mm', 'pt', 'pc'];
  64003. this.screen_units = ['px', '%'];
  64004. this.all_units = ['m', 'cm', 'in', 'mm', 'pt', 'pc', 'px', '%'];
  64005. this.densities = {
  64006. m: 0.0254,
  64007. mm: 25.4,
  64008. cm: 2.54,
  64009. pt: 72,
  64010. pc: 6
  64011. };
  64012. this.value = parseFloat(value);
  64013. this.unit = unit || null;
  64014. this.index = index;
  64015. }
  64016. ev(env) {
  64017. if (this.unit && this.all_units.indexOf(this.unit)<0) {
  64018. env.error({
  64019. message: "Invalid unit: '" + this.unit + "'",
  64020. index: this.index
  64021. });
  64022. return {is: 'undefined', value: 'undefined'};
  64023. }
  64024. // normalize units which are not px or %
  64025. if (this.unit && this.physical_units.indexOf(this.unit)>=0) {
  64026. if (!env.ppi) {
  64027. env.error({
  64028. message: "ppi is not set, so metric units can't be used",
  64029. index: this.index
  64030. });
  64031. return {is: 'undefined', value: 'undefined'};
  64032. }
  64033. // convert all units to inch
  64034. // convert inch to px using ppi
  64035. this.value = (this.value / this.densities[this.unit]) * env.ppi;
  64036. this.unit = 'px';
  64037. }
  64038. return this;
  64039. }
  64040. toColor() {
  64041. return new CartoCSS.Tree.Color([this.value, this.value, this.value]);
  64042. }
  64043. round() {
  64044. this.value = Math.round(this.value);
  64045. return this;
  64046. }
  64047. toString() {
  64048. return this.value.toString();
  64049. }
  64050. operate(env, op, other) {
  64051. if (this.unit === '%' && other.unit !== '%') {
  64052. env.error({
  64053. message: 'If two operands differ, the first must not be %',
  64054. index: this.index
  64055. });
  64056. return {
  64057. is: 'undefined',
  64058. value: 'undefined'
  64059. };
  64060. }
  64061. if (this.unit !== '%' && other.unit === '%') {
  64062. if (op === '*' || op === '/' || op === '%') {
  64063. env.error({
  64064. message: 'Percent values can only be added or subtracted from other values',
  64065. index: this.index
  64066. });
  64067. return {
  64068. is: 'undefined',
  64069. value: 'undefined'
  64070. };
  64071. }
  64072. return new CartoCSS.Tree.Dimension(CartoCSS.Tree.operate(op,
  64073. this.value, this.value * other.value * 0.01),
  64074. this.unit);
  64075. }
  64076. //here the operands are either the same (% or undefined or px), or one is undefined and the other is px
  64077. return new CartoCSS.Tree.Dimension(CartoCSS.Tree.operate(op, this.value, other.value),
  64078. this.unit || other.unit);
  64079. }
  64080. };
  64081. CartoCSS.Tree.Element = class Element {
  64082. constructor(value) {
  64083. this.value = value.trim();
  64084. if (this.value[0] === '#') {
  64085. this.type = 'id';
  64086. this.clean = this.value.replace(/^#/, '');
  64087. }
  64088. if (this.value[0] === '.') {
  64089. this.type = 'class';
  64090. this.clean = this.value.replace(/^\./, '');
  64091. }
  64092. if (this.value.indexOf('*') !== -1) {
  64093. this.type = 'wildcard';
  64094. }
  64095. }
  64096. specificity() {
  64097. return [
  64098. (this.type === 'id') ? 1 : 0, // a
  64099. (this.type === 'class') ? 1 : 0 // b
  64100. ];
  64101. }
  64102. toString() {
  64103. return this.value;
  64104. }
  64105. };
  64106. CartoCSS.Tree.Expression = class Expression {
  64107. constructor(value) {
  64108. this.is = 'expression';
  64109. this.value = value;
  64110. }
  64111. ev(env) {
  64112. if (this.value.length > 1) {
  64113. return new CartoCSS.Tree.Expression(this.value.map(function (e) {
  64114. return e.ev(env);
  64115. }));
  64116. } else {
  64117. return this.value[0].ev(env);
  64118. }
  64119. }
  64120. toString(env) {
  64121. return this.value.map(function (e) {
  64122. return e.toString(env);
  64123. }).join(' ');
  64124. }
  64125. };
  64126. CartoCSS.Tree.Field = class Field {
  64127. constructor(content) {
  64128. this.is = 'field';
  64129. this.value = content || '';
  64130. }
  64131. toString() {
  64132. return '["' + this.value.toUpperCase() + '"]';
  64133. }
  64134. 'ev'() {
  64135. return this;
  64136. }
  64137. };
  64138. CartoCSS.Tree.Filter = class Filter {
  64139. constructor(key, op, val, index, filename) {
  64140. this.ops = {
  64141. '<': [' &lt; ', 'numeric'],
  64142. '>': [' &gt; ', 'numeric'],
  64143. '=': [' = ', 'both'],
  64144. '!=': [' != ', 'both'],
  64145. '<=': [' &lt;= ', 'numeric'],
  64146. '>=': [' &gt;= ', 'numeric'],
  64147. '=~': ['.match(', 'string', ')']
  64148. };
  64149. this.key = key;
  64150. this.op = op;
  64151. this.val = val;
  64152. this.index = index;
  64153. this.filename = filename;
  64154. this.id = this.key + this.op + this.val;
  64155. }
  64156. ev(env) {
  64157. this.key = this.key.ev(env);
  64158. this.val = this.val.ev(env);
  64159. return this;
  64160. }
  64161. toString() {
  64162. return '[' + this.id + ']';
  64163. }
  64164. };
  64165. CartoCSS.Tree.Filterset = class Filterset {
  64166. constructor() {
  64167. this.filters = {};
  64168. }
  64169. toJS(env) {
  64170. function eachFilter(filter) {
  64171. var op = filter.op;
  64172. if (op === "=") {
  64173. op = "==";
  64174. }
  64175. var val = filter.val;
  64176. if (filter._val !== undefined) {
  64177. val = filter._val.toString(true);
  64178. }
  64179. //对scale进行特殊处理,将值转换成数值
  64180. if (filter.key && filter.key.value === 'scale') {
  64181. val = +val;
  64182. } else if (typeof val === 'string' || typeof val === 'object') {
  64183. val = "'" + val + "'";
  64184. }
  64185. var attrs = "attributes";
  64186. return attrs + "&&" + attrs + filter.key + "&&" + attrs + filter.key + " " + op + val;
  64187. }
  64188. var results = [];
  64189. for (var id in this.filters) {
  64190. results.push(eachFilter(this.filters[id]));
  64191. }
  64192. return results.join(' && ');
  64193. }
  64194. toString() {
  64195. var arr = [];
  64196. for (var id in this.filters) {arr.push(this.filters[id].id);}
  64197. return arr.sort().join('\t');
  64198. }
  64199. ev(env) {
  64200. for (var i in this.filters) {
  64201. this.filters[i].ev(env);
  64202. }
  64203. return this;
  64204. }
  64205. clone() {
  64206. var clone = new CartoCSS.Tree.Filterset();
  64207. for (var id in this.filters) {
  64208. clone.filters[id] = this.filters[id];
  64209. }
  64210. return clone;
  64211. }
  64212. cloneWith(other) {
  64213. var additions = [];
  64214. for (var id in other.filters) {
  64215. var status = this.addable(other.filters[id]);
  64216. // status is true, false or null. if it's null we don't fail this
  64217. // clone nor do we add the filter.
  64218. if (status === false) {
  64219. return false;
  64220. }
  64221. if (status === true) {
  64222. // Adding the filter will override another value.
  64223. additions.push(other.filters[id]);
  64224. }
  64225. }
  64226. // Adding the other filters doesn't make this filterset invalid, but it
  64227. // doesn't add anything to it either.
  64228. if (!additions.length) {
  64229. return null;
  64230. }
  64231. // We can successfully add all filters. Now clone the filterset and add the
  64232. // new rules.
  64233. var clone = new CartoCSS.Tree.Filterset();
  64234. // We can add the rules that are already present without going through the
  64235. // add function as a Filterset is always in it's simplest canonical form.
  64236. for (id in this.filters) {
  64237. clone.filters[id] = this.filters[id];
  64238. }
  64239. // Only add new filters that actually change the filter.
  64240. while (id = additions.shift()) {
  64241. clone.add(id);
  64242. }
  64243. return clone;
  64244. }
  64245. addable(filter) {
  64246. var key = filter.key.toString(),
  64247. value = filter.val.toString();
  64248. if (value.match(/^[0-9]+(\.[0-9]*)?_match/)) {value = parseFloat(value);}
  64249. switch (filter.op) {
  64250. case '=':
  64251. // if there is already foo= and we're adding foo=
  64252. if (this.filters[key + '='] !== undefined) {
  64253. if (this.filters[key + '='].val.toString() != value) {
  64254. return false;
  64255. } else {
  64256. return null;
  64257. }
  64258. }
  64259. if (this.filters[key + '!=' + value] !== undefined) {return false;}
  64260. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return false;}
  64261. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return false;}
  64262. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return false;}
  64263. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return false;}
  64264. return true;
  64265. case '=~':
  64266. return true;
  64267. case '!=':
  64268. if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val === value) ? false : null;}
  64269. if (this.filters[key + '!=' + value] !== undefined) {return null;}
  64270. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return null;}
  64271. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return null;}
  64272. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return null;}
  64273. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return null;}
  64274. return true;
  64275. case '>':
  64276. if (key + '=' in this.filters) {
  64277. if (this.filters[key + '='].val <= value) {
  64278. return false;
  64279. } else {
  64280. return null;
  64281. }
  64282. }
  64283. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return false;}
  64284. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val <= value) {return false;}
  64285. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return null;}
  64286. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return null;}
  64287. return true;
  64288. case '>=':
  64289. if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val < value) ? false : null;}
  64290. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return false;}
  64291. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return false;}
  64292. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return null;}
  64293. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val >= value) {return null;}
  64294. return true;
  64295. case '<':
  64296. if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val >= value) ? false : null;}
  64297. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return false;}
  64298. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val >= value) {return false;}
  64299. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return null;}
  64300. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return null;}
  64301. return true;
  64302. case '<=':
  64303. if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val > value) ? false : null;}
  64304. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return false;}
  64305. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return false;}
  64306. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return null;}
  64307. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val <= value) {return null;}
  64308. return true;
  64309. default:
  64310. break;
  64311. }
  64312. }
  64313. conflict(filter) {
  64314. var key = filter.key.toString(),
  64315. value = filter.val.toString();
  64316. if (!isNaN(parseFloat(value))) {value = parseFloat(value);}
  64317. // if (a=b) && (a=c)
  64318. // if (a=b) && (a!=b)
  64319. // or (a!=b) && (a=b)
  64320. if ((filter.op === '=' && this.filters[key + '='] !== undefined &&
  64321. value != this.filters[key + '='].val.toString()) ||
  64322. (filter.op === '!=' && this.filters[key + '='] !== undefined &&
  64323. value == this.filters[key + '='].val.toString()) ||
  64324. (filter.op === '=' && this.filters[key + '!='] !== undefined &&
  64325. value === this.filters[key + '!='].val.toString())) {
  64326. return filter.toString() + ' added to ' + this.toString() + ' produces an invalid filter';
  64327. }
  64328. return false;
  64329. }
  64330. add(filter, env) {
  64331. var key = filter.key.toString(),
  64332. op = filter.op,
  64333. conflict = this.conflict(filter),
  64334. numval;
  64335. if (conflict) {return conflict;}
  64336. if (op === '=') {
  64337. for (var i in this.filters) {
  64338. if (this.filters[i].key === key) {delete this.filters[i];}
  64339. }
  64340. this.filters[key + '='] = filter;
  64341. } else if (op === '!=') {
  64342. this.filters[key + '!=' + filter.val] = filter;
  64343. } else if (op === '=~') {
  64344. this.filters[key + '=~' + filter.val] = filter;
  64345. } else if (op === '>') {
  64346. // If there are other filters that are also >
  64347. // but are less than this one, they don't matter, so
  64348. // remove them.
  64349. for (var j in this.filters) {
  64350. if (this.filters[j].key === key && this.filters[j].val <= filter.val) {
  64351. delete this.filters[j];
  64352. }
  64353. }
  64354. this.filters[key + '>'] = filter;
  64355. } else if (op === '>=') {
  64356. for (var k in this.filters) {
  64357. numval = (+this.filters[k].val.toString());
  64358. if (this.filters[k].key === key && numval < filter.val) {
  64359. delete this.filters[k];
  64360. }
  64361. }
  64362. if (this.filters[key + '!=' + filter.val] !== undefined) {
  64363. delete this.filters[key + '!=' + filter.val];
  64364. filter.op = '>';
  64365. this.filters[key + '>'] = filter;
  64366. } else {
  64367. this.filters[key + '>='] = filter;
  64368. }
  64369. } else if (op === '<') {
  64370. for (var l in this.filters) {
  64371. numval = (+this.filters[l].val.toString());
  64372. if (this.filters[l].key === key && numval >= filter.val) {
  64373. delete this.filters[l];
  64374. }
  64375. }
  64376. this.filters[key + '<'] = filter;
  64377. } else if (op === '<=') {
  64378. for (var m in this.filters) {
  64379. numval = (+this.filters[m].val.toString());
  64380. if (this.filters[m].key === key && numval > filter.val) {
  64381. delete this.filters[m];
  64382. }
  64383. }
  64384. if (this.filters[key + '!=' + filter.val] !== undefined) {
  64385. delete this.filters[key + '!=' + filter.val];
  64386. filter.op = '<';
  64387. this.filters[key + '<'] = filter;
  64388. } else {
  64389. this.filters[key + '<='] = filter;
  64390. }
  64391. }
  64392. }
  64393. };
  64394. CartoCSS.Tree.Fontset = class Fontset {
  64395. constructor(env, fonts) {
  64396. this.fonts = fonts;
  64397. this.name = 'fontset-' + env.effects.length;
  64398. }
  64399. };
  64400. CartoCSS.Tree.Invalid = class Invalid {
  64401. constructor(chunk, index, message) {
  64402. this.is = 'invalid';
  64403. this.chunk = chunk;
  64404. this.index = index;
  64405. this.type = 'syntax';
  64406. this.message = message || "Invalid code: " + this.chunk;
  64407. }
  64408. ev(env) {
  64409. env.error({
  64410. chunk: this.chunk,
  64411. index: this.index,
  64412. type: 'syntax',
  64413. message: this.message || "Invalid code: " + this.chunk
  64414. });
  64415. return {
  64416. is: 'undefined'
  64417. };
  64418. }
  64419. };
  64420. CartoCSS.Tree.Keyword = class Keyword {
  64421. ev() {
  64422. return this;
  64423. }
  64424. constructor(value) {
  64425. this.value = value;
  64426. var special = {
  64427. 'transparent': 'color',
  64428. 'true': 'boolean',
  64429. 'false': 'boolean'
  64430. };
  64431. this.is = special[value] ? special[value] : 'keyword';
  64432. }
  64433. toString() {
  64434. return this.value;
  64435. }
  64436. };
  64437. /*Layer:class Invalid ),*/
  64438. CartoCSS.Tree.Literal = class Literal {
  64439. constructor(content) {
  64440. this.value = content || '';
  64441. this.is = 'field';
  64442. }
  64443. toString() {
  64444. return this.value;
  64445. }
  64446. 'ev'() {
  64447. return this;
  64448. }
  64449. };
  64450. CartoCSS.Tree.Operation = class Operation {
  64451. constructor(op, operands, index) {
  64452. this.is = 'operation';
  64453. this.op = op.trim();
  64454. this.operands = operands;
  64455. this.index = index;
  64456. }
  64457. ev(env) {
  64458. var a = this.operands[0].ev(env),
  64459. b = this.operands[1].ev(env),
  64460. temp;
  64461. if (a.is === 'undefined' || b.is === 'undefined') {
  64462. return {
  64463. is: 'undefined',
  64464. value: 'undefined'
  64465. };
  64466. }
  64467. if (a instanceof CartoCSS.Tree.Dimension && b instanceof CartoCSS.Tree.Color) {
  64468. if (this.op === '*' || this.op === '+') {
  64469. temp = b;
  64470. b = a;
  64471. a = temp;
  64472. } else {
  64473. env.error({
  64474. name: "OperationError",
  64475. message: "Can't substract or divide a color from a number",
  64476. index: this.index
  64477. });
  64478. }
  64479. }
  64480. // Only concatenate plain strings, because this is easily
  64481. // pre-processed
  64482. if (a instanceof CartoCSS.Tree.Quoted && b instanceof CartoCSS.Tree.Quoted && this.op !== '+') {
  64483. env.error({
  64484. message: "Can't subtract, divide, or multiply strings.",
  64485. index: this.index,
  64486. type: 'runtime',
  64487. filename: this.filename
  64488. });
  64489. return {
  64490. is: 'undefined',
  64491. value: 'undefined'
  64492. };
  64493. }
  64494. // Fields, literals, dimensions, and quoted strings can be combined.
  64495. if (a instanceof CartoCSS.Tree.Field || b instanceof CartoCSS.Tree.Field ||
  64496. a instanceof CartoCSS.Tree.Literal || b instanceof CartoCSS.Tree.Literal) {
  64497. if (a.is === 'color' || b.is === 'color') {
  64498. env.error({
  64499. message: "Can't subtract, divide, or multiply colors in expressions.",
  64500. index: this.index,
  64501. type: 'runtime',
  64502. filename: this.filename
  64503. });
  64504. return {
  64505. is: 'undefined',
  64506. value: 'undefined'
  64507. };
  64508. } else {
  64509. return new CartoCSS.Tree.Literal(a.ev(env).toString(true) + this.op + b.ev(env).toString(true));
  64510. }
  64511. }
  64512. if (a.operate === undefined) {
  64513. env.error({
  64514. message: 'Cannot do math with type ' + a.is + '.',
  64515. index: this.index,
  64516. type: 'runtime',
  64517. filename: this.filename
  64518. });
  64519. return {
  64520. is: 'undefined',
  64521. value: 'undefined'
  64522. };
  64523. }
  64524. return a.operate(env, this.op, b);
  64525. }
  64526. };
  64527. CartoCSS.Tree.Quoted = class Quoted {
  64528. constructor(content) {
  64529. this.is = 'string';
  64530. this.value = content || '';
  64531. }
  64532. toString(quotes) {
  64533. var escapedValue = this.value
  64534. .replace(/&/g, '&amp;')
  64535. var xmlvalue = escapedValue
  64536. .replace(/\'/g, '\\\'')
  64537. .replace(/\"/g, '&quot;')
  64538. .replace(/</g, '&lt;')
  64539. .replace(/\>/g, '&gt;');
  64540. return (quotes === true) ? "'" + xmlvalue + "'" : escapedValue;
  64541. }
  64542. ev() {
  64543. return this;
  64544. }
  64545. operate(env, op, other) {
  64546. return new CartoCSS.Tree.Quoted(CartoCSS.Tree.operate(op, this.toString(), other.toString(this.contains_field)));
  64547. }
  64548. };
  64549. CartoCSS.Tree.Reference = {
  64550. _validateValue: {
  64551. 'font': function (env, value) {
  64552. if (env.validation_data && env.validation_data.fonts) {
  64553. return env.validation_data.fonts.indexOf(value) != -1;
  64554. } else {
  64555. return true;
  64556. }
  64557. }
  64558. },
  64559. setData: function (data) {
  64560. this.data = data;
  64561. this.selector_cache = generateSelectorCache(data);
  64562. this.mapnikFunctions = generateMapnikFunctions(data);
  64563. this.required_cache = generateRequiredProperties(data);
  64564. function generateSelectorCache(data) {
  64565. var index = {};
  64566. for (var i in data.symbolizers) {
  64567. for (var j in data.symbolizers[i]) {
  64568. if (data.symbolizers[i][j].hasOwnProperty('css')) {
  64569. index[data.symbolizers[i][j].css] = [data.symbolizers[i][j], i, j];
  64570. }
  64571. }
  64572. }
  64573. return index;
  64574. }
  64575. function generateMapnikFunctions(data) {
  64576. var functions = {};
  64577. for (var i in data.symbolizers) {
  64578. for (var j in data.symbolizers[i]) {
  64579. if (data.symbolizers[i][j].type === 'functions') {
  64580. for (var k = 0; k < data.symbolizers[i][j].functions.length; k++) {
  64581. var fn = data.symbolizers[i][j].functions[k];
  64582. functions[fn[0]] = fn[1];
  64583. }
  64584. }
  64585. }
  64586. }
  64587. return functions;
  64588. }
  64589. function generateRequiredProperties(data) {
  64590. var cache = {};
  64591. for (var symbolizer_name in data.symbolizers) {
  64592. cache[symbolizer_name] = [];
  64593. for (var j in data.symbolizers[symbolizer_name]) {
  64594. if (data.symbolizers[symbolizer_name][j].required) {
  64595. cache[symbolizer_name].push(data.symbolizers[symbolizer_name][j].css);
  64596. }
  64597. }
  64598. }
  64599. return cache;
  64600. }
  64601. },
  64602. setVersion: function (version) {
  64603. if (CartoCSS.mapnik_reference.version.hasOwnProperty(version)) {
  64604. this.setData(CartoCSS.mapnik_reference.version[version]);
  64605. return true;
  64606. }
  64607. return false;
  64608. },
  64609. selectorData: function (selector, i) {
  64610. if (this.selector_cache && this.selector_cache[selector]) {return this.selector_cache[selector][i];}
  64611. },
  64612. validSelector: function (selector) {
  64613. return !!this.selector_cache[selector];
  64614. },
  64615. selectorName: function (selector) {
  64616. return this.selectorData(selector, 2);
  64617. },
  64618. selector: function (selector) {
  64619. return this.selectorData(selector, 0);
  64620. },
  64621. symbolizer: function (selector) {
  64622. return this.selectorData(selector, 1);
  64623. },
  64624. requiredProperties: function (symbolizer_name, rules) {
  64625. var req = this.required_cache[symbolizer_name];
  64626. for (var i in req) {
  64627. if (!(req[i] in rules)) {
  64628. return 'Property ' + req[i] + ' required for defining ' +
  64629. symbolizer_name + ' styles.';
  64630. }
  64631. }
  64632. },
  64633. isFont: function (selector) {
  64634. return this.selector(selector).validate === 'font';
  64635. },
  64636. editDistance: function (a, b) {
  64637. if (a.length === 0) {return b.length;}
  64638. if (b.length === 0) {return a.length;}
  64639. var matrix = [];
  64640. for (var i = 0; i <= b.length; i++) {
  64641. matrix[i] = [i];
  64642. }
  64643. for (var j = 0; j <= a.length; j++) {
  64644. matrix[0][j] = j;
  64645. }
  64646. for (i = 1; i <= b.length; i++) {
  64647. for (j = 1; j <= a.length; j++) {
  64648. if (b.charAt(i - 1) === a.charAt(j - 1)) {
  64649. matrix[i][j] = matrix[i - 1][j - 1];
  64650. } else {
  64651. matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // substitution
  64652. Math.min(matrix[i][j - 1] + 1, // insertion
  64653. matrix[i - 1][j] + 1)); // deletion
  64654. }
  64655. }
  64656. }
  64657. return matrix[b.length][a.length];
  64658. },
  64659. validValue: function (env, selector, value) {
  64660. function validateFunctions(value, selector) {
  64661. if (value.value[0].is === 'string') {return true;}
  64662. for (var i in value.value) {
  64663. for (var j in value.value[i].value) {
  64664. if (value.value[i].value[j].is !== 'call') {return false;}
  64665. var f = find(this.selector(selector).functions, function (x) {//NOSONAR
  64666. return x[0] === value.value[i].value[j].name;
  64667. });
  64668. if (!(f && f[1] === -1)) {
  64669. // This filter is unknown or given an incorrect number of arguments
  64670. if (!f || f[1] !== value.value[i].value[j].args.length) {return false;}
  64671. }
  64672. }
  64673. }
  64674. return true;
  64675. }
  64676. function validateKeyword(value, selector) {
  64677. if (typeof this.selector(selector).type === 'object') {
  64678. return this.selector(selector).type
  64679. .indexOf(value.value[0].value) !== -1;
  64680. } else {
  64681. // allow unquoted keywords as strings
  64682. return this.selector(selector).type === 'string';
  64683. }
  64684. }
  64685. var i;
  64686. if (!this.selector(selector)) {
  64687. return false;
  64688. } else if (value.value[0].is === 'keyword') {
  64689. return validateKeyword(value, selector);
  64690. } else if (value.value[0].is === 'undefined') {
  64691. // caught earlier in the chain - ignore here so that
  64692. // error is not overridden
  64693. return true;
  64694. } else if (this.selector(selector).type === 'numbers') {
  64695. for (i in value.value) {
  64696. if (value.value[i].is !== 'float') {
  64697. return false;
  64698. }
  64699. }
  64700. return true;
  64701. } else if (this.selector(selector).type === 'tags') {
  64702. if (!value.value) {return false;}
  64703. if (!value.value[0].value) {
  64704. return value.value[0].is === 'tag';
  64705. }
  64706. for (i = 0; i < value.value[0].value.length; i++) {
  64707. if (value.value[0].value[i].is !== 'tag') {return false;}
  64708. }
  64709. return true;
  64710. } else if (this.selector(selector).type == 'functions') {
  64711. // For backwards compatibility, you can specify a string for `functions`-compatible
  64712. // values, though they will not be validated.
  64713. return validateFunctions(value, selector);
  64714. } else if (this.selector(selector).type === 'expression') {
  64715. return true;
  64716. } else if (this.selector(selector).type === 'unsigned') {
  64717. if (value.value[0].is === 'float') {
  64718. value.value[0].round();
  64719. return true;
  64720. } else {
  64721. return false;
  64722. }
  64723. } else {
  64724. if (this.selector(selector).validate) {
  64725. var valid = false;
  64726. for (i = 0; i < value.value.length; i++) {
  64727. if (this.selector(selector).type === value.value[i].is &&
  64728. this._validateValue[this.selector(selector).validate](env, value.value[i].value)) {
  64729. return true;
  64730. }
  64731. }
  64732. return valid;
  64733. } else {
  64734. return this.selector(selector).type === value.value[0].is;
  64735. }
  64736. }
  64737. }
  64738. };
  64739. CartoCSS.Tree.Reference.setVersion("latest");
  64740. CartoCSS.Tree.Rule = class Rule {
  64741. constructor(name, value, index, filename) {
  64742. this.is = 'rule';
  64743. var parts = name.split('/');
  64744. this.name = parts.pop();
  64745. this.instance = parts.length ? parts[0] : '__default__';
  64746. this.value = (value instanceof CartoCSS.Tree.Value) ?
  64747. value : new CartoCSS.Tree.Value([value]);
  64748. this.index = index;
  64749. this.symbolizer = CartoCSS.Tree.Reference.symbolizer(this.name);
  64750. this.filename = filename;
  64751. this.variable = (name.charAt(0) === '@');
  64752. }
  64753. clone() {
  64754. var clone = Object.create(CartoCSS.Tree.Rule.prototype);
  64755. clone.name = this.name;
  64756. clone.value = this.value;
  64757. clone.index = this.index;
  64758. clone.instance = this.instance;
  64759. clone.symbolizer = this.symbolizer;
  64760. clone.filename = this.filename;
  64761. clone.variable = this.variable;
  64762. return clone;
  64763. }
  64764. updateID() {
  64765. return this.id = this.zoom + '#' + this.instance + '#' + this.name;
  64766. }
  64767. toString() {
  64768. return '[' + CartoCSS.Tree.Zoom.toString(this.zoom) + '] ' + this.name + ': ' + this.value;
  64769. }
  64770. ev(context) {
  64771. return new CartoCSS.Tree.Rule(this.name,
  64772. this.value.ev(context),
  64773. this.index,
  64774. this.filename);
  64775. }
  64776. };
  64777. CartoCSS.Tree.Ruleset = class Ruleset {
  64778. constructor(selectors, rules) {
  64779. this.is = 'ruleset';
  64780. this.selectors = selectors;
  64781. this.rules = rules;
  64782. // static cache of find() function
  64783. this._lookups = {};
  64784. }
  64785. ev(env) {
  64786. var i,
  64787. rule,
  64788. ruleset = new CartoCSS.Tree.Ruleset(this.selectors, this.rules.slice(0));
  64789. ruleset.root = this.root;
  64790. // push the current ruleset to the frames stack
  64791. env.frames.unshift(ruleset);
  64792. // Evaluate everything else
  64793. for (i = 0, rule; i < ruleset.rules.length; i++) {
  64794. rule = ruleset.rules[i];
  64795. ruleset.rules[i] = rule.ev ? rule.ev(env) : rule;
  64796. }
  64797. // Pop the stack
  64798. env.frames.shift();
  64799. return ruleset;
  64800. }
  64801. match(args) {
  64802. return !args || args.length === 0;
  64803. }
  64804. variables() {
  64805. if (this._variables) {
  64806. return this._variables;
  64807. } else {
  64808. return this._variables = this.rules.reduce(function (hash, r) {
  64809. if (r instanceof CartoCSS.Tree.Rule && r.variable === true) {
  64810. hash[r.name] = r;
  64811. }
  64812. return hash;
  64813. }, {});
  64814. }
  64815. }
  64816. variable(name) {
  64817. return this.variables()[name];
  64818. }
  64819. rulesets() {
  64820. if (this._rulesets) {
  64821. return this._rulesets;
  64822. } else {
  64823. return this._rulesets = this.rules.filter(function (r) {
  64824. return (r instanceof CartoCSS.Tree.Ruleset);
  64825. });
  64826. }
  64827. }
  64828. find(selector, self) {
  64829. self = self || this;
  64830. var rules = [], match,
  64831. key = selector.toString();
  64832. if (key in this._lookups) {
  64833. return this._lookups[key];
  64834. }
  64835. this.rulesets().forEach(function (rule) {
  64836. if (rule !== self) {
  64837. for (var j = 0; j < rule.selectors.length; j++) {
  64838. match = selector.match(rule.selectors[j]);
  64839. if (match) {
  64840. if (selector.elements.length > 1) {
  64841. Array.prototype.push.apply(rules, rule.find(
  64842. new CartoCSS.Tree.Selector(null, null, selector.elements.slice(1)), self));
  64843. } else {
  64844. rules.push(rule);
  64845. }
  64846. break;
  64847. }
  64848. }
  64849. }
  64850. });
  64851. return this._lookups[key] = rules;
  64852. }
  64853. // Zooms can use variables. This replaces CartoCSS.Tree.Zoom objects on selectors
  64854. // with simple bit-arrays that we can compare easily.
  64855. evZooms(env) {
  64856. for (var i = 0; i < this.selectors.length; i++) {
  64857. var zval = CartoCSS.Tree.Zoom.all;
  64858. for (var z = 0; z < this.selectors[i].zoom.length; z++) {
  64859. zval = this.selectors[i].zoom[z].ev(env).zoom;
  64860. }
  64861. this.selectors[i].zoom = zval;
  64862. }
  64863. }
  64864. flatten(result, parents, env) {
  64865. var selectors = [], i, j;
  64866. if (this.selectors.length === 0) {
  64867. env.frames = env.frames.concat(this.rules);
  64868. }
  64869. // evaluate zoom variables on this object.
  64870. this.evZooms(env);
  64871. for (i = 0; i < this.selectors.length; i++) {
  64872. var child = this.selectors[i];
  64873. if (!child.filters) {
  64874. // This is an invalid filterset.
  64875. continue;
  64876. }
  64877. if (parents.length) {
  64878. for (j = 0; j < parents.length; j++) {
  64879. var parent = parents[j];
  64880. var mergedFilters = parent.filters.cloneWith(child.filters);
  64881. if (mergedFilters === null) {
  64882. // Filters could be added, but they didn't change the
  64883. // filters. This means that we only have to clone when
  64884. // the zoom levels or the attachment is different too.
  64885. if (parent.zoom === child.zoom &&
  64886. parent.attachment === child.attachment &&
  64887. parent.elements.join() === child.elements.join()) {
  64888. selectors.push(parent);
  64889. continue;
  64890. } else {
  64891. mergedFilters = parent.filters;
  64892. }
  64893. } else if (!mergedFilters) {
  64894. // The merged filters are invalid, that means we don't
  64895. // have to clone.
  64896. continue;
  64897. }
  64898. var clone = Object.create(CartoCSS.Tree.Selector.prototype);
  64899. clone.filters = mergedFilters;
  64900. clone.zoom = child.zoom;
  64901. clone.elements = parent.elements.concat(child.elements);
  64902. if (parent.attachment && child.attachment) {
  64903. clone.attachment = parent.attachment + '/' + child.attachment;
  64904. } else {clone.attachment = child.attachment || parent.attachment;}
  64905. clone.conditions = parent.conditions + child.conditions;
  64906. clone.index = child.index;
  64907. selectors.push(clone);
  64908. }
  64909. } else {
  64910. selectors.push(child);
  64911. }
  64912. }
  64913. var rules = [];
  64914. for (i = 0; i < this.rules.length; i++) {
  64915. var rule = this.rules[i];
  64916. // Recursively flatten any nested rulesets
  64917. if (rule instanceof CartoCSS.Tree.Ruleset) {
  64918. rule.flatten(result, selectors, env);
  64919. } else if (rule instanceof CartoCSS.Tree.Rule) {
  64920. rules.push(rule);
  64921. } else if (rule instanceof CartoCSS.Tree.Invalid) {
  64922. env.error(rule);
  64923. }
  64924. }
  64925. var index = rules.length ? rules[0].index : false;
  64926. for (i = 0; i < selectors.length; i++) {
  64927. // For specificity sort, use the position of the first rule to allow
  64928. // defining attachments that are under current element as a descendant
  64929. // selector.
  64930. if (index !== false) {
  64931. selectors[i].index = index;
  64932. }
  64933. result.push(new CartoCSS.Tree.Definition(selectors[i], rules.slice()));
  64934. }
  64935. return result;
  64936. }
  64937. };
  64938. CartoCSS.Tree.Selector = class Selector {
  64939. constructor(filters, zoom, elements, attachment, conditions, index) {
  64940. this.elements = elements || [];
  64941. this.attachment = attachment;
  64942. this.filters = filters || {};
  64943. this.zoom = typeof zoom !== 'undefined' ? zoom : CartoCSS.Tree.Zoom.all;
  64944. this.conditions = conditions;
  64945. this.index = index;
  64946. }
  64947. specificity() {
  64948. return this.elements.reduce(function (memo, e) {
  64949. var spec = e.specificity();
  64950. memo[0] += spec[0];
  64951. memo[1] += spec[1];
  64952. return memo;
  64953. }, [0, 0, this.conditions, this.index]);
  64954. }
  64955. };
  64956. /*style:class Invalid ),*/
  64957. CartoCSS.Tree.URL = class URL {
  64958. constructor(val, paths) {
  64959. this.is = 'uri';
  64960. this.value = val;
  64961. this.paths = paths;
  64962. }
  64963. toString() {
  64964. return this.value.toString();
  64965. }
  64966. ev(ctx) {
  64967. return new CartoCSS.Tree.URL(this.value.ev(ctx), this.paths);
  64968. }
  64969. };
  64970. CartoCSS.Tree.Value = class Value {
  64971. constructor(value) {
  64972. this.is = 'value';
  64973. this.value = value;
  64974. }
  64975. ev(env) {
  64976. if (this.value.length === 1) {
  64977. return this.value[0].ev(env);
  64978. } else {
  64979. return new CartoCSS.Tree.Value(this.value.map(function (v) {
  64980. return v.ev(env);
  64981. }));
  64982. }
  64983. }
  64984. toJS(env) {
  64985. //var v = this.value[0].value[0];
  64986. var val = this.ev(env);
  64987. var v = val.toString();
  64988. if (val.is === "color" || val.is === 'uri' || val.is === 'string' || val.is === 'keyword') {
  64989. v = "'" + v + "'";
  64990. } else if (val.is === 'field') {
  64991. // replace [varuable] by ctx['variable']
  64992. v = v.replace(/\[(.*)\]/g, "attributes['\_match1']")
  64993. } else if (val.value && typeof val.value === "object") {
  64994. v = "[" + v + "]";
  64995. }
  64996. return "_value = " + v + ";";
  64997. }
  64998. toString(env, selector, sep, format) {
  64999. return this.value.map(function (e) {
  65000. return e.toString(env, format);
  65001. }).join(sep || ', ');
  65002. }
  65003. clone() {
  65004. var obj = Object.create(CartoCSS.Tree.Value.prototype);
  65005. if (Array.isArray(obj)) {obj.value = this.value.slice();} else {obj.value = this.value;}
  65006. obj.is = this.is;
  65007. return obj;
  65008. }
  65009. };
  65010. CartoCSS.Tree.Variable = class Variable {
  65011. constructor(name, index, filename) {
  65012. this.is = 'variable';
  65013. this.name = name;
  65014. this.index = index;
  65015. this.filename = filename;
  65016. }
  65017. toString() {
  65018. return this.name;
  65019. }
  65020. ev(env) {
  65021. if (this._css) {return this._css;}
  65022. var thisframe = env.frames.filter(function (f) {
  65023. return f.name === this.name;
  65024. }.bind(this));
  65025. if (thisframe.length) {
  65026. return thisframe[0].value.ev(env);
  65027. } else {
  65028. env.error({
  65029. message: 'variable ' + this.name + ' is undefined',
  65030. index: this.index,
  65031. type: 'runtime',
  65032. filename: this.filename
  65033. });
  65034. return {
  65035. is: 'undefined',
  65036. value: 'undefined'
  65037. };
  65038. }
  65039. }
  65040. };
  65041. CartoCSS.Tree.Zoom = class Zoom {
  65042. constructor(op, value, index) {
  65043. this.op = op;
  65044. this.value = value;
  65045. this.index = index;
  65046. }
  65047. setZoom(zoom) {
  65048. this.zoom = zoom;
  65049. return this;
  65050. }
  65051. ev(env) {
  65052. var value = parseInt(this.value.ev(env).toString(), 10);
  65053. if (value > CartoCSS.Tree.Zoom.maxZoom || value < 0) {
  65054. env.error({
  65055. message: 'Only zoom levels between 0 and ' +
  65056. CartoCSS.Tree.Zoom.maxZoom + ' supported.',
  65057. index: this.index
  65058. });
  65059. }
  65060. switch (this.op) {
  65061. case '=':
  65062. this.zoom = "zoom && zoom === " + value;
  65063. return this;
  65064. case '>':
  65065. this.zoom = "zoom && zoom > " + value;
  65066. break;
  65067. case '>=':
  65068. this.zoom = "zoom && zoom >= " + value;
  65069. break;
  65070. case '<':
  65071. this.zoom = "zoom && zoom < " + value;
  65072. break;
  65073. case '<=':
  65074. this.zoom = "zoom && zoom <= " + value;
  65075. break;
  65076. default:
  65077. break;
  65078. }
  65079. /*
  65080. for (var i = 0; i <= CartoCSS.Tree.Zoom.maxZoom; i++) {
  65081. if (i >= start && i <= end) {
  65082. zoom |= (1 << i);
  65083. }
  65084. }
  65085. this.zoom = zoom;
  65086. this.zoom=value+this.op+"zoom";*/
  65087. return this;
  65088. }
  65089. toString() {
  65090. var str = '';
  65091. for (var i = 0; i <= CartoCSS.Tree.Zoom.maxZoom; i++) {
  65092. str += (this.zoom & (1 << i)) ? 'X' : '.';
  65093. }
  65094. return str;
  65095. }
  65096. };
  65097. // Covers all zoomlevels from 0 to 22
  65098. CartoCSS.Tree.Zoom.all = 23;
  65099. CartoCSS.Tree.Zoom.maxZoom = 22;
  65100. CartoCSS.Tree.Zoom.ranges = {
  65101. 0: 1000000000,
  65102. 1: 500000000,
  65103. 2: 200000000,
  65104. 3: 100000000,
  65105. 4: 50000000,
  65106. 5: 25000000,
  65107. 6: 12500000,
  65108. 7: 6500000,
  65109. 8: 3000000,
  65110. 9: 1500000,
  65111. 10: 750000,
  65112. 11: 400000,
  65113. 12: 200000,
  65114. 13: 100000,
  65115. 14: 50000,
  65116. 15: 25000,
  65117. 16: 12500,
  65118. 17: 5000,
  65119. 18: 2500,
  65120. 19: 1500,
  65121. 20: 750,
  65122. 21: 500,
  65123. 22: 250,
  65124. 23: 100
  65125. };
  65126. ;// CONCATENATED MODULE: ./src/common/style/ThemeStyle.js
  65127. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  65128. * This program are made available under the terms of the Apache License, Version 2.0
  65129. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  65130. /**
  65131. * @class ThemeStyle
  65132. * @deprecatedclass SuperMap.ThemeStyle
  65133. * @classdesc 客户端专题图风格类。
  65134. * @modulecategory Overlay
  65135. * @category Visualization Theme
  65136. * @param {Object} options - 可选参数。
  65137. * @param {boolean} [options.fill=true] - 是否填充,不需要填充则设置为 false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
  65138. * @param {string} [options.fillColor='#000000'] - 十六进制填充颜色。
  65139. * @param {number} [options.fillOpacity=1] - 填充不透明度。取值范围[0, 1]。
  65140. * @param {boolean} [options.stroke=false] - 是否描边,不需要描边则设置为false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
  65141. * @param {string} [options.strokeColor='#000000'] - 十六进制描边颜色。
  65142. * @param {number} [options.strokeOpacity=1] - 描边的不透明度。取值范围[0, 1]。
  65143. * @param {number} [options.strokeWidth=1] - 线宽度/描边宽度。
  65144. * @param {string} [options.strokeLinecap='butt'] - 线帽样式。strokeLinecap 有三种类型 “butt", "round", "square"。
  65145. * @param {string} [options.strokeLineJoin='iter'] - 线段连接样式。strokeLineJoin 有三种类型 “miter", "round", "bevel"。
  65146. * @param {string} [options.strokeDashstyle='solid'] - 虚线类型。strokeDashstyle 有八种类型 “dot",“dash",“dashdot",“longdash",“longdashdot",“solid", "dashed", "dotted"。solid 表示实线。
  65147. * @param {number} [options.pointRadius=6] - 点半径,单位为像素。
  65148. * @param {number} [options.shadowBlur=0] - 阴影模糊度,(大于 0 有效)。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
  65149. * @param {string} [options.shadowColor='#000000'] - 阴影颜色。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
  65150. * @param {number} [options.shadowOffsetX=0] - 阴影 X 方向偏移值。
  65151. * @param {number} [options.shadowOffsetY=0] - 阴影 Y 方向偏移值。
  65152. * @param {string} options.label - 专题要素附加文本标签内容。
  65153. * @param {string} [options.fontColor] - 附加文本字体颜色。
  65154. * @param {number} [options.fontSize=12] - 附加文本字体大小,单位是像素。
  65155. * @param {string} [options.fontStyle='normal'] - 附加文本字体样式。可设值:"normal", "italic", "oblique"。
  65156. * @param {string} [options.fontVariant='normal'] - 附加文本字体变体。可设值:"normal", "small-caps"。
  65157. * @param {string} [options.fontWeight='normal'] - 附加文本字体粗细。可设值:"normal", "bold", "bolder", "lighter"。
  65158. * @param {string} [options.fontFamily='arial,sans-serif'] - 附加文本字体系列。fontFamily 值是字体族名称或/及类族名称的一个优先表,每个值逗号分割,
  65159. * 浏览器会使用它可识别的第一个可以使用具体的字体名称("times"、"courier"、"arial")或字体系列名称
  65160. * ("serif"、"sans-serif"、"cursive"、"fantasy"、"monospace")。
  65161. * @param {string} [options.labelPosition='top'] - 附加文本位置,可以是 'inside', 'left', 'right', 'top', 'bottom'。
  65162. * @param {string} [options.labelAlign='center'] - 附加文本水平对齐。可以是 'left', 'right', 'center'。
  65163. * @param {string} [options.labelBaseline='middle'] - 附加文本垂直对齐。可以是 'top', 'bottom', 'middle' 。
  65164. * @param {number} [options.labelXOffset=0] - 附加文本在x轴方向的偏移量。
  65165. * @param {number} [options.labelYOffset=0] - 附加文本在y轴方向的偏移量。
  65166. * @usage
  65167. */
  65168. class ThemeStyle {
  65169. constructor(options) {
  65170. options = options || {};
  65171. /**
  65172. * @member {boolean} [ThemeStyle.prototype.fill=true]
  65173. * @description 是否填充,不需要填充则设置为 false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
  65174. */
  65175. this.fill = true;
  65176. /**
  65177. * @member {string} [ThemeStyle.prototype.fillColor="#000000"]
  65178. * @description 十六进制填充颜色。
  65179. */
  65180. this.fillColor = "#000000";
  65181. /**
  65182. * @member {number} [ThemeStyle.prototype.fillOpacity=1]
  65183. * @description 填充不透明度。取值范围[0, 1]。
  65184. */
  65185. this.fillOpacity = 1;
  65186. /**
  65187. * @member {boolean} [ThemeStyle.prototype.stroke=false]
  65188. * @description 是否描边,不需要描边则设置为false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
  65189. */
  65190. this.stroke = false;
  65191. /**
  65192. * @member {string} [ThemeStyle.prototype.strokeColor="#000000"]
  65193. * @description 十六进制描边颜色。
  65194. */
  65195. this.strokeColor = "#000000";
  65196. /**
  65197. * @member {number} [ThemeStyle.prototype.strokeOpacity=1]
  65198. * @description 描边的不透明度。取值范围[0, 1]。
  65199. */
  65200. this.strokeOpacity = 1;
  65201. /**
  65202. * @member {number} [ThemeStyle.prototype.strokeWidth=1]
  65203. * @description 线宽度/描边宽度。
  65204. */
  65205. this.strokeWidth = 1;
  65206. /**
  65207. * @member {string} [ThemeStyle.prototype.strokeLinecap="butt"]
  65208. * @description 线帽样式;strokeLinecap 有三种类型 “butt", "round", "square" 。
  65209. */
  65210. this.strokeLinecap = "butt";
  65211. /**
  65212. * @member {string} [ThemeStyle.prototype.strokeLineJoin="miter"]
  65213. * @description 线段连接样式;strokeLineJoin 有三种类型 “miter", "round", "bevel"。
  65214. */
  65215. this.strokeLineJoin = "miter";
  65216. /**
  65217. * @member {string} [ThemeStyle.prototype.strokeDashstyle="solid"]
  65218. * @description 虚线类型;strokeDashstyle 有八种类型 “dot",“dash",“dashdot",“longdash",“longdashdot",“solid", "dashed", "dotted";
  65219. * solid 表示实线。
  65220. */
  65221. this.strokeDashstyle = "solid";
  65222. /**
  65223. * @member {number} [ThemeStyle.prototype.pointRadius=6]
  65224. * @description 点半径。单位为像素。
  65225. */
  65226. this.pointRadius = 6;
  65227. /**
  65228. * @member {number} [ThemeStyle.prototype.shadowBlur=0]
  65229. * @description 阴影模糊度,(大于 0 有效)。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
  65230. */
  65231. this.shadowBlur = 0;
  65232. /**
  65233. * @member {string} [ThemeStyle.prototype.shadowColor='#000000']
  65234. * @description 阴影颜色。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
  65235. */
  65236. this.shadowColor = "#000000";
  65237. /**
  65238. * @member {number} [ThemeStyle.prototype.shadowOffsetX=0]
  65239. * @description 阴影 X 方向偏移值。
  65240. */
  65241. this.shadowOffsetX = 0;
  65242. /**
  65243. * @member {number} ThemeStyle.prototype.shadowOffsetY
  65244. * @description Y 方向偏移值。
  65245. */
  65246. this.shadowOffsetY = 0;
  65247. /**
  65248. * @member {string} [ThemeStyle.prototype.label]
  65249. * @description 专题要素附加文本标签内容。
  65250. */
  65251. this.label = "";
  65252. /**
  65253. * @member {boolean} [ThemeStyle.prototype.labelRect=false]
  65254. * @description 是否显示文本标签矩形背景。
  65255. */
  65256. this.labelRect = false;
  65257. /**
  65258. * @member {string} [ThemeStyle.prototype.fontColor]
  65259. * @description 附加文本字体颜色。
  65260. */
  65261. this.fontColor = "";
  65262. /**
  65263. * @member {number} [ThemeStyle.prototype.fontSize=12]
  65264. * @description 附加文本字体大小,单位是像素。
  65265. */
  65266. this.fontSize = 12;
  65267. /**
  65268. * @member {string} [ThemeStyle.prototype.fontStyle="normal"]
  65269. * @description 附加文本字体样式。可设值:"normal", "italic", "oblique"。
  65270. */
  65271. this.fontStyle = "normal";
  65272. /**
  65273. * @member {string} [ThemeStyle.prototype.fontVariant="normal"]
  65274. * @description 附加文本字体变体。可设值:"normal", "small-caps"。
  65275. */
  65276. this.fontVariant = "normal";
  65277. /**
  65278. * @member {string} [ThemeStyle.prototype.fontWeight="normal"]
  65279. * @description 附加文本字体粗细。可设值:"normal", "bold", "bolder", "lighter"。
  65280. */
  65281. this.fontWeight = "normal";
  65282. /**
  65283. * @member {string} [ThemeStyle.prototype.fontFamily="arial,sans-serif"]
  65284. * @description 附加文本字体系列。fontFamily 值是字体族名称或/及类族名称的一个优先表,每个值逗号分割,浏览器会使用它可识别的第一个
  65285. * 可以使用具体的字体名称("times"、"courier"、"arial")或字体系列名称("serif"、"sans-serif"、"cursive"、"fantasy"、"monospace")。
  65286. */
  65287. this.fontFamily = "arial,sans-serif";
  65288. /**
  65289. * @member {string} [ThemeStyle.prototype.labelPosition='top']
  65290. * @description 附加文本位置,可以是 'inside', 'left', 'right', 'top', 'bottom'。
  65291. */
  65292. this.labelPosition = "top";
  65293. /**
  65294. * @member {string} [ThemeStyle.prototype.labelAlign='center']
  65295. * @description 附加文本水平对齐。可以是 'left', 'right', 'center'。
  65296. */
  65297. this.labelAlign = "center";
  65298. /**
  65299. * @member {string} [ThemeStyle.prototype.labelBaseline='middle']
  65300. * @description 附加文本垂直对齐。可以是 'top', 'bottom', 'middle'。
  65301. */
  65302. this.labelBaseline = "middle";
  65303. /**
  65304. * @member {number} [ThemeStyle.prototype.labelXOffset=0]
  65305. * @description 附加文本在 X 轴方向的偏移量。
  65306. */
  65307. this.labelXOffset = 0;
  65308. /**
  65309. * @member {number} [ThemeStyle.prototype.labelYOffset=0]
  65310. * @description 附加文本在 Y 轴方向的偏移量。
  65311. */
  65312. this.labelYOffset = 0;
  65313. Util_Util.extend(this, options);
  65314. }
  65315. }
  65316. ;// CONCATENATED MODULE: ./src/common/style/index.js
  65317. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  65318. * This program are made available under the terms of the Apache License, Version 2.0
  65319. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  65320. ;// CONCATENATED MODULE: ./src/common/overlay/feature/ShapeParameters.js
  65321. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  65322. * This program are made available under the terms of the Apache License, Version 2.0
  65323. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  65324. /**
  65325. * @class ShapeParameters
  65326. * @aliasclass Feature.ShapeParameters
  65327. * @deprecatedclass SuperMap.Feature.ShapeParameters
  65328. * @category Visualization Theme
  65329. * @classdesc 图形参数基类
  65330. * @usage
  65331. */
  65332. class ShapeParameters {
  65333. constructor() {
  65334. /**
  65335. * @member {Array.<number>} [ShapeParameters.prototype.refOriginalPosition=[0,0]]
  65336. * @description 图形参考原点位置,图形的参考中心位置。
  65337. * refOriginalPosition 是长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  65338. * refOriginalPosition 表示图形的参考中心,通常情况下,图形是使用 canvas 的原点位置作为位置参考,
  65339. * 但 refOriginalPosition 可以改变图形的参考位置,例如: refOriginalPosition = [80, 80],
  65340. * 图形圆的 style.x = 20, style.y = 20,那么圆在 canvas 中的实际位置是 [100, 100]。
  65341. * 图形(Shape)的所有位置相关属性都是以 refOriginalPosition 为参考中心,
  65342. * 也就是说图形的所有位置信息在 canvas 中都是以 refOriginalPosition 为参考的相对位置,只有
  65343. * refOriginalPosition 的值为 [0, 0] 时,图形的位置信息才是 canvas 绝对位置。
  65344. * 图形的位置信息通常有:style.pointList,style.x,style.y。
  65345. */
  65346. this.refOriginalPosition = [0, 0];
  65347. /**
  65348. * @member {string} ShapeParameters.prototype.refDataID
  65349. * @description 图形所关联数据的 ID(<{@link FeatureVector}> 的 ID)。
  65350. */
  65351. this.refDataID = null;
  65352. /**
  65353. * @member {boolean} ShapeParameters.prototype.isHoverByRefDataID
  65354. * @description 是否根据 refDataID 进行高亮。用于同时高亮所有 refDataID 相同的图形。
  65355. */
  65356. this.isHoverByRefDataID = false;
  65357. /**
  65358. * @member {string} ShapeParameters.prototype.refDataHoverGroup
  65359. * @description 高亮图形组的组名。此属性在 refDataID 有效且 isHoverByRefDataID 为 true 时生效。
  65360. * 一旦设置此属性,且属性值有效,只有关联同一个数据的图形且此属性相同的图形才会高亮。
  65361. */
  65362. this.refDataHoverGroup = null;
  65363. /**
  65364. * @member {Object} ShapeParameters.prototype.dataInfo
  65365. * @description 图形携带的附加数据。
  65366. */
  65367. this.dataInfo = null;
  65368. /**
  65369. * @member {boolean} ShapeParameters.prototype.clickable
  65370. * @description 是否可点击。
  65371. */
  65372. this.clickable = true;
  65373. /**
  65374. * @member {boolean} ShapeParameters.prototype.hoverable
  65375. * @description 是否可点击。
  65376. */
  65377. this.hoverable = true;
  65378. /**
  65379. * @member {Object} ShapeParameters.prototype.style
  65380. * @description 图形样式对象,可设样式属性在子类中确定。
  65381. */
  65382. this.style = null;
  65383. /**
  65384. * @member {Object} ShapeParameters.prototype.highlightStyle
  65385. * @description 高亮样式对象,可设样式属性与 style 的可设样式属性相同。
  65386. */
  65387. this.highlightStyle = {};
  65388. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters";
  65389. }
  65390. /**
  65391. * @function ShapeParameters.prototype.destroy
  65392. * @description 销毁对象。
  65393. */
  65394. destroy() {
  65395. this.refOriginalPosition = null;
  65396. this.refDataID = null;
  65397. this.isHoverByRefDataID = null;
  65398. this.refDataHoverGroup = null;
  65399. this.dataInfo = null;
  65400. this.clickable = null;
  65401. this.hoverable = null;
  65402. this.style = null;
  65403. this.highlightStyle = null;
  65404. }
  65405. }
  65406. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Point.js
  65407. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  65408. * This program are made available under the terms of the Apache License, Version 2.0
  65409. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  65410. /**
  65411. * @class ShapeParametersPoint
  65412. * @aliasclass Feature.ShapeParameters.Point
  65413. * @deprecatedclass SuperMap.Feature.ShapeParameters.Point
  65414. * @category Visualization Theme
  65415. * @classdesc 点参数对象。
  65416. * @extends {ShapeParameters}
  65417. * @param {number} x - 点 x 坐标。
  65418. * @param {number} y - 点 y 坐标。
  65419. * @usage
  65420. */
  65421. class Point_Point extends ShapeParameters {
  65422. constructor(x, y) {
  65423. super(x, y);
  65424. /**
  65425. * @member {number} ShapeParametersPoint.prototype.x
  65426. * @description 点 x 坐标。
  65427. */
  65428. this.x = !isNaN(x) ? x : 0;
  65429. /**
  65430. * @member {number} ShapeParametersPoint.prototype.y
  65431. * @description 点 y 坐标。
  65432. */
  65433. this.y = !isNaN(y) ? y : 0;
  65434. /**
  65435. * @member {number} ShapeParametersPoint.prototype.r
  65436. * @description 点的半径。
  65437. */
  65438. this.r = 6;
  65439. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Point";
  65440. }
  65441. /**
  65442. * @function ShapeParametersPoint.prototype.destroy
  65443. * @description 销毁对象。
  65444. */
  65445. destroy() {
  65446. this.x = null;
  65447. this.y = null;
  65448. this.r = null;
  65449. super.destroy();
  65450. }
  65451. }
  65452. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Line.js
  65453. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  65454. * This program are made available under the terms of the Apache License, Version 2.0
  65455. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  65456. /**
  65457. * @class ShapeParametersLine
  65458. * @aliasclass Feature.ShapeParameters.Line
  65459. * @deprecatedclass SuperMap.Feature.ShapeParameters.Line
  65460. * @category Visualization Theme
  65461. * @classdesc 线参数对象。
  65462. * @extends {ShapeParameters}
  65463. * @param {Array} pointList - 线要素节点数组,二维数组。
  65464. * @usage
  65465. */
  65466. class Line_Line extends ShapeParameters {
  65467. constructor(pointList) {
  65468. super(pointList);
  65469. /**
  65470. * @member {Array} ShapeParametersLine.prototype.pointList
  65471. * @description 线要素节点数组,二维数组。
  65472. * 数组形如:
  65473. * (start code)
  65474. * [
  65475. * [10, 20], //节点
  65476. * [30, 40],
  65477. * [25, 30] //最后一个节点和第一个节点不必相同,绘制时自动封闭
  65478. * ]
  65479. * (end)
  65480. */
  65481. this.pointList = pointList;
  65482. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Line";
  65483. }
  65484. /**
  65485. * @function ShapeParametersLine.prototype.destroy
  65486. * @description 销毁对象。
  65487. */
  65488. destroy() {
  65489. this.pointList = null;
  65490. super.destroy();
  65491. }
  65492. }
  65493. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Polygon.js
  65494. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  65495. * This program are made available under the terms of the Apache License, Version 2.0
  65496. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  65497. /**
  65498. * @class ShapeParametersPolygon
  65499. * @aliasclass Feature.ShapeParameters.Polygon
  65500. * @deprecatedclass SuperMap.Feature.ShapeParameters.Polygon
  65501. * @category Visualization Theme
  65502. * @classdesc 面参数对象。
  65503. * @extends {ShapeParameters}
  65504. * @param {Array} pointList - 横坐标。
  65505. * @usage
  65506. */
  65507. class feature_Polygon_Polygon extends ShapeParameters {
  65508. constructor(pointList) {
  65509. super(pointList);
  65510. /**
  65511. * @member {Array} ShapeParametersPolygon.prototype.pointList
  65512. * @description 面要素节点数组,二维数组。
  65513. * 数组形如:
  65514. * (start code)
  65515. * [
  65516. * [10, 20], //节点
  65517. * [30, 40],
  65518. * [25, 30] //最后一个节点和第一个节点不必相同,绘制时自动封闭
  65519. * ]
  65520. * (end)
  65521. */
  65522. this.pointList = pointList;
  65523. /**
  65524. * @member {Array} ShapeParametersPolygon.prototype.holePolygonPointLists
  65525. * @description 岛洞面多边形顶点数组(三维数组)
  65526. */
  65527. this.holePolygonPointLists = null;
  65528. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Polygon";
  65529. }
  65530. /**
  65531. * @function ShapeParametersPolygon.prototype.destroy
  65532. * @description 销毁对象。
  65533. */
  65534. destroy() {
  65535. this.pointList = null;
  65536. this.holePolygonPointLists = null;
  65537. super.destroy();
  65538. }
  65539. }
  65540. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Rectangle.js
  65541. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  65542. * This program are made available under the terms of the Apache License, Version 2.0
  65543. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  65544. /**
  65545. * @class ShapeParametersRectangle
  65546. * @aliasclass Feature.ShapeParameters.Rectangle
  65547. * @deprecatedclass SuperMap.Feature.ShapeParameters.Rectangle
  65548. * @category Visualization Theme
  65549. * @classdesc 矩形参数对象。
  65550. * @extends {ShapeParameters}
  65551. * @param {number} x - 矩形 x 坐标。
  65552. * @param {number} y - 矩形 y 坐标。
  65553. * @param {number} width - 矩形 width 宽度。
  65554. * @param {number} height - 矩形 height 高度。
  65555. * @usage
  65556. */
  65557. class Rectangle_Rectangle extends ShapeParameters {
  65558. constructor(x, y, width, height) {
  65559. super(x, y, width, height);
  65560. /**
  65561. * @member {number} ShapeParametersRectangle.prototype.x
  65562. * @description 左上角 x 坐标。
  65563. */
  65564. this.x = !isNaN(x) ? x : 0;
  65565. /**
  65566. * @member {number} ShapeParametersRectangle.prototype.y
  65567. * @description 左上角 y 坐标。
  65568. */
  65569. this.y = !isNaN(x) ? y : 0;
  65570. /**
  65571. * @member {number} ShapeParametersRectangle.prototype.width
  65572. * @description 宽度。
  65573. */
  65574. this.width = !isNaN(width) ? width : 0;
  65575. /**
  65576. * @member {number} ShapeParametersRectangle.prototype.height
  65577. * @description 高度。
  65578. */
  65579. this.height = !isNaN(height) ? height : 0;
  65580. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Rectangle";
  65581. }
  65582. /**
  65583. * @function ShapeParametersRectangle.prototype.destroy
  65584. * @description 销毁对象。
  65585. */
  65586. destroy() {
  65587. this.x = null;
  65588. this.y = null;
  65589. this.width = null;
  65590. this.height = null;
  65591. super.destroy();
  65592. }
  65593. }
  65594. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Sector.js
  65595. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  65596. * This program are made available under the terms of the Apache License, Version 2.0
  65597. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  65598. /**
  65599. * @class ShapeParametersSector
  65600. * @aliasclass Feature.ShapeParameters.Sector
  65601. * @deprecatedclass SuperMap.Feature.ShapeParameters.Sector
  65602. * @category Visualization Theme
  65603. * @classdesc 扇形参数对象。
  65604. * @extends {ShapeParameters}
  65605. * @param {number} x - 圆心 x 坐标。
  65606. * @param {number} y - 圆心 y 坐标。
  65607. * @param {number} r - 外圆半径。
  65608. * @param {number} startAngle - 起始角度。取值范围[0, 360)。
  65609. * @param {number} endAngle - 结束角度。取值范围(0, 360]。
  65610. * @param {number} [r0=0] - 内圆半径,指定后将出现内弧,同时扇边长度为'r - r0'。取值范围[0, r)。
  65611. * @usage
  65612. */
  65613. class Sector extends ShapeParameters {
  65614. constructor(x, y, r, startAngle, endAngle, r0, clockWise) {
  65615. super(x, y, r, startAngle, endAngle, r0, clockWise);
  65616. /**
  65617. * @member {number} ShapeParametersSector.prototype.x
  65618. * @description 圆心 x 坐标。
  65619. */
  65620. this.x = !isNaN(x) ? x : 0;
  65621. /**
  65622. * @member {number} ShapeParametersSector.prototype.Y
  65623. * @description 圆心 Y 坐标。
  65624. */
  65625. this.y = !isNaN(y) ? y : 0;
  65626. /**
  65627. * @member {number} ShapeParametersSector.prototype.r
  65628. * @description 外圆半径。
  65629. */
  65630. this.r = !isNaN(r) ? r : 0;
  65631. /**
  65632. * @member {number} ShapeParametersSector.prototype.startAngle
  65633. * @description 起始角度。取值范围[0, 360),默认值:null。
  65634. */
  65635. this.startAngle = !isNaN(startAngle) ? startAngle : 0;
  65636. /**
  65637. * @member {number} ShapeParametersSector.prototype.endAngle
  65638. * @description 结束角度。取值范围(0, 360],默认值:null。
  65639. */
  65640. this.endAngle = !isNaN(endAngle) ? endAngle : 0;
  65641. /**
  65642. * @member {number} [ShapeParametersSector.prototype.r0=0]
  65643. * @description 内圆半径,指定后将出现内弧,同时扇边长度为 r 减 r0。取值范围[0, r)。
  65644. */
  65645. this.r0 = !isNaN(r0) ? r0 : 0;
  65646. /**
  65647. * @member {number} [ShapeParametersSector.prototype.clockWise=false]
  65648. * @description 是否是顺时针。默认值:false。
  65649. */
  65650. this.clockWise = clockWise;
  65651. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Sector";
  65652. }
  65653. /**
  65654. * @function ShapeParametersSector.prototype.destroy
  65655. * @description 销毁对象。
  65656. */
  65657. destroy() {
  65658. this.x = null;
  65659. this.y = null;
  65660. this.r = null;
  65661. this.startAngle = null;
  65662. this.endAngle = null;
  65663. this.r0 = null;
  65664. this.clockWise = null;
  65665. super.destroy();
  65666. }
  65667. }
  65668. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Label.js
  65669. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  65670. * This program are made available under the terms of the Apache License, Version 2.0
  65671. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  65672. /**
  65673. * @class ShapeParametersLabel
  65674. * @aliasclass Feature.ShapeParameters.Label
  65675. * @deprecatedclass SuperMap.Feature.ShapeParameters.Label
  65676. * @category Visualization Theme
  65677. * @classdesc 标签参数对象。
  65678. * @extends {ShapeParameters}
  65679. * @param {number} x - 横坐标。
  65680. * @param {number} y - 纵坐标。
  65681. * @param {string} text - 图形中的附加文本。
  65682. * @usage
  65683. * ```
  65684. * // 浏览器
  65685. * <script type="text/javascript" src="{cdn}"></script>
  65686. * <script>
  65687. * new {namespace}.Feature.ShapeParameters.Label(x, y, text);
  65688. *
  65689. * // 弃用的写法
  65690. * new SuperMap.Feature.ShapeParameters.Label(x, y, text);
  65691. *
  65692. * </script>
  65693. * // ES6 Import
  65694. * import { ShapeParametersLabel } from '{npm}';
  65695. * new ShapeParametersLabel(x, y, text);
  65696. *
  65697. * // 弃用的写法
  65698. * import { Label } from '{npm}';
  65699. * new Label(x, y, text);
  65700. *
  65701. * ```
  65702. */
  65703. class Label extends ShapeParameters {
  65704. constructor(x, y, text) {
  65705. super(x, y, text);
  65706. /**
  65707. * @member {number} ShapeParametersLabel.prototype.x
  65708. * @description 标签 x 坐标。
  65709. */
  65710. this.x = x;
  65711. /**
  65712. * @member {number} ShapeParametersLabel.prototype.y
  65713. * @description 标签 y 坐标。
  65714. */
  65715. this.y = y;
  65716. /**
  65717. * @member {number} ShapeParametersLabel.prototype.text
  65718. * @description 标签的文本内容。
  65719. */
  65720. this.text = text;
  65721. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Label";
  65722. }
  65723. /**
  65724. * @function ShapeParametersLabel.prototype.destroy
  65725. * @description 销毁对象。
  65726. */
  65727. destroy() {
  65728. this.x = null;
  65729. this.y = null;
  65730. this.text = null;
  65731. super.destroy();
  65732. }
  65733. }
  65734. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Image.js
  65735. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  65736. * This program are made available under the terms of the Apache License, Version 2.0
  65737. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  65738. /**
  65739. * @class ShapeParametersImage
  65740. * @aliasclass Feature.ShapeParameters.Image
  65741. * @deprecatedclass SuperMap.Feature.ShapeParameters.Image
  65742. * @category Visualization Theme
  65743. * @classdesc 图片参数对象。
  65744. * @extends {ShapeParameters}
  65745. * @param {number} x - 左上角横坐标。
  65746. * @param {number} y - 左上角纵坐标。
  65747. * @param {(string|Object)} image - 图片地址或Cavans对象。
  65748. * @param {number} width - 绘制到画布上的宽度,默认为图片高度。
  65749. * @param {number} height - 绘制到画布上的高度,默认为图片高度。
  65750. * @param {number} sx - 从图片中裁剪的左上角横坐标。
  65751. * @param {number} sy - 从图片中裁剪的左上角纵坐标。
  65752. * @param {number} sWidth - 从图片中裁剪的宽度,默认为图片高度。
  65753. * @param {number} sHeight - 绘制到画布上的高度,默认为图片高度。
  65754. * @usage
  65755. */
  65756. class Image_Image extends ShapeParameters {
  65757. constructor(x, y, image, width, height, sx, sy, sWidth, sHeight) {
  65758. super(x, y, image, width, height, sx, sy, sWidth, sHeight);
  65759. /**
  65760. * @member {number} ShapeParametersImage.prototype.x
  65761. * @description 左上角横坐标,必设参数。
  65762. */
  65763. this.x = x;
  65764. /**
  65765. * @member {number} ShapeParametersImage.prototype.y
  65766. * @description 左上角纵坐标,必设参数。
  65767. */
  65768. this.y = y;
  65769. /**
  65770. * @member {(string|Object)} ShapeParametersImage.prototype.image
  65771. * @description 图片地址。
  65772. */
  65773. this.image = image;
  65774. /**
  65775. * @member {number} ShapeParametersImage.prototype.width
  65776. * @description 绘制到画布上的宽度,默认为图片高度。
  65777. */
  65778. this.width = width;
  65779. /**
  65780. * @member {number} ShapeParametersImage.prototype.height
  65781. * @description 绘制到画布上的高度,默认为图片高度。
  65782. */
  65783. this.height = height;
  65784. /**
  65785. * @member {number} ShapeParametersImage.prototype.sx
  65786. * @description 从图片中裁剪的左上角横坐标。
  65787. */
  65788. this.sx = sx;
  65789. /**
  65790. * @member {number} ShapeParametersImage.prototype.sy
  65791. * @description 从图片中裁剪的左上角纵坐标。
  65792. */
  65793. this.sy = sy;
  65794. /**
  65795. * @member {number} ShapeParametersImage.prototype.sWidth
  65796. * @description 从图片中裁剪的宽度,默认为图片高度。
  65797. */
  65798. this.sWidth = sWidth;
  65799. /**
  65800. * @member {number} ShapeParametersImage.prototype.sHeight
  65801. * @description 绘制到画布上的高度,默认为图片高度。
  65802. */
  65803. this.sHeight = sHeight;
  65804. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Image";
  65805. }
  65806. /**
  65807. * @function ShapeParametersImage.prototype.destroy
  65808. * @description 销毁对象。
  65809. */
  65810. destroy() {
  65811. this.x = null;
  65812. this.y = null;
  65813. this.image = null;
  65814. this.width = null;
  65815. this.height = null;
  65816. this.sx = null;
  65817. this.sy = null;
  65818. this.sWidth = null;
  65819. this.sHeight = null;
  65820. super.destroy();
  65821. }
  65822. }
  65823. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Circle.js
  65824. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  65825. * This program are made available under the terms of the Apache License, Version 2.0
  65826. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  65827. /**
  65828. * @class ShapeParametersCircle
  65829. * @aliasclass Feature.ShapeParameters.Circle
  65830. * @deprecatedclass SuperMap.Feature.ShapeParameters.Circle
  65831. * @classdesc 圆形参数对象。
  65832. * @category Visualization Theme
  65833. * @extends {ShapeParameters}
  65834. * @param {number} x - 圆心 x 坐标。
  65835. * @param {number} y - 圆心 y 坐标。
  65836. * @param {number} r - 圆半径。
  65837. * @usage
  65838. */
  65839. class Circle_Circle extends ShapeParameters {
  65840. constructor(x, y, r) {
  65841. super(x, y, r);
  65842. /**
  65843. * @member {number} ShapeParametersCircle.prototype.x
  65844. * @description 圆心 x 坐标。
  65845. */
  65846. this.x = !isNaN(x) ? x : 0;
  65847. /**
  65848. * @member {number} ShapeParametersCircle.prototype.y
  65849. * @description 圆心 y 坐标。
  65850. */
  65851. this.y = !isNaN(y) ? y : 0;
  65852. /**
  65853. * @member {number} ShapeParametersCircle.prototype.r
  65854. * @description 圆半径。
  65855. */
  65856. this.r = !isNaN(r) ? r : 0;
  65857. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Circle";
  65858. }
  65859. /**
  65860. * @function ShapeParametersCircle.prototype.destroy
  65861. * @description 销毁对象。
  65862. */
  65863. destroy() {
  65864. this.x = null;
  65865. this.y = null;
  65866. this.r = null;
  65867. super.destroy();
  65868. }
  65869. }
  65870. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Eventful.js
  65871. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  65872. * This program are made available under the terms of the Apache License, Version 2.0
  65873. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  65874. /**
  65875. * @class LevelRenderer.Eventful
  65876. * @category Visualization Theme
  65877. * @classdesc 事件分发器超类,所有支持事件处理的类均是此类的子类。
  65878. * 此类不可实例化。
  65879. * 支持的事件:
  65880. * Symbolizer properties:
  65881. * onclick - {function} 默认值:null。
  65882. * onmouseover - {function} 默认值:null。
  65883. * onmouseout - {function} 默认值:null。
  65884. * onmousemove - {function} 默认值:null。
  65885. * onmousewheel - {function} 默认值:null。
  65886. * onmousedown - {function} 默认值:null。
  65887. * onmouseup - {function} 默认值:null。
  65888. * ondragstart - {function} 默认值:null。
  65889. * ondragend - {function} 默认值:null。
  65890. * ondragenter - {function} 默认值:null。
  65891. * ondragleave - {function} 默认值:null。
  65892. * ondragover - {function} 默认值:null。
  65893. * ondrop - {function} 默认值:null。
  65894. * @private
  65895. */
  65896. class Eventful {
  65897. constructor() {
  65898. /**
  65899. * @member {Object} LevelRenderer.Eventful.prototype._handlers
  65900. * @description 事件处理对象(事件分发器)。
  65901. */
  65902. this._handlers = {};
  65903. this.CLASS_NAME = "SuperMap.LevelRenderer.Eventful";
  65904. }
  65905. /**
  65906. * @function {Object} LevelRenderer.Eventful.prototype.destroy
  65907. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  65908. */
  65909. destroy() {
  65910. this._handlers = null;
  65911. }
  65912. /**
  65913. * @function LevelRenderer.Eventful.prototype.one
  65914. * @description 单次触发绑定,dispatch后销毁。
  65915. * @param {string} event - 事件名。
  65916. * @param {boolean} handler - 响应函数。
  65917. * @param {Object} context - context。
  65918. * @returns {LevelRenderer.Eventful} this
  65919. */
  65920. one(event, handler, context) {
  65921. var _h = this._handlers;
  65922. if (!handler || !event) {
  65923. return this;
  65924. }
  65925. if (!_h[event]) {
  65926. _h[event] = [];
  65927. }
  65928. _h[event].push({
  65929. h: handler,
  65930. one: true,
  65931. ctx: context || this
  65932. });
  65933. return this;
  65934. }
  65935. /**
  65936. * @function LevelRenderer.Eventful.prototype.bind
  65937. * @description 绑定事件。
  65938. * @param {string} event - 事件名。
  65939. * @param {boolean} handler - 响应函数。
  65940. * @param {Object} context - context。
  65941. * @returns {LevelRenderer.Eventful} this
  65942. */
  65943. bind(event, handler, context) {
  65944. var _h = this._handlers;
  65945. if (!handler || !event) {
  65946. return this;
  65947. }
  65948. if (!_h[event]) {
  65949. _h[event] = [];
  65950. }
  65951. _h[event].push({
  65952. h: handler,
  65953. one: false,
  65954. ctx: context || this
  65955. });
  65956. return this;
  65957. }
  65958. /**
  65959. * @function LevelRenderer.Eventful.prototype.unbind
  65960. * @description 解绑事件。
  65961. * @param {string} event - 事件名。
  65962. * @param {boolean} handler - 响应函数。
  65963. * @returns {LevelRenderer.Eventful} this
  65964. */
  65965. unbind(event, handler) {
  65966. var _h = this._handlers;
  65967. if (!event) {
  65968. this._handlers = {};
  65969. return this;
  65970. }
  65971. if (handler) {
  65972. if (_h[event]) {
  65973. var newList = [];
  65974. for (var i = 0, l = _h[event].length; i < l; i++) {
  65975. if (_h[event][i]['h'] != handler) {
  65976. newList.push(_h[event][i]);
  65977. }
  65978. }
  65979. _h[event] = newList;
  65980. }
  65981. if (_h[event] && _h[event].length === 0) {
  65982. delete _h[event];
  65983. }
  65984. } else {
  65985. delete _h[event];
  65986. }
  65987. return this;
  65988. }
  65989. /**
  65990. * @function LevelRenderer.Eventful.prototype.dispatch
  65991. * @description 事件分发。
  65992. * @param {string} type - 事件类型。
  65993. * @returns {LevelRenderer.Eventful} this
  65994. */
  65995. dispatch(type) {
  65996. if (this._handlers[type]) {
  65997. var args = arguments;
  65998. var argLen = args.length;
  65999. if (argLen > 3) {
  66000. args = Array.prototype.slice.call(args, 1);
  66001. }
  66002. var _h = this._handlers[type];
  66003. var len = _h.length;
  66004. for (var i = 0; i < len;) {
  66005. // Optimize advise from backbone
  66006. switch (argLen) {
  66007. case 1:
  66008. _h[i]['h'].call(_h[i]['ctx']);
  66009. break;
  66010. case 2:
  66011. _h[i]['h'].call(_h[i]['ctx'], args[1]);
  66012. break;
  66013. case 3:
  66014. _h[i]['h'].call(_h[i]['ctx'], args[1], args[2]);
  66015. break;
  66016. default:
  66017. // have more than 2 given arguments
  66018. _h[i]['h'].apply(_h[i]['ctx'], args);
  66019. break;
  66020. }
  66021. if (_h[i]['one']) {
  66022. _h.splice(i, 1);
  66023. len--;
  66024. } else {
  66025. i++;
  66026. }
  66027. }
  66028. }
  66029. return this;
  66030. }
  66031. /**
  66032. * @function LevelRenderer.Eventful.prototype.dispatchWithContext
  66033. * @description 带有context的事件分发,最后一个参数是事件回调的 context。
  66034. * @param {string} type - 事件类型。
  66035. * @returns {LevelRenderer.Eventful} this
  66036. */
  66037. dispatchWithContext(type) {
  66038. if (this._handlers[type]) {
  66039. var args = arguments;
  66040. var argLen = args.length;
  66041. if (argLen > 4) {
  66042. args = Array.prototype.slice.call(args, 1, args.length - 1);
  66043. }
  66044. var ctx = args[args.length - 1];
  66045. var _h = this._handlers[type];
  66046. var len = _h.length;
  66047. for (var i = 0; i < len;) {
  66048. // Optimize advise from backbone
  66049. switch (argLen) {
  66050. case 1:
  66051. _h[i]['h'].call(ctx);
  66052. break;
  66053. case 2:
  66054. _h[i]['h'].call(ctx, args[1]);
  66055. break;
  66056. case 3:
  66057. _h[i]['h'].call(ctx, args[1], args[2]);
  66058. break;
  66059. default:
  66060. // have more than 2 given arguments
  66061. _h[i]['h'].apply(ctx, args);
  66062. break;
  66063. }
  66064. if (_h[i]['one']) {
  66065. _h.splice(i, 1);
  66066. len--;
  66067. } else {
  66068. i++;
  66069. }
  66070. }
  66071. }
  66072. return this;
  66073. }
  66074. }
  66075. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Vector.js
  66076. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  66077. * This program are made available under the terms of the Apache License, Version 2.0
  66078. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66079. /**
  66080. * @private
  66081. * @class LevelRenderer.Tool.Vector
  66082. * @category Visualization Theme
  66083. * @classdesc LevelRenderer 二维向量类
  66084. *
  66085. */
  66086. class levelRenderer_Vector_Vector {
  66087. constructor() {
  66088. this.ArrayCtor = typeof Float32Array === 'undefined'
  66089. ? Array
  66090. : Float32Array;
  66091. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Vector";
  66092. }
  66093. /**
  66094. * @function LevelRenderer.Tool.Vector.prototype.create
  66095. * @description 创建一个向量。
  66096. *
  66097. * @param {number} x - x坐标
  66098. * @param {number} y - Y坐标
  66099. * @return {Vector2} 向量。
  66100. */
  66101. create(x, y) {
  66102. var ArrayCtor = this.ArrayCtor;
  66103. var out = new ArrayCtor(2);
  66104. out[0] = x || 0;
  66105. out[1] = y || 0;
  66106. return out;
  66107. }
  66108. /**
  66109. * @function LevelRenderer.Tool.Vector.prototype.copy
  66110. * @description 复制一个向量。
  66111. *
  66112. * @param {Vector2} out - 基础向量。
  66113. * @param {Vector2} v - 向量。
  66114. * @return {Vector2} 克隆向量。
  66115. */
  66116. copy(out, v) {
  66117. out[0] = v[0];
  66118. out[1] = v[1];
  66119. return out;
  66120. }
  66121. /**
  66122. * @function LevelRenderer.Tool.Vector.prototype.set
  66123. * @description 设置向量的两个项。
  66124. *
  66125. * @param {Vector2} out - 基础向量。
  66126. * @param {number} a - 项 a。
  66127. * @param {number} b - 项 b。
  66128. * @return {Vector2} 结果。
  66129. */
  66130. set(out, a, b) {
  66131. out[0] = a;
  66132. out[1] = b;
  66133. return out;
  66134. }
  66135. /**
  66136. * @function LevelRenderer.Tool.Vector.prototype.add
  66137. * @description 向量相加。
  66138. *
  66139. * @param {Vector2} out - 基础向量。
  66140. * @param {Vector2} v1 - 向量 v1。
  66141. * @param {Vector2} v2 - 向量 v2。
  66142. * @return {Vector2} 结果。
  66143. */
  66144. add(out, v1, v2) {
  66145. out[0] = v1[0] + v2[0];
  66146. out[1] = v1[1] + v2[1];
  66147. return out;
  66148. }
  66149. /**
  66150. * @function LevelRenderer.Tool.Vector.prototype.scaleAndAdd
  66151. * @description 向量缩放后相加。
  66152. * @param {Vector2} out - 基础向量。
  66153. * @param {Vector2} v1 - 向量 v1。
  66154. * @param {Vector2} v2 - 向量 v2(缩放向量)。
  66155. * @param {number} a - 缩放参数。
  66156. * @return {Vector2} 结果。
  66157. */
  66158. scaleAndAdd(out, v1, v2, a) {
  66159. out[0] = v1[0] + v2[0] * a;
  66160. out[1] = v1[1] + v2[1] * a;
  66161. return out;
  66162. }
  66163. /**
  66164. * @function LevelRenderer.Tool.Vector.prototype.sub
  66165. * @description 向量相减。
  66166. * @param {Vector2} out - 基础向量。
  66167. * @param {Vector2} v1 - 向量 v1。
  66168. * @param {Vector2} v2 - 向量 v2。
  66169. * @return {Vector2} 结果。
  66170. */
  66171. sub(out, v1, v2) {
  66172. out[0] = v1[0] - v2[0];
  66173. out[1] = v1[1] - v2[1];
  66174. return out;
  66175. }
  66176. /**
  66177. * @function LevelRenderer.Tool.Vector.prototype.len
  66178. * @description 向量长度。
  66179. * @param {Vector2} v - 向量。
  66180. * @return {number} 向量长度。
  66181. */
  66182. len(v) {
  66183. return Math.sqrt(this.lenSquare(v));
  66184. }
  66185. /**
  66186. * @function LevelRenderer.Tool.Vector.prototype.lenSquare
  66187. * @description 向量长度平方。
  66188. * @param {Vector2} v - 向量。
  66189. * @return {number} 向量长度平方。
  66190. */
  66191. lenSquare(v) {
  66192. return v[0] * v[0] + v[1] * v[1];
  66193. }
  66194. /**
  66195. * @function LevelRenderer.Tool.Vector.prototype.mul
  66196. * @description 向量乘法。
  66197. * @param {Vector2} out - 基础向量。
  66198. * @param {Vector2} v1 - 向量 v1。
  66199. * @param {Vector2} v2 - 向量 v2。
  66200. * @return {Vector2} 结果。
  66201. */
  66202. mul(out, v1, v2) {
  66203. out[0] = v1[0] * v2[0];
  66204. out[1] = v1[1] * v2[1];
  66205. return out;
  66206. }
  66207. /**
  66208. * @function LevelRenderer.Tool.Vector.prototype.div
  66209. * @description 向量除法。
  66210. *
  66211. * @param {Vector2} out - 基础向量。
  66212. * @param {Vector2} v1 - 向量 v1。
  66213. * @param {Vector2} v2 - 向量 v2。
  66214. * @return {Vector2} 结果。
  66215. */
  66216. div(out, v1, v2) {
  66217. out[0] = v1[0] / v2[0];
  66218. out[1] = v1[1] / v2[1];
  66219. return out;
  66220. }
  66221. /**
  66222. * @function LevelRenderer.Tool.Vector.prototype.dot
  66223. * @description 向量点乘。
  66224. *
  66225. * @param {Vector2} v1 - 向量 v1。
  66226. * @param {Vector2} v2 - 向量 v2。
  66227. * @return {number} 向量点乘。
  66228. */
  66229. dot(v1, v2) {
  66230. return v1[0] * v2[0] + v1[1] * v2[1];
  66231. }
  66232. /**
  66233. * @function LevelRenderer.Tool.Vector.prototype.scale
  66234. * @description 向量缩放。
  66235. *
  66236. * @param {Vector2} out - 基础向量。
  66237. * @param {Vector2} v - 向量v。
  66238. * @param {number} s -缩放参数。
  66239. * @return {Vector2} 结果。
  66240. */
  66241. scale(out, v, s) {
  66242. out[0] = v[0] * s;
  66243. out[1] = v[1] * s;
  66244. return out;
  66245. }
  66246. /**
  66247. * @function LevelRenderer.Tool.Vector.prototype.normalize
  66248. * @description 向量归一化。
  66249. *
  66250. * @param {Vector2} out - 基础向量。
  66251. * @param {Vector2} v - 向量 v。
  66252. * @return {Vector2} 结果。
  66253. */
  66254. normalize(out, v) {
  66255. var d = this.len(v);
  66256. if (d === 0) {
  66257. out[0] = 0;
  66258. out[1] = 0;
  66259. } else {
  66260. out[0] = v[0] / d;
  66261. out[1] = v[1] / d;
  66262. }
  66263. return out;
  66264. }
  66265. /**
  66266. * @function LevelRenderer.Tool.Vector.prototype.distance
  66267. * @description 计算向量间距离。
  66268. *
  66269. * @param {Vector2} v1 - 向量 v1。
  66270. * @param {Vector2} v2 - 向量 v2。
  66271. * @return {number} 向量间距离。
  66272. */
  66273. distance(v1, v2) {
  66274. return Math.sqrt(
  66275. (v1[0] - v2[0]) * (v1[0] - v2[0])
  66276. + (v1[1] - v2[1]) * (v1[1] - v2[1])
  66277. );
  66278. }
  66279. /**
  66280. * @function LevelRenderer.Tool.Vector.prototype.distanceSquare
  66281. * @description 向量距离平方。
  66282. *
  66283. * @param {Vector2} v1 - 向量 v1。
  66284. * @param {Vector2} v2 - 向量 v2。
  66285. * @return {number} 向量距离平方。
  66286. */
  66287. distanceSquare(v1, v2) {
  66288. return (v1[0] - v2[0]) * (v1[0] - v2[0])
  66289. + (v1[1] - v2[1]) * (v1[1] - v2[1]);
  66290. }
  66291. /**
  66292. * @function LevelRenderer.Tool.Vector.prototype.negate
  66293. * @description 求负向量。
  66294. *
  66295. * @param {Vector2} out - 基础向量。
  66296. * @param {Vector2} v - 向量 v。
  66297. * @return {Vector2} 负向量。
  66298. */
  66299. negate(out, v) {
  66300. out[0] = -v[0];
  66301. out[1] = -v[1];
  66302. return out;
  66303. }
  66304. /**
  66305. * @function LevelRenderer.Tool.Vector.prototype.lerp
  66306. * @description 两点之间线性插值。
  66307. *
  66308. * @param {Vector2} out - 基础向量。
  66309. * @param {Vector2} v1 - 向量 v1。
  66310. * @param {Vector2} v2 - 向量 v2。
  66311. * @param {number} t
  66312. * @return {Vector2} 结果。
  66313. */
  66314. lerp(out, v1, v2, t) {
  66315. out[0] = v1[0] + t * (v2[0] - v1[0]);
  66316. out[1] = v1[1] + t * (v2[1] - v1[1]);
  66317. return out;
  66318. }
  66319. /**
  66320. * @function LevelRenderer.Tool.Vector.prototype.applyTransform
  66321. * @description 矩阵左乘向量。
  66322. *
  66323. * @param {Vector2} out - 基础向量。
  66324. * @param {Vector2} v1 - 向量 v1。
  66325. * @param {Vector2} v2 - 向量 v2。
  66326. * @return {Vector2} 结果。
  66327. */
  66328. applyTransform(out, v, m) {
  66329. var x = v[0];
  66330. var y = v[1];
  66331. out[0] = m[0] * x + m[2] * y + m[4];
  66332. out[1] = m[1] * x + m[3] * y + m[5];
  66333. return out;
  66334. }
  66335. /**
  66336. * @function LevelRenderer.Tool.Vector.prototype.min
  66337. * @description 求两个向量最小值。
  66338. * @param {Vector2} out - 基础向量。
  66339. * @param {Vector2} v1 - 向量 v1。
  66340. * @param {Vector2} v2 - 向量 v2。
  66341. * @return {Vector2} 结果。
  66342. */
  66343. min(out, v1, v2) {
  66344. out[0] = Math.min(v1[0], v2[0]);
  66345. out[1] = Math.min(v1[1], v2[1]);
  66346. return out;
  66347. }
  66348. /**
  66349. * @function LevelRenderer.Tool.Vector.prototype.max
  66350. * @description 求两个向量最大值。
  66351. *
  66352. * @param {Vector2} out - 基础向量。
  66353. * @param {Vector2} v1 - 向量 v1。
  66354. * @param {Vector2} v2 - 向量 v2。
  66355. * @return {Vector2} 结果。
  66356. */
  66357. max(out, v1, v2) {
  66358. out[0] = Math.max(v1[0], v2[0]);
  66359. out[1] = Math.max(v1[1], v2[1]);
  66360. return out;
  66361. }
  66362. /**
  66363. * @function LevelRenderer.Tool.Vector.prototype.length
  66364. * @description 向量长度。
  66365. *
  66366. * @param {Vector2} v - 向量。
  66367. * @return {number} 向量长度。
  66368. */
  66369. length(v) {
  66370. return this.len(v);
  66371. }
  66372. /**
  66373. * @function LevelRenderer.Tool.Vector.prototype.lengthSquare
  66374. * @description 向量长度平方。
  66375. *
  66376. * @param {Vector2} v - 向量。
  66377. * @return {number} 向量长度平方。
  66378. */
  66379. lengthSquare(v) {
  66380. return this.lenSquare(v);
  66381. }
  66382. /**
  66383. * @function LevelRenderer.Tool.Vector.prototype.dist
  66384. * @description 计算向量间距离。
  66385. *
  66386. * @param {Vector2} v1 - 向量 v1。
  66387. * @param {Vector2} v2 - 向量 v2。
  66388. * @return {number} 向量间距离。
  66389. */
  66390. dist(v1, v2) {
  66391. return this.distance(v1, v2);
  66392. }
  66393. /**
  66394. * @function LevelRenderer.Tool.Vector.prototype.distSquare
  66395. * @description 向量距离平方。
  66396. *
  66397. * @param {Vector2} v1 - 向量 v1。
  66398. * @param {Vector2} v2 - 向量 v2。
  66399. * @return {number} 向量距离平方
  66400. */
  66401. distSquare(v1, v2) {
  66402. return this.distanceSquare(v1, v2);
  66403. }
  66404. }
  66405. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Curve.js
  66406. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  66407. * This program are made available under the terms of the Apache License, Version 2.0
  66408. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66409. /**
  66410. * @class LevelRenderer.Tool.Curve
  66411. * @category Visualization Theme
  66412. * @classdesc LevelRenderer 工具-曲线
  66413. * @private
  66414. */
  66415. class Curve_Curve {
  66416. constructor() {
  66417. /**
  66418. * @member {LevelRenderer.Tool.Vector} LevelRenderer.Tool.Curve.prototype.vector
  66419. * @description 矢量工具。
  66420. */
  66421. this.vector = new levelRenderer_Vector_Vector();
  66422. /**
  66423. * @member {number} LevelRenderer.Tool.Curve.prototype.EPSILON
  66424. * @description e。
  66425. */
  66426. this.EPSILON = 1e-4;
  66427. /**
  66428. * @member {number} LevelRenderer.Tool.Curve.prototype.THREE_SQRT
  66429. * @description 3 的平方根。
  66430. */
  66431. this.THREE_SQRT = Math.sqrt(3);
  66432. /**
  66433. * @member {number} LevelRenderer.Tool.Curve.prototype.ONE_THIRD
  66434. * @description 1/3。
  66435. */
  66436. this.ONE_THIRD = 1 / 3;
  66437. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Curve";
  66438. }
  66439. /*
  66440. * Method: evalCubicCoeff
  66441. *
  66442. * Parameters:
  66443. * a - {number} 值。
  66444. * b - {number} 值。
  66445. * c - {number} 值。
  66446. * d - {number} 值。
  66447. * t - {number} 值。
  66448. *
  66449. * Returns:
  66450. * {number}
  66451. */
  66452. /*
  66453. evalCubicCoeff: function(a, b, c, d, t){
  66454. return ((a * t + b) * t + c) * t + d;
  66455. },
  66456. */
  66457. /**
  66458. * @function LevelRenderer.Tool.Curve.prototype.isAroundZero
  66459. * @description 判断一个值是否趋于0,判断参考值:1e-4。
  66460. * @param {number} val - 值。
  66461. * @returns {boolean} 值是否趋于0。
  66462. */
  66463. isAroundZero(val) {
  66464. return val > -this.EPSILON && val < this.EPSILON;
  66465. }
  66466. /**
  66467. * @function LevelRenderer.Tool.Curve.prototype.isNotAroundZero
  66468. * @description 判断一个值是否不趋于0,判断参考值:1e-4。
  66469. * @param {number} val - 值。
  66470. * @returns {boolean} 值是否不趋于0。
  66471. */
  66472. isNotAroundZero(val) {
  66473. return val > this.EPSILON || val < -this.EPSILON;
  66474. }
  66475. /**
  66476. * @function LevelRenderer.Tool.Curve.prototype.cubicAt
  66477. * @description 计算三次贝塞尔值
  66478. * @param {number} p0 - 点p0。
  66479. * @param {number} p1 - 点p1。
  66480. * @param {number} p2 - 点p2。
  66481. * @param {number} p3 - 点p3。
  66482. * @param {number} t - t值。
  66483. * @returns {number} 三次贝塞尔值。
  66484. */
  66485. cubicAt(p0, p1, p2, p3, t) {
  66486. var onet = 1 - t;
  66487. return onet * onet * (onet * p0 + 3 * t * p1)
  66488. + t * t * (t * p3 + 3 * onet * p2);
  66489. }
  66490. /**
  66491. * @function LevelRenderer.Tool.Curve.prototype.cubicDerivativeAt
  66492. * @description 计算三次贝塞尔导数值
  66493. * @param {number} p0 - 点p0。
  66494. * @param {number} p1 - 点p1。
  66495. * @param {number} p2 - 点p2。
  66496. * @param {number} p3 - 点p3。
  66497. * @param {number} t - t值。
  66498. * @returns {number} 三次贝塞尔导数值。
  66499. */
  66500. cubicDerivativeAt(p0, p1, p2, p3, t) {
  66501. var onet = 1 - t;
  66502. return 3 * (
  66503. ((p1 - p0) * onet + 2 * (p2 - p1) * t) * onet
  66504. + (p3 - p2) * t * t
  66505. );
  66506. }
  66507. /**
  66508. * @function LevelRenderer.Tool.Curve.prototype.cubicRootAt
  66509. * @description 计算三次贝塞尔方程根,使用盛金公式
  66510. * @param {number} p0 - 点p0。
  66511. * @param {number} p1 - 点p1。
  66512. * @param {number} p2 - 点p2。
  66513. * @param {number} p3 - 点p3。
  66514. * @param {number} val - 值。
  66515. * @param {Array.<number>} roots - 有效根数目。
  66516. * @returns {number} 有效根。
  66517. */
  66518. cubicRootAt(p0, p1, p2, p3, val, roots) {
  66519. // Evaluate roots of cubic functions
  66520. var a = p3 + 3 * (p1 - p2) - p0;
  66521. var b = 3 * (p2 - p1 * 2 + p0);
  66522. var c = 3 * (p1 - p0);
  66523. var d = p0 - val;
  66524. var A = b * b - 3 * a * c;
  66525. var B = b * c - 9 * a * d;
  66526. var C = c * c - 3 * b * d;
  66527. var n = 0;
  66528. if (this.isAroundZero(A) && this.isAroundZero(B)) {
  66529. if (this.isAroundZero(b)) {
  66530. roots[0] = 0;
  66531. } else {
  66532. let t1 = -c / b; //t1, t2, t3, b is not zero
  66533. if (t1 >= 0 && t1 <= 1) {
  66534. roots[n++] = t1;
  66535. }
  66536. }
  66537. } else {
  66538. var disc = B * B - 4 * A * C;
  66539. if (this.isAroundZero(disc)) {
  66540. var K = B / A;
  66541. let t1 = -b / a + K; // t1, a is not zero
  66542. let t2 = -K / 2; // t2, t3
  66543. if (t1 >= 0 && t1 <= 1) {
  66544. roots[n++] = t1;
  66545. }
  66546. if (t2 >= 0 && t2 <= 1) {
  66547. roots[n++] = t2;
  66548. }
  66549. } else if (disc > 0) {
  66550. let discSqrt = Math.sqrt(disc);
  66551. let Y1 = A * b + 1.5 * a * (-B + discSqrt);
  66552. let Y2 = A * b + 1.5 * a * (-B - discSqrt);
  66553. if (Y1 < 0) {
  66554. Y1 = -Math.pow(-Y1, this.ONE_THIRD);
  66555. } else {
  66556. Y1 = Math.pow(Y1, this.ONE_THIRD);
  66557. }
  66558. if (Y2 < 0) {
  66559. Y2 = -Math.pow(-Y2, this.ONE_THIRD);
  66560. } else {
  66561. Y2 = Math.pow(Y2, this.ONE_THIRD);
  66562. }
  66563. let t1 = (-b - (Y1 + Y2)) / (3 * a);
  66564. if (t1 >= 0 && t1 <= 1) {
  66565. roots[n++] = t1;
  66566. }
  66567. } else {
  66568. var T = (2 * A * b - 3 * a * B) / (2 * Math.sqrt(A * A * A));
  66569. var theta = Math.acos(T) / 3;
  66570. var ASqrt = Math.sqrt(A);
  66571. var tmp = Math.cos(theta);
  66572. let t1 = (-b - 2 * ASqrt * tmp) / (3 * a);
  66573. let t2 = (-b + ASqrt * (tmp + this.THREE_SQRT * Math.sin(theta))) / (3 * a);
  66574. let t3 = (-b + ASqrt * (tmp - this.THREE_SQRT * Math.sin(theta))) / (3 * a);
  66575. if (t1 >= 0 && t1 <= 1) {
  66576. roots[n++] = t1;
  66577. }
  66578. if (t2 >= 0 && t2 <= 1) {
  66579. roots[n++] = t2;
  66580. }
  66581. if (t3 >= 0 && t3 <= 1) {
  66582. roots[n++] = t3;
  66583. }
  66584. }
  66585. }
  66586. return n;
  66587. }
  66588. /**
  66589. * @function LevelRenderer.Tool.Curve.prototype.cubicRootAt
  66590. * @description 计算三次贝塞尔方程极限值的位置
  66591. * @param {number} p0 - 点p0。
  66592. * @param {number} p1 - 点p1。
  66593. * @param {number} p2 - 点p2。
  66594. * @param {number} p3 - 点p3。
  66595. * @param {Array.<number>} extrema - 值。
  66596. * @returns {number} 有效数目。
  66597. */
  66598. cubicExtrema(p0, p1, p2, p3, extrema) {
  66599. var b = 6 * p2 - 12 * p1 + 6 * p0;
  66600. var a = 9 * p1 + 3 * p3 - 3 * p0 - 9 * p2;
  66601. var c = 3 * p1 - 3 * p0;
  66602. var n = 0;
  66603. if (this.isAroundZero(a)) {
  66604. if (this.isNotAroundZero(b)) {
  66605. let t1 = -c / b;
  66606. if (t1 >= 0 && t1 <= 1) {
  66607. extrema[n++] = t1;
  66608. }
  66609. }
  66610. } else {
  66611. var disc = b * b - 4 * a * c;
  66612. if (this.isAroundZero(disc)) {
  66613. extrema[0] = -b / (2 * a);
  66614. } else if (disc > 0) {
  66615. let discSqrt = Math.sqrt(disc);
  66616. let t1 = (-b + discSqrt) / (2 * a);
  66617. let t2 = (-b - discSqrt) / (2 * a);
  66618. if (t1 >= 0 && t1 <= 1) {
  66619. extrema[n++] = t1;
  66620. }
  66621. if (t2 >= 0 && t2 <= 1) {
  66622. extrema[n++] = t2;
  66623. }
  66624. }
  66625. }
  66626. return n;
  66627. }
  66628. /**
  66629. * @function LevelRenderer.Tool.Curve.prototype.cubicSubdivide
  66630. * @description 细分三次贝塞尔曲线
  66631. * @param {number} p0 - 点p0。
  66632. * @param {number} p1 - 点p1。
  66633. * @param {number} p2 - 点p2。
  66634. * @param {number} p3 - 点p3。
  66635. * @param {number} t - t值。
  66636. * @param {Array.<number>} out - 投射点。
  66637. * @returns {number} 投射点。
  66638. */
  66639. cubicSubdivide(p0, p1, p2, p3, t, out) {
  66640. var p01 = (p1 - p0) * t + p0;
  66641. var p12 = (p2 - p1) * t + p1;
  66642. var p23 = (p3 - p2) * t + p2;
  66643. var p012 = (p12 - p01) * t + p01;
  66644. var p123 = (p23 - p12) * t + p12;
  66645. var p0123 = (p123 - p012) * t + p012;
  66646. // Seg0
  66647. out[0] = p0;
  66648. out[1] = p01;
  66649. out[2] = p012;
  66650. out[3] = p0123;
  66651. // Seg1
  66652. out[4] = p0123;
  66653. out[5] = p123;
  66654. out[6] = p23;
  66655. out[7] = p3;
  66656. }
  66657. /**
  66658. * @function LevelRenderer.Tool.Curve.prototype.cubicProjectPoint
  66659. * @description 投射点到三次贝塞尔曲线上,返回投射距离。投射点有可能会有一个或者多个,这里只返回其中距离最短的一个。
  66660. * @param {number} x0 - 点p0横坐标。
  66661. * @param {number} y0 - 点p0纵坐标。
  66662. * @param {number} x1 - 点p1横坐标。
  66663. * @param {number} y1 - 点p1纵坐标。
  66664. * @param {number} x2 - 点p2横坐标。
  66665. * @param {number} y2 - 点p2纵坐标。
  66666. * @param {number} x3 - 点p3横坐标。
  66667. * @param {number} y3 - 点p3纵坐标。
  66668. * @param {number} x - 点p横坐标。
  66669. * @param {number} y - 点p纵坐标。
  66670. * @param {Array.<number>} out - 投射点。
  66671. * @returns {number} 投射点。
  66672. */
  66673. cubicProjectPoint(x0, y0, x1, y1, x2, y2, x3, y3, x, y, out) {
  66674. // 临时变量
  66675. var _v0 = this.vector.create();
  66676. var _v1 = this.vector.create();
  66677. var _v2 = this.vector.create();
  66678. // var _v3 = vector.create();
  66679. // http://pomax.github.io/bezierinfo/#projections
  66680. var t;
  66681. var interval = 0.005;
  66682. var d = Infinity;
  66683. _v0[0] = x;
  66684. _v0[1] = y;
  66685. // 先粗略估计一下可能的最小距离的 t 值
  66686. // PENDING
  66687. for (let _t = 0; _t < 1; _t += 0.05) {
  66688. _v1[0] = this.cubicAt(x0, x1, x2, x3, _t);
  66689. _v1[1] = this.cubicAt(y0, y1, y2, y3, _t);
  66690. let d1 = this.vector.distSquare(_v0, _v1);
  66691. if (d1 < d) {
  66692. t = _t;
  66693. d = d1;
  66694. }
  66695. }
  66696. d = Infinity;
  66697. // At most 32 iteration
  66698. for (let i = 0; i < 32; i++) {
  66699. if (interval < this.EPSILON) {
  66700. break;
  66701. }
  66702. let prev = t - interval;
  66703. let next = t + interval;
  66704. // t - interval
  66705. _v1[0] = this.cubicAt(x0, x1, x2, x3, prev);
  66706. _v1[1] = this.cubicAt(y0, y1, y2, y3, prev);
  66707. let d1 = this.vector.distSquare(_v1, _v0);
  66708. if (prev >= 0 && d1 < d) {
  66709. t = prev;
  66710. d = d1;
  66711. } else {
  66712. // t + interval
  66713. _v2[0] = this.cubicAt(x0, x1, x2, x3, next);
  66714. _v2[1] = this.cubicAt(y0, y1, y2, y3, next);
  66715. let d2 = this.vector.distSquare(_v2, _v0);
  66716. if (next <= 1 && d2 < d) {
  66717. t = next;
  66718. d = d2;
  66719. } else {
  66720. interval *= 0.5;
  66721. }
  66722. }
  66723. }
  66724. // t
  66725. if (out) {
  66726. out[0] = this.cubicAt(x0, x1, x2, x3, t);
  66727. out[1] = this.cubicAt(y0, y1, y2, y3, t);
  66728. }
  66729. // console.log(interval, i);
  66730. return Math.sqrt(d);
  66731. }
  66732. /**
  66733. * @function LevelRenderer.Tool.Curve.prototype.quadraticAt
  66734. * @description 计算二次方贝塞尔值。
  66735. * @param {number} p0 - 点p0。
  66736. * @param {number} p1 - 点p1。
  66737. * @param {number} p2 - 点p2。
  66738. * @param {number} t - t值。
  66739. * @returns {number} 二次方贝塞尔值。
  66740. */
  66741. quadraticAt(p0, p1, p2, t) {
  66742. var onet = 1 - t;
  66743. return onet * (onet * p0 + 2 * t * p1) + t * t * p2;
  66744. }
  66745. /**
  66746. * @function LevelRenderer.Tool.Curve.prototype.quadraticAt
  66747. * @description 计算二次方贝塞尔导数值。
  66748. * @param {number} p0 - 点p0。
  66749. * @param {number} p1 - 点p1。
  66750. * @param {number} p2 - 点p2。
  66751. * @param {number} t - t值。
  66752. * @returns {number} 二次方贝塞尔导数值。
  66753. */
  66754. quadraticDerivativeAt(p0, p1, p2, t) {
  66755. return 2 * ((1 - t) * (p1 - p0) + t * (p2 - p1));
  66756. }
  66757. /**
  66758. * @function LevelRenderer.Tool.Curve.prototype.quadraticRootAt
  66759. * @description 计算二次方贝塞尔方程根
  66760. * @param {number} p0 - 点p0。
  66761. * @param {number} p1 - 点p1。
  66762. * @param {number} p2 - 点p2。
  66763. * @param {number} val - 值。
  66764. * @param {Array.<number>} roots - 有效根数目。
  66765. * @returns {number} 有效根数目。
  66766. */
  66767. quadraticRootAt(p0, p1, p2, val, roots) {
  66768. var a = p0 - 2 * p1 + p2;
  66769. var b = 2 * (p1 - p0);
  66770. var c = p0 - val;
  66771. var n = 0;
  66772. if (this.isAroundZero(a)) {
  66773. if (this.isNotAroundZero(b)) {
  66774. var t1 = -c / b;
  66775. if (t1 >= 0 && t1 <= 1) {
  66776. roots[n++] = t1;
  66777. }
  66778. }
  66779. } else {
  66780. var disc = b * b - 4 * a * c;
  66781. if (this.isAroundZero(disc)) {
  66782. let t1 = -b / (2 * a);
  66783. if (t1 >= 0 && t1 <= 1) {
  66784. roots[n++] = t1;
  66785. }
  66786. } else if (disc > 0) {
  66787. let discSqrt = Math.sqrt(disc);
  66788. let t1 = (-b + discSqrt) / (2 * a);
  66789. let t2 = (-b - discSqrt) / (2 * a);
  66790. if (t1 >= 0 && t1 <= 1) {
  66791. roots[n++] = t1;
  66792. }
  66793. if (t2 >= 0 && t2 <= 1) {
  66794. roots[n++] = t2;
  66795. }
  66796. }
  66797. }
  66798. return n;
  66799. }
  66800. /**
  66801. * @function LevelRenderer.Tool.Curve.prototype.quadraticExtremum
  66802. * @description 计算二次贝塞尔方程极限值
  66803. * @param {number} p0 - 点p0。
  66804. * @param {number} p1 - 点p1。
  66805. * @param {number} p2 - 点p2。
  66806. * @returns {number} 二次贝塞尔方程极限值。
  66807. */
  66808. quadraticExtremum(p0, p1, p2) {
  66809. var divider = p0 + p2 - 2 * p1;
  66810. if (divider === 0) {
  66811. // p1 is center of p0 and p2
  66812. return 0.5;
  66813. } else {
  66814. return (p0 - p1) / divider;
  66815. }
  66816. }
  66817. /**
  66818. * @function LevelRenderer.Tool.Curve.prototype.quadraticProjectPoint
  66819. * @description 投射点到二次贝塞尔曲线上,返回投射距离。投射点有可能会有一个或者多个,这里只返回其中距离最短的一个。
  66820. * @param {number} x0 - 点p0横坐标。
  66821. * @param {number} y0 - 点p0纵坐标。
  66822. * @param {number} x1 - 点p1横坐标。
  66823. * @param {number} y1 - 点p1纵坐标。
  66824. * @param {number} x2 - 点p2横坐标。
  66825. * @param {number} y2 - 点p2纵坐标。
  66826. * @param {number} x - 点p横坐标。
  66827. * @param {number} y - 点p纵坐标。
  66828. * @param {Array.<number>} out - 投射点。
  66829. * @returns {number} 投射距离。
  66830. */
  66831. quadraticProjectPoint(x0, y0, x1, y1, x2, y2, x, y, out) {
  66832. // 临时变量
  66833. var _v0 = this.vector.create();
  66834. var _v1 = this.vector.create();
  66835. var _v2 = this.vector.create();
  66836. // http://pomax.github.io/bezierinfo/#projections
  66837. var t;
  66838. var interval = 0.005;
  66839. var d = Infinity;
  66840. _v0[0] = x;
  66841. _v0[1] = y;
  66842. // 先粗略估计一下可能的最小距离的 t 值
  66843. // PENDING
  66844. for (let _t = 0; _t < 1; _t += 0.05) {
  66845. _v1[0] = this.quadraticAt(x0, x1, x2, _t);
  66846. _v1[1] = this.quadraticAt(y0, y1, y2, _t);
  66847. let d1 = this.vector.distSquare(_v0, _v1);
  66848. if (d1 < d) {
  66849. t = _t;
  66850. d = d1;
  66851. }
  66852. }
  66853. d = Infinity;
  66854. // At most 32 iteration
  66855. for (let i = 0; i < 32; i++) {
  66856. if (interval < this.EPSILON) {
  66857. break;
  66858. }
  66859. let prev = t - interval;
  66860. let next = t + interval;
  66861. // t - interval
  66862. _v1[0] = this.quadraticAt(x0, x1, x2, prev);
  66863. _v1[1] = this.quadraticAt(y0, y1, y2, prev);
  66864. let d1 = this.vector.distSquare(_v1, _v0);
  66865. if (prev >= 0 && d1 < d) {
  66866. t = prev;
  66867. d = d1;
  66868. } else {
  66869. // t + interval
  66870. _v2[0] = this.quadraticAt(x0, x1, x2, next);
  66871. _v2[1] = this.quadraticAt(y0, y1, y2, next);
  66872. let d2 = this.vector.distSquare(_v2, _v0);
  66873. if (next <= 1 && d2 < d) {
  66874. t = next;
  66875. d = d2;
  66876. } else {
  66877. interval *= 0.5;
  66878. }
  66879. }
  66880. }
  66881. // t
  66882. if (out) {
  66883. out[0] = this.quadraticAt(x0, x1, x2, t);
  66884. out[1] = this.quadraticAt(y0, y1, y2, t);
  66885. }
  66886. // console.log(interval, i);
  66887. return Math.sqrt(d);
  66888. }
  66889. }
  66890. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Area.js
  66891. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  66892. * This program are made available under the terms of the Apache License, Version 2.0
  66893. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66894. /**
  66895. * @class LevelRenderer.Tool.Area
  66896. * @category Visualization Theme
  66897. * @classdesc LevelRenderer 工具-图形范围判断
  66898. * @private
  66899. */
  66900. class Area {
  66901. constructor() {
  66902. /**
  66903. * @member {LevelRenderer.Tool.Util} LevelRenderer.Tool.Areal.prototype.util
  66904. * @description 基础工具对象。
  66905. */
  66906. this.util = new levelRenderer_Util_Util();
  66907. /**
  66908. * @member {LevelRenderer.Tool.Curve} LevelRenderer.Tool.Areal.prototype.curve
  66909. * @description 曲线工具对象
  66910. */
  66911. this.curve = new Curve_Curve();
  66912. /**
  66913. * @member {Object} LevelRenderer.Tool.Areal.prototype._ctx
  66914. * @description Cavans2D 渲染上下文
  66915. */
  66916. this._ctx = null;
  66917. /**
  66918. * @member {Object} LevelRenderer.Tool.Areal.prototype._textWidthCache
  66919. * @description 文本宽度缓存
  66920. */
  66921. this._textWidthCache = {};
  66922. /**
  66923. * @member {Object} LevelRenderer.Tool.Areal.prototype._textHeightCache
  66924. * @description 文本高度缓存
  66925. */
  66926. this._textHeightCache = {};
  66927. /**
  66928. * @member {number} LevelRenderer.Tool.Areal.prototype._textWidthCacheCounter
  66929. * @description 文本宽度缓存数量
  66930. */
  66931. this._textWidthCacheCounter = 0;
  66932. /**
  66933. * @member {number} LevelRenderer.Tool.Areal.prototype._textHeightCacheCounter
  66934. * @description 文本高度缓存数量
  66935. */
  66936. this._textHeightCacheCounter = 0;
  66937. /**
  66938. * @member {number} LevelRenderer.Tool.Areal.prototype.TEXT_CACHE_MAX
  66939. * @description 文本最大缓存数量
  66940. */
  66941. this.TEXT_CACHE_MAX = 5000;
  66942. /**
  66943. * @member {number} LevelRenderer.Tool.Areal.prototype.PI2
  66944. * @description 2*PI 的值
  66945. */
  66946. this.PI2 = Math.PI * 2;
  66947. /**
  66948. * @member {Array.<number>} LevelRenderer.Tool.Areal.prototype.roots
  66949. * @description 临时数组
  66950. */
  66951. this.roots = [-1, -1, -1];
  66952. /**
  66953. * @member {Array.<number>} LevelRenderer.Tool.Areal.prototype.extrema
  66954. * @description 临时数组
  66955. */
  66956. this.extrema = [-1, -1];
  66957. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Area";
  66958. }
  66959. /**
  66960. * @function LevelRenderer.Tool.Areal.prototype.normalizeRadian
  66961. * @description 弧度标准化函数。
  66962. * @param {number} angle - 弧度值。
  66963. * @returns {number} 标准化后的弧度值。
  66964. */
  66965. normalizeRadian(angle) {
  66966. angle %= this.PI2;
  66967. if (angle < 0) {
  66968. angle += this.PI2;
  66969. }
  66970. return angle;
  66971. }
  66972. /**
  66973. * @function LevelRenderer.Tool.Areal.prototype.isInside
  66974. * @description 包含判断。
  66975. * @param {Object} shape - 图形。
  66976. * @param {number} area - 目标区域。
  66977. * @param {number} x - 横坐标。
  66978. * @param {number} y - 纵坐标。
  66979. * @returns {boolean} 图形是否包含鼠标位置。
  66980. */
  66981. isInside(shape, area, x, y) {
  66982. if (!area || !shape) {
  66983. // 无参数或不支持类型
  66984. return false;
  66985. }
  66986. var zoneType = shape.type;
  66987. this._ctx = this._ctx || this.util.getContext();
  66988. // 未实现或不可用时则数学运算,主要是line,brokenLine,ring
  66989. var _mathReturn = this._mathMethod(shape, area, x, y);
  66990. if (typeof _mathReturn != 'undefined') {
  66991. return _mathReturn;
  66992. }
  66993. if (shape.buildPath && this._ctx.isPointInPath) {
  66994. return this._buildPathMethod(shape, this._ctx, area, x, y);
  66995. }
  66996. // 上面的方法都行不通时
  66997. switch (zoneType) {
  66998. case 'ellipse': // Todo,不精确
  66999. case 'smicellipse': // Todo,不精确
  67000. return true;
  67001. // 旋轮曲线 不准确
  67002. case 'trochoid':
  67003. var _r = area.location == 'out'
  67004. ? area.r1 + area.r2 + area.d
  67005. : area.r1 - area.r2 + area.d;
  67006. return this.isInsideCircle(area, x, y, _r);
  67007. // 玫瑰线 不准确
  67008. case 'rose' :
  67009. return this.isInsideCircle(area, x, y, area.maxr);
  67010. // 路径,椭圆,曲线等-----------------13
  67011. default:
  67012. return false; // Todo,暂不支持
  67013. }
  67014. }
  67015. /**
  67016. * @function LevelRenderer.Tool.Areal.prototype._mathMethod
  67017. * @description 包含判断。用数学方法判断,三个方法中最快,但是支持的shape少。
  67018. * @param {Object} shape - 图形。
  67019. * @param {number} area - 目标区域。
  67020. * @param {number} x - 横坐标。
  67021. * @param {number} y - 纵坐标。
  67022. * @returns {boolean} 图形是否包含鼠标位置,true表示坐标处在图形中。
  67023. */
  67024. _mathMethod(shape, area, x, y) {
  67025. var zoneType = shape.type;
  67026. // 在矩形内则部分图形需要进一步判断
  67027. switch (zoneType) {
  67028. // 贝塞尔曲线
  67029. case 'bezier-curve':
  67030. if (typeof(area.cpX2) === 'undefined') {
  67031. return this.isInsideQuadraticStroke(
  67032. area.xStart, area.yStart,
  67033. area.cpX1, area.cpY1,
  67034. area.xEnd, area.yEnd,
  67035. area.lineWidth, x, y
  67036. );
  67037. }
  67038. return this.isInsideCubicStroke(
  67039. area.xStart, area.yStart,
  67040. area.cpX1, area.cpY1,
  67041. area.cpX2, area.cpY2,
  67042. area.xEnd, area.yEnd,
  67043. area.lineWidth, x, y
  67044. );
  67045. // 线
  67046. case 'line':
  67047. return this.isInsideLine(
  67048. area.xStart, area.yStart,
  67049. area.xEnd, area.yEnd,
  67050. area.lineWidth, x, y
  67051. );
  67052. // 折线
  67053. case 'broken-line':
  67054. return this.isInsideBrokenLine(
  67055. area.pointList, area.lineWidth, x, y
  67056. );
  67057. // 扩展折线
  67058. case 'smicbroken-line': {
  67059. // SMIC-修改 - start
  67060. let icX = x;
  67061. let icY = y;
  67062. if (shape.refOriginalPosition) {
  67063. icX = x - shape.refOriginalPosition[0];
  67064. icY = y - shape.refOriginalPosition[1];
  67065. }
  67066. return this.isInsideBrokenLine(
  67067. area.pointList, area.lineWidth, icX, icY
  67068. );
  67069. }
  67070. //初始代码:
  67071. // return isInsideBrokenLine(
  67072. // area.pointList, area.lineWidth, x, y
  67073. // );
  67074. // SMIC-修改 - end
  67075. // 圆环
  67076. case 'ring':
  67077. return this.isInsideRing(
  67078. area.x, area.y, area.r0, area.r, x, y
  67079. );
  67080. case 'smicring': {
  67081. let areaX = area.x;
  67082. let areaY = area.y;
  67083. if (shape.refOriginalPosition) {
  67084. areaX = area.x + shape.refOriginalPosition[0];
  67085. areaY = area.y + shape.refOriginalPosition[1];
  67086. }
  67087. return this.isInsideRing(
  67088. areaX, areaY, area.r0, area.r, x, y
  67089. );
  67090. }
  67091. // 圆形
  67092. case 'circle':
  67093. return this.isInsideCircle(
  67094. area.x, area.y, area.r, x, y
  67095. );
  67096. // 扩展-点
  67097. case 'smicpoint': {
  67098. // SMIC-修改 - start
  67099. let icX = x;
  67100. let icY = y;
  67101. if (shape.refOriginalPosition) {
  67102. icX = x - shape.refOriginalPosition[0];
  67103. icY = y - shape.refOriginalPosition[1];
  67104. }
  67105. return this.isInsideCircle(
  67106. area.x, area.y, area.r, icX, icY
  67107. );
  67108. }
  67109. //初始代码:
  67110. // 无
  67111. // SMIC-修改 - end
  67112. // 扇形
  67113. case 'sector': {
  67114. let startAngle = area.startAngle * Math.PI / 180;
  67115. let endAngle = area.endAngle * Math.PI / 180;
  67116. if (!area.clockWise) {
  67117. startAngle = -startAngle;
  67118. endAngle = -endAngle;
  67119. }
  67120. return this.isInsideSector(
  67121. area.x, area.y, area.r0, area.r,
  67122. startAngle, endAngle,
  67123. !area.clockWise,
  67124. x, y
  67125. );
  67126. }
  67127. //初始代码:
  67128. // 无
  67129. // SMIC-增加 - end
  67130. // 扇形
  67131. case 'smicsector': {
  67132. let startAngle = area.startAngle * Math.PI / 180;
  67133. let endAngle = area.endAngle * Math.PI / 180;
  67134. if (!area.clockWise) {
  67135. startAngle = -startAngle;
  67136. endAngle = -endAngle;
  67137. }
  67138. let areaX = area.x;
  67139. let areaY = area.y;
  67140. if (shape.refOriginalPosition) {
  67141. areaX = area.x + shape.refOriginalPosition[0];
  67142. areaY = area.y + shape.refOriginalPosition[1];
  67143. }
  67144. return this.isInsideSector(
  67145. areaX, areaY, area.r0, area.r,
  67146. startAngle, endAngle,
  67147. !area.clockWise,
  67148. x, y
  67149. );
  67150. }
  67151. // 多边形
  67152. case 'path':
  67153. return this.isInsidePath(
  67154. area.pathArray, Math.max(area.lineWidth, 5),
  67155. area.brushType, x, y
  67156. );
  67157. case 'polygon':
  67158. case 'star':
  67159. case 'smicstar':
  67160. case 'isogon':
  67161. case 'smicisogon':
  67162. return this.isInsidePolygon(area.pointList, x, y);
  67163. // 扩展多边形
  67164. case 'smicpolygon': {
  67165. // SMIC-修改 - start
  67166. let icX = x;
  67167. let icY = y;
  67168. if (shape.refOriginalPosition) {
  67169. icX = x - shape.refOriginalPosition[0];
  67170. icY = y - shape.refOriginalPosition[1];
  67171. }
  67172. //岛洞面
  67173. if (shape.holePolygonPointLists && shape.holePolygonPointLists.length > 0) {
  67174. var isOnBase = this.isInsidePolygon(area.pointList, icX, icY);
  67175. // 遍历岛洞子面
  67176. var holePLS = shape.holePolygonPointLists;
  67177. var isOnHole = false;
  67178. for (var i = 0, holePLSen = holePLS.length; i < holePLSen; i++) {
  67179. var holePL = holePLS[i];
  67180. var isOnSubHole = this.isInsidePolygon(holePL, icX, icY);
  67181. if (isOnSubHole === true) {
  67182. isOnHole = true;
  67183. }
  67184. }
  67185. // 捕获判断
  67186. return isOnBase === true && isOnHole === false;
  67187. } else {
  67188. return this.isInsidePolygon(area.pointList, icX, icY);
  67189. }
  67190. }
  67191. // 初始代码:
  67192. // 无
  67193. // SMIC-修改 - end
  67194. // 文本
  67195. case 'text':
  67196. var rect = area.__rect || shape.getRect(area);
  67197. return this.isInsideRect(
  67198. rect.x, rect.y, rect.width, rect.height, x, y
  67199. );
  67200. // 扩展文本
  67201. case 'smictext':
  67202. //用文本背景矩形判断
  67203. var textBg = shape.getTextBackground(area);
  67204. return this.isInsidePolygon(textBg, x, y);
  67205. //初始代码:
  67206. // 无
  67207. // SMIC-修改 - end
  67208. // 矩形
  67209. case 'rectangle':
  67210. case 'image':
  67211. // 图片
  67212. return this.isInsideRect(
  67213. area.x, area.y, area.width, area.height, x, y
  67214. );
  67215. case 'smicimage': {
  67216. let areaX = area.x;
  67217. let areaY = area.y;
  67218. if (shape.refOriginalPosition) {
  67219. areaX = area.x + shape.refOriginalPosition[0];
  67220. areaY = area.y + shape.refOriginalPosition[1];
  67221. }
  67222. return this.isInsideRect(
  67223. areaX, areaY, area.width, area.height, x, y
  67224. );
  67225. }
  67226. //// 扩展矩形
  67227. //case 'smicpolygon':
  67228. // // SMIC-修改 - start
  67229. // var icX = x;
  67230. // var icY = y;
  67231. // if(shape.refOriginalPosition) {
  67232. // icX = x - shape.refOriginalPosition[0];
  67233. // icY = y - shape.refOriginalPosition[1];
  67234. // }
  67235. // return this.isInsideRect(
  67236. // area.x, area.y, area.width, area.height, icX, icY
  67237. // );
  67238. //初始代码:
  67239. // 无
  67240. // SMIC-修改 - end
  67241. }
  67242. }
  67243. /**
  67244. * @function LevelRenderer.Tool.Areal.prototype._buildPathMethod
  67245. * @description 包含判断。通过buildPath方法来判断,三个方法中较快,但是不支持线条类型的 shape。
  67246. * @param {Object} shape - 图形。
  67247. * @param {Object} context - 上下文。
  67248. * @param {number} area - 目标区域。
  67249. * @param {number} x - 横坐标。
  67250. * @param {number} y - 纵坐标。
  67251. * @returns {boolean} 图形是否包含鼠标位置,true表示坐标处在图形中。
  67252. */
  67253. _buildPathMethod(shape, context, area, x, y) {
  67254. // 图形类实现路径创建了则用类的path
  67255. context.beginPath();
  67256. shape.buildPath(context, area);
  67257. context.closePath();
  67258. return context.isPointInPath(x, y);
  67259. }
  67260. /**
  67261. * @function LevelRenderer.Tool.Areal.prototype.isOutside
  67262. * @description 图形是否不包含鼠标位置。
  67263. * @param {Object} shape - 图形。
  67264. * @param {number} area - 目标区域。
  67265. * @param {number} x - 横坐标。
  67266. * @param {number} y - 纵坐标。
  67267. * @returns {boolean} 图形是否不包含鼠标位置, true表示坐标处在图形外。
  67268. */
  67269. isOutside(shape, area, x, y) {
  67270. return !this.isInside(shape, area, x, y);
  67271. }
  67272. /**
  67273. * @function LevelRenderer.Tool.Areal.prototype.isInsideLine
  67274. * @description 线段包含判断。
  67275. * @param {number} x0 - 线起始点横坐标。
  67276. * @param {number} y0 - 线起始点纵坐标。
  67277. * @param {number} x1 - 线终点横坐标。
  67278. * @param {number} y1 - 线终点纵坐标。
  67279. * @param {number} lineWidth - 线宽。
  67280. * @param {number} x - 鼠标位置横坐标。
  67281. * @param {number} y - 鼠标位置纵坐标。
  67282. * @returns {boolean} 图形是否包含鼠标位置,true表示坐标处在图形内。
  67283. */
  67284. isInsideLine(x0, y0, x1, y1, lineWidth, x, y) {
  67285. if (lineWidth === 0) {
  67286. return false;
  67287. }
  67288. var _l = Math.max(lineWidth, 5);
  67289. var _a = 0;
  67290. var _b = 0;
  67291. // Quick reject
  67292. if (
  67293. (y > y0 + _l && y > y1 + _l)
  67294. || (y < y0 - _l && y < y1 - _l)
  67295. || (x > x0 + _l && x > x1 + _l)
  67296. || (x < x0 - _l && x < x1 - _l)
  67297. ) {
  67298. return false;
  67299. }
  67300. if (x0 !== x1) {
  67301. _a = (y0 - y1) / (x0 - x1);
  67302. _b = (x0 * y1 - x1 * y0) / (x0 - x1);
  67303. } else {
  67304. return Math.abs(x - x0) <= _l / 2;
  67305. }
  67306. var tmp = _a * x - y + _b;
  67307. var _s = tmp * tmp / (_a * _a + 1);
  67308. return _s <= _l / 2 * _l / 2;
  67309. }
  67310. /**
  67311. * @function LevelRenderer.Tool.Areal.prototype.isInsideCubicStroke
  67312. * @description 三次贝塞尔曲线描边包含判断。
  67313. * @param {number} x0 - 点1横坐标。
  67314. * @param {number} y0 - 点1纵坐标。
  67315. * @param {number} x1 - 点2横坐标。
  67316. * @param {number} y1 - 点2纵坐标。
  67317. * @param {number} x2 - 点3纵坐标。
  67318. * @param {number} y2 - 点3纵坐标。
  67319. * @param {number} lineWidth - 线宽。
  67320. * @param {number} x - 鼠标位置横坐标。
  67321. * @param {number} y - 鼠标位置纵坐标。
  67322. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  67323. */
  67324. isInsideCubicStroke(x0, y0, x1, y1, x2, y2, x3, y3, lineWidth, x, y) {
  67325. if (lineWidth === 0) {
  67326. return false;
  67327. }
  67328. var _l = Math.max(lineWidth, 5);
  67329. // Quick reject
  67330. if (
  67331. (y > y0 + _l && y > y1 + _l && y > y2 + _l && y > y3 + _l)
  67332. || (y < y0 - _l && y < y1 - _l && y < y2 - _l && y < y3 - _l)
  67333. || (x > x0 + _l && x > x1 + _l && x > x2 + _l && x > x3 + _l)
  67334. || (x < x0 - _l && x < x1 - _l && x < x2 - _l && x < x3 - _l)
  67335. ) {
  67336. return false;
  67337. }
  67338. var d = this.curve.cubicProjectPoint(
  67339. x0, y0, x1, y1, x2, y2, x3, y3,
  67340. x, y, null
  67341. );
  67342. return d <= _l / 2;
  67343. }
  67344. /**
  67345. * @function LevelRenderer.Tool.Areal.prototype.isInsideQuadraticStroke
  67346. * @description 二次贝塞尔曲线描边包含判断。
  67347. * @param {number} x0 - 点1横坐标。
  67348. * @param {number} y0 - 点1纵坐标。
  67349. * @param {number} x1 - 点2横坐标。
  67350. * @param {number} y1 - 点2纵坐标。
  67351. * @param {number} x2 - 点3纵坐标。
  67352. * @param {number} y2 - 点3纵坐标。
  67353. * @param {number} lineWidth - 线宽。
  67354. * @param {number} x - 鼠标位置横坐标。
  67355. * @param {number} y - 鼠标位置纵坐标。
  67356. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  67357. */
  67358. isInsideQuadraticStroke(x0, y0, x1, y1, x2, y2, lineWidth, x, y) {
  67359. if (lineWidth === 0) {
  67360. return false;
  67361. }
  67362. var _l = Math.max(lineWidth, 5);
  67363. // Quick reject
  67364. if (
  67365. (y > y0 + _l && y > y1 + _l && y > y2 + _l)
  67366. || (y < y0 - _l && y < y1 - _l && y < y2 - _l)
  67367. || (x > x0 + _l && x > x1 + _l && x > x2 + _l)
  67368. || (x < x0 - _l && x < x1 - _l && x < x2 - _l)
  67369. ) {
  67370. return false;
  67371. }
  67372. var d = this.curve.quadraticProjectPoint(
  67373. x0, y0, x1, y1, x2, y2,
  67374. x, y, null
  67375. );
  67376. return d <= _l / 2;
  67377. }
  67378. /**
  67379. * @function LevelRenderer.Tool.Areal.prototype.isInsideArcStroke
  67380. * @description 圆弧描边包含判断。
  67381. * @param {number} cx - 圆心横坐标。
  67382. * @param {number} cy - 圆心纵坐标。
  67383. * @param {number} r - 圆半径。
  67384. * @param {number} startAngle - 起始角度。
  67385. * @param {number} endAngle - 终止角度。
  67386. * @param {number} anticlockwise - 顺时针还是逆时针。
  67387. * @param {number} lineWidth - 线宽。
  67388. * @param {number} x - 鼠标位置横坐标。
  67389. * @param {number} y - 鼠标位置纵坐标。
  67390. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  67391. */
  67392. isInsideArcStroke(cx, cy, r, startAngle, endAngle, anticlockwise, lineWidth, x, y) {
  67393. var PI2 = this.PI2;
  67394. if (lineWidth === 0) {
  67395. return false;
  67396. }
  67397. var _l = Math.max(lineWidth, 5);
  67398. x -= cx;
  67399. y -= cy;
  67400. var d = Math.sqrt(x * x + y * y);
  67401. if ((d - _l > r) || (d + _l < r)) {
  67402. return false;
  67403. }
  67404. if (Math.abs(startAngle - endAngle) >= PI2) {
  67405. // Is a circle
  67406. return true;
  67407. }
  67408. if (anticlockwise) {
  67409. var tmp = startAngle;
  67410. startAngle = this.normalizeRadian(endAngle);
  67411. endAngle = this.normalizeRadian(tmp);
  67412. } else {
  67413. startAngle = this.normalizeRadian(startAngle);
  67414. endAngle = this.normalizeRadian(endAngle);
  67415. }
  67416. if (startAngle > endAngle) {
  67417. endAngle += PI2;
  67418. }
  67419. var angle = Math.atan2(y, x);
  67420. if (angle < 0) {
  67421. angle += PI2;
  67422. }
  67423. return (angle >= startAngle && angle <= endAngle)
  67424. || (angle + PI2 >= startAngle && angle + PI2 <= endAngle);
  67425. }
  67426. /**
  67427. * @function LevelRenderer.Tool.Areal.prototype.isInsideBrokenLine
  67428. * @description 图形 BrokenLine 是否包含鼠标位置, true表示坐标处在图形内。
  67429. * @param {Array} points - 曲线点对象。
  67430. * @param {number} lineWidth - 线宽。
  67431. * @param {number} x - 鼠标位置横坐标。
  67432. * @param {number} y - 鼠标位置纵坐标。
  67433. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  67434. */
  67435. isInsideBrokenLine(points, lineWidth, x, y) {
  67436. var _lineWidth = Math.max(lineWidth, 10);
  67437. for (var i = 0, l = points.length - 1; i < l; i++) {
  67438. var x0 = points[i][0];
  67439. var y0 = points[i][1];
  67440. var x1 = points[i + 1][0];
  67441. var y1 = points[i + 1][1];
  67442. if (this.isInsideLine(x0, y0, x1, y1, _lineWidth, x, y)) {
  67443. return true;
  67444. }
  67445. }
  67446. return false;
  67447. }
  67448. /**
  67449. * @function LevelRenderer.Tool.Areal.prototype.isInsideRing
  67450. * @description 图形 Ring 是否包含鼠标位置, true表示坐标处在图形内。
  67451. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  67452. */
  67453. isInsideRing(cx, cy, r0, r, x, y) {
  67454. var d = (x - cx) * (x - cx) + (y - cy) * (y - cy);
  67455. return (d < r * r) && (d > r0 * r0);
  67456. }
  67457. /**
  67458. * @function LevelRenderer.Tool.Areal.prototype.isInsideRect
  67459. * @description 图形 Rect 是否包含鼠标位置, true表示坐标处在图形内。
  67460. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  67461. */
  67462. isInsideRect(x0, y0, width, height, x, y) {
  67463. return x >= x0 && x <= (x0 + width) && y >= y0 && y <= (y0 + height);
  67464. }
  67465. /**
  67466. * @function LevelRenderer.Tool.Areal.prototype.isInsideCircle
  67467. * @description 图形 Circle 是否包含鼠标位置, true表示坐标处在图形内。
  67468. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  67469. */
  67470. isInsideCircle(x0, y0, r, x, y) {
  67471. return (x - x0) * (x - x0) + (y - y0) * (y - y0) < r * r;
  67472. }
  67473. /**
  67474. * @function LevelRenderer.Tool.Areal.prototype.isInsideSector
  67475. * @description 图形 Sector 是否包含鼠标位置, true表示坐标处在图形内。
  67476. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  67477. */
  67478. isInsideSector(cx, cy, r0, r, startAngle, endAngle, anticlockwise, x, y) {
  67479. return this.isInsideArcStroke(cx, cy, (r0 + r) / 2, startAngle, endAngle, anticlockwise, r - r0, x, y);
  67480. }
  67481. /**
  67482. * @function LevelRenderer.Tool.Areal.prototype.isInsidePolygon
  67483. * @description 图形 Polygon 是否包含鼠标位置, true表示坐标处在图形内。与 canvas 一样采用 non-zero winding rule
  67484. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  67485. */
  67486. isInsidePolygon(points, x, y) {
  67487. var N = points.length;
  67488. var w = 0;
  67489. for (var i = 0, j = N - 1; i < N; i++) {
  67490. var x0 = points[j][0];
  67491. var y0 = points[j][1];
  67492. var x1 = points[i][0];
  67493. var y1 = points[i][1];
  67494. w += this.windingLine(x0, y0, x1, y1, x, y);
  67495. j = i;
  67496. }
  67497. return w !== 0;
  67498. }
  67499. /**
  67500. * @function LevelRenderer.Tool.Areal.prototype.windingLine
  67501. */
  67502. windingLine(x0, y0, x1, y1, x, y) {
  67503. if ((y > y0 && y > y1) || (y < y0 && y < y1)) {
  67504. return 0;
  67505. }
  67506. if (y1 == y0) {
  67507. return 0;
  67508. }
  67509. var dir = y1 < y0 ? 1 : -1;
  67510. var t = (y - y0) / (y1 - y0);
  67511. var x_ = t * (x1 - x0) + x0;
  67512. return x_ > x ? dir : 0;
  67513. }
  67514. /**
  67515. * @function LevelRenderer.Tool.Areal.prototype.swapExtrema
  67516. */
  67517. swapExtrema() {
  67518. var tmp = this.extrema[0];
  67519. this.extrema[0] = this.extrema[1];
  67520. this.extrema[1] = tmp;
  67521. }
  67522. /**
  67523. * @function LevelRenderer.Tool.Areal.prototype.windingCubic
  67524. */
  67525. windingCubic(x0, y0, x1, y1, x2, y2, x3, y3, x, y) {
  67526. var curve = this.curve;
  67527. var roots = this.roots;
  67528. var extrema = this.extrema;
  67529. // Quick reject
  67530. if (
  67531. (y > y0 && y > y1 && y > y2 && y > y3)
  67532. || (y < y0 && y < y1 && y < y2 && y < y3)
  67533. ) {
  67534. return 0;
  67535. }
  67536. var nRoots = curve.cubicRootAt(y0, y1, y2, y3, y, roots);
  67537. if (nRoots === 0) {
  67538. return 0;
  67539. } else {
  67540. var w = 0;
  67541. var nExtrema = -1;
  67542. var y0_, y1_;
  67543. for (var i = 0; i < nRoots; i++) {
  67544. var t = roots[i];
  67545. var x_ = curve.cubicAt(x0, x1, x2, x3, t);
  67546. if (x_ < x) { // Quick reject
  67547. continue;
  67548. }
  67549. if (nExtrema < 0) {
  67550. nExtrema = curve.cubicExtrema(y0, y1, y2, y3, extrema);
  67551. if (extrema[1] < extrema[0] && nExtrema > 1) {
  67552. this.swapExtrema();
  67553. }
  67554. y0_ = curve.cubicAt(y0, y1, y2, y3, extrema[0]);
  67555. if (nExtrema > 1) {
  67556. y1_ = curve.cubicAt(y0, y1, y2, y3, extrema[1]);
  67557. }
  67558. }
  67559. if (nExtrema == 2) {
  67560. // 分成三段单调函数
  67561. if (t < extrema[0]) {
  67562. w += y0_ < y0 ? 1 : -1;
  67563. } else if (t < extrema[1]) {
  67564. w += y1_ < y0_ ? 1 : -1;
  67565. } else {
  67566. w += y3 < y1_ ? 1 : -1;
  67567. }
  67568. } else {
  67569. // 分成两段单调函数
  67570. if (t < extrema[0]) {
  67571. w += y0_ < y0 ? 1 : -1;
  67572. } else {
  67573. w += y3 < y0_ ? 1 : -1;
  67574. }
  67575. }
  67576. }
  67577. return w;
  67578. }
  67579. }
  67580. /**
  67581. * @function LevelRenderer.Tool.Areal.prototype.windingQuadratic
  67582. */
  67583. windingQuadratic(x0, y0, x1, y1, x2, y2, x, y) {
  67584. var curve = this.curve;
  67585. var roots = this.roots;
  67586. // Quick reject
  67587. if (
  67588. (y > y0 && y > y1 && y > y2)
  67589. || (y < y0 && y < y1 && y < y2)
  67590. ) {
  67591. return 0;
  67592. }
  67593. var nRoots = curve.quadraticRootAt(y0, y1, y2, y, roots);
  67594. if (nRoots === 0) {
  67595. return 0;
  67596. } else {
  67597. var t = curve.quadraticExtremum(y0, y1, y2);
  67598. if (t >= 0 && t <= 1) {
  67599. var w = 0;
  67600. var y_ = curve.quadraticAt(y0, y1, y2, t);
  67601. for (let i = 0; i < nRoots; i++) {
  67602. let x_ = curve.quadraticAt(x0, x1, x2, roots[i]);
  67603. if (x_ > x) {
  67604. continue;
  67605. }
  67606. if (roots[i] < t) {
  67607. w += y_ < y0 ? 1 : -1;
  67608. } else {
  67609. w += y2 < y_ ? 1 : -1;
  67610. }
  67611. }
  67612. return w;
  67613. } else {
  67614. let x_ = curve.quadraticAt(x0, x1, x2, roots[0]);
  67615. if (x_ > x) {
  67616. return 0;
  67617. }
  67618. return y2 < y0 ? 1 : -1;
  67619. }
  67620. }
  67621. }
  67622. /**
  67623. * @function LevelRenderer.Tool.Areal.prototype.windingArc
  67624. * // TODO Arc 旋转
  67625. */
  67626. windingArc(cx, cy, r, startAngle, endAngle, anticlockwise, x, y) {
  67627. var roots = this.roots;
  67628. var PI2 = this.PI2;
  67629. y -= cy;
  67630. if (y > r || y < -r) {
  67631. return 0;
  67632. }
  67633. let tmp = Math.sqrt(r * r - y * y);
  67634. roots[0] = -tmp;
  67635. roots[1] = tmp;
  67636. if (Math.abs(startAngle - endAngle) >= PI2) {
  67637. // Is a circle
  67638. startAngle = 0;
  67639. endAngle = PI2;
  67640. var dir = anticlockwise ? 1 : -1;
  67641. if (x >= roots[0] + cx && x <= roots[1] + cx) {
  67642. return dir;
  67643. } else {
  67644. return 0;
  67645. }
  67646. }
  67647. if (anticlockwise) {
  67648. let tmp = startAngle;
  67649. startAngle = this.normalizeRadian(endAngle);
  67650. endAngle = this.normalizeRadian(tmp);
  67651. } else {
  67652. startAngle = this.normalizeRadian(startAngle);
  67653. endAngle = this.normalizeRadian(endAngle);
  67654. }
  67655. if (startAngle > endAngle) {
  67656. endAngle += PI2;
  67657. }
  67658. var w = 0;
  67659. for (let i = 0; i < 2; i++) {
  67660. var x_ = roots[i];
  67661. if (x_ + cx > x) {
  67662. let angle = Math.atan2(y, x_);
  67663. let dir = anticlockwise ? 1 : -1;
  67664. if (angle < 0) {
  67665. angle = PI2 + angle;
  67666. }
  67667. if (
  67668. (angle >= startAngle && angle <= endAngle)
  67669. || (angle + PI2 >= startAngle && angle + PI2 <= endAngle)
  67670. ) {
  67671. if (angle > Math.PI / 2 && angle < Math.PI * 1.5) {
  67672. dir = -dir;
  67673. }
  67674. w += dir;
  67675. }
  67676. }
  67677. }
  67678. return w;
  67679. }
  67680. /**
  67681. * @function LevelRenderer.Tool.Areal.prototype.isInsidePath
  67682. * @description 与 canvas 一样采用 non-zero winding rule
  67683. */
  67684. isInsidePath(pathArray, lineWidth, brushType, x, y) {
  67685. var w = 0;
  67686. var xi = 0;
  67687. var yi = 0;
  67688. var x0 = 0;
  67689. var y0 = 0;
  67690. var beginSubpath = true;
  67691. var firstCmd = true;
  67692. brushType = brushType || 'fill';
  67693. var hasStroke = brushType === 'stroke' || brushType === 'both';
  67694. var hasFill = brushType === 'fill' || brushType === 'both';
  67695. // var roots = [-1, -1, -1];
  67696. for (var i = 0; i < pathArray.length; i++) {
  67697. var seg = pathArray[i];
  67698. var p = seg.points;
  67699. // Begin a new subpath
  67700. if (beginSubpath || seg.command === 'M') {
  67701. if (i > 0) {
  67702. // Close previous subpath
  67703. if (hasFill) {
  67704. w += this.windingLine(xi, yi, x0, y0, x, y);
  67705. }
  67706. if (w !== 0) {
  67707. return true;
  67708. }
  67709. }
  67710. x0 = p[p.length - 2];
  67711. y0 = p[p.length - 1];
  67712. beginSubpath = false;
  67713. if (firstCmd && seg.command !== 'A') {
  67714. // 如果第一个命令不是M, 是lineTo, bezierCurveTo
  67715. // 等绘制命令的话,是会从该绘制的起点开始算的
  67716. // Arc 会在之后做单独处理所以这里忽略
  67717. firstCmd = false;
  67718. xi = x0;
  67719. yi = y0;
  67720. }
  67721. }
  67722. switch (seg.command) {
  67723. case 'M':
  67724. xi = p[0];
  67725. yi = p[1];
  67726. break;
  67727. case 'L':
  67728. if (hasStroke) {
  67729. if (this.isInsideLine(
  67730. xi, yi, p[0], p[1], lineWidth, x, y
  67731. )) {
  67732. return true;
  67733. }
  67734. }
  67735. if (hasFill) {
  67736. w += this.windingLine(xi, yi, p[0], p[1], x, y);
  67737. }
  67738. xi = p[0];
  67739. yi = p[1];
  67740. break;
  67741. case 'C':
  67742. if (hasStroke) {
  67743. if (this.isInsideCubicStroke(
  67744. xi, yi, p[0], p[1], p[2], p[3], p[4], p[5],
  67745. lineWidth, x, y
  67746. )) {
  67747. return true;
  67748. }
  67749. }
  67750. if (hasFill) {
  67751. w += this.windingCubic(
  67752. xi, yi, p[0], p[1], p[2], p[3], p[4], p[5], x, y
  67753. );
  67754. }
  67755. xi = p[4];
  67756. yi = p[5];
  67757. break;
  67758. case 'Q':
  67759. if (hasStroke) {
  67760. if (this.isInsideQuadraticStroke(
  67761. xi, yi, p[0], p[1], p[2], p[3],
  67762. lineWidth, x, y
  67763. )) {
  67764. return true;
  67765. }
  67766. }
  67767. if (hasFill) {
  67768. w += this.windingQuadratic(
  67769. xi, yi, p[0], p[1], p[2], p[3], x, y
  67770. );
  67771. }
  67772. xi = p[2];
  67773. yi = p[3];
  67774. break;
  67775. case 'A':
  67776. // TODO Arc 旋转
  67777. // TODO Arc 判断的开销比较大
  67778. var cx = p[0];
  67779. var cy = p[1];
  67780. var rx = p[2];
  67781. var ry = p[3];
  67782. var theta = p[4];
  67783. var dTheta = p[5];
  67784. var x1 = Math.cos(theta) * rx + cx;
  67785. var y1 = Math.sin(theta) * ry + cy;
  67786. // 不是直接使用 arc 命令
  67787. if (!firstCmd) {
  67788. w += this.windingLine(xi, yi, x1, y1);
  67789. } else {
  67790. firstCmd = false;
  67791. // 第一个命令起点还未定义
  67792. x0 = x1;
  67793. y0 = y1;
  67794. }
  67795. // zr 使用scale来模拟椭圆, 这里也对x做一定的缩放
  67796. var _x = (x - cx) * ry / rx + cx;
  67797. if (hasStroke) {
  67798. if (this.isInsideArcStroke(
  67799. cx, cy, ry, theta, theta + dTheta, 1 - p[7],
  67800. lineWidth, _x, y
  67801. )) {
  67802. return true;
  67803. }
  67804. }
  67805. if (hasFill) {
  67806. w += this.windingArc(
  67807. cx, cy, ry, theta, theta + dTheta, 1 - p[7],
  67808. _x, y
  67809. );
  67810. }
  67811. xi = Math.cos(theta + dTheta) * rx + cx;
  67812. yi = Math.sin(theta + dTheta) * ry + cy;
  67813. break;
  67814. case 'z':
  67815. if (hasStroke) {
  67816. if (this.isInsideLine(
  67817. xi, yi, x0, y0, lineWidth, x, y
  67818. )) {
  67819. return true;
  67820. }
  67821. }
  67822. beginSubpath = true;
  67823. break;
  67824. }
  67825. }
  67826. if (hasFill) {
  67827. w += this.windingLine(xi, yi, x0, y0, x, y);
  67828. }
  67829. return w !== 0;
  67830. }
  67831. /**
  67832. * @function LevelRenderer.Tool.Areal.prototype.getTextWidth
  67833. * @description 测算多行文本宽度
  67834. */
  67835. getTextWidth(text, textFont) {
  67836. var key = text + ':' + textFont;
  67837. if (this._textWidthCache[key]) {
  67838. return this._textWidthCache[key];
  67839. }
  67840. this._ctx = this._ctx || this.util.getContext();
  67841. this._ctx.save();
  67842. if (textFont) {
  67843. this._ctx.font = textFont;
  67844. }
  67845. text = (text + '').split('\n');
  67846. var width = 0;
  67847. for (var i = 0, l = text.length; i < l; i++) {
  67848. width = Math.max(
  67849. this._ctx.measureText(text[i]).width,
  67850. width
  67851. );
  67852. }
  67853. this._ctx.restore();
  67854. this._textWidthCache[key] = width;
  67855. if (++this._textWidthCacheCounter > this.TEXT_CACHE_MAX) {
  67856. // 内存释放
  67857. this._textWidthCacheCounter = 0;
  67858. this._textWidthCache = {};
  67859. }
  67860. return width;
  67861. }
  67862. /**
  67863. * @function LevelRenderer.Tool.Areal.prototype.getTextHeight
  67864. * @description 测算多行文本高度
  67865. */
  67866. getTextHeight(text, textFont) {
  67867. var key = text + ':' + textFont;
  67868. if (this._textHeightCache[key]) {
  67869. return this._textHeightCache[key];
  67870. }
  67871. this._ctx = this._ctx || this.util.getContext();
  67872. this._ctx.save();
  67873. if (textFont) {
  67874. this._ctx.font = textFont;
  67875. }
  67876. text = (text + '').split('\n');
  67877. // 比较粗暴
  67878. //var height = (this._ctx.measureText('国').width + 2) * text.length; //打包不支持中文,替换掉
  67879. var height = (this._ctx.measureText('ZH').width + 2) * text.length;
  67880. this._ctx.restore();
  67881. this._textHeightCache[key] = height;
  67882. if (++this._textHeightCacheCounter > this.TEXT_CACHE_MAX) {
  67883. // 内存释放
  67884. this._textHeightCacheCounter = 0;
  67885. this._textHeightCache = {};
  67886. }
  67887. return height;
  67888. }
  67889. }
  67890. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/ComputeBoundingBox.js
  67891. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  67892. * This program are made available under the terms of the Apache License, Version 2.0
  67893. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67894. /**
  67895. * @class LevelRenderer.Tool.ComputeBoundingBox
  67896. * @category Visualization Theme
  67897. * @classdesc LevelRenderer 工具-图形 Bounds 计算
  67898. * @private
  67899. */
  67900. class ComputeBoundingBox {
  67901. constructor() {
  67902. if (arguments.length === 3) {
  67903. this.computeBoundingBox(arguments);
  67904. }
  67905. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.ComputeBoundingBox";
  67906. }
  67907. /**
  67908. * @function LevelRenderer.Tool.ComputeBoundingBox.prototype.computeBoundingBox
  67909. * @description 从顶点数组中计算出最小包围盒,写入'min'和'max'中。
  67910. * @param {Array.<Object>} points - 顶点数组。
  67911. * @param {Array.<number>} min - 最小
  67912. * @param {Array.<number>} max - 最大
  67913. */
  67914. computeBoundingBox(points, min, max) {
  67915. if (points.length === 0) {
  67916. return;
  67917. }
  67918. var left = points[0][0];
  67919. var right = points[0][0];
  67920. var top = points[0][1];
  67921. var bottom = points[0][1];
  67922. for (var i = 1; i < points.length; i++) {
  67923. var p = points[i];
  67924. if (p[0] < left) {
  67925. left = p[0];
  67926. }
  67927. if (p[0] > right) {
  67928. right = p[0];
  67929. }
  67930. if (p[1] < top) {
  67931. top = p[1];
  67932. }
  67933. if (p[1] > bottom) {
  67934. bottom = p[1];
  67935. }
  67936. }
  67937. min[0] = left;
  67938. min[1] = top;
  67939. max[0] = right;
  67940. max[1] = bottom;
  67941. }
  67942. /**
  67943. * @function LevelRenderer.Tool.ComputeBoundingBox.prototype.cubeBezier
  67944. * @description 从三阶贝塞尔曲线(p0, p1, p2, p3)中计算出最小包围盒,写入'min'和'max'中。原:computeCubeBezierBoundingBox。
  67945. * @param {Array.<number>} p0 - 三阶贝塞尔曲线p0点
  67946. * @param {Array.<number>} p1 - 三阶贝塞尔曲线p1点
  67947. * @param {Array.<number>} p2 - 三阶贝塞尔曲线p2点
  67948. * @param {Array.<number>} p3 - 三阶贝塞尔曲线p3点
  67949. * @param {Array.<number>} min - 最小
  67950. * @param {Array.<number>} max - 最大
  67951. */
  67952. cubeBezier(p0, p1, p2, p3, min, max) {
  67953. var curve = new Curve_Curve();
  67954. var xDim = [];
  67955. curve.cubicExtrema(p0[0], p1[0], p2[0], p3[0], xDim);
  67956. for (let i = 0; i < xDim.length; i++) {
  67957. xDim[i] = curve.cubicAt(p0[0], p1[0], p2[0], p3[0], xDim[i]);
  67958. }
  67959. var yDim = [];
  67960. curve.cubicExtrema(p0[1], p1[1], p2[1], p3[1], yDim);
  67961. for (let i = 0; i < yDim.length; i++) {
  67962. yDim[i] = curve.cubicAt(p0[1], p1[1], p2[1], p3[1], yDim[i]);
  67963. }
  67964. xDim.push(p0[0], p3[0]);
  67965. yDim.push(p0[1], p3[1]);
  67966. var left = Math.min.apply(null, xDim);
  67967. var right = Math.max.apply(null, xDim);
  67968. var top = Math.min.apply(null, yDim);
  67969. var bottom = Math.max.apply(null, yDim);
  67970. min[0] = left;
  67971. min[1] = top;
  67972. max[0] = right;
  67973. max[1] = bottom;
  67974. }
  67975. /**
  67976. * @function LevelRenderer.Tool.ComputeBoundingBox.prototype.quadraticBezier
  67977. * @description 从二阶贝塞尔曲线(p0, p1, p2)中计算出最小包围盒,写入'min'和'max'中。原:computeQuadraticBezierBoundingBox。
  67978. * @param {Array.<number>} p0 - 二阶贝塞尔曲线p0点
  67979. * @param {Array.<number>} p1 - 二阶贝塞尔曲线p1点
  67980. * @param {Array.<number>} p2 - 二阶贝塞尔曲线p2点
  67981. * @param {Array.<number>} min - 最小
  67982. * @param {Array.<number>} max - 最大
  67983. */
  67984. quadraticBezier(p0, p1, p2, min, max) {
  67985. var curve = new Curve_Curve();
  67986. // Find extremities, where derivative in x dim or y dim is zero
  67987. var t1 = curve.quadraticExtremum(p0[0], p1[0], p2[0]);
  67988. var t2 = curve.quadraticExtremum(p0[1], p1[1], p2[1]);
  67989. t1 = Math.max(Math.min(t1, 1), 0);
  67990. t2 = Math.max(Math.min(t2, 1), 0);
  67991. var ct1 = 1 - t1;
  67992. var ct2 = 1 - t2;
  67993. var x1 = ct1 * ct1 * p0[0]
  67994. + 2 * ct1 * t1 * p1[0]
  67995. + t1 * t1 * p2[0];
  67996. var y1 = ct1 * ct1 * p0[1]
  67997. + 2 * ct1 * t1 * p1[1]
  67998. + t1 * t1 * p2[1];
  67999. var x2 = ct2 * ct2 * p0[0]
  68000. + 2 * ct2 * t2 * p1[0]
  68001. + t2 * t2 * p2[0];
  68002. var y2 = ct2 * ct2 * p0[1]
  68003. + 2 * ct2 * t2 * p1[1]
  68004. + t2 * t2 * p2[1];
  68005. min[0] = Math.min(p0[0], p2[0], x1, x2);
  68006. min[1] = Math.min(p0[1], p2[1], y1, y2);
  68007. max[0] = Math.max(p0[0], p2[0], x1, x2);
  68008. max[1] = Math.max(p0[1], p2[1], y1, y2);
  68009. }
  68010. /**
  68011. * @function LevelRenderer.Tool.ComputeBoundingBox.prototype.arc
  68012. * @description 从圆弧中计算出最小包围盒,写入'min'和'max'中。原:computeArcBoundingBox。
  68013. * @param {number} x - 圆弧中心点 x
  68014. * @param {number} y - 圆弧中心点 y
  68015. * @param {number} r - 圆弧半径
  68016. * @param {number} startAngle - 圆弧开始角度
  68017. * @param {number} endAngle - 圆弧结束角度
  68018. * @param {number} anticlockwise - 是否是顺时针
  68019. * @param {number} min - 最小
  68020. * @param {number} max - 最大
  68021. */
  68022. arc(x, y, r, startAngle, endAngle, anticlockwise, min, max) {
  68023. var vec2 = new levelRenderer_Vector_Vector();
  68024. var start = vec2.create();
  68025. var end = vec2.create();
  68026. var extremity = vec2.create();
  68027. start[0] = Math.cos(startAngle) * r + x;
  68028. start[1] = Math.sin(startAngle) * r + y;
  68029. end[0] = Math.cos(endAngle) * r + x;
  68030. end[1] = Math.sin(endAngle) * r + y;
  68031. vec2.min(min, start, end);
  68032. vec2.max(max, start, end);
  68033. // Thresh to [0, Math.PI * 2]
  68034. startAngle = startAngle % (Math.PI * 2);
  68035. if (startAngle < 0) {
  68036. startAngle = startAngle + Math.PI * 2;
  68037. }
  68038. endAngle = endAngle % (Math.PI * 2);
  68039. if (endAngle < 0) {
  68040. endAngle = endAngle + Math.PI * 2;
  68041. }
  68042. if (startAngle > endAngle && !anticlockwise) {
  68043. endAngle += Math.PI * 2;
  68044. } else if (startAngle < endAngle && anticlockwise) {
  68045. startAngle += Math.PI * 2;
  68046. }
  68047. if (anticlockwise) {
  68048. var tmp = endAngle;
  68049. endAngle = startAngle;
  68050. startAngle = tmp;
  68051. }
  68052. // var number = 0;
  68053. // var step = (anticlockwise ? -Math.PI : Math.PI) / 2;
  68054. for (var angle = 0; angle < endAngle; angle += Math.PI / 2) {
  68055. if (angle > startAngle) {
  68056. extremity[0] = Math.cos(angle) * r + x;
  68057. extremity[1] = Math.sin(angle) * r + y;
  68058. vec2.min(min, extremity, min);
  68059. vec2.max(max, extremity, max);
  68060. }
  68061. }
  68062. }
  68063. }
  68064. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Env.js
  68065. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  68066. * This program are made available under the terms of the Apache License, Version 2.0
  68067. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68068. /**
  68069. * @class LevelRenderer.Tool.Env
  68070. * @category Visualization Theme
  68071. * @classdesc 环境识别
  68072. * @private
  68073. */
  68074. class Env {
  68075. constructor() {
  68076. // Zepto.js
  68077. // (c) 2010-2013 Thomas Fuchs
  68078. // Zepto.js may be freely distributed under the MIT license.
  68079. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Env";
  68080. var me = this;
  68081. function detect(ua) {
  68082. var os = me.os = {};
  68083. var browser = me.browser = {};
  68084. var webkit = ua.match(/Web[kK]it[\/]{0,1}([\d.]+)/);
  68085. var android = ua.match(/(Android);?[\s\/]+([\d.]+)?/);
  68086. var ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
  68087. var ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
  68088. var iphone = !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/);
  68089. var webos = ua.match(/(webOS|hpwOS)[\s\/]([\d.]+)/);
  68090. var touchpad = webos && ua.match(/TouchPad/);
  68091. var kindle = ua.match(/Kindle\/([\d.]+)/);
  68092. var silk = ua.match(/Silk\/([\d._]+)/);
  68093. var blackberry = ua.match(/(BlackBerry).*Version\/([\d.]+)/);
  68094. var bb10 = ua.match(/(BB10).*Version\/([\d.]+)/);
  68095. var rimtabletos = ua.match(/(RIM\sTablet\sOS)\s([\d.]+)/);
  68096. var playbook = ua.match(/PlayBook/);
  68097. var chrome = ua.match(/Chrome\/([\d.]+)/) || ua.match(/CriOS\/([\d.]+)/);
  68098. var firefox = ua.match(/Firefox\/([\d.]+)/);
  68099. var ie = ua.match(/MSIE ([\d.]+)/);
  68100. var safari = webkit && ua.match(/Mobile\//) && !chrome;
  68101. var webview = ua.match(/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/) && !chrome;
  68102. // Todo: clean this up with a better OS/browser seperation:
  68103. // - discern (more) between multiple browsers on android
  68104. // - decide if kindle fire in silk mode is android or not
  68105. // - Firefox on Android doesn't specify the Android version
  68106. // - possibly devide in os, device and browser hashes
  68107. /*eslint-disable*/
  68108. if (browser.webkit = !!webkit) {
  68109. browser.version = webkit[1];
  68110. }
  68111. if (android) {
  68112. os.android = true;
  68113. os.version = android[2];
  68114. }
  68115. if (iphone && !ipod) {
  68116. os.ios = os.iphone = true;
  68117. os.version = iphone[2].replace(/_/g, '.');
  68118. }
  68119. if (ipad) {
  68120. os.ios = os.ipad = true;
  68121. os.version = ipad[2].replace(/_/g, '.');
  68122. }
  68123. if (ipod) {
  68124. os.ios = os.ipod = true;
  68125. os.version = ipod[3] ? ipod[3].replace(/_/g, '.') : null;
  68126. }
  68127. if (webos) {
  68128. os.webos = true;
  68129. os.version = webos[2];
  68130. }
  68131. if (touchpad) {
  68132. os.touchpad = true;
  68133. }
  68134. if (blackberry) {
  68135. os.blackberry = true;
  68136. os.version = blackberry[2];
  68137. }
  68138. if (bb10) {
  68139. os.bb10 = true;
  68140. os.version = bb10[2];
  68141. }
  68142. if (rimtabletos) {
  68143. os.rimtabletos = true;
  68144. os.version = rimtabletos[2];
  68145. }
  68146. if (playbook) {
  68147. browser.playbook = true;
  68148. }
  68149. if (kindle) {
  68150. os.kindle = true;
  68151. os.version = kindle[1];
  68152. }
  68153. if (silk) {
  68154. browser.silk = true;
  68155. browser.version = silk[1];
  68156. }
  68157. if (!silk && os.android && ua.match(/Kindle Fire/)) {
  68158. browser.silk = true;
  68159. }
  68160. if (chrome) {
  68161. browser.chrome = true;
  68162. browser.version = chrome[1];
  68163. }
  68164. if (firefox) {
  68165. browser.firefox = true;
  68166. browser.version = firefox[1];
  68167. }
  68168. if (ie) {
  68169. browser.ie = true;
  68170. browser.version = ie[1];
  68171. }
  68172. if (safari && (ua.match(/Safari/) || !!os.ios)) {
  68173. browser.safari = true;
  68174. }
  68175. if (webview) {
  68176. browser.webview = true;
  68177. }
  68178. if (ie) {
  68179. browser.ie = true;
  68180. browser.version = ie[1];
  68181. }
  68182. os.tablet = !!(ipad || playbook || (android && !ua.match(/Mobile/)) ||
  68183. (firefox && ua.match(/Tablet/)) || (ie && !ua.match(/Phone/) && ua.match(/Touch/)));
  68184. os.phone = !!(!os.tablet && !os.ipod && (android || iphone || webos || blackberry || bb10 ||
  68185. (chrome && ua.match(/Android/)) || (chrome && ua.match(/CriOS\/([\d.]+)/)) ||
  68186. (firefox && ua.match(/Mobile/)) || (ie && ua.match(/Touch/))));
  68187. return {
  68188. browser: browser,
  68189. os: os,
  68190. // 原生canvas支持
  68191. canvasSupported: document.createElement('canvas').getContext ? true : false
  68192. };
  68193. }
  68194. return detect(navigator.userAgent);
  68195. }
  68196. destory() {
  68197. return true;
  68198. }
  68199. }
  68200. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Event.js
  68201. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  68202. * This program are made available under the terms of the Apache License, Version 2.0
  68203. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68204. /**
  68205. * @class LevelRenderer.Tool.Event
  68206. * @category Visualization Theme
  68207. * @classdesc LevelRenderer 工具-事件辅助类
  68208. * @private
  68209. */
  68210. class Event_Event {
  68211. constructor() {
  68212. /**
  68213. * @member {function} LevelRenderer.Tool.Event.prototype.stop
  68214. * @description 停止冒泡和阻止默认行为
  68215. */
  68216. this.stop = typeof window.addEventListener === 'function'
  68217. ? function (e) {
  68218. e.preventDefault();
  68219. e.stopPropagation();
  68220. e.cancelBubble = true;
  68221. }
  68222. : function (e) {
  68223. e.returnValue = false;
  68224. e.cancelBubble = true;
  68225. };
  68226. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Event";
  68227. }
  68228. /**
  68229. * @function LevelRenderer.Tool.Event.prototype.getX
  68230. * @description 提取鼠标(手指)x坐标。
  68231. * @param {Event} e - 事件。
  68232. * @returns {number} 鼠标(手指)x坐标。
  68233. */
  68234. getX(e) {
  68235. return typeof e.zrenderX != 'undefined' && e.zrenderX
  68236. || typeof e.offsetX != 'undefined' && e.offsetX
  68237. || typeof e.layerX != 'undefined' && e.layerX
  68238. || typeof e.clientX != 'undefined' && e.clientX;
  68239. }
  68240. /**
  68241. * @function LevelRenderer.Tool.Event.prototype.getY
  68242. * @description 提取鼠标(手指)y坐标。
  68243. * @param {Event} e - 事件。
  68244. * @returns {number} 鼠标(手指)y坐标。
  68245. */
  68246. getY(e) {
  68247. return typeof e.zrenderY != 'undefined' && e.zrenderY
  68248. || typeof e.offsetY != 'undefined' && e.offsetY
  68249. || typeof e.layerY != 'undefined' && e.layerY
  68250. || typeof e.clientY != 'undefined' && e.clientY;
  68251. }
  68252. /**
  68253. * @function LevelRenderer.Tool.Event.prototype.getDelta
  68254. * @description 提取鼠标滚轮变化。
  68255. * @param {Event} e - 事件。
  68256. * @returns {number} 滚轮变化,正值说明滚轮是向上滚动,如果是负值说明滚轮是向下滚动。
  68257. */
  68258. getDelta(e) {
  68259. return typeof e.zrenderDelta != 'undefined' && e.zrenderDelta
  68260. || typeof e.wheelDelta != 'undefined' && e.wheelDelta
  68261. || typeof e.detail != 'undefined' && -e.detail;
  68262. }
  68263. }
  68264. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Http.js
  68265. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  68266. * This program are made available under the terms of the Apache License, Version 2.0
  68267. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68268. /**
  68269. * @private
  68270. * @class LevelRenderer.Tool.Http
  68271. * @category Visualization Theme
  68272. * @classdesc LevelRenderer 工具-Http
  68273. */
  68274. class Http {
  68275. constructor() {
  68276. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Http"
  68277. }
  68278. /**
  68279. * @function LevelRenderer.Tool.Http.prototype.get
  68280. * @description get请求。
  68281. * @param {(string|IHTTPGetOption)} url - 请求url
  68282. * @param {function} onsuccess - 请求成功函数
  68283. * @param {function} onerror - 请求失败函数
  68284. * @param {Object} opts - 额外参数
  68285. * @returns {number} cos值
  68286. */
  68287. get(url, onsuccess, onerror) {
  68288. if (typeof(url) === 'object') {
  68289. var obj = url;
  68290. url = obj.url;
  68291. onsuccess = obj.onsuccess;
  68292. onerror = obj.onerror;
  68293. }
  68294. var xhr = window.XMLHttpRequest
  68295. ? new XMLHttpRequest()
  68296. : new window.ActiveXObject('Microsoft.XMLHTTP');
  68297. xhr.open('GET', url, true);
  68298. xhr.onreadystatechange = function () {
  68299. if (xhr.readyState == 4) {
  68300. if (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) {
  68301. onsuccess && onsuccess(xhr.responseText);
  68302. } else {
  68303. onerror && onerror();
  68304. }
  68305. xhr.onreadystatechange = new Function();
  68306. xhr = null;
  68307. }
  68308. };
  68309. xhr.send(null);
  68310. }
  68311. }
  68312. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Config.js
  68313. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  68314. * This program are made available under the terms of the Apache License, Version 2.0
  68315. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68316. class Config_Config {
  68317. }
  68318. /**
  68319. * @enum EVENT
  68320. * @description 事件
  68321. * @type {Object}
  68322. * @private
  68323. */
  68324. Config_Config.EVENT = {
  68325. //窗口大小变化
  68326. RESIZE: 'resize',
  68327. //鼠标按钮被(手指)按下,事件对象是:目标图形元素或空
  68328. CLICK: 'click',
  68329. //双击事件
  68330. DBLCLICK: 'dblclick',
  68331. //鼠标滚轮变化,事件对象是:目标图形元素或空
  68332. MOUSEWHEEL: 'mousewheel',
  68333. //鼠标(手指)被移动,事件对象是:目标图形元素或空
  68334. MOUSEMOVE: 'mousemove',
  68335. //鼠标移到某图形元素之上,事件对象是:目标图形元素
  68336. MOUSEOVER: 'mouseover',
  68337. //鼠标从某图形元素移开,事件对象是:目标图形元素
  68338. MOUSEOUT: 'mouseout',
  68339. //鼠标按钮(手指)被按下,事件对象是:目标图形元素或空
  68340. MOUSEDOWN: 'mousedown',
  68341. //鼠标按键(手指)被松开,事件对象是:目标图形元素或空
  68342. MOUSEUP: 'mouseup',
  68343. //全局离开,MOUSEOUT触发比较频繁,一次离开优化绑定
  68344. GLOBALOUT: 'globalout',
  68345. // 一次成功元素拖拽的行为事件过程是:
  68346. // dragstart > dragenter > dragover [> dragleave] > drop > dragend
  68347. //开始拖拽时触发,事件对象是:被拖拽图形元素
  68348. DRAGSTART: 'dragstart',
  68349. //拖拽完毕时触发(在drop之后触发),事件对象是:被拖拽图形元素
  68350. DRAGEND: 'dragend',
  68351. //拖拽图形元素进入目标图形元素时触发,事件对象是:目标图形元素
  68352. DRAGENTER: 'dragenter',
  68353. //拖拽图形元素在目标图形元素上移动时触发,事件对象是:目标图形元素
  68354. DRAGOVER: 'dragover',
  68355. //拖拽图形元素离开目标图形元素时触发,事件对象是:目标图形元素
  68356. DRAGLEAVE: 'dragleave',
  68357. //拖拽图形元素放在目标图形元素内时触发,事件对象是:目标图形元素
  68358. DROP: 'drop',
  68359. //touch end - start < delay is click
  68360. touchClickDelay: 300
  68361. };
  68362. /**
  68363. * @enum catchBrushException
  68364. * @description 是否异常捕获
  68365. * @type {boolean}
  68366. * @private
  68367. */
  68368. Config_Config.catchBrushException = false;
  68369. /**
  68370. * @enum debugMode
  68371. * @description debug 日志选项:catchBrushException 为 true 下有效。
  68372. * 0 : 不生成debug数据,发布用
  68373. * 1 : 异常抛出,调试用
  68374. * 2 : 控制台输出,调试用
  68375. * @type {boolean}
  68376. * @private
  68377. */
  68378. Config_Config.debugMode = 0;
  68379. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Log.js
  68380. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  68381. * This program are made available under the terms of the Apache License, Version 2.0
  68382. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68383. /**
  68384. * @private
  68385. * @class LevelRenderer.Tool.Log
  68386. * @category Visualization Theme
  68387. * @classdesc LevelRenderer 工具-日志
  68388. */
  68389. class Log {
  68390. constructor() {
  68391. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Log";
  68392. return function () {
  68393. if (+Config_Config.debugMode === 0) {
  68394. return;
  68395. } else if (+Config_Config.debugMode === 1) {
  68396. for (let k in arguments) {
  68397. throw new Error(arguments[k]);
  68398. }
  68399. } else if (+Config_Config.debugMode > 1) {
  68400. for (let k in arguments) {
  68401. console.log(arguments[k]);
  68402. }
  68403. }
  68404. };
  68405. /* for debug
  68406. return function(mes) {
  68407. document.getElementById('wrong-message').innerHTML =
  68408. mes + ' ' + (new Date() - 0)
  68409. + '<br/>'
  68410. + document.getElementById('wrong-message').innerHTML;
  68411. };
  68412. */
  68413. }
  68414. destory() {
  68415. return true;
  68416. }
  68417. }
  68418. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Math.js
  68419. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  68420. * This program are made available under the terms of the Apache License, Version 2.0
  68421. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68422. /**
  68423. * @private
  68424. * @class LevelRenderer.Tool.Math
  68425. * @category Visualization Theme
  68426. * @classdesc LevelRenderer 工具-数学辅助类
  68427. */
  68428. class MathTool {
  68429. constructor() {
  68430. /**
  68431. * @member {number} LevelRenderer.Tool.Math._radians
  68432. * @description 角度与弧度转化参数
  68433. */
  68434. this._radians = window.Math.PI / 180;
  68435. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Math";
  68436. }
  68437. /**
  68438. * @function LevelRenderer.Tool.Math.prototype.sin
  68439. * @description 正弦函数。
  68440. * @param {number} angle - 弧度(角度)参数。
  68441. * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
  68442. * @returns {number} sin 值。
  68443. */
  68444. sin(angle, isDegrees) {
  68445. return window.Math.sin(isDegrees ? angle * this._radians : angle);
  68446. }
  68447. /**
  68448. * @function LevelRenderer.Tool.Math.prototype.cos
  68449. * @description 余弦函数。
  68450. * @param {number} angle - 弧度(角度)参数。
  68451. * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
  68452. * @returns {number} cos 值。
  68453. */
  68454. cos(angle, isDegrees) {
  68455. return window.Math.cos(isDegrees ? angle * this._radians : angle);
  68456. }
  68457. /**
  68458. * @function LevelRenderer.Tool.Math.prototype.degreeToRadian
  68459. * @description 角度转弧度。
  68460. * @param {number} angle - 弧度(角度)参数。
  68461. * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
  68462. * @returns {number} 弧度值。
  68463. */
  68464. degreeToRadian(angle) {
  68465. return angle * this._radians;
  68466. }
  68467. /**
  68468. * @function LevelRenderer.Tool.Math.prototype.radianToDegree
  68469. * @description 弧度转角度。
  68470. * @param {number} angle - 弧度(角度)参数。
  68471. * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
  68472. * @returns {number} 角度。
  68473. */
  68474. radianToDegree(angle) {
  68475. return angle / this._radians;
  68476. }
  68477. }
  68478. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Matrix.js
  68479. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  68480. * This program are made available under the terms of the Apache License, Version 2.0
  68481. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68482. /**
  68483. * @private
  68484. * @class LevelRenderer.Tool.Matrix
  68485. * @category Visualization Theme
  68486. * @classdesc LevelRenderer 工具-3x2矩阵操作类
  68487. */
  68488. class Matrix {
  68489. constructor() {
  68490. /**
  68491. * @member {Object} LevelRenderer.Tool.Matrix.prototype.ArrayCtor
  68492. * @description 数组类型控制
  68493. */
  68494. this.ArrayCtor = typeof Float32Array === 'undefined'
  68495. ? Array
  68496. : Float32Array;
  68497. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Matrix";
  68498. }
  68499. /**
  68500. * @function LevelRenderer.Tool.Matrix.prototype.create
  68501. * @description 创建一个单位矩阵。
  68502. * @returns {(Float32Array|Array.<number>)} 单位矩阵。
  68503. */
  68504. create() {
  68505. var ArrayCtor = this.ArrayCtor;
  68506. var out = new ArrayCtor(6);
  68507. this.identity(out);
  68508. return out;
  68509. }
  68510. /**
  68511. * @function LevelRenderer.Tool.Matrix.prototype.identity
  68512. * @description 设置矩阵为单位矩阵。
  68513. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  68514. * @returns {(Float32Array|Array.<number>)} 单位矩阵。
  68515. */
  68516. identity(out) {
  68517. out[0] = 1;
  68518. out[1] = 0;
  68519. out[2] = 0;
  68520. out[3] = 1;
  68521. out[4] = 0;
  68522. out[5] = 0;
  68523. return out;
  68524. }
  68525. /**
  68526. * @function LevelRenderer.Tool.Matrix.prototype.copy
  68527. * @description 复制矩阵。
  68528. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  68529. * @returns {(Float32Array|Array.<number>)} 克隆矩阵。
  68530. */
  68531. copy(out, m) {
  68532. out[0] = m[0];
  68533. out[1] = m[1];
  68534. out[2] = m[2];
  68535. out[3] = m[3];
  68536. out[4] = m[4];
  68537. out[5] = m[5];
  68538. return out;
  68539. }
  68540. /**
  68541. * @function LevelRenderer.Tool.Matrix.prototype.mul
  68542. * @description 矩阵相乘。
  68543. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  68544. * @param {(Float32Array|Array.<number>)} m1 - 矩阵m1。
  68545. * @param {(Float32Array|Array.<number>)} m2- 矩阵m2。
  68546. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  68547. */
  68548. mul(out, m1, m2) {
  68549. out[0] = m1[0] * m2[0] + m1[2] * m2[1];
  68550. out[1] = m1[1] * m2[0] + m1[3] * m2[1];
  68551. out[2] = m1[0] * m2[2] + m1[2] * m2[3];
  68552. out[3] = m1[1] * m2[2] + m1[3] * m2[3];
  68553. out[4] = m1[0] * m2[4] + m1[2] * m2[5] + m1[4];
  68554. out[5] = m1[1] * m2[4] + m1[3] * m2[5] + m1[5];
  68555. return out;
  68556. }
  68557. /**
  68558. * @function LevelRenderer.Tool.Matrix.prototype.mul
  68559. * @description 平移变换。
  68560. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  68561. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  68562. * @param {(Float32Array|Array.<number>)} v- 平移参数。
  68563. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  68564. */
  68565. translate(out, a, v) {
  68566. out[0] = a[0];
  68567. out[1] = a[1];
  68568. out[2] = a[2];
  68569. out[3] = a[3];
  68570. out[4] = a[4] + v[0];
  68571. out[5] = a[5] + v[1];
  68572. return out;
  68573. }
  68574. /**
  68575. * @function LevelRenderer.Tool.Matrix.prototype.rotate
  68576. * @description 平移变换。
  68577. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  68578. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  68579. * @param {(Float32Array|Array.<number>)} rad - 旋转参数。
  68580. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  68581. */
  68582. rotate(out, a, rad) {
  68583. var aa = a[0];
  68584. var ac = a[2];
  68585. var atx = a[4];
  68586. var ab = a[1];
  68587. var ad = a[3];
  68588. var aty = a[5];
  68589. var st = Math.sin(rad);
  68590. var ct = Math.cos(rad);
  68591. out[0] = aa * ct + ab * st;
  68592. out[1] = -aa * st + ab * ct;
  68593. out[2] = ac * ct + ad * st;
  68594. out[3] = -ac * st + ct * ad;
  68595. out[4] = ct * atx + st * aty;
  68596. out[5] = ct * aty - st * atx;
  68597. return out;
  68598. }
  68599. /**
  68600. * @function LevelRenderer.Tool.Matrix.prototype.scale
  68601. * @description 缩放变换。
  68602. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  68603. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  68604. * @param {(Float32Array|Array.<number>)} v - 缩放参数。
  68605. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  68606. */
  68607. scale(out, a, v) {
  68608. var vx = v[0];
  68609. var vy = v[1];
  68610. out[0] = a[0] * vx;
  68611. out[1] = a[1] * vy;
  68612. out[2] = a[2] * vx;
  68613. out[3] = a[3] * vy;
  68614. out[4] = a[4] * vx;
  68615. out[5] = a[5] * vy;
  68616. return out;
  68617. }
  68618. /**
  68619. * @function LevelRenderer.Tool.Matrix.prototype.invert
  68620. * @description 求逆矩阵。
  68621. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  68622. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  68623. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  68624. */
  68625. invert(out, a) {
  68626. var aa = a[0];
  68627. var ac = a[2];
  68628. var atx = a[4];
  68629. var ab = a[1];
  68630. var ad = a[3];
  68631. var aty = a[5];
  68632. var det = aa * ad - ab * ac;
  68633. if (!det) {
  68634. return null;
  68635. }
  68636. det = 1.0 / det;
  68637. out[0] = ad * det;
  68638. out[1] = -ab * det;
  68639. out[2] = -ac * det;
  68640. out[3] = aa * det;
  68641. out[4] = (ac * aty - ad * atx) * det;
  68642. out[5] = (ab * atx - aa * aty) * det;
  68643. return out;
  68644. }
  68645. /**
  68646. * @function LevelRenderer.Tool.Matrix.prototype.mulVector
  68647. * @description 矩阵左乘向量。
  68648. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  68649. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  68650. * @param {(Float32Array|Array.<number>)} v - 缩放参数。
  68651. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  68652. */
  68653. mulVector(out, a, v) {
  68654. var aa = a[0];
  68655. var ac = a[2];
  68656. var atx = a[4];
  68657. var ab = a[1];
  68658. var ad = a[3];
  68659. var aty = a[5];
  68660. out[0] = v[0] * aa + v[1] * ac + atx;
  68661. out[1] = v[0] * ab + v[1] * ad + aty;
  68662. return out;
  68663. }
  68664. }
  68665. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SUtil.js
  68666. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  68667. * This program are made available under the terms of the Apache License, Version 2.0
  68668. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68669. class SUtil_SUtil {
  68670. /**
  68671. * @function LevelRenderer.SUtil.SUtil_smoothBezier
  68672. * @description 贝塞尔平滑曲线。
  68673. * @private
  68674. * @param {Array} points - 线段顶点数组。
  68675. * @param {number} smooth - 平滑等级, 0-1。
  68676. * @param {boolean} isLoop - isLoop。
  68677. * @param {Array} constraint - 将计算出来的控制点约束在一个包围盒内,比如 [[0, 0], [100, 100]], 这个包围盒会与整个折线的包围盒做一个并集用来约束控制点。
  68678. * @param {Array.<number>} [originalPosition=[0, 0]] - 参考原点。
  68679. * @return {Array} 生成的平滑节点数组。
  68680. */
  68681. static SUtil_smoothBezier(points, smooth, isLoop, constraint, originalPosition) {
  68682. if (!originalPosition || originalPosition.length !== 2) {
  68683. originalPosition = [0, 0];
  68684. }
  68685. var __OP = originalPosition;
  68686. var cps = [];
  68687. var v = [];
  68688. var v1 = [];
  68689. var v2 = [];
  68690. var hasConstraint = !!constraint;
  68691. var min, max;
  68692. if (hasConstraint) {
  68693. min = [Infinity, Infinity];
  68694. max = [-Infinity, -Infinity];
  68695. let len = points.length;
  68696. for (let i = 0; i < len; i++) {
  68697. SUtil_SUtil.Util_vector.min(min, min, [points[i][0] + __OP[0], points[i][1] + __OP[1]]);
  68698. SUtil_SUtil.Util_vector.max(max, max, [points[i][0] + __OP[0], points[i][1] + __OP[1]]);
  68699. }
  68700. // 与指定的包围盒做并集
  68701. SUtil_SUtil.Util_vector.min(min, min, constraint[0]);
  68702. SUtil_SUtil.Util_vector.max(max, max, constraint[1]);
  68703. }
  68704. let len = points.length;
  68705. for (let i = 0; i < len; i++) {
  68706. let point = [points[i][0] + __OP[0], points[i][1] + __OP[1]];
  68707. let prevPoint;
  68708. let nextPoint;
  68709. if (isLoop) {
  68710. prevPoint = [points[i ? i - 1 : len - 1][0] + __OP[0], points[i ? i - 1 : len - 1][1] + __OP[1]];
  68711. nextPoint = [points[(i + 1) % len][0] + __OP[0], points[(i + 1) % len][1] + __OP[1]];
  68712. } else {
  68713. if (i === 0 || i === len - 1) {
  68714. cps.push([points[i][0] + __OP[0], points[i][1] + __OP[1]]);
  68715. continue;
  68716. } else {
  68717. prevPoint = [points[i - 1][0] + __OP[0], points[i - 1][1] + __OP[1]];
  68718. nextPoint = [points[i + 1][0] + __OP[0], points[i + 1][1] + __OP[1]];
  68719. }
  68720. }
  68721. SUtil_SUtil.Util_vector.sub(v, nextPoint, prevPoint);
  68722. // use degree to scale the handle length
  68723. SUtil_SUtil.Util_vector.scale(v, v, smooth);
  68724. let d0 = SUtil_SUtil.Util_vector.distance(point, prevPoint);
  68725. let d1 = SUtil_SUtil.Util_vector.distance(point, nextPoint);
  68726. let sum = d0 + d1;
  68727. if (sum !== 0) {
  68728. d0 /= sum;
  68729. d1 /= sum;
  68730. }
  68731. SUtil_SUtil.Util_vector.scale(v1, v, -d0);
  68732. SUtil_SUtil.Util_vector.scale(v2, v, d1);
  68733. let cp0 = SUtil_SUtil.Util_vector.add([], point, v1);
  68734. let cp1 = SUtil_SUtil.Util_vector.add([], point, v2);
  68735. if (hasConstraint) {
  68736. SUtil_SUtil.Util_vector.max(cp0, cp0, min);
  68737. SUtil_SUtil.Util_vector.min(cp0, cp0, max);
  68738. SUtil_SUtil.Util_vector.max(cp1, cp1, min);
  68739. SUtil_SUtil.Util_vector.min(cp1, cp1, max);
  68740. }
  68741. cps.push(cp0);
  68742. cps.push(cp1);
  68743. }
  68744. if (isLoop) {
  68745. cps.push(cps.shift());
  68746. }
  68747. return cps;
  68748. }
  68749. /**
  68750. * @function LevelRenderer.SUtil.SUtil_smoothSpline
  68751. * @description 插值折线。
  68752. * @private
  68753. * @param {Array} points - 线段顶点数组。
  68754. * @param {boolean} isLoop - isLoop。
  68755. * @param {Array} constraint - 将计算出来的控制点约束在一个包围盒内,比如 [[0, 0], [100, 100]], 这个包围盒会与整个折线的包围盒做一个并集用来约束控制点。
  68756. * @param {Array.<number>} originalPosition - 参考原点。默认值:[0, 0]。
  68757. * @return {Array} 生成的平滑节点数组。
  68758. */
  68759. static SUtil_smoothSpline(points, isLoop, constraint, originalPosition) {
  68760. if (!originalPosition || originalPosition.length !== 2) {
  68761. originalPosition = [0, 0];
  68762. }
  68763. var __OP = originalPosition;
  68764. var len = points.length;
  68765. var ret = [];
  68766. var distance = 0;
  68767. for (let i = 1; i < len; i++) {
  68768. 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]]);
  68769. }
  68770. var segs = distance / 5;
  68771. segs = segs < len ? len : segs;
  68772. for (let i = 0; i < segs; i++) {
  68773. let pos = i / (segs - 1) * (isLoop ? len : len - 1);
  68774. let idx = Math.floor(pos);
  68775. let w = pos - idx;
  68776. let p0;
  68777. let p1 = [points[idx % len][0] + __OP[0], points[idx % len][1] + __OP[1]];
  68778. let p2;
  68779. let p3;
  68780. if (!isLoop) {
  68781. p0 = [points[idx === 0 ? idx : idx - 1][0] + __OP[0], points[idx === 0 ? idx : idx - 1][1] + __OP[1]];
  68782. p2 = [points[idx > len - 2 ? len - 1 : idx + 1][0] + __OP[0], points[idx > len - 2 ? len - 1 : idx + 1][1] + __OP[1]];
  68783. p3 = [points[idx > len - 3 ? len - 1 : idx + 2][0] + __OP[0], points[idx > len - 3 ? len - 1 : idx + 2][1] + __OP[1]];
  68784. } else {
  68785. p0 = [points[(idx - 1 + len) % len][0] + __OP[0], points[(idx - 1 + len) % len][1] + __OP[1]];
  68786. p2 = [points[(idx + 1) % len][0] + __OP[0], points[(idx + 1) % len][1] + __OP[1]];
  68787. p3 = [points[(idx + 2) % len][0] + __OP[0], points[(idx + 2) % len][1] + __OP[1]];
  68788. }
  68789. let w2 = w * w;
  68790. let w3 = w * w2;
  68791. ret.push([
  68792. interpolate(p0[0], p1[0], p2[0], p3[0], w, w2, w3),
  68793. interpolate(p0[1], p1[1], p2[1], p3[1], w, w2, w3)
  68794. ]);
  68795. }
  68796. return ret;
  68797. // inner Function
  68798. function interpolate(p0, p1, p2, p3, t, t2, t3) {
  68799. var v0 = (p2 - p0) * 0.5;
  68800. var v1 = (p3 - p1) * 0.5;
  68801. return (2 * (p1 - p2) + v0 + v1) * t3
  68802. + (-3 * (p1 - p2) - 2 * v0 - v1) * t2
  68803. + v0 * t + p1;
  68804. }
  68805. }
  68806. /**
  68807. * @function LevelRenderer.SUtil.SUtil_dashedLineTo
  68808. * @description 虚线 lineTo。
  68809. */
  68810. static SUtil_dashedLineTo(ctx, x1, y1, x2, y2, dashLength, customDashPattern) {
  68811. // http://msdn.microsoft.com/en-us/library/ie/dn265063(v=vs.85).aspx
  68812. var dashPattern = [5, 5];
  68813. dashLength = typeof dashLength != 'number'
  68814. ? 5
  68815. : dashLength;
  68816. if (ctx.setLineDash) {
  68817. dashPattern[0] = dashLength;
  68818. dashPattern[1] = dashLength;
  68819. if (customDashPattern && (customDashPattern instanceof Array)) {
  68820. ctx.setLineDash(customDashPattern);
  68821. } else {
  68822. ctx.setLineDash(dashPattern);
  68823. }
  68824. // ctx.setLineDash(dashPattern);
  68825. ctx.moveTo(x1, y1);
  68826. ctx.lineTo(x2, y2);
  68827. return;
  68828. }
  68829. var dx = x2 - x1;
  68830. var dy = y2 - y1;
  68831. var numDashes = Math.floor(
  68832. Math.sqrt(dx * dx + dy * dy) / dashLength
  68833. );
  68834. dx = dx / numDashes;
  68835. dy = dy / numDashes;
  68836. var flag = true;
  68837. for (var i = 0; i < numDashes; ++i) {
  68838. if (flag) {
  68839. ctx.moveTo(x1, y1);
  68840. } else {
  68841. ctx.lineTo(x1, y1);
  68842. }
  68843. flag = !flag;
  68844. x1 += dx;
  68845. y1 += dy;
  68846. }
  68847. ctx.lineTo(x2, y2);
  68848. }
  68849. }
  68850. // 把所有工具对象放到全局静态变量上,以便直接调用工具方法,
  68851. // 避免使用工具时频繁的创建工具对象带来的性能消耗。
  68852. SUtil_SUtil.Util_area = new Area();
  68853. SUtil_SUtil.Util_color = new Color_Color();
  68854. SUtil_SUtil.Util_computeBoundingBox = new ComputeBoundingBox();
  68855. SUtil_SUtil.Util_curve = new Curve_Curve();
  68856. SUtil_SUtil.Util_env = new Env();
  68857. SUtil_SUtil.Util_event = new Event_Event();
  68858. SUtil_SUtil.Util_http = new Http();
  68859. SUtil_SUtil.Util_log = new Log();
  68860. SUtil_SUtil.Util_math = new MathTool();
  68861. SUtil_SUtil.Util_matrix = new Matrix();
  68862. SUtil_SUtil.Util = new levelRenderer_Util_Util();
  68863. SUtil_SUtil.Util_vector = new levelRenderer_Vector_Vector();
  68864. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Transformable.js
  68865. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  68866. * This program are made available under the terms of the Apache License, Version 2.0
  68867. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68868. /**
  68869. * @private
  68870. * @class LevelRenderer.Transformable
  68871. * @category Visualization Theme
  68872. * @classdesc 可变换超类,所有支持 Canvas Transform 变换操作的类均是此类的子类。此类不可实例化。
  68873. */
  68874. class Transformable {
  68875. constructor() {
  68876. /**
  68877. * @member {Array.<number>} LevelRenderer.Transformable.prototype.position
  68878. * @description 平移,默认值:[0, 0]。
  68879. */
  68880. this.position = [0, 0];
  68881. /**
  68882. * @member {Array.<number>} LevelRenderer.Transformable.prototype.rotation
  68883. * @description 旋转,可以通过数组二三项指定旋转的原点,默认值:[0, 0, 0]。
  68884. */
  68885. this.rotation = [0, 0, 0];
  68886. /**
  68887. * @member {Array.<number>} LevelRenderer.Transformable.prototype.scale
  68888. * @description 缩放,可以通过数组三四项指定缩放的原点,默认值:[1, 1, 0, 0]。
  68889. */
  68890. this.scale = [1, 1, 0, 0];
  68891. /**
  68892. * @member {boolean} LevelRenderer.Transformable.prototype.needLocalTransform
  68893. * @description 是否变换。默认值:false。
  68894. */
  68895. this.needLocalTransform = false;
  68896. /**
  68897. * @member {boolean} LevelRenderer.Transformable.prototype.needTransform
  68898. * @description 是否有坐标变换。默认值:false。
  68899. */
  68900. this.needTransform = false;
  68901. this.CLASS_NAME = "SuperMap.LevelRenderer.Transformable";
  68902. /**
  68903. * @function LevelRenderer.Transformable.prototype.lookAt
  68904. * @description 设置图形的朝向。
  68905. */
  68906. this.lookAt = (function () {
  68907. var v = SUtil_SUtil.Util_vector.create();
  68908. // {Array.<Number>|Float32Array} target
  68909. return function (target) {
  68910. if (!this.transform) {
  68911. this.transform = SUtil_SUtil.Util_matrix.create();
  68912. }
  68913. var m = this.transform;
  68914. SUtil_SUtil.Util_vector.sub(v, target, this.position);
  68915. if (isAroundZero(v[0]) && isAroundZero(v[1])) {
  68916. return;
  68917. }
  68918. SUtil_SUtil.Util_vector.normalize(v, v);
  68919. // Y Axis
  68920. // TODO Scale origin ?
  68921. m[2] = v[0] * this.scale[1];
  68922. m[3] = v[1] * this.scale[1];
  68923. // X Axis
  68924. m[0] = v[1] * this.scale[0];
  68925. m[1] = -v[0] * this.scale[0];
  68926. // Position
  68927. m[4] = this.position[0];
  68928. m[5] = this.position[1];
  68929. this.decomposeTransform();
  68930. function isAroundZero(val) {
  68931. var EPSILON = 5e-5;
  68932. return val > -EPSILON && val < EPSILON;
  68933. }
  68934. };
  68935. })();
  68936. }
  68937. /**
  68938. * @function LevelRenderer.Transformable.prototype.destroy
  68939. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  68940. */
  68941. destroy() {
  68942. this.position = null;
  68943. this.rotation = null;
  68944. this.scale = null;
  68945. this.needLocalTransform = null;
  68946. this.needTransform = null;
  68947. }
  68948. /**
  68949. * @function LevelRenderer.Transformable.prototype.updateNeedTransform
  68950. * @description 更新 needLocalTransform
  68951. */
  68952. updateNeedTransform() {
  68953. this.needLocalTransform = isNotAroundZero(this.rotation[0])
  68954. || isNotAroundZero(this.position[0])
  68955. || isNotAroundZero(this.position[1])
  68956. || isNotAroundZero(this.scale[0] - 1)
  68957. || isNotAroundZero(this.scale[1] - 1);
  68958. function isNotAroundZero(val) {
  68959. var EPSILON = 5e-5;
  68960. return val > EPSILON || val < -EPSILON;
  68961. }
  68962. }
  68963. /**
  68964. * @function LevelRenderer.Transformable.prototype.updateTransform
  68965. * @description 判断是否需要有坐标变换,更新 needTransform 属性。如果有坐标变换,则从 position, rotation, scale 以及父节点的 transform 计算出自身的 transform 矩阵。
  68966. */
  68967. updateTransform() {
  68968. this.updateNeedTransform();
  68969. if (this.parent) {
  68970. this.needTransform = this.needLocalTransform || this.parent.needTransform;
  68971. } else {
  68972. this.needTransform = this.needLocalTransform;
  68973. }
  68974. if (!this.needTransform) {
  68975. return;
  68976. }
  68977. var origin = [0, 0];
  68978. var m = this.transform || SUtil_SUtil.Util_matrix.create();
  68979. SUtil_SUtil.Util_matrix.identity(m);
  68980. if (this.needLocalTransform) {
  68981. if (
  68982. isNotAroundZero(this.scale[0])
  68983. || isNotAroundZero(this.scale[1])
  68984. ) {
  68985. origin[0] = -this.scale[2] || 0;
  68986. origin[1] = -this.scale[3] || 0;
  68987. let haveOrigin = isNotAroundZero(origin[0])
  68988. || isNotAroundZero(origin[1]);
  68989. if (haveOrigin) {
  68990. SUtil_SUtil.Util_matrix.translate(
  68991. m, m, origin
  68992. );
  68993. }
  68994. SUtil_SUtil.Util_matrix.scale(m, m, this.scale);
  68995. if (haveOrigin) {
  68996. origin[0] = -origin[0];
  68997. origin[1] = -origin[1];
  68998. SUtil_SUtil.Util_matrix.translate(
  68999. m, m, origin
  69000. );
  69001. }
  69002. }
  69003. if (this.rotation instanceof Array) {
  69004. if (this.rotation[0] !== 0) {
  69005. origin[0] = -this.rotation[1] || 0;
  69006. origin[1] = -this.rotation[2] || 0;
  69007. let haveOrigin = isNotAroundZero(origin[0])
  69008. || isNotAroundZero(origin[1]);
  69009. if (haveOrigin) {
  69010. SUtil_SUtil.Util_matrix.translate(
  69011. m, m, origin
  69012. );
  69013. }
  69014. SUtil_SUtil.Util_matrix.rotate(m, m, this.rotation[0]);
  69015. if (haveOrigin) {
  69016. origin[0] = -origin[0];
  69017. origin[1] = -origin[1];
  69018. SUtil_SUtil.Util_matrix.translate(
  69019. m, m, origin
  69020. );
  69021. }
  69022. }
  69023. } else {
  69024. if (+this.rotation !== 0) {
  69025. SUtil_SUtil.Util_matrix.rotate(m, m, this.rotation);
  69026. }
  69027. }
  69028. if (
  69029. isNotAroundZero(this.position[0]) || isNotAroundZero(this.position[1])
  69030. ) {
  69031. SUtil_SUtil.Util_matrix.translate(m, m, this.position);
  69032. }
  69033. }
  69034. // 保存这个变换矩阵
  69035. this.transform = m;
  69036. // 应用父节点变换
  69037. if (this.parent && this.parent.needTransform) {
  69038. if (this.needLocalTransform) {
  69039. SUtil_SUtil.Util_matrix.mul(this.transform, this.parent.transform, this.transform);
  69040. } else {
  69041. SUtil_SUtil.Util_matrix.copy(this.transform, this.parent.transform);
  69042. }
  69043. }
  69044. function isNotAroundZero(val) {
  69045. var EPSILON = 5e-5;
  69046. return val > EPSILON || val < -EPSILON;
  69047. }
  69048. }
  69049. /**
  69050. * @function LevelRenderer.Transformable.prototype.setTransform
  69051. * @description 将自己的 transform 应用到 context 上。
  69052. *
  69053. * @param {Context2D} ctx - Context2D 上下文。
  69054. */
  69055. setTransform(ctx) {
  69056. if (this.needTransform) {
  69057. var m = this.transform;
  69058. ctx.transform(
  69059. m[0], m[1],
  69060. m[2], m[3],
  69061. m[4], m[5]
  69062. );
  69063. }
  69064. }
  69065. /**
  69066. * @function LevelRenderer.Transformable.prototype.decomposeTransform
  69067. * @description 分解`transform`矩阵到`position`, `rotation`, `scale` 。
  69068. */
  69069. decomposeTransform() {
  69070. if (!this.transform) {
  69071. return;
  69072. }
  69073. var m = this.transform;
  69074. var sx = m[0] * m[0] + m[1] * m[1];
  69075. var position = this.position;
  69076. var scale = this.scale;
  69077. var rotation = this.rotation;
  69078. if (isNotAroundZero(sx - 1)) {
  69079. sx = Math.sqrt(sx);
  69080. }
  69081. var sy = m[2] * m[2] + m[3] * m[3];
  69082. if (isNotAroundZero(sy - 1)) {
  69083. sy = Math.sqrt(sy);
  69084. }
  69085. position[0] = m[4];
  69086. position[1] = m[5];
  69087. scale[0] = sx;
  69088. scale[1] = sy;
  69089. scale[2] = scale[3] = 0;
  69090. rotation[0] = Math.atan2(-m[1] / sy, m[0] / sx);
  69091. rotation[1] = rotation[2] = 0;
  69092. function isNotAroundZero(val) {
  69093. var EPSILON = 5e-5;
  69094. return val > EPSILON || val < -EPSILON;
  69095. }
  69096. }
  69097. }
  69098. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Shape.js
  69099. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  69100. * This program are made available under the terms of the Apache License, Version 2.0
  69101. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  69102. /**
  69103. * @private
  69104. * @class LevelRenderer.Shape
  69105. * @category Visualization Theme
  69106. * @classdesc 图形(shape)基类。
  69107. * @extends LevelRenderer.Eventful
  69108. * @extends LevelRenderer.Transformable
  69109. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  69110. */
  69111. class Shape_Shape extends mixinExt(Eventful, Transformable) {
  69112. constructor(options) {
  69113. super(options);
  69114. options = options || {};
  69115. /**
  69116. * @member {string} LevelRenderer.Shape.prototype.id
  69117. * @description 唯一标识。
  69118. */
  69119. this.id = null;
  69120. /**
  69121. * @member {Object} LevelRenderer.Shape.prototype.style
  69122. * @description 基础绘制样式。
  69123. * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  69124. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  69125. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  69126. * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  69127. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  69128. * @param {number} style.opacity - 绘制透明度。默认值:1。
  69129. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  69130. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  69131. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  69132. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  69133. * @param {string} style.text - 图形中的附加文本。默认值:""。
  69134. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  69135. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  69136. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  69137. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  69138. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  69139. *
  69140. */
  69141. this.style = {};
  69142. /**
  69143. * @member {Object} LevelRenderer.Shape.prototype.style.__rect
  69144. * @description 包围图形的最小矩形盒子。
  69145. *
  69146. * @param {number} x - 左上角顶点x轴坐标。
  69147. * @param {number} y - 左上角顶点y轴坐标。
  69148. * @param {number} width - 包围盒矩形宽度。
  69149. * @param {number} height - 包围盒矩形高度。
  69150. */
  69151. /**
  69152. * @member {Object} LevelRenderer.Shape.prototype.highlightStyle
  69153. * @description 高亮样式。
  69154. *
  69155. * @param {string} highlightStyle.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  69156. * @param {string} highlightStyle.color - 填充颜色。默认值:"#000000'"。
  69157. * @param {string} highlightStyle.strokeColor - 描边颜色。默认值:"#000000'"。
  69158. * @param {string} highlightStyle.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  69159. * @param {number} highlightStyle.lineWidth - 描边宽度。默认值:1。
  69160. * @param {number} highlightStyle.opacity - 绘制透明度。默认值:1。
  69161. * @param {number} highlightStyle.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  69162. * @param {number} highlightStyle.shadowColor - 阴影颜色。默认值:"#000000'"。
  69163. * @param {number} highlightStyle.shadowOffsetX - 阴影横向偏移。默认值:0。
  69164. * @param {number} highlightStyle.shadowOffsetY - 阴影纵向偏移。默认值:0。
  69165. * @param {string} highlightStyle.text - 图形中的附加文本。默认值:""。
  69166. * @param {string} highlightStyle.textColor - 文本颜色。默认值:"#000000'"。
  69167. * @param {string} highlightStyle.textFont - 附加文本样式。示例:'bold 18px verdana'。
  69168. * @param {string} highlightStyle.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  69169. * @param {string} highlightStyle.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  69170. * @param {string} highlightStyle.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  69171. */
  69172. this.highlightStyle = null;
  69173. /**
  69174. * @member {Object} LevelRenderer.Shape.prototype.parent
  69175. * @description 父节点,只读属性。<LevelRenderer.Group>
  69176. */
  69177. this.parent = null;
  69178. /**
  69179. * @member {boolean} LevelRenderer.Shape.prototype.__dirty
  69180. * @description {boolean}
  69181. */
  69182. this.__dirty = true;
  69183. /**
  69184. * @member {Array} LevelRenderer.Shape.prototype.__clipShapes
  69185. * @description {Array}
  69186. *
  69187. */
  69188. this.__clipShapes = [];
  69189. /**
  69190. * @member {boolean} LevelRenderer.Shape.prototype.invisible
  69191. * @description 图形是否可见,为 true 时不绘制图形,但是仍能触发鼠标事件。默认值:false。
  69192. */
  69193. this.invisible = false;
  69194. /**
  69195. * @member {boolean} LevelRenderer.Shape.prototype.ignore
  69196. * @description 图形是否忽略,为 true 时忽略图形的绘制以及事件触发。默认值:false。
  69197. */
  69198. this.ignore = false;
  69199. /**
  69200. * @member {boolean} LevelRenderer.Shape.prototype.zlevel
  69201. * @description z 层 level,决定绘画在哪层 canvas 中。默认值:0。
  69202. */
  69203. this.zlevel = 0;
  69204. /**
  69205. * @member {boolean} LevelRenderer.Shape.prototype.draggable
  69206. * @description 是否可拖拽。默认值:false。
  69207. */
  69208. this.draggable = false;
  69209. /**
  69210. * @member {boolean} LevelRenderer.Shape.prototype.clickable
  69211. * @description 是否可点击。默认值:false。
  69212. */
  69213. this.clickable = false;
  69214. /**
  69215. * @member {boolean} LevelRenderer.Shape.prototype.hoverable
  69216. * @description 是否可以 hover。默认值:true。
  69217. */
  69218. this.hoverable = true;
  69219. /**
  69220. * @member {number} LevelRenderer.Shape.prototype.z
  69221. * @description z值,跟zlevel一样影响shape绘制的前后顺序,z值大的shape会覆盖在z值小的上面,但是并不会创建新的canvas,所以优先级低于zlevel,而且频繁改动的开销比zlevel小很多。默认值:0。
  69222. */
  69223. this.z = 0;
  69224. //地理扩展
  69225. /**
  69226. * @member {Array.<number>} LevelRenderer.Shape.prototype.refOriginalPosition
  69227. * @description 图形参考原点位置,图形的参考中心位置。
  69228. * refOriginalPosition 是长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  69229. *
  69230. * refOriginalPosition 表示图形的参考中心,通常情况下,图形是使用 canvas 的原点位置作为位置参考,
  69231. * 但 refOriginalPosition 可以改变图形的参考位置,例如: refOriginalPosition = [80, 80],
  69232. * 图形圆的 style.x = 20, style.y = 20,那么圆在 canvas 中的实际位置是 [100, 100]。
  69233. *
  69234. * 图形(Shape) 的所有位置相关属性都是以 refOriginalPosition 为参考中心,
  69235. * 也就是说图形的所有位置信息在 canvas 中都是以 refOriginalPosition 为参考的相对位置,只有
  69236. * refOriginalPosition 的值为 [0, 0] 时,形的位置信息才是 canvas 绝对位置。
  69237. *
  69238. * 图形的位置信息通常有:style.pointList,style.x,style.y。
  69239. *
  69240. * refOriginalPosition。默认值是: [0, 0]。
  69241. */
  69242. this.refOriginalPosition = [0, 0];
  69243. /**
  69244. * @member {string} LevelRenderer.Shape.prototype.refDataID
  69245. * @description 图形所关联数据的 ID。
  69246. *
  69247. */
  69248. this.refDataID = null;
  69249. /**
  69250. * @member {boolean} LevelRenderer.Shape.prototype.isHoverByRefDataID
  69251. * @description 是否根据 refDataID 进行高亮。用于同时高亮所有 refDataID 相同的图形。
  69252. *
  69253. */
  69254. this.isHoverByRefDataID = false;
  69255. /**
  69256. * @member {string} LevelRenderer.Shape.prototype.refDataHoverGroup
  69257. * @description 高亮图形组的组名。此属性在 refDataID 有效且 isHoverByRefDataID 为 true 时生效。
  69258. * 一旦设置此属性,且属性值有效,只有关联同一个数据的图形且此属性相同的图形才会高亮。
  69259. *
  69260. */
  69261. this.refDataHoverGroup = null;
  69262. /**
  69263. * @member {Object} LevelRenderer.Shape.prototype.dataInfo
  69264. * @description 图形的数据信息。
  69265. *
  69266. */
  69267. this.dataInfo = null;
  69268. Util_Util.extend(this, options);
  69269. this.id = this.id || Util_Util.createUniqueID("smShape_");
  69270. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape";
  69271. /**
  69272. * @function LevelRenderer.Shape.prototype.getTansform
  69273. * @description 变换鼠标位置到 shape 的局部坐标空间
  69274. *
  69275. */
  69276. this.getTansform = (function () {
  69277. var invTransform = [];
  69278. return function (x, y) {
  69279. var originPos = [x, y];
  69280. // 对鼠标的坐标也做相同的变换
  69281. if (this.needTransform && this.transform) {
  69282. SUtil_SUtil.Util_matrix.invert(invTransform, this.transform);
  69283. SUtil_SUtil.Util_matrix.mulVector(originPos, invTransform, [x, y, 1]);
  69284. if (x == originPos[0] && y == originPos[1]) {
  69285. // 避免外部修改导致的 needTransform 不准确
  69286. this.updateNeedTransform();
  69287. }
  69288. }
  69289. return originPos;
  69290. };
  69291. })();
  69292. }
  69293. /**
  69294. * @function LevelRenderer.Shape.prototype.destroy
  69295. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  69296. */
  69297. destroy() {
  69298. this.id = null;
  69299. this.style = null;
  69300. this.highlightStyle = null;
  69301. this.parent = null;
  69302. this.__dirty = null;
  69303. this.__clipShapes = null;
  69304. this.invisible = null;
  69305. this.ignore = null;
  69306. this.zlevel = null;
  69307. this.draggable = null;
  69308. this.clickable = null;
  69309. this.hoverable = null;
  69310. this.z = null;
  69311. this.refOriginalPosition = null;
  69312. this.refDataID = null;
  69313. this.refDataHoverGroup = null;
  69314. this.isHoverByRefDataID = null;
  69315. this.dataInfo = null;
  69316. super.destroy();
  69317. }
  69318. /**
  69319. * @function LevelRenderer.Shape.prototype.brush
  69320. * @description 绘制图形。
  69321. *
  69322. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  69323. * @param {boolean} isHighlight - 是否使用高亮属性。
  69324. * @param {function} updateCallback - 需要异步加载资源的 shape 可以通过这个 callback(e),让painter更新视图,base.brush 没用,需要的话重载 brush。
  69325. */
  69326. brush(ctx, isHighlight) {
  69327. var style = this.beforeBrush(ctx, isHighlight);
  69328. ctx.beginPath();
  69329. this.buildPath(ctx, style);
  69330. switch (style.brushType) {
  69331. /* jshint ignore:start */
  69332. case 'both':
  69333. this.setCtxGlobalAlpha(ctx, "fill", style);
  69334. ctx.fill();
  69335. if (style.lineWidth > 0) {
  69336. this.setCtxGlobalAlpha(ctx, "stroke", style);
  69337. ctx.stroke();
  69338. }
  69339. this.setCtxGlobalAlpha(ctx, "reset", style);
  69340. break;
  69341. case 'stroke':
  69342. this.setCtxGlobalAlpha(ctx, "stroke", style);
  69343. style.lineWidth > 0 && ctx.stroke();
  69344. this.setCtxGlobalAlpha(ctx, "reset", style);
  69345. break;
  69346. /* jshint ignore:end */
  69347. default:
  69348. this.setCtxGlobalAlpha(ctx, "fill", style);
  69349. ctx.fill();
  69350. this.setCtxGlobalAlpha(ctx, "reset", style);
  69351. break;
  69352. }
  69353. this.drawText(ctx, style, this.style);
  69354. this.afterBrush(ctx);
  69355. }
  69356. /**
  69357. * @function LevelRenderer.Shape.prototype.beforeBrush
  69358. * @description 具体绘制操作前的一些公共操作。
  69359. *
  69360. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  69361. * @param {boolean} isHighlight - 是否使用高亮属性。
  69362. * @return {Object} 处理后的样式。
  69363. */
  69364. beforeBrush(ctx, isHighlight) {
  69365. var style = this.style;
  69366. if (this.brushTypeOnly) {
  69367. style.brushType = this.brushTypeOnly;
  69368. }
  69369. if (isHighlight) {
  69370. // 根据style扩展默认高亮样式
  69371. style = this.getHighlightStyle(
  69372. style,
  69373. this.highlightStyle || {},
  69374. this.brushTypeOnly
  69375. );
  69376. }
  69377. if (this.brushTypeOnly == 'stroke') {
  69378. style.strokeColor = style.strokeColor || style.color;
  69379. }
  69380. ctx.save();
  69381. this.doClip(ctx);
  69382. this.setContext(ctx, style);
  69383. // 设置transform
  69384. this.setTransform(ctx);
  69385. return style;
  69386. }
  69387. /**
  69388. * @function LevelRenderer.Shape.prototype.afterBrush
  69389. * @description 绘制后的处理。
  69390. *
  69391. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  69392. *
  69393. */
  69394. afterBrush(ctx) {
  69395. ctx.restore();
  69396. }
  69397. /**
  69398. * @function LevelRenderer.Shape.prototype.setContext
  69399. * @description 设置 fillStyle, strokeStyle, shadow 等通用绘制样式。
  69400. *
  69401. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  69402. * @param {Object} style - 样式。
  69403. *
  69404. */
  69405. setContext(ctx, style) {
  69406. var STYLE_CTX_MAP = [
  69407. ['color', 'fillStyle'],
  69408. ['strokeColor', 'strokeStyle'],
  69409. ['opacity', 'globalAlpha'],
  69410. ['lineCap', 'lineCap'],
  69411. ['lineJoin', 'lineJoin'],
  69412. ['miterLimit', 'miterLimit'],
  69413. ['lineWidth', 'lineWidth'],
  69414. ['shadowBlur', 'shadowBlur'],
  69415. ['shadowColor', 'shadowColor'],
  69416. ['shadowOffsetX', 'shadowOffsetX'],
  69417. ['shadowOffsetY', 'shadowOffsetY']
  69418. ];
  69419. for (var i = 0, len = STYLE_CTX_MAP.length; i < len; i++) {
  69420. var styleProp = STYLE_CTX_MAP[i][0];
  69421. var styleValue = style[styleProp];
  69422. var ctxProp = STYLE_CTX_MAP[i][1];
  69423. if (typeof styleValue != 'undefined') {
  69424. ctx[ctxProp] = styleValue;
  69425. }
  69426. }
  69427. }
  69428. /**
  69429. * @function LevelRenderer.Shape.prototype.doClip
  69430. *
  69431. */
  69432. doClip(ctx) {
  69433. var clipShapeInvTransform = SUtil_SUtil.Util_matrix.create();
  69434. if (this.__clipShapes) {
  69435. for (var i = 0; i < this.__clipShapes.length; i++) {
  69436. var clipShape = this.__clipShapes[i];
  69437. if (clipShape.needTransform) {
  69438. let m = clipShape.transform;
  69439. SUtil_SUtil.Util_matrix.invert(clipShapeInvTransform, m);
  69440. ctx.transform(
  69441. m[0], m[1],
  69442. m[2], m[3],
  69443. m[4], m[5]
  69444. );
  69445. }
  69446. ctx.beginPath();
  69447. clipShape.buildPath(ctx, clipShape.style);
  69448. ctx.clip();
  69449. // Transform back
  69450. if (clipShape.needTransform) {
  69451. let m = clipShapeInvTransform;
  69452. ctx.transform(
  69453. m[0], m[1],
  69454. m[2], m[3],
  69455. m[4], m[5]
  69456. );
  69457. }
  69458. }
  69459. }
  69460. }
  69461. /**
  69462. * @function LevelRenderer.Shape.prototype.getHighlightStyle
  69463. * @description 根据默认样式扩展高亮样式
  69464. *
  69465. * @param {Object} style - 样式。
  69466. * @param {Object} highlightStyle - 高亮样式。
  69467. * @param {string} brushTypeOnly - brushTypeOnly。
  69468. *
  69469. */
  69470. getHighlightStyle(style, highlightStyle, brushTypeOnly) {
  69471. var newStyle = {};
  69472. for (let k in style) {
  69473. newStyle[k] = style[k];
  69474. }
  69475. var highlightColor = SUtil_SUtil.Util_color.getHighlightColor();
  69476. // 根据highlightStyle扩展
  69477. if (style.brushType != 'stroke') {
  69478. // 带填充则用高亮色加粗边线
  69479. newStyle.strokeColor = highlightColor;
  69480. // SMIC-方法修改 - start
  69481. newStyle.lineWidth = (style.lineWidth || 1);
  69482. // 原始代码
  69483. // newStyle.lineWidth = (style.lineWidth || 1)
  69484. // + this.getHighlightZoom();
  69485. // 修改代码1
  69486. // if(!style.lineType || style.lineType === "solid"){
  69487. // newStyle.lineWidth = (style.lineWidth || 1)
  69488. // + this.getHighlightZoom();
  69489. // }
  69490. // else{
  69491. // newStyle.lineWidth = (style.lineWidth || 1);
  69492. // }
  69493. // SMIC-方法修改 - end
  69494. newStyle.brushType = 'both';
  69495. } else {
  69496. if (brushTypeOnly != 'stroke') {
  69497. // 描边型的则用原色加工高亮
  69498. newStyle.strokeColor = highlightColor;
  69499. // SMIC-方法修改 - start
  69500. newStyle.lineWidth = (style.lineWidth || 1);
  69501. // 原始代码
  69502. // newStyle.lineWidth = (style.lineWidth || 1)
  69503. // + this.getHighlightZoom();
  69504. // 修改代码1
  69505. // if(!style.lineType || style.lineType === "solid"){
  69506. // newStyle.lineWidth = (style.lineWidth || 1)
  69507. // + this.getHighlightZoom();
  69508. // }
  69509. // else{
  69510. // newStyle.lineWidth = (style.lineWidth || 1);
  69511. // }
  69512. // SMIC-方法修改 - end
  69513. } else {
  69514. // 线型的则用原色加工高亮
  69515. newStyle.strokeColor = highlightStyle.strokeColor
  69516. || SUtil_SUtil.Util_color.mix(
  69517. style.strokeColor,
  69518. SUtil_SUtil.Util_color.toRGB(highlightColor)
  69519. );
  69520. }
  69521. }
  69522. // 可自定义覆盖默认值
  69523. for (let k in highlightStyle) {
  69524. if (typeof highlightStyle[k] != 'undefined') {
  69525. newStyle[k] = highlightStyle[k];
  69526. }
  69527. }
  69528. return newStyle;
  69529. }
  69530. /**
  69531. * @function LevelRenderer.Shape.prototype.getHighlightZoom
  69532. * @description 高亮放大效果参数,当前统一设置为6,如有需要差异设置,通过 this.type 判断实例类型
  69533. *
  69534. */
  69535. getHighlightZoom() {
  69536. return this.type != 'text' ? 6 : 2;
  69537. }
  69538. /**
  69539. * @function LevelRenderer.Shape.prototype.drift
  69540. * @description 移动位置
  69541. *
  69542. * @param {Object} dx - 横坐标变化。
  69543. * @param {Object} dy - 纵坐标变化。
  69544. *
  69545. */
  69546. drift(dx, dy) {
  69547. this.position[0] += dx;
  69548. this.position[1] += dy;
  69549. }
  69550. /**
  69551. * @function LevelRenderer.Shape.prototype.buildPath
  69552. * @description 构建绘制的Path。子类必须重新实现此方法。
  69553. *
  69554. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  69555. * @param {Object} style - 样式。
  69556. */
  69557. buildPath(ctx, style) { // eslint-disable-line no-unused-vars
  69558. SUtil_SUtil.Util_log('buildPath not implemented in ' + this.type);
  69559. }
  69560. /**
  69561. * @function LevelRenderer.Shape.prototype.getRect
  69562. * @description 计算返回包围盒矩形。子类必须重新实现此方法。
  69563. *
  69564. * @param {Object} style - 样式。
  69565. */
  69566. getRect(style) { // eslint-disable-line no-unused-vars
  69567. SUtil_SUtil.Util_log('getRect not implemented in ' + this.type);
  69568. }
  69569. /**
  69570. * @function LevelRenderer.Shape.prototype.isCover
  69571. * @description 判断鼠标位置是否在图形内。
  69572. *
  69573. * @param {number} x - x。
  69574. * @param {number} y - y。
  69575. */
  69576. isCover(x, y) {
  69577. var originPos = this.getTansform(x, y);
  69578. x = originPos[0];
  69579. y = originPos[1];
  69580. // 快速预判并保留判断矩形
  69581. var rect = this.style.__rect;
  69582. if (!rect) {
  69583. rect = this.style.__rect = this.getRect(this.style);
  69584. }
  69585. if (x >= rect.x
  69586. && x <= (rect.x + rect.width)
  69587. && y >= rect.y
  69588. && y <= (rect.y + rect.height)
  69589. ) {
  69590. // 矩形内
  69591. return SUtil_SUtil.Util_area.isInside(this, this.style, x, y);
  69592. }
  69593. return false;
  69594. }
  69595. /**
  69596. * @function LevelRenderer.Shape.prototype.drawText
  69597. * @description 绘制附加文本。
  69598. *
  69599. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  69600. * @param {string} style - 样式。
  69601. * @param {string} normalStyle - normalStyle 默认样式,用于定位文字显示。
  69602. */
  69603. drawText(ctx, style, normalStyle) {
  69604. if (typeof(style.text) == 'undefined' || style.text === false) {
  69605. return;
  69606. }
  69607. // 字体颜色策略
  69608. var textColor = style.textColor || style.color || style.strokeColor;
  69609. ctx.fillStyle = textColor;
  69610. // 文本与图形间空白间隙
  69611. var dd = 10;
  69612. var al; // 文本水平对齐
  69613. var bl; // 文本垂直对齐
  69614. var tx; // 文本横坐标
  69615. var ty; // 文本纵坐标
  69616. var textPosition = style.textPosition // 用户定义
  69617. || this.textPosition // shape默认
  69618. || 'top'; // 全局默认
  69619. // Smic 方法修改 -start
  69620. var __OP = [];
  69621. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  69622. __OP = [0, 0];
  69623. } else {
  69624. __OP = this.refOriginalPosition;
  69625. }
  69626. //原代码:
  69627. // Smic 方法修改 -end
  69628. switch (textPosition) {
  69629. case 'inside':
  69630. case 'top':
  69631. case 'bottom':
  69632. case 'left':
  69633. case 'right':
  69634. if (this.getRect) {
  69635. var rect = (normalStyle || style).__rect
  69636. || this.getRect(normalStyle || style);
  69637. switch (textPosition) {
  69638. case 'inside':
  69639. tx = rect.x + rect.width / 2;
  69640. ty = rect.y + rect.height / 2;
  69641. al = 'center';
  69642. bl = 'middle';
  69643. if (style.brushType != 'stroke'
  69644. && textColor == style.color
  69645. ) {
  69646. ctx.fillStyle = '#fff';
  69647. }
  69648. break;
  69649. case 'left':
  69650. tx = rect.x - dd;
  69651. ty = rect.y + rect.height / 2;
  69652. al = 'end';
  69653. bl = 'middle';
  69654. break;
  69655. case 'right':
  69656. tx = rect.x + rect.width + dd;
  69657. ty = rect.y + rect.height / 2;
  69658. al = 'start';
  69659. bl = 'middle';
  69660. break;
  69661. case 'top':
  69662. tx = rect.x + rect.width / 2;
  69663. ty = rect.y - dd;
  69664. al = 'center';
  69665. bl = 'bottom';
  69666. break;
  69667. case 'bottom':
  69668. tx = rect.x + rect.width / 2;
  69669. ty = rect.y + rect.height + dd;
  69670. al = 'center';
  69671. bl = 'top';
  69672. break;
  69673. }
  69674. }
  69675. break;
  69676. case 'start':
  69677. case 'end':
  69678. var xStart = 0;
  69679. var xEnd = 0;
  69680. var yStart = 0;
  69681. var yEnd = 0;
  69682. if (typeof style.pointList != 'undefined') {
  69683. var pointList = style.pointList;
  69684. if (pointList.length < 2) {
  69685. // 少于2个点就不画了~
  69686. return;
  69687. }
  69688. var length = pointList.length;
  69689. switch (textPosition) {
  69690. // Smic 方法修改 -start
  69691. case 'start':
  69692. xStart = pointList[0][0] + __OP[0];
  69693. xEnd = pointList[1][0] + __OP[0];
  69694. yStart = pointList[0][1] + __OP[1];
  69695. yEnd = pointList[1][1] + __OP[1];
  69696. break;
  69697. case 'end':
  69698. xStart = pointList[length - 2][0] + __OP[0];
  69699. xEnd = pointList[length - 1][0] + __OP[0];
  69700. yStart = pointList[length - 2][1] + __OP[1];
  69701. yEnd = pointList[length - 1][1] + __OP[1];
  69702. break;
  69703. //原代码:
  69704. /*
  69705. case 'start':
  69706. xStart = pointList[0][0];
  69707. xEnd = pointList[1][0];
  69708. yStart = pointList[0][1];
  69709. yEnd = pointList[1][1];
  69710. break;
  69711. case 'end':
  69712. xStart = pointList[length - 2][0];
  69713. xEnd = pointList[length - 1][0];
  69714. yStart = pointList[length - 2][1];
  69715. yEnd = pointList[length - 1][1];
  69716. break;
  69717. */
  69718. // Smic 方法修改 -end
  69719. }
  69720. } else {
  69721. // Smic 方法修改 -start
  69722. xStart = (style.xStart + __OP[0]) || 0;
  69723. xEnd = (style.xEnd + __OP[0]) || 0;
  69724. yStart = (style.yStart + __OP[1]) || 0;
  69725. yEnd = (style.yEnd + __OP[1]) || 0;
  69726. //原代码:
  69727. /*
  69728. xStart = style.xStart || 0;
  69729. xEnd = style.xEnd || 0;
  69730. yStart = style.yStart || 0;
  69731. yEnd = style.yEnd || 0;
  69732. */
  69733. // Smic 方法修改 -end
  69734. }
  69735. switch (textPosition) {
  69736. case 'start':
  69737. al = xStart < xEnd ? 'end' : 'start';
  69738. bl = yStart < yEnd ? 'bottom' : 'top';
  69739. tx = xStart;
  69740. ty = yStart;
  69741. break;
  69742. case 'end':
  69743. al = xStart < xEnd ? 'start' : 'end';
  69744. bl = yStart < yEnd ? 'top' : 'bottom';
  69745. tx = xEnd;
  69746. ty = yEnd;
  69747. break;
  69748. }
  69749. dd -= 4;
  69750. if (xStart && xEnd && xStart != xEnd) {
  69751. tx -= (al == 'end' ? dd : -dd);
  69752. } else {
  69753. al = 'center';
  69754. }
  69755. if (yStart != yEnd) {
  69756. ty -= (bl == 'bottom' ? dd : -dd);
  69757. } else {
  69758. bl = 'middle';
  69759. }
  69760. break;
  69761. case 'specific':
  69762. tx = style.textX || 0;
  69763. ty = style.textY || 0;
  69764. al = 'start';
  69765. bl = 'middle';
  69766. break;
  69767. }
  69768. // Smic 方法修改 -start
  69769. if (style.labelXOffset && !isNaN(style.labelXOffset)) {
  69770. tx += style.labelXOffset;
  69771. }
  69772. if (style.labelYOffset && !isNaN(style.labelYOffset)) {
  69773. ty += style.labelYOffset;
  69774. }
  69775. //原代码:
  69776. // Smic 方法修改 -end
  69777. if (tx != null && ty != null) {
  69778. Shape_Shape._fillText(
  69779. ctx,
  69780. style.text,
  69781. tx, ty,
  69782. style.textFont,
  69783. style.textAlign || al,
  69784. style.textBaseline || bl
  69785. );
  69786. }
  69787. }
  69788. /**
  69789. * @function LevelRenderer.Shape.prototype.modSelf
  69790. * @description 图形发生改变
  69791. */
  69792. modSelf() {
  69793. this.__dirty = true;
  69794. if (this.style) {
  69795. this.style.__rect = null;
  69796. }
  69797. if (this.highlightStyle) {
  69798. this.highlightStyle.__rect = null;
  69799. }
  69800. }
  69801. /**
  69802. * @function LevelRenderer.Shape.prototype.isSilent
  69803. * @description 图形是否会触发事件,通过 bind 绑定的事件
  69804. */
  69805. isSilent() {
  69806. return !(
  69807. this.hoverable || this.draggable || this.clickable
  69808. || this.onmousemove || this.onmouseover || this.onmouseout
  69809. || this.onmousedown || this.onmouseup || this.onclick
  69810. || this.ondragenter || this.ondragover || this.ondragleave
  69811. || this.ondrop
  69812. );
  69813. }
  69814. /**
  69815. * @function LevelRenderer.Shape.prototype.setCtxGlobalAlpha
  69816. * @description 设置 Cavans 上下文全局透明度
  69817. *
  69818. * @param {Object} _ctx - Cavans 上下文
  69819. * @param {string} type - one of 'stroke', 'fill', or 'reset'
  69820. * @param {Object} style - Symbolizer hash
  69821. */
  69822. setCtxGlobalAlpha(_ctx, type, style) {
  69823. if (type === "fill") {
  69824. _ctx.globalAlpha = typeof(style["fillOpacity"]) === "undefined" ? (typeof(style["opacity"]) === "undefined" ? 1 : style['opacity']) : style['fillOpacity'];
  69825. } else if (type === "stroke") {
  69826. _ctx.globalAlpha = typeof(style["strokeOpacity"]) === "undefined" ? (typeof(style["opacity"]) === "undefined" ? 1 : style['opacity']) : style['strokeOpacity'];
  69827. } else {
  69828. _ctx.globalAlpha = typeof(style["opacity"]) === "undefined" ? 1 : style['opacity'];
  69829. }
  69830. }
  69831. /**
  69832. * @function LevelRenderer.Shape.prototype._fillText
  69833. * @description 填充文本
  69834. */
  69835. static _fillText(ctx, text, x, y, textFont, textAlign, textBaseline) {
  69836. if (textFont) {
  69837. ctx.font = textFont;
  69838. }
  69839. ctx.textAlign = textAlign;
  69840. ctx.textBaseline = textBaseline;
  69841. var rect = Shape_Shape._getTextRect(
  69842. text, x, y, textFont, textAlign, textBaseline
  69843. );
  69844. text = (text + '').split('\n');
  69845. var lineHeight = SUtil_SUtil.Util_area.getTextHeight('ZH', textFont);
  69846. switch (textBaseline) {
  69847. case 'top':
  69848. y = rect.y;
  69849. break;
  69850. case 'bottom':
  69851. y = rect.y + lineHeight;
  69852. break;
  69853. default:
  69854. y = rect.y + lineHeight / 2;
  69855. }
  69856. for (var i = 0, l = text.length; i < l; i++) {
  69857. ctx.fillText(text[i], x, y);
  69858. y += lineHeight;
  69859. }
  69860. }
  69861. /**
  69862. * @function LevelRenderer.Shape._getTextRect
  69863. * @description 返回矩形区域,用于局部刷新和文字定位
  69864. *
  69865. * @param {string} text - text。
  69866. * @param {number} x - x。
  69867. * @param {number} y - y。
  69868. * @param {string} textFont - textFont。
  69869. * @param {string} textAlign - textAlign。
  69870. * @param {string} textBaseline - textBaseline。
  69871. * @return {Object} 矩形区域。
  69872. */
  69873. static _getTextRect(text, x, y, textFont, textAlign, textBaseline) {
  69874. var width = SUtil_SUtil.Util_area.getTextWidth(text, textFont);
  69875. var lineHeight = SUtil_SUtil.Util_area.getTextHeight('ZH', textFont);
  69876. text = (text + '').split('\n');
  69877. switch (textAlign) {
  69878. case 'end':
  69879. case 'right':
  69880. x -= width;
  69881. break;
  69882. case 'center':
  69883. x -= (width / 2);
  69884. break;
  69885. }
  69886. switch (textBaseline) {
  69887. case 'top':
  69888. break;
  69889. case 'bottom':
  69890. y -= lineHeight * text.length;
  69891. break;
  69892. default:
  69893. y -= lineHeight * text.length / 2;
  69894. }
  69895. return {
  69896. x: x,
  69897. y: y,
  69898. width: width,
  69899. height: lineHeight * text.length
  69900. };
  69901. }
  69902. }
  69903. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicPoint.js
  69904. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  69905. * This program are made available under the terms of the Apache License, Version 2.0
  69906. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  69907. /**
  69908. * @private
  69909. * @class LevelRenderer.Shape.SmicPoint
  69910. * @category Visualization Theme
  69911. * @classdesc 点。
  69912. * @extends LevelRenderer.Shape
  69913. * @example
  69914. * var shape = new LevelRenderer.Shape.SmicPoint({
  69915. * style: {
  69916. * x: 100,
  69917. * y: 100,
  69918. * r: 40,
  69919. * brushType: 'both',
  69920. * color: 'blue',
  69921. * strokeColor: 'red',
  69922. * lineWidth: 3,
  69923. * text: 'point'
  69924. * }
  69925. * });
  69926. * levelRenderer.addShape(shape);
  69927. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  69928. *
  69929. */
  69930. class SmicPoint extends Shape_Shape {
  69931. constructor(options) {
  69932. super(options);
  69933. /**
  69934. * @member {string} LevelRenderer.Shape.SmicPoint.prototype.type
  69935. * @description 图形类型。
  69936. */
  69937. this.type = 'smicpoint';
  69938. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  69939. this.refOriginalPosition = [0, 0];
  69940. }
  69941. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicPoint";
  69942. }
  69943. /**
  69944. * @function cdestroy
  69945. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  69946. */
  69947. destroy() {
  69948. this.type = null;
  69949. super.destroy();
  69950. }
  69951. /**
  69952. * @function LevelRenderer.Shape.SmicPoint.prototype.buildPath
  69953. * @description 创建点触。
  69954. *
  69955. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  69956. * @param {Object} style - style。
  69957. *
  69958. */
  69959. buildPath(ctx, style) {
  69960. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  69961. this.refOriginalPosition = [0, 0];
  69962. }
  69963. var __OP = this.refOriginalPosition;
  69964. ctx.arc(style.x + __OP[0], style.y + __OP[1], style.r, 0, Math.PI * 2, true);
  69965. return;
  69966. }
  69967. /**
  69968. * @function LevelRenderer.Shape.SmicPoint.prototype.getRect
  69969. * @description 计算返回点的包围盒矩形。该包围盒是直接从四个控制点计算,并非最小包围盒。
  69970. *
  69971. * @param {Object} style - style
  69972. * @return {Object} 边框对象。包含属性:x,y,width,height。
  69973. */
  69974. getRect(style) {
  69975. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  69976. this.refOriginalPosition = [0, 0];
  69977. }
  69978. var __OP = this.refOriginalPosition;
  69979. if (style.__rect) {
  69980. return style.__rect;
  69981. }
  69982. var lineWidth;
  69983. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  69984. lineWidth = style.lineWidth || 1;
  69985. } else {
  69986. lineWidth = 0;
  69987. }
  69988. style.__rect = {
  69989. x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
  69990. y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
  69991. width: style.r * 2 + lineWidth,
  69992. height: style.r * 2 + lineWidth
  69993. };
  69994. return style.__rect;
  69995. }
  69996. }
  69997. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicText.js
  69998. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  69999. * This program are made available under the terms of the Apache License, Version 2.0
  70000. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  70001. /**
  70002. * @private
  70003. * @class LevelRenderer.Shape.SmicText
  70004. * @category Visualization Theme
  70005. * @extends {LevelRenderer.Shape}
  70006. * @example
  70007. * var shape = new LevelRenderer.Shape.SmicText({
  70008. * style: {
  70009. * text: 'Label',
  70010. * x: 100,
  70011. * y: 100,
  70012. * textFont: '14px Arial'
  70013. * }
  70014. * });
  70015. * levelRenderer.addShape(shape);
  70016. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  70017. */
  70018. class SmicText extends Shape_Shape {
  70019. constructor(options) {
  70020. super(options);
  70021. /**
  70022. * @member {string} LevelRenderer.Shape.SmicText.prototype.type
  70023. * @description 图形类型.
  70024. */
  70025. this.type = 'smictext';
  70026. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  70027. this.refOriginalPosition = [0, 0];
  70028. }
  70029. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicText";
  70030. }
  70031. /**
  70032. * @function LevelRenderer.Shape.SmicText.prototype.destroy
  70033. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  70034. */
  70035. destroy() {
  70036. this.type = null;
  70037. super.destroy();
  70038. }
  70039. /**
  70040. * @function LevelRenderer.Shape.SmicText.prototype.brush
  70041. * @description 笔触。
  70042. *
  70043. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  70044. * @param {boolean} isHighlight - 是否使用高亮属性。
  70045. *
  70046. */
  70047. brush(ctx, isHighlight) {
  70048. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  70049. this.refOriginalPosition = [0, 0];
  70050. }
  70051. var __OP = this.refOriginalPosition;
  70052. var style = this.style;
  70053. if (isHighlight) {
  70054. // 根据style扩展默认高亮样式
  70055. style = this.getHighlightStyle(
  70056. style, this.highlightStyle || {}
  70057. );
  70058. }
  70059. if (typeof(style.text) == 'undefined' || style.text === false) {
  70060. return;
  70061. }
  70062. ctx.save();
  70063. this.doClip(ctx);
  70064. this.setContext(ctx, style);
  70065. // 设置transform
  70066. this.setTransform(ctx);
  70067. if (style.textFont) {
  70068. ctx.font = style.textFont;
  70069. }
  70070. ctx.textAlign = style.textAlign || 'start';
  70071. ctx.textBaseline = style.textBaseline || 'middle';
  70072. var text = (style.text + '').split('\n');
  70073. var lineHeight = SUtil_SUtil.Util_area.getTextHeight('ZH', style.textFont);
  70074. var rect = this.getRectNoRotation(style);
  70075. // var x = style.x;
  70076. var x = style.x + __OP[0];
  70077. var y;
  70078. if (style.textBaseline == 'top') {
  70079. y = rect.y;
  70080. } else if (style.textBaseline == 'bottom') {
  70081. y = rect.y + lineHeight;
  70082. } else {
  70083. y = rect.y + lineHeight / 2;
  70084. }
  70085. var ox = style.x + __OP[0];
  70086. var oy = style.y + __OP[1];
  70087. //文本绘制
  70088. for (var i = 0, l = text.length; i < l; i++) {
  70089. //是否渲染矩形背景及颜色
  70090. if (style.labelRect) {
  70091. //+4,-2是为了让文字距边框左右边缘有点间隔
  70092. ctx.fillRect(rect.x - 2, rect.y, rect.width + 4, rect.height);
  70093. ctx.fillStyle = style.strokeColor;
  70094. ctx.strokeRect(rect.x - 2, rect.y, rect.width + 4, rect.height);
  70095. ctx.fillStyle = style.textColor;
  70096. }
  70097. switch (style.brushType) {
  70098. case 'stroke':
  70099. this.setCtxGlobalAlpha(ctx, "stroke", style);
  70100. if (style.textRotation && style.textRotation !== 0) {
  70101. ctx.save();
  70102. ctx.translate(ox, oy);
  70103. ctx.rotate(style.textRotation * Math.PI / 180);
  70104. if (style.textBaseline == 'top') {
  70105. if (style.maxWidth) {
  70106. ctx.strokeText(text[i], 0, lineHeight * i, style.maxWidth);
  70107. } else {
  70108. ctx.strokeText(text[i], 0, lineHeight * i);
  70109. }
  70110. } else if (style.textBaseline == 'bottom') {
  70111. if (style.maxWidth) {
  70112. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
  70113. } else {
  70114. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height);
  70115. }
  70116. } else {
  70117. if (style.maxWidth) {
  70118. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
  70119. } else {
  70120. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
  70121. }
  70122. }
  70123. ctx.restore();
  70124. } else {
  70125. if (style.maxWidth) {
  70126. ctx.strokeText(text[i], x, y, style.maxWidth);
  70127. } else {
  70128. ctx.strokeText(text[i], x, y);
  70129. }
  70130. }
  70131. this.setCtxGlobalAlpha(ctx, "reset", style);
  70132. break;
  70133. case 'both':
  70134. if (style.textRotation && style.textRotation !== 0) {
  70135. ctx.save();
  70136. ctx.translate(ox, oy);
  70137. ctx.rotate(style.textRotation * Math.PI / 180);
  70138. if (style.textBaseline == 'top') {
  70139. if (style.maxWidth) {
  70140. this.setCtxGlobalAlpha(ctx, "fill", style);
  70141. ctx.fillText(text[i], 0, lineHeight * i, style.maxWidth);
  70142. this.setCtxGlobalAlpha(ctx, "reset", style);
  70143. this.setCtxGlobalAlpha(ctx, "stroke", style);
  70144. ctx.strokeText(text[i], 0, lineHeight * i, style.maxWidth);
  70145. this.setCtxGlobalAlpha(ctx, "reset", style);
  70146. } else {
  70147. this.setCtxGlobalAlpha(ctx, "fill", style);
  70148. ctx.fillText(text[i], 0, lineHeight * i);
  70149. this.setCtxGlobalAlpha(ctx, "reset", style);
  70150. this.setCtxGlobalAlpha(ctx, "stroke", style);
  70151. ctx.strokeText(text[i], 0, lineHeight * i);
  70152. this.setCtxGlobalAlpha(ctx, "reset", style);
  70153. }
  70154. } else if (style.textBaseline == 'bottom') {
  70155. if (style.maxWidth) {
  70156. this.setCtxGlobalAlpha(ctx, "fill", style);
  70157. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
  70158. this.setCtxGlobalAlpha(ctx, "reset", style);
  70159. this.setCtxGlobalAlpha(ctx, "stroke", style);
  70160. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
  70161. this.setCtxGlobalAlpha(ctx, "reset", style);
  70162. } else {
  70163. this.setCtxGlobalAlpha(ctx, "fill", style);
  70164. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height);
  70165. this.setCtxGlobalAlpha(ctx, "reset", style);
  70166. this.setCtxGlobalAlpha(ctx, "stroke", style);
  70167. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height);
  70168. this.setCtxGlobalAlpha(ctx, "reset", style);
  70169. }
  70170. } else {
  70171. if (style.maxWidth) {
  70172. this.setCtxGlobalAlpha(ctx, "fill", style);
  70173. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
  70174. this.setCtxGlobalAlpha(ctx, "reset", style);
  70175. this.setCtxGlobalAlpha(ctx, "stroke", style);
  70176. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
  70177. this.setCtxGlobalAlpha(ctx, "reset", style);
  70178. } else {
  70179. this.setCtxGlobalAlpha(ctx, "fill", style);
  70180. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
  70181. this.setCtxGlobalAlpha(ctx, "reset", style);
  70182. this.setCtxGlobalAlpha(ctx, "stroke", style);
  70183. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
  70184. this.setCtxGlobalAlpha(ctx, "reset", style);
  70185. }
  70186. }
  70187. ctx.restore();
  70188. } else {
  70189. if (style.maxWidth) {
  70190. this.setCtxGlobalAlpha(ctx, "fill", style);
  70191. ctx.fillText(text[i], x, y, style.maxWidth);
  70192. this.setCtxGlobalAlpha(ctx, "reset", style);
  70193. this.setCtxGlobalAlpha(ctx, "stroke", style);
  70194. ctx.strokeText(text[i], x, y, style.maxWidth);
  70195. this.setCtxGlobalAlpha(ctx, "reset", style);
  70196. } else {
  70197. this.setCtxGlobalAlpha(ctx, "fill", style);
  70198. ctx.fillText(text[i], x, y);
  70199. this.setCtxGlobalAlpha(ctx, "reset", style);
  70200. this.setCtxGlobalAlpha(ctx, "stroke", style);
  70201. ctx.strokeText(text[i], x, y);
  70202. this.setCtxGlobalAlpha(ctx, "reset", style);
  70203. }
  70204. }
  70205. break;
  70206. default:
  70207. //fill or others
  70208. this.setCtxGlobalAlpha(ctx, "fill", style);
  70209. if (style.textRotation && style.textRotation !== 0) {
  70210. ctx.save();
  70211. ctx.translate(ox, oy);
  70212. ctx.rotate(style.textRotation * Math.PI / 180);
  70213. if (style.textBaseline == 'top') {
  70214. if (style.maxWidth) {
  70215. ctx.fillText(text[i], 0, lineHeight * i, style.maxWidth);
  70216. } else {
  70217. ctx.fillText(text[i], 0, lineHeight * i);
  70218. }
  70219. } else if (style.textBaseline == 'bottom') {
  70220. if (style.maxWidth) {
  70221. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
  70222. } else {
  70223. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height);
  70224. }
  70225. } else {
  70226. if (style.maxWidth) {
  70227. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
  70228. } else {
  70229. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
  70230. }
  70231. }
  70232. ctx.restore();
  70233. } else {
  70234. if (style.maxWidth) {
  70235. ctx.fillText(text[i], x, y, style.maxWidth);
  70236. } else {
  70237. ctx.fillText(text[i], x, y);
  70238. }
  70239. }
  70240. this.setCtxGlobalAlpha(ctx, "reset", style);
  70241. }
  70242. y += lineHeight;
  70243. }
  70244. ctx.restore();
  70245. return;
  70246. }
  70247. /**
  70248. * @function LevelRenderer.Shape.SmicText.prototype.getRect
  70249. * @description 返回文字包围盒矩形
  70250. */
  70251. getRect(style) {
  70252. if (style.__rect) {
  70253. return style.__rect;
  70254. }
  70255. var left, top, right, bottom
  70256. var tbg = this.getTextBackground(style, true);
  70257. for (var i = 0, len = tbg.length; i < len; i++) {
  70258. var poi = tbg[i];
  70259. //用第一个点初始化
  70260. if (i == 0) {
  70261. left = poi[0];
  70262. right = poi[0];
  70263. top = poi[1];
  70264. bottom = poi[1];
  70265. } else {
  70266. if (poi[0] < left) {
  70267. left = poi[0]
  70268. }
  70269. if (poi[0] > right) {
  70270. right = poi[0]
  70271. }
  70272. if (poi[1] < top) {
  70273. top = poi[1]
  70274. }
  70275. if (poi[1] > bottom) {
  70276. bottom = poi[1]
  70277. }
  70278. }
  70279. }
  70280. style.__rect = {
  70281. x: left,
  70282. y: top,
  70283. width: right - left,
  70284. height: bottom - top
  70285. };
  70286. return style.__rect;
  70287. }
  70288. /**
  70289. * @function LevelRenderer.Shape.SmicText.prototype.getRectNoRotation
  70290. * @description 返回忽略旋转和maxWidth时文字包围盒矩形
  70291. */
  70292. getRectNoRotation(style) {
  70293. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  70294. this.refOriginalPosition = [0, 0];
  70295. }
  70296. var __OP = this.refOriginalPosition;
  70297. var lineHeight = SUtil_SUtil.Util_area.getTextHeight('ZH', style.textFont);
  70298. var width = SUtil_SUtil.Util_area.getTextWidth(style.text, style.textFont);
  70299. var height = SUtil_SUtil.Util_area.getTextHeight(style.text, style.textFont);
  70300. //处理文字位置,注:文本的绘制是由此 rect 决定
  70301. var textX = style.x + __OP[0]; // 默认start == left
  70302. if (style.textAlign == 'end' || style.textAlign == 'right') {
  70303. textX -= width;
  70304. } else if (style.textAlign == 'center') {
  70305. textX -= (width / 2);
  70306. }
  70307. var textY;
  70308. if (style.textBaseline == 'top') {
  70309. // textY = style.y;
  70310. textY = style.y + __OP[1];
  70311. } else if (style.textBaseline == 'bottom') {
  70312. textY = (style.y + __OP[1]) - height;
  70313. } else {
  70314. // middle
  70315. textY = (style.y + __OP[1]) - height / 2;
  70316. }
  70317. var isWidthChangeByMaxWidth = false;
  70318. var widthBeforeChangeByMaxWidth;
  70319. //处理 maxWidth
  70320. if (style.maxWidth) {
  70321. var maxWidth = parseInt(style.maxWidth);
  70322. if (maxWidth < width) {
  70323. widthBeforeChangeByMaxWidth = width;
  70324. isWidthChangeByMaxWidth = true;
  70325. width = maxWidth;
  70326. }
  70327. textX = style.x + __OP[0];
  70328. if (style.textAlign == 'end' || style.textAlign == 'right') {
  70329. textX -= width;
  70330. } else if (style.textAlign == 'center') {
  70331. textX -= (width / 2);
  70332. }
  70333. }
  70334. //处理斜体字
  70335. if (style.textFont) {
  70336. var textFont = style.textFont;
  70337. var textFontStr = textFont.toLowerCase()
  70338. if (textFontStr.indexOf("italic") > -1) {
  70339. if (isWidthChangeByMaxWidth === true) {
  70340. width += (lineHeight / 3) * (width / widthBeforeChangeByMaxWidth);
  70341. } else {
  70342. width += lineHeight / 3;
  70343. }
  70344. }
  70345. }
  70346. var rect = {
  70347. x: textX,
  70348. y: textY,
  70349. width: width,
  70350. height: height
  70351. };
  70352. return rect;
  70353. }
  70354. /**
  70355. * @function LevelRenderer.Shape.SmicText.prototype.getTextBackground
  70356. * @description 获取文本背景框范围
  70357. *
  70358. * @param {Object} style - 样式。
  70359. * @param {boolean} redo - 是否强制重新计算 textBackground。
  70360. */
  70361. getTextBackground(style, redo) {
  70362. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  70363. this.refOriginalPosition = [0, 0];
  70364. }
  70365. var __OP = this.refOriginalPosition;
  70366. if ((!redo) && style.__textBackground) {
  70367. return style.__textBackground;
  70368. }
  70369. //不旋转时矩形框
  70370. var rect = this.getRectNoRotation(style);
  70371. //旋转中心点
  70372. var ox = style.x + __OP[0];
  70373. var oy = style.y + __OP[1];
  70374. //背景框
  70375. var background = [];
  70376. if (style.textRotation && style.textRotation !== 0) {
  70377. let textRotation = style.textRotation;
  70378. let ltPoi = this.getRotatedLocation(rect.x, rect.y, ox, oy, textRotation);
  70379. let rtPoi = this.getRotatedLocation(rect.x + rect.width, rect.y, ox, oy, textRotation);
  70380. let rbPoi = this.getRotatedLocation(rect.x + rect.width, rect.y + rect.height, ox, oy, textRotation);
  70381. let lbPoi = this.getRotatedLocation(rect.x, rect.y + rect.height, ox, oy, textRotation);
  70382. background.push(ltPoi);
  70383. background.push(rtPoi);
  70384. background.push(rbPoi);
  70385. background.push(lbPoi);
  70386. } else {
  70387. let ltPoi = [rect.x, rect.y];
  70388. let rtPoi = [rect.x + rect.width, rect.y];
  70389. let rbPoi = [rect.x + rect.width, rect.y + rect.height];
  70390. let lbPoi = [rect.x, rect.y + rect.height];
  70391. background.push(ltPoi);
  70392. background.push(rtPoi);
  70393. background.push(rbPoi);
  70394. background.push(lbPoi);
  70395. }
  70396. style.__textBackground = background;
  70397. return style.__textBackground;
  70398. }
  70399. /**
  70400. * @function LevelRenderer.Shape.SmicText.prototype.getRotatedLocation
  70401. * @description 获取一个点绕旋转中心顺时针旋转后的位置。(此方法用于屏幕坐标)
  70402. *
  70403. * @param {number} x - 旋转点横坐标。
  70404. * @param {number} y - 旋转点纵坐标。
  70405. * @param {number} rx - 旋转中心点横坐标。
  70406. * @param {number} ry - 旋转中心点纵坐标。
  70407. * @param {number} angle - 旋转角度(度)。
  70408. * @return {Array.<number>} 旋转后的坐标位置,长度为 2 的一维数组,数组第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  70409. */
  70410. getRotatedLocation(x, y, rx, ry, angle) {
  70411. var loc = new Array(), x0, y0;
  70412. y = -y;
  70413. ry = -ry;
  70414. angle = -angle;//顺时针旋转
  70415. x0 = (x - rx) * Math.cos((angle / 180) * Math.PI) - (y - ry) * Math.sin((angle / 180) * Math.PI) + rx;
  70416. y0 = (x - rx) * Math.sin((angle / 180) * Math.PI) + (y - ry) * Math.cos((angle / 180) * Math.PI) + ry;
  70417. loc[0] = x0;
  70418. loc[1] = -y0;
  70419. return loc;
  70420. }
  70421. }
  70422. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicCircle.js
  70423. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  70424. * This program are made available under the terms of the Apache License, Version 2.0
  70425. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  70426. /**
  70427. * @private
  70428. * @class LevelRenderer.Shape.SmicCircle
  70429. * @category Visualization Theme
  70430. * @classdesc 圆形
  70431. * @extends LevelRenderer.Shape
  70432. * @example
  70433. * var shape = new LevelRenderer.Shape.SmicCircle({
  70434. * style: {
  70435. * x: 100,
  70436. * y: 100,
  70437. * r: 60,
  70438. * brushType: "both",
  70439. * color: "blue",
  70440. * strokeColor: "red",
  70441. * lineWidth: 3,
  70442. * text: "Circle"
  70443. * }
  70444. * });
  70445. * levelRenderer.addShape(shape);
  70446. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  70447. *
  70448. */
  70449. class SmicCircle extends Shape_Shape {
  70450. constructor(options) {
  70451. super(options);
  70452. /**
  70453. * @member {string} LevelRenderer.Shape.SmicCircle.prototype.type
  70454. * @description 图形类型。
  70455. */
  70456. this.type = 'smiccircle';
  70457. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  70458. this.refOriginalPosition = [0, 0];
  70459. }
  70460. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicCircle";
  70461. }
  70462. /**
  70463. * @function LevelRenderer.Shape.SmicCircle.prototype.destroy
  70464. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  70465. */
  70466. destroy() {
  70467. this.type = null;
  70468. super.destroy();
  70469. }
  70470. /**
  70471. * @function LevelRenderer.Shape.SmicCircle.prototype.buildPath
  70472. * @description 创建图形路径。
  70473. *
  70474. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  70475. * @param {Object} style - style。
  70476. *
  70477. */
  70478. buildPath(ctx, style) {
  70479. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  70480. this.refOriginalPosition = [0, 0];
  70481. }
  70482. var __OP = this.refOriginalPosition;
  70483. var x = style.x + __OP[0]; // 圆心x
  70484. var y = style.y + __OP[1]; // 圆心y
  70485. ctx.moveTo(x + style.r, y);
  70486. ctx.arc(x, y, style.r, 0, Math.PI * 2, true);
  70487. return true;
  70488. }
  70489. /**
  70490. * @function LevelRenderer.Shape.SmicCircle.prototype.getRect
  70491. * @description 返回圆形包围盒矩形
  70492. *
  70493. * @param {Object} style - style
  70494. * @return {Object} 边框对象。包含属性:x,y,width,height。
  70495. *
  70496. */
  70497. getRect(style) {
  70498. if (style.__rect) {
  70499. return style.__rect;
  70500. }
  70501. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  70502. this.refOriginalPosition = [0, 0];
  70503. }
  70504. var __OP = this.refOriginalPosition;
  70505. var x = style.x + __OP[0]; // 圆心x
  70506. var y = style.y + __OP[1]; // 圆心y
  70507. var r = style.r; // 圆r
  70508. var lineWidth;
  70509. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  70510. lineWidth = style.lineWidth || 1;
  70511. } else {
  70512. lineWidth = 0;
  70513. }
  70514. style.__rect = {
  70515. x: Math.round(x - r - lineWidth / 2),
  70516. y: Math.round(y - r - lineWidth / 2),
  70517. width: r * 2 + lineWidth,
  70518. height: r * 2 + lineWidth
  70519. };
  70520. return style.__rect;
  70521. }
  70522. }
  70523. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicPolygon.js
  70524. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  70525. * This program are made available under the terms of the Apache License, Version 2.0
  70526. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  70527. /**
  70528. * @private
  70529. * @class LevelRenderer.Shape.SmicPolygon
  70530. * @category Visualization Theme
  70531. * @classdesc 多边形。
  70532. * @extends LevelRenderer.Shape
  70533. * @example
  70534. * var shape = new LevelRenderer.Shape.SmicPolygon({
  70535. * style: {
  70536. * // 100x100 的正方形
  70537. * pointList: [[0, 0], [100, 0], [100, 100], [0, 100]],
  70538. * color: 'blue'
  70539. * }
  70540. * });
  70541. * levelRenderer.addShape(shape);
  70542. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  70543. */
  70544. class SmicPolygon extends Shape_Shape {
  70545. constructor(options) {
  70546. super(options);
  70547. /**
  70548. * @member {string} LevelRenderer.Shape.SmicPolygon.prototype.type
  70549. * @description 图形类型.
  70550. */
  70551. this.type = 'smicpolygon';
  70552. /**
  70553. * @member {Array} LevelRenderer.Shape.SmicPolygon.prototype._holePolygonPointList
  70554. * @description 岛洞面多边形顶点数组(三维数组)
  70555. *
  70556. */
  70557. this.holePolygonPointLists = null;
  70558. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  70559. this.refOriginalPosition = [0, 0];
  70560. }
  70561. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicPolygon";
  70562. }
  70563. /**
  70564. * @function LevelRenderer.Shape.SmicPolygon.prototype.destroy
  70565. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  70566. */
  70567. destroy() {
  70568. this.type = null;
  70569. this.holePolygonPointLists = null;
  70570. super.destroy();
  70571. }
  70572. /**
  70573. * @function LevelRenderer.Shape.SmicPolygon.prototype.brush
  70574. * @description 笔触。
  70575. *
  70576. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  70577. * @param {boolean} isHighlight - 是否使用高亮属性。
  70578. *
  70579. */
  70580. brush(ctx, isHighlight) {
  70581. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  70582. this.refOriginalPosition = [0, 0];
  70583. }
  70584. var style = this.style;
  70585. if (isHighlight) {
  70586. // 根据style扩展默认高亮样式
  70587. style = this.getHighlightStyle(
  70588. style,
  70589. this.highlightStyle || {}
  70590. );
  70591. }
  70592. ctx.save();
  70593. this.setContext(ctx, style);
  70594. // 设置 transform
  70595. this.setTransform(ctx);
  70596. // 先 fill 再stroke
  70597. var hasPath = false;
  70598. if (style.brushType == 'fill' || style.brushType == 'both' || typeof style.brushType == 'undefined') { // 默认为fill
  70599. ctx.beginPath();
  70600. if (style.lineType == 'dashed'
  70601. || style.lineType == 'dotted'
  70602. || style.lineType == 'dot'
  70603. || style.lineType == 'dash'
  70604. || style.lineType == 'dashdot'
  70605. || style.lineType == 'longdash'
  70606. || style.lineType == 'longdashdot'
  70607. ) {
  70608. // 特殊处理,虚线围不成path,实线再build一次
  70609. this.buildPath(ctx, {
  70610. lineType: 'solid',
  70611. lineWidth: style.lineWidth,
  70612. pointList: style.pointList
  70613. }
  70614. );
  70615. } else {
  70616. this.buildPath(ctx, style);
  70617. hasPath = true; // 这个path能用
  70618. }
  70619. ctx.closePath();
  70620. this.setCtxGlobalAlpha(ctx, "fill", style);
  70621. ctx.fill();
  70622. this.setCtxGlobalAlpha(ctx, "reset", style);
  70623. }
  70624. if (style.lineWidth > 0 && (style.brushType == 'stroke' || style.brushType == 'both')) {
  70625. if (!hasPath) {
  70626. ctx.beginPath();
  70627. this.buildPath(ctx, style);
  70628. }
  70629. this.setCtxGlobalAlpha(ctx, "stroke", style);
  70630. ctx.stroke();
  70631. this.setCtxGlobalAlpha(ctx, "reset", style);
  70632. }
  70633. this.drawText(ctx, style, this.style);
  70634. //岛洞
  70635. var hpStyle = Util_Util.cloneObject(style);
  70636. if (hpStyle.pointList) {
  70637. if (this.holePolygonPointLists && this.holePolygonPointLists.length > 0) {
  70638. var holePLS = this.holePolygonPointLists;
  70639. var holePLSen = holePLS.length;
  70640. for (var i = 0; i < holePLSen; i++) {
  70641. var holePL = holePLS[i];
  70642. //岛洞面
  70643. hpStyle.pointList = holePL;
  70644. ctx.globalCompositeOperation = "destination-out";
  70645. // 先 fill 再stroke
  70646. hasPath = false;
  70647. if (hpStyle.brushType == 'fill' || hpStyle.brushType == 'both' || typeof hpStyle.brushType == 'undefined') { // 默认为fill
  70648. ctx.beginPath();
  70649. if (hpStyle.lineType == 'dashed'
  70650. || hpStyle.lineType == 'dotted'
  70651. || hpStyle.lineType == 'dot'
  70652. || hpStyle.lineType == 'dash'
  70653. || hpStyle.lineType == 'dashdot'
  70654. || hpStyle.lineType == 'longdash'
  70655. || hpStyle.lineType == 'longdashdot'
  70656. ) {
  70657. // 特殊处理,虚线围不成path,实线再build一次
  70658. this.buildPath(ctx, {
  70659. lineType: 'solid',
  70660. lineWidth: hpStyle.lineWidth,
  70661. pointList: hpStyle.pointList
  70662. }
  70663. );
  70664. } else {
  70665. this.buildPath(ctx, hpStyle);
  70666. hasPath = true; // 这个path能用
  70667. }
  70668. ctx.closePath();
  70669. this.setCtxGlobalAlpha(ctx, "fill", hpStyle);
  70670. ctx.fill();
  70671. this.setCtxGlobalAlpha(ctx, "reset", hpStyle);
  70672. }
  70673. if (hpStyle.lineWidth > 0 && (hpStyle.brushType == 'stroke' || hpStyle.brushType == 'both')) {
  70674. if (!hasPath) {
  70675. ctx.beginPath();
  70676. this.buildPath(ctx, hpStyle);
  70677. }
  70678. //如果描边,先回复 globalCompositeOperation 默认值再描边。
  70679. ctx.globalCompositeOperation = "source-over";
  70680. this.setCtxGlobalAlpha(ctx, "stroke", hpStyle);
  70681. ctx.stroke();
  70682. this.setCtxGlobalAlpha(ctx, "reset", hpStyle);
  70683. } else {
  70684. ctx.globalCompositeOperation = "source-over";
  70685. }
  70686. }
  70687. }
  70688. }
  70689. ctx.restore();
  70690. return;
  70691. }
  70692. /**
  70693. * @function LevelRenderer.Shape.SmicPolygon.prototype.buildPath
  70694. * @description 创建多边形路径。
  70695. *
  70696. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  70697. * @param {Object} style - style。
  70698. *
  70699. */
  70700. buildPath(ctx, style) {
  70701. if (style.showShadow) {
  70702. ctx.shadowBlur = style.shadowBlur;
  70703. ctx.shadowColor = style.shadowColor;
  70704. ctx.shadowOffsetX = style.shadowOffsetX;
  70705. ctx.shadowOffsetY = style.shadowOffsetY;
  70706. }
  70707. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  70708. this.refOriginalPosition = [0, 0];
  70709. }
  70710. var __OP = this.refOriginalPosition;
  70711. // 虽然能重用 brokenLine,但底层图形基于性能考虑,重复代码减少调用吧
  70712. var pointList = style.pointList;
  70713. if (pointList.length < 2) {
  70714. // 少于2个点就不画了~
  70715. return;
  70716. }
  70717. if (style.smooth && style.smooth !== 'spline') {
  70718. var controlPoints = SUtil_SUtil.SUtil_smoothBezier(pointList, style.smooth, true, style.smoothConstraint, __OP);
  70719. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  70720. var cp1;
  70721. var cp2;
  70722. var p;
  70723. var len = pointList.length;
  70724. for (var i = 0; i < len; i++) {
  70725. cp1 = controlPoints[i * 2];
  70726. cp2 = controlPoints[i * 2 + 1];
  70727. p = [pointList[(i + 1) % len][0] + __OP[0], pointList[(i + 1) % len][1] + __OP[1]];
  70728. ctx.bezierCurveTo(
  70729. cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]
  70730. );
  70731. }
  70732. } else {
  70733. if (style.smooth === 'spline') {
  70734. pointList = SUtil_SUtil.SUtil_smoothSpline(pointList, true, null, __OP);
  70735. }
  70736. if (!style.lineType || style.lineType == 'solid') {
  70737. // 默认为实线
  70738. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  70739. for (let i = 1; i < pointList.length; i++) {
  70740. ctx.lineTo(pointList[i][0] + __OP[0], pointList[i][1] + __OP[1]);
  70741. }
  70742. ctx.lineTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  70743. } else if (style.lineType === 'dashed'
  70744. || style.lineType === 'dotted'
  70745. || style.lineType === 'dot'
  70746. || style.lineType === 'dash'
  70747. || style.lineType === 'longdash'
  70748. ) {
  70749. // SMIC-方法修改 - start
  70750. let dashLengthForStyle = style._dashLength || (style.lineWidth || 1) * (style.lineType == 'dashed' ? 5 : 1);
  70751. style._dashLength = dashLengthForStyle;
  70752. let dashLength = (style.lineWidth || 1);
  70753. let pattern1 = dashLength;
  70754. let pattern2 = dashLength;
  70755. //dashed
  70756. if (style.lineType === 'dashed') {
  70757. pattern1 *= 5;
  70758. pattern2 *= 5;
  70759. if (style.lineCap && style.lineCap !== "butt") {
  70760. pattern1 -= dashLength;
  70761. pattern2 += dashLength;
  70762. }
  70763. }
  70764. //dotted
  70765. if (style.lineType === 'dotted') {
  70766. if (style.lineCap && style.lineCap !== "butt") {
  70767. pattern1 = 1;
  70768. pattern2 += dashLength;
  70769. }
  70770. }
  70771. //dot
  70772. if (style.lineType === 'dot') {
  70773. pattern2 *= 4;
  70774. if (style.lineCap && style.lineCap !== "butt") {
  70775. pattern1 = 1;
  70776. pattern2 += dashLength;
  70777. }
  70778. }
  70779. //dash
  70780. if (style.lineType === 'dash') {
  70781. pattern1 *= 4;
  70782. pattern2 *= 4;
  70783. if (style.lineCap && style.lineCap !== "butt") {
  70784. pattern1 -= dashLength;
  70785. pattern2 += dashLength;
  70786. }
  70787. }
  70788. //longdash
  70789. if (style.lineType === 'longdash') {
  70790. pattern1 *= 8;
  70791. pattern2 *= 4;
  70792. if (style.lineCap && style.lineCap !== "butt") {
  70793. pattern1 -= dashLength;
  70794. pattern2 += dashLength;
  70795. }
  70796. }
  70797. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  70798. for (let i = 1; i < pointList.length; i++) {
  70799. SUtil_SUtil.SUtil_dashedLineTo(
  70800. ctx,
  70801. pointList[i - 1][0] + __OP[0],
  70802. pointList[i - 1][1] + __OP[1],
  70803. pointList[i][0] + __OP[0],
  70804. pointList[i][1] + __OP[1],
  70805. dashLength,
  70806. [pattern1, pattern2]
  70807. );
  70808. }
  70809. SUtil_SUtil.SUtil_dashedLineTo(
  70810. ctx,
  70811. pointList[pointList.length - 1][0] + __OP[0],
  70812. pointList[pointList.length - 1][1] + __OP[1],
  70813. pointList[0][0] + __OP[0],
  70814. pointList[0][1] + __OP[1],
  70815. dashLength,
  70816. [pattern1, pattern2]
  70817. );
  70818. } else if (style.lineType === 'dashdot'
  70819. || style.lineType === 'longdashdot'
  70820. ) {
  70821. let dashLengthForStyle = style._dashLength || (style.lineWidth || 1) * (style.lineType == 'dashed' ? 5 : 1);
  70822. style._dashLength = dashLengthForStyle;
  70823. let dashLength = (style.lineWidth || 1);
  70824. let pattern1 = dashLength;
  70825. let pattern2 = dashLength;
  70826. let pattern3 = dashLength;
  70827. let pattern4 = dashLength;
  70828. //dashdot
  70829. if (style.lineType === 'dashdot') {
  70830. pattern1 *= 4;
  70831. pattern2 *= 4;
  70832. pattern4 *= 4;
  70833. if (style.lineCap && style.lineCap !== "butt") {
  70834. pattern1 -= dashLength;
  70835. pattern2 += dashLength;
  70836. pattern3 = 1;
  70837. pattern4 += dashLength;
  70838. }
  70839. }
  70840. //longdashdot
  70841. if (style.lineType === 'longdashdot') {
  70842. pattern1 *= 8;
  70843. pattern2 *= 4;
  70844. pattern4 *= 4;
  70845. if (style.lineCap && style.lineCap !== "butt") {
  70846. pattern1 -= dashLength;
  70847. pattern2 += dashLength;
  70848. pattern3 = 1;
  70849. pattern4 += dashLength;
  70850. }
  70851. }
  70852. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  70853. for (let i = 1; i < pointList.length; i++) {
  70854. SUtil_SUtil.SUtil_dashedLineTo(
  70855. ctx,
  70856. pointList[i - 1][0] + __OP[0],
  70857. pointList[i - 1][1] + __OP[1],
  70858. pointList[i][0] + __OP[0],
  70859. pointList[i][1] + __OP[1],
  70860. dashLength,
  70861. [pattern1, pattern2, pattern3, pattern4]
  70862. );
  70863. }
  70864. SUtil_SUtil.SUtil_dashedLineTo(
  70865. ctx,
  70866. pointList[pointList.length - 1][0] + __OP[0],
  70867. pointList[pointList.length - 1][1] + __OP[1],
  70868. pointList[0][0] + __OP[0],
  70869. pointList[0][1] + __OP[1],
  70870. dashLength,
  70871. [pattern1, pattern2, pattern3, pattern4]
  70872. );
  70873. }
  70874. }
  70875. return;
  70876. }
  70877. /**
  70878. * @function LevelRenderer.Shape.SmicPolygon.prototype.getRect
  70879. * @description 计算返回多边形包围盒矩阵。该包围盒是直接从四个控制点计算,并非最小包围盒。
  70880. *
  70881. * @param {Object} style - style
  70882. * @return {Object} 边框对象。包含属性:x,y,width,height。
  70883. *
  70884. */
  70885. getRect(style, refOriginalPosition) {
  70886. var __OP;
  70887. if (!refOriginalPosition) {
  70888. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  70889. this.refOriginalPosition = [0, 0];
  70890. }
  70891. __OP = this.refOriginalPosition;
  70892. } else {
  70893. __OP = refOriginalPosition;
  70894. }
  70895. if (style.__rect) {
  70896. return style.__rect;
  70897. }
  70898. var minX = Number.MAX_VALUE;
  70899. var maxX = Number.MIN_VALUE;
  70900. var minY = Number.MAX_VALUE;
  70901. var maxY = Number.MIN_VALUE;
  70902. var pointList = style.pointList;
  70903. for (var i = 0, l = pointList.length; i < l; i++) {
  70904. if (pointList[i][0] + __OP[0] < minX) {
  70905. minX = pointList[i][0] + __OP[0];
  70906. }
  70907. if (pointList[i][0] + __OP[0] > maxX) {
  70908. maxX = pointList[i][0] + __OP[0];
  70909. }
  70910. if (pointList[i][1] + __OP[1] < minY) {
  70911. minY = pointList[i][1] + __OP[1];
  70912. }
  70913. if (pointList[i][1] + __OP[1] > maxY) {
  70914. maxY = pointList[i][1] + __OP[1];
  70915. }
  70916. }
  70917. var lineWidth;
  70918. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  70919. lineWidth = style.lineWidth || 1;
  70920. } else {
  70921. lineWidth = 0;
  70922. }
  70923. style.__rect = {
  70924. x: Math.round(minX - lineWidth / 2),
  70925. y: Math.round(minY - lineWidth / 2),
  70926. width: maxX - minX + lineWidth,
  70927. height: maxY - minY + lineWidth
  70928. };
  70929. return style.__rect;
  70930. }
  70931. }
  70932. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicBrokenLine.js
  70933. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  70934. * This program are made available under the terms of the Apache License, Version 2.0
  70935. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  70936. /**
  70937. * @private
  70938. * @class LevelRenderer.Shape.SmicBrokenLine
  70939. * @category Visualization Theme
  70940. * @classdesc 折线(ic)。
  70941. * @extends LevelRenderer.Shape
  70942. * @example
  70943. * var shape = new LevelRenderer.Shape.SmicBrokenLine({
  70944. * style: {
  70945. * pointList: [[0, 0], [100, 100], [100, 0]],
  70946. * smooth: 'bezier',
  70947. * strokeColor: 'purple'
  70948. * }
  70949. * });
  70950. * levelRenderer.addShape(shape);
  70951. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  70952. *
  70953. */
  70954. class SmicBrokenLine extends Shape_Shape {
  70955. constructor(options) {
  70956. super(options);
  70957. /**
  70958. * @member {string} LevelRenderer.Shape.SmicBrokenLine.prototype.brushTypeOnly
  70959. * @description 线条只能描边。
  70960. */
  70961. this.brushTypeOnly = 'stroke';
  70962. /**
  70963. * @member {string} LevelRenderer.Shape.SmicBrokenLine.prototype.textPosition
  70964. * @description 文本位置。
  70965. */
  70966. this.textPosition = 'end';
  70967. /**
  70968. * @member {string} LevelRenderer.Shape.SmicBrokenLine.prototype.type
  70969. * @description 图形类型.
  70970. */
  70971. this.type = 'smicbroken-line';
  70972. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  70973. this.refOriginalPosition = [0, 0];
  70974. }
  70975. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicBrokenLine";
  70976. }
  70977. /**
  70978. * @function LevelRenderer.Shape.SmicBrokenLine.prototype.destroy
  70979. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  70980. */
  70981. destroy() {
  70982. this.brushTypeOnly = null;
  70983. this.textPosition = null;
  70984. this.type = null;
  70985. super.destroy();
  70986. }
  70987. /**
  70988. * @function LevelRenderer.Shape.SmicBrokenLine.prototype.buildPath
  70989. * @description 创建折线路径。
  70990. *
  70991. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  70992. * @param {Object} style - style。
  70993. *
  70994. */
  70995. buildPath(ctx, style) {
  70996. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  70997. this.refOriginalPosition = [0, 0];
  70998. }
  70999. var __OP = this.refOriginalPosition;
  71000. var pointList = style.pointList;
  71001. if (pointList.length < 2) {
  71002. // 少于2个点就不画了~
  71003. return;
  71004. }
  71005. var len = Math.min(style.pointList.length, Math.round(style.pointListLength || style.pointList.length));
  71006. if (style.smooth && style.smooth !== 'spline') {
  71007. var controlPoints = SUtil_SUtil.SUtil_smoothBezier(pointList, style.smooth, false, style.smoothConstraint, __OP);
  71008. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  71009. var cp1;
  71010. var cp2;
  71011. var p;
  71012. for (let i = 0; i < len - 1; i++) {
  71013. cp1 = controlPoints[i * 2];
  71014. cp2 = controlPoints[i * 2 + 1];
  71015. p = [pointList[i + 1][0] + __OP[0], pointList[i + 1][1] + __OP[1]];
  71016. ctx.bezierCurveTo(
  71017. cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]
  71018. );
  71019. }
  71020. } else {
  71021. if (style.smooth === 'spline') {
  71022. pointList = SUtil_SUtil.SUtil_smoothSpline(pointList, null, null, __OP);
  71023. len = pointList.length;
  71024. }
  71025. if (!style.lineType || style.lineType === 'solid') {
  71026. // 默认为实线
  71027. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  71028. for (let i = 1; i < len; i++) {
  71029. ctx.lineTo(pointList[i][0] + __OP[0], pointList[i][1] + __OP[1]);
  71030. }
  71031. } else if (style.lineType === 'dashed'
  71032. || style.lineType === 'dotted'
  71033. || style.lineType === 'dot'
  71034. || style.lineType === 'dash'
  71035. || style.lineType === 'longdash'
  71036. ) {
  71037. let dashLength = (style.lineWidth || 1);
  71038. let pattern1 = dashLength;
  71039. let pattern2 = dashLength;
  71040. //dashed
  71041. if (style.lineType === 'dashed') {
  71042. pattern1 *= 5;
  71043. pattern2 *= 5;
  71044. if (style.lineCap && style.lineCap !== "butt") {
  71045. pattern1 -= dashLength;
  71046. pattern2 += dashLength;
  71047. }
  71048. }
  71049. //dotted
  71050. if (style.lineType === 'dotted') {
  71051. if (style.lineCap && style.lineCap !== "butt") {
  71052. pattern1 = 1;
  71053. pattern2 += dashLength;
  71054. }
  71055. }
  71056. //dot
  71057. if (style.lineType === 'dot') {
  71058. pattern2 *= 4;
  71059. if (style.lineCap && style.lineCap !== "butt") {
  71060. pattern1 = 1;
  71061. pattern2 += dashLength;
  71062. }
  71063. }
  71064. //dash
  71065. if (style.lineType === 'dash') {
  71066. pattern1 *= 4;
  71067. pattern2 *= 4;
  71068. if (style.lineCap && style.lineCap !== "butt") {
  71069. pattern1 -= dashLength;
  71070. pattern2 += dashLength;
  71071. }
  71072. }
  71073. //longdash
  71074. if (style.lineType === 'longdash') {
  71075. pattern1 *= 8;
  71076. pattern2 *= 4;
  71077. if (style.lineCap && style.lineCap !== "butt") {
  71078. pattern1 -= dashLength;
  71079. pattern2 += dashLength;
  71080. }
  71081. }
  71082. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  71083. for (var i = 1; i < len; i++) {
  71084. SUtil_SUtil.SUtil_dashedLineTo(
  71085. ctx,
  71086. pointList[i - 1][0] + __OP[0], pointList[i - 1][1] + __OP[1],
  71087. pointList[i][0] + __OP[0], pointList[i][1] + __OP[1],
  71088. dashLength,
  71089. [pattern1, pattern2]
  71090. );
  71091. }
  71092. } else if (style.lineType === 'dashdot'
  71093. || style.lineType === 'longdashdot'
  71094. ) {
  71095. let dashLength = (style.lineWidth || 1);
  71096. let pattern1 = dashLength;
  71097. let pattern2 = dashLength;
  71098. let pattern3 = dashLength;
  71099. let pattern4 = dashLength;
  71100. //dashdot
  71101. if (style.lineType === 'dashdot') {
  71102. pattern1 *= 4;
  71103. pattern2 *= 4;
  71104. pattern4 *= 4;
  71105. if (style.lineCap && style.lineCap !== "butt") {
  71106. pattern1 -= dashLength;
  71107. pattern2 += dashLength;
  71108. pattern3 = 1;
  71109. pattern4 += dashLength;
  71110. }
  71111. }
  71112. //longdashdot
  71113. if (style.lineType === 'longdashdot') {
  71114. pattern1 *= 8;
  71115. pattern2 *= 4;
  71116. pattern4 *= 4;
  71117. if (style.lineCap && style.lineCap !== "butt") {
  71118. pattern1 -= dashLength;
  71119. pattern2 += dashLength;
  71120. pattern3 = 1;
  71121. pattern4 += dashLength;
  71122. }
  71123. }
  71124. dashLength = (style.lineWidth || 1)
  71125. * (style.lineType === 'dashed' ? 5 : 1);
  71126. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  71127. for (let i = 1; i < len; i++) {
  71128. SUtil_SUtil.SUtil_dashedLineTo(
  71129. ctx,
  71130. pointList[i - 1][0] + __OP[0], pointList[i - 1][1] + __OP[1],
  71131. pointList[i][0] + __OP[0], pointList[i][1] + __OP[1],
  71132. dashLength,
  71133. [pattern1, pattern2, pattern3, pattern4]
  71134. );
  71135. }
  71136. }
  71137. }
  71138. return;
  71139. }
  71140. /**
  71141. * @function LevelRenderer.Shape.SmicBrokenLine.prototype.getRect
  71142. * @description 计算返回折线包围盒矩形。该包围盒是直接从四个控制点计算,并非最小包围盒。
  71143. *
  71144. * @param {Object} style - style
  71145. * @return {Object} 边框对象。包含属性:x,y,width,height。
  71146. */
  71147. getRect(style) {
  71148. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  71149. this.refOriginalPosition = [0, 0];
  71150. }
  71151. var __OP = this.refOriginalPosition;
  71152. return SmicPolygon.prototype.getRect.apply(this, [style, __OP]);
  71153. }
  71154. }
  71155. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicImage.js
  71156. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  71157. * This program are made available under the terms of the Apache License, Version 2.0
  71158. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71159. /**
  71160. * @private
  71161. * @class LevelRenderer.Shape.SmicImage
  71162. * @category Visualization Theme
  71163. * @classdesc 图片绘制。
  71164. * @extends LevelRenderer.Shape
  71165. * @example
  71166. * var shape = new LevelRenderer.Shape.SmicImage({
  71167. * style: {
  71168. * image: 'test.jpg',
  71169. * x: 100,
  71170. * y: 100
  71171. * }
  71172. * });
  71173. * levelRenderer.addShape(shape);
  71174. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  71175. *
  71176. */
  71177. class SmicImage extends Shape_Shape {
  71178. constructor(options) {
  71179. super(options);
  71180. /**
  71181. * @member {string} LevelRenderer.Shape.SmicImage.prototype.type
  71182. * @description 图形类型。
  71183. */
  71184. this.type = 'smicimage';
  71185. /**
  71186. * @member {string} LevelRenderer.Shape.SmicImage.prototype._imageCache
  71187. * @description 图片缓存。
  71188. */
  71189. this._imageCache = {};
  71190. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  71191. this.refOriginalPosition = [0, 0];
  71192. }
  71193. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicImage";
  71194. }
  71195. /**
  71196. * @function LevelRenderer.Shape.SmicImage.prototype.destroy
  71197. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  71198. */
  71199. destroy() {
  71200. this.type = null;
  71201. this._imageCache = null;
  71202. super.destroy();
  71203. }
  71204. /**
  71205. * @function LevelRenderer.Shape.SmicImage.prototype.buildPath
  71206. * @description 创建图片。
  71207. *
  71208. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  71209. * @param {Object} style - style。
  71210. *
  71211. */
  71212. brush(ctx, isHighlight, refresh) {
  71213. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  71214. this.refOriginalPosition = [0, 0];
  71215. }
  71216. var __OP = this.refOriginalPosition;
  71217. var style = this.style || {};
  71218. if (isHighlight) {
  71219. // 根据style扩展默认高亮样式
  71220. style = this.getHighlightStyle(
  71221. style, this.highlightStyle || {}
  71222. );
  71223. }
  71224. var image = style.image;
  71225. var me = this;
  71226. if (typeof(image) === 'string') {
  71227. var src = image;
  71228. if (this._imageCache[src]) {
  71229. image = this._imageCache[src];
  71230. } else {
  71231. image = new Image();
  71232. image.onload = function () {
  71233. image.onload = null;
  71234. clearTimeout(SmicImage._refreshTimeout);
  71235. SmicImage._needsRefresh.push(me);
  71236. // 防止因为缓存短时间内触发多次onload事件
  71237. SmicImage._refreshTimeout = setTimeout(function () {
  71238. refresh && refresh(SmicImage._needsRefresh);
  71239. // 清空 needsRefresh
  71240. SmicImage._needsRefresh = [];
  71241. }, 10);
  71242. };
  71243. image.src = src;
  71244. this._imageCache[src] = image;
  71245. }
  71246. }
  71247. if (image) {
  71248. // 图片已经加载完成
  71249. if (image.nodeName.toUpperCase() == 'IMG') {
  71250. if (window.ActiveXObject) {
  71251. if (image.readyState != 'complete') {
  71252. return;
  71253. }
  71254. } else {
  71255. if (!image.complete) {
  71256. return;
  71257. }
  71258. }
  71259. }
  71260. // Else is canvas
  71261. var width = style.width || image.width;
  71262. var height = style.height || image.height;
  71263. var x = style.x + __OP[0];
  71264. var y = style.y + __OP[1];
  71265. // 图片加载失败
  71266. if (!image.width || !image.height) {
  71267. return;
  71268. }
  71269. ctx.save();
  71270. this.doClip(ctx);
  71271. this.setContext(ctx, style);
  71272. // 设置transform
  71273. this.setTransform(ctx);
  71274. if (style.sWidth && style.sHeight) {
  71275. let sx = (style.sx + __OP[0]) || 0;
  71276. let sy = (style.sy + __OP[1]) || 0;
  71277. ctx.drawImage(
  71278. image,
  71279. sx, sy, style.sWidth, style.sHeight,
  71280. x, y, width, height
  71281. );
  71282. } else if (style.sx && style.sy) {
  71283. let sx = style.sx + __OP[0];
  71284. let sy = style.sy + __OP[1];
  71285. var sWidth = width - sx;
  71286. var sHeight = height - sy;
  71287. ctx.drawImage(
  71288. image,
  71289. sx, sy, sWidth, sHeight,
  71290. x, y, width, height
  71291. );
  71292. } else {
  71293. ctx.drawImage(image, x, y, width, height);
  71294. }
  71295. // 如果没设置宽和高的话自动根据图片宽高设置
  71296. if (!style.width) {
  71297. style.width = width;
  71298. }
  71299. if (!style.height) {
  71300. style.height = height;
  71301. }
  71302. if (!this.style.width) {
  71303. this.style.width = width;
  71304. }
  71305. if (!this.style.height) {
  71306. this.style.height = height;
  71307. }
  71308. this.drawText(ctx, style, this.style);
  71309. ctx.restore();
  71310. }
  71311. }
  71312. /**
  71313. * @function LevelRenderer.Shape.SmicImage.prototype.getRect
  71314. * @description 计算返回图片的包围盒矩形。
  71315. *
  71316. * @param {Object} style - style
  71317. * @return {Object} 边框对象。包含属性:x,y,width,height。
  71318. */
  71319. getRect(style) {
  71320. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  71321. this.refOriginalPosition = [0, 0];
  71322. }
  71323. var __OP = this.refOriginalPosition;
  71324. return {
  71325. x: style.x + __OP[0],
  71326. y: style.y + __OP[1],
  71327. width: style.width,
  71328. height: style.height
  71329. };
  71330. }
  71331. /**
  71332. * @function LevelRenderer.Shape.SmicImage.prototype.clearCache
  71333. * @description 清除图片缓存。
  71334. *
  71335. * @param {Object} style - style
  71336. * @return {Object} 边框对象。包含属性:x,y,width,height。
  71337. *
  71338. */
  71339. clearCache() {
  71340. this._imageCache = {};
  71341. }
  71342. }
  71343. SmicImage._needsRefresh = [];
  71344. SmicImage._refreshTimeout = null;
  71345. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicRectangle.js
  71346. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  71347. * This program are made available under the terms of the Apache License, Version 2.0
  71348. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71349. /**
  71350. * @private
  71351. * @class LevelRenderer.Shape.SmicRectangle
  71352. * @category Visualization Theme
  71353. * @classdesc 矩形。
  71354. * @extends LevelRenderer.Shape
  71355. * @example
  71356. * var shape = new LevelRenderer.Shape.SmicRectangle({
  71357. * style: {
  71358. * x: 0,
  71359. * y: 0,
  71360. * width: 100,
  71361. * height: 100,
  71362. * radius: 20
  71363. * }
  71364. * });
  71365. * levelRenderer.addShape(shape);
  71366. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  71367. */
  71368. class SmicRectangle extends Shape_Shape {
  71369. constructor(options) {
  71370. super(options);
  71371. /**
  71372. * @member {string} LevelRenderer.Shape.SmicRectangle.prototype.type
  71373. * @description 图形类型.
  71374. */
  71375. this.type = 'smicrectangle';
  71376. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  71377. this.refOriginalPosition = [0, 0];
  71378. }
  71379. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicRectangle";
  71380. }
  71381. /**
  71382. * @function LevelRenderer.Shape.SmicRectangle.prototype.destroy
  71383. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  71384. */
  71385. destroy() {
  71386. this.type = null;
  71387. super.destroy();
  71388. }
  71389. /**
  71390. * APIMethod: _buildRadiusPath
  71391. * 创建矩形的圆角路径。
  71392. *
  71393. * Parameters:
  71394. * ctx - {CanvasRenderingContext2D} Context2D 上下文。
  71395. * style - {Object} style。
  71396. *
  71397. */
  71398. _buildRadiusPath(ctx, style) {
  71399. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  71400. this.refOriginalPosition = [0, 0];
  71401. }
  71402. var __OP = this.refOriginalPosition;
  71403. // 左上、右上、右下、左下角的半径依次为r1、r2、r3、r4
  71404. // r缩写为1 相当于 [1, 1, 1, 1]
  71405. // r缩写为[1] 相当于 [1, 1, 1, 1]
  71406. // r缩写为[1, 2] 相当于 [1, 2, 1, 2]
  71407. // r缩写为[1, 2, 3] 相当于 [1, 2, 3, 2]
  71408. var x = style.x + __OP[0];
  71409. var y = style.y + __OP[1];
  71410. var width = style.width;
  71411. var height = style.height;
  71412. var r = style.radius;
  71413. var r1;
  71414. var r2;
  71415. var r3;
  71416. var r4;
  71417. if (typeof r === 'number') {
  71418. r1 = r2 = r3 = r4 = r;
  71419. } else if (r instanceof Array) {
  71420. if (r.length === 1) {
  71421. r1 = r2 = r3 = r4 = r[0];
  71422. } else if (r.length === 2) {
  71423. r1 = r3 = r[0];
  71424. r2 = r4 = r[1];
  71425. } else if (r.length === 3) {
  71426. r1 = r[0];
  71427. r2 = r4 = r[1];
  71428. r3 = r[2];
  71429. } else {
  71430. r1 = r[0];
  71431. r2 = r[1];
  71432. r3 = r[2];
  71433. r4 = r[3];
  71434. }
  71435. } else {
  71436. r1 = r2 = r3 = r4 = 0;
  71437. }
  71438. var total;
  71439. if (r1 + r2 > width) {
  71440. total = r1 + r2;
  71441. r1 *= width / total;
  71442. r2 *= width / total;
  71443. }
  71444. if (r3 + r4 > width) {
  71445. total = r3 + r4;
  71446. r3 *= width / total;
  71447. r4 *= width / total;
  71448. }
  71449. if (r2 + r3 > height) {
  71450. total = r2 + r3;
  71451. r2 *= height / total;
  71452. r3 *= height / total;
  71453. }
  71454. if (r1 + r4 > height) {
  71455. total = r1 + r4;
  71456. r1 *= height / total;
  71457. r4 *= height / total;
  71458. }
  71459. ctx.moveTo(x + r1, y);
  71460. ctx.lineTo(x + width - r2, y);
  71461. r2 !== 0 && ctx.quadraticCurveTo(
  71462. x + width, y, x + width, y + r2
  71463. );
  71464. ctx.lineTo(x + width, y + height - r3);
  71465. r3 !== 0 && ctx.quadraticCurveTo(
  71466. x + width, y + height, x + width - r3, y + height
  71467. );
  71468. ctx.lineTo(x + r4, y + height);
  71469. r4 !== 0 && ctx.quadraticCurveTo(
  71470. x, y + height, x, y + height - r4
  71471. );
  71472. ctx.lineTo(x, y + r1);
  71473. r1 !== 0 && ctx.quadraticCurveTo(x, y, x + r1, y);
  71474. }
  71475. /**
  71476. * @function LevelRenderer.Shape.SmicRectangle.prototype.buildPath
  71477. * @description 创建矩形路径。
  71478. *
  71479. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  71480. * @param {Object} style - style。
  71481. *
  71482. */
  71483. buildPath(ctx, style) {
  71484. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  71485. this.refOriginalPosition = [0, 0];
  71486. }
  71487. var __OP = this.refOriginalPosition;
  71488. if (!style.radius) {
  71489. ctx.moveTo(style.x + __OP[0], style.y + __OP[1]);
  71490. ctx.lineTo((style.x + __OP[0]) + style.width, (style.y + __OP[1]));
  71491. ctx.lineTo((style.x + __OP[0]) + style.width, (style.y + __OP[1]) + style.height);
  71492. ctx.lineTo((style.x + __OP[0]), (style.y + __OP[1]) + style.height);
  71493. ctx.lineTo(style.x + __OP[0], style.y + __OP[1]);
  71494. // ctx.rect(style.x, style.y, style.width, style.height);
  71495. } else {
  71496. this._buildRadiusPath(ctx, style);
  71497. }
  71498. ctx.closePath();
  71499. return;
  71500. }
  71501. /**
  71502. * @function LevelRenderer.Shape.SmicRectangle.prototype.getRect
  71503. * @description 计算返回矩形包围盒矩阵。该包围盒是直接从四个控制点计算,并非最小包围盒。
  71504. *
  71505. * @param {Object} style - style
  71506. * @return {Object} 边框对象。包含属性:x,y,width,height。
  71507. */
  71508. getRect(style) {
  71509. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  71510. this.refOriginalPosition = [0, 0];
  71511. }
  71512. var __OP = this.refOriginalPosition;
  71513. if (style.__rect) {
  71514. return style.__rect;
  71515. }
  71516. var lineWidth;
  71517. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  71518. lineWidth = style.lineWidth || 1;
  71519. } else {
  71520. lineWidth = 0;
  71521. }
  71522. style.__rect = {
  71523. x: Math.round((style.x + __OP[0]) - lineWidth / 2),
  71524. y: Math.round((style.y + __OP[1]) - lineWidth / 2),
  71525. width: style.width + lineWidth,
  71526. height: style.height + lineWidth
  71527. };
  71528. return style.__rect;
  71529. }
  71530. }
  71531. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicSector.js
  71532. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  71533. * This program are made available under the terms of the Apache License, Version 2.0
  71534. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71535. /**
  71536. * @private
  71537. * @class LevelRenderer.Shape.SmicSector
  71538. * @category Visualization Theme
  71539. * @classdesc 扇形。
  71540. * @extends LevelRenderer.Shape
  71541. * @example
  71542. * var shape = new LevelRenderer.Shape.SmicSector({
  71543. * style: {
  71544. * x: 100,
  71545. * y: 100,
  71546. * r: 60,
  71547. * r0: 30,
  71548. * startAngle: 0,
  71549. * endEngle: 180
  71550. * }
  71551. * });
  71552. * levelRenderer.addShape(shape);
  71553. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  71554. *
  71555. */
  71556. class SmicSector extends Shape_Shape {
  71557. constructor(options) {
  71558. super(options);
  71559. /**
  71560. * @member {string} LevelRenderer.Shape.SmicSector.protptype.type
  71561. * @description 图形类型。
  71562. */
  71563. this.type = 'smicsector';
  71564. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  71565. this.refOriginalPosition = [0, 0];
  71566. }
  71567. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicSector";
  71568. }
  71569. /**
  71570. * @function LevelRenderer.Shape.SmicSector.prototype.destroy
  71571. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  71572. */
  71573. destroy() {
  71574. this.type = null;
  71575. super.destroy();
  71576. }
  71577. /**
  71578. * @function LevelRenderer.Shape.SmicSector.prototype.buildPath
  71579. * @description 创建扇形路径。
  71580. *
  71581. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  71582. * @param {Object} style - style。
  71583. *
  71584. */
  71585. buildPath(ctx, style) {
  71586. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  71587. this.refOriginalPosition = [0, 0];
  71588. }
  71589. var __OP = this.refOriginalPosition;
  71590. var x = style.x + __OP[0]; // 圆心x
  71591. var y = style.y + __OP[1]; // 圆心y
  71592. var r0 = style.r0 || 0; // 形内半径[0,r)
  71593. var r = style.r; // 扇形外半径(0,r]
  71594. var startAngle = style.startAngle; // 起始角度[0,360)
  71595. var endAngle = style.endAngle; // 结束角度(0,360]
  71596. var clockWise = style.clockWise || false;
  71597. startAngle = SUtil_SUtil.Util_math.degreeToRadian(startAngle);
  71598. endAngle = SUtil_SUtil.Util_math.degreeToRadian(endAngle);
  71599. if (!clockWise) {
  71600. // 扇形默认是逆时针方向,Y轴向上
  71601. // 这个跟arc的标准不一样,为了兼容echarts
  71602. startAngle = -startAngle;
  71603. endAngle = -endAngle;
  71604. }
  71605. var unitX = SUtil_SUtil.Util_math.cos(startAngle);
  71606. var unitY = SUtil_SUtil.Util_math.sin(startAngle);
  71607. ctx.moveTo(
  71608. unitX * r0 + x,
  71609. unitY * r0 + y
  71610. );
  71611. ctx.lineTo(
  71612. unitX * r + x,
  71613. unitY * r + y
  71614. );
  71615. ctx.arc(x, y, r, startAngle, endAngle, !clockWise);
  71616. ctx.lineTo(
  71617. SUtil_SUtil.Util_math.cos(endAngle) * r0 + x,
  71618. SUtil_SUtil.Util_math.sin(endAngle) * r0 + y
  71619. );
  71620. if (r0 !== 0) {
  71621. ctx.arc(x, y, r0, endAngle, startAngle, clockWise);
  71622. }
  71623. ctx.closePath();
  71624. return;
  71625. }
  71626. /**
  71627. * @function LevelRenderer.Shape.SmicSector.prototype.getRect
  71628. * @description 返回扇形包围盒矩形
  71629. *
  71630. * @param {Object} style - style
  71631. * @return {Object} 边框对象。包含属性:x,y,width,height。
  71632. *
  71633. */
  71634. getRect(style) {
  71635. if (style.__rect) {
  71636. return style.__rect;
  71637. }
  71638. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  71639. this.refOriginalPosition = [0, 0];
  71640. }
  71641. var __OP = this.refOriginalPosition;
  71642. var min0 = SUtil_SUtil.Util_vector.create();
  71643. var min1 = SUtil_SUtil.Util_vector.create();
  71644. var max0 = SUtil_SUtil.Util_vector.create();
  71645. var max1 = SUtil_SUtil.Util_vector.create();
  71646. var x = style.x + __OP[0]; // 圆心x
  71647. var y = style.y + __OP[1]; // 圆心y
  71648. var r0 = style.r0 || 0; // 形内半径[0,r)
  71649. var r = style.r; // 扇形外半径(0,r]
  71650. var startAngle = SUtil_SUtil.Util_math.degreeToRadian(style.startAngle);
  71651. var endAngle = SUtil_SUtil.Util_math.degreeToRadian(style.endAngle);
  71652. var clockWise = style.clockWise;
  71653. if (!clockWise) {
  71654. startAngle = -startAngle;
  71655. endAngle = -endAngle;
  71656. }
  71657. if (r0 > 1) {
  71658. SUtil_SUtil.Util_computeBoundingBox.arc(
  71659. x, y, r0, startAngle, endAngle, !clockWise, min0, max0
  71660. );
  71661. } else {
  71662. min0[0] = max0[0] = x;
  71663. min0[1] = max0[1] = y;
  71664. }
  71665. SUtil_SUtil.Util_computeBoundingBox.arc(
  71666. x, y, r, startAngle, endAngle, !clockWise, min1, max1
  71667. );
  71668. SUtil_SUtil.Util_vector.min(min0, min0, min1);
  71669. SUtil_SUtil.Util_vector.max(max0, max0, max1);
  71670. style.__rect = {
  71671. x: min0[0],
  71672. y: min0[1],
  71673. width: max0[0] - min0[0],
  71674. height: max0[1] - min0[1]
  71675. };
  71676. return style.__rect;
  71677. }
  71678. }
  71679. ;// CONCATENATED MODULE: ./src/common/overlay/feature/ShapeFactory.js
  71680. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  71681. * This program are made available under the terms of the Apache License, Version 2.0
  71682. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71683. /**
  71684. * @class FeatureShapeFactory
  71685. * @aliasclass Feature.ShapeFactory
  71686. * @deprecatedclass SuperMap.Feature.ShapeFactory
  71687. * @category Visualization Theme
  71688. * @classdesc 图形工厂类。
  71689. * 目前支持创建的图形有:<br>
  71690. * 用于统计专题图:<br>
  71691. * 点 - 参数对象 <{@link ShapeParametersPoint}> <br>
  71692. * 线 - 参数对象 <{@link ShapeParametersLine}> <br>
  71693. * 面 - 参数对象 <{@link ShapeParametersPolygon}> <br>
  71694. * 矩形 - 参数对象 <{@link ShapeParametersPolygon}> <br>
  71695. * 扇形 - 参数对象 <{@link ShapeParametersSector}> <br>
  71696. * 标签 - 参数对象 <{@link ShapeParametersLabel}> <br>
  71697. * 图片 - 参数对象 <{@link ShapeParametersImage}> <br>
  71698. * 用于符号专题图:<br>
  71699. * 圆形 - 参数对象:<{@link ShapeParametersCircle}>
  71700. * @param {Object} [shapeParameters] - 图形参数对象,<{@link ShapeParameters}> 子类对象。
  71701. * @usage
  71702. */
  71703. class ShapeFactory {
  71704. constructor(shapeParameters) {
  71705. /**
  71706. * @member {Object} FeatureShapeFactory.prototype.shapeParameters
  71707. * @description 图形参数对象,<{@link ShapeParameters}> 子类对象。必设参数,默认值 null。
  71708. */
  71709. this.shapeParameters = shapeParameters;
  71710. this.CLASS_NAME = "SuperMap.Feature.ShapeFactory";
  71711. }
  71712. /**
  71713. * @function FeatureShapeFactory.prototype.destroy
  71714. * @description 销毁图形工厂类对象。
  71715. */
  71716. destroy() {
  71717. this.shapeParameters = null;
  71718. }
  71719. /**
  71720. * @function FeatureShapeFactory.prototype.createShape
  71721. * @description 创建一个图形。具体图形由 shapeParameters 决定。
  71722. * @param {Object} shapeParameters - 图形参数对象,<{@link ShapeParameters}> 子类对象。
  71723. * 此参数可选,如果使用此参数(不为 null),shapeParameters 属性值将被修改为参数的值,然后再使用 shapeParameters 属性值创建图形;
  71724. * 如果不使用此参数,createShape 方法将直接使用 shapeParameters 属性创建图形。
  71725. * @returns {Object} 图形对象(或 null - 图形创建失败)。
  71726. */
  71727. createShape(shapeParameters) {
  71728. if (shapeParameters) {
  71729. this.shapeParameters = shapeParameters;
  71730. }
  71731. if (!this.shapeParameters) {
  71732. return null;
  71733. }
  71734. var sps = this.shapeParameters;
  71735. if (sps instanceof Point_Point) { // 点
  71736. //设置style
  71737. let style = new Object();
  71738. style["x"] = sps.x;
  71739. style["y"] = sps.y;
  71740. style["r"] = sps.r;
  71741. style = Util_Util.copyAttributesWithClip(style, sps.style, ['x', 'y']);
  71742. //创建图形
  71743. let shape = new SmicPoint();
  71744. shape.style = ShapeFactory.transformStyle(style);
  71745. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  71746. Util_Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'style', 'highlightStyle']);
  71747. return shape;
  71748. } else if (sps instanceof Line_Line) { // 线
  71749. //检查参数 pointList 是否存在
  71750. if (!sps.pointList) {
  71751. return null;
  71752. }
  71753. // 设置style
  71754. let style = new Object();
  71755. style["pointList"] = sps.pointList;
  71756. style = Util_Util.copyAttributesWithClip(style, sps.style, ['pointList']);
  71757. // 创建图形
  71758. let shape = new SmicBrokenLine();
  71759. shape.style = ShapeFactory.transformStyle(style);
  71760. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  71761. Util_Util.copyAttributesWithClip(shape, sps, ['pointList', 'style', 'highlightStyle']);
  71762. return shape;
  71763. } else if (sps instanceof feature_Polygon_Polygon) { // 面
  71764. //检查参数 pointList 是否存在
  71765. if (!sps.pointList) {
  71766. return null;
  71767. }
  71768. //设置style
  71769. let style = new Object();
  71770. style["pointList"] = sps.pointList;
  71771. style = Util_Util.copyAttributesWithClip(style, sps.style, ['pointList']);
  71772. //创建图形
  71773. let shape = new SmicPolygon();
  71774. shape.style = ShapeFactory.transformStyle(style);
  71775. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  71776. Util_Util.copyAttributesWithClip(shape, sps, ['pointList', 'style', "highlightStyle"]);
  71777. return shape;
  71778. } else if (sps instanceof Rectangle_Rectangle) { // 矩形
  71779. //检查参数 pointList 是否存在
  71780. if (!sps.x && !sps.y & !sps.width & !sps.height) {
  71781. return null;
  71782. }
  71783. //设置style
  71784. let style = new Object();
  71785. style["x"] = sps.x;
  71786. style["y"] = sps.y;
  71787. style["width"] = sps.width;
  71788. style["height"] = sps.height;
  71789. style = Util_Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'width', 'height']);
  71790. //创建图形
  71791. let shape = new SmicRectangle();
  71792. shape.style = ShapeFactory.transformStyle(style);
  71793. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  71794. Util_Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'width', 'height', 'style', 'highlightStyle']);
  71795. return shape;
  71796. } else if (sps instanceof Sector) { // 扇形
  71797. //设置style
  71798. let style = new Object();
  71799. style["x"] = sps.x;
  71800. style["y"] = sps.y;
  71801. style["r"] = sps.r;
  71802. style["startAngle"] = sps.startAngle;
  71803. style["endAngle"] = sps.endAngle;
  71804. if (sps["r0"]) {
  71805. style["r0"] = sps.r0
  71806. }
  71807. if (sps["clockWise"]) {
  71808. style["clockWise"] = sps.clockWise
  71809. }
  71810. style = Util_Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'r', 'startAngle', 'endAngle', 'r0', 'endAngle']);
  71811. //创建图形
  71812. let shape = new SmicSector();
  71813. shape.style = ShapeFactory.transformStyle(style);
  71814. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  71815. Util_Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'r', 'startAngle', 'endAngle', 'r0', 'endAngle', 'style', 'highlightStyle']);
  71816. return shape;
  71817. } else if (sps instanceof Label) { // 标签
  71818. //设置style
  71819. let style = new Object();
  71820. style["x"] = sps.x;
  71821. style["y"] = sps.y;
  71822. style["text"] = sps.text;
  71823. style = Util_Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'text']);
  71824. //创建图形
  71825. let shape = new SmicText();
  71826. shape.style = ShapeFactory.transformStyle(style);
  71827. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  71828. Util_Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'text', 'style', 'highlightStyle']);
  71829. return shape;
  71830. } else if (sps instanceof Image_Image) { // 图片
  71831. //设置style
  71832. let style = new Object();
  71833. style["x"] = sps.x;
  71834. style["y"] = sps.y;
  71835. if (sps["image"]) {
  71836. style["image"] = sps.image;
  71837. }
  71838. if (sps["width"]) {
  71839. style["width"] = sps.width;
  71840. }
  71841. if (sps["height"]) {
  71842. style["height"] = sps.height;
  71843. }
  71844. if (sps["sx"]) {
  71845. style["sx"] = sps.sx;
  71846. }
  71847. if (sps["sy"]) {
  71848. style["sy"] = sps.sy;
  71849. }
  71850. if (sps["sWidth"]) {
  71851. style["sWidth"] = sps.sWidth
  71852. }
  71853. if (sps["sHeight"]) {
  71854. style["sHeight"] = sps.sHeight
  71855. }
  71856. style = Util_Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'image', 'width', 'height', 'sx', 'sy', 'sWidth', 'sHeight']);
  71857. //创建图形
  71858. let shape = new SmicImage();
  71859. shape.style = ShapeFactory.transformStyle(style);
  71860. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  71861. Util_Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'image', 'width', 'height', 'style', 'highlightStyle']);
  71862. return shape;
  71863. } else if (sps instanceof Circle_Circle) { //圆形 用于符号专题图
  71864. //设置stytle
  71865. let style = new Object();
  71866. style["x"] = sps.x;
  71867. style["r"] = sps.r;
  71868. style["y"] = sps.y;
  71869. style = Util_Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'r']);
  71870. //创建图形
  71871. let shape = new SmicCircle();
  71872. shape.style = ShapeFactory.transformStyle(style);
  71873. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  71874. Util_Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'r', 'style', 'highlightStyle', 'lineWidth', 'text', 'textPosition']);
  71875. return shape;
  71876. }
  71877. return null
  71878. }
  71879. /**
  71880. * @function FeatureShapeFactory.prototype.transformStyle
  71881. * @description 将用户 feature.style (类 Svg style 标准) 的样式,转换为 levelRenderer 的样式标准(类 CSS-Canvas 样式)
  71882. * @param {Object} style - 用户 style。
  71883. * @returns {Object} 符合 levelRenderer 的 style。
  71884. */
  71885. static transformStyle(style) {
  71886. var newStyle = {};
  71887. //字体 ["font-style", "font-variant", "font-weight", "font-size / line-height", "font-family"];
  71888. var fontStr = ["normal", "normal", "normal", "12", "arial,sans-serif"];
  71889. //画笔类型 ["fill", "stroke"];
  71890. var brushType = [true, false];
  71891. for (var ss in style) {
  71892. switch (ss) {
  71893. case "fill":
  71894. brushType[0] = style[ss];
  71895. break;
  71896. case "fillColor":
  71897. newStyle["color"] = style[ss];
  71898. break;
  71899. case "stroke":
  71900. brushType[1] = style[ss];
  71901. break;
  71902. case "strokeWidth":
  71903. newStyle["lineWidth"] = style[ss];
  71904. break;
  71905. case "strokeLinecap":
  71906. newStyle["lineCap"] = style[ss];
  71907. break;
  71908. case "strokeLineJoin":
  71909. newStyle["lineJoin"] = style[ss];
  71910. break;
  71911. case "strokeDashstyle":
  71912. newStyle["lineType"] = style[ss];
  71913. break;
  71914. case "pointRadius":
  71915. newStyle["r"] = style[ss];
  71916. break;
  71917. case "label":
  71918. newStyle["text"] = style[ss];
  71919. break;
  71920. case "labelRect":
  71921. newStyle["labelRect"] = style[ss];
  71922. break;
  71923. case "fontColor":
  71924. newStyle["textColor"] = style[ss];
  71925. break;
  71926. case "fontStyle":
  71927. fontStr[0] = style[ss];
  71928. break;
  71929. case "fontVariant":
  71930. fontStr[1] = style[ss];
  71931. break;
  71932. case "fontWeight":
  71933. fontStr[2] = style[ss];
  71934. break;
  71935. case "fontSize":
  71936. var unit = "";
  71937. if (style[ss] && style[ss].toString().indexOf("px") < 0) {
  71938. unit = "px";
  71939. }
  71940. fontStr[3] = style[ss] + unit;
  71941. break;
  71942. case "fontFamily":
  71943. fontStr[4] = style[ss];
  71944. break;
  71945. case "fontOpacity":
  71946. newStyle["opacity"] = style[ss];
  71947. break;
  71948. case "labelPosition":
  71949. newStyle["textPosition"] = style[ss];
  71950. break;
  71951. case "labelAlign":
  71952. newStyle["textAlign"] = style[ss];
  71953. break;
  71954. case "labelBaseline":
  71955. newStyle["textBaseline"] = style[ss];
  71956. break;
  71957. case "labelRotation":
  71958. newStyle["textRotation"] = style[ss];
  71959. break;
  71960. default:
  71961. newStyle[ss] = style[ss];
  71962. break;
  71963. }
  71964. }
  71965. //拼接字体字符串
  71966. newStyle["textFont"] = fontStr.join(" ");
  71967. //画笔类型
  71968. if (brushType[0] === true && brushType[1] === false) {
  71969. newStyle["brushType"] = "fill";
  71970. } else if (brushType[0] === false && brushType[1] === true) {
  71971. newStyle["brushType"] = "stroke";
  71972. } else if (brushType[0] === true && brushType[1] === true) {
  71973. newStyle["brushType"] = "both";
  71974. } else {
  71975. newStyle["brushType"] = "fill";
  71976. }
  71977. //默认线宽 1
  71978. if (newStyle["lineWidth"] == null) {
  71979. newStyle["lineWidth"] = 1;
  71980. }
  71981. return newStyle;
  71982. }
  71983. /**
  71984. * @function FeatureShapeFactory.prototype.Background
  71985. * @description 创建一个矩形背景框图形对象。
  71986. * @param {FeatureShapeFactory} shapeFactory - 图形工厂对象。
  71987. * @param {Array.<number>} box - 框区域,长度为 4 的一维数组,像素坐标,[left, bottom, right, top]。
  71988. * @param {Object} setting - 图表配置参数。本函数中图形配置对象 setting 可设属性:
  71989. * @param {Object} setting.backgroundStyle - 背景样式,此样式对象对象可设属性:<ShapeParametersRectangle#style>。
  71990. * @param {Array.<number>} [setting.backgroundRadius=[0,0,0,0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4,则 backgroundRadius 为 [r1、r2、r3、r4 ]。
  71991. * @returns {Object} 背景框图形,一个可视化图形(矩形)对象。
  71992. */
  71993. static Background(shapeFactory, box, setting) {
  71994. var sets = setting ? setting : {};
  71995. // 背景框图形参数对象
  71996. var bgSP = new Rectangle_Rectangle(box[0], box[3], Math.abs(box[2] - box[0]), Math.abs(box[3] - box[1]));
  71997. // 默认样式
  71998. bgSP.style = {
  71999. fillColor: "#f3f3f3"
  72000. };
  72001. // 设置用户 style
  72002. if (sets.backgroundStyle) {
  72003. Util_Util.copyAttributesWithClip(bgSP.style, sets.backgroundStyle);
  72004. }
  72005. // 设置背景框圆角参数
  72006. if (sets.backgroundRadius) {
  72007. bgSP.style["radius"] = sets.backgroundRadius;
  72008. }
  72009. // 禁止背景框响应事件
  72010. bgSP.clickable = false;
  72011. bgSP.hoverable = false;
  72012. return shapeFactory.createShape(bgSP);
  72013. }
  72014. /**
  72015. * @function FeatureShapeFactory.prototype.GraphAxis
  72016. * @description 创建一个统计图表坐标轴图形对象组。
  72017. * @param {FeatureShapeFactory} shapeFactory - 图形工厂对象。
  72018. * @param {Array.<number>} dataViewBox - 统计图表模型的数据视图框,长度为 4 的一维数组,像素坐标,[left, bottom, right, top]。
  72019. * @param {Object} setting - 图表配置参数。
  72020. * @param {Object} setting.axisStyle - 坐标轴样式,此样式对象对象可设属性:<ShapeParametersLine#style>。
  72021. * @param {boolean} [setting.axisUseArrow=false] - 坐标轴是否使用箭头。
  72022. * @param {number} [setting.axisYTick=0] - y 轴刻度数量,0表示不使用箭头。
  72023. * @param {Array.<string>} setting.axisYLabels - y 轴上的标签组内容,标签顺序沿着数据视图框左面条边自上而下,等距排布。例如:["1000", "750", "500", "250", "0"]。
  72024. * @param {Object} setting.axisYLabelsStyle - y 轴上的标签组样式,此样式对象对象可设属性:<ShapeParametersLabel#style>。
  72025. * @param {Array.<number>} [setting.axisYLabelsOffset=[0,0]] - y 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 y 轴标签组横向上的偏移量,向左为正,默认值:0;数组第二项表示 y 轴标签组纵向上的偏移量,向下为正,默认值:0。
  72026. * @param {Array.<string>} setting.axisXLabels - x 轴上的标签组内容,标签顺序沿着数据视图框下面条边自左向右排布,例如:["92年", "95年", "99年"]。
  72027. * 标签排布规则:当标签数量与 xShapeInfo 中的属性 xPositions 数量相同(即标签个数与数据个数相等时), 按照 xPositions 提供的位置在水平方向上排布标签,否则沿数据视图框下面条边等距排布标签。
  72028. * @param {Object} setting.axisXLabelsStyle - x 轴上的标签组样式,此样式对象对象可设属性:<ShapeParametersLabel#style>。
  72029. * @param {Array.<number>} [setting.axisXLabelsOffset=[0,0]] - x 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 x 轴标签组横向上的偏移量,向左为正,默认值:0;数组第二项表示 x 轴标签组纵向上的偏移量,向下为正,默认值:0。
  72030. * @param {boolean} setting.useXReferenceLine - 是否使用水平参考线,如果为 true,在 axisYTick 大于 0 时有效,水平参考线是 y 轴刻度在数据视图框里的延伸。
  72031. * @param {Object} setting.xReferenceLineStyle - 水平参考线样式,此样式对象对象可设属性:<ShapeParametersLine#style>。
  72032. * @param {number} [setting.axis3DParameter=0] - 3D 坐标轴参数,此属性值在大于等于 15 时有效。
  72033. * @param {Object} xShapeInfo - X 方向上的图形信息对象,包含两个属性。
  72034. * @param {Array.<number>} xShapeInfo.xPositions - 图形在 x 轴方向上的像素坐标值,是一个一维数组,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  72035. * @param {number} xShapeInfo.width - 图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  72036. * @returns {Array.<Object>} 统计图表坐标轴图形对象数组。
  72037. */
  72038. static GraphAxis(shapeFactory, dataViewBox, setting, xShapeInfo) {
  72039. var dvb = dataViewBox;
  72040. var sets = setting ? setting : {};
  72041. // 参考线图形对象组
  72042. var refLines = [];
  72043. //坐标轴箭头对象组
  72044. var arrows = [];
  72045. // 是否使用参水平考线,默认不使用
  72046. var isAddRefLine = sets.useXReferenceLine ? sets.useXReferenceLine : false;
  72047. // y 轴上的刻度
  72048. var axisytick = (sets.axisYTick && !isNaN(sets.axisYTick)) ? sets.axisYTick : 0;
  72049. // 坐标轴节点数组
  72050. var pois = [];
  72051. //z 轴箭头数组
  72052. var zArrowPois = [];
  72053. // x,y 轴主干节点数组
  72054. var xMainPois = [];
  72055. if (axisytick == 0) {
  72056. xMainPois.push([dvb[0], dvb[3] - 5]);
  72057. xMainPois.push([dvb[0], dvb[1]]);
  72058. // 3D 坐标轴 第三象限平分线
  72059. if (sets.axis3DParameter && !isNaN(sets.axis3DParameter) && sets.axis3DParameter >= 15) {
  72060. let axis3DParameter = parseInt(sets.axis3DParameter);
  72061. let axis3DPoi = [dvb[0] - axis3DParameter, dvb[1] + axis3DParameter];
  72062. // 添加 3D 轴节点
  72063. if (sets.axisUseArrow) { // 添加 3D 轴箭头节点坐标
  72064. //箭头坐标
  72065. zArrowPois.push([axis3DPoi[0] + 1.5, axis3DPoi[1] - 7.5]);
  72066. zArrowPois.push([axis3DPoi[0] - 1, axis3DPoi[1] + 1]);
  72067. zArrowPois.push([axis3DPoi[0] + 7.5, axis3DPoi[1] - 1.5]);
  72068. //3D轴
  72069. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  72070. } else {
  72071. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  72072. }
  72073. xMainPois.push([dvb[0], dvb[1]]);
  72074. }
  72075. xMainPois.push([dvb[2] + 5, dvb[1]]);
  72076. } else {
  72077. // 单位刻度长度
  72078. var unitTick = Math.abs(dvb[1] - dvb[3]) / axisytick;
  72079. // 刻度 y 坐标
  72080. var thckY = dvb[3];
  72081. xMainPois.push([dvb[0], thckY - 5]);
  72082. for (var i = 0; i < axisytick; i++) {
  72083. xMainPois.push([dvb[0], thckY]);
  72084. xMainPois.push([dvb[0] - 5, thckY]);
  72085. xMainPois.push([dvb[0], thckY]);
  72086. // 参考线
  72087. if (isAddRefLine) {
  72088. // 参考线参数对象
  72089. var refLineSP = new Line_Line([
  72090. [dvb[0], thckY],
  72091. [dvb[2], thckY]
  72092. ]);
  72093. // 参考线默认样式对象
  72094. refLineSP.style = {
  72095. strokeColor: "#cfcfcf",
  72096. strokeLinecap: "butt",
  72097. strokeLineJoin: "round",
  72098. strokeWidth: 1
  72099. };
  72100. // 禁止事件
  72101. refLineSP.clickable = false;
  72102. refLineSP.hoverable = false;
  72103. // 用户style
  72104. if (sets.xReferenceLineStyle) {
  72105. Util_Util.copyAttributesWithClip(refLineSP.style, sets.xReferenceLineStyle);
  72106. }
  72107. // 生成参考线图形对象
  72108. refLines.push(shapeFactory.createShape(refLineSP))
  72109. }
  72110. // y 刻度增量
  72111. thckY += unitTick;
  72112. }
  72113. xMainPois.push([dvb[0], dvb[1]]);
  72114. // 3D 坐标轴 第三象限平分线
  72115. if (sets.axis3DParameter && !isNaN(sets.axis3DParameter) && sets.axis3DParameter >= 15) {
  72116. let axis3DParameter = parseInt(sets.axis3DParameter);
  72117. let axis3DPoi = [dvb[0] - axis3DParameter, dvb[1] + axis3DParameter];
  72118. /*
  72119. // 箭头计算过程
  72120. var axis3DPoiRef = [axis3DPoi[0] + 7, axis3DPoi[1] - 7]; // 7 是 10 为斜边 cos(45度)时邻边的值
  72121. var axis3DPoiLT = [axis3DPoiRef[0] - 4, axis3DPoiRef[1] - 4];
  72122. var axis3DPoiRB = [axis3DPoiRef[0] + 4, axis3DPoiRef[1] + 4];
  72123. if(sets.axisUseArrow){
  72124. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  72125. xMainPois.push([axis3DPoiLT[0], axis3DPoiLT[1]]);
  72126. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  72127. xMainPois.push([axis3DPoiRB[0], axis3DPoiRB[1]]);
  72128. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  72129. }
  72130. else{
  72131. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  72132. }
  72133. */
  72134. // 添加 3D 轴节点
  72135. if (sets.axisUseArrow) { // 添加 3D 轴和箭头坐标
  72136. //箭头坐标
  72137. zArrowPois.push([axis3DPoi[0] + 1.5, axis3DPoi[1] - 7.5]);
  72138. zArrowPois.push([axis3DPoi[0] - 1, axis3DPoi[1] + 1]);
  72139. zArrowPois.push([axis3DPoi[0] + 7.5, axis3DPoi[1] - 1.5]);
  72140. //3D轴
  72141. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  72142. } else {
  72143. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  72144. }
  72145. xMainPois.push([dvb[0], dvb[1]]);
  72146. }
  72147. xMainPois.push([dvb[2] + 5, dvb[1]]);
  72148. }
  72149. // 坐标轴箭头
  72150. if (sets.axisUseArrow) {
  72151. // x 轴箭头节点数组
  72152. var xArrowPois = [
  72153. [dvb[2] + 5, dvb[1] + 4],
  72154. [dvb[2] + 13, dvb[1]],
  72155. [dvb[2] + 5, dvb[1] - 4]
  72156. ];
  72157. // y 轴箭头节点数组
  72158. var yArrowPois = [
  72159. [dvb[0] - 4, dvb[3] - 5],
  72160. [dvb[0], dvb[3] - 13],
  72161. [dvb[0] + 4, dvb[3] - 5]
  72162. ];
  72163. //x轴箭头
  72164. var xSP = new feature_Polygon_Polygon(xArrowPois);
  72165. xSP.style = {fillColor: "#008acd"};
  72166. Util_Util.copyAttributesWithClip(xSP.style, sets.axisStyle);
  72167. arrows.push(shapeFactory.createShape(xSP));
  72168. //y轴箭头
  72169. var ySP = new feature_Polygon_Polygon(yArrowPois);
  72170. ySP.style = {fillColor: "#008acd"};
  72171. Util_Util.copyAttributesWithClip(ySP.style, sets.axisStyle);
  72172. arrows.push(shapeFactory.createShape(ySP));
  72173. // z轴箭头 坐标轴箭头是否要使用
  72174. if (sets.axis3DParameter && !isNaN(sets.axis3DParameter) && sets.axis3DParameter >= 15) {
  72175. var zSP = new feature_Polygon_Polygon(zArrowPois);
  72176. zSP.style = {fillColor: "#008acd"};
  72177. Util_Util.copyAttributesWithClip(zSP.style, sets.axisStyle);
  72178. arrows.push(shapeFactory.createShape(zSP));
  72179. }
  72180. }
  72181. //不带箭头的坐标轴
  72182. pois = xMainPois;
  72183. // 坐标轴参数对象
  72184. var axisSP = new Line_Line(pois);
  72185. // 坐标轴默认style
  72186. axisSP.style = {
  72187. strokeLinecap: "butt",
  72188. strokeLineJoin: "round",
  72189. strokeColor: "#008acd",
  72190. strokeWidth: 1
  72191. };
  72192. // 用户 style
  72193. if (sets.axisStyle) {
  72194. Util_Util.copyAttributesWithClip(axisSP.style, sets.axisStyle);
  72195. }
  72196. // 禁止事件
  72197. axisSP.clickable = false;
  72198. axisSP.hoverable = false;
  72199. // 创建坐标轴图形对象
  72200. var axisMain = [shapeFactory.createShape(axisSP)];
  72201. // Y 轴标签
  72202. var yLabels = [];
  72203. if (sets.axisYLabels && sets.axisYLabels.length && sets.axisYLabels.length > 0) {
  72204. var axisYLabels = sets.axisYLabels;
  72205. let len = axisYLabels.length;
  72206. // 标签偏移量
  72207. var ylOffset = [0, 0];
  72208. if (sets.axisYLabelsOffset && sets.axisYLabelsOffset.length) {
  72209. ylOffset = sets.axisYLabelsOffset;
  72210. }
  72211. if (len == 1) {
  72212. // 标签参数对象
  72213. let labelYSP = new Label(dvb[0] - 5 + ylOffset[0], dvb[3] + ylOffset[1], axisYLabels[0]);
  72214. labelYSP.style = {
  72215. labelAlign: "right"
  72216. };
  72217. // 用户 style
  72218. if (sets.axisYLabelsStyle) {
  72219. Util_Util.copyAttributesWithClip(labelYSP.style, sets.axisYLabelsStyle);
  72220. }
  72221. // 禁止事件
  72222. labelYSP.clickable = false;
  72223. labelYSP.hoverable = false;
  72224. // 制作标签
  72225. yLabels.push(shapeFactory.createShape(labelYSP));
  72226. } else {
  72227. var labelY = dvb[3];
  72228. // y 轴标签单位距离
  72229. var yUnit = Math.abs(dvb[1] - dvb[3]) / (len - 1);
  72230. for (var j = 0; j < len; j++) {
  72231. // 标签参数对象
  72232. let labelYSP = new Label(dvb[0] - 5 + ylOffset[0], labelY + ylOffset[1], axisYLabels[j]);
  72233. labelYSP.style = {
  72234. labelAlign: "right"
  72235. };
  72236. // 用户 style
  72237. if (sets.axisYLabelsStyle) {
  72238. Util_Util.copyAttributesWithClip(labelYSP.style, sets.axisYLabelsStyle);
  72239. }
  72240. // 禁止事件
  72241. labelYSP.clickable = false;
  72242. labelYSP.hoverable = false;
  72243. // 制作标签
  72244. yLabels.push(shapeFactory.createShape(labelYSP));
  72245. // y 轴标签 y 方向增量
  72246. labelY += yUnit;
  72247. }
  72248. }
  72249. }
  72250. // X 轴标签
  72251. var xLabels = [];
  72252. if (sets.axisXLabels && sets.axisXLabels.length && sets.axisXLabels.length > 0) {
  72253. let axisXLabels = sets.axisXLabels;
  72254. let len = axisXLabels.length;
  72255. // 标签偏移量
  72256. let xlOffset = [0, 0];
  72257. if (sets.axisXLabelsOffset && sets.axisXLabelsOffset.length) {
  72258. xlOffset = sets.axisXLabelsOffset;
  72259. }
  72260. // 标签个数与数据字段个数相等等时,标签在 x 轴均匀排列
  72261. if (xShapeInfo && xShapeInfo.xPositions && xShapeInfo.xPositions.length && xShapeInfo.xPositions.length == len) {
  72262. let xsCenter = xShapeInfo.xPositions;
  72263. for (let K = 0; K < len; K++) {
  72264. // 标签参数对象
  72265. let labelXSP = new Label(xsCenter[K] + xlOffset[0], dvb[1] + xlOffset[1], axisXLabels[K]);
  72266. // 默认 style
  72267. labelXSP.style = {
  72268. labelAlign: "center",
  72269. labelBaseline: "top"
  72270. };
  72271. // 用户 style
  72272. if (sets.axisXLabelsStyle) {
  72273. Util_Util.copyAttributesWithClip(labelXSP.style, sets.axisXLabelsStyle);
  72274. }
  72275. // 禁止事件
  72276. labelXSP.clickable = false;
  72277. labelXSP.hoverable = false;
  72278. // 创建标签对象
  72279. xLabels.push(shapeFactory.createShape(labelXSP));
  72280. }
  72281. } else {
  72282. if (len == 1) {
  72283. // 标签参数对象
  72284. let labelXSP = new Label(dvb[0] - 5 + xlOffset[0], dvb[1] + xlOffset[0], axisXLabels[0]);
  72285. // 默认 style
  72286. labelXSP.style = {
  72287. labelAlign: "center",
  72288. labelBaseline: "top"
  72289. };
  72290. // 用户 style
  72291. if (sets.axisXLabelsStyle) {
  72292. Util_Util.copyAttributesWithClip(labelXSP.style, sets.axisXLabelsStyle);
  72293. }
  72294. // 禁止事件
  72295. labelXSP.clickable = false;
  72296. labelXSP.hoverable = false;
  72297. // 创建标签对象
  72298. xLabels.push(shapeFactory.createShape(labelXSP));
  72299. } else {
  72300. let labelX = dvb[0];
  72301. // x 轴标签单位距离
  72302. let xUnit = Math.abs(dvb[2] - dvb[0]) / (len - 1);
  72303. for (let m = 0; m < len; m++) {
  72304. // 标签参数对象
  72305. let labelXSP = new Label(labelX + xlOffset[0], dvb[1] + xlOffset[1], axisXLabels[m]);
  72306. // 默认 style
  72307. labelXSP.style = {
  72308. labelAlign: "center",
  72309. labelBaseline: "top"
  72310. };
  72311. // 用户 style
  72312. if (sets.axisXLabelsStyle) {
  72313. Util_Util.copyAttributesWithClip(labelXSP.style, sets.axisXLabelsStyle);
  72314. }
  72315. // 禁止事件
  72316. labelXSP.clickable = false;
  72317. labelXSP.hoverable = false;
  72318. // 创建标签对象
  72319. xLabels.push(shapeFactory.createShape(labelXSP));
  72320. // x 轴标签 x 方向增量
  72321. labelX += xUnit;
  72322. }
  72323. }
  72324. }
  72325. }
  72326. // 组装并返回构成坐标轴的图形
  72327. return ((refLines.concat(axisMain)).concat(yLabels)).concat(xLabels).concat(arrows);
  72328. }
  72329. /**
  72330. * @function FeatureShapeFactory.prototype.ShapeStyleTool
  72331. * @description 一个图形 style 处理工具。此工具将指定的默认 style,通用 style,按 styleGroup 取得的 style 和按数据值 value 范围取得的 style 进行合并,得到图形最终的 style。
  72332. * @param {Object} defaultStyle - 默认style,此样式对象可设属性根据图形类型参考 <{@link ShapeParameters}> 子类对象的 style 属性。
  72333. * @param {Object} style - 图形对象基础 style,此参数控制图形的基础样式,可设属性根据图形类型参考 <{@link ShapeParameters}> 子类对象的 style 属性。优先级低于 styleGroup,styleByCodomain。
  72334. * @param {Array.<Object>} styleGroup - 一个 style 数组,优先级低于 styleByCodomain,高于 style。此数组每个元素是样式对象,
  72335. * 其可设属性根据图形类型参考 <{@link ShapeParameters}> 子类对象的 style 属性。通过 index 参数从 styleGroup 中取 style。
  72336. * @param {Array.<Object>} styleByCodomain - 按数据(参数 value)所在值域范围控制数据的可视化对象样式。
  72337. * (start code)
  72338. * // styleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  72339. * // start: 值域值下限(包含);
  72340. * // end: 值域值上限(不包含);
  72341. * // style: 数据可视化图形的 style,其可设属性根据图形类型参考 <ShapeParameters> 子类对象的 style 属性。
  72342. * // dataStyleByCodomain 数组形如:
  72343. * [
  72344. * {
  72345. * start:0,
  72346. * end:250,
  72347. * style:{
  72348. * fillColor:"#00CD00"
  72349. * }
  72350. * },
  72351. * {
  72352. * start:250,
  72353. * end:500,
  72354. * style:{
  72355. * fillColor:"#00EE00"
  72356. * }
  72357. * },
  72358. * {
  72359. * start:500,
  72360. * end:750,
  72361. * style:{
  72362. * fillColor:"#00FF7F"
  72363. * }
  72364. * },
  72365. * {
  72366. * start:750,
  72367. * end:1500,
  72368. * style:{
  72369. * fillColor:"#00FF00"
  72370. * }
  72371. * }
  72372. * ]
  72373. * (end)
  72374. * @param {number} index - styleGroup 的索引值,用于取出 styleGroup 指定的 style。
  72375. * @param {number} value - 数据值,用于取出 styleByCodomain 指定的 style。
  72376. * @returns {Object} 合并后的样式 (style) 对象。
  72377. */
  72378. static ShapeStyleTool(defaultStyle, style, styleGroup, styleByCodomain, index, value) {
  72379. // 用 defaultStyle 初始化 style 对象
  72380. var finalStyle = defaultStyle ? defaultStyle : {};
  72381. // 基础 style
  72382. if (style) {
  72383. Util_Util.copyAttributesWithClip(finalStyle, style);
  72384. }
  72385. // 按索引赋 style
  72386. if (styleGroup && styleGroup.length && typeof(index) !== "undefined" && !isNaN(index) && index >= 0) {
  72387. if (styleGroup[index]) {
  72388. Util_Util.copyAttributesWithClip(finalStyle, styleGroup[index]);
  72389. }
  72390. }
  72391. // 按值域赋 style
  72392. if (styleByCodomain && styleByCodomain.length && typeof(value) !== "undefined") {
  72393. var dsc = styleByCodomain;
  72394. var dscLen = dsc.length;
  72395. var v = parseFloat(value);
  72396. for (var i = 0; i < dscLen; i++) {
  72397. if (dsc[i].start <= v && v < dsc[i].end) {
  72398. Util_Util.copyAttributesWithClip(finalStyle, dsc[i].style);
  72399. break;
  72400. }
  72401. }
  72402. }
  72403. return finalStyle;
  72404. }
  72405. }
  72406. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Theme.js
  72407. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  72408. * This program are made available under the terms of the Apache License, Version 2.0
  72409. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72410. /**
  72411. * @class FeatureTheme
  72412. * @aliasclass Feature.Theme
  72413. * @deprecatedclass SuperMap.Feature.Theme
  72414. * @category Visualization Theme
  72415. * @classdesc 专题要素基类。
  72416. * @param {Object} data - 用户数据,用于生成可视化 shape。
  72417. * @param {SuperMap.Layer.Theme} layer - 此专题要素所在图层。
  72418. * @usage
  72419. */
  72420. class Theme_Theme {
  72421. constructor(data, layer) {
  72422. if (!data) {
  72423. return;
  72424. }
  72425. // layer 必须已经添加到地图, 且已初始化渲染器
  72426. if (!layer || !layer.map || !layer.renderer) {
  72427. return;
  72428. }
  72429. /**
  72430. * @member {string} FeatureTheme.prototype.id
  72431. * @description 专题要素唯一标识。
  72432. */
  72433. this.id = Util_Util.createUniqueID(this.CLASS_NAME + "_");
  72434. /**
  72435. * @member {LonLat} FeatureTheme.prototype.lonlat
  72436. * @description 专题要素地理参考位置。子类中必须根据用户数据(或地理位置参数)对其赋值。
  72437. */
  72438. this.lonlat = null;
  72439. /**
  72440. * @member {Array.<number>} FeatureTheme.prototype.location
  72441. * @description 专题要素像素参考位置。通常由地理参考位置决定。长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  72442. */
  72443. this.location = [];
  72444. /**
  72445. * @readonly
  72446. * @member {Object} FeatureTheme.prototype.data
  72447. * @description 用户数据,用于生成可视化 shape,可在子类中规定数据格式或类型,如:<{@link FeatureVector}>。
  72448. */
  72449. this.data = data;
  72450. /**
  72451. * @readonly
  72452. * @member {Array.<Object>} FeatureTheme.prototype.shapes
  72453. * @description 构成此专题要素的可视化图形对象数组,数组顺序控制渲染。
  72454. */
  72455. this.shapes = [];
  72456. /**
  72457. * @readonly
  72458. * @member {SuperMap.Layer.Theme} FeatureTheme.prototype.layer
  72459. * @description 此专题要素所在专题图层。
  72460. */
  72461. this.layer = layer;
  72462. this.CLASS_NAME = "SuperMap.Feature.Theme";
  72463. }
  72464. /**
  72465. * @function FeatureTheme.prototype.destroy
  72466. * @description 销毁专题要素。
  72467. */
  72468. destroy() {
  72469. this.data = null;
  72470. this.id = null;
  72471. this.lonlat = null;
  72472. this.location = null;
  72473. this.shapes = null;
  72474. this.layer = null;
  72475. }
  72476. /**
  72477. * @function FeatureTheme.prototype.getLocalXY
  72478. * @description 地理坐标转为像素坐标。
  72479. * @param {GeometryPoint|GeometryGeoText|LonLat} coordinate - 地理坐标点。
  72480. * @returns {Array.<number>} 长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  72481. */
  72482. getLocalXY(coordinate) {
  72483. var resolution = this.layer.map.getResolution();
  72484. var extent = this.layer.map.getExtent();
  72485. if (coordinate instanceof Point || coordinate instanceof GeoText) {
  72486. let x = (coordinate.x / resolution + (-extent.left / resolution));
  72487. let y = ((extent.top / resolution) - coordinate.y / resolution);
  72488. return [x, y];
  72489. } else if (coordinate instanceof LonLat) {
  72490. let x = (coordinate.lon / resolution + (-extent.left / resolution));
  72491. let y = ((extent.top / resolution) - coordinate.lat / resolution);
  72492. return [x, y];
  72493. } else {
  72494. return null;
  72495. }
  72496. }
  72497. }
  72498. ;// CONCATENATED MODULE: ./src/common/overlay/Graph.js
  72499. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  72500. * This program are made available under the terms of the Apache License, Version 2.0
  72501. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72502. /**
  72503. * @class FeatureThemeGraph
  72504. * @aliasclass Feature.Theme.Graph
  72505. * @deprecatedclass SuperMap.Feature.Theme.Graph
  72506. * @category Visualization Theme
  72507. * @classdesc 统计专题要素基类。
  72508. * 此类定义了统计专题要素基础模型,具体的图表模型通过继承此类,在子类中实现 assembleShapes 方法。
  72509. * 统计专题要素模型采用了可视化图形大小自适应策略,用较少的参数控制着图表诸多图形,图表配置对象 <FeatureThemeGraph.setting> 的基础属性只有 7 个,
  72510. * 它们控制着图表结构、值域范围、数据小数位等基础图表形态。构成图表的图形必须在图表结构里自适应大小。
  72511. * 此类不可实例化,此类的可实例化子类必须实现 assembleShapes() 方法。
  72512. * @extends FeatureTheme
  72513. * @param {FeatureVector} data - 用户数据。
  72514. * @param {SuperMap.Layer.Theme} layer - 此专题要素所在图层。
  72515. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  72516. * @param {Object} setting - 图表配置对象。
  72517. * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  72518. * @usage
  72519. */
  72520. class Graph extends Theme_Theme {
  72521. constructor(data, layer, fields, setting, lonlat, options) {
  72522. super(data, layer, fields, setting, lonlat, options);
  72523. /**
  72524. * @member {FeatureShapeFactory} FeatureThemeGraph.prototype.shapeFactory
  72525. * @description 内置的图形工厂对象,调用其 createShape 方法创建图形。
  72526. */
  72527. this.shapeFactory = new ShapeFactory();
  72528. /**
  72529. * @member {Object} FeatureThemeGraph.prototype.shapeParameters
  72530. * @description 当前图形参数对象,<{@link ShapeParameters}> 的子类对象。
  72531. */
  72532. this.shapeParameters = null;
  72533. /**
  72534. * @member {boolean} [FeatureThemeGraph.prototype.RelativeCoordinate]
  72535. * @description 图形是否已经计算了相对坐标。
  72536. */
  72537. this.RelativeCoordinate = false;
  72538. /**
  72539. * @member {Object} FeatureThemeGraph.prototype.setting
  72540. * @description 图表配置对象,该对象控制着图表的可视化显示。
  72541. * @param {number} width - 专题要素(图表)宽度。
  72542. * @param {number} height - 专题要素(图表)高度。
  72543. * @param {Array.<number>} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  72544. * @param {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  72545. * @param {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  72546. * @param {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox
  72547. * (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  72548. * @param {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。
  72549. * 如果不设置此参数,在取数据值时不对数据做小数位处理。
  72550. *
  72551. */
  72552. this.setting = null;
  72553. /**
  72554. * @readonly
  72555. * @member {Array.<number>} FeatureThemeGraph.prototype.origonPoint
  72556. * @description 专题要素(图表)原点,图表左上角点像素坐标,是长度为 2 的一维数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  72557. */
  72558. this.origonPoint = null;
  72559. /**
  72560. * @readonly
  72561. * @member {Array.<number>} FeatureThemeGraph.prototype.chartBox
  72562. * @description 专题要素(图表)区域,即图表框,长度为 4 的一维数组,数组的 4 个元素依次表示图表框左端 x 坐标值、
  72563. * 下端 y坐标值、右端 x坐标值、上端 y 坐标值;[left, bottom, right, top]。
  72564. */
  72565. this.chartBox = null;
  72566. /**
  72567. * @readonly
  72568. * @member {Bounds} FeatureThemeGraph.prototype.chartBounds
  72569. * @description 图表 Bounds 随着 lonlat、XOffset、YOffset 更新,注意 chartBounds 是图表像素范围,不是地理范围。
  72570. */
  72571. this.chartBounds = null;
  72572. /**
  72573. * @readonly
  72574. * @member {number} FeatureThemeGraph.prototype.width
  72575. * @description 专题要素(图表)宽度 。
  72576. */
  72577. this.width = null;
  72578. /**
  72579. * @readonly
  72580. * @member {number} FeatureThemeGraph.prototype.height
  72581. * @description 专题要素(图表)高度 。
  72582. */
  72583. this.height = null;
  72584. /**
  72585. * @readonly
  72586. * @member {number} FeatureThemeGraph.prototype.XOffset
  72587. * @description 专题要素(图表)在 X 方向上的偏移值,单位像素。
  72588. */
  72589. this.XOffset = 0;
  72590. /**
  72591. * @readonly
  72592. * @member {number} FeatureThemeGraph.prototype.YOffset
  72593. * @description 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  72594. */
  72595. this.YOffset = 0;
  72596. /**
  72597. * @readonly
  72598. * @member {Array.<number>} FeatureThemeGraph.prototype.DVBParameter
  72599. * @description 数据视图框参数,长度为 4 的一维数组(数组元素值 >= 0),[leftOffset, bottomOffset, rightOffset, topOffset],chartBox 内偏距值。
  72600. * 此属性用于指定数据视图框 dataViewBox 的范围。
  72601. */
  72602. this.DVBParameter = null;
  72603. /**
  72604. * @readonly
  72605. * @member {Array.<number>} FeatureThemeGraph.prototype.dataViewBox
  72606. * @description 数据视图框,长度为 4 的一维数组,[left, bottom, right, top]。
  72607. * dataViewBox 是统计专题要素最核心的内容,它负责解释数据在一个像素区域里的数据可视化含义,
  72608. * 这种含义用可视化图形表达出来,这些表示数据的图形和一些辅助图形组合在一起构成统计专题图表。
  72609. */
  72610. this.dataViewBox = null;
  72611. /**
  72612. * @readonly
  72613. * @member {Array.<number>} FeatureThemeGraph.prototype.DVBCodomain
  72614. * @description 数据视图框的内允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  72615. * dataViewBox 中允许的数据范围,对数据溢出值域范围情况的处理需要在 assembleShapes 中进行。
  72616. */
  72617. this.DVBCodomain = null;
  72618. /**
  72619. * @readonly
  72620. * @member {Array.<number>} FeatureThemeGraph.prototype.DVBCenterPoint
  72621. * @description 数据视图框中心点,长度为 2 的一维数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  72622. */
  72623. this.DVBCenterPoint = null;
  72624. /**
  72625. * @readonly
  72626. * @member {string} FeatureThemeGraph.prototype.DVBUnitValue
  72627. * @description 单位值。在 assembleShapes() 中初始化其具体意义,例如:饼图的 DVBUnitValue 可以定义为"360/数据总和",
  72628. * 折线图的 DVBUnitValue 可以定义为 "DVBCodomain/DVBHeight"。
  72629. */
  72630. this.DVBUnitValue = null;
  72631. /**
  72632. * @readonly
  72633. * @member {Array.<number>} FeatureThemeGraph.prototype.DVBOrigonPoint
  72634. * @description 数据视图框原点,数据视图框左上角点,长度为 2 的一维数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  72635. */
  72636. this.DVBOrigonPoint = null;
  72637. /**
  72638. * @readonly
  72639. * @member {number} FeatureThemeGraph.prototype.DVBWidth
  72640. * @description 数据视图框宽度。
  72641. */
  72642. this.DVBWidth = null;
  72643. /**
  72644. * @readonly
  72645. * @member {number} FeatureThemeGraph.prototype.DVBHeight
  72646. * @description 数据视图框高度。
  72647. */
  72648. this.DVBHeight = null;
  72649. /**
  72650. * @readonly
  72651. * @member {Array.<number>} FeatureThemeGraph.prototype.origonPointOffset
  72652. * @description 数据视图框原点相对于图表框的原点偏移量,长度为 2 的一维数组,第一个元素表示 x 偏移量,第二个元素表示 y 偏移量。
  72653. */
  72654. this.origonPointOffset = null;
  72655. /**
  72656. * @readonly
  72657. * @member {Array.<string>} FeatureThemeGraph.prototype.fields
  72658. * @description 数据{FeatureVector}属性字段。
  72659. */
  72660. this.fields = fields || [];
  72661. /**
  72662. * @readonly
  72663. * @member {Array.<number>} FeatureThemeGraph.prototype.dataValues
  72664. * @description 图表展示的数据值,通过 fields 从数据 feature 属性中获得。
  72665. */
  72666. this.dataValues = null;
  72667. // 图表位置
  72668. if (lonlat) {
  72669. this.lonlat = lonlat;
  72670. } else {
  72671. // 默认使用 bounds 中心
  72672. this.lonlat = this.data.geometry.getBounds().getCenterLonLat();
  72673. }
  72674. // 配置项检测与赋值
  72675. if (setting && setting.width && setting.height && setting.codomain) {
  72676. this.setting = setting;
  72677. }
  72678. this.CLASS_NAME = "SuperMap.Feature.Theme.Graph";
  72679. }
  72680. /**
  72681. * @function FeatureThemeGraph.prototype.destroy
  72682. * @description 销毁专题要素。
  72683. */
  72684. destroy() {
  72685. this.shapeFactory = null;
  72686. this.shapeParameters = null;
  72687. this.width = null;
  72688. this.height = null;
  72689. this.origonPoint = null;
  72690. this.chartBox = null;
  72691. this.dataViewBox = null;
  72692. this.chartBounds = null;
  72693. this.DVBParameter = null;
  72694. this.DVBOrigonPoint = null;
  72695. this.DVBCenterPoint = null;
  72696. this.DVBWidth = null;
  72697. this.DVBHeight = null;
  72698. this.DVBCodomain = null;
  72699. this.DVBUnitValue = null;
  72700. this.origonPointOffset = null;
  72701. this.XOffset = null;
  72702. this.YOffset = null;
  72703. this.fields = null;
  72704. this.dataValues = null;
  72705. this.setting = null;
  72706. super.destroy();
  72707. }
  72708. /**
  72709. * @function FeatureThemeGraph.prototype.initBaseParameter
  72710. * @description 初始化专题要素(图表)基础参数。在调用此方法前,此类的图表模型相关属性都是不可用的 ,此方法在 assembleShapes 函数中调用。
  72711. * 调用此函数关系到 setting 对象的以下属性。
  72712. * @param {number} width - 专题要素(图表)宽度。
  72713. * @param {number} height - 专题要素(图表)高度。
  72714. * @param {Array.<number>} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  72715. * @param {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  72716. * @param {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  72717. * @param {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox。
  72718. * (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  72719. * @param {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  72720. * @returns {boolean} 初始化参数是否成功。
  72721. */
  72722. initBaseParameter() {
  72723. // 参数初始化是否成功
  72724. var isSuccess = true;
  72725. // setting 属性是否已成功赋值
  72726. if (!this.setting) {
  72727. return false;
  72728. }
  72729. var sets = this.setting;
  72730. // 检测 setting 的必设参数
  72731. if (!(sets.width && sets.height && sets.codomain)) {
  72732. return false;
  72733. }
  72734. // 数据
  72735. var decimalNumber = (typeof(sets.decimalNumber) !== "undefined" && !isNaN(sets.decimalNumber)) ? sets.decimalNumber : -1;
  72736. var dataEffective = Theme_Theme.getDataValues(this.data, this.fields, decimalNumber);
  72737. this.dataValues = dataEffective ? dataEffective : [];
  72738. // 基础参数 width, height, codomain
  72739. this.width = parseFloat(sets.width);
  72740. this.height = parseFloat(sets.height);
  72741. this.DVBCodomain = sets.codomain;
  72742. // 图表偏移
  72743. // if(sets.XOffset) {this.XOffset = sets.XOffset};
  72744. // if(sets.YOffset) {this.YOffset = sets.YOffset};
  72745. this.XOffset = sets.XOffset ? sets.XOffset : 0;
  72746. this.YOffset = sets.YOffset ? sets.YOffset : 0;
  72747. // 其他默认值
  72748. this.origonPoint = [];
  72749. this.chartBox = [];
  72750. this.dataViewBox = [];
  72751. this.DVBParameter = sets.dataViewBoxParameter ? sets.dataViewBoxParameter : [0, 0, 0, 0];
  72752. this.DVBOrigonPoint = [];
  72753. this.DVBCenterPoint = [];
  72754. this.origonPointOffset = [];
  72755. // 图表位置
  72756. this.resetLocation();
  72757. // 专题要素宽度 w
  72758. var w = this.width;
  72759. // 专题要素高度 h
  72760. var h = this.height;
  72761. // 专题要素像素位置 loc
  72762. var loc = this.location;
  72763. // 专题要素像素位置 loc
  72764. this.origonPoint = [loc[0] - w / 2, loc[1] - h / 2];
  72765. // 专题要素原点(左上角)
  72766. var op = this.origonPoint;
  72767. // 图表框([left, bottom, right, top])
  72768. this.chartBox = [op[0], op[1] + h, op[0] + w, op[1]];
  72769. // 图表框
  72770. var cb = this.chartBox;
  72771. // 数据视图框参数,它是图表框各方向对应的内偏距
  72772. var dbbP = this.DVBParameter;
  72773. // 数据视图框 ([left, bottom, right, top])
  72774. this.dataViewBox = [cb[0] + dbbP[0], cb[1] - dbbP[1], cb[2] - dbbP[2], cb[3] + dbbP[3]];
  72775. // 数据视图框
  72776. var dvb = this.dataViewBox;
  72777. //检查数据视图框是否合法
  72778. if (dvb[0] >= dvb[2] || dvb[1] <= dvb[3]) {
  72779. return false;
  72780. }
  72781. // 数据视图框原点
  72782. this.DVBOrigonPoint = [dvb[0], dvb[3]];
  72783. // 数据视图框宽度
  72784. this.DVBWidth = Math.abs(dvb[2] - dvb[0]);
  72785. // 数据视图框高度
  72786. this.DVBHeight = Math.abs(dvb[1] - dvb[3]);
  72787. // 数据视图框中心点
  72788. this.DVBCenterPoint = [this.DVBOrigonPoint[0] + this.DVBWidth / 2, this.DVBOrigonPoint[1] + this.DVBHeight / 2]
  72789. // 数据视图框原点与图表框的原点偏移量
  72790. this.origonPointOffset = [this.DVBOrigonPoint[0] - op[0], this.DVBOrigonPoint[1] - op[1]];
  72791. return isSuccess;
  72792. }
  72793. /**
  72794. * @function FeatureThemeGraph.prototype.resetLocation
  72795. * @description 根据地理位置 lonlat 重置专题要素(图表)位置。
  72796. * @param {LonLat} lonlat - 专题要素新的像素中心位置。
  72797. * @returns {Array.<number>} 新专题要素像素参考位置。长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  72798. */
  72799. resetLocation(lonlat) {
  72800. if (lonlat) {
  72801. this.lonlat = lonlat;
  72802. }
  72803. // 获取地理位置对应的像素坐标 newLocalLX
  72804. var newLocalLX = this.getLocalXY(this.lonlat);
  72805. // 处理偏移量 XOffset, YOffset
  72806. newLocalLX[0] += this.XOffset;
  72807. newLocalLX[1] += this.YOffset;
  72808. // 将图形位置赋予 location 属性(注意 location 属性表示的是专题要素中心位置)
  72809. this.location = newLocalLX;
  72810. // 更新图表像素 Bounds
  72811. var w = this.width;
  72812. var h = this.height;
  72813. var loc = this.location;
  72814. this.chartBounds = new Bounds(loc[0] - w / 2, loc[1] + h / 2, loc[0] + w / 2, loc[1] - h / 2);
  72815. //重新计算当前渐变色
  72816. this.resetLinearGradient();
  72817. return loc;
  72818. }
  72819. /**
  72820. * @function FeatureThemeGraph.prototype.resetLinearGradient
  72821. * @description resetLocation 中调用 图表的相对坐标存在的时候,重新计算渐变的颜色(目前用于二维柱状图渐变色 所以子类实现此方法)。
  72822. */
  72823. resetLinearGradient() {
  72824. //子类实现此方法
  72825. }
  72826. /**
  72827. * @function FeatureThemeGraph.prototype.shapesConvertToRelativeCoordinate
  72828. * @description 将(构成图表)图形的节点转为相对坐标表示,此函数必须且只能在 assembleShapes() 结束时调用。
  72829. */
  72830. shapesConvertToRelativeCoordinate() {
  72831. var shapes = this.shapes;
  72832. var shapeROP = this.location;
  72833. for (var i = 0, len = shapes.length; i < len; i++) {
  72834. shapes[i].refOriginalPosition = shapeROP;
  72835. var style = shapes[i].style;
  72836. for (var sty in style) {
  72837. switch (sty) {
  72838. case "pointList":
  72839. var pl = style[sty];
  72840. for (var j = 0, len2 = pl.length; j < len2; j++) {
  72841. pl[j][0] -= shapeROP[0];
  72842. pl[j][1] -= shapeROP[1];
  72843. }
  72844. break;
  72845. case "x":
  72846. style[sty] -= shapeROP[0];
  72847. break;
  72848. case "y":
  72849. style[sty] -= shapeROP[1];
  72850. break;
  72851. default:
  72852. break;
  72853. }
  72854. }
  72855. }
  72856. this.RelativeCoordinate = true;
  72857. }
  72858. /**
  72859. * @function FeatureThemeGraph.prototype.assembleShapes
  72860. * @description 图形装配函数。抽象方法,可视化子类必须实现此方法。<br>
  72861. * 重写此方法的步骤:<br>
  72862. * 1. 图表的某些特殊配置项(setting)处理,例如多数图表模型需要重新指定 dataViewBoxParameter 的默认值。<br>
  72863. * 2. 调用 initBaseParameter() 方法初始化模型属性值,此步骤必须执行,只有当 initBaseParameter 返回 true 时才可以允许进行后续步骤。<br>
  72864. * 3. 计算图形参数,制作图形,图形组合。在组装图表过程中,应该特别注意数据视图框单位值的定义、数据值溢出值域范围的处理和图形大小自适应。<br>
  72865. * 4. 调用 shapesConvertToRelativeCoordinate() 方法,将图形的坐标值转为相对坐标,此步骤必须执行。
  72866. * @example
  72867. * //子类实现 assembleShapes() 接口的步骤示例:
  72868. * assembleShapes: function(){
  72869. * // 第一步:图表的某些特殊配置项(setting)处理,例如多数图表模型需要重新指定 dataViewBoxParameter 的默认值。此步骤是非必须过程。
  72870. *
  72871. * // 图表配置对象
  72872. * var sets = this.setting;
  72873. * // 默认数据视图框,这里展示在使用坐标轴和不使用坐标轴情况下对数据视图框参数赋予不同的默认值
  72874. * if(!sets.dataViewBoxParameter){
  72875. * if(typeof(sets.useAxis) === "undefined" || sets.useAxis){
  72876. * sets.dataViewBoxParameter = [45, 15, 15, 15];
  72877. * }
  72878. * else{
  72879. * sets.dataViewBoxParameter = [5, 5, 5, 5];
  72880. * }
  72881. * }
  72882. *
  72883. * // 第二步:初始化图表模型基本参数,只有在图表模型基本参数初始化成功时才可模型相关属性,如 this.dataViewBox、 this.DVBCodomain等。此步骤是必须过程。
  72884. * if(!this.initBaseParameter()) return;
  72885. *
  72886. * // 第三步:用图形组装图表,在组装图表过程中,应该特别注意数据视图框单位值的定义、数据值溢出值域范围的处理和图形大小自适应。
  72887. * // 定义图表数据视图框中单位值的含义,下面行代码表示将数据视图框单位值定义为数据视图框高度上每像素代表的数据值
  72888. * this.DVBUnitValue = (this.codomain[1] - this.codomain[0])/this.DVBHeight;
  72889. * var uv = this.DVBUnitValue;
  72890. *
  72891. * // 图形参数计算代码......
  72892. *
  72893. * // 关于图形装配,实际上就是利用图形工程对象 this.shapeFactory 的 createShape() 方法通过图形参数对象创建可视化的图形对象,并把这些图形对象按序添加到模型的图形库(his.shapes)中。下面的代码演示创建一个面图形参数对象,并允许通过图形配置对象设置图形的 style 和 highlightStyle,
  72894. * var barParams = new ShapeParametersPolygon(poiLists);
  72895. * barParams.style = sets.barStyle? sets.barStyle:{fillColor: "lightblue"};
  72896. * barParams.highlightStyle = sets.barHoverStyle? sets.barHoverStyle:{fillColor: "blue"};
  72897. * // 图形携带数据ID信息
  72898. * barParams.refDataID = this.data.id;
  72899. * // 创建图形并添加到图表图形数组中
  72900. * this.shapes.push(this.shapeFactory.createShape(barParams));
  72901. *
  72902. * // 第四步:调用 shapesConvertToRelativeCoordinate() 方法,将图形库(his.shapes)中的图形转为由相对坐标表示的图形,客户端统计专题图模块从结构上要求可视化图形使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数。此步骤是必须过程。
  72903. * this.shapesConvertToRelativeCoordinate();
  72904. * },
  72905. */
  72906. assembleShapes() {
  72907. //子类必须实现此方法
  72908. }
  72909. /**
  72910. * @function FeatureThemeGraph.prototype.getLocalXY
  72911. * @description 地理坐标转为像素坐标。
  72912. * @param {LonLat} lonlat - 带转换的地理坐标。
  72913. * @returns 屏幕像素坐标。
  72914. */
  72915. getLocalXY(lonlat) {
  72916. return this.layer.getLocalXY(lonlat);
  72917. }
  72918. }
  72919. /**
  72920. * @function FeatureTheme.getDataValues
  72921. * @description 根据字段名数组获取指定数据(feature)的属性值数组。属性值类型必须为 Number。
  72922. * @param {FeatureVector} data - 数据。
  72923. * @param {Array.<string>} [fields] - 字段名数组。
  72924. * @param {number} [decimalNumber] - 小数位处理参数,对获取到的属性数据值进行小数位处理。
  72925. * @returns {Array.<string>} 字段名数组对应的属性数据值数组。
  72926. */
  72927. Theme_Theme.getDataValues = function (data, fields, decimalNumber) {
  72928. if (!data.attributes) {
  72929. return false;
  72930. }
  72931. var fieldsValue = [];
  72932. var attrs = data.attributes;
  72933. for (var i = 0; i < fields.length; i++) {
  72934. for (var field in attrs) {
  72935. if (field !== fields[i]) {
  72936. continue
  72937. }
  72938. // 数字转换判断
  72939. try {
  72940. if (!isNaN(decimalNumber) && decimalNumber >= 0) {
  72941. fieldsValue.push(parseFloat(attrs[field].toString()).toFixed(decimalNumber));
  72942. } else {
  72943. fieldsValue.push(parseFloat(attrs[field].toString()));
  72944. }
  72945. } catch (e) {
  72946. throw new Error("not a number")
  72947. }
  72948. }
  72949. }
  72950. if (fieldsValue.length === fields.length) {
  72951. return fieldsValue;
  72952. } else {
  72953. return false;
  72954. }
  72955. };
  72956. ;// CONCATENATED MODULE: ./src/common/overlay/Bar.js
  72957. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  72958. * This program are made available under the terms of the Apache License, Version 2.0
  72959. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72960. /**
  72961. * @class FeatureThemeBar
  72962. * @aliasclass Feature.Theme.Bar
  72963. * @deprecatedclass SuperMap.Feature.Theme.Bar
  72964. * @classdesc 柱状图 。
  72965. * @category Visualization Theme
  72966. * @example
  72967. * // barStyleByCodomain参数用法如下:
  72968. * // barStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  72969. * // start: 值域值下限(包含);
  72970. * // end: 值域值上限(不包含);
  72971. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <ShapeParametersPolygon.style> 。
  72972. * // barStyleByCodomain 数组形如:
  72973. * [
  72974. * {
  72975. * start:0,
  72976. * end:250,
  72977. * style:{
  72978. * fillColor:"#00CD00"
  72979. * }
  72980. * },
  72981. * {
  72982. * start:250,
  72983. * end:500,
  72984. * style:{
  72985. * fillColor:"#00EE00"
  72986. * }
  72987. * },
  72988. * {
  72989. * start:500,
  72990. * end:750,
  72991. * style:{
  72992. * fillColor:"#00FF7F"
  72993. * }
  72994. * },
  72995. * {
  72996. * start:750,
  72997. * end:1500,
  72998. * style:{
  72999. * fillColor:"#00FF00"
  73000. * }
  73001. * }
  73002. * ]
  73003. * @extends FeatureThemeGraph
  73004. * @param {FeatureVector} data - 用户数据。
  73005. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  73006. * @param {Array.<string>} fields - data 属性中的参与此图表生成的属性字段名称。
  73007. * @param {FeatureThemeBar.setting} setting - 图表配置对象。
  73008. * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  73009. * @usage
  73010. * @private
  73011. */
  73012. class Bar extends Graph {
  73013. constructor(data, layer, fields, setting, lonlat) {
  73014. super(data, layer, fields, setting, lonlat);
  73015. this.CLASS_NAME = "SuperMap.Feature.Theme.Bar";
  73016. }
  73017. /**
  73018. * @function FeatureThemeBar.prototype.destroy
  73019. * @override
  73020. */
  73021. destroy() {
  73022. super.destroy();
  73023. }
  73024. /**
  73025. * @function FeatureThemeBar.prototype.assembleShapes
  73026. * @description 图表图形装配函数。
  73027. */
  73028. assembleShapes() {
  73029. //默认渐变颜色数组
  73030. var deafaultColors = [["#00FF00", "#00CD00"], ["#00CCFF", "#5E87A2"], ["#00FF66", "#669985"], ["#CCFF00", "#94A25E"], ["#FF9900", "#A2945E"]];
  73031. //默认阴影
  73032. var deafaultShawdow = {
  73033. showShadow: true,
  73034. shadowBlur: 8,
  73035. shadowColor: "rgba(100,100,100,0.8)",
  73036. shadowOffsetX: 2,
  73037. shadowOffsetY: 2
  73038. };
  73039. // 图表配置对象
  73040. var sets = this.setting;
  73041. if (!sets.barLinearGradient) {
  73042. sets.barLinearGradient = deafaultColors;
  73043. }
  73044. // 默认数据视图框
  73045. if (!sets.dataViewBoxParameter) {
  73046. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  73047. sets.dataViewBoxParameter = [45, 15, 15, 15];
  73048. } else {
  73049. sets.dataViewBoxParameter = [5, 5, 5, 5];
  73050. }
  73051. }
  73052. // 重要步骤:初始化参数
  73053. if (!this.initBaseParameter()) {
  73054. return;
  73055. }
  73056. // 值域
  73057. var codomain = this.DVBCodomain;
  73058. // 重要步骤:定义图表 BaFeatureThemeBarr 数据视图框中单位值的含义
  73059. this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
  73060. // 数据视图域
  73061. var dvb = this.dataViewBox;
  73062. // 用户数据值
  73063. var fv = this.dataValues;
  73064. if (fv.length < 1) {
  73065. return;
  73066. } // 没有数据
  73067. // 数据溢出值域范围处理
  73068. for (let i = 0, fvLen = fv.length; i < fvLen; i++) {
  73069. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  73070. return;
  73071. }
  73072. }
  73073. // 获取 x 轴上的图形信息
  73074. var xShapeInfo = this.calculateXShapeInfo();
  73075. if (!xShapeInfo) {
  73076. return;
  73077. }
  73078. // 每个柱条 x 位置
  73079. var xsLoc = xShapeInfo.xPositions;
  73080. // 柱条宽度
  73081. var xsWdith = xShapeInfo.width;
  73082. // 背景框,默认启用
  73083. if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
  73084. // 将背景框图形添加到模型的 shapes 数组,注意添加顺序,后添加的图形在先添加的图形之上。
  73085. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  73086. }
  73087. // 坐标轴, 默认启用
  73088. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  73089. // 添加坐标轴图形数组
  73090. this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
  73091. }
  73092. for (var i = 0; i < fv.length; i++) {
  73093. // 计算柱条 top 边的 y 轴坐标值
  73094. var yPx = dvb[1] - (fv[i] - codomain[0]) / this.DVBUnitValue;
  73095. // 柱条节点数组
  73096. var poiLists = [
  73097. [xsLoc[i] - xsWdith / 2, dvb[1] - 1],
  73098. [xsLoc[i] + xsWdith / 2, dvb[1] - 1],
  73099. [xsLoc[i] + xsWdith / 2, yPx],
  73100. [xsLoc[i] - xsWdith / 2, yPx]
  73101. ];
  73102. // 柱条参数对象(一个面参数对象)
  73103. var barParams = new feature_Polygon_Polygon(poiLists);
  73104. // 柱条 阴影 style
  73105. if (typeof(sets.showShadow) === "undefined" || sets.showShadow) {
  73106. if (sets.barShadowStyle) {
  73107. var sss = sets.barShadowStyle;
  73108. if (sss.shadowBlur) {
  73109. deafaultShawdow.shadowBlur = sss.shadowBlur;
  73110. }
  73111. if (sss.shadowColor) {
  73112. deafaultShawdow.shadowColor = sss.shadowColor;
  73113. }
  73114. if (sss.shadowOffsetX) {
  73115. deafaultShawdow.shadowOffsetX = sss.shadowOffsetX;
  73116. }
  73117. if (sss.shadowOffsetY) {
  73118. deafaultShawdow.shadowOffsetY = sss.shadowOffsetY;
  73119. }
  73120. }
  73121. barParams.style = {};
  73122. Util_Util.copyAttributesWithClip(barParams.style, deafaultShawdow);
  73123. }
  73124. // 图形携带的数据信息
  73125. barParams.refDataID = this.data.id;
  73126. barParams.dataInfo = {
  73127. field: this.fields[i],
  73128. value: fv[i]
  73129. };
  73130. // 柱条 hover click
  73131. if (typeof(sets.barHoverAble) !== "undefined") {
  73132. barParams.hoverable = sets.barHoverAble;
  73133. }
  73134. if (typeof(sets.barClickAble) !== "undefined") {
  73135. barParams.clickable = sets.barClickAble;
  73136. }
  73137. // 创建柱条并添加到图表图形数组中
  73138. this.shapes.push(this.shapeFactory.createShape(barParams));
  73139. }
  73140. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  73141. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  73142. this.shapesConvertToRelativeCoordinate();
  73143. }
  73144. /**
  73145. * @function FeatureThemeBar.prototype.calculateXShapeInfo
  73146. * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
  73147. * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
  73148. * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  73149. * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  73150. * 本函数中图形配置对象 setting 可设属性:
  73151. * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
  73152. * 长度为 3 的数组,第一元素表示第一个图形左端与数据视图框左端的空白间距,第二个元素表示图形间空白间距,
  73153. * 第三个元素表示最后一个图形右端与数据视图框右端端的空白间距 。
  73154. * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:
  73155. * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  73156. * width - {number} 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  73157. *
  73158. */
  73159. calculateXShapeInfo() {
  73160. var dvb = this.dataViewBox; // 数据视图框
  73161. var sets = this.setting; // 图表配置对象
  73162. var fvc = this.dataValues.length; // 数组值个数
  73163. if (fvc < 1) {
  73164. return null;
  73165. }
  73166. var xBlank; // x 轴空白间隔参数
  73167. var xShapePositions = []; // x 轴上图形的位置
  73168. var xShapeWidth = 0; // x 轴上图形宽度(自适应)
  73169. var dvbWidth = this.DVBWidth; // 数据视图框宽度
  73170. // x 轴空白间隔参数处理
  73171. if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 3) {
  73172. xBlank = sets.xShapeBlank;
  73173. var xsLen = dvbWidth - (xBlank[0] + xBlank[2] + (fvc - 1) * xBlank[1]);
  73174. if (xsLen <= fvc) {
  73175. return null;
  73176. }
  73177. xShapeWidth = xsLen / fvc
  73178. } else {
  73179. // 默认使用等距离空白间隔,空白间隔为图形宽度
  73180. xShapeWidth = dvbWidth / (2 * fvc + 1);
  73181. xBlank = [xShapeWidth, xShapeWidth, xShapeWidth];
  73182. }
  73183. // 图形 x 轴上的位置计算
  73184. var xOffset = 0
  73185. for (var i = 0; i < fvc; i++) {
  73186. if (i == 0) {
  73187. xOffset = xBlank[0] + xShapeWidth / 2;
  73188. } else {
  73189. xOffset += (xShapeWidth + xBlank[1]);
  73190. }
  73191. xShapePositions.push(dvb[0] + xOffset);
  73192. }
  73193. return {
  73194. "xPositions": xShapePositions,
  73195. "width": xShapeWidth
  73196. };
  73197. }
  73198. /**
  73199. * @function FeatureThemeBar.prototype.resetLinearGradient
  73200. * @description 图表的相对坐标存在的时候,重新计算渐变的颜色(目前用于二维柱状图 所以子类实现此方法)。
  73201. */
  73202. resetLinearGradient() {
  73203. if (this.RelativeCoordinate) {
  73204. var shpelength = this.shapes.length;
  73205. var barLinearGradient = this.setting.barLinearGradient;
  73206. var index = -1;
  73207. for (var i = 0; i < shpelength; i++) {
  73208. var shape = this.shapes[i];
  73209. if (shape.CLASS_NAME === "SuperMap.LevelRenderer.Shape.SmicPolygon") {
  73210. var style = shape.style;
  73211. //计算出当前的绝对 x y
  73212. var x1 = this.location[0] + style.pointList[0][0];
  73213. var x2 = this.location[0] + style.pointList[1][0];
  73214. //渐变颜色
  73215. index++;
  73216. //以防定义的颜色数组不够用
  73217. if (index >= barLinearGradient.length) {
  73218. index = index % barLinearGradient.length;
  73219. }
  73220. var color1 = barLinearGradient[index][0];
  73221. var color2 = barLinearGradient[index][1];
  73222. //颜色
  73223. var zcolor = new Color_Color();
  73224. var linearGradient = zcolor.getLinearGradient(x1, 0, x2, 0,
  73225. [[0, color1], [1, color2]]);
  73226. //赋值
  73227. shape.style.color = linearGradient;
  73228. }
  73229. }
  73230. }
  73231. }
  73232. }
  73233. ;// CONCATENATED MODULE: ./src/common/overlay/Bar3D.js
  73234. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  73235. * This program are made available under the terms of the Apache License, Version 2.0
  73236. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73237. /**
  73238. * @class FeatureThemeBar3D
  73239. * @aliasclass Feature.Theme.Bar3D
  73240. * @deprecatedclass SuperMap.Feature.Theme.Bar3D
  73241. * @classdesc 三维柱状图 。
  73242. * @category Visualization Theme
  73243. * @extends FeatureThemeGraph
  73244. * @param {FeatureVector} data - 用户数据。
  73245. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  73246. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  73247. * @param {FeatureThemeBar3D.setting} setting - 图表配置对象。
  73248. * @param {LonLat} [lonlat] - 专题要素地理位置,默认为 data 指代的地理要素 Bounds 中心。
  73249. *
  73250. *
  73251. * @example
  73252. * // barFaceStyleByCodomain 用法示例如下:
  73253. * // barFaceStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  73254. * // start: 值域值下限(包含);
  73255. * // end: 值域值上限(不包含);
  73256. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <ShapeParametersPolygon.style> 。
  73257. * // barFaceStyleByCodomain 数组形如:
  73258. * [
  73259. * {
  73260. * start:0,
  73261. * end:250,
  73262. * style:{
  73263. * fillColor:"#00CD00"
  73264. * }
  73265. * },
  73266. * {
  73267. * start:250,
  73268. * end:500,
  73269. * style:{
  73270. * fillColor:"#00EE00"
  73271. * }
  73272. * },
  73273. * {
  73274. * start:500,
  73275. * end:750,
  73276. * style:{
  73277. * fillColor:"#00FF7F"
  73278. * }
  73279. * },
  73280. * {
  73281. * start:750,
  73282. * end:1500,
  73283. * style:{
  73284. * fillColor:"#00FF00"
  73285. * }
  73286. * }
  73287. * ]
  73288. *
  73289. * @example
  73290. * // barSideStyleByCodomain 用法示例如下:
  73291. * // barSideStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  73292. * // start: 值域值下限(包含);
  73293. * // end: 值域值上限(不包含);
  73294. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <ShapeParametersPolygon.style> 。
  73295. * // barSideStyleByCodomain 数组形如:
  73296. * [
  73297. * {
  73298. * start:0,
  73299. * end:250,
  73300. * style:{
  73301. * fillColor:"#00CD00"
  73302. * }
  73303. * },
  73304. * {
  73305. * start:250,
  73306. * end:500,
  73307. * style:{
  73308. * fillColor:"#00EE00"
  73309. * }
  73310. * },
  73311. * {
  73312. * start:500,
  73313. * end:750,
  73314. * style:{
  73315. * fillColor:"#00FF7F"
  73316. * }
  73317. * },
  73318. * {
  73319. * start:750,
  73320. * end:1500,
  73321. * style:{
  73322. * fillColor:"#00FF00"
  73323. * }
  73324. * }
  73325. * ]
  73326. *
  73327. * @example
  73328. * // barTopStyleByCodomain 用法示例如下:
  73329. * // barTopStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  73330. * // start: 值域值下限(包含);
  73331. * // end: 值域值上限(不包含);
  73332. * // style: 数据可视化图形的 style,这个样式对象的可设属性:<ShapeParametersPolygon.style> 。
  73333. * // barTopStyleByCodomain 数组形如:
  73334. * [
  73335. * {
  73336. * start:0,
  73337. * end:250,
  73338. * style:{
  73339. * fillColor:"#00CD00"
  73340. * }
  73341. * },
  73342. * {
  73343. * start:250,
  73344. * end:500,
  73345. * style:{
  73346. * fillColor:"#00EE00"
  73347. * }
  73348. * },
  73349. * {
  73350. * start:500,
  73351. * end:750,
  73352. * style:{
  73353. * fillColor:"#00FF7F"
  73354. * }
  73355. * },
  73356. * {
  73357. * start:750,
  73358. * end:1500,
  73359. * style:{
  73360. * fillColor:"#00FF00"
  73361. * }
  73362. * }
  73363. * ]
  73364. * @usage
  73365. * @private
  73366. */
  73367. class Bar3D extends Graph {
  73368. constructor(data, layer, fields, setting, lonlat) {
  73369. super(data, layer, fields, setting, lonlat);
  73370. this.CLASS_NAME = "SuperMap.Feature.Theme.Bar3D";
  73371. }
  73372. /**
  73373. * @function FeatureThemeBar3D.prototype.destroy
  73374. * @override
  73375. */
  73376. destroy() {
  73377. super.destroy();
  73378. }
  73379. /**
  73380. * @function FeatureThemeBar3D.prototype.assembleShapes
  73381. * @description 图形装配实现(扩展接口)。
  73382. */
  73383. assembleShapes() {
  73384. // 图表配置对象
  73385. var sets = this.setting;
  73386. // 默认数据视图框
  73387. if (!sets.dataViewBoxParameter) {
  73388. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  73389. sets.dataViewBoxParameter = [45, 25, 20, 20];
  73390. } else {
  73391. sets.dataViewBoxParameter = [5, 5, 5, 5];
  73392. }
  73393. }
  73394. // 3d 柱图的坐标轴默认使用坐标轴箭头
  73395. sets.axisUseArrow = (typeof(sets.axisUseArrow) !== "undefined") ? sets.axisUseArrow : true;
  73396. sets.axisXLabelsOffset = (typeof(sets.axisXLabelsOffset) !== "undefined") ? sets.axisXLabelsOffset : [-10, 10];
  73397. // 重要步骤:初始化参数
  73398. if (!this.initBaseParameter()) {
  73399. return;
  73400. }
  73401. // 值域
  73402. var codomain = this.DVBCodomain;
  73403. // 重要步骤:定义图表 FeatureThemeBar 数据视图框中单位值的含义
  73404. this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
  73405. // 数据视图域
  73406. var dvb = this.dataViewBox;
  73407. // 用户数据值
  73408. var fv = this.dataValues;
  73409. if (fv.length < 1) {
  73410. return;
  73411. } // 没有数据
  73412. // 数据溢出值域范围处理
  73413. for (let i = 0, fvLen = fv.length; i < fvLen; i++) {
  73414. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  73415. return;
  73416. }
  73417. }
  73418. // 获取 x 轴上的图形信息
  73419. var xShapeInfo = this.calculateXShapeInfo();
  73420. if (!xShapeInfo) {
  73421. return;
  73422. }
  73423. // 每个柱条 x 位置
  73424. var xsLoc = xShapeInfo.xPositions;
  73425. // 柱条宽度
  73426. var xsWdith = xShapeInfo.width;
  73427. // 坐标轴, 默认启用
  73428. if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
  73429. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  73430. }
  73431. // 坐标轴
  73432. if (!sets.axis3DParameter || isNaN(sets.axis3DParameter) || sets.axis3DParameter < 15) {
  73433. sets.axis3DParameter = 20;
  73434. }
  73435. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  73436. this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
  73437. }
  73438. // 3d 偏移量, 默认值 10;
  73439. var offset3d = (sets.bar3DParameter && !isNaN(sets.bar3DParameter)) ? sets.bar3DParameter : 10;
  73440. for (let i = 0; i < fv.length; i++) {
  73441. // 无 3d 偏移量时的柱面顶部 y 坐标
  73442. var yPx = dvb[1] - (fv[i] - codomain[0]) / this.DVBUnitValue;
  73443. // 无 3d 偏移量时的柱面的左、右端 x 坐标
  73444. var iPoiL = xsLoc[i] - xsWdith / 2;
  73445. var iPoiR = xsLoc[i] + xsWdith / 2;
  73446. // 3d 柱顶面节点
  73447. var bar3DTopPois = [
  73448. [iPoiL, yPx],
  73449. [iPoiR, yPx],
  73450. [iPoiR - offset3d, yPx + offset3d],
  73451. [iPoiL - offset3d, yPx + offset3d]
  73452. ];
  73453. // 3d 柱侧面节点
  73454. var bar3DSidePois = [
  73455. [iPoiR, yPx],
  73456. [iPoiR - offset3d, yPx + offset3d],
  73457. [iPoiR - offset3d, dvb[1] + offset3d],
  73458. [iPoiR, dvb[1]]
  73459. ];
  73460. // 3d 柱正面节点
  73461. var bar3DFacePois = [
  73462. [iPoiL - offset3d, dvb[1] + offset3d],
  73463. [iPoiR - offset3d, dvb[1] + offset3d],
  73464. [iPoiR - offset3d, yPx + offset3d],
  73465. [iPoiL - offset3d, yPx + offset3d]
  73466. ];
  73467. if (offset3d <= 0) { // offset3d <= 0 时正面不偏移
  73468. bar3DFacePois = [
  73469. [iPoiL, dvb[1]],
  73470. [iPoiR, dvb[1]],
  73471. [iPoiR, yPx],
  73472. [iPoiL, yPx]
  73473. ];
  73474. }
  73475. // 新建 3d 柱面顶面、侧面、正面图形参数对象
  73476. var polyTopSP = new feature_Polygon_Polygon(bar3DTopPois);
  73477. var polySideSP = new feature_Polygon_Polygon(bar3DSidePois);
  73478. var polyFaceSP = new feature_Polygon_Polygon(bar3DFacePois);
  73479. // 侧面、正面图形 style 默认值
  73480. sets.barSideStyle = sets.barSideStyle ? sets.barSideStyle : sets.barFaceStyle;
  73481. sets.barSideStyleByFields = sets.barSideStyleByFields ? sets.barSideStyleByFields : sets.barFaceStyleByFields;
  73482. sets.barSideStyleByCodomain = sets.barSideStyleByCodomain ? sets.barSideStyleByCodomain : sets.barFaceStyleByCodomain;
  73483. sets.barTopStyle = sets.barTopStyle ? sets.barTopStyle : sets.barFaceStyle;
  73484. sets.barTopStyleByFields = sets.barTopStyleByFields ? sets.barTopStyleByFields : sets.barFaceStyleByFields;
  73485. sets.barTopStyleByCodomain = sets.barTopStyleByCodomain ? sets.barTopStyleByCodomain : sets.barFaceStyleByCodomain;
  73486. // 顶面、侧面、正面图形 style
  73487. polyFaceSP.style = ShapeFactory.ShapeStyleTool({
  73488. stroke: true,
  73489. strokeColor: "#ffffff",
  73490. fillColor: "#ee9900"
  73491. },
  73492. sets.barFaceStyle, sets.barFaceStyleByFields, sets.barFaceStyleByCodomain, i, fv[i]);
  73493. polySideSP.style = ShapeFactory.ShapeStyleTool({
  73494. stroke: true,
  73495. strokeColor: "#ffffff",
  73496. fillColor: "#ee9900"
  73497. },
  73498. sets.barSideStyle, sets.barSideStyleByFields, sets.barSideStyleByCodomain, i, fv[i]);
  73499. polyTopSP.style = ShapeFactory.ShapeStyleTool({
  73500. stroke: true,
  73501. strokeColor: "#ffffff",
  73502. fillColor: "#ee9900"
  73503. },
  73504. sets.barTopStyle, sets.barTopStyleByFields, sets.barTopStyleByCodomain, i, fv[i]);
  73505. // 3d 柱条高亮样式
  73506. sets.barSideHoverStyle = sets.barSideHoverStyle ? sets.barSideHoverStyle : sets.barFaceHoverStyle;
  73507. sets.barTopHoverStyle = sets.barTopHoverStyle ? sets.barTopHoverStyle : sets.barFaceHoverStyle;
  73508. polyFaceSP.highlightStyle = ShapeFactory.ShapeStyleTool({stroke: true}, sets.barFaceHoverStyle);
  73509. polySideSP.highlightStyle = ShapeFactory.ShapeStyleTool({stroke: true}, sets.barSideHoverStyle);
  73510. polyTopSP.highlightStyle = ShapeFactory.ShapeStyleTool({stroke: true}, sets.barTopHoverStyle);
  73511. // 图形携带的数据 id 信息 & 高亮模式
  73512. polyTopSP.refDataID = polySideSP.refDataID = polyFaceSP.refDataID = this.data.id;
  73513. // hover 模式(组合)
  73514. polyTopSP.isHoverByRefDataID = polySideSP.isHoverByRefDataID = polyFaceSP.isHoverByRefDataID = true;
  73515. // 高亮组(当鼠标 hover 到组内任何一个图形,整个组的图形都会高亮。refDataHoverGroup 在 isHoverByRefDataID 为 true 时有效)
  73516. polyTopSP.refDataHoverGroup = polySideSP.refDataHoverGroup = polyFaceSP.refDataHoverGroup = Util_Util.createUniqueID("lr_shg");
  73517. // 图形携带的数据信息
  73518. polyTopSP.dataInfo = polySideSP.dataInfo = polyFaceSP.dataInfo = {
  73519. field: this.fields[i],
  73520. value: fv[i]
  73521. };
  73522. // 3d 柱条顶面、侧面、正面图形 hover click 设置
  73523. if (typeof(sets.barHoverAble) !== "undefined") {
  73524. polyTopSP.hoverable = polySideSP.hoverable = polyFaceSP.hoverable = sets.barHoverAble;
  73525. }
  73526. if (typeof(sets.barClickAble) !== "undefined") {
  73527. polyTopSP.clickable = polySideSP.clickable = polyFaceSP.clickable = sets.barClickAble;
  73528. }
  73529. // 创建3d 柱条的顶面、侧面、正面图形并添加到图表的图形列表数组
  73530. this.shapes.push(this.shapeFactory.createShape(polySideSP));
  73531. this.shapes.push(this.shapeFactory.createShape(polyTopSP));
  73532. this.shapes.push(this.shapeFactory.createShape(polyFaceSP));
  73533. }
  73534. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  73535. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  73536. this.shapesConvertToRelativeCoordinate();
  73537. }
  73538. /**
  73539. * @function FeatureThemeBar3D.prototype.calculateXShapeInfo
  73540. * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
  73541. * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
  73542. * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  73543. * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  73544. * 本函数中图形配置对象 setting 可设属性:
  73545. * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
  73546. * 长度为 3 的数组,第一元素表示第一个图形左端与数据视图框左端的空白间距,第二个元素表示图形间空白间距,
  73547. * 第三个元素表示最后一个图形右端与数据视图框右端端的空白间距 。
  73548. * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:
  73549. * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  73550. * width - {number} 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  73551. */
  73552. calculateXShapeInfo() {
  73553. var dvb = this.dataViewBox; // 数据视图框
  73554. var sets = this.setting; // 图表配置对象
  73555. var fvc = this.dataValues.length; // 数组值个数
  73556. if (fvc < 1) {
  73557. return null;
  73558. }
  73559. var xBlank; // x 轴空白间隔参数
  73560. var xShapePositions = []; // x 轴上图形的位置
  73561. var xShapeWidth = 0; // x 轴上图形宽度(自适应)
  73562. var dvbWidth = this.DVBWidth; // 数据视图框宽度
  73563. // x 轴空白间隔参数处理
  73564. if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 3) {
  73565. xBlank = sets.xShapeBlank;
  73566. var xsLen = dvbWidth - (xBlank[0] + xBlank[2] + (fvc - 1) * xBlank[1])
  73567. if (xsLen <= fvc) {
  73568. return null;
  73569. }
  73570. xShapeWidth = xsLen / fvc
  73571. } else {
  73572. // 默认使用等距离空白间隔,空白间隔为图形宽度
  73573. xShapeWidth = dvbWidth / (2 * fvc + 1);
  73574. xBlank = [xShapeWidth, xShapeWidth, xShapeWidth];
  73575. }
  73576. // 图形 x 轴上的位置计算
  73577. var xOffset = 0
  73578. for (var i = 0; i < fvc; i++) {
  73579. if (i == 0) {
  73580. xOffset = xBlank[0] + xShapeWidth / 2;
  73581. } else {
  73582. xOffset += (xShapeWidth + xBlank[1]);
  73583. }
  73584. xShapePositions.push(dvb[0] + xOffset);
  73585. }
  73586. return {
  73587. "xPositions": xShapePositions,
  73588. "width": xShapeWidth
  73589. };
  73590. }
  73591. }
  73592. ;// CONCATENATED MODULE: ./src/common/overlay/RankSymbol.js
  73593. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  73594. * This program are made available under the terms of the Apache License, Version 2.0
  73595. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73596. /**
  73597. * @class FeatureThemeRankSymbol
  73598. * @aliasclass Feature.Theme.RankSymbol
  73599. * @deprecatedclass SuperMap.Feature.Theme.RankSymbol
  73600. * @category Visualization Theme
  73601. * @classdesc 符号专题要素基类。此类定义了符号专题要素基础模型,具体的图表模型通过继承此类,在子类中实现 assembleShapes 方法。
  73602. * 符号专题要素模型采用了可视化图形大小自适应策略,用较少的参数控制着图表诸多图形,图表配置对象 <FeatureThemeRankSymbol.setting> 的基础属性只有 5 个,
  73603. * 它们控制着图表结构、值域范围、数据小数位等基础图表形态。构成图表的图形必须在图表结构里自适应大小。
  73604. * 此类不可实例化,此类的可实例化子类必须实现 assembleShapes() 方法。
  73605. * @param {FeatureVector} data - 用户数据。
  73606. * @param {SuperMap.Layer.RankSymbol} layer - 此专题要素所在图层。
  73607. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  73608. * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  73609. * @param {Object} setting - 图表配置对象。除了以下 5 个基础属性,此对象的可设属性在不同子类中有较大差异,不同子类中对同一属性的解释也可能不同,请在此类的子类中查看 setting 对象的可设属性和属性含义。
  73610. * @param {Array.<number>} setting.codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  73611. * @param {number} [setting.XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  73612. * @param {number} [setting.YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  73613. * @param {Array.<number>} [setting.dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  73614. * @param {number} [setting.decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  73615. * @extends FeatureThemeGraph
  73616. * @usage
  73617. */
  73618. class RankSymbol extends Graph {
  73619. constructor(data, layer, fields, setting, lonlat, options) {
  73620. super(data, layer, fields, setting, lonlat, options);
  73621. /**
  73622. * @member {Object} FeatureThemeRankSymbol.prototype.setting
  73623. * @description 符号配置对象,该对象控制着图表的可视化显示。
  73624. */
  73625. this.setting = null;
  73626. // 配置项检测与赋值
  73627. if (setting && setting.codomain) {
  73628. this.setting = setting;
  73629. this.DVBCodomain = this.setting.codomain;
  73630. }
  73631. this.CLASS_NAME = "SuperMap.Feature.Theme.RankSymbol";
  73632. }
  73633. /**
  73634. * @function FeatureThemeRankSymbol.prototype.destroy
  73635. * @description 销毁专题要素。
  73636. */
  73637. destroy() {
  73638. this.setting = null;
  73639. super.destroy();
  73640. }
  73641. /**
  73642. * @function FeatureThemeRankSymbol.prototype.initBaseParameter
  73643. * @description 初始化专题要素(图形)基础参数。
  73644. * 在调用此方法前,此类的图表模型相关属性都是不可用的 ,此方法在 assembleShapes 函数中调用。
  73645. * 调用此函数关系到 setting 对象的以下属性。
  73646. * @param {Array.<number>} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  73647. * @param {number} [XOffset] - 专题要素(图形)在 X 方向上的偏移值,单位像素。
  73648. * @param {number} [YOffset] - 专题要素(图形)在 Y 方向上的偏移值,单位像素。
  73649. * @param {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图形框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  73650. * @param {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  73651. * @returns {boolean} 初始化参数是否成功。
  73652. */
  73653. initBaseParameter() {
  73654. // 参数初始化是否成功
  73655. var isSuccess = true;
  73656. // setting 属性是否已成功赋值
  73657. if (!this.setting) {
  73658. return false;
  73659. }
  73660. var sets = this.setting;
  73661. // 图表偏移
  73662. if (sets.XOffset) {
  73663. this.XOffset = sets.XOffset;
  73664. }
  73665. if (sets.YOffset) {
  73666. this.YOffset = sets.YOffset;
  73667. }
  73668. this.XOffset = sets.XOffset ? sets.XOffset : 0;
  73669. this.YOffset = sets.YOffset ? sets.YOffset : 0;
  73670. // 其他默认值
  73671. this.origonPoint = [];
  73672. this.chartBox = [];
  73673. this.dataViewBox = [];
  73674. this.DVBParameter = sets.dataViewBoxParameter ? sets.dataViewBoxParameter : [0, 0, 0, 0];
  73675. this.DVBOrigonPoint = [];
  73676. this.DVBCenterPoint = [];
  73677. this.origonPointOffset = [];
  73678. // 图表位置
  73679. this.resetLocation();
  73680. // 专题要素宽度 w
  73681. var w = this.width;
  73682. // 专题要素高度 h
  73683. var h = this.height;
  73684. // 专题要素像素位置 loc
  73685. var loc = this.location;
  73686. // 专题要素像素位置 loc
  73687. this.origonPoint = [loc[0] - w / 2, loc[1] - h / 2];
  73688. // 专题要素原点(左上角)
  73689. var op = this.origonPoint;
  73690. // 图表框([left, bottom, right, top])
  73691. this.chartBox = [op[0], op[1] + h, op[0] + w, op[1]];
  73692. // 图表框
  73693. var cb = this.chartBox;
  73694. // 数据视图框参数,它是图表框各方向对应的内偏距
  73695. var dbbP = this.DVBParameter;
  73696. // 数据视图框 ([left, bottom, right, top])
  73697. this.dataViewBox = [cb[0] + dbbP[0], cb[1] - dbbP[1], cb[2] - dbbP[2], cb[3] + dbbP[3]];
  73698. // 数据视图框
  73699. var dvb = this.dataViewBox;
  73700. //检查数据视图框是否合法
  73701. if (dvb[0] >= dvb[2] || dvb[1] <= dvb[3]) {
  73702. return false;
  73703. }
  73704. // 数据视图框原点
  73705. this.DVBOrigonPoint = [dvb[0], dvb[3]];
  73706. // 数据视图框宽度
  73707. this.DVBWidth = Math.abs(dvb[2] - dvb[0]);
  73708. // 数据视图框高度
  73709. this.DVBHeight = Math.abs(dvb[1] - dvb[3]);
  73710. // 数据视图框中心点
  73711. this.DVBCenterPoint = [this.DVBOrigonPoint[0] + this.DVBWidth / 2, this.DVBOrigonPoint[1] + this.DVBHeight / 2];
  73712. // 数据视图框原点与图表框的原点偏移量
  73713. this.origonPointOffset = [this.DVBOrigonPoint[0] - op[0], this.DVBOrigonPoint[1] - op[1]];
  73714. return isSuccess;
  73715. }
  73716. }
  73717. ;// CONCATENATED MODULE: ./src/common/overlay/Circle.js
  73718. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  73719. * This program are made available under the terms of the Apache License, Version 2.0
  73720. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73721. /**
  73722. * @class FeatureThemeCircle
  73723. * @aliasclass Feature.Theme.Circle
  73724. * @deprecatedclass SuperMap.Feature.Theme.Circle
  73725. * @classdesc 圆类。
  73726. * @category Visualization Theme
  73727. * @extends FeatureThemeRankSymbol
  73728. * @param {FeatureVector} data - 用户数据。
  73729. * @param {SuperMap.Layer.RankSymbol} layer - 此专题要素所在图层。
  73730. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  73731. * @param {FeatureThemeCircle.setting} setting - 图表配置对象。
  73732. * @param {LonLat} [lonlat] - 专题要素地理位置,默认为 data 指代的地理要素 Bounds 中心。
  73733. * @usage
  73734. * @private
  73735. */
  73736. class Circle extends RankSymbol {
  73737. constructor(data, layer, fields, setting, lonlat) {
  73738. super(data, layer, fields, setting, lonlat);
  73739. this.CLASS_NAME = "SuperMap.Feature.Theme.Circle";
  73740. }
  73741. /**
  73742. * @function FeatureThemeCircle.prototype.destroy
  73743. * @override
  73744. */
  73745. destroy() {
  73746. super.destroy();
  73747. }
  73748. /**
  73749. * @function FeatureThemeCircle.prototype.assembleShapes
  73750. * @description 装配图形(扩展接口)。
  73751. */
  73752. assembleShapes() {
  73753. //默认填充颜色
  73754. var defaultFillColor = "#ff9277";
  73755. // setting 属性是否已成功赋值
  73756. if (!this.setting) {
  73757. return false;
  73758. }
  73759. var sets = this.setting;
  73760. // 检测 setting 的必设参数
  73761. if (!(sets.codomain)) {
  73762. return false;
  73763. }
  73764. // 数据
  73765. var decimalNumber = (typeof(sets.decimalNumber) !== "undefined" && !isNaN(sets.decimalNumber)) ? sets.decimalNumber : -1;
  73766. var dataEffective = Theme_Theme.getDataValues(this.data, this.fields, decimalNumber);
  73767. this.dataValues = dataEffective ? dataEffective : [];
  73768. // 数据值数组
  73769. var fv = this.dataValues;
  73770. //if(fv.length != 1) return; // 没有数据 或者数据不唯一
  73771. //if(fv[0] < 0) return; //数据为负值
  73772. //用户应该定义最大 最小半径 默认最大半径MaxR:100 最小半径MinR:0;
  73773. if (!sets.maxR) {
  73774. sets.maxR = 100;
  73775. }
  73776. if (!sets.minR) {
  73777. sets.minR = 0;
  73778. }
  73779. // 值域范围
  73780. var codomain = this.DVBCodomain;
  73781. // 重要步骤:定义Circle数据视图框中单位值的含义,单位值:1所代表的长度
  73782. // 用户定义了值域范围
  73783. if (codomain && codomain[1] - codomain[0] > 0) {
  73784. this.DVBUnitValue = sets.maxR / (codomain[1] - codomain[0]);
  73785. } else {
  73786. //this.DVBUnitValue = sets.maxR / maxValue;
  73787. this.DVBUnitValue = sets.maxR;
  73788. }
  73789. var uv = this.DVBUnitValue;
  73790. //圆半径
  73791. var r = fv[0] * uv + sets.minR;
  73792. this.width = 2 * r;
  73793. this.height = 2 * r;
  73794. // 重要步骤:初始化参数
  73795. if (!this.initBaseParameter()) {
  73796. return;
  73797. }
  73798. //假如用户设置了值域范围 没有在值域范围直接返回
  73799. if (codomain) {
  73800. if (fv[0] < codomain[0] || fv[0] > codomain[1]) {
  73801. return;
  73802. }
  73803. }
  73804. var dvbCenter = this.DVBCenterPoint; // 数据视图框中心作为圆心
  73805. //圆形对象参数
  73806. var circleSP = new Circle_Circle(dvbCenter[0], dvbCenter[1], r);
  73807. //circleSP.sytle 初始化
  73808. circleSP.style = ShapeFactory.ShapeStyleTool(null, sets.circleStyle, null, null, 0);
  73809. //图形的填充颜色
  73810. if (typeof (sets.fillColor) !== "undefined") {
  73811. //用户自定义
  73812. circleSP.style.fillColor = sets.fillColor;
  73813. } else {
  73814. //当前默认
  73815. circleSP.style.fillColor = defaultFillColor;
  73816. }
  73817. //圆形 Hover样式
  73818. circleSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.circleHoverStyle);
  73819. //圆形 Hover 与 click 设置
  73820. if (typeof(sets.circleHoverAble) !== "undefined") {
  73821. circleSP.hoverable = sets.circleHoverAble;
  73822. }
  73823. if (typeof(sets.circleClickAble) !== "undefined") {
  73824. circleSP.clickable = sets.circleClickAble;
  73825. }
  73826. //图形携带的数据信息
  73827. circleSP.refDataID = this.data.id;
  73828. circleSP.dataInfo = {
  73829. field: this.fields[0],
  73830. r: r,
  73831. value: fv[0]
  73832. };
  73833. // 创建扇形并把此扇形添加到图表图形数组
  73834. this.shapes.push(this.shapeFactory.createShape(circleSP));
  73835. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  73836. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  73837. this.shapesConvertToRelativeCoordinate();
  73838. }
  73839. }
  73840. ;// CONCATENATED MODULE: ./src/common/overlay/Line.js
  73841. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  73842. * This program are made available under the terms of the Apache License, Version 2.0
  73843. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73844. /**
  73845. * @class FeatureThemeLine
  73846. * @aliasclass Feature.Theme.Line
  73847. * @deprecatedclass SuperMap.Feature.Theme.Line
  73848. * @classdesc 折线图。
  73849. * @category Visualization Theme
  73850. * @example
  73851. * // pointStyleByCodomain 参数用法示例
  73852. * // pointStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  73853. * // start: 值域值下限(包含);
  73854. * // end: 值域值上限(不包含);
  73855. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <Point.style> 。
  73856. * // pointStyleByCodomain 数组形如:
  73857. * [
  73858. * {
  73859. * start:0,
  73860. * end:250,
  73861. * style:{
  73862. * fillColor:"#00CD00"
  73863. * }
  73864. * },
  73865. * {
  73866. * start:250,
  73867. * end:500,
  73868. * style:{
  73869. * fillColor:"#00EE00"
  73870. * }
  73871. * },
  73872. * {
  73873. * start:500,
  73874. * end:750,
  73875. * style:{
  73876. * fillColor:"#00FF7F"
  73877. * }
  73878. * },
  73879. * {
  73880. * start:750,
  73881. * end:1500,
  73882. * style:{
  73883. * fillColor:"#00FF00"
  73884. * }
  73885. * }
  73886. * ]
  73887. *
  73888. * @extends FeatureThemeGraph
  73889. * @param {FeatureVector} data - 用户数据。
  73890. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  73891. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  73892. * @param {FeatureThemeLine.setting} setting - 图表配置对象。
  73893. * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  73894. * @usage
  73895. * @private
  73896. */
  73897. class Line extends Graph {
  73898. constructor(data, layer, fields, setting, lonlat, options) {
  73899. super(data, layer, fields, setting, lonlat, options);
  73900. this.CLASS_NAME = "SuperMap.Feature.Theme.Line";
  73901. }
  73902. /**
  73903. * @function FeatureThemeLine.prototype.destroy
  73904. * @override
  73905. */
  73906. destroy() {
  73907. super.destroy();
  73908. }
  73909. /**
  73910. * @function FeatureThemeLine.prototype.assembleShapes
  73911. * @description 装配图形(扩展接口)。
  73912. */
  73913. assembleShapes() {
  73914. // 图表配置对象
  73915. var sets = this.setting;
  73916. // 默认数据视图框
  73917. if (!sets.dataViewBoxParameter) {
  73918. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  73919. sets.dataViewBoxParameter = [45, 15, 15, 15];
  73920. } else {
  73921. sets.dataViewBoxParameter = [5, 5, 5, 5];
  73922. }
  73923. }
  73924. // 重要步骤:初始化参数
  73925. if (!this.initBaseParameter()) {
  73926. return;
  73927. }
  73928. var dvb = this.dataViewBox;
  73929. // 值域
  73930. var codomain = this.DVBCodomain;
  73931. // 重要步骤:定义图表 FeatureThemeBar 数据视图框中单位值的含义
  73932. this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
  73933. var uv = this.DVBUnitValue;
  73934. // 数据值数组
  73935. var fv = this.dataValues;
  73936. if (fv.length < 1) {
  73937. return;
  73938. } // 没有数据
  73939. // 获取 x 轴上的图形信息
  73940. var xShapeInfo = this.calculateXShapeInfo();
  73941. if (!xShapeInfo) {
  73942. return;
  73943. }
  73944. // 折线每个节点的 x 位置
  73945. var xsLoc = xShapeInfo.xPositions;
  73946. // 背景框,默认启用
  73947. if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
  73948. // 将背景框图形添加到模型的 shapes 数组,注意添加顺序,后添加的图形在先添加的图形之上。
  73949. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  73950. }
  73951. // 折线图必须使用坐标轴
  73952. this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
  73953. // var isDataEffective = true;
  73954. var xPx; // 折线节点 x 坐标
  73955. var yPx; // 折线节点 y 坐标
  73956. var poiLists = []; // 折线节点数组
  73957. var shapePois = []; // 折线节点图形数组
  73958. for (var i = 0, len = fv.length; i < len; i++) {
  73959. // 数据溢出值域检查
  73960. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  73961. // isDataEffective = false;
  73962. return null;
  73963. }
  73964. xPx = xsLoc[i];
  73965. yPx = dvb[1] - (fv[i] - codomain[0]) / uv;
  73966. // 折线节点参数对象
  73967. var poiSP = new Point_Point(xPx, yPx);
  73968. // 折线节点 style
  73969. poiSP.style = ShapeFactory.ShapeStyleTool({fillColor: "#ee9900"}, sets.pointStyle, sets.pointStyleByFields, sets.pointStyleByCodomain, i, fv[i]);
  73970. // 折线节点 hover 样式
  73971. poiSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.pointHoverStyle);
  73972. // 折线节点 hover click
  73973. if (typeof(sets.pointHoverAble) !== "undefined") {
  73974. poiSP.hoverable = sets.pointHoverAble;
  73975. }
  73976. if (typeof(sets.pointClickAble) !== "undefined") {
  73977. poiSP.clickable = sets.pointClickAble;
  73978. }
  73979. // 图形携带的数据信息
  73980. poiSP.refDataID = this.data.id;
  73981. poiSP.dataInfo = {
  73982. field: this.fields[i],
  73983. value: fv[i]
  73984. };
  73985. // 创建图形并把此图形添加到折线节点图形数组
  73986. shapePois.push(this.shapeFactory.createShape(poiSP));
  73987. // 添加折线节点到折线节点数组
  73988. var poi = [xPx, yPx];
  73989. poiLists.push(poi);
  73990. }
  73991. // 折线参数对象
  73992. var lineSP = new Line_Line(poiLists);
  73993. lineSP.style = ShapeFactory.ShapeStyleTool({strokeColor: "#ee9900"}, sets.lineStyle);
  73994. // 禁止事件响应
  73995. lineSP.clickable = false;
  73996. lineSP.hoverable = false;
  73997. var shapeLine = this.shapeFactory.createShape(lineSP);
  73998. this.shapes.push(shapeLine);
  73999. // 添加节点到图表图形数组
  74000. this.shapes = this.shapes.concat(shapePois);
  74001. // // 数据范围检测未通过,清空图形
  74002. // if (isDataEffective === false) {
  74003. // this.shapes = [];
  74004. // }
  74005. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  74006. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  74007. this.shapesConvertToRelativeCoordinate();
  74008. }
  74009. /**
  74010. * @function FeatureThemeLine.prototype.calculateXShapeInfo
  74011. * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
  74012. * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
  74013. * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  74014. * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  74015. * 本函数中图形配置对象 setting 可设属性:<br>
  74016. * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
  74017. * 长度为 2 的数组,第一元素表示第折线左端点与数据视图框左端的空白间距,第二个元素表示折线右端点右端与数据视图框右端端的空白间距 。
  74018. * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:<br>
  74019. * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。<br>
  74020. * width - {number} 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  74021. */
  74022. calculateXShapeInfo() {
  74023. var dvb = this.dataViewBox; // 数据视图框
  74024. var sets = this.setting; // 图表配置对象
  74025. var fvc = this.dataValues.length; // 数组值个数
  74026. if (fvc < 1) {
  74027. return null;
  74028. }
  74029. var xBlank; // x 轴空白间隔参数
  74030. var xShapePositions = []; // x 轴上图形的位置
  74031. var xShapeWidth = 0; // x 轴上图形宽度(自适应)
  74032. var dvbWidth = this.DVBWidth; // 数据视图框宽度
  74033. var unitOffset = 0; // 单位偏移量
  74034. // x 轴空白间隔参数处理
  74035. if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 2) {
  74036. xBlank = sets.xShapeBlank;
  74037. var xsLen = dvbWidth - (xBlank[0] + xBlank[1]);
  74038. if (xsLen <= fvc) {
  74039. return null;
  74040. }
  74041. unitOffset = xsLen / (fvc - 1);
  74042. } else {
  74043. // 默认使用等距离空白间隔,空白间隔为图形宽度
  74044. unitOffset = dvbWidth / (fvc + 1);
  74045. xBlank = [unitOffset, unitOffset, unitOffset];
  74046. }
  74047. // 图形 x 轴上的位置计算
  74048. var xOffset = 0
  74049. for (var i = 0; i < fvc; i++) {
  74050. if (i == 0) {
  74051. xOffset = xBlank[0];
  74052. } else {
  74053. xOffset += unitOffset;
  74054. }
  74055. xShapePositions.push(dvb[0] + xOffset);
  74056. }
  74057. return {
  74058. "xPositions": xShapePositions,
  74059. "width": xShapeWidth
  74060. };
  74061. }
  74062. }
  74063. ;// CONCATENATED MODULE: ./src/common/overlay/Pie.js
  74064. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  74065. * This program are made available under the terms of the Apache License, Version 2.0
  74066. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74067. /**
  74068. * @class FeatureThemePie
  74069. * @aliasclass Feature.Theme.Pie
  74070. * @deprecatedclass SuperMap.Feature.Theme.Pie
  74071. * @classdesc 饼图。
  74072. * @category Visualization Theme
  74073. * @param {FeatureVector} data - 用户数据。
  74074. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  74075. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  74076. * @param {FeatureThemePoint.setting} setting - 图表配置对象。
  74077. * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  74078. * @extends FeatureThemeGraph
  74079. * @example
  74080. * // sectorStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  74081. * // start: 值域值下限(包含);
  74082. * // end: 值域值上限(不包含);
  74083. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <ShapeParametersSector.style> 。
  74084. * // sectorStyleByCodomain 数组形如:
  74085. * [
  74086. * {
  74087. * start:0,
  74088. * end:250,
  74089. * style:{
  74090. * fillColor:"#00CD00"
  74091. * }
  74092. * },
  74093. * {
  74094. * start:250,
  74095. * end:500,
  74096. * style:{
  74097. * fillColor:"#00EE00"
  74098. * }
  74099. * },
  74100. * {
  74101. * start:500,
  74102. * end:750,
  74103. * style:{
  74104. * fillColor:"#00FF7F"
  74105. * }
  74106. * },
  74107. * {
  74108. * start:750,
  74109. * end:1500,
  74110. * style:{
  74111. * fillColor:"#00FF00"
  74112. * }
  74113. * }
  74114. * ]
  74115. * @usage
  74116. * @private
  74117. */
  74118. class Pie extends Graph {
  74119. constructor(data, layer, fields, setting, lonlat) {
  74120. super(data, layer, fields, setting, lonlat);
  74121. this.CLASS_NAME = "SuperMap.Feature.Theme.Pie";
  74122. }
  74123. /**
  74124. * @function FeatureThemePie.prototype.destroy
  74125. * @description 销毁此专题要素。调用 destroy 后此对象所以属性置为 null。
  74126. */
  74127. destroy() {
  74128. super.destroy();
  74129. }
  74130. /**
  74131. * @function FeatureThemePie.prototype.assembleShapes
  74132. * @description 装配图形(扩展接口)。
  74133. */
  74134. assembleShapes() {
  74135. // 图表配置对象
  74136. var sets = this.setting;
  74137. // 一个默认 style 组
  74138. var defaultStyleGroup = [
  74139. {fillColor: "#ff9277"}, {fillColor: "#dddd00"}, {fillColor: "#ffc877"}, {fillColor: "#bbe3ff"}, {fillColor: "#d5ffbb"},
  74140. {fillColor: "#bbbbff"}, {fillColor: "#ddb000"}, {fillColor: "#b0dd00"}, {fillColor: "#e2bbff"}, {fillColor: "#ffbbe3"},
  74141. {fillColor: "#ff7777"}, {fillColor: "#ff9900"}, {fillColor: "#83dd00"}, {fillColor: "#77e3ff"}, {fillColor: "#778fff"},
  74142. {fillColor: "#c877ff"}, {fillColor: "#ff77ab"}, {fillColor: "#ff6600"}, {fillColor: "#aa8800"}, {fillColor: "#77c7ff"},
  74143. {fillColor: "#ad77ff"}, {fillColor: "#ff77ff"}, {fillColor: "#dd0083"}, {fillColor: "#777700"}, {fillColor: "#00aa00"},
  74144. {fillColor: "#0088aa"}, {fillColor: "#8400dd"}, {fillColor: "#aa0088"}, {fillColor: "#dd0000"}, {fillColor: "#772e00"}
  74145. ];
  74146. // 重要步骤:初始化参数
  74147. if (!this.initBaseParameter()) {
  74148. return;
  74149. }
  74150. // 背景框,默认不启用
  74151. if (sets.useBackground) {
  74152. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  74153. }
  74154. // 数据值数组
  74155. var fv = this.dataValues;
  74156. if (fv.length < 1) {
  74157. return;
  74158. } // 没有数据
  74159. // 值域范围
  74160. var codomain = this.DVBCodomain;
  74161. // 值域范围检测
  74162. for (let i = 0; i < fv.length; i++) {
  74163. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  74164. return;
  74165. }
  74166. }
  74167. // 值的绝对值总和
  74168. var valueSum = 0;
  74169. for (let i = 0; i < fv.length; i++) {
  74170. valueSum += Math.abs(fv[i]);
  74171. }
  74172. // 重要步骤:定义图表 FeatureThemePie 数据视图框中单位值的含义,单位值:每度代表的数值
  74173. this.DVBUnitValue = 360 / valueSum;
  74174. var uv = this.DVBUnitValue;
  74175. var dvbCenter = this.DVBCenterPoint; // 数据视图框中心作为扇心
  74176. var startAngle = 0; // 扇形起始边角度
  74177. var endAngle = 0; // 扇形终止边角度
  74178. var startAngleTmp = startAngle; // 扇形临时起始边角度
  74179. // 扇形(自适应)半径
  74180. var r = this.DVBHeight < this.DVBWidth ? this.DVBHeight / 2 : this.DVBWidth / 2;
  74181. for (var i = 0; i < fv.length; i++) {
  74182. var fvi = Math.abs(fv[i]);
  74183. //计算终止角
  74184. if (i === 0) {
  74185. endAngle = startAngle + fvi * uv;
  74186. } else if (i === fvi.length - 1) {
  74187. endAngle = startAngleTmp;
  74188. } else {
  74189. endAngle = startAngle + fvi * uv;
  74190. }
  74191. //矫正误差计算
  74192. if ((endAngle - startAngle) >= 360) {
  74193. endAngle = 359.9999999;
  74194. }
  74195. // 扇形参数对象
  74196. var sectorSP = new Sector(dvbCenter[0], dvbCenter[1], r, startAngle, endAngle);
  74197. // 扇形样式
  74198. if (typeof(sets.sectorStyleByFields) === "undefined") {
  74199. // 使用默认 style 组
  74200. var colorIndex = i % defaultStyleGroup.length;
  74201. sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, defaultStyleGroup, null, colorIndex);
  74202. } else {
  74203. sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, sets.sectorStyleByFields, sets.sectorStyleByCodomain, i, fv[i]);
  74204. }
  74205. // 扇形 hover 样式
  74206. sectorSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.sectorHoverStyle);
  74207. // 扇形 hover 与 click 设置
  74208. if (typeof(sets.sectorHoverAble) !== "undefined") {
  74209. sectorSP.hoverable = sets.sectorHoverAble;
  74210. }
  74211. if (typeof(sets.sectorClickAble) !== "undefined") {
  74212. sectorSP.clickable = sets.sectorClickAble;
  74213. }
  74214. // 图形携带的数据信息
  74215. sectorSP.refDataID = this.data.id;
  74216. sectorSP.dataInfo = {
  74217. field: this.fields[i],
  74218. value: fv[i]
  74219. };
  74220. // 创建扇形并把此扇形添加到图表图形数组
  74221. this.shapes.push(this.shapeFactory.createShape(sectorSP));
  74222. // 把上一次的结束角度作为下一次的起始角度
  74223. startAngle = endAngle;
  74224. }
  74225. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  74226. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  74227. this.shapesConvertToRelativeCoordinate();
  74228. }
  74229. }
  74230. ;// CONCATENATED MODULE: ./src/common/overlay/Point.js
  74231. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  74232. * This program are made available under the terms of the Apache License, Version 2.0
  74233. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74234. /**
  74235. * @class FeatureThemePoint
  74236. * @aliasclass Feature.Theme.Point
  74237. * @deprecatedclass SuperMap.Feature.Theme.Point
  74238. * @classdesc 点状图。
  74239. * @category Visualization Theme
  74240. * @param {FeatureVector} data - 用户数据。
  74241. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  74242. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  74243. * @param {FeatureThemePoint.setting} setting - 图表配置对象。
  74244. * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  74245. * @example
  74246. * // pointStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  74247. * // start: 值域值下限(包含);
  74248. * // end: 值域值上限(不包含);
  74249. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <Point.style> 。
  74250. * // pointStyleByCodomain 数组形如:
  74251. * [
  74252. * {
  74253. * start:0,
  74254. * end:250,
  74255. * style:{
  74256. * fillColor:"#00CD00"
  74257. * }
  74258. * },
  74259. * {
  74260. * start:250,
  74261. * end:500,
  74262. * style:{
  74263. * fillColor:"#00EE00"
  74264. * }
  74265. * },
  74266. * {
  74267. * start:500,
  74268. * end:750,
  74269. * style:{
  74270. * fillColor:"#00FF7F"
  74271. * }
  74272. * },
  74273. * {
  74274. * start:750,
  74275. * end:1500,
  74276. * style:{
  74277. * fillColor:"#00FF00"
  74278. * }
  74279. * }
  74280. * ]
  74281. * @extends FeatureThemeGraph
  74282. * @usage
  74283. * @private
  74284. */
  74285. class overlay_Point_Point extends Graph {
  74286. constructor(data, layer, fields, setting, lonlat, options) {
  74287. super(data, layer, fields, setting, lonlat, options);
  74288. this.CLASS_NAME = "SuperMap.Feature.Theme.Point";
  74289. }
  74290. /**
  74291. * @function FeatureThemePoint.prototype.destroy
  74292. * @description 销毁此专题要素。调用 destroy 后此对象所以属性置为 null。
  74293. */
  74294. destroy() {
  74295. super.destroy();
  74296. }
  74297. /**
  74298. * @function FeatureThemePoint.prototype.Point.assembleShapes
  74299. * @description 装配图形(扩展接口)。
  74300. */
  74301. assembleShapes() {
  74302. // 图表配置对象
  74303. var sets = this.setting;
  74304. // 默认数据视图框
  74305. if (!sets.dataViewBoxParameter) {
  74306. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  74307. sets.dataViewBoxParameter = [45, 15, 15, 15];
  74308. } else {
  74309. sets.dataViewBoxParameter = [5, 5, 5, 5];
  74310. }
  74311. }
  74312. // 重要步骤:初始化参数
  74313. if (!this.initBaseParameter()) {
  74314. return;
  74315. }
  74316. var dvb = this.dataViewBox;
  74317. // 值域
  74318. var codomain = this.DVBCodomain;
  74319. // 重要步骤:定义图表 FeatureThemeBar 数据视图框中单位值的含义
  74320. this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
  74321. var uv = this.DVBUnitValue;
  74322. var fv = this.dataValues;
  74323. // 获取 x 轴上的图形信息
  74324. var xShapeInfo = this.calculateXShapeInfo();
  74325. if (!xShapeInfo) {
  74326. return;
  74327. }
  74328. // 折线每个节点的 x 位置
  74329. var xsLoc = xShapeInfo.xPositions;
  74330. // 背景框,默认启用
  74331. if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
  74332. // 将背景框图形添加到模型的 shapes 数组,注意添加顺序,后添加的图形在先添加的图形之上。
  74333. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  74334. }
  74335. // 点状图必须使用坐标轴
  74336. this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
  74337. var xPx; // 图形点 x 坐标
  74338. var yPx; // 图形点 y 坐标
  74339. for (var i = 0, len = fv.length; i < len; i++) {
  74340. // 数据溢出值域检查
  74341. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  74342. //isDataEffective = false;
  74343. return null;
  74344. }
  74345. xPx = xsLoc[i];
  74346. yPx = dvb[1] - (fv[i] - codomain[0]) / uv;
  74347. // 图形点参数对象
  74348. var poiSP = new Point_Point(xPx, yPx);
  74349. // 图形点 style
  74350. poiSP.style = ShapeFactory.ShapeStyleTool({fillColor: "#ee9900"}, sets.pointStyle, sets.pointStyleByFields, sets.pointStyleByCodomain, i, fv[i]);
  74351. // 图形点 hover 样式
  74352. poiSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.pointHoverStyle);
  74353. // 图形点 hover click
  74354. if (typeof(sets.pointHoverAble) !== "undefined") {
  74355. poiSP.hoverable = sets.pointHoverAble;
  74356. }
  74357. if (typeof(sets.pointClickAble) !== "undefined") {
  74358. poiSP.clickable = sets.pointClickAble;
  74359. }
  74360. // 图形携带的数据信息
  74361. poiSP.refDataID = this.data.id;
  74362. poiSP.dataInfo = {
  74363. field: this.fields[i],
  74364. value: fv[i]
  74365. };
  74366. // 创建图形点并把此图形添加到图表图形数组
  74367. this.shapes.push(this.shapeFactory.createShape(poiSP));
  74368. }
  74369. // 数据范围检测未通过,清空图形
  74370. // if (isDataEffective === false) {
  74371. // this.shapes = [];
  74372. // }
  74373. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  74374. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  74375. this.shapesConvertToRelativeCoordinate();
  74376. }
  74377. /**
  74378. * @function FeatureThemePoint.prototype.calculateXShapeInfo
  74379. * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
  74380. * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
  74381. * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  74382. * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  74383. * 本函数中图形配置对象 setting 可设属性:<br>
  74384. * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
  74385. * 长度为 2 的数组,第一元素表示第折线左端点与数据视图框左端的空白间距,第二个元素表示折线右端点右端与数据视图框右端端的空白间距 。
  74386. * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:<br>
  74387. * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  74388. * width - {number}表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  74389. */
  74390. calculateXShapeInfo() {
  74391. var dvb = this.dataViewBox; // 数据视图框
  74392. var sets = this.setting; // 图表配置对象
  74393. var fvc = this.dataValues.length; // 数组值个数
  74394. if (fvc < 1) {
  74395. return null;
  74396. }
  74397. var xBlank; // x 轴空白间隔参数
  74398. var xShapePositions = []; // x 轴上图形的位置
  74399. var xShapeWidth = 0; // x 轴上图形宽度(自适应)
  74400. var dvbWidth = this.DVBWidth; // 数据视图框宽度
  74401. var unitOffset = 0; // 单位偏移量
  74402. // x 轴空白间隔参数处理
  74403. if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 2) {
  74404. xBlank = sets.xShapeBlank;
  74405. var xsLen = dvbWidth - (xBlank[0] + xBlank[1]);
  74406. if (xsLen <= fvc) {
  74407. return null;
  74408. }
  74409. unitOffset = xsLen / (fvc - 1);
  74410. } else {
  74411. // 默认使用等距离空白间隔,空白间隔为图形宽度
  74412. unitOffset = dvbWidth / (fvc + 1);
  74413. xBlank = [unitOffset, unitOffset, unitOffset];
  74414. }
  74415. // 图形 x 轴上的位置计算
  74416. var xOffset = 0
  74417. for (var i = 0; i < fvc; i++) {
  74418. if (i == 0) {
  74419. xOffset = xBlank[0];
  74420. } else {
  74421. xOffset += unitOffset;
  74422. }
  74423. xShapePositions.push(dvb[0] + xOffset);
  74424. }
  74425. return {
  74426. "xPositions": xShapePositions,
  74427. "width": xShapeWidth
  74428. };
  74429. }
  74430. }
  74431. ;// CONCATENATED MODULE: ./src/common/overlay/Ring.js
  74432. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  74433. * This program are made available under the terms of the Apache License, Version 2.0
  74434. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74435. /**
  74436. * @class FeatureThemeRing
  74437. * @aliasclass Feature.Theme.Ring
  74438. * @deprecatedclass SuperMap.Feature.Theme.Ring
  74439. * @classdesc 环状图。
  74440. * @category Visualization Theme
  74441. * @description 基于路由对象计算指定点 M 值操作的参数类。通过该类提供参数信息。
  74442. * @param {FeatureVector} data - 用户数据。
  74443. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  74444. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  74445. * @param {FeatureThemeRing.setting} setting - 图表配置对象。
  74446. * @param {LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  74447. * @example
  74448. * // sectorStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  74449. * // start: 值域值下限(包含);
  74450. * // end: 值域值上限(不包含);
  74451. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <ShapeParametersSector.style> 。
  74452. * // sectorStyleByCodomain 数组形如:
  74453. * [
  74454. * {
  74455. * start:0,
  74456. * end:250,
  74457. * style:{
  74458. * fillColor:"#00CD00"
  74459. * }
  74460. * },
  74461. * {
  74462. * start:250,
  74463. * end:500,
  74464. * style:{
  74465. * fillColor:"#00EE00"
  74466. * }
  74467. * },
  74468. * {
  74469. * start:500,
  74470. * end:750,
  74471. * style:{
  74472. * fillColor:"#00FF7F"
  74473. * }
  74474. * },
  74475. * {
  74476. * start:750,
  74477. * end:1500,
  74478. * style:{
  74479. * fillColor:"#00FF00"
  74480. * }
  74481. * }
  74482. * ]
  74483. * @param {Object} [sectorHoverStyle=true] - 环状图扇形 hover 状态时的样式,sectorHoverAble 为 true 时有效。
  74484. * @param {boolean} [sectorHoverAble=true] - 是否允许环状图扇形使用 hover 状态。同时设置 sectorHoverAble 和 sectorClickAble 为 false,可以直接屏蔽环状图扇形对专题图层事件的响应。
  74485. * @param {boolean} [sectorClickAble=true] - 是否允许环状图扇形被点击。同时设置 sectorHoverAble 和 sectorClickAble 为 false,可以直接屏蔽环状图扇形对专题图层事件的响应。
  74486. *
  74487. * @extends FeatureThemeGraph
  74488. * @usage
  74489. * @private
  74490. */
  74491. class Ring extends Graph {
  74492. constructor(data, layer, fields, setting, lonlat) {
  74493. super(data, layer, fields, setting, lonlat);
  74494. this.CLASS_NAME = "SuperMap.Feature.Theme.Ring";
  74495. }
  74496. /**
  74497. * @function FeatureThemeRing.prototype.destroy
  74498. * @description 销毁此专题要素。调用 destroy 后此对象所以属性置为 null。
  74499. */
  74500. destroy() {
  74501. super.destroy();
  74502. }
  74503. /**
  74504. * @function FeatureThemeRing.prototype.assembleShapes
  74505. * @description 装配图形(扩展接口)。
  74506. */
  74507. assembleShapes() {
  74508. // 重要步骤:初始化参数
  74509. if (!this.initBaseParameter()) {
  74510. return;
  74511. }
  74512. // 一个默认 style 组
  74513. var defaultStyleGroup = [
  74514. {fillColor: "#ff9277"}, {fillColor: "#dddd00"}, {fillColor: "#ffc877"}, {fillColor: "#bbe3ff"}, {fillColor: "#d5ffbb"},
  74515. {fillColor: "#bbbbff"}, {fillColor: "#ddb000"}, {fillColor: "#b0dd00"}, {fillColor: "#e2bbff"}, {fillColor: "#ffbbe3"},
  74516. {fillColor: "#ff7777"}, {fillColor: "#ff9900"}, {fillColor: "#83dd00"}, {fillColor: "#77e3ff"}, {fillColor: "#778fff"},
  74517. {fillColor: "#c877ff"}, {fillColor: "#ff77ab"}, {fillColor: "#ff6600"}, {fillColor: "#aa8800"}, {fillColor: "#77c7ff"},
  74518. {fillColor: "#ad77ff"}, {fillColor: "#ff77ff"}, {fillColor: "#dd0083"}, {fillColor: "#777700"}, {fillColor: "#00aa00"},
  74519. {fillColor: "#0088aa"}, {fillColor: "#8400dd"}, {fillColor: "#aa0088"}, {fillColor: "#dd0000"}, {fillColor: "#772e00"}
  74520. ];
  74521. // 图表配置对象
  74522. var sets = this.setting;
  74523. // 背景框,默认不启用
  74524. if (sets.useBackground) {
  74525. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  74526. }
  74527. // 数据值数组
  74528. var fv = this.dataValues;
  74529. if (fv.length < 1) {
  74530. return;
  74531. } // 没有数据
  74532. // 值域范围
  74533. var codomain = this.DVBCodomain;
  74534. // 值域范围检测
  74535. for (let i = 0; i < fv.length; i++) {
  74536. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  74537. return;
  74538. }
  74539. }
  74540. // 值的绝对值总和
  74541. var valueSum = 0;
  74542. for (let i = 0; i < fv.length; i++) {
  74543. valueSum += Math.abs(fv[i]);
  74544. }
  74545. // 重要步骤:定义图表 FeatureThemeRing 数据视图框中单位值的含义,单位值:每度代表的数值
  74546. this.DVBUnitValue = 360 / valueSum;
  74547. var uv = this.DVBUnitValue;
  74548. var dvbCenter = this.DVBCenterPoint; // 数据视图框中心作为扇心
  74549. var startAngle = 0; // 扇形起始边角度
  74550. var endAngle = 0; // 扇形终止边角度
  74551. var startAngleTmp = startAngle; // 扇形临时起始边角度
  74552. // 扇形外环(自适应)半径
  74553. var r = this.DVBHeight < this.DVBWidth ? this.DVBHeight / 2 : this.DVBWidth / 2;
  74554. // 扇形内环(自适应)半径
  74555. var isInRange = sets.innerRingRadius >= 0 && sets.innerRingRadius < r;
  74556. var r0 = (
  74557. typeof(sets.innerRingRadius) !== "undefined"
  74558. && !isNaN(sets.innerRingRadius)
  74559. && isInRange
  74560. ) ? sets.innerRingRadius : 0;
  74561. for (var i = 0; i < fv.length; i++) {
  74562. var fvi = Math.abs(fv[i]);
  74563. // 计算结束角度
  74564. if (i === 0) {
  74565. endAngle = startAngle + fvi * uv;
  74566. } else if (i === fvi.length - 1) {
  74567. endAngle = startAngleTmp;
  74568. } else {
  74569. endAngle = startAngle + fvi * uv;
  74570. }
  74571. // 扇形参数对象
  74572. var sectorSP = new Sector(dvbCenter[0], dvbCenter[1], r, startAngle, endAngle, r0);
  74573. // 扇形样式
  74574. if (typeof(sets.sectorStyleByFields) === "undefined") {
  74575. // 使用默认 style 组
  74576. var colorIndex = i % defaultStyleGroup.length;
  74577. sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, defaultStyleGroup, null, colorIndex);
  74578. } else {
  74579. sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, sets.sectorStyleByFields, sets.sectorStyleByCodomain, i, fv[i]);
  74580. }
  74581. // 扇形 hover 样式
  74582. sectorSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.sectorHoverStyle);
  74583. // 扇形 hover 与 click 设置
  74584. if (typeof(sets.sectorHoverAble) !== "undefined") {
  74585. sectorSP.hoverable = sets.sectorHoverAble;
  74586. }
  74587. if (typeof(sets.sectorClickAble) !== "undefined") {
  74588. sectorSP.clickable = sets.sectorClickAble;
  74589. }
  74590. // 图形携带的数据信息
  74591. sectorSP.refDataID = this.data.id;
  74592. sectorSP.dataInfo = {
  74593. field: this.fields[i],
  74594. value: fv[i]
  74595. };
  74596. // 创建扇形并把此扇形添加到图表图形数组
  74597. this.shapes.push(this.shapeFactory.createShape(sectorSP));
  74598. // 把上一次的结束角度作为下一次的起始角度
  74599. startAngle = endAngle;
  74600. }
  74601. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  74602. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  74603. this.shapesConvertToRelativeCoordinate();
  74604. }
  74605. }
  74606. ;// CONCATENATED MODULE: ./src/common/overlay/ThemeVector.js
  74607. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  74608. * This program are made available under the terms of the Apache License, Version 2.0
  74609. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74610. /**
  74611. * @class FeatureThemeVector
  74612. * @aliasclass Feature.Theme.ThemeVector
  74613. * @deprecatedclass SuperMap.Feature.Theme.ThemeVector
  74614. * @classdesc 矢量专题要素类。
  74615. * @category Visualization Theme
  74616. * @extends FeatureTheme
  74617. * @param {FeatureVector} data - 用户数据,的类型为矢量数据 feature。
  74618. * @param {SuperMap.Layer} layer - 此专题要素所在图层。
  74619. * @param {Object} style - 样式。
  74620. * @param {Object} options - 创建专题要素时的可选参数。
  74621. * @param {number} [options.nodesClipPixel=2] - 节点抽稀像素距离,单位:像素。
  74622. * @param {boolean} [options.isHoverAble=true] - 图形是否可 hover。
  74623. * @param {boolean} [options.isMultiHover=true] - 是否使用多图形高亮,isHoverAble 为 true 时生效。
  74624. * @param {boolean} [options.isClickAble=true] - 图形是否可点击。
  74625. * @param {Object} [options.highlightStyle] - 高亮样式。
  74626. * @usage
  74627. */
  74628. class ThemeVector extends Theme_Theme {
  74629. constructor(data, layer, style, options, shapeOptions) {
  74630. super(data, layer);
  74631. //数据的 geometry 属性必须存在且类型是 Geometry 或其子类的类型
  74632. if (!data.geometry) {
  74633. return;
  74634. }
  74635. if (!(data.geometry instanceof Geometry_Geometry)) {
  74636. return;
  74637. }
  74638. /**
  74639. * @member {Bounds} [FeatureThemeVector.prototype.dataBounds]
  74640. * @description 用户数据的(feature.geometry)地理范围。
  74641. */
  74642. this.dataBounds = data.geometry.getBounds();
  74643. /**
  74644. * @member {number} [FeatureThemeVector.prototype.nodesClipPixel=2]
  74645. * @description 节点抽稀像素距离。
  74646. */
  74647. this.nodesClipPixel = 2;
  74648. /**
  74649. * @member {boolean} [FeatureThemeVector.prototype.isHoverAble=true]
  74650. * @description 图形是否可 hover。
  74651. */
  74652. this.isHoverAble = true;
  74653. /**
  74654. * @member {boolean} [FeatureThemeVector.prototype.isMultiHover=true]
  74655. * @description 是否使用多图形高亮,isHoverAble 为 true 时生效。
  74656. */
  74657. this.isMultiHover = true;
  74658. /**
  74659. * @member {boolean} [FeatureThemeVector.prototype.isClickAble=true]
  74660. * @description 图形是否可点击。
  74661. */
  74662. this.isClickAble = true;
  74663. /**
  74664. * @member {Object} [FeatureThemeVector.prototype.highlightStyle]
  74665. * @description 高亮样式。
  74666. */
  74667. this.highlightStyle = null;
  74668. /**
  74669. * @member {Object} [FeatureThemeVector.prototype.shapeOptions]
  74670. * @description 添加到渲染器前修改 shape 的一些属性,非特殊情况通常不允许这么做。
  74671. */
  74672. this.shapeOptions = {};
  74673. /**
  74674. * @member {Object} [FeatureThemeVector.prototype.style]
  74675. * @description 可视化图形的 style。在子类中规定其对象结构和默认属性值。
  74676. */
  74677. this.style = style || {};
  74678. this.CLASS_NAME = "SuperMap.Feature.Theme.Vector";
  74679. this.style = style ? style : {};
  74680. if (options) {
  74681. Util_Util.copyAttributesWithClip(this, options, ["shapeOptions", "dataBounds"])
  74682. }
  74683. if (shapeOptions) {
  74684. Util_Util.copyAttributesWithClip(this.shapeOptions, shapeOptions);
  74685. }
  74686. //设置基础参数 dataBounds、lonlat、location
  74687. var geometry = data.geometry;
  74688. this.lonlat = this.dataBounds.getCenterLonLat();
  74689. this.location = this.getLocalXY(this.lonlat);
  74690. //将地理要素转为专题要素
  74691. if (geometry instanceof LinearRing_LinearRing) {
  74692. this.lineToTF(geometry);
  74693. } else if (geometry instanceof LineString) {
  74694. this.lineToTF(geometry);
  74695. } else if (geometry instanceof Curve) {
  74696. //独立几何体
  74697. } else if (geometry instanceof MultiPoint) {
  74698. this.multiPointToTF(geometry);
  74699. } else if (geometry instanceof MultiLineString) {
  74700. this.multiLineStringToTF(geometry);
  74701. } else if (geometry instanceof MultiPolygon) {
  74702. this.multiPolygonToTF(geometry);
  74703. } else if (geometry instanceof Polygon_Polygon) {
  74704. this.polygonToTF(geometry);
  74705. } else if (geometry instanceof Collection) {
  74706. //独立几何体
  74707. } else if (geometry instanceof Point) {
  74708. this.pointToTF(geometry);
  74709. } else if (geometry instanceof Rectangle) {
  74710. this.rectangleToTF(geometry);
  74711. } else if (geometry instanceof GeoText) {
  74712. this.geoTextToTF(geometry);
  74713. }
  74714. }
  74715. /**
  74716. * @function FeatureThemeVector.prototype.destroy
  74717. * @override
  74718. */
  74719. destroy() {
  74720. this.style = null;
  74721. this.dataBounds = null;
  74722. this.nodesClipPixel = null;
  74723. this.isHoverAble = null;
  74724. this.isMultiHover = null;
  74725. this.isClickAble = null;
  74726. this.highlightStyle = null;
  74727. this.shapeOptions = null;
  74728. super.destroy();
  74729. }
  74730. /**
  74731. * @function FeatureThemeVector.prototype.lineToTF
  74732. * @description 转换线和线环要素。
  74733. * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 GeometryLineString 或 GeometryLineRing。
  74734. */
  74735. lineToTF(geometry) {
  74736. var components = geometry.components;
  74737. //节点像素坐标
  74738. var localLX = [];
  74739. //参考位置,参考中心为
  74740. var refLocal = [];
  74741. var location = this.location;
  74742. var pointList = [];
  74743. //节点抽稀距离
  74744. var nCPx = this.nodesClipPixel;
  74745. for (var i = 0; i < components.length; i++) {
  74746. var components_i = components[i];
  74747. refLocal = [];
  74748. localLX = this.getLocalXY(components_i);
  74749. refLocal[0] = localLX[0] - location[0];
  74750. refLocal[1] = localLX[1] - location[1];
  74751. //抽稀 - 2 px
  74752. if (pointList.length > 0) {
  74753. var lastLocalXY = pointList[pointList.length - 1];
  74754. if ((Math.abs(lastLocalXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastLocalXY[1] - refLocal[1]) <= nCPx)) {
  74755. continue;
  74756. }
  74757. }
  74758. //使用参考点
  74759. pointList.push(refLocal);
  74760. }
  74761. if (pointList.length < 2) {
  74762. return null;
  74763. }
  74764. //赋 style
  74765. var style = new Object();
  74766. style = Util_Util.copyAttributesWithClip(style, this.style, ['pointList']);
  74767. style.pointList = pointList;
  74768. //创建图形
  74769. var shape = new SmicBrokenLine({
  74770. style: style,
  74771. clickable: this.isClickAble,
  74772. hoverable: this.isHoverAble
  74773. });
  74774. //设置高亮样式
  74775. if (this.highlightStyle) {
  74776. shape.highlightStyle = this.highlightStyle;
  74777. }
  74778. //设置参考中心,指定图形位置
  74779. shape.refOriginalPosition = this.location;
  74780. //储存数据 id 属性,用于事件
  74781. shape.refDataID = this.data.id;
  74782. //储存数据 id 属性,用于事件-多图形同时高亮
  74783. shape.isHoverByRefDataID = this.isMultiHover;
  74784. //添加到渲染器前修改 shape 的一些属性,非特殊情况通常不允许这么做
  74785. if (this.shapeOptions) {
  74786. Util_Util.copyAttributesWithClip(shape, this.shapeOptions);
  74787. }
  74788. this.shapes.push(shape);
  74789. }
  74790. /**
  74791. * @function FeatureThemeVector.prototype.multiPointToTF
  74792. * @description 转多点要素。
  74793. * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 MultiPoint。
  74794. */
  74795. multiPointToTF(geometry) {
  74796. /* //-- 不抽稀
  74797. var components = geometry.components;
  74798. for(var i = 0; i < components.length; i++){
  74799. var components_i = components[i];
  74800. this.pointToTF(components_i);
  74801. }
  74802. */
  74803. var components = geometry.components;
  74804. //节点像素坐标
  74805. var localLX = [];
  74806. //参考位置,参考中心为
  74807. var refLocal = [];
  74808. var location = this.location;
  74809. var pointList = [];
  74810. //节点抽稀距离
  74811. var nCPx = this.nodesClipPixel;
  74812. for (var i = 0; i < components.length; i++) {
  74813. var components_i = components[i];
  74814. refLocal = [];
  74815. localLX = this.getLocalXY(components_i);
  74816. refLocal[0] = localLX[0] - location[0];
  74817. refLocal[1] = localLX[1] - location[1];
  74818. //抽稀
  74819. if (pointList.length > 0) {
  74820. var lastLocalXY = pointList[pointList.length - 1];
  74821. if ((Math.abs(lastLocalXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastLocalXY[1] - refLocal[1]) <= nCPx)) {
  74822. continue;
  74823. }
  74824. }
  74825. //使用参考点
  74826. pointList.push(refLocal);
  74827. //赋 style
  74828. var style = new Object();
  74829. style.r = 6; //防止漏设此参数,默认 6 像素
  74830. style = Util_Util.copyAttributesWithClip(style, this.style);
  74831. style.x = refLocal[0];
  74832. style.y = refLocal[1];
  74833. //创建图形
  74834. var shape = new SmicPoint({
  74835. style: style,
  74836. clickable: this.isClickAble,
  74837. hoverable: this.isHoverAble
  74838. });
  74839. //设置高亮样式
  74840. if (this.highlightStyle) {
  74841. shape.highlightStyle = this.highlightStyle;
  74842. }
  74843. //设置参考中心,指定图形位置
  74844. shape.refOriginalPosition = location;
  74845. //储存数据 id 属性,用于事件
  74846. shape.refDataID = this.data.id;
  74847. //储存数据 id 属性,用于事件-多图形同时高亮
  74848. shape.isHoverByRefDataID = this.isMultiHover;
  74849. //修改一些 shape 可选属性,通常不需要这么做
  74850. if (this.shapeOptions) {
  74851. Util_Util.copyAttributesWithClip(shape, this.shapeOptions);
  74852. }
  74853. this.shapes.push(shape);
  74854. }
  74855. }
  74856. /**
  74857. * @function FeatureThemeVector.prototype.multiLineStringToTF
  74858. * @description 转换多线要素。
  74859. * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 MultiLineString。
  74860. */
  74861. multiLineStringToTF(geometry) {
  74862. var components = geometry.components;
  74863. for (var i = 0; i < components.length; i++) {
  74864. var components_i = components[i];
  74865. this.lineToTF(components_i);
  74866. }
  74867. }
  74868. /**
  74869. * @function FeatureThemeVector.prototype.multiPolygonToTF
  74870. * @description 转换多面要素。
  74871. * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 MultiPolygon。
  74872. */
  74873. multiPolygonToTF(geometry) {
  74874. var components = geometry.components;
  74875. for (var i = 0; i < components.length; i++) {
  74876. var components_i = components[i];
  74877. this.polygonToTF(components_i);
  74878. }
  74879. }
  74880. /**
  74881. * @function FeatureThemeVector.prototype.pointToTF
  74882. * @description 转换点要素。
  74883. * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 Point。
  74884. */
  74885. pointToTF(geometry) {
  74886. //参考位置,参考中心为
  74887. var location = this.location;
  74888. //geometry 像素坐标
  74889. var localLX = this.getLocalXY(geometry);
  74890. //赋 style
  74891. var style = new Object();
  74892. style.r = 6; //防止漏设此参数,默认 6 像素
  74893. style = Util_Util.copyAttributesWithClip(style, this.style);
  74894. style.x = localLX[0] - location[0];
  74895. style.y = localLX[1] - location[1];
  74896. //创建图形
  74897. var shape = new SmicPoint({
  74898. style: style,
  74899. clickable: this.isClickAble,
  74900. hoverable: this.isHoverAble
  74901. });
  74902. //设置高亮样式
  74903. if (this.highlightStyle) {
  74904. shape.highlightStyle = this.highlightStyle;
  74905. }
  74906. //设置参考中心,指定图形位置
  74907. shape.refOriginalPosition = location;
  74908. //储存数据 id 属性,用于事件
  74909. shape.refDataID = this.data.id;
  74910. //储存数据 id 属性,用于事件-多图形同时高亮
  74911. shape.isHoverByRefDataID = this.isMultiHover;
  74912. //修改一些 shape 可选属性,通常不需要这么做
  74913. if (this.shapeOptions) {
  74914. Util_Util.copyAttributesWithClip(shape, this.shapeOptions);
  74915. }
  74916. this.shapes.push(shape);
  74917. }
  74918. /**
  74919. * @function FeatureThemeVector.prototype.polygonToThemeFeature
  74920. * @description 转换面要素。
  74921. * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 Polygon。
  74922. */
  74923. polygonToTF(geometry) {
  74924. var components = geometry.components;
  74925. //节点像素坐标
  74926. var localLX = [];
  74927. //参考位置,参考中心为
  74928. var refLocal = [];
  74929. var location = this.location;
  74930. var pointList = [];
  74931. //岛洞
  74932. var holePolygonPointList = [];
  74933. var holePolygonPointLists = [];
  74934. //节点抽稀距离
  74935. var nCPx = this.nodesClipPixel;
  74936. for (var i = 0; i < components.length; i++) {
  74937. var components_i = components[i].components;
  74938. if (i === 0) {
  74939. // 第一个 component 正常绘制
  74940. pointList = [];
  74941. for (var j = 0; j < components_i.length; j++) {
  74942. refLocal = [];
  74943. localLX = this.getLocalXY(components_i[j]);
  74944. refLocal[0] = localLX[0] - location[0];
  74945. refLocal[1] = localLX[1] - location[1];
  74946. //抽稀 - 2 px
  74947. if (pointList.length > 0) {
  74948. var lastLocalXY = pointList[pointList.length - 1];
  74949. if ((Math.abs(lastLocalXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastLocalXY[1] - refLocal[1]) <= nCPx)) {
  74950. continue;
  74951. }
  74952. }
  74953. //使用参考点
  74954. pointList.push(refLocal);
  74955. }
  74956. } else {
  74957. // 其它 component 作为岛洞
  74958. holePolygonPointList = [];
  74959. for (var k = 0; k < components_i.length; k++) {
  74960. refLocal = [];
  74961. localLX = this.getLocalXY(components_i[k]);
  74962. refLocal[0] = localLX[0] - location[0];
  74963. refLocal[1] = localLX[1] - location[1];
  74964. //抽稀 - 2 px
  74965. if (holePolygonPointList.length > 0) {
  74966. var lastXY = holePolygonPointList[holePolygonPointList.length - 1];
  74967. if ((Math.abs(lastXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastXY[1] - refLocal[1]) <= nCPx)) {
  74968. continue;
  74969. }
  74970. }
  74971. //使用参考点
  74972. holePolygonPointList.push(refLocal);
  74973. }
  74974. }
  74975. if (holePolygonPointList.length < 2) {
  74976. continue;
  74977. }
  74978. holePolygonPointLists.push(holePolygonPointList);
  74979. }
  74980. if (pointList.length < 2) {
  74981. return;
  74982. }
  74983. //赋 style
  74984. var style = {};
  74985. style = Util_Util.copyAttributesWithClip(style, this.style, ['pointList']);
  74986. style.pointList = pointList;
  74987. //创建图形
  74988. var shape = new SmicPolygon({
  74989. style: style,
  74990. clickable: this.isClickAble,
  74991. hoverable: this.isHoverAble
  74992. });
  74993. //设置高亮样式
  74994. if (this.highlightStyle) {
  74995. shape.highlightStyle = this.highlightStyle;
  74996. }
  74997. //设置参考中心,指定图形位置
  74998. shape.refOriginalPosition = this.location;
  74999. //储存数据 id 属性,用于事件
  75000. shape.refDataID = this.data.id;
  75001. //储存数据 id 属性,用于事件-多图形同时高亮
  75002. shape.isHoverByRefDataID = this.isMultiHover;
  75003. //岛洞面
  75004. if (holePolygonPointLists.length > 0) {
  75005. shape.holePolygonPointLists = holePolygonPointLists;
  75006. }
  75007. //修改一些 shape 可选属性,通常不需要这么做
  75008. if (this.shapeOptions) {
  75009. Util_Util.copyAttributesWithClip(shape, this.shapeOptions);
  75010. }
  75011. this.shapes.push(shape);
  75012. }
  75013. /**
  75014. * @function FeatureThemeVector.prototype.rectangleToTF
  75015. * @description 转换矩形要素。
  75016. * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 Rectangle。
  75017. */
  75018. rectangleToTF(geometry) {
  75019. //参考位置,参考中心为
  75020. var location = this.location;
  75021. var ll = new LonLat(geometry.x, geometry.y);
  75022. //地图分辨率
  75023. var res = this.layer.map.getResolution();
  75024. //geometry 像素坐标
  75025. var localLX = this.getLocalXY(ll);
  75026. //赋 style
  75027. var style = new Object();
  75028. style.r = 6; //防止漏设此参数,默认 6 像素
  75029. style = Util_Util.copyAttributesWithClip(style, this.style);
  75030. style.x = localLX[0] - location[0];
  75031. // Rectangle 使用左下角定位, SmicRectangle 使用左上角定位,需要转换
  75032. style.y = (localLX[1] - location[1]) - 2 * geometry.width / res;
  75033. style.width = geometry.width / res;
  75034. style.height = geometry.height / res;
  75035. //创建图形
  75036. var shape = new SmicRectangle({
  75037. style: style,
  75038. clickable: this.isClickAble,
  75039. hoverable: this.isHoverAble
  75040. });
  75041. //设置高亮样式
  75042. if (this.highlightStyle) {
  75043. shape.highlightStyle = this.highlightStyle;
  75044. }
  75045. //设置参考中心,指定图形位置
  75046. shape.refOriginalPosition = location;
  75047. //储存数据 id 属性,用于事件
  75048. shape.refDataID = this.data.id;
  75049. //储存数据 id 属性,用于事件-多图形同时高亮
  75050. shape.isHoverByRefDataID = this.isMultiHover;
  75051. //修改一些 shape 可选属性,通常不需要这么做
  75052. if (this.shapeOptions) {
  75053. Util_Util.copyAttributesWithClip(shape, this.shapeOptions);
  75054. }
  75055. this.shapes.push(shape);
  75056. }
  75057. /**
  75058. * @function FeatureThemeVector.prototype.geoTextToTF
  75059. * @description 转换文本要素。
  75060. * @param {Geometry} geometry - 用户数据几何地理信息,这里必须是 GeoText。
  75061. */
  75062. geoTextToTF(geometry) {
  75063. //参考位置,参考中心为
  75064. var location = this.location;
  75065. //geometry 像素坐标
  75066. var localLX = this.getLocalXY(geometry);
  75067. //赋 style
  75068. var style = new Object();
  75069. style.r = 6; //防止漏设此参数,默认 6 像素
  75070. style = Util_Util.copyAttributesWithClip(style, this.style, ["x", "y", "text"]);
  75071. style.x = localLX[0] - location[0];
  75072. style.y = localLX[1] - location[1];
  75073. style.text = geometry.text;
  75074. //创建图形
  75075. var shape = new SmicText({
  75076. style: style,
  75077. clickable: this.isClickAble,
  75078. hoverable: this.isHoverAble
  75079. });
  75080. //设置高亮样式
  75081. if (this.highlightStyle) {
  75082. shape.highlightStyle = this.highlightStyle;
  75083. }
  75084. //设置参考中心,指定图形位置
  75085. shape.refOriginalPosition = location;
  75086. //储存数据 id 属性,用于事件
  75087. shape.refDataID = this.data.id;
  75088. //储存数据 id 属性,用于事件-多图形同时高亮
  75089. shape.isHoverByRefDataID = this.isMultiHover;
  75090. //修改一些 shape 可选属性,通常不需要这么做
  75091. if (this.shapeOptions) {
  75092. Util_Util.copyAttributesWithClip(shape, this.shapeOptions);
  75093. }
  75094. this.shapes.push(shape);
  75095. }
  75096. /**
  75097. * @function FeatureThemeVector.prototype.updateAndAddShapes
  75098. * @description 修改位置,针对地图平移操作,地图漫游操作后调用此函数。
  75099. */
  75100. updateAndAddShapes() {
  75101. var newLocalLX = this.getLocalXY(this.lonlat);
  75102. this.location = newLocalLX;
  75103. var render = this.layer.renderer;
  75104. for (var i = 0, len = this.shapes.length; i < len; i++) {
  75105. var shape = this.shapes[i];
  75106. //设置参考中心,指定图形位置
  75107. shape.refOriginalPosition = newLocalLX;
  75108. render.addShape(shape);
  75109. }
  75110. }
  75111. /**
  75112. * @function FeatureThemeVector.prototype.getShapesCount
  75113. * @description 获得专题要素中可视化图形的数量。
  75114. * @returns {number} 可视化图形的数量。
  75115. */
  75116. getShapesCount() {
  75117. return this.shapes.length;
  75118. }
  75119. /**
  75120. * @function FeatureThemeVector.prototype.getLocalXY
  75121. * @description 地理坐标转为像素坐标。
  75122. * @param {LonLat} lonlat - 专题要素地理位置。
  75123. */
  75124. getLocalXY(lonlat) {
  75125. return this.layer.getLocalXY(lonlat);
  75126. }
  75127. }
  75128. ;// CONCATENATED MODULE: ./src/common/overlay/feature/index.js
  75129. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  75130. * This program are made available under the terms of the Apache License, Version 2.0
  75131. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75132. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Group.js
  75133. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  75134. * This program are made available under the terms of the Apache License, Version 2.0
  75135. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75136. /**
  75137. * @class LevelRenderer.Group
  75138. * @category Visualization Theme
  75139. * @private
  75140. * @classdesc Group 是一个容器,可以插入子节点,Group 的变换也会被应用到子节点上。
  75141. * @extends {LevelRenderer.Transformable}
  75142. * (code)
  75143. * var g = new LevelRenderer.Group();
  75144. * var Circle = new LevelRenderer.Shape.Circle();
  75145. * g.position[0] = 100;
  75146. * g.position[1] = 100;
  75147. * g.addChild(new Circle({
  75148. * style: {
  75149. * x: 100,
  75150. * y: 100,
  75151. * r: 20,
  75152. * brushType: 'fill'
  75153. * }
  75154. * }));
  75155. * LR.addGroup(g);
  75156. * (end)
  75157. * @param {Array} options - Group 的配置(options)项,可以是 Group 的自有属性,也可以是自定义的属性。
  75158. */
  75159. class Group extends mixinExt(Eventful, Transformable) {
  75160. constructor(options) {
  75161. super(options)
  75162. options = options || {};
  75163. /**
  75164. * @member {string} LevelRenderer.Group.prototype.id
  75165. * @description Group 的唯一标识。
  75166. */
  75167. this.id = null;
  75168. /**
  75169. * @readonly
  75170. * @member {string} [LevelRenderer.Group.prototype.type='group']
  75171. * @description 类型。
  75172. */
  75173. this.type = 'group';
  75174. //http://www.w3.org/TR/2dcontext/#clipping-region
  75175. /**
  75176. * @member {string} LevelRenderer.Group.prototype.clipShape
  75177. * @description 用于裁剪的图形(shape),所有 Group 内的图形在绘制时都会被这个图形裁剪,该图形会继承 Group 的变换。
  75178. */
  75179. this.clipShape = null;
  75180. /**
  75181. * @member {Array} LevelRenderer.Group.prototype._children
  75182. * @description _children。
  75183. */
  75184. this._children = [];
  75185. /**
  75186. * @member {Array} LevelRenderer.Group.prototype._storage
  75187. * @description _storage。
  75188. */
  75189. this._storage = null;
  75190. /**
  75191. * @member {boolean} [LevelRenderer.Group.prototype.__dirty=true]
  75192. * @description __dirty。
  75193. */
  75194. this.__dirty = true;
  75195. /**
  75196. * @member {boolean} [LevelRenderer.Group.prototype.ignore=false]
  75197. * @description 是否忽略该 Group 及其所有子节点。
  75198. */
  75199. this.ignore = false;
  75200. Util_Util.extend(this, options);
  75201. this.id = this.id || Util_Util.createUniqueID("smShapeGroup_");
  75202. this.CLASS_NAME = "SuperMap.LevelRenderer.Group";
  75203. }
  75204. /**
  75205. * @function LevelRenderer.Group.prototype.destroy
  75206. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  75207. */
  75208. destroy() {
  75209. this.id = null;
  75210. this.type = null;
  75211. this.clipShape = null;
  75212. this._children = null;
  75213. this._storage = null;
  75214. this.__dirty = null;
  75215. this.ignore = null;
  75216. super.destroy();
  75217. }
  75218. /**
  75219. * @function LevelRenderer.Group.prototype.children
  75220. * @description 复制并返回一份新的包含所有儿子节点的数组。
  75221. * @returns {Array.<LevelRenderer.Shape>} 图形数组。
  75222. */
  75223. children() {
  75224. return this._children.slice();
  75225. }
  75226. /**
  75227. * @function LevelRenderer.Group.prototype.childAt
  75228. * @description 获取指定 index 的儿子节点
  75229. * @param {number} idx - 节点索引。
  75230. * @returns {LevelRenderer.Shape} 图形。
  75231. */
  75232. childAt(idx) {
  75233. return this._children[idx];
  75234. }
  75235. /**
  75236. * @function LevelRenderer.Group.prototype.addChild
  75237. * @description 添加子节点,可以是 Shape 或者 Group。
  75238. * @param {(LevelRenderer.Shape|LevelRenderer.Group)} child - 节点图形。
  75239. */
  75240. // TODO Type Check
  75241. addChild(child) {
  75242. if (child == this) {
  75243. return;
  75244. }
  75245. if (child.parent == this) {
  75246. return;
  75247. }
  75248. if (child.parent) {
  75249. child.parent.removeChild(child);
  75250. }
  75251. this._children.push(child);
  75252. child.parent = this;
  75253. if (this._storage && this._storage !== child._storage) {
  75254. this._storage.addToMap(child);
  75255. if (child instanceof Group) {
  75256. child.addChildrenToStorage(this._storage);
  75257. }
  75258. }
  75259. }
  75260. /**
  75261. * @function LevelRenderer.Group.prototype.removeChild
  75262. * @description 移除子节点。
  75263. * @param {LevelRenderer.Shape} child - 需要移除的子节点图形。
  75264. */
  75265. removeChild(child) {
  75266. var idx = Util_Util.indexOf(this._children, child);
  75267. this._children.splice(idx, 1);
  75268. child.parent = null;
  75269. if (this._storage) {
  75270. this._storage.delFromMap(child.id);
  75271. if (child instanceof Group) {
  75272. child.delChildrenFromStorage(this._storage);
  75273. }
  75274. }
  75275. }
  75276. /**
  75277. * @function LevelRenderer.Group.prototype.eachChild
  75278. * @description 遍历所有子节点。
  75279. * @param {function} cb - 回调函数。
  75280. * @param {Object} context - 上下文。
  75281. */
  75282. eachChild(cb, context) {
  75283. var haveContext = !!context;
  75284. for (var i = 0; i < this._children.length; i++) {
  75285. var child = this._children[i];
  75286. if (haveContext) {
  75287. cb.call(context, child);
  75288. } else {
  75289. cb(child);
  75290. }
  75291. }
  75292. }
  75293. /**
  75294. * @function LevelRenderer.Group.prototype.traverse
  75295. * @description 深度优先遍历所有子孙节点。
  75296. * @param {function} cb - 回调函数。
  75297. * @param {Object} context - 上下文。
  75298. */
  75299. traverse(cb, context) {
  75300. var haveContext = !!context;
  75301. for (var i = 0; i < this._children.length; i++) {
  75302. var child = this._children[i];
  75303. if (haveContext) {
  75304. cb.call(context, child);
  75305. } else {
  75306. cb(child);
  75307. }
  75308. if (child.type === 'group') {
  75309. child.traverse(cb, context);
  75310. }
  75311. }
  75312. }
  75313. /**
  75314. * @function LevelRenderer.Group.prototype.addChildrenToStorage
  75315. * @description 把子图形添加到仓库。
  75316. * @param {LevelRenderer.Storage} storage - 图形仓库。
  75317. */
  75318. addChildrenToStorage(storage) {
  75319. for (var i = 0; i < this._children.length; i++) {
  75320. var child = this._children[i];
  75321. storage.addToMap(child);
  75322. if (child.type === 'group') {
  75323. child.addChildrenToStorage(storage);
  75324. }
  75325. }
  75326. }
  75327. /**
  75328. * @function LevelRenderer.Group.prototype.delChildrenFromStorage
  75329. * @description 从仓库把子图形删除。
  75330. * @param {LevelRenderer.Storage} storage - 图形仓库。
  75331. */
  75332. delChildrenFromStorage(storage) {
  75333. for (var i = 0; i < this._children.length; i++) {
  75334. var child = this._children[i];
  75335. storage.delFromMap(child.id);
  75336. if (child.type === 'group') {
  75337. child.delChildrenFromStorage(storage);
  75338. }
  75339. }
  75340. }
  75341. /**
  75342. * @function LevelRenderer.Group.prototype.modSelf
  75343. * @description 是否修改。
  75344. */
  75345. modSelf() {
  75346. this.__dirty = true;
  75347. }
  75348. }
  75349. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Storage.js
  75350. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  75351. * This program are made available under the terms of the Apache License, Version 2.0
  75352. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75353. /**
  75354. * @private
  75355. * @class LevelRenderer.Storage
  75356. * @category Visualization Theme
  75357. * @classdesc 内容(图像)仓库 (M) 。
  75358. */
  75359. class Storage {
  75360. constructor() {
  75361. /**
  75362. * @member {Object} LevelRenderer.Storage.prototype._elements
  75363. * @description 所有常规形状,id 索引的 map。
  75364. */
  75365. this._elements = {};
  75366. /**
  75367. * @member {Array} LevelRenderer.Storage.prototype._hoverElements
  75368. * @description 高亮层形状,不稳定,动态增删,数组位置也是 z 轴方向,靠前显示在下方。
  75369. *
  75370. */
  75371. this._hoverElements = [];
  75372. /**
  75373. * @member {Array} LevelRenderer.Storage.prototype._roots
  75374. * @description _roots。
  75375. *
  75376. */
  75377. this._roots = [];
  75378. /**
  75379. * @member {Array} LevelRenderer.Storage.prototype._shapeList
  75380. * @description _shapeList。
  75381. *
  75382. */
  75383. this._shapeList = [];
  75384. /**
  75385. * @member {number} LevelRenderer.Storage.prototype._shapeListOffset
  75386. * @description _shapeListOffset。默认值:0。
  75387. *
  75388. */
  75389. this._shapeListOffset = 0;
  75390. this.CLASS_NAME = "SuperMap.LevelRenderer.Storage";
  75391. }
  75392. /**
  75393. * @function LevelRenderer.Storage.prototype.destroy
  75394. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  75395. */
  75396. destroy() {
  75397. this.dispose();
  75398. this._shapeList = null;
  75399. this._shapeListOffset = null;
  75400. }
  75401. /**
  75402. * @function LevelRenderer.Storage.prototype.iterShape
  75403. * @description 遍历迭代器。
  75404. *
  75405. * @param {function} fun - 迭代回调函数,return true终止迭代。
  75406. * @param {Object} option - 迭代参数,缺省为仅降序遍历普通层图形。
  75407. * @param {boolean} [hover=true] - 是否是高亮层图形。
  75408. * @param {string} [normal='down'] - 是否是普通层图形,迭代时是否指定及z轴顺序。可设值:'down' ,'up'。
  75409. * @param {boolean} [update=false] - 是否在迭代前更新形状列表。
  75410. * @return {LevelRenderer.Storage} this。
  75411. */
  75412. iterShape(fun, option) {
  75413. if (!option) {
  75414. var defaultIterateOption = {
  75415. hover: false,
  75416. normal: 'down',
  75417. update: false
  75418. };
  75419. option = defaultIterateOption;
  75420. }
  75421. if (option.hover) {
  75422. // 高亮层数据遍历
  75423. for (var i = 0, l = this._hoverElements.length; i < l; i++) {
  75424. var el = this._hoverElements[i];
  75425. el.updateTransform();
  75426. if (fun(el)) {
  75427. return this;
  75428. }
  75429. }
  75430. }
  75431. if (option.update) {
  75432. this.updateShapeList();
  75433. }
  75434. // 遍历: 'down' | 'up'
  75435. switch (option.normal) {
  75436. case 'down':
  75437. {
  75438. // 降序遍历,高层优先
  75439. let l = this._shapeList.length;
  75440. while (l--) {
  75441. if (fun(this._shapeList[l])) {
  75442. return this;
  75443. }
  75444. }
  75445. break;
  75446. }
  75447. // case 'up':
  75448. default:
  75449. {
  75450. // 升序遍历,底层优先
  75451. for (let i = 0, l = this._shapeList.length; i < l; i++) {
  75452. if (fun(this._shapeList[i])) {
  75453. return this;
  75454. }
  75455. }
  75456. break;
  75457. }
  75458. }
  75459. return this;
  75460. }
  75461. /**
  75462. * @function LevelRenderer.Storage.prototype.getHoverShapes
  75463. * @param {boolean} [update=false] - 是否在返回前更新图形的变换。
  75464. * @return {Array.<LevelRenderer.Shape>} 图形数组。
  75465. */
  75466. getHoverShapes(update) {
  75467. // hoverConnect
  75468. var hoverElements = [], len = this._hoverElements.length;
  75469. for (let i = 0; i < len; i++) {
  75470. hoverElements.push(this._hoverElements[i]);
  75471. var target = this._hoverElements[i].hoverConnect;
  75472. if (target) {
  75473. var shape;
  75474. target = target instanceof Array ? target : [target];
  75475. for (var j = 0, k = target.length; j < k; j++) {
  75476. shape = target[j].id ? target[j] : this.get(target[j]);
  75477. if (shape) {
  75478. hoverElements.push(shape);
  75479. }
  75480. }
  75481. }
  75482. }
  75483. hoverElements.sort(Storage.shapeCompareFunc);
  75484. if (update) {
  75485. for (let i = 0, l = hoverElements.length; i < l; i++) {
  75486. hoverElements[i].updateTransform();
  75487. }
  75488. }
  75489. return hoverElements;
  75490. }
  75491. /**
  75492. * @function LevelRenderer.Storage.prototype.getShapeList
  75493. * @description 返回所有图形的绘制队列。
  75494. *
  75495. * @param {boolean} [update=false] - 是否在返回前更新该数组。详见:<LevelRenderer.Shape> updateShapeList。
  75496. * @return {LevelRenderer.Shape} 图形。
  75497. */
  75498. getShapeList(update) {
  75499. if (update) {
  75500. this.updateShapeList();
  75501. }
  75502. return this._shapeList;
  75503. }
  75504. /**
  75505. * @function LevelRenderer.Storage.prototype.updateShapeList
  75506. * @description 更新图形的绘制队列。每次绘制前都会调用,该方法会先深度优先遍历整个树,更新所有Group和Shape的变换并且把所有可见的Shape保存到数组中,最后根据绘制的优先级(zlevel > z > 插入顺序)排序得到绘制队列。
  75507. */
  75508. updateShapeList() {
  75509. this._shapeListOffset = 0;
  75510. var rootsLen = this._roots.length;
  75511. for (let i = 0; i < rootsLen; i++) {
  75512. let root = this._roots[i];
  75513. this._updateAndAddShape(root);
  75514. }
  75515. this._shapeList.length = this._shapeListOffset;
  75516. var shapeListLen = this._shapeList.length;
  75517. for (let i = 0; i < shapeListLen; i++) {
  75518. this._shapeList[i].__renderidx = i;
  75519. }
  75520. this._shapeList.sort(Storage.shapeCompareFunc);
  75521. }
  75522. /**
  75523. * @function LevelRenderer.Storage.prototype._updateAndAddShape
  75524. * @description 更新并添加图形。
  75525. *
  75526. */
  75527. _updateAndAddShape(el, clipShapes) {
  75528. if (el.ignore) {
  75529. return;
  75530. }
  75531. el.updateTransform();
  75532. if (el.type == 'group') {
  75533. if (el.clipShape) {
  75534. // clipShape 的变换是基于 group 的变换
  75535. el.clipShape.parent = el;
  75536. el.clipShape.updateTransform();
  75537. // PENDING 效率影响
  75538. if (clipShapes) {
  75539. clipShapes = clipShapes.slice();
  75540. clipShapes.push(el.clipShape);
  75541. } else {
  75542. clipShapes = [el.clipShape];
  75543. }
  75544. }
  75545. for (var i = 0; i < el._children.length; i++) {
  75546. var child = el._children[i];
  75547. // Force to mark as dirty if group is dirty
  75548. child.__dirty = el.__dirty || child.__dirty;
  75549. this._updateAndAddShape(child, clipShapes);
  75550. }
  75551. // Mark group clean here
  75552. el.__dirty = false;
  75553. } else {
  75554. el.__clipShapes = clipShapes;
  75555. this._shapeList[this._shapeListOffset++] = el;
  75556. }
  75557. }
  75558. /**
  75559. * @function LevelRenderer.Storage.prototype.mod
  75560. * @description 修改图形(Shape)或者组(Group)。
  75561. *
  75562. * @param {string} elId - 唯一标识。
  75563. * @param {Object} params - 参数。
  75564. * @return {LevelRenderer.Storage} this。
  75565. */
  75566. mod(elId, params) {
  75567. var el = this._elements[elId];
  75568. if (el) {
  75569. el.modSelf();
  75570. if (params) {
  75571. // 如果第二个参数直接使用 shape
  75572. // parent, _storage, __startClip 三个属性会有循环引用
  75573. // 主要为了向 1.x 版本兼容,2.x 版本不建议使用第二个参数
  75574. if (params.parent || params._storage || params.__startClip) {
  75575. var target = {};
  75576. for (var name in params) {
  75577. if (
  75578. name == 'parent'
  75579. || name == '_storage'
  75580. || name == '__startClip'
  75581. ) {
  75582. continue;
  75583. }
  75584. if (params.hasOwnProperty(name)) {
  75585. target[name] = params[name];
  75586. }
  75587. }
  75588. new levelRenderer_Util_Util().merge(el, target, true);
  75589. } else {
  75590. new levelRenderer_Util_Util().merge(el, params, true);
  75591. }
  75592. }
  75593. }
  75594. return this;
  75595. }
  75596. /**
  75597. * @function LevelRenderer.Storage.prototype.drift
  75598. * @description 移动指定的图形(Shape)的位置。
  75599. * @param {string} shapeId - 唯一标识。
  75600. * @param {number} dx
  75601. * @param {number} dy
  75602. * @return {LevelRenderer.Storage} this。
  75603. */
  75604. drift(shapeId, dx, dy) {
  75605. var shape = this._elements[shapeId];
  75606. if (shape) {
  75607. shape.needTransform = true;
  75608. if (shape.draggable === 'horizontal') {
  75609. dy = 0;
  75610. } else if (shape.draggable === 'vertical') {
  75611. dx = 0;
  75612. }
  75613. if (!shape.ondrift // ondrift
  75614. // 有onbrush并且调用执行返回false或undefined则继续
  75615. || (shape.ondrift && !shape.ondrift(dx, dy))
  75616. ) {
  75617. shape.drift(dx, dy);
  75618. }
  75619. }
  75620. return this;
  75621. }
  75622. /**
  75623. * @function LevelRenderer.Storage.prototype.addHover
  75624. * @description 添加高亮层数据。
  75625. * @param {LevelRenderer.Shape} shape - 图形。
  75626. * @return {LevelRenderer.Storage} this。
  75627. */
  75628. addHover(shape) {
  75629. shape.updateNeedTransform();
  75630. this._hoverElements.push(shape);
  75631. return this;
  75632. }
  75633. /**
  75634. * @function LevelRenderer.Storage.prototype.delHover
  75635. * @description 清空高亮层数据。
  75636. * @return {LevelRenderer.Storage} this。
  75637. */
  75638. delHover() {
  75639. this._hoverElements = [];
  75640. return this;
  75641. }
  75642. /**
  75643. * @function LevelRenderer.Storage.prototype.hasHoverShape
  75644. * @description 是否有图形在高亮层里。
  75645. * @return {boolean} 是否有图形在高亮层里。
  75646. */
  75647. hasHoverShape() {
  75648. return this._hoverElements.length > 0;
  75649. }
  75650. /**
  75651. * @function LevelRenderer.Storage.prototype.addRoot
  75652. * @description 添加图形(Shape)或者组(Group)到根节点。
  75653. *
  75654. * @param {(LevelRenderer.Shape/LevelRenderer.Group)} el - 图形。
  75655. *
  75656. */
  75657. addRoot(el) {
  75658. if (el instanceof Group) {
  75659. el.addChildrenToStorage(this);
  75660. }
  75661. this.addToMap(el);
  75662. this._roots.push(el);
  75663. }
  75664. /**
  75665. * @function LevelRenderer.Storage.prototype.delRoot
  75666. * @description 删除指定的图形(Shape)或者组(Group)。
  75667. *
  75668. * @param {Array.<string>} elId - 删除图形(Shape)或者组(Group)的 ID 数组。如果为空清空整个Storage。
  75669. *
  75670. */
  75671. delRoot(elId) {
  75672. if (typeof(elId) == 'undefined') {
  75673. // 不指定elId清空
  75674. for (var i = 0; i < this._roots.length; i++) {
  75675. var root = this._roots[i];
  75676. if (root instanceof Group) {
  75677. root.delChildrenFromStorage(this);
  75678. }
  75679. }
  75680. this._elements = {};
  75681. this._hoverElements = [];
  75682. this._roots = [];
  75683. return;
  75684. }
  75685. if (elId instanceof Array) {
  75686. var elIdLen = elId.length;
  75687. for (let i = 0; i < elIdLen; i++) {
  75688. this.delRoot(elId[i]);
  75689. }
  75690. return;
  75691. }
  75692. var el;
  75693. if (typeof(elId) == 'string') {
  75694. el = this._elements[elId];
  75695. } else {
  75696. el = elId;
  75697. }
  75698. var idx = new levelRenderer_Util_Util().indexOf(this._roots, el);
  75699. if (idx >= 0) {
  75700. this.delFromMap(el.id);
  75701. this._roots.splice(idx, 1);
  75702. if (el instanceof Group) {
  75703. el.delChildrenFromStorage(this);
  75704. }
  75705. }
  75706. }
  75707. /**
  75708. * @function LevelRenderer.Storage.prototype.addToMap
  75709. * @description 添加图形到 map。
  75710. *
  75711. * @param {LevelRenderer.Shape} el - 图形。
  75712. * @return {LevelRenderer.Storage} this。
  75713. */
  75714. addToMap(el) {
  75715. if (el instanceof Group) {
  75716. el._storage = this;
  75717. }
  75718. el.modSelf();
  75719. this._elements[el.id] = el;
  75720. return this;
  75721. }
  75722. /**
  75723. * @function LevelRenderer.Storage.prototype.get
  75724. * @description 获取指定图形。
  75725. *
  75726. * @param {string} elId - 图形 id。
  75727. * @return {LevelRenderer.Shape} 图形。
  75728. */
  75729. get(elId) {
  75730. return this._elements[elId];
  75731. }
  75732. /**
  75733. * @function LevelRenderer.Storage.prototype.delFromMap
  75734. * @description 从 map 中删除指定图形。
  75735. *
  75736. * @param {string} elId - 图形id。
  75737. * @return {LevelRenderer.Storage} this。
  75738. */
  75739. delFromMap(elId) {
  75740. var el = this._elements[elId];
  75741. if (el) {
  75742. delete this._elements[elId];
  75743. if (el instanceof Group) {
  75744. el._storage = null;
  75745. }
  75746. }
  75747. return this;
  75748. }
  75749. /**
  75750. * @function LevelRenderer.Storage.prototype.dispose
  75751. * @description 清空并且释放 Storage。
  75752. */
  75753. dispose() {
  75754. this._elements = null;
  75755. // this._renderList = null;
  75756. this._roots = null;
  75757. this._hoverElements = null;
  75758. }
  75759. static shapeCompareFunc(a, b) {
  75760. if (a.zlevel == b.zlevel) {
  75761. if (a.z == b.z) {
  75762. return a.__renderidx - b.__renderidx;
  75763. }
  75764. return a.z - b.z;
  75765. }
  75766. return a.zlevel - b.zlevel;
  75767. }
  75768. }
  75769. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Painter.js
  75770. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  75771. * This program are made available under the terms of the Apache License, Version 2.0
  75772. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75773. /**
  75774. * @private
  75775. * @class LevelRenderer.Painter
  75776. * @category Visualization Theme
  75777. * @classdesc Painter 绘图模块。
  75778. * @param {HTMLElement} root - 绘图区域(DIV)。
  75779. * @param {LevelRenderer.Storage} storage - Storage 实例。
  75780. */
  75781. class Painter {
  75782. constructor(root, storage) {
  75783. /**
  75784. * @member {HTMLElement} LevelRenderer.Painter.prototype.root
  75785. * @description 绘图容器。
  75786. *
  75787. */
  75788. this.root = root;
  75789. /**
  75790. * @member {Array} LevelRenderer.Painter.prototype.storage
  75791. * @description 图形仓库。
  75792. *
  75793. */
  75794. this.storage = storage;
  75795. /**
  75796. * @member {HTMLElement} LevelRenderer.Painter.prototype._domRoot
  75797. * @description 容器根 dom 对象。
  75798. *
  75799. */
  75800. this._domRoot = null;
  75801. /**
  75802. * @member {Object} LevelRenderer.Painter.prototype._layers
  75803. * @description 绘制层对象。
  75804. *
  75805. */
  75806. this._layers = {};
  75807. /**
  75808. * @member {Array} LevelRenderer.Painter.prototype._zlevelList
  75809. * @description 层列表。
  75810. *
  75811. */
  75812. this._zlevelList = [];
  75813. /**
  75814. * @member {Object} LevelRenderer.Painter.prototype._layerConfig
  75815. * @description 绘制层配置对象。
  75816. *
  75817. */
  75818. this._layerConfig = {};
  75819. /**
  75820. * @member {Object} LevelRenderer.Painter.prototype._bgDom
  75821. * @description 背景层 Canvas (Dom)。
  75822. *
  75823. */
  75824. this._bgDom = null;
  75825. /**
  75826. * @member {function} LevelRenderer.Painter.prototype.shapeToImage
  75827. * @description 形状转图像函数。
  75828. *
  75829. */
  75830. this.shapeToImage = null;
  75831. // retina 屏幕优化
  75832. Painter.devicePixelRatio = Math.max((window.devicePixelRatio || 1), 1);
  75833. this.CLASS_NAME = "SuperMap.LevelRenderer.Painter";
  75834. this.root.innerHTML = '';
  75835. this._width = this._getWidth(); // 宽,缓存记录
  75836. this._height = this._getHeight(); // 高,缓存记录
  75837. var domRoot = document.createElement('div');
  75838. this._domRoot = domRoot;
  75839. // domRoot.onselectstart = returnFalse; // 避免页面选中的尴尬
  75840. domRoot.style.position = 'relative';
  75841. domRoot.style.overflow = 'hidden';
  75842. domRoot.style.width = this._width + 'px';
  75843. domRoot.style.height = this._height + 'px';
  75844. this.root.appendChild(domRoot);
  75845. this.shapeToImage = this._createShapeToImageProcessor();
  75846. // 创建各层canvas
  75847. // 背景
  75848. //this._bgDom = Painter.createDom('bg', 'div', this);
  75849. this._bgDom = Painter.createDom(Util_Util.createUniqueID("SuperMap.Theme_background_"), 'div', this);
  75850. domRoot.appendChild(this._bgDom);
  75851. this._bgDom.onselectstart = returnFalse;
  75852. this._bgDom.style['-webkit-user-select'] = 'none';
  75853. this._bgDom.style['user-select'] = 'none';
  75854. this._bgDom.style['-webkit-touch-callout'] = 'none';
  75855. // 高亮
  75856. //var hoverLayer = new PaintLayer('_hoverLayer_', this);
  75857. var hoverLayer = new PaintLayer(Util_Util.createUniqueID("_highLightLayer_"), this);
  75858. this._layers['hover'] = hoverLayer;
  75859. domRoot.appendChild(hoverLayer.dom);
  75860. hoverLayer.initContext();
  75861. hoverLayer.dom.onselectstart = returnFalse;
  75862. hoverLayer.dom.style['-webkit-user-select'] = 'none';
  75863. hoverLayer.dom.style['user-select'] = 'none';
  75864. hoverLayer.dom.style['-webkit-touch-callout'] = 'none';
  75865. var me = this;
  75866. this.updatePainter = function (shapeList, callback) {
  75867. me.refreshShapes(shapeList, callback);
  75868. };
  75869. // 返回false的方法,用于避免页面被选中
  75870. function returnFalse() {
  75871. return false;
  75872. }
  75873. /* eslint-disable */
  75874. // 什么都不干的空方法
  75875. function doNothing() { //NOSONAR
  75876. }
  75877. /* eslint-enable */
  75878. }
  75879. /**
  75880. * @function LevelRenderer.Painter.prototype.destroy
  75881. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  75882. */
  75883. destroy() {
  75884. this.dispose();
  75885. this._zlevelList = null;
  75886. this._layerConfig = null;
  75887. this._bgDom = null;
  75888. this.shapeToImage = null;
  75889. }
  75890. /**
  75891. * @function LevelRenderer.Painter.prototype.render
  75892. * @description 渲染。首次绘图,创建各种 dom 和 context。
  75893. *
  75894. * @param {function} callback - 绘画结束后的回调函数。
  75895. * @return {LevelRenderer.Painter} this。
  75896. */
  75897. render(callback) {
  75898. // TODO
  75899. this.refresh(callback, true);
  75900. return this;
  75901. }
  75902. /**
  75903. * @function LevelRenderer.Painter.prototype.refresh
  75904. * @description 刷新。
  75905. *
  75906. * @param {function} callback - 刷新结束后的回调函数。
  75907. * @param {boolean} paintAll - 强制绘制所有 shape。
  75908. * @return {LevelRenderer.Painter} this。
  75909. */
  75910. refresh(callback, paintAll) {
  75911. var list = this.storage.getShapeList(true);
  75912. this._paintList(list, paintAll);
  75913. if (typeof callback == 'function') {
  75914. callback();
  75915. }
  75916. return this;
  75917. }
  75918. /**
  75919. * Method: _paintList
  75920. * 按列表绘制图形。
  75921. */
  75922. _paintList(list, paintAll) {
  75923. if (typeof(paintAll) == 'undefined') {
  75924. paintAll = false;
  75925. }
  75926. this._updateLayerStatus(list);
  75927. var currentLayer;
  75928. var currentZLevel;
  75929. var ctx;
  75930. for (var id in this._layers) {
  75931. if (id !== 'hover') {
  75932. this._layers[id].unusedCount++;
  75933. this._layers[id].updateTransform();
  75934. }
  75935. }
  75936. var invTransform = [];
  75937. for (var i = 0, l = list.length; i < l; i++) {
  75938. var shape = list[i];
  75939. if (currentZLevel !== shape.zlevel) {
  75940. if (currentLayer && currentLayer.needTransform) {
  75941. ctx.restore();
  75942. }
  75943. currentLayer = this.getLayer(shape.zlevel);
  75944. ctx = currentLayer.ctx;
  75945. currentZLevel = shape.zlevel;
  75946. // Reset the count
  75947. currentLayer.unusedCount = 0;
  75948. if (currentLayer.dirty || paintAll) {
  75949. currentLayer.clear();
  75950. }
  75951. if (currentLayer.needTransform) {
  75952. ctx.save();
  75953. currentLayer.setTransform(ctx);
  75954. }
  75955. }
  75956. // Start group clipping
  75957. if (ctx && shape.__startClip) {
  75958. var clipShape = shape.__startClip;
  75959. ctx.save();
  75960. // Set transform
  75961. if (clipShape.needTransform) {
  75962. let m = clipShape.transform;
  75963. SUtil_SUtil.Util_matrix.invert(invTransform, m);
  75964. ctx.transform(
  75965. m[0], m[1],
  75966. m[2], m[3],
  75967. m[4], m[5]
  75968. );
  75969. }
  75970. ctx.beginPath();
  75971. clipShape.buildPath(ctx, clipShape.style);
  75972. ctx.clip();
  75973. // Transform back
  75974. if (clipShape.needTransform) {
  75975. let m = invTransform;
  75976. ctx.transform(
  75977. m[0], m[1],
  75978. m[2], m[3],
  75979. m[4], m[5]
  75980. );
  75981. }
  75982. }
  75983. if (((currentLayer && currentLayer.dirty) || paintAll) && !shape.invisible) {
  75984. if (
  75985. !shape.onbrush
  75986. || (shape.onbrush && !shape.onbrush(ctx, false))
  75987. ) {
  75988. if (Config_Config.catchBrushException) {
  75989. try {
  75990. shape.brush(ctx, false, this.updatePainter);
  75991. } catch (error) {
  75992. SUtil_SUtil.Util_log(
  75993. error,
  75994. 'brush error of ' + shape.type,
  75995. shape
  75996. );
  75997. }
  75998. } else {
  75999. shape.brush(ctx, false, this.updatePainter);
  76000. }
  76001. }
  76002. }
  76003. // Stop group clipping
  76004. if (ctx && shape.__stopClip) {
  76005. ctx.restore();
  76006. }
  76007. shape.__dirty = false;
  76008. }
  76009. if (ctx && currentLayer && currentLayer.needTransform) {
  76010. ctx.restore();
  76011. }
  76012. for (let id in this._layers) {
  76013. if (id !== 'hover') {
  76014. var layer = this._layers[id];
  76015. layer.dirty = false;
  76016. // 删除过期的层
  76017. // PENDING
  76018. // if (layer.unusedCount >= 500) {
  76019. // this.delLayer(id);
  76020. // }
  76021. if (layer.unusedCount == 1) {
  76022. layer.clear();
  76023. }
  76024. }
  76025. }
  76026. }
  76027. /**
  76028. * @function LevelRenderer.Painter.prototype.getLayer
  76029. * @description 获取 zlevel 所在层,如果不存在则会创建一个新的层。
  76030. *
  76031. * @param {number} zlevel - zlevel。
  76032. * @return {LevelRenderer.Painter} this。
  76033. */
  76034. getLayer(zlevel) {
  76035. // Change draw layer
  76036. var currentLayer = this._layers[zlevel];
  76037. if (!currentLayer) {
  76038. var len = this._zlevelList.length;
  76039. var prevLayer = null;
  76040. var i = -1;
  76041. if (len > 0 && zlevel > this._zlevelList[0]) {
  76042. for (i = 0; i < len - 1; i++) {
  76043. if (
  76044. this._zlevelList[i] < zlevel
  76045. && this._zlevelList[i + 1] > zlevel
  76046. ) {
  76047. break;
  76048. }
  76049. }
  76050. prevLayer = this._layers[this._zlevelList[i]];
  76051. }
  76052. this._zlevelList.splice(i + 1, 0, zlevel);
  76053. // Create a new layer
  76054. //currentLayer = new PaintLayer(zlevel, this);
  76055. currentLayer = new PaintLayer(Util_Util.createUniqueID("_levelLayer_" + zlevel), this);
  76056. var prevDom = prevLayer ? prevLayer.dom : this._bgDom;
  76057. if (prevDom.nextSibling) {
  76058. prevDom.parentNode.insertBefore(
  76059. currentLayer.dom,
  76060. prevDom.nextSibling
  76061. );
  76062. } else {
  76063. prevDom.parentNode.appendChild(
  76064. currentLayer.dom
  76065. );
  76066. }
  76067. currentLayer.initContext();
  76068. this._layers[zlevel] = currentLayer;
  76069. if (this._layerConfig[zlevel]) {
  76070. new levelRenderer_Util_Util().merge(currentLayer, this._layerConfig[zlevel], true);
  76071. }
  76072. currentLayer.updateTransform();
  76073. }
  76074. return currentLayer;
  76075. }
  76076. /**
  76077. * @function LevelRenderer.Painter.prototype.getLayers
  76078. * @description 获取所有已创建的层。
  76079. * @return {Array.<Painter.Layer>} 已创建的层
  76080. */
  76081. getLayers() {
  76082. return this._layers;
  76083. }
  76084. /**
  76085. * Method: _updateLayerStatus
  76086. * 更新绘制层状态。
  76087. */
  76088. _updateLayerStatus(list) {
  76089. var layers = this._layers;
  76090. var elCounts = {};
  76091. for (let z in layers) {
  76092. if (z !== 'hover') {
  76093. elCounts[z] = layers[z].elCount;
  76094. layers[z].elCount = 0;
  76095. }
  76096. }
  76097. for (let i = 0; i < list.length; i++) {
  76098. var shape = list[i];
  76099. var zlevel = shape.zlevel;
  76100. var layer = layers[zlevel];
  76101. if (layer) {
  76102. layer.elCount++;
  76103. // 已经被标记为需要刷新
  76104. if (layer.dirty) {
  76105. continue;
  76106. }
  76107. layer.dirty = shape.__dirty;
  76108. }
  76109. }
  76110. // 层中的元素数量有发生变化
  76111. for (let z in layers) {
  76112. if (z !== 'hover') {
  76113. if (elCounts[z] !== layers[z].elCount) {
  76114. layers[z].dirty = true;
  76115. }
  76116. }
  76117. }
  76118. }
  76119. /**
  76120. * @function LevelRenderer.Painter.prototype.refreshShapes
  76121. * @description 更新的图形元素列表。
  76122. *
  76123. * @param {number} shapeList - 需要更新的图形元素列表。
  76124. * @param {number} callback - 视图更新后回调函数。
  76125. * @return {LevelRenderer.Painter} this。
  76126. */
  76127. refreshShapes(shapeList, callback) {
  76128. for (var i = 0, l = shapeList.length; i < l; i++) {
  76129. var shape = shapeList[i];
  76130. this.storage.mod(shape.id);
  76131. }
  76132. this.refresh(callback);
  76133. return this;
  76134. }
  76135. /**
  76136. * @function LevelRenderer.Painter.prototype.clear
  76137. * @description 清除 hover 层外所有内容。
  76138. * @return {LevelRenderer.Painter} this。
  76139. */
  76140. clear() {
  76141. for (var k in this._layers) {
  76142. if (k == 'hover') {
  76143. continue;
  76144. }
  76145. this._layers[k].clear();
  76146. }
  76147. return this;
  76148. }
  76149. /**
  76150. * @function LevelRenderer.Painter.prototype.modLayer
  76151. * @description 修改指定 zlevel 的绘制参数。
  76152. *
  76153. * @param {string} zlevel - zlevel。
  76154. * @param {Object} config - 配置对象。
  76155. * @param {string} [config.clearColor=0] - 每次清空画布的颜色。
  76156. * @param {boolean} [config.motionBlur=false] - 是否开启动态模糊。
  76157. * @param {number} [config.lastFrameAlpha=0.7] - 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显。默认值:0.7。
  76158. * @param {Array.<number>} config.position - 层的平移。
  76159. * @param {Array.<number>} config.rotation - 层的旋转。
  76160. * @param {Array.<number>} config.scale - 层的缩放。
  76161. * @param {boolean} config.zoomable - 层是否支持鼠标缩放操作。默认值:false。
  76162. * @param {boolean} config.panable - 层是否支持鼠标平移操作。默认值:false。
  76163. *
  76164. */
  76165. modLayer(zlevel, config) {
  76166. if (config) {
  76167. if (!this._layerConfig[zlevel]) {
  76168. this._layerConfig[zlevel] = config;
  76169. } else {
  76170. new levelRenderer_Util_Util().merge(this._layerConfig[zlevel], config, true);
  76171. }
  76172. var layer = this._layers[zlevel];
  76173. if (layer) {
  76174. new levelRenderer_Util_Util().merge(layer, this._layerConfig[zlevel], true);
  76175. }
  76176. }
  76177. }
  76178. /**
  76179. * @function LevelRenderer.Painter.prototype.delLayer
  76180. * @description 删除指定层。
  76181. *
  76182. * @param {string} zlevel - 层所在的 zlevel。
  76183. */
  76184. delLayer(zlevel) {
  76185. var layer = this._layers[zlevel];
  76186. if (!layer) {
  76187. return;
  76188. }
  76189. // Save config
  76190. this.modLayer(zlevel, {
  76191. position: layer.position,
  76192. rotation: layer.rotation,
  76193. scale: layer.scale
  76194. });
  76195. layer.dom.parentNode.removeChild(layer.dom);
  76196. delete this._layers[zlevel];
  76197. this._zlevelList.splice(new levelRenderer_Util_Util().indexOf(this._zlevelList, zlevel), 1);
  76198. }
  76199. /**
  76200. * @function LevelRenderer.Painter.prototype.refreshHover
  76201. * @description 刷新 hover 层。
  76202. * @return {LevelRenderer.Painter} this。
  76203. */
  76204. refreshHover() {
  76205. this.clearHover();
  76206. var list = this.storage.getHoverShapes(true);
  76207. for (var i = 0, l = list.length; i < l; i++) {
  76208. this._brushHover(list[i]);
  76209. }
  76210. this.storage.delHover();
  76211. return this;
  76212. }
  76213. /**
  76214. * @function LevelRenderer.Painter.prototype.clearHover
  76215. * @description 清除 hover 层所有内容。
  76216. * @return {LevelRenderer.Painter} this。
  76217. */
  76218. clearHover() {
  76219. var hover = this._layers.hover;
  76220. hover && hover.clear();
  76221. return this;
  76222. }
  76223. /**
  76224. * @function LevelRenderer.Painter.prototype.resize
  76225. * @description 区域大小变化后重绘。
  76226. * @return {LevelRenderer.Painter} this。
  76227. */
  76228. resize() {
  76229. var domRoot = this._domRoot;
  76230. domRoot.style.display = 'none';
  76231. var width = this._getWidth();
  76232. var height = this._getHeight();
  76233. domRoot.style.display = '';
  76234. // 优化没有实际改变的resize
  76235. if (this._width != width || height != this._height) {
  76236. this._width = width;
  76237. this._height = height;
  76238. domRoot.style.width = width + 'px';
  76239. domRoot.style.height = height + 'px';
  76240. for (var id in this._layers) {
  76241. this._layers[id].resize(width, height);
  76242. }
  76243. this.refresh(null, true);
  76244. }
  76245. return this;
  76246. }
  76247. /**
  76248. * @function LevelRenderer.Painter.prototype.clearLayer
  76249. * @description 清除指定的一个层。
  76250. * @param {number} zLevel - 层。
  76251. */
  76252. clearLayer(zLevel) {
  76253. var layer = this._layers[zLevel];
  76254. if (layer) {
  76255. layer.clear();
  76256. }
  76257. }
  76258. /**
  76259. * @function LevelRenderer.Painter.prototype.dispose
  76260. * @description 释放。
  76261. *
  76262. */
  76263. dispose() {
  76264. this.root.innerHTML = '';
  76265. this.root = null;
  76266. this.storage = null;
  76267. this._domRoot = null;
  76268. this._layers = null;
  76269. }
  76270. /**
  76271. * @function LevelRenderer.Painter.prototype.getDomHover
  76272. * @description 获取 Hover 层的 Dom。
  76273. */
  76274. getDomHover() {
  76275. return this._layers.hover.dom;
  76276. }
  76277. /**
  76278. * @function LevelRenderer.Painter.prototype.toDataURL
  76279. * @description 图像导出。
  76280. * @param {string} type - 图片类型。
  76281. * @param {string} backgroundColor - 背景色。默认值:'#fff'。
  76282. * @param {Object} args
  76283. * @return {string} 图片的Base64 url。
  76284. */
  76285. toDataURL(type, backgroundColor, args) {
  76286. //var imageDom = Painter.createDom('image', 'canvas', this);
  76287. var imageDom = Painter.createDom(Util_Util.createUniqueID("SuperMap.Theme.image_"), 'canvas', this);
  76288. this._bgDom.appendChild(imageDom);
  76289. var ctx = imageDom.getContext('2d');
  76290. Painter.devicePixelRatio != 1
  76291. && ctx.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  76292. ctx.fillStyle = backgroundColor || '#fff';
  76293. ctx.rect(
  76294. 0, 0,
  76295. this._width * Painter.devicePixelRatio,
  76296. this._height * Painter.devicePixelRatio
  76297. );
  76298. ctx.fill();
  76299. var self = this;
  76300. // 升序遍历,shape上的zlevel指定绘画图层的z轴层叠
  76301. this.storage.iterShape(
  76302. function (shape) {
  76303. if (!shape.invisible) {
  76304. if (!shape.onbrush // 没有onbrush
  76305. // 有onbrush并且调用执行返回false或undefined则继续粉刷
  76306. || (shape.onbrush && !shape.onbrush(ctx, false))
  76307. ) {
  76308. if (Config_Config.catchBrushException) {
  76309. try {
  76310. shape.brush(ctx, false, self.updatePainter);
  76311. } catch (error) {
  76312. SUtil_SUtil.Util_log(
  76313. error,
  76314. 'brush error of ' + shape.type,
  76315. shape
  76316. );
  76317. }
  76318. } else {
  76319. shape.brush(ctx, false, self.updatePainter);
  76320. }
  76321. }
  76322. }
  76323. },
  76324. {normal: 'up', update: true}
  76325. );
  76326. var image = imageDom.toDataURL(type, args);
  76327. ctx = null;
  76328. this._bgDom.removeChild(imageDom);
  76329. return image;
  76330. }
  76331. /**
  76332. * @function LevelRenderer.Painter.prototype.getWidth
  76333. * @description 获取绘图区域宽度。
  76334. * @return {number} 绘图区域宽度。
  76335. */
  76336. getWidth() {
  76337. return this._width;
  76338. }
  76339. /**
  76340. * @function LevelRenderer.Painter.prototype.getHeight
  76341. * @description 获取绘图区域高度。
  76342. * @return {number} 绘图区域高度。
  76343. */
  76344. getHeight() {
  76345. return this._height;
  76346. }
  76347. /**
  76348. * Method: _getWidth
  76349. *
  76350. */
  76351. _getWidth() {
  76352. var root = this.root;
  76353. var stl = root.currentStyle
  76354. || document.defaultView.getComputedStyle(root);
  76355. return ((root.clientWidth || parseInt(stl.width, 10))
  76356. - parseInt(stl.paddingLeft, 10) // 请原谅我这比较粗暴
  76357. - parseInt(stl.paddingRight, 10)).toFixed(0) - 0;
  76358. }
  76359. /**
  76360. * Method: _getHeight
  76361. *
  76362. */
  76363. _getHeight() {
  76364. var root = this.root;
  76365. var stl = root.currentStyle
  76366. || document.defaultView.getComputedStyle(root);
  76367. return ((root.clientHeight || parseInt(stl.height, 10))
  76368. - parseInt(stl.paddingTop, 10) // 请原谅我这比较粗暴
  76369. - parseInt(stl.paddingBottom, 10)).toFixed(0) - 0;
  76370. }
  76371. /**
  76372. * Method: _brushHover
  76373. *
  76374. */
  76375. _brushHover(shape) {
  76376. var ctx = this._layers.hover.ctx;
  76377. if (!shape.onbrush // 没有onbrush
  76378. // 有onbrush并且调用执行返回false或undefined则继续粉刷
  76379. || (shape.onbrush && !shape.onbrush(ctx, true))
  76380. ) {
  76381. var layer = this.getLayer(shape.zlevel);
  76382. if (layer.needTransform) {
  76383. ctx.save();
  76384. layer.setTransform(ctx);
  76385. }
  76386. // Retina 优化
  76387. if (Config_Config.catchBrushException) {
  76388. try {
  76389. shape.brush(ctx, true, this.updatePainter);
  76390. } catch (error) {
  76391. SUtil_SUtil.Util_log(
  76392. error, 'hoverBrush error of ' + shape.type, shape
  76393. );
  76394. }
  76395. } else {
  76396. shape.brush(ctx, true, this.updatePainter);
  76397. }
  76398. if (layer.needTransform) {
  76399. ctx.restore();
  76400. }
  76401. }
  76402. }
  76403. /**
  76404. * Method: _shapeToImage
  76405. *
  76406. */
  76407. _shapeToImage(id, shape, width, height, devicePixelRatio) {
  76408. var canvas = document.createElement('canvas');
  76409. var ctx = canvas.getContext('2d');
  76410. var _devicePixelRatio = devicePixelRatio || window.devicePixelRatio || 1;
  76411. canvas.style.width = width + 'px';
  76412. canvas.style.height = height + 'px';
  76413. canvas.setAttribute('width', width * _devicePixelRatio);
  76414. canvas.setAttribute('height', height * _devicePixelRatio);
  76415. ctx.clearRect(0, 0, width * _devicePixelRatio, height * _devicePixelRatio);
  76416. var shapeTransform = {
  76417. position: shape.position,
  76418. rotation: shape.rotation,
  76419. scale: shape.scale
  76420. };
  76421. shape.position = [0, 0, 0];
  76422. shape.rotation = 0;
  76423. shape.scale = [1, 1];
  76424. if (shape) {
  76425. shape.brush(ctx, false);
  76426. }
  76427. var imgShape = new SmicImage({
  76428. id: id,
  76429. style: {
  76430. x: 0,
  76431. y: 0,
  76432. image: canvas
  76433. }
  76434. });
  76435. if (shapeTransform.position != null) {
  76436. imgShape.position = shape.position = shapeTransform.position;
  76437. }
  76438. if (shapeTransform.rotation != null) {
  76439. imgShape.rotation = shape.rotation = shapeTransform.rotation;
  76440. }
  76441. if (shapeTransform.scale != null) {
  76442. imgShape.scale = shape.scale = shapeTransform.scale;
  76443. }
  76444. return imgShape;
  76445. }
  76446. /**
  76447. * Method: _createShapeToImageProcessor
  76448. *
  76449. */
  76450. _createShapeToImageProcessor() {
  76451. var me = this;
  76452. return function (id, e, width, height) {
  76453. return me._shapeToImage(
  76454. id, e, width, height, Painter.devicePixelRatio
  76455. );
  76456. };
  76457. }
  76458. // SMIC-方法扩展 - start
  76459. /**
  76460. * @function LevelRenderer.Painter.prototype.updateHoverLayer
  76461. * @description 更新设置显示高亮图层。
  76462. * @param {Array} shapes - 图形数组。
  76463. */
  76464. updateHoverLayer(shapes) {
  76465. if (!(shapes instanceof Array)) {
  76466. return this;
  76467. }
  76468. //清除高亮
  76469. this.clearHover();
  76470. this.storage.delHover();
  76471. for (var i = 0; i < shapes.length; i++) {
  76472. this.storage.addHover(shapes[i]);
  76473. this._brushHover(shapes[i]);
  76474. }
  76475. }
  76476. /**
  76477. * @function LevelRenderer.Painter.prototype.createDom
  76478. * @description 创建 Dom。
  76479. *
  76480. * @param {string} id - Dom id
  76481. * @param {string} type - Dom type
  76482. * @param {LevelRenderer.Painter} painter - Painter 实例。
  76483. * @return {Object} Dom
  76484. */
  76485. static createDom(id, type, painter) {
  76486. var newDom = document.createElement(type);
  76487. var width = painter._width;
  76488. var height = painter._height;
  76489. // 没append呢,请原谅我这样写,清晰~
  76490. newDom.style.position = 'absolute';
  76491. newDom.style.left = 0;
  76492. newDom.style.top = 0;
  76493. newDom.style.width = width + 'px';
  76494. newDom.style.height = height + 'px';
  76495. newDom.setAttribute('width', width * Painter.devicePixelRatio);
  76496. newDom.setAttribute('height', height * Painter.devicePixelRatio);
  76497. // id不作为索引用,避免可能造成的重名,定义为私有属性
  76498. //newDom.setAttribute('data-zr-dom-id', id);
  76499. newDom.setAttribute('id', id);
  76500. return newDom;
  76501. }
  76502. }
  76503. /**
  76504. * @private
  76505. * @class Painter.Layer
  76506. * @classdesc 绘制层类。
  76507. * @extends LevelRenderer.Transformable
  76508. */
  76509. class PaintLayer extends Transformable {
  76510. /**
  76511. * @function Painter.Layer.constructor
  76512. * @description 构造函数。
  76513. *
  76514. * @param {string} id - id。
  76515. * @param {LevelRenderer.Painter} painter - Painter 实例。
  76516. *
  76517. */
  76518. constructor(id, painter) {
  76519. super(id, painter);
  76520. /**
  76521. * @member {Object} Painter.Layer.prototype.dom
  76522. * @description dom。
  76523. */
  76524. this.dom = null;
  76525. /**
  76526. * @member {Object} Painter.Layer.prototype.domBack
  76527. * @description domBack。
  76528. */
  76529. this.domBack = null;
  76530. /**
  76531. * @member {Object} Painter.Layer.prototype.ctxBack
  76532. * @description ctxBack。
  76533. */
  76534. this.ctxBack = null;
  76535. /**
  76536. * @member {LevelRenderer.Painter} Painter.Layer.prototype.painter
  76537. * @description painter。
  76538. */
  76539. this.painter = painter;
  76540. /**
  76541. * @member {number} Painter.Layer.prototype.unusedCount
  76542. * @description unusedCount。
  76543. */
  76544. this.unusedCount = 0;
  76545. /**
  76546. * @member {Object} Painter.Layer.prototype.config
  76547. * @description config。
  76548. */
  76549. this.config = null;
  76550. /**
  76551. * @member {boolean} Painter.Layer.prototype.dirty
  76552. * @description dirty。
  76553. */
  76554. this.dirty = true;
  76555. /**
  76556. * @member {number} Painter.Layer.prototype.elCount
  76557. * @description elCount。
  76558. */
  76559. this.elCount = 0;
  76560. // Configs
  76561. /**
  76562. * @member {string} Painter.Layer.prototype.clearColor
  76563. * @description 每次清空画布的颜色。默认值:0;
  76564. */
  76565. this.clearColor = 0;
  76566. /**
  76567. * @member {boolean} Painter.Layer.prototype.motionBlur
  76568. * @description 是否开启动态模糊。默认值:false;
  76569. */
  76570. this.motionBlur = false;
  76571. /**
  76572. * @member {number} Painter.Layer.prototype.lastFrameAlpha
  76573. * @description 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显
  76574. */
  76575. this.lastFrameAlpha = 0.7;
  76576. /**
  76577. * @member {boolean} Painter.Layer.prototype.zoomable
  76578. * @description 层是否支持鼠标平移操作。默认值:false;
  76579. */
  76580. this.zoomable = false;
  76581. /**
  76582. * @member {boolean} Painter.Layer.prototype.panable
  76583. * @description 层是否支持鼠标缩放操作。默认值:false;
  76584. */
  76585. this.panable = false;
  76586. /**
  76587. * @member {number} Painter.Layer.prototype.maxZoom
  76588. * @description maxZoom。默认值:Infinity。
  76589. */
  76590. this.maxZoom = Infinity;
  76591. /**
  76592. * @member {number} Painter.Layer.prototype.minZoom
  76593. * @description minZoom。默认值:0。
  76594. */
  76595. this.minZoom = 0;
  76596. /**
  76597. * @member {number} Painter.Layer.prototype.ctx
  76598. * @description Canvas 上下文。
  76599. */
  76600. this.ctx = null;
  76601. this.dom = Painter.createDom(Util_Util.createUniqueID("SuperMap.Theme" + id), 'canvas', painter);
  76602. this.dom.onselectstart = returnFalse; // 避免页面选中的尴尬
  76603. this.dom.style['-webkit-user-select'] = 'none';
  76604. this.dom.style['user-select'] = 'none';
  76605. this.dom.style['-webkit-touch-callout'] = 'none';
  76606. // Function
  76607. // 返回false的方法,用于避免页面被选中
  76608. function returnFalse() {
  76609. return false;
  76610. }
  76611. this.CLASS_NAME = "SuperMap.LevelRenderer.Painter.Layer";
  76612. }
  76613. /**
  76614. * @function Painter.Layer.prototype.destroy
  76615. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  76616. */
  76617. destroy() {
  76618. this.dom = null;
  76619. this.domBack = null;
  76620. this.ctxBack = null;
  76621. this.painter = null;
  76622. this.unusedCount = null;
  76623. this.config = null;
  76624. this.dirty = null;
  76625. this.elCount = null;
  76626. this.clearColor = null;
  76627. this.motionBlur = null;
  76628. this.lastFrameAlpha = null;
  76629. this.zoomable = null;
  76630. this.panable = null;
  76631. this.maxZoom = null;
  76632. this.minZoom = null;
  76633. this.ctx = null;
  76634. Transformable.destroy.apply(this, arguments);
  76635. }
  76636. /**
  76637. * @function Painter.Layer.prototype.initContext
  76638. * @description 初始化 Canvan 2D 上下文。
  76639. */
  76640. initContext() {
  76641. this.ctx = this.dom.getContext('2d');
  76642. if (Painter.devicePixelRatio != 1) {
  76643. this.ctx.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  76644. }
  76645. }
  76646. /**
  76647. * @function Painter.Layer.prototype.createBackBuffer
  76648. * @description 创建备份缓冲。
  76649. */
  76650. createBackBuffer() {
  76651. this.domBack = Painter.createDom(Util_Util.createUniqueID("SuperMap.Theme.back-" + this.id), 'canvas', this.painter);
  76652. this.ctxBack = this.domBack.getContext('2d');
  76653. if (Painter.devicePixelRatio != 1) {
  76654. this.ctxBack.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  76655. }
  76656. }
  76657. /**
  76658. * @function Painter.Layer.prototype.resize
  76659. * @description 改变大小。
  76660. *
  76661. * @param {number} width - 宽。
  76662. * @param {number} height - 高。
  76663. */
  76664. resize(width, height) {
  76665. this.dom.style.width = width + 'px';
  76666. this.dom.style.height = height + 'px';
  76667. this.dom.setAttribute('width', width * Painter.devicePixelRatio);
  76668. this.dom.setAttribute('height', height * Painter.devicePixelRatio);
  76669. if (Painter.devicePixelRatio != 1) {
  76670. this.ctx.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  76671. }
  76672. if (this.domBack) {
  76673. this.domBack.setAttribute('width', width * Painter.devicePixelRatio);
  76674. this.domBack.setAttribute('height', height * Painter.devicePixelRatio);
  76675. if (Painter.devicePixelRatio != 1) {
  76676. this.ctxBack.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  76677. }
  76678. }
  76679. }
  76680. /**
  76681. * @function Painter.Layer.prototype.clear
  76682. * @description 清空该层画布。
  76683. */
  76684. clear() {
  76685. var dom = this.dom;
  76686. var ctx = this.ctx;
  76687. var width = dom.width;
  76688. var height = dom.height;
  76689. var haveClearColor = this.clearColor;
  76690. var haveMotionBLur = this.motionBlur;
  76691. var lastFrameAlpha = this.lastFrameAlpha;
  76692. if (haveMotionBLur) {
  76693. if (!this.domBack) {
  76694. this.createBackBuffer();
  76695. }
  76696. this.ctxBack.globalCompositeOperation = 'copy';
  76697. this.ctxBack.drawImage(
  76698. dom, 0, 0,
  76699. width / Painter.devicePixelRatio,
  76700. height / Painter.devicePixelRatio
  76701. );
  76702. }
  76703. if (haveClearColor) {
  76704. ctx.save();
  76705. ctx.fillStyle = this.config.clearColor;
  76706. ctx.fillRect(
  76707. 0, 0,
  76708. width / Painter.devicePixelRatio,
  76709. height / Painter.devicePixelRatio
  76710. );
  76711. ctx.restore();
  76712. } else {
  76713. ctx.clearRect(
  76714. 0, 0,
  76715. width / Painter.devicePixelRatio,
  76716. height / Painter.devicePixelRatio
  76717. );
  76718. }
  76719. if (haveMotionBLur) {
  76720. var domBack = this.domBack;
  76721. ctx.save();
  76722. ctx.globalAlpha = lastFrameAlpha;
  76723. ctx.drawImage(
  76724. domBack, 0, 0,
  76725. width / Painter.devicePixelRatio,
  76726. height / Painter.devicePixelRatio
  76727. );
  76728. ctx.restore();
  76729. }
  76730. }
  76731. }
  76732. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Handler.js
  76733. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  76734. * This program are made available under the terms of the Apache License, Version 2.0
  76735. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76736. /**
  76737. * @private
  76738. * @class LevelRenderer.Handler
  76739. * @category Visualization Theme
  76740. * @classdesc Handler控制模块。
  76741. * @extends {LevelRenderer.Eventful}
  76742. * @param {HTMLElement} root - 绘图区域。
  76743. * @param {LevelRenderer.Storage} storage - Storage 实例。
  76744. * @param {LevelRenderer.Painter} painter - Painter 实例。
  76745. */
  76746. class Handler extends Eventful {
  76747. constructor(root, storage, painter) {
  76748. super(root, storage, painter);
  76749. /**
  76750. * @member {HTMLElement} LevelRenderer.Handler.prototype.root
  76751. * @description 绘图区域
  76752. */
  76753. this.root = root;
  76754. /**
  76755. * @member {LevelRenderer.Storage} LevelRenderer.Handler.prototype.storage
  76756. * @description Storage 实例
  76757. */
  76758. this.storage = storage;
  76759. /**
  76760. * @member {LevelRenderer.Painter} LevelRenderer.Handler.prototype.Painter
  76761. * @description Painter 实例
  76762. */
  76763. this.painter = painter;
  76764. /**
  76765. * @member {number} [LevelRenderer.Handler.prototype._lastX=0]
  76766. * @description 上一次鼠标位置x坐标值
  76767. */
  76768. this._lastX = 0;
  76769. /**
  76770. * @member {number} [LevelRenderer.Handler.prototype._lastY=0]
  76771. * @description 上一次鼠标位置y坐标值
  76772. */
  76773. this._lastY = 0;
  76774. /**
  76775. * @member {number} [LevelRenderer.Handler.prototype._mouseX=0]
  76776. * @description 当前鼠标位置x坐标值
  76777. */
  76778. this._mouseX = 0;
  76779. /**
  76780. * @member {number} [LevelRenderer.Handler.prototype._mouseY=0]
  76781. * @description 当前鼠标位置y坐标值
  76782. */
  76783. this._mouseY = 0;
  76784. /**
  76785. * @member {function} LevelRenderer.Handler.prototype._findHover
  76786. * @description 查找 Hover 图形
  76787. */
  76788. this._findHover = null;
  76789. /**
  76790. * @member {Object} LevelRenderer.Handler.prototype._domHover
  76791. * @description 高亮 DOM
  76792. */
  76793. this._domHover = null;
  76794. // 各种事件标识的私有变量
  76795. // this._hasfound = false; // 是否找到 hover 图形元素
  76796. // this._lastHover = null; // 最后一个 hover 图形元素
  76797. // this._mouseDownTarget = null;
  76798. // this._draggingTarget = null; // 当前被拖拽的图形元素
  76799. // this._isMouseDown = false;
  76800. // this._isDragging = false;
  76801. // this._lastMouseDownMoment;
  76802. // this._lastTouchMoment;
  76803. // this._lastDownButton;
  76804. this._findHover = bind3Arg(findHover, this);
  76805. this._domHover = painter.getDomHover();
  76806. this.CLASS_NAME = "SuperMap.LevelRenderer.Handler";
  76807. var domHandlers = {
  76808. /**
  76809. * Method: resize
  76810. * 窗口大小改变响应函数。
  76811. *
  76812. * Parameters:
  76813. * event - {Event} event。
  76814. *
  76815. */
  76816. resize: function (event) {
  76817. event = event || window.event;
  76818. this._lastHover = null;
  76819. this._isMouseDown = 0;
  76820. // 分发SuperMap.LevelRenderer.Config.EVENT.RESIZE事件,global
  76821. this.dispatch(Config_Config.EVENT.RESIZE, event);
  76822. },
  76823. /**
  76824. * Method: click
  76825. * 点击响应函数。
  76826. *
  76827. * Parameters:
  76828. * event - {Event} event。
  76829. *
  76830. */
  76831. click: function (event) {
  76832. event = this._zrenderEventFixed(event);
  76833. // 分发SuperMap.LevelRenderer.Config.EVENT.CLICK事件
  76834. var _lastHover = this._lastHover;
  76835. if ((_lastHover && _lastHover.clickable)
  76836. || !_lastHover
  76837. ) {
  76838. // 判断没有发生拖拽才触发click事件
  76839. if (this._clickThreshold < 10) {
  76840. this._dispatchAgency(_lastHover, Config_Config.EVENT.CLICK, event);
  76841. }
  76842. }
  76843. this._mousemoveHandler(event);
  76844. },
  76845. /**
  76846. * Method: dblclick
  76847. * 双击响应函数。
  76848. *
  76849. * Parameters:
  76850. * event - {Event} event。
  76851. *
  76852. */
  76853. dblclick: function (event) {
  76854. event = event || window.event;
  76855. event = this._zrenderEventFixed(event);
  76856. // 分发SuperMap.LevelRenderer.Config.EVENT.DBLCLICK事件
  76857. var _lastHover = this._lastHover;
  76858. if ((_lastHover && _lastHover.clickable)
  76859. || !_lastHover
  76860. ) {
  76861. // 判断没有发生拖拽才触发dblclick事件
  76862. if (this._clickThreshold < 5) {
  76863. this._dispatchAgency(_lastHover, Config_Config.EVENT.DBLCLICK, event);
  76864. }
  76865. }
  76866. this._mousemoveHandler(event);
  76867. },
  76868. /**
  76869. * Method: mousewheel
  76870. * 鼠标滚轮响应函数。
  76871. *
  76872. * Parameters:
  76873. * event - {Event} event。
  76874. *
  76875. */
  76876. mousewheel: function (event) {
  76877. event = this._zrenderEventFixed(event);
  76878. // http://www.sitepoint.com/html5-javascript-mouse-wheel/
  76879. // https://developer.mozilla.org/en-US/docs/DOM/DOM_event_reference/mousewheel
  76880. var delta = event.wheelDelta // Webkit
  76881. || -event.detail; // Firefox
  76882. var scale = delta > 0 ? 1.1 : 1 / 1.1;
  76883. var layers = this.painter.getLayers();
  76884. var needsRefresh = false;
  76885. for (var z in layers) {
  76886. if (z !== 'hover') {
  76887. var layer = layers[z];
  76888. var pos = layer.position;
  76889. if (layer.zoomable) {
  76890. layer.__zoom = layer.__zoom || 1;
  76891. var newZoom = layer.__zoom;
  76892. newZoom *= scale;
  76893. newZoom = Math.max(
  76894. Math.min(layer.maxZoom, newZoom),
  76895. layer.minZoom
  76896. );
  76897. scale = newZoom / layer.__zoom;
  76898. layer.__zoom = newZoom;
  76899. // Keep the mouse center when scaling
  76900. pos[0] -= (this._mouseX - pos[0]) * (scale - 1);
  76901. pos[1] -= (this._mouseY - pos[1]) * (scale - 1);
  76902. layer.scale[0] *= scale;
  76903. layer.scale[1] *= scale;
  76904. layer.dirty = true;
  76905. needsRefresh = true;
  76906. }
  76907. }
  76908. }
  76909. if (needsRefresh) {
  76910. this.painter.refresh();
  76911. }
  76912. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEWHEEL事件
  76913. this._dispatchAgency(this._lastHover, Config_Config.EVENT.MOUSEWHEEL, event);
  76914. this._mousemoveHandler(event);
  76915. },
  76916. /**
  76917. * Method: mousemove
  76918. * 鼠标(手指)移动响应函数。
  76919. *
  76920. * Parameters:
  76921. * event - {Event} event。
  76922. *
  76923. */
  76924. mousemove: function (event) {
  76925. // 拖拽不触发click事件
  76926. this._clickThreshold++;
  76927. event = this._zrenderEventFixed(event);
  76928. this._lastX = this._mouseX;
  76929. this._lastY = this._mouseY;
  76930. this._mouseX = SUtil_SUtil.Util_event.getX(event);
  76931. this._mouseY = SUtil_SUtil.Util_event.getY(event);
  76932. var dx = this._mouseX - this._lastX;
  76933. var dy = this._mouseY - this._lastY;
  76934. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGSTART事件
  76935. // 避免手抖点击误认为拖拽
  76936. // if (this._mouseX - this._lastX > 1 || this._mouseY - this._lastY > 1) {
  76937. this._processDragStart(event);
  76938. // }
  76939. this._hasfound = 0;
  76940. this._event = event;
  76941. this._iterateAndFindHover();
  76942. // 找到的在迭代函数里做了处理,没找到得在迭代完后处理
  76943. if (!this._hasfound) {
  76944. // 过滤首次拖拽产生的mouseout和dragLeave
  76945. if (!this._draggingTarget
  76946. || (this._lastHover && this._lastHover != this._draggingTarget)
  76947. ) {
  76948. // 可能出现SuperMap.LevelRenderer.Config.EVENT.MOUSEOUT事件
  76949. this._processOutShape(event);
  76950. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGLEAVE事件
  76951. this._processDragLeave(event);
  76952. }
  76953. this._lastHover = null;
  76954. this.storage.delHover();
  76955. this.painter.clearHover();
  76956. }
  76957. // set cursor for root element
  76958. var cursor = '';
  76959. // 如果存在拖拽中元素,被拖拽的图形元素最后addHover
  76960. if (this._draggingTarget) {
  76961. this.storage.drift(this._draggingTarget.id, dx, dy);
  76962. this._draggingTarget.modSelf();
  76963. this.storage.addHover(this._draggingTarget);
  76964. } else if (this._isMouseDown) {
  76965. // Layer dragging
  76966. var layers = this.painter.getLayers();
  76967. var needsRefresh = false;
  76968. for (var z in layers) {
  76969. if (z !== 'hover') {
  76970. var layer = layers[z];
  76971. if (layer.panable) {
  76972. // PENDING
  76973. cursor = 'move';
  76974. // Keep the mouse center when scaling
  76975. layer.position[0] += dx;
  76976. layer.position[1] += dy;
  76977. needsRefresh = true;
  76978. layer.dirty = true;
  76979. }
  76980. }
  76981. }
  76982. if (needsRefresh) {
  76983. this.painter.refresh();
  76984. }
  76985. }
  76986. if (this._draggingTarget || (this._hasfound && this._lastHover.draggable)) {
  76987. cursor = 'move';
  76988. } else if (this._hasfound && this._lastHover.clickable) {
  76989. cursor = 'pointer';
  76990. }
  76991. this.root.style.cursor = cursor;
  76992. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEMOVE事件
  76993. this._dispatchAgency(this._lastHover, Config_Config.EVENT.MOUSEMOVE, event);
  76994. if (this._draggingTarget || this._hasfound || this.storage.hasHoverShape()) {
  76995. this.painter.refreshHover();
  76996. }
  76997. },
  76998. /**
  76999. * Method: mouseout
  77000. * 鼠标(手指)离开响应函数。
  77001. *
  77002. * Parameters:
  77003. * event - {Event} event。
  77004. *
  77005. */
  77006. mouseout: function (event) {
  77007. event = this._zrenderEventFixed(event);
  77008. var element = event.toElement || event.relatedTarget;
  77009. if (element != this.root) {
  77010. while (element && element.nodeType != 9) {
  77011. // 忽略包含在root中的dom引起的mouseOut
  77012. if (element == this.root) {
  77013. this._mousemoveHandler(event);
  77014. return;
  77015. }
  77016. element = element.parentNode;
  77017. }
  77018. }
  77019. event.zrenderX = this._lastX;
  77020. event.zrenderY = this._lastY;
  77021. this.root.style.cursor = '';
  77022. this._isMouseDown = 0;
  77023. this._processOutShape(event);
  77024. this._processDrop(event);
  77025. this._processDragEnd(event);
  77026. this.painter.refreshHover();
  77027. this.dispatch(Config_Config.EVENT.GLOBALOUT, event);
  77028. },
  77029. /**
  77030. * Method: mousedown
  77031. * 鼠标(手指)按下响应函数。
  77032. *
  77033. * Parameters:
  77034. * event - {Event} event。
  77035. *
  77036. */
  77037. mousedown: function (event) {
  77038. // 重置 clickThreshold
  77039. this._clickThreshold = 0;
  77040. if (this._lastDownButton == 2) {
  77041. this._lastDownButton = event.button;
  77042. this._mouseDownTarget = null;
  77043. // 仅作为关闭右键菜单使用
  77044. return;
  77045. }
  77046. this._lastMouseDownMoment = new Date();
  77047. event = this._zrenderEventFixed(event);
  77048. this._isMouseDown = 1;
  77049. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEDOWN事件
  77050. this._mouseDownTarget = this._lastHover;
  77051. this._dispatchAgency(this._lastHover, Config_Config.EVENT.MOUSEDOWN, event);
  77052. this._lastDownButton = event.button;
  77053. },
  77054. /**
  77055. * Method: mouseup
  77056. * 鼠标(手指)抬起响应函数。
  77057. *
  77058. * Parameters:
  77059. * event - {Event} event。
  77060. *
  77061. */
  77062. mouseup: function (event) {
  77063. event = this._zrenderEventFixed(event);
  77064. this.root.style.cursor = '';
  77065. this._isMouseDown = 0;
  77066. this._mouseDownTarget = null;
  77067. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEUP事件
  77068. this._dispatchAgency(this._lastHover, Config_Config.EVENT.MOUSEUP, event);
  77069. this._processDrop(event);
  77070. this._processDragEnd(event);
  77071. },
  77072. /**
  77073. * Method: touchstart
  77074. * Touch 开始响应函数。
  77075. *
  77076. * Parameters:
  77077. * event - {Event} event。
  77078. *
  77079. */
  77080. touchstart: function (event) {
  77081. // SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
  77082. event = this._zrenderEventFixed(event, true);
  77083. this._lastTouchMoment = new Date();
  77084. // 平板补充一次findHover
  77085. this._mobildFindFixed(event);
  77086. this._mousedownHandler(event);
  77087. },
  77088. /**
  77089. * Method: touchmove
  77090. * Touch 移动响应函数。
  77091. *
  77092. * Parameters:
  77093. * event - {Event} event。
  77094. *
  77095. */
  77096. touchmove: function (event) {
  77097. event = this._zrenderEventFixed(event, true);
  77098. this._mousemoveHandler(event);
  77099. if (this._isDragging) {
  77100. SUtil_SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
  77101. }
  77102. },
  77103. /**
  77104. * Method: touchend
  77105. * Touch 结束响应函数。
  77106. *
  77107. * Parameters:
  77108. * event - {Event} event。
  77109. *
  77110. */
  77111. touchend: function (event) {
  77112. // SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
  77113. event = this._zrenderEventFixed(event, true);
  77114. this._mouseupHandler(event);
  77115. var now = new Date();
  77116. if (now - this._lastTouchMoment < Config_Config.EVENT.touchClickDelay) {
  77117. this._mobildFindFixed(event);
  77118. this._clickHandler(event);
  77119. if (now - this._lastClickMoment < Config_Config.EVENT.touchClickDelay / 2) {
  77120. this._dblclickHandler(event);
  77121. if (this._lastHover && this._lastHover.clickable) {
  77122. SUtil_SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
  77123. }
  77124. }
  77125. this._lastClickMoment = now;
  77126. }
  77127. this.painter.clearHover();
  77128. }
  77129. };
  77130. initDomHandler(this);
  77131. // 初始化,事件绑定,支持的所有事件都由如下原生事件计算得来
  77132. if (window.addEventListener) {
  77133. window.addEventListener('resize', this._resizeHandler);
  77134. if (SUtil_SUtil.Util_env.os.tablet || SUtil_SUtil.Util_env.os.phone) {
  77135. // mobile支持
  77136. root.addEventListener('touchstart', this._touchstartHandler);
  77137. root.addEventListener('touchmove', this._touchmoveHandler);
  77138. root.addEventListener('touchend', this._touchendHandler);
  77139. } else {
  77140. // mobile的click/move/up/down自己模拟
  77141. root.addEventListener('click', this._clickHandler);
  77142. root.addEventListener('dblclick', this._dblclickHandler);
  77143. root.addEventListener('mousewheel', this._mousewheelHandler);
  77144. root.addEventListener('mousemove', this._mousemoveHandler);
  77145. root.addEventListener('mousedown', this._mousedownHandler);
  77146. root.addEventListener('mouseup', this._mouseupHandler);
  77147. }
  77148. root.addEventListener('DOMMouseScroll', this._mousewheelHandler);
  77149. root.addEventListener('mouseout', this._mouseoutHandler);
  77150. } else {
  77151. window.attachEvent('onresize', this._resizeHandler);
  77152. root.attachEvent('onclick', this._clickHandler);
  77153. //root.attachEvent('ondblclick ', this._dblclickHandler);
  77154. root.ondblclick = this._dblclickHandler;
  77155. root.attachEvent('onmousewheel', this._mousewheelHandler);
  77156. root.attachEvent('onmousemove', this._mousemoveHandler);
  77157. root.attachEvent('onmouseout', this._mouseoutHandler);
  77158. root.attachEvent('onmousedown', this._mousedownHandler);
  77159. root.attachEvent('onmouseup', this._mouseupHandler);
  77160. }
  77161. // 辅助函数 start
  77162. /**
  77163. * Method: bind1Arg
  77164. * bind 一个参数的 function。
  77165. *
  77166. * Parameters:
  77167. * handler - {function} 要 bind 的 function。
  77168. * context - {Object} 运行时 this 环境。
  77169. *
  77170. * Returns:
  77171. * {function}
  77172. */
  77173. function bind1Arg(handler, context) {
  77174. return function (e) {
  77175. return handler.call(context, e);
  77176. };
  77177. }
  77178. /*
  77179. // bind 两个参数的 function
  77180. function bind2Arg(handler, context) {
  77181. return function (arg1, arg2) {
  77182. return handler.call(context, arg1, arg2);
  77183. };
  77184. }
  77185. */
  77186. // bind 三个参数的 function
  77187. function bind3Arg(handler, context) {
  77188. return function (arg1, arg2, arg3) {
  77189. return handler.call(context, arg1, arg2, arg3);
  77190. };
  77191. }
  77192. /**
  77193. * Method: initDomHandler
  77194. * 为控制类实例初始化 dom 事件处理函数。
  77195. *
  77196. * Parameters:
  77197. * instance - {<LevelRenderer.Handler>} 控制类实例 。
  77198. *
  77199. * Returns:
  77200. * {function}
  77201. */
  77202. function initDomHandler(instance) {
  77203. var domHandlerNames = [
  77204. 'resize', 'click', 'dblclick',
  77205. 'mousewheel', 'mousemove', 'mouseout', 'mouseup', 'mousedown',
  77206. 'touchstart', 'touchend', 'touchmove'
  77207. ];
  77208. var len = domHandlerNames.length;
  77209. while (len--) {
  77210. var name = domHandlerNames[len];
  77211. instance['_' + name + 'Handler'] = bind1Arg(domHandlers[name], instance);
  77212. }
  77213. }
  77214. /**
  77215. * Method: findHover
  77216. * 迭代函数,查找 hover 到的图形元素并即时做些事件分发。
  77217. *
  77218. * Parameters:
  77219. * shape - {Object} 图形。
  77220. * x - {number} 鼠标 x。
  77221. * y - {number} 鼠标 y。
  77222. *
  77223. * Returns:
  77224. * {boolean} 是否找到图形。
  77225. *
  77226. */
  77227. function findHover(shape, x, y) {
  77228. var me = this;
  77229. if (
  77230. (me._draggingTarget && me._draggingTarget.id == shape.id) // 迭代到当前拖拽的图形上
  77231. || shape.isSilent() // 打酱油的路过,啥都不响应的shape~
  77232. ) {
  77233. return false;
  77234. }
  77235. var event = me._event;
  77236. if (shape.isCover(x, y)) {
  77237. if (shape.hoverable) {
  77238. // SMIC-修改 - start
  77239. if (shape.isHoverByRefDataID && shape.isHoverByRefDataID === true) {
  77240. if (shape.refDataID) {
  77241. var fid = shape.refDataID;
  77242. //me.painter.clearHover();
  77243. //me.storage.delHover();
  77244. var hoverGroup = null;
  77245. if (shape.refDataHoverGroup) {
  77246. hoverGroup = shape.refDataHoverGroup;
  77247. }
  77248. //查找同一个用户数据 feature 的所有图形
  77249. var shapeList = me.storage._shapeList;
  77250. for (var i = 0, len = shapeList.length; i < len; i++) {
  77251. var si = shapeList[i];
  77252. if (si.refDataID && fid === si.refDataID) {
  77253. if (hoverGroup) {
  77254. if (si.refDataHoverGroup && hoverGroup === si.refDataHoverGroup) {
  77255. me.storage.addHover(si);
  77256. }
  77257. } else {
  77258. me.storage.addHover(si);
  77259. }
  77260. }
  77261. }
  77262. }
  77263. } else {
  77264. me.storage.addHover(shape);
  77265. }
  77266. //初始代码:
  77267. // me.storage.addHover(shape);
  77268. // SMIC-修改 - end
  77269. }
  77270. // 查找是否在 clipShape 中
  77271. var p = shape.parent;
  77272. while (p) {
  77273. if (p.clipShape && !p.clipShape.isCover(me._mouseX, me._mouseY)) {
  77274. // 已经被祖先 clip 掉了
  77275. return false;
  77276. }
  77277. p = p.parent;
  77278. }
  77279. if (me._lastHover != shape) {
  77280. me._processOutShape(event);
  77281. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGLEAVE事件
  77282. me._processDragLeave(event);
  77283. me._lastHover = shape;
  77284. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGENTER事件
  77285. me._processDragEnter(event);
  77286. }
  77287. me._processOverShape(event);
  77288. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGOVER
  77289. me._processDragOver(event);
  77290. me._hasfound = 1;
  77291. return true; // 找到则中断迭代查找
  77292. }
  77293. return false;
  77294. }
  77295. // 辅助函数 end
  77296. }
  77297. /**
  77298. * @function LevelRenderer.Handler.prototype.destroy
  77299. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为null。
  77300. */
  77301. destroy() {
  77302. this.dispose();
  77303. this._lastX = null;
  77304. this._lastY = null;
  77305. this._mouseX = null;
  77306. this._mouseY = null;
  77307. this._findHover = null;
  77308. Eventful.prototype.destroy.apply(this, arguments);
  77309. }
  77310. /**
  77311. * @function LevelRenderer.Handler.prototype.on
  77312. * @description 自定义事件绑定。
  77313. * @param {string} eventName - 事件名称,resize、hover、drag等。
  77314. * @param {function} handler - 响应函数。
  77315. * @returns {LevelRenderer.Handler} this。
  77316. */
  77317. on(eventName, handler) {
  77318. this.bind(eventName, handler);
  77319. return this;
  77320. }
  77321. /**
  77322. * @function LevelRenderer.Handler.prototype.un
  77323. * @description 自定义事件解除绑定。
  77324. * @param {string} eventName - 事件名称,resize、hover、drag等。
  77325. * @param {function} handler - 响应函数。
  77326. * @returns {LevelRenderer.Handler} this。
  77327. */
  77328. un(eventName, handler) {
  77329. this.unbind(eventName, handler);
  77330. return this;
  77331. }
  77332. /**
  77333. * @function LevelRenderer.Handler.prototype.trigger
  77334. * @description 事件触发。
  77335. * @param {string} eventName - 事件名称,resize、hover、drag等。
  77336. * @param {event} eventArgs - dom事件对象。
  77337. */
  77338. trigger(eventName, eventArgs) {
  77339. var EVENT = Config_Config.EVENT;
  77340. switch (eventName) {
  77341. case EVENT.RESIZE:
  77342. case EVENT.CLICK:
  77343. case EVENT.DBLCLICK:
  77344. case EVENT.MOUSEWHEEL:
  77345. case EVENT.MOUSEMOVE:
  77346. case EVENT.MOUSEDOWN:
  77347. case EVENT.MOUSEUP:
  77348. case EVENT.MOUSEOUT:
  77349. this['_' + eventName + 'Handler'](eventArgs);
  77350. break;
  77351. }
  77352. }
  77353. /**
  77354. * @function LevelRenderer.Handler.prototype.dispose
  77355. * @description 释放,解绑所有事件。
  77356. */
  77357. dispose() {
  77358. var root = this.root;
  77359. if (window.removeEventListener) {
  77360. window.removeEventListener('resize', this._resizeHandler);
  77361. if (SUtil_SUtil.Util_env.os.tablet || SUtil_SUtil.Util_env.os.phone) {
  77362. // mobile支持
  77363. root.removeEventListener('touchstart', this._touchstartHandler);
  77364. root.removeEventListener('touchmove', this._touchmoveHandler);
  77365. root.removeEventListener('touchend', this._touchendHandler);
  77366. } else {
  77367. // mobile的click自己模拟
  77368. root.removeEventListener('click', this._clickHandler);
  77369. root.removeEventListener('dblclick', this._dblclickHandler);
  77370. root.removeEventListener('mousewheel', this._mousewheelHandler);
  77371. root.removeEventListener('mousemove', this._mousemoveHandler);
  77372. root.removeEventListener('mousedown', this._mousedownHandler);
  77373. root.removeEventListener('mouseup', this._mouseupHandler);
  77374. }
  77375. root.removeEventListener('DOMMouseScroll', this._mousewheelHandler);
  77376. root.removeEventListener('mouseout', this._mouseoutHandler);
  77377. } else {
  77378. window.detachEvent('onresize', this._resizeHandler);
  77379. root.detachEvent('onclick', this._clickHandler);
  77380. root.detachEvent('dblclick', this._dblclickHandler);
  77381. root.detachEvent('onmousewheel', this._mousewheelHandler);
  77382. root.detachEvent('onmousemove', this._mousemoveHandler);
  77383. root.detachEvent('onmouseout', this._mouseoutHandler);
  77384. root.detachEvent('onmousedown', this._mousedownHandler);
  77385. root.detachEvent('onmouseup', this._mouseupHandler);
  77386. }
  77387. this.root = null;
  77388. this._domHover = null;
  77389. this.storage = null;
  77390. this.painter = null;
  77391. this.un();
  77392. }
  77393. /**
  77394. * Method: _processDragStart
  77395. * 拖拽开始。
  77396. *
  77397. * Parameters:
  77398. * event - {Object} 事件对象。
  77399. *
  77400. */
  77401. _processDragStart(event) {
  77402. var _lastHover = this._lastHover;
  77403. if (this._isMouseDown
  77404. && _lastHover
  77405. && _lastHover.draggable
  77406. && !this._draggingTarget
  77407. && this._mouseDownTarget == _lastHover
  77408. ) {
  77409. // 拖拽点击生效时长阀门,某些场景需要降低拖拽敏感度
  77410. if (_lastHover.dragEnableTime &&
  77411. new Date() - this._lastMouseDownMoment < _lastHover.dragEnableTime
  77412. ) {
  77413. return;
  77414. }
  77415. var _draggingTarget = _lastHover;
  77416. this._draggingTarget = _draggingTarget;
  77417. this._isDragging = 1;
  77418. _draggingTarget.invisible = true;
  77419. this.storage.mod(_draggingTarget.id);
  77420. // 分发 Config.EVENT.DRAGSTART事件
  77421. this._dispatchAgency(
  77422. _draggingTarget,
  77423. Config_Config.EVENT.DRAGSTART,
  77424. event
  77425. );
  77426. this.painter.refresh();
  77427. }
  77428. }
  77429. /**
  77430. * Method: _processDragEnter
  77431. * 拖拽进入目标元素。
  77432. *
  77433. * Parameters:
  77434. * event - {Object} 事件对象。
  77435. *
  77436. */
  77437. _processDragEnter(event) {
  77438. if (this._draggingTarget) {
  77439. // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGENTER事件
  77440. this._dispatchAgency(
  77441. this._lastHover,
  77442. Config_Config.EVENT.DRAGENTER,
  77443. event,
  77444. this._draggingTarget
  77445. );
  77446. }
  77447. }
  77448. /**
  77449. * Method: _processDragOver
  77450. * 拖拽在目标元素上移动。
  77451. *
  77452. * Parameters:
  77453. * event - {Object} 事件对象。
  77454. *
  77455. */
  77456. _processDragOver(event) {
  77457. if (this._draggingTarget) {
  77458. // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGOVER事件
  77459. this._dispatchAgency(
  77460. this._lastHover,
  77461. Config_Config.EVENT.DRAGOVER,
  77462. event,
  77463. this._draggingTarget
  77464. );
  77465. }
  77466. }
  77467. /**
  77468. * Method: _processDragLeave
  77469. * 拖拽离开目标元素。
  77470. *
  77471. * Parameters:
  77472. * event - {Object} 事件对象。
  77473. *
  77474. */
  77475. _processDragLeave(event) {
  77476. if (this._draggingTarget) {
  77477. // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGLEAVE事件
  77478. this._dispatchAgency(
  77479. this._lastHover,
  77480. Config_Config.EVENT.DRAGLEAVE,
  77481. event,
  77482. this._draggingTarget
  77483. );
  77484. }
  77485. }
  77486. /**
  77487. * Method: _processDrop
  77488. * 拖拽在目标元素上完成。
  77489. *
  77490. * Parameters:
  77491. * event - {Object} 事件对象。
  77492. *
  77493. */
  77494. _processDrop(event) {
  77495. if (this._draggingTarget) {
  77496. this._draggingTarget.invisible = false;
  77497. this.storage.mod(this._draggingTarget.id);
  77498. this.painter.refresh();
  77499. // 分发SuperMap.LevelRenderer.Config.EVENT.DROP事件
  77500. this._dispatchAgency(
  77501. this._lastHover,
  77502. Config_Config.EVENT.DROP,
  77503. event,
  77504. this._draggingTarget
  77505. );
  77506. }
  77507. }
  77508. /**
  77509. * Method: _processDragEnd
  77510. * 拖拽结束。
  77511. *
  77512. * Parameters:
  77513. * event - {Object} 事件对象。
  77514. *
  77515. */
  77516. _processDragEnd(event) {
  77517. if (this._draggingTarget) {
  77518. // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGEND事件
  77519. this._dispatchAgency(
  77520. this._draggingTarget,
  77521. Config_Config.EVENT.DRAGEND,
  77522. event
  77523. );
  77524. this._lastHover = null;
  77525. }
  77526. this._isDragging = 0;
  77527. this._draggingTarget = null;
  77528. }
  77529. /**
  77530. * Method: _processOverShape
  77531. * 鼠标在某个图形元素上移动。
  77532. *
  77533. * Parameters:
  77534. * event - {Object} 事件对象。
  77535. *
  77536. */
  77537. _processOverShape(event) {
  77538. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEOVER事件
  77539. this._dispatchAgency(this._lastHover, Config_Config.EVENT.MOUSEOVER, event);
  77540. }
  77541. /**
  77542. * Method: _processOutShape
  77543. * 鼠标离开某个图形元素。
  77544. *
  77545. * Parameters:
  77546. * event - {Object} 事件对象。
  77547. *
  77548. */
  77549. _processOutShape(event) {
  77550. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEOUT事件
  77551. this._dispatchAgency(this._lastHover, Config_Config.EVENT.MOUSEOUT, event);
  77552. }
  77553. /**
  77554. * Method: _dispatchAgency
  77555. * 鼠标离开某个图形元素。
  77556. *
  77557. * Parameters:
  77558. * targetShape - {Object} 目标图形元素。
  77559. * eventName - {Object} 事件名称。
  77560. * event - {Object} 事件对象。
  77561. * draggedShape - {Object} 拖拽事件特有,当前被拖拽图形元素。
  77562. *
  77563. */
  77564. _dispatchAgency(targetShape, eventName, event, draggedShape) {
  77565. var eventHandler = 'on' + eventName;
  77566. var eventPacket = {
  77567. type: eventName,
  77568. event: event,
  77569. target: targetShape,
  77570. cancelBubble: false
  77571. };
  77572. var el = targetShape;
  77573. if (draggedShape) {
  77574. eventPacket.dragged = draggedShape;
  77575. }
  77576. while (el) {
  77577. el[eventHandler]
  77578. && (eventPacket.cancelBubble = el[eventHandler](eventPacket));
  77579. el.dispatch(eventName, eventPacket);
  77580. el = el.parent;
  77581. if (eventPacket.cancelBubble) {
  77582. break;
  77583. }
  77584. }
  77585. if (targetShape) {
  77586. // 冒泡到顶级 zrender 对象
  77587. if (!eventPacket.cancelBubble) {
  77588. this.dispatch(eventName, eventPacket);
  77589. }
  77590. } else if (!draggedShape) {
  77591. // 无hover目标,无拖拽对象,原生事件分发
  77592. this.dispatch(eventName, {
  77593. type: eventName,
  77594. event: event
  77595. });
  77596. }
  77597. }
  77598. /**
  77599. * Method: _iterateAndFindHover
  77600. * 迭代寻找 hover shape。
  77601. *
  77602. */
  77603. _iterateAndFindHover() {
  77604. var invTransform = SUtil_SUtil.Util_matrix.create();
  77605. var list = this.storage.getShapeList();
  77606. var currentZLevel;
  77607. var currentLayer;
  77608. var tmp = [0, 0];
  77609. for (var i = list.length - 1; i >= 0; i--) {
  77610. var shape = list[i];
  77611. if (currentZLevel !== shape.zlevel) {
  77612. currentLayer = this.painter.getLayer(shape.zlevel, currentLayer);
  77613. tmp[0] = this._mouseX;
  77614. tmp[1] = this._mouseY;
  77615. if (currentLayer.needTransform) {
  77616. SUtil_SUtil.Util_matrix.invert(invTransform, currentLayer.transform);
  77617. SUtil_SUtil.Util_vector.applyTransform(tmp, tmp, invTransform);
  77618. }
  77619. }
  77620. if (this._findHover(shape, tmp[0], tmp[1])) {
  77621. break;
  77622. }
  77623. }
  77624. }
  77625. /**
  77626. * Method: _mobildFindFixed
  77627. * touch 有指尖错觉,四向尝试,让touch上的点击更好触发事件。
  77628. *
  77629. * Parameters:
  77630. * event - {Object} 事件对象。
  77631. *
  77632. */
  77633. _mobildFindFixed(event) {
  77634. // touch指尖错觉的尝试偏移量配置
  77635. var MOBILE_TOUCH_OFFSETS = [
  77636. {x: 10},
  77637. {x: -20},
  77638. {x: 10, y: 10},
  77639. {y: -20}
  77640. ];
  77641. this._lastHover = null;
  77642. this._mouseX = event.zrenderX;
  77643. this._mouseY = event.zrenderY;
  77644. this._event = event;
  77645. this._iterateAndFindHover();
  77646. for (var i = 0; !this._lastHover && i < MOBILE_TOUCH_OFFSETS.length; i++) {
  77647. var offset = MOBILE_TOUCH_OFFSETS[i];
  77648. offset.x && (this._mouseX += offset.x);
  77649. offset.y && (this._mouseX += offset.y);
  77650. this._iterateAndFindHover();
  77651. }
  77652. if (this._lastHover) {
  77653. event.zrenderX = this._mouseX;
  77654. event.zrenderY = this._mouseY;
  77655. }
  77656. }
  77657. /**
  77658. * Method: _zrenderEventFixed
  77659. * 如果存在第三方嵌入的一些dom触发的事件,或touch事件,需要转换一下事件坐标 。
  77660. *
  77661. * Parameters:
  77662. * event - {Object} 事件。
  77663. * isTouch - {boolean} 是否触摸。
  77664. *
  77665. */
  77666. _zrenderEventFixed(event, isTouch) {
  77667. if (event.zrenderFixed) {
  77668. return event;
  77669. }
  77670. if (!isTouch) {
  77671. event = event || window.event;
  77672. // 进入对象优先~
  77673. var target = event.toElement
  77674. || event.relatedTarget
  77675. || event.srcElement
  77676. || event.target;
  77677. if (target && target != this._domHover) {
  77678. event.zrenderX = (typeof event.offsetX != 'undefined'
  77679. ? event.offsetX
  77680. : event.layerX)
  77681. + target.offsetLeft;
  77682. event.zrenderY = (typeof event.offsetY != 'undefined'
  77683. ? event.offsetY
  77684. : event.layerY)
  77685. + target.offsetTop;
  77686. }
  77687. } else {
  77688. var touch = event.type != 'touchend'
  77689. ? event.targetTouches[0]
  77690. : event.changedTouches[0];
  77691. if (touch) {
  77692. var rBounding = this.root.getBoundingClientRect();
  77693. // touch事件坐标是全屏的~
  77694. event.zrenderX = touch.clientX - rBounding.left;
  77695. event.zrenderY = touch.clientY - rBounding.top;
  77696. }
  77697. }
  77698. event.zrenderFixed = 1;
  77699. return event;
  77700. }
  77701. // SMIC-方法扩展 - start
  77702. /**
  77703. * @function LevelRenderer.Handler.prototype.getLastHoverOne
  77704. * @description 获取单个高亮图形
  77705. */
  77706. getLastHoverOne() {
  77707. if (this._lastHover) {
  77708. return this._lastHover;
  77709. }
  77710. return null;
  77711. }
  77712. // SMIC-方法扩展 - end
  77713. }
  77714. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Easing.js
  77715. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  77716. * This program are made available under the terms of the Apache License, Version 2.0
  77717. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  77718. /**
  77719. * @class LevelRenderer.Animation.easing
  77720. * @category Visualization Theme
  77721. * @classdesc 缓动
  77722. * @private
  77723. */
  77724. // 缓动代码来自 https://github.com/sole/tween.js/blob/master/src/Tween.js
  77725. // http://sole.github.io/tween.js/examples/03_graphs.html
  77726. class Easing {
  77727. constructor() {
  77728. this.CLASS_NAME = "SuperMap.LevelRenderer.Animation.easing";
  77729. }
  77730. /**
  77731. * @function LevelRenderer.Animation.easing.destroy
  77732. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  77733. */
  77734. destroy() {
  77735. }
  77736. /**
  77737. * @function LevelRenderer.Animation.easing.Linear
  77738. * @description 线性缓动
  77739. * @param {number} k - 参数
  77740. * @return {number} 输入值
  77741. */
  77742. Linear(k) {
  77743. return k;
  77744. }
  77745. /**
  77746. * @function LevelRenderer.Animation.easing.QuadraticIn
  77747. * @description 二次方的缓动(t^2)
  77748. * @param {number} k - 参数
  77749. * @return {number} 二次方的缓动的值
  77750. */
  77751. QuadraticIn(k) {
  77752. return k * k;
  77753. }
  77754. /**
  77755. * @function LevelRenderer.Animation.easing.QuadraticOut
  77756. * @description 返回按二次方缓动退出的值
  77757. * @param {number} k - 参数
  77758. * @return {number} 按二次方缓动退出的值
  77759. */
  77760. QuadraticOut(k) {
  77761. return k * (2 - k);
  77762. }
  77763. /**
  77764. * @function LevelRenderer.Animation.easing.QuadraticInOut
  77765. * @description 返回按二次方缓动进入和退出的值
  77766. * @param {number} k - 参数
  77767. * @return {number} 按二次方缓动进入和退出的值
  77768. */
  77769. QuadraticInOut(k) {
  77770. if ((k *= 2) < 1) {
  77771. return 0.5 * k * k;
  77772. }
  77773. return -0.5 * (--k * (k - 2) - 1);
  77774. }
  77775. /**
  77776. * @function LevelRenderer.Animation.easing.CubicIn
  77777. * @description 三次方的缓动(t^3)
  77778. * @param {number} k - 参数
  77779. * @return {number} 按三次方缓动的值
  77780. */
  77781. CubicIn(k) {
  77782. return k * k * k;
  77783. }
  77784. /**
  77785. * @function LevelRenderer.Animation.easing.CubicOut
  77786. * @description 返回按三次方缓动退出的值
  77787. * @param {number} k - 参数
  77788. * @return {number} 按三次方缓动退出的值
  77789. */
  77790. CubicOut(k) {
  77791. return --k * k * k + 1;
  77792. }
  77793. /**
  77794. * @function LevelRenderer.Animation.easing.CubicInOut
  77795. * @description 返回按三次方缓动进入退出的值
  77796. * @param {number} k - 参数
  77797. * @return {number} 按三次方缓动进入退出的值
  77798. */
  77799. CubicInOut(k) {
  77800. if ((k *= 2) < 1) {
  77801. return 0.5 * k * k * k;
  77802. }
  77803. return 0.5 * ((k -= 2) * k * k + 2);
  77804. }
  77805. /**
  77806. * @function LevelRenderer.Animation.easing.QuarticIn
  77807. * @description 返回按四次方缓动进入的值
  77808. * @param {number} k - 参数
  77809. * @return {number} 按四次方缓动进入的值
  77810. */
  77811. QuarticIn(k) {
  77812. return k * k * k * k;
  77813. }
  77814. /**
  77815. * @function LevelRenderer.Animation.easing.QuarticOut
  77816. * @description 返回按四次方缓动退出的值
  77817. * @param {number} k - 参数
  77818. * @return {number} 按四次方缓动退出的值
  77819. */
  77820. QuarticOut(k) {
  77821. return 1 - (--k * k * k * k);
  77822. }
  77823. /**
  77824. * @function LevelRenderer.Animation.easing.QuarticInOut
  77825. * @description 返回按四次方缓动进入退出的值
  77826. * @param {number} k - 参数
  77827. * @return {number} 按四次方缓动进入退出的值
  77828. */
  77829. QuarticInOut(k) {
  77830. if ((k *= 2) < 1) {
  77831. return 0.5 * k * k * k * k;
  77832. }
  77833. return -0.5 * ((k -= 2) * k * k * k - 2);
  77834. }
  77835. // 五次方的缓动(t^5)
  77836. /**
  77837. * @function LevelRenderer.Animation.easing.QuinticIn
  77838. * @description 返回按五次方缓动的值
  77839. * @param {number} k - 参数
  77840. * @return {number} 按五次方缓动的值
  77841. */
  77842. QuinticIn(k) {
  77843. return k * k * k * k * k;
  77844. }
  77845. /**
  77846. * @function LevelRenderer.Animation.easing.QuinticOut
  77847. * @description 返回按五次方缓动退出的值
  77848. * @param {number} k - 参数
  77849. * @return {number} 按五次方缓动退出的值
  77850. */
  77851. QuinticOut(k) {
  77852. return --k * k * k * k * k + 1;
  77853. }
  77854. /**
  77855. * @function LevelRenderer.Animation.easing.QuinticInOut
  77856. * @description 返回按五次方缓动进入退出的值
  77857. * @param {number} k - 参数
  77858. * @return {number} 按五次方缓动进入退出的值
  77859. */
  77860. QuinticInOut(k) {
  77861. if ((k *= 2) < 1) {
  77862. return 0.5 * k * k * k * k * k;
  77863. }
  77864. return 0.5 * ((k -= 2) * k * k * k * k + 2);
  77865. }
  77866. // 正弦曲线的缓动(sin(t))
  77867. /**
  77868. * @function LevelRenderer.Animation.easing.SinusoidalIn
  77869. * @description 返回按正弦曲线的缓动进入的值
  77870. * @param {number} k - 参数
  77871. * @return {number} 按正弦曲线的缓动进入的值
  77872. */
  77873. SinusoidalIn(k) {
  77874. return 1 - Math.cos(k * Math.PI / 2);
  77875. }
  77876. /**
  77877. * @function LevelRenderer.Animation.easing.SinusoidalOut
  77878. * @description 返回按正弦曲线的缓动退出的值
  77879. * @param {number} k - 参数
  77880. * @return {number} 按正弦曲线的缓动退出的值
  77881. */
  77882. SinusoidalOut(k) {
  77883. return Math.sin(k * Math.PI / 2);
  77884. }
  77885. /**
  77886. * @function LevelRenderer.Animation.easing.SinusoidalInOut
  77887. * @description 返回按正弦曲线的缓动进入退出的值
  77888. * @param {number} k - 参数
  77889. * @return {number} 按正弦曲线的缓动进入退出的值
  77890. */
  77891. SinusoidalInOut(k) {
  77892. return 0.5 * (1 - Math.cos(Math.PI * k));
  77893. }
  77894. // 指数曲线的缓动(2^t)
  77895. /**
  77896. * @function LevelRenderer.Animation.easing.ExponentialIn
  77897. * @description 返回按指数曲线的缓动进入的值
  77898. * @param {number} k - 参数
  77899. * @return {number} 按指数曲线的缓动进入的值
  77900. */
  77901. ExponentialIn(k) {
  77902. return k === 0 ? 0 : Math.pow(1024, k - 1);
  77903. }
  77904. /**
  77905. * @function LevelRenderer.Animation.easing.ExponentialOut
  77906. * @description 返回按指数曲线的缓动退出的值
  77907. * @param {number} k - 参数
  77908. * @return {number} 按指数曲线的缓动退出的值
  77909. */
  77910. ExponentialOut(k) {
  77911. return k === 1 ? 1 : 1 - Math.pow(2, -10 * k);
  77912. }
  77913. /**
  77914. * @function LevelRenderer.Animation.easing.ExponentialInOut
  77915. * @description 返回按指数曲线的缓动进入退出的值
  77916. * @param {number} k - 参数
  77917. * @return {number} 按指数曲线的缓动进入退出的值
  77918. */
  77919. ExponentialInOut(k) {
  77920. if (k === 0) {
  77921. return 0;
  77922. }
  77923. if (k === 1) {
  77924. return 1;
  77925. }
  77926. if ((k *= 2) < 1) {
  77927. return 0.5 * Math.pow(1024, k - 1);
  77928. }
  77929. return 0.5 * (-Math.pow(2, -10 * (k - 1)) + 2);
  77930. }
  77931. // 圆形曲线的缓动(sqrt(1-t^2))
  77932. /**
  77933. * @function LevelRenderer.Animation.easing.CircularIn
  77934. * @description 返回按圆形曲线的缓动进入的值
  77935. * @param {number} k - 参数
  77936. * @return {number} 按圆形曲线的缓动进入的值
  77937. */
  77938. CircularIn(k) {
  77939. return 1 - Math.sqrt(1 - k * k);
  77940. }
  77941. /**
  77942. * @function LevelRenderer.Animation.easing.CircularOut
  77943. * @description 返回按圆形曲线的缓动退出的值
  77944. * @param {number} k - 参数
  77945. * @return {number} 按圆形曲线的缓动退出的值
  77946. */
  77947. CircularOut(k) {
  77948. return Math.sqrt(1 - (--k * k));
  77949. }
  77950. /**
  77951. * @function LevelRenderer.Animation.easing.CircularInOut
  77952. * @description 返回按圆形曲线的缓动进入退出的值
  77953. * @param {number} k - 参数
  77954. * @return {number} 按圆形曲线的缓动进入退出的值
  77955. */
  77956. CircularInOut(k) {
  77957. if ((k *= 2) < 1) {
  77958. return -0.5 * (Math.sqrt(1 - k * k) - 1);
  77959. }
  77960. return 0.5 * (Math.sqrt(1 - (k -= 2) * k) + 1);
  77961. }
  77962. // 创建类似于弹簧在停止前来回振荡的动画
  77963. /**
  77964. * @function LevelRenderer.Animation.easing.ElasticIn
  77965. * @description 返回按类似于弹簧在停止前来回振荡的动画的缓动进入的值
  77966. * @param {number} k - 参数
  77967. * @return {number} 按类似于弹簧在停止前来回振荡的动画的缓动进入的值
  77968. */
  77969. ElasticIn(k) {
  77970. var s;
  77971. var a = 0.1;
  77972. var p = 0.4;
  77973. if (k === 0) {
  77974. return 0;
  77975. }
  77976. if (k === 1) {
  77977. return 1;
  77978. }
  77979. if (a < 1) {
  77980. a = 1;
  77981. s = p / 4;
  77982. } else {
  77983. s = p * Math.asin(1 / a) / (2 * Math.PI);
  77984. }
  77985. return -(a * Math.pow(2, 10 * (k -= 1)) *
  77986. Math.sin((k - s) * (2 * Math.PI) / p));
  77987. }
  77988. /**
  77989. * @function LevelRenderer.Animation.easing.ElasticOut
  77990. * @description 返回按类似于弹簧在停止前来回振荡的动画的缓动退出的值
  77991. * @param {number} k - 参数
  77992. * @return {number} 按类似于弹簧在停止前来回振荡的动画的缓动退出的值
  77993. */
  77994. ElasticOut(k) {
  77995. var s;
  77996. var a = 0.1;
  77997. var p = 0.4;
  77998. if (k === 0) {
  77999. return 0;
  78000. }
  78001. if (k === 1) {
  78002. return 1;
  78003. }
  78004. if (a < 1) {
  78005. a = 1;
  78006. s = p / 4;
  78007. } else {
  78008. s = p * Math.asin(1 / a) / (2 * Math.PI);
  78009. }
  78010. return (a * Math.pow(2, -10 * k) *
  78011. Math.sin((k - s) * (2 * Math.PI) / p) + 1);
  78012. }
  78013. /**
  78014. * @function LevelRenderer.Animation.easing.ElasticInOut
  78015. * @description 返回按类似于弹簧在停止前来回振荡的动画的缓动进入退出的值
  78016. * @param {number} k - 参数
  78017. * @return {number} 按类似于弹簧在停止前来回振荡的动画的缓动进入退出的值
  78018. */
  78019. ElasticInOut(k) {
  78020. var s;
  78021. var a = 0.1;
  78022. var p = 0.4;
  78023. if (k === 0) {
  78024. return 0;
  78025. }
  78026. if (k === 1) {
  78027. return 1;
  78028. }
  78029. if (a < 1) {
  78030. a = 1;
  78031. s = p / 4;
  78032. } else {
  78033. s = p * Math.asin(1 / a) / (2 * Math.PI);
  78034. }
  78035. if ((k *= 2) < 1) {
  78036. return -0.5 * (a * Math.pow(2, 10 * (k -= 1))
  78037. * Math.sin((k - s) * (2 * Math.PI) / p));
  78038. }
  78039. return a * Math.pow(2, -10 * (k -= 1))
  78040. * Math.sin((k - s) * (2 * Math.PI) / p) * 0.5 + 1;
  78041. }
  78042. // 在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动
  78043. /**
  78044. * @function LevelRenderer.Animation.easing.BackIn
  78045. * @description 返回按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入的值
  78046. * @param {number} k - 参数
  78047. * @return {number} 按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入的值
  78048. */
  78049. BackIn(k) {
  78050. var s = 1.70158;
  78051. return k * k * ((s + 1) * k - s);
  78052. }
  78053. /**
  78054. * @function LevelRenderer.Animation.easing.BackOut
  78055. * @description 返回按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动退出的值
  78056. * @param {number} k - 参数
  78057. * @return {number} 按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动退出的值
  78058. */
  78059. BackOut(k) {
  78060. var s = 1.70158;
  78061. return --k * k * ((s + 1) * k + s) + 1;
  78062. }
  78063. /**
  78064. * @function LevelRenderer.Animation.easing.BackInOut
  78065. * @description 返回按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入退出的值
  78066. * @param {number} k - 参数
  78067. * @return {number} 按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入退出的值
  78068. */
  78069. BackInOut(k) {
  78070. var s = 1.70158 * 1.525;
  78071. if ((k *= 2) < 1) {
  78072. return 0.5 * (k * k * ((s + 1) * k - s));
  78073. }
  78074. return 0.5 * ((k -= 2) * k * ((s + 1) * k + s) + 2);
  78075. }
  78076. // 创建弹跳效果
  78077. /**
  78078. * @function LevelRenderer.Animation.easing.BounceIn
  78079. * @description 返回按弹跳效果的缓动进入的值
  78080. * @param {number} k - 参数
  78081. * @return {number} 按弹跳效果的缓动进入的值
  78082. */
  78083. BounceIn(k) {
  78084. return 1 - this.BounceOut(1 - k);
  78085. }
  78086. /**
  78087. * @function LevelRenderer.Animation.easing.BounceOut
  78088. * @description 返回按弹跳效果的缓动退出的值
  78089. * @param {number} k - 参数
  78090. * @return {number} 按弹跳效果的缓动退出的值
  78091. */
  78092. BounceOut(k) {
  78093. if (k < (1 / 2.75)) {
  78094. return 7.5625 * k * k;
  78095. } else if (k < (2 / 2.75)) {
  78096. return 7.5625 * (k -= (1.5 / 2.75)) * k + 0.75;
  78097. } else if (k < (2.5 / 2.75)) {
  78098. return 7.5625 * (k -= (2.25 / 2.75)) * k + 0.9375;
  78099. } else {
  78100. return 7.5625 * (k -= (2.625 / 2.75)) * k + 0.984375;
  78101. }
  78102. }
  78103. /**
  78104. * @function LevelRenderer.Animation.easing.BounceInOut
  78105. * @description 返回按弹跳效果的缓动进入退出的值
  78106. * @param {number} k - 参数
  78107. * @return {number} 按弹跳效果的缓动进入退出的值
  78108. */
  78109. BounceInOut(k) {
  78110. if (k < 0.5) {
  78111. return this.BounceIn(k * 2) * 0.5;
  78112. }
  78113. return this.BounceOut(k * 2 - 1) * 0.5 + 0.5;
  78114. }
  78115. }
  78116. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Clip.js
  78117. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  78118. * This program are made available under the terms of the Apache License, Version 2.0
  78119. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  78120. /**
  78121. * @class LevelRenderer.Animation.Clip
  78122. * @category Visualization Theme
  78123. * @classdesc 动画片段
  78124. * @param {Object} options - 参数。
  78125. * @param {Object} options.target - 动画对象,可以是数组,如果是数组的话会批量分发 onframe 等事件。
  78126. * @param {number} [options.life=1000] - 动画时长。
  78127. * @param {number} [options.delay=0] - 动画延迟时间。
  78128. * @param {boolean} [options.loop=true] - 是否循环。
  78129. * @param {number} [options.gap=0] - 循环的间隔时间。
  78130. * @param {Object} options.onframe - 帧。
  78131. * @param {boolean} options.easing - 是否消除。
  78132. * @param {boolean} options.ondestroy - 是否销毁。
  78133. * @param {boolean} options.onrestart - 是否重播。
  78134. * @private
  78135. */
  78136. class Clip {
  78137. constructor(options) {
  78138. this._targetPool = options.target || {};
  78139. if (!(this._targetPool instanceof Array)) {
  78140. this._targetPool = [this._targetPool];
  78141. }
  78142. // 生命周期
  78143. this._life = options.life || 1000;
  78144. // 延时
  78145. this._delay = options.delay || 0;
  78146. // 开始时间
  78147. this._startTime = new Date().getTime() + this._delay;// 单位毫秒
  78148. // 结束时间
  78149. this._endTime = this._startTime + this._life * 1000;
  78150. // 是否循环
  78151. this.loop = typeof options.loop == 'undefined'
  78152. ? false : options.loop;
  78153. this.gap = options.gap || 0;
  78154. this.easing = options.easing || 'Linear';
  78155. this.onframe = options.onframe;
  78156. this.ondestroy = options.ondestroy;
  78157. this.onrestart = options.onrestart;
  78158. this.CLASS_NAME = "SuperMap.LevelRenderer.Animation.Clip";
  78159. }
  78160. /**
  78161. * @function LevelRenderer.Animation.Clip.prototype.destroy
  78162. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  78163. */
  78164. destroy() {
  78165. }
  78166. step(time) {
  78167. var easing = new Easing();
  78168. var percent = (time - this._startTime) / this._life;
  78169. // 还没开始
  78170. if (percent < 0) {
  78171. return;
  78172. }
  78173. percent = Math.min(percent, 1);
  78174. var easingFunc = typeof this.easing == 'string'
  78175. ? easing[this.easing]
  78176. : this.easing;
  78177. var schedule = typeof easingFunc === 'function'
  78178. ? easingFunc(percent)
  78179. : percent;
  78180. this.fire('frame', schedule);
  78181. // 结束
  78182. if (percent == 1) {
  78183. if (this.loop) {
  78184. this.restart();
  78185. // 重新开始周期
  78186. // 抛出而不是直接调用事件直到 stage.update 后再统一调用这些事件
  78187. return 'restart';
  78188. }
  78189. // 动画完成将这个控制器标识为待删除
  78190. // 在Animation.update中进行批量删除
  78191. this._needsRemove = true;
  78192. return 'destroy';
  78193. }
  78194. return null;
  78195. }
  78196. restart() {
  78197. var time = new Date().getTime();
  78198. var remainder = (time - this._startTime) % this._life;
  78199. this._startTime = new Date().getTime() - remainder + this.gap;
  78200. }
  78201. fire(eventType, arg) {
  78202. for (var i = 0, len = this._targetPool.length; i < len; i++) {
  78203. if (this['on' + eventType]) {
  78204. this['on' + eventType](this._targetPool[i], arg);
  78205. }
  78206. }
  78207. }
  78208. }
  78209. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Animation.js
  78210. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  78211. * This program are made available under the terms of the Apache License, Version 2.0
  78212. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  78213. /**
  78214. * @class LevelRenderer.Animation
  78215. * @classdesc 动画主类, 调度和管理所有动画控制器
  78216. * @category Visualization Theme
  78217. * @extends {LevelRenderer.Eventful}
  78218. * @param {Object} options - 动画参数。
  78219. * @param {Object} options.onframe - onframe。
  78220. * @param {Object} options.stage - stage。
  78221. * @example 例如:
  78222. * (start code)
  78223. * var animation = new LevelRenderer.Animation();
  78224. * var obj = {
  78225. * x: 100,
  78226. * y: 100
  78227. * };
  78228. * animation.animate(node.position)
  78229. * .when(1000, {
  78230. * x: 500,
  78231. * y: 500
  78232. * })
  78233. * .when(2000, {
  78234. * x: 100,
  78235. * y: 100
  78236. * })
  78237. * .start('spline');
  78238. * (end)
  78239. * @private
  78240. */
  78241. class Animation extends Eventful {
  78242. constructor(options) {
  78243. super(options);
  78244. options = options || {};
  78245. /**
  78246. * @member {Object} LevelRenderer.Animation.prototype.stage
  78247. * @description stage。
  78248. */
  78249. this.stage = {};
  78250. /**
  78251. * @member {Object} LevelRenderer.Animation.prototype.onframe
  78252. * @description onframe。
  78253. */
  78254. this.onframe = function () {
  78255. };
  78256. /**
  78257. * @member {Array} LevelRenderer.Animation.prototype._clips
  78258. * @description _clips。
  78259. */
  78260. this._clips = [];
  78261. /**
  78262. * @member {boolean} LevelRenderer.Animation.prototype._running
  78263. * @description _running。
  78264. */
  78265. this._running = false;
  78266. /**
  78267. * @member {number} LevelRenderer.Animation.prototype._time
  78268. * @description _time。
  78269. */
  78270. this._time = 0;
  78271. Util_Util.extend(this, options);
  78272. this.CLASS_NAME = "SuperMap.LevelRenderer.Animation";
  78273. }
  78274. /**
  78275. * @function LevelRenderer.Animation.prototype.add
  78276. * @description 添加动画片段。
  78277. * @param {LevelRenderer.Animation.Clip} clip - 动画片段。
  78278. */
  78279. add(clip) {
  78280. this._clips.push(clip);
  78281. }
  78282. /**
  78283. * @function LevelRenderer.Animation.prototype.remove
  78284. * @description 删除动画片段。
  78285. * @param {LevelRenderer.Animation.Clip} clip - 动画片段。
  78286. */
  78287. remove(clip) {
  78288. var idx = new levelRenderer_Util_Util().indexOf(this._clips, clip);
  78289. if (idx >= 0) {
  78290. this._clips.splice(idx, 1);
  78291. }
  78292. }
  78293. /**
  78294. * @function LevelRenderer.Animation.prototype.update
  78295. * @description 更新动画片段。
  78296. */
  78297. _update() {
  78298. var time = new Date().getTime();
  78299. var delta = time - this._time;
  78300. var clips = this._clips;
  78301. var len = clips.length;
  78302. var deferredEvents = [];
  78303. var deferredClips = [];
  78304. for (let i = 0; i < len; i++) {
  78305. var clip = clips[i];
  78306. var e = clip.step(time);
  78307. // Throw out the events need to be called after
  78308. // stage.update, like destroy
  78309. if (e) {
  78310. deferredEvents.push(e);
  78311. deferredClips.push(clip);
  78312. }
  78313. }
  78314. if (this.stage.update) {
  78315. this.stage.update();
  78316. }
  78317. // Remove the finished clip
  78318. for (let i = 0; i < len;) {
  78319. if (clips[i]._needsRemove) {
  78320. clips[i] = clips[len - 1];
  78321. clips.pop();
  78322. len--;
  78323. } else {
  78324. i++;
  78325. }
  78326. }
  78327. len = deferredEvents.length;
  78328. for (let i = 0; i < len; i++) {
  78329. deferredClips[i].fire(deferredEvents[i]);
  78330. }
  78331. this._time = time;
  78332. this.onframe(delta);
  78333. this.dispatch('frame', delta);
  78334. }
  78335. /**
  78336. * @function LevelRenderer.Animation.prototype.start
  78337. * @description 开始运行动画。
  78338. */
  78339. start() {
  78340. var requestAnimationFrame = window.requestAnimationFrame
  78341. || window.msRequestAnimationFrame
  78342. || window.mozRequestAnimationFrame
  78343. || window.webkitRequestAnimationFrame
  78344. || function (func) {
  78345. setTimeout(func, 16);
  78346. };
  78347. var self = this;
  78348. this._running = true;
  78349. function step() {
  78350. if (self._running) {
  78351. self._update();
  78352. requestAnimationFrame(step);
  78353. }
  78354. }
  78355. this._time = new Date().getTime();
  78356. requestAnimationFrame(step);
  78357. }
  78358. /**
  78359. * @function LevelRenderer.Animation.prototype.stop
  78360. * @description 停止运行动画。
  78361. */
  78362. stop() {
  78363. this._running = false;
  78364. }
  78365. /**
  78366. * @function LevelRenderer.Animation.prototype.clear
  78367. * @description 清除所有动画片段。
  78368. */
  78369. clear() {
  78370. this._clips = [];
  78371. }
  78372. /**
  78373. * @function LevelRenderer.Animation.prototype.animate
  78374. * @description 对一个目标创建一个animator对象,可以指定目标中的属性使用动画。
  78375. * @param {Object} target - 目标对象。
  78376. * @param {Object} options - 动画参数选项。
  78377. * @param {boolean} [options.loop=false] - 是否循环播放动画。
  78378. * @param {function} [options.getter] - 如果指定getter函数,会通过getter函数取属性值。
  78379. * @param {function} [options.setter] - 如果指定setter函数,会通过setter函数设置属性值。
  78380. * @returns {LevelRenderer.Animation.Animator} Animator。
  78381. */
  78382. animate(target, options) {
  78383. options = options || {};
  78384. var deferred = new Animator(
  78385. target,
  78386. options.loop,
  78387. options.getter,
  78388. options.setter
  78389. );
  78390. deferred.animation = this;
  78391. return deferred;
  78392. }
  78393. static _interpolateNumber(p0, p1, percent) {
  78394. return (p1 - p0) * percent + p0;
  78395. }
  78396. static _interpolateArray(p0, p1, percent, out, arrDim) {
  78397. var len = p0.length;
  78398. if (arrDim == 1) {
  78399. for (let i = 0; i < len; i++) {
  78400. out[i] = Animation._interpolateNumber(p0[i], p1[i], percent);
  78401. }
  78402. } else {
  78403. var len2 = p0[0].length;
  78404. for (let i = 0; i < len; i++) {
  78405. for (let j = 0; j < len2; j++) {
  78406. out[i][j] = Animation._interpolateNumber(
  78407. p0[i][j], p1[i][j], percent
  78408. );
  78409. }
  78410. }
  78411. }
  78412. }
  78413. static _isArrayLike(data) {
  78414. switch (typeof data) {
  78415. case 'undefined':
  78416. case 'string':
  78417. return false;
  78418. }
  78419. return typeof data.length !== 'undefined';
  78420. }
  78421. static _catmullRomInterpolateArray(p0, p1, p2, p3, t, t2, t3, out, arrDim) {
  78422. var len = p0.length;
  78423. if (arrDim == 1) {
  78424. for (let i = 0; i < len; i++) {
  78425. out[i] = Animation._catmullRomInterpolate(
  78426. p0[i], p1[i], p2[i], p3[i], t, t2, t3
  78427. );
  78428. }
  78429. } else {
  78430. var len2 = p0[0].length;
  78431. for (let i = 0; i < len; i++) {
  78432. for (var j = 0; j < len2; j++) {
  78433. out[i][j] = Animation._catmullRomInterpolate(
  78434. p0[i][j], p1[i][j], p2[i][j], p3[i][j],
  78435. t, t2, t3
  78436. );
  78437. }
  78438. }
  78439. }
  78440. }
  78441. static _catmullRomInterpolate(p0, p1, p2, p3, t, t2, t3) {
  78442. var v0 = (p2 - p0) * 0.5;
  78443. var v1 = (p3 - p1) * 0.5;
  78444. return (2 * (p1 - p2) + v0 + v1) * t3
  78445. + (-3 * (p1 - p2) - 2 * v0 - v1) * t2
  78446. + v0 * t + p1;
  78447. }
  78448. static _cloneValue(value) {
  78449. var arraySlice = Array.prototype.slice;
  78450. if (Animation._isArrayLike(value)) {
  78451. var len = value.length;
  78452. if (Animation._isArrayLike(value[0])) {
  78453. var ret = [];
  78454. for (var i = 0; i < len; i++) {
  78455. ret.push(arraySlice.call(value[i]));
  78456. }
  78457. return ret;
  78458. } else {
  78459. return arraySlice.call(value);
  78460. }
  78461. } else {
  78462. return value;
  78463. }
  78464. }
  78465. static rgba2String(rgba) {
  78466. rgba[0] = Math.floor(rgba[0]);
  78467. rgba[1] = Math.floor(rgba[1]);
  78468. rgba[2] = Math.floor(rgba[2]);
  78469. return 'rgba(' + rgba.join(',') + ')';
  78470. }
  78471. }
  78472. /**
  78473. * @class LevelRenderer.Animation.Animator
  78474. */
  78475. class Animator {
  78476. /**
  78477. * @function LevelRenderer.Animation.Animator.prototype.animate
  78478. * @description 构造函数
  78479. * @param {Object} target - 目标对象。
  78480. * @param {Object} options - 动画参数选项。
  78481. * @param {boolean} [loop=false] - 是否循环播放动画。
  78482. * @param {function} [getterl] - 如果指定getter函数,会通过getter函数取属性值。
  78483. * @param {function} [setter] - 如果指定setter函数,会通过setter函数设置属性值。
  78484. */
  78485. constructor(target, loop, getter, setter) {
  78486. /**
  78487. * @member {Object} LevelRenderer.Animation.Animator.prototype._tracks
  78488. * @description _tracks。
  78489. */
  78490. this._tracks = {};
  78491. /**
  78492. * @member {Object} LevelRenderer.Animation.Animator.prototype._target
  78493. * @description _target。
  78494. */
  78495. this._target = target;
  78496. /**
  78497. * @member {boolean} LevelRenderer.Animation.Animator.prototype._loop
  78498. * @description _loop。
  78499. */
  78500. this._loop = loop || false;
  78501. /**
  78502. * @member {function} LevelRenderer.Animation.Animator.prototype._getter
  78503. * @description _getter。
  78504. */
  78505. this._getter = getter || _defaultGetter;
  78506. /**
  78507. * @member {function} LevelRenderer.Animation.Animator.prototype._setter
  78508. * @description _setter。
  78509. */
  78510. this._setter = setter || _defaultSetter;
  78511. /**
  78512. * @member {number} LevelRenderer.Animation.Animator.prototype._clipCount
  78513. * @description _clipCount。
  78514. */
  78515. this._clipCount = 0;
  78516. /**
  78517. * @member {number} LevelRenderer.Animation.Animator.prototype._delay
  78518. * @description _delay。
  78519. */
  78520. this._delay = 0;
  78521. /**
  78522. * @member {Array} LevelRenderer.Animation.Animator.prototype._doneList
  78523. * @description _doneList。
  78524. */
  78525. this._doneList = [];
  78526. /**
  78527. * @member {Array} LevelRenderer.Animation.Animator.prototype._onframeList
  78528. * @description _onframeList。
  78529. */
  78530. this._onframeList = [];
  78531. /**
  78532. * @member {Array} LevelRenderer.Animation.Animator.prototype._clipList
  78533. * @description _clipList。
  78534. */
  78535. this._clipList = [];
  78536. this.CLASS_NAME = "SuperMap.LevelRenderer.Animation.Animator";
  78537. //Function
  78538. function _defaultGetter(target, key) {
  78539. return target[key];
  78540. }
  78541. function _defaultSetter(target, key, value) {
  78542. target[key] = value;
  78543. }
  78544. }
  78545. /**
  78546. * @function LevelRenderer.Animation.Animator.prototype.when
  78547. * @description 设置动画关键帧
  78548. * @param {number} time - 关键帧时间,单位是ms
  78549. * @param {Object} props - 关键帧的属性值,key-value表示
  78550. * @returns {LevelRenderer.Animation.Animator} Animator
  78551. */
  78552. when(time /* ms */, props) {
  78553. for (var propName in props) {
  78554. if (!this._tracks[propName]) {
  78555. this._tracks[propName] = [];
  78556. // If time is 0
  78557. // Then props is given initialize value
  78558. // Else
  78559. // Initialize value from current prop value
  78560. if (time !== 0) {
  78561. this._tracks[propName].push({
  78562. time: 0,
  78563. value: Animation._cloneValue(
  78564. this._getter(this._target, propName)
  78565. )
  78566. });
  78567. }
  78568. }
  78569. this._tracks[propName].push({
  78570. time: parseInt(time, 10),
  78571. value: props[propName]
  78572. });
  78573. }
  78574. return this;
  78575. }
  78576. /**
  78577. * @function LevelRenderer.Animation.Animator.prototype.during
  78578. * @description 添加动画每一帧的回调函数
  78579. * @param {RequestCallback} callback - 回调函数
  78580. * @returns {LevelRenderer.Animation.Animator} Animator
  78581. */
  78582. during(callback) {
  78583. this._onframeList.push(callback);
  78584. return this;
  78585. }
  78586. /**
  78587. * @function LevelRenderer.Animation.Animator.prototype.start
  78588. * @description 开始执行动画
  78589. * @param {(string|function)} easing - 动画缓动函数。详见:<{@link LevelRenderer.Animation.easing}>。
  78590. * @returns {LevelRenderer.Animation.Animator} Animator
  78591. */
  78592. start(easing) {
  78593. var self = this;
  78594. var setter = this._setter;
  78595. var getter = this._getter;
  78596. var onFrameListLen = self._onframeList.length;
  78597. var useSpline = easing === 'spline';
  78598. var ondestroy = function () {
  78599. self._clipCount--;
  78600. if (self._clipCount === 0) {
  78601. // Clear all tracks
  78602. self._tracks = {};
  78603. var len = self._doneList.length;
  78604. for (var i = 0; i < len; i++) {
  78605. self._doneList[i].call(self);
  78606. }
  78607. }
  78608. };
  78609. var createTrackClip = function (keyframes, propName) {
  78610. var trackLen = keyframes.length;
  78611. if (!trackLen) {
  78612. return;
  78613. }
  78614. // Guess data type
  78615. var firstVal = keyframes[0].value;
  78616. var isValueArray = Animation._isArrayLike(firstVal);
  78617. var isValueColor = false;
  78618. // For vertices morphing
  78619. var arrDim = (
  78620. isValueArray
  78621. && Animation._isArrayLike(firstVal[0])
  78622. )
  78623. ? 2 : 1;
  78624. // Sort keyframe as ascending
  78625. keyframes.sort(function (a, b) {
  78626. return a.time - b.time;
  78627. });
  78628. var trackMaxTime = keyframes[trackLen - 1].time;
  78629. // Percents of each keyframe
  78630. var kfPercents = [];
  78631. // Value of each keyframe
  78632. var kfValues = [];
  78633. for (let i = 0; i < trackLen; i++) {
  78634. kfPercents.push(keyframes[i].time / trackMaxTime);
  78635. // Assume value is a color when it is a string
  78636. var value = keyframes[i].value;
  78637. if (typeof(value) == 'string') {
  78638. value = SUtil_SUtil.Util_color.toArray(value);
  78639. if (value.length === 0) { // Invalid color
  78640. value[0] = value[1] = value[2] = 0;
  78641. value[3] = 1;
  78642. }
  78643. isValueColor = true;
  78644. }
  78645. kfValues.push(value);
  78646. }
  78647. // Cache the key of last frame to speed up when
  78648. // animation playback is sequency
  78649. var cacheKey = 0;
  78650. var cachePercent = 0;
  78651. var start;
  78652. var i;
  78653. var w;
  78654. var p0;
  78655. var p1;
  78656. var p2;
  78657. var p3;
  78658. if (isValueColor) {
  78659. var rgba = [0, 0, 0, 0];
  78660. }
  78661. var onframe = function (target, percent) {
  78662. // Find the range keyframes
  78663. // kf1-----kf2---------current--------kf3
  78664. // find kf2 and kf3 and do interpolation
  78665. if (percent < cachePercent) {
  78666. // Start from next key
  78667. start = Math.min(cacheKey + 1, trackLen - 1);
  78668. for (i = start; i >= 0; i--) {
  78669. if (kfPercents[i] <= percent) {
  78670. break;
  78671. }
  78672. }
  78673. i = Math.min(i, trackLen - 2);
  78674. } else {
  78675. for (i = cacheKey; i < trackLen; i++) {
  78676. if (kfPercents[i] > percent) {
  78677. break;
  78678. }
  78679. }
  78680. i = Math.min(i - 1, trackLen - 2);
  78681. }
  78682. cacheKey = i;
  78683. cachePercent = percent;
  78684. var range = (kfPercents[i + 1] - kfPercents[i]);
  78685. if (range === 0) {
  78686. return;
  78687. } else {
  78688. w = (percent - kfPercents[i]) / range;
  78689. }
  78690. if (useSpline) {
  78691. p1 = kfValues[i];
  78692. p0 = kfValues[i === 0 ? i : i - 1];
  78693. p2 = kfValues[i > trackLen - 2 ? trackLen - 1 : i + 1];
  78694. p3 = kfValues[i > trackLen - 3 ? trackLen - 1 : i + 2];
  78695. if (isValueArray) {
  78696. Animation._catmullRomInterpolateArray(
  78697. p0, p1, p2, p3, w, w * w, w * w * w,
  78698. getter(target, propName),
  78699. arrDim
  78700. );
  78701. } else {
  78702. let value;
  78703. if (isValueColor) {
  78704. // value = LevelRenderer.Animation._catmullRomInterpolateArray(
  78705. // p0, p1, p2, p3, w, w * w, w * w * w,
  78706. // rgba, 1
  78707. // );
  78708. value = Animation.rgba2String(rgba);
  78709. } else {
  78710. value = Animation._catmullRomInterpolate(
  78711. p0, p1, p2, p3, w, w * w, w * w * w
  78712. );
  78713. }
  78714. setter(
  78715. target,
  78716. propName,
  78717. value
  78718. );
  78719. }
  78720. } else {
  78721. if (isValueArray) {
  78722. Animation._interpolateArray(
  78723. kfValues[i], kfValues[i + 1], w,
  78724. getter(target, propName),
  78725. arrDim
  78726. );
  78727. } else {
  78728. let value;
  78729. if (isValueColor) {
  78730. Animation._interpolateArray(
  78731. kfValues[i], kfValues[i + 1], w,
  78732. rgba, 1
  78733. );
  78734. value = Animation.rgba2String(rgba);
  78735. } else {
  78736. value = Animation._interpolateNumber(kfValues[i], kfValues[i + 1], w);
  78737. }
  78738. setter(
  78739. target,
  78740. propName,
  78741. value
  78742. );
  78743. }
  78744. }
  78745. for (i = 0; i < onFrameListLen; i++) {
  78746. self._onframeList[i](target, percent);
  78747. }
  78748. };
  78749. var clip = new Clip({
  78750. target: self._target,
  78751. life: trackMaxTime,
  78752. loop: self._loop,
  78753. delay: self._delay,
  78754. onframe: onframe,
  78755. ondestroy: ondestroy
  78756. });
  78757. if (easing && easing !== 'spline') {
  78758. clip.easing = easing;
  78759. }
  78760. self._clipList.push(clip);
  78761. self._clipCount++;
  78762. self.animation.add(clip);
  78763. };
  78764. for (var propName in this._tracks) {
  78765. createTrackClip(this._tracks[propName], propName);
  78766. }
  78767. return this;
  78768. }
  78769. /**
  78770. * @function LevelRenderer.Animation.Animator.prototype.stop
  78771. * @description 停止动画
  78772. */
  78773. stop() {
  78774. for (var i = 0; i < this._clipList.length; i++) {
  78775. var clip = this._clipList[i];
  78776. this.animation.remove(clip);
  78777. }
  78778. this._clipList = [];
  78779. }
  78780. /**
  78781. * @function LevelRenderer.Animation.Animator.prototype.delay
  78782. * @description 设置动画延迟开始的时间
  78783. * @param {number} time - 时间,单位ms
  78784. * @returns {LevelRenderer.Animation.Animator} Animator
  78785. */
  78786. delay(time) {
  78787. this._delay = time;
  78788. return this;
  78789. }
  78790. /**
  78791. * @function LevelRenderer.Animation.Animator.prototype.done
  78792. * @description 添加动画结束的回调
  78793. * @param {function} cb - Function
  78794. * @returns {LevelRenderer.Animation.Animator} Animator
  78795. */
  78796. done(cb) {
  78797. if (cb) {
  78798. this._doneList.push(cb);
  78799. }
  78800. return this;
  78801. }
  78802. }
  78803. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Render.js
  78804. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  78805. * This program are made available under the terms of the Apache License, Version 2.0
  78806. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  78807. /**
  78808. * @private
  78809. * @class LevelRenderer.Render
  78810. * @category Visualization Theme
  78811. * @classdesc Render 接口类,对外可用的所有接口都在这里。内部使用非 get 接口统一返回 this 对象,支持链式调用。
  78812. * @param {string} id - 唯一标识。
  78813. * @param {HTMLElement} dom - Dom 对象。
  78814. */
  78815. class Render {
  78816. constructor(id, dom) {
  78817. /**
  78818. * @member {string} LevelRenderer.Render.prototype.id
  78819. * @description 唯一标识。
  78820. */
  78821. this.id = id;
  78822. /**
  78823. * @member {LevelRenderer.Storage} LevelRenderer.Render.prototype.storage
  78824. * @description 图形仓库对象。
  78825. */
  78826. this.storage = new Storage();
  78827. /**
  78828. * @member {LevelRenderer.Painter} LevelRenderer.Render.prototype.painter
  78829. * @description 绘制器对象。
  78830. *
  78831. */
  78832. this.painter = new Painter(dom, this.storage);
  78833. /**
  78834. * @member {LevelRenderer.Handler} LevelRenderer.Render.prototype.handler
  78835. * @description 事件处理对象。
  78836. *
  78837. */
  78838. this.handler = new Handler(dom, this.storage, this.painter);
  78839. /**
  78840. * @member {Array} LevelRenderer.Render.prototype.animatingElements
  78841. * @description 动画控制数组。
  78842. *
  78843. */
  78844. this.animatingElements = [];
  78845. /**
  78846. * @member {LevelRenderer.animation.Animation} LevelRenderer.Render.prototype.animation
  78847. * @description 动画对象。
  78848. *
  78849. */
  78850. this.animation = new Animation({
  78851. stage: {
  78852. update: Render.getFrameCallback(this)
  78853. }
  78854. });
  78855. /**
  78856. * @member {boolean} LevelRenderer.Render.prototype._needsRefreshNextFrame
  78857. * @description 是否需要刷新下一帧。
  78858. *
  78859. */
  78860. this._needsRefreshNextFrame = false;
  78861. this.animation.start();
  78862. this.CLASS_NAME = "SuperMap.LevelRenderer.Render";
  78863. }
  78864. /**
  78865. * @function LevelRenderer.Render.prototype.destory
  78866. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  78867. */
  78868. destroy() {
  78869. this.id = null;
  78870. this.storage = null;
  78871. this.painter = null;
  78872. this.handler = null;
  78873. this.animatingElements = null;
  78874. this.animation = null;
  78875. this._needsRefreshNextFrame = null;
  78876. }
  78877. /**
  78878. * @function LevelRenderer.Render.prototype.getId
  78879. * @description 获取实例唯一标识。
  78880. * @return {string} 实例唯一标识。
  78881. */
  78882. getId() {
  78883. return this.id;
  78884. }
  78885. /**
  78886. * @function LevelRenderer.Render.prototype.addShape
  78887. * @description 添加图形形状到根节点。
  78888. *
  78889. * @param {LevelRenderer.Shape} shape - 图形对象,可用属性全集,详见各 shape。
  78890. * @return {LevelRenderer.Render} this。
  78891. */
  78892. addShape(shape) {
  78893. this.storage.addRoot(shape);
  78894. return this;
  78895. }
  78896. /**
  78897. * @function LevelRenderer.Render.prototype.addGroup
  78898. * @description 添加组到根节点。
  78899. *
  78900. * (code)
  78901. * //添加组到根节点例子
  78902. * var render = new LevelRenderer.Render("Render",document.getElementById('lRendertest'));
  78903. * render.clear();
  78904. * var g = new LevelRenderer.Group();
  78905. * g.addChild(new LevelRenderer.Shape.Circle({
  78906. * style: {
  78907. * x: 100,
  78908. * y: 100,
  78909. * r: 20,
  78910. * brushType: 'fill'
  78911. * }
  78912. * }));
  78913. * render.addGroup(g);
  78914. * render.render();
  78915. * (end)
  78916. *
  78917. * @param {LevelRenderer.Group} group - 组对象。
  78918. * @return {LevelRenderer.Render} this。
  78919. */
  78920. addGroup(group) {
  78921. this.storage.addRoot(group);
  78922. return this;
  78923. }
  78924. /**
  78925. * @function LevelRenderer.Render.prototype.delShape
  78926. * @description 从根节点删除图形形状。
  78927. *
  78928. * @param {string} shapeId - 图形对象唯一标识。
  78929. * @return {LevelRenderer.Render} this。
  78930. */
  78931. delShape(shapeId) {
  78932. this.storage.delRoot(shapeId);
  78933. return this;
  78934. }
  78935. /**
  78936. * @function LevelRenderer.Render.prototype.delGroup
  78937. * @description 从根节点删除组。
  78938. *
  78939. * @param {string} groupId - 组对象唯一标识。
  78940. * @return {LevelRenderer.Render} this。
  78941. */
  78942. delGroup(groupId) {
  78943. this.storage.delRoot(groupId);
  78944. return this;
  78945. }
  78946. /**
  78947. * @function LevelRenderer.Render.prototype.modShape
  78948. * @description 修改图形形状。
  78949. *
  78950. * @param {string} shapeId - 图形对象唯一标识。
  78951. * @param {LevelRenderer.Shape} shape - 图形对象。
  78952. * @return {LevelRenderer.Render} this。
  78953. */
  78954. modShape(shapeId, shape) {
  78955. this.storage.mod(shapeId, shape);
  78956. return this;
  78957. }
  78958. /**
  78959. * @function LevelRenderer.Render.prototype.modGroup
  78960. * @description 修改组。
  78961. *
  78962. * @param {string} groupId - 组对象唯一标识。
  78963. * @param {LevelRenderer.Group} group - 组对象。
  78964. * @return {LevelRenderer.Render} this。
  78965. */
  78966. modGroup(groupId, group) {
  78967. this.storage.mod(groupId, group);
  78968. return this;
  78969. }
  78970. /**
  78971. * @function LevelRenderer.Render.prototype.modLayer
  78972. * @description 修改指定 zlevel 的绘制配置项。
  78973. *
  78974. * @param {string} zLevel - 组对象唯一标识。
  78975. * @param {Object} config - 配置对象。
  78976. * @param {string} clearColor - 每次清空画布的颜色。默认值:0。
  78977. * @param {noolean} motionBlur - 是否开启动态模糊。默认值:false。
  78978. * @param {number} lastFrameAlpha - 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显。默认值:0.7。
  78979. * @param {Array.<number>} position - 层的平移。
  78980. * @param {Array.<number>} rotation - 层的旋转。
  78981. * @param {Array.<number>} scale - 层的缩放。
  78982. * @param {boolean} zoomable - 层是否支持鼠标缩放操作。默认值:false。
  78983. * @param {boolean} panable - 层是否支持鼠标平移操作。默认值:false。
  78984. * @return {LevelRenderer.Render} this。
  78985. */
  78986. modLayer(zLevel, config) {
  78987. this.painter.modLayer(zLevel, config);
  78988. return this;
  78989. }
  78990. /**
  78991. * @function LevelRenderer.Render.prototype.addHoverShape
  78992. * @description 添加额外高亮层显示,仅提供添加方法,每次刷新后高亮层图形均被清空。
  78993. *
  78994. * @param {LevelRenderer.Shape} shape - 图形对象。
  78995. * @return {LevelRenderer.Render} this。
  78996. */
  78997. addHoverShape(shape) {
  78998. this.storage.addHover(shape);
  78999. return this;
  79000. }
  79001. /**
  79002. * @function LevelRenderer.Render.prototype.render
  79003. * @description 渲染。
  79004. *
  79005. * @callback {function} callback - 渲染结束后回调函数。
  79006. * @return {LevelRenderer.Render} this。
  79007. */
  79008. render(callback) {
  79009. this.painter.render(callback);
  79010. this._needsRefreshNextFrame = false;
  79011. return this;
  79012. }
  79013. /**
  79014. * @function LevelRenderer.Render.prototype.refresh
  79015. * @description 视图更新。
  79016. *
  79017. * @callback {function} callback - 视图更新后回调函数。
  79018. * @return {LevelRenderer.Render} this。
  79019. */
  79020. refresh(callback) {
  79021. this.painter.refresh(callback);
  79022. this._needsRefreshNextFrame = false;
  79023. return this;
  79024. }
  79025. /**
  79026. * @function LevelRenderer.Render.prototype.refreshNextFrame
  79027. * @description 标记视图在浏览器下一帧需要绘制。
  79028. * @return {LevelRenderer.Render} this。
  79029. */
  79030. refreshNextFrame() {
  79031. this._needsRefreshNextFrame = true;
  79032. return this;
  79033. }
  79034. /**
  79035. * @function LevelRenderer.Render.prototype.refreshHover
  79036. * @description 绘制(视图更新)高亮层。
  79037. * @callback {function} callback - 视图更新后回调函数。
  79038. * @return {LevelRenderer.Render} this。
  79039. */
  79040. refreshHover(callback) {
  79041. this.painter.refreshHover(callback);
  79042. return this;
  79043. }
  79044. /**
  79045. * @function LevelRenderer.Render.prototype.refreshShapes
  79046. * @description 视图更新。
  79047. *
  79048. * @param {Array.<LevelRenderer.Shape>} shapeList - 需要更新的图形列表。
  79049. * @callback {function} callback - 视图更新后回调函数。
  79050. * @return {LevelRenderer.Render} this。
  79051. */
  79052. refreshShapes(shapeList, callback) {
  79053. this.painter.refreshShapes(shapeList, callback);
  79054. return this;
  79055. }
  79056. /**
  79057. * @function LevelRenderer.Render.prototype.resize
  79058. * @description 调整视图大小。
  79059. * @return {LevelRenderer.Render} this。
  79060. */
  79061. resize() {
  79062. this.painter.resize();
  79063. return this;
  79064. }
  79065. /**
  79066. * @function LevelRenderer.Render.prototype.animate
  79067. * @description 动画。
  79068. *
  79069. * @example
  79070. * zr.animate(circle.id, 'style', false)
  79071. * .when(1000, {x: 10} )
  79072. * .done(function(){ // Animation done })
  79073. * .start()
  79074. *
  79075. *
  79076. * @param {Array.<(LevelRenderer.Shape/LevelRenderer.Group)>} el - 动画对象。
  79077. * @param {string} path - 需要添加动画的属性获取路径,可以通过 a.b.c 来获取深层的属性。若传入对象为<LevelRenderer.Group>,path需为空字符串。
  79078. * @param {function} loop - 动画是否循环。
  79079. * @return {LevelRenderer.animation.Animator} Animator。
  79080. */
  79081. animate(el, path, loop) {
  79082. if (typeof(el) === 'string') {
  79083. el = this.storage.get(el);
  79084. }
  79085. if (el) {
  79086. var target;
  79087. if (path) {
  79088. var pathSplitted = path.split('.');
  79089. var prop = el;
  79090. for (var i = 0, l = pathSplitted.length; i < l; i++) {
  79091. if (!prop) {
  79092. continue;
  79093. }
  79094. prop = prop[pathSplitted[i]];
  79095. }
  79096. if (prop) {
  79097. target = prop;
  79098. }
  79099. } else {
  79100. target = el;
  79101. }
  79102. if (!target) {
  79103. SUtil_SUtil.Util_log(
  79104. 'Property "'
  79105. + path
  79106. + '" is not existed in element '
  79107. + el.id
  79108. );
  79109. return;
  79110. }
  79111. var animatingElements = this.animatingElements;
  79112. if (typeof el.__aniCount === 'undefined') {
  79113. // 正在进行的动画记数
  79114. el.__aniCount = 0;
  79115. }
  79116. if (el.__aniCount === 0) {
  79117. animatingElements.push(el);
  79118. }
  79119. el.__aniCount++;
  79120. return this.animation.animate(target, {loop: loop})
  79121. .done(function () {
  79122. el.__aniCount--;
  79123. if (el.__aniCount === 0) {
  79124. // 从animatingElements里移除
  79125. var idx = new levelRenderer_Util_Util().indexOf(animatingElements, el);
  79126. animatingElements.splice(idx, 1);
  79127. }
  79128. });
  79129. } else {
  79130. SUtil_SUtil.Util_log('Element not existed');
  79131. }
  79132. }
  79133. /**
  79134. * @function LevelRenderer.Render.prototype.clearAnimation
  79135. * @description 停止所有动画。
  79136. *
  79137. */
  79138. clearAnimation() {
  79139. this.animation.clear();
  79140. }
  79141. /**
  79142. * @function LevelRenderer.Render.prototype.getWidth
  79143. * @description 获取视图宽度。
  79144. * @return {number} 视图宽度。
  79145. */
  79146. getWidth() {
  79147. return this.painter.getWidth();
  79148. }
  79149. /**
  79150. * @function LevelRenderer.Render.prototype.getHeight
  79151. * @description 获取视图高度。
  79152. * @return {number} 视图高度。
  79153. */
  79154. getHeight() {
  79155. return this.painter.getHeight();
  79156. }
  79157. /**
  79158. * @function LevelRenderer.Render.prototype.toDataURL
  79159. * @description 图像导出。
  79160. *
  79161. * @param {string} type - 类型。
  79162. * @param {string} backgroundColor - 背景色,默认值:"#FFFFFF"。
  79163. * @param {string} args - 参数。
  79164. * @return {string} 图片的 Base64 url。
  79165. */
  79166. toDataURL(type, backgroundColor, args) {
  79167. return this.painter.toDataURL(type, backgroundColor, args);
  79168. }
  79169. /**
  79170. * @function LevelRenderer.Render.prototype.shapeToImage
  79171. * @description 将常规 shape 转成 image shape。
  79172. *
  79173. * @param {LevelRenderer.Shape} e - 图形。
  79174. * @param {number} width - 宽度。
  79175. * @param {number} height - 高度。
  79176. * @return {Object} image shape。
  79177. */
  79178. shapeToImage(e, width, height) {
  79179. var id = Util_Util.createUniqueID("SuperMap.LevelRenderer.ToImage_");
  79180. return this.painter.shapeToImage(id, e, width, height);
  79181. }
  79182. /**
  79183. * @function LevelRenderer.Render.prototype.on
  79184. * @description 事件绑定。
  79185. *
  79186. * @param {string} eventName - 事件名称。
  79187. * @param {function} eventHandler - 响应函数。
  79188. * @return {LevelRenderer.Render} this。
  79189. */
  79190. on(eventName, eventHandler) {
  79191. this.handler.on(eventName, eventHandler);
  79192. return this;
  79193. }
  79194. /**
  79195. * @function LevelRenderer.Render.prototype.un
  79196. * @description 事件解绑定,参数为空则解绑所有自定义事件。
  79197. *
  79198. * @param {string} eventName - 事件名称。
  79199. * @param {function} eventHandler - 响应函数。
  79200. * @return {LevelRenderer.Render} this。
  79201. */
  79202. un(eventName, eventHandler) {
  79203. this.handler.un(eventName, eventHandler);
  79204. return this;
  79205. }
  79206. /**
  79207. * @function LevelRenderer.Render.prototype.trigger
  79208. * @description 事件触发。
  79209. *
  79210. * @param {string} eventName - 事件名称,resize,hover,drag,etc。
  79211. * @param {event} event - event dom事件对象。
  79212. * @return {LevelRenderer.Render} this。
  79213. */
  79214. trigger(eventName, event) {
  79215. this.handler.trigger(eventName, event);
  79216. this.handler.dispatch(eventName, event);
  79217. return this;
  79218. }
  79219. /**
  79220. * @function LevelRenderer.Render.prototype.clear
  79221. * @description 清除当前 Render 下所有类图的数据和显示,clear 后 MVC 和已绑定事件均还存在在,Render 可用。
  79222. * @return {LevelRenderer.Render} this。
  79223. */
  79224. clear() {
  79225. this.storage.delRoot();
  79226. this.painter.clear();
  79227. return this;
  79228. }
  79229. /**
  79230. * @function LevelRenderer.Render.prototype.dispose
  79231. * @description 释放当前 Render 实例(删除包括 dom,数据、显示和事件绑定),dispose后 Render 不可用。
  79232. */
  79233. dispose() {
  79234. this.animation.stop();
  79235. this.clear();
  79236. this.storage.dispose();
  79237. this.painter.dispose();
  79238. this.handler.dispose();
  79239. this.animation = null;
  79240. this.animatingElements = null;
  79241. this.storage = null;
  79242. this.painter = null;
  79243. this.handler = null;
  79244. // 释放后告诉全局删除对自己的索引,没想到啥好方法
  79245. // zrender.delInstance(this.id);
  79246. }
  79247. // SMIC-方法扩展 - start
  79248. /**
  79249. * @function LevelRenderer.Render.prototype.updateHoverShapes
  79250. * @description 更新设置显示高亮图层。
  79251. *
  79252. * @param {Array.<LevelRenderer.Shape>} shapes - 图形数组。
  79253. * @return {LevelRenderer.Render} this。
  79254. */
  79255. updateHoverShapes(shapes) {
  79256. this.painter.updateHoverLayer(shapes);
  79257. return this;
  79258. }
  79259. /**
  79260. * @function LevelRenderer.Render.prototype.getAllShapes
  79261. * @description 获取所有图形。
  79262. * @return {Array.<LevelRenderer.Shape>} 图形数组。
  79263. */
  79264. getAllShapes() {
  79265. return this.storage._shapeList;
  79266. }
  79267. /**
  79268. * @function LevelRenderer.Render.prototype.clearAll
  79269. * @description 清除高亮和图形图层。
  79270. * @return {LevelRenderer.Render} this。
  79271. */
  79272. clearAll() {
  79273. this.clear();
  79274. this.painter.clearHover();
  79275. return this;
  79276. }
  79277. /**
  79278. * @function LevelRenderer.Render.prototype.getHoverOne
  79279. * @description 获取单个高亮图形,当前鼠标对应。
  79280. * @return {LevelRenderer.Shape} 高亮图形。
  79281. */
  79282. getHoverOne() {
  79283. return this.handler.getLastHoverOne();
  79284. }
  79285. static getFrameCallback(renderInstance) {
  79286. return function () {
  79287. var animatingElements = renderInstance.animatingElements;
  79288. //animatingElements instanceof Array 临时解决 destory 报错
  79289. if (animatingElements instanceof Array) {
  79290. for (var i = 0, l = animatingElements.length; i < l; i++) {
  79291. renderInstance.storage.mod(animatingElements[i].id);
  79292. }
  79293. if (animatingElements.length || renderInstance._needsRefreshNextFrame) {
  79294. renderInstance.refresh();
  79295. }
  79296. }
  79297. };
  79298. }
  79299. // SMIC-方法扩展 - end
  79300. }
  79301. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/LevelRenderer.js
  79302. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  79303. * This program are made available under the terms of the Apache License, Version 2.0
  79304. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  79305. /**
  79306. * @class LevelRenderer
  79307. * @deprecatedclass SuperMap.LevelRenderer
  79308. * @category Visualization Theme
  79309. * @classdesc LevelRenderer 渲染器
  79310. * @example
  79311. * //在渲染器上加上图形
  79312. * var levelRenderer = new LevelRenderer();
  79313. * var zr = levelRenderer.init(document.getElementById('lRendertest'));
  79314. * zr.clear();
  79315. * zr.addShape(new LevelRenderer.Shape.Circle({
  79316. * style:{
  79317. * x : 100,
  79318. * y : 100,
  79319. * r : 50,
  79320. * brushType: 'fill'
  79321. * }
  79322. * }));
  79323. * zr.render();
  79324. * @private
  79325. */
  79326. class LevelRenderer {
  79327. constructor() {
  79328. /**
  79329. * @member {Object} LevelRenderer.prototype._instances
  79330. * @description LevelRenderer 实例 map 索引
  79331. */
  79332. LevelRenderer._instances = {};
  79333. // 工具
  79334. LevelRenderer.Tool = {};
  79335. /**
  79336. * @member {string} LevelRenderer.prototype.version
  79337. * @description 版本。zRender(Baidu)的版本号
  79338. * 记录当前 LevelRenderer 是在 zRender 的那个版本上构建而来。
  79339. * 在每次完整评判和实施由 zRender(Baidu)升级带来的 LevelRenderer 升级后修改。
  79340. */
  79341. this.version = '2.0.4';
  79342. this.CLASS_NAME = "SuperMap.LevelRenderer";
  79343. }
  79344. /**
  79345. * @function LevelRenderer.prototype.destroy
  79346. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为null。
  79347. */
  79348. destroy() {
  79349. this.dispose();
  79350. this.version = null;
  79351. }
  79352. /**
  79353. * @function LevelRenderer.prototype.init
  79354. * @description 创建 LevelRenderer 实例。
  79355. * @param {HTMLElement} dom - 绘图容器。
  79356. * @returns {LevelRenderer} LevelRenderer 实例。
  79357. */
  79358. init(dom) {
  79359. var zr = new Render(Util_Util.createUniqueID("LRenderer_"), dom);
  79360. LevelRenderer._instances[zr.id] = zr;
  79361. return zr;
  79362. }
  79363. /**
  79364. * @function LevelRenderer.prototype.dispose
  79365. * @description LevelRenderer 实例销毁。
  79366. * 可以通过 zrender.dispose(zr) 销毁指定 LevelRenderer.Render 实例。
  79367. * 也可以通过 zr.dispose() 直接销毁
  79368. * @param {LevelRenderer.Render} zr - ZRender对象,不传此参数则销毁全部。
  79369. * @returns {LevelRenderer} this。
  79370. */
  79371. dispose(zr) {
  79372. if (zr) {
  79373. zr.dispose();
  79374. this.delInstance(zr.id);
  79375. } else {
  79376. for (var key in LevelRenderer._instances) {
  79377. LevelRenderer._instances[key].dispose();
  79378. }
  79379. LevelRenderer._instances = {};
  79380. }
  79381. return this;
  79382. }
  79383. /**
  79384. * @function LevelRenderer.prototype.getInstance
  79385. * @description 获取 LevelRenderer.Render 实例。
  79386. * @param {string} id - ZRender对象索引。
  79387. * @returns {LevelRenderer.Render} LevelRenderer.Render 实例。
  79388. */
  79389. getInstance(id) {
  79390. return LevelRenderer._instances[id];
  79391. }
  79392. /**
  79393. * @function LevelRenderer.prototype.delInstance
  79394. * @description 删除 zrender 实例,LevelRenderer.Render 实例 dispose 时会调用,删除后 getInstance 则返回 undefined
  79395. * @param {string} id - ZRender对象索引。
  79396. * @param {string} id - LevelRenderer.Render 对象索引。
  79397. * @returns {LevelRenderer} this。
  79398. */
  79399. delInstance(id) {
  79400. delete LevelRenderer._instances[id];
  79401. return this;
  79402. }
  79403. }
  79404. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicEllipse.js
  79405. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  79406. * This program are made available under the terms of the Apache License, Version 2.0
  79407. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  79408. /**
  79409. * @private
  79410. * @class LevelRenderer.Shape.SmicEllipse
  79411. * @category Visualization Theme
  79412. * @classdesc 椭圆。
  79413. * @extends LevelRenderer.Shape
  79414. * @example
  79415. * var shape = new LevelRenderer.Shape.SmicEllipse({
  79416. * style: {
  79417. * x: 100,
  79418. * y: 100,
  79419. * a: 40,
  79420. * b: 20,
  79421. * brushType: 'both',
  79422. * color: 'blue',
  79423. * strokeColor: 'red',
  79424. * lineWidth: 3,
  79425. * text: 'SmicEllipse'
  79426. * }
  79427. * });
  79428. * levelRenderer.addShape(shape);
  79429. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  79430. *
  79431. */
  79432. class SmicEllipse extends (/* unused pure expression or super */ null && (Shape)) {
  79433. constructor(options) {
  79434. super(options);
  79435. /**
  79436. * @member {string} LevelRenderer.Shape.SmicEllipse.prototype.type
  79437. * @description 图形类型。
  79438. */
  79439. this.type = 'smicellipse';
  79440. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  79441. this.refOriginalPosition = [0, 0];
  79442. }
  79443. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicEllipse";
  79444. }
  79445. /**
  79446. * @function LevelRenderer.Shape.SmicEllipse.prototype.destroy
  79447. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  79448. */
  79449. destroy() {
  79450. this.type = null;
  79451. super.destroy();
  79452. }
  79453. /**
  79454. * @function LevelRenderer.Shape.SmicEllipse.prototype.buildPath
  79455. * @description 构建椭圆的 Path。
  79456. *
  79457. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  79458. * @param {Object} style - style。
  79459. *
  79460. */
  79461. buildPath(ctx, style) {
  79462. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  79463. this.refOriginalPosition = [0, 0];
  79464. }
  79465. var __OP = this.refOriginalPosition;
  79466. var k = 0.5522848;
  79467. var x = style.x + __OP[0];
  79468. var y = style.y + __OP[1];
  79469. var a = style.a;
  79470. var b = style.b;
  79471. var ox = a * k; // 水平控制点偏移量
  79472. var oy = b * k; // 垂直控制点偏移量
  79473. // 从椭圆的左端点开始顺时针绘制四条三次贝塞尔曲线
  79474. ctx.moveTo(x - a, y);
  79475. ctx.bezierCurveTo(x - a, y - oy, x - ox, y - b, x, y - b);
  79476. ctx.bezierCurveTo(x + ox, y - b, x + a, y - oy, x + a, y);
  79477. ctx.bezierCurveTo(x + a, y + oy, x + ox, y + b, x, y + b);
  79478. ctx.bezierCurveTo(x - ox, y + b, x - a, y + oy, x - a, y);
  79479. ctx.closePath();
  79480. }
  79481. /**
  79482. * @function LevelRenderer.Shape.SmicEllipse.prototype.getRect
  79483. * @description 计算返回椭圆包围盒矩形
  79484. *
  79485. * @param {Object} style - style
  79486. * @return {Object} 边框对象。包含属性:x,y,width,height。
  79487. *
  79488. */
  79489. getRect(style) {
  79490. if (style.__rect) {
  79491. return style.__rect;
  79492. }
  79493. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  79494. this.refOriginalPosition = [0, 0];
  79495. }
  79496. var __OP = this.refOriginalPosition;
  79497. var lineWidth;
  79498. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  79499. lineWidth = style.lineWidth || 1;
  79500. } else {
  79501. lineWidth = 0;
  79502. }
  79503. style.__rect = {
  79504. x: Math.round((style.x + __OP[0]) - style.a - lineWidth / 2),
  79505. y: Math.round((style.x + __OP[1]) - style.b - lineWidth / 2),
  79506. width: style.a * 2 + lineWidth,
  79507. height: style.b * 2 + lineWidth
  79508. };
  79509. return style.__rect;
  79510. }
  79511. }
  79512. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicIsogon.js
  79513. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  79514. * This program are made available under the terms of the Apache License, Version 2.0
  79515. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  79516. /**
  79517. * @private
  79518. * @class LevelRenderer.Shape.SmicIsogon
  79519. * @category Visualization Theme
  79520. * @classdesc 正多边形。
  79521. * @extends LevelRenderer.Shape
  79522. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  79523. */
  79524. class SmicIsogon extends (/* unused pure expression or super */ null && (Shape)) {
  79525. constructor(options) {
  79526. super(options);
  79527. /**
  79528. * @member {string} LevelRenderer.Shape.SmicIsogon.prototype.type
  79529. * @description 图形类型。
  79530. */
  79531. this.type = 'smicisogon';
  79532. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  79533. this.refOriginalPosition = [0, 0];
  79534. }
  79535. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicIsogon";
  79536. }
  79537. /**
  79538. * @function LevelRenderer.Shape.SmicIsogon.prototype.destroy
  79539. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  79540. */
  79541. destroy() {
  79542. this.type = null;
  79543. super.destroy();
  79544. }
  79545. /**
  79546. * @function LevelRenderer.Shape.SmicIsogon.prototype.buildPath
  79547. * @description 创建n角星(n>=3)路径。
  79548. *
  79549. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  79550. * @param {Object} style - style。
  79551. *
  79552. */
  79553. buildPath(ctx, style) {
  79554. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  79555. this.refOriginalPosition = [0, 0];
  79556. }
  79557. var __OP = this.refOriginalPosition;
  79558. var sin = SUtil.Util_math.sin;
  79559. var cos = SUtil.Util_math.cos;
  79560. var PI = Math.PI;
  79561. var n = style.n;
  79562. if (!n || n < 2) {
  79563. return;
  79564. }
  79565. var x = style.x + __OP[0];
  79566. var y = style.y + __OP[1];
  79567. var r = style.r;
  79568. var dStep = 2 * PI / n;
  79569. var deg = -PI / 2;
  79570. var xStart = x + r * cos(deg);
  79571. var yStart = y + r * sin(deg);
  79572. deg += dStep;
  79573. // 记录边界点,用于判断insight
  79574. var pointList = style.pointList = [];
  79575. pointList.push([xStart, yStart]);
  79576. for (let i = 0, end = n - 1; i < end; i++) {
  79577. pointList.push([x + r * cos(deg), y + r * sin(deg)]);
  79578. deg += dStep;
  79579. }
  79580. pointList.push([xStart, yStart]);
  79581. // 绘制
  79582. ctx.moveTo(pointList[0][0], pointList[0][1]);
  79583. for (let i = 0; i < pointList.length; i++) {
  79584. ctx.lineTo(pointList[i][0], pointList[i][1]);
  79585. }
  79586. ctx.closePath();
  79587. return;
  79588. }
  79589. /**
  79590. * @function LevelRenderer.Shape.SmicIsogon.prototype.getRect
  79591. * @description 计算返回正多边形的包围盒矩形。
  79592. *
  79593. * @param {Object} style - style
  79594. * @return {Object} 边框对象。包含属性:x,y,width,height。
  79595. */
  79596. getRect(style) {
  79597. if (style.__rect) {
  79598. return style.__rect;
  79599. }
  79600. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  79601. this.refOriginalPosition = [0, 0];
  79602. }
  79603. var __OP = this.refOriginalPosition;
  79604. var lineWidth;
  79605. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  79606. lineWidth = style.lineWidth || 1;
  79607. } else {
  79608. lineWidth = 0;
  79609. }
  79610. style.__rect = {
  79611. x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
  79612. y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
  79613. width: style.r * 2 + lineWidth,
  79614. height: style.r * 2 + lineWidth
  79615. };
  79616. return style.__rect;
  79617. }
  79618. }
  79619. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicRing.js
  79620. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  79621. * This program are made available under the terms of the Apache License, Version 2.0
  79622. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  79623. /**
  79624. * @private
  79625. * @class LevelRenderer.Shape.SmicRing
  79626. * @category Visualization Theme
  79627. * @classdesc 圆环。
  79628. * @extends LevelRenderer.Shape
  79629. * @example
  79630. * var shape = new LevelRenderer.Shape.SmicRing({
  79631. * style: {
  79632. * x: 100,
  79633. * y: 100,
  79634. * r0: 30,
  79635. * r: 50
  79636. * }
  79637. * });
  79638. * levelRenderer.addShape(shape);
  79639. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  79640. */
  79641. class SmicRing extends (/* unused pure expression or super */ null && (Shape)) {
  79642. constructor(options) {
  79643. super(options);
  79644. /**
  79645. * @member {string} LevelRenderer.Shape.SmicRing.prototype.type
  79646. * @description 图形类型。
  79647. */
  79648. this.type = 'smicring';
  79649. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  79650. this.refOriginalPosition = [0, 0];
  79651. }
  79652. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicRing";
  79653. }
  79654. /**
  79655. * @function LevelRenderer.Shape.SmicRing.prototype.destroy
  79656. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  79657. */
  79658. destroy() {
  79659. this.type = null;
  79660. super.destroy();
  79661. }
  79662. /**
  79663. * @function LevelRenderer.Shape.SmicRing.prototype.buildPath
  79664. * @description 创建圆环路径。
  79665. *
  79666. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  79667. * @param {Object} style - style。
  79668. *
  79669. */
  79670. buildPath(ctx, style) {
  79671. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  79672. this.refOriginalPosition = [0, 0];
  79673. }
  79674. var __OP = this.refOriginalPosition;
  79675. // 非零环绕填充优化
  79676. ctx.arc(style.x + __OP[0], style.y + __OP[1], style.r, 0, Math.PI * 2, false);
  79677. ctx.moveTo((style.x + __OP[0]) + style.r0, style.y + __OP[1]);
  79678. ctx.arc(style.x + __OP[0], style.y + __OP[1], style.r0, 0, Math.PI * 2, true);
  79679. return;
  79680. }
  79681. /**
  79682. * @function LevelRenderer.Shape.SmicRing.prototype.getRect
  79683. * @description 计算返回圆环包围盒矩阵
  79684. *
  79685. * @param {Object} style - style
  79686. * @return {Object} 边框对象。包含属性:x,y,width,height。
  79687. */
  79688. getRect(style) {
  79689. if (style.__rect) {
  79690. return style.__rect;
  79691. }
  79692. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  79693. this.refOriginalPosition = [0, 0];
  79694. }
  79695. var __OP = this.refOriginalPosition;
  79696. var lineWidth;
  79697. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  79698. lineWidth = style.lineWidth || 1;
  79699. } else {
  79700. lineWidth = 0;
  79701. }
  79702. style.__rect = {
  79703. x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
  79704. y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
  79705. width: style.r * 2 + lineWidth,
  79706. height: style.r * 2 + lineWidth
  79707. };
  79708. return style.__rect;
  79709. }
  79710. }
  79711. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicStar.js
  79712. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  79713. * This program are made available under the terms of the Apache License, Version 2.0
  79714. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  79715. /**
  79716. * @private
  79717. * @class LevelRenderer.Shape.SmicStar
  79718. * @category Visualization Theme
  79719. * @classdesc n 角星(n>3)。
  79720. * @extends LevelRenderer.Shape
  79721. * @example
  79722. * var shape = new LevelRenderer.Shape.SmicStar({
  79723. * style: {
  79724. * x: 200,
  79725. * y: 100,
  79726. * r: 150,
  79727. * n: 5,
  79728. * text: '五角星'
  79729. * }
  79730. * });
  79731. * levelRenderer.addShape(shape);
  79732. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  79733. *
  79734. */
  79735. class SmicStar extends (/* unused pure expression or super */ null && (Shape)) {
  79736. constructor(options) {
  79737. super(options);
  79738. /**
  79739. * @member {string} LevelRenderer.Shape.SmicStar.prototype.type
  79740. * @description 图形类型。
  79741. */
  79742. this.type = 'smicstar';
  79743. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  79744. this.refOriginalPosition = [0, 0];
  79745. }
  79746. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicStar";
  79747. }
  79748. /**
  79749. * @function LevelRenderer.Shape.SmicStar.prototype.destroy
  79750. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  79751. */
  79752. destroy() {
  79753. this.type = null;
  79754. super.destroy();
  79755. }
  79756. /**
  79757. * @function LevelRenderer.Shape.SmicStar.prototype.buildPath
  79758. * @description 创建n 角星(n>3)路径。
  79759. *
  79760. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  79761. * @param {Object} style - style。
  79762. *
  79763. */
  79764. buildPath(ctx, style) {
  79765. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  79766. this.refOriginalPosition = [0, 0];
  79767. }
  79768. var __OP = this.refOriginalPosition;
  79769. var n = style.n;
  79770. if (!n || n < 2) {
  79771. return;
  79772. }
  79773. var sin = SUtil.Util_math.sin;
  79774. var cos = SUtil.Util_math.cos;
  79775. var PI = Math.PI;
  79776. var x = style.x + __OP[0];
  79777. var y = style.y + __OP[1];
  79778. var r = style.r;
  79779. var r0 = style.r0;
  79780. // 如果未指定内部顶点外接圆半径,则自动计算
  79781. if (r0 == null) {
  79782. r0 = n > 4
  79783. // 相隔的外部顶点的连线的交点,
  79784. // 被取为内部交点,以此计算r0
  79785. ? r * cos(2 * PI / n) / cos(PI / n)
  79786. // 二三四角星的特殊处理
  79787. : r / 3;
  79788. }
  79789. var dStep = PI / n;
  79790. var deg = -PI / 2;
  79791. var xStart = x + r * cos(deg);
  79792. var yStart = y + r * sin(deg);
  79793. deg += dStep;
  79794. // 记录边界点,用于判断inside
  79795. var pointList = style.pointList = [];
  79796. pointList.push([xStart, yStart]);
  79797. for (var i = 0, end = n * 2 - 1, ri; i < end; i++) {
  79798. ri = i % 2 === 0 ? r0 : r;
  79799. pointList.push([x + ri * cos(deg), y + ri * sin(deg)]);
  79800. deg += dStep;
  79801. }
  79802. pointList.push([xStart, yStart]);
  79803. // 绘制
  79804. ctx.moveTo(pointList[0][0], pointList[0][1]);
  79805. for (let i = 0; i < pointList.length; i++) {
  79806. ctx.lineTo(pointList[i][0], pointList[i][1]);
  79807. }
  79808. ctx.closePath();
  79809. return;
  79810. }
  79811. /**
  79812. * @function LevelRenderer.Shape.SmicStar.prototype.getRect
  79813. * @description 返回 n 角星包围盒矩形。
  79814. *
  79815. * @param {Object} style - style
  79816. * @return {Object} 边框对象。包含属性:x,y,width,height。
  79817. */
  79818. getRect(style) {
  79819. if (style.__rect) {
  79820. return style.__rect;
  79821. }
  79822. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  79823. this.refOriginalPosition = [0, 0];
  79824. }
  79825. var __OP = this.refOriginalPosition;
  79826. var lineWidth;
  79827. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  79828. lineWidth = style.lineWidth || 1;
  79829. } else {
  79830. lineWidth = 0;
  79831. }
  79832. style.__rect = {
  79833. x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
  79834. y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
  79835. width: style.r * 2 + lineWidth,
  79836. height: style.r * 2 + lineWidth
  79837. };
  79838. return style.__rect;
  79839. }
  79840. }
  79841. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/index.js
  79842. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  79843. * This program are made available under the terms of the Apache License, Version 2.0
  79844. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  79845. ;// CONCATENATED MODULE: ./src/common/overlay/index.js
  79846. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  79847. * This program are made available under the terms of the Apache License, Version 2.0
  79848. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  79849. ;// CONCATENATED MODULE: ./src/common/components/CommonTypes.js
  79850. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  79851. * This program are made available under the terms of the Apache License, Version 2.0
  79852. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  79853. /**
  79854. * @description 该文件用于存储一些公用常量
  79855. * @private
  79856. */
  79857. const CommonTypes_FileTypes = {
  79858. EXCEL: "EXCEL",
  79859. CSV: "CSV",
  79860. ISERVER: "ISERVER",
  79861. GEOJSON: "GEOJSON",
  79862. JSON: 'JSON'
  79863. };
  79864. const CommonTypes_FileConfig = {
  79865. fileMaxSize: 10 * 1024 * 1024
  79866. };
  79867. ;// CONCATENATED MODULE: ./src/common/components/openfile/FileModel.js
  79868. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  79869. * This program are made available under the terms of the Apache License, Version 2.0
  79870. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  79871. /**
  79872. * @class FileModel
  79873. * @deprecatedclass SuperMap.FileModel
  79874. * @description 文件数据组件数据模型,用于存储一些文件数据或状态,todo 结构待完善
  79875. * @category Components OpenFile
  79876. * @private
  79877. */
  79878. class FileModel {
  79879. constructor(options) {
  79880. this.FileTypes = FileTypes;
  79881. this.FileConfig = FileConfig;
  79882. this.loadFileObject = options && options.loadFileObject ? options.loadFileObject : [];
  79883. }
  79884. /**
  79885. * @function FileModel.prototype.set
  79886. * @description 设置属性值
  79887. * @param {string} key - 属性名称
  79888. * @param {string|Object} value - 属性值
  79889. */
  79890. set(key, value) {
  79891. this[key] = value;
  79892. }
  79893. /**
  79894. * @function FileModel.prototype.get
  79895. * @description 获取数据值
  79896. * @param {string} key - 属性名称
  79897. * @returns {string|Object} value - 返回属性值
  79898. */
  79899. get(key) {
  79900. return this[key];
  79901. }
  79902. }
  79903. ;// CONCATENATED MODULE: ./src/common/components/messagebox/MessageBox.js
  79904. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  79905. * This program are made available under the terms of the Apache License, Version 2.0
  79906. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  79907. /**
  79908. * @class MessageBox
  79909. * @aliasclass Components.MessageBox
  79910. * @deprecatedclass SuperMap.Components.MessageBox
  79911. * @version 9.1.1
  79912. * @classdesc 组件信息提示框。
  79913. * @category Components Common
  79914. * @usage
  79915. */
  79916. class MessageBox {
  79917. constructor() {
  79918. this._initView();
  79919. }
  79920. _initView() {
  79921. //原生js形式
  79922. const messageBoxContainer = document.createElement("div");
  79923. messageBoxContainer.hidden = true;
  79924. messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-orange");
  79925. //图标
  79926. const iconContainer = document.createElement("div");
  79927. iconContainer.setAttribute("class", "icon");
  79928. this.icon = document.createElement("span");
  79929. this.icon.setAttribute("class", "supermapol-icons-message-warning");
  79930. iconContainer.appendChild(this.icon);
  79931. messageBoxContainer.appendChild(iconContainer);
  79932. //内容:
  79933. const messageBox = document.createElement("div");
  79934. messageBox.setAttribute("class", "component-messagebox");
  79935. messageBox.innerHTML = "";
  79936. messageBoxContainer.appendChild(messageBox);
  79937. this.messageBox = messageBox;
  79938. //关闭按钮
  79939. const cancelContainer = document.createElement("div");
  79940. cancelContainer.setAttribute("class", "component-messagebox__cancelbtncontainer");
  79941. const cancelBtn = document.createElement("button");
  79942. cancelBtn.setAttribute("class", "component-messagebox__cancelBtn");
  79943. cancelBtn.innerHTML = "x";
  79944. cancelBtn.onclick = this.closeView.bind(this);
  79945. cancelContainer.appendChild(cancelBtn);
  79946. messageBoxContainer.appendChild(cancelContainer);
  79947. this.messageBoxContainer = messageBoxContainer;
  79948. document.body.appendChild(this.messageBoxContainer);
  79949. }
  79950. /**
  79951. * @function MessageBox.prototype.closeView
  79952. * @description 关闭提示框。
  79953. */
  79954. closeView() {
  79955. this.messageBoxContainer.hidden = true;
  79956. }
  79957. /**
  79958. * @function MessageBox.prototype.showView
  79959. * @description 显示提示框。
  79960. * @param {string} message - 提示框显示内容。
  79961. * @param {string}[type="warring"] 提示框类型,如 "warring", "failure", "success"。
  79962. */
  79963. showView(message, type = 'warring') {
  79964. //设置提示框的样式:
  79965. if (type === "success") {
  79966. this.icon.setAttribute("class", "supermapol-icons-message-success");
  79967. this.messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-green");
  79968. } else if (type === "failure") {
  79969. this.icon.setAttribute("class", "supermapol-icons-message-failure");
  79970. this.messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-red");
  79971. } else if (type === "warring") {
  79972. this.icon.setAttribute("class", "supermapol-icons-message-warning");
  79973. this.messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-orange");
  79974. }
  79975. this.messageBox.innerHTML = message;
  79976. this.messageBoxContainer.hidden = false;
  79977. }
  79978. }
  79979. ;// CONCATENATED MODULE: external "function(){try{return echarts}catch(e){return {}}}()"
  79980. const external_function_try_return_echarts_catch_e_return_namespaceObject = function(){try{return echarts}catch(e){return {}}}();
  79981. ;// CONCATENATED MODULE: ./src/common/lang/locales/en-US.js
  79982. 
  79983. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  79984. * This program are made available under the terms of the Apache License, Version 2.0
  79985. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  79986. /**
  79987. * Namespace: SuperMap.Lang["en"]
  79988. * Dictionary for English. Keys for entries are used in calls to
  79989. * <SuperMap.Lang.translate>. Entry bodies are normal strings or
  79990. * strings formatted for use with <SuperMap.String.format> calls.
  79991. */
  79992. let en = {
  79993. 'title_dataFlowService': 'Data Flow Service',
  79994. 'title_distributedAnalysis': 'Distributed Analysis',
  79995. 'title_clientComputing': 'Client Computing',
  79996. 'title_dataServiceQuery': 'Data Service Query',
  79997. 'title_searchCity':'Search city',
  79998. 'title_searchLayer':' Search layer',
  79999. 'text_input_value_inputDataFlowUrl': 'Please enter the data stream service address such as: ws://{serviceRoot}/{dataFlowName}/dataflow/subscribe',
  80000. 'text_displayFeaturesInfo': 'Display feature information',
  80001. 'text_subscribe': 'subscribe',
  80002. 'text_cancelSubscribe': 'unsubscribe',
  80003. 'text_densityAnalysis': 'Density Analysis',
  80004. 'text_CalculateTheValuePerUnitArea': 'Calculate the value per unit area within the neighborhood shape',
  80005. 'text_option_selectDataset':'Please select a dataset',
  80006. 'text_label_dataset': 'Dataset',
  80007. 'text_option_simplePointDensityAnalysis': 'Simple point density analysis',
  80008. 'text_option_nuclearDensityAnalysis': 'Nuclear density analysis',
  80009. 'text_label_analyticalMethod': 'Analytical method',
  80010. 'text_option_quadrilateral': 'Quadrilateral',
  80011. 'text_option_hexagon': 'hexagon',
  80012. 'text_label_meshType': 'Mesh type',
  80013. 'text_option_notSet': 'Not set',
  80014. 'text_label_weightField': 'Weight field',
  80015. 'text_label_gridSizeInMeters': 'Grid size',
  80016. 'text_label_searchRadius': 'Search radius',
  80017. 'text_label_queryRange': 'Scope of analysis',
  80018. 'text_label_areaUnit': 'Area unit',
  80019. 'text_option_equidistantSegmentation': 'Equidistant segmentation',
  80020. 'text_option_logarithm': 'Logarithm',
  80021. 'text_option_equalCountingSegment': 'Equal counting segment',
  80022. 'text_option_squareRootSegmentation': 'Square root segmentation',
  80023. 'text_label_thematicMapSegmentationMode': 'Thematic map segmentation mode',
  80024. 'text_label_thematicMapSegmentationParameters': 'Thematic map segmentation parameters',
  80025. 'text_option_greenOrangePurpleGradient': 'Green orange purple gradient',
  80026. 'text_option_greenOrangeRedGradient': 'Green orange red gradient',
  80027. 'text_option_rainbowGradient': 'Rainbow gradient',
  80028. 'text_option_spectralGradient': 'Spectral gradient',
  80029. 'text_option_terrainGradient': 'Terrain gradient',
  80030. 'text_label_thematicMapColorGradientMode': 'Thematic map color gradient mode',
  80031. 'text_label_resultLayerName': 'Result layer name',
  80032. 'text_chooseFile': 'Open File',
  80033. 'text_isoline': 'Isoline',
  80034. 'text_extractDiscreteValue': 'Extract discrete value generation curve',
  80035. 'text_buffer': 'Buffer',
  80036. 'text_specifyTheDistance': 'Specify the distance to create the surrounding area',
  80037. 'text_label_analysisLayer': 'Analysis layer',
  80038. 'text_label_extractField': 'Extract field',
  80039. 'text_label_extractedValue': 'Extracted value',
  80040. 'text_label_distanceAttenuation': 'Distance attenuation',
  80041. 'text_label_gridSize': 'gridSize',
  80042. 'text_label_bufferRadius': 'Buffer radius',
  80043. 'text_label_defaultkilometers': 'Default 10 kilometers',
  80044. 'text_label_kilometer': 'kilometer',
  80045. 'text_label_unit': 'unit',
  80046. 'text_retainOriginal': 'Retain original object field',
  80047. 'text_mergeBuffer': 'Merge buffer',
  80048. 'text_label_color': 'Color',
  80049. 'text_label_buffer': '[Buffer]',
  80050. 'text_label_isolines': '[Isolines]',
  80051. 'text_label_queryRangeTips': 'The default is the full range of input data. Example: -74.050, 40.650, -73.850, 40.850',
  80052. 'text_label_queryModel': 'Query mode',
  80053. 'text_label_IDArrayOfFeatures': 'ID array of features',
  80054. 'text_label_maxFeatures': 'The maximum number of features that can be returned',
  80055. 'text_label_bufferDistance': 'Buffer distance',
  80056. 'text_label_queryRange1': 'Query range',
  80057. 'text_label_spatialQueryMode': 'Spatial query mode',
  80058. 'text_label_featureFilter': 'Feature filter',
  80059. 'text_label_geometricObject': 'Geometric object',
  80060. 'text_label_queryMode': 'Query mode',
  80061. 'text_label_searchTips': 'Search for city locations or layer features',
  80062. 'text_label_chooseSearchLayers': 'Select a query layer',
  80063. 'text_loadSearchCriteria': 'Load search criteria',
  80064. 'text_saveSearchCriteria': 'Save search criteria',
  80065. "btn_analyze": "Analyze",
  80066. "btn_analyzing": "Analyzing",
  80067. "btn_emptyTheAnalysisLayer": "Empty the analysis layer",
  80068. "btn_cancelAnalysis": "Cancel",
  80069. "btn_query": "Query",
  80070. "btn_querying": "Querying",
  80071. "btn_emptyTheRresultLayer": "Clear all result layers",
  80072. 'msg_dataReturnedIsEmpty.': 'The request is successful and the data returned by the query is empty.',
  80073. 'msg_dataFlowServiceHasBeenSubscribed': 'The data stream service has been subscribed to.',
  80074. 'msg_inputDataFlowUrlFirst': 'Please enter the data stream service address first.',
  80075. 'msg_datasetOrMethodUnsupport': 'This dataset does not support this analysis type. Please reselect the dataset.',
  80076. 'msg_selectDataset': 'Please select a data set!',
  80077. 'msg_setTheWeightField': 'Please set the weight field!',
  80078. 'msg_theFieldNotSupportAnalysis': 'The field you currently select does not support analysis!',
  80079. 'msg_resultIsEmpty': 'The result of the analysis is empty!',
  80080. 'msg_openFileFail': 'Failed to open file!',
  80081. 'msg_fileTypeUnsupported': 'File format is not supported!',
  80082. 'msg_fileSizeExceeded': 'File size exceeded! The file size should not exceed 10M!',
  80083. 'msg_dataInWrongGeoJSONFormat': 'Wrong data format! Non standard GEOJSON format data!',
  80084. 'msg_dataInWrongFormat': 'Wrong data format! Non standard EXCEL, CSV or GEOJSON format data!',
  80085. 'msg_searchKeywords': "Search keywords cannot be empty. Please enter your search criteria.",
  80086. 'msg_searchGeocodeField':"Did not match the address matching service data!",
  80087. 'msg_cityGeocodeField':"The address matching service of the current city is not configured.",
  80088. 'msg_getFeatureField':"No related vector features found!",
  80089. 'msg_dataflowservicesubscribed':'The data stream service has been subscribed to.',
  80090. 'msg_subscribesucceeded':'The data stream service subscription was successful.',
  80091. 'msg_crsunsupport':'Does not support the coordinate system of the current map',
  80092. 'msg_tilematrixsetunsupport':'Incoming TileMatrixSet is not supported',
  80093. 'msg_jsonResolveFiled': 'JSON format parsing failure!',
  80094. 'msg_requestContentFiled': 'Failed to request data through iportal!',
  80095. 'msg_getdatafailed': 'Failed to get data!'
  80096. };
  80097. ;// CONCATENATED MODULE: ./src/common/lang/locales/zh-CN.js
  80098. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  80099. * This program are made available under the terms of the Apache License, Version 2.0
  80100. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  80101. /**
  80102. * Namespace: SuperMap.Lang["zh-CN"]
  80103. * Dictionary for Simplified Chinese. Keys for entries are used in calls to
  80104. * <SuperMap.Lang.translate>. Entry bodies are normal strings or
  80105. * strings formatted for use with <SuperMap.String.format> calls.
  80106. */
  80107. let zh = {
  80108. 'title_dataFlowService': '数据流服务',
  80109. 'title_distributedAnalysis': '分布式分析',
  80110. 'title_clientComputing': '客户端计算',
  80111. 'title_dataServiceQuery': '数据服务查询',
  80112. 'title_searchCity':'搜索城市',
  80113. 'title_searchLayer':'搜索图层',
  80114. 'text_input_value_inputDataFlowUrl': '请输入数据流服务地址如:ws://{serviceRoot}/{dataFlowName}/dataflow/subscribe',
  80115. 'text_displayFeaturesInfo': '显示要素信息',
  80116. 'text_subscribe': '订阅',
  80117. 'text_cancelSubscribe': '取消订阅',
  80118. 'text_densityAnalysis': '密度分析',
  80119. 'text_CalculateTheValuePerUnitArea': '计算点指定邻域形状内的每单位面积量值',
  80120. 'text_option_selectDataset':'请选择数据集',
  80121. 'text_label_dataset': '数据集',
  80122. 'text_option_simplePointDensityAnalysis': '简单点密度分析',
  80123. 'text_option_nuclearDensityAnalysis': '核密度分析',
  80124. 'text_label_analyticalMethod': '分析方法',
  80125. 'text_option_quadrilateral': '四边形',
  80126. 'text_option_hexagon': '六边形',
  80127. 'text_label_meshType': '网格面类型',
  80128. 'text_option_notSet': '未设置',
  80129. 'text_label_weightField': '权重字段',
  80130. 'text_label_gridSizeInMeters': '网格大小',
  80131. 'text_label_searchRadius': '搜索半径',
  80132. 'text_label_queryRange': '分析范围',
  80133. 'text_label_areaUnit': '面积单位',
  80134. 'text_option_equidistantSegmentation': '等距离分段',
  80135. 'text_option_logarithm': '对数',
  80136. 'text_option_equalCountingSegment': '等计数分段',
  80137. 'text_option_squareRootSegmentation': '平方根分段',
  80138. 'text_label_thematicMapSegmentationMode': '专题图分段模式',
  80139. 'text_label_thematicMapSegmentationParameters': '专题图分段参数',
  80140. 'text_option_greenOrangePurpleGradient': '绿橙紫渐变',
  80141. 'text_option_greenOrangeRedGradient': '绿橙红渐变',
  80142. 'text_option_rainbowGradient': '彩虹渐变',
  80143. 'text_option_spectralGradient': '光谱渐变',
  80144. 'text_option_terrainGradient': '地形渐变',
  80145. 'text_label_thematicMapColorGradientMode': '专题图颜色渐变模式',
  80146. 'text_label_resultLayerName': '结果图层名称',
  80147. 'text_chooseFile': '选择文件',
  80148. 'text_isoline': '等值线',
  80149. 'text_extractDiscreteValue': '提取离散值生成曲线',
  80150. 'text_buffer': '缓冲区',
  80151. 'text_specifyTheDistance': '指定距离创建周边区域',
  80152. 'text_label_analysisLayer': '分析图层',
  80153. 'text_label_extractField': '提取字段',
  80154. 'text_label_extractedValue': '提取值',
  80155. 'text_label_distanceAttenuation': '距离衰减',
  80156. 'text_label_gridSize': '栅格大小',
  80157. 'text_label_bufferRadius': '缓冲半径',
  80158. 'text_label_defaultkilometers': '默认10千米',
  80159. 'text_option_kilometer': '千米',
  80160. 'text_label_unit': '单位',
  80161. 'text_retainOriginal': '保留原对象字段属性',
  80162. 'text_mergeBuffer': '合并缓冲区',
  80163. 'text_label_color': '颜色',
  80164. 'text_label_buffer': '[缓冲区]',
  80165. 'text_label_isolines': '[等值线]',
  80166. 'text_label_queryRangeTips': '默认为输入数据的全幅范围。范例:-74.050,40.650,-73.850,40.850',
  80167. 'text_label_IDArrayOfFeatures': '要素 ID 数组',
  80168. 'text_label_maxFeatures': '最多可返回的要素数量',
  80169. 'text_label_bufferDistance': '缓冲区距离',
  80170. 'text_label_queryRange1': '查询范围',
  80171. 'text_label_spatialQueryMode': '空间查询模式',
  80172. 'text_label_featureFilter': '要素过滤器',
  80173. 'text_label_geometricObject': '几何对象',
  80174. 'text_label_queryMode': '查询模式',
  80175. 'text_label_searchTips': '搜索城市地点或图层要素',
  80176. 'text_label_chooseSearchLayers': '选择查询图层',
  80177. 'text_loadSearchCriteria': '加载搜索条件',
  80178. 'text_saveSearchCriteria': '保存搜索条件',
  80179. "btn_analyze": "分析",
  80180. "btn_analyzing": "分析中",
  80181. "btn_emptyTheAnalysisLayer": "清空分析图层",
  80182. "btn_cancelAnalysis": "取消",
  80183. "btn_query": "查询",
  80184. "btn_querying": "查询中",
  80185. "btn_emptyTheRresultLayer": "清除所有结果图层",
  80186. 'msg_dataFlowServiceHasBeenSubscribed': '已订阅该数据流服务。',
  80187. 'msg_inputDataFlowUrlFirst': '请先输入数据流服务地址。',
  80188. 'msg_datasetOrMethodUnsupport': '该数据集不支持本分析类型,请重新选择数据集',
  80189. 'msg_selectDataset': '请选择数据集!',
  80190. 'msg_setTheWeightField': '请设置权重字段!',
  80191. 'msg_theFieldNotSupportAnalysis': '您当前选择的字段不支持分析!',
  80192. 'msg_resultIsEmpty': '分析的结果为空!',
  80193. 'msg_dataReturnedIsEmpty': '请求成功,查询返回的数据为空。',
  80194. 'msg_openFileFail': '打开文件失败!',
  80195. 'msg_fileTypeUnsupported': '不支持该文件格式!',
  80196. 'msg_fileSizeExceeded': '文件大小超限!文件大小不得超过 10M!',
  80197. 'msg_dataInWrongGeoJSONFormat': '数据格式错误!非标准的 GEOJSON 格式数据!',
  80198. 'msg_dataInWrongFormat': '数据格式错误!非标准的 EXCEL, CSV 或 GEOJSON 格式数据!',
  80199. 'msg_searchKeywords': "搜索关键字不能为空,请输入搜索条件。",
  80200. 'msg_searchGeocodeField':"未匹配到地址匹配服务数据!",
  80201. 'msg_cityGeocodeField':"未配置当前城市的地址匹配服务。",
  80202. 'msg_getFeatureField':"未查找到相关矢量要素!",
  80203. 'msg_dataflowservicesubscribed':'已订阅该数据流服务。',
  80204. 'msg_subscribesucceeded':'数据流服务订阅成功。',
  80205. 'msg_crsunsupport':'不支持当前地图的坐标系',
  80206. 'msg_tilematrixsetunsupport':'不支持传入的TileMatrixSet',
  80207. 'msg_jsonResolveFiled': 'json格式解析失败!',
  80208. 'msg_requestContentFiled': '通过iportal请求数据失败!',
  80209. 'msg_getdatafailed': '获取数据失败!'
  80210. };
  80211. ;// CONCATENATED MODULE: ./src/common/lang/Lang.js
  80212. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  80213. * This program are made available under the terms of the Apache License, Version 2.0
  80214. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  80215. /**
  80216. * @name Lang
  80217. * @namespace
  80218. * @category BaseTypes Internationalization
  80219. * @description 国际化的命名空间,包含多种语言和方法库来设置和获取当前的语言。
  80220. * @usage
  80221. * ```
  80222. * // 浏览器
  80223. * <script type="text/javascript" src="{cdn}"></script>
  80224. * <script>
  80225. * const result = {namespace}.Lang.getCode();
  80226. *
  80227. * // 弃用的写法
  80228. * const result = SuperMap.Lang.getCode();
  80229. *
  80230. * </script>
  80231. *
  80232. * // ES6 Import
  80233. * import { Lang } from '{npm}';
  80234. *
  80235. * const result = Lang.getCode();
  80236. *
  80237. * ```
  80238. */
  80239. let Lang = {
  80240. 'en-US': en,
  80241. "zh-CN": zh,
  80242. /**
  80243. * @member {string} Lang.code
  80244. * @description 当前所使用的语言类型。
  80245. */
  80246. code: null,
  80247. /**
  80248. * @member {string} [Lang.defaultCode='en-US']
  80249. * @description 默认使用的语言类型。
  80250. */
  80251. defaultCode: "en-US",
  80252. /**
  80253. * @function Lang.getCode
  80254. * @description 获取当前的语言代码。
  80255. * @returns {string} 当前的语言代码。
  80256. */
  80257. getCode: function () {
  80258. if (!Lang.code) {
  80259. Lang.setCode();
  80260. }
  80261. return Lang.code;
  80262. },
  80263. /**
  80264. * @function Lang.setCode
  80265. * @description 设置语言代码。
  80266. * @param {string} code - 此参数遵循IETF规范。
  80267. */
  80268. setCode: function () {
  80269. var lang = this.getLanguageFromCookie();
  80270. if (!lang) {
  80271. lang = Lang.defaultCode;
  80272. if (navigator.appName === 'Netscape') {
  80273. lang = navigator.language;
  80274. } else {
  80275. lang = navigator.browserLanguage;
  80276. }
  80277. }
  80278. if (lang.indexOf('zh') === 0) {
  80279. lang = 'zh-CN';
  80280. }
  80281. if (lang.indexOf('en') === 0) {
  80282. lang = 'en-US';
  80283. }
  80284. Lang.code = lang;
  80285. },
  80286. /**
  80287. * @function Lang.getLanguageFromCookie
  80288. * @description 从 cookie 中获取语言类型。
  80289. */
  80290. getLanguageFromCookie() {
  80291. var name = 'language=';
  80292. var ca = document.cookie.split(';');
  80293. for (var i = 0; i < ca.length; i++) {
  80294. var c = ca[i];
  80295. while (c.charAt(0) === ' ') {
  80296. c = c.substring(1)
  80297. }
  80298. if (c.indexOf(name) !== -1) {
  80299. return c.substring(name.length, c.length)
  80300. }
  80301. }
  80302. return "";
  80303. },
  80304. /**
  80305. * @function Lang.i18n
  80306. * @description 从当前语言字符串的字典查找 key。
  80307. * @param {string} key - 字典中 i18n 字符串值的关键字。
  80308. * @returns {string} 国际化的字符串。
  80309. */
  80310. i18n: function (key) {
  80311. var dictionary = Lang[Lang.getCode()];
  80312. var message = dictionary && dictionary[key];
  80313. if (!message) {
  80314. // Message not found, fall back to message key
  80315. message = key;
  80316. }
  80317. return message;
  80318. }
  80319. };
  80320. ;// CONCATENATED MODULE: external "function(){try{return XLSX}catch(e){return {}}}()"
  80321. const external_function_try_return_XLSX_catch_e_return_namespaceObject = function(){try{return XLSX}catch(e){return {}}}();
  80322. ;// CONCATENATED MODULE: ./src/common/components/util/FileReaderUtil.js
  80323. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  80324. * This program are made available under the terms of the Apache License, Version 2.0
  80325. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  80326. /**
  80327. * @name FileReaderUtil
  80328. * @namespace
  80329. * @category Components OpenFile
  80330. * @description 组件读取文件工具类。
  80331. * @version 9.1.1
  80332. * @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(*, *=))}}
  80333. * @usage
  80334. * ```
  80335. * // 浏览器
  80336. * <script type="text/javascript" src="{cdn}"></script>
  80337. * <script>
  80338. * const result = {namespace}.Components.FileReaderUtil.isXField(data);
  80339. *
  80340. * // 弃用的写法
  80341. * const result = SuperMap.Components.FileReaderUtil.isXField(data);
  80342. *
  80343. * </script>
  80344. *
  80345. * // ES6 Import
  80346. * import { FileReaderUtil } from '{npm}';
  80347. *
  80348. * const result = FileReaderUtil.isXField(data);
  80349. * ```
  80350. */
  80351. let FileReaderUtil = {
  80352. rABS: typeof FileReader !== 'undefined' && FileReader.prototype && FileReader.prototype.readAsBinaryString,
  80353. rABF: typeof FileReader !== 'undefined' && FileReader.prototype && FileReader.prototype.readAsArrayBuffer,
  80354. rAT: typeof FileReader !== 'undefined' && FileReader.prototype && FileReader.prototype.readAsText,
  80355. /**
  80356. * @function FileReaderUtil.prototype.readFile
  80357. * @description 读取文件。
  80358. * @param {string} fileType - 当前读取的文件类型。
  80359. *
  80360. * @param {Object} file - 读取回来的文件内容对象。
  80361. * @param {function} success - 读取文件成功回调函数。
  80362. * @param {function} failed - 读取文件失败回调函数。
  80363. * @param {Object} context - 回调重定向对象。
  80364. */
  80365. readFile(fileType, file, success, failed, context) {
  80366. if (CommonTypes_FileTypes.JSON === fileType || CommonTypes_FileTypes.GEOJSON === fileType) {
  80367. this.readTextFile(file, success, failed, context)
  80368. } else if (CommonTypes_FileTypes.EXCEL === fileType || CommonTypes_FileTypes.CSV === fileType) {
  80369. this.readXLSXFile(file, success, failed, context)
  80370. }
  80371. },
  80372. /**
  80373. * @description 读取文本文件。
  80374. * @param {Object} file 文件内容对象。
  80375. * @param {function} success 读取文件成功回调函数。
  80376. * @param {function} failed 读取文件失败回调函数。
  80377. * @param {Object} context - 回调重定向对象。
  80378. */
  80379. readTextFile(file, success, failed, context) {
  80380. let reader = new FileReader();
  80381. reader.onloadend = function (evt) {
  80382. success && success.call(context, evt.target.result);
  80383. };
  80384. reader.onerror = function (error) {
  80385. failed && failed.call(context, error)
  80386. };
  80387. this.rAT ? reader.readAsText(file.file, 'utf-8') : reader.readAsBinaryString(file.file);
  80388. },
  80389. /**
  80390. * @description 读取excel或csv文件。
  80391. * @param {Object} file 文件内容对象。
  80392. * @param {function} success 读取文件成功回调函数。
  80393. * @param {function} failed 读取文件失败回调函数。
  80394. * @param {Object} context - 回调重定向对象。
  80395. */
  80396. readXLSXFile(file, success, failed, context) {
  80397. let reader = new FileReader();
  80398. reader.onloadend = function (evt) {
  80399. let xLSXData = new Uint8Array(evt.target.result);
  80400. let workbook = external_function_try_return_XLSX_catch_e_return_namespaceObject.read(xLSXData, {type: "array"});
  80401. try {
  80402. if (workbook && workbook.SheetNames && workbook.SheetNames.length > 0) {
  80403. //暂时只读取第一个sheets的内容
  80404. let sheetName = workbook.SheetNames[0];
  80405. let xLSXCSVString = external_function_try_return_XLSX_catch_e_return_namespaceObject.utils.sheet_to_csv(workbook.Sheets[sheetName]);
  80406. success && success.call(context, xLSXCSVString);
  80407. }
  80408. } catch (error) {
  80409. failed && failed.call(context, error);
  80410. }
  80411. };
  80412. reader.onerror = function (error) {
  80413. failed && failed.call(context, error)
  80414. };
  80415. this.rABF && reader.readAsArrayBuffer(file.file);
  80416. },
  80417. /**
  80418. * @function FileReaderUtil.prototype.processDataToGeoJson
  80419. * @description 将读取回来得数据统一处理为 GeoJSON 格式。
  80420. * @param {string} type - 文件类型。
  80421. * @param {Object} data - 读取返回的数据对象。
  80422. * @param {function} success - 数据处理成功的回调。
  80423. * @param {function} failed - 数据处理失败的回调。
  80424. * @param {Object} context - 回调重定向对象。
  80425. * @returns {GeoJSONObject} 返回标准 GeoJSON 规范格式数据。
  80426. * @private
  80427. */
  80428. processDataToGeoJson(type, data, success, failed, context) {
  80429. let geojson = null;
  80430. if (type === "EXCEL" || type === "CSV") {
  80431. geojson = this.processExcelDataToGeoJson(data);
  80432. success && success.call(context, geojson);
  80433. } else if (type === 'JSON' || type === 'GEOJSON') {
  80434. let result = data;
  80435. //geojson、json未知,通过类容来判断
  80436. if ((typeof result) === "string") {
  80437. result = JSON.parse(result);
  80438. }
  80439. if (result.type === 'ISERVER') {
  80440. geojson = result.data.recordsets[0].features;
  80441. } else if (result.type === 'FeatureCollection') {
  80442. //geojson
  80443. geojson = result;
  80444. } else {
  80445. //不支持数据
  80446. failed && failed.call(context, Lang.i18n('msg_dataInWrongGeoJSONFormat'));
  80447. }
  80448. success && success.call(context, geojson);
  80449. } else {
  80450. failed && failed.call(context, Lang.i18n('msg_dataInWrongFormat'));
  80451. }
  80452. },
  80453. /**
  80454. * @function FileReaderUtil.prototype.processExcelDataToGeoJson
  80455. * @description 表格文件数据处理。
  80456. * @param {Object} data - 读取的表格文件数据。
  80457. * @returns {GeoJSONObject} 返回标准 GeoJSON 规范格式数据。
  80458. * @private
  80459. */
  80460. processExcelDataToGeoJson(data) {
  80461. //处理为对象格式转化
  80462. let dataContent = this.string2Csv(data);
  80463. let fieldCaptions = dataContent.colTitles;
  80464. //位置属性处理
  80465. let xfieldIndex = -1,
  80466. yfieldIndex = -1;
  80467. for (let i = 0, len = fieldCaptions.length; i < len; i++) {
  80468. if (this.isXField(fieldCaptions[i])) {
  80469. xfieldIndex = i;
  80470. }
  80471. if (this.isYField(fieldCaptions[i])) {
  80472. yfieldIndex = i;
  80473. }
  80474. }
  80475. // feature 构建后期支持坐标系 4326/3857
  80476. let features = [];
  80477. for (let i = 0, len = dataContent.rows.length; i < len; i++) {
  80478. let row = dataContent.rows[i];
  80479. //if (featureFrom === "LonLat") {
  80480. let x = Number(row[xfieldIndex]),
  80481. y = Number(row[yfieldIndex]);
  80482. //属性信息
  80483. let attributes = {};
  80484. for (let index in dataContent.colTitles) {
  80485. let key = dataContent.colTitles[index];
  80486. attributes[key] = dataContent.rows[i][index];
  80487. }
  80488. //目前csv 只支持处理点,所以先生成点类型的 geojson
  80489. let feature = {
  80490. "type": "Feature",
  80491. "geometry": {
  80492. "type": "Point",
  80493. "coordinates": [x, y]
  80494. },
  80495. "properties": attributes
  80496. };
  80497. features.push(feature);
  80498. }
  80499. return features;
  80500. },
  80501. /**
  80502. * @description 判断是否地理X坐标。
  80503. * @param {string} data 字段名。
  80504. */
  80505. isXField(data) {
  80506. var lowerdata = data.toLowerCase();
  80507. return (lowerdata === "x" || lowerdata === "smx" ||
  80508. lowerdata === "jd" || lowerdata === "经度" || lowerdata === "东经" || lowerdata === "longitude" ||
  80509. lowerdata === "lot" || lowerdata === "lon" || lowerdata === "lng" || lowerdata === "x坐标");
  80510. },
  80511. /**
  80512. * @description 判断是否地理Y坐标。
  80513. * @param {string} data 字段名。
  80514. */
  80515. isYField(data) {
  80516. var lowerdata = data.toLowerCase();
  80517. return (lowerdata === "y" || lowerdata === "smy" ||
  80518. lowerdata === "wd" || lowerdata === "纬度" || lowerdata === "北纬" ||
  80519. lowerdata === "latitude" || lowerdata === "lat" || lowerdata === "y坐标");
  80520. },
  80521. /**
  80522. * @description 字符串转为dataEditor 支持的csv格式数据。
  80523. * @param {string} string 待转化的字符串。
  80524. * @param {boolean} withoutTitle 是否需要列标题。
  80525. */
  80526. string2Csv(string, withoutTitle) {
  80527. // let rows = string.split('\r\n');
  80528. let rows = string.split('\n');
  80529. let result = {};
  80530. if (!withoutTitle) {
  80531. result["colTitles"] = rows[0].split(',');
  80532. } else {
  80533. result["colTitles"] = [];
  80534. }
  80535. result['rows'] = [];
  80536. for (let i = (withoutTitle) ? 0 : 1; i < rows.length; i++) {
  80537. rows[i] && result['rows'].push(rows[i].split(','));
  80538. }
  80539. return result;
  80540. }
  80541. };
  80542. ;// CONCATENATED MODULE: ./src/common/components/chart/ChartModel.js
  80543. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  80544. * This program are made available under the terms of the Apache License, Version 2.0
  80545. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  80546. /**
  80547. * @class ChartModel
  80548. * @classdesc 图表组件数据模型
  80549. * @private
  80550. * @param {Object} datasets - 数据来源。
  80551. * @category Components Chart
  80552. * @fires ChartModel#getdatafailed
  80553. */
  80554. class ChartModel {
  80555. constructor(datasets) {
  80556. this.datasets = datasets;
  80557. this.EVENT_TYPES = ['getdatafailed'];
  80558. this.events = new Events(this, null, this.EVENT_TYPES);
  80559. }
  80560. /**
  80561. * @private
  80562. * @function ChartModel.prototype.getDatasetInfo
  80563. * @description 获得数据集数据。
  80564. * @param {string} datasetUrl - 数据集资源地址。
  80565. */
  80566. getDatasetInfo(success) {
  80567. let datasetUrl = this.datasets.url;
  80568. let me = this;
  80569. FetchRequest.get(datasetUrl)
  80570. .then(function (response) {
  80571. return response.json();
  80572. })
  80573. .then(function (results) {
  80574. if (results.datasetInfo) {
  80575. let datasetInfo = results.datasetInfo;
  80576. me.datasetsInfo = {
  80577. dataSourceName: datasetInfo.dataSourceName,
  80578. datasetName: datasetInfo.name,
  80579. mapName: results.name
  80580. };
  80581. success({
  80582. result: me.datasetsInfo
  80583. });
  80584. }
  80585. })
  80586. .catch(function (error) {
  80587. console.log(error);
  80588. me._fireFailedEvent(error);
  80589. });
  80590. }
  80591. /**
  80592. * @private
  80593. * @function ChartModel.prototype.getDataFeatures
  80594. * @description 请求数据集的数据信息
  80595. * @param {Object} results - 数据集信息。
  80596. * @param {function} success - 成功回调函数。
  80597. */
  80598. getDataFeatures(results, success) {
  80599. let datasetsInfo = results.result;
  80600. let getFeatureParam, getFeatureBySQLParams, getFeatureBySQLService;
  80601. let params = {
  80602. name: datasetsInfo.datasetName + '@' + datasetsInfo.dataSourceName
  80603. };
  80604. Object.assign(params, this.datasets.queryInfo);
  80605. getFeatureParam = new FilterParameter(params);
  80606. getFeatureBySQLParams = new GetFeaturesBySQLParameters({
  80607. queryParameter: getFeatureParam,
  80608. datasetNames: [datasetsInfo.dataSourceName + ':' + datasetsInfo.datasetName],
  80609. fromIndex: 0,
  80610. toIndex: 100000
  80611. });
  80612. getFeatureBySQLService = new GetFeaturesBySQLService(datasetsInfo.dataUrl, {
  80613. eventListeners: {
  80614. processCompleted: success,
  80615. processFailed: function () {}
  80616. }
  80617. });
  80618. getFeatureBySQLService.processAsync(getFeatureBySQLParams);
  80619. }
  80620. /**
  80621. * @private
  80622. * @function ChartModel.prototype.getLayerFeatures
  80623. * @description 请求图层要素的数据信息
  80624. * @param {Object} results - 数据集信息。
  80625. * @param {Callbacks} success - 成功回调函数。
  80626. */
  80627. getLayerFeatures(results, success) {
  80628. let datasetsInfo = results.result;
  80629. let queryParam, queryBySQLParams, queryBySQLService;
  80630. let params = {
  80631. name: datasetsInfo.mapName
  80632. };
  80633. Object.assign(params, this.datasets.queryInfo);
  80634. queryParam = new FilterParameter(params);
  80635. queryBySQLParams = new QueryBySQLParameters({
  80636. queryParams: [queryParam],
  80637. expectCount: 100000
  80638. });
  80639. queryBySQLService = new QueryBySQLService(datasetsInfo.dataUrl, {
  80640. eventListeners: {
  80641. processCompleted: success,
  80642. processFailed: function () {}
  80643. }
  80644. });
  80645. queryBySQLService.processAsync(queryBySQLParams);
  80646. }
  80647. /**
  80648. * @private
  80649. * @function ChartModel.prototype.getDataInfoByIptl
  80650. * @description 用dataId获取iportal的数据。
  80651. * @param {Callbacks} success - 成功回调函数。
  80652. *
  80653. */
  80654. getDataInfoByIptl(success) {
  80655. // success是chart的回调
  80656. this.getServiceInfo(this.datasets.url, success);
  80657. }
  80658. /**
  80659. * @private
  80660. * @function ChartModel.prototype.getServiceInfo
  80661. * @description 用iportal获取dataItemServices。
  80662. * @param {string} url
  80663. * @param {Callbacks} success - 成功回调函数。
  80664. * */
  80665. getServiceInfo(url, success) {
  80666. let me = this;
  80667. FetchRequest.get(url, null, {
  80668. withCredentials: this.datasets.withCredentials
  80669. })
  80670. .then((response) => {
  80671. return response.json();
  80672. })
  80673. .then((data) => {
  80674. if (data.succeed === false) {
  80675. //请求失败
  80676. me._fireFailedEvent(data);
  80677. return;
  80678. }
  80679. // 是否有rest服务
  80680. if (data.dataItemServices && data.dataItemServices.length > 0) {
  80681. let dataItemServices = data.dataItemServices,
  80682. resultData;
  80683. dataItemServices.forEach((item) => {
  80684. // 如果有restdata并且发布成功,就请求restdata服务
  80685. // 如果有restmap并且发布成功,就请求restmap服务
  80686. // 其他情况就请求iportal/content.json
  80687. if (item.serviceType === 'RESTDATA' && item.serviceStatus === 'PUBLISHED') {
  80688. resultData = item;
  80689. } else if (item.serviceType === 'RESTMAP' && item.serviceStatus === 'PUBLISHED') {
  80690. resultData = item;
  80691. } else {
  80692. me.getDatafromContent(url, success);
  80693. return;
  80694. }
  80695. });
  80696. // 如果有服务,获取数据源和数据集, 然后请求rest服务
  80697. resultData && me.getDatafromRest(resultData.serviceType, resultData.address, success);
  80698. } else {
  80699. me.getDatafromContent(url, success);
  80700. return;
  80701. }
  80702. })
  80703. .catch((error) => {
  80704. console.log(error);
  80705. me._fireFailedEvent(error);
  80706. });
  80707. }
  80708. /**
  80709. * @private
  80710. * @function ChartModel.prototype.getDatafromURL
  80711. * @description 用iportal获取数据。(通过固定的url来请求,但是不能请求工作空间的数据)
  80712. * @param {string} url
  80713. * @param {Callbacks} success - 成功回调函数。
  80714. */
  80715. getDatafromContent(url, success) {
  80716. // 成功回调传入的results
  80717. let results = {
  80718. result: {}
  80719. },
  80720. me = this;
  80721. url += '/content.json?pageSize=9999999&currentPage=1';
  80722. // 获取图层数据
  80723. FetchRequest.get(url, null, {
  80724. withCredentials: this.datasets.withCredentials
  80725. })
  80726. .then((response) => {
  80727. return response.json();
  80728. })
  80729. .then((data) => {
  80730. if (data.succeed === false) {
  80731. //请求失败
  80732. me._fireFailedEvent(data);
  80733. return;
  80734. }
  80735. if (data.type) {
  80736. if (data.type === 'JSON' || data.type === 'GEOJSON') {
  80737. // 将字符串转换成json
  80738. data.content = JSON.parse(data.content.trim());
  80739. // 如果是json文件 data.content = {type:'fco', features},格式不固定
  80740. if (!data.content.features) {
  80741. //json格式解析失败
  80742. console.log(Lang.i18n('msg_jsonResolveFiled'));
  80743. return;
  80744. }
  80745. let features = this._formatGeoJSON(data.content);
  80746. results.result.features = {
  80747. type: data.content.type,
  80748. features
  80749. };
  80750. } else if (data.type === 'EXCEL' || data.type === 'CSV') {
  80751. let features = this._excelData2Feature(data.content);
  80752. results.result.features = {
  80753. type: 'FeatureCollection',
  80754. features
  80755. };
  80756. }
  80757. success(results, 'content');
  80758. }
  80759. }, this)
  80760. .catch((error) => {
  80761. console.log(error);
  80762. me._fireFailedEvent(error);
  80763. });
  80764. }
  80765. /**
  80766. * @private
  80767. * @function ChartModel.prototype._getDataSource
  80768. * @description 获取数据源名和数据集名。
  80769. * @param {string} serviceType 服务类型
  80770. * @param {string} address 地址
  80771. * @param {Callbacks} success - 成功回调函数。
  80772. * @return {Array.<string>} ["数据源名:数据集名"]
  80773. * @return {string} 图层名
  80774. */
  80775. getDatafromRest(serviceType, address, success) {
  80776. let me = this,
  80777. withCredentials = this.datasets.withCredentials;
  80778. if (serviceType === 'RESTDATA') {
  80779. let url = `${address}/data/datasources`,
  80780. sourceName,
  80781. datasetName;
  80782. // 请求获取数据源名
  80783. FetchRequest.get(url, null, {
  80784. withCredentials
  80785. })
  80786. .then((response) => {
  80787. return response.json();
  80788. })
  80789. .then((data) => {
  80790. sourceName = data.datasourceNames[0];
  80791. url = `${address}/data/datasources/${sourceName}/datasets`;
  80792. // 请求获取数据集名
  80793. FetchRequest.get(url, null, {
  80794. withCredentials
  80795. })
  80796. .then((response) => {
  80797. return response.json();
  80798. })
  80799. .then((data) => {
  80800. datasetName = data.datasetNames[0];
  80801. // 请求restdata服务
  80802. me.getDatafromRestData(`${address}/data`, [sourceName + ':' + datasetName], success);
  80803. return [sourceName + ':' + datasetName];
  80804. })
  80805. .catch(function (error) {
  80806. me._fireFailedEvent(error);
  80807. });
  80808. })
  80809. .catch(function (error) {
  80810. me._fireFailedEvent(error);
  80811. });
  80812. } else {
  80813. // 如果是地图服务
  80814. let url = `${address}/maps`,
  80815. mapName,
  80816. layerName,
  80817. path;
  80818. // 请求获取地图名
  80819. FetchRequest.get(url, null, {
  80820. withCredentials
  80821. })
  80822. .then((response) => {
  80823. return response.json();
  80824. })
  80825. .then((data) => {
  80826. mapName = data[0].name;
  80827. path = data[0].path;
  80828. url = url = `${address}/maps/${mapName}/layers`;
  80829. // 请求获取图层名
  80830. FetchRequest.get(url, null, {
  80831. withCredentials
  80832. })
  80833. .then((response) => {
  80834. return response.json();
  80835. })
  80836. .then((data) => {
  80837. layerName = data[0].subLayers.layers[0].caption;
  80838. // 请求restmap服务
  80839. me.getDatafromRestMap(layerName, path, success);
  80840. return layerName;
  80841. })
  80842. .catch(function (error) {
  80843. me._fireFailedEvent(error);
  80844. });
  80845. })
  80846. .catch(function (error) {
  80847. me._fireFailedEvent(error);
  80848. });
  80849. }
  80850. }
  80851. /**
  80852. * @private
  80853. * @function ChartModel.prototype.getDatafromRestData
  80854. * @description 请求restdata服务
  80855. * @param {string} url
  80856. * @param {Array<string>} dataSource [数据源名:数据集名]
  80857. * @param {Callbacks} success - 成功回调函数。
  80858. */
  80859. getDatafromRestData(url, dataSource, success) {
  80860. let me = this;
  80861. this.datasets.queryInfo.attributeFilter = this.datasets.queryInfo.attributeFilter || 'SmID>0';
  80862. this._getFeatureBySQL(
  80863. url,
  80864. dataSource,
  80865. this.datasets.queryInfo,
  80866. (results) => {
  80867. // 此时的features已经处理成geojson了
  80868. success(results, 'RESTDATA');
  80869. },
  80870. (error) => {
  80871. console.log(error);
  80872. me._fireFailedEvent(error);
  80873. }
  80874. );
  80875. }
  80876. /**
  80877. * @private
  80878. * @function ChartModel.prototype.getDatafromRestMap
  80879. * @description 请求restmap服务
  80880. * @param {string} dataSource layerName
  80881. * @param {string} path - map服务地址。
  80882. * @param {Callbacks} success - 成功回调函数。
  80883. */
  80884. getDatafromRestMap(dataSource, path, success) {
  80885. let me = this;
  80886. this.datasets.queryInfo.attributeFilter = this.datasets.queryInfo.attributeFilter || 'smid=1';
  80887. this._queryFeatureBySQL(
  80888. path,
  80889. dataSource,
  80890. this.datasets.queryInfo,
  80891. null,
  80892. null,
  80893. (results) => {
  80894. // let features = result.result.recordsets[0].features;
  80895. success(results, 'RESTMAP');
  80896. },
  80897. (error) => {
  80898. console.log(error);
  80899. me._fireFailedEvent(error);
  80900. }
  80901. );
  80902. }
  80903. /**
  80904. * @private
  80905. * @function ChartModel.prototype._getFeatureBySQL
  80906. * @description 通过 sql 方式查询数据。
  80907. */
  80908. _getFeatureBySQL(url, datasetNames, queryInfo, processCompleted, processFaild) {
  80909. let getFeatureParam, getFeatureBySQLService, getFeatureBySQLParams;
  80910. let params = {
  80911. name: datasetNames.join().replace(':', '@')
  80912. };
  80913. Object.assign(params, queryInfo);
  80914. getFeatureParam = new FilterParameter(params);
  80915. getFeatureBySQLParams = new GetFeaturesBySQLParameters({
  80916. queryParameter: getFeatureParam,
  80917. datasetNames: datasetNames,
  80918. fromIndex: 0,
  80919. toIndex: 100000,
  80920. returnContent: true
  80921. });
  80922. let options = {
  80923. eventListeners: {
  80924. processCompleted: (getFeaturesEventArgs) => {
  80925. processCompleted && processCompleted(getFeaturesEventArgs);
  80926. },
  80927. processFailed: (e) => {
  80928. processFaild && processFaild(e);
  80929. }
  80930. }
  80931. };
  80932. getFeatureBySQLService = new GetFeaturesBySQLService(url, options);
  80933. getFeatureBySQLService.processAsync(getFeatureBySQLParams);
  80934. }
  80935. /**
  80936. * @private
  80937. * @function ChartModel.prototype._queryFeatureBySQL
  80938. * @description 通过 sql 方式查询数据。
  80939. */
  80940. _queryFeatureBySQL(
  80941. url,
  80942. layerName,
  80943. queryInfo,
  80944. fields,
  80945. epsgCode,
  80946. processCompleted,
  80947. processFaild,
  80948. startRecord,
  80949. recordLength,
  80950. onlyAttribute
  80951. ) {
  80952. var queryParam, queryBySQLParams;
  80953. var filterParams = {
  80954. name: layerName
  80955. };
  80956. Object.assign(filterParams, queryInfo);
  80957. queryParam = new FilterParameter(filterParams);
  80958. if (fields) {
  80959. queryParam.fields = fields;
  80960. }
  80961. var params = {
  80962. queryParams: [queryParam]
  80963. };
  80964. if (onlyAttribute) {
  80965. params.queryOption = QueryOption.ATTRIBUTE;
  80966. }
  80967. startRecord && (params.startRecord = startRecord);
  80968. recordLength && (params.expectCount = recordLength);
  80969. if (epsgCode) {
  80970. params.prjCoordSys = {
  80971. epsgCode: epsgCode
  80972. };
  80973. }
  80974. queryBySQLParams = new QueryBySQLParameters(params);
  80975. this._queryBySQL(url, queryBySQLParams, (data) => {
  80976. data.type === 'processCompleted' ? processCompleted(data) : processFaild(data);
  80977. });
  80978. }
  80979. /**
  80980. * @function ChartModel.prototype._queryBySQL
  80981. * @description SQL 查询服务。
  80982. * @param {QueryBySQLParameters} params - SQL 查询相关参数类。
  80983. * @param {RequestCallback} callback - 回调函数。
  80984. * @param {DataFormat} [resultFormat=DataFormat.GEOJSON] - 结果类型。
  80985. */
  80986. _queryBySQL(url, params, callback, resultFormat) {
  80987. var me = this;
  80988. var queryBySQLService = new QueryBySQLService(url, {
  80989. eventListeners: {
  80990. scope: me,
  80991. processCompleted: callback,
  80992. processFailed: callback
  80993. },
  80994. format: me._processFormat(resultFormat)
  80995. });
  80996. queryBySQLService.processAsync(params);
  80997. }
  80998. /**
  80999. * @function ChartModel.prototype._processFormat
  81000. * @description 将数据转换成geojson。
  81001. * @param {Object} resultFormat - 返回结果集。
  81002. * @return {Object} [resultFormat=DataFormat.GEOJSON] - 结果类型。
  81003. */
  81004. _processFormat(resultFormat) {
  81005. return resultFormat ? resultFormat : DataFormat.GEOJSON;
  81006. }
  81007. /**
  81008. * @private
  81009. * @function ChartModel.prototype._formatGeoJSON
  81010. * @description 格式 GeoJSON。
  81011. * @param {GeoJSON} data - GeoJSON 数据。
  81012. */
  81013. _formatGeoJSON(data) {
  81014. let features = data.features;
  81015. features.forEach((row, index) => {
  81016. row.properties['index'] = index;
  81017. });
  81018. return features;
  81019. }
  81020. /**
  81021. * @private
  81022. * @description 将 csv 和 xls 文件内容转换成 geojson
  81023. * @function ChartModel.prototype._excelData2Feature
  81024. * @param content 文件内容
  81025. * @param layerInfo 图层信息
  81026. * @returns {Array} feature的数组集合
  81027. */
  81028. _excelData2Feature(dataContent) {
  81029. let fieldCaptions = dataContent.colTitles;
  81030. //位置属性处理
  81031. let xfieldIndex = -1,
  81032. yfieldIndex = -1;
  81033. for (let i = 0, len = fieldCaptions.length; i < len; i++) {
  81034. if (FileReaderUtil.isXField(fieldCaptions[i])) {
  81035. xfieldIndex = i;
  81036. }
  81037. if (FileReaderUtil.isYField(fieldCaptions[i])) {
  81038. yfieldIndex = i;
  81039. }
  81040. }
  81041. // feature 构建后期支持坐标系 4326/3857
  81042. let features = [];
  81043. for (let i = 0, len = dataContent.rows.length; i < len; i++) {
  81044. let row = dataContent.rows[i];
  81045. let x = Number(row[xfieldIndex]),
  81046. y = Number(row[yfieldIndex]);
  81047. //属性信息
  81048. let attributes = {};
  81049. for (let index in dataContent.colTitles) {
  81050. let key = dataContent.colTitles[index];
  81051. attributes[key] = dataContent.rows[i][index];
  81052. }
  81053. attributes['index'] = i + '';
  81054. //目前csv 只支持处理点,所以先生成点类型的 geojson
  81055. let feature = {
  81056. type: 'Feature',
  81057. geometry: {
  81058. type: 'Point',
  81059. coordinates: [x, y]
  81060. },
  81061. properties: attributes
  81062. };
  81063. features.push(feature);
  81064. }
  81065. return features;
  81066. }
  81067. /**
  81068. * @private
  81069. * @description 请求数据失败的事件
  81070. * @function ChartModel.prototype._fireFailedEvent
  81071. * @param {Object} error 错误信息
  81072. */
  81073. _fireFailedEvent(error) {
  81074. let errorData = error
  81075. ? {
  81076. error,
  81077. message: Lang.i18n('msg_getdatafailed')
  81078. }
  81079. : {
  81080. message: Lang.i18n('msg_getdatafailed')
  81081. };
  81082. /**
  81083. * @event ChartModel#getdatafailed
  81084. * @description 监听到获取数据失败事件后触发
  81085. * @property {Object} error - 事件对象。
  81086. */
  81087. this.events.triggerEvent('getdatafailed', errorData);
  81088. }
  81089. }
  81090. ;// CONCATENATED MODULE: ./src/common/components/chart/ChartViewModel.js
  81091. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  81092. * This program are made available under the terms of the Apache License, Version 2.0
  81093. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  81094. /**
  81095. * @class ChartViewModel
  81096. * @aliasclass Components.ChartViewModel
  81097. * @deprecatedclass SuperMap.Components.ChartViewModel
  81098. * @classdesc 图表组件功能类。
  81099. * @category Components Chart
  81100. * @version 10.0.0
  81101. * @param {Object} options - 可选参数。
  81102. * @param {string} options.type - 图表类型。
  81103. * @param {ChartView.Datasets} options.datasets - 数据来源。
  81104. * @param {Array.<Object>} options.chartOptions - 图表可选配置。
  81105. * @param {Array.<Object>} options.chartOptions.xAxis - X轴可选参数。
  81106. * @param {string} options.chartOptions.xAxis.field - X轴字段名。
  81107. * @param {string} options.chartOptions.xAxis.name - X轴名称。
  81108. * @param {Array.<Object>} options.chartOptions.yAxis - Y轴可选参数。
  81109. * @param {string} options.chartOptions.yAxis.field - Y轴字段名。
  81110. * @param {string} options.chartOptions.yAxis.name - Y轴名称。
  81111. * @fires ChartViewModel#getdatafailed
  81112. * @usage
  81113. */
  81114. class ChartViewModel {
  81115. constructor(options) {
  81116. this.datasets = options.datasets;
  81117. this.xField = [];
  81118. this.yField = [];
  81119. this.grid = {
  81120. top: "50px",
  81121. bottom: "50px",
  81122. left: "50px",
  81123. right: "60px"
  81124. };
  81125. this.chartType = options.type || "bar";
  81126. this._initXYField(options.chartOptions);
  81127. this.EVENT_TYPES = ["getdatafailed"];
  81128. this.events = new Events(this, null, this.EVENT_TYPES);
  81129. }
  81130. /**
  81131. * @function ChartViewModel.prototype._initXYField
  81132. * @description 初始化XY字段。
  81133. * @private
  81134. * @param {Object} chartOptions - options里的图表参数。
  81135. */
  81136. _initXYField(chartOptions) {
  81137. let me = this;
  81138. if (chartOptions && chartOptions.length > 0) {
  81139. chartOptions.forEach(function (option) {
  81140. if (option.xAxis) {
  81141. me.xField.push({
  81142. field: option.xAxis.field,
  81143. name: option.xAxis.name
  81144. });
  81145. }
  81146. if (option.yAxis) {
  81147. me.yField.push({
  81148. field: option.yAxis.field,
  81149. name: option.yAxis.name
  81150. });
  81151. }
  81152. });
  81153. }
  81154. }
  81155. /**
  81156. * @function ChartViewModel.prototype.getDatasetInfo
  81157. * @description 获得数据集数据。
  81158. * @param {function} success - 成功回调函数。
  81159. */
  81160. getDatasetInfo(success) {
  81161. this.createChart = success;
  81162. if (this.datasets && this._checkUrl(this.datasets.url)) {
  81163. this.chartModel = new ChartModel(this.datasets);
  81164. if(this.datasets.type === 'iServer'){
  81165. this.chartModel.getDatasetInfo(this._getDatasetInfoSuccess.bind(this));
  81166. }else if(this.datasets.type === 'iPortal'){
  81167. this.chartModel.getDataInfoByIptl(this._getDataInfoSuccess.bind(this));
  81168. }
  81169. /**
  81170. * @event ChartViewModel#getdatafailed
  81171. * @description 监听到获取数据失败事件后触发。
  81172. * @property {Object} error - 事件对象。
  81173. */
  81174. this.chartModel.events.on({"getdatafailed": (error) => {
  81175. this.events.triggerEvent("getdatafailed", error)
  81176. }});
  81177. }
  81178. }
  81179. /**
  81180. * @function ChartViewModel.prototype._getDatasetInfoSuccess
  81181. * @description 成功回调函数。
  81182. * @private
  81183. * @param {Object} results - 数据集信息。
  81184. */
  81185. _getDatasetInfoSuccess(results) {
  81186. let datasetUrl = this.datasets.url;
  81187. //判断服务为地图服务 或者 数据服务
  81188. let restIndex = datasetUrl.indexOf("rest");
  81189. if (restIndex > 0) {
  81190. let index = datasetUrl.indexOf("/", restIndex + 5);
  81191. let type = datasetUrl.substring(restIndex + 5, index);
  81192. let dataUrl = datasetUrl.substring(0, restIndex + 4) + "/data";
  81193. if (type === "maps") {
  81194. let mapIndex = datasetUrl.indexOf("/", index + 1);
  81195. let mapName = datasetUrl.substring(index + 1, mapIndex);
  81196. dataUrl = datasetUrl.substring(0, restIndex + 4) + "/maps/" + mapName;
  81197. results.result.dataUrl = dataUrl;
  81198. this._getLayerFeatures(results);
  81199. } else if (type === "data") {
  81200. results.result.dataUrl = dataUrl;
  81201. this._getDataFeatures(results);
  81202. }
  81203. }
  81204. }
  81205. /**
  81206. * @function ChartViewModel.prototype._getDataInfoSuccess
  81207. * @description 请求iportal数据成功之后的回调。
  81208. * @private
  81209. */
  81210. _getDataInfoSuccess(results, type) {
  81211. let me = this;
  81212. if(type === 'RESTMAP'){
  81213. me._getChartDatasFromLayer(results);
  81214. }else{
  81215. me._getChartDatas(results);
  81216. }
  81217. }
  81218. /**
  81219. * @function ChartViewModel.prototype._getDataFeatures
  81220. * @description 请求数据集的数据信息
  81221. * @private
  81222. * @param {Object} results - 数据集信息
  81223. */
  81224. _getDataFeatures(results) {
  81225. this.chartModel.getDataFeatures(results, this._getChartDatas.bind(this));
  81226. }
  81227. /**
  81228. * @function ChartViewModel.prototype._getLayerFeatures
  81229. * @description 请求图层的数据信息。
  81230. * @private
  81231. * @param {Object} results - 数据集信息。
  81232. */
  81233. _getLayerFeatures(results) {
  81234. this.chartModel.getLayerFeatures(results, this._getChartDatasFromLayer.bind(this));
  81235. }
  81236. /**
  81237. * @function ChartViewModel.prototype._getChartDatas
  81238. * @description 将请求回来的数据转换为图表所需的数据格式。
  81239. * @private
  81240. * @param {Object} results - 数据要素信息。
  81241. */
  81242. _getChartDatas(results) {
  81243. if (results) {
  81244. // 数据来自restdata---results.result.features
  81245. this.features = results.result.features;
  81246. let features = this.features.features;
  81247. let data = {};
  81248. if (features.length) {
  81249. let feature = features[0];
  81250. let attrFields = [],
  81251. itemTypes = [];
  81252. for (let attr in feature.properties) {
  81253. attrFields.push(attr);
  81254. itemTypes.push(this._getDataType(feature.properties[attr]));
  81255. }
  81256. data = {
  81257. features,
  81258. fieldCaptions: attrFields,
  81259. fieldTypes: itemTypes,
  81260. fieldValues: []
  81261. }
  81262. for (let m in itemTypes) {
  81263. let fieldValue = [];
  81264. for (let j in features) {
  81265. let feature = features[j];
  81266. let caption = data.fieldCaptions[m];
  81267. let value = feature.properties[caption];
  81268. fieldValue.push(value);
  81269. }
  81270. data.fieldValues.push(fieldValue);
  81271. }
  81272. this.createChart(data);
  81273. }
  81274. }
  81275. }
  81276. /**
  81277. * @function ChartViewModel.prototype._getChartDatasFromLayer
  81278. * @description 将请求回来的数据转换为图表所需的数据格式。
  81279. * @private
  81280. * @param {Object} results - 图层数据要素信息。
  81281. */
  81282. _getChartDatasFromLayer(results) {
  81283. if (results.result.recordsets) {
  81284. let recordsets = results.result.recordsets[0];
  81285. let features = recordsets.features.features;
  81286. this.features = recordsets.features;
  81287. let data = {};
  81288. if (features.length) {
  81289. data = {
  81290. features: recordsets.features,
  81291. fieldCaptions: recordsets.fieldCaptions,
  81292. fieldTypes: recordsets.fieldTypes,
  81293. fieldValues: []
  81294. }
  81295. for (let m in data.fieldCaptions) {
  81296. let fieldValue = [];
  81297. for (let j in features) {
  81298. let feature = features[j];
  81299. let caption = data.fieldCaptions[m];
  81300. let value = feature.properties[caption];
  81301. fieldValue.push(value);
  81302. }
  81303. data.fieldValues.push(fieldValue);
  81304. }
  81305. this.createChart(data);
  81306. }
  81307. }
  81308. }
  81309. /**
  81310. * @function ChartViewModel.prototype._createChartOptions
  81311. * @description 创建图表所需参数。
  81312. * @private
  81313. * @param {Object} data - 图表数据。
  81314. */
  81315. _createChartOptions(data) {
  81316. this.calculatedData = this._createChartDatas(data);
  81317. return this.updateChartOptions(this.chartType);
  81318. }
  81319. /**
  81320. * @function ChartViewModel.prototype.changeType
  81321. * @description 改变图表类型。
  81322. * @param {string} type - 图表类型。
  81323. */
  81324. changeType(type) {
  81325. if (type !== this.chartType) {
  81326. this.chartType = type;
  81327. return this.updateChartOptions(this.chartType);
  81328. }
  81329. }
  81330. /**
  81331. * @function ChartViewModel.prototype.updateData
  81332. * @description 改变图表类型。
  81333. * @param {ChartView.Datasets} datasets - 数据来源。
  81334. * @param {function} success 成功回调函数。
  81335. */
  81336. updateData(datasets, chartOption, success) {
  81337. this.updateChart = success;
  81338. this.xField = [];
  81339. this.yField = [];
  81340. this._initXYField(chartOption);
  81341. // type的设置默认值
  81342. datasets.type = datasets.type || 'iServer';
  81343. // withCredentials的设置默认值
  81344. datasets.withCredentials = datasets.withCredentials || false;
  81345. this.datasets = datasets;
  81346. this.getDatasetInfo(this._updateDataSuccess.bind(this));
  81347. }
  81348. /**
  81349. * @function ChartViewModel.prototype._updateDataSuccess
  81350. * @description 改变图表类型。
  81351. * @private
  81352. * @param {Object} data - 图表数据。
  81353. */
  81354. _updateDataSuccess(data) {
  81355. let options = this._createChartOptions(data);
  81356. this.updateChart(options);
  81357. }
  81358. /**
  81359. * @function ChartViewModel.prototype.updateChartOptions
  81360. * @description 更新图表所需参数。
  81361. * @param {string} type - 图表类型。
  81362. * @param {Object} style - 图表样式。
  81363. */
  81364. updateChartOptions(type, style) {
  81365. if (this.calculatedData) {
  81366. let grid = this.grid;
  81367. let series = this._createChartSeries(this.calculatedData, type);
  81368. let datas = [];
  81369. for (let i in this.calculatedData.XData) {
  81370. datas.push({
  81371. value: this.calculatedData.XData[i].fieldsData
  81372. });
  81373. }
  81374. let xAxis = {
  81375. type: "category",
  81376. name: this.xField[0].name || "X",
  81377. data: datas,
  81378. nameTextStyle: {
  81379. color: '#fff',
  81380. fontSize: 14
  81381. },
  81382. splitLine: {
  81383. show: false
  81384. },
  81385. axisLine: {
  81386. lineStyle: {
  81387. color: '#eee'
  81388. }
  81389. }
  81390. }
  81391. let yAxis = {
  81392. type: "value",
  81393. name: this.yFieldName || "Y",
  81394. data: {},
  81395. nameTextStyle: {
  81396. color: '#fff',
  81397. fontSize: 14
  81398. },
  81399. splitLine: {
  81400. show: false
  81401. },
  81402. axisLine: {
  81403. lineStyle: {
  81404. color: '#eee'
  81405. }
  81406. }
  81407. }
  81408. let tooltip = {
  81409. formatter: '{b0}: {c0}'
  81410. };
  81411. let backgroundColor = '#404a59';
  81412. if (style) {
  81413. if (style.grid) {
  81414. grid = style.grid;
  81415. }
  81416. if (style.tooltip) {
  81417. tooltip = style.tooltip;
  81418. }
  81419. if (style.backgroundColor) {
  81420. backgroundColor = style.backgroundColor;
  81421. }
  81422. }
  81423. return {
  81424. backgroundColor: backgroundColor,
  81425. grid: grid,
  81426. series: series,
  81427. xAxis: xAxis,
  81428. yAxis: yAxis,
  81429. tooltip: tooltip
  81430. }
  81431. }
  81432. }
  81433. /**
  81434. * @function ChartViewModel.prototype._createChartDatas
  81435. * @description 构建图表数据。
  81436. * @private
  81437. * @param {Object} data - 源数据。
  81438. */
  81439. _createChartDatas(data) {
  81440. let fieldIndex = 0, yfieldIndexs = [];
  81441. let fieldCaptions = data.fieldCaptions;
  81442. let me = this;
  81443. //X
  81444. fieldCaptions.forEach(function (field, index) {
  81445. if (me.xField[0] && field === me.xField[0].field) {
  81446. fieldIndex = index;
  81447. }
  81448. });
  81449. //Y
  81450. this.yFieldName = "";
  81451. this.yField.forEach(function (value, index) {
  81452. if (index !== 0) {
  81453. me.yFieldName = me.yFieldName + ",";
  81454. }
  81455. me.yFieldName = me.yFieldName + value.name;
  81456. fieldCaptions.forEach(function (field, index) {
  81457. if (field === value.field) {
  81458. yfieldIndexs.push(index);
  81459. }
  81460. });
  81461. })
  81462. let datas = this._getAttrData(data, fieldIndex);
  81463. let yDatas = [];
  81464. if (yfieldIndexs.length > 0) {
  81465. yfieldIndexs.forEach(function (yfieldIndex) {
  81466. let yData = [];
  81467. for (let i in data.fieldValues[yfieldIndex]) {
  81468. yData.push({
  81469. value: data.fieldValues[yfieldIndex][i]
  81470. });
  81471. }
  81472. yDatas.push(yData);
  81473. });
  81474. } else { //未指定Y字段时,y轴计数
  81475. let YData = [],
  81476. XData = [],
  81477. len = datas.length;
  81478. //计算X轴,Y轴数据,并去重
  81479. for (let i = 0; i < len; i++) {
  81480. let isSame = false;
  81481. for (let j = 0, leng = XData.length; j < leng; j++) {
  81482. if (datas[i].fieldsData === XData[j].fieldsData) {
  81483. YData[j].value++;
  81484. XData[j].recordIndexs.push(i);
  81485. isSame = true;
  81486. break;
  81487. }
  81488. }
  81489. if (!isSame) {
  81490. if (datas[i].fieldsData) {
  81491. XData.push({ fieldsData: datas[i].fieldsData, recordIndexs: [i] });
  81492. YData.push({ value: 1 });
  81493. }
  81494. }
  81495. }
  81496. datas = XData;
  81497. yDatas = [YData];
  81498. }
  81499. return {
  81500. XData: datas,
  81501. YData: yDatas
  81502. }
  81503. }
  81504. /**
  81505. * @function ChartViewModel.prototype._getAttrData
  81506. * @description 选中字段数据。
  81507. * @private
  81508. * @param {Object} datacontent - 图表数据。
  81509. * @param {number} index - 字段索引。
  81510. */
  81511. _getAttrData(datacontent, index) {
  81512. if (index === 0) {
  81513. this.xField = [{
  81514. field: datacontent.fieldCaptions[index],
  81515. name: datacontent.fieldCaptions[index]
  81516. }];
  81517. }
  81518. let fieldsDatas = [];
  81519. for (let i = 0, len = datacontent.fieldValues[index].length; i < len; i++) {
  81520. let value = datacontent.fieldValues[index][i];
  81521. fieldsDatas.push({
  81522. recordIndexs: i,
  81523. fieldsData: value
  81524. });
  81525. }
  81526. return fieldsDatas;
  81527. }
  81528. /**
  81529. * @function ChartViewModel.prototype._createChartSeries
  81530. * @description 图表数据。
  81531. * @private
  81532. * @param {Object} calculatedData - 图表数据。
  81533. * @param {string} chartType - 图表类型。
  81534. */
  81535. _createChartSeries(calculatedData, chartType) {
  81536. let series = [];
  81537. let yDatas = calculatedData.YData;
  81538. yDatas.forEach(function (yData) {
  81539. let value = 0;
  81540. let serieData = [];
  81541. for (let data of yData) {
  81542. value = data.value;
  81543. serieData.push({
  81544. value: value
  81545. });
  81546. }
  81547. let serie = {
  81548. type: chartType,
  81549. data: serieData,
  81550. name: "y"
  81551. };
  81552. series.push(serie);
  81553. });
  81554. return series;
  81555. }
  81556. /**
  81557. * @function ChartViewModel.prototype._isDate
  81558. * @description 判断是否为日期。
  81559. * @private
  81560. * @param {string} data - 字符串。
  81561. */
  81562. _isDate(data) {
  81563. 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;
  81564. return reg.test(data);
  81565. }
  81566. /**
  81567. * @function ChartViewModel.prototype._isNumber
  81568. * @description 判断是否为数值。
  81569. * @private
  81570. * @param {string} data - 字符串。
  81571. */
  81572. _isNumber(data) {
  81573. let mdata = Number(data);
  81574. if (mdata === 0) {
  81575. return true;
  81576. }
  81577. return !isNaN(mdata);
  81578. }
  81579. /**
  81580. * @function ChartViewModel.prototype._getDataType
  81581. * @description 判断数据的类型。
  81582. * @private
  81583. * @param {string} data - 字符串。
  81584. */
  81585. _getDataType(data) {
  81586. if (data !== null && data !== undefined && data !== '') {
  81587. if (this._isDate(data)) {
  81588. return "DATE";
  81589. }
  81590. if (this._isNumber(data)) {
  81591. return "NUMBER";
  81592. }
  81593. }
  81594. return "STRING";
  81595. }
  81596. /**
  81597. * @function ChartViewModel.prototype._checkUrl
  81598. * @description 检查url是否符合要求。
  81599. * @private
  81600. * @param {string} url。
  81601. */
  81602. _checkUrl(url) {
  81603. let match;
  81604. if (url === '' || !this._isMatchUrl(url)) {
  81605. match = false;
  81606. } else if (/^http[s]?:\/\/localhost/.test(url) || /^http[s]?:\/\/127.0.0.1/.test(url)) {
  81607. //不是实际域名
  81608. match = false;
  81609. } else {
  81610. match = true;
  81611. }
  81612. return match;
  81613. }
  81614. /**
  81615. * @function ChartViewModel.prototype._isMatchUrl
  81616. * @description 判断输入的地址是否符合地址格式。
  81617. * @private
  81618. * @param {string} str - url。
  81619. */
  81620. _isMatchUrl(str) {
  81621. var reg = new RegExp('(https?|http|file|ftp)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]');
  81622. return reg.test(str);
  81623. }
  81624. /**
  81625. * @function ChartViewModel.prototype.getStyle
  81626. * @description 获取图表样式。
  81627. */
  81628. getStyle() {
  81629. let style = {
  81630. grid: this.grid,
  81631. tooltip: this.tooltip,
  81632. backgroundColor: this.backgroundColor
  81633. }
  81634. return style;
  81635. }
  81636. /**
  81637. * @function ChartViewModel.prototype.getFeatures
  81638. * @description 获取地图服务,数据服务请求返回的数据。
  81639. */
  81640. getFeatures() {
  81641. return this.features;
  81642. }
  81643. /**
  81644. * @function ChartViewModel.prototype.setStyle
  81645. * @description 设置图表样式。
  81646. * @param {Object} style - 图表样式
  81647. */
  81648. setStyle(style) {
  81649. return this.updateChartOptions(this.chartType, style);
  81650. }
  81651. }
  81652. ;// CONCATENATED MODULE: ./src/common/components/chart/ChartView.js
  81653. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  81654. * This program are made available under the terms of the Apache License, Version 2.0
  81655. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  81656. /**
  81657. * @class ChartView
  81658. * @aliasclass Components.ChartView
  81659. * @deprecatedclass SuperMap.Components.Chart
  81660. * @classdesc 图表组件。
  81661. * @modulecategory Components
  81662. * @version 9.1.2
  81663. * @param {string} domID - 图表dom元素ID。
  81664. * @param {Object} options - 可选参数。
  81665. * @param {string} options.type - 图表类型。
  81666. * @param {ChartView.Datasets} options.datasets - 数据来源。
  81667. * @param {Array.<Object>} options.chartOptions - 图表可选参数。
  81668. * @param {Array.<Object>} options.chartOptions.xAxis - 图表X轴。
  81669. * @param {string} options.chartOptions.xAxis.field - 图表X轴字段名。
  81670. * @param {string} options.chartOptions.xAxis.name - 图表X轴名称。
  81671. * @param {Array.<Object>} options.chartOptions.yAxis - 图表Y轴。
  81672. * @param {string} options.chartOptions.yAxis.field - 图表Y轴字段名。
  81673. * @param {string} options.chartOptions.yAxis.name - 图表Y轴名称。
  81674. * @category Components Chart
  81675. * @usage
  81676. */
  81677. /**
  81678. * @typedef {Object} ChartView.Datasets - 数据来源。
  81679. * @property {string} [type = 'iServer'] - 服务类型 iServer, iPortal。
  81680. * @property {string} url - 服务地址。
  81681. * @property {boolean} [withCredentials = false] - 设置请求是否带cookie。
  81682. * @property {FilterParameter} queryInfo - 查询条件。
  81683. */
  81684. class ChartView {
  81685. constructor(domID, options) {
  81686. this.domID = domID;
  81687. this.chartType = options.type || "bar";
  81688. // 设置options.datasets.type的默认值是iServer
  81689. options.datasets.type = options.datasets.type || 'iServer';
  81690. // 设置withCredentials的默认值为false
  81691. options.datasets.withCredentials = options.datasets.withCredentials || false;
  81692. this.viewModel = new ChartViewModel(options);
  81693. //添加控件。
  81694. this._fillDataToView();
  81695. }
  81696. /**
  81697. * @function ChartView.prototype.onAdd
  81698. * @description 创建图表之后成功回调。
  81699. * @param {function} addChart - 回调函数。
  81700. */
  81701. onAdd(addChart) {
  81702. this.addChart = addChart;
  81703. }
  81704. /**
  81705. * @function ChartView.prototype._fillDataToView
  81706. * @description 填充数据到 view。
  81707. * @private
  81708. */
  81709. _fillDataToView() {
  81710. let messageboxs = new MessageBox();
  81711. //iclient 绑定createChart事件成功回调
  81712. this.viewModel.getDatasetInfo(this._createChart.bind(this));
  81713. this.viewModel.events.on({
  81714. "getdatafailed": (error) => {
  81715. messageboxs.showView(error.message);
  81716. }
  81717. });
  81718. }
  81719. /**
  81720. * @function ChartView.prototype.getStyle
  81721. * @description 获取图表样式。
  81722. */
  81723. getStyle() {
  81724. return this.viewModel.getStyle()
  81725. }
  81726. /**
  81727. * @function ChartView.prototype.getFeatures
  81728. * @description 获取地图服务,数据服务请求返回的数据。
  81729. */
  81730. getFeatures() {
  81731. return this.viewModel.getFeatures();
  81732. }
  81733. /**
  81734. * @function ChartView.prototype.setStyle
  81735. * @description 设置图表样式。
  81736. * @param {Object} style - 图表样式,参考Echarts-options样式设置。
  81737. */
  81738. setStyle(style) {
  81739. let newOptions = this.viewModel.setStyle(style);
  81740. this._updateChart(newOptions);
  81741. }
  81742. /**
  81743. * @function ChartView.prototype.changeType
  81744. * @description 改变图表类型。
  81745. * @param {string} type - 图表类型。
  81746. */
  81747. changeType(type) {
  81748. if (this.chartType !== type) {
  81749. this.chartType = type;
  81750. let newOptions = this.viewModel.changeType(type);
  81751. this._updateChart(newOptions);
  81752. }
  81753. }
  81754. /**
  81755. * @function ChartView.prototype.updateData
  81756. * @description 更新图表数据。
  81757. * @param {ChartView.Datasets} datasets - 数据来源。
  81758. * @param {Object} chartOption - X,Y轴信息。
  81759. */
  81760. updateData(datasets, chartOption) {
  81761. let me = this;
  81762. this.viewModel.updateData(datasets, chartOption, function (options) {
  81763. me._updateChart(options);
  81764. if (me.addChart) {
  81765. me.addChart();
  81766. }
  81767. });
  81768. }
  81769. /**
  81770. * @function ChartView.prototype._createChart
  81771. * @description 创建图表。
  81772. * @private
  81773. * @param {Object} data - 图表数据。
  81774. */
  81775. _createChart(data) {
  81776. this.echart = external_function_try_return_echarts_catch_e_return_namespaceObject.init(
  81777. document.getElementById(this.domID),
  81778. null, {
  81779. renderer: "canvas"
  81780. }
  81781. )
  81782. let options = this.viewModel._createChartOptions(data);
  81783. this.echart.setOption(options);
  81784. if (this.addChart) {
  81785. this.addChart();
  81786. }
  81787. }
  81788. /**
  81789. * @function ChartView.prototype._updateChart
  81790. * @description 更新图表。
  81791. * @private
  81792. * @param {Object} options - 图表参数。
  81793. */
  81794. _updateChart(options) {
  81795. if (this.echart) {
  81796. this.echart.clear();
  81797. this.echart.setOption(options);
  81798. }
  81799. }
  81800. }
  81801. ;// CONCATENATED MODULE: ./src/common/components/templates/TemplateBase.js
  81802. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  81803. * This program are made available under the terms of the Apache License, Version 2.0
  81804. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  81805. /**
  81806. * @class TemplateBase
  81807. * @aliasclass Components.TemplateBase
  81808. * @deprecatedclass SuperMap.Components.TemplateBase
  81809. * @classdesc 组件公用组件父类,用于约束统一封装的公用组件结构。
  81810. * @version 9.1.1
  81811. * @param {Object} options - 组件配置参数。
  81812. * @param {string} options.id - 组件 dom 元素 id。
  81813. * @category Components Common
  81814. * @usage
  81815. */
  81816. class TemplateBase {
  81817. constructor(options) {
  81818. options = options ? options : {};
  81819. /**
  81820. * @member {string} [TemplateBase.prototype.id=null]
  81821. * @description 组件 dom 元素 id。
  81822. */
  81823. this.id = options.id ? options.id : null;
  81824. /**
  81825. * @member {HTMLElement} [TemplateBase.prototype.rootContainer=null]
  81826. * @description 组件 dom 元素对象。
  81827. */
  81828. this.rootContainer = null;
  81829. }
  81830. /**
  81831. * @function TemplateBase.prototype.getElement
  81832. * @description 获取当前组件元素对象。
  81833. * @return {HTMLElement} 组件 dom 元素对象
  81834. */
  81835. getElement() {
  81836. //todo 其实感觉再这里给组件设置不太合理
  81837. if (this.id) {
  81838. this.rootContainer.id = this.id;
  81839. }
  81840. return this.rootContainer;
  81841. }
  81842. /**
  81843. * @function TemplateBase.prototype._initView
  81844. * @private
  81845. * @description 初始化模板。
  81846. */
  81847. _initView() {
  81848. //子类实现此方法
  81849. }
  81850. /**
  81851. * @function TemplateBase.prototype.showView
  81852. * @description 显示组件。
  81853. */
  81854. showView() {
  81855. this.rootContainer.hidden = false;
  81856. }
  81857. /**
  81858. * @function TemplateBase.prototype.closeView
  81859. * @description 隐藏组件。
  81860. */
  81861. closeView() {
  81862. this.rootContainer.hidden = true;
  81863. }
  81864. }
  81865. ;// CONCATENATED MODULE: ./src/common/components/templates/CommonContainer.js
  81866. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  81867. * This program are made available under the terms of the Apache License, Version 2.0
  81868. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  81869. /**
  81870. * @class CommonContainer
  81871. * @aliasclass Components.CommonContainer
  81872. * @deprecatedclass SuperMap.Components.CommonContainer
  81873. * @classdesc 组件统一外框。
  81874. * @version 9.1.1
  81875. * @param {Object} options - 组件配置参数。
  81876. * @param {string} options.id - 组件 dom 元素 id。
  81877. * @param {string} options.title - 标题。
  81878. * @category Components Common
  81879. * @extends {TemplateBase}
  81880. * @usage
  81881. */
  81882. class CommonContainer extends TemplateBase {
  81883. constructor(options) {
  81884. super(options);
  81885. let title = options.title ? options.title : "";
  81886. this._initView(title);
  81887. }
  81888. /**
  81889. * @private
  81890. * @override
  81891. */
  81892. _initView(title) {
  81893. const container = document.createElement("div");
  81894. container.setAttribute("class", "component-container");
  81895. //title
  81896. const titleContainer = document.createElement("div");
  81897. titleContainer.setAttribute("class", "component-title");
  81898. const titleContent = document.createElement("div");
  81899. titleContent.innerHTML = title;
  81900. titleContainer.appendChild(titleContent);
  81901. container.appendChild(titleContainer);
  81902. //container
  81903. const componentContent = document.createElement("div");
  81904. componentContent.setAttribute("class", "component-content");
  81905. container.appendChild(componentContent);
  81906. this.content = componentContent;
  81907. this.rootContainer = container;
  81908. return container;
  81909. }
  81910. /**
  81911. * @function CommonContainer.prototype.getContentElement
  81912. * @description 获取内容元素容器。
  81913. */
  81914. getContentElement() {
  81915. return this.content;
  81916. }
  81917. /**
  81918. * @function CommonContainer.prototype.appendContent
  81919. * @description 填充内容元素。
  81920. */
  81921. appendContent(element) {
  81922. this.content.appendChild(element);
  81923. }
  81924. }
  81925. ;// CONCATENATED MODULE: ./src/common/components/templates/Select.js
  81926. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  81927. * This program are made available under the terms of the Apache License, Version 2.0
  81928. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  81929. /**
  81930. * @class Select
  81931. * @aliasclass Components.Select
  81932. * @deprecatedclass SuperMap.Components.Select
  81933. * @classdesc 组件统一的文字下拉框。
  81934. * @version 9.1.1
  81935. * @param {Array.<string|Array>} options - 组件配置参数数组。
  81936. * @param {string} options.id - 组件 dom 元素 id。
  81937. * @param {string} [options.labelName] - label 名称。
  81938. * @param {Array.<string>} options.optionsArr - 需要创建的 option 数据数组。
  81939. * @param {function} [options.optionsClickCb] - option 点击事件回调函数。
  81940. * @extends {TemplateBase}
  81941. * @category Components Common
  81942. * @usage
  81943. */
  81944. class Select extends TemplateBase {
  81945. constructor(options) {
  81946. super(options);
  81947. this._initView(options);
  81948. }
  81949. _initView(options) {
  81950. let selectTool = this._createElement('div', "component-selecttool");
  81951. if (options.labelName) {
  81952. let label = this._createElement('label', 'component-selecttool__lable--describe', selectTool);
  81953. label.innerHTML = options.labelName;
  81954. }
  81955. let chartSelect = this._createElement('div', 'component-selecttool--chart', selectTool);
  81956. chartSelect.setAttribute('tabindex', '1');
  81957. let selectName = this._createElement('div', "component-selecttool__name", chartSelect);
  81958. selectName.title = options.optionsArr[0];
  81959. selectName.innerHTML = options.optionsArr[0];
  81960. let chartTriangleBtn = this._createElement('div', 'component-selecttool__trianglebtn--chart', chartSelect);
  81961. let triangleBtn = this._createElement('div', 'component-triangle-down-img', chartTriangleBtn);
  81962. let selectContent = this._createElement('div', 'component-selecttool__content', chartSelect);
  81963. let scrollarea = this._createElement('div', 'component-selecttool__content--chart', selectContent);
  81964. let scrollareaContent = this._createElement('div', 'component-selecttool__scrollarea__content', scrollarea);
  81965. scrollareaContent.setAttribute('tabindex', '1');
  81966. this.createOptions(scrollareaContent, options.optionsArr);
  81967. this.optionClickEvent(scrollareaContent, selectName, options.optionsClickCb);
  81968. // 下拉框显示 & 隐藏事件
  81969. this._selectClickEvent(chartSelect, selectContent, triangleBtn);
  81970. this.rootContainer = selectTool;
  81971. }
  81972. /**
  81973. * @function Select.prototype.createOptions
  81974. * @description 创建所属下拉框选项。
  81975. */
  81976. createOptions(container, optionsArr) {
  81977. for (let i in optionsArr) {
  81978. let option = this._createElement('div', 'component-selecttool__option', container);
  81979. option.title = optionsArr[i];
  81980. option.innerHTML = optionsArr[i];
  81981. }
  81982. }
  81983. /**
  81984. * @function Select.prototype._selectClickEvent
  81985. * @description select 点击显示&隐藏事件。
  81986. * @private
  81987. */
  81988. _selectClickEvent(eventElement, contentElement, triangleBtn) {
  81989. eventElement.onclick = function (e) {
  81990. if (contentElement.style.display === "block") {
  81991. contentElement.style.display = "none";
  81992. triangleBtn.className = "component-triangle-down-img";
  81993. } else {
  81994. contentElement.style.display = "block";
  81995. triangleBtn.className = "triangle-up-img";
  81996. }
  81997. e.preventDefault();
  81998. e.stopPropagation();
  81999. };
  82000. eventElement.onmousedown = function (evt) {
  82001. //console.log('dropdownbox onmousedown '+evt.target.className);
  82002. if (evt.target !== this) {
  82003. this.focus();
  82004. evt.preventDefault();
  82005. evt.stopPropagation()
  82006. }
  82007. };
  82008. eventElement.onblur = function () {
  82009. contentElement.style.display = "none";
  82010. triangleBtn.className = "component-triangle-down-img";
  82011. }
  82012. }
  82013. /**
  82014. * @function Select.prototype._createElement
  82015. * @description 通用创建元素。
  82016. * @private
  82017. */
  82018. _createElement(tagName, className, parentEle) {
  82019. let ele = document.createElement(tagName || 'div');
  82020. className && (ele.className = className);
  82021. parentEle && parentEle.appendChild(ele);
  82022. return ele;
  82023. }
  82024. /**
  82025. * @function Select.prototype.optionClickEvent
  82026. * @description 下拉框的 option 的点击事件。
  82027. */
  82028. optionClickEvent(optionEleArr, selectNameEle, optionsClickCb) {
  82029. for (let i = 0; i < optionEleArr.children.length; i++) {
  82030. let childEle = optionEleArr.children[i];
  82031. childEle.onclick = function () {
  82032. selectNameEle.innerHTML = childEle.innerHTML;
  82033. selectNameEle.title = childEle.title;
  82034. if (childEle.getAttribute('data-value')) {
  82035. selectNameEle.setAttribute('data-value', childEle.getAttribute('data-value'))
  82036. }
  82037. optionsClickCb && optionsClickCb(childEle);
  82038. }
  82039. }
  82040. }
  82041. }
  82042. ;// CONCATENATED MODULE: ./src/common/components/templates/DropDownBox.js
  82043. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  82044. * This program are made available under the terms of the Apache License, Version 2.0
  82045. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  82046. /**
  82047. * @class DropDownBox
  82048. * @aliasclass Components.DropDownBox
  82049. * @deprecatedclass SuperMap.Components.DropDownBox
  82050. * @classdesc 组件统一的图片下拉框。
  82051. * @version 9.1.1
  82052. * @param {Array.<Object>} options - 组件配置参数数组。
  82053. * @param {string} options.id - 组件 dom 元素 id。
  82054. * @param {string} options.title - 下拉框 title。
  82055. * @param {string} options.remark - 下拉框解释标记文本。
  82056. * @param {string} [options.dataValue] - 下拉框 attribute 名为 data-value 的值 。
  82057. * @param {string} [options.icon] - 下拉框图标。
  82058. * @param {string} [options.icon.className] - 下拉框图标类名。
  82059. * @param {string} [options.icon.background] - 下拉框图标背景 url。
  82060. * @category Components Common
  82061. * @extends {TemplateBase}
  82062. * @usage
  82063. */
  82064. class DropDownBox extends TemplateBase {
  82065. constructor(optionsArr) {
  82066. super(optionsArr);
  82067. this._initView(optionsArr);
  82068. }
  82069. /**
  82070. * @function DropDownBox.prototype._initView
  82071. * @description 初始化下拉框。
  82072. * @private
  82073. * @override
  82074. */
  82075. _initView(optionsArr) {
  82076. let dropDownContainer = document.createElement('div');
  82077. dropDownContainer.className = 'component-dropdownbox--container';
  82078. let dropDownBox = document.createElement('div');
  82079. dropDownBox.setAttribute('tabindex', '1');
  82080. dropDownBox.className = "component-dropdownbox";
  82081. dropDownContainer.appendChild(dropDownBox);
  82082. let dropDownTopContainer = document.createElement('div');
  82083. dropDownBox.appendChild(dropDownTopContainer);
  82084. this._createDropDownOption(optionsArr[0], dropDownTopContainer);
  82085. let triangleBtnContainer = document.createElement('div');
  82086. triangleBtnContainer.className = 'component-dropdownbox__triangle-btn';
  82087. dropDownBox.appendChild(triangleBtnContainer);
  82088. let triangleBtn = document.createElement('div');
  82089. triangleBtn.className = 'component-triangle-down-img';
  82090. triangleBtnContainer.appendChild(triangleBtn);
  82091. let createDropDownBoxParam = {
  82092. "parentEle": dropDownBox,
  82093. "dropDownContent": ['component-dropdownbox__content component-dropdownbox__content--chart', 'dropDownContent'],
  82094. "scrollareaContent": 'component-selecttool__scrollarea__content',
  82095. "optionsArr": optionsArr,
  82096. "triangleBtn": triangleBtn,
  82097. "dropDownTopContainer": dropDownTopContainer
  82098. };
  82099. this._createDropDownBox(createDropDownBoxParam);
  82100. this.rootContainer = dropDownContainer;
  82101. }
  82102. /**
  82103. * @function DropDownBox.prototype._createDropDownBox
  82104. * @description 创建下拉框。
  82105. * @private
  82106. */
  82107. _createDropDownBox(createDropDownBoxParam) {
  82108. let dropDownBox = createDropDownBoxParam.parentEle;
  82109. let dropDownTopContainer = createDropDownBoxParam.dropDownTopContainer;
  82110. let dropDownContent = document.createElement('div');
  82111. dropDownContent.className = createDropDownBoxParam.dropDownContent[0];
  82112. dropDownBox.appendChild(dropDownContent);
  82113. let scrollareaContent = document.createElement('div');
  82114. scrollareaContent.className = createDropDownBoxParam.scrollareaContent;
  82115. dropDownContent.appendChild(scrollareaContent);
  82116. let optionsArr = createDropDownBoxParam.optionsArr;
  82117. for (let i = 0; i < optionsArr.length; i++) {
  82118. this._createDropDownOption(optionsArr[i], scrollareaContent)
  82119. }
  82120. // 下拉框显示 & 隐藏事件
  82121. let triangleBtn = createDropDownBoxParam.triangleBtn;
  82122. this._dropDownClickEvent(dropDownBox, dropDownContent, triangleBtn);
  82123. this._eleOnblur(dropDownBox, dropDownContent, triangleBtn);
  82124. // 下拉框 options 点击事件
  82125. let scrollareaOptions = scrollareaContent.children;
  82126. for (let i = 0; i < scrollareaOptions.length; i++) {
  82127. scrollareaOptions[i].onclick = function () {
  82128. dropDownTopContainer.innerHTML = scrollareaOptions[i].outerHTML;
  82129. //evt.stopPropagation();
  82130. }
  82131. }
  82132. }
  82133. /**
  82134. * @function DropDownBox.prototype._createDropDownOption
  82135. * @description 创建下拉框子元素。
  82136. * @private
  82137. */
  82138. _createDropDownOption(data, parentElement) {
  82139. let ele = document.createElement('div');
  82140. ele.className = 'component-dropdownbox__item';
  82141. let dataItem = data;
  82142. if (dataItem['dataValue']) {
  82143. ele.setAttribute('data-value', dataItem['dataValue']);
  82144. }
  82145. parentElement.appendChild(ele);
  82146. let imgContainer = document.createElement('div');
  82147. imgContainer.className = 'component-dropdownbox__item__img';
  82148. ele.appendChild(imgContainer);
  82149. let img = document.createElement('div');
  82150. if (dataItem.icon.className) {
  82151. img.className = dataItem.icon.className;
  82152. }
  82153. if (dataItem.icon.background) {
  82154. img.style.background = dataItem.icon.background;
  82155. }
  82156. imgContainer.appendChild(img);
  82157. let title = document.createElement('div');
  82158. title.className = 'component-dropdownbox__item__title';
  82159. title.title = dataItem.title;
  82160. title.innerHTML = dataItem.title;
  82161. ele.appendChild(title);
  82162. let remark = document.createElement('div');
  82163. remark.className = 'component-dropdownbox__item__remark';
  82164. remark.title = dataItem.remark;
  82165. remark.innerHTML = dataItem.remark;
  82166. ele.appendChild(remark);
  82167. }
  82168. /**
  82169. * @function DropDownBox.prototype._dropDownClickEvent
  82170. * @description 下拉框点击事件。
  82171. * @private
  82172. */
  82173. _dropDownClickEvent(eventElement, contentElement, triangleBtn) {
  82174. eventElement.onclick = function (e) {
  82175. if (contentElement.style.display === "block") {
  82176. contentElement.style.display = "none";
  82177. triangleBtn.className = "component-triangle-down-img";
  82178. } else {
  82179. contentElement.style.display = "block";
  82180. triangleBtn.className = "triangle-up-img";
  82181. }
  82182. e.preventDefault();
  82183. e.stopPropagation()
  82184. };
  82185. eventElement.onmousedown = function (evt) {
  82186. //console.log('dropdownbox onmousedown '+evt.target.className);
  82187. if (evt.target !== this) {
  82188. this.focus();
  82189. evt.preventDefault();
  82190. evt.stopPropagation()
  82191. }
  82192. }
  82193. }
  82194. /**
  82195. * @function DropDownBox.prototype._eleOnblur
  82196. * @description 下拉框失焦事件。
  82197. * @private
  82198. */
  82199. _eleOnblur(eventElement, contentElement, triangleBtn) {
  82200. eventElement.onblur = function () {
  82201. contentElement.style.display = "none";
  82202. triangleBtn.className = "component-triangle-down-img";
  82203. }
  82204. }
  82205. /**
  82206. * @function DropDownBox.prototype._createElement
  82207. * @description 通用创建元素。
  82208. * @private
  82209. */
  82210. _createElement(tagName, className, parentEle) {
  82211. let ele = document.createElement(tagName || 'div');
  82212. className && (ele.className = className);
  82213. parentEle && parentEle.appendChild(ele);
  82214. return ele;
  82215. }
  82216. }
  82217. ;// CONCATENATED MODULE: ./src/common/components/templates/PopContainer.js
  82218. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  82219. * This program are made available under the terms of the Apache License, Version 2.0
  82220. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  82221. /**
  82222. * @class PopContainer
  82223. * @aliasclass Components.PopContainer
  82224. * @deprecatedclass SuperMap.Components.PopContainer
  82225. * @classdesc 弹框组件。
  82226. * @version 9.1.1
  82227. * @param {Object} options - 组件配置参数。
  82228. * @param {string} options.id - 组件 dom 元素 id。
  82229. * @param {string} options.title - 弹框组件名称。
  82230. * @extends {TemplateBase}
  82231. * @category Components Common
  82232. * @usage
  82233. */
  82234. class PopContainer extends TemplateBase {
  82235. constructor(options) {
  82236. options = options ? options : {};
  82237. super(options);
  82238. options.title = options.title ? options.title : "";
  82239. this._initView(options.title);
  82240. }
  82241. /**
  82242. * @private
  82243. * @override
  82244. */
  82245. _initView(titile) {
  82246. const container = document.createElement("div");
  82247. container.setAttribute("class", "component-popcontainer");
  82248. //header
  82249. const header = document.createElement("div");
  82250. header.setAttribute("class", "component-popcontainer__header");
  82251. const title = document.createElement("label");
  82252. title.setAttribute("class", "component-popcontainer__header__title");
  82253. title.innerHTML = titile;
  82254. header.appendChild(title);
  82255. const closeBtn = document.createElement("span");
  82256. closeBtn.setAttribute("class", "supermapol-icons-clear component-popcontainer__header__close");
  82257. closeBtn.onclick = this.closeView.bind(this);
  82258. container.appendChild(closeBtn);
  82259. container.appendChild(header);
  82260. //content
  82261. const content = document.createElement("div");
  82262. content.setAttribute("class", "component-popcontainer__content");
  82263. this.content = content;
  82264. container.appendChild(content);
  82265. this.rootContainer = container;
  82266. }
  82267. /**
  82268. * @function PopContainer.prototype.appendContent
  82269. * @description 追加内容。
  82270. * @param {HTMLElement} dom - 内容元素。
  82271. */
  82272. appendContent(dom) {
  82273. this.content.appendChild(dom);
  82274. }
  82275. }
  82276. ;// CONCATENATED MODULE: ./src/common/components/templates/AttributesPopContainer.js
  82277. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  82278. * This program are made available under the terms of the Apache License, Version 2.0
  82279. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  82280. /**
  82281. * @class AttributesPopContainer
  82282. * @aliasclass Components.AttributesPopContainer
  82283. * @deprecatedclass SuperMap.Components.AttributesPopContainer
  82284. * @classdesc 属性弹框组件
  82285. * @version 9.1.1
  82286. * @param {Object} options - 组件配置参数。
  82287. * @param {string} options.id - 组件 dom 元素 id。
  82288. * @param {Object} options.title - 属性弹框组件名称。
  82289. * @param {Object} options.attributes - 组件需要显示的属性内容。
  82290. * @extends {PopContainer}
  82291. * @category Components Common
  82292. * @usage
  82293. */
  82294. class AttributesPopContainer extends PopContainer {
  82295. constructor(options) {
  82296. //默认为属性:
  82297. options.title = options.title ? options.title : "属性";
  82298. super(options);
  82299. this.rootContainer.firstChild.hidden = true;
  82300. options.attributes = options.attributes ? options.attributes : [];
  82301. this._createAttributesTable(options.attributes);
  82302. }
  82303. _createAttributesTable(attributes) {
  82304. const table = document.createElement("table");
  82305. table.setAttribute("class", "component-popcontainer__content__table");
  82306. const tbody = document.createElement("tbody");
  82307. let single = true;
  82308. for (let name in attributes) {
  82309. const tr = document.createElement("tr");
  82310. if (single) {
  82311. tr.setAttribute("class", "component-popcontainer__content__td--color");
  82312. }
  82313. const title = document.createElement("td");
  82314. const titleSpan = document.createElement("Span");
  82315. titleSpan.innerHTML = name;
  82316. title.appendChild(titleSpan);
  82317. const value = document.createElement("td");
  82318. value.innerHTML = attributes[name];
  82319. tr.appendChild(title);
  82320. tr.appendChild(value);
  82321. tbody.appendChild(tr);
  82322. single = !single;
  82323. }
  82324. table.appendChild(tbody);
  82325. this.appendContent(table);
  82326. }
  82327. }
  82328. ;// CONCATENATED MODULE: ./src/common/components/templates/IndexTabsPageContainer.js
  82329. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  82330. * This program are made available under the terms of the Apache License, Version 2.0
  82331. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  82332. /**
  82333. * @class IndexTabsPageContainer
  82334. * @aliasclass Components.IndexTabsPageContainer
  82335. * @deprecatedclass SuperMap.Components.IndexTabsPageContainer
  82336. * @classdesc 标签索引组件。
  82337. * @version 9.1.1
  82338. * @param {Object} options - 组件配置参数。
  82339. * @param {string} options.id - 组件 dom 元素 id。
  82340. * @category Components Common
  82341. * @extends {TemplateBase}
  82342. * @usage
  82343. */
  82344. class IndexTabsPageContainer extends TemplateBase {
  82345. constructor(options) {
  82346. super(options);
  82347. this._initView();
  82348. }
  82349. /**
  82350. * @private
  82351. * @override
  82352. */
  82353. _initView() {
  82354. const container = document.createElement("div");
  82355. container.setAttribute("class", "component-tabpage");
  82356. const header = document.createElement("ul");
  82357. this.header = header;
  82358. const content = document.createElement("div");
  82359. content.setAttribute("class", "component-tabpage__content");
  82360. this.content = content;
  82361. container.appendChild(header);
  82362. container.appendChild(content);
  82363. this.rootContainer = container;
  82364. }
  82365. /**
  82366. * @function IndexTabsPageContainer.prototype.setTabs
  82367. * @description 设置标签元素。
  82368. * @param {Array.<HTMLElement>} tabs
  82369. */
  82370. setTabs(tabs) {
  82371. this.removeAllTabs();
  82372. this.appendTabs(tabs);
  82373. }
  82374. /**
  82375. * @function IndexTabsPageContainer.prototype.appendTabs
  82376. * @description 追加标签元素。
  82377. * @param {Array.<HTMLElement>} tabs
  82378. */
  82379. appendTabs(tabs) {
  82380. for (let i = 0; i < tabs.length; i++) {
  82381. let title = document.createElement("span");
  82382. title.index = i;
  82383. title.appendChild(document.createTextNode(tabs[i].title));
  82384. //绑定标签切换对应页面:
  82385. title.onclick = this._changeTabsPage.bind(this);
  82386. let content = tabs[i].content;
  82387. content.index = i;
  82388. content.hidden = true;
  82389. this.header.appendChild(title);
  82390. this.content.appendChild(content);
  82391. }
  82392. //todo 确认是否两个子元素的 index 相互对应
  82393. //默认显示第一个标签对象
  82394. this.header.firstChild.setAttribute("class", "on");
  82395. this.content.firstChild.hidden = false;
  82396. }
  82397. /**
  82398. * @function IndexTabsPageContainer.prototype.removeTab
  82399. * @description 删除某个标签页面。
  82400. * @param {number} index - 标签索引号。
  82401. */
  82402. removeTab(index) {
  82403. this.header.removeChild(this.header.children[index]);
  82404. this.content.removeChild(this.content.children[index]);
  82405. }
  82406. /**
  82407. * @function IndexTabsPageContainer.prototype.removeAllTabs
  82408. * @description 删除所有标签。
  82409. */
  82410. removeAllTabs() {
  82411. for (let i = this.header.children.length; i > 0; i--) {
  82412. this.header.removeChild(this.header.children[i]);
  82413. this.content.removeChild(this.content.children[i]);
  82414. }
  82415. }
  82416. _changeTabsPage(e) {
  82417. const index = e.target.index;
  82418. for (let i = 0; i < this.header.children.length; i++) {
  82419. this.header.children[i].setAttribute("class", "");
  82420. this.content.children[i].hidden = true;
  82421. if (i === index) {
  82422. this.header.children[i].setAttribute("class", "on");
  82423. this.content.children[i].hidden = false;
  82424. }
  82425. }
  82426. }
  82427. }
  82428. ;// CONCATENATED MODULE: ./src/common/components/templates/CityTabsPage.js
  82429. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  82430. * This program are made available under the terms of the Apache License, Version 2.0
  82431. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  82432. /**
  82433. * @class CityTabsPage
  82434. * @aliasclass Components.CityTabsPage
  82435. * @deprecatedclass SuperMap.Components.CityTabsPage
  82436. * @classdesc 城市地址匹配组件模板
  82437. * @version 9.1.1
  82438. * @param {Object} options - 组件配置参数。
  82439. * @param {string} options.id - 组件 dom 元素 id。
  82440. * @param {Object|Array.<string>} options.config - 城市名称配置列表,支持两种格式:{key1:{A:[],B:[]}, key2:{C:[],D:[]}} 或
  82441. * ["成都市","北京市"],用户可根据自己的项目需求进行配置
  82442. * @extends {IndexTabsPageContainer}
  82443. * @category Components Common
  82444. * @usage
  82445. */
  82446. class CityTabsPage extends IndexTabsPageContainer {
  82447. constructor(options) {
  82448. super(options);
  82449. //去掉默认的边框阴影样式:
  82450. this.rootContainer.classList.add("component-citytabpage--noneBoxShadow");
  82451. this.config = options.config;
  82452. //header,若 config为城市名称数组,则直接加载内容
  82453. if (Util_Util.isArray(this.config)) {
  82454. this.header.hidden = true;
  82455. this._createCityItem("城市", this.config);
  82456. this.content.style.border = "none";
  82457. } else {
  82458. this._createTabs();
  82459. this.header.onclick = (e) => {
  82460. //关闭所有元素 是否有更简化的写法?
  82461. for (let i = 0; i < this.header.children.length; i++) {
  82462. this.header.children[i].setAttribute("class", "");
  82463. }
  82464. //打开点击内容元素
  82465. e.target.setAttribute("class", "on");
  82466. this._createCityContent(e.target.innerHTML);
  82467. };
  82468. }
  82469. }
  82470. /**
  82471. * @function CityTabsPage.prototype._createTabs
  82472. * @description 创建 Tabs
  82473. * @private
  82474. */
  82475. _createTabs() {
  82476. //header
  82477. if (Util_Util.isArray(this.config)) {
  82478. for (let i = 0; i < this.config.length; i++) {
  82479. let innerHTML = "";
  82480. for (const key in this.config[i]) {
  82481. innerHTML += key;
  82482. }
  82483. let li = document.createElement("li");
  82484. li.innerHTML = innerHTML;
  82485. this.header.appendChild(li);
  82486. }
  82487. } else {
  82488. for (const key in this.config) {
  82489. let li = document.createElement("li");
  82490. li.innerHTML = key;
  82491. this.header.appendChild(li);
  82492. }
  82493. }
  82494. this.header.firstChild.setAttribute("class", "on");
  82495. this._createCityContent(this.header.firstChild.innerHTML);
  82496. }
  82497. /**
  82498. * @function CityTabsPage.prototype._createCityContent
  82499. * @description 创建列表容器
  82500. * @private
  82501. */
  82502. _createCityContent(keyName) {
  82503. //清除元素:
  82504. for (let i = this.content.children.length; i > 0; i--) {
  82505. this.content.removeChild(this.content.children[i - 1]);
  82506. }
  82507. //创建对应元素
  82508. const cities = this.config[keyName];
  82509. for (let key in cities) {
  82510. this._createCityItem(key, cities[key]);
  82511. }
  82512. }
  82513. /**
  82514. * @function CityTabsPage.prototype._createCityContent
  82515. * @description 创建列表容器
  82516. * @private
  82517. */
  82518. _createCityItem(key, cities) {
  82519. const city = document.createElement("div");
  82520. const cityClass = document.createElement("div");
  82521. cityClass.setAttribute("class", "component-citytabpag__py-key");
  82522. cityClass.innerHTML = key;
  82523. city.appendChild(cityClass);
  82524. const cityContent = document.createElement("div");
  82525. cityContent.setAttribute("class", "component-citytabpag__content");
  82526. for (let i = 0; i < cities.length; i++) {
  82527. let span = document.createElement("span");
  82528. span.innerHTML = cities[i];
  82529. cityContent.appendChild(span);
  82530. }
  82531. //HOT 元素长度单独微调:
  82532. if (key === "HOT") {
  82533. cityContent.style.width = "428px";
  82534. }
  82535. city.appendChild(cityContent);
  82536. this.content.appendChild(city);
  82537. }
  82538. }
  82539. ;// CONCATENATED MODULE: ./src/common/components/templates/NavTabsPage.js
  82540. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  82541. * This program are made available under the terms of the Apache License, Version 2.0
  82542. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  82543. /**
  82544. * @class NavTabsPage
  82545. * @aliasclass Components.NavTabsPage
  82546. * @deprecatedclass SuperMap.Components.NavTabsPage
  82547. * @classdesc 标签页面组件。
  82548. * @version 9.1.1
  82549. * @param {Object} options - 组件配置参数。
  82550. * @param {string} options.id - 组件 dom 元素 id。
  82551. * @param {Array.<Object>} [options.tabs=[]] - 标签对象数组,形如:[{title: "",content: HTMLElement}],初始时,传入则创建页面。
  82552. * @extends {TemplateBase}
  82553. * @category Components Common
  82554. * @usage
  82555. */
  82556. // todo 思考拆分的控件应该以哪种方式使用
  82557. class NavTabsPage extends TemplateBase {
  82558. constructor(options) {
  82559. super(options);
  82560. this.navTabsTitle = null;
  82561. this.navTabsContent = null;
  82562. options.tabs = options.tabs ? options.tabs : [];
  82563. this._initView(options.tabs);
  82564. }
  82565. /**
  82566. * @override
  82567. * @private
  82568. */
  82569. _initView(tabs) {
  82570. const navTabsPage = document.createElement("div");
  82571. navTabsPage.setAttribute("class", "component-navtabspage");
  82572. //关闭按钮
  82573. const closeBtn = document.createElement("span");
  82574. closeBtn.setAttribute("class", "supermapol-icons-close");
  82575. closeBtn.onclick = this.closeView.bind(this);
  82576. navTabsPage.appendChild(closeBtn);
  82577. //标签
  82578. const navTabsTitle = document.createElement("div");
  82579. this.navTabsTitle = navTabsTitle;
  82580. navTabsTitle.setAttribute("class", "component-navtabspage__title");
  82581. navTabsPage.appendChild(navTabsTitle);
  82582. //内容
  82583. const navTabsContent = document.createElement("div");
  82584. this.navTabsContent = navTabsContent;
  82585. navTabsContent.setAttribute("class", "component-navtabspage__content");
  82586. navTabsPage.appendChild(navTabsContent);
  82587. //若 tabs 初始传入值,则
  82588. if (tabs.length > 0) {
  82589. this.appendTabs(tabs);
  82590. }
  82591. this.rootContainer = navTabsPage;
  82592. }
  82593. /**
  82594. * @function NavTabsPage.prototype.setTabs
  82595. * @description 设置标签。
  82596. * @param {Array.<Object>} tabs - 标签对象数组,形如:[{title: "",content: {}}]。
  82597. */
  82598. setTabs(tabs) {
  82599. this.removeAllTabs();
  82600. this.appendTabs(tabs);
  82601. }
  82602. /**
  82603. * @function NavTabsPage.prototype.appendTabs
  82604. * @description 添加标签页面。
  82605. * @param {Array.<Object>} tabs - 标签对象数组,形如:[{title: "",content: {}}]。
  82606. */
  82607. appendTabs(tabs) {
  82608. for (let i = 0; i < tabs.length; i++) {
  82609. let title = document.createElement("span");
  82610. title.index = i;
  82611. title.appendChild(document.createTextNode(tabs[i].title));
  82612. //绑定标签切换对应页面:
  82613. title.onclick = this._changeTabsPage.bind(this);
  82614. let content = tabs[i].content;
  82615. content.index = i;
  82616. content.hidden = true;
  82617. this.navTabsTitle.appendChild(title);
  82618. this.navTabsContent.appendChild(content);
  82619. }
  82620. //todo 确认是否两个子元素的 index 相互对应
  82621. //默认显示第一个标签对象
  82622. this.navTabsTitle.firstChild.setAttribute("class", "component-navtabspage__tabs--select");
  82623. this.navTabsContent.firstChild.hidden = false;
  82624. }
  82625. /**
  82626. * @function NavTabsPage.prototype.removeTab
  82627. * @description 删除某个标签页面。
  82628. * @param {number} index - 标签索引号。
  82629. */
  82630. removeTab(index) {
  82631. this.navTabsTitle.removeChild(this.navTabsTitle.children[index]);
  82632. this.navTabsContent.removeChild(this.navTabsContent.children[index]);
  82633. }
  82634. /**
  82635. * @function NavTabsPage.prototype.removeAllTabs
  82636. * @description 删除所有标签。
  82637. */
  82638. removeAllTabs() {
  82639. for (let i = this.navTabsTitle.children.length; i > 0; i--) {
  82640. this.navTabsTitle.removeChild(this.navTabsTitle.children[i]);
  82641. this.navTabsContent.removeChild(this.navTabsContent.children[i]);
  82642. }
  82643. }
  82644. _changeTabsPage(e) {
  82645. const index = e.target.index;
  82646. for (let i = 0; i < this.navTabsTitle.children.length; i++) {
  82647. this.navTabsTitle.children[i].setAttribute("class", "");
  82648. this.navTabsContent.children[i].hidden = true;
  82649. if (i === index) {
  82650. this.navTabsTitle.children[i].setAttribute("class", "component-navtabspage__tabs--select");
  82651. this.navTabsContent.children[i].hidden = false;
  82652. }
  82653. }
  82654. }
  82655. }
  82656. ;// CONCATENATED MODULE: ./src/common/components/templates/PaginationContainer.js
  82657. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  82658. * This program are made available under the terms of the Apache License, Version 2.0
  82659. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  82660. /**
  82661. * @class PaginationContainer
  82662. * @aliasclass Components.PaginationContainer
  82663. * @deprecatedclass SuperMap.Components.PaginationContainer
  82664. * @classdesc 分页组件模板。
  82665. * @version 9.1.1
  82666. * @param {Object} options - 组件配置参数。
  82667. * @param {string} options.id - 组件 dom 元素 id。
  82668. * @param {HTMLElement} options.contents - 页面填充的 DOM 元素对象。
  82669. * @param {number} options.pageCounts - 页数。
  82670. * @extends {TemplateBase}
  82671. * @category Components Common
  82672. * @usage
  82673. */
  82674. class PaginationContainer extends TemplateBase {
  82675. constructor(options) {
  82676. options = options ? options : {};
  82677. super(options);
  82678. this.currentPage = 0;
  82679. this.pageNumberLis = [];
  82680. this.currentPageNumberLis = [];
  82681. this.linkageEvent = null;
  82682. options.contents = options.contents ? options.contents : null;
  82683. options.pageCounts = options.pageCounts ? options.pageCounts : 0;
  82684. this._initView(options.contents, options.pageCounts);
  82685. }
  82686. /**
  82687. * @function PaginationContainer.prototype.setLinkageEvent
  82688. * @description 设置页面联动方法。
  82689. * @param {function} linkageEvent - 联动方法,实现指定功能。
  82690. */
  82691. setLinkageEvent(linkageEvent) {
  82692. this.linkageEvent = linkageEvent;
  82693. }
  82694. /**
  82695. * @private
  82696. * @override
  82697. */
  82698. _initView(contents, pageCounts) {
  82699. const container = document.createElement("div");
  82700. container.setAttribute("class", "component-pagination");
  82701. //content
  82702. const content = document.createElement("div");
  82703. content.setAttribute("class", "component-pagination__content");
  82704. container.appendChild(content);
  82705. this.content = content;
  82706. //link
  82707. const link = document.createElement("ul");
  82708. link.setAttribute("class", "component-pagination__link");
  82709. link.onclick = this._changePageEvent.bind(this);
  82710. container.appendChild(link);
  82711. this._createLink(link);
  82712. this.link = link;
  82713. //填充内容:
  82714. if (contents) {
  82715. this.setContent(contents);
  82716. }
  82717. if (pageCounts !== 0) {
  82718. this.setPageLink(pageCounts);
  82719. }
  82720. this.rootContainer = container;
  82721. }
  82722. /**---------以下是页面相关操作 **/
  82723. /**
  82724. * @function PaginationContainer.prototype.setContent
  82725. * @description 设置页面内容。
  82726. * @param {HTMLElement} element - 页面内容元素。
  82727. */
  82728. setContent(element) {
  82729. this.clearContent();
  82730. this.appendContent(element);
  82731. }
  82732. /**
  82733. * @function PaginationContainer.prototype.appendContent
  82734. * @description 追加内容。
  82735. * @param {HTMLElement} element - 页面内容元素。
  82736. */
  82737. appendContent(element) {
  82738. this.content.appendChild(element);
  82739. }
  82740. /**
  82741. * @function PaginationContainer.prototype.clearContent
  82742. * @description 清空内容元素。
  82743. */
  82744. clearContent() {
  82745. for (let i = this.content.children.length - 1; i >= 0; i--) {
  82746. this.content.removeChild(this.content.children[i]);
  82747. }
  82748. }
  82749. /** -----以下是页码相关的操作:**/
  82750. /**
  82751. * @function PaginationContainer.prototype.setPageLink
  82752. * @description 设置页码数。
  82753. * @param {number} pageNumber - 页码数。
  82754. */
  82755. setPageLink(pageNumber) {
  82756. //清空当前页码
  82757. this.pageNumberLis = [];
  82758. this.currentPageNumberLis = [];
  82759. this.clearPageLink();
  82760. //创建页码
  82761. this._createPageLi(pageNumber);
  82762. //添加页码到页码列表
  82763. this._appendPageLink();
  82764. }
  82765. /**
  82766. * @description 创建页码。
  82767. * @param pageNumber
  82768. * @private
  82769. */
  82770. _createPageLi(pageNumber) {
  82771. for (let i = 0; i < pageNumber; i++) {
  82772. const pageLi = document.createElement("li");
  82773. pageLi.innerHTML = i + 1;
  82774. /*const liContent = document.createElement("span");
  82775. liContent.innerHTML = i + 1;*/
  82776. // pageLi.appendChild(liContent);
  82777. this.pageNumberLis.push(pageLi);
  82778. }
  82779. this.pageNumberLis[0].setAttribute("class", "active");
  82780. this.currentPage = 1;
  82781. if (pageNumber < 5) {
  82782. this.currentPageNumberLis = this.pageNumberLis;
  82783. } else {
  82784. for (let i = 0; i < 5; i++) {
  82785. this.currentPageNumberLis.push(this.pageNumberLis[i]);
  82786. }
  82787. }
  82788. }
  82789. /**
  82790. * @description 添加页码到页码列表。
  82791. * @private
  82792. */
  82793. _appendPageLink() {
  82794. //todo 如何插入中间
  82795. for (let i = 0; i < this.currentPageNumberLis.length; i++) {
  82796. this.link.insertBefore(this.currentPageNumberLis[i], this.link.childNodes[this.link.children.length - 2]);
  82797. }
  82798. for (let i = 0; i < this.currentPageNumberLis.length; i++) {
  82799. //清空 active 状态
  82800. this.currentPageNumberLis[i].setAttribute("class", "");
  82801. //给当前选中的 li 赋值 active 状态
  82802. if (Number(this.currentPageNumberLis[i].innerHTML) === this.currentPage) {
  82803. this.currentPageNumberLis[i].setAttribute("class", "active");
  82804. }
  82805. }
  82806. //根据 currentPage 改变按钮状态
  82807. this._changeDisableState();
  82808. if (this.linkageEvent) {
  82809. this.linkageEvent(this.currentPage);
  82810. }
  82811. }
  82812. /**
  82813. * @function PaginationContainer.prototype.clearPageLink
  82814. * @description 清除页码列表。
  82815. */
  82816. clearPageLink() {
  82817. for (let i = this.link.children.length - 3; i > 1; i--) {
  82818. this.link.removeChild(this.link.children[i]);
  82819. }
  82820. }
  82821. /**
  82822. * @description 创建页码按钮。
  82823. * @param ul
  82824. * @private
  82825. */
  82826. _createLink(ul) {
  82827. for (let i = 0; i < 4; i++) {
  82828. const li = document.createElement("li");
  82829. li.setAttribute("class", "disable");
  82830. const liContent = document.createElement("span");
  82831. li.appendChild(liContent);
  82832. if (i === 0) {
  82833. liContent.id = "first";
  82834. liContent.setAttribute("class", "supermapol-icons-first");
  82835. } else if (i === 1) {
  82836. liContent.id = "prev";
  82837. liContent.setAttribute("class", "supermapol-icons-prev");
  82838. } else if (i === 2) {
  82839. liContent.id = "next";
  82840. liContent.setAttribute("class", "supermapol-icons-next");
  82841. } else if (i === 3) {
  82842. liContent.id = "last";
  82843. liContent.setAttribute("class", "supermapol-icons-last");
  82844. }
  82845. ul.appendChild(li);
  82846. }
  82847. }
  82848. /**
  82849. * @description 点击页码事件。
  82850. * @param e
  82851. * @private
  82852. */
  82853. _changePageEvent(e) {
  82854. //todo
  82855. const trigger = e.target;
  82856. //若列表禁用,点击无效
  82857. if (trigger.parentElement.classList[0] === "disable") {
  82858. return;
  82859. }
  82860. let targetLi;
  82861. if (trigger.id) {
  82862. targetLi = trigger.id;
  82863. } else if (Number(trigger.innerHTML)) {
  82864. targetLi = Number(trigger.innerHTML);
  82865. } else {
  82866. return;
  82867. }
  82868. //页码预处理:
  82869. this._prePageNum(targetLi);
  82870. //根据 currentPageNumberLis 创建页码列表
  82871. this.clearPageLink();
  82872. this._appendPageLink();
  82873. }
  82874. /**
  82875. * @description 根据 currentPage 改变按钮状态。
  82876. * @private
  82877. */
  82878. _changeDisableState() {
  82879. this.link.children[0].setAttribute("class", "");
  82880. this.link.children[1].setAttribute("class", "");
  82881. this.link.children[this.link.children.length - 1].setAttribute("class", "");
  82882. this.link.children[this.link.children.length - 2].setAttribute("class", "");
  82883. if (this.currentPage === 1) {
  82884. this.link.children[0].setAttribute("class", "disable");
  82885. this.link.children[1].setAttribute("class", "disable");
  82886. }
  82887. if (this.currentPage === this.pageNumberLis.length) {
  82888. this.link.children[this.link.children.length - 1].setAttribute("class", "disable");
  82889. this.link.children[this.link.children.length - 2].setAttribute("class", "disable");
  82890. }
  82891. }
  82892. /**
  82893. * @description 根据点击页码列表事件准备需展现的页码列表。
  82894. * @param {string|number} targetLi - 被点击的列表对象 id 或 被点击的页码值。
  82895. * @private
  82896. */
  82897. _prePageNum(targetLi) {
  82898. const currentPageNumberLis = [];
  82899. if (targetLi === "first") {
  82900. this.currentPage = 1;
  82901. } else if (targetLi === "last") {
  82902. this.currentPage = this.pageNumberLis.length;
  82903. } else if (targetLi === "prev") {
  82904. this.currentPage = this.currentPage - 1;
  82905. } else if (targetLi === "next") {
  82906. this.currentPage = this.currentPage + 1;
  82907. } else {
  82908. this.currentPage = targetLi;
  82909. }
  82910. if (this.pageNumberLis.length <= 5) {
  82911. for (let i = 0; i < this.pageNumberLis.length; i++) {
  82912. currentPageNumberLis.push(this.pageNumberLis[i]);
  82913. }
  82914. } else {
  82915. //当前点击前三,都取前五
  82916. if (this.currentPage <= 3) {
  82917. for (let i = 0; i < 5; i++) {
  82918. currentPageNumberLis.push(this.pageNumberLis[i]);
  82919. }
  82920. } else if (this.currentPage >= this.pageNumberLis.length - 3) {
  82921. //点击后三,都取后5
  82922. for (let i = this.pageNumberLis.length - 5; i < this.pageNumberLis.length; i++) {
  82923. currentPageNumberLis.push(this.pageNumberLis[i]);
  82924. }
  82925. } else {
  82926. //其他,取中间:
  82927. for (let i = this.currentPage - 3; i <= this.currentPage + 1; i++) {
  82928. currentPageNumberLis.push(this.pageNumberLis[i]);
  82929. }
  82930. }
  82931. }
  82932. if (currentPageNumberLis.length > 0) {
  82933. this.currentPageNumberLis = currentPageNumberLis;
  82934. }
  82935. }
  82936. }
  82937. ;// CONCATENATED MODULE: ./src/common/components/util/Util.js
  82938. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  82939. * This program are made available under the terms of the Apache License, Version 2.0
  82940. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  82941. /**
  82942. * @name ComponentsUtil
  82943. * @namespace
  82944. * @category BaseTypes Util
  82945. * @description 获取文件类型工具类。
  82946. * @usage
  82947. * ```
  82948. * // 浏览器
  82949. * <script type="text/javascript" src="{cdn}"></script>
  82950. * <script>
  82951. * const result = {namespace}.ComponentsUtil.getFileType(fileName);
  82952. *
  82953. * </script>
  82954. * // ES6 Import
  82955. * import { ComponentsUtil } from '{npm}';
  82956. *
  82957. * const result = ComponentsUtil.getFileType(fileName);
  82958. * ```
  82959. */
  82960. let ComponentsUtil = {
  82961. /**
  82962. * @function ComponentsUtil.getFileType
  82963. * @description 获取上传文件类型。
  82964. * @param {string} fileName - 文件名称。
  82965. */
  82966. getFileType(fileName) {
  82967. let regCSV = /^.*\.(?:csv)$/i;
  82968. let regExcel = /^.*\.(?:xls|xlsx)$/i; //文件名可以带空格
  82969. let regGeojson = /^.*\.(?:geojson|json)$/i;
  82970. if (regExcel.test(fileName)) { //校验不通过
  82971. return CommonTypes_FileTypes.EXCEL;
  82972. } else if (regCSV.test(fileName)) {
  82973. return CommonTypes_FileTypes.CSV;
  82974. } else if (regGeojson.test(fileName)) {
  82975. return CommonTypes_FileTypes.GEOJSON;
  82976. }
  82977. return null;
  82978. }
  82979. };
  82980. ;// CONCATENATED MODULE: ./src/common/components/util/index.js
  82981. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  82982. * This program are made available under the terms of the Apache License, Version 2.0
  82983. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  82984. ;// CONCATENATED MODULE: ./src/common/components/index.js
  82985. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  82986. * This program are made available under the terms of the Apache License, Version 2.0
  82987. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  82988. //数据
  82989. //组件
  82990. //提示框组件
  82991. //图表组件
  82992. //公用模板:
  82993. //工具类
  82994. ;// CONCATENATED MODULE: ./src/common/lang/index.js
  82995. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  82996. * This program are made available under the terms of the Apache License, Version 2.0
  82997. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  82998. ;// CONCATENATED MODULE: ./src/common/index.common.js
  82999. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  83000. * This program are made available under the terms of the Apache License, Version 2.0
  83001. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  83002. ;// CONCATENATED MODULE: ./src/common/index.all.js
  83003. ;// CONCATENATED MODULE: ./src/common/namespace.js
  83004. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  83005. * This program are made available under the terms of the Apache License, Version 2.0
  83006. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  83007. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  83008. * This program are made available under the terms of the Apache License, Version 2.0
  83009. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  83010. // Lang
  83011. SuperMap.Lang = Lang;
  83012. SuperMap.i18n = SuperMap.Lang.i18n;
  83013. // CommonUtil
  83014. SuperMap.Util = { ...SuperMap.Util, ...Util_Util };
  83015. SuperMap.Browser = Browser;
  83016. SuperMap.INCHES_PER_UNIT = INCHES_PER_UNIT;
  83017. SuperMap.METERS_PER_INCH = METERS_PER_INCH;
  83018. SuperMap.DOTS_PER_INCH = DOTS_PER_INCH;
  83019. SuperMap.IS_GECKO = IS_GECKO;
  83020. // FetchRequest
  83021. SuperMap.setCORS = setCORS;
  83022. SuperMap.isCORS = isCORS;
  83023. SuperMap.setRequestTimeout = setRequestTimeout;
  83024. SuperMap.getRequestTimeout = getRequestTimeout;
  83025. SuperMap.FetchRequest = FetchRequest;
  83026. // commontypes
  83027. SuperMap.inherit = inheritExt;
  83028. SuperMap.mixin = mixinExt;
  83029. SuperMap.String = StringExt;
  83030. SuperMap.Number = NumberExt;
  83031. SuperMap.Function = FunctionExt;
  83032. SuperMap.Array = ArrayExt;
  83033. SuperMap.Date = DateExt;
  83034. SuperMap.Event = Event;
  83035. SuperMap.Bounds = Bounds;
  83036. SuperMap.Credential = Credential;
  83037. SuperMap.Events = Events;
  83038. SuperMap.Feature = Feature_Feature;
  83039. SuperMap.Geometry = Geometry_Geometry;
  83040. SuperMap.Pixel = Pixel;
  83041. SuperMap.Size = Size;
  83042. SuperMap.Feature.Vector = Vector;
  83043. SuperMap.Geometry.Collection = Collection;
  83044. SuperMap.Geometry.Curve = Curve;
  83045. SuperMap.Geometry.GeoText = GeoText;
  83046. SuperMap.Geometry.LinearRing = LinearRing_LinearRing;
  83047. SuperMap.Geometry.LineString = LineString;
  83048. SuperMap.Geometry.MultiLineString = MultiLineString;
  83049. SuperMap.Geometry.MultiPoint = MultiPoint;
  83050. SuperMap.Geometry.MultiPolygon = MultiPolygon;
  83051. SuperMap.Geometry.Point = Point;
  83052. SuperMap.Geometry.Polygon = Polygon_Polygon;
  83053. SuperMap.Geometry.Rectangle = Rectangle;
  83054. // Components
  83055. SuperMap.Components.Chart = ChartView;
  83056. SuperMap.Components.ChartViewModel = ChartViewModel;
  83057. SuperMap.Components.MessageBox = MessageBox;
  83058. SuperMap.Components.AttributesPopContainer = AttributesPopContainer;
  83059. SuperMap.Components.CityTabsPage = CityTabsPage;
  83060. SuperMap.Components.CommonContainer = CommonContainer;
  83061. SuperMap.Components.DropDownBox = DropDownBox;
  83062. SuperMap.Components.IndexTabsPageContainer = IndexTabsPageContainer;
  83063. SuperMap.Components.NavTabsPage = NavTabsPage;
  83064. SuperMap.Components.PaginationContainer = PaginationContainer;
  83065. SuperMap.Components.PopContainer = PopContainer;
  83066. SuperMap.Components.Select = Select;
  83067. SuperMap.Components.TemplateBase = TemplateBase;
  83068. SuperMap.Components.FileReaderUtil = FileReaderUtil;
  83069. // control
  83070. SuperMap.TimeControlBase = TimeControlBase;
  83071. SuperMap.TimeFlowControl = TimeFlowControl;
  83072. // Format
  83073. SuperMap.Format = SuperMap.Format || Format;
  83074. SuperMap.Format.GeoJSON = GeoJSON;
  83075. SuperMap.Format.JSON = JSONFormat;
  83076. SuperMap.Format.WKT = WKT;
  83077. // iManager
  83078. SuperMap.iManager = IManager;
  83079. SuperMap.iManagerCreateNodeParam = IManagerCreateNodeParam;
  83080. SuperMap.iManagerServiceBase = IManagerServiceBase;
  83081. // iPortal
  83082. SuperMap.iPortal = IPortal;
  83083. SuperMap.iPortalAddDataParam = IPortalAddDataParam;
  83084. SuperMap.iPortalAddResourceParam = IPortalAddResourceParam;
  83085. SuperMap.iPortalDataConnectionInfoParam = IPortalDataConnectionInfoParam;
  83086. SuperMap.iPortalDataMetaInfoParam = IPortalDataMetaInfoParam;
  83087. SuperMap.iPortalDataStoreInfoParam = IPortalDataStoreInfoParam;
  83088. SuperMap.iPortalQueryParam = IPortalQueryParam;
  83089. SuperMap.iPortalQueryResult = IPortalQueryResult;
  83090. SuperMap.iPortalRegisterServiceParam = IPortalRegisterServiceParam;
  83091. SuperMap.iPortalResource = IPortalResource;
  83092. SuperMap.iPortalServiceBase = IPortalServiceBase;
  83093. SuperMap.iPortalShareEntity = IPortalShareEntity;
  83094. SuperMap.iPortalShareParam = IPortalShareParam;
  83095. SuperMap.iPortalUser = IPortalUser;
  83096. // iServer
  83097. SuperMap.AddressMatchService = AddressMatchService_AddressMatchService;
  83098. SuperMap.AggregationParameter = AggregationParameter;
  83099. SuperMap.AreaSolarRadiationParameters = AreaSolarRadiationParameters;
  83100. SuperMap.AreaSolarRadiationService = AreaSolarRadiationService;
  83101. SuperMap.BucketAggParameter = BucketAggParameter;
  83102. SuperMap.BufferAnalystParameters = BufferAnalystParameters;
  83103. SuperMap.BufferAnalystService = BufferAnalystService;
  83104. SuperMap.BufferDistance = BufferDistance;
  83105. SuperMap.BuffersAnalystJobsParameter = BuffersAnalystJobsParameter;
  83106. SuperMap.BuffersAnalystJobsService = BuffersAnalystJobsService;
  83107. SuperMap.BufferSetting = BufferSetting;
  83108. SuperMap.BurstPipelineAnalystParameters = BurstPipelineAnalystParameters;
  83109. SuperMap.BurstPipelineAnalystService = BurstPipelineAnalystService;
  83110. SuperMap.ChartFeatureInfoSpecsService = ChartFeatureInfoSpecsService;
  83111. SuperMap.ChartQueryFilterParameter = ChartQueryFilterParameter;
  83112. SuperMap.ChartQueryParameters = ChartQueryParameters;
  83113. SuperMap.ChartQueryService = ChartQueryService;
  83114. SuperMap.ClipParameter = ClipParameter;
  83115. SuperMap.ColorDictionary = ColorDictionary;
  83116. SuperMap.CommonServiceBase = CommonServiceBase;
  83117. SuperMap.ComputeWeightMatrixParameters = ComputeWeightMatrixParameters;
  83118. SuperMap.ComputeWeightMatrixService = ComputeWeightMatrixService;
  83119. SuperMap.CreateDatasetParameters = CreateDatasetParameters;
  83120. SuperMap.DataFlowService = DataFlowService_DataFlowService;
  83121. SuperMap.DataReturnOption = DataReturnOption;
  83122. SuperMap.DatasetBufferAnalystParameters = DatasetBufferAnalystParameters;
  83123. SuperMap.DatasetInfo = DatasetInfo;
  83124. SuperMap.DatasetOverlayAnalystParameters = DatasetOverlayAnalystParameters;
  83125. SuperMap.DatasetService = DatasetService_DatasetService;
  83126. SuperMap.DatasetSurfaceAnalystParameters = DatasetSurfaceAnalystParameters;
  83127. SuperMap.DatasetThiessenAnalystParameters = DatasetThiessenAnalystParameters;
  83128. SuperMap.DatasourceConnectionInfo = DatasourceConnectionInfo;
  83129. SuperMap.DatasourceService = DatasourceService_DatasourceService;
  83130. SuperMap.DensityAnalystService = DensityAnalystService;
  83131. SuperMap.DensityKernelAnalystParameters = DensityKernelAnalystParameters;
  83132. SuperMap.EditFeaturesParameters = EditFeaturesParameters;
  83133. SuperMap.EditFeaturesService = EditFeaturesService;
  83134. SuperMap.FacilityAnalyst3DParameters = FacilityAnalyst3DParameters;
  83135. SuperMap.FacilityAnalystSinks3DParameters = FacilityAnalystSinks3DParameters;
  83136. SuperMap.FacilityAnalystSinks3DService = FacilityAnalystSinks3DService;
  83137. SuperMap.FacilityAnalystSources3DParameters = FacilityAnalystSources3DParameters;
  83138. SuperMap.FacilityAnalystSources3DService = FacilityAnalystSources3DService;
  83139. SuperMap.FacilityAnalystStreamParameters = FacilityAnalystStreamParameters;
  83140. SuperMap.FacilityAnalystStreamService = FacilityAnalystStreamService;
  83141. SuperMap.FacilityAnalystTracedown3DParameters = FacilityAnalystTracedown3DParameters;
  83142. SuperMap.FacilityAnalystTracedown3DService = FacilityAnalystTracedown3DService;
  83143. SuperMap.FacilityAnalystTraceup3DParameters = FacilityAnalystTraceup3DParameters;
  83144. SuperMap.FacilityAnalystTraceup3DService = FacilityAnalystTraceup3DService;
  83145. SuperMap.FacilityAnalystUpstream3DParameters = FacilityAnalystUpstream3DParameters;
  83146. SuperMap.FacilityAnalystUpstream3DService = FacilityAnalystUpstream3DService;
  83147. SuperMap.FieldParameters = FieldParameters;
  83148. SuperMap.FieldsFilter = FieldsFilter;
  83149. SuperMap.FieldStatisticService = FieldStatisticService;
  83150. SuperMap.FieldStatisticsParameters = FieldStatisticsParameters;
  83151. SuperMap.FilterParameter = FilterParameter;
  83152. SuperMap.FindClosestFacilitiesParameters = FindClosestFacilitiesParameters;
  83153. SuperMap.FindClosestFacilitiesService = FindClosestFacilitiesService;
  83154. SuperMap.FindLocationParameters = FindLocationParameters;
  83155. SuperMap.FindLocationService = FindLocationService;
  83156. SuperMap.FindMTSPPathsParameters = FindMTSPPathsParameters;
  83157. SuperMap.FindMTSPPathsService = FindMTSPPathsService;
  83158. SuperMap.FindPathParameters = FindPathParameters;
  83159. SuperMap.FindPathService = FindPathService;
  83160. SuperMap.FindServiceAreasParameters = FindServiceAreasParameters;
  83161. SuperMap.FindServiceAreasService = FindServiceAreasService;
  83162. SuperMap.FindTSPPathsParameters = FindTSPPathsParameters;
  83163. SuperMap.FindTSPPathsService = FindTSPPathsService;
  83164. SuperMap.GenerateSpatialDataParameters = GenerateSpatialDataParameters;
  83165. SuperMap.GenerateSpatialDataService = GenerateSpatialDataService;
  83166. SuperMap.GeoCodingParameter = GeoCodingParameter;
  83167. SuperMap.GeoDecodingParameter = GeoDecodingParameter;
  83168. SuperMap.GeoHashGridAggParameter = GeoHashGridAggParameter;
  83169. SuperMap.GeometryBatchAnalystService = GeometryBatchAnalystService;
  83170. SuperMap.GeometryBufferAnalystParameters = GeometryBufferAnalystParameters;
  83171. SuperMap.GeometryOverlayAnalystParameters = GeometryOverlayAnalystParameters;
  83172. SuperMap.GeometrySurfaceAnalystParameters = GeometrySurfaceAnalystParameters;
  83173. SuperMap.GeometryThiessenAnalystParameters = GeometryThiessenAnalystParameters;
  83174. SuperMap.GeoprocessingService = GeoprocessingService_GeoprocessingService;
  83175. SuperMap.GeoRelationAnalystParameters = GeoRelationAnalystParameters;
  83176. SuperMap.GeoRelationAnalystService = GeoRelationAnalystService;
  83177. SuperMap.GetFeaturesByBoundsParameters = GetFeaturesByBoundsParameters;
  83178. SuperMap.GetFeaturesByBoundsService = GetFeaturesByBoundsService;
  83179. SuperMap.GetFeaturesByBufferParameters = GetFeaturesByBufferParameters;
  83180. SuperMap.GetFeaturesByBufferService = GetFeaturesByBufferService;
  83181. SuperMap.GetFeaturesByGeometryParameters = GetFeaturesByGeometryParameters;
  83182. SuperMap.GetFeaturesByGeometryService = GetFeaturesByGeometryService;
  83183. SuperMap.GetFeaturesByIDsParameters = GetFeaturesByIDsParameters;
  83184. SuperMap.GetFeaturesByIDsService = GetFeaturesByIDsService;
  83185. SuperMap.GetFeaturesBySQLParameters = GetFeaturesBySQLParameters;
  83186. SuperMap.GetFeaturesBySQLService = GetFeaturesBySQLService;
  83187. SuperMap.GetFeaturesParametersBase = GetFeaturesParametersBase;
  83188. SuperMap.GetFeaturesServiceBase = GetFeaturesServiceBase;
  83189. SuperMap.GetFieldsService = GetFieldsService;
  83190. SuperMap.GetGridCellInfosParameters = GetGridCellInfosParameters;
  83191. SuperMap.GetGridCellInfosService = GetGridCellInfosService;
  83192. SuperMap.GetLayersInfoService = GetLayersInfoService;
  83193. SuperMap.Grid = Grid;
  83194. SuperMap.HillshadeParameter = HillshadeParameter;
  83195. SuperMap.Image = UGCImage;
  83196. SuperMap.ImageCollectionService = ImageCollectionService_ImageCollectionService;
  83197. SuperMap.ImageGFAspect = ImageGFAspect;
  83198. SuperMap.ImageGFHillShade = ImageGFHillShade;
  83199. SuperMap.ImageGFOrtho = ImageGFOrtho;
  83200. SuperMap.ImageGFSlope = ImageGFSlope;
  83201. SuperMap.ImageRenderingRule = ImageRenderingRule;
  83202. SuperMap.ImageSearchParameter = ImageSearchParameter;
  83203. SuperMap.ImageService = ImageService_ImageService;
  83204. SuperMap.ImageStretchOption = ImageStretchOption;
  83205. SuperMap.InterpolationAnalystParameters = InterpolationAnalystParameters;
  83206. SuperMap.InterpolationAnalystService = InterpolationAnalystService;
  83207. SuperMap.InterpolationDensityAnalystParameters = InterpolationDensityAnalystParameters;
  83208. SuperMap.InterpolationIDWAnalystParameters = InterpolationIDWAnalystParameters;
  83209. SuperMap.InterpolationKrigingAnalystParameters = InterpolationKrigingAnalystParameters;
  83210. SuperMap.InterpolationRBFAnalystParameters = InterpolationRBFAnalystParameters;
  83211. SuperMap.JoinItem = JoinItem;
  83212. SuperMap.KernelDensityJobParameter = KernelDensityJobParameter;
  83213. SuperMap.KernelDensityJobsService = KernelDensityJobsService;
  83214. SuperMap.LabelImageCell = LabelImageCell;
  83215. SuperMap.LabelMatrixCell = LabelMatrixCell;
  83216. SuperMap.LabelMixedTextStyle = LabelMixedTextStyle;
  83217. SuperMap.LabelSymbolCell = LabelSymbolCell;
  83218. SuperMap.LabelThemeCell = LabelThemeCell;
  83219. SuperMap.LayerStatus = LayerStatus;
  83220. SuperMap.LinkItem = LinkItem;
  83221. SuperMap.MappingParameters = MappingParameters;
  83222. SuperMap.MapService = MapService_MapService;
  83223. SuperMap.MathExpressionAnalysisParameters = MathExpressionAnalysisParameters;
  83224. SuperMap.MathExpressionAnalysisService = MathExpressionAnalysisService;
  83225. SuperMap.MeasureParameters = MeasureParameters;
  83226. SuperMap.MeasureService = MeasureService_MeasureService;
  83227. SuperMap.MetricsAggParameter = MetricsAggParameter;
  83228. SuperMap.NDVIParameter = NDVIParameter;
  83229. SuperMap.NetworkAnalystServiceBase = NetworkAnalystServiceBase;
  83230. SuperMap.OutputSetting = OutputSetting;
  83231. SuperMap.OverlapDisplayedOptions = OverlapDisplayedOptions;
  83232. SuperMap.OverlayAnalystParameters = OverlayAnalystParameters;
  83233. SuperMap.OverlayAnalystService = OverlayAnalystService;
  83234. SuperMap.OverlayGeoJobParameter = OverlayGeoJobParameter;
  83235. SuperMap.OverlayGeoJobsService = OverlayGeoJobsService;
  83236. SuperMap.PointWithMeasure = PointWithMeasure;
  83237. SuperMap.ProcessingServiceBase = ProcessingServiceBase;
  83238. SuperMap.QueryByBoundsParameters = QueryByBoundsParameters;
  83239. SuperMap.QueryByBoundsService = QueryByBoundsService;
  83240. SuperMap.QueryByDistanceParameters = QueryByDistanceParameters;
  83241. SuperMap.QueryByDistanceService = QueryByDistanceService;
  83242. SuperMap.QueryByGeometryParameters = QueryByGeometryParameters;
  83243. SuperMap.QueryByGeometryService = QueryByGeometryService;
  83244. SuperMap.QueryBySQLParameters = QueryBySQLParameters;
  83245. SuperMap.QueryBySQLService = QueryBySQLService;
  83246. SuperMap.QueryParameters = QueryParameters;
  83247. SuperMap.QueryService = QueryService_QueryService;
  83248. SuperMap.RasterFunctionParameter = RasterFunctionParameter;
  83249. SuperMap.Route = Route;
  83250. SuperMap.RouteCalculateMeasureParameters = RouteCalculateMeasureParameters;
  83251. SuperMap.RouteCalculateMeasureService = RouteCalculateMeasureService;
  83252. SuperMap.RouteLocatorParameters = RouteLocatorParameters;
  83253. SuperMap.RouteLocatorService = RouteLocatorService;
  83254. SuperMap.ServerColor = ServerColor;
  83255. SuperMap.ServerFeature = ServerFeature;
  83256. SuperMap.ServerGeometry = ServerGeometry;
  83257. SuperMap.ServerStyle = ServerStyle;
  83258. SuperMap.ServerTextStyle = ServerTextStyle;
  83259. SuperMap.ServerTheme = ServerTheme;
  83260. SuperMap.SetDatasourceParameters = SetDatasourceParameters;
  83261. SuperMap.SetLayerInfoParameters = SetLayerInfoParameters;
  83262. SuperMap.SetLayerInfoService = SetLayerInfoService;
  83263. SuperMap.SetLayersInfoParameters = SetLayersInfoParameters;
  83264. SuperMap.SetLayersInfoService = SetLayersInfoService;
  83265. SuperMap.SetLayerStatusParameters = SetLayerStatusParameters;
  83266. SuperMap.SetLayerStatusService = SetLayerStatusService;
  83267. SuperMap.SingleObjectQueryJobsParameter = SingleObjectQueryJobsParameter;
  83268. SuperMap.SingleObjectQueryJobsService = SingleObjectQueryJobsService;
  83269. SuperMap.Sortby = Sortby;
  83270. SuperMap.SpatialAnalystBase = SpatialAnalystBase;
  83271. SuperMap.StopQueryParameters = StopQueryParameters;
  83272. SuperMap.StopQueryService = StopQueryService;
  83273. SuperMap.SummaryAttributesJobsParameter = SummaryAttributesJobsParameter;
  83274. SuperMap.SummaryAttributesJobsService = SummaryAttributesJobsService;
  83275. SuperMap.SummaryMeshJobParameter = SummaryMeshJobParameter;
  83276. SuperMap.SummaryMeshJobsService = SummaryMeshJobsService;
  83277. SuperMap.SummaryRegionJobParameter = SummaryRegionJobParameter;
  83278. SuperMap.SummaryRegionJobsService = SummaryRegionJobsService;
  83279. SuperMap.SupplyCenter = SupplyCenter;
  83280. SuperMap.SurfaceAnalystParameters = SurfaceAnalystParameters;
  83281. SuperMap.SurfaceAnalystParametersSetting = SurfaceAnalystParametersSetting;
  83282. SuperMap.SurfaceAnalystService = SurfaceAnalystService;
  83283. SuperMap.TerrainCurvatureCalculationParameters = TerrainCurvatureCalculationParameters;
  83284. SuperMap.TerrainCurvatureCalculationService = TerrainCurvatureCalculationService;
  83285. SuperMap.Theme = Theme;
  83286. SuperMap.ThemeDotDensity = ThemeDotDensity;
  83287. SuperMap.ThemeFlow = ThemeFlow;
  83288. SuperMap.ThemeGraduatedSymbol = ThemeGraduatedSymbol;
  83289. SuperMap.ThemeGraduatedSymbolStyle = ThemeGraduatedSymbolStyle;
  83290. SuperMap.ThemeGraph = ThemeGraph;
  83291. SuperMap.ThemeGraphAxes = ThemeGraphAxes;
  83292. SuperMap.ThemeGraphItem = ThemeGraphItem;
  83293. SuperMap.ThemeGraphSize = ThemeGraphSize;
  83294. SuperMap.ThemeGraphText = ThemeGraphText;
  83295. SuperMap.ThemeGridRange = ThemeGridRange;
  83296. SuperMap.ThemeGridRangeItem = ThemeGridRangeItem;
  83297. SuperMap.ThemeGridUnique = ThemeGridUnique;
  83298. SuperMap.ThemeGridUniqueItem = ThemeGridUniqueItem;
  83299. SuperMap.ThemeLabel = ThemeLabel;
  83300. SuperMap.ThemeLabelAlongLine = ThemeLabelAlongLine;
  83301. SuperMap.ThemeLabelBackground = ThemeLabelBackground;
  83302. SuperMap.ThemeLabelItem = ThemeLabelItem;
  83303. SuperMap.ThemeLabelText = ThemeLabelText;
  83304. SuperMap.ThemeLabelUniqueItem = ThemeLabelUniqueItem;
  83305. SuperMap.ThemeMemoryData = ThemeMemoryData;
  83306. SuperMap.ThemeOffset = ThemeOffset;
  83307. SuperMap.ThemeParameters = ThemeParameters;
  83308. SuperMap.ThemeRange = ThemeRange;
  83309. SuperMap.ThemeRangeItem = ThemeRangeItem;
  83310. SuperMap.ThemeService = ThemeService_ThemeService;
  83311. SuperMap.ThemeUnique = ThemeUnique;
  83312. SuperMap.ThemeUniqueItem = ThemeUniqueItem;
  83313. SuperMap.ThiessenAnalystParameters = ThiessenAnalystParameters;
  83314. SuperMap.ThiessenAnalystService = ThiessenAnalystService;
  83315. SuperMap.TilesetsService = TilesetsService;
  83316. SuperMap.TopologyValidatorJobsParameter = TopologyValidatorJobsParameter;
  83317. SuperMap.TopologyValidatorJobsService = TopologyValidatorJobsService;
  83318. SuperMap.TransferLine = TransferLine;
  83319. SuperMap.TransferPathParameters = TransferPathParameters;
  83320. SuperMap.TransferPathService = TransferPathService;
  83321. SuperMap.TransferSolutionParameters = TransferSolutionParameters;
  83322. SuperMap.TransferSolutionService = TransferSolutionService;
  83323. SuperMap.TransportationAnalystParameter = TransportationAnalystParameter;
  83324. SuperMap.TransportationAnalystResultSetting = TransportationAnalystResultSetting;
  83325. SuperMap.UGCLayer = UGCLayer;
  83326. SuperMap.UGCMapLayer = UGCMapLayer;
  83327. SuperMap.UGCSubLayer = UGCSubLayer;
  83328. SuperMap.UpdateDatasetParameters = UpdateDatasetParameters;
  83329. SuperMap.UpdateEdgeWeightParameters = UpdateEdgeWeightParameters;
  83330. SuperMap.UpdateEdgeWeightService = UpdateEdgeWeightService;
  83331. SuperMap.UpdateTurnNodeWeightParameters = UpdateTurnNodeWeightParameters;
  83332. SuperMap.UpdateTurnNodeWeightService = UpdateTurnNodeWeightService;
  83333. SuperMap.Vector = Vector_Vector;
  83334. SuperMap.VectorClipJobsParameter = VectorClipJobsParameter;
  83335. SuperMap.VectorClipJobsService = VectorClipJobsService;
  83336. SuperMap.WebPrintingJobContent = WebPrintingJobContent;
  83337. SuperMap.WebPrintingJobCustomItems = WebPrintingJobCustomItems;
  83338. SuperMap.WebPrintingJobExportOptions = WebPrintingJobExportOptions;
  83339. SuperMap.WebPrintingJobImage = WebPrintingJobImage;
  83340. SuperMap.WebPrintingJobLayers = WebPrintingJobLayers;
  83341. SuperMap.WebPrintingJobLayoutOptions = WebPrintingJobLayoutOptions;
  83342. SuperMap.WebPrintingJobLegendOptions = WebPrintingJobLegendOptions;
  83343. SuperMap.WebPrintingJobLittleMapOptions = WebPrintingJobLittleMapOptions;
  83344. SuperMap.WebPrintingJobNorthArrowOptions = WebPrintingJobNorthArrowOptions;
  83345. SuperMap.WebPrintingJobParameters = WebPrintingJobParameters;
  83346. SuperMap.WebPrintingJobScaleBarOptions = WebPrintingJobScaleBarOptions;
  83347. SuperMap.WebPrintingService = WebPrintingService;
  83348. //Online
  83349. SuperMap.Online = Online;
  83350. SuperMap.OnlineData = OnlineData;
  83351. SuperMap.OnlineQueryDatasParameter = OnlineQueryDatasParameter;
  83352. SuperMap.ServiceStatus = ServiceStatus;
  83353. // 包含online中的DataItemType数据类型
  83354. SuperMap.DataItemType = DataItemType;
  83355. SuperMap.DataItemOrderBy = DataItemOrderBy;
  83356. SuperMap.FilterField = FilterField;
  83357. SuperMap.OnlineServiceBase = OnlineServiceBase;
  83358. // overlay
  83359. SuperMap.Feature = SuperMap.Feature || {};
  83360. SuperMap.Feature.Theme = Theme_Theme;
  83361. SuperMap.Feature.Theme.Bar = Bar;
  83362. SuperMap.Feature.Theme.Bar3D = Bar3D;
  83363. SuperMap.Feature.Theme.Circle = Circle;
  83364. SuperMap.Feature.Theme.Graph = Graph;
  83365. SuperMap.Feature.Theme.Line = Line;
  83366. SuperMap.Feature.Theme.Pie = Pie;
  83367. SuperMap.Feature.Theme.Point = overlay_Point_Point;
  83368. SuperMap.Feature.Theme.RankSymbol = RankSymbol;
  83369. SuperMap.Feature.Theme.Ring = Ring;
  83370. SuperMap.Feature.Theme.ThemeVector = ThemeVector;
  83371. SuperMap.Feature.ShapeParameters = ShapeParameters;
  83372. SuperMap.Feature.ShapeParameters.Circle = Circle_Circle;
  83373. SuperMap.Feature.ShapeParameters.Image = Image_Image;
  83374. SuperMap.Feature.ShapeParameters.Label = Label;
  83375. SuperMap.Feature.ShapeParameters.Line = Line_Line;
  83376. SuperMap.Feature.ShapeParameters.Point = Point_Point;
  83377. SuperMap.Feature.ShapeParameters.Polygon = feature_Polygon_Polygon;
  83378. SuperMap.Feature.ShapeParameters.Rectangle = Rectangle_Rectangle;
  83379. SuperMap.Feature.ShapeParameters.Sector = Sector;
  83380. SuperMap.Feature.ShapeFactory = ShapeFactory;
  83381. // LevelRenderer
  83382. SuperMap.LevelRenderer = LevelRenderer;
  83383. // security
  83384. SuperMap.KeyServiceParameter = KeyServiceParameter;
  83385. SuperMap.SecurityManager = SecurityManager;
  83386. SuperMap.ServerInfo = ServerInfo;
  83387. SuperMap.TokenServiceParameter = TokenServiceParameter;
  83388. // style
  83389. SuperMap.ThemeStyle = ThemeStyle;
  83390. SuperMap.CartoCSS = CartoCSS;
  83391. // thirdparty
  83392. // SuperMap.BinaryClassification = BinaryClassification;
  83393. // SuperMap.LandcoverClassification = LandcoverClassification;
  83394. // SuperMap.ObjectDetection = ObjectDetection;
  83395. // SuperMap.WebMachineLearning = WebMachineLearning;
  83396. SuperMap.ElasticSearch = ElasticSearch;
  83397. // util
  83398. SuperMap.ArrayStatistic = ArrayStatistic;
  83399. SuperMap.ColorsPickerUtil = ColorsPickerUtil;
  83400. // REST
  83401. SuperMap.DataFormat = DataFormat;
  83402. SuperMap.ServerType = ServerType;
  83403. SuperMap.GeometryType = REST_GeometryType;
  83404. SuperMap.QueryOption = QueryOption;
  83405. SuperMap.JoinType = JoinType;
  83406. SuperMap.SpatialQueryMode = SpatialQueryMode;
  83407. SuperMap.SpatialRelationType = SpatialRelationType;
  83408. SuperMap.MeasureMode = MeasureMode;
  83409. SuperMap.Unit = Unit;
  83410. SuperMap.BufferRadiusUnit = BufferRadiusUnit;
  83411. SuperMap.EngineType = EngineType;
  83412. SuperMap.ThemeGraphTextFormat = ThemeGraphTextFormat;
  83413. SuperMap.ThemeGraphType = ThemeGraphType;
  83414. SuperMap.GraphAxesTextDisplayMode = GraphAxesTextDisplayMode;
  83415. SuperMap.GraduatedMode = GraduatedMode;
  83416. SuperMap.RangeMode = RangeMode;
  83417. SuperMap.ThemeType = ThemeType;
  83418. SuperMap.ColorGradientType = ColorGradientType;
  83419. SuperMap.TextAlignment = TextAlignment;
  83420. SuperMap.FillGradientMode = FillGradientMode;
  83421. SuperMap.AlongLineDirection = AlongLineDirection;
  83422. SuperMap.LabelBackShape = LabelBackShape;
  83423. SuperMap.LabelOverLengthMode = LabelOverLengthMode;
  83424. SuperMap.DirectionType = DirectionType;
  83425. SuperMap.OverlayOperationType = OverlayOperationType;
  83426. SuperMap.OutputType = OutputType;
  83427. SuperMap.SideType = SideType;
  83428. SuperMap.SupplyCenterType = SupplyCenterType;
  83429. SuperMap.TurnType = TurnType;
  83430. SuperMap.BufferEndType = BufferEndType;
  83431. SuperMap.SmoothMethod = SmoothMethod;
  83432. SuperMap.SurfaceAnalystMethod = SurfaceAnalystMethod;
  83433. SuperMap.DataReturnMode = DataReturnMode;
  83434. SuperMap.EditType = EditType;
  83435. SuperMap.TransferTactic = TransferTactic;
  83436. SuperMap.TransferPreference = TransferPreference;
  83437. SuperMap.GridType = GridType;
  83438. SuperMap.ColorSpaceType = ColorSpaceType;
  83439. SuperMap.LayerType = LayerType;
  83440. SuperMap.UGCLayerType = UGCLayerType;
  83441. SuperMap.StatisticMode = StatisticMode;
  83442. SuperMap.PixelFormat = PixelFormat;
  83443. SuperMap.SearchMode = SearchMode;
  83444. SuperMap.InterpolationAlgorithmType = InterpolationAlgorithmType;
  83445. SuperMap.VariogramMode = VariogramMode;
  83446. SuperMap.Exponent = Exponent;
  83447. SuperMap.ClientType = ClientType;
  83448. SuperMap.ChartType = ChartType;
  83449. SuperMap.ClipAnalystMode = ClipAnalystMode;
  83450. SuperMap.AnalystAreaUnit = AnalystAreaUnit;
  83451. SuperMap.AnalystSizeUnit = AnalystSizeUnit;
  83452. SuperMap.StatisticAnalystMode = StatisticAnalystMode;
  83453. SuperMap.SummaryType = SummaryType;
  83454. SuperMap.TopologyValidatorRule = TopologyValidatorRule;
  83455. SuperMap.BucketAggType = BucketAggType;
  83456. SuperMap.MetricsAggType = MetricsAggType;
  83457. SuperMap.GetFeatureMode = GetFeatureMode;
  83458. SuperMap.RasterFunctionType = RasterFunctionType;
  83459. SuperMap.ResourceType = ResourceType;
  83460. SuperMap.OrderBy = OrderBy;
  83461. SuperMap.OrderType = OrderType;
  83462. SuperMap.SearchType = SearchType;
  83463. SuperMap.AggregationTypes = AggregationTypes;
  83464. SuperMap.PermissionType = PermissionType;
  83465. SuperMap.EntityType = EntityType;
  83466. SuperMap.WebExportFormatType = WebExportFormatType;
  83467. SuperMap.WebScaleOrientationType = WebScaleOrientationType;
  83468. SuperMap.WebScaleType = WebScaleType;
  83469. SuperMap.WebScaleUnit = WebScaleUnit;
  83470. SuperMap.KnowledgeGraph = KnowledgeGraph
  83471. ;// CONCATENATED MODULE: ./src/maplibregl/index.js
  83472. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  83473. * This program are made available under the terms of the Apache License, Version 2.0
  83474. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  83475. ;// CONCATENATED MODULE: ./src/maplibregl/namespace.js
  83476. /* Copyright© 2000 - 2023 SuperMap Software Co.Ltd. All rights reserved.
  83477. * This program are made available under the terms of the Apache License, Version 2.0
  83478. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  83479. (external_maplibregl_default()).supermap = {...SuperMap, ...(external_maplibregl_default()).supermap};
  83480. (external_maplibregl_default()).supermap.Graphic = Graphic;
  83481. (external_maplibregl_default()).supermap.Transform = Transform;
  83482. (external_maplibregl_default()).supermap.AddressMatchService = AddressMatchService;
  83483. (external_maplibregl_default()).supermap.ChartService = ChartService;
  83484. (external_maplibregl_default()).supermap.DataFlowService = DataFlowService;
  83485. (external_maplibregl_default()).supermap.DatasetService = DatasetService;
  83486. (external_maplibregl_default()).supermap.DatasourceService = DatasourceService;
  83487. (external_maplibregl_default()).supermap.FeatureService = FeatureService;
  83488. (external_maplibregl_default()).supermap.FieldService = FieldService;
  83489. (external_maplibregl_default()).supermap.GeoprocessingService = GeoprocessingService;
  83490. (external_maplibregl_default()).supermap.GridCellInfosService = GridCellInfosService;
  83491. (external_maplibregl_default()).supermap.ImageCollectionService = ImageCollectionService;
  83492. (external_maplibregl_default()).supermap.ImageService = ImageService;
  83493. (external_maplibregl_default()).supermap.LayerInfoService = LayerInfoService;
  83494. (external_maplibregl_default()).supermap.MapService = MapService;
  83495. (external_maplibregl_default()).supermap.MeasureService = MeasureService;
  83496. (external_maplibregl_default()).supermap.NetworkAnalyst3DService = NetworkAnalyst3DService;
  83497. (external_maplibregl_default()).supermap.NetworkAnalystService = NetworkAnalystService;
  83498. (external_maplibregl_default()).supermap.ProcessingService = ProcessingService;
  83499. (external_maplibregl_default()).supermap.QueryService = QueryService;
  83500. (external_maplibregl_default()).supermap.ServiceBase = ServiceBase;
  83501. (external_maplibregl_default()).supermap.SpatialAnalystService = SpatialAnalystService;
  83502. (external_maplibregl_default()).supermap.ThemeService = ThemeService;
  83503. (external_maplibregl_default()).supermap.TrafficTransferAnalystService = TrafficTransferAnalystService;
  83504. (external_maplibregl_default()).supermap.WebPrintingJobService = WebPrintingJobService;
  83505. (external_maplibregl_default()).supermap.KnowledgeGraphService = KnowledgeGraphService;
  83506. (external_maplibregl_default()).supermap.CommonUtil = Util_Util;
  83507. (external_maplibregl_default()).supermap.Util = core_Util_Util;
  83508. (external_maplibregl_default()).supermap.LogoControl = Logo;
  83509. (external_maplibregl_default()).supermap.Logo = Logo;
  83510. (external_maplibregl_default()).supermap.GraphMap = GraphMap;
  83511. (external_maplibregl_default()).supermap.MapvLayer = MapvLayer;
  83512. (external_maplibregl_default()).supermap.ThreeLayer = ThreeLayer;
  83513. (external_maplibregl_default()).supermap.DeckglLayer = DeckglLayer;
  83514. (external_maplibregl_default()).supermap.HeatMapLayer = HeatMapLayer;
  83515. (external_maplibregl_default()).supermap.GraphicLayer = GraphicLayer;
  83516. (external_maplibregl_default()).supermap.GraticuleLayer = GraticuleLayer;
  83517. (external_maplibregl_default()).supermap.FGBLayer = FGBLayer;
  83518. })();
  83519. /******/ })()
  83520. ;