iclient-leaflet-es6.js 3.6 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097640986409964100641016410264103641046410564106641076410864109641106411164112641136411464115641166411764118641196412064121641226412364124641256412664127641286412964130641316413264133641346413564136641376413864139641406414164142641436414464145641466414764148641496415064151641526415364154641556415664157641586415964160641616416264163641646416564166641676416864169641706417164172641736417464175641766417764178641796418064181641826418364184641856418664187641886418964190641916419264193641946419564196641976419864199642006420164202642036420464205642066420764208642096421064211642126421364214642156421664217642186421964220642216422264223642246422564226642276422864229642306423164232642336423464235642366423764238642396424064241642426424364244642456424664247642486424964250642516425264253642546425564256642576425864259642606426164262642636426464265642666426764268642696427064271642726427364274642756427664277642786427964280642816428264283642846428564286642876428864289642906429164292642936429464295642966429764298642996430064301643026430364304643056430664307643086430964310643116431264313643146431564316643176431864319643206432164322643236432464325643266432764328643296433064331643326433364334643356433664337643386433964340643416434264343643446434564346643476434864349643506435164352643536435464355643566435764358643596436064361643626436364364643656436664367643686436964370643716437264373643746437564376643776437864379643806438164382643836438464385643866438764388643896439064391643926439364394643956439664397643986439964400644016440264403644046440564406644076440864409644106441164412644136441464415644166441764418644196442064421644226442364424644256442664427644286442964430644316443264433644346443564436644376443864439644406444164442644436444464445644466444764448644496445064451644526445364454644556445664457644586445964460644616446264463644646446564466644676446864469644706447164472644736447464475644766447764478644796448064481644826448364484644856448664487644886448964490644916449264493644946449564496644976449864499645006450164502645036450464505645066450764508645096451064511645126451364514645156451664517645186451964520645216452264523645246452564526645276452864529645306453164532645336453464535645366453764538645396454064541645426454364544645456454664547645486454964550645516455264553645546455564556645576455864559645606456164562645636456464565645666456764568645696457064571645726457364574645756457664577645786457964580645816458264583645846458564586645876458864589645906459164592645936459464595645966459764598645996460064601646026460364604646056460664607646086460964610646116461264613646146461564616646176461864619646206462164622646236462464625646266462764628646296463064631646326463364634646356463664637646386463964640646416464264643646446464564646646476464864649646506465164652646536465464655646566465764658646596466064661646626466364664646656466664667646686466964670646716467264673646746467564676646776467864679646806468164682646836468464685646866468764688646896469064691646926469364694646956469664697646986469964700647016470264703647046470564706647076470864709647106471164712647136471464715647166471764718647196472064721647226472364724647256472664727647286472964730647316473264733647346473564736647376473864739647406474164742647436474464745647466474764748647496475064751647526475364754647556475664757647586475964760647616476264763647646476564766647676476864769647706477164772647736477464775647766477764778647796478064781647826478364784647856478664787647886478964790647916479264793647946479564796647976479864799648006480164802648036480464805648066480764808648096481064811648126481364814648156481664817648186481964820648216482264823648246482564826648276482864829648306483164832648336483464835648366483764838648396484064841648426484364844648456484664847648486484964850648516485264853648546485564856648576485864859648606486164862648636486464865648666486764868648696487064871648726487364874648756487664877648786487964880648816488264883648846488564886648876488864889648906489164892648936489464895648966489764898648996490064901649026490364904649056490664907649086490964910649116491264913649146491564916649176491864919649206492164922649236492464925649266492764928649296493064931649326493364934649356493664937649386493964940649416494264943649446494564946649476494864949649506495164952649536495464955649566495764958649596496064961649626496364964649656496664967649686496964970649716497264973649746497564976649776497864979649806498164982649836498464985649866498764988649896499064991649926499364994649956499664997649986499965000650016500265003650046500565006650076500865009650106501165012650136501465015650166501765018650196502065021650226502365024650256502665027650286502965030650316503265033650346503565036650376503865039650406504165042650436504465045650466504765048650496505065051650526505365054650556505665057650586505965060650616506265063650646506565066650676506865069650706507165072650736507465075650766507765078650796508065081650826508365084650856508665087650886508965090650916509265093650946509565096650976509865099651006510165102651036510465105651066510765108651096511065111651126511365114651156511665117651186511965120651216512265123651246512565126651276512865129651306513165132651336513465135651366513765138651396514065141651426514365144651456514665147651486514965150651516515265153651546515565156651576515865159651606516165162651636516465165651666516765168651696517065171651726517365174651756517665177651786517965180651816518265183651846518565186651876518865189651906519165192651936519465195651966519765198651996520065201652026520365204652056520665207652086520965210652116521265213652146521565216652176521865219652206522165222652236522465225652266522765228652296523065231652326523365234652356523665237652386523965240652416524265243652446524565246652476524865249652506525165252652536525465255652566525765258652596526065261652626526365264652656526665267652686526965270652716527265273652746527565276652776527865279652806528165282652836528465285652866528765288652896529065291652926529365294652956529665297652986529965300653016530265303653046530565306653076530865309653106531165312653136531465315653166531765318653196532065321653226532365324653256532665327653286532965330653316533265333653346533565336653376533865339653406534165342653436534465345653466534765348653496535065351653526535365354653556535665357653586535965360653616536265363653646536565366653676536865369653706537165372653736537465375653766537765378653796538065381653826538365384653856538665387653886538965390653916539265393653946539565396653976539865399654006540165402654036540465405654066540765408654096541065411654126541365414654156541665417654186541965420654216542265423654246542565426654276542865429654306543165432654336543465435654366543765438654396544065441654426544365444654456544665447654486544965450654516545265453654546545565456654576545865459654606546165462654636546465465654666546765468654696547065471654726547365474654756547665477654786547965480654816548265483654846548565486654876548865489654906549165492654936549465495654966549765498654996550065501655026550365504655056550665507655086550965510655116551265513655146551565516655176551865519655206552165522655236552465525655266552765528655296553065531655326553365534655356553665537655386553965540655416554265543655446554565546655476554865549655506555165552655536555465555655566555765558655596556065561655626556365564655656556665567655686556965570655716557265573655746557565576655776557865579655806558165582655836558465585655866558765588655896559065591655926559365594655956559665597655986559965600656016560265603656046560565606656076560865609656106561165612656136561465615656166561765618656196562065621656226562365624656256562665627656286562965630656316563265633656346563565636656376563865639656406564165642656436564465645656466564765648656496565065651656526565365654656556565665657656586565965660656616566265663656646566565666656676566865669656706567165672656736567465675656766567765678656796568065681656826568365684656856568665687656886568965690656916569265693656946569565696656976569865699657006570165702657036570465705657066570765708657096571065711657126571365714657156571665717657186571965720657216572265723657246572565726657276572865729657306573165732657336573465735657366573765738657396574065741657426574365744657456574665747657486574965750657516575265753657546575565756657576575865759657606576165762657636576465765657666576765768657696577065771657726577365774657756577665777657786577965780657816578265783657846578565786657876578865789657906579165792657936579465795657966579765798657996580065801658026580365804658056580665807658086580965810658116581265813658146581565816658176581865819658206582165822658236582465825658266582765828658296583065831658326583365834658356583665837658386583965840658416584265843658446584565846658476584865849658506585165852658536585465855658566585765858658596586065861658626586365864658656586665867658686586965870658716587265873658746587565876658776587865879658806588165882658836588465885658866588765888658896589065891658926589365894658956589665897658986589965900659016590265903659046590565906659076590865909659106591165912659136591465915659166591765918659196592065921659226592365924659256592665927659286592965930659316593265933659346593565936659376593865939659406594165942659436594465945659466594765948659496595065951659526595365954659556595665957659586595965960659616596265963659646596565966659676596865969659706597165972659736597465975659766597765978659796598065981659826598365984659856598665987659886598965990659916599265993659946599565996659976599865999660006600166002660036600466005660066600766008660096601066011660126601366014660156601666017660186601966020660216602266023660246602566026660276602866029660306603166032660336603466035660366603766038660396604066041660426604366044660456604666047660486604966050660516605266053660546605566056660576605866059660606606166062660636606466065660666606766068660696607066071660726607366074660756607666077660786607966080660816608266083660846608566086660876608866089660906609166092660936609466095660966609766098660996610066101661026610366104661056610666107661086610966110661116611266113661146611566116661176611866119661206612166122661236612466125661266612766128661296613066131661326613366134661356613666137661386613966140661416614266143661446614566146661476614866149661506615166152661536615466155661566615766158661596616066161661626616366164661656616666167661686616966170661716617266173661746617566176661776617866179661806618166182661836618466185661866618766188661896619066191661926619366194661956619666197661986619966200662016620266203662046620566206662076620866209662106621166212662136621466215662166621766218662196622066221662226622366224662256622666227662286622966230662316623266233662346623566236662376623866239662406624166242662436624466245662466624766248662496625066251662526625366254662556625666257662586625966260662616626266263662646626566266662676626866269662706627166272662736627466275662766627766278662796628066281662826628366284662856628666287662886628966290662916629266293662946629566296662976629866299663006630166302663036630466305663066630766308663096631066311663126631366314663156631666317663186631966320663216632266323663246632566326663276632866329663306633166332663336633466335663366633766338663396634066341663426634366344663456634666347663486634966350663516635266353663546635566356663576635866359663606636166362663636636466365663666636766368663696637066371663726637366374663756637666377663786637966380663816638266383663846638566386663876638866389663906639166392663936639466395663966639766398663996640066401664026640366404664056640666407664086640966410664116641266413664146641566416664176641866419664206642166422664236642466425664266642766428664296643066431664326643366434664356643666437664386643966440664416644266443664446644566446664476644866449664506645166452664536645466455664566645766458664596646066461664626646366464664656646666467664686646966470664716647266473664746647566476664776647866479664806648166482664836648466485664866648766488664896649066491664926649366494664956649666497664986649966500665016650266503665046650566506665076650866509665106651166512665136651466515665166651766518665196652066521665226652366524665256652666527665286652966530665316653266533665346653566536665376653866539665406654166542665436654466545665466654766548665496655066551665526655366554665556655666557665586655966560665616656266563665646656566566665676656866569665706657166572665736657466575665766657766578665796658066581665826658366584665856658666587665886658966590665916659266593665946659566596665976659866599666006660166602666036660466605666066660766608666096661066611666126661366614666156661666617666186661966620666216662266623666246662566626666276662866629666306663166632666336663466635666366663766638666396664066641666426664366644666456664666647666486664966650666516665266653666546665566656666576665866659666606666166662666636666466665666666666766668666696667066671666726667366674666756667666677666786667966680666816668266683666846668566686666876668866689666906669166692666936669466695666966669766698666996670066701667026670366704667056670666707667086670966710667116671266713667146671566716667176671866719667206672166722667236672466725667266672766728667296673066731667326673366734667356673666737667386673966740667416674266743667446674566746667476674866749667506675166752667536675466755667566675766758667596676066761667626676366764667656676666767667686676966770667716677266773667746677566776667776677866779667806678166782667836678466785667866678766788667896679066791667926679366794667956679666797667986679966800668016680266803668046680566806668076680866809668106681166812668136681466815668166681766818668196682066821668226682366824668256682666827668286682966830668316683266833668346683566836668376683866839668406684166842668436684466845668466684766848668496685066851668526685366854668556685666857668586685966860668616686266863668646686566866668676686866869668706687166872668736687466875668766687766878668796688066881668826688366884668856688666887668886688966890668916689266893668946689566896668976689866899669006690166902669036690466905669066690766908669096691066911669126691366914669156691666917669186691966920669216692266923669246692566926669276692866929669306693166932669336693466935669366693766938669396694066941669426694366944669456694666947669486694966950669516695266953669546695566956669576695866959669606696166962669636696466965669666696766968669696697066971669726697366974669756697666977669786697966980669816698266983669846698566986669876698866989669906699166992669936699466995669966699766998669996700067001670026700367004670056700667007670086700967010670116701267013670146701567016670176701867019670206702167022670236702467025670266702767028670296703067031670326703367034670356703667037670386703967040670416704267043670446704567046670476704867049670506705167052670536705467055670566705767058670596706067061670626706367064670656706667067670686706967070670716707267073670746707567076670776707867079670806708167082670836708467085670866708767088670896709067091670926709367094670956709667097670986709967100671016710267103671046710567106671076710867109671106711167112671136711467115671166711767118671196712067121671226712367124671256712667127671286712967130671316713267133671346713567136671376713867139671406714167142671436714467145671466714767148671496715067151671526715367154671556715667157671586715967160671616716267163671646716567166671676716867169671706717167172671736717467175671766717767178671796718067181671826718367184671856718667187671886718967190671916719267193671946719567196671976719867199672006720167202672036720467205672066720767208672096721067211672126721367214672156721667217672186721967220672216722267223672246722567226672276722867229672306723167232672336723467235672366723767238672396724067241672426724367244672456724667247672486724967250672516725267253672546725567256672576725867259672606726167262672636726467265672666726767268672696727067271672726727367274672756727667277672786727967280672816728267283672846728567286672876728867289672906729167292672936729467295672966729767298672996730067301673026730367304673056730667307673086730967310673116731267313673146731567316673176731867319673206732167322673236732467325673266732767328673296733067331673326733367334673356733667337673386733967340673416734267343673446734567346673476734867349673506735167352673536735467355673566735767358673596736067361673626736367364673656736667367673686736967370673716737267373673746737567376673776737867379673806738167382673836738467385673866738767388673896739067391673926739367394673956739667397673986739967400674016740267403674046740567406674076740867409674106741167412674136741467415674166741767418674196742067421674226742367424674256742667427674286742967430674316743267433674346743567436674376743867439674406744167442674436744467445674466744767448674496745067451674526745367454674556745667457674586745967460674616746267463674646746567466674676746867469674706747167472674736747467475674766747767478674796748067481674826748367484674856748667487674886748967490674916749267493674946749567496674976749867499675006750167502675036750467505675066750767508675096751067511675126751367514675156751667517675186751967520675216752267523675246752567526675276752867529675306753167532675336753467535675366753767538675396754067541675426754367544675456754667547675486754967550675516755267553675546755567556675576755867559675606756167562675636756467565675666756767568675696757067571675726757367574675756757667577675786757967580675816758267583675846758567586675876758867589675906759167592675936759467595675966759767598675996760067601676026760367604676056760667607676086760967610676116761267613676146761567616676176761867619676206762167622676236762467625676266762767628676296763067631676326763367634676356763667637676386763967640676416764267643676446764567646676476764867649676506765167652676536765467655676566765767658676596766067661676626766367664676656766667667676686766967670676716767267673676746767567676676776767867679676806768167682676836768467685676866768767688676896769067691676926769367694676956769667697676986769967700677016770267703677046770567706677076770867709677106771167712677136771467715677166771767718677196772067721677226772367724677256772667727677286772967730677316773267733677346773567736677376773867739677406774167742677436774467745677466774767748677496775067751677526775367754677556775667757677586775967760677616776267763677646776567766677676776867769677706777167772677736777467775677766777767778677796778067781677826778367784677856778667787677886778967790677916779267793677946779567796677976779867799678006780167802678036780467805678066780767808678096781067811678126781367814678156781667817678186781967820678216782267823678246782567826678276782867829678306783167832678336783467835678366783767838678396784067841678426784367844678456784667847678486784967850678516785267853678546785567856678576785867859678606786167862678636786467865678666786767868678696787067871678726787367874678756787667877678786787967880678816788267883678846788567886678876788867889678906789167892678936789467895678966789767898678996790067901679026790367904679056790667907679086790967910679116791267913679146791567916679176791867919679206792167922679236792467925679266792767928679296793067931679326793367934679356793667937679386793967940679416794267943679446794567946679476794867949679506795167952679536795467955679566795767958679596796067961679626796367964679656796667967679686796967970679716797267973679746797567976679776797867979679806798167982679836798467985679866798767988679896799067991679926799367994679956799667997679986799968000680016800268003680046800568006680076800868009680106801168012680136801468015680166801768018680196802068021680226802368024680256802668027680286802968030680316803268033680346803568036680376803868039680406804168042680436804468045680466804768048680496805068051680526805368054680556805668057680586805968060680616806268063680646806568066680676806868069680706807168072680736807468075680766807768078680796808068081680826808368084680856808668087680886808968090680916809268093680946809568096680976809868099681006810168102681036810468105681066810768108681096811068111681126811368114681156811668117681186811968120681216812268123681246812568126681276812868129681306813168132681336813468135681366813768138681396814068141681426814368144681456814668147681486814968150681516815268153681546815568156681576815868159681606816168162681636816468165681666816768168681696817068171681726817368174681756817668177681786817968180681816818268183681846818568186681876818868189681906819168192681936819468195681966819768198681996820068201682026820368204682056820668207682086820968210682116821268213682146821568216682176821868219682206822168222682236822468225682266822768228682296823068231682326823368234682356823668237682386823968240682416824268243682446824568246682476824868249682506825168252682536825468255682566825768258682596826068261682626826368264682656826668267682686826968270682716827268273682746827568276682776827868279682806828168282682836828468285682866828768288682896829068291682926829368294682956829668297682986829968300683016830268303683046830568306683076830868309683106831168312683136831468315683166831768318683196832068321683226832368324683256832668327683286832968330683316833268333683346833568336683376833868339683406834168342683436834468345683466834768348683496835068351683526835368354683556835668357683586835968360683616836268363683646836568366683676836868369683706837168372683736837468375683766837768378683796838068381683826838368384683856838668387683886838968390683916839268393683946839568396683976839868399684006840168402684036840468405684066840768408684096841068411684126841368414684156841668417684186841968420684216842268423684246842568426684276842868429684306843168432684336843468435684366843768438684396844068441684426844368444684456844668447684486844968450684516845268453684546845568456684576845868459684606846168462684636846468465684666846768468684696847068471684726847368474684756847668477684786847968480684816848268483684846848568486684876848868489684906849168492684936849468495684966849768498684996850068501685026850368504685056850668507685086850968510685116851268513685146851568516685176851868519685206852168522685236852468525685266852768528685296853068531685326853368534685356853668537685386853968540685416854268543685446854568546685476854868549685506855168552685536855468555685566855768558685596856068561685626856368564685656856668567685686856968570685716857268573685746857568576685776857868579685806858168582685836858468585685866858768588685896859068591685926859368594685956859668597685986859968600686016860268603686046860568606686076860868609686106861168612686136861468615686166861768618686196862068621686226862368624686256862668627686286862968630686316863268633686346863568636686376863868639686406864168642686436864468645686466864768648686496865068651686526865368654686556865668657686586865968660686616866268663686646866568666686676866868669686706867168672686736867468675686766867768678686796868068681686826868368684686856868668687686886868968690686916869268693686946869568696686976869868699687006870168702687036870468705687066870768708687096871068711687126871368714687156871668717687186871968720687216872268723687246872568726687276872868729687306873168732687336873468735687366873768738687396874068741687426874368744687456874668747687486874968750687516875268753687546875568756687576875868759687606876168762687636876468765687666876768768687696877068771687726877368774687756877668777687786877968780687816878268783687846878568786687876878868789687906879168792687936879468795687966879768798687996880068801688026880368804688056880668807688086880968810688116881268813688146881568816688176881868819688206882168822688236882468825688266882768828688296883068831688326883368834688356883668837688386883968840688416884268843688446884568846688476884868849688506885168852688536885468855688566885768858688596886068861688626886368864688656886668867688686886968870688716887268873688746887568876688776887868879688806888168882688836888468885688866888768888688896889068891688926889368894688956889668897688986889968900689016890268903689046890568906689076890868909689106891168912689136891468915689166891768918689196892068921689226892368924689256892668927689286892968930689316893268933689346893568936689376893868939689406894168942689436894468945689466894768948689496895068951689526895368954689556895668957689586895968960689616896268963689646896568966689676896868969689706897168972689736897468975689766897768978689796898068981689826898368984689856898668987689886898968990689916899268993689946899568996689976899868999690006900169002690036900469005690066900769008690096901069011690126901369014690156901669017690186901969020690216902269023690246902569026690276902869029690306903169032690336903469035690366903769038690396904069041690426904369044690456904669047690486904969050690516905269053690546905569056690576905869059690606906169062690636906469065690666906769068690696907069071690726907369074690756907669077690786907969080690816908269083690846908569086690876908869089690906909169092690936909469095690966909769098690996910069101691026910369104691056910669107691086910969110691116911269113691146911569116691176911869119691206912169122691236912469125691266912769128691296913069131691326913369134691356913669137691386913969140691416914269143691446914569146691476914869149691506915169152691536915469155691566915769158691596916069161691626916369164691656916669167691686916969170691716917269173691746917569176691776917869179691806918169182691836918469185691866918769188691896919069191691926919369194691956919669197691986919969200692016920269203692046920569206692076920869209692106921169212692136921469215692166921769218692196922069221692226922369224692256922669227692286922969230692316923269233692346923569236692376923869239692406924169242692436924469245692466924769248692496925069251692526925369254692556925669257692586925969260692616926269263692646926569266692676926869269692706927169272692736927469275692766927769278692796928069281692826928369284692856928669287692886928969290692916929269293692946929569296692976929869299693006930169302693036930469305693066930769308693096931069311693126931369314693156931669317693186931969320693216932269323693246932569326693276932869329693306933169332693336933469335693366933769338693396934069341693426934369344693456934669347693486934969350693516935269353693546935569356693576935869359693606936169362693636936469365693666936769368693696937069371693726937369374693756937669377693786937969380693816938269383693846938569386693876938869389693906939169392693936939469395693966939769398693996940069401694026940369404694056940669407694086940969410694116941269413694146941569416694176941869419694206942169422694236942469425694266942769428694296943069431694326943369434694356943669437694386943969440694416944269443694446944569446694476944869449694506945169452694536945469455694566945769458694596946069461694626946369464694656946669467694686946969470694716947269473694746947569476694776947869479694806948169482694836948469485694866948769488694896949069491694926949369494694956949669497694986949969500695016950269503695046950569506695076950869509695106951169512695136951469515695166951769518695196952069521695226952369524695256952669527695286952969530695316953269533695346953569536695376953869539695406954169542695436954469545695466954769548695496955069551695526955369554695556955669557695586955969560695616956269563695646956569566695676956869569695706957169572695736957469575695766957769578695796958069581695826958369584695856958669587695886958969590695916959269593695946959569596695976959869599696006960169602696036960469605696066960769608696096961069611696126961369614696156961669617696186961969620696216962269623696246962569626696276962869629696306963169632696336963469635696366963769638696396964069641696426964369644696456964669647696486964969650696516965269653696546965569656696576965869659696606966169662696636966469665696666966769668696696967069671696726967369674696756967669677696786967969680696816968269683696846968569686696876968869689696906969169692696936969469695696966969769698696996970069701697026970369704697056970669707697086970969710697116971269713697146971569716697176971869719697206972169722697236972469725697266972769728697296973069731697326973369734697356973669737697386973969740697416974269743697446974569746697476974869749697506975169752697536975469755697566975769758697596976069761697626976369764697656976669767697686976969770697716977269773697746977569776697776977869779697806978169782697836978469785697866978769788697896979069791697926979369794697956979669797697986979969800698016980269803698046980569806698076980869809698106981169812698136981469815698166981769818698196982069821698226982369824698256982669827698286982969830698316983269833698346983569836698376983869839698406984169842698436984469845698466984769848698496985069851698526985369854698556985669857698586985969860698616986269863698646986569866698676986869869698706987169872698736987469875698766987769878698796988069881698826988369884698856988669887698886988969890698916989269893698946989569896698976989869899699006990169902699036990469905699066990769908699096991069911699126991369914699156991669917699186991969920699216992269923699246992569926699276992869929699306993169932699336993469935699366993769938699396994069941699426994369944699456994669947699486994969950699516995269953699546995569956699576995869959699606996169962699636996469965699666996769968699696997069971699726997369974699756997669977699786997969980699816998269983699846998569986699876998869989699906999169992699936999469995699966999769998699997000070001700027000370004700057000670007700087000970010700117001270013700147001570016700177001870019700207002170022700237002470025700267002770028700297003070031700327003370034700357003670037700387003970040700417004270043700447004570046700477004870049700507005170052700537005470055700567005770058700597006070061700627006370064700657006670067700687006970070700717007270073700747007570076700777007870079700807008170082700837008470085700867008770088700897009070091700927009370094700957009670097700987009970100701017010270103701047010570106701077010870109701107011170112701137011470115701167011770118701197012070121701227012370124701257012670127701287012970130701317013270133701347013570136701377013870139701407014170142701437014470145701467014770148701497015070151701527015370154701557015670157701587015970160701617016270163701647016570166701677016870169701707017170172701737017470175701767017770178701797018070181701827018370184701857018670187701887018970190701917019270193701947019570196701977019870199702007020170202702037020470205702067020770208702097021070211702127021370214702157021670217702187021970220702217022270223702247022570226702277022870229702307023170232702337023470235702367023770238702397024070241702427024370244702457024670247702487024970250702517025270253702547025570256702577025870259702607026170262702637026470265702667026770268702697027070271702727027370274702757027670277702787027970280702817028270283702847028570286702877028870289702907029170292702937029470295702967029770298702997030070301703027030370304703057030670307703087030970310703117031270313703147031570316703177031870319703207032170322703237032470325703267032770328703297033070331703327033370334703357033670337703387033970340703417034270343703447034570346703477034870349703507035170352703537035470355703567035770358703597036070361703627036370364703657036670367703687036970370703717037270373703747037570376703777037870379703807038170382703837038470385703867038770388703897039070391703927039370394703957039670397703987039970400704017040270403704047040570406704077040870409704107041170412704137041470415704167041770418704197042070421704227042370424704257042670427704287042970430704317043270433704347043570436704377043870439704407044170442704437044470445704467044770448704497045070451704527045370454704557045670457704587045970460704617046270463704647046570466704677046870469704707047170472704737047470475704767047770478704797048070481704827048370484704857048670487704887048970490704917049270493704947049570496704977049870499705007050170502705037050470505705067050770508705097051070511705127051370514705157051670517705187051970520705217052270523705247052570526705277052870529705307053170532705337053470535705367053770538705397054070541705427054370544705457054670547705487054970550705517055270553705547055570556705577055870559705607056170562705637056470565705667056770568705697057070571705727057370574705757057670577705787057970580705817058270583705847058570586705877058870589705907059170592705937059470595705967059770598705997060070601706027060370604706057060670607706087060970610706117061270613706147061570616706177061870619706207062170622706237062470625706267062770628706297063070631706327063370634706357063670637706387063970640706417064270643706447064570646706477064870649706507065170652706537065470655706567065770658706597066070661706627066370664706657066670667706687066970670706717067270673706747067570676706777067870679706807068170682706837068470685706867068770688706897069070691706927069370694706957069670697706987069970700707017070270703707047070570706707077070870709707107071170712707137071470715707167071770718707197072070721707227072370724707257072670727707287072970730707317073270733707347073570736707377073870739707407074170742707437074470745707467074770748707497075070751707527075370754707557075670757707587075970760707617076270763707647076570766707677076870769707707077170772707737077470775707767077770778707797078070781707827078370784707857078670787707887078970790707917079270793707947079570796707977079870799708007080170802708037080470805708067080770808708097081070811708127081370814708157081670817708187081970820708217082270823708247082570826708277082870829708307083170832708337083470835708367083770838708397084070841708427084370844708457084670847708487084970850708517085270853708547085570856708577085870859708607086170862708637086470865708667086770868708697087070871708727087370874708757087670877708787087970880708817088270883708847088570886708877088870889708907089170892708937089470895708967089770898708997090070901709027090370904709057090670907709087090970910709117091270913709147091570916709177091870919709207092170922709237092470925709267092770928709297093070931709327093370934709357093670937709387093970940709417094270943709447094570946709477094870949709507095170952709537095470955709567095770958709597096070961709627096370964709657096670967709687096970970709717097270973709747097570976709777097870979709807098170982709837098470985709867098770988709897099070991709927099370994709957099670997709987099971000710017100271003710047100571006710077100871009710107101171012710137101471015710167101771018710197102071021710227102371024710257102671027710287102971030710317103271033710347103571036710377103871039710407104171042710437104471045710467104771048710497105071051710527105371054710557105671057710587105971060710617106271063710647106571066710677106871069710707107171072710737107471075710767107771078710797108071081710827108371084710857108671087710887108971090710917109271093710947109571096710977109871099711007110171102711037110471105711067110771108711097111071111711127111371114711157111671117711187111971120711217112271123711247112571126711277112871129711307113171132711337113471135711367113771138711397114071141711427114371144711457114671147711487114971150711517115271153711547115571156711577115871159711607116171162711637116471165711667116771168711697117071171711727117371174711757117671177711787117971180711817118271183711847118571186711877118871189711907119171192711937119471195711967119771198711997120071201712027120371204712057120671207712087120971210712117121271213712147121571216712177121871219712207122171222712237122471225712267122771228712297123071231712327123371234712357123671237712387123971240712417124271243712447124571246712477124871249712507125171252712537125471255712567125771258712597126071261712627126371264712657126671267712687126971270712717127271273712747127571276712777127871279712807128171282712837128471285712867128771288712897129071291712927129371294712957129671297712987129971300713017130271303713047130571306713077130871309713107131171312713137131471315713167131771318713197132071321713227132371324713257132671327713287132971330713317133271333713347133571336713377133871339713407134171342713437134471345713467134771348713497135071351713527135371354713557135671357713587135971360713617136271363713647136571366713677136871369713707137171372713737137471375713767137771378713797138071381713827138371384713857138671387713887138971390713917139271393713947139571396713977139871399714007140171402714037140471405714067140771408714097141071411714127141371414714157141671417714187141971420714217142271423714247142571426714277142871429714307143171432714337143471435714367143771438714397144071441714427144371444714457144671447714487144971450714517145271453714547145571456714577145871459714607146171462714637146471465714667146771468714697147071471714727147371474714757147671477714787147971480714817148271483714847148571486714877148871489714907149171492714937149471495714967149771498714997150071501715027150371504715057150671507715087150971510715117151271513715147151571516715177151871519715207152171522715237152471525715267152771528715297153071531715327153371534715357153671537715387153971540715417154271543715447154571546715477154871549715507155171552715537155471555715567155771558715597156071561715627156371564715657156671567715687156971570715717157271573715747157571576715777157871579715807158171582715837158471585715867158771588715897159071591715927159371594715957159671597715987159971600716017160271603716047160571606716077160871609716107161171612716137161471615716167161771618716197162071621716227162371624716257162671627716287162971630716317163271633716347163571636716377163871639716407164171642716437164471645716467164771648716497165071651716527165371654716557165671657716587165971660716617166271663716647166571666716677166871669716707167171672716737167471675716767167771678716797168071681716827168371684716857168671687716887168971690716917169271693716947169571696716977169871699717007170171702717037170471705717067170771708717097171071711717127171371714717157171671717717187171971720717217172271723717247172571726717277172871729717307173171732717337173471735717367173771738717397174071741717427174371744717457174671747717487174971750717517175271753717547175571756717577175871759717607176171762717637176471765717667176771768717697177071771717727177371774717757177671777717787177971780717817178271783717847178571786717877178871789717907179171792717937179471795717967179771798717997180071801718027180371804718057180671807718087180971810718117181271813718147181571816718177181871819718207182171822718237182471825718267182771828718297183071831718327183371834718357183671837718387183971840718417184271843718447184571846718477184871849718507185171852718537185471855718567185771858718597186071861718627186371864718657186671867718687186971870718717187271873718747187571876718777187871879718807188171882718837188471885718867188771888718897189071891718927189371894718957189671897718987189971900719017190271903719047190571906719077190871909719107191171912719137191471915719167191771918719197192071921719227192371924719257192671927719287192971930719317193271933719347193571936719377193871939719407194171942719437194471945719467194771948719497195071951719527195371954719557195671957719587195971960719617196271963719647196571966719677196871969719707197171972719737197471975719767197771978719797198071981719827198371984719857198671987719887198971990719917199271993719947199571996719977199871999720007200172002720037200472005720067200772008720097201072011720127201372014720157201672017720187201972020720217202272023720247202572026720277202872029720307203172032720337203472035720367203772038720397204072041720427204372044720457204672047720487204972050720517205272053720547205572056720577205872059720607206172062720637206472065720667206772068720697207072071720727207372074720757207672077720787207972080720817208272083720847208572086720877208872089720907209172092720937209472095720967209772098720997210072101721027210372104721057210672107721087210972110721117211272113721147211572116721177211872119721207212172122721237212472125721267212772128721297213072131721327213372134721357213672137721387213972140721417214272143721447214572146721477214872149721507215172152721537215472155721567215772158721597216072161721627216372164721657216672167721687216972170721717217272173721747217572176721777217872179721807218172182721837218472185721867218772188721897219072191721927219372194721957219672197721987219972200722017220272203722047220572206722077220872209722107221172212722137221472215722167221772218722197222072221722227222372224722257222672227722287222972230722317223272233722347223572236722377223872239722407224172242722437224472245722467224772248722497225072251722527225372254722557225672257722587225972260722617226272263722647226572266722677226872269722707227172272722737227472275722767227772278722797228072281722827228372284722857228672287722887228972290722917229272293722947229572296722977229872299723007230172302723037230472305723067230772308723097231072311723127231372314723157231672317723187231972320723217232272323723247232572326723277232872329723307233172332723337233472335723367233772338723397234072341723427234372344723457234672347723487234972350723517235272353723547235572356723577235872359723607236172362723637236472365723667236772368723697237072371723727237372374723757237672377723787237972380723817238272383723847238572386723877238872389723907239172392723937239472395723967239772398723997240072401724027240372404724057240672407724087240972410724117241272413724147241572416724177241872419724207242172422724237242472425724267242772428724297243072431724327243372434724357243672437724387243972440724417244272443724447244572446724477244872449724507245172452724537245472455724567245772458724597246072461724627246372464724657246672467724687246972470724717247272473724747247572476724777247872479724807248172482724837248472485724867248772488724897249072491724927249372494724957249672497724987249972500725017250272503725047250572506725077250872509725107251172512725137251472515725167251772518725197252072521725227252372524725257252672527725287252972530725317253272533725347253572536725377253872539725407254172542725437254472545725467254772548725497255072551725527255372554725557255672557725587255972560725617256272563725647256572566725677256872569725707257172572725737257472575725767257772578725797258072581725827258372584725857258672587725887258972590725917259272593725947259572596725977259872599726007260172602726037260472605726067260772608726097261072611726127261372614726157261672617726187261972620726217262272623726247262572626726277262872629726307263172632726337263472635726367263772638726397264072641726427264372644726457264672647726487264972650726517265272653726547265572656726577265872659726607266172662726637266472665726667266772668726697267072671726727267372674726757267672677726787267972680726817268272683726847268572686726877268872689726907269172692726937269472695726967269772698726997270072701727027270372704727057270672707727087270972710727117271272713727147271572716727177271872719727207272172722727237272472725727267272772728727297273072731727327273372734727357273672737727387273972740727417274272743727447274572746727477274872749727507275172752727537275472755727567275772758727597276072761727627276372764727657276672767727687276972770727717277272773727747277572776727777277872779727807278172782727837278472785727867278772788727897279072791727927279372794727957279672797727987279972800728017280272803728047280572806728077280872809728107281172812728137281472815728167281772818728197282072821728227282372824728257282672827728287282972830728317283272833728347283572836728377283872839728407284172842728437284472845728467284772848728497285072851728527285372854728557285672857728587285972860728617286272863728647286572866728677286872869728707287172872728737287472875728767287772878728797288072881728827288372884728857288672887728887288972890728917289272893728947289572896728977289872899729007290172902729037290472905729067290772908729097291072911729127291372914729157291672917729187291972920729217292272923729247292572926729277292872929729307293172932729337293472935729367293772938729397294072941729427294372944729457294672947729487294972950729517295272953729547295572956729577295872959729607296172962729637296472965729667296772968729697297072971729727297372974729757297672977729787297972980729817298272983729847298572986729877298872989729907299172992729937299472995729967299772998729997300073001730027300373004730057300673007730087300973010730117301273013730147301573016730177301873019730207302173022730237302473025730267302773028730297303073031730327303373034730357303673037730387303973040730417304273043730447304573046730477304873049730507305173052730537305473055730567305773058730597306073061730627306373064730657306673067730687306973070730717307273073730747307573076730777307873079730807308173082730837308473085730867308773088730897309073091730927309373094730957309673097730987309973100731017310273103731047310573106731077310873109731107311173112731137311473115731167311773118731197312073121731227312373124731257312673127731287312973130731317313273133731347313573136731377313873139731407314173142731437314473145731467314773148731497315073151731527315373154731557315673157731587315973160731617316273163731647316573166731677316873169731707317173172731737317473175731767317773178731797318073181731827318373184731857318673187731887318973190731917319273193731947319573196731977319873199732007320173202732037320473205732067320773208732097321073211732127321373214732157321673217732187321973220732217322273223732247322573226732277322873229732307323173232732337323473235732367323773238732397324073241732427324373244732457324673247732487324973250732517325273253732547325573256732577325873259732607326173262732637326473265732667326773268732697327073271732727327373274732757327673277732787327973280732817328273283732847328573286732877328873289732907329173292732937329473295732967329773298732997330073301733027330373304733057330673307733087330973310733117331273313733147331573316733177331873319733207332173322733237332473325733267332773328733297333073331733327333373334733357333673337733387333973340733417334273343733447334573346733477334873349733507335173352733537335473355733567335773358733597336073361733627336373364733657336673367733687336973370733717337273373733747337573376733777337873379733807338173382733837338473385733867338773388733897339073391733927339373394733957339673397733987339973400734017340273403734047340573406734077340873409734107341173412734137341473415734167341773418734197342073421734227342373424734257342673427734287342973430734317343273433734347343573436734377343873439734407344173442734437344473445734467344773448734497345073451734527345373454734557345673457734587345973460734617346273463734647346573466734677346873469734707347173472734737347473475734767347773478734797348073481734827348373484734857348673487734887348973490734917349273493734947349573496734977349873499735007350173502735037350473505735067350773508735097351073511735127351373514735157351673517735187351973520735217352273523735247352573526735277352873529735307353173532735337353473535735367353773538735397354073541735427354373544735457354673547735487354973550735517355273553735547355573556735577355873559735607356173562735637356473565735667356773568735697357073571735727357373574735757357673577735787357973580735817358273583735847358573586735877358873589735907359173592735937359473595735967359773598735997360073601736027360373604736057360673607736087360973610736117361273613736147361573616736177361873619736207362173622736237362473625736267362773628736297363073631736327363373634736357363673637736387363973640736417364273643736447364573646736477364873649736507365173652736537365473655736567365773658736597366073661736627366373664736657366673667736687366973670736717367273673736747367573676736777367873679736807368173682736837368473685736867368773688736897369073691736927369373694736957369673697736987369973700737017370273703737047370573706737077370873709737107371173712737137371473715737167371773718737197372073721737227372373724737257372673727737287372973730737317373273733737347373573736737377373873739737407374173742737437374473745737467374773748737497375073751737527375373754737557375673757737587375973760737617376273763737647376573766737677376873769737707377173772737737377473775737767377773778737797378073781737827378373784737857378673787737887378973790737917379273793737947379573796737977379873799738007380173802738037380473805738067380773808738097381073811738127381373814738157381673817738187381973820738217382273823738247382573826738277382873829738307383173832738337383473835738367383773838738397384073841738427384373844738457384673847738487384973850738517385273853738547385573856738577385873859738607386173862738637386473865738667386773868738697387073871738727387373874738757387673877738787387973880738817388273883738847388573886738877388873889738907389173892738937389473895738967389773898738997390073901739027390373904739057390673907739087390973910739117391273913739147391573916739177391873919739207392173922739237392473925739267392773928739297393073931739327393373934739357393673937739387393973940739417394273943739447394573946739477394873949739507395173952739537395473955739567395773958739597396073961739627396373964739657396673967739687396973970739717397273973739747397573976739777397873979739807398173982739837398473985739867398773988739897399073991739927399373994739957399673997739987399974000740017400274003740047400574006740077400874009740107401174012740137401474015740167401774018740197402074021740227402374024740257402674027740287402974030740317403274033740347403574036740377403874039740407404174042740437404474045740467404774048740497405074051740527405374054740557405674057740587405974060740617406274063740647406574066740677406874069740707407174072740737407474075740767407774078740797408074081740827408374084740857408674087740887408974090740917409274093740947409574096740977409874099741007410174102741037410474105741067410774108741097411074111741127411374114741157411674117741187411974120741217412274123741247412574126741277412874129741307413174132741337413474135741367413774138741397414074141741427414374144741457414674147741487414974150741517415274153741547415574156741577415874159741607416174162741637416474165741667416774168741697417074171741727417374174741757417674177741787417974180741817418274183741847418574186741877418874189741907419174192741937419474195741967419774198741997420074201742027420374204742057420674207742087420974210742117421274213742147421574216742177421874219742207422174222742237422474225742267422774228742297423074231742327423374234742357423674237742387423974240742417424274243742447424574246742477424874249742507425174252742537425474255742567425774258742597426074261742627426374264742657426674267742687426974270742717427274273742747427574276742777427874279742807428174282742837428474285742867428774288742897429074291742927429374294742957429674297742987429974300743017430274303743047430574306743077430874309743107431174312743137431474315743167431774318743197432074321743227432374324743257432674327743287432974330743317433274333743347433574336743377433874339743407434174342743437434474345743467434774348743497435074351743527435374354743557435674357743587435974360743617436274363743647436574366743677436874369743707437174372743737437474375743767437774378743797438074381743827438374384743857438674387743887438974390743917439274393743947439574396743977439874399744007440174402744037440474405744067440774408744097441074411744127441374414744157441674417744187441974420744217442274423744247442574426744277442874429744307443174432744337443474435744367443774438744397444074441744427444374444744457444674447744487444974450744517445274453744547445574456744577445874459744607446174462744637446474465744667446774468744697447074471744727447374474744757447674477744787447974480744817448274483744847448574486744877448874489744907449174492744937449474495744967449774498744997450074501745027450374504745057450674507745087450974510745117451274513745147451574516745177451874519745207452174522745237452474525745267452774528745297453074531745327453374534745357453674537745387453974540745417454274543745447454574546745477454874549745507455174552745537455474555745567455774558745597456074561745627456374564745657456674567745687456974570745717457274573745747457574576745777457874579745807458174582745837458474585745867458774588745897459074591745927459374594745957459674597745987459974600746017460274603746047460574606746077460874609746107461174612746137461474615746167461774618746197462074621746227462374624746257462674627746287462974630746317463274633746347463574636746377463874639746407464174642746437464474645746467464774648746497465074651746527465374654746557465674657746587465974660746617466274663746647466574666746677466874669746707467174672746737467474675746767467774678746797468074681746827468374684746857468674687746887468974690746917469274693746947469574696746977469874699747007470174702747037470474705747067470774708747097471074711747127471374714747157471674717747187471974720747217472274723747247472574726747277472874729747307473174732747337473474735747367473774738747397474074741747427474374744747457474674747747487474974750747517475274753747547475574756747577475874759747607476174762747637476474765747667476774768747697477074771747727477374774747757477674777747787477974780747817478274783747847478574786747877478874789747907479174792747937479474795747967479774798747997480074801748027480374804748057480674807748087480974810748117481274813748147481574816748177481874819748207482174822748237482474825748267482774828748297483074831748327483374834748357483674837748387483974840748417484274843748447484574846748477484874849748507485174852748537485474855748567485774858748597486074861748627486374864748657486674867748687486974870748717487274873748747487574876748777487874879748807488174882748837488474885748867488774888748897489074891748927489374894748957489674897748987489974900749017490274903749047490574906749077490874909749107491174912749137491474915749167491774918749197492074921749227492374924749257492674927749287492974930749317493274933749347493574936749377493874939749407494174942749437494474945749467494774948749497495074951749527495374954749557495674957749587495974960749617496274963749647496574966749677496874969749707497174972749737497474975749767497774978749797498074981749827498374984749857498674987749887498974990749917499274993749947499574996749977499874999750007500175002750037500475005750067500775008750097501075011750127501375014750157501675017750187501975020750217502275023750247502575026750277502875029750307503175032750337503475035750367503775038750397504075041750427504375044750457504675047750487504975050750517505275053750547505575056750577505875059750607506175062750637506475065750667506775068750697507075071750727507375074750757507675077750787507975080750817508275083750847508575086750877508875089750907509175092750937509475095750967509775098750997510075101751027510375104751057510675107751087510975110751117511275113751147511575116751177511875119751207512175122751237512475125751267512775128751297513075131751327513375134751357513675137751387513975140751417514275143751447514575146751477514875149751507515175152751537515475155751567515775158751597516075161751627516375164751657516675167751687516975170751717517275173751747517575176751777517875179751807518175182751837518475185751867518775188751897519075191751927519375194751957519675197751987519975200752017520275203752047520575206752077520875209752107521175212752137521475215752167521775218752197522075221752227522375224752257522675227752287522975230752317523275233752347523575236752377523875239752407524175242752437524475245752467524775248752497525075251752527525375254752557525675257752587525975260752617526275263752647526575266752677526875269752707527175272752737527475275752767527775278752797528075281752827528375284752857528675287752887528975290752917529275293752947529575296752977529875299753007530175302753037530475305753067530775308753097531075311753127531375314753157531675317753187531975320753217532275323753247532575326753277532875329753307533175332753337533475335753367533775338753397534075341753427534375344753457534675347753487534975350753517535275353753547535575356753577535875359753607536175362753637536475365753667536775368753697537075371753727537375374753757537675377753787537975380753817538275383753847538575386753877538875389753907539175392753937539475395753967539775398753997540075401754027540375404754057540675407754087540975410754117541275413754147541575416754177541875419754207542175422754237542475425754267542775428754297543075431754327543375434754357543675437754387543975440754417544275443754447544575446754477544875449754507545175452754537545475455754567545775458754597546075461754627546375464754657546675467754687546975470754717547275473754747547575476754777547875479754807548175482754837548475485754867548775488754897549075491754927549375494754957549675497754987549975500755017550275503755047550575506755077550875509755107551175512755137551475515755167551775518755197552075521755227552375524755257552675527755287552975530755317553275533755347553575536755377553875539755407554175542755437554475545755467554775548755497555075551755527555375554755557555675557755587555975560755617556275563755647556575566755677556875569755707557175572755737557475575755767557775578755797558075581755827558375584755857558675587755887558975590755917559275593755947559575596755977559875599756007560175602756037560475605756067560775608756097561075611756127561375614756157561675617756187561975620756217562275623756247562575626756277562875629756307563175632756337563475635756367563775638756397564075641756427564375644756457564675647756487564975650756517565275653756547565575656756577565875659756607566175662756637566475665756667566775668756697567075671756727567375674756757567675677756787567975680756817568275683756847568575686756877568875689756907569175692756937569475695756967569775698756997570075701757027570375704757057570675707757087570975710757117571275713757147571575716757177571875719757207572175722757237572475725757267572775728757297573075731757327573375734757357573675737757387573975740757417574275743757447574575746757477574875749757507575175752757537575475755757567575775758757597576075761757627576375764757657576675767757687576975770757717577275773757747577575776757777577875779757807578175782757837578475785757867578775788757897579075791757927579375794757957579675797757987579975800758017580275803758047580575806758077580875809758107581175812758137581475815758167581775818758197582075821758227582375824758257582675827758287582975830758317583275833758347583575836758377583875839758407584175842758437584475845758467584775848758497585075851758527585375854758557585675857758587585975860758617586275863758647586575866758677586875869758707587175872758737587475875758767587775878758797588075881758827588375884758857588675887758887588975890758917589275893758947589575896758977589875899759007590175902759037590475905759067590775908759097591075911759127591375914759157591675917759187591975920759217592275923759247592575926759277592875929759307593175932759337593475935759367593775938759397594075941759427594375944759457594675947759487594975950759517595275953759547595575956759577595875959759607596175962759637596475965759667596775968759697597075971759727597375974759757597675977759787597975980759817598275983759847598575986759877598875989759907599175992759937599475995759967599775998759997600076001760027600376004760057600676007760087600976010760117601276013760147601576016760177601876019760207602176022760237602476025760267602776028760297603076031760327603376034760357603676037760387603976040760417604276043760447604576046760477604876049760507605176052760537605476055760567605776058760597606076061760627606376064760657606676067760687606976070760717607276073760747607576076760777607876079760807608176082760837608476085760867608776088760897609076091760927609376094760957609676097760987609976100761017610276103761047610576106761077610876109761107611176112761137611476115761167611776118761197612076121761227612376124761257612676127761287612976130761317613276133761347613576136761377613876139761407614176142761437614476145761467614776148761497615076151761527615376154761557615676157761587615976160761617616276163761647616576166761677616876169761707617176172761737617476175761767617776178761797618076181761827618376184761857618676187761887618976190761917619276193761947619576196761977619876199762007620176202762037620476205762067620776208762097621076211762127621376214762157621676217762187621976220762217622276223762247622576226762277622876229762307623176232762337623476235762367623776238762397624076241762427624376244762457624676247762487624976250762517625276253762547625576256762577625876259762607626176262762637626476265762667626776268762697627076271762727627376274762757627676277762787627976280762817628276283762847628576286762877628876289762907629176292762937629476295762967629776298762997630076301763027630376304763057630676307763087630976310763117631276313763147631576316763177631876319763207632176322763237632476325763267632776328763297633076331763327633376334763357633676337763387633976340763417634276343763447634576346763477634876349763507635176352763537635476355763567635776358763597636076361763627636376364763657636676367763687636976370763717637276373763747637576376763777637876379763807638176382763837638476385763867638776388763897639076391763927639376394763957639676397763987639976400764017640276403764047640576406764077640876409764107641176412764137641476415764167641776418764197642076421764227642376424764257642676427764287642976430764317643276433764347643576436764377643876439764407644176442764437644476445764467644776448764497645076451764527645376454764557645676457764587645976460764617646276463764647646576466764677646876469764707647176472764737647476475764767647776478764797648076481764827648376484764857648676487764887648976490764917649276493764947649576496764977649876499765007650176502765037650476505765067650776508765097651076511765127651376514765157651676517765187651976520765217652276523765247652576526765277652876529765307653176532765337653476535765367653776538765397654076541765427654376544765457654676547765487654976550765517655276553765547655576556765577655876559765607656176562765637656476565765667656776568765697657076571765727657376574765757657676577765787657976580765817658276583765847658576586765877658876589765907659176592765937659476595765967659776598765997660076601766027660376604766057660676607766087660976610766117661276613766147661576616766177661876619766207662176622766237662476625766267662776628766297663076631766327663376634766357663676637766387663976640766417664276643766447664576646766477664876649766507665176652766537665476655766567665776658766597666076661766627666376664766657666676667766687666976670766717667276673766747667576676766777667876679766807668176682766837668476685766867668776688766897669076691766927669376694766957669676697766987669976700767017670276703767047670576706767077670876709767107671176712767137671476715767167671776718767197672076721767227672376724767257672676727767287672976730767317673276733767347673576736767377673876739767407674176742767437674476745767467674776748767497675076751767527675376754767557675676757767587675976760767617676276763767647676576766767677676876769767707677176772767737677476775767767677776778767797678076781767827678376784767857678676787767887678976790767917679276793767947679576796767977679876799768007680176802768037680476805768067680776808768097681076811768127681376814768157681676817768187681976820768217682276823768247682576826768277682876829768307683176832768337683476835768367683776838768397684076841768427684376844768457684676847768487684976850768517685276853768547685576856768577685876859768607686176862768637686476865768667686776868768697687076871768727687376874768757687676877768787687976880768817688276883768847688576886768877688876889768907689176892768937689476895768967689776898768997690076901769027690376904769057690676907769087690976910769117691276913769147691576916769177691876919769207692176922769237692476925769267692776928769297693076931769327693376934769357693676937769387693976940769417694276943769447694576946769477694876949769507695176952769537695476955769567695776958769597696076961769627696376964769657696676967769687696976970769717697276973769747697576976769777697876979769807698176982769837698476985769867698776988769897699076991769927699376994769957699676997769987699977000770017700277003770047700577006770077700877009770107701177012770137701477015770167701777018770197702077021770227702377024770257702677027770287702977030770317703277033770347703577036770377703877039770407704177042770437704477045770467704777048770497705077051770527705377054770557705677057770587705977060770617706277063770647706577066770677706877069770707707177072770737707477075770767707777078770797708077081770827708377084770857708677087770887708977090770917709277093770947709577096770977709877099771007710177102771037710477105771067710777108771097711077111771127711377114771157711677117771187711977120771217712277123771247712577126771277712877129771307713177132771337713477135771367713777138771397714077141771427714377144771457714677147771487714977150771517715277153771547715577156771577715877159771607716177162771637716477165771667716777168771697717077171771727717377174771757717677177771787717977180771817718277183771847718577186771877718877189771907719177192771937719477195771967719777198771997720077201772027720377204772057720677207772087720977210772117721277213772147721577216772177721877219772207722177222772237722477225772267722777228772297723077231772327723377234772357723677237772387723977240772417724277243772447724577246772477724877249772507725177252772537725477255772567725777258772597726077261772627726377264772657726677267772687726977270772717727277273772747727577276772777727877279772807728177282772837728477285772867728777288772897729077291772927729377294772957729677297772987729977300773017730277303773047730577306773077730877309773107731177312773137731477315773167731777318773197732077321773227732377324773257732677327773287732977330773317733277333773347733577336773377733877339773407734177342773437734477345773467734777348773497735077351773527735377354773557735677357773587735977360773617736277363773647736577366773677736877369773707737177372773737737477375773767737777378773797738077381773827738377384773857738677387773887738977390773917739277393773947739577396773977739877399774007740177402774037740477405774067740777408774097741077411774127741377414774157741677417774187741977420774217742277423774247742577426774277742877429774307743177432774337743477435774367743777438774397744077441774427744377444774457744677447774487744977450774517745277453774547745577456774577745877459774607746177462774637746477465774667746777468774697747077471774727747377474774757747677477774787747977480774817748277483774847748577486774877748877489774907749177492774937749477495774967749777498774997750077501775027750377504775057750677507775087750977510775117751277513775147751577516775177751877519775207752177522775237752477525775267752777528775297753077531775327753377534775357753677537775387753977540775417754277543775447754577546775477754877549775507755177552775537755477555775567755777558775597756077561775627756377564775657756677567775687756977570775717757277573775747757577576775777757877579775807758177582775837758477585775867758777588775897759077591775927759377594775957759677597775987759977600776017760277603776047760577606776077760877609776107761177612776137761477615776167761777618776197762077621776227762377624776257762677627776287762977630776317763277633776347763577636776377763877639776407764177642776437764477645776467764777648776497765077651776527765377654776557765677657776587765977660776617766277663776647766577666776677766877669776707767177672776737767477675776767767777678776797768077681776827768377684776857768677687776887768977690776917769277693776947769577696776977769877699777007770177702777037770477705777067770777708777097771077711777127771377714777157771677717777187771977720777217772277723777247772577726777277772877729777307773177732777337773477735777367773777738777397774077741777427774377744777457774677747777487774977750777517775277753777547775577756777577775877759777607776177762777637776477765777667776777768777697777077771777727777377774777757777677777777787777977780777817778277783777847778577786777877778877789777907779177792777937779477795777967779777798777997780077801778027780377804778057780677807778087780977810778117781277813778147781577816778177781877819778207782177822778237782477825778267782777828778297783077831778327783377834778357783677837778387783977840778417784277843778447784577846778477784877849778507785177852778537785477855778567785777858778597786077861778627786377864778657786677867778687786977870778717787277873778747787577876778777787877879778807788177882778837788477885778867788777888778897789077891778927789377894778957789677897778987789977900779017790277903779047790577906779077790877909779107791177912779137791477915779167791777918779197792077921779227792377924779257792677927779287792977930779317793277933779347793577936779377793877939779407794177942779437794477945779467794777948779497795077951779527795377954779557795677957779587795977960779617796277963779647796577966779677796877969779707797177972779737797477975779767797777978779797798077981779827798377984779857798677987779887798977990779917799277993779947799577996779977799877999780007800178002780037800478005780067800778008780097801078011780127801378014780157801678017780187801978020780217802278023780247802578026780277802878029780307803178032780337803478035780367803778038780397804078041780427804378044780457804678047780487804978050780517805278053780547805578056780577805878059780607806178062780637806478065780667806778068780697807078071780727807378074780757807678077780787807978080780817808278083780847808578086780877808878089780907809178092780937809478095780967809778098780997810078101781027810378104781057810678107781087810978110781117811278113781147811578116781177811878119781207812178122781237812478125781267812778128781297813078131781327813378134781357813678137781387813978140781417814278143781447814578146781477814878149781507815178152781537815478155781567815778158781597816078161781627816378164781657816678167781687816978170781717817278173781747817578176781777817878179781807818178182781837818478185781867818778188781897819078191781927819378194781957819678197781987819978200782017820278203782047820578206782077820878209782107821178212782137821478215782167821778218782197822078221782227822378224782257822678227782287822978230782317823278233782347823578236782377823878239782407824178242782437824478245782467824778248782497825078251782527825378254782557825678257782587825978260782617826278263782647826578266782677826878269782707827178272782737827478275782767827778278782797828078281782827828378284782857828678287782887828978290782917829278293782947829578296782977829878299783007830178302783037830478305783067830778308783097831078311783127831378314783157831678317783187831978320783217832278323783247832578326783277832878329783307833178332783337833478335783367833778338783397834078341783427834378344783457834678347783487834978350783517835278353783547835578356783577835878359783607836178362783637836478365783667836778368783697837078371783727837378374783757837678377783787837978380783817838278383783847838578386783877838878389783907839178392783937839478395783967839778398783997840078401784027840378404784057840678407784087840978410784117841278413784147841578416784177841878419784207842178422784237842478425784267842778428784297843078431784327843378434784357843678437784387843978440784417844278443784447844578446784477844878449784507845178452784537845478455784567845778458784597846078461784627846378464784657846678467784687846978470784717847278473784747847578476784777847878479784807848178482784837848478485784867848778488784897849078491784927849378494784957849678497784987849978500785017850278503785047850578506785077850878509785107851178512785137851478515785167851778518785197852078521785227852378524785257852678527785287852978530785317853278533785347853578536785377853878539785407854178542785437854478545785467854778548785497855078551785527855378554785557855678557785587855978560785617856278563785647856578566785677856878569785707857178572785737857478575785767857778578785797858078581785827858378584785857858678587785887858978590785917859278593785947859578596785977859878599786007860178602786037860478605786067860778608786097861078611786127861378614786157861678617786187861978620786217862278623786247862578626786277862878629786307863178632786337863478635786367863778638786397864078641786427864378644786457864678647786487864978650786517865278653786547865578656786577865878659786607866178662786637866478665786667866778668786697867078671786727867378674786757867678677786787867978680786817868278683786847868578686786877868878689786907869178692786937869478695786967869778698786997870078701787027870378704787057870678707787087870978710787117871278713787147871578716787177871878719787207872178722787237872478725787267872778728787297873078731787327873378734787357873678737787387873978740787417874278743787447874578746787477874878749787507875178752787537875478755787567875778758787597876078761787627876378764787657876678767787687876978770787717877278773787747877578776787777877878779787807878178782787837878478785787867878778788787897879078791787927879378794787957879678797787987879978800788017880278803788047880578806788077880878809788107881178812788137881478815788167881778818788197882078821788227882378824788257882678827788287882978830788317883278833788347883578836788377883878839788407884178842788437884478845788467884778848788497885078851788527885378854788557885678857788587885978860788617886278863788647886578866788677886878869788707887178872788737887478875788767887778878788797888078881788827888378884788857888678887788887888978890788917889278893788947889578896788977889878899789007890178902789037890478905789067890778908789097891078911789127891378914789157891678917789187891978920789217892278923789247892578926789277892878929789307893178932789337893478935789367893778938789397894078941789427894378944789457894678947789487894978950789517895278953789547895578956789577895878959789607896178962789637896478965789667896778968789697897078971789727897378974789757897678977789787897978980789817898278983789847898578986789877898878989789907899178992789937899478995789967899778998789997900079001790027900379004790057900679007790087900979010790117901279013790147901579016790177901879019790207902179022790237902479025790267902779028790297903079031790327903379034790357903679037790387903979040790417904279043790447904579046790477904879049790507905179052790537905479055790567905779058790597906079061790627906379064790657906679067790687906979070790717907279073790747907579076790777907879079790807908179082790837908479085790867908779088790897909079091790927909379094790957909679097790987909979100791017910279103791047910579106791077910879109791107911179112791137911479115791167911779118791197912079121791227912379124791257912679127791287912979130791317913279133791347913579136791377913879139791407914179142791437914479145791467914779148791497915079151791527915379154791557915679157791587915979160791617916279163791647916579166791677916879169791707917179172791737917479175791767917779178791797918079181791827918379184791857918679187791887918979190791917919279193791947919579196791977919879199792007920179202792037920479205792067920779208792097921079211792127921379214792157921679217792187921979220792217922279223792247922579226792277922879229792307923179232792337923479235792367923779238792397924079241792427924379244792457924679247792487924979250792517925279253792547925579256792577925879259792607926179262792637926479265792667926779268792697927079271792727927379274792757927679277792787927979280792817928279283792847928579286792877928879289792907929179292792937929479295792967929779298792997930079301793027930379304793057930679307793087930979310793117931279313793147931579316793177931879319793207932179322793237932479325793267932779328793297933079331793327933379334793357933679337793387933979340793417934279343793447934579346793477934879349793507935179352793537935479355793567935779358793597936079361793627936379364793657936679367793687936979370793717937279373793747937579376793777937879379793807938179382793837938479385793867938779388793897939079391793927939379394793957939679397793987939979400794017940279403794047940579406794077940879409794107941179412794137941479415794167941779418794197942079421794227942379424794257942679427794287942979430794317943279433794347943579436794377943879439794407944179442794437944479445794467944779448794497945079451794527945379454794557945679457794587945979460794617946279463794647946579466794677946879469794707947179472794737947479475794767947779478794797948079481794827948379484794857948679487794887948979490794917949279493794947949579496794977949879499795007950179502795037950479505795067950779508795097951079511795127951379514795157951679517795187951979520795217952279523795247952579526795277952879529795307953179532795337953479535795367953779538795397954079541795427954379544795457954679547795487954979550795517955279553795547955579556795577955879559795607956179562795637956479565795667956779568795697957079571795727957379574795757957679577795787957979580795817958279583795847958579586795877958879589795907959179592795937959479595795967959779598795997960079601796027960379604796057960679607796087960979610796117961279613796147961579616796177961879619796207962179622796237962479625796267962779628796297963079631796327963379634796357963679637796387963979640796417964279643796447964579646796477964879649796507965179652796537965479655796567965779658796597966079661796627966379664796657966679667796687966979670796717967279673796747967579676796777967879679796807968179682796837968479685796867968779688796897969079691796927969379694796957969679697796987969979700797017970279703797047970579706797077970879709797107971179712797137971479715797167971779718797197972079721797227972379724797257972679727797287972979730797317973279733797347973579736797377973879739797407974179742797437974479745797467974779748797497975079751797527975379754797557975679757797587975979760797617976279763797647976579766797677976879769797707977179772797737977479775797767977779778797797978079781797827978379784797857978679787797887978979790797917979279793797947979579796797977979879799798007980179802798037980479805798067980779808798097981079811798127981379814798157981679817798187981979820798217982279823798247982579826798277982879829798307983179832798337983479835798367983779838798397984079841798427984379844798457984679847798487984979850798517985279853798547985579856798577985879859798607986179862798637986479865798667986779868798697987079871798727987379874798757987679877798787987979880798817988279883798847988579886798877988879889798907989179892798937989479895798967989779898798997990079901799027990379904799057990679907799087990979910799117991279913799147991579916799177991879919799207992179922799237992479925799267992779928799297993079931799327993379934799357993679937799387993979940799417994279943799447994579946799477994879949799507995179952799537995479955799567995779958799597996079961799627996379964799657996679967799687996979970799717997279973799747997579976799777997879979799807998179982799837998479985799867998779988799897999079991799927999379994799957999679997799987999980000800018000280003800048000580006800078000880009800108001180012800138001480015800168001780018800198002080021800228002380024800258002680027800288002980030800318003280033800348003580036800378003880039800408004180042800438004480045800468004780048800498005080051800528005380054800558005680057800588005980060800618006280063800648006580066800678006880069800708007180072800738007480075800768007780078800798008080081800828008380084800858008680087800888008980090800918009280093800948009580096800978009880099801008010180102801038010480105801068010780108801098011080111801128011380114801158011680117801188011980120801218012280123801248012580126801278012880129801308013180132801338013480135801368013780138801398014080141801428014380144801458014680147801488014980150801518015280153801548015580156801578015880159801608016180162801638016480165801668016780168801698017080171801728017380174801758017680177801788017980180801818018280183801848018580186801878018880189801908019180192801938019480195801968019780198801998020080201802028020380204802058020680207802088020980210802118021280213802148021580216802178021880219802208022180222802238022480225802268022780228802298023080231802328023380234802358023680237802388023980240802418024280243802448024580246802478024880249802508025180252802538025480255802568025780258802598026080261802628026380264802658026680267802688026980270802718027280273802748027580276802778027880279802808028180282802838028480285802868028780288802898029080291802928029380294802958029680297802988029980300803018030280303803048030580306803078030880309803108031180312803138031480315803168031780318803198032080321803228032380324803258032680327803288032980330803318033280333803348033580336803378033880339803408034180342803438034480345803468034780348803498035080351803528035380354803558035680357803588035980360803618036280363803648036580366803678036880369803708037180372803738037480375803768037780378803798038080381803828038380384803858038680387803888038980390803918039280393803948039580396803978039880399804008040180402804038040480405804068040780408804098041080411804128041380414804158041680417804188041980420804218042280423804248042580426804278042880429804308043180432804338043480435804368043780438804398044080441804428044380444804458044680447804488044980450804518045280453804548045580456804578045880459804608046180462804638046480465804668046780468804698047080471804728047380474804758047680477804788047980480804818048280483804848048580486804878048880489804908049180492804938049480495804968049780498804998050080501805028050380504805058050680507805088050980510805118051280513805148051580516805178051880519805208052180522805238052480525805268052780528805298053080531805328053380534805358053680537805388053980540805418054280543805448054580546805478054880549805508055180552805538055480555805568055780558805598056080561805628056380564805658056680567805688056980570805718057280573805748057580576805778057880579805808058180582805838058480585805868058780588805898059080591805928059380594805958059680597805988059980600806018060280603806048060580606806078060880609806108061180612806138061480615806168061780618806198062080621806228062380624806258062680627806288062980630806318063280633806348063580636806378063880639806408064180642806438064480645806468064780648806498065080651806528065380654806558065680657806588065980660806618066280663806648066580666806678066880669806708067180672806738067480675806768067780678806798068080681806828068380684806858068680687806888068980690806918069280693806948069580696806978069880699807008070180702807038070480705807068070780708807098071080711807128071380714807158071680717807188071980720807218072280723807248072580726807278072880729807308073180732807338073480735807368073780738807398074080741807428074380744807458074680747807488074980750807518075280753807548075580756807578075880759807608076180762807638076480765807668076780768807698077080771807728077380774807758077680777807788077980780807818078280783807848078580786807878078880789807908079180792807938079480795807968079780798807998080080801808028080380804808058080680807808088080980810808118081280813808148081580816808178081880819808208082180822808238082480825808268082780828808298083080831808328083380834808358083680837808388083980840808418084280843808448084580846808478084880849808508085180852808538085480855808568085780858808598086080861808628086380864808658086680867808688086980870808718087280873808748087580876808778087880879808808088180882808838088480885808868088780888808898089080891808928089380894808958089680897808988089980900809018090280903809048090580906809078090880909809108091180912809138091480915809168091780918809198092080921809228092380924809258092680927809288092980930809318093280933809348093580936809378093880939809408094180942809438094480945809468094780948809498095080951809528095380954809558095680957809588095980960809618096280963809648096580966809678096880969809708097180972809738097480975809768097780978809798098080981809828098380984809858098680987809888098980990809918099280993809948099580996809978099880999810008100181002810038100481005810068100781008810098101081011810128101381014810158101681017810188101981020810218102281023810248102581026810278102881029810308103181032810338103481035810368103781038810398104081041810428104381044810458104681047810488104981050810518105281053810548105581056810578105881059810608106181062810638106481065810668106781068810698107081071810728107381074810758107681077810788107981080810818108281083810848108581086810878108881089810908109181092810938109481095810968109781098810998110081101811028110381104811058110681107811088110981110811118111281113811148111581116811178111881119811208112181122811238112481125811268112781128811298113081131811328113381134811358113681137811388113981140811418114281143811448114581146811478114881149811508115181152811538115481155811568115781158811598116081161811628116381164811658116681167811688116981170811718117281173811748117581176811778117881179811808118181182811838118481185811868118781188811898119081191811928119381194811958119681197811988119981200812018120281203812048120581206812078120881209812108121181212812138121481215812168121781218812198122081221812228122381224812258122681227812288122981230812318123281233812348123581236812378123881239812408124181242812438124481245812468124781248812498125081251812528125381254812558125681257812588125981260812618126281263812648126581266812678126881269812708127181272812738127481275812768127781278812798128081281812828128381284812858128681287812888128981290812918129281293812948129581296812978129881299813008130181302813038130481305813068130781308813098131081311813128131381314813158131681317813188131981320813218132281323813248132581326813278132881329813308133181332813338133481335813368133781338813398134081341813428134381344813458134681347813488134981350813518135281353813548135581356813578135881359813608136181362813638136481365813668136781368813698137081371813728137381374813758137681377813788137981380813818138281383813848138581386813878138881389813908139181392813938139481395813968139781398813998140081401814028140381404814058140681407814088140981410814118141281413814148141581416814178141881419814208142181422814238142481425814268142781428814298143081431814328143381434814358143681437814388143981440814418144281443814448144581446814478144881449814508145181452814538145481455814568145781458814598146081461814628146381464814658146681467814688146981470814718147281473814748147581476814778147881479814808148181482814838148481485814868148781488814898149081491814928149381494814958149681497814988149981500815018150281503815048150581506815078150881509815108151181512815138151481515815168151781518815198152081521815228152381524815258152681527815288152981530815318153281533815348153581536815378153881539815408154181542815438154481545815468154781548815498155081551815528155381554815558155681557815588155981560815618156281563815648156581566815678156881569815708157181572815738157481575815768157781578815798158081581815828158381584815858158681587815888158981590815918159281593815948159581596815978159881599816008160181602816038160481605816068160781608816098161081611816128161381614816158161681617816188161981620816218162281623816248162581626816278162881629816308163181632816338163481635816368163781638816398164081641816428164381644816458164681647816488164981650816518165281653816548165581656816578165881659816608166181662816638166481665816668166781668816698167081671816728167381674816758167681677816788167981680816818168281683816848168581686816878168881689816908169181692816938169481695816968169781698816998170081701817028170381704817058170681707817088170981710817118171281713817148171581716817178171881719817208172181722817238172481725817268172781728817298173081731817328173381734817358173681737817388173981740817418174281743817448174581746817478174881749817508175181752817538175481755817568175781758817598176081761817628176381764817658176681767817688176981770817718177281773817748177581776817778177881779817808178181782817838178481785817868178781788817898179081791817928179381794817958179681797817988179981800818018180281803818048180581806818078180881809818108181181812818138181481815818168181781818818198182081821818228182381824818258182681827818288182981830818318183281833818348183581836818378183881839818408184181842818438184481845818468184781848818498185081851818528185381854818558185681857818588185981860818618186281863818648186581866818678186881869818708187181872818738187481875818768187781878818798188081881818828188381884818858188681887818888188981890818918189281893818948189581896818978189881899819008190181902819038190481905819068190781908819098191081911819128191381914819158191681917819188191981920819218192281923819248192581926819278192881929819308193181932819338193481935819368193781938819398194081941819428194381944819458194681947819488194981950819518195281953819548195581956819578195881959819608196181962819638196481965819668196781968819698197081971819728197381974819758197681977819788197981980819818198281983819848198581986819878198881989819908199181992819938199481995819968199781998819998200082001820028200382004820058200682007820088200982010820118201282013820148201582016820178201882019820208202182022820238202482025820268202782028820298203082031820328203382034820358203682037820388203982040820418204282043820448204582046820478204882049820508205182052820538205482055820568205782058820598206082061820628206382064820658206682067820688206982070820718207282073820748207582076820778207882079820808208182082820838208482085820868208782088820898209082091820928209382094820958209682097820988209982100821018210282103821048210582106821078210882109821108211182112821138211482115821168211782118821198212082121821228212382124821258212682127821288212982130821318213282133821348213582136821378213882139821408214182142821438214482145821468214782148821498215082151821528215382154821558215682157821588215982160821618216282163821648216582166821678216882169821708217182172821738217482175821768217782178821798218082181821828218382184821858218682187821888218982190821918219282193821948219582196821978219882199822008220182202822038220482205822068220782208822098221082211822128221382214822158221682217822188221982220822218222282223822248222582226822278222882229822308223182232822338223482235822368223782238822398224082241822428224382244822458224682247822488224982250822518225282253822548225582256822578225882259822608226182262822638226482265822668226782268822698227082271822728227382274822758227682277822788227982280822818228282283822848228582286822878228882289822908229182292822938229482295822968229782298822998230082301823028230382304823058230682307823088230982310823118231282313823148231582316823178231882319823208232182322823238232482325823268232782328823298233082331823328233382334823358233682337823388233982340823418234282343823448234582346823478234882349823508235182352823538235482355823568235782358823598236082361823628236382364823658236682367823688236982370823718237282373823748237582376823778237882379823808238182382823838238482385823868238782388823898239082391823928239382394823958239682397823988239982400824018240282403824048240582406824078240882409824108241182412824138241482415824168241782418824198242082421824228242382424824258242682427824288242982430824318243282433824348243582436824378243882439824408244182442824438244482445824468244782448824498245082451824528245382454824558245682457824588245982460824618246282463824648246582466824678246882469824708247182472824738247482475824768247782478824798248082481824828248382484824858248682487824888248982490824918249282493824948249582496824978249882499825008250182502825038250482505825068250782508825098251082511825128251382514825158251682517825188251982520825218252282523825248252582526825278252882529825308253182532825338253482535825368253782538825398254082541825428254382544825458254682547825488254982550825518255282553825548255582556825578255882559825608256182562825638256482565825668256782568825698257082571825728257382574825758257682577825788257982580825818258282583825848258582586825878258882589825908259182592825938259482595825968259782598825998260082601826028260382604826058260682607826088260982610826118261282613826148261582616826178261882619826208262182622826238262482625826268262782628826298263082631826328263382634826358263682637826388263982640826418264282643826448264582646826478264882649826508265182652826538265482655826568265782658826598266082661826628266382664826658266682667826688266982670826718267282673826748267582676826778267882679826808268182682826838268482685826868268782688826898269082691826928269382694826958269682697826988269982700827018270282703827048270582706827078270882709827108271182712827138271482715827168271782718827198272082721827228272382724827258272682727827288272982730827318273282733827348273582736827378273882739827408274182742827438274482745827468274782748827498275082751827528275382754827558275682757827588275982760827618276282763827648276582766827678276882769827708277182772827738277482775827768277782778827798278082781827828278382784827858278682787827888278982790827918279282793827948279582796827978279882799828008280182802828038280482805828068280782808828098281082811828128281382814828158281682817828188281982820828218282282823828248282582826828278282882829828308283182832828338283482835828368283782838828398284082841828428284382844828458284682847828488284982850828518285282853828548285582856828578285882859828608286182862828638286482865828668286782868828698287082871828728287382874828758287682877828788287982880828818288282883828848288582886828878288882889828908289182892828938289482895828968289782898828998290082901829028290382904829058290682907829088290982910829118291282913829148291582916829178291882919829208292182922829238292482925829268292782928829298293082931829328293382934829358293682937829388293982940829418294282943829448294582946829478294882949829508295182952829538295482955829568295782958829598296082961829628296382964829658296682967829688296982970829718297282973829748297582976829778297882979829808298182982829838298482985829868298782988829898299082991829928299382994829958299682997829988299983000830018300283003830048300583006830078300883009830108301183012830138301483015830168301783018830198302083021830228302383024830258302683027830288302983030830318303283033830348303583036830378303883039830408304183042830438304483045830468304783048830498305083051830528305383054830558305683057830588305983060830618306283063830648306583066830678306883069830708307183072830738307483075830768307783078830798308083081830828308383084830858308683087830888308983090830918309283093830948309583096830978309883099831008310183102831038310483105831068310783108831098311083111831128311383114831158311683117831188311983120831218312283123831248312583126831278312883129831308313183132831338313483135831368313783138831398314083141831428314383144831458314683147831488314983150831518315283153831548315583156831578315883159831608316183162831638316483165831668316783168831698317083171831728317383174831758317683177831788317983180831818318283183831848318583186831878318883189831908319183192831938319483195831968319783198831998320083201832028320383204832058320683207832088320983210832118321283213832148321583216832178321883219832208322183222832238322483225832268322783228832298323083231832328323383234832358323683237832388323983240832418324283243832448324583246832478324883249832508325183252832538325483255832568325783258832598326083261832628326383264832658326683267832688326983270832718327283273832748327583276832778327883279832808328183282832838328483285832868328783288832898329083291832928329383294832958329683297832988329983300833018330283303833048330583306833078330883309833108331183312833138331483315833168331783318833198332083321833228332383324833258332683327833288332983330833318333283333833348333583336833378333883339833408334183342833438334483345833468334783348833498335083351833528335383354833558335683357833588335983360833618336283363833648336583366833678336883369833708337183372833738337483375833768337783378833798338083381833828338383384833858338683387833888338983390833918339283393833948339583396833978339883399834008340183402834038340483405834068340783408834098341083411834128341383414834158341683417834188341983420834218342283423834248342583426834278342883429834308343183432834338343483435834368343783438834398344083441834428344383444834458344683447834488344983450834518345283453834548345583456834578345883459834608346183462834638346483465834668346783468834698347083471834728347383474834758347683477834788347983480834818348283483834848348583486834878348883489834908349183492834938349483495834968349783498834998350083501835028350383504835058350683507835088350983510835118351283513835148351583516835178351883519835208352183522835238352483525835268352783528835298353083531835328353383534835358353683537835388353983540835418354283543835448354583546835478354883549835508355183552835538355483555835568355783558835598356083561835628356383564835658356683567835688356983570835718357283573835748357583576835778357883579835808358183582835838358483585835868358783588835898359083591835928359383594835958359683597835988359983600836018360283603836048360583606836078360883609836108361183612836138361483615836168361783618836198362083621836228362383624836258362683627836288362983630836318363283633836348363583636836378363883639836408364183642836438364483645836468364783648836498365083651836528365383654836558365683657836588365983660836618366283663836648366583666836678366883669836708367183672836738367483675836768367783678836798368083681836828368383684836858368683687836888368983690836918369283693836948369583696836978369883699837008370183702837038370483705837068370783708837098371083711837128371383714837158371683717837188371983720837218372283723837248372583726837278372883729837308373183732837338373483735837368373783738837398374083741837428374383744837458374683747837488374983750837518375283753837548375583756837578375883759837608376183762837638376483765837668376783768837698377083771837728377383774837758377683777837788377983780837818378283783837848378583786837878378883789837908379183792837938379483795837968379783798837998380083801838028380383804838058380683807838088380983810838118381283813838148381583816838178381883819838208382183822838238382483825838268382783828838298383083831838328383383834838358383683837838388383983840838418384283843838448384583846838478384883849838508385183852838538385483855838568385783858838598386083861838628386383864838658386683867838688386983870838718387283873838748387583876838778387883879838808388183882838838388483885838868388783888838898389083891838928389383894838958389683897838988389983900839018390283903839048390583906839078390883909839108391183912839138391483915839168391783918839198392083921839228392383924839258392683927839288392983930839318393283933839348393583936839378393883939839408394183942839438394483945839468394783948839498395083951839528395383954839558395683957839588395983960839618396283963839648396583966839678396883969839708397183972839738397483975839768397783978839798398083981839828398383984839858398683987839888398983990839918399283993839948399583996839978399883999840008400184002840038400484005840068400784008840098401084011840128401384014840158401684017840188401984020840218402284023840248402584026840278402884029840308403184032840338403484035840368403784038840398404084041840428404384044840458404684047840488404984050840518405284053840548405584056840578405884059840608406184062840638406484065840668406784068840698407084071840728407384074840758407684077840788407984080840818408284083840848408584086840878408884089840908409184092840938409484095840968409784098840998410084101841028410384104841058410684107841088410984110841118411284113841148411584116841178411884119841208412184122841238412484125841268412784128841298413084131841328413384134841358413684137841388413984140841418414284143841448414584146841478414884149841508415184152841538415484155841568415784158841598416084161841628416384164841658416684167841688416984170841718417284173841748417584176841778417884179841808418184182841838418484185841868418784188841898419084191841928419384194841958419684197841988419984200842018420284203842048420584206842078420884209842108421184212842138421484215842168421784218842198422084221842228422384224842258422684227842288422984230842318423284233842348423584236842378423884239842408424184242842438424484245842468424784248842498425084251842528425384254842558425684257842588425984260842618426284263842648426584266842678426884269842708427184272842738427484275842768427784278842798428084281842828428384284842858428684287842888428984290842918429284293842948429584296842978429884299843008430184302843038430484305843068430784308843098431084311843128431384314843158431684317843188431984320843218432284323843248432584326843278432884329843308433184332843338433484335843368433784338843398434084341843428434384344843458434684347843488434984350843518435284353843548435584356843578435884359843608436184362843638436484365843668436784368843698437084371843728437384374843758437684377843788437984380843818438284383843848438584386843878438884389843908439184392843938439484395843968439784398843998440084401844028440384404844058440684407844088440984410844118441284413844148441584416844178441884419844208442184422844238442484425844268442784428844298443084431844328443384434844358443684437844388443984440844418444284443844448444584446844478444884449844508445184452844538445484455844568445784458844598446084461844628446384464844658446684467844688446984470844718447284473844748447584476844778447884479844808448184482844838448484485844868448784488844898449084491844928449384494844958449684497844988449984500845018450284503845048450584506845078450884509845108451184512845138451484515845168451784518845198452084521845228452384524845258452684527845288452984530845318453284533845348453584536845378453884539845408454184542845438454484545845468454784548845498455084551845528455384554845558455684557845588455984560845618456284563845648456584566845678456884569845708457184572845738457484575845768457784578845798458084581845828458384584845858458684587845888458984590845918459284593845948459584596845978459884599846008460184602846038460484605846068460784608846098461084611846128461384614846158461684617846188461984620846218462284623846248462584626846278462884629846308463184632846338463484635846368463784638846398464084641846428464384644846458464684647846488464984650846518465284653846548465584656846578465884659846608466184662846638466484665846668466784668846698467084671846728467384674846758467684677846788467984680846818468284683846848468584686846878468884689846908469184692846938469484695846968469784698846998470084701847028470384704847058470684707847088470984710847118471284713847148471584716847178471884719847208472184722847238472484725847268472784728847298473084731847328473384734847358473684737847388473984740847418474284743847448474584746847478474884749847508475184752847538475484755847568475784758847598476084761847628476384764847658476684767847688476984770847718477284773847748477584776847778477884779847808478184782847838478484785847868478784788847898479084791847928479384794847958479684797847988479984800848018480284803848048480584806848078480884809848108481184812848138481484815848168481784818848198482084821848228482384824848258482684827848288482984830848318483284833848348483584836848378483884839848408484184842848438484484845848468484784848848498485084851848528485384854848558485684857848588485984860848618486284863848648486584866848678486884869848708487184872848738487484875848768487784878848798488084881848828488384884848858488684887848888488984890848918489284893848948489584896848978489884899849008490184902849038490484905849068490784908849098491084911849128491384914849158491684917849188491984920849218492284923849248492584926849278492884929849308493184932849338493484935849368493784938849398494084941849428494384944849458494684947849488494984950849518495284953849548495584956849578495884959849608496184962849638496484965849668496784968849698497084971849728497384974849758497684977849788497984980849818498284983849848498584986849878498884989849908499184992849938499484995849968499784998849998500085001850028500385004850058500685007850088500985010850118501285013850148501585016850178501885019850208502185022850238502485025850268502785028850298503085031850328503385034850358503685037850388503985040850418504285043850448504585046850478504885049850508505185052850538505485055850568505785058850598506085061850628506385064850658506685067850688506985070850718507285073850748507585076850778507885079850808508185082850838508485085850868508785088850898509085091850928509385094850958509685097850988509985100851018510285103851048510585106851078510885109851108511185112851138511485115851168511785118851198512085121851228512385124851258512685127851288512985130851318513285133851348513585136851378513885139851408514185142851438514485145851468514785148851498515085151851528515385154851558515685157851588515985160851618516285163851648516585166851678516885169851708517185172851738517485175851768517785178851798518085181851828518385184851858518685187851888518985190851918519285193851948519585196851978519885199852008520185202852038520485205852068520785208852098521085211852128521385214852158521685217852188521985220852218522285223852248522585226852278522885229852308523185232852338523485235852368523785238852398524085241852428524385244852458524685247852488524985250852518525285253852548525585256852578525885259852608526185262852638526485265852668526785268852698527085271852728527385274852758527685277852788527985280852818528285283852848528585286852878528885289852908529185292852938529485295852968529785298852998530085301853028530385304853058530685307853088530985310853118531285313853148531585316853178531885319853208532185322853238532485325853268532785328853298533085331853328533385334853358533685337853388533985340853418534285343853448534585346853478534885349853508535185352853538535485355853568535785358853598536085361853628536385364853658536685367853688536985370853718537285373853748537585376853778537885379853808538185382853838538485385853868538785388853898539085391853928539385394853958539685397853988539985400854018540285403854048540585406854078540885409854108541185412854138541485415854168541785418854198542085421854228542385424854258542685427854288542985430854318543285433854348543585436854378543885439854408544185442854438544485445854468544785448854498545085451854528545385454854558545685457854588545985460854618546285463854648546585466854678546885469854708547185472854738547485475854768547785478854798548085481854828548385484854858548685487854888548985490854918549285493854948549585496854978549885499855008550185502855038550485505855068550785508855098551085511855128551385514855158551685517855188551985520855218552285523855248552585526855278552885529855308553185532855338553485535855368553785538855398554085541855428554385544855458554685547855488554985550855518555285553855548555585556855578555885559855608556185562855638556485565855668556785568855698557085571855728557385574855758557685577855788557985580855818558285583855848558585586855878558885589855908559185592855938559485595855968559785598855998560085601856028560385604856058560685607856088560985610856118561285613856148561585616856178561885619856208562185622856238562485625856268562785628856298563085631856328563385634856358563685637856388563985640856418564285643856448564585646856478564885649856508565185652856538565485655856568565785658856598566085661856628566385664856658566685667856688566985670856718567285673856748567585676856778567885679856808568185682856838568485685856868568785688856898569085691856928569385694856958569685697856988569985700857018570285703857048570585706857078570885709857108571185712857138571485715857168571785718857198572085721857228572385724857258572685727857288572985730857318573285733857348573585736857378573885739857408574185742857438574485745857468574785748857498575085751857528575385754857558575685757857588575985760857618576285763857648576585766857678576885769857708577185772857738577485775857768577785778857798578085781857828578385784857858578685787857888578985790857918579285793857948579585796857978579885799858008580185802858038580485805858068580785808858098581085811858128581385814858158581685817858188581985820858218582285823858248582585826858278582885829858308583185832858338583485835858368583785838858398584085841858428584385844858458584685847858488584985850858518585285853858548585585856858578585885859858608586185862858638586485865858668586785868858698587085871858728587385874858758587685877858788587985880858818588285883858848588585886858878588885889858908589185892858938589485895858968589785898858998590085901859028590385904859058590685907859088590985910859118591285913859148591585916859178591885919859208592185922859238592485925859268592785928859298593085931859328593385934859358593685937859388593985940859418594285943859448594585946859478594885949859508595185952859538595485955859568595785958859598596085961859628596385964859658596685967859688596985970859718597285973859748597585976859778597885979859808598185982859838598485985859868598785988859898599085991859928599385994859958599685997859988599986000860018600286003860048600586006860078600886009860108601186012860138601486015860168601786018860198602086021860228602386024860258602686027860288602986030860318603286033860348603586036860378603886039860408604186042860438604486045860468604786048860498605086051860528605386054860558605686057860588605986060860618606286063860648606586066860678606886069860708607186072860738607486075860768607786078860798608086081860828608386084860858608686087860888608986090860918609286093860948609586096860978609886099861008610186102861038610486105861068610786108861098611086111861128611386114861158611686117861188611986120861218612286123861248612586126861278612886129861308613186132861338613486135861368613786138861398614086141861428614386144861458614686147861488614986150861518615286153861548615586156861578615886159861608616186162861638616486165861668616786168861698617086171861728617386174861758617686177861788617986180861818618286183861848618586186861878618886189861908619186192861938619486195861968619786198861998620086201862028620386204862058620686207862088620986210862118621286213862148621586216862178621886219862208622186222862238622486225862268622786228862298623086231862328623386234862358623686237862388623986240862418624286243862448624586246862478624886249862508625186252862538625486255862568625786258862598626086261862628626386264862658626686267862688626986270862718627286273862748627586276862778627886279862808628186282862838628486285862868628786288862898629086291862928629386294862958629686297862988629986300863018630286303863048630586306863078630886309863108631186312863138631486315863168631786318863198632086321863228632386324863258632686327863288632986330863318633286333863348633586336863378633886339863408634186342863438634486345863468634786348863498635086351863528635386354863558635686357863588635986360863618636286363863648636586366863678636886369863708637186372863738637486375863768637786378863798638086381863828638386384863858638686387863888638986390863918639286393863948639586396863978639886399864008640186402864038640486405864068640786408864098641086411864128641386414864158641686417864188641986420864218642286423864248642586426864278642886429864308643186432864338643486435864368643786438864398644086441864428644386444864458644686447864488644986450864518645286453864548645586456864578645886459864608646186462864638646486465864668646786468864698647086471864728647386474864758647686477864788647986480864818648286483864848648586486864878648886489864908649186492864938649486495864968649786498864998650086501865028650386504865058650686507865088650986510865118651286513865148651586516865178651886519865208652186522865238652486525865268652786528865298653086531865328653386534865358653686537865388653986540865418654286543865448654586546865478654886549865508655186552865538655486555865568655786558865598656086561865628656386564865658656686567865688656986570865718657286573865748657586576865778657886579865808658186582865838658486585865868658786588865898659086591865928659386594865958659686597865988659986600866018660286603866048660586606866078660886609866108661186612866138661486615866168661786618866198662086621866228662386624866258662686627866288662986630866318663286633866348663586636866378663886639866408664186642866438664486645866468664786648866498665086651866528665386654866558665686657866588665986660866618666286663866648666586666866678666886669866708667186672866738667486675866768667786678866798668086681866828668386684866858668686687866888668986690866918669286693866948669586696866978669886699867008670186702867038670486705867068670786708867098671086711867128671386714867158671686717867188671986720867218672286723867248672586726867278672886729867308673186732867338673486735867368673786738867398674086741867428674386744867458674686747867488674986750867518675286753867548675586756867578675886759867608676186762867638676486765867668676786768867698677086771867728677386774867758677686777867788677986780867818678286783867848678586786867878678886789867908679186792867938679486795867968679786798867998680086801868028680386804868058680686807868088680986810868118681286813868148681586816868178681886819868208682186822868238682486825868268682786828868298683086831868328683386834868358683686837868388683986840868418684286843868448684586846868478684886849868508685186852868538685486855868568685786858868598686086861868628686386864868658686686867868688686986870868718687286873868748687586876868778687886879868808688186882868838688486885868868688786888868898689086891868928689386894868958689686897868988689986900869018690286903869048690586906869078690886909869108691186912869138691486915869168691786918869198692086921869228692386924869258692686927869288692986930869318693286933869348693586936869378693886939869408694186942869438694486945869468694786948869498695086951869528695386954869558695686957869588695986960869618696286963869648696586966869678696886969869708697186972869738697486975869768697786978869798698086981869828698386984869858698686987869888698986990869918699286993869948699586996869978699886999870008700187002870038700487005870068700787008870098701087011870128701387014870158701687017870188701987020870218702287023870248702587026870278702887029870308703187032870338703487035870368703787038870398704087041870428704387044870458704687047870488704987050870518705287053870548705587056870578705887059870608706187062870638706487065870668706787068870698707087071870728707387074870758707687077870788707987080870818708287083870848708587086870878708887089870908709187092870938709487095870968709787098870998710087101871028710387104871058710687107871088710987110871118711287113871148711587116871178711887119871208712187122871238712487125871268712787128871298713087131871328713387134871358713687137871388713987140871418714287143871448714587146871478714887149871508715187152871538715487155871568715787158871598716087161871628716387164871658716687167871688716987170871718717287173871748717587176871778717887179871808718187182871838718487185871868718787188871898719087191871928719387194871958719687197871988719987200872018720287203872048720587206872078720887209872108721187212872138721487215872168721787218872198722087221872228722387224872258722687227872288722987230872318723287233872348723587236872378723887239872408724187242872438724487245872468724787248872498725087251872528725387254872558725687257872588725987260872618726287263872648726587266872678726887269872708727187272872738727487275872768727787278872798728087281872828728387284872858728687287872888728987290872918729287293872948729587296872978729887299873008730187302873038730487305873068730787308873098731087311873128731387314873158731687317873188731987320873218732287323873248732587326873278732887329873308733187332873338733487335873368733787338873398734087341873428734387344873458734687347873488734987350873518735287353873548735587356873578735887359873608736187362873638736487365873668736787368873698737087371873728737387374873758737687377873788737987380873818738287383873848738587386873878738887389873908739187392873938739487395873968739787398873998740087401874028740387404874058740687407874088740987410874118741287413874148741587416874178741887419874208742187422874238742487425874268742787428874298743087431874328743387434874358743687437874388743987440874418744287443874448744587446874478744887449874508745187452874538745487455874568745787458874598746087461874628746387464874658746687467874688746987470874718747287473874748747587476874778747887479874808748187482874838748487485874868748787488874898749087491874928749387494874958749687497874988749987500875018750287503875048750587506875078750887509875108751187512875138751487515875168751787518875198752087521875228752387524875258752687527875288752987530875318753287533875348753587536875378753887539875408754187542875438754487545875468754787548875498755087551875528755387554875558755687557875588755987560875618756287563875648756587566875678756887569875708757187572875738757487575875768757787578875798758087581875828758387584875858758687587875888758987590875918759287593875948759587596875978759887599876008760187602876038760487605876068760787608876098761087611876128761387614876158761687617876188761987620876218762287623876248762587626876278762887629876308763187632876338763487635876368763787638876398764087641876428764387644876458764687647876488764987650876518765287653876548765587656876578765887659876608766187662876638766487665876668766787668876698767087671876728767387674876758767687677876788767987680876818768287683876848768587686876878768887689876908769187692876938769487695876968769787698876998770087701877028770387704877058770687707877088770987710877118771287713877148771587716877178771887719877208772187722877238772487725877268772787728877298773087731877328773387734877358773687737877388773987740877418774287743877448774587746877478774887749877508775187752877538775487755877568775787758877598776087761877628776387764877658776687767877688776987770877718777287773877748777587776877778777887779877808778187782877838778487785877868778787788877898779087791877928779387794877958779687797877988779987800878018780287803878048780587806878078780887809878108781187812878138781487815878168781787818878198782087821878228782387824878258782687827878288782987830878318783287833878348783587836878378783887839878408784187842878438784487845878468784787848878498785087851878528785387854878558785687857878588785987860878618786287863878648786587866878678786887869878708787187872878738787487875878768787787878878798788087881878828788387884878858788687887878888788987890878918789287893878948789587896878978789887899879008790187902879038790487905879068790787908879098791087911879128791387914879158791687917879188791987920879218792287923879248792587926879278792887929879308793187932879338793487935879368793787938879398794087941879428794387944879458794687947879488794987950879518795287953879548795587956879578795887959879608796187962879638796487965879668796787968879698797087971879728797387974879758797687977879788797987980879818798287983879848798587986879878798887989879908799187992879938799487995879968799787998879998800088001880028800388004880058800688007880088800988010880118801288013880148801588016880178801888019880208802188022880238802488025880268802788028880298803088031880328803388034880358803688037880388803988040880418804288043880448804588046880478804888049880508805188052880538805488055880568805788058880598806088061880628806388064880658806688067880688806988070880718807288073880748807588076880778807888079880808808188082880838808488085880868808788088880898809088091880928809388094880958809688097880988809988100881018810288103881048810588106881078810888109881108811188112881138811488115881168811788118881198812088121881228812388124881258812688127881288812988130881318813288133881348813588136881378813888139881408814188142881438814488145881468814788148881498815088151881528815388154881558815688157881588815988160881618816288163881648816588166881678816888169881708817188172881738817488175881768817788178881798818088181881828818388184881858818688187881888818988190881918819288193881948819588196881978819888199882008820188202882038820488205882068820788208882098821088211882128821388214882158821688217882188821988220882218822288223882248822588226882278822888229882308823188232882338823488235882368823788238882398824088241882428824388244882458824688247882488824988250882518825288253882548825588256882578825888259882608826188262882638826488265882668826788268882698827088271882728827388274882758827688277882788827988280882818828288283882848828588286882878828888289882908829188292882938829488295882968829788298882998830088301883028830388304883058830688307883088830988310883118831288313883148831588316883178831888319883208832188322883238832488325883268832788328883298833088331883328833388334883358833688337883388833988340883418834288343883448834588346883478834888349883508835188352883538835488355883568835788358883598836088361883628836388364883658836688367883688836988370883718837288373883748837588376883778837888379883808838188382883838838488385883868838788388883898839088391883928839388394883958839688397883988839988400884018840288403884048840588406884078840888409884108841188412884138841488415884168841788418884198842088421884228842388424884258842688427884288842988430884318843288433884348843588436884378843888439884408844188442884438844488445884468844788448884498845088451884528845388454884558845688457884588845988460884618846288463884648846588466884678846888469884708847188472884738847488475884768847788478884798848088481884828848388484884858848688487884888848988490884918849288493884948849588496884978849888499885008850188502885038850488505885068850788508885098851088511885128851388514885158851688517885188851988520885218852288523885248852588526885278852888529885308853188532885338853488535885368853788538885398854088541885428854388544885458854688547885488854988550885518855288553885548855588556885578855888559885608856188562885638856488565885668856788568885698857088571885728857388574885758857688577885788857988580885818858288583885848858588586885878858888589885908859188592885938859488595885968859788598885998860088601886028860388604886058860688607886088860988610886118861288613886148861588616886178861888619886208862188622886238862488625886268862788628886298863088631886328863388634886358863688637886388863988640886418864288643886448864588646886478864888649886508865188652886538865488655886568865788658886598866088661886628866388664886658866688667886688866988670886718867288673886748867588676886778867888679886808868188682886838868488685886868868788688886898869088691886928869388694886958869688697886988869988700887018870288703887048870588706887078870888709887108871188712887138871488715887168871788718887198872088721887228872388724887258872688727887288872988730887318873288733887348873588736887378873888739887408874188742887438874488745887468874788748887498875088751887528875388754887558875688757887588875988760887618876288763887648876588766887678876888769887708877188772887738877488775887768877788778887798878088781887828878388784887858878688787887888878988790887918879288793887948879588796887978879888799888008880188802888038880488805888068880788808888098881088811888128881388814888158881688817888188881988820888218882288823888248882588826888278882888829888308883188832888338883488835888368883788838888398884088841888428884388844888458884688847888488884988850888518885288853888548885588856888578885888859888608886188862888638886488865888668886788868888698887088871888728887388874888758887688877888788887988880888818888288883888848888588886888878888888889888908889188892888938889488895888968889788898888998890088901889028890388904889058890688907889088890988910889118891288913889148891588916889178891888919889208892188922889238892488925889268892788928889298893088931889328893388934889358893688937889388893988940889418894288943889448894588946889478894888949889508895188952889538895488955889568895788958889598896088961889628896388964889658896688967889688896988970889718897288973889748897588976889778897888979889808898188982889838898488985889868898788988889898899088991889928899388994889958899688997889988899989000890018900289003890048900589006890078900889009890108901189012890138901489015890168901789018890198902089021890228902389024890258902689027890288902989030890318903289033890348903589036890378903889039890408904189042890438904489045890468904789048890498905089051890528905389054890558905689057890588905989060890618906289063890648906589066890678906889069890708907189072890738907489075890768907789078890798908089081890828908389084890858908689087890888908989090890918909289093890948909589096890978909889099891008910189102891038910489105891068910789108891098911089111891128911389114891158911689117891188911989120891218912289123891248912589126891278912889129891308913189132891338913489135891368913789138891398914089141891428914389144891458914689147891488914989150891518915289153891548915589156891578915889159891608916189162891638916489165891668916789168891698917089171891728917389174891758917689177891788917989180891818918289183891848918589186891878918889189891908919189192891938919489195891968919789198891998920089201892028920389204892058920689207892088920989210892118921289213892148921589216892178921889219892208922189222892238922489225892268922789228892298923089231892328923389234892358923689237892388923989240892418924289243892448924589246892478924889249892508925189252892538925489255892568925789258892598926089261892628926389264892658926689267892688926989270892718927289273892748927589276892778927889279892808928189282892838928489285892868928789288892898929089291892928929389294892958929689297892988929989300893018930289303893048930589306893078930889309893108931189312893138931489315893168931789318893198932089321893228932389324893258932689327893288932989330893318933289333893348933589336893378933889339893408934189342893438934489345893468934789348893498935089351893528935389354893558935689357893588935989360893618936289363893648936589366893678936889369893708937189372893738937489375893768937789378893798938089381893828938389384893858938689387893888938989390893918939289393893948939589396893978939889399894008940189402894038940489405894068940789408894098941089411894128941389414894158941689417894188941989420894218942289423894248942589426894278942889429894308943189432894338943489435894368943789438894398944089441894428944389444894458944689447894488944989450894518945289453894548945589456894578945889459894608946189462894638946489465894668946789468894698947089471894728947389474894758947689477894788947989480894818948289483894848948589486894878948889489894908949189492894938949489495894968949789498894998950089501895028950389504895058950689507895088950989510895118951289513895148951589516895178951889519895208952189522895238952489525895268952789528895298953089531895328953389534895358953689537895388953989540895418954289543895448954589546895478954889549895508955189552895538955489555895568955789558895598956089561895628956389564895658956689567895688956989570895718957289573895748957589576895778957889579895808958189582895838958489585895868958789588895898959089591895928959389594895958959689597895988959989600896018960289603896048960589606896078960889609896108961189612896138961489615896168961789618896198962089621896228962389624896258962689627896288962989630896318963289633896348963589636896378963889639896408964189642896438964489645896468964789648896498965089651896528965389654896558965689657896588965989660896618966289663896648966589666896678966889669896708967189672896738967489675896768967789678896798968089681896828968389684896858968689687896888968989690896918969289693896948969589696896978969889699897008970189702897038970489705897068970789708897098971089711897128971389714897158971689717897188971989720897218972289723897248972589726897278972889729897308973189732897338973489735897368973789738897398974089741897428974389744897458974689747897488974989750897518975289753897548975589756897578975889759897608976189762897638976489765897668976789768897698977089771897728977389774897758977689777897788977989780897818978289783897848978589786897878978889789897908979189792897938979489795897968979789798897998980089801898028980389804898058980689807898088980989810898118981289813898148981589816898178981889819898208982189822898238982489825898268982789828898298983089831898328983389834898358983689837898388983989840898418984289843898448984589846898478984889849898508985189852898538985489855898568985789858898598986089861898628986389864898658986689867898688986989870898718987289873898748987589876898778987889879898808988189882898838988489885898868988789888898898989089891898928989389894898958989689897898988989989900899018990289903899048990589906899078990889909899108991189912899138991489915899168991789918899198992089921899228992389924899258992689927899288992989930899318993289933899348993589936899378993889939899408994189942899438994489945899468994789948899498995089951899528995389954899558995689957899588995989960899618996289963899648996589966899678996889969899708997189972899738997489975899768997789978899798998089981899828998389984899858998689987899888998989990899918999289993899948999589996899978999889999900009000190002900039000490005900069000790008900099001090011900129001390014900159001690017900189001990020900219002290023900249002590026900279002890029900309003190032900339003490035900369003790038900399004090041900429004390044900459004690047900489004990050900519005290053900549005590056900579005890059900609006190062900639006490065900669006790068900699007090071900729007390074900759007690077900789007990080900819008290083900849008590086900879008890089900909009190092900939009490095900969009790098900999010090101901029010390104901059010690107901089010990110901119011290113901149011590116901179011890119901209012190122901239012490125901269012790128901299013090131901329013390134901359013690137901389013990140901419014290143901449014590146901479014890149901509015190152901539015490155901569015790158901599016090161901629016390164901659016690167901689016990170901719017290173901749017590176901779017890179901809018190182901839018490185901869018790188901899019090191901929019390194901959019690197901989019990200902019020290203902049020590206902079020890209902109021190212902139021490215902169021790218902199022090221902229022390224902259022690227902289022990230902319023290233902349023590236902379023890239902409024190242902439024490245902469024790248902499025090251902529025390254902559025690257902589025990260902619026290263902649026590266902679026890269902709027190272902739027490275902769027790278902799028090281902829028390284902859028690287902889028990290902919029290293902949029590296902979029890299903009030190302903039030490305903069030790308903099031090311903129031390314903159031690317903189031990320903219032290323903249032590326903279032890329903309033190332903339033490335903369033790338903399034090341903429034390344903459034690347903489034990350903519035290353903549035590356903579035890359903609036190362903639036490365903669036790368903699037090371903729037390374903759037690377903789037990380903819038290383903849038590386903879038890389903909039190392903939039490395903969039790398903999040090401904029040390404904059040690407904089040990410904119041290413904149041590416904179041890419904209042190422904239042490425904269042790428904299043090431904329043390434904359043690437904389043990440904419044290443904449044590446904479044890449904509045190452904539045490455904569045790458904599046090461904629046390464904659046690467904689046990470904719047290473904749047590476904779047890479904809048190482904839048490485904869048790488904899049090491904929049390494904959049690497904989049990500905019050290503905049050590506905079050890509905109051190512905139051490515905169051790518905199052090521905229052390524905259052690527905289052990530905319053290533905349053590536905379053890539905409054190542905439054490545905469054790548905499055090551905529055390554905559055690557905589055990560905619056290563905649056590566905679056890569905709057190572905739057490575905769057790578905799058090581905829058390584905859058690587905889058990590905919059290593905949059590596905979059890599906009060190602906039060490605906069060790608906099061090611906129061390614906159061690617906189061990620906219062290623906249062590626906279062890629906309063190632906339063490635906369063790638906399064090641906429064390644906459064690647906489064990650906519065290653906549065590656906579065890659906609066190662906639066490665906669066790668906699067090671906729067390674906759067690677906789067990680906819068290683906849068590686906879068890689906909069190692906939069490695906969069790698906999070090701907029070390704907059070690707907089070990710907119071290713907149071590716907179071890719907209072190722907239072490725907269072790728907299073090731907329073390734907359073690737907389073990740907419074290743907449074590746907479074890749907509075190752907539075490755907569075790758907599076090761907629076390764907659076690767907689076990770907719077290773907749077590776907779077890779907809078190782907839078490785907869078790788907899079090791907929079390794907959079690797907989079990800908019080290803908049080590806908079080890809908109081190812908139081490815908169081790818908199082090821908229082390824908259082690827908289082990830908319083290833908349083590836908379083890839908409084190842908439084490845908469084790848908499085090851908529085390854908559085690857908589085990860908619086290863908649086590866908679086890869908709087190872908739087490875908769087790878908799088090881908829088390884908859088690887908889088990890908919089290893908949089590896908979089890899909009090190902909039090490905909069090790908909099091090911909129091390914909159091690917909189091990920909219092290923909249092590926909279092890929909309093190932909339093490935909369093790938909399094090941909429094390944909459094690947909489094990950909519095290953909549095590956909579095890959909609096190962909639096490965909669096790968909699097090971909729097390974909759097690977909789097990980909819098290983909849098590986909879098890989909909099190992909939099490995909969099790998909999100091001910029100391004910059100691007910089100991010910119101291013910149101591016910179101891019910209102191022910239102491025910269102791028910299103091031910329103391034910359103691037910389103991040910419104291043910449104591046910479104891049910509105191052910539105491055910569105791058910599106091061910629106391064910659106691067910689106991070910719107291073910749107591076910779107891079910809108191082910839108491085910869108791088910899109091091910929109391094910959109691097910989109991100911019110291103911049110591106911079110891109911109111191112911139111491115911169111791118911199112091121911229112391124911259112691127911289112991130911319113291133911349113591136911379113891139911409114191142911439114491145911469114791148911499115091151911529115391154911559115691157911589115991160911619116291163911649116591166911679116891169911709117191172911739117491175911769117791178911799118091181911829118391184911859118691187911889118991190911919119291193911949119591196911979119891199912009120191202912039120491205912069120791208912099121091211912129121391214912159121691217912189121991220912219122291223912249122591226912279122891229912309123191232912339123491235912369123791238912399124091241912429124391244912459124691247912489124991250912519125291253912549125591256912579125891259912609126191262912639126491265912669126791268912699127091271912729127391274912759127691277912789127991280912819128291283912849128591286912879128891289912909129191292912939129491295912969129791298912999130091301913029130391304913059130691307913089130991310913119131291313913149131591316913179131891319913209132191322913239132491325913269132791328913299133091331913329133391334913359133691337913389133991340913419134291343913449134591346913479134891349913509135191352913539135491355913569135791358913599136091361913629136391364913659136691367913689136991370913719137291373913749137591376913779137891379913809138191382913839138491385913869138791388913899139091391913929139391394913959139691397913989139991400914019140291403914049140591406914079140891409914109141191412914139141491415914169141791418914199142091421914229142391424914259142691427914289142991430914319143291433914349143591436914379143891439914409144191442914439144491445914469144791448914499145091451914529145391454914559145691457914589145991460914619146291463914649146591466914679146891469914709147191472914739147491475914769147791478914799148091481914829148391484914859148691487914889148991490914919149291493914949149591496914979149891499915009150191502915039150491505915069150791508915099151091511915129151391514915159151691517915189151991520915219152291523915249152591526915279152891529915309153191532915339153491535915369153791538915399154091541915429154391544915459154691547915489154991550915519155291553915549155591556915579155891559915609156191562915639156491565915669156791568915699157091571915729157391574915759157691577915789157991580915819158291583915849158591586915879158891589915909159191592915939159491595915969159791598915999160091601916029160391604916059160691607916089160991610916119161291613916149161591616916179161891619916209162191622916239162491625916269162791628916299163091631916329163391634916359163691637916389163991640916419164291643916449164591646916479164891649916509165191652916539165491655916569165791658916599166091661916629166391664916659166691667916689166991670916719167291673916749167591676916779167891679916809168191682916839168491685916869168791688916899169091691916929169391694916959169691697916989169991700917019170291703917049170591706917079170891709917109171191712917139171491715917169171791718917199172091721917229172391724917259172691727917289172991730917319173291733917349173591736917379173891739917409174191742917439174491745917469174791748917499175091751917529175391754917559175691757917589175991760917619176291763917649176591766917679176891769917709177191772917739177491775917769177791778917799178091781917829178391784917859178691787917889178991790917919179291793917949179591796917979179891799918009180191802918039180491805918069180791808918099181091811918129181391814918159181691817918189181991820918219182291823918249182591826918279182891829918309183191832918339183491835918369183791838918399184091841918429184391844918459184691847918489184991850918519185291853918549185591856918579185891859918609186191862918639186491865918669186791868918699187091871918729187391874918759187691877918789187991880918819188291883918849188591886918879188891889918909189191892918939189491895918969189791898918999190091901919029190391904919059190691907919089190991910919119191291913919149191591916919179191891919919209192191922919239192491925919269192791928919299193091931919329193391934919359193691937919389193991940919419194291943919449194591946919479194891949919509195191952919539195491955919569195791958919599196091961919629196391964919659196691967919689196991970919719197291973919749197591976919779197891979919809198191982919839198491985919869198791988919899199091991919929199391994919959199691997919989199992000920019200292003920049200592006920079200892009920109201192012920139201492015920169201792018920199202092021920229202392024920259202692027920289202992030920319203292033920349203592036920379203892039920409204192042920439204492045920469204792048920499205092051920529205392054920559205692057920589205992060920619206292063920649206592066920679206892069920709207192072920739207492075920769207792078920799208092081920829208392084920859208692087920889208992090920919209292093920949209592096920979209892099921009210192102921039210492105921069210792108921099211092111921129211392114921159211692117921189211992120921219212292123921249212592126921279212892129921309213192132921339213492135921369213792138921399214092141921429214392144921459214692147921489214992150921519215292153921549215592156921579215892159921609216192162921639216492165921669216792168921699217092171921729217392174921759217692177921789217992180921819218292183921849218592186921879218892189921909219192192921939219492195921969219792198921999220092201922029220392204922059220692207922089220992210922119221292213922149221592216922179221892219922209222192222922239222492225922269222792228922299223092231922329223392234922359223692237922389223992240922419224292243922449224592246922479224892249922509225192252922539225492255922569225792258922599226092261922629226392264922659226692267922689226992270922719227292273922749227592276922779227892279922809228192282922839228492285922869228792288922899229092291922929229392294922959229692297922989229992300923019230292303923049230592306923079230892309923109231192312923139231492315923169231792318923199232092321923229232392324923259232692327923289232992330923319233292333923349233592336923379233892339923409234192342923439234492345923469234792348923499235092351923529235392354923559235692357923589235992360923619236292363923649236592366923679236892369923709237192372923739237492375923769237792378923799238092381923829238392384923859238692387923889238992390923919239292393923949239592396923979239892399924009240192402924039240492405924069240792408924099241092411924129241392414924159241692417924189241992420924219242292423924249242592426924279242892429924309243192432924339243492435924369243792438924399244092441924429244392444924459244692447924489244992450924519245292453924549245592456924579245892459924609246192462924639246492465924669246792468924699247092471924729247392474924759247692477924789247992480924819248292483924849248592486924879248892489924909249192492924939249492495924969249792498924999250092501925029250392504925059250692507925089250992510925119251292513925149251592516925179251892519925209252192522925239252492525925269252792528925299253092531925329253392534925359253692537925389253992540925419254292543925449254592546925479254892549925509255192552925539255492555925569255792558925599256092561925629256392564925659256692567925689256992570925719257292573925749257592576925779257892579925809258192582925839258492585925869258792588925899259092591925929259392594925959259692597925989259992600926019260292603926049260592606926079260892609926109261192612926139261492615926169261792618926199262092621926229262392624926259262692627926289262992630926319263292633926349263592636926379263892639926409264192642926439264492645926469264792648926499265092651926529265392654926559265692657926589265992660926619266292663926649266592666926679266892669926709267192672926739267492675926769267792678926799268092681926829268392684926859268692687926889268992690926919269292693926949269592696926979269892699927009270192702927039270492705927069270792708927099271092711927129271392714927159271692717927189271992720927219272292723927249272592726927279272892729927309273192732927339273492735927369273792738927399274092741927429274392744927459274692747927489274992750927519275292753927549275592756927579275892759927609276192762927639276492765927669276792768927699277092771927729277392774927759277692777927789277992780927819278292783927849278592786927879278892789927909279192792927939279492795927969279792798927999280092801928029280392804928059280692807928089280992810928119281292813928149281592816928179281892819928209282192822928239282492825928269282792828928299283092831928329283392834928359283692837928389283992840928419284292843928449284592846928479284892849928509285192852928539285492855928569285792858928599286092861928629286392864928659286692867928689286992870928719287292873928749287592876928779287892879928809288192882928839288492885928869288792888928899289092891928929289392894928959289692897928989289992900929019290292903929049290592906929079290892909929109291192912929139291492915929169291792918929199292092921929229292392924929259292692927929289292992930929319293292933929349293592936929379293892939929409294192942929439294492945929469294792948929499295092951929529295392954929559295692957929589295992960929619296292963929649296592966929679296892969929709297192972929739297492975929769297792978929799298092981929829298392984929859298692987929889298992990929919299292993929949299592996929979299892999930009300193002930039300493005930069300793008930099301093011930129301393014930159301693017930189301993020930219302293023930249302593026930279302893029930309303193032930339303493035930369303793038930399304093041930429304393044930459304693047930489304993050930519305293053930549305593056930579305893059930609306193062930639306493065930669306793068930699307093071930729307393074930759307693077930789307993080930819308293083930849308593086930879308893089930909309193092930939309493095930969309793098930999310093101931029310393104931059310693107931089310993110931119311293113931149311593116931179311893119931209312193122931239312493125931269312793128931299313093131931329313393134931359313693137931389313993140931419314293143931449314593146931479314893149931509315193152931539315493155931569315793158931599316093161931629316393164931659316693167931689316993170931719317293173931749317593176931779317893179931809318193182931839318493185931869318793188931899319093191931929319393194931959319693197931989319993200932019320293203932049320593206932079320893209932109321193212932139321493215932169321793218932199322093221932229322393224932259322693227932289322993230932319323293233932349323593236932379323893239932409324193242932439324493245932469324793248932499325093251932529325393254932559325693257932589325993260932619326293263932649326593266932679326893269932709327193272932739327493275932769327793278932799328093281932829328393284932859328693287932889328993290932919329293293932949329593296932979329893299933009330193302933039330493305933069330793308933099331093311933129331393314933159331693317933189331993320933219332293323933249332593326933279332893329933309333193332933339333493335933369333793338933399334093341933429334393344933459334693347933489334993350933519335293353933549335593356933579335893359933609336193362933639336493365933669336793368933699337093371933729337393374933759337693377933789337993380933819338293383933849338593386933879338893389933909339193392933939339493395933969339793398933999340093401934029340393404934059340693407934089340993410934119341293413934149341593416934179341893419934209342193422934239342493425934269342793428934299343093431934329343393434934359343693437934389343993440934419344293443934449344593446934479344893449934509345193452934539345493455934569345793458934599346093461934629346393464934659346693467934689346993470934719347293473934749347593476934779347893479934809348193482934839348493485934869348793488934899349093491934929349393494934959349693497934989349993500935019350293503935049350593506935079350893509935109351193512935139351493515935169351793518935199352093521935229352393524935259352693527935289352993530935319353293533935349353593536935379353893539935409354193542935439354493545935469354793548935499355093551935529355393554935559355693557935589355993560935619356293563935649356593566935679356893569935709357193572935739357493575935769357793578935799358093581935829358393584935859358693587935889358993590935919359293593935949359593596935979359893599936009360193602936039360493605936069360793608936099361093611936129361393614936159361693617936189361993620936219362293623936249362593626936279362893629936309363193632936339363493635936369363793638936399364093641936429364393644936459364693647936489364993650936519365293653936549365593656936579365893659936609366193662936639366493665936669366793668936699367093671936729367393674936759367693677936789367993680936819368293683936849368593686936879368893689936909369193692936939369493695936969369793698936999370093701937029370393704937059370693707937089370993710937119371293713937149371593716937179371893719937209372193722937239372493725937269372793728937299373093731937329373393734937359373693737937389373993740937419374293743937449374593746937479374893749937509375193752937539375493755937569375793758937599376093761937629376393764937659376693767937689376993770937719377293773937749377593776937779377893779937809378193782937839378493785937869378793788937899379093791937929379393794937959379693797937989379993800938019380293803938049380593806938079380893809938109381193812938139381493815938169381793818938199382093821938229382393824938259382693827938289382993830938319383293833938349383593836938379383893839938409384193842938439384493845938469384793848938499385093851938529385393854938559385693857938589385993860938619386293863938649386593866938679386893869938709387193872938739387493875938769387793878938799388093881938829388393884938859388693887938889388993890938919389293893938949389593896938979389893899939009390193902939039390493905939069390793908939099391093911939129391393914939159391693917939189391993920939219392293923939249392593926939279392893929939309393193932939339393493935939369393793938939399394093941939429394393944939459394693947939489394993950939519395293953939549395593956939579395893959939609396193962939639396493965939669396793968939699397093971939729397393974939759397693977939789397993980939819398293983939849398593986939879398893989939909399193992939939399493995939969399793998939999400094001940029400394004940059400694007940089400994010940119401294013940149401594016940179401894019940209402194022940239402494025940269402794028940299403094031940329403394034940359403694037940389403994040940419404294043940449404594046940479404894049940509405194052940539405494055940569405794058940599406094061940629406394064940659406694067940689406994070940719407294073940749407594076940779407894079940809408194082940839408494085940869408794088940899409094091940929409394094940959409694097940989409994100941019410294103941049410594106941079410894109941109411194112941139411494115941169411794118941199412094121941229412394124941259412694127941289412994130941319413294133941349413594136941379413894139941409414194142941439414494145941469414794148941499415094151941529415394154941559415694157941589415994160941619416294163941649416594166941679416894169941709417194172941739417494175941769417794178941799418094181941829418394184941859418694187941889418994190941919419294193941949419594196941979419894199942009420194202942039420494205942069420794208942099421094211942129421394214942159421694217942189421994220942219422294223942249422594226942279422894229942309423194232942339423494235942369423794238942399424094241942429424394244942459424694247942489424994250942519425294253942549425594256942579425894259942609426194262942639426494265942669426794268942699427094271942729427394274942759427694277942789427994280942819428294283942849428594286942879428894289942909429194292942939429494295942969429794298942999430094301943029430394304943059430694307943089430994310943119431294313943149431594316943179431894319943209432194322943239432494325943269432794328943299433094331943329433394334943359433694337943389433994340943419434294343943449434594346943479434894349943509435194352943539435494355943569435794358943599436094361943629436394364943659436694367943689436994370943719437294373943749437594376943779437894379943809438194382943839438494385943869438794388943899439094391943929439394394943959439694397943989439994400944019440294403944049440594406944079440894409944109441194412944139441494415944169441794418944199442094421944229442394424944259442694427944289442994430944319443294433944349443594436944379443894439944409444194442944439444494445944469444794448944499445094451944529445394454944559445694457944589445994460944619446294463944649446594466944679446894469944709447194472944739447494475944769447794478944799448094481944829448394484944859448694487944889448994490944919449294493944949449594496944979449894499945009450194502945039450494505945069450794508945099451094511945129451394514945159451694517945189451994520945219452294523945249452594526945279452894529945309453194532945339453494535945369453794538945399454094541945429454394544945459454694547945489454994550945519455294553945549455594556945579455894559945609456194562945639456494565945669456794568945699457094571945729457394574945759457694577945789457994580945819458294583945849458594586945879458894589945909459194592945939459494595945969459794598945999460094601946029460394604946059460694607946089460994610946119461294613946149461594616946179461894619946209462194622946239462494625946269462794628946299463094631946329463394634946359463694637946389463994640946419464294643946449464594646946479464894649946509465194652946539465494655946569465794658946599466094661946629466394664946659466694667946689466994670946719467294673946749467594676946779467894679946809468194682946839468494685946869468794688946899469094691946929469394694946959469694697946989469994700947019470294703947049470594706947079470894709947109471194712947139471494715947169471794718947199472094721947229472394724947259472694727947289472994730947319473294733947349473594736947379473894739947409474194742947439474494745947469474794748947499475094751947529475394754947559475694757947589475994760947619476294763947649476594766947679476894769947709477194772947739477494775947769477794778947799478094781947829478394784947859478694787947889478994790947919479294793947949479594796947979479894799948009480194802948039480494805948069480794808948099481094811948129481394814948159481694817948189481994820948219482294823948249482594826948279482894829948309483194832948339483494835948369483794838948399484094841948429484394844948459484694847948489484994850948519485294853948549485594856948579485894859948609486194862948639486494865948669486794868948699487094871948729487394874948759487694877948789487994880948819488294883948849488594886948879488894889948909489194892948939489494895948969489794898948999490094901949029490394904949059490694907949089490994910949119491294913949149491594916949179491894919949209492194922949239492494925949269492794928949299493094931949329493394934949359493694937949389493994940949419494294943949449494594946949479494894949949509495194952949539495494955949569495794958949599496094961949629496394964949659496694967949689496994970949719497294973949749497594976949779497894979949809498194982949839498494985949869498794988949899499094991949929499394994949959499694997949989499995000950019500295003950049500595006950079500895009950109501195012950139501495015950169501795018950199502095021950229502395024950259502695027950289502995030950319503295033950349503595036950379503895039950409504195042950439504495045950469504795048950499505095051950529505395054950559505695057950589505995060950619506295063950649506595066950679506895069950709507195072950739507495075950769507795078950799508095081950829508395084950859508695087950889508995090950919509295093950949509595096950979509895099951009510195102951039510495105951069510795108951099511095111951129511395114951159511695117951189511995120951219512295123951249512595126951279512895129951309513195132951339513495135951369513795138951399514095141951429514395144951459514695147951489514995150951519515295153951549515595156951579515895159951609516195162951639516495165951669516795168951699517095171951729517395174951759517695177951789517995180951819518295183951849518595186951879518895189951909519195192951939519495195951969519795198951999520095201952029520395204952059520695207952089520995210952119521295213952149521595216952179521895219952209522195222952239522495225952269522795228952299523095231952329523395234952359523695237952389523995240952419524295243952449524595246952479524895249952509525195252952539525495255952569525795258952599526095261952629526395264952659526695267952689526995270952719527295273952749527595276952779527895279952809528195282952839528495285952869528795288952899529095291952929529395294952959529695297952989529995300953019530295303953049530595306953079530895309953109531195312953139531495315953169531795318953199532095321953229532395324953259532695327953289532995330953319533295333953349533595336953379533895339953409534195342953439534495345953469534795348953499535095351953529535395354953559535695357953589535995360953619536295363953649536595366953679536895369953709537195372953739537495375953769537795378953799538095381953829538395384953859538695387953889538995390953919539295393953949539595396953979539895399954009540195402954039540495405954069540795408954099541095411954129541395414954159541695417954189541995420954219542295423954249542595426954279542895429954309543195432954339543495435954369543795438954399544095441954429544395444954459544695447954489544995450954519545295453954549545595456954579545895459954609546195462954639546495465954669546795468954699547095471954729547395474954759547695477954789547995480954819548295483954849548595486954879548895489954909549195492954939549495495954969549795498954999550095501955029550395504955059550695507955089550995510955119551295513955149551595516955179551895519955209552195522955239552495525955269552795528955299553095531955329553395534955359553695537955389553995540955419554295543955449554595546955479554895549955509555195552955539555495555955569555795558955599556095561955629556395564955659556695567955689556995570955719557295573955749557595576955779557895579955809558195582955839558495585955869558795588955899559095591955929559395594955959559695597955989559995600956019560295603956049560595606956079560895609956109561195612956139561495615956169561795618956199562095621956229562395624956259562695627956289562995630956319563295633956349563595636956379563895639956409564195642956439564495645956469564795648956499565095651956529565395654956559565695657956589565995660956619566295663956649566595666956679566895669956709567195672956739567495675956769567795678956799568095681956829568395684956859568695687956889568995690956919569295693956949569595696956979569895699957009570195702957039570495705957069570795708957099571095711957129571395714957159571695717957189571995720957219572295723957249572595726957279572895729957309573195732957339573495735957369573795738957399574095741957429574395744957459574695747957489574995750957519575295753957549575595756957579575895759957609576195762957639576495765957669576795768957699577095771957729577395774957759577695777957789577995780957819578295783957849578595786957879578895789957909579195792957939579495795957969579795798957999580095801958029580395804958059580695807958089580995810958119581295813958149581595816958179581895819958209582195822958239582495825958269582795828958299583095831958329583395834958359583695837958389583995840958419584295843958449584595846958479584895849958509585195852958539585495855958569585795858958599586095861958629586395864958659586695867958689586995870958719587295873958749587595876958779587895879958809588195882958839588495885958869588795888958899589095891958929589395894958959589695897958989589995900959019590295903959049590595906959079590895909959109591195912959139591495915959169591795918959199592095921959229592395924959259592695927959289592995930959319593295933959349593595936959379593895939959409594195942959439594495945959469594795948959499595095951959529595395954959559595695957959589595995960959619596295963959649596595966959679596895969959709597195972959739597495975959769597795978959799598095981959829598395984959859598695987959889598995990959919599295993959949599595996959979599895999960009600196002960039600496005960069600796008960099601096011960129601396014960159601696017960189601996020960219602296023960249602596026960279602896029960309603196032960339603496035960369603796038960399604096041960429604396044960459604696047960489604996050960519605296053960549605596056960579605896059960609606196062960639606496065960669606796068960699607096071960729607396074960759607696077960789607996080960819608296083960849608596086960879608896089960909609196092960939609496095960969609796098960999610096101961029610396104961059610696107961089610996110961119611296113961149611596116961179611896119961209612196122961239612496125961269612796128961299613096131961329613396134961359613696137961389613996140961419614296143961449614596146961479614896149961509615196152961539615496155961569615796158961599616096161961629616396164961659616696167961689616996170961719617296173961749617596176961779617896179961809618196182961839618496185961869618796188961899619096191961929619396194961959619696197961989619996200962019620296203962049620596206962079620896209962109621196212962139621496215962169621796218962199622096221962229622396224962259622696227962289622996230962319623296233962349623596236962379623896239962409624196242962439624496245962469624796248962499625096251962529625396254962559625696257962589625996260962619626296263962649626596266962679626896269962709627196272962739627496275962769627796278962799628096281962829628396284962859628696287962889628996290962919629296293962949629596296962979629896299963009630196302963039630496305963069630796308963099631096311963129631396314963159631696317963189631996320963219632296323963249632596326963279632896329963309633196332963339633496335963369633796338963399634096341963429634396344963459634696347963489634996350963519635296353963549635596356963579635896359963609636196362963639636496365963669636796368963699637096371963729637396374963759637696377963789637996380963819638296383963849638596386963879638896389963909639196392963939639496395963969639796398963999640096401964029640396404964059640696407964089640996410964119641296413964149641596416964179641896419964209642196422964239642496425964269642796428964299643096431964329643396434964359643696437964389643996440964419644296443964449644596446964479644896449964509645196452964539645496455964569645796458964599646096461964629646396464964659646696467964689646996470964719647296473964749647596476964779647896479964809648196482964839648496485964869648796488964899649096491964929649396494964959649696497964989649996500965019650296503965049650596506965079650896509965109651196512965139651496515965169651796518965199652096521965229652396524965259652696527965289652996530965319653296533965349653596536965379653896539965409654196542965439654496545965469654796548965499655096551965529655396554965559655696557965589655996560965619656296563965649656596566965679656896569965709657196572965739657496575965769657796578965799658096581965829658396584965859658696587965889658996590965919659296593965949659596596965979659896599966009660196602966039660496605966069660796608966099661096611966129661396614966159661696617966189661996620966219662296623966249662596626966279662896629966309663196632966339663496635966369663796638966399664096641966429664396644966459664696647966489664996650966519665296653966549665596656966579665896659966609666196662966639666496665966669666796668966699667096671966729667396674966759667696677966789667996680966819668296683966849668596686966879668896689966909669196692966939669496695966969669796698966999670096701967029670396704967059670696707967089670996710967119671296713967149671596716967179671896719967209672196722967239672496725967269672796728967299673096731967329673396734967359673696737967389673996740967419674296743967449674596746967479674896749967509675196752967539675496755967569675796758967599676096761967629676396764967659676696767967689676996770967719677296773967749677596776967779677896779967809678196782967839678496785967869678796788967899679096791967929679396794967959679696797967989679996800968019680296803968049680596806968079680896809968109681196812968139681496815968169681796818968199682096821968229682396824968259682696827968289682996830968319683296833968349683596836968379683896839968409684196842968439684496845968469684796848968499685096851968529685396854968559685696857968589685996860968619686296863968649686596866968679686896869968709687196872968739687496875968769687796878968799688096881968829688396884968859688696887968889688996890968919689296893968949689596896968979689896899969009690196902969039690496905969069690796908969099691096911969129691396914969159691696917969189691996920969219692296923969249692596926969279692896929969309693196932969339693496935969369693796938969399694096941969429694396944969459694696947969489694996950969519695296953969549695596956969579695896959969609696196962969639696496965969669696796968969699697096971969729697396974969759697696977969789697996980969819698296983969849698596986969879698896989969909699196992969939699496995969969699796998969999700097001970029700397004970059700697007970089700997010970119701297013970149701597016970179701897019970209702197022970239702497025970269702797028970299703097031970329703397034970359703697037970389703997040970419704297043970449704597046970479704897049970509705197052970539705497055970569705797058970599706097061970629706397064970659706697067970689706997070970719707297073970749707597076970779707897079970809708197082970839708497085970869708797088970899709097091970929709397094970959709697097970989709997100971019710297103971049710597106971079710897109971109711197112971139711497115971169711797118971199712097121971229712397124971259712697127971289712997130971319713297133971349713597136971379713897139971409714197142971439714497145971469714797148971499715097151971529715397154971559715697157971589715997160971619716297163971649716597166971679716897169971709717197172971739717497175971769717797178971799718097181971829718397184971859718697187971889718997190971919719297193971949719597196971979719897199972009720197202972039720497205972069720797208972099721097211972129721397214972159721697217972189721997220972219722297223972249722597226972279722897229972309723197232972339723497235972369723797238972399724097241972429724397244972459724697247972489724997250972519725297253972549725597256972579725897259972609726197262972639726497265972669726797268972699727097271972729727397274972759727697277972789727997280972819728297283972849728597286972879728897289972909729197292972939729497295972969729797298972999730097301973029730397304973059730697307973089730997310973119731297313973149731597316973179731897319973209732197322973239732497325973269732797328973299733097331973329733397334973359733697337973389733997340973419734297343973449734597346973479734897349973509735197352973539735497355973569735797358973599736097361973629736397364973659736697367973689736997370973719737297373973749737597376973779737897379973809738197382973839738497385973869738797388973899739097391973929739397394973959739697397973989739997400974019740297403974049740597406974079740897409974109741197412974139741497415974169741797418974199742097421974229742397424974259742697427974289742997430974319743297433974349743597436974379743897439974409744197442974439744497445974469744797448974499745097451974529745397454974559745697457974589745997460974619746297463974649746597466974679746897469974709747197472974739747497475974769747797478974799748097481974829748397484974859748697487974889748997490974919749297493974949749597496974979749897499975009750197502975039750497505975069750797508975099751097511975129751397514975159751697517975189751997520975219752297523975249752597526975279752897529975309753197532975339753497535975369753797538975399754097541975429754397544975459754697547975489754997550975519755297553975549755597556975579755897559975609756197562975639756497565975669756797568975699757097571975729757397574975759757697577975789757997580975819758297583975849758597586975879758897589975909759197592975939759497595975969759797598975999760097601976029760397604976059760697607976089760997610976119761297613976149761597616976179761897619976209762197622976239762497625976269762797628976299763097631976329763397634976359763697637976389763997640976419764297643976449764597646976479764897649976509765197652976539765497655976569765797658976599766097661976629766397664976659766697667976689766997670976719767297673976749767597676976779767897679976809768197682976839768497685976869768797688976899769097691976929769397694976959769697697976989769997700977019770297703977049770597706977079770897709977109771197712977139771497715977169771797718977199772097721977229772397724977259772697727977289772997730977319773297733977349773597736977379773897739977409774197742977439774497745977469774797748977499775097751977529775397754977559775697757977589775997760977619776297763977649776597766977679776897769977709777197772977739777497775977769777797778977799778097781977829778397784977859778697787977889778997790977919779297793977949779597796977979779897799978009780197802978039780497805978069780797808978099781097811978129781397814978159781697817978189781997820978219782297823978249782597826978279782897829978309783197832978339783497835978369783797838978399784097841978429784397844978459784697847978489784997850978519785297853978549785597856978579785897859978609786197862978639786497865978669786797868978699787097871978729787397874978759787697877978789787997880978819788297883978849788597886978879788897889978909789197892978939789497895978969789797898978999790097901979029790397904979059790697907979089790997910979119791297913979149791597916979179791897919979209792197922979239792497925979269792797928979299793097931979329793397934979359793697937979389793997940979419794297943979449794597946979479794897949979509795197952979539795497955979569795797958979599796097961979629796397964979659796697967979689796997970979719797297973979749797597976979779797897979979809798197982979839798497985979869798797988979899799097991979929799397994979959799697997979989799998000980019800298003980049800598006980079800898009980109801198012980139801498015980169801798018980199802098021980229802398024980259802698027980289802998030980319803298033980349803598036980379803898039980409804198042980439804498045980469804798048980499805098051980529805398054980559805698057980589805998060980619806298063980649806598066980679806898069980709807198072980739807498075980769807798078980799808098081980829808398084980859808698087980889808998090980919809298093980949809598096980979809898099981009810198102981039810498105981069810798108981099811098111981129811398114981159811698117981189811998120981219812298123981249812598126981279812898129981309813198132981339813498135981369813798138981399814098141981429814398144981459814698147981489814998150981519815298153981549815598156981579815898159981609816198162981639816498165981669816798168981699817098171981729817398174981759817698177981789817998180981819818298183981849818598186981879818898189981909819198192981939819498195981969819798198981999820098201982029820398204982059820698207982089820998210982119821298213982149821598216982179821898219982209822198222982239822498225982269822798228982299823098231982329823398234982359823698237982389823998240982419824298243982449824598246982479824898249982509825198252982539825498255982569825798258982599826098261982629826398264982659826698267982689826998270982719827298273982749827598276982779827898279982809828198282982839828498285982869828798288982899829098291982929829398294982959829698297982989829998300983019830298303983049830598306983079830898309983109831198312983139831498315983169831798318983199832098321983229832398324983259832698327983289832998330983319833298333983349833598336983379833898339983409834198342
  1. /*!
  2. *
  3. * iclient-leaflet.(https://iclient.supermap.io)
  4. * Copyright© 2000 - 2021 SuperMap Software Co.Ltd
  5. * license: Apache-2.0
  6. * version: v10.1.1
  7. *
  8. */
  9. /******/ (() => { // webpackBootstrap
  10. /******/ var __webpack_modules__ = ({
  11. /***/ 550:
  12. /***/ ((module) => {
  13. "use strict";
  14. module.exports = Point;
  15. /**
  16. * A standalone point geometry with useful accessor, comparison, and
  17. * modification methods.
  18. *
  19. * @class Point
  20. * @param {Number} x the x-coordinate. this could be longitude or screen
  21. * pixels, or any other sort of unit.
  22. * @param {Number} y the y-coordinate. this could be latitude or screen
  23. * pixels, or any other sort of unit.
  24. * @example
  25. * var point = new Point(-77, 38);
  26. */
  27. function Point(x, y) {
  28. this.x = x;
  29. this.y = y;
  30. }
  31. Point.prototype = {
  32. /**
  33. * Clone this point, returning a new point that can be modified
  34. * without affecting the old one.
  35. * @return {Point} the clone
  36. */
  37. clone: function() { return new Point(this.x, this.y); },
  38. /**
  39. * Add this point's x & y coordinates to another point,
  40. * yielding a new point.
  41. * @param {Point} p the other point
  42. * @return {Point} output point
  43. */
  44. add: function(p) { return this.clone()._add(p); },
  45. /**
  46. * Subtract this point's x & y coordinates to from point,
  47. * yielding a new point.
  48. * @param {Point} p the other point
  49. * @return {Point} output point
  50. */
  51. sub: function(p) { return this.clone()._sub(p); },
  52. /**
  53. * Multiply this point's x & y coordinates by point,
  54. * yielding a new point.
  55. * @param {Point} p the other point
  56. * @return {Point} output point
  57. */
  58. multByPoint: function(p) { return this.clone()._multByPoint(p); },
  59. /**
  60. * Divide this point's x & y coordinates by point,
  61. * yielding a new point.
  62. * @param {Point} p the other point
  63. * @return {Point} output point
  64. */
  65. divByPoint: function(p) { return this.clone()._divByPoint(p); },
  66. /**
  67. * Multiply this point's x & y coordinates by a factor,
  68. * yielding a new point.
  69. * @param {Point} k factor
  70. * @return {Point} output point
  71. */
  72. mult: function(k) { return this.clone()._mult(k); },
  73. /**
  74. * Divide this point's x & y coordinates by a factor,
  75. * yielding a new point.
  76. * @param {Point} k factor
  77. * @return {Point} output point
  78. */
  79. div: function(k) { return this.clone()._div(k); },
  80. /**
  81. * Rotate this point around the 0, 0 origin by an angle a,
  82. * given in radians
  83. * @param {Number} a angle to rotate around, in radians
  84. * @return {Point} output point
  85. */
  86. rotate: function(a) { return this.clone()._rotate(a); },
  87. /**
  88. * Rotate this point around p point by an angle a,
  89. * given in radians
  90. * @param {Number} a angle to rotate around, in radians
  91. * @param {Point} p Point to rotate around
  92. * @return {Point} output point
  93. */
  94. rotateAround: function(a,p) { return this.clone()._rotateAround(a,p); },
  95. /**
  96. * Multiply this point by a 4x1 transformation matrix
  97. * @param {Array<Number>} m transformation matrix
  98. * @return {Point} output point
  99. */
  100. matMult: function(m) { return this.clone()._matMult(m); },
  101. /**
  102. * Calculate this point but as a unit vector from 0, 0, meaning
  103. * that the distance from the resulting point to the 0, 0
  104. * coordinate will be equal to 1 and the angle from the resulting
  105. * point to the 0, 0 coordinate will be the same as before.
  106. * @return {Point} unit vector point
  107. */
  108. unit: function() { return this.clone()._unit(); },
  109. /**
  110. * Compute a perpendicular point, where the new y coordinate
  111. * is the old x coordinate and the new x coordinate is the old y
  112. * coordinate multiplied by -1
  113. * @return {Point} perpendicular point
  114. */
  115. perp: function() { return this.clone()._perp(); },
  116. /**
  117. * Return a version of this point with the x & y coordinates
  118. * rounded to integers.
  119. * @return {Point} rounded point
  120. */
  121. round: function() { return this.clone()._round(); },
  122. /**
  123. * Return the magitude of this point: this is the Euclidean
  124. * distance from the 0, 0 coordinate to this point's x and y
  125. * coordinates.
  126. * @return {Number} magnitude
  127. */
  128. mag: function() {
  129. return Math.sqrt(this.x * this.x + this.y * this.y);
  130. },
  131. /**
  132. * Judge whether this point is equal to another point, returning
  133. * true or false.
  134. * @param {Point} other the other point
  135. * @return {boolean} whether the points are equal
  136. */
  137. equals: function(other) {
  138. return this.x === other.x &&
  139. this.y === other.y;
  140. },
  141. /**
  142. * Calculate the distance from this point to another point
  143. * @param {Point} p the other point
  144. * @return {Number} distance
  145. */
  146. dist: function(p) {
  147. return Math.sqrt(this.distSqr(p));
  148. },
  149. /**
  150. * Calculate the distance from this point to another point,
  151. * without the square root step. Useful if you're comparing
  152. * relative distances.
  153. * @param {Point} p the other point
  154. * @return {Number} distance
  155. */
  156. distSqr: function(p) {
  157. var dx = p.x - this.x,
  158. dy = p.y - this.y;
  159. return dx * dx + dy * dy;
  160. },
  161. /**
  162. * Get the angle from the 0, 0 coordinate to this point, in radians
  163. * coordinates.
  164. * @return {Number} angle
  165. */
  166. angle: function() {
  167. return Math.atan2(this.y, this.x);
  168. },
  169. /**
  170. * Get the angle from this point to another point, in radians
  171. * @param {Point} b the other point
  172. * @return {Number} angle
  173. */
  174. angleTo: function(b) {
  175. return Math.atan2(this.y - b.y, this.x - b.x);
  176. },
  177. /**
  178. * Get the angle between this point and another point, in radians
  179. * @param {Point} b the other point
  180. * @return {Number} angle
  181. */
  182. angleWith: function(b) {
  183. return this.angleWithSep(b.x, b.y);
  184. },
  185. /*
  186. * Find the angle of the two vectors, solving the formula for
  187. * the cross product a x b = |a||b|sin(θ) for θ.
  188. * @param {Number} x the x-coordinate
  189. * @param {Number} y the y-coordinate
  190. * @return {Number} the angle in radians
  191. */
  192. angleWithSep: function(x, y) {
  193. return Math.atan2(
  194. this.x * y - this.y * x,
  195. this.x * x + this.y * y);
  196. },
  197. _matMult: function(m) {
  198. var x = m[0] * this.x + m[1] * this.y,
  199. y = m[2] * this.x + m[3] * this.y;
  200. this.x = x;
  201. this.y = y;
  202. return this;
  203. },
  204. _add: function(p) {
  205. this.x += p.x;
  206. this.y += p.y;
  207. return this;
  208. },
  209. _sub: function(p) {
  210. this.x -= p.x;
  211. this.y -= p.y;
  212. return this;
  213. },
  214. _mult: function(k) {
  215. this.x *= k;
  216. this.y *= k;
  217. return this;
  218. },
  219. _div: function(k) {
  220. this.x /= k;
  221. this.y /= k;
  222. return this;
  223. },
  224. _multByPoint: function(p) {
  225. this.x *= p.x;
  226. this.y *= p.y;
  227. return this;
  228. },
  229. _divByPoint: function(p) {
  230. this.x /= p.x;
  231. this.y /= p.y;
  232. return this;
  233. },
  234. _unit: function() {
  235. this._div(this.mag());
  236. return this;
  237. },
  238. _perp: function() {
  239. var y = this.y;
  240. this.y = this.x;
  241. this.x = -y;
  242. return this;
  243. },
  244. _rotate: function(angle) {
  245. var cos = Math.cos(angle),
  246. sin = Math.sin(angle),
  247. x = cos * this.x - sin * this.y,
  248. y = sin * this.x + cos * this.y;
  249. this.x = x;
  250. this.y = y;
  251. return this;
  252. },
  253. _rotateAround: function(angle, p) {
  254. var cos = Math.cos(angle),
  255. sin = Math.sin(angle),
  256. x = p.x + cos * (this.x - p.x) - sin * (this.y - p.y),
  257. y = p.y + sin * (this.x - p.x) + cos * (this.y - p.y);
  258. this.x = x;
  259. this.y = y;
  260. return this;
  261. },
  262. _round: function() {
  263. this.x = Math.round(this.x);
  264. this.y = Math.round(this.y);
  265. return this;
  266. }
  267. };
  268. /**
  269. * Construct a point from an array if necessary, otherwise if the input
  270. * is already a Point, or an unknown type, return it unchanged
  271. * @param {Array<Number>|Point|*} a any kind of input value
  272. * @return {Point} constructed point, or passed-through value.
  273. * @example
  274. * // this
  275. * var point = Point.convert([0, 1]);
  276. * // is equivalent to
  277. * var point = new Point(0, 1);
  278. */
  279. Point.convert = function (a) {
  280. if (a instanceof Point) {
  281. return a;
  282. }
  283. if (Array.isArray(a)) {
  284. return new Point(a[0], a[1]);
  285. }
  286. return a;
  287. };
  288. /***/ }),
  289. /***/ 929:
  290. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  291. module.exports.VectorTile = __webpack_require__(779);
  292. /* unused reexport */ __webpack_require__(24);
  293. /* unused reexport */ __webpack_require__(701);
  294. /***/ }),
  295. /***/ 779:
  296. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  297. "use strict";
  298. var VectorTileLayer = __webpack_require__(701);
  299. module.exports = VectorTile;
  300. function VectorTile(pbf, end) {
  301. this.layers = pbf.readFields(readTile, {}, end);
  302. }
  303. function readTile(tag, layers, pbf) {
  304. if (tag === 3) {
  305. var layer = new VectorTileLayer(pbf, pbf.readVarint() + pbf.pos);
  306. if (layer.length) layers[layer.name] = layer;
  307. }
  308. }
  309. /***/ }),
  310. /***/ 24:
  311. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  312. "use strict";
  313. var Point = __webpack_require__(550);
  314. module.exports = VectorTileFeature;
  315. function VectorTileFeature(pbf, end, extent, keys, values) {
  316. // Public
  317. this.properties = {};
  318. this.extent = extent;
  319. this.type = 0;
  320. // Private
  321. this._pbf = pbf;
  322. this._geometry = -1;
  323. this._keys = keys;
  324. this._values = values;
  325. pbf.readFields(readFeature, this, end);
  326. }
  327. function readFeature(tag, feature, pbf) {
  328. if (tag == 1) feature.id = pbf.readVarint();
  329. else if (tag == 2) readTag(pbf, feature);
  330. else if (tag == 3) feature.type = pbf.readVarint();
  331. else if (tag == 4) feature._geometry = pbf.pos;
  332. }
  333. function readTag(pbf, feature) {
  334. var end = pbf.readVarint() + pbf.pos;
  335. while (pbf.pos < end) {
  336. var key = feature._keys[pbf.readVarint()],
  337. value = feature._values[pbf.readVarint()];
  338. feature.properties[key] = value;
  339. }
  340. }
  341. VectorTileFeature.types = ['Unknown', 'Point', 'LineString', 'Polygon'];
  342. VectorTileFeature.prototype.loadGeometry = function() {
  343. var pbf = this._pbf;
  344. pbf.pos = this._geometry;
  345. var end = pbf.readVarint() + pbf.pos,
  346. cmd = 1,
  347. length = 0,
  348. x = 0,
  349. y = 0,
  350. lines = [],
  351. line;
  352. while (pbf.pos < end) {
  353. if (length <= 0) {
  354. var cmdLen = pbf.readVarint();
  355. cmd = cmdLen & 0x7;
  356. length = cmdLen >> 3;
  357. }
  358. length--;
  359. if (cmd === 1 || cmd === 2) {
  360. x += pbf.readSVarint();
  361. y += pbf.readSVarint();
  362. if (cmd === 1) { // moveTo
  363. if (line) lines.push(line);
  364. line = [];
  365. }
  366. line.push(new Point(x, y));
  367. } else if (cmd === 7) {
  368. // Workaround for https://github.com/mapbox/mapnik-vector-tile/issues/90
  369. if (line) {
  370. line.push(line[0].clone()); // closePolygon
  371. }
  372. } else {
  373. throw new Error('unknown command ' + cmd);
  374. }
  375. }
  376. if (line) lines.push(line);
  377. return lines;
  378. };
  379. VectorTileFeature.prototype.bbox = function() {
  380. var pbf = this._pbf;
  381. pbf.pos = this._geometry;
  382. var end = pbf.readVarint() + pbf.pos,
  383. cmd = 1,
  384. length = 0,
  385. x = 0,
  386. y = 0,
  387. x1 = Infinity,
  388. x2 = -Infinity,
  389. y1 = Infinity,
  390. y2 = -Infinity;
  391. while (pbf.pos < end) {
  392. if (length <= 0) {
  393. var cmdLen = pbf.readVarint();
  394. cmd = cmdLen & 0x7;
  395. length = cmdLen >> 3;
  396. }
  397. length--;
  398. if (cmd === 1 || cmd === 2) {
  399. x += pbf.readSVarint();
  400. y += pbf.readSVarint();
  401. if (x < x1) x1 = x;
  402. if (x > x2) x2 = x;
  403. if (y < y1) y1 = y;
  404. if (y > y2) y2 = y;
  405. } else if (cmd !== 7) {
  406. throw new Error('unknown command ' + cmd);
  407. }
  408. }
  409. return [x1, y1, x2, y2];
  410. };
  411. VectorTileFeature.prototype.toGeoJSON = function(x, y, z) {
  412. var size = this.extent * Math.pow(2, z),
  413. x0 = this.extent * x,
  414. y0 = this.extent * y,
  415. coords = this.loadGeometry(),
  416. type = VectorTileFeature.types[this.type],
  417. i, j;
  418. function project(line) {
  419. for (var j = 0; j < line.length; j++) {
  420. var p = line[j], y2 = 180 - (p.y + y0) * 360 / size;
  421. line[j] = [
  422. (p.x + x0) * 360 / size - 180,
  423. 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90
  424. ];
  425. }
  426. }
  427. switch (this.type) {
  428. case 1:
  429. var points = [];
  430. for (i = 0; i < coords.length; i++) {
  431. points[i] = coords[i][0];
  432. }
  433. coords = points;
  434. project(coords);
  435. break;
  436. case 2:
  437. for (i = 0; i < coords.length; i++) {
  438. project(coords[i]);
  439. }
  440. break;
  441. case 3:
  442. coords = classifyRings(coords);
  443. for (i = 0; i < coords.length; i++) {
  444. for (j = 0; j < coords[i].length; j++) {
  445. project(coords[i][j]);
  446. }
  447. }
  448. break;
  449. }
  450. if (coords.length === 1) {
  451. coords = coords[0];
  452. } else {
  453. type = 'Multi' + type;
  454. }
  455. var result = {
  456. type: "Feature",
  457. geometry: {
  458. type: type,
  459. coordinates: coords
  460. },
  461. properties: this.properties
  462. };
  463. if ('id' in this) {
  464. result.id = this.id;
  465. }
  466. return result;
  467. };
  468. // classifies an array of rings into polygons with outer rings and holes
  469. function classifyRings(rings) {
  470. var len = rings.length;
  471. if (len <= 1) return [rings];
  472. var polygons = [],
  473. polygon,
  474. ccw;
  475. for (var i = 0; i < len; i++) {
  476. var area = signedArea(rings[i]);
  477. if (area === 0) continue;
  478. if (ccw === undefined) ccw = area < 0;
  479. if (ccw === area < 0) {
  480. if (polygon) polygons.push(polygon);
  481. polygon = [rings[i]];
  482. } else {
  483. polygon.push(rings[i]);
  484. }
  485. }
  486. if (polygon) polygons.push(polygon);
  487. return polygons;
  488. }
  489. function signedArea(ring) {
  490. var sum = 0;
  491. for (var i = 0, len = ring.length, j = len - 1, p1, p2; i < len; j = i++) {
  492. p1 = ring[i];
  493. p2 = ring[j];
  494. sum += (p2.x - p1.x) * (p1.y + p2.y);
  495. }
  496. return sum;
  497. }
  498. /***/ }),
  499. /***/ 701:
  500. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  501. "use strict";
  502. var VectorTileFeature = __webpack_require__(24);
  503. module.exports = VectorTileLayer;
  504. function VectorTileLayer(pbf, end) {
  505. // Public
  506. this.version = 1;
  507. this.name = null;
  508. this.extent = 4096;
  509. this.length = 0;
  510. // Private
  511. this._pbf = pbf;
  512. this._keys = [];
  513. this._values = [];
  514. this._features = [];
  515. pbf.readFields(readLayer, this, end);
  516. this.length = this._features.length;
  517. }
  518. function readLayer(tag, layer, pbf) {
  519. if (tag === 15) layer.version = pbf.readVarint();
  520. else if (tag === 1) layer.name = pbf.readString();
  521. else if (tag === 5) layer.extent = pbf.readVarint();
  522. else if (tag === 2) layer._features.push(pbf.pos);
  523. else if (tag === 3) layer._keys.push(pbf.readString());
  524. else if (tag === 4) layer._values.push(readValueMessage(pbf));
  525. }
  526. function readValueMessage(pbf) {
  527. var value = null,
  528. end = pbf.readVarint() + pbf.pos;
  529. while (pbf.pos < end) {
  530. var tag = pbf.readVarint() >> 3;
  531. value = tag === 1 ? pbf.readString() :
  532. tag === 2 ? pbf.readFloat() :
  533. tag === 3 ? pbf.readDouble() :
  534. tag === 4 ? pbf.readVarint64() :
  535. tag === 5 ? pbf.readVarint() :
  536. tag === 6 ? pbf.readSVarint() :
  537. tag === 7 ? pbf.readBoolean() : null;
  538. }
  539. return value;
  540. }
  541. // return feature `i` from this layer as a `VectorTileFeature`
  542. VectorTileLayer.prototype.feature = function(i) {
  543. if (i < 0 || i >= this._features.length) throw new Error('feature index out of bounds');
  544. this._pbf.pos = this._features[i];
  545. var end = this._pbf.readVarint() + this._pbf.pos;
  546. return new VectorTileFeature(this._pbf, end, this.extent, this._keys, this._values);
  547. };
  548. /***/ }),
  549. /***/ 693:
  550. /***/ (function(module) {
  551. (function(self) {
  552. 'use strict';
  553. // if __disableNativeFetch is set to true, the it will always polyfill fetch
  554. // with Ajax.
  555. if (!self.__disableNativeFetch && self.fetch) {
  556. return
  557. }
  558. function normalizeName(name) {
  559. if (typeof name !== 'string') {
  560. name = String(name)
  561. }
  562. if (/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)) {
  563. throw new TypeError('Invalid character in header field name')
  564. }
  565. return name.toLowerCase()
  566. }
  567. function normalizeValue(value) {
  568. if (typeof value !== 'string') {
  569. value = String(value)
  570. }
  571. return value
  572. }
  573. function Headers(headers) {
  574. this.map = {}
  575. if (headers instanceof Headers) {
  576. headers.forEach(function(value, name) {
  577. this.append(name, value)
  578. }, this)
  579. } else if (headers) {
  580. Object.getOwnPropertyNames(headers).forEach(function(name) {
  581. this.append(name, headers[name])
  582. }, this)
  583. }
  584. }
  585. Headers.prototype.append = function(name, value) {
  586. name = normalizeName(name)
  587. value = normalizeValue(value)
  588. var list = this.map[name]
  589. if (!list) {
  590. list = []
  591. this.map[name] = list
  592. }
  593. list.push(value)
  594. }
  595. Headers.prototype['delete'] = function(name) {
  596. delete this.map[normalizeName(name)]
  597. }
  598. Headers.prototype.get = function(name) {
  599. var values = this.map[normalizeName(name)]
  600. return values ? values[0] : null
  601. }
  602. Headers.prototype.getAll = function(name) {
  603. return this.map[normalizeName(name)] || []
  604. }
  605. Headers.prototype.has = function(name) {
  606. return this.map.hasOwnProperty(normalizeName(name))
  607. }
  608. Headers.prototype.set = function(name, value) {
  609. this.map[normalizeName(name)] = [normalizeValue(value)]
  610. }
  611. Headers.prototype.forEach = function(callback, thisArg) {
  612. Object.getOwnPropertyNames(this.map).forEach(function(name) {
  613. this.map[name].forEach(function(value) {
  614. callback.call(thisArg, value, name, this)
  615. }, this)
  616. }, this)
  617. }
  618. function consumed(body) {
  619. if (body.bodyUsed) {
  620. return Promise.reject(new TypeError('Already read'))
  621. }
  622. body.bodyUsed = true
  623. }
  624. function fileReaderReady(reader) {
  625. return new Promise(function(resolve, reject) {
  626. reader.onload = function() {
  627. resolve(reader.result)
  628. }
  629. reader.onerror = function() {
  630. reject(reader.error)
  631. }
  632. })
  633. }
  634. function readBlobAsArrayBuffer(blob) {
  635. var reader = new FileReader()
  636. reader.readAsArrayBuffer(blob)
  637. return fileReaderReady(reader)
  638. }
  639. function readBlobAsText(blob, options) {
  640. var reader = new FileReader()
  641. var contentType = options.headers.map['content-type'] ? options.headers.map['content-type'].toString() : ''
  642. var regex = /charset\=[0-9a-zA-Z\-\_]*;?/
  643. var _charset = blob.type.match(regex) || contentType.match(regex)
  644. var args = [blob]
  645. if(_charset) {
  646. args.push(_charset[0].replace(/^charset\=/, '').replace(/;$/, ''))
  647. }
  648. reader.readAsText.apply(reader, args)
  649. return fileReaderReady(reader)
  650. }
  651. var support = {
  652. blob: 'FileReader' in self && 'Blob' in self && (function() {
  653. try {
  654. new Blob();
  655. return true
  656. } catch(e) {
  657. return false
  658. }
  659. })(),
  660. formData: 'FormData' in self,
  661. arrayBuffer: 'ArrayBuffer' in self
  662. }
  663. function Body() {
  664. this.bodyUsed = false
  665. this._initBody = function(body, options) {
  666. this._bodyInit = body
  667. if (typeof body === 'string') {
  668. this._bodyText = body
  669. } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
  670. this._bodyBlob = body
  671. this._options = options
  672. } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
  673. this._bodyFormData = body
  674. } else if (!body) {
  675. this._bodyText = ''
  676. } else if (support.arrayBuffer && ArrayBuffer.prototype.isPrototypeOf(body)) {
  677. // Only support ArrayBuffers for POST method.
  678. // Receiving ArrayBuffers happens via Blobs, instead.
  679. } else {
  680. throw new Error('unsupported BodyInit type')
  681. }
  682. }
  683. if (support.blob) {
  684. this.blob = function() {
  685. var rejected = consumed(this)
  686. if (rejected) {
  687. return rejected
  688. }
  689. if (this._bodyBlob) {
  690. return Promise.resolve(this._bodyBlob)
  691. } else if (this._bodyFormData) {
  692. throw new Error('could not read FormData body as blob')
  693. } else {
  694. return Promise.resolve(new Blob([this._bodyText]))
  695. }
  696. }
  697. this.arrayBuffer = function() {
  698. return this.blob().then(readBlobAsArrayBuffer)
  699. }
  700. this.text = function() {
  701. var rejected = consumed(this)
  702. if (rejected) {
  703. return rejected
  704. }
  705. if (this._bodyBlob) {
  706. return readBlobAsText(this._bodyBlob, this._options)
  707. } else if (this._bodyFormData) {
  708. throw new Error('could not read FormData body as text')
  709. } else {
  710. return Promise.resolve(this._bodyText)
  711. }
  712. }
  713. } else {
  714. this.text = function() {
  715. var rejected = consumed(this)
  716. return rejected ? rejected : Promise.resolve(this._bodyText)
  717. }
  718. }
  719. if (support.formData) {
  720. this.formData = function() {
  721. return this.text().then(decode)
  722. }
  723. }
  724. this.json = function() {
  725. return this.text().then(JSON.parse)
  726. }
  727. return this
  728. }
  729. // HTTP methods whose capitalization should be normalized
  730. var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']
  731. function normalizeMethod(method) {
  732. var upcased = method.toUpperCase()
  733. return (methods.indexOf(upcased) > -1) ? upcased : method
  734. }
  735. function Request(input, options) {
  736. options = options || {}
  737. var body = options.body
  738. if (Request.prototype.isPrototypeOf(input)) {
  739. if (input.bodyUsed) {
  740. throw new TypeError('Already read')
  741. }
  742. this.url = input.url
  743. this.credentials = input.credentials
  744. if (!options.headers) {
  745. this.headers = new Headers(input.headers)
  746. }
  747. this.method = input.method
  748. this.mode = input.mode
  749. if (!body) {
  750. body = input._bodyInit
  751. input.bodyUsed = true
  752. }
  753. } else {
  754. this.url = input
  755. }
  756. this.credentials = options.credentials || this.credentials || 'omit'
  757. if (options.headers || !this.headers) {
  758. this.headers = new Headers(options.headers)
  759. }
  760. this.method = normalizeMethod(options.method || this.method || 'GET')
  761. this.mode = options.mode || this.mode || null
  762. this.referrer = null
  763. if ((this.method === 'GET' || this.method === 'HEAD') && body) {
  764. throw new TypeError('Body not allowed for GET or HEAD requests')
  765. }
  766. this._initBody(body, options)
  767. }
  768. Request.prototype.clone = function() {
  769. return new Request(this)
  770. }
  771. function decode(body) {
  772. var form = new FormData()
  773. body.trim().split('&').forEach(function(bytes) {
  774. if (bytes) {
  775. var split = bytes.split('=')
  776. var name = split.shift().replace(/\+/g, ' ')
  777. var value = split.join('=').replace(/\+/g, ' ')
  778. form.append(decodeURIComponent(name), decodeURIComponent(value))
  779. }
  780. })
  781. return form
  782. }
  783. function headers(xhr) {
  784. var head = new Headers()
  785. var pairs = xhr.getAllResponseHeaders().trim().split('\n')
  786. pairs.forEach(function(header) {
  787. var split = header.trim().split(':')
  788. var key = split.shift().trim()
  789. var value = split.join(':').trim()
  790. head.append(key, value)
  791. })
  792. return head
  793. }
  794. Body.call(Request.prototype)
  795. function Response(bodyInit, options) {
  796. if (!options) {
  797. options = {}
  798. }
  799. this._initBody(bodyInit, options)
  800. this.type = 'default'
  801. this.status = options.status
  802. this.ok = this.status >= 200 && this.status < 300
  803. this.statusText = options.statusText
  804. this.headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers)
  805. this.url = options.url || ''
  806. }
  807. Body.call(Response.prototype)
  808. Response.prototype.clone = function() {
  809. return new Response(this._bodyInit, {
  810. status: this.status,
  811. statusText: this.statusText,
  812. headers: new Headers(this.headers),
  813. url: this.url
  814. })
  815. }
  816. Response.error = function() {
  817. var response = new Response(null, {status: 0, statusText: ''})
  818. response.type = 'error'
  819. return response
  820. }
  821. var redirectStatuses = [301, 302, 303, 307, 308]
  822. Response.redirect = function(url, status) {
  823. if (redirectStatuses.indexOf(status) === -1) {
  824. throw new RangeError('Invalid status code')
  825. }
  826. return new Response(null, {status: status, headers: {location: url}})
  827. }
  828. self.Headers = Headers;
  829. self.Request = Request;
  830. self.Response = Response;
  831. self.fetch = function(input, init) {
  832. return new Promise(function(resolve, reject) {
  833. var request
  834. if (Request.prototype.isPrototypeOf(input) && !init) {
  835. request = input
  836. } else {
  837. request = new Request(input, init)
  838. }
  839. var xhr = new XMLHttpRequest()
  840. function responseURL() {
  841. if ('responseURL' in xhr) {
  842. return xhr.responseURL
  843. }
  844. // Avoid security warnings on getResponseHeader when not allowed by CORS
  845. if (/^X-Request-URL:/m.test(xhr.getAllResponseHeaders())) {
  846. return xhr.getResponseHeader('X-Request-URL')
  847. }
  848. return;
  849. }
  850. var __onLoadHandled = false;
  851. function onload() {
  852. if (xhr.readyState !== 4) {
  853. return
  854. }
  855. var status = (xhr.status === 1223) ? 204 : xhr.status
  856. if (status < 100 || status > 599) {
  857. if (__onLoadHandled) { return; } else { __onLoadHandled = true; }
  858. reject(new TypeError('Network request failed'))
  859. return
  860. }
  861. var options = {
  862. status: status,
  863. statusText: xhr.statusText,
  864. headers: headers(xhr),
  865. url: responseURL()
  866. }
  867. var body = 'response' in xhr ? xhr.response : xhr.responseText;
  868. if (__onLoadHandled) { return; } else { __onLoadHandled = true; }
  869. resolve(new Response(body, options))
  870. }
  871. xhr.onreadystatechange = onload;
  872. xhr.onload = onload;
  873. xhr.onerror = function() {
  874. if (__onLoadHandled) { return; } else { __onLoadHandled = true; }
  875. reject(new TypeError('Network request failed'))
  876. }
  877. xhr.open(request.method, request.url, true)
  878. // `withCredentials` should be setted after calling `.open` in IE10
  879. // http://stackoverflow.com/a/19667959/1219343
  880. try {
  881. if (request.credentials === 'include') {
  882. if ('withCredentials' in xhr) {
  883. xhr.withCredentials = true;
  884. } else {
  885. console && console.warn && console.warn('withCredentials is not supported, you can ignore this warning');
  886. }
  887. }
  888. } catch (e) {
  889. console && console.warn && console.warn('set withCredentials error:' + e);
  890. }
  891. if ('responseType' in xhr && support.blob) {
  892. xhr.responseType = 'blob'
  893. }
  894. request.headers.forEach(function(value, name) {
  895. xhr.setRequestHeader(name, value)
  896. })
  897. xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)
  898. })
  899. }
  900. self.fetch.polyfill = true
  901. // Support CommonJS
  902. if ( true && module.exports) {
  903. module.exports = self.fetch;
  904. }
  905. })(typeof self !== 'undefined' ? self : this);
  906. /***/ }),
  907. /***/ 144:
  908. /***/ (function(module, exports) {
  909. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
  910. if (true) {
  911. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, module], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  912. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  913. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  914. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  915. } else { var mod; }
  916. })(this, function (exports, module) {
  917. 'use strict';
  918. var defaultOptions = {
  919. timeout: 5000,
  920. jsonpCallback: 'callback',
  921. jsonpCallbackFunction: null
  922. };
  923. function generateCallbackFunction() {
  924. return 'jsonp_' + Date.now() + '_' + Math.ceil(Math.random() * 100000);
  925. }
  926. function clearFunction(functionName) {
  927. // IE8 throws an exception when you try to delete a property on window
  928. // http://stackoverflow.com/a/1824228/751089
  929. try {
  930. delete window[functionName];
  931. } catch (e) {
  932. window[functionName] = undefined;
  933. }
  934. }
  935. function removeScript(scriptId) {
  936. var script = document.getElementById(scriptId);
  937. if (script) {
  938. document.getElementsByTagName('head')[0].removeChild(script);
  939. }
  940. }
  941. function fetchJsonp(_url) {
  942. var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
  943. // to avoid param reassign
  944. var url = _url;
  945. var timeout = options.timeout || defaultOptions.timeout;
  946. var jsonpCallback = options.jsonpCallback || defaultOptions.jsonpCallback;
  947. var timeoutId = undefined;
  948. return new Promise(function (resolve, reject) {
  949. var callbackFunction = options.jsonpCallbackFunction || generateCallbackFunction();
  950. var scriptId = jsonpCallback + '_' + callbackFunction;
  951. window[callbackFunction] = function (response) {
  952. resolve({
  953. ok: true,
  954. // keep consistent with fetch API
  955. json: function json() {
  956. return Promise.resolve(response);
  957. }
  958. });
  959. if (timeoutId) clearTimeout(timeoutId);
  960. removeScript(scriptId);
  961. clearFunction(callbackFunction);
  962. };
  963. // Check if the user set their own params, and if not add a ? to start a list of params
  964. url += url.indexOf('?') === -1 ? '?' : '&';
  965. var jsonpScript = document.createElement('script');
  966. jsonpScript.setAttribute('src', '' + url + jsonpCallback + '=' + callbackFunction);
  967. if (options.charset) {
  968. jsonpScript.setAttribute('charset', options.charset);
  969. }
  970. jsonpScript.id = scriptId;
  971. document.getElementsByTagName('head')[0].appendChild(jsonpScript);
  972. timeoutId = setTimeout(function () {
  973. reject(new Error('JSONP request to ' + _url + ' timed out'));
  974. clearFunction(callbackFunction);
  975. removeScript(scriptId);
  976. window[callbackFunction] = function () {
  977. clearFunction(callbackFunction);
  978. };
  979. }, timeout);
  980. // Caught if got 404/500
  981. jsonpScript.onerror = function () {
  982. reject(new Error('JSONP request to ' + _url + ' failed'));
  983. clearFunction(callbackFunction);
  984. removeScript(scriptId);
  985. if (timeoutId) clearTimeout(timeoutId);
  986. };
  987. });
  988. }
  989. // export as global function
  990. /*
  991. let local;
  992. if (typeof global !== 'undefined') {
  993. local = global;
  994. } else if (typeof self !== 'undefined') {
  995. local = self;
  996. } else {
  997. try {
  998. local = Function('return this')();
  999. } catch (e) {
  1000. throw new Error('polyfill failed because global object is unavailable in this environment');
  1001. }
  1002. }
  1003. local.fetchJsonp = fetchJsonp;
  1004. */
  1005. module.exports = fetchJsonp;
  1006. });
  1007. /***/ }),
  1008. /***/ 645:
  1009. /***/ ((__unused_webpack_module, exports) => {
  1010. /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
  1011. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  1012. var e, m
  1013. var eLen = (nBytes * 8) - mLen - 1
  1014. var eMax = (1 << eLen) - 1
  1015. var eBias = eMax >> 1
  1016. var nBits = -7
  1017. var i = isLE ? (nBytes - 1) : 0
  1018. var d = isLE ? -1 : 1
  1019. var s = buffer[offset + i]
  1020. i += d
  1021. e = s & ((1 << (-nBits)) - 1)
  1022. s >>= (-nBits)
  1023. nBits += eLen
  1024. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  1025. m = e & ((1 << (-nBits)) - 1)
  1026. e >>= (-nBits)
  1027. nBits += mLen
  1028. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  1029. if (e === 0) {
  1030. e = 1 - eBias
  1031. } else if (e === eMax) {
  1032. return m ? NaN : ((s ? -1 : 1) * Infinity)
  1033. } else {
  1034. m = m + Math.pow(2, mLen)
  1035. e = e - eBias
  1036. }
  1037. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  1038. }
  1039. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  1040. var e, m, c
  1041. var eLen = (nBytes * 8) - mLen - 1
  1042. var eMax = (1 << eLen) - 1
  1043. var eBias = eMax >> 1
  1044. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  1045. var i = isLE ? 0 : (nBytes - 1)
  1046. var d = isLE ? 1 : -1
  1047. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  1048. value = Math.abs(value)
  1049. if (isNaN(value) || value === Infinity) {
  1050. m = isNaN(value) ? 1 : 0
  1051. e = eMax
  1052. } else {
  1053. e = Math.floor(Math.log(value) / Math.LN2)
  1054. if (value * (c = Math.pow(2, -e)) < 1) {
  1055. e--
  1056. c *= 2
  1057. }
  1058. if (e + eBias >= 1) {
  1059. value += rt / c
  1060. } else {
  1061. value += rt * Math.pow(2, 1 - eBias)
  1062. }
  1063. if (value * c >= 2) {
  1064. e++
  1065. c /= 2
  1066. }
  1067. if (e + eBias >= eMax) {
  1068. m = 0
  1069. e = eMax
  1070. } else if (e + eBias >= 1) {
  1071. m = ((value * c) - 1) * Math.pow(2, mLen)
  1072. e = e + eBias
  1073. } else {
  1074. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  1075. e = 0
  1076. }
  1077. }
  1078. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  1079. e = (e << mLen) | m
  1080. eLen += mLen
  1081. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  1082. buffer[offset + i - d] |= s * 128
  1083. }
  1084. /***/ }),
  1085. /***/ 545:
  1086. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  1087. var utils = __webpack_require__(820)
  1088. var AND = '&&'
  1089. , OR = '||'
  1090. , AND_STR = 'and'
  1091. , OR_STR = 'or'
  1092. , NOT = '!'
  1093. , EQUAL = '='
  1094. , LIKE = '~'
  1095. , NOTEQUAL = NOT + EQUAL
  1096. , NOTLIKE = NOT + LIKE
  1097. , GT = '>'
  1098. , GE = '>='
  1099. , LT = '<'
  1100. , LE = '<='
  1101. , WILDCARD = '*'
  1102. , COMMA = ','
  1103. , DELIMITER = '.'
  1104. , LEFT = '('
  1105. , RIGHT = ')'
  1106. , WHERE = 'where'
  1107. , synopsis = {
  1108. pathway: [],
  1109. groups: {}
  1110. }
  1111. , AST = {}
  1112. , options = {};
  1113. var print = console.log;
  1114. // ------------------ splitter -------------------- //
  1115. function Tokenize(query) {
  1116. var parts = __splitTrim(query, WHERE);
  1117. var pathway = parts[0];
  1118. var where = parts[1];
  1119. synopsis.pathway = __splitTrim(pathway, COMMA);
  1120. for (var i = 0, len = synopsis.pathway.length; i < len; i++) {
  1121. synopsis.pathway[i] = __splitTrim(synopsis.pathway[i], DELIMITER);
  1122. if (synopsis.pathway[i][0] == WILDCARD)
  1123. synopsis.pathway[i].shift();
  1124. if (synopsis.pathway[i].length === 0)
  1125. synopsis.pathway.splice(i, 1);
  1126. }
  1127. var lastLeft = -1,
  1128. lastRight = -1,
  1129. current = 0;
  1130. while (current < where.length) {
  1131. if (where[current] === LEFT) {
  1132. lastLeft = current;
  1133. } else if (where[current] === RIGHT) {
  1134. lastRight = current;
  1135. if (lastRight > lastLeft && lastLeft !== -1) {
  1136. var k = 'gr' + '_' + new Date().getTime();
  1137. synopsis.groups[k] = where.substring(lastLeft + 1, lastRight);
  1138. where = where.replace(LEFT + synopsis.groups[k] + RIGHT, k);
  1139. current = -1;
  1140. }
  1141. }
  1142. current += 1;
  1143. }
  1144. LogicalGrouping(AST, where);
  1145. }
  1146. function LogicalGrouping(current, where) {
  1147. var lastAnd = __findIndex(where, AND),
  1148. lastOr = __findIndex(where, OR);
  1149. if (lastAnd !== Number.MAX_VALUE || lastOr !== Number.MAX_VALUE) {
  1150. if (lastAnd < lastOr) {
  1151. current.and = current.and || [];
  1152. var parts = __splitTrim(where, AND);
  1153. current.and.push(parts[0]);
  1154. LogicalGrouping(current.and, parts[1]);
  1155. } else {
  1156. current.or = current.or || [];
  1157. var parts = __splitTrim(where, OR);
  1158. current.or.push(parts[0]);
  1159. LogicalGrouping(current.or, parts[1]);
  1160. }
  1161. } else {
  1162. if (synopsis.groups[where]) {
  1163. where = synopsis.groups[where];
  1164. LogicalGrouping(current, where);
  1165. } else {
  1166. if (Array.isArray(current))
  1167. current.push(where);
  1168. else
  1169. current.or = [where];
  1170. ExtractExpression(AST.or ? AST.or : AST.and)
  1171. }
  1172. }
  1173. }
  1174. function ExtractExpression(logicalGroup) {
  1175. for (var k in logicalGroup) {
  1176. if (logicalGroup.hasOwnProperty(k)) {
  1177. if (Array.isArray(logicalGroup[k])) {
  1178. ExtractExpression(logicalGroup[k]);
  1179. }
  1180. else if (typeof logicalGroup[k] === 'string') {
  1181. if (__contains(logicalGroup[k], NOTEQUAL)) {
  1182. var parts = __splitTrim(logicalGroup[k], NOTEQUAL);
  1183. logicalGroup[k] = {
  1184. ne: [
  1185. parts[0],
  1186. parts[1]
  1187. ]
  1188. };
  1189. } else if (__contains(logicalGroup[k], NOTLIKE)) {
  1190. var parts = __splitTrim(logicalGroup[k], NOTLIKE);
  1191. logicalGroup[k] = {
  1192. nreq: [
  1193. parts[0],
  1194. parts[1]
  1195. ]
  1196. };
  1197. } else if (__contains(logicalGroup[k], LIKE)) {
  1198. var parts = __splitTrim(logicalGroup[k], LIKE);
  1199. logicalGroup[k] = { // rough eq
  1200. req: [
  1201. parts[0],
  1202. parts[1]
  1203. ]
  1204. };
  1205. } else if (__contains(logicalGroup[k], GE)) {
  1206. var parts = __splitTrim(logicalGroup[k], GE);
  1207. logicalGroup[k] = { // greater than or equal
  1208. ge: [
  1209. parts[0],
  1210. parts[1]
  1211. ]
  1212. };
  1213. } else if (__contains(logicalGroup[k], GT)) {
  1214. var parts = __splitTrim(logicalGroup[k], GT);
  1215. logicalGroup[k] = { // greater than
  1216. gt: [
  1217. parts[0],
  1218. parts[1]
  1219. ]
  1220. };
  1221. } else if (__contains(logicalGroup[k], LE)) {
  1222. var parts = __splitTrim(logicalGroup[k], LE);
  1223. logicalGroup[k] = { // less than or equal
  1224. le: [
  1225. parts[0],
  1226. parts[1]
  1227. ]
  1228. };
  1229. } else if (__contains(logicalGroup[k], LT)) {
  1230. var parts = __splitTrim(logicalGroup[k], LT);
  1231. logicalGroup[k] = { // less than
  1232. lt: [
  1233. parts[0],
  1234. parts[1]
  1235. ]
  1236. };
  1237. } else if (__contains(logicalGroup[k], EQUAL)) {
  1238. var parts = __splitTrim(logicalGroup[k], EQUAL);
  1239. logicalGroup[k] = {
  1240. eq: [
  1241. parts[0],
  1242. parts[1]
  1243. ]
  1244. };
  1245. }
  1246. }
  1247. }
  1248. }
  1249. }
  1250. function __findIndex(str, token) {
  1251. var index = str.indexOf(token);
  1252. return index === -1 ? Number.MAX_VALUE : index;
  1253. }
  1254. function __splitTrim(str, token) {
  1255. return str.split(token).map(function (p) {
  1256. return p.trim();
  1257. });
  1258. }
  1259. function __contains(a, b) {
  1260. return a.indexOf(b) > -1;
  1261. }
  1262. function __hierarchize(obj, dottedPath) {
  1263. var parts = __splitTrim(dottedPath, DELIMITER);
  1264. var res = obj;
  1265. for (var p in parts) {
  1266. if (res.hasOwnProperty(parts[p]))
  1267. res = res[parts[p]];
  1268. else
  1269. return '';
  1270. }
  1271. // support comparison for Date/DateString
  1272. if(utils.isDate(res)) res = res.valueOf()
  1273. else if(utils.isDateString(res)) res = utils.parseDateFromString(res)
  1274. else res = res.toString()
  1275. return res
  1276. }
  1277. function FilterOR(ASTNode, row) {
  1278. var res = false;
  1279. for (var k in ASTNode) {
  1280. var filterFunc = (k === AND_STR ? FilterAND : (k === OR_STR ? FilterOR : Filter));
  1281. res = res || filterFunc(ASTNode[k], row);
  1282. if (options.trace)
  1283. print(synopsis.step, '======((( or', ASTNode[k], res);
  1284. if (res) return res;
  1285. }
  1286. return res;
  1287. }
  1288. function FilterAND(ASTNode, row) {
  1289. var res = true;
  1290. for (var k in ASTNode) {
  1291. var filterFunc = (k === AND_STR ? FilterAND : (k === OR_STR ? FilterOR : Filter));
  1292. res = res && filterFunc(ASTNode[k], row);
  1293. if (options.trace)
  1294. print(synopsis.step, '======((( and', ASTNode[k], res);
  1295. if (!res) return res;
  1296. }
  1297. return res;
  1298. }
  1299. function Filter(ASTNode, row) {
  1300. synopsis.step += 1;
  1301. if (ASTNode.or) {
  1302. var res = FilterOR(ASTNode.or, row);
  1303. if (options.trace)
  1304. print(synopsis.step, 'OR', ASTNode, res);
  1305. return res;
  1306. } else if (ASTNode.and) {
  1307. var res = FilterAND(ASTNode.and, row);
  1308. if (options.trace)
  1309. print(synopsis.step, 'AND', ASTNode, res);
  1310. return res;
  1311. } else if (typeof ASTNode === 'object') {
  1312. if (ASTNode.eq) { // =
  1313. return __hierarchize(row, ASTNode.eq[0]) === ASTNode.eq[1];
  1314. } else if (ASTNode.ne) { // !=
  1315. return __hierarchize(row, ASTNode.ne[0]) !== ASTNode.ne[1];
  1316. } else if (ASTNode.req) { // ~
  1317. return __contains(__hierarchize(row, ASTNode.req[0]), ASTNode.req[1]);
  1318. } else if (ASTNode.nreq) { // ~
  1319. return !__contains(__hierarchize(row, ASTNode.nreq[0]), ASTNode.nreq[1]);
  1320. } else if (ASTNode.gt) { // >
  1321. return __hierarchize(row, ASTNode.gt[0]) > ASTNode.gt[1];
  1322. } else if (ASTNode.ge) { // >=
  1323. return __hierarchize(row, ASTNode.ge[0]) >= ASTNode.ge[1];
  1324. } else if (ASTNode.lt) { // <
  1325. return __hierarchize(row, ASTNode.lt[0]) < ASTNode.lt[1];
  1326. } else if (ASTNode.le) { // <=
  1327. return __hierarchize(row, ASTNode.le[0]) <= ASTNode.le[1];
  1328. } else {
  1329. return Filter(ASTNode, row);
  1330. }
  1331. }
  1332. }
  1333. function Parse(dataSource) {
  1334. var result = [];
  1335. for (var k in dataSource)
  1336. if (Filter(AST, dataSource[k]))
  1337. result.push(dataSource[k]);
  1338. return result;
  1339. }
  1340. function Fields(result) {
  1341. if (result && synopsis.pathway.length > 0) {
  1342. //print(synopsis.pathway);
  1343. return result.map(function (ele) {
  1344. var res = {};
  1345. for (var i = 0, len = synopsis.pathway.length; i < len; i++) {
  1346. var key = synopsis.pathway[i].join(DELIMITER);
  1347. res[key] = __hierarchize(ele, key);
  1348. }
  1349. return res;
  1350. });
  1351. }
  1352. return result;
  1353. }
  1354. function Query(dataSource, query, opts) {
  1355. synopsis = {
  1356. pathway: [],
  1357. groups: {},
  1358. step: 0
  1359. };
  1360. AST = {};
  1361. opts = opts || {
  1362. trace: false
  1363. };
  1364. options = opts;
  1365. Tokenize(query);
  1366. return Fields(Parse(dataSource));
  1367. }
  1368. if ( true && typeof(module.exports) != 'undefined') module.exports = Query;
  1369. if (typeof(window) != 'undefined') window.Query = Query;
  1370. /***/ }),
  1371. /***/ 820:
  1372. /***/ ((module) => {
  1373. function getObjectType(obj) {
  1374. return Object.prototype.toString.call(obj);
  1375. }
  1376. function isDate(obj) {
  1377. return getObjectType(obj) === '[object Date]';
  1378. }
  1379. function isString(obj) {
  1380. return getObjectType(obj) === '[object String]';
  1381. }
  1382. function isDateString(obj) {
  1383. return isString(obj) && !isNaN(Date.parse(obj))
  1384. }
  1385. function isNumber(obj) {
  1386. return typeof obj === 'number'
  1387. }
  1388. function parseDateFromString(str) {
  1389. return Date.parse(str)
  1390. }
  1391. module.exports = {
  1392. getObjectType: getObjectType,
  1393. isDate: isDate,
  1394. isString: isString,
  1395. isDateString: isDateString,
  1396. parseDateFromString: parseDateFromString,
  1397. isNumber: isNumber
  1398. }
  1399. /***/ }),
  1400. /***/ 52:
  1401. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  1402. /**
  1403. * lodash (Custom Build) <https://lodash.com/>
  1404. * Build: `lodash modularize exports="npm" -o ./`
  1405. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  1406. * Released under MIT license <https://lodash.com/license>
  1407. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  1408. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  1409. */
  1410. /** Used as references for various `Number` constants. */
  1411. var MAX_SAFE_INTEGER = 9007199254740991;
  1412. /** `Object#toString` result references. */
  1413. var argsTag = '[object Arguments]',
  1414. funcTag = '[object Function]',
  1415. genTag = '[object GeneratorFunction]',
  1416. mapTag = '[object Map]',
  1417. objectTag = '[object Object]',
  1418. promiseTag = '[object Promise]',
  1419. setTag = '[object Set]',
  1420. weakMapTag = '[object WeakMap]';
  1421. var dataViewTag = '[object DataView]';
  1422. /**
  1423. * Used to match `RegExp`
  1424. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  1425. */
  1426. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  1427. /** Used to detect host constructors (Safari). */
  1428. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  1429. /** Used to detect unsigned integer values. */
  1430. var reIsUint = /^(?:0|[1-9]\d*)$/;
  1431. /** Detect free variable `global` from Node.js. */
  1432. var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
  1433. /** Detect free variable `self`. */
  1434. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  1435. /** Used as a reference to the global object. */
  1436. var root = freeGlobal || freeSelf || Function('return this')();
  1437. /**
  1438. * A specialized version of `_.map` for arrays without support for iteratee
  1439. * shorthands.
  1440. *
  1441. * @private
  1442. * @param {Array} [array] The array to iterate over.
  1443. * @param {Function} iteratee The function invoked per iteration.
  1444. * @returns {Array} Returns the new mapped array.
  1445. */
  1446. function arrayMap(array, iteratee) {
  1447. var index = -1,
  1448. length = array ? array.length : 0,
  1449. result = Array(length);
  1450. while (++index < length) {
  1451. result[index] = iteratee(array[index], index, array);
  1452. }
  1453. return result;
  1454. }
  1455. /**
  1456. * The base implementation of `_.times` without support for iteratee shorthands
  1457. * or max array length checks.
  1458. *
  1459. * @private
  1460. * @param {number} n The number of times to invoke `iteratee`.
  1461. * @param {Function} iteratee The function invoked per iteration.
  1462. * @returns {Array} Returns the array of results.
  1463. */
  1464. function baseTimes(n, iteratee) {
  1465. var index = -1,
  1466. result = Array(n);
  1467. while (++index < n) {
  1468. result[index] = iteratee(index);
  1469. }
  1470. return result;
  1471. }
  1472. /**
  1473. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  1474. * of key-value pairs for `object` corresponding to the property names of `props`.
  1475. *
  1476. * @private
  1477. * @param {Object} object The object to query.
  1478. * @param {Array} props The property names to get values for.
  1479. * @returns {Object} Returns the key-value pairs.
  1480. */
  1481. function baseToPairs(object, props) {
  1482. return arrayMap(props, function(key) {
  1483. return [key, object[key]];
  1484. });
  1485. }
  1486. /**
  1487. * Gets the value at `key` of `object`.
  1488. *
  1489. * @private
  1490. * @param {Object} [object] The object to query.
  1491. * @param {string} key The key of the property to get.
  1492. * @returns {*} Returns the property value.
  1493. */
  1494. function getValue(object, key) {
  1495. return object == null ? undefined : object[key];
  1496. }
  1497. /**
  1498. * Checks if `value` is a host object in IE < 9.
  1499. *
  1500. * @private
  1501. * @param {*} value The value to check.
  1502. * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
  1503. */
  1504. function isHostObject(value) {
  1505. // Many host objects are `Object` objects that can coerce to strings
  1506. // despite having improperly defined `toString` methods.
  1507. var result = false;
  1508. if (value != null && typeof value.toString != 'function') {
  1509. try {
  1510. result = !!(value + '');
  1511. } catch (e) {}
  1512. }
  1513. return result;
  1514. }
  1515. /**
  1516. * Converts `map` to its key-value pairs.
  1517. *
  1518. * @private
  1519. * @param {Object} map The map to convert.
  1520. * @returns {Array} Returns the key-value pairs.
  1521. */
  1522. function mapToArray(map) {
  1523. var index = -1,
  1524. result = Array(map.size);
  1525. map.forEach(function(value, key) {
  1526. result[++index] = [key, value];
  1527. });
  1528. return result;
  1529. }
  1530. /**
  1531. * Creates a unary function that invokes `func` with its argument transformed.
  1532. *
  1533. * @private
  1534. * @param {Function} func The function to wrap.
  1535. * @param {Function} transform The argument transform.
  1536. * @returns {Function} Returns the new function.
  1537. */
  1538. function overArg(func, transform) {
  1539. return function(arg) {
  1540. return func(transform(arg));
  1541. };
  1542. }
  1543. /**
  1544. * Converts `set` to its value-value pairs.
  1545. *
  1546. * @private
  1547. * @param {Object} set The set to convert.
  1548. * @returns {Array} Returns the value-value pairs.
  1549. */
  1550. function setToPairs(set) {
  1551. var index = -1,
  1552. result = Array(set.size);
  1553. set.forEach(function(value) {
  1554. result[++index] = [value, value];
  1555. });
  1556. return result;
  1557. }
  1558. /** Used for built-in method references. */
  1559. var funcProto = Function.prototype,
  1560. objectProto = Object.prototype;
  1561. /** Used to detect overreaching core-js shims. */
  1562. var coreJsData = root['__core-js_shared__'];
  1563. /** Used to detect methods masquerading as native. */
  1564. var maskSrcKey = (function() {
  1565. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  1566. return uid ? ('Symbol(src)_1.' + uid) : '';
  1567. }());
  1568. /** Used to resolve the decompiled source of functions. */
  1569. var funcToString = funcProto.toString;
  1570. /** Used to check objects for own properties. */
  1571. var hasOwnProperty = objectProto.hasOwnProperty;
  1572. /**
  1573. * Used to resolve the
  1574. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  1575. * of values.
  1576. */
  1577. var objectToString = objectProto.toString;
  1578. /** Used to detect if a method is native. */
  1579. var reIsNative = RegExp('^' +
  1580. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  1581. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  1582. );
  1583. /** Built-in value references. */
  1584. var propertyIsEnumerable = objectProto.propertyIsEnumerable;
  1585. /* Built-in method references for those with the same name as other `lodash` methods. */
  1586. var nativeKeys = overArg(Object.keys, Object);
  1587. /* Built-in method references that are verified to be native. */
  1588. var DataView = getNative(root, 'DataView'),
  1589. Map = getNative(root, 'Map'),
  1590. Promise = getNative(root, 'Promise'),
  1591. Set = getNative(root, 'Set'),
  1592. WeakMap = getNative(root, 'WeakMap');
  1593. /** Used to detect maps, sets, and weakmaps. */
  1594. var dataViewCtorString = toSource(DataView),
  1595. mapCtorString = toSource(Map),
  1596. promiseCtorString = toSource(Promise),
  1597. setCtorString = toSource(Set),
  1598. weakMapCtorString = toSource(WeakMap);
  1599. /**
  1600. * Creates an array of the enumerable property names of the array-like `value`.
  1601. *
  1602. * @private
  1603. * @param {*} value The value to query.
  1604. * @param {boolean} inherited Specify returning inherited property names.
  1605. * @returns {Array} Returns the array of property names.
  1606. */
  1607. function arrayLikeKeys(value, inherited) {
  1608. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  1609. // Safari 9 makes `arguments.length` enumerable in strict mode.
  1610. var result = (isArray(value) || isArguments(value))
  1611. ? baseTimes(value.length, String)
  1612. : [];
  1613. var length = result.length,
  1614. skipIndexes = !!length;
  1615. for (var key in value) {
  1616. if ((inherited || hasOwnProperty.call(value, key)) &&
  1617. !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
  1618. result.push(key);
  1619. }
  1620. }
  1621. return result;
  1622. }
  1623. /**
  1624. * The base implementation of `getTag`.
  1625. *
  1626. * @private
  1627. * @param {*} value The value to query.
  1628. * @returns {string} Returns the `toStringTag`.
  1629. */
  1630. function baseGetTag(value) {
  1631. return objectToString.call(value);
  1632. }
  1633. /**
  1634. * The base implementation of `_.isNative` without bad shim checks.
  1635. *
  1636. * @private
  1637. * @param {*} value The value to check.
  1638. * @returns {boolean} Returns `true` if `value` is a native function,
  1639. * else `false`.
  1640. */
  1641. function baseIsNative(value) {
  1642. if (!isObject(value) || isMasked(value)) {
  1643. return false;
  1644. }
  1645. var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
  1646. return pattern.test(toSource(value));
  1647. }
  1648. /**
  1649. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  1650. *
  1651. * @private
  1652. * @param {Object} object The object to query.
  1653. * @returns {Array} Returns the array of property names.
  1654. */
  1655. function baseKeys(object) {
  1656. if (!isPrototype(object)) {
  1657. return nativeKeys(object);
  1658. }
  1659. var result = [];
  1660. for (var key in Object(object)) {
  1661. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  1662. result.push(key);
  1663. }
  1664. }
  1665. return result;
  1666. }
  1667. /**
  1668. * Creates a `_.toPairs` or `_.toPairsIn` function.
  1669. *
  1670. * @private
  1671. * @param {Function} keysFunc The function to get the keys of a given object.
  1672. * @returns {Function} Returns the new pairs function.
  1673. */
  1674. function createToPairs(keysFunc) {
  1675. return function(object) {
  1676. var tag = getTag(object);
  1677. if (tag == mapTag) {
  1678. return mapToArray(object);
  1679. }
  1680. if (tag == setTag) {
  1681. return setToPairs(object);
  1682. }
  1683. return baseToPairs(object, keysFunc(object));
  1684. };
  1685. }
  1686. /**
  1687. * Gets the native function at `key` of `object`.
  1688. *
  1689. * @private
  1690. * @param {Object} object The object to query.
  1691. * @param {string} key The key of the method to get.
  1692. * @returns {*} Returns the function if it's native, else `undefined`.
  1693. */
  1694. function getNative(object, key) {
  1695. var value = getValue(object, key);
  1696. return baseIsNative(value) ? value : undefined;
  1697. }
  1698. /**
  1699. * Gets the `toStringTag` of `value`.
  1700. *
  1701. * @private
  1702. * @param {*} value The value to query.
  1703. * @returns {string} Returns the `toStringTag`.
  1704. */
  1705. var getTag = baseGetTag;
  1706. // Fallback for data views, maps, sets, and weak maps in IE 11,
  1707. // for data views in Edge < 14, and promises in Node.js.
  1708. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  1709. (Map && getTag(new Map) != mapTag) ||
  1710. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  1711. (Set && getTag(new Set) != setTag) ||
  1712. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  1713. getTag = function(value) {
  1714. var result = objectToString.call(value),
  1715. Ctor = result == objectTag ? value.constructor : undefined,
  1716. ctorString = Ctor ? toSource(Ctor) : undefined;
  1717. if (ctorString) {
  1718. switch (ctorString) {
  1719. case dataViewCtorString: return dataViewTag;
  1720. case mapCtorString: return mapTag;
  1721. case promiseCtorString: return promiseTag;
  1722. case setCtorString: return setTag;
  1723. case weakMapCtorString: return weakMapTag;
  1724. }
  1725. }
  1726. return result;
  1727. };
  1728. }
  1729. /**
  1730. * Checks if `value` is a valid array-like index.
  1731. *
  1732. * @private
  1733. * @param {*} value The value to check.
  1734. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  1735. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  1736. */
  1737. function isIndex(value, length) {
  1738. length = length == null ? MAX_SAFE_INTEGER : length;
  1739. return !!length &&
  1740. (typeof value == 'number' || reIsUint.test(value)) &&
  1741. (value > -1 && value % 1 == 0 && value < length);
  1742. }
  1743. /**
  1744. * Checks if `func` has its source masked.
  1745. *
  1746. * @private
  1747. * @param {Function} func The function to check.
  1748. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  1749. */
  1750. function isMasked(func) {
  1751. return !!maskSrcKey && (maskSrcKey in func);
  1752. }
  1753. /**
  1754. * Checks if `value` is likely a prototype object.
  1755. *
  1756. * @private
  1757. * @param {*} value The value to check.
  1758. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  1759. */
  1760. function isPrototype(value) {
  1761. var Ctor = value && value.constructor,
  1762. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  1763. return value === proto;
  1764. }
  1765. /**
  1766. * Converts `func` to its source code.
  1767. *
  1768. * @private
  1769. * @param {Function} func The function to process.
  1770. * @returns {string} Returns the source code.
  1771. */
  1772. function toSource(func) {
  1773. if (func != null) {
  1774. try {
  1775. return funcToString.call(func);
  1776. } catch (e) {}
  1777. try {
  1778. return (func + '');
  1779. } catch (e) {}
  1780. }
  1781. return '';
  1782. }
  1783. /**
  1784. * Checks if `value` is likely an `arguments` object.
  1785. *
  1786. * @static
  1787. * @memberOf _
  1788. * @since 0.1.0
  1789. * @category Lang
  1790. * @param {*} value The value to check.
  1791. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  1792. * else `false`.
  1793. * @example
  1794. *
  1795. * _.isArguments(function() { return arguments; }());
  1796. * // => true
  1797. *
  1798. * _.isArguments([1, 2, 3]);
  1799. * // => false
  1800. */
  1801. function isArguments(value) {
  1802. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  1803. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
  1804. (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
  1805. }
  1806. /**
  1807. * Checks if `value` is classified as an `Array` object.
  1808. *
  1809. * @static
  1810. * @memberOf _
  1811. * @since 0.1.0
  1812. * @category Lang
  1813. * @param {*} value The value to check.
  1814. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  1815. * @example
  1816. *
  1817. * _.isArray([1, 2, 3]);
  1818. * // => true
  1819. *
  1820. * _.isArray(document.body.children);
  1821. * // => false
  1822. *
  1823. * _.isArray('abc');
  1824. * // => false
  1825. *
  1826. * _.isArray(_.noop);
  1827. * // => false
  1828. */
  1829. var isArray = Array.isArray;
  1830. /**
  1831. * Checks if `value` is array-like. A value is considered array-like if it's
  1832. * not a function and has a `value.length` that's an integer greater than or
  1833. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  1834. *
  1835. * @static
  1836. * @memberOf _
  1837. * @since 4.0.0
  1838. * @category Lang
  1839. * @param {*} value The value to check.
  1840. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  1841. * @example
  1842. *
  1843. * _.isArrayLike([1, 2, 3]);
  1844. * // => true
  1845. *
  1846. * _.isArrayLike(document.body.children);
  1847. * // => true
  1848. *
  1849. * _.isArrayLike('abc');
  1850. * // => true
  1851. *
  1852. * _.isArrayLike(_.noop);
  1853. * // => false
  1854. */
  1855. function isArrayLike(value) {
  1856. return value != null && isLength(value.length) && !isFunction(value);
  1857. }
  1858. /**
  1859. * This method is like `_.isArrayLike` except that it also checks if `value`
  1860. * is an object.
  1861. *
  1862. * @static
  1863. * @memberOf _
  1864. * @since 4.0.0
  1865. * @category Lang
  1866. * @param {*} value The value to check.
  1867. * @returns {boolean} Returns `true` if `value` is an array-like object,
  1868. * else `false`.
  1869. * @example
  1870. *
  1871. * _.isArrayLikeObject([1, 2, 3]);
  1872. * // => true
  1873. *
  1874. * _.isArrayLikeObject(document.body.children);
  1875. * // => true
  1876. *
  1877. * _.isArrayLikeObject('abc');
  1878. * // => false
  1879. *
  1880. * _.isArrayLikeObject(_.noop);
  1881. * // => false
  1882. */
  1883. function isArrayLikeObject(value) {
  1884. return isObjectLike(value) && isArrayLike(value);
  1885. }
  1886. /**
  1887. * Checks if `value` is classified as a `Function` object.
  1888. *
  1889. * @static
  1890. * @memberOf _
  1891. * @since 0.1.0
  1892. * @category Lang
  1893. * @param {*} value The value to check.
  1894. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  1895. * @example
  1896. *
  1897. * _.isFunction(_);
  1898. * // => true
  1899. *
  1900. * _.isFunction(/abc/);
  1901. * // => false
  1902. */
  1903. function isFunction(value) {
  1904. // The use of `Object#toString` avoids issues with the `typeof` operator
  1905. // in Safari 8-9 which returns 'object' for typed array and other constructors.
  1906. var tag = isObject(value) ? objectToString.call(value) : '';
  1907. return tag == funcTag || tag == genTag;
  1908. }
  1909. /**
  1910. * Checks if `value` is a valid array-like length.
  1911. *
  1912. * **Note:** This method is loosely based on
  1913. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  1914. *
  1915. * @static
  1916. * @memberOf _
  1917. * @since 4.0.0
  1918. * @category Lang
  1919. * @param {*} value The value to check.
  1920. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  1921. * @example
  1922. *
  1923. * _.isLength(3);
  1924. * // => true
  1925. *
  1926. * _.isLength(Number.MIN_VALUE);
  1927. * // => false
  1928. *
  1929. * _.isLength(Infinity);
  1930. * // => false
  1931. *
  1932. * _.isLength('3');
  1933. * // => false
  1934. */
  1935. function isLength(value) {
  1936. return typeof value == 'number' &&
  1937. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  1938. }
  1939. /**
  1940. * Checks if `value` is the
  1941. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  1942. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  1943. *
  1944. * @static
  1945. * @memberOf _
  1946. * @since 0.1.0
  1947. * @category Lang
  1948. * @param {*} value The value to check.
  1949. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  1950. * @example
  1951. *
  1952. * _.isObject({});
  1953. * // => true
  1954. *
  1955. * _.isObject([1, 2, 3]);
  1956. * // => true
  1957. *
  1958. * _.isObject(_.noop);
  1959. * // => true
  1960. *
  1961. * _.isObject(null);
  1962. * // => false
  1963. */
  1964. function isObject(value) {
  1965. var type = typeof value;
  1966. return !!value && (type == 'object' || type == 'function');
  1967. }
  1968. /**
  1969. * Checks if `value` is object-like. A value is object-like if it's not `null`
  1970. * and has a `typeof` result of "object".
  1971. *
  1972. * @static
  1973. * @memberOf _
  1974. * @since 4.0.0
  1975. * @category Lang
  1976. * @param {*} value The value to check.
  1977. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  1978. * @example
  1979. *
  1980. * _.isObjectLike({});
  1981. * // => true
  1982. *
  1983. * _.isObjectLike([1, 2, 3]);
  1984. * // => true
  1985. *
  1986. * _.isObjectLike(_.noop);
  1987. * // => false
  1988. *
  1989. * _.isObjectLike(null);
  1990. * // => false
  1991. */
  1992. function isObjectLike(value) {
  1993. return !!value && typeof value == 'object';
  1994. }
  1995. /**
  1996. * Creates an array of the own enumerable property names of `object`.
  1997. *
  1998. * **Note:** Non-object values are coerced to objects. See the
  1999. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  2000. * for more details.
  2001. *
  2002. * @static
  2003. * @since 0.1.0
  2004. * @memberOf _
  2005. * @category Object
  2006. * @param {Object} object The object to query.
  2007. * @returns {Array} Returns the array of property names.
  2008. * @example
  2009. *
  2010. * function Foo() {
  2011. * this.a = 1;
  2012. * this.b = 2;
  2013. * }
  2014. *
  2015. * Foo.prototype.c = 3;
  2016. *
  2017. * _.keys(new Foo);
  2018. * // => ['a', 'b'] (iteration order is not guaranteed)
  2019. *
  2020. * _.keys('hi');
  2021. * // => ['0', '1']
  2022. */
  2023. function keys(object) {
  2024. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  2025. }
  2026. /**
  2027. * Creates an array of own enumerable string keyed-value pairs for `object`
  2028. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  2029. * entries are returned.
  2030. *
  2031. * @static
  2032. * @memberOf _
  2033. * @since 4.0.0
  2034. * @alias entries
  2035. * @category Object
  2036. * @param {Object} object The object to query.
  2037. * @returns {Array} Returns the key-value pairs.
  2038. * @example
  2039. *
  2040. * function Foo() {
  2041. * this.a = 1;
  2042. * this.b = 2;
  2043. * }
  2044. *
  2045. * Foo.prototype.c = 3;
  2046. *
  2047. * _.toPairs(new Foo);
  2048. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  2049. */
  2050. var toPairs = createToPairs(keys);
  2051. module.exports = toPairs;
  2052. /***/ }),
  2053. /***/ 614:
  2054. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  2055. "use strict";
  2056. module.exports = Pbf;
  2057. var ieee754 = __webpack_require__(645);
  2058. function Pbf(buf) {
  2059. this.buf = ArrayBuffer.isView && ArrayBuffer.isView(buf) ? buf : new Uint8Array(buf || 0);
  2060. this.pos = 0;
  2061. this.type = 0;
  2062. this.length = this.buf.length;
  2063. }
  2064. Pbf.Varint = 0; // varint: int32, int64, uint32, uint64, sint32, sint64, bool, enum
  2065. Pbf.Fixed64 = 1; // 64-bit: double, fixed64, sfixed64
  2066. Pbf.Bytes = 2; // length-delimited: string, bytes, embedded messages, packed repeated fields
  2067. Pbf.Fixed32 = 5; // 32-bit: float, fixed32, sfixed32
  2068. var SHIFT_LEFT_32 = (1 << 16) * (1 << 16),
  2069. SHIFT_RIGHT_32 = 1 / SHIFT_LEFT_32;
  2070. // Threshold chosen based on both benchmarking and knowledge about browser string
  2071. // data structures (which currently switch structure types at 12 bytes or more)
  2072. var TEXT_DECODER_MIN_LENGTH = 12;
  2073. var utf8TextDecoder = typeof TextDecoder === 'undefined' ? null : new TextDecoder('utf8');
  2074. Pbf.prototype = {
  2075. destroy: function() {
  2076. this.buf = null;
  2077. },
  2078. // === READING =================================================================
  2079. readFields: function(readField, result, end) {
  2080. end = end || this.length;
  2081. while (this.pos < end) {
  2082. var val = this.readVarint(),
  2083. tag = val >> 3,
  2084. startPos = this.pos;
  2085. this.type = val & 0x7;
  2086. readField(tag, result, this);
  2087. if (this.pos === startPos) this.skip(val);
  2088. }
  2089. return result;
  2090. },
  2091. readMessage: function(readField, result) {
  2092. return this.readFields(readField, result, this.readVarint() + this.pos);
  2093. },
  2094. readFixed32: function() {
  2095. var val = readUInt32(this.buf, this.pos);
  2096. this.pos += 4;
  2097. return val;
  2098. },
  2099. readSFixed32: function() {
  2100. var val = readInt32(this.buf, this.pos);
  2101. this.pos += 4;
  2102. return val;
  2103. },
  2104. // 64-bit int handling is based on github.com/dpw/node-buffer-more-ints (MIT-licensed)
  2105. readFixed64: function() {
  2106. var val = readUInt32(this.buf, this.pos) + readUInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;
  2107. this.pos += 8;
  2108. return val;
  2109. },
  2110. readSFixed64: function() {
  2111. var val = readUInt32(this.buf, this.pos) + readInt32(this.buf, this.pos + 4) * SHIFT_LEFT_32;
  2112. this.pos += 8;
  2113. return val;
  2114. },
  2115. readFloat: function() {
  2116. var val = ieee754.read(this.buf, this.pos, true, 23, 4);
  2117. this.pos += 4;
  2118. return val;
  2119. },
  2120. readDouble: function() {
  2121. var val = ieee754.read(this.buf, this.pos, true, 52, 8);
  2122. this.pos += 8;
  2123. return val;
  2124. },
  2125. readVarint: function(isSigned) {
  2126. var buf = this.buf,
  2127. val, b;
  2128. b = buf[this.pos++]; val = b & 0x7f; if (b < 0x80) return val;
  2129. b = buf[this.pos++]; val |= (b & 0x7f) << 7; if (b < 0x80) return val;
  2130. b = buf[this.pos++]; val |= (b & 0x7f) << 14; if (b < 0x80) return val;
  2131. b = buf[this.pos++]; val |= (b & 0x7f) << 21; if (b < 0x80) return val;
  2132. b = buf[this.pos]; val |= (b & 0x0f) << 28;
  2133. return readVarintRemainder(val, isSigned, this);
  2134. },
  2135. readVarint64: function() { // for compatibility with v2.0.1
  2136. return this.readVarint(true);
  2137. },
  2138. readSVarint: function() {
  2139. var num = this.readVarint();
  2140. return num % 2 === 1 ? (num + 1) / -2 : num / 2; // zigzag encoding
  2141. },
  2142. readBoolean: function() {
  2143. return Boolean(this.readVarint());
  2144. },
  2145. readString: function() {
  2146. var end = this.readVarint() + this.pos;
  2147. var pos = this.pos;
  2148. this.pos = end;
  2149. if (end - pos >= TEXT_DECODER_MIN_LENGTH && utf8TextDecoder) {
  2150. // longer strings are fast with the built-in browser TextDecoder API
  2151. return readUtf8TextDecoder(this.buf, pos, end);
  2152. }
  2153. // short strings are fast with our custom implementation
  2154. return readUtf8(this.buf, pos, end);
  2155. },
  2156. readBytes: function() {
  2157. var end = this.readVarint() + this.pos,
  2158. buffer = this.buf.subarray(this.pos, end);
  2159. this.pos = end;
  2160. return buffer;
  2161. },
  2162. // verbose for performance reasons; doesn't affect gzipped size
  2163. readPackedVarint: function(arr, isSigned) {
  2164. if (this.type !== Pbf.Bytes) return arr.push(this.readVarint(isSigned));
  2165. var end = readPackedEnd(this);
  2166. arr = arr || [];
  2167. while (this.pos < end) arr.push(this.readVarint(isSigned));
  2168. return arr;
  2169. },
  2170. readPackedSVarint: function(arr) {
  2171. if (this.type !== Pbf.Bytes) return arr.push(this.readSVarint());
  2172. var end = readPackedEnd(this);
  2173. arr = arr || [];
  2174. while (this.pos < end) arr.push(this.readSVarint());
  2175. return arr;
  2176. },
  2177. readPackedBoolean: function(arr) {
  2178. if (this.type !== Pbf.Bytes) return arr.push(this.readBoolean());
  2179. var end = readPackedEnd(this);
  2180. arr = arr || [];
  2181. while (this.pos < end) arr.push(this.readBoolean());
  2182. return arr;
  2183. },
  2184. readPackedFloat: function(arr) {
  2185. if (this.type !== Pbf.Bytes) return arr.push(this.readFloat());
  2186. var end = readPackedEnd(this);
  2187. arr = arr || [];
  2188. while (this.pos < end) arr.push(this.readFloat());
  2189. return arr;
  2190. },
  2191. readPackedDouble: function(arr) {
  2192. if (this.type !== Pbf.Bytes) return arr.push(this.readDouble());
  2193. var end = readPackedEnd(this);
  2194. arr = arr || [];
  2195. while (this.pos < end) arr.push(this.readDouble());
  2196. return arr;
  2197. },
  2198. readPackedFixed32: function(arr) {
  2199. if (this.type !== Pbf.Bytes) return arr.push(this.readFixed32());
  2200. var end = readPackedEnd(this);
  2201. arr = arr || [];
  2202. while (this.pos < end) arr.push(this.readFixed32());
  2203. return arr;
  2204. },
  2205. readPackedSFixed32: function(arr) {
  2206. if (this.type !== Pbf.Bytes) return arr.push(this.readSFixed32());
  2207. var end = readPackedEnd(this);
  2208. arr = arr || [];
  2209. while (this.pos < end) arr.push(this.readSFixed32());
  2210. return arr;
  2211. },
  2212. readPackedFixed64: function(arr) {
  2213. if (this.type !== Pbf.Bytes) return arr.push(this.readFixed64());
  2214. var end = readPackedEnd(this);
  2215. arr = arr || [];
  2216. while (this.pos < end) arr.push(this.readFixed64());
  2217. return arr;
  2218. },
  2219. readPackedSFixed64: function(arr) {
  2220. if (this.type !== Pbf.Bytes) return arr.push(this.readSFixed64());
  2221. var end = readPackedEnd(this);
  2222. arr = arr || [];
  2223. while (this.pos < end) arr.push(this.readSFixed64());
  2224. return arr;
  2225. },
  2226. skip: function(val) {
  2227. var type = val & 0x7;
  2228. if (type === Pbf.Varint) while (this.buf[this.pos++] > 0x7f) {}
  2229. else if (type === Pbf.Bytes) this.pos = this.readVarint() + this.pos;
  2230. else if (type === Pbf.Fixed32) this.pos += 4;
  2231. else if (type === Pbf.Fixed64) this.pos += 8;
  2232. else throw new Error('Unimplemented type: ' + type);
  2233. },
  2234. // === WRITING =================================================================
  2235. writeTag: function(tag, type) {
  2236. this.writeVarint((tag << 3) | type);
  2237. },
  2238. realloc: function(min) {
  2239. var length = this.length || 16;
  2240. while (length < this.pos + min) length *= 2;
  2241. if (length !== this.length) {
  2242. var buf = new Uint8Array(length);
  2243. buf.set(this.buf);
  2244. this.buf = buf;
  2245. this.length = length;
  2246. }
  2247. },
  2248. finish: function() {
  2249. this.length = this.pos;
  2250. this.pos = 0;
  2251. return this.buf.subarray(0, this.length);
  2252. },
  2253. writeFixed32: function(val) {
  2254. this.realloc(4);
  2255. writeInt32(this.buf, val, this.pos);
  2256. this.pos += 4;
  2257. },
  2258. writeSFixed32: function(val) {
  2259. this.realloc(4);
  2260. writeInt32(this.buf, val, this.pos);
  2261. this.pos += 4;
  2262. },
  2263. writeFixed64: function(val) {
  2264. this.realloc(8);
  2265. writeInt32(this.buf, val & -1, this.pos);
  2266. writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);
  2267. this.pos += 8;
  2268. },
  2269. writeSFixed64: function(val) {
  2270. this.realloc(8);
  2271. writeInt32(this.buf, val & -1, this.pos);
  2272. writeInt32(this.buf, Math.floor(val * SHIFT_RIGHT_32), this.pos + 4);
  2273. this.pos += 8;
  2274. },
  2275. writeVarint: function(val) {
  2276. val = +val || 0;
  2277. if (val > 0xfffffff || val < 0) {
  2278. writeBigVarint(val, this);
  2279. return;
  2280. }
  2281. this.realloc(4);
  2282. this.buf[this.pos++] = val & 0x7f | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;
  2283. this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;
  2284. this.buf[this.pos++] = ((val >>>= 7) & 0x7f) | (val > 0x7f ? 0x80 : 0); if (val <= 0x7f) return;
  2285. this.buf[this.pos++] = (val >>> 7) & 0x7f;
  2286. },
  2287. writeSVarint: function(val) {
  2288. this.writeVarint(val < 0 ? -val * 2 - 1 : val * 2);
  2289. },
  2290. writeBoolean: function(val) {
  2291. this.writeVarint(Boolean(val));
  2292. },
  2293. writeString: function(str) {
  2294. str = String(str);
  2295. this.realloc(str.length * 4);
  2296. this.pos++; // reserve 1 byte for short string length
  2297. var startPos = this.pos;
  2298. // write the string directly to the buffer and see how much was written
  2299. this.pos = writeUtf8(this.buf, str, this.pos);
  2300. var len = this.pos - startPos;
  2301. if (len >= 0x80) makeRoomForExtraLength(startPos, len, this);
  2302. // finally, write the message length in the reserved place and restore the position
  2303. this.pos = startPos - 1;
  2304. this.writeVarint(len);
  2305. this.pos += len;
  2306. },
  2307. writeFloat: function(val) {
  2308. this.realloc(4);
  2309. ieee754.write(this.buf, val, this.pos, true, 23, 4);
  2310. this.pos += 4;
  2311. },
  2312. writeDouble: function(val) {
  2313. this.realloc(8);
  2314. ieee754.write(this.buf, val, this.pos, true, 52, 8);
  2315. this.pos += 8;
  2316. },
  2317. writeBytes: function(buffer) {
  2318. var len = buffer.length;
  2319. this.writeVarint(len);
  2320. this.realloc(len);
  2321. for (var i = 0; i < len; i++) this.buf[this.pos++] = buffer[i];
  2322. },
  2323. writeRawMessage: function(fn, obj) {
  2324. this.pos++; // reserve 1 byte for short message length
  2325. // write the message directly to the buffer and see how much was written
  2326. var startPos = this.pos;
  2327. fn(obj, this);
  2328. var len = this.pos - startPos;
  2329. if (len >= 0x80) makeRoomForExtraLength(startPos, len, this);
  2330. // finally, write the message length in the reserved place and restore the position
  2331. this.pos = startPos - 1;
  2332. this.writeVarint(len);
  2333. this.pos += len;
  2334. },
  2335. writeMessage: function(tag, fn, obj) {
  2336. this.writeTag(tag, Pbf.Bytes);
  2337. this.writeRawMessage(fn, obj);
  2338. },
  2339. writePackedVarint: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedVarint, arr); },
  2340. writePackedSVarint: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSVarint, arr); },
  2341. writePackedBoolean: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedBoolean, arr); },
  2342. writePackedFloat: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFloat, arr); },
  2343. writePackedDouble: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedDouble, arr); },
  2344. writePackedFixed32: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFixed32, arr); },
  2345. writePackedSFixed32: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSFixed32, arr); },
  2346. writePackedFixed64: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedFixed64, arr); },
  2347. writePackedSFixed64: function(tag, arr) { if (arr.length) this.writeMessage(tag, writePackedSFixed64, arr); },
  2348. writeBytesField: function(tag, buffer) {
  2349. this.writeTag(tag, Pbf.Bytes);
  2350. this.writeBytes(buffer);
  2351. },
  2352. writeFixed32Field: function(tag, val) {
  2353. this.writeTag(tag, Pbf.Fixed32);
  2354. this.writeFixed32(val);
  2355. },
  2356. writeSFixed32Field: function(tag, val) {
  2357. this.writeTag(tag, Pbf.Fixed32);
  2358. this.writeSFixed32(val);
  2359. },
  2360. writeFixed64Field: function(tag, val) {
  2361. this.writeTag(tag, Pbf.Fixed64);
  2362. this.writeFixed64(val);
  2363. },
  2364. writeSFixed64Field: function(tag, val) {
  2365. this.writeTag(tag, Pbf.Fixed64);
  2366. this.writeSFixed64(val);
  2367. },
  2368. writeVarintField: function(tag, val) {
  2369. this.writeTag(tag, Pbf.Varint);
  2370. this.writeVarint(val);
  2371. },
  2372. writeSVarintField: function(tag, val) {
  2373. this.writeTag(tag, Pbf.Varint);
  2374. this.writeSVarint(val);
  2375. },
  2376. writeStringField: function(tag, str) {
  2377. this.writeTag(tag, Pbf.Bytes);
  2378. this.writeString(str);
  2379. },
  2380. writeFloatField: function(tag, val) {
  2381. this.writeTag(tag, Pbf.Fixed32);
  2382. this.writeFloat(val);
  2383. },
  2384. writeDoubleField: function(tag, val) {
  2385. this.writeTag(tag, Pbf.Fixed64);
  2386. this.writeDouble(val);
  2387. },
  2388. writeBooleanField: function(tag, val) {
  2389. this.writeVarintField(tag, Boolean(val));
  2390. }
  2391. };
  2392. function readVarintRemainder(l, s, p) {
  2393. var buf = p.buf,
  2394. h, b;
  2395. b = buf[p.pos++]; h = (b & 0x70) >> 4; if (b < 0x80) return toNum(l, h, s);
  2396. b = buf[p.pos++]; h |= (b & 0x7f) << 3; if (b < 0x80) return toNum(l, h, s);
  2397. b = buf[p.pos++]; h |= (b & 0x7f) << 10; if (b < 0x80) return toNum(l, h, s);
  2398. b = buf[p.pos++]; h |= (b & 0x7f) << 17; if (b < 0x80) return toNum(l, h, s);
  2399. b = buf[p.pos++]; h |= (b & 0x7f) << 24; if (b < 0x80) return toNum(l, h, s);
  2400. b = buf[p.pos++]; h |= (b & 0x01) << 31; if (b < 0x80) return toNum(l, h, s);
  2401. throw new Error('Expected varint not more than 10 bytes');
  2402. }
  2403. function readPackedEnd(pbf) {
  2404. return pbf.type === Pbf.Bytes ?
  2405. pbf.readVarint() + pbf.pos : pbf.pos + 1;
  2406. }
  2407. function toNum(low, high, isSigned) {
  2408. if (isSigned) {
  2409. return high * 0x100000000 + (low >>> 0);
  2410. }
  2411. return ((high >>> 0) * 0x100000000) + (low >>> 0);
  2412. }
  2413. function writeBigVarint(val, pbf) {
  2414. var low, high;
  2415. if (val >= 0) {
  2416. low = (val % 0x100000000) | 0;
  2417. high = (val / 0x100000000) | 0;
  2418. } else {
  2419. low = ~(-val % 0x100000000);
  2420. high = ~(-val / 0x100000000);
  2421. if (low ^ 0xffffffff) {
  2422. low = (low + 1) | 0;
  2423. } else {
  2424. low = 0;
  2425. high = (high + 1) | 0;
  2426. }
  2427. }
  2428. if (val >= 0x10000000000000000 || val < -0x10000000000000000) {
  2429. throw new Error('Given varint doesn\'t fit into 10 bytes');
  2430. }
  2431. pbf.realloc(10);
  2432. writeBigVarintLow(low, high, pbf);
  2433. writeBigVarintHigh(high, pbf);
  2434. }
  2435. function writeBigVarintLow(low, high, pbf) {
  2436. pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;
  2437. pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;
  2438. pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;
  2439. pbf.buf[pbf.pos++] = low & 0x7f | 0x80; low >>>= 7;
  2440. pbf.buf[pbf.pos] = low & 0x7f;
  2441. }
  2442. function writeBigVarintHigh(high, pbf) {
  2443. var lsb = (high & 0x07) << 4;
  2444. pbf.buf[pbf.pos++] |= lsb | ((high >>>= 3) ? 0x80 : 0); if (!high) return;
  2445. pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;
  2446. pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;
  2447. pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;
  2448. pbf.buf[pbf.pos++] = high & 0x7f | ((high >>>= 7) ? 0x80 : 0); if (!high) return;
  2449. pbf.buf[pbf.pos++] = high & 0x7f;
  2450. }
  2451. function makeRoomForExtraLength(startPos, len, pbf) {
  2452. var extraLen =
  2453. len <= 0x3fff ? 1 :
  2454. len <= 0x1fffff ? 2 :
  2455. len <= 0xfffffff ? 3 : Math.floor(Math.log(len) / (Math.LN2 * 7));
  2456. // if 1 byte isn't enough for encoding message length, shift the data to the right
  2457. pbf.realloc(extraLen);
  2458. for (var i = pbf.pos - 1; i >= startPos; i--) pbf.buf[i + extraLen] = pbf.buf[i];
  2459. }
  2460. function writePackedVarint(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeVarint(arr[i]); }
  2461. function writePackedSVarint(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSVarint(arr[i]); }
  2462. function writePackedFloat(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFloat(arr[i]); }
  2463. function writePackedDouble(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeDouble(arr[i]); }
  2464. function writePackedBoolean(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeBoolean(arr[i]); }
  2465. function writePackedFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFixed32(arr[i]); }
  2466. function writePackedSFixed32(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed32(arr[i]); }
  2467. function writePackedFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeFixed64(arr[i]); }
  2468. function writePackedSFixed64(arr, pbf) { for (var i = 0; i < arr.length; i++) pbf.writeSFixed64(arr[i]); }
  2469. // Buffer code below from https://github.com/feross/buffer, MIT-licensed
  2470. function readUInt32(buf, pos) {
  2471. return ((buf[pos]) |
  2472. (buf[pos + 1] << 8) |
  2473. (buf[pos + 2] << 16)) +
  2474. (buf[pos + 3] * 0x1000000);
  2475. }
  2476. function writeInt32(buf, val, pos) {
  2477. buf[pos] = val;
  2478. buf[pos + 1] = (val >>> 8);
  2479. buf[pos + 2] = (val >>> 16);
  2480. buf[pos + 3] = (val >>> 24);
  2481. }
  2482. function readInt32(buf, pos) {
  2483. return ((buf[pos]) |
  2484. (buf[pos + 1] << 8) |
  2485. (buf[pos + 2] << 16)) +
  2486. (buf[pos + 3] << 24);
  2487. }
  2488. function readUtf8(buf, pos, end) {
  2489. var str = '';
  2490. var i = pos;
  2491. while (i < end) {
  2492. var b0 = buf[i];
  2493. var c = null; // codepoint
  2494. var bytesPerSequence =
  2495. b0 > 0xEF ? 4 :
  2496. b0 > 0xDF ? 3 :
  2497. b0 > 0xBF ? 2 : 1;
  2498. if (i + bytesPerSequence > end) break;
  2499. var b1, b2, b3;
  2500. if (bytesPerSequence === 1) {
  2501. if (b0 < 0x80) {
  2502. c = b0;
  2503. }
  2504. } else if (bytesPerSequence === 2) {
  2505. b1 = buf[i + 1];
  2506. if ((b1 & 0xC0) === 0x80) {
  2507. c = (b0 & 0x1F) << 0x6 | (b1 & 0x3F);
  2508. if (c <= 0x7F) {
  2509. c = null;
  2510. }
  2511. }
  2512. } else if (bytesPerSequence === 3) {
  2513. b1 = buf[i + 1];
  2514. b2 = buf[i + 2];
  2515. if ((b1 & 0xC0) === 0x80 && (b2 & 0xC0) === 0x80) {
  2516. c = (b0 & 0xF) << 0xC | (b1 & 0x3F) << 0x6 | (b2 & 0x3F);
  2517. if (c <= 0x7FF || (c >= 0xD800 && c <= 0xDFFF)) {
  2518. c = null;
  2519. }
  2520. }
  2521. } else if (bytesPerSequence === 4) {
  2522. b1 = buf[i + 1];
  2523. b2 = buf[i + 2];
  2524. b3 = buf[i + 3];
  2525. if ((b1 & 0xC0) === 0x80 && (b2 & 0xC0) === 0x80 && (b3 & 0xC0) === 0x80) {
  2526. c = (b0 & 0xF) << 0x12 | (b1 & 0x3F) << 0xC | (b2 & 0x3F) << 0x6 | (b3 & 0x3F);
  2527. if (c <= 0xFFFF || c >= 0x110000) {
  2528. c = null;
  2529. }
  2530. }
  2531. }
  2532. if (c === null) {
  2533. c = 0xFFFD;
  2534. bytesPerSequence = 1;
  2535. } else if (c > 0xFFFF) {
  2536. c -= 0x10000;
  2537. str += String.fromCharCode(c >>> 10 & 0x3FF | 0xD800);
  2538. c = 0xDC00 | c & 0x3FF;
  2539. }
  2540. str += String.fromCharCode(c);
  2541. i += bytesPerSequence;
  2542. }
  2543. return str;
  2544. }
  2545. function readUtf8TextDecoder(buf, pos, end) {
  2546. return utf8TextDecoder.decode(buf.subarray(pos, end));
  2547. }
  2548. function writeUtf8(buf, str, pos) {
  2549. for (var i = 0, c, lead; i < str.length; i++) {
  2550. c = str.charCodeAt(i); // code point
  2551. if (c > 0xD7FF && c < 0xE000) {
  2552. if (lead) {
  2553. if (c < 0xDC00) {
  2554. buf[pos++] = 0xEF;
  2555. buf[pos++] = 0xBF;
  2556. buf[pos++] = 0xBD;
  2557. lead = c;
  2558. continue;
  2559. } else {
  2560. c = lead - 0xD800 << 10 | c - 0xDC00 | 0x10000;
  2561. lead = null;
  2562. }
  2563. } else {
  2564. if (c > 0xDBFF || (i + 1 === str.length)) {
  2565. buf[pos++] = 0xEF;
  2566. buf[pos++] = 0xBF;
  2567. buf[pos++] = 0xBD;
  2568. } else {
  2569. lead = c;
  2570. }
  2571. continue;
  2572. }
  2573. } else if (lead) {
  2574. buf[pos++] = 0xEF;
  2575. buf[pos++] = 0xBF;
  2576. buf[pos++] = 0xBD;
  2577. lead = null;
  2578. }
  2579. if (c < 0x80) {
  2580. buf[pos++] = c;
  2581. } else {
  2582. if (c < 0x800) {
  2583. buf[pos++] = c >> 0x6 | 0xC0;
  2584. } else {
  2585. if (c < 0x10000) {
  2586. buf[pos++] = c >> 0xC | 0xE0;
  2587. } else {
  2588. buf[pos++] = c >> 0x12 | 0xF0;
  2589. buf[pos++] = c >> 0xC & 0x3F | 0x80;
  2590. }
  2591. buf[pos++] = c >> 0x6 & 0x3F | 0x80;
  2592. }
  2593. buf[pos++] = c & 0x3F | 0x80;
  2594. }
  2595. }
  2596. return pos;
  2597. }
  2598. /***/ }),
  2599. /***/ 107:
  2600. /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
  2601. (function (global, factory) {
  2602. true ? factory() :
  2603. 0;
  2604. }(this, (function () { 'use strict';
  2605. /**
  2606. * @this {Promise}
  2607. */
  2608. function finallyConstructor(callback) {
  2609. var constructor = this.constructor;
  2610. return this.then(
  2611. function(value) {
  2612. // @ts-ignore
  2613. return constructor.resolve(callback()).then(function() {
  2614. return value;
  2615. });
  2616. },
  2617. function(reason) {
  2618. // @ts-ignore
  2619. return constructor.resolve(callback()).then(function() {
  2620. // @ts-ignore
  2621. return constructor.reject(reason);
  2622. });
  2623. }
  2624. );
  2625. }
  2626. // Store setTimeout reference so promise-polyfill will be unaffected by
  2627. // other code modifying setTimeout (like sinon.useFakeTimers())
  2628. var setTimeoutFunc = setTimeout;
  2629. function isArray(x) {
  2630. return Boolean(x && typeof x.length !== 'undefined');
  2631. }
  2632. function noop() {}
  2633. // Polyfill for Function.prototype.bind
  2634. function bind(fn, thisArg) {
  2635. return function() {
  2636. fn.apply(thisArg, arguments);
  2637. };
  2638. }
  2639. /**
  2640. * @constructor
  2641. * @param {Function} fn
  2642. */
  2643. function Promise(fn) {
  2644. if (!(this instanceof Promise))
  2645. throw new TypeError('Promises must be constructed via new');
  2646. if (typeof fn !== 'function') throw new TypeError('not a function');
  2647. /** @type {!number} */
  2648. this._state = 0;
  2649. /** @type {!boolean} */
  2650. this._handled = false;
  2651. /** @type {Promise|undefined} */
  2652. this._value = undefined;
  2653. /** @type {!Array<!Function>} */
  2654. this._deferreds = [];
  2655. doResolve(fn, this);
  2656. }
  2657. function handle(self, deferred) {
  2658. while (self._state === 3) {
  2659. self = self._value;
  2660. }
  2661. if (self._state === 0) {
  2662. self._deferreds.push(deferred);
  2663. return;
  2664. }
  2665. self._handled = true;
  2666. Promise._immediateFn(function() {
  2667. var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;
  2668. if (cb === null) {
  2669. (self._state === 1 ? resolve : reject)(deferred.promise, self._value);
  2670. return;
  2671. }
  2672. var ret;
  2673. try {
  2674. ret = cb(self._value);
  2675. } catch (e) {
  2676. reject(deferred.promise, e);
  2677. return;
  2678. }
  2679. resolve(deferred.promise, ret);
  2680. });
  2681. }
  2682. function resolve(self, newValue) {
  2683. try {
  2684. // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure
  2685. if (newValue === self)
  2686. throw new TypeError('A promise cannot be resolved with itself.');
  2687. if (
  2688. newValue &&
  2689. (typeof newValue === 'object' || typeof newValue === 'function')
  2690. ) {
  2691. var then = newValue.then;
  2692. if (newValue instanceof Promise) {
  2693. self._state = 3;
  2694. self._value = newValue;
  2695. finale(self);
  2696. return;
  2697. } else if (typeof then === 'function') {
  2698. doResolve(bind(then, newValue), self);
  2699. return;
  2700. }
  2701. }
  2702. self._state = 1;
  2703. self._value = newValue;
  2704. finale(self);
  2705. } catch (e) {
  2706. reject(self, e);
  2707. }
  2708. }
  2709. function reject(self, newValue) {
  2710. self._state = 2;
  2711. self._value = newValue;
  2712. finale(self);
  2713. }
  2714. function finale(self) {
  2715. if (self._state === 2 && self._deferreds.length === 0) {
  2716. Promise._immediateFn(function() {
  2717. if (!self._handled) {
  2718. Promise._unhandledRejectionFn(self._value);
  2719. }
  2720. });
  2721. }
  2722. for (var i = 0, len = self._deferreds.length; i < len; i++) {
  2723. handle(self, self._deferreds[i]);
  2724. }
  2725. self._deferreds = null;
  2726. }
  2727. /**
  2728. * @constructor
  2729. */
  2730. function Handler(onFulfilled, onRejected, promise) {
  2731. this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;
  2732. this.onRejected = typeof onRejected === 'function' ? onRejected : null;
  2733. this.promise = promise;
  2734. }
  2735. /**
  2736. * Take a potentially misbehaving resolver function and make sure
  2737. * onFulfilled and onRejected are only called once.
  2738. *
  2739. * Makes no guarantees about asynchrony.
  2740. */
  2741. function doResolve(fn, self) {
  2742. var done = false;
  2743. try {
  2744. fn(
  2745. function(value) {
  2746. if (done) return;
  2747. done = true;
  2748. resolve(self, value);
  2749. },
  2750. function(reason) {
  2751. if (done) return;
  2752. done = true;
  2753. reject(self, reason);
  2754. }
  2755. );
  2756. } catch (ex) {
  2757. if (done) return;
  2758. done = true;
  2759. reject(self, ex);
  2760. }
  2761. }
  2762. Promise.prototype['catch'] = function(onRejected) {
  2763. return this.then(null, onRejected);
  2764. };
  2765. Promise.prototype.then = function(onFulfilled, onRejected) {
  2766. // @ts-ignore
  2767. var prom = new this.constructor(noop);
  2768. handle(this, new Handler(onFulfilled, onRejected, prom));
  2769. return prom;
  2770. };
  2771. Promise.prototype['finally'] = finallyConstructor;
  2772. Promise.all = function(arr) {
  2773. return new Promise(function(resolve, reject) {
  2774. if (!isArray(arr)) {
  2775. return reject(new TypeError('Promise.all accepts an array'));
  2776. }
  2777. var args = Array.prototype.slice.call(arr);
  2778. if (args.length === 0) return resolve([]);
  2779. var remaining = args.length;
  2780. function res(i, val) {
  2781. try {
  2782. if (val && (typeof val === 'object' || typeof val === 'function')) {
  2783. var then = val.then;
  2784. if (typeof then === 'function') {
  2785. then.call(
  2786. val,
  2787. function(val) {
  2788. res(i, val);
  2789. },
  2790. reject
  2791. );
  2792. return;
  2793. }
  2794. }
  2795. args[i] = val;
  2796. if (--remaining === 0) {
  2797. resolve(args);
  2798. }
  2799. } catch (ex) {
  2800. reject(ex);
  2801. }
  2802. }
  2803. for (var i = 0; i < args.length; i++) {
  2804. res(i, args[i]);
  2805. }
  2806. });
  2807. };
  2808. Promise.resolve = function(value) {
  2809. if (value && typeof value === 'object' && value.constructor === Promise) {
  2810. return value;
  2811. }
  2812. return new Promise(function(resolve) {
  2813. resolve(value);
  2814. });
  2815. };
  2816. Promise.reject = function(value) {
  2817. return new Promise(function(resolve, reject) {
  2818. reject(value);
  2819. });
  2820. };
  2821. Promise.race = function(arr) {
  2822. return new Promise(function(resolve, reject) {
  2823. if (!isArray(arr)) {
  2824. return reject(new TypeError('Promise.race accepts an array'));
  2825. }
  2826. for (var i = 0, len = arr.length; i < len; i++) {
  2827. Promise.resolve(arr[i]).then(resolve, reject);
  2828. }
  2829. });
  2830. };
  2831. // Use polyfill for setImmediate for performance gains
  2832. Promise._immediateFn =
  2833. // @ts-ignore
  2834. (typeof setImmediate === 'function' &&
  2835. function(fn) {
  2836. // @ts-ignore
  2837. setImmediate(fn);
  2838. }) ||
  2839. function(fn) {
  2840. setTimeoutFunc(fn, 0);
  2841. };
  2842. Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) {
  2843. if (typeof console !== 'undefined' && console) {
  2844. console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console
  2845. }
  2846. };
  2847. /** @suppress {undefinedVars} */
  2848. var globalNS = (function() {
  2849. // the only reliable means to get the global object is
  2850. // `Function('return this')()`
  2851. // However, this causes CSP violations in Chrome apps.
  2852. if (typeof self !== 'undefined') {
  2853. return self;
  2854. }
  2855. if (typeof window !== 'undefined') {
  2856. return window;
  2857. }
  2858. if (typeof __webpack_require__.g !== 'undefined') {
  2859. return __webpack_require__.g;
  2860. }
  2861. throw new Error('unable to locate global object');
  2862. })();
  2863. if (!('Promise' in globalNS)) {
  2864. globalNS['Promise'] = Promise;
  2865. } else if (!globalNS.Promise.prototype['finally']) {
  2866. globalNS.Promise.prototype['finally'] = finallyConstructor;
  2867. }
  2868. })));
  2869. /***/ })
  2870. /******/ });
  2871. /************************************************************************/
  2872. /******/ // The module cache
  2873. /******/ var __webpack_module_cache__ = {};
  2874. /******/
  2875. /******/ // The require function
  2876. /******/ function __webpack_require__(moduleId) {
  2877. /******/ // Check if module is in cache
  2878. /******/ if(__webpack_module_cache__[moduleId]) {
  2879. /******/ return __webpack_module_cache__[moduleId].exports;
  2880. /******/ }
  2881. /******/ // Create a new module (and put it into the cache)
  2882. /******/ var module = __webpack_module_cache__[moduleId] = {
  2883. /******/ // no module.id needed
  2884. /******/ // no module.loaded needed
  2885. /******/ exports: {}
  2886. /******/ };
  2887. /******/
  2888. /******/ // Execute the module function
  2889. /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  2890. /******/
  2891. /******/ // Return the exports of the module
  2892. /******/ return module.exports;
  2893. /******/ }
  2894. /******/
  2895. /************************************************************************/
  2896. /******/ /* webpack/runtime/compat get default export */
  2897. /******/ (() => {
  2898. /******/ // getDefaultExport function for compatibility with non-harmony modules
  2899. /******/ __webpack_require__.n = (module) => {
  2900. /******/ var getter = module && module.__esModule ?
  2901. /******/ () => module['default'] :
  2902. /******/ () => module;
  2903. /******/ __webpack_require__.d(getter, { a: getter });
  2904. /******/ return getter;
  2905. /******/ };
  2906. /******/ })();
  2907. /******/
  2908. /******/ /* webpack/runtime/define property getters */
  2909. /******/ (() => {
  2910. /******/ // define getter functions for harmony exports
  2911. /******/ __webpack_require__.d = (exports, definition) => {
  2912. /******/ for(var key in definition) {
  2913. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  2914. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  2915. /******/ }
  2916. /******/ }
  2917. /******/ };
  2918. /******/ })();
  2919. /******/
  2920. /******/ /* webpack/runtime/global */
  2921. /******/ (() => {
  2922. /******/ __webpack_require__.g = (function() {
  2923. /******/ if (typeof globalThis === 'object') return globalThis;
  2924. /******/ try {
  2925. /******/ return this || new Function('return this')();
  2926. /******/ } catch (e) {
  2927. /******/ if (typeof window === 'object') return window;
  2928. /******/ }
  2929. /******/ })();
  2930. /******/ })();
  2931. /******/
  2932. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  2933. /******/ (() => {
  2934. /******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
  2935. /******/ })();
  2936. /******/
  2937. /************************************************************************/
  2938. (() => {
  2939. "use strict";
  2940. // UNUSED EXPORTS: AddressMatchService, AggQueryBuilderParameter, AggregationParameter, AggregationQueryBuilderType, AggregationType, AlongLineDirection, AnalystAreaUnit, AnalystSizeUnit, AreaSolarRadiationParameters, ArrayStatistic, AttributesPopContainer, BaiduCRS, BaiduTileLayer, BufferAnalystParameters, BufferDistance, BufferEndType, BufferRadiusUnit, BufferSetting, BuffersAnalystJobsParameter, BurstPipelineAnalystParameters, CRS, CanvasRenderer, CartoCSSToLeaflet, CartoStyleMap, ChangeTileVersion, ChartQueryFilterParameter, ChartQueryParameters, ChartService, ChartType, ChartView, ChartViewModel, CircleStyle, CityTabsPage, ClientComputationLayer, ClientComputationView, ClientComputationViewModel, ClientType, ClipAnalystMode, ClipParameter, CloudTileLayer, CloverStyle, ColorDictionary, ColorGradientType, ColorSpaceType, ColorsPickerUtil, CommonContainer, CommontypesConversion, CompOpMap, ComponentsUtil, ComputeWeightMatrixParameters, DataFlowLayer, DataFlowService, DataFlowView, DataFormat, DataItemOrderBy, DataItemType, DataReturnMode, DataReturnOption, DataServiceQueryView, DataServiceQueryViewModel, DatasetBufferAnalystParameters, DatasetInfo, DatasetOverlayAnalystParameters, DatasetSurfaceAnalystParameters, DatasetThiessenAnalystParameters, DatasourceConnectionInfo, DefaultStyle, DensityKernelAnalystParameters, DirectionType, DistributedAnalysisView, DistributedAnalysisViewModel, DropDownBox, EchartsLayer, EditFeaturesParameters, EditType, ElasticSearch, EngineType, Exponent, FacilityAnalyst3DParameters, FacilityAnalystSinks3DParameters, FacilityAnalystSources3DParameters, FacilityAnalystStreamParameters, FacilityAnalystTracedown3DParameters, FacilityAnalystTraceup3DParameters, FacilityAnalystUpstream3DParameters, FeatureService, FetchRequest, FieldParameters, FieldService, FieldStatisticsParameters, FileConfig, FileModel, FileReaderUtil, FileTypes, FillGradientMode, FilterAggParameter, FilterField, FilterParameter, FindClosestFacilitiesParameters, FindLocationParameters, FindMTSPPathsParameters, FindPathParameters, FindServiceAreasParameters, FindTSPPathsParameters, GenerateSpatialDataParameters, GeoBoundingBoxQueryBuilderParameter, GeoCodingParameter, GeoDecodingParameter, GeoFeatureThemeLayer, GeoHashGridAggParameter, GeoJSONLayerWithName, GeoJsonLayerDataModel, GeoJsonLayersDataModel, GeoRelationAnalystParameters, GeometryBufferAnalystParameters, GeometryOverlayAnalystParameters, GeometrySurfaceAnalystParameters, GeometryThiessenAnalystParameters, GeometryType, GetFeatureMode, GetFeaturesByBoundsParameters, GetFeaturesByBufferParameters, GetFeaturesByGeometryParameters, GetFeaturesByIDsParameters, GetFeaturesBySQLParameters, GetGridCellInfosParameters, GetResolutionFromScaleDpi, GraduatedMode, GraphAxesTextDisplayMode, GraphThemeLayer, Graphic, GraphicLayer, Grid, GridCellInfosService, GridType, IManager, IManagerCreateNodeParam, IManagerServiceBase, IPortal, IPortalAddDataParam, IPortalAddResourceParam, IPortalDataConnectionInfoParam, IPortalDataMetaInfoParam, IPortalDataStoreInfoParam, IPortalQueryParam, IPortalQueryResult, IPortalRegisterServiceParam, IPortalResource, IPortalServiceBase, IPortalShareEntity, IPortalShareParam, IPortalUser, Image, ImageMapLayer, ImageStyle, IndexTabsPageContainer, InterpolationAlgorithmType, InterpolationAnalystParameters, InterpolationIDWAnalystParameters, InterpolationKrigingAnalystParameters, InterpolationRBFAnalystParameters, JoinItem, JoinType, KernelDensityJobParameter, KeyServiceParameter, LabelBackShape, LabelImageCell, LabelMatrixCell, LabelMixedTextStyle, LabelOverLengthMode, LabelSymbolCell, LabelThemeCell, LabelThemeLayer, LayerInfoService, LayerStatus, LayerType, LeafletMapCoordSys, LineSymbolizer, LinkItem, Logo, MapService, MapVLayer, MapVRenderer, MappingParameters, MathExpressionAnalysisParameters, MeasureMode, MeasureParameters, MeasureService, MessageBox, NavTabsPage, NetworkAnalyst3DService, NetworkAnalystService, NonEarthCRS, NonProjection, NormalizeScale, Online, OnlineData, OnlineQueryDatasParameter, OnlineServiceBase, OpenFileView, OpenFileViewModel, OutputSetting, OutputType, OverlapDisplayedOptions, OverlayAnalystParameters, OverlayGeoJobParameter, OverlayOperationType, PaginationContainer, PixelFormat, PointSymbolizer, PointWithMeasure, PolyBase, PopContainer, ProcessingService, QueryByBoundsParameters, QueryByDistanceParameters, QueryByGeometryParameters, QueryBySQLParameters, QueryOption, QueryParameters, QueryService, RangeMode, RangeThemeLayer, RankSymbolThemeLayer, RegionSymbolizer, Route, RouteCalculateMeasureParameters, RouteLocatorParameters, SVGRenderer, SearchMode, SearchView, SecurityManager, Select, ServerColor, ServerFeature, ServerGeometry, ServerInfo, ServerStyle, ServerStyleMap, ServerTextStyle, ServerTheme, ServerType, ServiceBase, ServiceStatus, SetLayerInfoParameters, SetLayerStatusParameters, SetLayersInfoParameters, SideType, SingleObjectQueryJobsParameter, SmoothMethod, SpatialAnalystService, SpatialQueryMode, SpatialRelationType, StatisticAnalystMode, StatisticMode, StopQueryParameters, SummaryAttributesJobsParameter, SummaryMeshJobParameter, SummaryRegionJobParameter, SummaryType, SuperMap, SupplyCenter, SupplyCenterType, SurfaceAnalystMethod, SurfaceAnalystParameters, SurfaceAnalystParametersSetting, Symbolizer, TerrainCurvatureCalculationParameters, TextAlignment, TextSymbolizer, Theme, ThemeDotDensity, ThemeFeature, ThemeFlow, ThemeGraduatedSymbol, ThemeGraduatedSymbolStyle, ThemeGraph, ThemeGraphAxes, ThemeGraphItem, ThemeGraphSize, ThemeGraphText, ThemeGraphTextFormat, ThemeGraphType, ThemeGridRange, ThemeGridRangeItem, ThemeGridUnique, ThemeGridUniqueItem, ThemeLabel, ThemeLabelAlongLine, ThemeLabelBackground, ThemeLabelItem, ThemeLabelText, ThemeLabelUniqueItem, ThemeLayer, ThemeMemoryData, ThemeOffset, ThemeParameters, ThemeRange, ThemeRangeItem, ThemeService, ThemeType, ThemeUnique, ThemeUniqueItem, ThiessenAnalystParameters, TianDiTu_MercatorCRS, TianDiTu_WGS84CRS, TiandituTileLayer, TileVectorLayer, TiledMapLayer, TimeFlowControl, TokenServiceParameter, TopologyValidatorJobsParameter, TopologyValidatorRule, TrafficTransferAnalystService, TransferLine, TransferPathParameters, TransferPreference, TransferSolutionParameters, TransferTactic, TransportationAnalystParameter, TransportationAnalystResultSetting, TurfLayer, TurnType, UGCLayer, UGCLayerType, UGCMapLayer, UGCSubLayer, UnicodeMarker, UniqueThemeLayer, Unit, UpdateEdgeWeightParameters, UpdateTurnNodeWeightParameters, VariogramMode, Vector, VectorClipJobsParameter, VectorFeatureType, VectorGrid, VectorTile, VectorTileFormat, VectorTileJSON, VectorTilePBF, WMTSLayer, WebMap, WebPrintingJobContent, WebPrintingJobCustomItems, WebPrintingJobExportOptions, WebPrintingJobImage, WebPrintingJobLayers, WebPrintingJobLayoutOptions, WebPrintingJobLegendOptions, WebPrintingJobLittleMapOptions, WebPrintingJobNorthArrowOptions, WebPrintingJobParameters, WebPrintingJobScaleBarOptions, WebPrintingJobService, WebPrintingService, addressMatchService, baiduTileLayer, changeTileVersion, chartService, circleStyle, clientComputationLayer, clientComputationView, cloudTileLayer, cloverStyle, crs, dataFlowLayer, dataFlowService, dataFlowView, dataServiceQueryView, dataServiceQueryViewModel, distributedAnalysisView, echartsLayer, featureService, fieldService, geoJSONLayerWithName, getMeterPerMapUnit, graphThemeLayer, graphic, graphicLayer, gridCellInfosService, imageMapLayer, imageStyle, labelThemeLayer, layerInfoService, logo, mapService, mapVLayer, measureService, networkAnalyst3DService, networkAnalystService, nonEarthCRS, nonProjection, openFileView, openFileViewModel, processingService, queryService, rangeThemeLayer, rankSymbolThemeLayer, resolutionToScale, scaleToResolution, searchView, spatialAnalystService, themeFeature, themeService, tiandituTileLayer, tiledMapLayer, tiledVectorLayer, toGeoJSON, toSuperMapGeometry, trafficTransferAnalystService, turfLayer, unicodeMarker, uniqueThemeLayer, webMap, webPrintingJobService, wmtsLayer
  2941. ;// CONCATENATED MODULE: ./src/common/SuperMap.js
  2942. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  2943. * This program are made available under the terms of the Apache License, Version 2.0
  2944. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  2945. var SuperMap = window.SuperMap = window.SuperMap || {};
  2946. SuperMap.Components = window.SuperMap.Components || {};
  2947. ;// CONCATENATED MODULE: ./src/common/REST.js
  2948. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  2949. * This program are made available under the terms of the Apache License, Version 2.0
  2950. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  2951. /**
  2952. * @enum DataFormat
  2953. * @memberOf SuperMap
  2954. * @description 服务请求返回结果数据类型
  2955. * @type {string}
  2956. */
  2957. var DataFormat = SuperMap.DataFormat = {
  2958. /** GEOJSON */
  2959. GEOJSON: "GEOJSON",
  2960. /** ISERVER */
  2961. ISERVER: "ISERVER"
  2962. };
  2963. /**
  2964. * @enum ServerType
  2965. * @memberOf SuperMap
  2966. * @description 服务器类型
  2967. * @type {string}
  2968. */
  2969. var ServerType = SuperMap.ServerType = {
  2970. /** ISERVER */
  2971. ISERVER: "ISERVER",
  2972. /** IPORTAL */
  2973. IPORTAL: "IPORTAL",
  2974. /** ONLINE */
  2975. ONLINE: "ONLINE"
  2976. };
  2977. /**
  2978. * @enum GeometryType
  2979. * @memberOf SuperMap
  2980. * @description 几何对象枚举,定义了一系列几何对象类型。
  2981. * @type {string}
  2982. */
  2983. var GeometryType = SuperMap.GeometryType = {
  2984. /** LINE */
  2985. LINE: "LINE",
  2986. /** LINEM */
  2987. LINEM: "LINEM",
  2988. /** POINT */
  2989. POINT: "POINT",
  2990. /** REGION */
  2991. REGION: "REGION",
  2992. /** POINTEPS */
  2993. POINTEPS: "POINTEPS",
  2994. /** LINEEPS */
  2995. LINEEPS: "LINEEPS",
  2996. /** REGIONEPS */
  2997. REGIONEPS: "REGIONEPS",
  2998. /** ELLIPSE */
  2999. ELLIPSE: "ELLIPSE",
  3000. /** CIRCLE */
  3001. CIRCLE: "CIRCLE",
  3002. /** TEXT */
  3003. TEXT: "TEXT",
  3004. /** RECTANGLE */
  3005. RECTANGLE: "RECTANGLE",
  3006. /** UNKNOWN */
  3007. UNKNOWN: "UNKNOWN",
  3008. /** GEOCOMPOUND */
  3009. GEOCOMPOUND:"GEOCOMPOUND"
  3010. };
  3011. /**
  3012. * @enum QueryOption
  3013. * @memberOf SuperMap
  3014. * @description 查询结果类型枚举,描述查询结果返回类型,包括只返回属性、只返回几何实体以及返回属性和几何实体。
  3015. * @type {string}
  3016. */
  3017. var QueryOption = SuperMap.QueryOption = {
  3018. /** 属性 */
  3019. ATTRIBUTE: "ATTRIBUTE",
  3020. /** 属性和几何对象 */
  3021. ATTRIBUTEANDGEOMETRY: "ATTRIBUTEANDGEOMETRY",
  3022. /** 几何对象 */
  3023. GEOMETRY: "GEOMETRY"
  3024. };
  3025. /**
  3026. * @enum JoinType
  3027. * @memberOf SuperMap
  3028. * @description 关联查询时的关联类型常量。
  3029. * 该类定义了两个表之间的连接类型常量,决定了对两个表之间进行连接查询时,查询结果中得到的记录的情况。
  3030. * @type {string}
  3031. */
  3032. var JoinType = SuperMap.JoinType = {
  3033. /** INNERJOIN */
  3034. INNERJOIN: "INNERJOIN",
  3035. /** LEFTJOIN */
  3036. LEFTJOIN: "LEFTJOIN"
  3037. };
  3038. /**
  3039. * @enum SpatialQueryMode
  3040. * @memberOf SuperMap
  3041. * @description 空间查询模式枚举。该类定义了空间查询操作模式常量。
  3042. * @type {string}
  3043. */
  3044. var SpatialQueryMode = SuperMap.SpatialQueryMode = {
  3045. /** 包含空间查询模式 */
  3046. CONTAIN: "CONTAIN",
  3047. /** 交叉空间查询模式 */
  3048. CROSS: "CROSS",
  3049. /** 分离空间查询模式 */
  3050. DISJOINT: "DISJOINT",
  3051. /** 重合空间查询模式 */
  3052. IDENTITY: "IDENTITY",
  3053. /** 相交空间查询模式 */
  3054. INTERSECT: "INTERSECT",
  3055. /** 无空间查询 */
  3056. NONE: "NONE",
  3057. /** 叠加空间查询模式 */
  3058. OVERLAP: "OVERLAP",
  3059. /** 邻接空间查询模式 */
  3060. TOUCH: "TOUCH",
  3061. /** 被包含空间查询模式 */
  3062. WITHIN: "WITHIN"
  3063. };
  3064. /**
  3065. * @enum SpatialRelationType
  3066. * @memberOf SuperMap
  3067. * @description 数据集对象间的空间关系枚举。
  3068. * 该类定义了数据集对象间的空间关系类型常量。
  3069. * @type {string}
  3070. */
  3071. var SpatialRelationType = SuperMap.SpatialRelationType = {
  3072. /** 包含关系 */
  3073. CONTAIN: "CONTAIN",
  3074. /** 相交关系 */
  3075. INTERSECT: "INTERSECT",
  3076. /** 被包含关系 */
  3077. WITHIN: "WITHIN"
  3078. };
  3079. /**
  3080. * @enum MeasureMode
  3081. * @memberOf SuperMap
  3082. * @type {string}
  3083. * @description 量算模式枚举。
  3084. * 该类定义了两种测量模式:距离测量和面积测量。
  3085. */
  3086. var MeasureMode = SuperMap.MeasureMode = {
  3087. /** 距离测量 */
  3088. DISTANCE: "DISTANCE",
  3089. /** 面积测量 */
  3090. AREA: "AREA"
  3091. };
  3092. /**
  3093. * @enum Unit
  3094. * @memberOf SuperMap
  3095. * @description 距离单位枚举。
  3096. * 该类定义了一系列距离单位类型。
  3097. * @type {string}
  3098. */
  3099. var Unit = SuperMap.Unit = {
  3100. /** 米 */
  3101. METER: "METER",
  3102. /** 千米 */
  3103. KILOMETER: "KILOMETER",
  3104. /** 英里 */
  3105. MILE: "MILE",
  3106. /** 码 */
  3107. YARD: "YARD",
  3108. /** 度 */
  3109. DEGREE: "DEGREE",
  3110. /** 毫米 */
  3111. MILLIMETER: "MILLIMETER",
  3112. /** 厘米 */
  3113. CENTIMETER: "CENTIMETER",
  3114. /** 英寸 */
  3115. INCH: "INCH",
  3116. /** 分米 */
  3117. DECIMETER: "DECIMETER",
  3118. /** 英尺 */
  3119. FOOT: "FOOT",
  3120. /** 秒 */
  3121. SECOND: "SECOND",
  3122. /** 分 */
  3123. MINUTE: "MINUTE",
  3124. /** 弧度 */
  3125. RADIAN: "RADIAN"
  3126. };
  3127. /**
  3128. * @enum BufferRadiusUnit
  3129. * @memberOf SuperMap
  3130. * @description 缓冲区距离单位枚举。
  3131. * 该类定义了一系列缓冲距离单位类型。
  3132. * @type {string}
  3133. */
  3134. var BufferRadiusUnit = SuperMap.BufferRadiusUnit = {
  3135. /** 厘米 */
  3136. CENTIMETER: "CENTIMETER",
  3137. /** 分米 */
  3138. DECIMETER: "DECIMETER",
  3139. /** 英尺 */
  3140. FOOT: "FOOT",
  3141. /** 英寸 */
  3142. INCH: "INCH",
  3143. /** 千米 */
  3144. KILOMETER: "KILOMETER",
  3145. /** 米 */
  3146. METER: "METER",
  3147. /** 英里 */
  3148. MILE: "MILE",
  3149. /** 毫米 */
  3150. MILLIMETER: "MILLIMETER",
  3151. /** 码 */
  3152. YARD: "YARD"
  3153. }
  3154. /**
  3155. * @enum EngineType
  3156. * @memberOf SuperMap
  3157. * @description 数据源引擎类型枚举。
  3158. * @type {string}
  3159. */
  3160. var EngineType = SuperMap.EngineType = {
  3161. /** 影像只读引擎类型,文件引擎,针对通用影像格式如 BMP,JPG,TIFF 以及超图自定义影像格式 SIT 等。 */
  3162. IMAGEPLUGINS: "IMAGEPLUGINS",
  3163. /** OGC 引擎类型,针对于 Web 数据源,Web 引擎,目前支持的类型有 WMS,WFS,WCS。 */
  3164. OGC: "OGC",
  3165. /** Oracle 引擎类型,针对 Oracle 数据源,数据库引擎。 */
  3166. ORACLEPLUS: "ORACLEPLUS",
  3167. /** SDB 引擎类型,文件引擎,即 SDB 数据源。 */
  3168. SDBPLUS: "SDBPLUS",
  3169. /** SQL Server 引擎类型,针对 SQL Server 数据源,数据库引擎 */
  3170. SQLPLUS: "SQLPLUS",
  3171. /** UDB 引擎类型,文件引擎。 */
  3172. UDB: "UDB"
  3173. };
  3174. /**
  3175. * @enum ThemeGraphTextFormat
  3176. * @memberOf SuperMap
  3177. * @description 统计专题图文本显示格式枚举。
  3178. * @type {string}
  3179. */
  3180. var ThemeGraphTextFormat = SuperMap.ThemeGraphTextFormat = {
  3181. /** 标题。以各子项的标题来进行标注。 */
  3182. CAPTION: "CAPTION",
  3183. /** 标题 + 百分数。以各子项的标题和所占的百分比来进行标注。 */
  3184. CAPTION_PERCENT: "CAPTION_PERCENT",
  3185. /** 标题 + 实际数值。以各子项的标题和真实数值来进行标注。 */
  3186. CAPTION_VALUE: "CAPTION_VALUE",
  3187. /** 百分数。以各子项所占的百分比来进行标注。 */
  3188. PERCENT: "PERCENT",
  3189. /** 实际数值。以各子项的真实数值来进行标注。 */
  3190. VALUE: "VALUE"
  3191. };
  3192. /**
  3193. * @enum ThemeGraphType
  3194. * @memberOf SuperMap
  3195. * @description 统计专题图类型枚举。
  3196. * @type {string}
  3197. */
  3198. var ThemeGraphType = SuperMap.ThemeGraphType = {
  3199. /** 面积图。 */
  3200. AREA: "AREA",
  3201. /** 柱状图。 */
  3202. BAR: "BAR",
  3203. /** 三维柱状图。 */
  3204. BAR3D: "BAR3D",
  3205. /** 折线图。 */
  3206. LINE: "LINE",
  3207. /** 饼图。 */
  3208. PIE: "PIE",
  3209. /** 三维饼图。 */
  3210. PIE3D: "PIE3D",
  3211. /** 点状图。 */
  3212. POINT: "POINT",
  3213. /** 环状图。 */
  3214. RING: "RING",
  3215. /** 玫瑰图。 */
  3216. ROSE: "ROSE",
  3217. /** 三维玫瑰图。 */
  3218. ROSE3D: "ROSE3D",
  3219. /** 堆叠柱状图。 */
  3220. STACK_BAR: "STACK_BAR",
  3221. /** 三维堆叠柱状图。 */
  3222. STACK_BAR3D: "STACK_BAR3D",
  3223. /** 阶梯图。 */
  3224. STEP: "STEP"
  3225. };
  3226. /**
  3227. * @enum GraphAxesTextDisplayMode
  3228. * @memberOf SuperMap
  3229. * @description 统计专题图坐标轴文本显示模式。
  3230. * @type {string}
  3231. */
  3232. var GraphAxesTextDisplayMode = SuperMap.GraphAxesTextDisplayMode = {
  3233. /** 显示全部文本。 */
  3234. ALL: "ALL",
  3235. /** 不显示。 */
  3236. NONE: "NONE",
  3237. /** 显示Y轴的文本。 */
  3238. YAXES: "YAXES"
  3239. };
  3240. /**
  3241. * @enum GraduatedMode
  3242. * @memberOf SuperMap
  3243. * @description 专题图分级模式枚举。
  3244. *
  3245. * @type {string}
  3246. */
  3247. var GraduatedMode = SuperMap.GraduatedMode = {
  3248. /** 常量分级模式。 */
  3249. CONSTANT: "CONSTANT",
  3250. /** 对数分级模式。 */
  3251. LOGARITHM: "LOGARITHM",
  3252. /** 平方根分级模式。 */
  3253. SQUAREROOT: "SQUAREROOT"
  3254. };
  3255. /**
  3256. * @enum RangeMode
  3257. * @memberOf SuperMap
  3258. * @description 范围分段专题图分段方式枚举。
  3259. * @type {string}
  3260. */
  3261. var RangeMode = SuperMap.RangeMode = {
  3262. /** 自定义分段法。 */
  3263. CUSTOMINTERVAL: "CUSTOMINTERVAL",
  3264. /** 等距离分段法。 */
  3265. EQUALINTERVAL: "EQUALINTERVAL",
  3266. /** 对数分段法。 */
  3267. LOGARITHM: "LOGARITHM",
  3268. /** 等计数分段法。 */
  3269. QUANTILE: "QUANTILE",
  3270. /** 平方根分段法。 */
  3271. SQUAREROOT: "SQUAREROOT",
  3272. /** 标准差分段法。 */
  3273. STDDEVIATION: "STDDEVIATION"
  3274. };
  3275. /**
  3276. * @enum ThemeType
  3277. * @memberOf SuperMap
  3278. * @description 专题图类型枚举。
  3279. * @type {string}
  3280. */
  3281. var ThemeType = SuperMap.ThemeType = {
  3282. /** 点密度专题图。 */
  3283. DOTDENSITY: "DOTDENSITY",
  3284. /** 等级符号专题图。 */
  3285. GRADUATEDSYMBOL: "GRADUATEDSYMBOL",
  3286. /** 统计专题图。 */
  3287. GRAPH: "GRAPH",
  3288. /** 标签专题图。 */
  3289. LABEL: "LABEL",
  3290. /** 分段专题图。 */
  3291. RANGE: "RANGE",
  3292. /** 単值专题图。 */
  3293. UNIQUE: "UNIQUE"
  3294. };
  3295. /**
  3296. * @enum ColorGradientType
  3297. * @memberOf SuperMap
  3298. * @description 渐变颜色枚举。
  3299. * @type {string}
  3300. */
  3301. var ColorGradientType = SuperMap.ColorGradientType = {
  3302. /** 黑白渐变色。 */
  3303. BLACK_WHITE: "BLACKWHITE",
  3304. /** 蓝黑渐变色。 */
  3305. BLUE_BLACK: "BLUEBLACK",
  3306. /** 蓝红渐变色。 */
  3307. BLUE_RED: "BLUERED",
  3308. /** 蓝白渐变色。 */
  3309. BLUE_WHITE: "BLUEWHITE",
  3310. /** 青黑渐变色。 */
  3311. CYAN_BLACK: "CYANBLACK",
  3312. /** 青蓝渐变色。 */
  3313. CYAN_BLUE: "CYANBLUE",
  3314. /** 青绿渐变色。 */
  3315. CYAN_GREEN: "CYANGREEN",
  3316. /** 青白渐变色。 */
  3317. CYAN_WHITE: "CYANWHITE",
  3318. /** 绿黑渐变色。 */
  3319. GREEN_BLACK: "GREENBLACK",
  3320. /** 绿蓝渐变色。 */
  3321. GREEN_BLUE: "GREENBLUE",
  3322. /** 绿橙紫渐变色。 */
  3323. GREEN_ORANGE_VIOLET: "GREENORANGEVIOLET",
  3324. /** 绿红渐变色。 */
  3325. GREEN_RED: "GREENRED",
  3326. /** 蓝红渐变色。 */
  3327. GREEN_WHITE: "GREENWHITE",
  3328. /** 粉黑渐变色。 */
  3329. PINK_BLACK: "PINKBLACK",
  3330. /** 粉蓝渐变色。 */
  3331. PINK_BLUE: "PINKBLUE",
  3332. /** 粉红渐变色。 */
  3333. PINK_RED: "PINKRED",
  3334. /** 粉白渐变色。 */
  3335. PINK_WHITE: "PINKWHITE",
  3336. /** 彩虹色。 */
  3337. RAIN_BOW: "RAINBOW",
  3338. /** 红黑渐变色。 */
  3339. RED_BLACK: "REDBLACK",
  3340. /** 红白渐变色。 */
  3341. RED_WHITE: "REDWHITE",
  3342. /** 光谱渐变。 */
  3343. SPECTRUM: "SPECTRUM",
  3344. /** 地形渐变,用于三维显示效果较好。 */
  3345. TERRAIN: "TERRAIN",
  3346. /** 黄黑渐变色。 */
  3347. YELLOW_BLACK: "YELLOWBLACK",
  3348. /** 黄蓝渐变色。 */
  3349. YELLOW_BLUE: "YELLOWBLUE",
  3350. /** 黄绿渐变色。 */
  3351. YELLOW_GREEN: "YELLOWGREEN",
  3352. /** 黄红渐变色。 */
  3353. YELLOW_RED: "YELLOWRED",
  3354. /** 黄白渐变色。 */
  3355. YELLOW_WHITE: "YELLOWWHITE"
  3356. };
  3357. /**
  3358. * @enum TextAlignment
  3359. * @memberOf SuperMap
  3360. * @description 文本对齐枚举。
  3361. * @type {string}
  3362. */
  3363. var TextAlignment = SuperMap.TextAlignment = {
  3364. /** 左上角对齐。 */
  3365. TOPLEFT: "TOPLEFT",
  3366. /** 顶部居中对齐。 */
  3367. TOPCENTER: "TOPCENTER",
  3368. /** 右上角对齐。 */
  3369. TOPRIGHT: "TOPRIGHT",
  3370. /** 基准线左对齐。 */
  3371. BASELINELEFT: "BASELINELEFT",
  3372. /** 基准线居中对齐。 */
  3373. BASELINECENTER: "BASELINECENTER",
  3374. /** 基准线右对齐。 */
  3375. BASELINERIGHT: "BASELINERIGHT",
  3376. /** 左下角对齐。 */
  3377. BOTTOMLEFT: "BOTTOMLEFT",
  3378. /** 底部居中对齐。 */
  3379. BOTTOMCENTER: "BOTTOMCENTER",
  3380. /** 右下角对齐。 */
  3381. BOTTOMRIGHT: "BOTTOMRIGHT",
  3382. /** 左中对齐。 */
  3383. MIDDLELEFT: "MIDDLELEFT",
  3384. /** 中心对齐。 */
  3385. MIDDLECENTER: "MIDDLECENTER",
  3386. /** 右中对齐。 */
  3387. MIDDLERIGHT: "MIDDLERIGHT"
  3388. };
  3389. /**
  3390. * @enum FillGradientMode
  3391. * @memberOf SuperMap
  3392. * @description 渐变填充风格的渐变类型枚举。
  3393. * @type {string}
  3394. */
  3395. var FillGradientMode = SuperMap.FillGradientMode = {
  3396. /** 无渐变。 */
  3397. NONE: "NONE",
  3398. /** 线性渐变填充。 */
  3399. LINEAR: "LINEAR",
  3400. /** 辐射渐变填充。 */
  3401. RADIAL: "RADIAL",
  3402. /** 圆锥渐变填充。 */
  3403. CONICAL: "CONICAL",
  3404. /** 四角渐变填充。 */
  3405. SQUARE: "SQUARE"
  3406. };
  3407. /**
  3408. * @enum AlongLineDirection
  3409. * @memberOf SuperMap
  3410. * @description 标签沿线标注方向枚举。
  3411. * @type {string}
  3412. */
  3413. var AlongLineDirection = SuperMap.AlongLineDirection = {
  3414. /** 沿线的法线方向放置标签。 */
  3415. NORMAL: "ALONG_LINE_NORMAL",
  3416. /** 从下到上,从左到右放置。 */
  3417. LB_TO_RT: "LEFT_BOTTOM_TO_RIGHT_TOP",
  3418. /** 从上到下,从左到右放置。 */
  3419. LT_TO_RB: "LEFT_TOP_TO_RIGHT_BOTTOM",
  3420. /** 从下到上,从右到左放置。 */
  3421. RB_TO_LT: "RIGHT_BOTTOM_TO_LEFT_TOP",
  3422. /** 从上到下,从右到左放置。 */
  3423. RT_TO_LB: "RIGHT_TOP_TO_LEFT_BOTTOM"
  3424. };
  3425. /**
  3426. * @enum LabelBackShape
  3427. * @memberOf SuperMap
  3428. * @description 标签专题图中标签背景的形状枚举。
  3429. * @type {string}
  3430. */
  3431. var LabelBackShape = SuperMap.LabelBackShape = {
  3432. /** 菱形背景,即标签背景的形状为菱形。 */
  3433. DIAMOND: "DIAMOND",
  3434. /** 椭圆形背景,即标签背景的行状为椭圆形。 */
  3435. ELLIPSE: "ELLIPSE",
  3436. /** 符号背景,即标签背景的形状为设定的符号。 */
  3437. MARKER: "MARKER",
  3438. /** 空背景,即不使用任何形状作为标签的背景。 */
  3439. NONE: "NONE",
  3440. /** 矩形背景,即标签背景的形状为矩形。 */
  3441. RECT: "RECT",
  3442. /** 圆角矩形背景,即标签背景的形状为圆角矩形。 */
  3443. ROUNDRECT: "ROUNDRECT",
  3444. /** 三角形背景,即标签背景的形状为三角形。 */
  3445. TRIANGLE: "TRIANGLE"
  3446. };
  3447. /**
  3448. * @enum LabelOverLengthMode
  3449. * @memberOf SuperMap
  3450. * @description 标签专题图中超长标签的处理模式枚举。
  3451. * @type {string}
  3452. */
  3453. var LabelOverLengthMode = SuperMap.LabelOverLengthMode = {
  3454. /** 换行显示。 */
  3455. NEWLINE: "NEWLINE",
  3456. /** 对超长标签不进行处理。 */
  3457. NONE: "NONE",
  3458. /** 省略超出部分。 */
  3459. OMIT: "OMIT"
  3460. };
  3461. /**
  3462. * @enum DirectionType
  3463. * @memberOf SuperMap
  3464. * @description 网络分析中方向枚举。
  3465. * 在行驶引导子项中使用。
  3466. * @type {string}
  3467. */
  3468. var DirectionType = SuperMap.DirectionType = {
  3469. /** 东。 */
  3470. EAST: "EAST",
  3471. /** 无方向。 */
  3472. NONE: "NONE",
  3473. /** 北。 */
  3474. NORTH: "NORTH",
  3475. /** 南。 */
  3476. SOURTH: "SOURTH",
  3477. /** 西。 */
  3478. WEST: "WEST"
  3479. };
  3480. /**
  3481. * @enum SideType
  3482. * @memberOf SuperMap
  3483. * @description 行驶位置枚举。
  3484. * 表示在行驶在路的左边、右边或者路上的枚举,该类用在行驶导引子项类中。
  3485. * @type {string}
  3486. */
  3487. var SideType = SuperMap.SideType = {
  3488. /** 路的左侧。 */
  3489. LEFT: "LEFT",
  3490. /** 在路上(即路的中间)。 */
  3491. MIDDLE: "MIDDLE",
  3492. /** 无效值。 */
  3493. NONE: "NONE",
  3494. /** 路的右侧。 */
  3495. RIGHT: "RIGHT"
  3496. };
  3497. /**
  3498. * @enum SupplyCenterType
  3499. * @memberOf SuperMap
  3500. * @description 资源供给中心类型枚举。
  3501. * 该枚举定义了网络分析中资源中心点的类型,主要用于资源分配和选址分区。
  3502. * 资源供给中心点的类型包括非中心,固定中心和可选中心。固定中心用于资源分配分析; 固定中心和可选中心用于选址分析;非中心在两种网络分析时都不予考虑。
  3503. * @type {string}
  3504. */
  3505. var SupplyCenterType = SuperMap.SupplyCenterType = {
  3506. /** 固定中心点。 */
  3507. FIXEDCENTER: "FIXEDCENTER",
  3508. /** 非中心点。 */
  3509. NULL: "NULL",
  3510. /** 可选中心点。 */
  3511. OPTIONALCENTER: "OPTIONALCENTER"
  3512. };
  3513. /**
  3514. * @enum TurnType
  3515. * @memberOf SuperMap
  3516. * @description 转弯方向枚举。
  3517. * 用在行驶引导子项类中,表示转弯的方向。
  3518. * @type {string}
  3519. */
  3520. var TurnType = SuperMap.TurnType = {
  3521. /** 向前直行。 */
  3522. AHEAD: "AHEAD",
  3523. /** 掉头。 */
  3524. BACK: "BACK",
  3525. /** 终点,不拐弯。 */
  3526. END: "END",
  3527. /** 左转弯。 */
  3528. LEFT: "LEFT",
  3529. /** 无效值。 */
  3530. NONE: "NONE",
  3531. /** 右转弯。 */
  3532. RIGHT: "RIGHT"
  3533. };
  3534. /**
  3535. * @enum BufferEndType
  3536. * @memberOf SuperMap
  3537. * @description 缓冲区分析BufferEnd类型。
  3538. * @type {string}
  3539. */
  3540. var BufferEndType = SuperMap.BufferEndType = {
  3541. /** FLAT */
  3542. FLAT: "FLAT",
  3543. /** ROUND */
  3544. ROUND: "ROUND"
  3545. };
  3546. /**
  3547. * @enum OverlayOperationType
  3548. * @memberOf SuperMap
  3549. * @description 叠加分析类型枚举。
  3550. * @type {string}
  3551. */
  3552. var OverlayOperationType = SuperMap.OverlayOperationType = {
  3553. /** 操作数据集(几何对象)裁剪被操作数据集(几何对象)。 */
  3554. CLIP: "CLIP",
  3555. /** 在被操作数据集(几何对象)上擦除掉与操作数据集(几何对象)相重合的部分。 */
  3556. ERASE: "ERASE",
  3557. /**对被操作数据集(几何对象)进行同一操作,即操作执行后,被操作数据集(几何对象)包含来自操作数据集(几何对象)的几何形状。 */
  3558. IDENTITY: "IDENTITY",
  3559. /** 对两个数据集(几何对象)求交,返回两个数据集(几何对象)的交集。 */
  3560. INTERSECT: "INTERSECT",
  3561. /** 对两个面数据集(几何对象)进行合并操作。 */
  3562. UNION: "UNION",
  3563. /** 对两个面数据集(几何对象)进行更新操作。 */
  3564. UPDATE: "UPDATE",
  3565. /** 对两个面数据集(几何对象)进行对称差操作。 */
  3566. XOR: "XOR"
  3567. };
  3568. /**
  3569. * @enum OutputType
  3570. * @memberOf SuperMap
  3571. * @description 分布式分析输出类型枚举。
  3572. * @type {string}
  3573. */
  3574. var OutputType = SuperMap.OutputType = {
  3575. /** INDEXEDHDFS */
  3576. INDEXEDHDFS: "INDEXEDHDFS",
  3577. /** UDB */
  3578. UDB: "UDB",
  3579. /** MONGODB */
  3580. MONGODB: "MONGODB",
  3581. /** PG */
  3582. PG: "PG"
  3583. };
  3584. /**
  3585. * @enum SmoothMethod
  3586. * @memberOf SuperMap
  3587. * @description 光滑方法枚举。
  3588. * 用于从Grid 或DEM数据生成等值线或等值面时对等值线或者等值面的边界线进行平滑处理的方法。
  3589. * @type {string}
  3590. */
  3591. var SmoothMethod = SuperMap.SmoothMethod = {
  3592. /** B 样条法。 */
  3593. BSPLINE: "BSPLINE",
  3594. /** 磨角法。 */
  3595. POLISH: "POLISH"
  3596. };
  3597. /**
  3598. * @enum SurfaceAnalystMethod
  3599. * @memberOf SuperMap
  3600. * @description 表面分析方法枚举。
  3601. * 通过对数据进行表面分析,能够挖掘原始数据所包含的信息,使某些细节明显化,易于分析。
  3602. * @type {string}
  3603. */
  3604. var SurfaceAnalystMethod = SuperMap.SurfaceAnalystMethod = {
  3605. /** 等值线提取。 */
  3606. ISOLINE: "ISOLINE",
  3607. /** 等值面提取。 */
  3608. ISOREGION: "ISOREGION"
  3609. };
  3610. /**
  3611. * @enum DataReturnMode
  3612. * @memberOf SuperMap
  3613. * @description 数据返回模式枚举。
  3614. * 该枚举用于指定空间分析返回结果模式,包含返回数据集标识和记录集、只返回数据集标识(数据集名称@数据源名称)及只返回记录集三种模式。
  3615. * @type {string}
  3616. */
  3617. var DataReturnMode = SuperMap.DataReturnMode = {
  3618. /** 返回结果数据集标识(数据集名称@数据源名称)和记录集(RecordSet)。 */
  3619. DATASET_AND_RECORDSET: "DATASET_AND_RECORDSET",
  3620. /** 只返回数据集标识(数据集名称@数据源名称)。 */
  3621. DATASET_ONLY: "DATASET_ONLY",
  3622. /** 只返回记录集(RecordSet)。 */
  3623. RECORDSET_ONLY: "RECORDSET_ONLY"
  3624. };
  3625. /**
  3626. * @enum EditType
  3627. * @memberOf SuperMap
  3628. * @description 要素集更新模式枚举。
  3629. * 该枚举用于指定数据服务中要素集更新模式,包含添加要素集、更新要素集和删除要素集。
  3630. * @type {string}
  3631. */
  3632. var EditType = SuperMap.EditType = {
  3633. /** 增加操作。 */
  3634. ADD: "add",
  3635. /** 修改操作。 */
  3636. UPDATE: "update",
  3637. /** 删除操作。 */
  3638. DELETE: "delete"
  3639. };
  3640. /**
  3641. * @enum TransferTactic
  3642. * @memberOf SuperMap
  3643. * @description 公交换乘策略枚举。
  3644. * 该枚举用于指定公交服务中要素集更新模式,包含添加要素集、更新要素集和删除要素集。
  3645. * @type {string}
  3646. */
  3647. var TransferTactic = SuperMap.TransferTactic = {
  3648. /** 时间短。 */
  3649. LESS_TIME: "LESS_TIME",
  3650. /** 少换乘。 */
  3651. LESS_TRANSFER: "LESS_TRANSFER",
  3652. /** 少步行。 */
  3653. LESS_WALK: "LESS_WALK",
  3654. /** 距离最短。 */
  3655. MIN_DISTANCE: "MIN_DISTANCE"
  3656. };
  3657. /**
  3658. * @enum TransferPreference
  3659. * @memberOf SuperMap
  3660. * @description 公交换乘策略枚举。
  3661. * 该枚举用于指定交通换乘服务中设置地铁优先、公交优先、不乘地铁、无偏好等偏好设置。
  3662. * @type {string}
  3663. */
  3664. var TransferPreference = SuperMap.TransferPreference = {
  3665. /** 公交汽车优先。 */
  3666. BUS: "BUS",
  3667. /** 地铁优先。 */
  3668. SUBWAY: "SUBWAY",
  3669. /** 不乘坐地铁。 */
  3670. NO_SUBWAY: "NO_SUBWAY",
  3671. /** 无乘车偏好。 */
  3672. NONE: "NONE"
  3673. };
  3674. /**
  3675. * @enum GridType
  3676. * @memberOf SuperMap
  3677. * @description 地图背景格网类型枚举。
  3678. * @type {string}
  3679. */
  3680. var GridType = SuperMap.GridType = {
  3681. /** 十字叉丝。 */
  3682. CROSS: "CROSS",
  3683. /** 网格线。 */
  3684. GRID: "GRID",
  3685. /** 点。 */
  3686. POINT: "POINT"
  3687. };
  3688. /**
  3689. * @enum ColorSpaceType
  3690. * @memberOf SuperMap
  3691. * @description 色彩空间枚举。
  3692. * 由于成色原理的不同,决定了显示器、投影仪这类靠色光直接合成颜色的颜色设备和打印机、
  3693. * 印刷机这类靠使用颜料的印刷设备在生成颜色方式上的区别。
  3694. * 针对上述不同成色方式,SuperMap 提供两种色彩空间,
  3695. * 分别为 RGB 和 CMYK。RGB 主要用于显示系统中,CMYK 主要用于印刷系统中。
  3696. * @type {string}
  3697. */
  3698. var ColorSpaceType = SuperMap.ColorSpaceType = {
  3699. /** 该类型主要在印刷系统使用。 */
  3700. CMYK: "CMYK",
  3701. /** 该类型主要在显示系统中使用。 */
  3702. RGB: "RGB"
  3703. };
  3704. /**
  3705. * @enum LayerType
  3706. * @memberOf SuperMap
  3707. * @description 图层类型。
  3708. * @type {string}
  3709. */
  3710. var LayerType = SuperMap.LayerType = {
  3711. /** SuperMap UGC 类型图层。如矢量图层、栅格(Grid)图层、影像图层。 */
  3712. UGC: "UGC",
  3713. /** WMS 图层。 */
  3714. WMS: "WMS",
  3715. /** WFS 图层。 */
  3716. WFS: "WFS",
  3717. /** 自定义图层。 */
  3718. CUSTOM: "CUSTOM"
  3719. };
  3720. /**
  3721. * @enum UGCLayerType
  3722. * @memberOf SuperMap
  3723. * @description UGC图层类型。
  3724. * @type {string}
  3725. */
  3726. var UGCLayerType = SuperMap.UGCLayerType = {
  3727. /** 专题图层。 */
  3728. THEME: "THEME",
  3729. /** 矢量图层。 */
  3730. VECTOR: "VECTOR",
  3731. /** 栅格图层。。 */
  3732. GRID: "GRID",
  3733. /** 影像图层。 */
  3734. IMAGE: "IMAGE"
  3735. };
  3736. /**
  3737. * @enum StatisticMode
  3738. * @memberOf SuperMap
  3739. * @description 字段统计方法类型。
  3740. * @type {string}
  3741. */
  3742. var StatisticMode = SuperMap.StatisticMode = {
  3743. /** 统计所选字段的平均值。 */
  3744. AVERAGE: "AVERAGE",
  3745. /** 统计所选字段的最大值。 */
  3746. MAX: "MAX",
  3747. /** 统计所选字段的最小值。 */
  3748. MIN: "MIN",
  3749. /** 统计所选字段的标准差 */
  3750. STDDEVIATION: "STDDEVIATION",
  3751. /** 统计所选字段的总和。 */
  3752. SUM: "SUM",
  3753. /** 统计所选字段的方差。 */
  3754. VARIANCE: "VARIANCE"
  3755. };
  3756. /**
  3757. * @enum PixelFormat
  3758. * @memberOf SuperMap
  3759. * @description 栅格与影像数据存储的像素格式枚举。
  3760. * @type {string}
  3761. */
  3762. var PixelFormat = SuperMap.PixelFormat = {
  3763. /** 每个像元用16个比特(即2个字节)表示。 */
  3764. BIT16: "BIT16",
  3765. /** 每个像元用32个比特(即4个字节)表示。 */
  3766. BIT32: "BIT32",
  3767. /** 每个像元用64个比特(即8个字节)表示,只提供给栅格数据集使用。 */
  3768. BIT64: "BIT64",
  3769. /** 每个像元用4个字节来表示,只提供给栅格数据集使用。 */
  3770. SINGLE: "SINGLE",
  3771. /** 每个像元用8个字节来表示,只提供给栅格数据集使用。 */
  3772. DOUBLE: "DOUBLE",
  3773. /** 每个像元用1个比特表示。 */
  3774. UBIT1: "UBIT1",
  3775. /** 每个像元用4个比特来表示。 */
  3776. UBIT4: "UBIT4",
  3777. /** 每个像元用8个比特(即1个字节)来表示。 */
  3778. UBIT8: "UBIT8",
  3779. /** 每个像元用24个比特(即3个字节)来表示。 */
  3780. UBIT24: "UBIT24",
  3781. /** 每个像元用32个比特(即4个字节)来表示。 */
  3782. UBIT32: "UBIT32"
  3783. };
  3784. /**
  3785. * @enum SearchMode
  3786. * @memberOf SuperMap
  3787. * @description 内插时使用的样本点的查找方式枚举
  3788. * @type {string}
  3789. */
  3790. var SearchMode = SuperMap.SearchMode = {
  3791. /** 使用 KDTREE 的固定点数方式查找参与内插分析的点。 */
  3792. KDTREE_FIXED_COUNT: "KDTREE_FIXED_COUNT",
  3793. /** 使用 KDTREE 的定长方式查找参与内插分析的点。 */
  3794. KDTREE_FIXED_RADIUS: "KDTREE_FIXED_RADIUS",
  3795. /** 不进行查找,使用所有的输入点进行内插分析。 */
  3796. NONE: "NONE",
  3797. /** 使用 QUADTREE 方式查找参与内插分析的点,仅对样条(RBF)插值和普通克吕金(Kriging)有用。 */
  3798. QUADTREE: "QUADTREE"
  3799. };
  3800. /**
  3801. * @enum InterpolationAlgorithmType
  3802. * @memberOf SuperMap
  3803. * @description 插值分析的算法的类型
  3804. * @type {string}
  3805. */
  3806. var InterpolationAlgorithmType = SuperMap.InterpolationAlgorithmType = {
  3807. /** 普通克吕金插值法。 */
  3808. KRIGING: "KRIGING",
  3809. /** 简单克吕金插值法。 */
  3810. SimpleKriging: "SimpleKriging",
  3811. /** 泛克吕金插值法。 */
  3812. UniversalKriging: "UniversalKriging"
  3813. };
  3814. /**
  3815. * @enum VariogramMode
  3816. * @memberOf SuperMap
  3817. * @description 克吕金(Kriging)插值时的半变函数类型枚举
  3818. * @type {string}
  3819. */
  3820. var VariogramMode = SuperMap.VariogramMode = {
  3821. /** 指数函数。 */
  3822. EXPONENTIAL: "EXPONENTIAL",
  3823. /** 高斯函数。 */
  3824. GAUSSIAN: "GAUSSIAN",
  3825. /** 球型函数。 */
  3826. SPHERICAL: "SPHERICAL"
  3827. };
  3828. /**
  3829. * @enum Exponent
  3830. * @memberOf SuperMap
  3831. * @description 定义了泛克吕金(UniversalKriging)插值时样点数据中趋势面方程的阶数
  3832. * @type {string}
  3833. */
  3834. var Exponent = SuperMap.Exponent = {
  3835. /** 阶数为1。 */
  3836. EXP1: "EXP1",
  3837. /** 阶数为2。 */
  3838. EXP2: "EXP2"
  3839. };
  3840. /**
  3841. * @enum ClientType
  3842. * @memberOf SuperMap
  3843. * @description token申请的客户端标识类型
  3844. * @type {string}
  3845. */
  3846. var ClientType = SuperMap.ClientType = {
  3847. /** 指定的 IP 地址。 */
  3848. IP: "IP",
  3849. /** 指定的 URL。 */
  3850. REFERER: "Referer",
  3851. /** 发送申请令牌请求的客户端 IP。 */
  3852. REQUESTIP: "RequestIP",
  3853. /** 不做任何验证。 */
  3854. NONE: "NONE",
  3855. /** SERVER。 */
  3856. SERVER: "SERVER",
  3857. /** WEB。 */
  3858. WEB: "WEB"
  3859. };
  3860. /**
  3861. * @enum ChartType
  3862. * @memberOf SuperMap
  3863. * @description 客户端专题图图表类型
  3864. * @type {string}
  3865. */
  3866. var ChartType = SuperMap.ChartType = {
  3867. /** 柱状图。 */
  3868. BAR: "Bar",
  3869. /** 三维柱状图。 */
  3870. BAR3D: "Bar3D",
  3871. /** 圆形图。 */
  3872. CIRCLE: "Circle",
  3873. /** 饼图。 */
  3874. PIE: "Pie",
  3875. /** 散点图。 */
  3876. POINT: "Point",
  3877. /** 折线图。 */
  3878. LINE: "Line",
  3879. /** 环状图。 */
  3880. RING: "Ring"
  3881. };
  3882. /**
  3883. * @enum ClipAnalystMode
  3884. * @memberOf SuperMap
  3885. * @description 裁剪分析模式
  3886. * @type {string}
  3887. */
  3888. var ClipAnalystMode = SuperMap.ClipAnalystMode = {
  3889. /** CLIP。 */
  3890. CLIP: "clip",
  3891. /** INTERSECT。 */
  3892. INTERSECT: "intersect"
  3893. };
  3894. /**
  3895. * @enum AnalystAreaUnit
  3896. * @memberOf SuperMap
  3897. * @description 分布式分析面积单位
  3898. * @type {string}
  3899. */
  3900. var AnalystAreaUnit = SuperMap.AnalystAreaUnit = {
  3901. /** 平方米。 */
  3902. "SQUAREMETER": "SquareMeter",
  3903. /** 平方千米。 */
  3904. "SQUAREKILOMETER": "SquareKiloMeter",
  3905. /** 公顷。 */
  3906. "HECTARE": "Hectare",
  3907. /** 公亩。 */
  3908. "ARE": "Are",
  3909. /** 英亩。 */
  3910. "ACRE": "Acre",
  3911. /** 平方英尺。 */
  3912. "SQUAREFOOT": "SquareFoot",
  3913. /** 平方码。 */
  3914. "SQUAREYARD": "SquareYard",
  3915. /** 平方英里。 */
  3916. "SQUAREMILE": "SquareMile"
  3917. };
  3918. /**
  3919. * @enum AnalystSizeUnit
  3920. * @memberOf SuperMap
  3921. * @description 分布式分析单位
  3922. * @type {string}
  3923. */
  3924. var AnalystSizeUnit = SuperMap.AnalystSizeUnit = {
  3925. /** 米。 */
  3926. "METER": "Meter",
  3927. /** 千米。 */
  3928. "KILOMETER": "Kilometer",
  3929. /** 码。 */
  3930. "YARD": "Yard",
  3931. /** 英尺。 */
  3932. "FOOT": "Foot",
  3933. /** 英里。 */
  3934. "MILE": "Mile"
  3935. };
  3936. /**
  3937. * @enum StatisticAnalystMode
  3938. * @memberOf SuperMap
  3939. * @description 分布式分析统计模式
  3940. * @type {string}
  3941. */
  3942. var StatisticAnalystMode = SuperMap.StatisticAnalystMode = {
  3943. /** 统计所选字段的最大值。 */
  3944. "MAX": "max",
  3945. /** 统计所选字段的最小值。 */
  3946. "MIN": "min",
  3947. /** 统计所选字段的平均值。 */
  3948. "AVERAGE": "average",
  3949. /** 统计所选字段的总和。 */
  3950. "SUM": "sum",
  3951. /** 统计所选字段的方差。 */
  3952. "VARIANCE": "variance",
  3953. /** 统计所选字段的标准差 */
  3954. "STDDEVIATION": "stdDeviation"
  3955. };
  3956. /**
  3957. * @enum SummaryType
  3958. * @memberOf SuperMap
  3959. * @description 分布式分析聚合类型
  3960. * @type {string}
  3961. */
  3962. var SummaryType = SuperMap.SummaryType = {
  3963. /** 格网聚合。 */
  3964. "SUMMARYMESH": "SUMMARYMESH",
  3965. /** 多边形聚合。 */
  3966. "SUMMARYREGION": "SUMMARYREGION"
  3967. };
  3968. /**
  3969. * @enum TopologyValidatorRule
  3970. * @memberOf SuperMap
  3971. * @description 拓扑检查模式枚举。该类定义了拓扑检查操作模式常量。
  3972. * @type {string}
  3973. */
  3974. var TopologyValidatorRule = SuperMap.TopologyValidatorRule = {
  3975. /** 面内无重叠,用于对面数据进行拓扑检查。 */
  3976. REGIONNOOVERLAP: "REGIONNOOVERLAP",
  3977. /** 面与面无重叠,用于对面数据进行拓扑检查。 */
  3978. REGIONNOOVERLAPWITH: "REGIONNOOVERLAPWITH",
  3979. /** 面被面包含,用于对面数据进行拓扑检查。 */
  3980. REGIONCONTAINEDBYREGION: "REGIONCONTAINEDBYREGION",
  3981. /** 面被面覆盖,用于对面数据进行拓扑检查。 */
  3982. REGIONCOVEREDBYREGION: "REGIONCOVEREDBYREGION",
  3983. /** 线与线无重叠,用于对线数据进行拓扑检查。 */
  3984. LINENOOVERLAP: "LINENOOVERLAP",
  3985. /** 线内无重叠,用于对线数据进行拓扑检查。 */
  3986. LINENOOVERLAPWITH: "LINENOOVERLAPWITH",
  3987. /** 点不相同,用于对点数据进行拓扑检查。 */
  3988. POINTNOIDENTICAL: "POINTNOIDENTICAL"
  3989. };
  3990. /**
  3991. * @enum AggregationType
  3992. * @memberOf SuperMap
  3993. * @description 聚合查询枚举类,该类定义了Es数据服务中聚合查询模式常量
  3994. * @type {string}
  3995. */
  3996. var AggregationType = SuperMap.AggregationType = {
  3997. /** 格网聚合类型。 */
  3998. GEOHASH_GRID: "geohash_grid",
  3999. /** 过滤聚合类型。 */
  4000. FILTER: "filter"
  4001. };
  4002. /**
  4003. * @enum AggregationType
  4004. * @memberOf SuperMap
  4005. * @description 聚合查询中filter查询枚举类
  4006. * @type {string}
  4007. */
  4008. var AggregationQueryBuilderType = SuperMap.AggregationQueryBuilderType = {
  4009. /** 范围查询。 */
  4010. GEO_BOUNDING_BOX: "geo_bounding_box"
  4011. }
  4012. /**
  4013. * @enum GetFeatureMode
  4014. * @memberOf SuperMap
  4015. * @description feature 查询方式。
  4016. * @type {string}
  4017. */
  4018. var GetFeatureMode = SuperMap.GetFeatureMode = {
  4019. /** 通过范围查询来获取要素。 */
  4020. BOUNDS: "BOUNDS",
  4021. /** 通过几何对象的缓冲区来获取要素。 */
  4022. BUFFER: "BUFFER",
  4023. /** 通过 ID 来获取要素。 */
  4024. ID: "ID",
  4025. /** 通过空间查询模式来获取要素。 */
  4026. SPATIAL: "SPATIAL",
  4027. /** 通过 SQL 查询来获取要素。 */
  4028. SQL: 'SQL'
  4029. }
  4030. /**
  4031. * @enum RasterFunctionType
  4032. * @memberOf SuperMap
  4033. * @description 栅格分析方法。
  4034. * @type {string}
  4035. */
  4036. var RasterFunctionType = SuperMap.RasterFunctionType = {
  4037. /** 归一化植被指数。 */
  4038. NDVI: "NDVI",
  4039. /** 阴影面分析。 */
  4040. HILLSHADE: "HILLSHADE"
  4041. }
  4042. /**
  4043. * @enum ResourceType
  4044. * @memberOf SuperMap
  4045. * @description iportal资源类型。
  4046. * @version 10.0.1
  4047. * @type {string}
  4048. */
  4049. var ResourceType = SuperMap.ResourceType = {
  4050. /** 地图。 */
  4051. MAP: "MAP",
  4052. /** 服务。 */
  4053. SERVICE: "SERVICE",
  4054. /** 场景。 */
  4055. SCENE: "SCENE",
  4056. /** 数据。 */
  4057. DATA: "DATA",
  4058. /** 洞察。 */
  4059. INSIGHTS_WORKSPACE: "INSIGHTS_WORKSPACE",
  4060. /** 大屏。 */
  4061. MAP_DASHBOARD: "MAP_DASHBOARD"
  4062. }
  4063. /**
  4064. * @enum OrderBy
  4065. * @memberOf SuperMap
  4066. * @description iportal资源排序字段。
  4067. * @version 10.0.1
  4068. * @type {string}
  4069. */
  4070. var OrderBy = SuperMap.OrderBy = {
  4071. /** 按更新时间排序 */
  4072. UPDATETIME: "UPDATETIME",
  4073. /** 按热度(可能是访问量、下载量)排序 */
  4074. HEATLEVEL: "HEATLEVEL",
  4075. /** 按相关性排序 */
  4076. RELEVANCE: "RELEVANCE"
  4077. }
  4078. /**
  4079. * @enum OrderType
  4080. * @memberOf SuperMap
  4081. * @description iportal资源升序还是降序过滤
  4082. * @version 10.0.1
  4083. * @type {string}
  4084. */
  4085. var OrderType = SuperMap.OrderType = {
  4086. /** 升序 */
  4087. ASC: "ASC",
  4088. /** 降序 */
  4089. DESC: "DESC"
  4090. }
  4091. /**
  4092. * @enum SearchType
  4093. * @memberOf SuperMap
  4094. * @description iportal资源查询的范围进行过滤
  4095. * @version 10.0.1
  4096. * @type {string}
  4097. */
  4098. var SearchType = SuperMap.SearchType = {
  4099. /** 公开资源。 */
  4100. PUBLIC: "PUBLIC",
  4101. /** 我的资源。 */
  4102. MY_RES: "MY_RES",
  4103. /** 我的群组资源。 */
  4104. MYGROUP_RES: "MYGROUP_RES",
  4105. /** 我的部门资源。 */
  4106. MYDEPARTMENT_RES: "MYDEPARTMENT_RES",
  4107. /** 分享给我的资源。 */
  4108. SHARETOME_RES: "SHARETOME_RES"
  4109. }
  4110. /**
  4111. * @enum AggregationTypes
  4112. * @memberOf SuperMap
  4113. * @description iportal资源聚合查询的类型
  4114. * @version 10.0.1
  4115. * @type {string}
  4116. */
  4117. var AggregationTypes = SuperMap.AggregationTypes = {
  4118. /** 标签 */
  4119. TAG: "TAG",
  4120. /** 资源类型 */
  4121. TYPE: "TYPE"
  4122. }
  4123. /**
  4124. * @enum PermissionType
  4125. * @memberOf SuperMap
  4126. * @description iportal资源权限类型。
  4127. * @version 10.0.1
  4128. * @type {string}
  4129. */
  4130. var PermissionType = SuperMap.PermissionType = {
  4131. /** 可检索 */
  4132. SEARCH:"SEARCH",
  4133. /** 可查看 */
  4134. READ: "READ",
  4135. /** 可编辑 */
  4136. READWRITE: "READWRITE",
  4137. /** 可删除 */
  4138. DELETE: "DELETE",
  4139. /** 可下载,包括可读、可检索 */
  4140. DOWNLOAD:"DOWNLOAD"
  4141. }
  4142. /**
  4143. * @enum EntityType
  4144. * @memberOf SuperMap
  4145. * @description iportal资源实体类型。
  4146. * @version 10.0.1
  4147. * @type {string}
  4148. */
  4149. var EntityType = SuperMap.EntityType = {
  4150. /** 部门 */
  4151. DEPARTMENT: "DEPARTMENT",
  4152. /** 用户组 */
  4153. GROUP: "GROUP",
  4154. /** 群组 */
  4155. IPORTALGROUP: "IPORTALGROUP",
  4156. /** 角色 */
  4157. ROLE: "ROLE",
  4158. /** 用户 */
  4159. USER: "USER"
  4160. }
  4161. /**
  4162. * @enum DataItemType
  4163. * @memberOf SuperMap
  4164. * @description iportal数据类型。
  4165. * @version 10.0.1
  4166. * @type {string}
  4167. */
  4168. var DataItemType = SuperMap.DataItemType = {
  4169. /** 工作空间 sxwu, smwu, sxw, smw */
  4170. WORKSPACE: "WORKSPACE",
  4171. /** udb 数据源 */
  4172. UDB: "UDB",
  4173. /** shp空间数据 */
  4174. SHP: "SHP",
  4175. /** excel数据 */
  4176. EXCEL: "EXCEL",
  4177. /** csv数据 */
  4178. CSV: "CSV",
  4179. /** geojson数据。 */
  4180. GEOJSON: "GEOJSON",
  4181. /** smtiles */
  4182. SMTILES: "SMTILES",
  4183. /** svtiles */
  4184. SVTILES: "SVTILES",
  4185. /** mbtiles */
  4186. MBTILES: "MBTILES",
  4187. /** tpk */
  4188. TPK: "TPK",
  4189. /** ugc v5 */
  4190. UGCV5: "UGCV5",
  4191. /** UGCV5_MVT */
  4192. UGCV5_MVT: "UGCV5_MVT",
  4193. /** json数据 */
  4194. JSON: "JSON"
  4195. }
  4196. /**
  4197. * @enum WebExportFormatType
  4198. * @memberOf SuperMap
  4199. * @description Web 打印输出的格式。
  4200. * @version 10.0.1
  4201. * @type {string}
  4202. */
  4203. var WebExportFormatType = SuperMap.WebExportFormatType = {
  4204. /** png */
  4205. PNG: "PNG",
  4206. /** pdf */
  4207. PDF: "PDF"
  4208. }
  4209. /**
  4210. * @enum WebScaleOrientationType
  4211. * @memberOf SuperMap
  4212. * @description Web 比例尺的方位样式。
  4213. * @version 10.0.1
  4214. * @type {string}
  4215. */
  4216. var WebScaleOrientationType = SuperMap.WebScaleOrientationType = {
  4217. /** horizontal labels below */
  4218. HORIZONTALLABELSBELOW: "HORIZONTALLABELSBELOW",
  4219. /** horizontal labels above */
  4220. HORIZONTALLABELSABOVE: "HORIZONTALLABELSABOVE",
  4221. /** vertical labels left */
  4222. VERTICALLABELSLEFT: "VERTICALLABELSLEFT",
  4223. /** vertical labels right */
  4224. VERTICALLABELSRIGHT: "VERTICALLABELSRIGHT"
  4225. }
  4226. /**
  4227. * @enum WebScaleType
  4228. * @memberOf SuperMap
  4229. * @description Web 比例尺的样式。
  4230. * @version 10.0.1
  4231. * @type {string}
  4232. */
  4233. var WebScaleType = SuperMap.WebScaleType = {
  4234. /** line */
  4235. LINE: "LINE",
  4236. /** bar */
  4237. BAR: "BAR",
  4238. /** bar sub */
  4239. BAR_SUB: "BAR_SUB"
  4240. }
  4241. /**
  4242. * @enum WebScaleUnit
  4243. * @memberOf SuperMap
  4244. * @description Web 比例尺的单位制。
  4245. * @version 10.0.1
  4246. * @type {string}
  4247. */
  4248. var WebScaleUnit = SuperMap.WebScaleUnit = {
  4249. /** meter */
  4250. METER: "METER",
  4251. /** foot */
  4252. FOOT: "FOOT",
  4253. /** degrees */
  4254. DEGREES: "DEGREES"
  4255. }
  4256. ;// CONCATENATED MODULE: ./src/common/commontypes/Size.js
  4257. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  4258. * This program are made available under the terms of the Apache License, Version 2.0
  4259. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  4260. /**
  4261. * @class SuperMap.Size
  4262. * @category BaseTypes Style
  4263. * @classdesc 此类描绘一对高宽值的实例。
  4264. * @param {number} [w=0.0] - 宽度。
  4265. * @param {number} [h=0.0] - 高度。
  4266. *
  4267. * @example
  4268. * var size = new SuperMap.Size(31,46);
  4269. */
  4270. class Size {
  4271. constructor(w, h) {
  4272. /**
  4273. * @member {number} [SuperMap.Size.prototype.w=0.0]
  4274. * @description 宽度。
  4275. */
  4276. this.w = w ? parseFloat(w) : 0.0;
  4277. /**
  4278. * @member {number} [SuperMap.Size.prototype.h=0.0]
  4279. * @description 高度。
  4280. */
  4281. this.h = w ? parseFloat(h) : 0.0;
  4282. this.CLASS_NAME = "SuperMap.Size";
  4283. }
  4284. /**
  4285. * @function SuperMap.Size.prototype.toString
  4286. * @description 返回此对象的字符串形式。
  4287. * @example
  4288. * var size = new SuperMap.Size(10,5);
  4289. * var str = size.toString();
  4290. * @returns {string} 例如:"w=10,h=5"。
  4291. */
  4292. toString() {
  4293. return ("w=" + this.w + ",h=" + this.h);
  4294. }
  4295. /**
  4296. * @function SuperMap.Size.prototype.clone
  4297. * @description 克隆当前size对象。
  4298. * @example
  4299. * var size = new SuperMap.Size(31,46);
  4300. * var size2 = size.clone();
  4301. * @returns {SuperMap.Size} 返回一个新的与当前 size 对象有相同宽、高的 Size 对象。
  4302. */
  4303. clone() {
  4304. return new Size(this.w, this.h);
  4305. }
  4306. /**
  4307. *
  4308. * @function SuperMap.Size.prototype.equals
  4309. * @description 比较两个 size 对象是否相等。
  4310. * @example
  4311. * var size = new SuperMap.Size(31,46);
  4312. * var size2 = new SuperMap.Size(31,46);
  4313. * var isEquals = size.equals(size2);
  4314. *
  4315. * @param {SuperMap.Size} sz - 用于比较相等的 Size 对象。
  4316. * @returns {boolean} 传入的 size 和当前 size 高宽相等,注意:如果传入的 size 为空则返回 false。
  4317. *
  4318. */
  4319. equals(sz) {
  4320. var equals = false;
  4321. if (sz != null) {
  4322. equals = ((this.w === sz.w && this.h === sz.h) ||
  4323. (isNaN(this.w) && isNaN(this.h) && isNaN(sz.w) && isNaN(sz.h)));
  4324. }
  4325. return equals;
  4326. }
  4327. /**
  4328. *
  4329. * @function SuperMap.Size.prototype.destroy
  4330. * @description 销毁此对象。销毁后此对象的所有属性为 null,而不是初始值。
  4331. * @example
  4332. * var size = new SuperMap.Size(31,46);
  4333. * size.destroy();
  4334. */
  4335. destroy() {
  4336. this.w = null;
  4337. this.h = null;
  4338. }
  4339. }
  4340. SuperMap.Size = Size;
  4341. ;// CONCATENATED MODULE: ./src/common/commontypes/Pixel.js
  4342. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  4343. * This program are made available under the terms of the Apache License, Version 2.0
  4344. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  4345. /**
  4346. * @class SuperMap.Pixel
  4347. * @category BaseTypes Geometry
  4348. * @classdesc 此类用 x,y 坐标描绘屏幕坐标(像素点)。
  4349. * @param {number} [x=0.0] - x 坐标。
  4350. * @param {number} [y=0.0] - y 坐标。
  4351. * @param {SuperMap.Pixel.Mode} [mode=SuperMap.Pixel.Mode.LeftTop] - 坐标模式。
  4352. *
  4353. * @example
  4354. * //单独创建一个对象
  4355. * var pixcel = new SuperMap.Pixel(100,50);
  4356. *
  4357. * //依据 size 创建
  4358. * var size = new SuperMap.Size(21,25);
  4359. * var offset = new SuperMap.Pixel(-(size.w/2), -size.h);
  4360. */
  4361. class Pixel {
  4362. constructor(x, y, mode) {
  4363. /**
  4364. * @member {number} [SuperMap.Pixel.prototype.x=0.0]
  4365. * @description x 坐标。
  4366. */
  4367. this.x = x ? parseFloat(x) : 0.0;
  4368. /**
  4369. * @member {number} [SuperMap.Pixel.prototype.y=0.0]
  4370. * @description y 坐标。
  4371. */
  4372. this.y = y ? parseFloat(y) : 0.0;
  4373. /**
  4374. * @member {SuperMap.Pixel.Mode} [SuperMap.Pixel.prototype.mode=SuperMap.Pixel.Mode.LeftTop]
  4375. * @description 坐标模式,有左上、右上、右下、左下这几种模式,分别表示相对于左上角、右上角、右下角、左下角的坐标。
  4376. */
  4377. this.mode = mode;
  4378. this.CLASS_NAME = "SuperMap.Pixel";
  4379. /**
  4380. * @enum SuperMap.Pixel.Mode
  4381. * @readonly
  4382. * @description 模式。
  4383. * @type {string}
  4384. */
  4385. SuperMap.Pixel.Mode = {
  4386. /** 左上模式。*/
  4387. LeftTop: "lefttop",
  4388. /** 右上模式。 */
  4389. RightTop: "righttop",
  4390. /** 右下模式。 */
  4391. RightBottom: "rightbottom",
  4392. /** 左下模式。 */
  4393. LeftBottom: "leftbottom"
  4394. };
  4395. }
  4396. /**
  4397. * @function SuperMap.Pixel.prototype.toString
  4398. * @description 返回此对象的字符串形式。
  4399. * @example
  4400. *
  4401. * var pixcel = new SuperMap.Pixel(100,50);
  4402. * var str = pixcel.toString();
  4403. *
  4404. * @returns {string} 例如: "x=200.4,y=242.2"
  4405. */
  4406. toString() {
  4407. return ("x=" + this.x + ",y=" + this.y);
  4408. }
  4409. /**
  4410. * @function SuperMap.Pixel.prototype.clone
  4411. * @description 克隆当前的 pixel 对象。
  4412. * @example
  4413. * var pixcel = new SuperMap.Pixel(100,50);
  4414. * var pixcel2 = pixcel.clone();
  4415. * @returns {SuperMap.Pixel} 返回一个新的与当前 pixel 对象有相同 x、y 坐标的 pixel 对象。
  4416. */
  4417. clone() {
  4418. return new Pixel(this.x, this.y, this.mode);
  4419. }
  4420. /**
  4421. * @function SuperMap.Pixel.prototype.equals
  4422. * @description 比较两 pixel 是否相等。
  4423. * @example
  4424. * var pixcel = new SuperMap.Pixel(100,50);
  4425. * var pixcel2 = new SuperMap.Pixel(100,50);
  4426. * var isEquals = pixcel.equals(pixcel2);
  4427. *
  4428. * @param {SuperMap.Pixel} px - 用于比较相等的 pixel 对象。
  4429. * @returns {boolean} 如果传入的像素点和当前像素点相同返回 true,如果不同或传入参数为 NULL 则返回 false。
  4430. */
  4431. equals(px) {
  4432. var equals = false;
  4433. if (px != null) {
  4434. equals = ((this.x == px.x && this.y == px.y) ||
  4435. (isNaN(this.x) && isNaN(this.y) && isNaN(px.x) && isNaN(px.y)));
  4436. }
  4437. return equals;
  4438. }
  4439. /**
  4440. * @function SuperMap.Pixel.prototype.distanceTo
  4441. * @description 返回两个 pixel 的距离。
  4442. * @example
  4443. * var pixcel = new SuperMap.Pixel(100,50);
  4444. * var pixcel2 = new SuperMap.Pixel(110,30);
  4445. * var distance = pixcel.distanceTo(pixcel2);
  4446. *
  4447. * @param {SuperMap.Pixel} px - 用于计算的一个 pixel。
  4448. * @returns {float} 作为参数传入的像素与当前像素点的距离。
  4449. */
  4450. distanceTo(px) {
  4451. return Math.sqrt(
  4452. Math.pow(this.x - px.x, 2) +
  4453. Math.pow(this.y - px.y, 2)
  4454. );
  4455. }
  4456. /**
  4457. * @function SuperMap.Pixel.prototype.add
  4458. * @description 在原来像素坐标基础上,x 值加上传入的 x 参数,y 值加上传入的 y 参数。
  4459. * @example
  4460. * var pixcel = new SuperMap.Pixel(100,50);
  4461. * //pixcel2是新的对象
  4462. * var pixcel2 = pixcel.add(20,30);
  4463. *
  4464. * @param {number} x - 传入的 x 值。
  4465. * @param {number} y - 传入的 y 值。
  4466. * @returns {SuperMap.Pixel} 返回一个新的 pixel 对象,该 pixel 是由当前的 pixel 与传入的 x,y 相加得到。
  4467. */
  4468. add(x, y) {
  4469. if ((x == null) || (y == null)) {
  4470. throw new TypeError('Pixel.add cannot receive null values');
  4471. }
  4472. return new Pixel(this.x + x, this.y + y);
  4473. }
  4474. /**
  4475. * @function SuperMap.Pixel.prototype.offset
  4476. * @description 通过传入的 {@link SuperMap.Pixel} 参数对原屏幕坐标进行偏移。
  4477. * @example
  4478. * var pixcel = new SuperMap.Pixel(100,50);
  4479. * var pixcel2 = new SuperMap.Pixel(130,20);
  4480. * //pixcel3 是新的对象
  4481. * var pixcel3 = pixcel.offset(pixcel2);
  4482. *
  4483. * @param {SuperMap.Pixel} px - 传入的 <SuperMap.Pixel> 对象。
  4484. * @returns {SuperMap.Pixel} 返回一个新的 pixel,该 pixel 是由当前的 pixel 对象的 x,y 值与传入的 Pixel 对象的 x,y 值相加得到。
  4485. */
  4486. offset(px) {
  4487. var newPx = this.clone();
  4488. if (px) {
  4489. newPx = this.add(px.x, px.y);
  4490. }
  4491. return newPx;
  4492. }
  4493. /**
  4494. *
  4495. * @function SuperMap.Pixel.prototype.destroy
  4496. * @description 销毁此对象。销毁后此对象的所有属性为 null,而不是初始值。
  4497. * @example
  4498. * var pixcel = new SuperMap.Pixel(100,50);
  4499. * pixcel.destroy();
  4500. */
  4501. destroy() {
  4502. this.x = null;
  4503. this.y = null;
  4504. this.mode = null;
  4505. }
  4506. }
  4507. SuperMap.Pixel = Pixel;
  4508. ;// CONCATENATED MODULE: ./src/common/commontypes/BaseTypes.js
  4509. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  4510. * This program are made available under the terms of the Apache License, Version 2.0
  4511. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  4512. /**
  4513. *@namespace SuperMap
  4514. *@category BaseTypes Namespace
  4515. */
  4516. /**
  4517. * @function SuperMap.inherit
  4518. * @description 除了 C 和 P 两个必要参数外,可以传递任意数量的对象,这些对象都将继承C。
  4519. * @memberOf SuperMap
  4520. * @param {Object} C - 继承的类。
  4521. * @param {Object} P - 被继承的父类。
  4522. */
  4523. SuperMap.inherit = function (C, P) {
  4524. var F = function () {
  4525. };
  4526. F.prototype = P.prototype;
  4527. C.prototype = new F;
  4528. var i, l, o;
  4529. for (i = 2, l = arguments.length; i < l; i++) {
  4530. o = arguments[i];
  4531. if (typeof o === "function") {
  4532. o = o.prototype;
  4533. }
  4534. SuperMap.Util.extend(C.prototype, o);
  4535. }
  4536. };
  4537. /**
  4538. * @function SuperMap.mixin
  4539. * @description 实现多重继承。
  4540. * @memberOf SuperMap
  4541. * @param {Class|Object} ...mixins - 继承的类。
  4542. */
  4543. SuperMap.mixin = function (...mixins) {
  4544. class Mix {
  4545. constructor(options) {
  4546. for (var index = 0; index < mixins.length; index++) {
  4547. copyProperties(this, new mixins[index](options));
  4548. }
  4549. }
  4550. }
  4551. for (var index = 0; index < mixins.length; index++) {
  4552. var mixin = mixins[index];
  4553. copyProperties(Mix, mixin);
  4554. copyProperties(Mix.prototype, mixin.prototype);
  4555. copyProperties(Mix.prototype, new mixin());
  4556. }
  4557. return Mix;
  4558. function copyProperties(target, source) {
  4559. var ownKeys = Object.getOwnPropertyNames(source);
  4560. if (Object.getOwnPropertySymbols) {
  4561. ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source));
  4562. }
  4563. for (var index = 0; index < ownKeys.length; index++) {
  4564. var key = ownKeys[index];
  4565. if (key !== "constructor"
  4566. && key !== "prototype"
  4567. && key !== "name" && key !== "length") {
  4568. let desc = Object.getOwnPropertyDescriptor(source, key);
  4569. if (window["ActiveXObject"]) {
  4570. Object.defineProperty(target, key, desc || {});
  4571. } else {
  4572. Object.defineProperty(target, key, desc);
  4573. }
  4574. }
  4575. }
  4576. }
  4577. };
  4578. /**
  4579. * @name String
  4580. * @namespace
  4581. * @memberOf SuperMap
  4582. * @category BaseTypes Util
  4583. * @description 字符串操作的一系列常用扩展函数。
  4584. */
  4585. var StringExt = SuperMap.String = {
  4586. /**
  4587. * @function SuperMap.String.startsWith
  4588. * @description 判断目标字符串是否以指定的子字符串开头。
  4589. * @param {string} str - 目标字符串。
  4590. * @param {string} sub - 查找的子字符串。
  4591. * @returns {boolean} 目标字符串以指定的子字符串开头,则返回 true;否则返回 false。
  4592. */
  4593. startsWith: function (str, sub) {
  4594. return (str.indexOf(sub) == 0);
  4595. },
  4596. /**
  4597. * @function SuperMap.String.contains
  4598. * @description 判断目标字符串是否包含指定的子字符串。
  4599. * @param {string} str - 目标字符串。
  4600. * @param {string} sub - 查找的子字符串。
  4601. * @returns {boolean} 目标字符串中包含指定的子字符串,则返回 true;否则返回 false。
  4602. */
  4603. contains: function (str, sub) {
  4604. return (str.indexOf(sub) != -1);
  4605. },
  4606. /**
  4607. * @function SuperMap.String.trim
  4608. * @description 删除一个字符串的开头和结尾处的所有空白字符。
  4609. * @param {string} str - (可能)存在空白字符填塞的字符串。
  4610. * @returns {string} 删除开头和结尾处空白字符后的字符串。
  4611. */
  4612. trim: function (str) {
  4613. return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
  4614. },
  4615. /**
  4616. * @function SuperMap.String.camelize
  4617. * @description 骆驼式("-")连字符的字符串处理。
  4618. * 例如:"chicken-head" becomes "chickenHead",
  4619. * "-chicken-head" becomes "ChickenHead"。
  4620. * @param {string} str - 要处理的字符串,原始内容不应被修改。
  4621. * @returns {string}
  4622. */
  4623. camelize: function (str) {
  4624. var oStringList = str.split('-');
  4625. var camelizedString = oStringList[0];
  4626. for (var i = 1, len = oStringList.length; i < len; i++) {
  4627. var s = oStringList[i];
  4628. camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
  4629. }
  4630. return camelizedString;
  4631. },
  4632. /**
  4633. * @function SuperMap.String.format
  4634. * @description 提供带 ${token} 标记的字符串, 返回 context 对象属性中指定标记的属性值。
  4635. * @example
  4636. * 示例:
  4637. * (code)
  4638. * 1、template = "${value,getValue}";
  4639. * context = {value: {getValue:function(){return Math.max.apply(null,argument);}}};
  4640. * args = [2,23,12,36,21];
  4641. * 返回值:36
  4642. * (end)
  4643. * 示例:
  4644. * (code)
  4645. * 2、template = "$${{value,getValue}}";
  4646. * context = {value: {getValue:function(){return Math.max.apply(null,argument);}}};
  4647. * args = [2,23,12,36,21];
  4648. * 返回值:"${36}"
  4649. * (end)
  4650. * 示例:
  4651. * (code)
  4652. * 3、template = "${a,b}";
  4653. * context = {a: {b:"format"}};
  4654. * args = null;
  4655. * 返回值:"format"
  4656. * (end)
  4657. * 示例:
  4658. * (code)
  4659. * 3、template = "${a,b}";
  4660. * context = null;
  4661. * args = null;
  4662. * 返回值:"${a.b}"
  4663. * (end)
  4664. * @param {string} template - 带标记的字符串将要被替换。参数 template 格式为"${token}",此处的 token 标记会替换为 context["token"] 属性的值。
  4665. * @param {Object} [context=window] - 带有属性的可选对象的属性用于匹配格式化字符串中的标记。如果该参数为空,将使用 window 对象。
  4666. * @param {Array} [args] - 可选参数传递给在 context 对象上找到的函数。
  4667. * @returns {string} 从 context 对象属性中替换字符串标记位的字符串。
  4668. */
  4669. format: function (template, context, args) {
  4670. if (!context) {
  4671. context = window;
  4672. }
  4673. // Example matching:
  4674. // str = ${foo.bar}
  4675. // match = foo.bar
  4676. var replacer = function (str, match) {
  4677. var replacement;
  4678. // Loop through all subs. Example: ${a.b.c}
  4679. // 0 -> replacement = context[a];
  4680. // 1 -> replacement = context[a][b];
  4681. // 2 -> replacement = context[a][b][c];
  4682. var subs = match.split(/\.+/);
  4683. for (var i = 0; i < subs.length; i++) {
  4684. if (i == 0) {
  4685. replacement = context;
  4686. }
  4687. replacement = replacement[subs[i]];
  4688. }
  4689. if (typeof replacement === "function") {
  4690. replacement = args ?
  4691. replacement.apply(null, args) :
  4692. replacement();
  4693. }
  4694. // If replacement is undefined, return the string 'undefined'.
  4695. // This is a workaround for a bugs in browsers not properly
  4696. // dealing with non-participating groups in regular expressions:
  4697. // http://blog.stevenlevithan.com/archives/npcg-javascript
  4698. if (typeof replacement == 'undefined') {
  4699. return 'undefined';
  4700. } else {
  4701. return replacement;
  4702. }
  4703. };
  4704. return template.replace(SuperMap.String.tokenRegEx, replacer);
  4705. },
  4706. /**
  4707. * @member {RegExp} [SuperMap.String.tokenRegEx]
  4708. * @description 寻找带 token 的字符串,默认为 tokenRegEx=/\$\{([\w.]+?)\}/g。
  4709. * @example
  4710. * Examples: ${a}, ${a.b.c}, ${a-b}, ${5}
  4711. */
  4712. tokenRegEx: /\$\{([\w.]+?)\}/g,
  4713. /**
  4714. * @member {RegExp} [SuperMap.String.numberRegEx]
  4715. * @description 判断一个字符串是否只包含一个数值,默认为 numberRegEx=/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/。
  4716. */
  4717. numberRegEx: /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/,
  4718. /**
  4719. * @function SuperMap.String.isNumeric
  4720. * @description 判断一个字符串是否只包含一个数值。
  4721. * @example
  4722. * (code)
  4723. * SuperMap.String.isNumeric("6.02e23") // true
  4724. * SuperMap.String.isNumeric("12 dozen") // false
  4725. * SuperMap.String.isNumeric("4") // true
  4726. * SuperMap.String.isNumeric(" 4 ") // false
  4727. * (end)
  4728. * @returns {boolean} 字符串包含唯一的数值,返回 true;否则返回 false。
  4729. */
  4730. isNumeric: function (value) {
  4731. return SuperMap.String.numberRegEx.test(value);
  4732. },
  4733. /**
  4734. * @function SuperMap.String.numericIf
  4735. * @description 把一个看似数值型的字符串转化为一个数值。
  4736. * @returns {(number|string)} 如果能转换为数值则返回数值,否则返回字符串本身。
  4737. */
  4738. numericIf: function (value) {
  4739. return SuperMap.String.isNumeric(value) ? parseFloat(value) : value;
  4740. }
  4741. };
  4742. /**
  4743. * @name Number
  4744. * @memberOf SuperMap
  4745. * @namespace
  4746. * @category BaseTypes Util
  4747. * @description 数值操作的一系列常用扩展函数。
  4748. */
  4749. var NumberExt = SuperMap.Number = {
  4750. /**
  4751. * @member {string} [SuperMap.Number.decimalSeparator='.']
  4752. * @description 格式化数字时默认的小数点分隔符。
  4753. * @constant
  4754. */
  4755. decimalSeparator: ".",
  4756. /**
  4757. * @member {string} [SuperMap.Number.thousandsSeparator=',']
  4758. * @description 格式化数字时默认的千位分隔符。
  4759. * @constant
  4760. */
  4761. thousandsSeparator: ",",
  4762. /**
  4763. * @function SuperMap.Number.limitSigDigs
  4764. * @description 限制浮点数的有效数字位数。
  4765. * @param {number} num - 浮点数。
  4766. * @param {integer} sig - 有效位数。
  4767. * @returns {number} 将数字四舍五入到指定数量的有效位数。
  4768. */
  4769. limitSigDigs: function (num, sig) {
  4770. var fig = 0;
  4771. if (sig > 0) {
  4772. fig = parseFloat(num.toPrecision(sig));
  4773. }
  4774. return fig;
  4775. },
  4776. /**
  4777. * @function SuperMap.Number.format
  4778. * @description 数字格式化输出。
  4779. * @param {number} num - 数字。
  4780. * @param {integer} [dec=0] - 数字的小数部分四舍五入到指定的位数。设置为 null 值时小数部分不变。
  4781. * @param {string} [tsep=','] - 千位分隔符。
  4782. * @param {string} [dsep='.'] - 小数点分隔符。
  4783. * @returns {string} 数字格式化后的字符串。
  4784. */
  4785. format: function (num, dec, tsep, dsep) {
  4786. dec = (typeof dec != "undefined") ? dec : 0;
  4787. tsep = (typeof tsep != "undefined") ? tsep :
  4788. SuperMap.Number.thousandsSeparator;
  4789. dsep = (typeof dsep != "undefined") ? dsep :
  4790. SuperMap.Number.decimalSeparator;
  4791. if (dec != null) {
  4792. num = parseFloat(num.toFixed(dec));
  4793. }
  4794. var parts = num.toString().split(".");
  4795. if (parts.length === 1 && dec == null) {
  4796. // integer where we do not want to touch the decimals
  4797. dec = 0;
  4798. }
  4799. var integer = parts[0];
  4800. if (tsep) {
  4801. var thousands = /(-?[0-9]+)([0-9]{3})/;
  4802. while (thousands.test(integer)) {
  4803. integer = integer.replace(thousands, "$1" + tsep + "$2");
  4804. }
  4805. }
  4806. var str;
  4807. if (dec == 0) {
  4808. str = integer;
  4809. } else {
  4810. var rem = parts.length > 1 ? parts[1] : "0";
  4811. if (dec != null) {
  4812. rem = rem + new Array(dec - rem.length + 1).join("0");
  4813. }
  4814. str = integer + dsep + rem;
  4815. }
  4816. return str;
  4817. }
  4818. };
  4819. if (!Number.prototype.limitSigDigs) {
  4820. /**
  4821. * APIMethod: Number.limitSigDigs
  4822. * 限制浮点数的有效数字位数.
  4823. * @param {integer} sig -有效位数。
  4824. * @returns {integer} 将数字四舍五入到指定数量的有效位数。
  4825. * 如果传入值 为 null、0、或者是负数, 返回值 0。
  4826. */
  4827. Number.prototype.limitSigDigs = function (sig) {
  4828. return NumberExt.limitSigDigs(this, sig);
  4829. };
  4830. }
  4831. /**
  4832. * @name Function
  4833. * @memberOf SuperMap
  4834. * @namespace
  4835. * @category BaseTypes Util
  4836. * @description 函数操作的一系列常用扩展函数。
  4837. */
  4838. var FunctionExt = SuperMap.Function = {
  4839. /**
  4840. * @function SuperMap.Function.bind
  4841. * @description 绑定函数到对象。方便创建 this 的作用域。
  4842. * @param {function} func - 输入函数。
  4843. * @param {Object} object - 对象绑定到输入函数(作为输入函数的 this 对象)。
  4844. * @returns {function} object 参数作为 func 函数的 this 对象。
  4845. */
  4846. bind: function (func, object) {
  4847. // create a reference to all arguments past the second one
  4848. var args = Array.prototype.slice.apply(arguments, [2]);
  4849. return function () {
  4850. // Push on any additional arguments from the actual function call.
  4851. // These will come after those sent to the bind call.
  4852. var newArgs = args.concat(
  4853. Array.prototype.slice.apply(arguments, [0])
  4854. );
  4855. return func.apply(object, newArgs);
  4856. };
  4857. },
  4858. /**
  4859. * @function SuperMap.Function.bindAsEventListener
  4860. * @description 绑定函数到对象,在调用该函数时配置并使用事件对象作为第一个参数。
  4861. * @param {function} func - 用于监听事件的函数。
  4862. * @param {Object} object - this 对象的引用。
  4863. * @returns {function}
  4864. */
  4865. bindAsEventListener: function (func, object) {
  4866. return function (event) {
  4867. return func.call(object, event || window.event);
  4868. };
  4869. },
  4870. /**
  4871. * @function SuperMap.Function.False
  4872. * @description 该函数仅仅返回 false。该函数主要是避免在 IE8 以下浏览中 DOM 事件句柄的匿名函数问题。
  4873. * @example
  4874. * document.onclick = SuperMap.Function.False;
  4875. * @returns {boolean}
  4876. */
  4877. False: function () {
  4878. return false;
  4879. },
  4880. /**
  4881. * @function SuperMap.Function.True
  4882. * @description 该函数仅仅返回 true。该函数主要是避免在 IE8 以下浏览中 DOM 事件句柄的匿名函数问题。
  4883. * @example
  4884. * document.onclick = SuperMap.Function.True;
  4885. * @returns {boolean}
  4886. */
  4887. True: function () {
  4888. return true;
  4889. },
  4890. /**
  4891. * @function SuperMap.Function.Void
  4892. * @description 可重用函数,仅仅返回 "undefined"。
  4893. * @returns {undefined}
  4894. */
  4895. Void: function () {
  4896. }
  4897. };
  4898. /**
  4899. * @name Array
  4900. * @memberOf SuperMap
  4901. * @namespace
  4902. * @category BaseTypes Util
  4903. * @description 数组操作的一系列常用扩展函数。
  4904. */
  4905. var ArrayExt = SuperMap.Array = {
  4906. /**
  4907. * @function SuperMap.Array.filter
  4908. * @description 过滤数组,提供了 ECMA-262 标准中 Array.prototype.filter 函数的扩展。详见:{@link http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array/filter}
  4909. * @param {Array} array - 要过滤的数组。
  4910. * @param {function} callback - 数组中的每一个元素调用该函数。</br>
  4911. * 如果函数的返回值为 true,该元素将包含在返回的数组中。该函数有三个参数: 数组中的元素,元素的索引,数组自身。</br>
  4912. * 如果设置了可选参数 caller,在调用 callback 时,使用可选参数 caller 设置为 callback 的参数。</br>
  4913. * @param {Object} [caller] - 在调用 callback 时,使用参数 caller 设置为 callback 的参数。
  4914. * @returns {Array} callback 函数返回 true 时的元素将作为返回数组中的元素。
  4915. */
  4916. filter: function (array, callback, caller) {
  4917. var selected = [];
  4918. if (Array.prototype.filter) {
  4919. selected = array.filter(callback, caller);
  4920. } else {
  4921. var len = array.length;
  4922. if (typeof callback != "function") {
  4923. throw new TypeError();
  4924. }
  4925. for (var i = 0; i < len; i++) {
  4926. if (i in array) {
  4927. var val = array[i];
  4928. if (callback.call(caller, val, i, array)) {
  4929. selected.push(val);
  4930. }
  4931. }
  4932. }
  4933. }
  4934. return selected;
  4935. }
  4936. };
  4937. ;// CONCATENATED MODULE: ./src/common/commontypes/Util.js
  4938. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  4939. * This program are made available under the terms of the Apache License, Version 2.0
  4940. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  4941. var Util = SuperMap.Util = SuperMap.Util || {};
  4942. /**
  4943. * @name Util
  4944. * @memberOf SuperMap
  4945. * @namespace
  4946. * @category BaseTypes Util
  4947. * @description common 工具类。
  4948. */
  4949. /**
  4950. * @description 复制源对象的所有属性到目标对象上,源对象上的没有定义的属性在目标对象上也不会被设置。
  4951. * @example
  4952. * 要复制 SuperMap.Size 对象的所有属性到自定义对象上,使用方法如下:
  4953. * var size = new SuperMap.Size(100, 100);
  4954. * var obj = {};
  4955. * SuperMap.Util.extend(obj, size);
  4956. * @param {Object} [destination] - 目标对象。
  4957. * @param {Object} source - 源对象,其属性将被设置到目标对象上。
  4958. * @returns {Object} 目标对象。
  4959. */
  4960. SuperMap.Util.extend = function (destination, source) {
  4961. destination = destination || {};
  4962. if (source) {
  4963. for (var property in source) {
  4964. var value = source[property];
  4965. if (value !== undefined) {
  4966. destination[property] = value;
  4967. }
  4968. }
  4969. /**
  4970. * IE doesn't include the toString property when iterating over an object's
  4971. * properties with the for(property in object) syntax. Explicitly check if
  4972. * the source has its own toString property.
  4973. */
  4974. /*
  4975. * FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
  4976. * prototype object" when calling hawOwnProperty if the source object
  4977. * is an instance of window.Event.
  4978. */
  4979. var sourceIsEvt = typeof window.Event === "function"
  4980. && source instanceof window.Event;
  4981. if (!sourceIsEvt
  4982. && source.hasOwnProperty && source.hasOwnProperty("toString")) {
  4983. destination.toString = source.toString;
  4984. }
  4985. }
  4986. return destination;
  4987. };
  4988. /**
  4989. * @description 对象拷贝。
  4990. * @param {Object} [des] - 目标对象。
  4991. * @param {Object} soc - 源对象。
  4992. */
  4993. SuperMap.Util.copy = function (des, soc) {
  4994. des = des || {};
  4995. var v;
  4996. if (soc) {
  4997. for (var p in des) {
  4998. v = soc[p];
  4999. if (typeof v !== 'undefined') {
  5000. des[p] = v;
  5001. }
  5002. }
  5003. }
  5004. };
  5005. /**
  5006. * @description 销毁对象,将其属性置空。
  5007. * @param {Object} [obj] - 目标对象。
  5008. */
  5009. SuperMap.Util.reset = function (obj) {
  5010. obj = obj || {};
  5011. for (var p in obj) {
  5012. if (obj.hasOwnProperty(p)) {
  5013. if (typeof obj[p] === "object" && obj[p] instanceof Array) {
  5014. for (var i in obj[p]) {
  5015. if (obj[p][i].destroy) {
  5016. obj[p][i].destroy();
  5017. }
  5018. }
  5019. obj[p].length = 0;
  5020. } else if (typeof obj[p] === "object" && obj[p] instanceof Object) {
  5021. if (obj[p].destroy) {
  5022. obj[p].destroy();
  5023. }
  5024. }
  5025. obj[p] = null;
  5026. }
  5027. }
  5028. };
  5029. /**
  5030. * @description 获取 HTML 元素数组。
  5031. * @returns {Array.<HTMLElement>} HTML 元素数组。
  5032. */
  5033. SuperMap.Util.getElement = function () {
  5034. var elements = [];
  5035. for (var i = 0, len = arguments.length; i < len; i++) {
  5036. var element = arguments[i];
  5037. if (typeof element === 'string') {
  5038. element = document.getElementById(element);
  5039. }
  5040. if (arguments.length === 1) {
  5041. return element;
  5042. }
  5043. elements.push(element);
  5044. }
  5045. return elements;
  5046. };
  5047. /**
  5048. * @description instance of 的跨浏览器实现。
  5049. * @param {Object} o - 对象。
  5050. * @returns {boolean} 是否是页面元素。
  5051. */
  5052. SuperMap.Util.isElement = function (o) {
  5053. return !!(o && o.nodeType === 1);
  5054. };
  5055. /**
  5056. * @description 判断一个对象是否是数组。
  5057. * @param {Object} a - 对象。
  5058. * @returns {boolean} 是否是数组。
  5059. */
  5060. SuperMap.Util.isArray = function (a) {
  5061. return (Object.prototype.toString.call(a) === '[object Array]');
  5062. };
  5063. /**
  5064. * @description 从数组中删除某一项。
  5065. * @param {Array} array - 数组。
  5066. * @param {Object} item - 数组中要删除的一项。
  5067. * @returns {Array} 执行删除操作后的数组。
  5068. */
  5069. SuperMap.Util.removeItem = function (array, item) {
  5070. for (var i = array.length - 1; i >= 0; i--) {
  5071. if (array[i] === item) {
  5072. array.splice(i, 1);
  5073. //break;more than once??
  5074. }
  5075. }
  5076. return array;
  5077. };
  5078. /**
  5079. * @description 获取某对象再数组中的索引值。
  5080. * @param {Array} array - 数组。
  5081. * @param {Object} obj - 对象。
  5082. * @returns {number} 某对象再数组中的索引值。
  5083. */
  5084. SuperMap.Util.indexOf = function (array, obj) {
  5085. if (array == null) {
  5086. return -1;
  5087. } else {
  5088. // use the build-in function if available.
  5089. if (typeof array.indexOf === "function") {
  5090. return array.indexOf(obj);
  5091. } else {
  5092. for (var i = 0, len = array.length; i < len; i++) {
  5093. if (array[i] === obj) {
  5094. return i;
  5095. }
  5096. }
  5097. return -1;
  5098. }
  5099. }
  5100. };
  5101. /**
  5102. * @description 修改某 DOM 元素的许多属性。
  5103. * @param {HTMLElement} element - 待修改的 DOM 元素。
  5104. * @param {string} [id] - DOM 元素的 ID。
  5105. * @param {SuperMap.Pixel} [px] - 包含 DOM 元素的 style 属性的 left 和 top 属性。
  5106. * @param {SuperMap.Size} [sz] - 包含 DOM 元素的 width 和 height 属性。
  5107. * @param {string} [position] - DOM 元素的 position 属性。
  5108. * @param {string} [border] - DOM 元素的 style 属性的 border 属性。
  5109. * @param {string} [overflow] - DOM 元素的 style 属性的 overflow 属性。
  5110. * @param {number} [opacity] - 不透明度值。取值范围为(0.0 - 1.0)。
  5111. */
  5112. SuperMap.Util.modifyDOMElement = function (element, id, px, sz, position,
  5113. border, overflow, opacity) {
  5114. if (id) {
  5115. element.id = id;
  5116. }
  5117. if (px) {
  5118. element.style.left = px.x + "px";
  5119. element.style.top = px.y + "px";
  5120. }
  5121. if (sz) {
  5122. element.style.width = sz.w + "px";
  5123. element.style.height = sz.h + "px";
  5124. }
  5125. if (position) {
  5126. element.style.position = position;
  5127. }
  5128. if (border) {
  5129. element.style.border = border;
  5130. }
  5131. if (overflow) {
  5132. element.style.overflow = overflow;
  5133. }
  5134. if (parseFloat(opacity) >= 0.0 && parseFloat(opacity) < 1.0) {
  5135. element.style.filter = 'alpha(opacity=' + (opacity * 100) + ')';
  5136. element.style.opacity = opacity;
  5137. } else if (parseFloat(opacity) === 1.0) {
  5138. element.style.filter = '';
  5139. element.style.opacity = '';
  5140. }
  5141. };
  5142. /**
  5143. * @description Takes an object and copies any properties that don't exist from
  5144. * another properties, by analogy with SuperMap.Util.extend() from
  5145. * Prototype.js.
  5146. *
  5147. * @param {Object} [to] - 目标对象。
  5148. * @param {Object} from - 源对象。Any properties of this object that
  5149. * are undefined in the to object will be set on the to object.
  5150. *
  5151. * @returns {Object} A reference to the to object. Note that the to argument is modified
  5152. * in place and returned by this function.
  5153. */
  5154. SuperMap.Util.applyDefaults = function (to, from) {
  5155. to = to || {};
  5156. /*
  5157. * FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
  5158. * prototype object" when calling hawOwnProperty if the source object is an
  5159. * instance of window.Event.
  5160. */
  5161. var fromIsEvt = typeof window.Event === "function"
  5162. && from instanceof window.Event;
  5163. for (var key in from) {
  5164. if (to[key] === undefined ||
  5165. (!fromIsEvt && from.hasOwnProperty
  5166. && from.hasOwnProperty(key) && !to.hasOwnProperty(key))) {
  5167. to[key] = from[key];
  5168. }
  5169. }
  5170. /**
  5171. * IE doesn't include the toString property when iterating over an object's
  5172. * properties with the for(property in object) syntax. Explicitly check if
  5173. * the source has its own toString property.
  5174. */
  5175. if (!fromIsEvt && from && from.hasOwnProperty
  5176. && from.hasOwnProperty('toString') && !to.hasOwnProperty('toString')) {
  5177. to.toString = from.toString;
  5178. }
  5179. return to;
  5180. };
  5181. /**
  5182. * @description 将参数对象转换为 HTTP 的 GET 请求中的参数字符串。例如:"key1=value1&key2=value2&key3=value3"。
  5183. * @param {Object} params - 参数对象。
  5184. * @returns {string} HTTP 的 GET 请求中的参数字符串。
  5185. */
  5186. SuperMap.Util.getParameterString = function (params) {
  5187. var paramsArray = [];
  5188. for (var key in params) {
  5189. var value = params[key];
  5190. if ((value != null) && (typeof value !== 'function')) {
  5191. var encodedValue;
  5192. if (Array.isArray(value) || value.toString() === '[object Object]') {
  5193. encodedValue = encodeURIComponent(JSON.stringify(value));
  5194. } else {
  5195. /* value is a string; simply encode */
  5196. encodedValue = encodeURIComponent(value);
  5197. }
  5198. paramsArray.push(encodeURIComponent(key) + "=" + encodedValue);
  5199. }
  5200. }
  5201. return paramsArray.join("&");
  5202. };
  5203. /**
  5204. * @description 给 URL 追加查询参数。
  5205. * @param {string} url - 待追加参数的 URL 字符串。
  5206. * @param {string} paramStr - 待追加的查询参数。
  5207. * @returns {string} 新的 URL。
  5208. */
  5209. SuperMap.Util.urlAppend = function (url, paramStr) {
  5210. var newUrl = url;
  5211. if (paramStr) {
  5212. if(paramStr.indexOf('?') === 0){
  5213. paramStr = paramStr.substring(1);
  5214. }
  5215. var parts = (url + " ").split(/[?&]/);
  5216. newUrl += (parts.pop() === " " ?
  5217. paramStr :
  5218. parts.length ? "&" + paramStr : "?" + paramStr);
  5219. }
  5220. return newUrl;
  5221. };
  5222. /**
  5223. * @description 给 URL 追加 path 参数。
  5224. * @param {string} url - 待追加参数的 URL 字符串。
  5225. * @param {string} paramStr - 待追加的path参数。
  5226. * @returns {string} 新的 URL。
  5227. */
  5228. SuperMap.Util.urlPathAppend = function (url, pathStr) {
  5229. let newUrl = url;
  5230. if (!pathStr) {
  5231. return newUrl;
  5232. }
  5233. if (pathStr.indexOf('/') === 0) {
  5234. pathStr = pathStr.substring(1);
  5235. }
  5236. const parts = url.split('?');
  5237. if(parts[0].indexOf('/', parts[0].length - 1) < 0){
  5238. parts[0] += '/'
  5239. }
  5240. newUrl = `${parts[0]}${pathStr}${parts.length > 1 ? `?${parts[1]}` : ''}`;
  5241. return newUrl;
  5242. };
  5243. /**
  5244. * @description 为了避免浮点精度错误而保留的有效位数。
  5245. * @type {number}
  5246. * @default 14
  5247. */
  5248. SuperMap.Util.DEFAULT_PRECISION = 14;
  5249. /**
  5250. * @description 将字符串以接近的精度转换为数字。
  5251. * @param {string} number - 字符串。
  5252. * @param {number} [precision=14] - 精度。
  5253. * @returns {number} 数字。
  5254. */
  5255. SuperMap.Util.toFloat = function (number, precision) {
  5256. if (precision == null) {
  5257. precision = SuperMap.Util.DEFAULT_PRECISION;
  5258. }
  5259. if (typeof number !== "number") {
  5260. number = parseFloat(number);
  5261. }
  5262. return precision === 0 ? number :
  5263. parseFloat(number.toPrecision(precision));
  5264. };
  5265. /**
  5266. * @description 角度转弧度。
  5267. * @param {number} x - 角度。
  5268. * @returns {number} 弧度。
  5269. */
  5270. SuperMap.Util.rad = function (x) {
  5271. return x * Math.PI / 180;
  5272. };
  5273. /**
  5274. * @description 从 URL 字符串中解析出参数对象。
  5275. * @param {string} url - URL。
  5276. * @returns {Object} 解析出的参数对象。
  5277. */
  5278. SuperMap.Util.getParameters = function (url) {
  5279. // if no url specified, take it from the location bar
  5280. url = (url === null || url === undefined) ? window.location.href : url;
  5281. //parse out parameters portion of url string
  5282. var paramsString = "";
  5283. if (SuperMap.String.contains(url, '?')) {
  5284. var start = url.indexOf('?') + 1;
  5285. var end = SuperMap.String.contains(url, "#") ?
  5286. url.indexOf('#') : url.length;
  5287. paramsString = url.substring(start, end);
  5288. }
  5289. var parameters = {};
  5290. var pairs = paramsString.split(/[&;]/);
  5291. for (var i = 0, len = pairs.length; i < len; ++i) {
  5292. var keyValue = pairs[i].split('=');
  5293. if (keyValue[0]) {
  5294. var key = keyValue[0];
  5295. try {
  5296. key = decodeURIComponent(key);
  5297. } catch (err) {
  5298. key = unescape(key);
  5299. }
  5300. // being liberal by replacing "+" with " "
  5301. var value = (keyValue[1] || '').replace(/\+/g, " ");
  5302. try {
  5303. value = decodeURIComponent(value);
  5304. } catch (err) {
  5305. value = unescape(value);
  5306. }
  5307. // follow OGC convention of comma delimited values
  5308. value = value.split(",");
  5309. //if there's only one value, do not return as array
  5310. if (value.length == 1) {
  5311. value = value[0];
  5312. }
  5313. parameters[key] = value;
  5314. }
  5315. }
  5316. return parameters;
  5317. };
  5318. /**
  5319. * @description 不断递增计数变量,用于生成唯一 ID。
  5320. * @type {number}
  5321. * @default 0
  5322. */
  5323. SuperMap.Util.lastSeqID = 0;
  5324. /**
  5325. * @description 创建唯一 ID 值。
  5326. * @param {string} [prefix] - 前缀。
  5327. * @returns {string} 唯一的 ID 值。
  5328. */
  5329. SuperMap.Util.createUniqueID = function (prefix) {
  5330. if (prefix == null) {
  5331. prefix = "id_";
  5332. }
  5333. SuperMap.Util.lastSeqID += 1;
  5334. return prefix + SuperMap.Util.lastSeqID;
  5335. };
  5336. /**
  5337. * @memberOf SuperMap
  5338. * @description 每单位的英尺数。
  5339. * @type {Object}
  5340. * @constant
  5341. */
  5342. SuperMap.INCHES_PER_UNIT = {
  5343. 'inches': 1.0,
  5344. 'ft': 12.0,
  5345. 'mi': 63360.0,
  5346. 'm': 39.3701,
  5347. 'km': 39370.1,
  5348. 'dd': 4374754,
  5349. 'yd': 36
  5350. };
  5351. SuperMap.INCHES_PER_UNIT.in = SuperMap.INCHES_PER_UNIT.inches;
  5352. SuperMap.INCHES_PER_UNIT.degrees = SuperMap.INCHES_PER_UNIT.dd;
  5353. SuperMap.INCHES_PER_UNIT.nmi = 1852 * SuperMap.INCHES_PER_UNIT.m;
  5354. // Units from CS-Map
  5355. SuperMap.METERS_PER_INCH = 0.02540005080010160020;
  5356. SuperMap.Util.extend(SuperMap.INCHES_PER_UNIT, {
  5357. "Inch": SuperMap.INCHES_PER_UNIT.inches,
  5358. "Meter": 1.0 / SuperMap.METERS_PER_INCH, //EPSG:9001
  5359. "Foot": 0.30480060960121920243 / SuperMap.METERS_PER_INCH, //EPSG:9003
  5360. "IFoot": 0.30480000000000000000 / SuperMap.METERS_PER_INCH, //EPSG:9002
  5361. "ClarkeFoot": 0.3047972651151 / SuperMap.METERS_PER_INCH, //EPSG:9005
  5362. "SearsFoot": 0.30479947153867624624 / SuperMap.METERS_PER_INCH, //EPSG:9041
  5363. "GoldCoastFoot": 0.30479971018150881758 / SuperMap.METERS_PER_INCH, //EPSG:9094
  5364. "IInch": 0.02540000000000000000 / SuperMap.METERS_PER_INCH,
  5365. "MicroInch": 0.00002540000000000000 / SuperMap.METERS_PER_INCH,
  5366. "Mil": 0.00000002540000000000 / SuperMap.METERS_PER_INCH,
  5367. "Centimeter": 0.01000000000000000000 / SuperMap.METERS_PER_INCH,
  5368. "Kilometer": 1000.00000000000000000000 / SuperMap.METERS_PER_INCH, //EPSG:9036
  5369. "Yard": 0.91440182880365760731 / SuperMap.METERS_PER_INCH,
  5370. "SearsYard": 0.914398414616029 / SuperMap.METERS_PER_INCH, //EPSG:9040
  5371. "IndianYard": 0.91439853074444079983 / SuperMap.METERS_PER_INCH, //EPSG:9084
  5372. "IndianYd37": 0.91439523 / SuperMap.METERS_PER_INCH, //EPSG:9085
  5373. "IndianYd62": 0.9143988 / SuperMap.METERS_PER_INCH, //EPSG:9086
  5374. "IndianYd75": 0.9143985 / SuperMap.METERS_PER_INCH, //EPSG:9087
  5375. "IndianFoot": 0.30479951 / SuperMap.METERS_PER_INCH, //EPSG:9080
  5376. "IndianFt37": 0.30479841 / SuperMap.METERS_PER_INCH, //EPSG:9081
  5377. "IndianFt62": 0.3047996 / SuperMap.METERS_PER_INCH, //EPSG:9082
  5378. "IndianFt75": 0.3047995 / SuperMap.METERS_PER_INCH, //EPSG:9083
  5379. "Mile": 1609.34721869443738887477 / SuperMap.METERS_PER_INCH,
  5380. "IYard": 0.91440000000000000000 / SuperMap.METERS_PER_INCH, //EPSG:9096
  5381. "IMile": 1609.34400000000000000000 / SuperMap.METERS_PER_INCH, //EPSG:9093
  5382. "NautM": 1852.00000000000000000000 / SuperMap.METERS_PER_INCH, //EPSG:9030
  5383. "Lat-66": 110943.316488932731 / SuperMap.METERS_PER_INCH,
  5384. "Lat-83": 110946.25736872234125 / SuperMap.METERS_PER_INCH,
  5385. "Decimeter": 0.10000000000000000000 / SuperMap.METERS_PER_INCH,
  5386. "Millimeter": 0.00100000000000000000 / SuperMap.METERS_PER_INCH,
  5387. "Dekameter": 10.00000000000000000000 / SuperMap.METERS_PER_INCH,
  5388. "Decameter": 10.00000000000000000000 / SuperMap.METERS_PER_INCH,
  5389. "Hectometer": 100.00000000000000000000 / SuperMap.METERS_PER_INCH,
  5390. "GermanMeter": 1.0000135965 / SuperMap.METERS_PER_INCH, //EPSG:9031
  5391. "CaGrid": 0.999738 / SuperMap.METERS_PER_INCH,
  5392. "ClarkeChain": 20.1166194976 / SuperMap.METERS_PER_INCH, //EPSG:9038
  5393. "GunterChain": 20.11684023368047 / SuperMap.METERS_PER_INCH, //EPSG:9033
  5394. "BenoitChain": 20.116782494375872 / SuperMap.METERS_PER_INCH, //EPSG:9062
  5395. "SearsChain": 20.11676512155 / SuperMap.METERS_PER_INCH, //EPSG:9042
  5396. "ClarkeLink": 0.201166194976 / SuperMap.METERS_PER_INCH, //EPSG:9039
  5397. "GunterLink": 0.2011684023368047 / SuperMap.METERS_PER_INCH, //EPSG:9034
  5398. "BenoitLink": 0.20116782494375872 / SuperMap.METERS_PER_INCH, //EPSG:9063
  5399. "SearsLink": 0.2011676512155 / SuperMap.METERS_PER_INCH, //EPSG:9043
  5400. "Rod": 5.02921005842012 / SuperMap.METERS_PER_INCH,
  5401. "IntnlChain": 20.1168 / SuperMap.METERS_PER_INCH, //EPSG:9097
  5402. "IntnlLink": 0.201168 / SuperMap.METERS_PER_INCH, //EPSG:9098
  5403. "Perch": 5.02921005842012 / SuperMap.METERS_PER_INCH,
  5404. "Pole": 5.02921005842012 / SuperMap.METERS_PER_INCH,
  5405. "Furlong": 201.1684023368046 / SuperMap.METERS_PER_INCH,
  5406. "Rood": 3.778266898 / SuperMap.METERS_PER_INCH,
  5407. "CapeFoot": 0.3047972615 / SuperMap.METERS_PER_INCH,
  5408. "Brealey": 375.00000000000000000000 / SuperMap.METERS_PER_INCH,
  5409. "ModAmFt": 0.304812252984505969011938 / SuperMap.METERS_PER_INCH,
  5410. "Fathom": 1.8288 / SuperMap.METERS_PER_INCH,
  5411. "NautM-UK": 1853.184 / SuperMap.METERS_PER_INCH,
  5412. "50kilometers": 50000.0 / SuperMap.METERS_PER_INCH,
  5413. "150kilometers": 150000.0 / SuperMap.METERS_PER_INCH
  5414. });
  5415. //unit abbreviations supported by PROJ.4
  5416. SuperMap.Util.extend(SuperMap.INCHES_PER_UNIT, {
  5417. "mm": SuperMap.INCHES_PER_UNIT.Meter / 1000.0,
  5418. "cm": SuperMap.INCHES_PER_UNIT.Meter / 100.0,
  5419. "dm": SuperMap.INCHES_PER_UNIT.Meter * 100.0,
  5420. "km": SuperMap.INCHES_PER_UNIT.Meter * 1000.0,
  5421. "kmi": SuperMap.INCHES_PER_UNIT.nmi, //International Nautical Mile
  5422. "fath": SuperMap.INCHES_PER_UNIT.Fathom, //International Fathom
  5423. "ch": SuperMap.INCHES_PER_UNIT.IntnlChain, //International Chain
  5424. "link": SuperMap.INCHES_PER_UNIT.IntnlLink, //International Link
  5425. "us-in": SuperMap.INCHES_PER_UNIT.inches, //U.S. Surveyor's Inch
  5426. "us-ft": SuperMap.INCHES_PER_UNIT.Foot, //U.S. Surveyor's Foot
  5427. "us-yd": SuperMap.INCHES_PER_UNIT.Yard, //U.S. Surveyor's Yard
  5428. "us-ch": SuperMap.INCHES_PER_UNIT.GunterChain, //U.S. Surveyor's Chain
  5429. "us-mi": SuperMap.INCHES_PER_UNIT.Mile, //U.S. Surveyor's Statute Mile
  5430. "ind-yd": SuperMap.INCHES_PER_UNIT.IndianYd37, //Indian Yard
  5431. "ind-ft": SuperMap.INCHES_PER_UNIT.IndianFt37, //Indian Foot
  5432. "ind-ch": 20.11669506 / SuperMap.METERS_PER_INCH //Indian Chain
  5433. });
  5434. /**
  5435. * @memberOf SuperMap
  5436. * @member [SuperMap.DOTS_PER_INCH=96]
  5437. * @description 分辨率与比例尺之间转换的常量。
  5438. * @type {Object}
  5439. */
  5440. SuperMap.DOTS_PER_INCH = 96;
  5441. /**
  5442. * @param {number} scale - 比例尺。
  5443. * @returns {number} 返回正常的 scale 值。
  5444. */
  5445. SuperMap.Util.normalizeScale = function (scale) {
  5446. var normScale = (scale > 1.0) ? (1.0 / scale) : scale;
  5447. return normScale;
  5448. };
  5449. /**
  5450. * @description 比例尺转分辨率。
  5451. * @param {number} scale - 比例尺。
  5452. * @param {string} [units='degrees'] - 比例尺单位。
  5453. * @returns {number} 分辨率。
  5454. */
  5455. SuperMap.Util.getResolutionFromScale = function (scale, units) {
  5456. var resolution;
  5457. if (scale) {
  5458. if (units == null) {
  5459. units = "degrees";
  5460. }
  5461. var normScale = SuperMap.Util.normalizeScale(scale);
  5462. resolution = 1 / (normScale * SuperMap.INCHES_PER_UNIT[units]
  5463. * SuperMap.DOTS_PER_INCH);
  5464. }
  5465. return resolution;
  5466. };
  5467. /**
  5468. * @description 分辨率转比例尺。
  5469. * @param {number} resolution - 分辨率。
  5470. * @param {string} [units='degrees'] - 分辨率单位。
  5471. * @returns {number} 比例尺。
  5472. */
  5473. SuperMap.Util.getScaleFromResolution = function (resolution, units) {
  5474. if (units == null) {
  5475. units = "degrees";
  5476. }
  5477. var scale = resolution * SuperMap.INCHES_PER_UNIT[units] *
  5478. SuperMap.DOTS_PER_INCH;
  5479. return scale;
  5480. };
  5481. /**
  5482. * @memberOf SuperMap
  5483. * @description 如果 userAgent 捕获到浏览器使用的是 Gecko 引擎则返回 true。
  5484. * @constant
  5485. */
  5486. SuperMap.IS_GECKO = (function () {
  5487. var ua = navigator.userAgent.toLowerCase();
  5488. return ua.indexOf("webkit") === -1 && ua.indexOf("gecko") !== -1;
  5489. })();
  5490. /**
  5491. * @memberOf SuperMap
  5492. * @description 浏览器名称,依赖于 userAgent 属性,BROWSER_NAME 可以是空,或者以下浏览器:
  5493. * * "opera" -- Opera
  5494. * * "msie" -- Internet Explorer
  5495. * * "safari" -- Safari
  5496. * * "firefox" -- Firefox
  5497. * * "mozilla" -- Mozilla
  5498. * @constant
  5499. */
  5500. SuperMap.Browser = (function () {
  5501. var name = '', version = '', device = 'pc', uaMatch;
  5502. //以下进行测试
  5503. var ua = navigator.userAgent.toLowerCase();
  5504. if (ua.indexOf("msie") > -1 || (ua.indexOf("trident") > -1 && ua.indexOf("rv") > -1)) {
  5505. name = 'msie';
  5506. uaMatch = ua.match(/msie ([\d.]+)/) || ua.match(/rv:([\d.]+)/);
  5507. } else if (ua.indexOf("chrome") > -1) {
  5508. name = 'chrome';
  5509. uaMatch = ua.match(/chrome\/([\d.]+)/);
  5510. } else if (ua.indexOf("firefox") > -1) {
  5511. name = 'firefox';
  5512. uaMatch = ua.match(/firefox\/([\d.]+)/);
  5513. } else if (ua.indexOf("opera") > -1) {
  5514. name = 'opera';
  5515. uaMatch = ua.match(/version\/([\d.]+)/);
  5516. } else if (ua.indexOf("safari") > -1) {
  5517. name = 'safari';
  5518. uaMatch = ua.match(/version\/([\d.]+)/);
  5519. }
  5520. version = uaMatch ? uaMatch[1] : '';
  5521. if (ua.indexOf("ipad") > -1 || ua.indexOf("ipod") > -1 || ua.indexOf("iphone") > -1) {
  5522. device = 'apple';
  5523. } else if (ua.indexOf("android") > -1) {
  5524. uaMatch = ua.match(/version\/([\d.]+)/);
  5525. version = uaMatch ? uaMatch[1] : '';
  5526. device = 'android';
  5527. }
  5528. return {name: name, version: version, device: device};
  5529. })();
  5530. /**
  5531. * @description 获取浏览器相关信息。支持的浏览器包括:Opera,Internet Explorer,Safari,Firefox。
  5532. * @returns {Object} 获取浏览器名称、版本、设备名称。对应的属性分别为 name, version, device。
  5533. */
  5534. SuperMap.Util.getBrowser = function () {
  5535. return SuperMap.Browser;
  5536. };
  5537. /**
  5538. * @description 浏览器是否支持 Canvas。
  5539. * @returns {boolean} 获取当前浏览器是否支持 HTML5 Canvas。
  5540. */
  5541. SuperMap.Util.isSupportCanvas = (function () {
  5542. var checkRes = true, broz = SuperMap.Util.getBrowser();
  5543. if (document.createElement("canvas").getContext) {
  5544. if (broz.name === 'firefox' && parseFloat(broz.version) < 5) {
  5545. checkRes = false;
  5546. }
  5547. if (broz.name === 'safari' && parseFloat(broz.version) < 4) {
  5548. checkRes = false;
  5549. }
  5550. if (broz.name === 'opera' && parseFloat(broz.version) < 10) {
  5551. checkRes = false;
  5552. }
  5553. if (broz.name === 'msie' && parseFloat(broz.version) < 9) {
  5554. checkRes = false;
  5555. }
  5556. } else {
  5557. checkRes = false;
  5558. }
  5559. return checkRes;
  5560. })();
  5561. /**
  5562. * @description 判断;浏览器是否支持 Canvas。
  5563. * @returns {boolean} 获取当前浏览器是否支持 HTML5 Canvas 。
  5564. */
  5565. SuperMap.Util.supportCanvas = function () {
  5566. return SuperMap.Util.isSupportCanvas;
  5567. };
  5568. //将服务端的地图单位转成SuperMap的地图单位
  5569. SuperMap.INCHES_PER_UNIT.degree = SuperMap.INCHES_PER_UNIT.dd;
  5570. SuperMap.INCHES_PER_UNIT.meter = SuperMap.INCHES_PER_UNIT.m;
  5571. SuperMap.INCHES_PER_UNIT.foot = SuperMap.INCHES_PER_UNIT.ft;
  5572. SuperMap.INCHES_PER_UNIT.inch = SuperMap.INCHES_PER_UNIT.inches;
  5573. SuperMap.INCHES_PER_UNIT.mile = SuperMap.INCHES_PER_UNIT.mi;
  5574. SuperMap.INCHES_PER_UNIT.kilometer = SuperMap.INCHES_PER_UNIT.km;
  5575. SuperMap.INCHES_PER_UNIT.yard = SuperMap.INCHES_PER_UNIT.yd;
  5576. /**
  5577. * @description 判断一个 URL 请求是否在当前域中。
  5578. * @param {string} url - URL 请求字符串。
  5579. * @returns {boolean} URL 请求是否在当前域中。
  5580. */
  5581. SuperMap.Util.isInTheSameDomain = function (url) {
  5582. if (!url) {
  5583. return true;
  5584. }
  5585. var index = url.indexOf("//");
  5586. var documentUrl = document.location.toString();
  5587. var documentIndex = documentUrl.indexOf("//");
  5588. if (index === -1) {
  5589. return true;
  5590. } else {
  5591. var protocol;
  5592. var substring = protocol = url.substring(0, index);
  5593. var documentSubString = documentUrl.substring(documentIndex + 2);
  5594. documentIndex = documentSubString.indexOf("/");
  5595. var documentPortIndex = documentSubString.indexOf(":");
  5596. var documentDomainWithPort = documentSubString.substring(0, documentIndex);
  5597. //var documentPort;
  5598. var documentprotocol = document.location.protocol;
  5599. if (documentPortIndex !== -1) {
  5600. // documentPort = +documentSubString.substring(documentPortIndex, documentIndex);
  5601. } else {
  5602. documentDomainWithPort += ':' + (documentprotocol.toLowerCase() === 'http:' ? 80 : 443);
  5603. }
  5604. if (documentprotocol.toLowerCase() !== substring.toLowerCase()) {
  5605. return false;
  5606. }
  5607. substring = url.substring(index + 2);
  5608. var portIndex = substring.indexOf(":");
  5609. index = substring.indexOf("/");
  5610. var domainWithPort = substring.substring(0, index);
  5611. var domain;
  5612. if (portIndex !== -1) {
  5613. domain = substring.substring(0, portIndex);
  5614. } else {
  5615. domain = substring.substring(0, index);
  5616. domainWithPort += ':' + (protocol.toLowerCase() === 'http:' ? 80 : 443);
  5617. }
  5618. var documentDomain = document.domain;
  5619. if (domain === documentDomain && domainWithPort === documentDomainWithPort) {
  5620. return true;
  5621. }
  5622. }
  5623. return false;
  5624. };
  5625. /**
  5626. * @description 计算 iServer 服务的 REST 图层的显示分辨率,需要从 iServer 的 REST 图层表述中获取 viewBounds、viewer、scale、coordUnit、datumAxis 五个参数,来进行计算。
  5627. * @param {SuperMap.Bounds} viewBounds - 地图的参照可视范围,即地图初始化时默认的地图显示范围。
  5628. * @param {SuperMap.Size} viewer - 地图初始化时默认的地图图片的尺寸。
  5629. * @param {number} scale - 地图初始化时默认的显示比例尺。
  5630. * @param {string} [coordUnit='degrees'] - 投影坐标系统的地图单位。
  5631. * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则系统默认为 WGS84 参考系的椭球体长半轴 6378137。
  5632. * @returns {number} 返回图层显示分辨率。
  5633. */
  5634. SuperMap.Util.calculateDpi = function (viewBounds, viewer, scale, coordUnit, datumAxis) {
  5635. //10000 是 0.1毫米与米的转换。DPI的计算公式:Viewer / DPI * 0.0254 * 10000 = ViewBounds * scale ,公式中的10000是为了提高计算结果的精度,以下出现的ratio皆为如此。
  5636. if (!viewBounds || !viewer || !scale) {
  5637. return;
  5638. }
  5639. var ratio = 10000,
  5640. rvbWidth = viewBounds.getWidth(),
  5641. rvbHeight = viewBounds.getHeight(),
  5642. rvWidth = viewer.w,
  5643. rvHeight = viewer.h;
  5644. //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
  5645. datumAxis = datumAxis || 6378137;
  5646. coordUnit = coordUnit || "degrees";
  5647. var dpi;
  5648. if (coordUnit.toLowerCase() === "degree" || coordUnit.toLowerCase() === "degrees" || coordUnit.toLowerCase() === "dd") {
  5649. let num1 = rvbWidth / rvWidth,
  5650. num2 = rvbHeight / rvHeight,
  5651. resolution = num1 > num2 ? num1 : num2;
  5652. dpi = 0.0254 * ratio / resolution / scale / ((Math.PI * 2 * datumAxis) / 360) / ratio;
  5653. } else {
  5654. let resolution = rvbWidth / rvWidth;
  5655. dpi = 0.0254 * ratio / resolution / scale / ratio;
  5656. }
  5657. return dpi;
  5658. };
  5659. /**
  5660. * @description 将对象转换成 JSON 字符串。
  5661. * @param {Object} obj - 要转换成 JSON 的 Object 对象。
  5662. * @returns {string} 返回转换后的 JSON 对象。
  5663. */
  5664. SuperMap.Util.toJSON = function (obj) {
  5665. var objInn = obj;
  5666. if (objInn == null) {
  5667. return null;
  5668. }
  5669. switch (objInn.constructor) {
  5670. case String:
  5671. //s = "'" + str.replace(/(["\\])/g, "\\$1") + "'"; string含有单引号出错
  5672. objInn = '"' + objInn.replace(/(["\\])/g, '\\$1') + '"';
  5673. objInn = objInn.replace(/\n/g, "\\n");
  5674. objInn = objInn.replace(/\r/g, "\\r");
  5675. objInn = objInn.replace("<", "&lt;");
  5676. objInn = objInn.replace(">", "&gt;");
  5677. objInn = objInn.replace(/%/g, "%25");
  5678. objInn = objInn.replace(/&/g, "%26");
  5679. return objInn;
  5680. case Array:
  5681. var arr = [];
  5682. for (var i = 0, len = objInn.length; i < len; i++) {
  5683. arr.push(SuperMap.Util.toJSON(objInn[i]));
  5684. }
  5685. return "[" + arr.join(",") + "]";
  5686. case Number:
  5687. return isFinite(objInn) ? String(objInn) : null;
  5688. case Boolean:
  5689. return String(objInn);
  5690. case Date:
  5691. var dateStr = "{" + "'__type':\"System.DateTime\"," +
  5692. "'Year':" + objInn.getFullYear() + "," +
  5693. "'Month':" + (objInn.getMonth() + 1) + "," +
  5694. "'Day':" + objInn.getDate() + "," +
  5695. "'Hour':" + objInn.getHours() + "," +
  5696. "'Minute':" + objInn.getMinutes() + "," +
  5697. "'Second':" + objInn.getSeconds() + "," +
  5698. "'Millisecond':" + objInn.getMilliseconds() + "," +
  5699. "'TimezoneOffset':" + objInn.getTimezoneOffset() + "}";
  5700. return dateStr;
  5701. default:
  5702. if (objInn["toJSON"] != null && typeof objInn["toJSON"] === "function") {
  5703. return objInn.toJSON();
  5704. }
  5705. if (typeof objInn === "object") {
  5706. if (objInn.length) {
  5707. let arr = [];
  5708. for (let i = 0, len = objInn.length; i < len; i++) {
  5709. arr.push(SuperMap.Util.toJSON(objInn[i]));
  5710. }
  5711. return "[" + arr.join(",") + "]";
  5712. }
  5713. let arr = [];
  5714. for (let attr in objInn) {
  5715. //为解决SuperMap.Geometry类型头json时堆栈溢出的问题,attr == "parent"时不进行json转换
  5716. if (typeof objInn[attr] !== "function" && attr !== "CLASS_NAME" && attr !== "parent") {
  5717. arr.push("'" + attr + "':" + SuperMap.Util.toJSON(objInn[attr]));
  5718. }
  5719. }
  5720. if (arr.length > 0) {
  5721. return "{" + arr.join(",") + "}";
  5722. } else {
  5723. return "{}";
  5724. }
  5725. }
  5726. return objInn.toString();
  5727. }
  5728. };
  5729. /**
  5730. * @description 根据比例尺和 dpi 计算屏幕分辨率。
  5731. * @param {number} scale - 比例尺。
  5732. * @param {number} dpi - 图像分辨率,表示每英寸内的像素个数。
  5733. * @param {string} [coordUnit] - 投影坐标系统的地图单位。
  5734. * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则 DPI 默认按照 WGS84 参考系的椭球体长半轴 6378137 来计算。
  5735. * @returns {number} 返回当前比例尺下的屏幕分辨率。
  5736. */
  5737. SuperMap.Util.getResolutionFromScaleDpi = function (scale, dpi, coordUnit, datumAxis) {
  5738. var resolution = null,
  5739. ratio = 10000;
  5740. //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
  5741. datumAxis = datumAxis || 6378137;
  5742. coordUnit = coordUnit || "";
  5743. if (scale > 0 && dpi > 0) {
  5744. scale = SuperMap.Util.normalizeScale(scale);
  5745. if (coordUnit.toLowerCase() === "degree" || coordUnit.toLowerCase() === "degrees" || coordUnit.toLowerCase() === "dd") {
  5746. //scale = SuperMap.Util.normalizeScale(scale);
  5747. resolution = 0.0254 * ratio / dpi / scale / ((Math.PI * 2 * datumAxis) / 360) / ratio;
  5748. return resolution;
  5749. } else {
  5750. resolution = 0.0254 * ratio / dpi / scale / ratio;
  5751. return resolution;
  5752. }
  5753. }
  5754. return -1;
  5755. };
  5756. /**
  5757. * @description 根据 resolution、dpi、coordUnit 和 datumAxis 计算比例尺。
  5758. * @param {number} resolution - 用于计算比例尺的地图分辨率。
  5759. * @param {number} dpi - 图像分辨率,表示每英寸内的像素个数。
  5760. * @param {string} [coordUnit] - 投影坐标系统的地图单位。
  5761. * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则 DPI 默认按照 WGS84 参考系的椭球体长半轴 6378137 来计算。
  5762. * @returns {number} 返回当前屏幕分辨率下的比例尺。
  5763. */
  5764. SuperMap.Util.getScaleFromResolutionDpi = function (resolution, dpi, coordUnit, datumAxis) {
  5765. var scale = null,
  5766. ratio = 10000;
  5767. //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
  5768. datumAxis = datumAxis || 6378137;
  5769. coordUnit = coordUnit || "";
  5770. if (resolution > 0 && dpi > 0) {
  5771. if (coordUnit.toLowerCase() === "degree" || coordUnit.toLowerCase() === "degrees" || coordUnit.toLowerCase() === "dd") {
  5772. scale = 0.0254 * ratio / dpi / resolution / ((Math.PI * 2 * datumAxis) / 360) / ratio;
  5773. return scale;
  5774. } else {
  5775. scale = 0.0254 * ratio / dpi / resolution / ratio;
  5776. return scale;
  5777. }
  5778. }
  5779. return -1;
  5780. };
  5781. /**
  5782. * @description 转换查询结果。
  5783. * @param {Object} result - 查询结果。
  5784. * @returns {Object} 转换后的查询结果。
  5785. */
  5786. SuperMap.Util.transformResult = function (result) {
  5787. if (result.responseText && typeof result.responseText === "string") {
  5788. result = JSON.parse(result.responseText);
  5789. }
  5790. return result;
  5791. };
  5792. /**
  5793. * @description 属性拷贝,不拷贝方法类名(CLASS_NAME)等。
  5794. * @param {Object} [destination] - 拷贝目标。
  5795. * @param {Object} source - 源对象。
  5796. *
  5797. */
  5798. SuperMap.Util.copyAttributes = function (destination, source) {
  5799. destination = destination || {};
  5800. if (source) {
  5801. for (var property in source) {
  5802. var value = source[property];
  5803. if (value !== undefined && property !== "CLASS_NAME" && typeof value !== "function") {
  5804. destination[property] = value;
  5805. }
  5806. }
  5807. }
  5808. return destination;
  5809. };
  5810. /**
  5811. * @description 将源对象上的属性拷贝到目标对象上。(不拷贝 CLASS_NAME 和方法)
  5812. * @param {Object} [destination] - 目标对象。
  5813. * @param {Object} source - 源对象。
  5814. * @param {Array.<string>} clip - 源对象中禁止拷贝到目标对象的属性,目的是防止目标对象上不可修改的属性被篡改。
  5815. *
  5816. */
  5817. SuperMap.Util.copyAttributesWithClip = function (destination, source, clip) {
  5818. destination = destination || {};
  5819. if (source) {
  5820. for (var property in source) {
  5821. //去掉禁止拷贝的属性
  5822. var isInClip = false;
  5823. if (clip && clip.length) {
  5824. for (var i = 0, len = clip.length; i < len; i++) {
  5825. if (property === clip[i]) {
  5826. isInClip = true;
  5827. break;
  5828. }
  5829. }
  5830. }
  5831. if (isInClip === true) {
  5832. continue;
  5833. }
  5834. var value = source[property];
  5835. if (value !== undefined && property !== "CLASS_NAME" && typeof value !== "function") {
  5836. destination[property] = value;
  5837. }
  5838. }
  5839. }
  5840. return destination;
  5841. };
  5842. /**
  5843. * @description 克隆一个 Object 对象
  5844. * @param {Object} obj - 需要克隆的对象。
  5845. * @returns {Object} 返回对象的拷贝对象,注意是新的对象,不是指向。
  5846. */
  5847. SuperMap.Util.cloneObject = function (obj) {
  5848. // Handle the 3 simple types, and null or undefined
  5849. if (null === obj || "object" !== typeof obj) {
  5850. return obj;
  5851. }
  5852. // Handle Date
  5853. if (obj instanceof Date) {
  5854. let copy = new Date();
  5855. copy.setTime(obj.getTime());
  5856. return copy;
  5857. }
  5858. // Handle Array
  5859. if (obj instanceof Array) {
  5860. let copy = obj.slice(0);
  5861. return copy;
  5862. }
  5863. // Handle Object
  5864. if (obj instanceof Object) {
  5865. let copy = {};
  5866. for (var attr in obj) {
  5867. if (obj.hasOwnProperty(attr)) {
  5868. copy[attr] = SuperMap.Util.cloneObject(obj[attr]);
  5869. }
  5870. }
  5871. return copy;
  5872. }
  5873. throw new Error("Unable to copy obj! Its type isn't supported.");
  5874. };
  5875. /**
  5876. * @description 判断两条线段是不是有交点。
  5877. * @param {SuperMap.Geometry.Point} a1 - 第一条线段的起始节点。
  5878. * @param {SuperMap.Geometry.Point} a2 - 第一条线段的结束节点。
  5879. * @param {SuperMap.Geometry.Point} b1 - 第二条线段的起始节点。
  5880. * @param {SuperMap.Geometry.Point} b2 - 第二条线段的结束节点。
  5881. * @returns {Object} 如果相交返回交点,如果不相交返回两条线段的位置关系。
  5882. */
  5883. SuperMap.Util.lineIntersection = function (a1, a2, b1, b2) {
  5884. var intersectValue = null;
  5885. var k1;
  5886. var k2;
  5887. var b = (b2.x - b1.x) * (a1.y - b1.y) - (b2.y - b1.y) * (a1.x - b1.x);
  5888. var a = (a2.x - a1.x) * (a1.y - b1.y) - (a2.y - a1.y) * (a1.x - b1.x);
  5889. var ab = (b2.y - b1.y) * (a2.x - a1.x) - (b2.x - b1.x) * (a2.y - a1.y);
  5890. //ab==0代表两条线断的斜率一样
  5891. if (ab != 0) {
  5892. k1 = b / ab;
  5893. k2 = a / ab;
  5894. if (k1 >= 0 && k2 <= 1 && k1 <= 1 && k2 >= 0) {
  5895. intersectValue = new SuperMap.Geometry.Point(a1.x + k1 * (a2.x - a1.x), a1.y + k1 * (a2.y - a1.y));
  5896. } else {
  5897. intersectValue = "No Intersection";
  5898. }
  5899. } else {
  5900. if (b == 0 && a == 0) {
  5901. var maxy = Math.max(a1.y, a2.y);
  5902. var miny = Math.min(a1.y, a2.y);
  5903. var maxx = Math.max(a1.x, a2.x);
  5904. var minx = Math.min(a1.x, a2.x);
  5905. if (((b1.y >= miny && b1.y <= maxy) || (b2.y >= miny && b2.y <= maxy)) &&
  5906. (b1.x >= minx && b1.x <= maxx) || (b2.x >= minx && b2.x <= maxx)) {
  5907. intersectValue = "Coincident";//重合
  5908. } else {
  5909. intersectValue = "Parallel";//平行
  5910. }
  5911. } else {
  5912. intersectValue = "Parallel";//平行
  5913. }
  5914. }
  5915. return intersectValue;
  5916. };
  5917. /**
  5918. * @description 获取文本外接矩形宽度与高度。
  5919. * @param {SuperMap.ThemeStyle} style - 文本样式。
  5920. * @param {string} text - 文本内容。
  5921. * @param {Object} element - DOM 元素。
  5922. * @returns {Object} 返回裁剪后的宽度,高度信息。
  5923. */
  5924. SuperMap.Util.getTextBounds = function (style, text, element) {
  5925. document.body.appendChild(element);
  5926. element.style.width = 'auto';
  5927. element.style.height = 'auto';
  5928. if (style.fontSize) {
  5929. element.style.fontSize = style.fontSize;
  5930. }
  5931. if (style.fontFamily) {
  5932. element.style.fontFamily = style.fontFamily;
  5933. }
  5934. if (style.fontWeight) {
  5935. element.style.fontWeight = style.fontWeight;
  5936. }
  5937. element.style.position = 'relative';
  5938. element.style.visibility = 'hidden';
  5939. //fix 在某些情况下,element内的文本变成竖起排列,导致宽度计算不正确的bug
  5940. element.style.display = 'inline-block';
  5941. element.innerHTML = text;
  5942. var textWidth = element.clientWidth;
  5943. var textHeight = element.clientHeight;
  5944. document.body.removeChild(element);
  5945. return {
  5946. textWidth: textWidth,
  5947. textHeight: textHeight
  5948. };
  5949. };
  5950. ;// CONCATENATED MODULE: ./src/common/commontypes/LonLat.js
  5951. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  5952. * This program are made available under the terms of the Apache License, Version 2.0
  5953. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  5954. /**
  5955. * @class SuperMap.LonLat
  5956. * @category BaseTypes Geometry
  5957. * @classdesc 这个类用来表示经度和纬度对。
  5958. * @param {number} [lon=0.0] - 地图单位上的 X 轴坐标,如果地图是地理投影,则此值是经度,否则,此值是地图地理位置的 x 坐标。
  5959. * @param {number} [lat=0.0] - 地图单位上的 Y 轴坐标,如果地图是地理投影,则此值是纬度,否则,此值是地图地理位置的 y 坐标。
  5960. * @param {Array.<float>} [location] - 如果要同时设置,则使用传入横纵坐标组成的数组。
  5961. * @example
  5962. * var lonLat = new SuperMap.LonLat(30,45);
  5963. */
  5964. class LonLat {
  5965. constructor(lon, lat) {
  5966. if (Util.isArray(lon)) {
  5967. lat = lon[1];
  5968. lon = lon[0];
  5969. }
  5970. /**
  5971. * @member {float} [SuperMap.LonLat.prototype.lon=0.0]
  5972. * @description 地图的单位的 X 轴(横轴)坐标。
  5973. */
  5974. this.lon = lon ? Util.toFloat(lon) : 0.0;
  5975. /**
  5976. * @member {float} [SuperMap.LonLat.prototype.lat=0.0]
  5977. * @description 地图的单位的 Y 轴(纵轴)坐标。
  5978. */
  5979. this.lat = lat ? Util.toFloat(lat) : 0.0;
  5980. this.CLASS_NAME = "SuperMap.LonLat";
  5981. }
  5982. /**
  5983. * @function SuperMap.LonLat.prototype.toString
  5984. * @description 返回此对象的字符串形式
  5985. * @example
  5986. * var lonLat = new SuperMap.LonLat(100,50);
  5987. * var str = lonLat.toString();
  5988. * @returns {string} 例如: "lon=100,lat=50"
  5989. */
  5990. toString() {
  5991. return ("lon=" + this.lon + ",lat=" + this.lat);
  5992. }
  5993. /**
  5994. * @function SuperMap.LonLat.prototype.toShortString
  5995. * @description 将经度纬度转换成简单字符串。
  5996. * @example
  5997. * var lonLat = new SuperMap.LonLat(100,50);
  5998. * var str = lonLat.toShortString();
  5999. * @returns {string} 返回处理后的经纬度字符串。例如:"100,50"
  6000. */
  6001. toShortString() {
  6002. return (this.lon + "," + this.lat);
  6003. }
  6004. /**
  6005. * @function SuperMap.LonLat.prototype.clone
  6006. * @description 复制坐标对象,并返回复制后的新对象。
  6007. * @example
  6008. * var lonLat1 = new SuperMap.LonLat(100,50);
  6009. * var lonLat2 = lonLat1.clone();
  6010. * @returns {SuperMap.LonLat} 返回相同坐标值的新的坐标对象。
  6011. */
  6012. clone() {
  6013. return new LonLat(this.lon, this.lat);
  6014. }
  6015. /**
  6016. * @function SuperMap.LonLat.prototype.add
  6017. * @description 在已有坐标对象的经纬度基础上加上新的坐标经纬度,并返回新的坐标对象。
  6018. * @example
  6019. * var lonLat1 = new SuperMap.LonLat(100,50);
  6020. * //lonLat2 是新的对象
  6021. * var lonLat2 = lonLat1.add(100,50);
  6022. * @param {float} lon - 传入的经度参数。
  6023. * @param {float} lat - 传入的纬度参数。
  6024. * @returns {SuperMap.LonLat} 返回一个新的 LonLat 对象,此对象的经纬度是由传入的经纬度与当前的经纬度相加所得。
  6025. */
  6026. add(lon, lat) {
  6027. if ((lon == null) || (lat == null)) {
  6028. throw new TypeError('LonLat.add cannot receive null values');
  6029. }
  6030. return new LonLat(this.lon + Util.toFloat(lon),
  6031. this.lat + Util.toFloat(lat));
  6032. }
  6033. /**
  6034. * @function SuperMap.LonLat.prototype.equals
  6035. * @description 判断两个坐标对象是否相等。
  6036. * @example
  6037. * var lonLat1 = new SuperMap.LonLat(100,50);
  6038. * var lonLat2 = new SuperMap.LonLat(100,50);
  6039. * var isEquals = lonLat1.equals(lonLat2);
  6040. * @param {SuperMap.LonLat} ll - 需要进行比较的坐标对象。
  6041. * @returns {boolean} 如果LonLat对象的经纬度和传入的经纬度一致则返回true,不一
  6042. * 致或传入的ll参数为NULL则返回false。
  6043. */
  6044. equals(ll) {
  6045. var equals = false;
  6046. if (ll != null) {
  6047. equals = ((this.lon === ll.lon && this.lat === ll.lat) ||
  6048. (isNaN(this.lon) && isNaN(this.lat) && isNaN(ll.lon) && isNaN(ll.lat)));
  6049. }
  6050. return equals;
  6051. }
  6052. /**
  6053. * @function SuperMap.LonLat.prototype.wrapDateLine
  6054. * @description 通过传入的范围对象对坐标对象转换到该范围内。
  6055. * 如果经度小于给定范围最小精度,则在原经度基础上加上范围宽度,直到精度在范围内为止,如果经度大于给定范围则在原经度基础上减去范围宽度。
  6056. * 即指将不在经度范围内的坐标转换到范围以内(只会转换 lon,不会转换 lat,主要用于转移到日界线以内)。
  6057. * @example
  6058. * var lonLat1 = new SuperMap.LonLat(420,50);
  6059. * var lonLat2 = lonLat1.wrapDateLine(
  6060. * new SuperMap.Bounds(-180,-90,180,90)
  6061. * );
  6062. * @param {SuperMap.Bounds} maxExtent - 最大边界的范围。
  6063. * @returns {SuperMap.LonLat} 将坐标转换到范围对象以内,并返回新的坐标。
  6064. */
  6065. wrapDateLine(maxExtent) {
  6066. var newLonLat = this.clone();
  6067. if (maxExtent) {
  6068. //shift right?
  6069. while (newLonLat.lon < maxExtent.left) {
  6070. newLonLat.lon += maxExtent.getWidth();
  6071. }
  6072. //shift left?
  6073. while (newLonLat.lon > maxExtent.right) {
  6074. newLonLat.lon -= maxExtent.getWidth();
  6075. }
  6076. }
  6077. return newLonLat;
  6078. }
  6079. /**
  6080. *
  6081. * @function SuperMap.LonLat.prototype.destroy
  6082. * @description 销毁此对象。
  6083. * 销毁后此对象的所有属性为 null,而不是初始值。
  6084. * @example
  6085. * var lonLat = new SuperMap.LonLat(100,50);
  6086. * lonLat.destroy();
  6087. */
  6088. destroy() {
  6089. this.lon = null;
  6090. this.lat = null;
  6091. }
  6092. /**
  6093. * @function SuperMap.LonLat.fromString
  6094. * @description 通过字符串生成一个 {@link SuperMap.LonLat} 对象。
  6095. * @example
  6096. * var str = "100,50";
  6097. * var lonLat = SuperMap.LonLat.fromString(str);
  6098. * @param {string} str - 字符串的格式:Lon+","+Lat。如:"100,50"。
  6099. * @returns {SuperMap.LonLat} 返回一个 {@link SuperMap.LonLat} 对象。
  6100. */
  6101. static fromString(str) {
  6102. var pair = str.split(",");
  6103. return new LonLat(pair[0], pair[1]);
  6104. }
  6105. /**
  6106. * @function SuperMap.LonLat.fromArray
  6107. * @description 通过数组生成一个 <SuperMap.LonLat> 对象。
  6108. * @param {Array.<float>} arr - 数组的格式,长度只能为2,:[Lon,Lat]。如:[5,-42]。
  6109. * @returns {SuperMap.LonLat} 返回一个 <SuperMap.LonLat> 对象。
  6110. */
  6111. static fromArray(arr) {
  6112. var gotArr = Util.isArray(arr),
  6113. lon = gotArr && arr[0],
  6114. lat = gotArr && arr[1];
  6115. return new LonLat(lon, lat);
  6116. }
  6117. }
  6118. ;// CONCATENATED MODULE: ./src/common/commontypes/Bounds.js
  6119. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  6120. * This program are made available under the terms of the Apache License, Version 2.0
  6121. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6122. /**
  6123. * @class SuperMap.Bounds
  6124. * @category BaseTypes Geometry
  6125. * @classdesc 表示边界类实例。使用 bounds 之前需要设置 left,bottom,right,top 四个属性,这些属性的初始值为 null。
  6126. * @param {number} [left] - 左边界,注意考虑宽度,理论上小于 right 值。
  6127. * @param {number} [bottom] - 下边界。考虑高度,理论上小于 top 值。
  6128. * @param {number} [right] - 右边界。
  6129. * @param {number} [top] - 上边界。
  6130. * @param {Array.<number>} [array] - [left, bottom, right, top],如果同时传多个参数,则使用左下右上组成的数组。
  6131. * @example
  6132. * var bounds = new SuperMap.Bounds();
  6133. * bounds.extend(new SuperMap.LonLat(4,5));
  6134. * bounds.extend(new SuperMap.LonLat(5,6));
  6135. * bounds.toBBOX(); // returns 4,5,5,6
  6136. */
  6137. class Bounds {
  6138. constructor(left, bottom, right, top) {
  6139. if (Util.isArray(left)) {
  6140. top = left[3];
  6141. right = left[2];
  6142. bottom = left[1];
  6143. left = left[0];
  6144. }
  6145. /**
  6146. * @member {number} SuperMap.Bounds.prototype.left
  6147. * @description 最小的水平坐标系。
  6148. */
  6149. this.left = left != null ? Util.toFloat(left) : this.left;
  6150. /**
  6151. * @member {number} SuperMap.Bounds.prototype.bottom
  6152. * @description 最小的垂直坐标系。
  6153. */
  6154. this.bottom = bottom != null ? Util.toFloat(bottom) : this.bottom;
  6155. /**
  6156. * @member {number} SuperMap.Bounds.prototype.right
  6157. * @description 最大的水平坐标系。
  6158. */
  6159. this.right = right != null ? Util.toFloat(right) : this.right;
  6160. /**
  6161. * @member {number} SuperMap.Bounds.prototype.top
  6162. * @description 最大的垂直坐标系。
  6163. */
  6164. this.top = top != null ? Util.toFloat(top) : this.top;
  6165. /**
  6166. * @member {SuperMap.LonLat} SuperMap.Bounds.prototype.centerLonLat
  6167. * @description bounds 的地图空间的中心点。用 getCenterLonLat() 获得。
  6168. */
  6169. this.centerLonLat = null;
  6170. this.CLASS_NAME = "SuperMap.Bounds";
  6171. }
  6172. /**
  6173. * @function SuperMap.Bounds.prototype.clone
  6174. * @description 复制当前 bounds 对象。
  6175. * @example
  6176. * var bounds1 = new SuperMap.Bounds(-180,-90,180,90);
  6177. * var bounds2 = bounds1.clone();
  6178. * @returns {SuperMap.Bounds} 返回一个克隆的 bounds。
  6179. */
  6180. clone() {
  6181. return new Bounds(this.left, this.bottom,
  6182. this.right, this.top);
  6183. }
  6184. /**
  6185. * @function SuperMap.Bounds.prototype.equals
  6186. * @description 判断两个 bounds 对象是否相等。
  6187. * @example
  6188. * var bounds1 = new SuperMap.Bounds(-180,-90,180,90);
  6189. * var bounds2 = new SuperMap.Bounds(-180,-90,180,90);
  6190. * var isEquals = bounds1.equals(bounds2);
  6191. * @param {SuperMap.Bounds} bounds - 需要进行计较的 bounds。
  6192. * @returns {boolean} 如果 bounds 对象的边和传入的 bounds 一致则返回 true,不一致或传入的 bounds 参数为 NULL 则返回 false。
  6193. */
  6194. equals(bounds) {
  6195. var equals = false;
  6196. if (bounds != null) {
  6197. equals = ((this.left === bounds.left) &&
  6198. (this.right === bounds.right) &&
  6199. (this.top === bounds.top) &&
  6200. (this.bottom === bounds.bottom));
  6201. }
  6202. return equals;
  6203. }
  6204. /**
  6205. * @function SuperMap.Bounds.prototype.toString
  6206. * @description 返回此对象的字符串形式。
  6207. * @example
  6208. * var bounds = new SuperMap.Bounds(-180,-90,180,90);
  6209. * var str = bounds.toString();
  6210. * @returns {string} 边界对象的字符串表示形式(left,bottom,right,top),例如: "-180,-90,180,90"。
  6211. */
  6212. toString() {
  6213. return [this.left, this.bottom, this.right, this.top].join(",");
  6214. }
  6215. /**
  6216. * @function SuperMap.Bounds.prototype.toArray
  6217. * @description 边界对象的数组表示形式。
  6218. * @example
  6219. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  6220. * //array1 = [-180,-90,100,80];
  6221. * var array1 = bounds.toArray();
  6222. * //array1 = [-90,-180,80,100];
  6223. * var array2 = bounds.toArray(true);
  6224. * @param {boolean} [reverseAxisOrder=false] - 是否反转轴顺序。
  6225. * 如果设为 true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
  6226. * @returns {Array.<number>} left, bottom, right, top 数组。
  6227. */
  6228. toArray(reverseAxisOrder) {
  6229. if (reverseAxisOrder === true) {
  6230. return [this.bottom, this.left, this.top, this.right];
  6231. } else {
  6232. return [this.left, this.bottom, this.right, this.top];
  6233. }
  6234. }
  6235. /**
  6236. * @function SuperMap.Bounds.prototype.toBBOX
  6237. * @description 取小数点后 decimal 位数字进行四舍五入再转换为 BBOX 字符串。
  6238. * @example
  6239. * var bounds = new SuperMap.Bounds(-1.1234567,-1.7654321,1.4444444,1.5555555);
  6240. * //str1 = "-1.123457,-1.765432,1.444444,1.555556";
  6241. * var str1 = bounds.toBBOX();
  6242. * //str2 = "-1.1,-1.8,1.4,1.6";
  6243. * var str2 = bounds.toBBOX(1);
  6244. * //str2 = "-1.8,-1.1,1.6,1.4";
  6245. * var str2 = bounds.toBBOX(1,true);
  6246. * @param {integer} [decimal=6] - 边界方位坐标的有效数字个数。
  6247. * @param {boolean} [reverseAxisOrder=false] - 是否是反转轴顺序。
  6248. * 如果设为true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
  6249. * @returns {string} 边界对象的字符串表示形式,如:"5,42,10,45"。
  6250. */
  6251. toBBOX(decimal, reverseAxisOrder) {
  6252. if (decimal == null) {
  6253. decimal = 6;
  6254. }
  6255. var mult = Math.pow(10, decimal);
  6256. var xmin = Math.round(this.left * mult) / mult;
  6257. var ymin = Math.round(this.bottom * mult) / mult;
  6258. var xmax = Math.round(this.right * mult) / mult;
  6259. var ymax = Math.round(this.top * mult) / mult;
  6260. if (reverseAxisOrder === true) {
  6261. return ymin + "," + xmin + "," + ymax + "," + xmax;
  6262. } else {
  6263. return xmin + "," + ymin + "," + xmax + "," + ymax;
  6264. }
  6265. }
  6266. /**
  6267. * @function SuperMap.Bounds.prototype.toGeometry
  6268. * @description 基于当前边界范围创建一个新的多边形对象。
  6269. * @example
  6270. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  6271. * //SuperMap.Geometry.Polygon对象
  6272. * var geo = bounds.toGeometry();
  6273. * @returns {SuperMap.Geometry.Polygon} 基于当前 bounds 坐标创建的新的多边形。
  6274. */
  6275. // toGeometry() {
  6276. // return new Polygon([
  6277. // new LinearRing([
  6278. // new Point(this.left, this.bottom),
  6279. // new Point(this.right, this.bottom),
  6280. // new Point(this.right, this.top),
  6281. // new Point(this.left, this.top)
  6282. // ])
  6283. // ]);
  6284. // }
  6285. /**
  6286. * @function SuperMap.Bounds.prototype.getWidth
  6287. * @description 获取 bounds 的宽度。
  6288. * @example
  6289. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  6290. * //width = 280;
  6291. * var width = bounds.getWidth();
  6292. * @returns {float} 获取当前 bounds 的宽度(right 减去 left)。
  6293. */
  6294. getWidth() {
  6295. return (this.right - this.left);
  6296. }
  6297. /**
  6298. * @function SuperMap.Bounds.prototype.getHeight
  6299. * @description 获取 bounds 的高度。
  6300. * @example
  6301. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  6302. * //height = 170;
  6303. * var height = bounds.getHeight();
  6304. * @returns {float} 返回边界高度(top 减去 bottom)。
  6305. */
  6306. getHeight() {
  6307. return (this.top - this.bottom);
  6308. }
  6309. /**
  6310. * @function SuperMap.Bounds.prototype.getSize
  6311. * @description 获取边框大小。
  6312. * @example
  6313. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  6314. * var size = bounds.getSize();
  6315. * @returns {SuperMap.Size} 返回边框大小。
  6316. */
  6317. getSize() {
  6318. return new Size(this.getWidth(), this.getHeight());
  6319. }
  6320. /**
  6321. * @function SuperMap.Bounds.prototype.getCenterPixel
  6322. * @description 获取像素格式的范围中心点。
  6323. * @example
  6324. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  6325. * var pixel = bounds.getCenterPixel();
  6326. * @returns {SuperMap.Pixel} 返回像素格式的当前范围的中心点。
  6327. */
  6328. getCenterPixel() {
  6329. return new Pixel((this.left + this.right) / 2,
  6330. (this.bottom + this.top) / 2);
  6331. }
  6332. /**
  6333. * @function SuperMap.Bounds.prototype.getCenterLonLat
  6334. * @description 获取地理格式的范围中心点。
  6335. * @example
  6336. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  6337. * var lonlat = bounds.getCenterLonLat();
  6338. * @returns {SuperMap.LonLat} 返回当前地理范围的中心点。
  6339. */
  6340. getCenterLonLat() {
  6341. if (!this.centerLonLat) {
  6342. this.centerLonLat = new LonLat(
  6343. (this.left + this.right) / 2, (this.bottom + this.top) / 2
  6344. );
  6345. }
  6346. return this.centerLonLat;
  6347. }
  6348. /**
  6349. * @function SuperMap.Bounds.prototype.scale
  6350. * @description 按照比例扩大/缩小出一个新的 bounds。
  6351. * @example
  6352. * var bounds = new SuperMap.Bounds(-50,-50,40,40);
  6353. * var bounds2 = bounds.scale(2);
  6354. * @param {float} [ratio=1] - 需要扩大的比例。
  6355. * @param {(SuperMap.Pixel|SuperMap.LonLat)} [origin] - 扩大时的基准点,默认为当前 bounds 的中心点。
  6356. * @returns {SuperMap.Bounds} 返回通过 ratio、origin 计算得到的新的边界范围。
  6357. */
  6358. scale(ratio, origin) {
  6359. ratio = ratio ? ratio : 1;
  6360. if (origin == null) {
  6361. origin = this.getCenterLonLat();
  6362. }
  6363. var origx, origy;
  6364. // get origin coordinates
  6365. if (origin.CLASS_NAME === "SuperMap.LonLat") {
  6366. origx = origin.lon;
  6367. origy = origin.lat;
  6368. } else {
  6369. origx = origin.x;
  6370. origy = origin.y;
  6371. }
  6372. var left = (this.left - origx) * ratio + origx;
  6373. var bottom = (this.bottom - origy) * ratio + origy;
  6374. var right = (this.right - origx) * ratio + origx;
  6375. var top = (this.top - origy) * ratio + origy;
  6376. return new Bounds(left, bottom, right, top);
  6377. }
  6378. /**
  6379. * @function SuperMap.Bounds.prototype.add
  6380. * @description 在当前的 Bounds 上按照传入的坐标点进行平移,返回新的范围。
  6381. * @example
  6382. * var bounds1 = new SuperMap.Bounds(-50,-50,40,40);
  6383. * //bounds2 是新的 bounds
  6384. * var bounds2 = bounds.add(20,10);
  6385. * @param {float} x - 传入坐标点的 x 坐标。
  6386. * @param {float} y - 传入坐标点的 y 坐标。
  6387. * @returns {SuperMap.Bounds} 返回一个新的 bounds,此 bounds 的坐标是由传入的 x,y 参数与当前 bounds 坐标计算所得。
  6388. */
  6389. add(x, y) {
  6390. if ((x == null) || (y == null)) {
  6391. throw new TypeError('Bounds.add cannot receive null values');
  6392. }
  6393. return new Bounds(this.left + x, this.bottom + y,
  6394. this.right + x, this.top + y);
  6395. }
  6396. /**
  6397. * @function SuperMap.Bounds.prototype.extend
  6398. * @description 在当前 bounds 上扩展 bounds,支持 point,lanlat 和 bounds。扩展后的 bounds 的范围是两者的结合。
  6399. * @example
  6400. * var bounds1 = new SuperMap.Bounds(-50,-50,40,40);
  6401. * //bounds 改变
  6402. * bounds.extend(new SuperMap.LonLat(50,60));
  6403. * @param {(SuperMap.Geometry.Point|SuperMap.LonLat|SuperMap.Bounds)} object - 可以是 point、lonlat 和 bounds。
  6404. */
  6405. extend(object) {
  6406. var bounds = null;
  6407. if (object) {
  6408. // clear cached center location
  6409. switch (object.CLASS_NAME) {
  6410. case "SuperMap.LonLat":
  6411. bounds = new Bounds(object.lon, object.lat,
  6412. object.lon, object.lat);
  6413. break;
  6414. case "SuperMap.Geometry.Point":
  6415. bounds = new Bounds(object.x, object.y,
  6416. object.x, object.y);
  6417. break;
  6418. case "SuperMap.Bounds":
  6419. bounds = object;
  6420. break;
  6421. }
  6422. if (bounds) {
  6423. this.centerLonLat = null;
  6424. if ((this.left == null) || (bounds.left < this.left)) {
  6425. this.left = bounds.left;
  6426. }
  6427. if ((this.bottom == null) || (bounds.bottom < this.bottom)) {
  6428. this.bottom = bounds.bottom;
  6429. }
  6430. if ((this.right == null) || (bounds.right > this.right)) {
  6431. this.right = bounds.right;
  6432. }
  6433. if ((this.top == null) || (bounds.top > this.top)) {
  6434. this.top = bounds.top;
  6435. }
  6436. }
  6437. }
  6438. }
  6439. /**
  6440. * @function SuperMap.Bounds.prototype.containsLonLat
  6441. * @description 判断传入的坐标是否在范围内。
  6442. * @example
  6443. * var bounds1 = new SuperMap.Bounds(-50,-50,40,40);
  6444. * //isContains1 = true
  6445. * //这里的第二个参数可以直接为 boolean 类型,也就是inclusive
  6446. * var isContains1 = bounds.containsLonLat(new SuperMap.LonLat(40,40),true);
  6447. *
  6448. * //(40,40)在范围内,同样(40+360,40)也在范围内
  6449. * var bounds2 = new SuperMap.Bounds(-50,-50,40,40);
  6450. * //isContains2 = true;
  6451. * var isContains2 = bounds2.containsLonLat(
  6452. * new SuperMap.LonLat(400,40),
  6453. * {
  6454. * inclusive:true,
  6455. * //全球的范围
  6456. * worldBounds: new SuperMap.Bounds(-180,-90,180,90)
  6457. * }
  6458. * );
  6459. * @param {(SuperMap.LonLat|Object)} ll - <SuperMap.LonLat> 对象或者是一个包含 'lon' 与 'lat' 属性的对象。
  6460. * @param {Object} options - 可选参数。
  6461. * @param {boolean} [options.inclusive=true] - 是否包含边界。
  6462. * @param {SuperMap.Bounds} [options.worldBounds] - 如果提供 worldBounds 参数, 如果 ll 参数提供的坐标超出了世界边界(worldBounds),
  6463. * 但是通过日界线的转化可以被包含, 它将被认为是包含在该范围内的。
  6464. * @returns {boolean} 传入坐标是否包含在范围内。
  6465. */
  6466. containsLonLat(ll, options) {
  6467. if (typeof options === "boolean") {
  6468. options = {inclusive: options};
  6469. }
  6470. options = options || {};
  6471. var contains = this.contains(ll.lon, ll.lat, options.inclusive),
  6472. worldBounds = options.worldBounds;
  6473. //日界线以外的也有可能算包含,
  6474. if (worldBounds && !contains) {
  6475. var worldWidth = worldBounds.getWidth();
  6476. var worldCenterX = (worldBounds.left + worldBounds.right) / 2;
  6477. //这一步很关键
  6478. var worldsAway = Math.round((ll.lon - worldCenterX) / worldWidth);
  6479. contains = this.containsLonLat({
  6480. lon: ll.lon - worldsAway * worldWidth,
  6481. lat: ll.lat
  6482. }, {inclusive: options.inclusive});
  6483. }
  6484. return contains;
  6485. }
  6486. /**
  6487. * @function SuperMap.Bounds.prototype.containsPixel
  6488. * @description 判断传入的像素是否在范围内。直接匹配大小,不涉及像素和地理转换。
  6489. * @example
  6490. * var bounds = new SuperMap.Bounds(-50,-50,40,40);
  6491. * //isContains = true
  6492. * var isContains = bounds.containsPixel(new SuperMap.Pixel(40,40),true);
  6493. * @param {SuperMap.Pixel} px - 提供的像素参数。
  6494. * @param {boolean} [inclusive=true] - 是否包含边界。
  6495. * @returns {boolean} 传入的 pixel 在当前边界范围之内。
  6496. */
  6497. containsPixel(px, inclusive) {
  6498. return this.contains(px.x, px.y, inclusive);
  6499. }
  6500. /**
  6501. * @function SuperMap.Bounds.prototype.contains
  6502. * @description 判断传入的 x,y 坐标值是否在范围内。
  6503. * @example
  6504. * var bounds = new SuperMap.Bounds(-50,-50,40,40);
  6505. * //isContains = true
  6506. * var isContains = bounds.contains(40,40,true);
  6507. * @param {float} x - 传入的 x 坐标值。
  6508. * @param {float} y - 传入的 y 坐标值。
  6509. * @param {boolean} [inclusive=true] - 是否包含边界。
  6510. * @returns {boolean} 传入的 x,y 坐标是否在当前范围内。
  6511. */
  6512. contains(x, y, inclusive) {
  6513. //set default
  6514. if (inclusive == null) {
  6515. inclusive = true;
  6516. }
  6517. if (x == null || y == null) {
  6518. return false;
  6519. }
  6520. //x = Util.toFloat(x);
  6521. //y = Util.toFloat(y);
  6522. var contains = false;
  6523. if (inclusive) {
  6524. contains = ((x >= this.left) && (x <= this.right) &&
  6525. (y >= this.bottom) && (y <= this.top));
  6526. } else {
  6527. contains = ((x > this.left) && (x < this.right) &&
  6528. (y > this.bottom) && (y < this.top));
  6529. }
  6530. return contains;
  6531. }
  6532. /**
  6533. * @function SuperMap.Bounds.prototype.intersectsBounds
  6534. * @description 判断目标边界范围是否与当前边界范围相交。如果两个边界范围中的任意
  6535. * 边缘相交或者一个边界包含了另外一个就认为这两个边界相交。
  6536. * @example
  6537. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  6538. * var isIntersects = bounds.intersectsBounds(
  6539. * new SuperMap.Bounds(-170,-90,120,80)
  6540. * );
  6541. * @param {SuperMap.Bounds} bounds - 目标边界。
  6542. * @param {Object} options - 参数。
  6543. * @param {boolean} [options.inclusive=true] - 边缘重合也看成相交。如果是false,
  6544. * 两个边界范围没有重叠部分仅仅是在边缘相接(重合),
  6545. * 这种情况被认为没有相交。
  6546. * @param {SuperMap.Bounds} [options.worldBounds] - 提供了 worldBounds 参数, 如果他们相交时
  6547. * 是在全球范围内, 两个边界将被视为相交。这仅适用于交叉或完全不在世界范围的边界。
  6548. * @returns {boolean} 传入的 bounds 对象与当前 bounds 相交。
  6549. */
  6550. intersectsBounds(bounds, options) {
  6551. if (typeof options === "boolean") {
  6552. options = {inclusive: options};
  6553. }
  6554. options = options || {};
  6555. if (options.worldBounds) {
  6556. var self = this.wrapDateLine(options.worldBounds);
  6557. bounds = bounds.wrapDateLine(options.worldBounds);
  6558. } else {
  6559. self = this;
  6560. }
  6561. if (options.inclusive == null) {
  6562. options.inclusive = true;
  6563. }
  6564. var intersects = false;
  6565. var mightTouch = (
  6566. self.left === bounds.right ||
  6567. self.right === bounds.left ||
  6568. self.top === bounds.bottom ||
  6569. self.bottom === bounds.top
  6570. );
  6571. // if the two bounds only touch at an edge, and inclusive is false,
  6572. // then the bounds don't *really* intersect.
  6573. if (options.inclusive || !mightTouch) {
  6574. // otherwise, if one of the boundaries even partially contains another,
  6575. // inclusive of the edges, then they do intersect.
  6576. var inBottom = (
  6577. ((bounds.bottom >= self.bottom) && (bounds.bottom <= self.top)) ||
  6578. ((self.bottom >= bounds.bottom) && (self.bottom <= bounds.top))
  6579. );
  6580. var inTop = (
  6581. ((bounds.top >= self.bottom) && (bounds.top <= self.top)) ||
  6582. ((self.top > bounds.bottom) && (self.top < bounds.top))
  6583. );
  6584. var inLeft = (
  6585. ((bounds.left >= self.left) && (bounds.left <= self.right)) ||
  6586. ((self.left >= bounds.left) && (self.left <= bounds.right))
  6587. );
  6588. var inRight = (
  6589. ((bounds.right >= self.left) && (bounds.right <= self.right)) ||
  6590. ((self.right >= bounds.left) && (self.right <= bounds.right))
  6591. );
  6592. intersects = ((inBottom || inTop) && (inLeft || inRight));
  6593. }
  6594. // document me
  6595. if (options.worldBounds && !intersects) {
  6596. var world = options.worldBounds;
  6597. var width = world.getWidth();
  6598. var selfCrosses = !world.containsBounds(self);
  6599. var boundsCrosses = !world.containsBounds(bounds);
  6600. if (selfCrosses && !boundsCrosses) {
  6601. bounds = bounds.add(-width, 0);
  6602. intersects = self.intersectsBounds(bounds, {inclusive: options.inclusive});
  6603. } else if (boundsCrosses && !selfCrosses) {
  6604. self = self.add(-width, 0);
  6605. intersects = bounds.intersectsBounds(self, {inclusive: options.inclusive});
  6606. }
  6607. }
  6608. return intersects;
  6609. }
  6610. /**
  6611. * @function SuperMap.Bounds.prototype.containsBounds
  6612. * @description 判断目标边界是否被当前边界包含在内。
  6613. * @example
  6614. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  6615. * var isContains = bounds.containsBounds(
  6616. * new SuperMap.Bounds(-170,-90,100,80),true,true
  6617. * );
  6618. * @param {SuperMap.Bounds} bounds - 目标边界。
  6619. * @param {boolean} [partial=false] - 目标边界的任意部分都包含在当前边界中则被认为是包含关系。
  6620. * 如果设为 false,整个目标边界全部被包含在当前边界范围内。
  6621. * @param {boolean} [inclusive=true] - 边缘共享被视为包含。
  6622. * @returns {boolean} 传入的边界被当前边界包含。
  6623. */
  6624. containsBounds(bounds, partial, inclusive) {
  6625. if (partial == null) {
  6626. partial = false;
  6627. }
  6628. if (inclusive == null) {
  6629. inclusive = true;
  6630. }
  6631. var bottomLeft = this.contains(bounds.left, bounds.bottom, inclusive);
  6632. var bottomRight = this.contains(bounds.right, bounds.bottom, inclusive);
  6633. var topLeft = this.contains(bounds.left, bounds.top, inclusive);
  6634. var topRight = this.contains(bounds.right, bounds.top, inclusive);
  6635. return (partial) ? (bottomLeft || bottomRight || topLeft || topRight)
  6636. : (bottomLeft && bottomRight && topLeft && topRight);
  6637. }
  6638. /**
  6639. * @function SuperMap.Bounds.prototype.determineQuadrant
  6640. * @description 判断传入坐标是否在 bounds 范围内的象限。以 bounds 中心点为坐标原点。
  6641. * @example
  6642. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  6643. * //str = "tr";
  6644. * var str = bounds.determineQuadrant(
  6645. * new SuperMap.LonLat(20,20)
  6646. * );
  6647. * @param {SuperMap.LonLat} lonlat - 传入的坐标对象。
  6648. * @returns {string} 传入坐标所在的象限("br" "tr" "tl" "bl" 分别对应"右下","右上","左上" "左下")。
  6649. */
  6650. determineQuadrant(lonlat) {
  6651. var quadrant = "";
  6652. var center = this.getCenterLonLat();
  6653. quadrant += (lonlat.lat < center.lat) ? "b" : "t";
  6654. quadrant += (lonlat.lon < center.lon) ? "l" : "r";
  6655. return quadrant;
  6656. }
  6657. /**
  6658. * @function SuperMap.Bounds.prototype.wrapDateLine
  6659. * @description 将当前 bounds 移动到最大边界范围内部(所谓的内部是相交或者内部)。
  6660. * @example
  6661. * var bounds = new SuperMap.Bounds(380,-40,400,-20);
  6662. * var maxExtent = new SuperMap.Bounds(-180,-90,100,80);
  6663. * //新的bounds
  6664. * var newBounds = bounds.wrapDateLine(maxExtent);
  6665. * @param {SuperMap.Bounds} maxExtent - 最大的边界范围(一般是全球范围)。
  6666. * @param {Object} options - 可选选项参数。
  6667. * @param {float} [options.leftTolerance=0] - left 允许的误差。
  6668. * @param {float} [options.rightTolerance=0] - right 允许的误差。
  6669. * @returns {SuperMap.Bounds} 克隆当前边界。如果当前边界完全在最大范围之外此函数则返回一个不同值的边界,
  6670. * 若落在最大边界的左边,则给当前的bounds值加上最大范围的宽度,即向右移动,
  6671. * 若落在右边,则向左移动,即给当前的bounds值加上负的最大范围的宽度。
  6672. */
  6673. wrapDateLine(maxExtent, options) {
  6674. options = options || {};
  6675. var leftTolerance = options.leftTolerance || 0;
  6676. var rightTolerance = options.rightTolerance || 0;
  6677. var newBounds = this.clone();
  6678. if (maxExtent) {
  6679. var width = maxExtent.getWidth();
  6680. //如果 newBounds 在 maxExtent 的左边,那么一直向右移动,直到相交或者包含为止,每次移动width
  6681. //shift right?
  6682. while (newBounds.left < maxExtent.left &&
  6683. newBounds.right - rightTolerance <= maxExtent.left) {
  6684. newBounds = newBounds.add(width, 0);
  6685. }
  6686. //如果 newBounds 在 maxExtent 的右边,那么一直向左移动,直到相交或者包含为止,每次移动width
  6687. //shift left?
  6688. while (newBounds.left + leftTolerance >= maxExtent.right &&
  6689. newBounds.right > maxExtent.right) {
  6690. newBounds = newBounds.add(-width, 0);
  6691. }
  6692. //如果和右边相交,左边又在内部,那么再次向左边移动一次
  6693. // crosses right only? force left
  6694. var newLeft = newBounds.left + leftTolerance;
  6695. if (newLeft < maxExtent.right && newLeft > maxExtent.left &&
  6696. newBounds.right - rightTolerance > maxExtent.right) {
  6697. newBounds = newBounds.add(-width, 0);
  6698. }
  6699. }
  6700. return newBounds;
  6701. }
  6702. /**
  6703. * @function SuperMap.Bounds.prototype.toServerJSONObject
  6704. * @description 转换成对应的 JSON 格式对象。
  6705. * @example
  6706. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  6707. * var obj = bounds.toServerJSONObject();
  6708. * @returns {Object} 返回 JSON 格式的 Object 对象。
  6709. */
  6710. toServerJSONObject() {
  6711. var jsonObject = {
  6712. rightTop: {x: this.right, y: this.top},
  6713. leftBottom: {x: this.left, y: this.bottom},
  6714. left: this.left,
  6715. right: this.right,
  6716. top: this.top,
  6717. bottom: this.bottom
  6718. }
  6719. return jsonObject;
  6720. }
  6721. /**
  6722. *
  6723. * @function SuperMap.Bounds.prototype.destroy
  6724. * @description 销毁此对象。
  6725. * 销毁后此对象的所有属性为 null,而不是初始值。
  6726. * @example
  6727. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  6728. * bounds.destroy();
  6729. */
  6730. destroy() {
  6731. this.left = null;
  6732. this.right = null;
  6733. this.top = null;
  6734. this.bottom = null;
  6735. this.centerLonLat = null;
  6736. }
  6737. /**
  6738. * @function SuperMap.Bounds.fromString
  6739. * @description 通过字符串参数创建新的 bounds 的构造函数。
  6740. * @example
  6741. * var bounds = SuperMap.Bounds.fromString("-180,-90,100,80");
  6742. * @param {string} str - 边界字符串,用逗号隔开(e.g. <i>"5,42,10,45"</i>)。
  6743. * @param {boolean} [reverseAxisOrder=false] - 是否反转轴顺序。
  6744. * 如果设为true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
  6745. * @returns {SuperMap.Bounds} 返回给定的字符串创建的新的边界对象。
  6746. */
  6747. static fromString(str, reverseAxisOrder) {
  6748. var bounds = str.split(",");
  6749. return Bounds.fromArray(bounds, reverseAxisOrder);
  6750. }
  6751. /**
  6752. * @function SuperMap.Bounds.fromArray
  6753. * @description 通过边界框数组创建 Bounds。
  6754. * @example
  6755. * var bounds = SuperMap.Bounds.fromArray([-180,-90,100,80]);
  6756. * @param {Array.<float>} bbox - 边界值数组。(e.g. <i>[5,42,10,45]</i>)。
  6757. * @param {boolean} [reverseAxisOrder=false] - 是否是反转轴顺序。如果设为true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
  6758. * @returns {SuperMap.Bounds} 返回根据传入的数组创建的新的边界对象。
  6759. */
  6760. static fromArray(bbox, reverseAxisOrder) {
  6761. return reverseAxisOrder === true ?
  6762. new Bounds(bbox[1], bbox[0], bbox[3], bbox[2]) :
  6763. new Bounds(bbox[0], bbox[1], bbox[2], bbox[3]);
  6764. }
  6765. /**
  6766. * @function SuperMap.Bounds.fromSize
  6767. * @description 通过传入的边界大小来创建新的边界。
  6768. * @example
  6769. * var bounds = SuperMap.Bounds.fromSize(new SuperMap.Size(20,10));
  6770. * @param {SuperMap.Size} size - 传入的边界大小。
  6771. * @returns {SuperMap.Bounds} 返回根据传入的边界大小的创建新的边界。
  6772. */
  6773. static fromSize(size) {
  6774. return new Bounds(0,
  6775. size.h,
  6776. size.w,
  6777. 0);
  6778. }
  6779. /**
  6780. * @function SuperMap.Bounds.oppositeQuadrant
  6781. * @description 反转象限。"t"和"b" 交换,"r"和"l"交换, 如:"tl"变为"br"。
  6782. * @param {string} quadrant - 代表象限的字符串,如:"tl"。
  6783. * @returns {string} 反转后的象限。
  6784. */
  6785. static oppositeQuadrant(quadrant) {
  6786. var opp = "";
  6787. opp += (quadrant.charAt(0) === 't') ? 'b' : 't';
  6788. opp += (quadrant.charAt(1) === 'l') ? 'r' : 'l';
  6789. return opp;
  6790. }
  6791. }
  6792. SuperMap.Bounds = Bounds;
  6793. ;// CONCATENATED MODULE: ./src/common/commontypes/Geometry.js
  6794. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  6795. * This program are made available under the terms of the Apache License, Version 2.0
  6796. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6797. // import {WKT} from '../format/WKT';
  6798. // import {Vector} from './Vector';
  6799. /**
  6800. * @class SuperMap.Geometry
  6801. * @category BaseTypes Geometry
  6802. * @classdesc 几何对象类,描述地理对象的几何图形。
  6803. */
  6804. class Geometry {
  6805. constructor() {
  6806. this.CLASS_NAME = "SuperMap.Geometry";
  6807. /**
  6808. * @member {string} SuperMap.Geometry.prototype.id
  6809. * @description 此几何对象的唯一标示符。
  6810. *
  6811. */
  6812. this.id = Util.createUniqueID(this.CLASS_NAME + "_");
  6813. /**
  6814. * @member {SuperMap.Geometry} SuperMap.Geometry.prototype.parent
  6815. * @description This is set when a Geometry is added as component
  6816. * of another geometry
  6817. */
  6818. this.parent = null;
  6819. /**
  6820. * @member {SuperMap.Bounds} SuperMap.Geometry.prototype.bounds
  6821. * @description 几何对象的范围。
  6822. *
  6823. */
  6824. this.bounds = null;
  6825. /**
  6826. * @member {interger} SuperMap.Geometry.prototype.SRID
  6827. * @description 投影坐标参数。通过该参数,服务器判断 Geometry 对象的坐标参考系是否与数据集相同,如果不同,则在数据入库前进行投影变换。
  6828. * @example
  6829. * var geometry= new SuperMap.Geometry();
  6830. * geometry. SRID=4326;
  6831. *
  6832. */
  6833. this.SRID = null;
  6834. }
  6835. /**
  6836. * @function SuperMap.Geometry.prototype.destroy
  6837. * @description 解构 Geometry 类,释放资源。
  6838. */
  6839. destroy() {
  6840. this.id = null;
  6841. this.bounds = null;
  6842. this.SRID = null;
  6843. }
  6844. /**
  6845. * @function SuperMap.Geometry.prototype.clone
  6846. * @description 创建克隆的几何图形。克隆的几何图形不设置非标准的属性。
  6847. * @returns {SuperMap.Geometry} 克隆的几何图形。
  6848. */
  6849. clone() {
  6850. return new Geometry();
  6851. }
  6852. /**
  6853. * @function SuperMap.Geometry.prototype.setBounds
  6854. * @description 设置此几何对象的 bounds。
  6855. * @param {SuperMap.Bounds} bounds - 范围。
  6856. */
  6857. setBounds(bounds) {
  6858. if (bounds) {
  6859. this.bounds = bounds.clone();
  6860. }
  6861. }
  6862. /**
  6863. * @function SuperMap.Geometry.prototype.clearBounds
  6864. * @description 清除几何对象的 bounds。
  6865. * 如果该对象有父类,也会清除父类几何对象的 bounds。
  6866. */
  6867. clearBounds() {
  6868. this.bounds = null;
  6869. if (this.parent) {
  6870. this.parent.clearBounds();
  6871. }
  6872. }
  6873. /**
  6874. * @function SuperMap.Geometry.prototype.extendBounds
  6875. * @description Extend the existing bounds to include the new bounds.
  6876. * If geometry's bounds is not yet set, then set a new Bounds.
  6877. *
  6878. * @param {SuperMap.Bounds} newBounds - 范围。
  6879. */
  6880. extendBounds(newBounds) {
  6881. var bounds = this.getBounds();
  6882. if (!bounds) {
  6883. this.setBounds(newBounds);
  6884. } else {
  6885. this.bounds.extend(newBounds);
  6886. }
  6887. }
  6888. /**
  6889. * @function SuperMap.Geometry.prototype.getBounds
  6890. * @description 获得几何图形的边界。如果没有设置边界,可通过计算获得。
  6891. * @returns {SuperMap.Bounds} 返回的几何对象的边界。
  6892. */
  6893. getBounds() {
  6894. if (this.bounds == null) {
  6895. this.calculateBounds();
  6896. }
  6897. return this.bounds;
  6898. }
  6899. /**
  6900. * @function SuperMap.Geometry.prototype.calculateBounds
  6901. * @description 重新计算几何图形的边界(需要在子类中实现此方法)。
  6902. */
  6903. calculateBounds() {
  6904. //
  6905. // This should be overridden by subclasses.
  6906. //
  6907. }
  6908. /**
  6909. * @function SuperMap.Geometry.prototype.getVertices
  6910. * @description 返回几何图形的所有顶点的列表(需要在子类中实现此方法)。
  6911. * @param {boolean} [nodes] - 如果是 true,线则只返回线的末端点,如果 false,仅仅返回顶点,如果没有设置,则返回顶点。
  6912. * @returns {Array} 几何图形的顶点列表。
  6913. */
  6914. getVertices(nodes) { // eslint-disable-line no-unused-vars
  6915. }
  6916. /**
  6917. * @function SuperMap.Geometry.prototype.getArea
  6918. * @description 计算几何对象的面积 ,此方法需要在子类中定义。
  6919. * @returns {float} The area of the collection by summing its parts
  6920. */
  6921. getArea() {
  6922. //to be overridden by geometries that actually have an area
  6923. //
  6924. return 0.0;
  6925. }
  6926. // /**
  6927. // * @function SuperMap.Geometry.prototype.toString
  6928. // * @description 返回geometry对象的字符串表述,需要引入{@link SuperMap.Format.WKT}。此方法只能在子类实现,在父类使用会报错。
  6929. // * @returns {string} geometry对象的字符串表述(Well-Known Text)
  6930. // */
  6931. // toString() {
  6932. // var string;
  6933. // if (WKT) {
  6934. // var wkt = new WKT();
  6935. // string = wkt.write(new Vector(this));
  6936. // } else {
  6937. // string = Object.prototype.toString.call(this);
  6938. // }
  6939. // return string;
  6940. // }
  6941. }
  6942. SuperMap.Geometry = Geometry;
  6943. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Collection.js
  6944. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  6945. * This program are made available under the terms of the Apache License, Version 2.0
  6946. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6947. /**
  6948. * @class SuperMap.Geometry.Collection
  6949. * @classdesc 几何对象集合类,存储在本地的 components 属性中(可作为参数传递给构造函数)。<br>
  6950. * 随着新的几何图形添加到集合中,将不能被克隆,当移动几何图形时,需要指定参照物。<br>
  6951. * getArea 和 getLength 函数只能通过遍历存储几何对象的 components 数组,总计所有几何图形的面积和长度。
  6952. * @category BaseTypes Geometry
  6953. * @extends {SuperMap.Geometry}
  6954. * @param {Array.<SuperMap.Geometry>} components - 几何对象数组。
  6955. * @example
  6956. * var point1 = new SuperMap.Geometry.Point(10,20);
  6957. * var point2 = new SuperMap.Geometry.Point(30,40);
  6958. * var col = new SuperMap.Geometry.Collection([point1,point2]);
  6959. */
  6960. class Collection extends Geometry {
  6961. constructor(components) {
  6962. super();
  6963. /**
  6964. * @description 存储几何对象的数组。
  6965. * @member {Array.<SuperMap.Geometry>} SuperMap.Geometry.Collection.prototype.components
  6966. */
  6967. this.components = [];
  6968. /**
  6969. * @member {Array.<string>} SuperMap.Geometry.Collection.prototype.componentTypes
  6970. * @description components 存储的的几何对象所支持的几何类型数组,为空表示类型不受限制。
  6971. */
  6972. this.componentTypes = null;
  6973. if (components != null) {
  6974. this.addComponents(components);
  6975. }
  6976. this.CLASS_NAME = "SuperMap.Geometry.Collection";
  6977. this.geometryType = "Collection";
  6978. }
  6979. /**
  6980. * @function SuperMap.Geometry.Collection.prototype.destroy
  6981. * @description 销毁几何图形。
  6982. */
  6983. destroy() {
  6984. this.components.length = 0;
  6985. this.components = null;
  6986. super.destroy();
  6987. }
  6988. /**
  6989. * @function SuperMap.Geometry.Collection.prototype.clone
  6990. * @description 克隆当前几何对象。
  6991. * @returns {SuperMap.Geometry.Collection} 克隆的几何对象集合。
  6992. */
  6993. clone() {
  6994. var geometry = new Collection();
  6995. for (var i = 0, len = this.components.length; i < len; i++) {
  6996. geometry.addComponent(this.components[i].clone());
  6997. }
  6998. // catch any randomly tagged-on properties
  6999. Util.applyDefaults(geometry, this);
  7000. return geometry;
  7001. }
  7002. /**
  7003. * @function SuperMap.Geometry.Collection.prototype.getComponentsString
  7004. * @description 获取 components 字符串。
  7005. * @returns {string} components 字符串。
  7006. */
  7007. getComponentsString() {
  7008. var strings = [];
  7009. for (var i = 0, len = this.components.length; i < len; i++) {
  7010. strings.push(this.components[i].toShortString());
  7011. }
  7012. return strings.join(",");
  7013. }
  7014. /**
  7015. * @function SuperMap.Geometry.Collection.prototype.calculateBounds
  7016. * @description 通过遍历数组重新计算边界,在遍历每一子项中时调用 extend 方法。
  7017. */
  7018. calculateBounds() {
  7019. this.bounds = null;
  7020. var bounds = new Bounds();
  7021. var components = this.components;
  7022. if (components) {
  7023. for (var i = 0, len = components.length; i < len; i++) {
  7024. bounds.extend(components[i].getBounds());
  7025. }
  7026. }
  7027. // to preserve old behavior, we only set bounds if non-null
  7028. // in the future, we could add bounds.isEmpty()
  7029. if (bounds.left != null && bounds.bottom != null &&
  7030. bounds.right != null && bounds.top != null) {
  7031. this.setBounds(bounds);
  7032. }
  7033. }
  7034. /**
  7035. * @function SuperMap.Geometry.Collection.prototype.addComponents
  7036. * @description 给几何图形对象添加元素。
  7037. * @param {Array.<SuperMap.Geometry>} components - 几何对象组件。
  7038. * @example
  7039. * var collection = new SuperMap.Geometry.Collection();
  7040. * collection.addComponents(new SuerpMap.Geometry.Point(10,10));
  7041. */
  7042. addComponents(components) {
  7043. if (!(Util.isArray(components))) {
  7044. components = [components];
  7045. }
  7046. for (var i = 0, len = components.length; i < len; i++) {
  7047. this.addComponent(components[i]);
  7048. }
  7049. }
  7050. /**
  7051. * @function SuperMap.Geometry.Collection.prototype.addComponent
  7052. * @description 添加一个几何对象到集合中。如果设置了 componentTypes 类型,则添加的几何对象必须是 componentTypes 中的类型。
  7053. * @param {SuperMap.Geometry} component - 待添加的几何对象。
  7054. * @param {int} [index] - 几何对象插入的位置。
  7055. * @returns {boolean} 是否添加成功。
  7056. */
  7057. addComponent(component, index) {
  7058. var added = false;
  7059. if (component) {
  7060. if (this.componentTypes == null ||
  7061. (Util.indexOf(this.componentTypes,
  7062. component.CLASS_NAME) > -1)) {
  7063. if (index != null && (index < this.components.length)) {
  7064. var components1 = this.components.slice(0, index);
  7065. var components2 = this.components.slice(index,
  7066. this.components.length);
  7067. components1.push(component);
  7068. this.components = components1.concat(components2);
  7069. } else {
  7070. this.components.push(component);
  7071. }
  7072. component.parent = this;
  7073. this.clearBounds();
  7074. added = true;
  7075. }
  7076. }
  7077. return added;
  7078. }
  7079. /**
  7080. * @function SuperMap.Geometry.Collection.prototype.removeComponents
  7081. * @description 清除几何对象。
  7082. * @param {Array.<SuperMap.Geometry>} components - 需要清除的几何对象。
  7083. * @returns {boolean} 元素是否被删除。
  7084. */
  7085. removeComponents(components) {
  7086. var removed = false;
  7087. if (!(Util.isArray(components))) {
  7088. components = [components];
  7089. }
  7090. for (var i = components.length - 1; i >= 0; --i) {
  7091. removed = this.removeComponent(components[i]) || removed;
  7092. }
  7093. return removed;
  7094. }
  7095. /**
  7096. * @function SuperMap.Geometry.Collection.prototype.removeComponent
  7097. * @description 从集合中移除一个几何对象。
  7098. * @param {SuperMap.Geometry} component - 要移除的几何对象。
  7099. * @returns {boolean} 几何对象是否移除成功。
  7100. */
  7101. removeComponent(component) {
  7102. Util.removeItem(this.components, component);
  7103. // clearBounds() so that it gets recalculated on the next call
  7104. // to this.getBounds();
  7105. this.clearBounds();
  7106. return true;
  7107. }
  7108. /**
  7109. * @function SuperMap.Geometry.Collection.prototype.getArea
  7110. * @description 计算几何对象的面积。注意,这个方法在 {@link SuperMap.Geometry.Polygon} 类中需要重写。
  7111. * @returns {number} 几何图形的面积,是几何对象中所有组成部分的面积之和。
  7112. */
  7113. getArea() {
  7114. var area = 0.0;
  7115. for (var i = 0, len = this.components.length; i < len; i++) {
  7116. area += this.components[i].getArea();
  7117. }
  7118. return area;
  7119. }
  7120. /**
  7121. * @function SuperMap.Geometry.Collection.prototype.equals
  7122. * @description 判断两个几何图形是否相等。如果所有的 components 具有相同的坐标,则认为是相等的。
  7123. * @param {SuperMap.Geometry} geometry - 需要判断的几何图形。
  7124. * @returns {boolean} 输入的几何图形与当前几何图形是否相等。
  7125. */
  7126. equals(geometry) {
  7127. var equivalent = true;
  7128. if (!geometry || !geometry.CLASS_NAME ||
  7129. (this.CLASS_NAME !== geometry.CLASS_NAME)) {
  7130. equivalent = false;
  7131. } else if (!(Util.isArray(geometry.components)) ||
  7132. (geometry.components.length !== this.components.length)) {
  7133. equivalent = false;
  7134. } else {
  7135. for (var i = 0, len = this.components.length; i < len; ++i) {
  7136. if (!this.components[i].equals(geometry.components[i])) {
  7137. equivalent = false;
  7138. break;
  7139. }
  7140. }
  7141. }
  7142. return equivalent;
  7143. }
  7144. /**
  7145. * @function SuperMap.Geometry.Collection.prototype.getVertices
  7146. * @description 返回几何对象的所有结点的列表。
  7147. * @param {boolean} [nodes] - 对于线来说,仅仅返回作为端点的顶点,如果设为 false,则返回非端点的顶点如果没有设置此参数,则返回所有顶点。
  7148. * @returns {Array} 几何对象的顶点列表。
  7149. */
  7150. getVertices(nodes) {
  7151. var vertices = [];
  7152. for (var i = 0, len = this.components.length; i < len; ++i) {
  7153. Array.prototype.push.apply(
  7154. vertices, this.components[i].getVertices(nodes)
  7155. );
  7156. }
  7157. return vertices;
  7158. }
  7159. }
  7160. SuperMap.Geometry.Collection = Collection;
  7161. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/MultiPoint.js
  7162. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  7163. * This program are made available under the terms of the Apache License, Version 2.0
  7164. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7165. /**
  7166. * @class SuperMap.Geometry.MultiPoint
  7167. * @classdesc 几何对象多点类。
  7168. * @category BaseTypes Geometry
  7169. * @extends {SuperMap.Geometry.Collection}
  7170. * @param {Array.<SuperMap.Geometry.Point>} components - 点对象数组。
  7171. * @example
  7172. * var point1 = new SuperMap.Geometry.Point(5,6);
  7173. * var poine2 = new SuperMap.Geometry.Point(7,8);
  7174. * var multiPoint = new SuperMap.Geometry.MultiPoint([point1,point2]);
  7175. */
  7176. class MultiPoint extends Collection {
  7177. constructor(components) {
  7178. super(components);
  7179. /**
  7180. * @member {Array.<string>} [SuperMap.Geometry.MultiPoint.prototype.componentTypes=["SuperMap.Geometry.Point"]]
  7181. * @description components 存储的的几何对象所支持的几何类型数组。
  7182. * @readonly
  7183. */
  7184. this.componentTypes = ["SuperMap.Geometry.Point"];
  7185. this.CLASS_NAME = "SuperMap.Geometry.MultiPoint";
  7186. this.geometryType = "MultiPoint";
  7187. }
  7188. /**
  7189. * @function SuperMap.Geometry.MultiPoint.prototype.addPoint
  7190. * @description 添加点,封装了 {@link SuperMap.Geometry.Collection|SuperMap.Geometry.Collection.addComponent} 方法。
  7191. * @param {SuperMap.Geometry.Point} point - 添加的点。
  7192. * @param {integer} [index] - 下标。
  7193. */
  7194. addPoint(point, index) {
  7195. this.addComponent(point, index);
  7196. }
  7197. /**
  7198. * @function SuperMap.Geometry.MultiPoint.prototype.removePoint
  7199. * @description 移除点,封装了 {@link SuperMap.Geometry.Collection|SuperMap.Geometry.Collection.removeComponent} 方法。
  7200. * @param {SuperMap.Geometry.Point} point - 移除的点对象。
  7201. */
  7202. removePoint(point) {
  7203. this.removeComponent(point);
  7204. }
  7205. }
  7206. SuperMap.Geometry.MultiPoint = MultiPoint;
  7207. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Curve.js
  7208. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  7209. * This program are made available under the terms of the Apache License, Version 2.0
  7210. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7211. /**
  7212. * @class SuperMap.Geometry.Curve
  7213. * @classdesc 几何对象曲线类。
  7214. * @category BaseTypes Geometry
  7215. * @extends {SuperMap.Geometry.MultiPoint}
  7216. * @param {Array.<SuperMap.Geometry.Point>} components - 几何对象数组。
  7217. * @example
  7218. * var point1 = new SuperMap.Geometry.Point(10,20);
  7219. * var point2 = new SuperMap.Geometry.Point(30,40);
  7220. * var curve = new SuperMap.Geometry.Curve([point1,point2]);
  7221. */
  7222. class Curve extends MultiPoint {
  7223. constructor(components) {
  7224. super(components);
  7225. /**
  7226. * @member {Array.<string>} [SuperMap.Geometry.Curve.prototype.componentType=["SuperMap.Geometry.Point", "SuperMap.PointWithMeasure"]]
  7227. * @description components 存储的的几何对象所支持的几何类型数组。
  7228. * @readonly
  7229. */
  7230. this.componentTypes = ["SuperMap.Geometry.Point", "SuperMap.PointWithMeasure"];
  7231. this.CLASS_NAME = "SuperMap.Geometry.Curve";
  7232. this.geometryType = "Curve";
  7233. }
  7234. }
  7235. SuperMap.Geometry.Curve = Curve;
  7236. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Point.js
  7237. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  7238. * This program are made available under the terms of the Apache License, Version 2.0
  7239. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7240. /**
  7241. * @class SuperMap.Geometry.Point
  7242. * @classdesc 点几何对象类。
  7243. * @category BaseTypes Geometry
  7244. * @extends {SuperMap.Geometry}
  7245. * @param {float} x - x 坐标。
  7246. * @param {float} y - y 坐标。
  7247. * @param {string} [type = 'Point'] - 用来存储点的类型。
  7248. * @param {float} [tag] - 用来存储额外的属性,比如差值分析中的 Z 值。
  7249. * @example
  7250. * var point = new SuperMap.Geometry.Point(-111.04, 45.68);
  7251. */
  7252. class Point extends Geometry {
  7253. constructor(x, y, type, tag) {
  7254. super(x, y, type, tag);
  7255. /**
  7256. * @member {float} SuperMap.Geometry.Point.prototype.x
  7257. * @description 横坐标。
  7258. */
  7259. this.x = parseFloat(x);
  7260. /**
  7261. * @member {float} SuperMap.Geometry.Point.prototype.y
  7262. * @description 纵坐标。
  7263. */
  7264. this.y = parseFloat(y);
  7265. /**
  7266. * @member {string} SuperMap.Geometry.Point.prototype.tag
  7267. * @description 用来存储额外的属性,比如差值分析中的 Z 值。
  7268. */
  7269. this.tag = (tag || tag == 0) ? parseFloat(tag) : null;
  7270. /**
  7271. * @member {string} SuperMap.Geometry.Point.prototype.tag
  7272. * @description 用来存储点的类型
  7273. */
  7274. this.type = type || "Point";
  7275. this.CLASS_NAME = "SuperMap.Geometry.Point";
  7276. this.geometryType = "Point";
  7277. }
  7278. /**
  7279. * @function SuperMap.Geometry.Point.prototype.clone
  7280. * @description 克隆点对象。
  7281. * @returns {SuperMap.Geometry.Point} 克隆后的点对象。
  7282. */
  7283. clone(obj) {
  7284. if (obj == null) {
  7285. obj = new Point(this.x, this.y);
  7286. }
  7287. // catch any randomly tagged-on properties
  7288. Util.applyDefaults(obj, this);
  7289. return obj;
  7290. }
  7291. /**
  7292. * @function SuperMap.Geometry.Point.prototype.calculateBounds
  7293. * @description 计算点对象的范围。
  7294. */
  7295. calculateBounds() {
  7296. this.bounds = new Bounds(this.x, this.y,
  7297. this.x, this.y);
  7298. }
  7299. /**
  7300. * @function SuperMap.Geometry.Point.prototype.equals
  7301. * @description 判断两个点对象是否相等。如果两个点对象具有相同的坐标,则认为是相等的。
  7302. * @example
  7303. * var point= new SuperMap.Geometry.Point(0,0);
  7304. * var point1={x:0,y:0};
  7305. * var result= point.equals(point1);
  7306. * @param {SuperMap.Geometry.Point} geom - 需要判断的点对象。
  7307. * @returns {boolean} 两个点对象是否相等(true 为相等,false 为不等)。
  7308. */
  7309. equals(geom) {
  7310. var equals = false;
  7311. if (geom != null) {
  7312. equals = ((this.x === geom.x && this.y === geom.y) ||
  7313. (isNaN(this.x) && isNaN(this.y) && isNaN(geom.x) && isNaN(geom.y)));
  7314. }
  7315. return equals;
  7316. }
  7317. /**
  7318. * @function SuperMap.Geometry.Point.prototype.move
  7319. * @description 沿着 x、y 轴的正方向上按照给定的位移移动点对象,move 不仅改变了几何对象的位置并且清理了边界缓存。
  7320. * @param {float} x - x 轴正方向上的偏移量。
  7321. * @param {float} y - y 轴正方向上偏移量。
  7322. */
  7323. move(x, y) {
  7324. this.x = this.x + x;
  7325. this.y = this.y + y;
  7326. this.clearBounds();
  7327. }
  7328. /**
  7329. * @function SuperMap.Geometry.Point.prototype.toShortString
  7330. * @returns {string} 字符串代表点对象。(ex. <i>"5, 42"</i>)
  7331. */
  7332. toShortString() {
  7333. return (this.x + ", " + this.y);
  7334. }
  7335. /**
  7336. * @function SuperMap.Geometry.Point.prototype.destroy
  7337. * @description 释放点对象的资源。
  7338. */
  7339. destroy() {
  7340. this.x = null;
  7341. this.y = null;
  7342. this.tag = null;
  7343. super.destroy();
  7344. }
  7345. /**
  7346. * @function SuperMap.Geometry.Point.prototype.getVertices
  7347. * @description 返回点对象的所有顶点的列表。
  7348. * @param {boolean} [nodes] - 对于点对象此参数不起作用,直接返回点。
  7349. * @returns {Array} 几何图形的顶点列表。
  7350. */
  7351. getVertices(nodes) { // eslint-disable-line no-unused-vars
  7352. return [this];
  7353. }
  7354. }
  7355. SuperMap.Geometry.Point = Point;
  7356. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/LineString.js
  7357. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  7358. * This program are made available under the terms of the Apache License, Version 2.0
  7359. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7360. /**
  7361. * @class SuperMap.Geometry.LineString
  7362. * @classdesc 几何对象线串类。
  7363. * @category BaseTypes Geometry
  7364. * @param {Array.<SuperMap.Geometry.Point>} points - 用来生成线串的点数组。
  7365. * @extends {SuperMap.Geometry.Curve}
  7366. * @example
  7367. * var points = [new SuperMap.Geometry.Point(4933.319287022352, -3337.3849141502124),
  7368. * new SuperMap.Geometry.Point(4960.9674060199022, -3349.3316322355736),
  7369. * new SuperMap.Geometry.Point(5006.0235999418364, -3358.8890067038628),
  7370. * new SuperMap.Geometry.Point(5075.3145648369318, -3378.0037556404409),
  7371. * new SuperMap.Geometry.Point(5305.19551436013, -3376.9669111768926)],
  7372. * var roadLine = new SuperMap.Geometry.LineString(points);
  7373. */
  7374. class LineString extends Curve {
  7375. constructor(points) {
  7376. super(points);
  7377. this.CLASS_NAME = "SuperMap.Geometry.LineString";
  7378. this.geometryType = "LineString";
  7379. }
  7380. /**
  7381. * @function SuperMap.Geometry.LineString.prototype.removeComponent
  7382. * @description 只有在线串上有三个或更多的点的时候,才会允许移除点(否则结果将会是单一的点)。
  7383. * @param {SuperMap.Geometry.Point} point - 将被删除的点。
  7384. * @returns {boolean} 删除的点。
  7385. */
  7386. removeComponent(point) { // eslint-disable-line no-unused-vars
  7387. var removed = this.components && (this.components.length > 2);
  7388. if (removed) {
  7389. super.removeComponent.apply(this, arguments);
  7390. }
  7391. return removed;
  7392. }
  7393. /**
  7394. * @function SuperMap.Geometry.LineString.prototype.getSortedSegments
  7395. * @returns {Array} An array of segment objects. Segment objects have properties
  7396. * x1, y1, x2, and y2. The start point is represented by x1 and y1.
  7397. * The end point is represented by x2 and y2. Start and end are
  7398. * ordered so that x1 < x2.
  7399. */
  7400. getSortedSegments() {
  7401. var numSeg = this.components.length - 1;
  7402. var segments = new Array(numSeg), point1, point2;
  7403. for (var i = 0; i < numSeg; ++i) {
  7404. point1 = this.components[i];
  7405. point2 = this.components[i + 1];
  7406. if (point1.x < point2.x) {
  7407. segments[i] = {
  7408. x1: point1.x,
  7409. y1: point1.y,
  7410. x2: point2.x,
  7411. y2: point2.y
  7412. };
  7413. } else {
  7414. segments[i] = {
  7415. x1: point2.x,
  7416. y1: point2.y,
  7417. x2: point1.x,
  7418. y2: point1.y
  7419. };
  7420. }
  7421. }
  7422. // more efficient to define this somewhere static
  7423. function byX1(seg1, seg2) {
  7424. return seg1.x1 - seg2.x1;
  7425. }
  7426. return segments.sort(byX1);
  7427. }
  7428. /**
  7429. * @function SuperMap.Geometry.LineString.prototype.getVertices
  7430. * @description 返回几何图形的所有顶点的列表。
  7431. * @param {boolean} [nodes] - 对于线来说,仅仅返回作为端点的顶点,如果设为 false,则返回非端点的顶点。如果没有设置此参数,则返回所有顶点。
  7432. * @returns {Array} 几何图形的顶点列表。
  7433. */
  7434. getVertices(nodes) {
  7435. var vertices;
  7436. if (nodes === true) {
  7437. vertices = [
  7438. this.components[0],
  7439. this.components[this.components.length - 1]
  7440. ];
  7441. } else if (nodes === false) {
  7442. vertices = this.components.slice(1, this.components.length - 1);
  7443. } else {
  7444. vertices = this.components.slice();
  7445. }
  7446. return vertices;
  7447. }
  7448. /**
  7449. * @function SuperMap.Geometry.LineString.calculateCircle
  7450. * @description 三点画圆弧。
  7451. * @param {Array.<SuperMap.Geometry.Point>} points - 传入的待计算的初始点串。
  7452. * @returns {Array.<SuperMap.Geometry.Point>} 计算出相应的圆弧控制点。
  7453. * @example
  7454. * var points = [];
  7455. * points.push(new SuperMap.Geometry.Point(-50,30));
  7456. * points.push(new SuperMap.Geometry.Point(-30,50));
  7457. * points.push(new SuperMap.Geometry.Point(2,60));
  7458. * var circle = SuperMap.Geometry.LineString.calculateCircle(points);
  7459. */
  7460. static calculateCircle(points) {
  7461. if (points.length < 3) {
  7462. return points
  7463. }
  7464. var centerPoint = {},
  7465. p1 = points[0],
  7466. p2 = points[1],
  7467. p3 = points[2];
  7468. var R = 0,
  7469. dStep = 0,
  7470. direc = true,
  7471. dRotation = 0,
  7472. dRotationBegin = 0,
  7473. dRotationAngle = 0,
  7474. nSegmentCount = 72,
  7475. circlePoints = [];
  7476. var KTan13 = (p3.y - p1.y) / (p3.x - p1.x);
  7477. var B13 = p3.y - KTan13 * p3.x;
  7478. if ((((p3.x != p1.x) && (p3.y != p1.y)) && (p2.y == KTan13 * p2.x + B13)) ||
  7479. ((p3.x == p1.x) && (p2.x == p1.x)) || ((p3.y == p1.y) && (p2.y == p1.y)) ||
  7480. ((p3.x == p1.x) && (p3.y == p1.y)) || ((p3.x == p2.x) && (p3.y == p2.y)) || ((p1.x == p2.x) && (p1.y == p2.y))) {
  7481. circlePoints.push(p1);
  7482. circlePoints.push(p2);
  7483. circlePoints.push(p3);
  7484. } else {
  7485. 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) -
  7486. (p1.x * p1.x + p1.y * p1.y)) * (2 * (p2.y - p1.y));
  7487. var E = (2 * (p2.x - p1.x)) * ((p3.x * p3.x + p3.y * p3.y) - (p1.x * p1.x + p1.y * p1.y)) -
  7488. (2 * (p3.x - p1.x)) * ((p2.x * p2.x + p2.y * p2.y) - (p1.x * p1.x + p1.y * p1.y));
  7489. var F = 4 * ((p2.x - p1.x) * (p3.y - p1.y) - (p3.x - p1.x) * (p2.y - p1.y));
  7490. centerPoint.x = D / F;
  7491. centerPoint.y = E / F;
  7492. R = Math.sqrt((p1.x - centerPoint.x) * (p1.x - centerPoint.x) + (p1.y - centerPoint.y) * (p1.y - centerPoint.y));
  7493. var dis = (p1.x - p3.x) * (p1.x - p3.x) + (p1.y - p3.y) * (p1.y - p3.y);
  7494. var cons = (2 * R * R - dis) / (2 * R * R);
  7495. cons = cons >= 1 ? 1 : cons;
  7496. cons = cons <= -1 ? -1 : cons;
  7497. dRotationAngle = Math.acos(cons) * 180 / Math.PI;
  7498. if (p3.x == p1.x) {
  7499. dRotationAngle = ((centerPoint.x > p1.x && p2.x > p1.x) || (centerPoint.x < p1.x && p2.x < p1.x)) ? (360 - dRotationAngle) : dRotationAngle;
  7500. } else {
  7501. dRotationAngle = ((centerPoint.y > (KTan13 * centerPoint.x + B13) && p2.y > (KTan13 * p2.x + B13)) ||
  7502. (centerPoint.y < (KTan13 * centerPoint.x + B13) && p2.y < (KTan13 * p2.x + B13))) ? (360 - dRotationAngle) : dRotationAngle;
  7503. }
  7504. dStep = dRotationAngle / 72;
  7505. if (p3.y != p1.y) {
  7506. if (p3.x == p1.x) {
  7507. if (p3.y > p1.y) {
  7508. if (p2.x < p1.x) {
  7509. direc = false;
  7510. }
  7511. } else {
  7512. if (p2.x > p1.x) {
  7513. direc = false;
  7514. }
  7515. }
  7516. } else if (p3.x < p1.x) {
  7517. if (p2.y < KTan13 * p2.x + B13) {
  7518. direc = false;
  7519. }
  7520. } else {
  7521. if (p2.y > KTan13 * p2.x + B13) {
  7522. direc = false;
  7523. }
  7524. }
  7525. } else {
  7526. if (p3.x > p1.x) {
  7527. if (p2.y > p1.y) {
  7528. direc = false;
  7529. }
  7530. } else {
  7531. if (p2.y < p1.y) {
  7532. direc = false;
  7533. }
  7534. }
  7535. }
  7536. var K10 = (p1.y - centerPoint.y) / (p1.x - centerPoint.x);
  7537. var atan10 = K10 >= 0 ? Math.atan(K10) * 180 / Math.PI : Math.abs(Math.atan(K10) * 180 / Math.PI) + 90;
  7538. var CY = Math.abs(centerPoint.y);
  7539. if ((p1.y == CY) && (CY == p3.y)) {
  7540. if (p1.x < p3.x) {
  7541. atan10 = atan10 + 180;
  7542. }
  7543. }
  7544. var newPY = p1.y - centerPoint.y;
  7545. circlePoints.push(p1);
  7546. for (var i = 1; i < nSegmentCount; i++) {
  7547. dRotation = dStep * i;
  7548. dRotationBegin = atan10;
  7549. if (direc) {
  7550. if (newPY >= 0) {
  7551. if (K10 >= 0) {
  7552. dRotationBegin = dRotationBegin + dRotation;
  7553. } else {
  7554. dRotationBegin = (180 - (dRotationBegin - 90)) + dRotation;
  7555. }
  7556. } else {
  7557. if (K10 > 0) {
  7558. dRotationBegin = (dRotationBegin - 180) + dRotation;
  7559. } else {
  7560. dRotationBegin = (90 - dRotationBegin) + dRotation;
  7561. }
  7562. }
  7563. } else {
  7564. if (newPY >= 0) {
  7565. if (K10 >= 0) {
  7566. dRotationBegin = dRotationBegin - dRotation;
  7567. } else {
  7568. dRotationBegin = (180 - (dRotationBegin - 90)) - dRotation;
  7569. }
  7570. } else {
  7571. if (K10 >= 0) {
  7572. dRotationBegin = (dRotationBegin - 180) - dRotation;
  7573. } else {
  7574. dRotationBegin = (90 - dRotationBegin) - dRotation;
  7575. }
  7576. }
  7577. }
  7578. dRotationBegin = dRotationBegin * Math.PI / 180;
  7579. var x = centerPoint.x + R * Math.cos(dRotationBegin);
  7580. var y = centerPoint.y + R * Math.sin(dRotationBegin);
  7581. circlePoints.push(new Point(x, y));
  7582. }
  7583. circlePoints.push(p3);
  7584. }
  7585. return circlePoints;
  7586. }
  7587. /**
  7588. * @function SuperMap.Geometry.LineString.createLineEPS
  7589. * @description 根据点的类型画出不同类型的曲线。
  7590. * 点的类型有三种:LTypeArc,LTypeCurve,NONE。
  7591. * @param {Array.<SuperMap.Geometry.Point>} points - 传入的待计算的初始点串。
  7592. * @returns {Array.<SuperMap.Geometry.Point>} 计算出相应的 lineEPS 控制点。
  7593. * @example
  7594. * var points = [];
  7595. * points.push(new SuperMap.Geometry.Point(-50,30));
  7596. * points.push(new SuperMap.Geometry.Point(-30,50,"LTypeArc"));
  7597. * points.push(new SuperMap.Geometry.Point(2,60));
  7598. * points.push(new SuperMap.Geometry.Point(8,20));
  7599. * var lineEPS = SuperMap.Geometry.LineString.createLineEPS(points);
  7600. */
  7601. static createLineEPS(points) {
  7602. var list = [],
  7603. len = points.length;
  7604. if (len < 2) {
  7605. return points;
  7606. }
  7607. for (var i = 0; i < len;) {
  7608. var type = points[i].type;
  7609. if (type == 'LTypeArc') {
  7610. var listObj = LineString.createLineArc(list, i, len, points);
  7611. list = listObj[0];
  7612. i = listObj[1];
  7613. } else {
  7614. list.push(points[i]);
  7615. i++;
  7616. }
  7617. }
  7618. return list;
  7619. }
  7620. static createLineArc(list, i, len, points) {
  7621. if (i == 0) {
  7622. let bezierPtsObj = LineString.addPointEPS(points, i, len, 'LTypeArc');
  7623. Array.prototype.push.apply(list, bezierPtsObj[0]);
  7624. i = bezierPtsObj[1] + 1;
  7625. } else if (i == len - 1) {
  7626. var bezierP = [points[i - 1], points[i]],
  7627. bezierPts = LineString.calculateCircle(bezierP);
  7628. Array.prototype.push.apply(list, bezierPts);
  7629. i++;
  7630. } else {
  7631. let bezierPtsObj = LineString.addPointEPS(points, i, len, 'LTypeArc');
  7632. list.pop();
  7633. Array.prototype.push.apply(list, bezierPtsObj[0]);
  7634. i = bezierPtsObj[1] + 1;
  7635. }
  7636. return [list, i];
  7637. }
  7638. static addPointEPS(points, i, len, type) {
  7639. var bezierP = [], j = i + 1;
  7640. if (i == 0) {
  7641. Array.prototype.push.apply(bezierP, [points[i], points[i + 1]]);
  7642. } else if (i == len - 1) {
  7643. Array.prototype.push.apply(bezierP, [points[i - 1], points[i]]);
  7644. } else {
  7645. Array.prototype.push.apply(bezierP, [points[i - 1], points[i], points[i + 1]]);
  7646. }
  7647. var bezierPts;
  7648. if (type == 'LTypeCurve') {
  7649. bezierPts = LineString.calculatePointsFBZN(bezierP);
  7650. } else if (type == 'LTypeArc') {
  7651. bezierPts = LineString.calculateCircle(bezierP);
  7652. }
  7653. return [bezierPts, j];
  7654. }
  7655. }
  7656. SuperMap.Geometry.LineString = LineString;
  7657. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/GeoText.js
  7658. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  7659. * This program are made available under the terms of the Apache License, Version 2.0
  7660. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7661. /**
  7662. * @class SuperMap.Geometry.GeoText
  7663. * @classdesc 文本标签类。
  7664. * @category BaseTypes Geometry
  7665. * @extends {SuperMap.Geometry}
  7666. * @param {float} x - x 坐标。
  7667. * @param {float} y - y 坐标。
  7668. * @param {string} text - 标签中的文本内容。
  7669. */
  7670. class GeoText extends Geometry {
  7671. constructor(x, y, text) {
  7672. super(x, y, text);
  7673. /**
  7674. * @member {float} SuperMap.Geometry.GeoText.prototype.x
  7675. * @description 横坐标。
  7676. */
  7677. this.x = parseFloat(x);
  7678. /**
  7679. * @member {float} SuperMap.Geometry.GeoText.prototype.y
  7680. * @description 纵坐标。
  7681. */
  7682. this.y = parseFloat(y);
  7683. /**
  7684. * @member {string} SuperMap.Geometry.GeoText.prototype.text
  7685. * @description 标签中的文本内容。
  7686. */
  7687. this.text = text.toString();
  7688. /**
  7689. * @member {Object} SuperMap.Geometry.GeoText.prototype.bsInfo
  7690. * @description 标签范围的基础信息。
  7691. * @property {number} w - bounds 的宽。
  7692. * @property {number} h - bounds 的高度。
  7693. */
  7694. this.bsInfo = {
  7695. "h": null,
  7696. "w": null
  7697. };
  7698. this.element = document.createElement('span');
  7699. this.CLASS_NAME = "SuperMap.Geometry.GeoText";
  7700. this.geometryType = "GeoText";
  7701. }
  7702. /**
  7703. * @function SuperMap.Geometry.GeoText.prototype.destroy
  7704. * @description 销毁文本标签类。
  7705. */
  7706. destroy() {
  7707. super.destroy();
  7708. this.x = null;
  7709. this.y = null;
  7710. this.text = null;
  7711. }
  7712. /**
  7713. * @function SuperMap.Geometry.GeoText.prototype.getCentroid
  7714. * @description 获取标签对象的质心。
  7715. * @returns {SuperMap.Geometry.Point} 标签对象的质心。
  7716. */
  7717. getCentroid() {
  7718. return new Point(this.x, this.y);
  7719. }
  7720. /**
  7721. * @function SuperMap.Geometry.GeoText.prototype.clone
  7722. * @description 克隆标签对象。
  7723. * @returns {SuperMap.Geometry.GeoText} 克隆后的标签对象。
  7724. */
  7725. clone(obj) {
  7726. if (obj == null) {
  7727. obj = new GeoText(this.x, this.y, this.text);
  7728. }
  7729. Util.applyDefaults(obj, this);
  7730. return obj;
  7731. }
  7732. /**
  7733. * @function SuperMap.Geometry.GeoText.prototype.calculateBounds
  7734. * @description 计算标签对象的范围。
  7735. */
  7736. calculateBounds() {
  7737. this.bounds = new Bounds(this.x, this.y,
  7738. this.x, this.y);
  7739. }
  7740. /**
  7741. * @function SuperMap.Geometry.GeoText.prototype.getLabelPxBoundsByLabel
  7742. * @description 根据绘制好的标签获取文字标签的像素范围,参数的单位是像素;此方法相对于 getLabelPxBoundsByText 效率较低,但支持所有格式的文本。
  7743. * @param {Object} locationPixel - 标签的位置点,该对象含有属性 x(横坐标),属性 y(纵坐标)。
  7744. * @param {string} labelWidth - 标签的宽度,如:“90px”。
  7745. * @param {string} labelHeight - 标签的高度。
  7746. * @param {Object} style - 标签的 style。
  7747. * @returns {SuperMap.Bounds} 标签的像素范围。
  7748. */
  7749. getLabelPxBoundsByLabel(locationPixel, labelWidth, labelHeight, style) {
  7750. var labelPxBounds, left, bottom, top, right;
  7751. var locationPx = Util.cloneObject(locationPixel);
  7752. //计算文本行数
  7753. var theText = style.label || this.text;
  7754. var textRows = theText.split('\n');
  7755. var laberRows = textRows.length;
  7756. //处理文字对齐
  7757. labelWidth = parseFloat(labelWidth);
  7758. labelHeight = parseFloat(labelHeight);
  7759. if (laberRows > 1) {
  7760. labelHeight = parseFloat(labelHeight) * laberRows;
  7761. }
  7762. if (style.labelAlign && style.labelAlign !== "cm") {
  7763. switch (style.labelAlign) {
  7764. case "lt":
  7765. locationPx.x += labelWidth / 2;
  7766. locationPx.y += labelHeight / 2;
  7767. break;
  7768. case "lm":
  7769. locationPx.x += labelWidth / 2;
  7770. break;
  7771. case "lb":
  7772. locationPx.x += labelWidth / 2;
  7773. locationPx.y -= labelHeight / 2;
  7774. break;
  7775. case "ct":
  7776. locationPx.y += labelHeight / 2;
  7777. break;
  7778. case "cb":
  7779. locationPx.y -= labelHeight / 2;
  7780. break;
  7781. case "rt":
  7782. locationPx.x -= labelWidth / 2;
  7783. locationPx.y += labelHeight / 2;
  7784. break;
  7785. case "rm":
  7786. locationPx.x -= labelWidth / 2;
  7787. break;
  7788. case "rb":
  7789. locationPx.x -= labelWidth / 2;
  7790. locationPx.y -= labelHeight / 2;
  7791. break;
  7792. default:
  7793. break;
  7794. }
  7795. }
  7796. this.bsInfo.h = labelHeight;
  7797. this.bsInfo.w = labelWidth;
  7798. //bounds的四边
  7799. left = locationPx.x - parseFloat(labelWidth) / 2;
  7800. bottom = locationPx.y + parseFloat(labelHeight) / 2;
  7801. right = locationPx.x + parseFloat(labelWidth) / 2;
  7802. top = locationPx.y - parseFloat(labelHeight) / 2;
  7803. labelPxBounds = new Bounds(left, bottom, right, top);
  7804. return labelPxBounds;
  7805. }
  7806. /**
  7807. * @function SuperMap.Geometry.GeoText.prototype.getLabelPxBoundsByText
  7808. * @description 根据文本内容获取文字标签的像素范围。
  7809. * @param {Object} locationPixel - 标签的位置点,该对象含有属性 x(横坐标),属性 y(纵坐标)。
  7810. * @param {Object} style - 标签的样式。
  7811. * @returns {SuperMap.Bounds} 标签的像素范围。
  7812. */
  7813. getLabelPxBoundsByText(locationPixel, style) {
  7814. var labelPxBounds, left, bottom, top, right;
  7815. var labelSize = this.getLabelPxSize(style);
  7816. var locationPx = Util.cloneObject(locationPixel);
  7817. //处理文字对齐
  7818. if (style.labelAlign && style.labelAlign !== "cm") {
  7819. switch (style.labelAlign) {
  7820. case "lt":
  7821. locationPx.x += labelSize.w / 2;
  7822. locationPx.y += labelSize.h / 2;
  7823. break;
  7824. case "lm":
  7825. locationPx.x += labelSize.w / 2;
  7826. break;
  7827. case "lb":
  7828. locationPx.x += labelSize.w / 2;
  7829. locationPx.y -= labelSize.h / 2;
  7830. break;
  7831. case "ct":
  7832. locationPx.y += labelSize.h / 2;
  7833. break;
  7834. case "cb":
  7835. locationPx.y -= labelSize.h / 2;
  7836. break;
  7837. case "rt":
  7838. locationPx.x -= labelSize.w / 2;
  7839. locationPx.y += labelSize.h / 2;
  7840. break;
  7841. case "rm":
  7842. locationPx.x -= labelSize.w / 2;
  7843. break;
  7844. case "rb":
  7845. locationPx.x -= labelSize.w / 2;
  7846. locationPx.y -= labelSize.h / 2;
  7847. break;
  7848. default:
  7849. break;
  7850. }
  7851. }
  7852. this.bsInfo.h = labelSize.h;
  7853. this.bsInfo.w = labelSize.w;
  7854. left = locationPx.x - labelSize.w / 2;
  7855. bottom = locationPx.y + labelSize.h / 2;
  7856. //处理斜体字
  7857. if (style.fontStyle && style.fontStyle === "italic") {
  7858. right = locationPx.x + labelSize.w / 2 + parseInt(parseFloat(style.fontSize) / 2);
  7859. } else {
  7860. right = locationPx.x + labelSize.w / 2;
  7861. }
  7862. top = locationPx.y - labelSize.h / 2;
  7863. labelPxBounds = new Bounds(left, bottom, right, top);
  7864. return labelPxBounds;
  7865. }
  7866. /**
  7867. * @function SuperMap.Geometry.GeoText.prototype.getLabelPxSize
  7868. * @description 获取 label 的像素大小。
  7869. * @param {Object} style - 标签样式。
  7870. * @returns {Object} 标签大小对象,属性 w 表示标签的宽度,属性 h 表示标签的高度。
  7871. */
  7872. getLabelPxSize(style) {
  7873. var text,//文本内容
  7874. fontSize,//字体大小
  7875. spacing = 1,//两个字符间的间距(单位:px)
  7876. lineSpacing = 0.2,
  7877. bgstrokeWidth = parseFloat(style.strokeWidth);//标签背景框边框的宽度
  7878. text = style.label || this.text;
  7879. if (style.fontSize) {
  7880. fontSize = parseFloat(style.fontSize);
  7881. } else {
  7882. fontSize = parseFloat("12px");
  7883. }
  7884. //标签宽高
  7885. var labelW, labelH;
  7886. var textRows = text.split('\n');
  7887. var numRows = textRows.length;
  7888. if (numRows > 1) {
  7889. labelH = fontSize * numRows + numRows + bgstrokeWidth + lineSpacing * fontSize;
  7890. } else {
  7891. labelH = fontSize + bgstrokeWidth + lineSpacing * fontSize + 1;
  7892. }
  7893. //取最大宽度
  7894. labelW = 0;
  7895. if (this.labelWTmp && labelW < this.labelWTmp) {
  7896. labelW = this.labelWTmp;
  7897. }
  7898. for (var i = 0; i < numRows; i++) {
  7899. var textCharC = this.getTextCount(textRows[i]);
  7900. var labelWTmp = this.labelWTmp = Util.getTextBounds(style, textRows[i], this.element).textWidth + textCharC.textC * spacing + bgstrokeWidth;
  7901. if (labelW < labelWTmp) {
  7902. labelW = labelWTmp;
  7903. }
  7904. }
  7905. var labelSize = new Object(); //标签大小
  7906. labelSize.h = labelH;
  7907. labelSize.w = labelW;
  7908. return labelSize;
  7909. }
  7910. /**
  7911. * @function SuperMap.Geometry.GeoText.prototype.getTextCount
  7912. * @description 获取 text 中的字符个数。
  7913. * @param {string} text - 字符串。
  7914. * @returns {Object} 字符个数统计结果,属性 cnC 表示中文字符个数,属性 enC 表示英文字符个数,属性 textC 表示字符总个数。
  7915. */
  7916. getTextCount(text) {
  7917. var textCharCount = {};
  7918. var cnCount = 0;
  7919. var enCount = 0;
  7920. for (var i = 0; i < text.length; i++) {
  7921. if (text.charCodeAt(i) > 255) { //遍历判断字符串中每个字符的Unicode码,大于255则为中文
  7922. cnCount++;
  7923. } else {
  7924. enCount++;
  7925. }
  7926. }
  7927. //中午字符个数
  7928. textCharCount.cnC = cnCount;
  7929. //英文字符个数
  7930. textCharCount.enC = enCount;
  7931. //字符总个数
  7932. textCharCount.textC = text.length;
  7933. return textCharCount;
  7934. }
  7935. }
  7936. SuperMap.Geometry.GeoText = GeoText;
  7937. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/LinearRing.js
  7938. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  7939. * This program are made available under the terms of the Apache License, Version 2.0
  7940. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7941. /**
  7942. * @class SuperMap.Geometry.LinearRing
  7943. * @classdesc 几何对象线环类,是一个特殊的封闭的线串,在每次 addPoint/removePoint 之后会通过添加一个点(此点是复制的第一个点得到的)
  7944. * 作为最后的一个点来自动关闭线环。
  7945. * @category BaseTypes Geometry
  7946. * @extends {SuperMap.Geometry.LineString}
  7947. * @param {Array.<SuperMap.Geometry.Point>} points - 组成线性环的点。
  7948. * @example
  7949. * var points = [new SuperMap.Geometry.Point(4933.319287022352, -3337.3849141502124),
  7950. * new SuperMap.Geometry.Point(4960.9674060199022, -3349.3316322355736),
  7951. * new SuperMap.Geometry.Point(5006.0235999418364, -3358.8890067038628),
  7952. * new SuperMap.Geometry.Point(5075.3145648369318, -3378.0037556404409),
  7953. * new SuperMap.Geometry.Point(5305.19551436013, -3376.9669111768926)],
  7954. * var linearRing = new SuperMap.Geometry.LinearRing(points);
  7955. */
  7956. class LinearRing extends LineString {
  7957. constructor(points) {
  7958. super(points);
  7959. /**
  7960. * @member {Array.<string>} [SuperMap.Geometry.LinearRing.prototype.componentTypes=["SuperMap.Geometry.Point"]]
  7961. * @description components 存储的的几何对象所支持的几何类型数组,为空表示类型不受限制。
  7962. * @readonly
  7963. */
  7964. this.componentTypes = ["SuperMap.Geometry.Point"];
  7965. this.CLASS_NAME = "SuperMap.Geometry.LinearRing";
  7966. this.geometryType = "LinearRing";
  7967. }
  7968. /**
  7969. * @function SuperMap.Geometry.LinearRing.prototype.addComponent
  7970. * @description 添加一个点到几何图形数组中,如果这个点将要被添加到组件数组的末端,并且与数组中已经存在的最后一个点相同,
  7971. * 重复的点是不能被添加的。这将影响未关闭环的关闭。
  7972. * 这个方法可以通过将非空索引(组件数组的下标)作为第二个参数重写。
  7973. * @param {SuperMap.Geometry.Point} point - 点对象。
  7974. * @param {integer} [index] - 插入组件数组的下标。
  7975. * @returns {boolean} 点对象是否添加成功。
  7976. */
  7977. addComponent(point, index) {
  7978. var added = false;
  7979. //remove last point
  7980. var lastPoint = this.components.pop();
  7981. // given an index, add the point
  7982. // without an index only add non-duplicate points
  7983. if (index != null || !point.equals(lastPoint)) {
  7984. added = super.addComponent.apply(this, arguments);
  7985. }
  7986. //append copy of first point
  7987. var firstPoint = this.components[0];
  7988. super.addComponent.apply(this, [firstPoint]);
  7989. return added;
  7990. }
  7991. /**
  7992. * @function SuperMap.Geometry.LinearRing.prototype.removeComponent
  7993. * @description 从几何组件中删除一个点。
  7994. * @param {SuperMap.Geometry.Point} point - 点对象。
  7995. * @returns {boolean} 点对象是否删除。
  7996. */
  7997. removeComponent(point) { // eslint-disable-line no-unused-vars
  7998. var removed = this.components && (this.components.length > 3);
  7999. if (removed) {
  8000. //remove last point
  8001. this.components.pop();
  8002. //remove our point
  8003. super.removeComponent.apply(this, arguments);
  8004. //append copy of first point
  8005. var firstPoint = this.components[0];
  8006. super.addComponent.apply(this, [firstPoint]);
  8007. }
  8008. return removed;
  8009. }
  8010. /**
  8011. * @function SuperMap.Geometry.LinearRing.prototype.getArea
  8012. * @description 获得当前几何对象区域大小,如果是沿顺时针方向的环则是正值,否则为负值。
  8013. * @returns {float} 环的面积。
  8014. */
  8015. getArea() {
  8016. var area = 0.0;
  8017. if (this.components && (this.components.length > 2)) {
  8018. var sum = 0.0;
  8019. for (var i = 0, len = this.components.length; i < len - 1; i++) {
  8020. var b = this.components[i];
  8021. var c = this.components[i + 1];
  8022. sum += (b.x + c.x) * (c.y - b.y);
  8023. }
  8024. area = -sum / 2.0;
  8025. }
  8026. return area;
  8027. }
  8028. /**
  8029. * @function SuperMap.Geometry.LinearRing.prototype.getVertices
  8030. * @description 返回几何图形的所有点的列表。
  8031. * @param {boolean} [nodes] - 对于线来说,仅仅返回作为端点的顶点,如果设为 false ,则返回非端点的顶点,如果没有设置此参数,则返回所有顶点。
  8032. * @returns {Array} 几何对象所有点的列表。
  8033. */
  8034. getVertices(nodes) {
  8035. return (nodes === true) ? [] : this.components.slice(0, this.components.length - 1);
  8036. }
  8037. }
  8038. SuperMap.Geometry.LinearRing = LinearRing;
  8039. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/MultiLineString.js
  8040. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8041. * This program are made available under the terms of the Apache License, Version 2.0
  8042. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8043. /**
  8044. * @class SuperMap.Geometry.MultiLineString
  8045. * @classdesc 几何对象多线类。
  8046. * @category BaseTypes Geometry
  8047. * @extends {SuperMap.Geometry.Collection}
  8048. * @param {Array.<SuperMap.Geometry.LineString>} components - LineString 数组。
  8049. * @example
  8050. * var multi = new SuperMap.Geometry.MultiLineString([
  8051. * new SuperMap.Geometry.LineString([
  8052. * new SuperMap.Geometry.Point(1, 0),
  8053. * new SuperMap.Geometry.Point(0, 1)
  8054. * ])
  8055. * ]);
  8056. */
  8057. class MultiLineString extends Collection {
  8058. constructor(components) {
  8059. super(components);
  8060. /**
  8061. * @member {Array.<string>} [SuperMap.Geometry.MultiLineString.prototype.componentTypes=["SuperMap.Geometry.LineString"]]
  8062. * @description components 存储的的几何对象所支持的几何类型数组。
  8063. * @readonly
  8064. */
  8065. this.componentTypes = ["SuperMap.Geometry.LineString"];
  8066. this.CLASS_NAME = "SuperMap.Geometry.MultiLineString";
  8067. this.geometryType = "MultiLineString";
  8068. }
  8069. }
  8070. SuperMap.Geometry.MultiLineString = MultiLineString;
  8071. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/MultiPolygon.js
  8072. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8073. * This program are made available under the terms of the Apache License, Version 2.0
  8074. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8075. /**
  8076. * @class SuperMap.Geometry.MultiPolygon
  8077. * @classdesc 几何对象多多边形类。
  8078. * @category BaseTypes Geometry
  8079. * @extends {SuperMap.Geometry.Collection}
  8080. * @param {Array.<SuperMap.Geometry.Polygon>} components - 形成 MultiPolygon 的多边形数组。
  8081. * @example
  8082. * var points1 = [new SuperMap.Geometry.Point(10,10),new SuperMap.Geometry.Point(0,0)];
  8083. * var points2 = [new SuperMap.Geometry.Point(10,10),new SuperMap.Geometry.Point(0,0),new SuperMap.Geometry.Point(3,3),new SuperMap.Geometry.Point(10,10)];
  8084. *
  8085. * var linearRing1 = new SuperMap.Geometry.LinearRing(points1);
  8086. * var linearRing2 = new SuperMap.Geometry.LinearRing(points2);
  8087. *
  8088. * var polygon1 = new SuperMap.Geometry.Polygon([linearRing1]);
  8089. * var polygon2 = new SuperMap.Geometry.Polygon([linearRing2]);
  8090. *
  8091. * var multiPolygon1 = new SuperMap.Geometry.MultiPolygon([polygon1,polygon2]);
  8092. */
  8093. class MultiPolygon extends Collection {
  8094. constructor(components) {
  8095. super(components);
  8096. /**
  8097. * @member {Array.<string>} [SuperMap.Geometry.MultiPolygon.prototype.componentTypes=["SuperMap.Geometry.Polygon"]]
  8098. * @description components 存储的的几何对象所支持的几何类型数组。
  8099. * @readonly
  8100. */
  8101. this.componentTypes = ["SuperMap.Geometry.Polygon"];
  8102. this.CLASS_NAME = "SuperMap.Geometry.MultiPolygon";
  8103. this.geometryType = "MultiPolygon";
  8104. }
  8105. }
  8106. SuperMap.Geometry.MultiPolygon = MultiPolygon;
  8107. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Polygon.js
  8108. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8109. * This program are made available under the terms of the Apache License, Version 2.0
  8110. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8111. /**
  8112. * @class SuperMap.Geometry.Polygon
  8113. * @classdesc 多边形几何对象类。
  8114. * @category BaseTypes Geometry
  8115. * @extends {SuperMap.Geometry.Collection}
  8116. * @param {Array.<SuperMap.Geometry.LinearRing>} components - 用来生成多边形的线环数组。
  8117. * @example
  8118. * var points =[new SuperMap.Geometry.Point(0,4010338),
  8119. * new SuperMap.Geometry.Point(1063524,4010338),
  8120. * new SuperMap.Geometry.Point(1063524,3150322),
  8121. * new SuperMap.Geometry.Point(0,3150322)
  8122. * ],
  8123. * var linearRings = new SuperMap.Geometry.LinearRing(points),
  8124. * var region = new SuperMap.Geometry.Polygon([linearRings]);
  8125. */
  8126. class Polygon extends Collection {
  8127. constructor(components) {
  8128. super(components);
  8129. /**
  8130. * @member {Array.<string>} [SuperMap.Geometry.Polygon.prototype.componentTypes=["SuperMap.Geometry.LinearRing"]]
  8131. * @description components 存储的的几何对象所支持的几何类型数组。
  8132. * @readonly
  8133. */
  8134. this.componentTypes = ["SuperMap.Geometry.LinearRing"];
  8135. this.CLASS_NAME = "SuperMap.Geometry.Polygon";
  8136. this.geometryType = "Polygon";
  8137. }
  8138. /**
  8139. * @function SuperMap.Geometry.Polygon.prototype.getArea
  8140. * @description 获得区域面积,从区域的外部口径减去计此区域内部口径算所得的面积。
  8141. * @returns {float} 几何对象的面积。
  8142. */
  8143. getArea() {
  8144. var area = 0.0;
  8145. if (this.components && (this.components.length > 0)) {
  8146. area += Math.abs(this.components[0].getArea());
  8147. for (var i = 1, len = this.components.length; i < len; i++) {
  8148. area -= Math.abs(this.components[i].getArea());
  8149. }
  8150. }
  8151. return area;
  8152. }
  8153. }
  8154. SuperMap.Geometry.Polygon = Polygon;
  8155. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Rectangle.js
  8156. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8157. * This program are made available under the terms of the Apache License, Version 2.0
  8158. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8159. /**
  8160. * @class SuperMap.Geometry.Rectangle
  8161. * @classdesc 矩形几何对象类。
  8162. * @category BaseTypes Geometry
  8163. * @param {float} x - 矩形左下角点的横坐标。
  8164. * @param {float} y - 矩形左下角点的纵坐标。
  8165. * @param {float} width - 矩形的宽度。
  8166. * @param {float} height - 矩形的高度。
  8167. * @extends {SuperMap.Geometry}
  8168. * @example
  8169. * //x 为矩形左下角点的横坐标;y 为矩形左下角点的纵坐标;w 为矩形的宽度;h 为矩形的高度
  8170. * var x = 1;
  8171. * var y = 2;
  8172. * var w = 10;
  8173. * var h = 20;
  8174. * var recttangle = new SuperMap.Geometry.Rectangle(x, y, w, h);
  8175. */
  8176. class Rectangle extends Geometry {
  8177. constructor(x, y, width, height) {
  8178. super(x, y, width, height);
  8179. /**
  8180. * @member {float} SuperMap.Geometry.Rectangle.prototype.x
  8181. * @description 矩形左下角点的横坐标。
  8182. */
  8183. this.x = x;
  8184. /**
  8185. * @member {float} SuperMap.Geometry.Rectangle.prototype.y
  8186. * @description 矩形左下角点的纵坐标。
  8187. */
  8188. this.y = y;
  8189. /**
  8190. * @member {float} SuperMap.Geometry.Rectangle.prototype.width
  8191. * @description 矩形的宽度。
  8192. */
  8193. this.width = width;
  8194. /**
  8195. * @member {float} SuperMap.Geometry.Rectangle.prototype.height
  8196. * @description 矩形的高度。
  8197. */
  8198. this.height = height;
  8199. this.CLASS_NAME = "SuperMap.Geometry.Rectangle";
  8200. this.geometryType = "Rectangle";
  8201. }
  8202. /**
  8203. * @function SuperMap.Geometry.Rectangle.prototype.calculateBounds
  8204. * @description 计算出此矩形对象的 bounds。
  8205. */
  8206. calculateBounds() {
  8207. this.bounds = new Bounds(this.x, this.y,
  8208. this.x + this.width,
  8209. this.y + this.height);
  8210. }
  8211. /**
  8212. * @function SuperMap.Geometry.Rectangle.prototype.getArea
  8213. * @description 获取矩形对象的面积。
  8214. * @returns {float} 矩形对象面积。
  8215. */
  8216. getArea() {
  8217. var area = this.width * this.height;
  8218. return area;
  8219. }
  8220. }
  8221. SuperMap.Geometry.Rectangle = Rectangle;
  8222. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/index.js
  8223. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8224. * This program are made available under the terms of the Apache License, Version 2.0
  8225. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8226. ;// CONCATENATED MODULE: ./src/common/commontypes/Credential.js
  8227. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8228. * This program are made available under the terms of the Apache License, Version 2.0
  8229. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8230. /**
  8231. * @class SuperMap.Credential
  8232. * @category Security
  8233. * @classdesc SuperMap 的安全证书类,其中包括 token 等安全验证信息。</br>
  8234. * 需要使用用户名和密码在:"http://localhost:8090/iserver/services/security/tokens" 下申请 value。</br>
  8235. * 获得形如:"2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ.." 的 value。</br>
  8236. * 目前支持的功能包括:地图服务、专题图、量算、查询、公交换乘、空间分析、网络分析,不支持轮询功能。</br>
  8237. * @param {string} value - 访问受安全限制的服务时用于通过安全认证的验证信息。
  8238. * @param {string} [name='token'] - 验证信息前缀,name=value 部分的 name 部分。
  8239. * @example
  8240. * var pixcel = new SuperMap.Credential("valueString","token");
  8241. * pixcel.destroy();
  8242. */
  8243. class Credential {
  8244. constructor(value, name) {
  8245. /**
  8246. * @member {string} SuperMap.Bounds.prototype.value
  8247. * @description 访问受安全限制的服务时用于通过安全认证的验证信息。
  8248. */
  8249. this.value = value ? value : "";
  8250. /**
  8251. * @member {string} [SuperMap.Bounds.prototype.name='token']
  8252. * @description 验证信息前缀,name=value 部分的 name 部分。
  8253. */
  8254. this.name = name ? name : "token";
  8255. this.CLASS_NAME = "SuperMap.Credential";
  8256. }
  8257. /**
  8258. * @function SuperMap.Credential.prototype.getUrlParameters
  8259. * @example
  8260. * var credential = new SuperMap.Credential("valueString","token");
  8261. * //这里 str = "token=valueString";
  8262. * var str = credential.getUrlParameters();
  8263. * @returns {string} 返回安全信息组成的 url 片段。
  8264. */
  8265. getUrlParameters() {
  8266. //当需要其他安全信息的时候,则需要return this.name + "=" + this.value + "&" + "...";的形式添加。
  8267. return this.name + "=" + this.value;
  8268. }
  8269. /**
  8270. * @function SuperMap.Bounds.prototype.getValue
  8271. * @description 获取 value。
  8272. * @example
  8273. * var credential = new SuperMap.Credential("2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ..","token");
  8274. * //这里 str = "2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ..";
  8275. * var str = credential.getValue();
  8276. * @returns {string} 返回 value 字符串,在 iServer 服务下该 value 值即为 token 值。
  8277. */
  8278. getValue() {
  8279. return this.value;
  8280. }
  8281. /**
  8282. *
  8283. * @function SuperMap.Credential.prototype.destroy
  8284. * @description 销毁此对象。销毁后此对象的所有属性为 null,而不是初始值。
  8285. * @example
  8286. * var credential = new SuperMap.Credential("valueString","token");
  8287. * credential.destroy();
  8288. */
  8289. destroy() {
  8290. this.value = null;
  8291. this.name = null;
  8292. }
  8293. }
  8294. /**
  8295. * @member {SuperMap.Credential} SuperMap.Credential.CREDENTIAL
  8296. * @description 这个对象保存一个安全类的实例,在服务端需要安全验证的时候必须进行设置。
  8297. * @constant
  8298. * @example
  8299. * 代码实例:
  8300. * // 当iServer启用服务安全的时候,下边的代码是必须的。安全证书类能够接收一个value和一个name参数。
  8301. * var value = "(以iServer为例,这里是申请的token值)";
  8302. * var name = "token";
  8303. * // 默认name参数为token,所以当使用iServer服务的时候可以不进行设置。
  8304. * SuperMap.Credential.CREDENTIAL = new SuperMap.Credential(value, name);
  8305. *
  8306. */
  8307. Credential.CREDENTIAL = null;
  8308. SuperMap.Credential = Credential;
  8309. ;// CONCATENATED MODULE: ./src/common/commontypes/Date.js
  8310. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8311. * This program are made available under the terms of the Apache License, Version 2.0
  8312. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8313. /**
  8314. * @name Date
  8315. * @memberOf SuperMap
  8316. * @namespace
  8317. * @category BaseTypes Util
  8318. * @description 包含 parse、toISOString 方法的实现,两个方法用来解析 RFC 3339 日期,遵循 ECMAScript 5 规范。
  8319. */
  8320. var DateExt = SuperMap.Date = {
  8321. /**
  8322. * @description 生成代表一个具体的日期字符串,该日期遵循 ISO 8601 标准(详情查看{@link http://tools.ietf.org/html/rfc3339})。
  8323. * @example
  8324. * var dateString = SuperMap.Date.toISOString(new Date());
  8325. * @param {Date} date - 日期对象。
  8326. * @returns {string} 一个代表日期的字符串。(例如 "2010-08-07T16:58:23.123Z")。
  8327. */
  8328. toISOString: (function () {
  8329. //标准的Date会存在toISOString方法,可以直接调用
  8330. if ("toISOString" in Date.prototype) {
  8331. return function (date) {
  8332. return date.toISOString();
  8333. };
  8334. } else {// 部分浏览器没有,就得自己组合,组合后的字符串规则不变
  8335. function pad(num, len) {
  8336. var str = num + "";
  8337. while (str.length < len) {
  8338. str = "0" + str;
  8339. }
  8340. return str;
  8341. }
  8342. return function (date) {
  8343. var str;
  8344. if (isNaN(date.getTime())) {
  8345. // ECMA-262 says throw RangeError, Firefox returns
  8346. // "Invalid Date"
  8347. str = "Invalid Date";
  8348. } else {
  8349. str =
  8350. date.getUTCFullYear() + "-" +
  8351. pad(date.getUTCMonth() + 1, 2) + "-" +
  8352. pad(date.getUTCDate(), 2) + "T" +
  8353. pad(date.getUTCHours(), 2) + ":" +
  8354. pad(date.getUTCMinutes(), 2) + ":" +
  8355. pad(date.getUTCSeconds(), 2) + "." +
  8356. pad(date.getUTCMilliseconds(), 3) + "Z";
  8357. }
  8358. return str;
  8359. };
  8360. }
  8361. })(),
  8362. /**
  8363. * @description 从一个字符串生成一个日期对象。
  8364. * @example
  8365. * var date = SuperMap.Date.parse("2010-08-07");
  8366. * @param {string} str - 代表日期的字符串。(例如: "2010", "2010-08", "2010-08-07", "2010-08-07T16:58:23.123Z","2010-08-07T11:58:23.123-06")。
  8367. * @returns {Date} 日期对象,如果字符串无法被解析,则返回一个无效的日期。(例如 isNaN(date.getTime()))。
  8368. */
  8369. parse: function (str) {
  8370. var date;
  8371. 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)?$/);
  8372. if (match && (match[1] || match[7])) { // must have at least year or time
  8373. var year = parseInt(match[1], 10) || 0;
  8374. var month = (parseInt(match[2], 10) - 1) || 0;
  8375. var day = parseInt(match[3], 10) || 1;
  8376. date = new Date(Date.UTC(year, month, day));
  8377. // optional time
  8378. var type = match[7];
  8379. if (type) {
  8380. var hours = parseInt(match[4], 10);
  8381. var minutes = parseInt(match[5], 10);
  8382. var secFrac = parseFloat(match[6]);
  8383. var seconds = secFrac | 0;
  8384. var milliseconds = Math.round(1000 * (secFrac - seconds));
  8385. date.setUTCHours(hours, minutes, seconds, milliseconds);
  8386. // check offset
  8387. if (type !== "Z") {
  8388. var hoursOffset = parseInt(type, 10);
  8389. var minutesOffset = parseInt(match[8], 10) || 0;
  8390. var offset = -1000 * (60 * (hoursOffset * 60) + minutesOffset * 60);
  8391. date = new Date(date.getTime() + offset);
  8392. }
  8393. }
  8394. } else {
  8395. date = new Date("invalid");
  8396. }
  8397. return date;
  8398. }
  8399. };
  8400. ;// CONCATENATED MODULE: ./src/common/commontypes/Event.js
  8401. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8402. * This program are made available under the terms of the Apache License, Version 2.0
  8403. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8404. /**
  8405. * @name Event
  8406. * @memberOf SuperMap
  8407. * @namespace
  8408. * @description 事件处理函数.
  8409. */
  8410. var Event = SuperMap.Event = {
  8411. /**
  8412. * @description A hash table cache of the event observers. Keyed by element._eventCacheID
  8413. * @type {boolean}
  8414. * @default false
  8415. */
  8416. observers: false,
  8417. /**
  8418. * @description KEY_SPACE
  8419. * @type {number}
  8420. * @default 32
  8421. */
  8422. KEY_SPACE: 32,
  8423. /**
  8424. * @description KEY_BACKSPACE
  8425. * @type {number}
  8426. * @default 8
  8427. */
  8428. KEY_BACKSPACE: 8,
  8429. /**
  8430. * @description KEY_TAB
  8431. * @type {number}
  8432. * @default 9
  8433. */
  8434. KEY_TAB: 9,
  8435. /**
  8436. * @description KEY_RETURN
  8437. * @type {number}
  8438. * @default 13
  8439. */
  8440. KEY_RETURN: 13,
  8441. /**
  8442. * @description KEY_ESC
  8443. * @type {number}
  8444. * @default 27
  8445. */
  8446. KEY_ESC: 27,
  8447. /**
  8448. * @description KEY_LEFT
  8449. * @type {number}
  8450. * @default 37
  8451. */
  8452. KEY_LEFT: 37,
  8453. /**
  8454. * @description KEY_UP
  8455. * @type {number}
  8456. * @default 38
  8457. */
  8458. KEY_UP: 38,
  8459. /**
  8460. * @description KEY_RIGHT
  8461. * @type {number}
  8462. * @default 39
  8463. */
  8464. KEY_RIGHT: 39,
  8465. /**
  8466. * @description KEY_DOWN
  8467. * @type {number}
  8468. * @default 40
  8469. */
  8470. KEY_DOWN: 40,
  8471. /**
  8472. * @description KEY_DELETE
  8473. * @type {number}
  8474. * @default 46
  8475. */
  8476. KEY_DELETE: 46,
  8477. /**
  8478. * @description Cross browser event element detection.
  8479. * @param {Event} event - The event
  8480. * @returns {HTMLElement} The element that caused the event
  8481. */
  8482. element: function (event) {
  8483. return event.target || event.srcElement;
  8484. },
  8485. /**
  8486. * @description Determine whether event was caused by a single touch
  8487. * @param {Event} event - The event
  8488. * @returns {boolean}
  8489. */
  8490. isSingleTouch: function (event) {
  8491. return event.touches && event.touches.length === 1;
  8492. },
  8493. /**
  8494. * @description Determine whether event was caused by a multi touch
  8495. * @param {Event} event - The event
  8496. * @returns {boolean}
  8497. */
  8498. isMultiTouch: function (event) {
  8499. return event.touches && event.touches.length > 1;
  8500. },
  8501. /**
  8502. * @description Determine whether event was caused by a left click.
  8503. * @param {Event} event - The event
  8504. * @returns {boolean}
  8505. */
  8506. isLeftClick: function (event) {
  8507. return (((event.which) && (event.which === 1)) ||
  8508. ((event.button) && (event.button === 1)));
  8509. },
  8510. /**
  8511. * @description Determine whether event was caused by a right mouse click.
  8512. * @param {Event} event - The event
  8513. * @returns {boolean}
  8514. */
  8515. isRightClick: function (event) {
  8516. return (((event.which) && (event.which === 3)) ||
  8517. ((event.button) && (event.button === 2)));
  8518. },
  8519. /**
  8520. * @description Stops an event from propagating.
  8521. * @param {Event} event - The event
  8522. * @param {boolean} allowDefault - If true, we stop the event chain but still allow the default browser behaviour (text selection, radio-button clicking, etc) Default false
  8523. */
  8524. stop: function (event, allowDefault) {
  8525. if (!allowDefault) {
  8526. if (event.preventDefault) {
  8527. event.preventDefault();
  8528. } else {
  8529. event.returnValue = false;
  8530. }
  8531. }
  8532. if (event.stopPropagation) {
  8533. event.stopPropagation();
  8534. } else {
  8535. event.cancelBubble = true;
  8536. }
  8537. },
  8538. /**
  8539. * @param {Event} event - The event。
  8540. * @param {string} tagName - html 标签名。
  8541. * @returns {HTMLElement} The first node with the given tagName, starting from the node the event was triggered on and traversing the DOM upwards
  8542. */
  8543. findElement: function (event, tagName) {
  8544. var element = SuperMap.Event.element(event);
  8545. while (element.parentNode && (!element.tagName ||
  8546. (element.tagName.toUpperCase() != tagName.toUpperCase()))) {
  8547. element = element.parentNode;
  8548. }
  8549. return element;
  8550. },
  8551. /**
  8552. * @description 监听事件,注册事件处理方法。
  8553. * @param {(HTMLElement|string)} elementParam - 待监听的 DOM 对象或者其 ID 标识。
  8554. * @param {string} name - 监听事件的类别名称。
  8555. * @param {function} observer - 注册的事件处理方法。
  8556. * @param {boolean} [useCapture=false] - 是否捕获。
  8557. */
  8558. observe: function (elementParam, name, observer, useCapture) {
  8559. var element = Util.getElement(elementParam);
  8560. useCapture = useCapture || false;
  8561. if (name === 'keypress' &&
  8562. (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
  8563. || element.attachEvent)) {
  8564. name = 'keydown';
  8565. }
  8566. //if observers cache has not yet been created, create it
  8567. if (!this.observers) {
  8568. this.observers = {};
  8569. }
  8570. //if not already assigned, make a new unique cache ID
  8571. if (!element._eventCacheID) {
  8572. var idPrefix = "eventCacheID_";
  8573. if (element.id) {
  8574. idPrefix = element.id + "_" + idPrefix;
  8575. }
  8576. element._eventCacheID = Util.createUniqueID(idPrefix);
  8577. }
  8578. var cacheID = element._eventCacheID;
  8579. //if there is not yet a hash entry for this element, add one
  8580. if (!this.observers[cacheID]) {
  8581. this.observers[cacheID] = [];
  8582. }
  8583. //add a new observer to this element's list
  8584. this.observers[cacheID].push({
  8585. 'element': element,
  8586. 'name': name,
  8587. 'observer': observer,
  8588. 'useCapture': useCapture
  8589. });
  8590. //add the actual browser event listener
  8591. if (element.addEventListener) {
  8592. if(name === 'mousewheel'){
  8593. // https://www.chromestatus.com/features/6662647093133312
  8594. element.addEventListener(name, observer, {useCapture: useCapture, passive: false} );
  8595. } else {
  8596. element.addEventListener(name, observer, useCapture);
  8597. }
  8598. } else if (element.attachEvent) {
  8599. element.attachEvent('on' + name, observer);
  8600. }
  8601. },
  8602. /**
  8603. * @description Given the id of an element to stop observing, cycle through the
  8604. * element's cached observers, calling stopObserving on each one,
  8605. * skipping those entries which can no longer be removed.
  8606. *
  8607. * @param {(HTMLElement|string)} elementParam -
  8608. */
  8609. stopObservingElement: function (elementParam) {
  8610. var element = Util.getElement(elementParam);
  8611. var cacheID = element._eventCacheID;
  8612. this._removeElementObservers(SuperMap.Event.observers[cacheID]);
  8613. },
  8614. /**
  8615. * @param {Array.<Object>} elementObservers - Array of (element, name,
  8616. * observer, usecapture) objects,
  8617. * taken directly from hashtable
  8618. */
  8619. _removeElementObservers: function (elementObservers) {
  8620. if (elementObservers) {
  8621. for (var i = elementObservers.length - 1; i >= 0; i--) {
  8622. var entry = elementObservers[i];
  8623. var args = new Array(entry.element, entry.name, entry.observer, entry.useCapture);
  8624. SuperMap.Event.stopObserving.apply(this, args);
  8625. }
  8626. }
  8627. },
  8628. /**
  8629. * @description 移除事件监听和注册的事件处理方法。注意:事件的移除和监听相对应,移除时的各属性信息必须监听时
  8630. * 保持一致才能确保事件移除成功。
  8631. * @param {(HTMLElement|string)} elementParam - 被监听的 DOM 元素或者其 ID。
  8632. * @param {string} name - 需要移除的被监听事件名称。
  8633. * @param {function} observer - 需要移除的事件处理方法。
  8634. * @param {boolean} [useCapture=false] - 是否捕获。
  8635. * @returns {boolean} Whether or not the event observer was removed
  8636. */
  8637. stopObserving: function (elementParam, name, observer, useCapture) {
  8638. useCapture = useCapture || false;
  8639. var element = Util.getElement(elementParam);
  8640. var cacheID = element._eventCacheID;
  8641. if (name === 'keypress') {
  8642. if (navigator.appVersion.match(/Konqueror|Safari|KHTML/) ||
  8643. element.detachEvent) {
  8644. name = 'keydown';
  8645. }
  8646. }
  8647. // find element's entry in this.observers cache and remove it
  8648. var foundEntry = false;
  8649. var elementObservers = SuperMap.Event.observers[cacheID];
  8650. if (elementObservers) {
  8651. // find the specific event type in the element's list
  8652. var i = 0;
  8653. while (!foundEntry && i < elementObservers.length) {
  8654. var cacheEntry = elementObservers[i];
  8655. if ((cacheEntry.name === name) &&
  8656. (cacheEntry.observer === observer) &&
  8657. (cacheEntry.useCapture === useCapture)) {
  8658. elementObservers.splice(i, 1);
  8659. if (elementObservers.length == 0) {
  8660. delete SuperMap.Event.observers[cacheID];
  8661. }
  8662. foundEntry = true;
  8663. break;
  8664. }
  8665. i++;
  8666. }
  8667. }
  8668. //actually remove the event listener from browser
  8669. if (foundEntry) {
  8670. if (element.removeEventListener) {
  8671. element.removeEventListener(name, observer, useCapture);
  8672. } else if (element && element.detachEvent) {
  8673. element.detachEvent('on' + name, observer);
  8674. }
  8675. }
  8676. return foundEntry;
  8677. },
  8678. /**
  8679. * @description Cycle through all the element entries in the events cache and call
  8680. * stopObservingElement on each.
  8681. */
  8682. unloadCache: function () {
  8683. // check for SuperMap.Event before checking for observers, because
  8684. // SuperMap.Event may be undefined in IE if no map instance was
  8685. // created
  8686. if (SuperMap.Event && SuperMap.Event.observers) {
  8687. for (var cacheID in SuperMap.Event.observers) {
  8688. var elementObservers = SuperMap.Event.observers[cacheID];
  8689. SuperMap.Event._removeElementObservers.apply(this,
  8690. [elementObservers]);
  8691. }
  8692. SuperMap.Event.observers = false;
  8693. }
  8694. },
  8695. CLASS_NAME: "SuperMap.Event"
  8696. };
  8697. SuperMap.Event = Event;
  8698. /* prevent memory leaks in IE */
  8699. SuperMap.Event.observe(window, 'unload', SuperMap.Event.unloadCache, false);
  8700. ;// CONCATENATED MODULE: ./src/common/commontypes/Events.js
  8701. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8702. * This program are made available under the terms of the Apache License, Version 2.0
  8703. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8704. /**
  8705. * @class SuperMap.Events
  8706. * @classdesc 事件类。
  8707. * @param {Object} object - 当前事件对象被添加到的 JS 对象。
  8708. * @param {HTMLElement} element - 响应浏览器事件的 DOM 元素。
  8709. * @param {Array.<string>} eventTypes - 自定义应用事件的数组。
  8710. * @param {boolean} [fallThrough=false] - 是否允许事件处理之后向上传递(冒泡),为 false 的时候阻止事件冒泡。
  8711. * @param {Object} options - 事件对象选项。
  8712. */
  8713. class Events {
  8714. constructor(object, element, eventTypes, fallThrough, options) {
  8715. /**
  8716. * @member {Array.<string>} SuperMap.Events.prototype.BROWSER_EVENTS
  8717. * @description 支持的事件。
  8718. * @constant
  8719. * @default [
  8720. "mouseover", "mouseout","mousedown", "mouseup", "mousemove",
  8721. "click", "dblclick", "rightclick", "dblrightclick","resize",
  8722. "focus", "blur","touchstart", "touchmove", "touchend","keydown",
  8723. "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
  8724. "MSGestureStart", "MSGestureChange", "MSGestureEnd","contextmenu"
  8725. ]
  8726. */
  8727. this.BROWSER_EVENTS = [
  8728. "mouseover", "mouseout",
  8729. "mousedown", "mouseup", "mousemove",
  8730. "click", "dblclick", "rightclick", "dblrightclick",
  8731. "resize", "focus", "blur",
  8732. "touchstart", "touchmove", "touchend",
  8733. "keydown", "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
  8734. "MSGestureStart", "MSGestureChange", "MSGestureEnd",
  8735. "contextmenu"
  8736. ];
  8737. /**
  8738. * @member {Object} SuperMap.Events.prototype.listeners
  8739. * @description Hashtable of Array(function): events listener functions
  8740. */
  8741. this.listeners = {};
  8742. /**
  8743. * @member {Object} SuperMap.Events.prototype.object
  8744. * @description 发布应用程序事件的对象。
  8745. */
  8746. this.object = object;
  8747. /**
  8748. * @member {HTMLElement} SuperMap.Events.prototype.element
  8749. * @description 接受浏览器事件的 DOM 节点。
  8750. */
  8751. this.element = null;
  8752. /**
  8753. * @member {Array.<string>} SuperMap.Events.prototype.eventTypes
  8754. * @description 支持的事件类型列表。
  8755. */
  8756. this.eventTypes = [];
  8757. /**
  8758. * @member {function} SuperMap.Events.prototype.eventHandler
  8759. * @description 绑定在元素上的事件处理器对象。
  8760. */
  8761. this.eventHandler = null;
  8762. /**
  8763. * @member {boolean} [SuperMap.Events.prototype.fallThrough=false]
  8764. * @description 是否允许事件处理之后向上传递(冒泡),为 false 的时候阻止事件冒泡。
  8765. */
  8766. this.fallThrough = fallThrough;
  8767. /**
  8768. * @member {boolean} [SuperMap.Events.prototype.includeXY=false]
  8769. * @description 判断是否让 xy 属性自动创建到浏览器上的鼠标事件,一般设置为 false,如果设置为 true,鼠标事件将会在事件传递过程中自动产生 xy 属性。
  8770. * 可根据事件对象的 'evt.object' 属性在相关的事件句柄上调用 getMousePosition 函数。这个选项习惯默认为 false 的原因在于,当创建一个
  8771. * 事件对象,其主要目的是管理。在一个 div 的相对定位的鼠标事件,将其设为 true 也是有意义的。这个选项也可以用来控制是否抵消缓存。如果
  8772. * 设为 false 不抵消,如果设为 true,用 this.clearMouseCache() 清除缓存偏移(边界元素偏移,元素在页面的位置偏移)。
  8773. * @example
  8774. * function named(evt) {
  8775. * this.xy = this.object.events.getMousePosition(evt);
  8776. * }
  8777. */
  8778. this.includeXY = false;
  8779. /**
  8780. * @member {Object} SuperMap.Events.prototype.extensions
  8781. * @description 事件扩展。Keys 代表事件类型,values 代表事件对象。
  8782. * @example
  8783. * 以扩展 "foostart" 和 "fooend" 事件为例。展示替换 css 属性为 foo 的元素的 click 事件。
  8784. *
  8785. * SuperMap.Events.foostart = SuperMap.Class({
  8786. * initialize: function(target) {
  8787. * this.target = target;
  8788. * this.target.register("click", this, this.doStuff, {extension: true});
  8789. * // only required if extension provides more than one event type
  8790. * this.target.extensions["foostart"] = true;
  8791. * this.target.extensions["fooend"] = true;
  8792. * },
  8793. * destroy: function() {
  8794. * var target = this.target;
  8795. * target.unregister("click", this, this.doStuff);
  8796. * delete this.target;
  8797. * // only required if extension provides more than one event type
  8798. * delete target.extensions["foostart"];
  8799. * delete target.extensions["fooend"];
  8800. * },
  8801. * doStuff: function(evt) {
  8802. * var propagate = true;
  8803. * if (SuperMap.Event.element(evt).className === "foo") {
  8804. * propagate = false;
  8805. * var target = this.target;
  8806. * target.triggerEvent("foostart");
  8807. * window.setTimeout(function() {
  8808. * target.triggerEvent("fooend");
  8809. * }, 1000);
  8810. * }
  8811. * return propagate;
  8812. * }
  8813. * });
  8814. * // only required if extension provides more than one event type
  8815. * SuperMap.Events.fooend = SuperMap.Events.foostart;
  8816. */
  8817. this.extensions = {};
  8818. /**
  8819. * @member {Object} SuperMap.Events.prototype.extensionCount
  8820. */
  8821. this.extensionCount = {};
  8822. /**
  8823. * @member {Object} SuperMap.Events.prototype.clearMouseListener
  8824. */
  8825. this.clearMouseListener = null;
  8826. Util.extend(this, options);
  8827. if (eventTypes != null) {
  8828. for (var i = 0, len = eventTypes.length; i < len; i++) {
  8829. this.addEventType(eventTypes[i]);
  8830. }
  8831. }
  8832. if (element != null) {
  8833. this.attachToElement(element);
  8834. }
  8835. this.CLASS_NAME = "SuperMap.Events";
  8836. }
  8837. /**
  8838. * @function SuperMap.Events.prototype.destroy
  8839. * @description 移除当前要素 element 上的所有事件监听和处理。
  8840. */
  8841. destroy() {
  8842. for (var e in this.extensions) {
  8843. if (typeof this.extensions[e] !== "boolean") {
  8844. this.extensions[e].destroy();
  8845. }
  8846. }
  8847. this.extensions = null;
  8848. if (this.element) {
  8849. Event.stopObservingElement(this.element);
  8850. if (this.element.hasScrollEvent) {
  8851. Event.stopObserving(
  8852. window, "scroll", this.clearMouseListener
  8853. );
  8854. }
  8855. }
  8856. this.element = null;
  8857. this.listeners = null;
  8858. this.object = null;
  8859. this.eventTypes = null;
  8860. this.fallThrough = null;
  8861. this.eventHandler = null;
  8862. }
  8863. /**
  8864. * @function SuperMap.Events.prototype.addEventType
  8865. * @description 在此事件对象中添加新的事件类型,如果这个事件类型已经添加过了,则不做任何事情。
  8866. * @param {string} eventName - 事件名。
  8867. */
  8868. addEventType(eventName) {
  8869. if (!this.listeners[eventName]) {
  8870. this.eventTypes.push(eventName);
  8871. this.listeners[eventName] = [];
  8872. }
  8873. }
  8874. /**
  8875. * @function SuperMap.Events.prototype.attachToElement
  8876. * @description 给 DOM 元素绑定浏览器事件。
  8877. * @param {HTMLDOMElement} element - 绑定浏览器事件的 DOM 元素。
  8878. */
  8879. attachToElement(element) {
  8880. if (this.element) {
  8881. Event.stopObservingElement(this.element);
  8882. } else {
  8883. // keep a bound copy of handleBrowserEvent() so that we can
  8884. // pass the same function to both Event.observe() and .stopObserving()
  8885. this.eventHandler = FunctionExt.bindAsEventListener(
  8886. this.handleBrowserEvent, this
  8887. );
  8888. // to be used with observe and stopObserving
  8889. this.clearMouseListener = FunctionExt.bind(
  8890. this.clearMouseCache, this
  8891. );
  8892. }
  8893. this.element = element;
  8894. for (var i = 0, len = this.BROWSER_EVENTS.length; i < len; i++) {
  8895. var eventType = this.BROWSER_EVENTS[i];
  8896. // every browser event has a corresponding application event
  8897. // (whether it's listened for or not).
  8898. this.addEventType(eventType);
  8899. // use Prototype to register the event cross-browser
  8900. Event.observe(element, eventType, this.eventHandler);
  8901. }
  8902. // disable dragstart in IE so that mousedown/move/up works normally
  8903. Event.observe(element, "dragstart", Event.stop);
  8904. }
  8905. /**
  8906. * @function SuperMap.Events.prototype.on
  8907. * @description 在一个相同的范围内注册监听器的方法,此方法调用 register 函数。
  8908. * @example
  8909. * // 注册一个 "loadstart" 监听事件
  8910. * events.on({"loadstart": loadStartListener});
  8911. *
  8912. * // 同样注册一个 "loadstart" 监听事件
  8913. * events.register("loadstart", undefined, loadStartListener);
  8914. *
  8915. * // 同时为对象注册多个监听事件
  8916. * events.on({
  8917. * "loadstart": loadStartListener,
  8918. * "loadend": loadEndListener,
  8919. * scope: object
  8920. * });
  8921. *
  8922. * // 同时为对象注册多个监听事件,多次调用 register 方法
  8923. * events.register("loadstart", object, loadStartListener);
  8924. * events.register("loadend", object, loadEndListener);
  8925. *
  8926. *
  8927. * @param {Object} object - 添加监听的对象。
  8928. */
  8929. on(object) {
  8930. for (var type in object) {
  8931. if (type !== "scope" && object.hasOwnProperty(type)) {
  8932. this.register(type, object.scope, object[type]);
  8933. }
  8934. }
  8935. }
  8936. /**
  8937. * @function SuperMap.Events.prototype.register
  8938. * @description 在事件对象上注册一个事件。当事件被触发时,'func' 函数被调用,假设我们触发一个事件,
  8939. * 指定 SuperMap.Bounds 作为 "obj",当事件被触发时,回调函数的上下文作为 Bounds 对象。
  8940. * @param {string} type - 事件注册者的名字。
  8941. * @param {Object} [obj=this.object] - 对象绑定的回调。
  8942. * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
  8943. * @param {(boolean|Object)} [priority] - 当为 true 时将新的监听加在事件队列的前面。
  8944. */
  8945. register(type, obj, func, priority) {
  8946. if (type in Events && !this.extensions[type]) {
  8947. this.extensions[type] = new Events[type](this);
  8948. }
  8949. if ((func != null) &&
  8950. (Util.indexOf(this.eventTypes, type) !== -1)) {
  8951. if (obj == null) {
  8952. obj = this.object;
  8953. }
  8954. var listeners = this.listeners[type];
  8955. if (!listeners) {
  8956. listeners = [];
  8957. this.listeners[type] = listeners;
  8958. this.extensionCount[type] = 0;
  8959. }
  8960. var listener = {obj: obj, func: func};
  8961. if (priority) {
  8962. listeners.splice(this.extensionCount[type], 0, listener);
  8963. if (typeof priority === "object" && priority.extension) {
  8964. this.extensionCount[type]++;
  8965. }
  8966. } else {
  8967. listeners.push(listener);
  8968. }
  8969. }
  8970. }
  8971. /**
  8972. * @function SuperMap.Events.prototype.registerPriority
  8973. * @description 相同的注册方法,但是在前面增加新的监听者事件查询而代替到方法的结束。
  8974. * @param {string} type - 事件注册者的名字。
  8975. * @param {Object} [obj=this.object] - 对象绑定方面的回调。
  8976. * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
  8977. */
  8978. registerPriority(type, obj, func) {
  8979. this.register(type, obj, func, true);
  8980. }
  8981. /**
  8982. * @function SuperMap.Events.prototype.un
  8983. * @description 在一个相同的范围内取消注册监听器的方法,此方法调用 unregister 函数。
  8984. * @example
  8985. * // 移除 "loadstart" 事件监听
  8986. * events.un({"loadstart": loadStartListener});
  8987. *
  8988. * // 使用 "unregister" 方法移除 "loadstart" 事件监听
  8989. * events.unregister("loadstart", undefined, loadStartListener);
  8990. *
  8991. * // 取消对象多个事件监听
  8992. * events.un({
  8993. * "loadstart": loadStartListener,
  8994. * "loadend": loadEndListener,
  8995. * scope: object
  8996. * });
  8997. *
  8998. * // 取消对象多个事件监听,多次调用unregister方法。
  8999. * events.unregister("loadstart", object, loadStartListener);
  9000. * events.unregister("loadend", object, loadEndListener);
  9001. *
  9002. * @param {Object} object - 移除监听的对象。
  9003. */
  9004. un(object) {
  9005. for (var type in object) {
  9006. if (type !== "scope" && object.hasOwnProperty(type)) {
  9007. this.unregister(type, object.scope, object[type]);
  9008. }
  9009. }
  9010. }
  9011. /**
  9012. * @function SuperMap.Events.prototype.unregister
  9013. * @description 取消注册。
  9014. * @param {string} type - 事件类型。
  9015. * @param {Object} [obj=this.object] - 对象绑定方面的回调。
  9016. * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
  9017. */
  9018. unregister(type, obj, func) {
  9019. if (obj == null) {
  9020. obj = this.object;
  9021. }
  9022. var listeners = this.listeners[type];
  9023. if (listeners != null) {
  9024. for (var i = 0, len = listeners.length; i < len; i++) {
  9025. if (listeners[i].obj === obj && listeners[i].func === func) {
  9026. listeners.splice(i, 1);
  9027. break;
  9028. }
  9029. }
  9030. }
  9031. }
  9032. /**
  9033. * @function SuperMap.Events.prototype.remove
  9034. * @description 删除某个事件类型的所有监听,如果该事件类型没有注册,则不做任何操作。
  9035. * @param {string} type - 事件类型。
  9036. */
  9037. remove(type) {
  9038. if (this.listeners[type] != null) {
  9039. this.listeners[type] = [];
  9040. }
  9041. }
  9042. /**
  9043. * @function SuperMap.Events.prototype.triggerEvent
  9044. * @description 触发一个特定的注册事件。
  9045. * @param {string} type - 触发事件类型。
  9046. * @param {Event} evt - 事件对象。
  9047. * @returns {boolean} 返回监听对象,如果返回是 false,则停止监听。
  9048. */
  9049. triggerEvent(type, evt) {
  9050. var listeners = this.listeners[type];
  9051. // fast path
  9052. if (!listeners || listeners.length == 0) {
  9053. return undefined;
  9054. }
  9055. // prep evt object with object & div references
  9056. if (evt == null) {
  9057. evt = {};
  9058. }
  9059. evt.object = this.object;
  9060. evt.element = this.element;
  9061. if (!evt.type) {
  9062. evt.type = type;
  9063. }
  9064. // execute all callbacks registered for specified type
  9065. // get a clone of the listeners array to
  9066. // allow for splicing during callbacks
  9067. listeners = listeners.slice();
  9068. var continueChain;
  9069. for (var i = 0, len = listeners.length; i < len; i++) {
  9070. var callback = listeners[i];
  9071. // bind the context to callback.obj
  9072. continueChain = callback.func.apply(callback.obj, [evt]);
  9073. if ((continueChain != undefined) && (continueChain === false)) {
  9074. // if callback returns false, execute no more callbacks.
  9075. break;
  9076. }
  9077. }
  9078. // don't fall through to other DOM elements
  9079. if (!this.fallThrough) {
  9080. Event.stop(evt, true);
  9081. }
  9082. return continueChain;
  9083. }
  9084. /**
  9085. * @function SuperMap.Events.prototype.handleBrowserEvent
  9086. * @description 对 triggerEvent 函数的包装,给事件对象设置了 xy 属性(即当前鼠标点的 xy 坐标)。
  9087. * @param {Event} evt - 事件对象。
  9088. */
  9089. handleBrowserEvent(evt) {
  9090. var type = evt.type, listeners = this.listeners[type];
  9091. if (!listeners || listeners.length == 0) {
  9092. // noone's listening, bail out
  9093. return;
  9094. }
  9095. // add clientX & clientY to all events - corresponds to average x, y
  9096. var touches = evt.touches;
  9097. if (touches && touches[0]) {
  9098. var x = 0;
  9099. var y = 0;
  9100. var num = touches.length;
  9101. var touch;
  9102. for (var i = 0; i < num; ++i) {
  9103. touch = touches[i];
  9104. x += touch.clientX;
  9105. y += touch.clientY;
  9106. }
  9107. evt.clientX = x / num;
  9108. evt.clientY = y / num;
  9109. }
  9110. if (this.includeXY) {
  9111. evt.xy = this.getMousePosition(evt);
  9112. }
  9113. this.triggerEvent(type, evt);
  9114. }
  9115. /**
  9116. * @function SuperMap.Events.prototype.clearMouseCache
  9117. * @description 清除鼠标缓存。
  9118. */
  9119. clearMouseCache() {
  9120. this.element.scrolls = null;
  9121. this.element.lefttop = null;
  9122. var body = document.body;
  9123. if (body && !((body.scrollTop != 0 || body.scrollLeft != 0) &&
  9124. navigator.userAgent.match(/iPhone/i))) {
  9125. this.element.offsets = null;
  9126. }
  9127. }
  9128. /**
  9129. * @function SuperMap.Events.prototype.getMousePosition
  9130. * @param {Event} evt - 事件对象。
  9131. * @returns {SuperMap.Pixel} 当前的鼠标的 xy 坐标点。
  9132. */
  9133. getMousePosition(evt) {
  9134. if (!this.includeXY) {
  9135. this.clearMouseCache();
  9136. } else if (!this.element.hasScrollEvent) {
  9137. Event.observe(window, "scroll", this.clearMouseListener);
  9138. this.element.hasScrollEvent = true;
  9139. }
  9140. if (!this.element.scrolls) {
  9141. var viewportElement = Util.getViewportElement();
  9142. this.element.scrolls = [
  9143. viewportElement.scrollLeft,
  9144. viewportElement.scrollTop
  9145. ];
  9146. }
  9147. if (!this.element.lefttop) {
  9148. this.element.lefttop = [
  9149. (document.documentElement.clientLeft || 0),
  9150. (document.documentElement.clientTop || 0)
  9151. ];
  9152. }
  9153. if (!this.element.offsets) {
  9154. this.element.offsets = Util.pagePosition(this.element);
  9155. }
  9156. return new Pixel(
  9157. (evt.clientX + this.element.scrolls[0]) - this.element.offsets[0]
  9158. - this.element.lefttop[0],
  9159. (evt.clientY + this.element.scrolls[1]) - this.element.offsets[1]
  9160. - this.element.lefttop[1]
  9161. );
  9162. }
  9163. }
  9164. SuperMap.Events = Events;
  9165. SuperMap.Events.prototype.BROWSER_EVENTS = [
  9166. "mouseover", "mouseout",
  9167. "mousedown", "mouseup", "mousemove",
  9168. "click", "dblclick", "rightclick", "dblrightclick",
  9169. "resize", "focus", "blur",
  9170. "touchstart", "touchmove", "touchend",
  9171. "keydown", "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
  9172. "MSGestureStart", "MSGestureChange", "MSGestureEnd",
  9173. "contextmenu"
  9174. ];
  9175. ;// CONCATENATED MODULE: ./src/common/commontypes/Feature.js
  9176. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  9177. * This program are made available under the terms of the Apache License, Version 2.0
  9178. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9179. /**
  9180. * @class SuperMap.Feature
  9181. * @category BaseTypes Geometry
  9182. * @classdesc 要素类组合了地理和属性,Feature 类同时具有 marker 和 lonlat 属性。
  9183. * @param {SuperMap.Layer} layer - 图层。
  9184. * @param {SuperMap.LonLat} lonlat - 经纬度。
  9185. * @param {Object} data - 数据对象。
  9186. */
  9187. class Feature {
  9188. constructor(layer, lonlat, data) {
  9189. this.CLASS_NAME = "SuperMap.Feature";
  9190. /**
  9191. * @deprecated
  9192. * @member {SuperMap.Layer} SuperMap.Feature.prototype.layer
  9193. * @description 图层。
  9194. */
  9195. this.layer = layer;
  9196. /**
  9197. * @member {string} SuperMap.Feature.prototype.id
  9198. * @description 要素 ID。
  9199. */
  9200. this.id = Util.createUniqueID(this.CLASS_NAME + "_");
  9201. /**
  9202. * @member {SuperMap.LonLat} SuperMap.Feature.prototype.lonlat
  9203. * @description 经纬度。
  9204. *
  9205. */
  9206. this.lonlat = lonlat;
  9207. /**
  9208. * @member {Object} SuperMap.Feature.prototype.data
  9209. * @description 数据对象。
  9210. */
  9211. this.data = (data != null) ? data : {};
  9212. }
  9213. /**
  9214. * @function SuperMap.Feature.prototype.destroy
  9215. * @description 释放相关资源。
  9216. */
  9217. destroy() {
  9218. this.id = null;
  9219. this.lonlat = null;
  9220. this.data = null;
  9221. }
  9222. }
  9223. SuperMap.Feature = Feature;
  9224. ;// CONCATENATED MODULE: ./src/common/commontypes/Vector.js
  9225. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  9226. * This program are made available under the terms of the Apache License, Version 2.0
  9227. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9228. /**
  9229. * @class SuperMap.Feature.Vector
  9230. * @category BaseTypes Geometry
  9231. * @classdesc 矢量要素类。该类具有 Geometry 属性存放几何信息,
  9232. * attributes 属性存放非几何信息,另外还包含了 style 属性,用来定义矢量要素的样式,
  9233. * 其中,默认的样式在 {@link SuperMap.Feature.Vector.style} 类中定义,如果没有特别的指定将使用默认的样式。
  9234. * @extends {SuperMap.Feature}
  9235. * @param {SuperMap.Geometry} geometry - 代表要素的几何形状。
  9236. * @param {Object} [attributes] - 描述要素的任意的可序列化属性,将要映射到 attributes 属性中的对象。
  9237. * @param {Object} [style] - 样式对象。
  9238. * @example
  9239. * var geometry = new SuperMap.Geometry.Point(-115,10);
  9240. * var style = {
  9241. * strokeColor:"#339933",
  9242. * strokeOpacity:1,
  9243. * strokeWidth:3,
  9244. * pointRadius:6
  9245. * }
  9246. * var pointFeature = new SuperMap.Feature.Vector(geometry,null,style);
  9247. * vectorLayer.addFeatures(pointFeature);
  9248. */
  9249. class Vector extends Feature {
  9250. constructor(geometry, attributes, style) {
  9251. super(null, null, attributes);
  9252. /**
  9253. * @member {string} SuperMap.Feature.Vector.prototype.fid
  9254. * @description fid
  9255. */
  9256. this.fid = null;
  9257. /**
  9258. * @member {SuperMap.Geometry} SuperMap.Feature.Vector.prototype.geometry
  9259. * @description 该属性用于存放几何信息。
  9260. */
  9261. this.geometry = geometry ? geometry : null;
  9262. /**
  9263. * @member {Object} SuperMap.Feature.Vector.prototype.attributes
  9264. * @description 描述要素的任意的可序列化属性。
  9265. */
  9266. this.attributes = {};
  9267. if (attributes) {
  9268. this.attributes = Util.extend(this.attributes, attributes);
  9269. }
  9270. /**
  9271. * @member {SuperMap.Bounds} SuperMap.Feature.Vector.prototype.bounds
  9272. * @description The box bounding that feature's geometry, that
  9273. * property can be set by an <SuperMap.Format> object when
  9274. * deserializing the feature, so in most cases it represents an
  9275. * information set by the server.
  9276. */
  9277. this.bounds = null;
  9278. /**
  9279. * @member {string} SuperMap.Feature.Vector.prototype.state
  9280. * @description state
  9281. */
  9282. this.state = null;
  9283. /**
  9284. * @member {Object} SuperMap.Feature.Vector.prototype.style
  9285. * @description 要素的样式属性,地图查询返回的 feature 的 style,8C 变为null。
  9286. */
  9287. this.style = style ? style : null;
  9288. /**
  9289. * @member {string} SuperMap.Feature.Vector.prototype.url
  9290. * @description 如果设置了这个属性,在更新或者删除要素时需要考虑 {@link SuperMap.HTTP} 。
  9291. */
  9292. this.url = null;
  9293. this.lonlat = null;
  9294. this.CLASS_NAME = "SuperMap.Feature.Vector";
  9295. // TRASH THIS
  9296. SuperMap.State = {
  9297. /** states */
  9298. UNKNOWN: 'Unknown',
  9299. INSERT: 'Insert',
  9300. UPDATE: 'Update',
  9301. DELETE: 'Delete'
  9302. };
  9303. Vector.style = {
  9304. 'default': {
  9305. fillColor: "#ee9900",
  9306. fillOpacity: 0.4,
  9307. hoverFillColor: "white",
  9308. hoverFillOpacity: 0.8,
  9309. strokeColor: "#ee9900",
  9310. strokeOpacity: 1,
  9311. strokeWidth: 1,
  9312. strokeLinecap: "round",
  9313. strokeDashstyle: "solid",
  9314. hoverStrokeColor: "red",
  9315. hoverStrokeOpacity: 1,
  9316. hoverStrokeWidth: 0.2,
  9317. pointRadius: 6,
  9318. hoverPointRadius: 1,
  9319. hoverPointUnit: "%",
  9320. pointerEvents: "visiblePainted",
  9321. cursor: "inherit",
  9322. fontColor: "#000000",
  9323. labelAlign: "cm",
  9324. labelOutlineColor: "white",
  9325. labelOutlineWidth: 3
  9326. },
  9327. 'select': {
  9328. fillColor: "blue",
  9329. fillOpacity: 0.4,
  9330. hoverFillColor: "white",
  9331. hoverFillOpacity: 0.8,
  9332. strokeColor: "blue",
  9333. strokeOpacity: 1,
  9334. strokeWidth: 2,
  9335. strokeLinecap: "round",
  9336. strokeDashstyle: "solid",
  9337. hoverStrokeColor: "red",
  9338. hoverStrokeOpacity: 1,
  9339. hoverStrokeWidth: 0.2,
  9340. pointRadius: 6,
  9341. hoverPointRadius: 1,
  9342. hoverPointUnit: "%",
  9343. pointerEvents: "visiblePainted",
  9344. cursor: "pointer",
  9345. fontColor: "#000000",
  9346. labelAlign: "cm",
  9347. labelOutlineColor: "white",
  9348. labelOutlineWidth: 3
  9349. },
  9350. 'temporary': {
  9351. fillColor: "#66cccc",
  9352. fillOpacity: 0.2,
  9353. hoverFillColor: "white",
  9354. hoverFillOpacity: 0.8,
  9355. strokeColor: "#66cccc",
  9356. strokeOpacity: 1,
  9357. strokeLinecap: "round",
  9358. strokeWidth: 2,
  9359. strokeDashstyle: "solid",
  9360. hoverStrokeColor: "red",
  9361. hoverStrokeOpacity: 1,
  9362. hoverStrokeWidth: 0.2,
  9363. pointRadius: 6,
  9364. hoverPointRadius: 1,
  9365. hoverPointUnit: "%",
  9366. pointerEvents: "visiblePainted",
  9367. //cursor:"inherit",
  9368. cursor: "default",
  9369. fontColor: "#000000",
  9370. labelAlign: "cm",
  9371. labelOutlineColor: "white",
  9372. labelOutlineWidth: 3
  9373. },
  9374. 'delete': {
  9375. display: "none"
  9376. }
  9377. };
  9378. }
  9379. /**
  9380. * @function SuperMap.Feature.Vector.prototype.destroy
  9381. * @description nullify references to prevent circular references and memory leaks
  9382. */
  9383. destroy() {
  9384. if (this.layer) {
  9385. this.layer.removeFeatures(this);
  9386. this.layer = null;
  9387. }
  9388. this.geometry = null;
  9389. super.destroy();
  9390. }
  9391. /**
  9392. * @function SuperMap.Feature.Vector.prototype.clone
  9393. * @description Create a clone of this vector feature. Does not set any non-standard
  9394. * properties.
  9395. * @returns {SuperMap.Feature.Vector} An exact clone of this vector feature.
  9396. */
  9397. clone() {
  9398. return new Vector(
  9399. this.geometry ? this.geometry.clone() : null,
  9400. this.attributes,
  9401. this.style);
  9402. }
  9403. /**
  9404. * @function SuperMap.Feature.Vector.prototype.toState
  9405. * @description 设置新状态。
  9406. * @param {string} state - 状态。
  9407. */
  9408. toState(state) {
  9409. if (state === SuperMap.State.UPDATE) {
  9410. switch (this.state) {
  9411. case SuperMap.State.UNKNOWN:
  9412. case SuperMap.State.DELETE:
  9413. this.state = state;
  9414. break;
  9415. case SuperMap.State.UPDATE:
  9416. case SuperMap.State.INSERT:
  9417. break;
  9418. }
  9419. } else if (state === SuperMap.State.INSERT) {
  9420. switch (this.state) {
  9421. case SuperMap.State.UNKNOWN:
  9422. break;
  9423. default:
  9424. this.state = state;
  9425. break;
  9426. }
  9427. } else if (state === SuperMap.State.DELETE) {
  9428. switch (this.state) {
  9429. case SuperMap.State.INSERT:
  9430. // the feature should be destroyed
  9431. break;
  9432. case SuperMap.State.DELETE:
  9433. break;
  9434. case SuperMap.State.UNKNOWN:
  9435. case SuperMap.State.UPDATE:
  9436. this.state = state;
  9437. break;
  9438. }
  9439. } else if (state === SuperMap.State.UNKNOWN) {
  9440. this.state = state;
  9441. }
  9442. }
  9443. }
  9444. /**
  9445. *
  9446. * @typedef {Object} SuperMap.Feature.Vector.style
  9447. * @description SuperMap.features 有大量的样式属性,如果没有特别的指定将使用默认的样式,
  9448. * 大部分样式通过 SVG 标准定义属性。
  9449. * - fill properties 资料介绍:{@link http://www.w3.org/TR/SVG/painting.html#FillProperties}
  9450. * - stroke properties 资料介绍:{@link http://www.w3.org/TR/SVG/painting.html#StrokeProperties}
  9451. * @property {boolean} [fill] - 不需要填充则设置为 false。
  9452. * @property {string} [fillColor='#ee9900'] - 十六进制填充颜色。
  9453. * @property {number} [fillOpacity=0.4] - 填充不透明度。
  9454. * @property {boolean} [stroke] - 不需要描边则设为 false。
  9455. * @property {string} [strokeColor='#ee9900'] - 十六进制描边颜色。
  9456. * @property {number} [strokeOpacity=0.4] - 描边的不透明度(0-1)。
  9457. * @property {number} [strokeWidth=1] - 像素描边宽度。
  9458. * @property {string} [strokeLinecap='round'] - strokeLinecap 有三种类型 butt,round,square。
  9459. * @property {string} [strokeDashstyle='solid'] - 有 dot,dash,dashdot,longdash,longdashdot,solid 几种样式。
  9460. * @property {boolean} [graphic] - 不需要则设置为 false。
  9461. * @property {number} [pointRadius=6] - 像素点半径。
  9462. * @property {string} [pointerEvents='visiblePainted'] - pointerEvents。
  9463. * @property {string} [cursor] - cursor。
  9464. * @property {boolean} [allowRotate='false'] - 是否允许图标随着运行方向旋转。用于时空数据图层。
  9465. * @property {string} [externalGraphic] - 连接到用来渲染点的外部的图形。
  9466. * @property {number} [graphicWidth] - 外部图表的像素宽度。
  9467. * @property {number} [graphicHeight] - 外部图表的高宽度。
  9468. * @property {number} [graphicOpacity] - 外部图表的不透明度(0-1)。
  9469. * @property {number} [graphicXOffset] - 外部图表沿着x方向的偏移量。
  9470. * @property {number} [graphicYOffset] - 外部图表沿着y方向的偏移量 Pixel。
  9471. * @property {number} [rotation] - 一个图表沿着其中心点(或者偏移中心指定点)在顺时针方向旋转。
  9472. * @property {number} [graphicZIndex] - 渲染时使用的索引值。
  9473. * @property {string} [graphicName='circle'] - 渲染点时图标使用的名字。支持"circle" , "square", "star", "x", "cross", "triangle"。
  9474. * @property {string} [graphicTitle] - 外部图表的提示框。
  9475. * @property {string} [backgroundGraphic] - 外部图表的背景。
  9476. * @property {number} [backgroundGraphicZIndex] - 背景图渲染时使用的索引值。
  9477. * @property {number} [backgroundXOffset] - 背景图在 x 轴的偏移量。
  9478. * @property {number} [backgroundYOffset] - 背景图在 y 轴的偏移量。
  9479. * @property {number} [backgroundHeight] - 背景图的高度。如果没有设置,将用 graphicHeight。
  9480. * @property {number} [backgroundWidth] - 背景图的宽度。如果没有设置,将用 graphicWidth。
  9481. * @property {boolean} [isUnicode=false] - 这个属性要配合 label 属性来用,当为 true时,label 就可以使用 unicode 编码,
  9482. * 比如 "a" 的 unicode 十六进制编码为 61,则 label 属性可以为 "&#x61;",其中 "&#" 为前缀,标志这个为 unicode 编码,
  9483. * "x" 是指 16 进制,这时页面显示的是 "a";当此值为 false 的时候,label 的内容会被直接输出,
  9484. * 比如,label 为 "&#x61;",这时页面显示的也是 "&#x61;"。
  9485. * @property {string} [label] - 可选的标签文本。
  9486. * @property {string} [labelAlign='cm'] - 标签对齐,是由两个字符组成的字符串,如:"lt", "cm", "rb",
  9487. * 其中第一个字符代表水平方向上的对齐,"l"=left, "c"=center, "r"=right;
  9488. * 第二个字符代表垂直方向上的对齐,"t"=top, "m"=middle, "b"=bottom。
  9489. * @property {number} [labelXOffset] - 标签在 x 轴方向的偏移量。
  9490. * @property {number} [labelYOffset] - 标签在 y 轴方向的偏移量。
  9491. * @property {boolean} [labelSelect=false] - 如果设为 true,标签可以选用 SelectFeature 或者 similar 控件。
  9492. * @property {string} [fontColor='#000000'] - 标签字体颜色。
  9493. * @property {number} [fontOpacity] - 标签透明度 (0-1)。
  9494. * @property {string} [fontFamily] - 标签的字体类型。
  9495. * @property {string} [fontSize] - 标签的字体大小。
  9496. * @property {string} [fontStyle] - 标签的字体样式。
  9497. * @property {string} [fontWeight] - 标签的字体粗细。
  9498. * @property {string} [display] - 如果 display 属性设置为 “none”,符号将没有任何效果。
  9499. * @example
  9500. * // label的用法如下:
  9501. * function addGeoTest(){
  9502. * var geometry = new SuperMap.Geometry.Point(105, 35);
  9503. * var pointFeature = new SuperMap.Feature.Vector(geometry);
  9504. * var styleTest = {
  9505. * label:"supermap",
  9506. * fontColor:"#0000ff",
  9507. * fontOpacity:"0.5",
  9508. * fontFamily:"隶书",
  9509. * fontSize:"8em",
  9510. * fontWeight:"bold",
  9511. * fontStyle:"italic",
  9512. * labelSelect:"true",
  9513. * }
  9514. * pointFeature.style = styleTest;
  9515. * vectorLayer.addFeatures([pointFeature]);
  9516. * }
  9517. */
  9518. SuperMap.Feature.Vector = Vector;
  9519. ;// CONCATENATED MODULE: ./src/common/commontypes/index.js
  9520. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  9521. * This program are made available under the terms of the Apache License, Version 2.0
  9522. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9523. ;// CONCATENATED MODULE: ./src/common/format/Format.js
  9524. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  9525. * This program are made available under the terms of the Apache License, Version 2.0
  9526. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9527. /**
  9528. * @class SuperMap.Format
  9529. * @classdesc 读写各种格式的格式类基类。其子类应该包含并实现 read 和 write 方法。
  9530. * @category BaseTypes Format
  9531. * @param {Object} options - 可选参数。
  9532. * @param {boolean} [options.keepData=false] - 如果设置为 true, data 属性会指向被解析的对象(例如 JSON 或 xml 数据对象)。
  9533. * @param {Object} [options.data] - 当 keepData 属性设置为 true,这是传递给 read 操作的要被解析的字符串。
  9534. */
  9535. class Format {
  9536. constructor(options) {
  9537. /**
  9538. * @member {Object} SuperMap.Format.prototype.data
  9539. * @description 当 keepData 属性设置为 true,这是传递给 read 操作的要被解析的字符串。
  9540. */
  9541. this.data = null;
  9542. /**
  9543. * APIProperty: keepData
  9544. * @member {Object} [SuperMap.Format.prototype.keepData=false]
  9545. * @description 保持最近读到的数据的引用(通过 <data> 属性)。
  9546. */
  9547. this.keepData = false;
  9548. Util.extend(this, options);
  9549. this.options = options;
  9550. this.CLASS_NAME = "SuperMap.Format";
  9551. }
  9552. /**
  9553. * @function SuperMap.Format.prototype.destroy
  9554. * @description 销毁该格式类,释放相关资源。
  9555. */
  9556. destroy() {
  9557. //用来销毁该格式类,释放相关资源
  9558. }
  9559. /**
  9560. * @function SuperMap.Format.prototype.read
  9561. * @description 来从字符串中读取数据。
  9562. * @param {string} data - 读取的数据。
  9563. */
  9564. read(data) { // eslint-disable-line no-unused-vars
  9565. //用来从字符串中读取数据
  9566. }
  9567. /**
  9568. * @function SuperMap.Format.prototype.write
  9569. * @description 将对象写成字符串。
  9570. * @param {Object} object - 可序列化的对象。
  9571. * @returns {string} 对象被写成字符串。
  9572. */
  9573. write(object) { // eslint-disable-line no-unused-vars
  9574. //用来写字符串
  9575. }
  9576. }
  9577. SuperMap.Format = SuperMap.Format || Format;
  9578. ;// CONCATENATED MODULE: ./src/common/format/JSON.js
  9579. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  9580. * This program are made available under the terms of the Apache License, Version 2.0
  9581. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9582. /**
  9583. * @class SuperMap.Format.JSON
  9584. * @classdesc 安全的读写 JSON 的解析类。使用 {@link SuperMap.Format.JSON} 构造函数创建新实例。
  9585. * @category BaseTypes Format
  9586. * @param {Object} [options] - 参数。
  9587. * @param {string} [options.indent=" "] - 用于格式化输出,indent 字符串会在每次缩进的时候使用一次。
  9588. * @param {string} [options.space=" "] - 用于格式化输出,space 字符串会在名值对的 ":" 后边添加。
  9589. * @param {string} [options.newline="\n"] - 用于格式化输出, newline 字符串会用在每一个名值对或数组项末尾。
  9590. * @param {number} [options.level=0] - 用于格式化输出, 表示的是缩进级别。
  9591. * @param {boolean} [options.pretty=false] - 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  9592. * @param {boolean} [options.nativeJSON] - 需要被注册的监听器对象。
  9593. * @extends {SuperMap.Format}
  9594. */
  9595. class JSONFormat extends Format {
  9596. constructor(options) {
  9597. super(options);
  9598. /**
  9599. * @member {string} [SuperMap.Format.JSON.prototype.indent=" "]
  9600. * @description 用于格式化输出,indent 字符串会在每次缩进的时候使用一次。
  9601. */
  9602. this.indent = " ";
  9603. /**
  9604. * @member {string} [SuperMap.Format.JSON.prototype.space=" "]
  9605. * @description 用于格式化输出,space 字符串会在名值对的 ":" 后边添加。
  9606. */
  9607. this.space = " ";
  9608. /**
  9609. * @member {string} [SuperMap.Format.JSON.prototype.newline="\n"]
  9610. * @description 用于格式化输出, newline 字符串会用在每一个名值对或数组项末尾。
  9611. */
  9612. this.newline = "\n";
  9613. /**
  9614. * @member {integer} [SuperMap.Format.JSON.prototype.level=0]
  9615. * @description 用于格式化输出, 表示的是缩进级别。
  9616. */
  9617. this.level = 0;
  9618. /**
  9619. * @member {boolean} [SuperMap.Format.JSON.prototype.pretty=false]
  9620. * @description 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  9621. */
  9622. this.pretty = false;
  9623. /**
  9624. * @member {boolean} SuperMap.Format.JSON.prototype.nativeJSON
  9625. * @description 判断浏览器是否原生支持 JSON 格式数据。
  9626. */
  9627. this.nativeJSON = (function () {
  9628. return !!(window.JSON && typeof JSON.parse === "function" && typeof JSON.stringify === "function");
  9629. })();
  9630. this.CLASS_NAME = "SuperMap.Format.JSON";
  9631. /**
  9632. * @member SuperMap.Format.JSON.prototype.serialize
  9633. * @description 提供一些类型对象转 JSON 字符串的方法。
  9634. */
  9635. this.serialize = {
  9636. /**
  9637. * @function SuperMap.Format.JSON.serialize.object
  9638. * @description 把对象转换为 JSON 字符串。
  9639. * @param {Object} object - 可序列化的对象。
  9640. * @returns {string} JSON 字符串。
  9641. */
  9642. 'object': function (object) {
  9643. // three special objects that we want to treat differently
  9644. if (object == null) {
  9645. return "null";
  9646. }
  9647. if (object.constructor === Date) {
  9648. return this.serialize.date.apply(this, [object]);
  9649. }
  9650. if (object.constructor === Array) {
  9651. return this.serialize.array.apply(this, [object]);
  9652. }
  9653. var pieces = ['{'];
  9654. this.level += 1;
  9655. var key, keyJSON, valueJSON;
  9656. var addComma = false;
  9657. for (key in object) {
  9658. if (object.hasOwnProperty(key)) {
  9659. // recursive calls need to allow for sub-classing
  9660. keyJSON = this.write.apply(this,
  9661. [key, this.pretty]);
  9662. valueJSON = this.write.apply(this,
  9663. [object[key], this.pretty]);
  9664. if (keyJSON != null && valueJSON != null) {
  9665. if (addComma) {
  9666. pieces.push(',');
  9667. }
  9668. pieces.push(this.writeNewline(), this.writeIndent(),
  9669. keyJSON, ':', this.writeSpace(), valueJSON);
  9670. addComma = true;
  9671. }
  9672. }
  9673. }
  9674. this.level -= 1;
  9675. pieces.push(this.writeNewline(), this.writeIndent(), '}');
  9676. return pieces.join('');
  9677. },
  9678. /**
  9679. * @function SuperMap.Format.JSON.serialize.array
  9680. * @description 把数组转换成 JSON 字符串。
  9681. * @param {Array} array - 可序列化的数组。
  9682. * @returns {string} JSON 字符串。
  9683. */
  9684. 'array': function (array) {
  9685. var json;
  9686. var pieces = ['['];
  9687. this.level += 1;
  9688. for (var i = 0, len = array.length; i < len; ++i) {
  9689. // recursive calls need to allow for sub-classing
  9690. json = this.write.apply(this,
  9691. [array[i], this.pretty]);
  9692. if (json != null) {
  9693. if (i > 0) {
  9694. pieces.push(',');
  9695. }
  9696. pieces.push(this.writeNewline(), this.writeIndent(), json);
  9697. }
  9698. }
  9699. this.level -= 1;
  9700. pieces.push(this.writeNewline(), this.writeIndent(), ']');
  9701. return pieces.join('');
  9702. },
  9703. /**
  9704. * @function SuperMap.Format.JSON.serialize.string
  9705. * @description 把字符串转换成 JSON 字符串。
  9706. * @param {string} string - 可序列化的字符串。
  9707. * @returns {string} JSON 字符串。
  9708. */
  9709. 'string': function (string) {
  9710. // If the string contains no control characters, no quote characters, and no
  9711. // backslash characters, then we can simply slap some quotes around it.
  9712. // Otherwise we must also replace the offending characters with safe
  9713. // sequences.
  9714. var m = {
  9715. '\b': '\\b',
  9716. '\t': '\\t',
  9717. '\n': '\\n',
  9718. '\f': '\\f',
  9719. '\r': '\\r',
  9720. '"': '\\"',
  9721. '\\': '\\\\'
  9722. };
  9723. /*eslint-disable no-control-regex*/
  9724. if (/["\\\x00-\x1f]/.test(string)) {
  9725. return '"' + string.replace(/([\x00-\x1f\\"])/g, function (a, b) {
  9726. var c = m[b];
  9727. if (c) {
  9728. return c;
  9729. }
  9730. c = b.charCodeAt();
  9731. return '\\u00' +
  9732. Math.floor(c / 16).toString(16) +
  9733. (c % 16).toString(16);
  9734. }) + '"';
  9735. }
  9736. return '"' + string + '"';
  9737. },
  9738. /**
  9739. * @function SuperMap.Format.JSON.serialize.number
  9740. * @description 把数字转换成 JSON 字符串。
  9741. * @param {number} number - 可序列化的数字。
  9742. * @returns {string} JSON 字符串。
  9743. */
  9744. 'number': function (number) {
  9745. return isFinite(number) ? String(number) : "null";
  9746. },
  9747. /**
  9748. * @function SuperMap.Format.JSON.serialize.boolean
  9749. * @description Transform a boolean into a JSON string.
  9750. * @param {boolean} bool - The boolean to be serialized.
  9751. * @returns {string} A JSON string representing the boolean.
  9752. */
  9753. 'boolean': function (bool) {
  9754. return String(bool);
  9755. },
  9756. /**
  9757. * @function SuperMap.Format.JSON.serialize.object
  9758. * @description 将日期对象转换成 JSON 字符串。
  9759. * @param {Date} date - 可序列化的日期对象。
  9760. * @returns {string} JSON 字符串。
  9761. */
  9762. 'date': function (date) {
  9763. function format(number) {
  9764. // Format integers to have at least two digits.
  9765. return (number < 10) ? '0' + number : number;
  9766. }
  9767. return '"' + date.getFullYear() + '-' +
  9768. format(date.getMonth() + 1) + '-' +
  9769. format(date.getDate()) + 'T' +
  9770. format(date.getHours()) + ':' +
  9771. format(date.getMinutes()) + ':' +
  9772. format(date.getSeconds()) + '"';
  9773. }
  9774. };
  9775. }
  9776. /**
  9777. * @function SuperMap.Format.JSON.prototype.read
  9778. * @description 将一个符合 JSON 结构的字符串进行解析。
  9779. * @param {string} json - 符合 JSON 结构的字符串。
  9780. * @param {function} filter - 过滤方法,最终结果的每一个键值对都会调用该过滤方法,并在对应的值的位置替换成该方法返回的值。
  9781. * @returns {Object} 对象,数组,字符串或数字。
  9782. */
  9783. read(json, filter) {
  9784. var object;
  9785. if (this.nativeJSON) {
  9786. try {
  9787. object = JSON.parse(json, filter);
  9788. } catch (e) {
  9789. // Fall through if the regexp test fails.
  9790. }
  9791. }
  9792. if (this.keepData) {
  9793. this.data = object;
  9794. }
  9795. return object;
  9796. }
  9797. /**
  9798. * @function SuperMap.Format.JSON.prototype.write
  9799. * @description 序列化一个对象到一个符合 JSON 格式的字符串。
  9800. * @param {(object|string|Array|number|boolean)} value - 需要被序列化的对象,数组,字符串,数字,布尔值。
  9801. * @param {boolean} [pretty=false] - 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  9802. * @returns {string} 符合 JSON 格式的字符串。
  9803. *
  9804. */
  9805. write(value, pretty) {
  9806. this.pretty = !!pretty;
  9807. var json = null;
  9808. var type = typeof value;
  9809. if (this.serialize[type]) {
  9810. try {
  9811. json = (!this.pretty && this.nativeJSON) ?
  9812. JSON.stringify(value) :
  9813. this.serialize[type].apply(this, [value]);
  9814. } catch (err) {
  9815. //SuperMap.Console.error("Trouble serializing: " + err);
  9816. }
  9817. }
  9818. return json;
  9819. }
  9820. /**
  9821. * @function SuperMap.Format.JSON.prototype.writeIndent
  9822. * @description 根据缩进级别输出一个缩进字符串。
  9823. * @private
  9824. * @returns {string} 一个适当的缩进字符串。
  9825. */
  9826. writeIndent() {
  9827. var pieces = [];
  9828. if (this.pretty) {
  9829. for (var i = 0; i < this.level; ++i) {
  9830. pieces.push(this.indent);
  9831. }
  9832. }
  9833. return pieces.join('');
  9834. }
  9835. /**
  9836. * @function SuperMap.Format.JSON.prototype.writeNewline
  9837. * @description 在格式化输出模式情况下输出代表新一行的字符串。
  9838. * @private
  9839. * @returns {string} 代表新的一行的字符串。
  9840. */
  9841. writeNewline() {
  9842. return (this.pretty) ? this.newline : '';
  9843. }
  9844. /**
  9845. * @function SuperMap.Format.JSON.prototype.writeSpace
  9846. * @private
  9847. * @description 在格式化输出模式情况下输出一个代表空格的字符串。
  9848. * @returns {string} 一个空格。
  9849. */
  9850. writeSpace() {
  9851. return (this.pretty) ? this.space : '';
  9852. }
  9853. }
  9854. SuperMap.Format.JSON = JSONFormat;
  9855. ;// CONCATENATED MODULE: ./src/common/iServer/ServerColor.js
  9856. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  9857. * This program are made available under the terms of the Apache License, Version 2.0
  9858. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9859. /**
  9860. * @class SuperMap.ServerColor
  9861. * @category iServer Map Theme
  9862. * @classdesc 颜色类。该类使用三原色( RGB )来表达颜色。
  9863. * @param {Object} options - 参数。
  9864. * @param {number} [options.red=255] - 获取或设置红色值。
  9865. * @param {number} [options.green=0] - 获取或设置绿色值。
  9866. * @param {number} [options.blue=0] - 获取或设置蓝色值。
  9867. */
  9868. class ServerColor {
  9869. constructor(red, green, blue) {
  9870. /**
  9871. * @member {number} [SuperMap.ServerColor.prototype.red=255]
  9872. * @description 获取或设置红色值。
  9873. */
  9874. this.red = (!red && red != 0)?255:red;
  9875. /**
  9876. * @member {number} [SuperMap.ServerColor.prototype.green=0]
  9877. * @description 获取或设置绿色值。
  9878. */
  9879. this.green = green||0;
  9880. /**
  9881. * @member {number} [SuperMap.ServerColor.prototype.blue=0]
  9882. * @description 获取或设置蓝色值。
  9883. */
  9884. this.blue = blue||0;
  9885. this.CLASS_NAME = "SuperMap.ServerColor";
  9886. }
  9887. /**
  9888. * @function SuperMap.ServerColor.prototype.destroy
  9889. * @description 释放资源,将引用资源的属性置空。
  9890. */
  9891. destroy() {
  9892. var me = this;
  9893. me.red = null;
  9894. me.green = null;
  9895. me.blue = null;
  9896. }
  9897. /**
  9898. * @function SuperMap.ServerColor.formJson
  9899. * @description 将 JSON 对象转化为 ServerColor 对象。
  9900. * @param {Object} jsonObject - 要转换的 JSON 对象。
  9901. * @returns {SuperMap.ServerColor} 转化后的 ServerColor 对象。
  9902. */
  9903. static fromJson(jsonObject) {
  9904. if (!jsonObject) {
  9905. return;
  9906. }
  9907. var color = new ServerColor();
  9908. var red = 255;
  9909. if (jsonObject.red !== null) {
  9910. red = Number(jsonObject.red);
  9911. }
  9912. color.red = red;
  9913. var green = 0;
  9914. if (jsonObject.green !== null) {
  9915. green = Number(jsonObject.green);
  9916. }
  9917. color.green = green;
  9918. var blue = 0;
  9919. if (jsonObject.blue !== null) {
  9920. blue = Number(jsonObject.blue);
  9921. }
  9922. color.blue = blue;
  9923. return color;
  9924. }
  9925. }
  9926. SuperMap.ServerColor = ServerColor;
  9927. ;// CONCATENATED MODULE: ./src/common/iServer/ServerStyle.js
  9928. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  9929. * This program are made available under the terms of the Apache License, Version 2.0
  9930. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9931. /**
  9932. * @class SuperMap.ServerStyle
  9933. * @category iServer Map Theme
  9934. * @classdesc 服务端矢量要素风格类。
  9935. * @description 该类用于定义点状符号、线状符号、填充符号风格及其相关属性。
  9936. * @param {Object} options - 参数。
  9937. * @param {SuperMap.FillGradientMode} options.fillGradientMode - 渐变填充风格的渐变类型。
  9938. * @param {SuperMap.ServerColor} [options.fillBackColor=[255,255,255]] - 填充背景颜色。
  9939. * @param {boolean} [options.fillBackOpaque=false] - 背景是否不透明。
  9940. * @param {SuperMap.ServerColor} [options.fillForeColor=[255,0,0]] - 填充颜色。
  9941. * @param {number} [options.fillGradientAngle=0] - 渐变填充的旋转角度。
  9942. * @param {number} [options.fillGradientOffsetRatioX=0] - 渐变填充中心点相对于填充区域范围中心点的水平偏移百分比。
  9943. * @param {number} [options.fillGradientOffsetRatioY=0] - 填充中心点相对于填充区域范围中心点的垂直偏移百分比。
  9944. * @param {number} [options.fillOpaqueRate=100] - 填充不透明度。
  9945. * @param {number} [options.fillSymbolID=0] - 填充符号的编码。
  9946. * @param {SuperMap.ServerColor} [options.lineColor] - 矢量要素的边线颜色。默认 lineColor = new ServerColor(0, 0, 0)。
  9947. * @param {number} [options.lineSymbolID=0] - 线状符号的编码。
  9948. * @param {number} [options.lineWidth=1] - 边线的宽度。
  9949. * @param {number} [options.markerAngle=0] - 点状符号的旋转角度。
  9950. * @param {number} [options.markerSize=1] - 点状符号的大小。
  9951. * @param {number} [options.markerSymbolID=-1] - 点状符号的编码。
  9952. */
  9953. class ServerStyle {
  9954. constructor(options) {
  9955. /**
  9956. * @member {SuperMap.ServerColor} SuperMap.ServerStyle.prototype.fillBackColor
  9957. * @description 填充背景颜色。当填充模式为渐变填充时,该颜色为填充终止色。
  9958. */
  9959. this.fillBackColor = new ServerColor(255, 255, 255);
  9960. /**
  9961. * @member {boolean} [SuperMap.ServerStyle.prototype.fillBackOpaque=false]
  9962. * @description 背景是否不透明。false 表示透明。
  9963. */
  9964. this.fillBackOpaque = false;
  9965. /**
  9966. * @member {SuperMap.ServerColor} SuperMap.ServerStyle.prototype.fillForeColor
  9967. * @description 填充颜色。当填充模式为渐变填充时,该颜色为填充起始颜色。
  9968. */
  9969. this.fillForeColor = new ServerColor(255, 0, 0);
  9970. /**
  9971. * @member {SuperMap.FillGradientMode} SuperMap.ServerStyle.prototype.fillGradientMode
  9972. * @description 渐变填充风格的渐变类型。
  9973. */
  9974. this.fillGradientMode = null;
  9975. /**
  9976. * @member {number} SuperMap.ServerStyle.prototype.fillGradientAngle -
  9977. * @description 渐变填充的旋转角度。单位为度,精确到 0.1 度,逆时针方向为正方向。
  9978. */
  9979. this.fillGradientAngle = 0;
  9980. /**
  9981. * @member {number} SuperMap.ServerStyle.prototype.fillGradientOffsetRatioX
  9982. * @description 渐变填充中心点相对于填充区域范围中心点的水平偏移百分比。它们的关系如下:设填充区域范围中心点的坐标为(x0, y0),
  9983. * 填充中心点的坐标为(x, y),填充区域范围的宽度为 a,水平偏移百分比为 dx,则 x=x0 + a*dx/100。
  9984. */
  9985. this.fillGradientOffsetRatioX = 0;
  9986. /**
  9987. * @member {number} SuperMap.ServerStyle.prototype.fillGradientOffsetRatioY
  9988. * @description 填充中心点相对于填充区域范围中心点的垂直偏移百分比。它们的关系如下:<br>
  9989. * 设填充区域范围中心点的坐标为(x0, y0),填充中心点的坐标为(x, y),填充区域范围的高度为 b,垂直偏移百分比为 dy,则 y=y0 + b*dx/100。
  9990. */
  9991. this.fillGradientOffsetRatioY = 0;
  9992. /**
  9993. * @member {number} [SuperMap.ServerStyle.prototype.fillOpaqueRate=100]
  9994. * @description 填充不透明度。合法值为 0 - 100 的数值。其中为 0 表示完全透明;
  9995. * 100 表示完全不透明。赋值小于 0 时按照 0 处理,大于 100 时按照 100 处理。
  9996. */
  9997. this.fillOpaqueRate = 100;
  9998. /**
  9999. * @member {number} SuperMap.ServerStyle.prototype.fillSymbolID
  10000. * @description 填充符号的编码。此编码用于唯一标识各普通填充风格的填充符号。
  10001. * 关于填充符号的样式与对应的 ID 号请在 SuperMap 桌面软件中查找。
  10002. */
  10003. this.fillSymbolID = 0;
  10004. /**
  10005. * @member {SuperMap.ServerColor} SuperMap.ServerStyle.prototype.lineColor
  10006. * @description 矢量要素的边线颜色。如果等级符号是点符号,点符号的颜色由 lineColor 控制。
  10007. */
  10008. this.lineColor = new ServerColor(0, 0, 0);
  10009. /**
  10010. * @member {number} [SuperMap.ServerStyle.prototype.lineSymbolID=0]
  10011. * @description 线状符号的编码。此编码用于唯一标识各普通填充风格的填充符号。
  10012. * 关于线状符号的样式与对应的 ID 号请在 SuperMap 桌面软件中查找。
  10013. */
  10014. this.lineSymbolID = 0;
  10015. /**
  10016. * @member {number} [SuperMap.ServerStyle.prototype.lineWidth=1.0]
  10017. * @description 边线的宽度。单位为毫米,精度到 0.1。
  10018. */
  10019. this.lineWidth = 1;
  10020. /**
  10021. * @member {number} [SuperMap.ServerStyle.prototype.markerAngle=0]
  10022. * @description 点状符号的旋转角度。以度为单位,精确到 0.1 度,逆时针方向为正方向。
  10023. */
  10024. this.markerAngle = 0;
  10025. /**
  10026. * @member {number} [SuperMap.ServerStyle.prototype.markerSize=1.0]
  10027. * @description 点状符号的大小。单位为毫米,精度为 0.1。当该属性设置为0时,采用符号默认大小 1.0 显示。
  10028. * 当该属性设置为非法值时,交由服务器默认处理。
  10029. */
  10030. this.markerSize = 1;
  10031. /**
  10032. * @member {number} [SuperMap.ServerStyle.prototype.markerSymbolID=-1]
  10033. * @description 点状符号的编码。此编码用于唯一标识各点状符号。
  10034. * 关于线状符号的样式与对应的 ID 号请在 SuperMap 桌面软件中查找。
  10035. */
  10036. this.markerSymbolID = -1;
  10037. if (options) {
  10038. Util.extend(this, options);
  10039. }
  10040. this.CLASS_NAME = "SuperMap.ServerStyle";
  10041. }
  10042. /**
  10043. * @function SuperMap.ServerStyle.prototype.destroy
  10044. * @description 释放资源,将引用资源的属性置空。
  10045. */
  10046. destroy() {
  10047. var me = this;
  10048. if (me.fillBackColor) {
  10049. me.fillBackColor.destroy();
  10050. me.fillBackColor = null;
  10051. }
  10052. me.fillBackOpaque = null;
  10053. if (me.fillForeColor) {
  10054. me.fillForeColor.destroy();
  10055. me.fillForeColor = null;
  10056. }
  10057. me.fillGradientMode = null;
  10058. me.fillGradientAngle = null;
  10059. me.fillGradientOffsetRatioX = null;
  10060. me.fillGradientOffsetRatioY = null;
  10061. me.fillOpaqueRate = null;
  10062. me.fillSymbolID = null;
  10063. if (me.lineColor) {
  10064. me.lineColor.destroy();
  10065. me.lineColor = null;
  10066. }
  10067. me.lineSymbolID = null;
  10068. me.lineWidth = null;
  10069. me.markerAngle = null;
  10070. me.markerSize = null;
  10071. me.markerSymbolID = null;
  10072. }
  10073. /**
  10074. * @function SuperMap.ServerStyle.prototype.toServerJSONObject
  10075. * @description 转换成对应的 JSON 格式对象。
  10076. * @returns {Object} 对应的 JSON 格式对象.
  10077. */
  10078. toServerJSONObject() {
  10079. var styleObj = {};
  10080. styleObj = Util.copyAttributes(styleObj, this);
  10081. //暂时先忽略serverColor往Json的转换
  10082. return styleObj;
  10083. }
  10084. /**
  10085. * @function SuperMap.ServerStyle.fromJson
  10086. * @description 将JSON对象转换为 SuperMap.ServerStyle 对象。
  10087. * @param jsonObject - {Object} 要转换的 JSON 对象。
  10088. * @returns {SuperMap.ServerStyle} 转化后的 SuperMap.ServerStyle 对象。
  10089. */
  10090. static fromJson(jsonObject) {
  10091. if (!jsonObject) {
  10092. return;
  10093. }
  10094. return new ServerStyle({
  10095. fillBackColor: ServerColor.fromJson(jsonObject.fillBackColor),
  10096. fillBackOpaque: jsonObject.fillBackOpaque,
  10097. fillForeColor: ServerColor.fromJson(jsonObject.fillForeColor),
  10098. fillGradientMode: jsonObject.fillGradientMode,
  10099. fillGradientAngle: jsonObject.fillGradientAngle,
  10100. fillGradientOffsetRatioX: jsonObject.fillGradientOffsetRatioX,
  10101. fillGradientOffsetRatioY: jsonObject.fillGradientOffsetRatioY,
  10102. fillOpaqueRate: jsonObject.fillOpaqueRate,
  10103. fillSymbolID: jsonObject.fillSymbolID,
  10104. lineColor: ServerColor.fromJson(jsonObject.lineColor),
  10105. lineSymbolID: jsonObject.lineSymbolID,
  10106. lineWidth: jsonObject.lineWidth,
  10107. markerAngle: jsonObject.markerAngle,
  10108. markerSize: jsonObject.markerSize,
  10109. markerSymbolID: jsonObject.markerSymbolID
  10110. });
  10111. }
  10112. }
  10113. SuperMap.ServerStyle = ServerStyle;
  10114. ;// CONCATENATED MODULE: ./src/common/iServer/PointWithMeasure.js
  10115. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  10116. * This program are made available under the terms of the Apache License, Version 2.0
  10117. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  10118. /**
  10119. * @class SuperMap.PointWithMeasure
  10120. * @category iServer SpatialAnalyst
  10121. * @classdesc 路由点类。路由点是指具有线性度量值 (Measure) 的二维地理坐标点。
  10122. * @param {Object} options - 参数。
  10123. * @param {number} options.measure - 度量值,即路由对象属性值 M。
  10124. * @param {number} options.x - 获取当前点对象在地理坐标系下的 X 坐标值。
  10125. * @param {number} options.y - 获取当前点对象在地理坐标系下的 Y 坐标值。
  10126. * @extends {SuperMap.Geometry.Point}
  10127. */
  10128. class PointWithMeasure extends Point {
  10129. constructor(options) {
  10130. super(options);
  10131. /**
  10132. * @member {number} SuperMap.PointWithMeasure.prototype.measure
  10133. * @description 度量值,即路由对象属性值 M。
  10134. */
  10135. this.measure = null;
  10136. if (options) {
  10137. Util.extend(this, options);
  10138. }
  10139. this.CLASS_NAME = "SuperMap.PointWithMeasure";
  10140. }
  10141. /**
  10142. * @function SuperMap.PointWithMeasure.prototype.equals
  10143. * @description 判断两个路由点对象是否相等。如果两个路由点对象具有相同的坐标以及度量值,则认为是相等的。
  10144. * @param {SuperMap.PointWithMeasure} geom - 需要判断的路由点对象。
  10145. * @returns {boolean} 两个路由点对象是否相等(true 为相等,false 为不等)。
  10146. */
  10147. equals(geom) {
  10148. var equals = false;
  10149. if (geom != null) {
  10150. var isValueEquals = this.x === geom.x && this.y === geom.y && this.measure === geom.measure;
  10151. var isNaNValue = isNaN(this.x) && isNaN(this.y) && isNaN(this.measure);
  10152. var isNaNGeometry = isNaN(geom.x) && isNaN(geom.y) && isNaN(geom.measure);
  10153. equals = ( isValueEquals || ( isNaNValue && isNaNGeometry ));
  10154. }
  10155. return equals;
  10156. }
  10157. /**
  10158. * @function SuperMap.PointWithMeasure.prototype.toJson
  10159. * @description 转换为 JSON 对象。
  10160. * */
  10161. toJson() {
  10162. var result = "{";
  10163. if (this.measure != null && this.measure != undefined) {
  10164. result += "\"measure\":" + this.measure + ",";
  10165. }
  10166. result += "\"x\":" + this.x + ",";
  10167. result += "\"y\":" + this.y;
  10168. result += "}";
  10169. return result;
  10170. }
  10171. /**
  10172. * @function SuperMap.PointWithMeasure.prototype.destroy
  10173. * @description 释放资源,将引用资源的属性置空。
  10174. */
  10175. destroy() {
  10176. var me = this;
  10177. me.measure = null;
  10178. me.x = null;
  10179. me.y = null;
  10180. }
  10181. /**
  10182. * @function SuperMap.PointWithMeasure.fromJson
  10183. * @description 将 JSON 对象转换为{@link SuperMap.PointWithMeasure} 对象。
  10184. * @param {Object} jsonObject - JSON 对象表示的路由点。
  10185. * @returns {SuperMap.PointWithMeasure} 转化后的 PointWithMeasure 对象。
  10186. */
  10187. static fromJson(jsonObject) {
  10188. if (!jsonObject) {
  10189. return;
  10190. }
  10191. return new PointWithMeasure({
  10192. x: jsonObject.x,
  10193. y: jsonObject.y,
  10194. measure: jsonObject.measure
  10195. });
  10196. }
  10197. }
  10198. SuperMap.PointWithMeasure = PointWithMeasure;
  10199. ;// CONCATENATED MODULE: ./src/common/iServer/Route.js
  10200. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  10201. * This program are made available under the terms of the Apache License, Version 2.0
  10202. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  10203. /**
  10204. * @class SuperMap.Route
  10205. * @category iServer SpatialAnalyst
  10206. * @classdesc 路由对象类。路由对象为一系列有序的带有属性值 M 的 x,y 坐标对,其中 M 值为该结点的距离属性(到已知点的距离)。
  10207. * @param {Array.<SuperMap.Geometry>} points - 形成路由对象的线数组。
  10208. * @param {Object} options - 参数。
  10209. * @param {number} options.id - 路由对象在数据库中的 id。
  10210. * @param {number} options.length - 路由对象的长度。单位与数据集的单位相同。
  10211. * @param {number} [options.maxM] - 最大线性度量值,即所有结点到起始点的量算距离中最大值。
  10212. * @param {number} [options.minM] - 最小线性度量值,即所有结点到起始点的量算距离中最小值。
  10213. * @param {string} [options.type] - 数据类型,如:"LINEM"。
  10214. * @extends {SuperMap.Geometry.Collection}
  10215. */
  10216. class Route extends Collection {
  10217. constructor(points, options) {
  10218. super(points, options);
  10219. /**
  10220. * @member {number} SuperMap.Route.prototype.id
  10221. * @description 路由对象在数据库中的 ID。
  10222. */
  10223. this.id = null;
  10224. /**
  10225. * @member {number} SuperMap.Route.prototype.center
  10226. * @description 路由对象的中心点。
  10227. */
  10228. this.center = null;
  10229. /**
  10230. * @member {string} SuperMap.Route.prototype.style
  10231. * @description 路由对象的样式。
  10232. */
  10233. this.style = null;
  10234. /**
  10235. * @member {number} SuperMap.Route.prototype.length
  10236. * @description 路由对象的长度。单位与数据集的单位相同。
  10237. */
  10238. this.length = null;
  10239. /**
  10240. * @member {number} SuperMap.Route.prototype.maxM
  10241. * @description 最大线性度量值,即所有结点到起始点的量算距离中最大值。
  10242. */
  10243. this.maxM = null;
  10244. /**
  10245. * @member {number} SuperMap.Route.prototype.minM
  10246. * @description 最小线性度量值,即所有结点到起始点的量算距离中最小值。
  10247. */
  10248. this.minM = null;
  10249. /**
  10250. * @member {Array.<number>} SuperMap.Route.prototype.parts
  10251. * @description 服务端几何对象中各个子对象所包含的节点个数。
  10252. */
  10253. this.parts = null;
  10254. /**
  10255. * @member {Array.<Object>} SuperMap.Route.prototype.points
  10256. * @description 路由对象的所有路由点。
  10257. * @example
  10258. * (start code)
  10259. * [
  10260. * {
  10261. * "measure": 0,
  10262. * "y": -4377.027184298267,
  10263. * "x": 4020.0045221720466
  10264. * },
  10265. * {
  10266. * "measure": 37.33288381391519,
  10267. * "y": -4381.569363260499,
  10268. * "x": 4057.0600591960642
  10269. * }
  10270. * ]
  10271. * (end)
  10272. */
  10273. this.points = null;
  10274. /**
  10275. * @member {string} SuperMap.Route.prototype.type
  10276. * @description 服务端几何对象类型。
  10277. */
  10278. this.type = null;
  10279. /**
  10280. * @member {Array.<string>} [SuperMap.Route.prototype.componentTypes=SuperMap.Geometry.LineString]
  10281. * @description components 存储的的几何对象所支持的几何类型数组。
  10282. */
  10283. this.componentTypes = ["SuperMap.Geometry.LinearRing", "SuperMap.Geometry.LineString"];
  10284. if (options) {
  10285. Util.extend(this, options);
  10286. }
  10287. this.CLASS_NAME = "SuperMap.Route";
  10288. this.geometryType = "LINEM";
  10289. }
  10290. /**
  10291. *
  10292. * @function SuperMap.Route.prototype.toJson
  10293. * @description 转换为 JSON 对象。
  10294. * @returns {Object} JSON 对象。
  10295. */
  10296. toJson() {
  10297. var result = "{";
  10298. if (this.id != null && this.id != undefined) {
  10299. result += "\"id\":" + this.id + ",";
  10300. }
  10301. if (this.center != null && this.center != undefined) {
  10302. result += "\"center\":" + this.center + ",";
  10303. }
  10304. if (this.style != null && this.style != undefined) {
  10305. result += "\"style\":" + this.style + ",";
  10306. }
  10307. if (this.length != null && this.length != undefined) {
  10308. result += "\"length\":" + this.length + ",";
  10309. }
  10310. if (this.maxM != null && this.maxM != undefined) {
  10311. result += "\"maxM\":" + this.maxM + ",";
  10312. }
  10313. if (this.minM != null && this.minM != undefined) {
  10314. result += "\"minM\":" + this.minM + ",";
  10315. }
  10316. if (this.type != null && this.type != undefined) {
  10317. result += "\"type\":\"" + this.type + "\",";
  10318. }
  10319. if (this.parts != null && this.parts != undefined) {
  10320. result += "\"parts\":[" + this.parts[0];
  10321. for (var i = 1; i < this.parts.length; i++) {
  10322. result += "," + this.parts[i];
  10323. }
  10324. result += "],";
  10325. }
  10326. if (this.components != null && this.components.length > 0) {
  10327. result += "\"points\":[";
  10328. for (var j = 0, len = this.components.length; j < len; j++) {
  10329. for (var k = 0, len2 = this.components[j].components.length; k < len2; k++) {
  10330. result += this.components[j].components[k].toJson() + ",";
  10331. }
  10332. }
  10333. result = result.replace(/,$/g, '');
  10334. result += "]";
  10335. }
  10336. result = result.replace(/,$/g, '');
  10337. result += "}";
  10338. return result;
  10339. }
  10340. /**
  10341. * @function SuperMap.Route.prototype.destroy
  10342. * @override
  10343. */
  10344. destroy() {
  10345. var me = this;
  10346. me.id = null;
  10347. me.center = null;
  10348. me.style = null;
  10349. me.length = null;
  10350. me.maxM = null;
  10351. me.minM = null;
  10352. me.type = null;
  10353. me.parts = null;
  10354. me.components.length = 0;
  10355. me.components = null;
  10356. me.componentTypes = null;
  10357. }
  10358. /**
  10359. * @function SuperMap.Route.fromJson
  10360. * @description 将 JSON 对象转换为 SuperMap.Route 对象。
  10361. * @param {Object} [jsonObject] - JSON 对象表示的路由对象。
  10362. * @returns {SuperMap.Route} 转化后的 Route 对象。
  10363. */
  10364. static fromJson(jsonObject) {
  10365. if (!jsonObject) {
  10366. return;
  10367. }
  10368. var geoParts = jsonObject.parts || [],
  10369. geoPoints = jsonObject.points || [],
  10370. len = geoParts.length,
  10371. lineList = [];
  10372. if (len > 0) {
  10373. for (var i = 0, pointIndex = 0, pointList = []; i < len; i++) {
  10374. for (var j = 0; j < geoParts[i]; j++) {
  10375. pointList.push(PointWithMeasure.fromJson(geoPoints[pointIndex + j]));
  10376. }
  10377. pointIndex += geoParts[i];
  10378. //判断线是否闭合,如果闭合,则返回LinearRing,否则返回LineString
  10379. if (pointList[0].equals(pointList[geoParts[i] - 1])) {
  10380. lineList.push(new LinearRing(pointList));
  10381. } else {
  10382. lineList.push(new LineString(pointList));
  10383. }
  10384. pointList = [];
  10385. }
  10386. } else {
  10387. return null;
  10388. }
  10389. return new Route(lineList, {
  10390. id: jsonObject.id,
  10391. center: jsonObject.center,
  10392. style: jsonObject.style,
  10393. length: jsonObject.length,
  10394. maxM: jsonObject.maxM,
  10395. minM: jsonObject.minM,
  10396. type: jsonObject.type,
  10397. parts: jsonObject.parts
  10398. });
  10399. }
  10400. }
  10401. SuperMap.Route = Route;
  10402. ;// CONCATENATED MODULE: ./src/common/iServer/ServerGeometry.js
  10403. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  10404. * This program are made available under the terms of the Apache License, Version 2.0
  10405. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  10406. /**
  10407. * @class SuperMap.ServerGeometry
  10408. * @category iServer
  10409. * @classdesc 服务端几何对象类。该类描述几何对象(矢量)的特征数据(坐标点对、几何对象的类型等)。基于服务端的空间分析、空间关系运算、查询等 GIS 服务功能使用服务端几何对象。
  10410. * @param {Object} options - 参数。
  10411. * @param {string} options.id - 服务端几何对象唯一标识符。
  10412. * @param {Array.<number>} options.parts - 服务端几何对象中各个子对象所包含的节点个数。
  10413. * @param {Array.<SuperMap.Geometry.Point>} options.points - 组成几何对象的节点的坐标对数组。
  10414. * @param {SuperMap.GeometryType} options.type - 几何对象的类型。
  10415. * @param {SuperMap.ServerStyle} [options.style] - 服务端几何对象的风格。
  10416. */
  10417. class ServerGeometry {
  10418. constructor(options) {
  10419. /**
  10420. * @member {string} SuperMap.ServerGeometry.prototype.id
  10421. * @description 服务端几何对象唯一标识符。
  10422. */
  10423. this.id = 0;
  10424. /**
  10425. * @member {SuperMap.ServerStyle} [SuperMap.ServerGeometry.prototype.style]
  10426. * @description 服务端几何对象的风格(ServerStyle)。
  10427. */
  10428. this.style = null;
  10429. /**
  10430. * @member {Array.<number>} SuperMap.ServerGeometry.prototype.parts
  10431. * @description 服务端几何对象中各个子对象所包含的节点个数。<br>
  10432. * 1.几何对象从结构上可以分为简单几何对象和复杂几何对象。
  10433. * 简单几何对象与复杂几何对象的区别:简单的几何对象一般为单一对象,
  10434. * 而复杂的几何对象由多个简单对象组成或经过一定的空间运算之后产生,
  10435. * 如:矩形为简单的区域对象,而中空的矩形为复杂的区域对象。<br>
  10436. * 2.通常情况,一个简单几何对象的子对象就是它本身,
  10437. * 因此对于简单对象来说的该字段为长度为1的整型数组,
  10438. * 该字段的值就是这个简单对象节点的个数。
  10439. * 如果一个几何对象是由几个简单对象组合而成的,
  10440. * 例如,一个岛状几何对象由 3 个简单的多边形组成而成,
  10441. * 那么这个岛状的几何对象的 Parts 字段值就是一个长度为 3 的整型数组,
  10442. * 数组中每个成员的值分别代表这三个多边形所包含的节点个数。
  10443. */
  10444. this.parts = null;
  10445. /**
  10446. * @member {Array.<SuperMap.Geometry.Point>} SuperMap.ServerGeometry.prototype.points
  10447. * @description 组成几何对象的节点的坐标对数组。<br>
  10448. * 1.所有几何对象(点、线、面)都是由一些简单的点坐标组成的,
  10449. * 该字段存放了组成几何对象的点坐标的数组。
  10450. * 对于简单的面对象,他的起点和终点的坐标点相同。<br>
  10451. * 2.对于复杂的几何对象,根据 Parts 属性来确定每一个组成复杂几何对象的简单对象所对应的节点的个数,
  10452. * 从而确定 Points 字段中坐标对的分配归属问题。
  10453. */
  10454. this.points = null;
  10455. /**
  10456. * @member {SuperMap.GeometryType} SuperMap.ServerGeometry.prototype.type
  10457. * @description 几何对象的类型(GeometryType)。
  10458. */
  10459. this.type = null;
  10460. /**
  10461. * @member {Object} SuperMap.ServerGeometry.prototype.prjCoordSys
  10462. * @description 投影坐标参数,现仅在缓冲区分析中有效。
  10463. */
  10464. this.prjCoordSys = null;
  10465. if (options) {
  10466. Util.extend(this, options);
  10467. }
  10468. this.CLASS_NAME = 'SuperMap.ServerGeometry';
  10469. }
  10470. /**
  10471. * @function SuperMap.ServerGeometry.prototype.destroy
  10472. * @description 释放资源,将引用资源的属性置空。
  10473. */
  10474. destroy() {
  10475. var me = this;
  10476. me.id = null;
  10477. me.style = null;
  10478. me.parts = null;
  10479. me.partTopo = null;
  10480. me.points = null;
  10481. me.type = null;
  10482. me.prjCoordSys = null;
  10483. }
  10484. /**
  10485. * @function SuperMap.ServerGeometry.prototype.toGeometry
  10486. * @description 将服务端几何对象 ServerGeometry 转换为客户端几何对象 Geometry。
  10487. * @returns {SuperMap.Geometry} 转换后的客户端几何对象。
  10488. */
  10489. toGeometry() {
  10490. var me = this,
  10491. geoType = me.type;
  10492. switch (geoType.toUpperCase()) {
  10493. case GeometryType.POINT:
  10494. return me.toGeoPoint();
  10495. case GeometryType.LINE:
  10496. return me.toGeoLine();
  10497. case GeometryType.LINEM:
  10498. return me.toGeoLinem();
  10499. case GeometryType.REGION:
  10500. return me.toGeoRegion();
  10501. case GeometryType.POINTEPS:
  10502. return me.toGeoPoint();
  10503. case GeometryType.LINEEPS:
  10504. return me.toGeoLineEPS();
  10505. case GeometryType.REGIONEPS:
  10506. return me.toGeoRegionEPS();
  10507. case GeometryType.GEOCOMPOUND:
  10508. return me.transformGeoCompound();
  10509. }
  10510. }
  10511. /**
  10512. * @function SuperMap.ServerGeometry.prototype.toGeoPoint
  10513. * @description 将服务端的点几何对象转换为客户端几何对象。包括 Point、MultiPoint。
  10514. * @returns {SuperMap.Geometry} 转换后的客户端几何对象。
  10515. */
  10516. toGeoPoint() {
  10517. var me = this,
  10518. geoParts = me.parts || [],
  10519. geoPoints = me.points || [],
  10520. len = geoParts.length;
  10521. if (len > 0) {
  10522. if (len === 1) {
  10523. return new Point(geoPoints[0].x, geoPoints[0].y);
  10524. } else {
  10525. var pointList = [];
  10526. for (let i = 0; i < len; i++) {
  10527. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y));
  10528. }
  10529. return new MultiPoint(pointList);
  10530. }
  10531. } else {
  10532. return null;
  10533. }
  10534. }
  10535. /**
  10536. * @function SuperMap.ServerGeometry.prototype.toGeoLine
  10537. * @description 将服务端的线几何对象转换为客户端几何对象。包括 LinearRing、LineString、MultiLineString。
  10538. * @returns {SuperMap.Geometry} 转换后的客户端几何对象。
  10539. */
  10540. toGeoLine() {
  10541. var me = this,
  10542. geoParts = me.parts || [],
  10543. geoPoints = me.points || [],
  10544. len = geoParts.length;
  10545. if (len > 0) {
  10546. if (len === 1) {
  10547. let pointList = [];
  10548. for (let i = 0; i < geoParts[0]; i++) {
  10549. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y));
  10550. }
  10551. //判断线是否闭合,如果闭合,则返回LinearRing,否则返回LineString
  10552. if (pointList[0].equals(pointList[geoParts[0] - 1])) {
  10553. return new LinearRing(pointList);
  10554. } else {
  10555. return new LineString(pointList);
  10556. }
  10557. } else {
  10558. let lineList = [];
  10559. for (let i = 0; i < len; i++) {
  10560. let pointList = [];
  10561. for (let j = 0; j < geoParts[i]; j++) {
  10562. pointList.push(new Point(geoPoints[j].x, geoPoints[j].y));
  10563. }
  10564. lineList.push(new LineString(pointList));
  10565. geoPoints.splice(0, geoParts[i]);
  10566. }
  10567. return new MultiLineString(lineList);
  10568. }
  10569. } else {
  10570. return null;
  10571. }
  10572. }
  10573. /**
  10574. * @function SuperMap.ServerGeometry.prototype.toGeoLineEPS
  10575. * @description 将服务端的线几何对象转换为客户端几何对象。包括 LinearRing、LineString、MultiLineString。
  10576. * @returns {SuperMap.Geometry} 转换后的客户端几何对象。
  10577. */
  10578. toGeoLineEPS() {
  10579. var me = this,
  10580. geoParts = me.parts || [],
  10581. geoPoints = me.points || [],
  10582. i,
  10583. j,
  10584. pointList,
  10585. lineList,
  10586. lineEPS,
  10587. len = geoParts.length;
  10588. if (len > 0) {
  10589. if (len === 1) {
  10590. for (i = 0, pointList = []; i < geoParts[0]; i++) {
  10591. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y, geoPoints[i].type));
  10592. }
  10593. //判断线是否闭合,如果闭合,则返回LinearRing,否则返回LineString
  10594. if (pointList[0].equals(pointList[geoParts[0] - 1])) {
  10595. lineEPS = LineString.createLineEPS(pointList);
  10596. return new LinearRing(lineEPS);
  10597. } else {
  10598. lineEPS = LineString.createLineEPS(pointList);
  10599. return new LineString(lineEPS);
  10600. }
  10601. } else {
  10602. for (i = 0, lineList = []; i < len; i++) {
  10603. for (j = 0, pointList = []; j < geoParts[i]; j++) {
  10604. pointList.push(new Point(geoPoints[j].x, geoPoints[j].y));
  10605. }
  10606. lineEPS = LineString.createLineEPS(pointList);
  10607. lineList.push(new LineString(lineEPS));
  10608. geoPoints.splice(0, geoParts[i]);
  10609. }
  10610. return new MultiLineString(lineList);
  10611. }
  10612. } else {
  10613. return null;
  10614. }
  10615. }
  10616. /**
  10617. * @function SuperMap.ServerGeometry.prototype.toGeoLine
  10618. * @description 将服务端的路由线几何对象转换为客户端几何对象。包括 LinearRing、LineString、MultiLineString。
  10619. * @returns {SuperMap.Geometry} 转换后的客户端几何对象。
  10620. */
  10621. toGeoLinem() {
  10622. var me = this;
  10623. return Route.fromJson(me);
  10624. }
  10625. /**
  10626. * @function SuperMap.ServerGeometry.prototype.toGeoRegion
  10627. * @description 将服务端的面几何对象转换为客户端几何对象。类型为 Polygon。
  10628. * @returns {SuperMap.Geometry} 转换后的客户端几何对象。
  10629. */
  10630. toGeoRegion() {
  10631. var me = this,
  10632. geoParts = me.parts || [],
  10633. geoTopo = me.partTopo || [],
  10634. geoPoints = me.points || [],
  10635. len = geoParts.length;
  10636. if (len <= 0) {
  10637. return null;
  10638. }
  10639. var polygonArray = [];
  10640. var pointList = [];
  10641. if (len == 1) {
  10642. for (let i = 0; i < geoPoints.length; i++) {
  10643. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y));
  10644. }
  10645. polygonArray.push(new Polygon([new LinearRing(pointList)]));
  10646. return new MultiPolygon(polygonArray);
  10647. }
  10648. //处理复杂面
  10649. var CCWArray = [];
  10650. var areaArray = [];
  10651. var polygonArrayTemp = [];
  10652. var polygonBounds = [];
  10653. //polyon岛洞标识数组,初始都是岛。
  10654. var CCWIdent = [];
  10655. for (let i = 0, pointIndex = 0; i < len; i++) {
  10656. for (let j = 0; j < geoParts[i]; j++) {
  10657. pointList.push(new Point(geoPoints[pointIndex + j].x, geoPoints[pointIndex + j].y));
  10658. }
  10659. pointIndex += geoParts[i];
  10660. var polygon = new Polygon([new LinearRing(pointList)]);
  10661. pointList = [];
  10662. polygonArrayTemp.push(polygon);
  10663. if (geoTopo.length === 0) {
  10664. polygonBounds.push(polygon.getBounds());
  10665. }
  10666. CCWIdent.push(1);
  10667. areaArray.push(polygon.getArea());
  10668. }
  10669. //根据面积排序
  10670. ServerGeometry.bubbleSort(areaArray, polygonArrayTemp, geoTopo, polygonBounds);
  10671. //iServer 9D新增字段
  10672. if (geoTopo.length === 0) {
  10673. //岛洞底层判断原则:将所有的子对象按照面积排序,面积最大的直接判定为岛(1),从面积次大的开始处理,
  10674. // 如果发现该对象在某个面积大于它的对象之中(即被包含),则根据包含它的对象的标识(1 or -1),指定其标识(-1 or 1),
  10675. // 依次处理完所有对象,就得到了一个标识数组,1表示岛,-1表示洞
  10676. //目标polygon索引列表 -1标示没有被任何polygon包含,
  10677. var targetArray = [];
  10678. for (let i = 1; i < polygonArrayTemp.length; i++) {
  10679. for (let j = i - 1; j >= 0; j--) {
  10680. targetArray[i] = -1;
  10681. if (polygonBounds[j].containsBounds(polygonBounds[i])) {
  10682. CCWIdent[i] = CCWIdent[j] * -1;
  10683. if (CCWIdent[i] < 0) {
  10684. targetArray[i] = j;
  10685. }
  10686. break;
  10687. }
  10688. }
  10689. }
  10690. for (let i = 0; i < polygonArrayTemp.length; i++) {
  10691. if (CCWIdent[i] > 0) {
  10692. polygonArray.push(polygonArrayTemp[i]);
  10693. } else {
  10694. polygonArray[targetArray[i]].components = polygonArray[targetArray[i]].components.concat(
  10695. polygonArrayTemp[i].components
  10696. );
  10697. //占位
  10698. polygonArray.push('');
  10699. }
  10700. }
  10701. } else {
  10702. //根据面积排序
  10703. //ServerGeometry.bubbleSort(areaArray, polygonArrayTemp,geoTopo);
  10704. polygonArray = new Array();
  10705. for (let i = 0; i < polygonArrayTemp.length; i++) {
  10706. if (geoTopo[i] && geoTopo[i] == -1) {
  10707. CCWArray = CCWArray.concat(polygonArrayTemp[i].components);
  10708. } else {
  10709. if (CCWArray.length > 0 && polygonArray.length > 0) {
  10710. polygonArray[polygonArray.length - 1].components = polygonArray[
  10711. polygonArray.length - 1
  10712. ].components.concat(CCWArray);
  10713. CCWArray = [];
  10714. }
  10715. polygonArray.push(polygonArrayTemp[i]);
  10716. }
  10717. if (i == len - 1) {
  10718. var polyLength = polygonArray.length;
  10719. if (polyLength) {
  10720. polygonArray[polyLength - 1].components = polygonArray[polyLength - 1].components.concat(
  10721. CCWArray
  10722. );
  10723. } else {
  10724. for (let k = 0, length = CCWArray.length; k < length; k++) {
  10725. polygonArray.push(new Polygon(CCWArray));
  10726. }
  10727. }
  10728. }
  10729. }
  10730. }
  10731. return new MultiPolygon(polygonArray);
  10732. }
  10733. /**
  10734. * @function SuperMap.ServerGeometry.prototype.toGeoRegionEPS
  10735. * @description 将服务端的面几何对象转换为客户端几何对象。类型为 Polygon。
  10736. * @returns {SuperMap.Geometry} 转换后的客户端几何对象。
  10737. */
  10738. toGeoRegionEPS() {
  10739. var me = this,
  10740. geoParts = me.parts || [],
  10741. geoTopo = me.partTopo || [],
  10742. geoPoints = me.points || [],
  10743. len = geoParts.length;
  10744. if (len <= 0) {
  10745. return null;
  10746. }
  10747. var polygonArray = [];
  10748. var pointList = [];
  10749. var lineEPS;
  10750. if (len == 1) {
  10751. for (var i = 0; i < geoPoints.length; i++) {
  10752. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y));
  10753. }
  10754. lineEPS = LineString.createLineEPS(pointList);
  10755. polygonArray.push(new Polygon([new LinearRing(lineEPS)]));
  10756. return new MultiPolygon(polygonArray);
  10757. }
  10758. //处理复杂面
  10759. var CCWArray = [];
  10760. var areaArray = [];
  10761. var polygonArrayTemp = [];
  10762. var polygonBounds = [];
  10763. //polyon岛洞标识数组,初始都是岛。
  10764. var CCWIdent = [];
  10765. for (let i = 0, pointIndex = 0; i < len; i++) {
  10766. for (let j = 0; j < geoParts[i]; j++) {
  10767. pointList.push(new Point(geoPoints[pointIndex + j].x, geoPoints[pointIndex + j].y));
  10768. }
  10769. pointIndex += geoParts[i];
  10770. lineEPS = LineString.createLineEPS(pointList);
  10771. var polygon = new Polygon([new LinearRing(lineEPS)]);
  10772. pointList = [];
  10773. polygonArrayTemp.push(polygon);
  10774. if (geoTopo.length === 0) {
  10775. polygonBounds.push(polygon.getBounds());
  10776. }
  10777. CCWIdent.push(1);
  10778. areaArray.push(polygon.getArea());
  10779. }
  10780. //根据面积排序
  10781. ServerGeometry.bubbleSort(areaArray, polygonArrayTemp, geoTopo, polygonBounds);
  10782. //iServer 9D新增字段
  10783. if (geoTopo.length === 0) {
  10784. //岛洞底层判断原则:将所有的子对象按照面积排序,面积最大的直接判定为岛(1),从面积次大的开始处理,
  10785. // 如果发现该对象在某个面积大于它的对象之中(即被包含),则根据包含它的对象的标识(1 or -1),指定其标识(-1 or 1),
  10786. // 依次处理完所有对象,就得到了一个标识数组,1表示岛,-1表示洞
  10787. //目标polygon索引列表 -1标示没有被任何polygon包含,
  10788. var targetArray = [];
  10789. for (let i = 1; i < polygonArrayTemp.length; i++) {
  10790. for (let j = i - 1; j >= 0; j--) {
  10791. targetArray[i] = -1;
  10792. if (polygonBounds[j].containsBounds(polygonBounds[i])) {
  10793. CCWIdent[i] = CCWIdent[j] * -1;
  10794. if (CCWIdent[i] < 0) {
  10795. targetArray[i] = j;
  10796. }
  10797. break;
  10798. }
  10799. }
  10800. }
  10801. for (let i = 0; i < polygonArrayTemp.length; i++) {
  10802. if (CCWIdent[i] > 0) {
  10803. polygonArray.push(polygonArrayTemp[i]);
  10804. } else {
  10805. polygonArray[targetArray[i]].components = polygonArray[targetArray[i]].components.concat(
  10806. polygonArrayTemp[i].components
  10807. );
  10808. //占位
  10809. polygonArray.push('');
  10810. }
  10811. }
  10812. } else {
  10813. //根据面积排序
  10814. polygonArray = new Array();
  10815. for (let i = 0; i < polygonArrayTemp.length; i++) {
  10816. if (geoTopo[i] && geoTopo[i] == -1) {
  10817. CCWArray = CCWArray.concat(polygonArrayTemp[i].components);
  10818. } else {
  10819. if (CCWArray.length > 0 && polygonArray.length > 0) {
  10820. polygonArray[polygonArray.length - 1].components = polygonArray[
  10821. polygonArray.length - 1
  10822. ].components.concat(CCWArray);
  10823. CCWArray = [];
  10824. }
  10825. polygonArray.push(polygonArrayTemp[i]);
  10826. }
  10827. if (i == len - 1) {
  10828. var polyLength = polygonArray.length;
  10829. if (polyLength) {
  10830. polygonArray[polyLength - 1].components = polygonArray[polyLength - 1].components.concat(
  10831. CCWArray
  10832. );
  10833. } else {
  10834. for (let k = 0, length = CCWArray.length; k < length; k++) {
  10835. polygonArray.push(new Polygon(CCWArray));
  10836. }
  10837. }
  10838. }
  10839. }
  10840. }
  10841. return new MultiPolygon(polygonArray);
  10842. }
  10843. transformGeoCompound() {
  10844. const me = this,
  10845. geoParts = me.geoParts || [],
  10846. len = geoParts.length;
  10847. if (len <= 0) {
  10848. return null;
  10849. }
  10850. const geometryList = [];
  10851. for (let index = 0; index < len; index++) {
  10852. const geometry = geoParts[index];
  10853. geometryList.push(new ServerGeometry(geometry).toGeometry());
  10854. }
  10855. return new Collection(geometryList);
  10856. }
  10857. /**
  10858. * @function SuperMap.ServerGeometry.prototype.fromJson
  10859. * @description 将 JSON 对象表示服务端几何对象转换为 ServerGeometry。
  10860. * @param {Object} jsonObject - 要转换的 JSON 对象。
  10861. * @returns {SuperMap.ServerGeometry} 转换后的 ServerGeometry 对象。
  10862. */
  10863. static fromJson(jsonObject) {
  10864. if (!jsonObject) {
  10865. return;
  10866. }
  10867. return new ServerGeometry({
  10868. id: jsonObject.id,
  10869. style: ServerStyle.fromJson(jsonObject.style),
  10870. parts: jsonObject.parts,
  10871. partTopo: jsonObject.partTopo,
  10872. points: jsonObject.points,
  10873. center: jsonObject.center,
  10874. length: jsonObject.length,
  10875. maxM: jsonObject.maxM,
  10876. minM: jsonObject.minM,
  10877. type: jsonObject.type
  10878. });
  10879. }
  10880. /**
  10881. * @function SuperMap.ServerGeometry.prototype.fromGeometry
  10882. * @description 将客户端 Geometry 转换成服务端 ServerGeometry。
  10883. * @param {SuperMap.Geometry} geometry - 要转换的客户端 Geometry 对象。
  10884. * @returns {SuperMap.ServerGeometry} 转换后的 ServerGeometry 对象。
  10885. */
  10886. static fromGeometry(geometry) {
  10887. if (!geometry) {
  10888. return;
  10889. }
  10890. var id = 0,
  10891. parts = [],
  10892. points = [],
  10893. type = null,
  10894. icomponents = geometry.components,
  10895. className = geometry.CLASS_NAME,
  10896. prjCoordSys = { epsgCode: geometry.SRID };
  10897. if (!isNaN(geometry.id)) {
  10898. id = geometry.id;
  10899. }
  10900. //坑爹的改法,没法,为了支持态势标绘,有时间就得全改
  10901. if (
  10902. className != 'SuperMap.Geometry.LinearRing' &&
  10903. className != 'SuperMap.Geometry.LineString' &&
  10904. (geometry instanceof MultiPoint || geometry instanceof MultiLineString)
  10905. ) {
  10906. let ilen = icomponents.length;
  10907. for (let i = 0; i < ilen; i++) {
  10908. let partPointsCount = icomponents[i].getVertices().length;
  10909. parts.push(partPointsCount);
  10910. for (let j = 0; j < partPointsCount; j++) {
  10911. points.push(new Point(icomponents[i].getVertices()[j].x, icomponents[i].getVertices()[j].y));
  10912. }
  10913. }
  10914. //这里className不是多点就全部是算线
  10915. type = className == 'SuperMap.Geometry.MultiPoint' ? GeometryType.POINT : GeometryType.LINE;
  10916. } else if (geometry instanceof MultiPolygon) {
  10917. let ilen = icomponents.length;
  10918. for (let i = 0; i < ilen; i++) {
  10919. let polygon = icomponents[i],
  10920. linearRingOfPolygon = polygon.components,
  10921. linearRingOfPolygonLen = linearRingOfPolygon.length;
  10922. for (let j = 0; j < linearRingOfPolygonLen; j++) {
  10923. let partPointsCount = linearRingOfPolygon[j].getVertices().length + 1;
  10924. parts.push(partPointsCount);
  10925. for (let k = 0; k < partPointsCount - 1; k++) {
  10926. points.push(
  10927. new Point(
  10928. linearRingOfPolygon[j].getVertices()[k].x,
  10929. linearRingOfPolygon[j].getVertices()[k].y
  10930. )
  10931. );
  10932. }
  10933. points.push(
  10934. new Point(linearRingOfPolygon[j].getVertices()[0].x, linearRingOfPolygon[j].getVertices()[0].y)
  10935. );
  10936. }
  10937. }
  10938. type = GeometryType.REGION;
  10939. } else if (geometry instanceof Polygon) {
  10940. let ilen = icomponents.length;
  10941. for (let i = 0; i < ilen; i++) {
  10942. let partPointsCount = icomponents[i].getVertices().length + 1;
  10943. parts.push(partPointsCount);
  10944. for (let j = 0; j < partPointsCount - 1; j++) {
  10945. points.push(new Point(icomponents[i].getVertices()[j].x, icomponents[i].getVertices()[j].y));
  10946. }
  10947. points.push(new Point(icomponents[i].getVertices()[0].x, icomponents[i].getVertices()[0].y));
  10948. }
  10949. type = GeometryType.REGION;
  10950. } else {
  10951. let geometryVerticesCount = geometry.getVertices().length;
  10952. for (let j = 0; j < geometryVerticesCount; j++) {
  10953. points.push(new Point(geometry.getVertices()[j].x, geometry.getVertices()[j].y));
  10954. }
  10955. if (geometry instanceof LinearRing) {
  10956. points.push(new Point(geometry.getVertices()[0].x, geometry.getVertices()[0].y));
  10957. geometryVerticesCount++;
  10958. }
  10959. parts.push(geometryVerticesCount);
  10960. type = geometry instanceof Point ? GeometryType.POINT : GeometryType.LINE;
  10961. }
  10962. return new ServerGeometry({
  10963. id: id,
  10964. style: null,
  10965. parts: parts,
  10966. points: points,
  10967. type: type,
  10968. prjCoordSys: prjCoordSys
  10969. });
  10970. }
  10971. /**
  10972. * @function SuperMap.ServerGeometry.prototype.IsClockWise
  10973. * @description 判断 linearRing 中的点的顺序。返回值大于 0,逆时针;小于 0,顺时针。
  10974. * @param {SuperMap.Geometry} geometry - 要转换的客户端 Geometry 对象。
  10975. * @returns {number} 返回值大于 0,逆时针;小于 0,顺时针。
  10976. */
  10977. static IsClockWise(points) {
  10978. var length = points.length;
  10979. if (length < 3) {
  10980. return 0.0;
  10981. }
  10982. var s = points[0].y * (points[length - 1].x - points[1].x);
  10983. points.push(points[0]);
  10984. for (var i = 1; i < length; i++) {
  10985. s += points[i].y * (points[i - 1].x - points[i + 1].x);
  10986. }
  10987. return s * 0.5;
  10988. }
  10989. static bubbleSort(areaArray, pointList, geoTopo, polygonBounds) {
  10990. for (var i = 0; i < areaArray.length; i++) {
  10991. for (var j = 0; j < areaArray.length; j++) {
  10992. if (areaArray[i] > areaArray[j]) {
  10993. var d = areaArray[j];
  10994. areaArray[j] = areaArray[i];
  10995. areaArray[i] = d;
  10996. var b = pointList[j];
  10997. pointList[j] = pointList[i];
  10998. pointList[i] = b;
  10999. if (geoTopo && geoTopo.length > 0) {
  11000. var c = geoTopo[j];
  11001. geoTopo[j] = geoTopo[i];
  11002. geoTopo[i] = c;
  11003. }
  11004. if (polygonBounds && polygonBounds.length > 0) {
  11005. var f = polygonBounds[j];
  11006. polygonBounds[j] = polygonBounds[i];
  11007. polygonBounds[i] = f;
  11008. }
  11009. }
  11010. }
  11011. }
  11012. }
  11013. }
  11014. SuperMap.ServerGeometry = ServerGeometry;
  11015. ;// CONCATENATED MODULE: ./src/common/format/GeoJSON.js
  11016. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  11017. * This program are made available under the terms of the Apache License, Version 2.0
  11018. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11019. /**
  11020. * @class SuperMap.Format.GeoJSON
  11021. * @classdesc GeoJSON 的读和写。使用 {@link SuperMap.Format.GeoJSON} 构造器创建一个 GeoJSON 解析器。
  11022. * @category BaseTypes Format
  11023. * @param {Object} [options] - 参数。
  11024. * @param {string} [options.indent=" "] - 用于格式化输出,indent 字符串会在每次缩进的时候使用一次。
  11025. * @param {string} [options.space=" "] - 用于格式化输出,space 字符串会在名值对的 ":" 后边添加。
  11026. * @param {string} [options.newline="\n"] - 用于格式化输出, newline 字符串会用在每一个名值对或数组项末尾。
  11027. * @param {number} [options.level=0] - 用于格式化输出, 表示的是缩进级别。
  11028. * @param {boolean} [options.pretty=false] - 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  11029. * @param {boolean} [options.nativeJSON] - 需要被注册的监听器对象。
  11030. * @param {boolean} [options.ignoreExtraDims=true] - 忽略维度超过 2 的几何要素。
  11031. * @extends {SuperMap.Format.JSON}
  11032. */
  11033. class GeoJSON extends JSONFormat {
  11034. constructor(options) {
  11035. super(options);
  11036. /**
  11037. * @member {boolean} [SuperMap.Format.GeoJSON.prototype.ignoreExtraDims=true]
  11038. * @description 忽略维度超过 2 的几何要素。
  11039. */
  11040. this.ignoreExtraDims = true;
  11041. this.CLASS_NAME = "SuperMap.Format.GeoJSON";
  11042. /**
  11043. * @member {Object} SuperMap.Format.GeoJSON.prototype.parseCoords
  11044. * @private
  11045. * @description 一个属性名对应着 GeoJSON 对象的几何类型的对象。每个属性其实都是一个实际上做解析用的方法。
  11046. */
  11047. this.parseCoords = {
  11048. /**
  11049. * @function SuperMap.Format.GeoJSON.parseCoords.point
  11050. * @description 将一组坐标转成一个 {@link SuperMap.Geometry} 对象。
  11051. * @param {Object} array - GeoJSON 片段中的一组坐标。
  11052. * @returns {SuperMap.Geometry} 一个几何对象。
  11053. */
  11054. "point": function (array) {
  11055. if (this.ignoreExtraDims === false &&
  11056. array.length != 2) {
  11057. throw "Only 2D points are supported: " + array;
  11058. }
  11059. return new Point(array[0], array[1]);
  11060. },
  11061. /**
  11062. * @function SuperMap.Format.GeoJSON.parseCoords.multipoint
  11063. * @description 将坐标组数组转化成为一个 {@link SuperMap.Geometry} 对象。
  11064. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  11065. * @returns {SuperMap.Geometry} 一个几何对象。
  11066. */
  11067. "multipoint": function (array) {
  11068. var points = [];
  11069. var p = null;
  11070. for (var i = 0, len = array.length; i < len; ++i) {
  11071. try {
  11072. p = this.parseCoords["point"].apply(this, [array[i]]);
  11073. } catch (err) {
  11074. throw err;
  11075. }
  11076. points.push(p);
  11077. }
  11078. return new MultiPoint(points);
  11079. },
  11080. /**
  11081. * @function SuperMap.Format.GeoJSON.parseCoords.linestring
  11082. * @description 将坐标组数组转化成为一个 {@link SuperMap.Geometry} 对象。
  11083. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  11084. * @returns {SuperMap.Geometry} 一个几何对象。
  11085. */
  11086. "linestring": function (array) {
  11087. var points = [];
  11088. var p = null;
  11089. for (var i = 0, len = array.length; i < len; ++i) {
  11090. try {
  11091. p = this.parseCoords["point"].apply(this, [array[i]]);
  11092. } catch (err) {
  11093. throw err;
  11094. }
  11095. points.push(p);
  11096. }
  11097. return new LineString(points);
  11098. },
  11099. /**
  11100. * @function SuperMap.Format.GeoJSON.parseCoords.multilinestring
  11101. * @description 将坐标组数组转化成为一个 {@link SuperMap.Geometry} 对象。
  11102. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  11103. * @returns {SuperMap.Geometry} 一个几何对象。
  11104. */
  11105. "multilinestring": function (array) {
  11106. var lines = [];
  11107. var l = null;
  11108. for (var i = 0, len = array.length; i < len; ++i) {
  11109. try {
  11110. l = this.parseCoords["linestring"].apply(this, [array[i]]);
  11111. } catch (err) {
  11112. throw err;
  11113. }
  11114. lines.push(l);
  11115. }
  11116. return new MultiLineString(lines);
  11117. },
  11118. /**
  11119. * @function SuperMap.Format.GeoJSON.parseCoords.polygon
  11120. * @description 将坐标组数组转化成为一个 {@link SuperMap.Geometry} 对象。
  11121. * @returns {SuperMap.Geometry} 一个几何对象。
  11122. */
  11123. "polygon": function (array) {
  11124. var rings = [];
  11125. var r, l;
  11126. for (var i = 0, len = array.length; i < len; ++i) {
  11127. try {
  11128. l = this.parseCoords["linestring"].apply(this, [array[i]]);
  11129. } catch (err) {
  11130. throw err;
  11131. }
  11132. r = new LinearRing(l.components);
  11133. rings.push(r);
  11134. }
  11135. return new Polygon(rings);
  11136. },
  11137. /**
  11138. * @function SuperMap.Format.GeoJSON.parseCoords.multipolygon
  11139. * @description 将坐标组数组转化成为一个 {@link SuperMap.Geometry} 对象。
  11140. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  11141. * @returns {SuperMap.Geometry} 一个几何对象。
  11142. */
  11143. "multipolygon": function (array) {
  11144. var polys = [];
  11145. var p = null;
  11146. for (var i = 0, len = array.length; i < len; ++i) {
  11147. try {
  11148. p = this.parseCoords["polygon"].apply(this, [array[i]]);
  11149. } catch (err) {
  11150. throw err;
  11151. }
  11152. polys.push(p);
  11153. }
  11154. return new MultiPolygon(polys);
  11155. },
  11156. /**
  11157. * @function SuperMap.Format.GeoJSON.parseCoords.box
  11158. * @description 将坐标组数组转化成为一个 {@link SuperMap.Geometry} 对象。
  11159. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  11160. * @returns {SuperMap.Geometry} 一个几何对象。
  11161. */
  11162. "box": function (array) {
  11163. if (array.length != 2) {
  11164. throw "GeoJSON box coordinates must have 2 elements";
  11165. }
  11166. return new Polygon([
  11167. new LinearRing([
  11168. new Point(array[0][0], array[0][1]),
  11169. new Point(array[1][0], array[0][1]),
  11170. new Point(array[1][0], array[1][1]),
  11171. new Point(array[0][0], array[1][1]),
  11172. new Point(array[0][0], array[0][1])
  11173. ])
  11174. ]);
  11175. }
  11176. };
  11177. /**
  11178. * @member {Object} SuperMap.Format.GeoJSON.prototype.extract
  11179. * @private
  11180. * @description 一个属性名对应着GeoJSON类型的对象。其值为相应的实际的解析方法。
  11181. */
  11182. this.extract = {
  11183. /**
  11184. * @function SuperMap.Format.GeoJSON.extract.feature
  11185. * @description 返回一个表示单个要素对象的 GeoJSON 的一部分。
  11186. * @param {SuperMap.ServerFeature} feature - iServer 要素对象。
  11187. * @returns {Object} 一个表示点的对象。
  11188. */
  11189. 'feature': function (feature) {
  11190. var geom = this.extract.geometry.apply(this, [feature.geometry]);
  11191. var json = {
  11192. "type": "Feature",
  11193. "properties": this.createAttributes(feature),
  11194. "geometry": geom
  11195. };
  11196. if (feature.geometry && feature.geometry.type === 'TEXT') {
  11197. json.properties.texts = feature.geometry.texts;
  11198. json.properties.textStyle = feature.geometry.textStyle;
  11199. }
  11200. if (feature.fid) {
  11201. json.id = feature.fid;
  11202. }
  11203. if (feature.ID) {
  11204. json.id = feature.ID;
  11205. }
  11206. return json;
  11207. },
  11208. /**
  11209. * @function SuperMap.Format.GeoJSON.extract.geometry
  11210. * @description 返回一个表示单个几何对象的 GeoJSON 的一部分。
  11211. * @param {Object} geometry - iServer 几何对象。
  11212. * @returns {Object} 一个表示几何体的对象。
  11213. */
  11214. 'geometry': function (geometry) {
  11215. if (geometry == null) {
  11216. return null;
  11217. }
  11218. if (!geometry.parts && geometry.points) {
  11219. geometry.parts = [geometry.points.length];
  11220. }
  11221. var geo = geometry.hasOwnProperty('geometryType')
  11222. ? geometry
  11223. : new ServerGeometry(geometry).toGeometry() || geometry;
  11224. var geometryType = geo.geometryType || geo.type;
  11225. var data;
  11226. if (geometryType === "LinearRing") {
  11227. geometryType = "LineString";
  11228. }
  11229. if (geometryType === "LINEM") {
  11230. geometryType = "MultiLineString";
  11231. }
  11232. data = this.extract[geometryType.toLowerCase()].apply(this, [geo]);
  11233. geometryType = geometryType === 'TEXT' ? 'Point' : geometryType;
  11234. var json;
  11235. if (geometryType === "Collection") {
  11236. json = {
  11237. "type": "GeometryCollection",
  11238. "geometries": data
  11239. };
  11240. } else {
  11241. json = {
  11242. "type": geometryType,
  11243. "coordinates": data
  11244. };
  11245. }
  11246. return json;
  11247. },
  11248. /**
  11249. * @function SuperMap.Format.GeoJSON.extract.point
  11250. * @description 从一个点对象中返回一个坐标组。
  11251. * @param {SuperMap.Geometry.Point} point - 一个点对象。
  11252. * @returns {Array} 一个表示一个点的坐标组。
  11253. */
  11254. 'point': function (point) {
  11255. var p = [point.x, point.y];
  11256. for (var name in point) {
  11257. if (name !== "x" && name !== "y" && point[name] !== null && !isNaN(point[name])) {
  11258. p.push(point[name]);
  11259. }
  11260. }
  11261. return p;
  11262. },
  11263. /**
  11264. * @function SuperMap.Format.GeoJSON.extract.point
  11265. * @description 从一个文本对象中返回一个坐标组。
  11266. * @param {Object} geo - 一个文本对象。
  11267. * @returns {Array} 一个表示一个点的坐标组。
  11268. */
  11269. 'text': function (geo) {
  11270. return [geo.points[0].x, geo.points[0].y];
  11271. },
  11272. /**
  11273. * @function SuperMap.Format.GeoJSON.extract.multipoint
  11274. * @description 从一个多点对象中返一个坐标组数组。
  11275. * @param {SuperMap.Geometry.MultiPoint} multipoint - 多点对象。
  11276. * @returns {Array} 一个表示多点的坐标组数组。
  11277. */
  11278. 'multipoint': function (multipoint) {
  11279. var array = [];
  11280. for (var i = 0, len = multipoint.components.length; i < len; ++i) {
  11281. array.push(this.extract.point.apply(this, [multipoint.components[i]]));
  11282. }
  11283. return array;
  11284. },
  11285. /**
  11286. * @function SuperMap.Format.GeoJSON.extract.linestring
  11287. * @description 从一个线对象中返回一个坐标组数组。
  11288. * @param {SuperMap.Geometry.Linestring} linestring - 线对象。
  11289. * @returns {Array} 一个表示线对象的坐标组数组。
  11290. */
  11291. 'linestring': function (linestring) {
  11292. var array = [];
  11293. for (var i = 0, len = linestring.components.length; i < len; ++i) {
  11294. array.push(this.extract.point.apply(this, [linestring.components[i]]));
  11295. }
  11296. return array;
  11297. },
  11298. /**
  11299. * @function SuperMap.Format.GeoJSON.extract.multilinestring
  11300. * @description 从一个多线对象中返回一个线数组。
  11301. * @param {SuperMap.Geometry.MultiLinestring} multilinestring - 多线对象。
  11302. *
  11303. * @returns {Array} 一个表示多线的线数组。
  11304. */
  11305. 'multilinestring': function (multilinestring) {
  11306. var array = [];
  11307. for (var i = 0, len = multilinestring.components.length; i < len; ++i) {
  11308. array.push(this.extract.linestring.apply(this, [multilinestring.components[i]]));
  11309. }
  11310. return array;
  11311. },
  11312. /**
  11313. * @function SuperMap.Format.GeoJSON.extract.polygon
  11314. * @description 从一个面对象中返回一组线环。
  11315. * @param {SuperMap.Geometry.Polygon} polygon - 面对象。
  11316. * @returns {Array} 一组表示面的线环。
  11317. */
  11318. 'polygon': function (polygon) {
  11319. var array = [];
  11320. for (var i = 0, len = polygon.components.length; i < len; ++i) {
  11321. array.push(this.extract.linestring.apply(this, [polygon.components[i]]));
  11322. }
  11323. return array;
  11324. },
  11325. /**
  11326. * @function SuperMap.Format.GeoJSON.extract.multipolygon
  11327. * @description 从一个多面对象中返回一组面。
  11328. * @param {SuperMap.Geometry.MultiPolygon} multipolygon - 多面对象。
  11329. * @returns {Array} 一组表示多面的面。
  11330. */
  11331. 'multipolygon': function (multipolygon) {
  11332. var array = [];
  11333. for (var i = 0, len = multipolygon.components.length; i < len; ++i) {
  11334. array.push(this.extract.polygon.apply(this, [multipolygon.components[i]]));
  11335. }
  11336. return array;
  11337. },
  11338. /**
  11339. * @function SuperMap.Format.GeoJSON.extract.collection
  11340. * @description 从一个几何要素集合中一组几何要素数组。
  11341. * @param {SuperMap.Geometry.Collection} collection - 几何要素集合。
  11342. * @returns {Array} 一组表示几何要素集合的几何要素数组。
  11343. */
  11344. 'collection': function (collection) {
  11345. var len = collection.components.length;
  11346. var array = new Array(len);
  11347. for (var i = 0; i < len; ++i) {
  11348. array[i] = this.extract.geometry.apply(this, [collection.components[i]]);
  11349. }
  11350. return array;
  11351. }
  11352. };
  11353. }
  11354. /**
  11355. * @function SuperMap.Format.GeoJSON.prototype.read
  11356. * @description 将 GeoJSON 对象或者GeoJSON 对象字符串转换为 SuperMap Feature 对象。
  11357. * @param {GeoJSONObject} json - GeoJSON 对象。
  11358. * @param {string} [type='FeaureCollection'] - 可选的字符串,它决定了输出的格式。支持的值有:"Geometry","Feature",和 "FeatureCollection",如果此值为null。
  11359. * @param {Function} filter - 对象中每个层次每个键值对都会调用此函数得出一个结果。每个值都会被 filter 函数的结果所替换掉。这个函数可被用来将某些对象转化成某个类相应的对象,或者将日期字符串转化成Date对象。
  11360. * @returns {Object} 返回值依赖于 type 参数的值。
  11361. * -如果 type 等于 "FeatureCollection",返回值将会是 {@link SuperMap.Feature.Vector} 数组。
  11362. * -如果 type 为 "Geometry",输入的 JSON 对象必须表示一个唯一的几何体,然后返回值就会是 {@link SuperMap.Feature.Geometry}。
  11363. * -如果 type 为 "Feature",输入的 JSON 对象也必须表示的一个要素,这样返回值才会是 {@link SuperMap.Feature.Vector}。
  11364. */
  11365. read(json, type, filter) {
  11366. type = (type) ? type : "FeatureCollection";
  11367. var results = null;
  11368. var obj = null;
  11369. if (typeof json == "string") {
  11370. obj = super.read(json, filter);
  11371. } else {
  11372. obj = json;
  11373. }
  11374. if (!obj) {
  11375. //SuperMap.Console.error("Bad JSON: " + json);
  11376. } else if (typeof (obj.type) != "string") {
  11377. //SuperMap.Console.error("Bad GeoJSON - no type: " + json);
  11378. } else if (this.isValidType(obj, type)) {
  11379. switch (type) {
  11380. case "Geometry":
  11381. try {
  11382. results = this.parseGeometry(obj);
  11383. } catch (err) {
  11384. //SuperMap.Console.error(err);
  11385. }
  11386. break;
  11387. case "Feature":
  11388. try {
  11389. results = this.parseFeature(obj);
  11390. results.type = "Feature";
  11391. } catch (err) {
  11392. //SuperMap.Console.error(err);
  11393. }
  11394. break;
  11395. case "FeatureCollection":
  11396. // for type FeatureCollection, we allow input to be any type
  11397. results = [];
  11398. switch (obj.type) {
  11399. case "Feature":
  11400. try {
  11401. results.push(this.parseFeature(obj));
  11402. } catch (err) {
  11403. results = null;
  11404. //SuperMap.Console.error(err);
  11405. }
  11406. break;
  11407. case "FeatureCollection":
  11408. for (var i = 0, len = obj.features.length; i < len; ++i) {
  11409. try {
  11410. results.push(this.parseFeature(obj.features[i]));
  11411. } catch (err) {
  11412. results = null;
  11413. // SuperMap.Console.error(err);
  11414. }
  11415. }
  11416. break;
  11417. default:
  11418. try {
  11419. var geom = this.parseGeometry(obj);
  11420. results.push(new Vector(geom));
  11421. } catch (err) {
  11422. results = null;
  11423. //SuperMap.Console.error(err);
  11424. }
  11425. }
  11426. break;
  11427. default:
  11428. break;
  11429. }
  11430. }
  11431. return results;
  11432. }
  11433. /**
  11434. * @function SuperMap.Format.GeoJSON.prototype.write
  11435. * @description iServer Geometry JSON 对象 转 GeoJSON对象字符串。
  11436. * @param {Object} obj - iServer Geometry JSON 对象。
  11437. * @param {boolean} [pretty=false] - 是否使用换行和缩进来控制输出。
  11438. * @returns {GeoJSONObject} 一个 GeoJSON 字符串,它表示了输入的几何对象,要素对象,或者要素对象数组。
  11439. */
  11440. write(obj, pretty) {
  11441. return super.write(this.toGeoJSON(obj), pretty);
  11442. }
  11443. /**
  11444. * @function SuperMap.Format.GeoJSON.prototype.fromGeoJSON
  11445. * @version 9.1.1
  11446. * @description 将 GeoJSON 对象或者GeoJSON 对象字符串转换为iServer Feature JSON。
  11447. * @param {GeoJSONObject} json - GeoJSON 对象。
  11448. * @param {string} [type='FeaureCollection'] - 可选的字符串,它决定了输出的格式。支持的值有:"Geometry","Feature",和 "FeatureCollection",如果此值为null。
  11449. * @param {Function} filter - 对象中每个层次每个键值对都会调用此函数得出一个结果。每个值都会被 filter 函数的结果所替换掉。这个函数可被用来将某些对象转化成某个类相应的对象,或者将日期字符串转化成Date对象。
  11450. * @returns {Object} iServer Feature JSON。
  11451. */
  11452. fromGeoJSON(json, type, filter) {
  11453. let feature = this.read(json, type, filter);
  11454. if (!Util.isArray(feature)) {
  11455. return this._toiSevrerFeature(feature);
  11456. }
  11457. return feature.map((element) => {
  11458. return this._toiSevrerFeature(element);
  11459. })
  11460. }
  11461. /**
  11462. * @function SuperMap.Format.GeoJSON.prototype.toGeoJSON
  11463. * @version 9.1.1
  11464. * @description 将 iServer Feature JSON 对象转换为 GeoJSON 对象。
  11465. * @param {Object} obj - iServer Feature JSON。
  11466. * @returns {GeoJSONObject} GeoJSON 对象。
  11467. */
  11468. toGeoJSON(obj) {
  11469. var geojson = {
  11470. "type": null
  11471. };
  11472. if (Util.isArray(obj)) {
  11473. geojson.type = "FeatureCollection";
  11474. var numFeatures = obj.length;
  11475. geojson.features = new Array(numFeatures);
  11476. for (var i = 0; i < numFeatures; ++i) {
  11477. var element = obj[i];
  11478. if (isGeometry(element)) {
  11479. let feature = {};
  11480. feature.geometry = element;
  11481. geojson.features[i] = this.extract.feature.apply(this, [feature]);
  11482. } else {
  11483. geojson.features[i] = this.extract.feature.apply(this, [element]);
  11484. }
  11485. }
  11486. } else if (isGeometry(obj)) {
  11487. let feature = {};
  11488. feature.geometry = obj;
  11489. geojson = this.extract.feature.apply(this, [feature]);
  11490. } else {
  11491. geojson = this.extract.feature.apply(this, [obj]);
  11492. }
  11493. function isGeometry(input) {
  11494. return (input.hasOwnProperty("parts") && input.hasOwnProperty("points")) || input.hasOwnProperty("geoParts");
  11495. }
  11496. return geojson;
  11497. }
  11498. /**
  11499. * @function SuperMap.Format.GeoJSON.prototype.isValidType
  11500. * @description 检查一个 GeoJSON 对象是否和给定的类型相符的合法的对象。
  11501. * @returns {boolean} GeoJSON 是否是给定类型的合法对象。
  11502. * @private
  11503. */
  11504. isValidType(obj, type) {
  11505. var valid = false;
  11506. switch (type) {
  11507. case "Geometry":
  11508. if (Util.indexOf(
  11509. ["Point", "MultiPoint", "LineString", "MultiLineString",
  11510. "Polygon", "MultiPolygon", "Box", "GeometryCollection"
  11511. ],
  11512. obj.type) == -1) {
  11513. // unsupported geometry type
  11514. //SuperMap.Console.error("Unsupported geometry type: " +
  11515. // obj.type);
  11516. } else {
  11517. valid = true;
  11518. }
  11519. break;
  11520. case "FeatureCollection":
  11521. // allow for any type to be converted to a feature collection
  11522. valid = true;
  11523. break;
  11524. default:
  11525. // for Feature types must match
  11526. if (obj.type == type) {
  11527. valid = true;
  11528. } else {
  11529. //SuperMap.Console.error("Cannot convert types from " +
  11530. //obj.type + " to " + type);
  11531. }
  11532. }
  11533. return valid;
  11534. }
  11535. /**
  11536. * @function SuperMap.Format.GeoJSON.prototype.parseFeature
  11537. * @description 将一个 GeoJSON 中的 feature 转化成 {@link SuperMap.Feature.Vector}> 对象。
  11538. * @private
  11539. * @param {GeoJSONObject} obj - 从 GeoJSON 对象中创建一个对象。
  11540. * @returns {SuperMap.Feature.Vector} 一个要素。
  11541. */
  11542. parseFeature(obj) {
  11543. var feature, geometry, attributes, bbox;
  11544. attributes = (obj.properties) ? obj.properties : {};
  11545. bbox = (obj.geometry && obj.geometry.bbox) || obj.bbox;
  11546. try {
  11547. geometry = this.parseGeometry(obj.geometry);
  11548. } catch (err) {
  11549. // deal with bad geometries
  11550. throw err;
  11551. }
  11552. feature = new Vector(geometry, attributes);
  11553. if (bbox) {
  11554. feature.bounds = Bounds.fromArray(bbox);
  11555. }
  11556. if (obj.id) {
  11557. feature.fid = obj.id;
  11558. }
  11559. return feature;
  11560. }
  11561. /**
  11562. * @function SuperMap.Format.GeoJSON.prototype.parseGeometry
  11563. * @description 将一个 GeoJSON 中的几何要素转化成 {@link SuperMap.Geometry} 对象。
  11564. * @param {GeoJSONObject} obj - 从 GeoJSON 对象中创建一个对象。
  11565. * @returns {SuperMap.Geometry} 一个几何要素。
  11566. * @private
  11567. */
  11568. parseGeometry(obj) {
  11569. if (obj == null) {
  11570. return null;
  11571. }
  11572. var geometry;
  11573. if (obj.type == "GeometryCollection") {
  11574. if (!(Util.isArray(obj.geometries))) {
  11575. throw "GeometryCollection must have geometries array: " + obj;
  11576. }
  11577. var numGeom = obj.geometries.length;
  11578. var components = new Array(numGeom);
  11579. for (var i = 0; i < numGeom; ++i) {
  11580. components[i] = this.parseGeometry.apply(
  11581. this, [obj.geometries[i]]
  11582. );
  11583. }
  11584. geometry = new Collection(components);
  11585. } else {
  11586. if (!(Util.isArray(obj.coordinates))) {
  11587. throw "Geometry must have coordinates array: " + obj;
  11588. }
  11589. if (!this.parseCoords[obj.type.toLowerCase()]) {
  11590. throw "Unsupported geometry type: " + obj.type;
  11591. }
  11592. try {
  11593. geometry = this.parseCoords[obj.type.toLowerCase()].apply(
  11594. this, [obj.coordinates]
  11595. );
  11596. } catch (err) {
  11597. // deal with bad coordinates
  11598. throw err;
  11599. }
  11600. }
  11601. return geometry;
  11602. }
  11603. /**
  11604. * @function SuperMap.Format.GeoJSON.prototype.createCRSObject
  11605. * @description 从一个要素对象中创建一个坐标参考系对象。
  11606. * @param {SuperMap.Feature.Vector} object - 要素对象。
  11607. * @private
  11608. * @returns {GeoJSONObject} 一个可作为 GeoJSON 对象的 CRS 属性使用的对象。
  11609. */
  11610. createCRSObject(object) {
  11611. var proj = object.layer.projection.toString();
  11612. var crs = {};
  11613. if (proj.match(/epsg:/i)) {
  11614. var code = parseInt(proj.substring(proj.indexOf(":") + 1));
  11615. if (code == 4326) {
  11616. crs = {
  11617. "type": "name",
  11618. "properties": {
  11619. "name": "urn:ogc:def:crs:OGC:1.3:CRS84"
  11620. }
  11621. };
  11622. } else {
  11623. crs = {
  11624. "type": "name",
  11625. "properties": {
  11626. "name": "EPSG:" + code
  11627. }
  11628. };
  11629. }
  11630. }
  11631. return crs;
  11632. }
  11633. _toiSevrerFeature(feature) {
  11634. const attributes = feature.attributes;
  11635. const attrNames = [];
  11636. const attrValues = [];
  11637. for (var attr in attributes) {
  11638. attrNames.push(attr);
  11639. attrValues.push(attributes[attr]);
  11640. }
  11641. const newFeature = {
  11642. fieldNames: attrNames,
  11643. fieldValues: attrValues,
  11644. geometry: ServerGeometry.fromGeometry(feature.geometry)
  11645. };
  11646. newFeature.geometry.id = feature.fid;
  11647. return newFeature;
  11648. }
  11649. createAttributes(feature) {
  11650. if (!feature) {
  11651. return null;
  11652. }
  11653. var attr = {};
  11654. processFieldsAttributes(feature, attr);
  11655. var exceptKeys = ["fieldNames", "fieldValues", "geometry", "stringID", "ID"];
  11656. for (var key in feature) {
  11657. if (exceptKeys.indexOf(key) > -1) {
  11658. continue;
  11659. }
  11660. attr[key] = feature[key];
  11661. }
  11662. function processFieldsAttributes(feature, attributes) {
  11663. if (!(feature.hasOwnProperty("fieldNames") && feature.hasOwnProperty("fieldValues"))) {
  11664. return;
  11665. }
  11666. var names = feature.fieldNames,
  11667. values = feature.fieldValues;
  11668. for (var i in names) {
  11669. attributes[names[i]] = values[i];
  11670. }
  11671. }
  11672. return attr;
  11673. }
  11674. }
  11675. SuperMap.Format.GeoJSON = GeoJSON;
  11676. ;// CONCATENATED MODULE: ./src/common/format/WKT.js
  11677. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  11678. * This program are made available under the terms of the Apache License, Version 2.0
  11679. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11680. /**
  11681. * @class SuperMap.Format.WKT
  11682. * @classdesc 用于读写常见文本的类。通过 {@link SuperMap.Format.WKT} 构造器来创建一个新的实例。
  11683. * @category BaseTypes Format
  11684. * @extends {SuperMap.Format}
  11685. * @param {Object} options - 可选的选项对象,其属性将被设置到实例。option 具体配置项继承自 {@link SuperMap.Format}。
  11686. */
  11687. class WKT extends Format {
  11688. constructor(options) {
  11689. super(options);
  11690. this.regExes = {
  11691. 'typeStr': /^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,
  11692. 'spaces': /\s+/,
  11693. 'parenComma': /\)\s*,\s*\(/,
  11694. 'doubleParenComma': /\)\s*\)\s*,\s*\(\s*\(/, // can't use {2} here
  11695. 'trimParens': /^\s*\(?(.*?)\)?\s*$/
  11696. };
  11697. this.CLASS_NAME = "SuperMap.Format.WKT"; /**
  11698. * @private
  11699. * @description Object with properties corresponding to the geometry types.
  11700. * Property values are functions that do the actual data extraction.
  11701. */
  11702. this.extract = {
  11703. /**
  11704. * @description Return a space delimited string of point coordinates.
  11705. * @param {SuperMap.Geometry.Point} point
  11706. * @returns {string} A string of coordinates representing the point
  11707. */
  11708. 'point': function (point) {
  11709. return point.x + ' ' + point.y;
  11710. },
  11711. /**
  11712. * @description Return a comma delimited string of point coordinates from a multipoint.
  11713. * @param {SuperMap.Geometry.MultiPoint} multipoint
  11714. * @returns {string} A string of point coordinate strings representing
  11715. * the multipoint
  11716. */
  11717. 'multipoint'(multipoint) {
  11718. var array = [];
  11719. for (var i = 0, len = multipoint.components.length; i < len; ++i) {
  11720. array.push('(' +
  11721. this.extract.point.apply(this, [multipoint.components[i]]) +
  11722. ')');
  11723. }
  11724. return array.join(',');
  11725. },
  11726. /**
  11727. * @description Return a comma delimited string of point coordinates from a line.
  11728. * @param {SuperMap.Geometry.LineString} linestring
  11729. * @returns {string} A string of point coordinate strings representing
  11730. * the linestring
  11731. */
  11732. 'linestring'(linestring) {
  11733. var array = [];
  11734. for (var i = 0, len = linestring.components.length; i < len; ++i) {
  11735. array.push(this.extract.point.apply(this, [linestring.components[i]]));
  11736. }
  11737. return array.join(',');
  11738. },
  11739. /**
  11740. * @description Return a comma delimited string of linestring strings from a multilinestring.
  11741. * @param {SuperMap.Geometry.MultiLineString} multilinestring
  11742. * @returns {string} A string of of linestring strings representing
  11743. * the multilinestring
  11744. */
  11745. 'multilinestring'(multilinestring) {
  11746. var array = [];
  11747. for (var i = 0, len = multilinestring.components.length; i < len; ++i) {
  11748. array.push('(' +
  11749. this.extract.linestring.apply(this, [multilinestring.components[i]]) +
  11750. ')');
  11751. }
  11752. return array.join(',');
  11753. },
  11754. /**
  11755. * @description Return a comma delimited string of linear ring arrays from a polygon.
  11756. * @param {SuperMap.Geometry.Polygon} polygon
  11757. * @returns {string} An array of linear ring arrays representing the polygon
  11758. */
  11759. 'polygon'(polygon) {
  11760. var array = [];
  11761. for (var i = 0, len = polygon.components.length; i < len; ++i) {
  11762. array.push('(' +
  11763. this.extract.linestring.apply(this, [polygon.components[i]]) +
  11764. ')');
  11765. }
  11766. return array.join(',');
  11767. },
  11768. /**
  11769. * @description Return an array of polygon arrays from a multipolygon.
  11770. * @param {SuperMap.Geometry.MultiPolygon} multipolygon
  11771. * @returns {string} An array of polygon arrays representing
  11772. * the multipolygon
  11773. */
  11774. 'multipolygon'(multipolygon) {
  11775. var array = [];
  11776. for (var i = 0, len = multipolygon.components.length; i < len; ++i) {
  11777. array.push('(' +
  11778. this.extract.polygon.apply(this, [multipolygon.components[i]]) +
  11779. ')');
  11780. }
  11781. return array.join(',');
  11782. },
  11783. /**
  11784. * @description Return the WKT portion between 'GEOMETRYCOLLECTION(' and ')' for an <SuperMap.Geometry.Collection>
  11785. * @param {SuperMap.Geometry.Collection} collection
  11786. * @returns {string} internal WKT representation of the collection
  11787. */
  11788. 'collection'(collection) {
  11789. var array = [];
  11790. for (var i = 0, len = collection.components.length; i < len; ++i) {
  11791. array.push(this.extractGeometry.apply(this, [collection.components[i]]));
  11792. }
  11793. return array.join(',');
  11794. }
  11795. };
  11796. /**
  11797. * @private
  11798. * @description Object with properties corresponding to the geometry types.
  11799. * Property values are functions that do the actual parsing.
  11800. */
  11801. this.parse = {
  11802. /**
  11803. * @private
  11804. * @description Return point feature given a point WKT fragment.
  11805. * @param {string} str A WKT fragment representing the point
  11806. * @returns {SuperMap.Feature.Vector} A point feature
  11807. *
  11808. */
  11809. 'point': function (str) {
  11810. var coords = StringExt.trim(str).split(this.regExes.spaces);
  11811. return new Vector(new Point(coords[0], coords[1])
  11812. );
  11813. },
  11814. /**
  11815. * @description Return a multipoint feature given a multipoint WKT fragment.
  11816. * @param {string} A WKT fragment representing the multipoint
  11817. * @returns {SuperMap.Feature.Vector} A multipoint feature
  11818. * @private
  11819. */
  11820. 'multipoint': function (str) {
  11821. var point;
  11822. var points = StringExt.trim(str).split(',');
  11823. var components = [];
  11824. for (var i = 0, len = points.length; i < len; ++i) {
  11825. point = points[i].replace(this.regExes.trimParens, '$1');
  11826. components.push(this.parse.point.apply(this, [point]).geometry);
  11827. }
  11828. return new Vector(
  11829. new MultiPoint(components)
  11830. );
  11831. },
  11832. /**
  11833. * @description Return a linestring feature given a linestring WKT fragment.
  11834. * @param {string} A WKT fragment representing the linestring
  11835. * @returns {SuperMap.Feature.Vector} A linestring feature
  11836. * @private
  11837. */
  11838. 'linestring': function (str) {
  11839. var points = StringExt.trim(str).split(',');
  11840. var components = [];
  11841. for (var i = 0, len = points.length; i < len; ++i) {
  11842. components.push(this.parse.point.apply(this, [points[i]]).geometry);
  11843. }
  11844. return new Vector(
  11845. new LineString(components)
  11846. );
  11847. },
  11848. /**
  11849. * @description Return a multilinestring feature given a multilinestring WKT fragment.
  11850. * @param {string} A WKT fragment representing the multilinestring
  11851. * @returns {SuperMap.Feature.Vector} A multilinestring feature
  11852. * @private
  11853. */
  11854. 'multilinestring': function (str) {
  11855. var line;
  11856. var lines = StringExt.trim(str).split(this.regExes.parenComma);
  11857. var components = [];
  11858. for (var i = 0, len = lines.length; i < len; ++i) {
  11859. line = lines[i].replace(this.regExes.trimParens, '$1');
  11860. components.push(this.parse.linestring.apply(this, [line]).geometry);
  11861. }
  11862. return new Vector(
  11863. new MultiLineString(components)
  11864. );
  11865. },
  11866. /**
  11867. * @description Return a polygon feature given a polygon WKT fragment.
  11868. * @param {string} A WKT fragment representing the polygon
  11869. * @returns {SuperMap.Feature.Vector} A polygon feature
  11870. * @private
  11871. */
  11872. 'polygon': function (str) {
  11873. var ring, linestring, linearring;
  11874. var rings = StringExt.trim(str).split(this.regExes.parenComma);
  11875. var components = [];
  11876. for (var i = 0, len = rings.length; i < len; ++i) {
  11877. ring = rings[i].replace(this.regExes.trimParens, '$1');
  11878. linestring = this.parse.linestring.apply(this, [ring]).geometry;
  11879. linearring = new LinearRing(linestring.components);
  11880. components.push(linearring);
  11881. }
  11882. return new Vector(
  11883. new Polygon(components)
  11884. );
  11885. },
  11886. /**
  11887. * @private
  11888. * @description Return a multipolygon feature given a multipolygon WKT fragment.
  11889. * @param {string} A WKT fragment representing the multipolygon
  11890. * @returns {SuperMap.Feature.Vector} A multipolygon feature
  11891. *
  11892. */
  11893. 'multipolygon': function (str) {
  11894. var polygon;
  11895. var polygons = StringExt.trim(str).split(this.regExes.doubleParenComma);
  11896. var components = [];
  11897. for (var i = 0, len = polygons.length; i < len; ++i) {
  11898. polygon = polygons[i].replace(this.regExes.trimParens, '$1');
  11899. components.push(this.parse.polygon.apply(this, [polygon]).geometry);
  11900. }
  11901. return new Vector(
  11902. new MultiPolygon(components)
  11903. );
  11904. },
  11905. /**
  11906. * @description Return an array of features given a geometrycollection WKT fragment.
  11907. * @param {string} A WKT fragment representing the geometrycollection
  11908. * @returns {Array} An array of SuperMap.Feature.Vector
  11909. * @private
  11910. */
  11911. 'geometrycollection': function (str) {
  11912. // separate components of the collection with |
  11913. str = str.replace(/,\s*([A-Za-z])/g, '|$1');
  11914. var wktArray = StringExt.trim(str).split('|');
  11915. var components = [];
  11916. for (var i = 0, len = wktArray.length; i < len; ++i) {
  11917. components.push(this.read(wktArray[i]));
  11918. }
  11919. return components;
  11920. }
  11921. };
  11922. }
  11923. /**
  11924. * @function SuperMap.Format.WKT.prototype.read
  11925. * @description Deserialize a WKT string and return a vector feature or an
  11926. * array of vector features. Supports WKT for POINT, MULTIPOINT,
  11927. * LINESTRING, MULTILINESTRING, POLYGON, MULTIPOLYGON, and
  11928. * GEOMETRYCOLLECTION.
  11929. * @param {string} wkt - A WKT string
  11930. * @returns {SuperMap.Feature.Vector|Array} A feature or array of features for
  11931. * GEOMETRYCOLLECTION WKT.
  11932. */
  11933. read(wkt) {
  11934. var features, type, str;
  11935. wkt = wkt.replace(/[\n\r]/g, " ");
  11936. var matches = this.regExes.typeStr.exec(wkt);
  11937. if (matches) {
  11938. type = matches[1].toLowerCase();
  11939. str = matches[2];
  11940. if (this.parse[type]) {
  11941. features = this.parse[type].apply(this, [str]);
  11942. }
  11943. }
  11944. return features;
  11945. }
  11946. /**
  11947. * @function SuperMap.Format.WKT.prototype.write
  11948. * @description Serialize a feature or array of features into a WKT string.
  11949. * @param {(SuperMap.Feature.Vector|Array)} features - A feature or array of features
  11950. * @returns {string} The WKT string representation of the input geometries
  11951. */
  11952. write(features) {
  11953. var collection, geometry, isCollection;
  11954. if (features.constructor === Array) {
  11955. collection = features;
  11956. isCollection = true;
  11957. } else {
  11958. collection = [features];
  11959. isCollection = false;
  11960. }
  11961. var pieces = [];
  11962. if (isCollection) {
  11963. pieces.push('GEOMETRYCOLLECTION(');
  11964. }
  11965. for (var i = 0, len = collection.length; i < len; ++i) {
  11966. if (isCollection && i > 0) {
  11967. pieces.push(',');
  11968. }
  11969. geometry = collection[i].geometry;
  11970. pieces.push(this.extractGeometry(geometry));
  11971. }
  11972. if (isCollection) {
  11973. pieces.push(')');
  11974. }
  11975. return pieces.join('');
  11976. }
  11977. /**
  11978. * @function SuperMap.Format.WKT.prototype.extractGeometry
  11979. * @description Entry point to construct the WKT for a single Geometry object.
  11980. * @param {SuperMap.Geometry} geometry
  11981. * @returns {string} A WKT string of representing the geometry
  11982. */
  11983. extractGeometry(geometry) {
  11984. var type = geometry.CLASS_NAME.split('.')[2].toLowerCase();
  11985. if (!this.extract[type]) {
  11986. return null;
  11987. }
  11988. var wktType = type === 'collection' ? 'GEOMETRYCOLLECTION' : type.toUpperCase();
  11989. var data = wktType + '(' + this.extract[type].apply(this, [geometry]) + ')';
  11990. return data;
  11991. }
  11992. }
  11993. SuperMap.Format.WKT = WKT;
  11994. ;// CONCATENATED MODULE: ./src/common/format/index.js
  11995. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  11996. * This program are made available under the terms of the Apache License, Version 2.0
  11997. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11998. ;// CONCATENATED MODULE: ./src/common/control/TimeControlBase.js
  11999. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  12000. * This program are made available under the terms of the Apache License, Version 2.0
  12001. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12002. /**
  12003. * @class SuperMap.TimeControlBase
  12004. * @classdesc 时间控制基类类。
  12005. * @category Control
  12006. * @param {Object} options - 该类开放的可选属性。
  12007. * @param {number} [options.speed=1] - 速度。不能小于 0,(每帧渲染的数据之间的间隔为1),设置越大速度越快。
  12008. * @param {number} [options.frequency=1000] - 刷新频率(单位 ms),服务器刷新的时间间隔。
  12009. * @param {number} [options.startTime=0] - 起始时间,必须为数字,且小于等于 endTime。如果不设置,初始化时为 0,建议设置。
  12010. * @param {number} [options.endTime] - 结束时间,必须为数字,且大于等于 startTime。如果不设置,初始化时以当前时间进行设置,建议设置。
  12011. * @param {boolean} [options.repeat=true] - 是否重复循环。
  12012. * @param {boolean} [options.reverse=false] - 是否反向。
  12013. */
  12014. class TimeControlBase {
  12015. constructor(options) {
  12016. //设置步长,刷新频率、开始结束时间、是否循环、是否反向
  12017. var me = this;
  12018. options = options || {};
  12019. /**
  12020. * @member {number} [SuperMap.TimeControlBase.prototype.speed=1]
  12021. * @description 步长,必须为非负数,默认为1(表示前后两次渲染的数据之间的间隔为1)
  12022. */
  12023. this.speed = (options.speed && options.speed >= 0) ? options.speed : 1;
  12024. /**
  12025. * @member {number} [SuperMap.TimeControlBase.prototype.frequency=1000]
  12026. * @description 刷新频率(单位ms),服务器刷新的时间间隔。
  12027. */
  12028. this.frequency = (options.speed && options.frequency >= 0) ? options.frequency : 1000;
  12029. /**
  12030. * @member {number} [SuperMap.TimeControlBase.prototype.startTime=0]
  12031. * @description 记录的起始时间,必须为数字,
  12032. * 如果不设置,初始化时为0,建议设置
  12033. */
  12034. this.startTime = (options.startTime && options.startTime != null) ? options.startTime : 0;
  12035. /**
  12036. * @member {number} SuperMap.TimeControlBase.prototype.endTime
  12037. * @description 记录的结束时间,必须为数字,
  12038. * 如果不设置,初始化时以当前时间进行设置,建议设置
  12039. */
  12040. this.endTime = (options.endTime && options.endTime != null && options.endTime >= me.startTime) ? options.endTime : +new Date();
  12041. /**
  12042. * @member {boolean} [SuperMap.TimeControlBase.prototype.repeat=true]
  12043. * @description 是否重复循环。
  12044. */
  12045. this.repeat = (options.repeat !== undefined) ? options.repeat : true;
  12046. /**
  12047. * @member {boolean} [SuperMap.TimeControlBase.prototype.reverse=false]
  12048. * @description 是否反向。
  12049. */
  12050. this.reverse = (options.reverse !== undefined) ? options.reverse : false;
  12051. /**
  12052. * @member {number} SuperMap.TimeControlBase.prototype.currentTime
  12053. * @description 记录近期的时间,也就是当前帧运行到的时间。
  12054. */
  12055. this.currentTime = null;
  12056. /**
  12057. * @member {number} SuperMap.TimeControlBase.prototype.oldTime
  12058. * @description 记录上一帧的时间,也就是之前运行到的时间。
  12059. */
  12060. this.oldTime = null;
  12061. /**
  12062. * @member {boolean} [SuperMap.TimeControlBase.prototype.running=false]
  12063. * @description 记录当前是否处于运行中。
  12064. */
  12065. this.running = false;
  12066. /**
  12067. * @private
  12068. * @member {Array.<string>} SuperMap.TimeControlBase.prototype.EVENT_TYPES
  12069. * @description 此类支持的事件类型。
  12070. *
  12071. */
  12072. this.EVENT_TYPES = ["start", "pause", "stop"];
  12073. /**
  12074. * @private
  12075. * @member {SuperMap.Events} SuperMap.TimeControlBase.prototype.events
  12076. * @description 事件
  12077. */
  12078. me.events = new Events(this, null, this.EVENT_TYPES);
  12079. me.speed = Number(me.speed);
  12080. me.frequency = Number(me.frequency);
  12081. me.startTime = Number(me.startTime);
  12082. me.endTime = Number(me.endTime);
  12083. me.startTime = Date.parse(new Date(me.startTime));
  12084. me.endTime = Date.parse(new Date(me.endTime));
  12085. //初始化当前时间
  12086. me.currentTime = me.startTime;
  12087. this.CLASS_NAME = "SuperMap.TimeControlBase";
  12088. }
  12089. /**
  12090. * @function SuperMap.TimeControlBase.prototype.updateOptions
  12091. * @param {Object} options - 设置参数得可选参数。设置步长,刷新频率、开始结束时间、是否循环、是否反向。
  12092. */
  12093. updateOptions(options) {
  12094. //设置步长,刷新频率、开始结束时间、是否循环、是否反向
  12095. var me = this;
  12096. options = options || {};
  12097. if (options.speed && options.speed >= 0) {
  12098. me.speed = options.speed;
  12099. me.speed = Number(me.speed);
  12100. }
  12101. if (options.speed && options.frequency >= 0) {
  12102. me.frequency = options.frequency;
  12103. me.frequency = Number(me.frequency);
  12104. }
  12105. if (options.startTime && options.startTime != null) {
  12106. me.startTime = options.startTime;
  12107. me.startTime = Date.parse(new Date(me.startTime));
  12108. }
  12109. if (options.endTime && options.endTime != null && options.endTime >= me.startTime) {
  12110. me.endTime = options.endTime;
  12111. me.endTime = Date.parse(new Date(me.endTime));
  12112. }
  12113. if (options.repeat != null) {
  12114. me.repeat = options.repeat;
  12115. }
  12116. if (options.reverse != null) {
  12117. me.reverse = options.reverse;
  12118. }
  12119. }
  12120. /**
  12121. * @function SuperMap.TimeControlBase.prototype.start
  12122. * @description 开始。
  12123. */
  12124. start() {
  12125. var me = this;
  12126. if (!me.running) {
  12127. me.running = true;
  12128. me.tick();
  12129. me.events.triggerEvent('start', me.currentTime);
  12130. }
  12131. }
  12132. /**
  12133. * @function SuperMap.TimeControlBase.prototype.pause
  12134. * @description 暂停。
  12135. */
  12136. pause() {
  12137. var me = this;
  12138. me.running = false;
  12139. me.events.triggerEvent('pause', me.currentTime);
  12140. }
  12141. /**
  12142. * @function SuperMap.TimeControlBase.prototype.stop
  12143. * @description 停止,停止后返回起始状态。
  12144. */
  12145. stop() {
  12146. var me = this;
  12147. //停止时 时间设置为开始时间
  12148. me.currentTime = me.startTime;
  12149. //如果正在运行,修改为初始时间即可绘制一帧
  12150. if (me.running) {
  12151. me.running = false;
  12152. }
  12153. me.events.triggerEvent('stop', me.currentTime);
  12154. }
  12155. /**
  12156. * @function SuperMap.TimeControlBase.prototype.toggle
  12157. * @description 开关切换,切换的是开始和暂停。
  12158. */
  12159. toggle() {
  12160. var me = this;
  12161. if (me.running) {
  12162. me.pause();
  12163. } else {
  12164. me.start();
  12165. }
  12166. }
  12167. /**
  12168. * @function SuperMap.TimeControlBase.prototype.setSpeed
  12169. * @description 设置步长。
  12170. * @param {number} [speed=1] - 步长,必须为非负数。
  12171. * @returns {boolean} true 代表设置成功,false 设置失败(speed 小于 0 时失败)。
  12172. */
  12173. setSpeed(speed) {
  12174. var me = this;
  12175. if (speed >= 0) {
  12176. me.speed = speed;
  12177. return true;
  12178. }
  12179. return false;
  12180. }
  12181. /**
  12182. * @function SuperMap.TimeControlBase.prototype.getSpeed
  12183. * @description 获取步长。
  12184. * @returns {number} 返回当前的步长
  12185. */
  12186. getSpeed() {
  12187. return this.speed;
  12188. }
  12189. /**
  12190. * @function SuperMap.TimeControlBase.prototype.setFrequency
  12191. * @description 设置刷新频率。
  12192. * @param {number} [frequency=1000] - 刷新频率,单位为 ms。
  12193. * @returns {boolean} true 代表设置成功,false 设置失败(frequency 小于 0 时失败)。
  12194. */
  12195. setFrequency(frequency) {
  12196. var me = this;
  12197. if (frequency >= 0) {
  12198. me.frequency = frequency;
  12199. return true;
  12200. }
  12201. return false;
  12202. }
  12203. /**
  12204. * @function SuperMap.TimeControlBase.prototype.getFrequency
  12205. * @description 获取刷新频率。
  12206. * @returns {number} 返回当前的刷新频率。
  12207. */
  12208. getFrequency() {
  12209. return this.frequency;
  12210. }
  12211. /**
  12212. * @function SuperMap.TimeControlBase.prototype.setStartTime
  12213. * @description 设置起始时间,设置完成后如果当前时间小于起始时间,则从起始时间开始。
  12214. * @param {number} startTime - 需要设置的起始时间。
  12215. * @returns {boolean} true 代表设置成功,false 设置失败(startTime 大于结束时间时失败)。
  12216. */
  12217. setStartTime(startTime) {
  12218. var me = this;
  12219. startTime = Date.parse(new Date(startTime));
  12220. //起始时间不得大于结束时间
  12221. if (startTime > me.endTime) {
  12222. return false;
  12223. }
  12224. me.startTime = startTime;
  12225. //如果当前时间小于了起始时间,则从当前起始时间开始
  12226. if (me.currentTime < me.startTime) {
  12227. me.currentTime = me.startTime;
  12228. me.tick();
  12229. }
  12230. return true;
  12231. }
  12232. /**
  12233. * @function SuperMap.TimeControlBase.prototype.getStartTime
  12234. * @description 获取起始时间。
  12235. * @returns {number} 返回当前的起始时间。
  12236. */
  12237. getStartTime() {
  12238. return this.startTime;
  12239. }
  12240. /**
  12241. * @function SuperMap.TimeControlBase.prototype.setEndTime
  12242. * @description 设置结束时间,设置完成后如果当前时间大于结束,则从起始时间开始。
  12243. * @param {number} endTime - 需要设置的结束时间。
  12244. * @returns {boolean} true 代表设置成功,false 设置失败(endTime 小于开始时间时失败)。
  12245. */
  12246. setEndTime(endTime) {
  12247. var me = this;
  12248. me.endTime = Date.parse(new Date(me.endTime));
  12249. //结束时间不得小于开始时间
  12250. if (endTime < me.startTime) {
  12251. return false;
  12252. }
  12253. me.endTime = endTime;
  12254. //如果当前时间大于了结束时间,则从起始时间开始
  12255. if (me.currentTime >= me.endTime) {
  12256. me.currentTime = me.startTime;
  12257. me.tick();
  12258. }
  12259. return true;
  12260. }
  12261. /**
  12262. * @function SuperMap.TimeControlBase.prototype.getEndTime
  12263. * @description 获取结束时间。
  12264. * @returns {number} 返回当前的结束时间。
  12265. */
  12266. getEndTime() {
  12267. return this.endTime;
  12268. }
  12269. /**
  12270. * @function SuperMap.TimeControlBase.prototype.setCurrentTime
  12271. * @description 设置当前时间。
  12272. * @param {number} currentTime - 需要设置的当前时间。
  12273. * @returns {boolean} true 代表设置成功,false 设置失败。
  12274. */
  12275. setCurrentTime(currentTime) {
  12276. var me = this;
  12277. me.currentTime = Date.parse(new Date(me.currentTime));
  12278. //结束时间不得小于开始时间
  12279. if (currentTime >= me.startTime && currentTime <= me.endTime) {
  12280. me.currentTime = currentTime;
  12281. me.startTime = me.currentTime;
  12282. me.tick();
  12283. return true;
  12284. }
  12285. return false;
  12286. }
  12287. /**
  12288. * @function SuperMap.TimeControlBase.prototype.getCurrentTime
  12289. * @description 获取当前时间。
  12290. * @returns {number} 返回当前时间。
  12291. */
  12292. getCurrentTime() {
  12293. return this.currentTime;
  12294. }
  12295. /**
  12296. * @function SuperMap.TimeControlBase.prototype.setRepeat
  12297. * @description 设置是否重复循环。
  12298. * @param {boolean} [repeat=true] - 是否重复循环。
  12299. */
  12300. setRepeat(repeat) {
  12301. this.repeat = repeat;
  12302. }
  12303. /**
  12304. * @function SuperMap.TimeControlBase.prototype.getRepeat
  12305. * @description 获取是否重复循环,默认是 true。
  12306. * @returns {boolean} 返回是否重复循环。
  12307. */
  12308. getRepeat() {
  12309. return this.repeat;
  12310. }
  12311. /**
  12312. * @function SuperMap.TimeControlBase.prototype.setReverse
  12313. * @description 设置是否反向。
  12314. * @param {boolean} [reverse=false] - 是否反向。
  12315. */
  12316. setReverse(reverse) {
  12317. this.reverse = reverse;
  12318. }
  12319. /**
  12320. * @function SuperMap.TimeControlBase.prototype.getReverse
  12321. * @description 获取是否反向,默认是false。
  12322. * @returns {boolean} 返回是否反向。
  12323. */
  12324. getReverse() {
  12325. return this.reverse;
  12326. }
  12327. /**
  12328. * @function SuperMap.TimeControlBase.prototype.getRunning
  12329. * @description 获取运行状态。
  12330. * @returns {boolean} true 代表正在运行,false 发表没有运行。
  12331. */
  12332. getRunning() {
  12333. return this.running;
  12334. }
  12335. /**
  12336. * @function SuperMap.TimeControlBase.prototype.destroy
  12337. * @description 销毁 Animator 对象,释放资源。
  12338. */
  12339. destroy() {
  12340. var me = this;
  12341. me.speed = null;
  12342. me.frequency = null;
  12343. me.startTime = null;
  12344. me.endTime = null;
  12345. me.currentTime = null;
  12346. me.repeat = null;
  12347. me.running = false;
  12348. me.reverse = null;
  12349. }
  12350. tick() {
  12351. //TODO 每次刷新执行的操作。子类实现
  12352. }
  12353. }
  12354. SuperMap.TimeControlBase = TimeControlBase;
  12355. ;// CONCATENATED MODULE: ./src/common/control/TimeFlowControl.js
  12356. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  12357. * This program are made available under the terms of the Apache License, Version 2.0
  12358. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12359. /**
  12360. * @class SuperMap.TimeFlowControl
  12361. * @classdesc 时间管理类。
  12362. * @category Control
  12363. * @description 此类只负责时间上的控制,具体执行的操作需要用户在初始化时的回调函数内部进行实现。
  12364. * 如设置起始时间为 1000,结束时间是 2000,步长设置为 1,
  12365. * 那么表示按照每次1年(可以通过 setSpeed 进行修改)的变化从公元 1000 年开始到公元 2000 年为止,默认每 1 秒会 1 次(通过 setFrequency 修改)
  12366. * @extends {SuperMap.TimeControlBase}
  12367. * @param {function} callback - 每次刷新回调函数。具体的效果需要用户在此回调函数里面实现。
  12368. * @param {Object} options - 该类开放的可选属性。
  12369. * @param {number} [options.speed=1] - 步长(单位 ms)。不能小于 0,(每次刷新的数据之间的间隔为 1ms)。
  12370. * @param {number} [options.frequency=1000] - 刷新频率(单位 ms)。
  12371. * @param {number} [options.startTime=0] - 起始时间,必须为数字,且小于等于 endTime。如果不设置,初始化时为 0,建议设置。
  12372. * @param {number} [options.endTime] - 结束时间,必须为数字,且大于等于 startTime。如果不设置,初始化时使用 new Date() 以当前时间进行设置,建议设置。
  12373. * @param {boolean} [options.repeat=true] - 是否重复循环。
  12374. * @param {boolean} [options.reverse=false] - 是否反向。
  12375. */
  12376. class TimeFlowControl extends TimeControlBase {
  12377. constructor(callback, options) {
  12378. super(options);
  12379. var me = this;
  12380. /**
  12381. * @member SuperMap.TimeFlowControl.prototype.callback -{function}
  12382. * @description 每次刷新执行的回调函数。
  12383. */
  12384. me.callback = callback;
  12385. //先让IE下支持bind方法
  12386. if (!Function.prototype.bind) {
  12387. Function.prototype.bind = function (oThis) {
  12388. if (typeof this !== "function") {
  12389. throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
  12390. }
  12391. var aArgs = Array.prototype.slice.call(arguments, 1),
  12392. fToBind = this,
  12393. fNOP = function () {
  12394. //empty Function
  12395. },
  12396. fBound = function () {
  12397. return fToBind.apply(this instanceof fNOP && oThis
  12398. ? this
  12399. : oThis,
  12400. aArgs.concat(Array.prototype.slice.call(arguments)));
  12401. };
  12402. fNOP.prototype = this.prototype;
  12403. fBound.prototype = new fNOP();
  12404. return fBound;
  12405. };
  12406. }
  12407. //保证 this.tick 的上下文还是 TimeControl 这个对象
  12408. me.update = me.update.bind(me);
  12409. me.oldTime = me.currentTime;
  12410. me.CLASS_NAME = "SuperMap.TimeFlowControl";
  12411. }
  12412. /**
  12413. * @function SuperMap.TimeFlowControl.prototype.updateOptions
  12414. * @override
  12415. */
  12416. updateOptions(options) {
  12417. options = options || {};
  12418. super.updateOptions(options);
  12419. }
  12420. /**
  12421. * @function SuperMap.TimeFlowControl.prototype.start
  12422. * @override
  12423. */
  12424. start() {
  12425. var me = this;
  12426. if (me.running) {
  12427. return;
  12428. }
  12429. me.running = true;
  12430. if (me.reverse) {
  12431. if (me.currentTime === me.startTime) {
  12432. me.oldTime = me.endTime;
  12433. me.currentTime = me.oldTime;
  12434. }
  12435. } else {
  12436. if (me.oldTime === me.endTime) {
  12437. me.currentTime = me.startTime;
  12438. me.oldTime = me.currentTime;
  12439. }
  12440. }
  12441. me.tick();
  12442. }
  12443. /**
  12444. * @function SuperMap.TimeFlowControl.prototype.stop
  12445. * @override
  12446. */
  12447. stop() {
  12448. super.stop();
  12449. var me = this;
  12450. me.oldTime = me.currentTime;
  12451. if (me.running) {
  12452. me.running = false;
  12453. }
  12454. //清除定时tick
  12455. me.intervalId && window.clearTimeout(me.intervalId);
  12456. }
  12457. /**
  12458. * @function SuperMap.TimeFlowControl.prototype.destroy
  12459. * @override
  12460. */
  12461. destroy() {
  12462. super.destroy();
  12463. var me = this;
  12464. me.oldTime = null;
  12465. me.callback = null;
  12466. }
  12467. /**
  12468. * @function SuperMap.TimeFlowControl.prototype.tick
  12469. * @description 定时刷新。
  12470. */
  12471. tick() {
  12472. var me = this;
  12473. me.intervalId && window.clearInterval(me.intervalId);
  12474. me.intervalId = null;
  12475. me.update();
  12476. me.intervalId = window.setInterval(me.update, me.frequency);
  12477. }
  12478. /**
  12479. * @function SuperMap.TimeFlowControl.prototype.update
  12480. * @override
  12481. */
  12482. update() {
  12483. var me = this;
  12484. //判定是否还需要继续
  12485. if (!me.running) {
  12486. return;
  12487. }
  12488. //调用回调函数
  12489. me.callback && me.callback(me.currentTime); //destroy之后callback就为空,所以需要判定一下
  12490. if (!me.reverse) {
  12491. //如果相等,则代表上一帧已经运行到了最后,下一帧运行初始化的状态
  12492. if (me.currentTime === me.endTime) {
  12493. //不循环时
  12494. if (!me.repeat) {
  12495. me.running = false;
  12496. me.stop();
  12497. return null;
  12498. }
  12499. me.stop();
  12500. me.currentTime = me.startTime;
  12501. me.oldTime = me.currentTime;
  12502. me.start();
  12503. } else {//否则时间递增
  12504. me.oldTime = me.currentTime;
  12505. me.currentTime += me.speed;
  12506. }
  12507. if (me.currentTime >= me.endTime) {
  12508. me.currentTime = me.endTime;
  12509. }
  12510. } else {
  12511. //如果相等,则代表上一帧已经运行到了最前,下一帧运行结束的状态
  12512. if (me.currentTime === me.startTime) {
  12513. //不循环时
  12514. if (!me.repeat) {
  12515. me.running = false;
  12516. return null;
  12517. }
  12518. me.oldTime = me.endTime;
  12519. me.currentTime = me.oldTime;
  12520. } else {//否则时间递减
  12521. me.currentTime = me.oldTime;
  12522. me.oldTime -= me.speed;
  12523. }
  12524. if (me.oldTime <= me.startTime) {
  12525. me.oldTime = me.startTime;
  12526. }
  12527. }
  12528. }
  12529. }
  12530. SuperMap.TimeFlowControl = TimeFlowControl;
  12531. ;// CONCATENATED MODULE: ./src/common/control/index.js
  12532. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  12533. * This program are made available under the terms of the Apache License, Version 2.0
  12534. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12535. // EXTERNAL MODULE: ./node_modules/promise-polyfill/dist/polyfill.js
  12536. var polyfill = __webpack_require__(107);
  12537. // EXTERNAL MODULE: ./node_modules/fetch-ie8/fetch.js
  12538. var fetch = __webpack_require__(693);
  12539. // EXTERNAL MODULE: ./node_modules/fetch-jsonp/build/fetch-jsonp.js
  12540. var fetch_jsonp = __webpack_require__(144);
  12541. var fetch_jsonp_default = /*#__PURE__*/__webpack_require__.n(fetch_jsonp);
  12542. ;// CONCATENATED MODULE: ./src/common/util/FetchRequest.js
  12543. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  12544. * This program are made available under the terms of the Apache License, Version 2.0
  12545. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12546. let FetchRequest_fetch = window.fetch;
  12547. var setFetch = function (newFetch) {
  12548. FetchRequest_fetch = newFetch;
  12549. }
  12550. /**
  12551. * @function SuperMap.setCORS
  12552. * @description 设置是否允许跨域请求,全局配置,优先级低于 service 下的 crossOring 参数。
  12553. * @param {boolean} cors - 是否允许跨域请求。
  12554. */
  12555. var setCORS = SuperMap.setCORS = function (cors) {
  12556. SuperMap.CORS = cors;
  12557. }
  12558. /**
  12559. * @function SuperMap.isCORS
  12560. * @description 是是否允许跨域请求。
  12561. * @returns {boolean} 是否允许跨域请求。
  12562. */
  12563. var isCORS = SuperMap.isCORS = function () {
  12564. if (SuperMap.CORS != undefined) {
  12565. return SuperMap.CORS;
  12566. }
  12567. return window.XMLHttpRequest && 'withCredentials' in new window.XMLHttpRequest();
  12568. }
  12569. /**
  12570. * @function SuperMap.setRequestTimeout
  12571. * @description 设置请求超时时间。
  12572. * @param {number} [timeout=45] - 请求超时时间,单位秒。
  12573. */
  12574. var setRequestTimeout = SuperMap.setRequestTimeout = function (timeout) {
  12575. return SuperMap.RequestTimeout = timeout;
  12576. }
  12577. /**
  12578. * @function SuperMap.getRequestTimeout
  12579. * @description 获取请求超时时间。
  12580. * @returns {number} 请求超时时间。
  12581. */
  12582. var getRequestTimeout = SuperMap.getRequestTimeout = function () {
  12583. return SuperMap.RequestTimeout || 45000;
  12584. }
  12585. var FetchRequest = SuperMap.FetchRequest = {
  12586. commit: function (method, url, params, options) {
  12587. method = method ? method.toUpperCase() : method;
  12588. switch (method) {
  12589. case 'GET':
  12590. return this.get(url, params, options);
  12591. case 'POST':
  12592. return this.post(url, params, options);
  12593. case 'PUT':
  12594. return this.put(url, params, options);
  12595. case 'DELETE':
  12596. return this.delete(url, params, options);
  12597. default:
  12598. return this.get(url, params, options);
  12599. }
  12600. },
  12601. supportDirectRequest: function (url, options) {
  12602. if (Util.isInTheSameDomain(url)) {
  12603. return true;
  12604. }
  12605. if (options.crossOrigin != undefined) {
  12606. return options.crossOrigin;
  12607. } else {
  12608. return isCORS() || options.proxy;
  12609. }
  12610. },
  12611. get: function (url, params, options) {
  12612. options = options || {};
  12613. var type = 'GET';
  12614. url = Util.urlAppend(url, this._getParameterString(params || {}));
  12615. url = this._processUrl(url, options);
  12616. if (!this.supportDirectRequest(url, options)) {
  12617. url = url.replace('.json', '.jsonp');
  12618. var config = {
  12619. url: url,
  12620. data: params
  12621. };
  12622. return SuperMap.Util.RequestJSONPPromise.GET(config);
  12623. }
  12624. if (!this.urlIsLong(url)) {
  12625. return this._fetch(url, params, options, type);
  12626. } else {
  12627. return this._postSimulatie(type, url.substring(0, url.indexOf('?') - 1), params, options);
  12628. }
  12629. },
  12630. delete: function (url, params, options) {
  12631. options = options || {};
  12632. var type = 'DELETE';
  12633. url = Util.urlAppend(url, this._getParameterString(params || {}));
  12634. url = this._processUrl(url, options);
  12635. if (!this.supportDirectRequest(url, options)) {
  12636. url = url.replace('.json', '.jsonp');
  12637. var config = {
  12638. url: url += "&_method=DELETE",
  12639. data: params
  12640. };
  12641. return SuperMap.Util.RequestJSONPPromise.DELETE(config);
  12642. }
  12643. if (this.urlIsLong(url)) {
  12644. return this._postSimulatie(type, url.substring(0, url.indexOf('?') - 1), params, options);
  12645. }
  12646. return this._fetch(url, params, options, type);
  12647. },
  12648. post: function (url, params, options) {
  12649. options = options || {};
  12650. if (!this.supportDirectRequest(url, options)) {
  12651. url = url.replace('.json', '.jsonp');
  12652. var config = {
  12653. url: url += "&_method=POST",
  12654. data: params
  12655. };
  12656. return SuperMap.Util.RequestJSONPPromise.POST(config);
  12657. }
  12658. return this._fetch(this._processUrl(url, options), params, options, 'POST');
  12659. },
  12660. put: function (url, params, options) {
  12661. options = options || {};
  12662. url = this._processUrl(url, options);
  12663. if (!this.supportDirectRequest(url, options)) {
  12664. url = url.replace('.json', '.jsonp');
  12665. var config = {
  12666. url: url += "&_method=PUT",
  12667. data: params
  12668. };
  12669. return SuperMap.Util.RequestJSONPPromise.PUT(config);
  12670. }
  12671. return this._fetch(url, params, options, 'PUT');
  12672. },
  12673. urlIsLong: function (url) {
  12674. //当前url的字节长度。
  12675. var totalLength = 0,
  12676. charCode = null;
  12677. for (var i = 0, len = url.length; i < len; i++) {
  12678. //转化为Unicode编码
  12679. charCode = url.charCodeAt(i);
  12680. if (charCode < 0x007f) {
  12681. totalLength++;
  12682. } else if ((0x0080 <= charCode) && (charCode <= 0x07ff)) {
  12683. totalLength += 2;
  12684. } else if ((0x0800 <= charCode) && (charCode <= 0xffff)) {
  12685. totalLength += 3;
  12686. }
  12687. }
  12688. return totalLength < 2000 ? false : true;
  12689. },
  12690. _postSimulatie: function (type, url, params, options) {
  12691. var separator = url.indexOf('?') > -1 ? '&' : '?';
  12692. url += separator + '_method=' + type;
  12693. if (typeof params !== 'string') {
  12694. params = JSON.stringify(params);
  12695. }
  12696. return this.post(url, params, options);
  12697. },
  12698. _processUrl: function (url, options) {
  12699. if (this._isMVTRequest(url)) {
  12700. return url;
  12701. }
  12702. if (url.indexOf('.json') === -1 && !options.withoutFormatSuffix) {
  12703. if (url.indexOf('?') < 0) {
  12704. url += '.json';
  12705. } else {
  12706. var urlArrays = url.split('?');
  12707. if (urlArrays.length === 2) {
  12708. url = urlArrays[0] + '.json?' + urlArrays[1];
  12709. }
  12710. }
  12711. }
  12712. if (options && options.proxy) {
  12713. if (typeof options.proxy === 'function') {
  12714. url = options.proxy(url);
  12715. } else {
  12716. url = decodeURIComponent(url);
  12717. url = options.proxy + encodeURIComponent(url);
  12718. }
  12719. }
  12720. return url;
  12721. },
  12722. _fetch: function (url, params, options, type) {
  12723. options = options || {};
  12724. options.headers = options.headers || {};
  12725. if (!options.headers['Content-Type']) {
  12726. options.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8';
  12727. }
  12728. if (options.timeout) {
  12729. return this._timeout(
  12730. options.timeout,
  12731. FetchRequest_fetch(url, {
  12732. method: type,
  12733. headers: options.headers,
  12734. body: type === 'PUT' || type === 'POST' ? params : undefined,
  12735. credentials: this._getWithCredentials(options),
  12736. mode: 'cors',
  12737. timeout: getRequestTimeout()
  12738. }).then(function (response) {
  12739. return response;
  12740. })
  12741. );
  12742. }
  12743. return FetchRequest_fetch(url, {
  12744. method: type,
  12745. body: type === 'PUT' || type === 'POST' ? params : undefined,
  12746. headers: options.headers,
  12747. credentials: this._getWithCredentials(options),
  12748. mode: 'cors',
  12749. timeout: getRequestTimeout()
  12750. }).then(function (response) {
  12751. return response;
  12752. });
  12753. },
  12754. _getWithCredentials: function (options) {
  12755. if (options.withCredentials === true) {
  12756. return 'include';
  12757. }
  12758. if (options.withCredentials === false) {
  12759. return 'omit';
  12760. }
  12761. return 'same-origin';
  12762. },
  12763. _fetchJsonp: function (url, options) {
  12764. options = options || {};
  12765. return fetch_jsonp_default()(url, {
  12766. method: 'GET',
  12767. timeout: options.timeout
  12768. }).then(function (response) {
  12769. return response;
  12770. });
  12771. },
  12772. _timeout: function (seconds, promise) {
  12773. return new Promise(function (resolve, reject) {
  12774. setTimeout(function () {
  12775. reject(new Error('timeout'));
  12776. }, seconds);
  12777. promise.then(resolve, reject);
  12778. });
  12779. },
  12780. _getParameterString: function (params) {
  12781. var paramsArray = [];
  12782. for (var key in params) {
  12783. var value = params[key];
  12784. if (value != null && typeof value !== 'function') {
  12785. var encodedValue;
  12786. if (Array.isArray(value) || value.toString() === '[object Object]') {
  12787. encodedValue = encodeURIComponent(JSON.stringify(value));
  12788. } else {
  12789. encodedValue = encodeURIComponent(value);
  12790. }
  12791. paramsArray.push(encodeURIComponent(key) + '=' + encodedValue);
  12792. }
  12793. }
  12794. return paramsArray.join('&');
  12795. },
  12796. _isMVTRequest: function (url) {
  12797. return url.indexOf('.mvt') > -1 || url.indexOf('.pbf') > -1;
  12798. }
  12799. }
  12800. SuperMap.Util.RequestJSONPPromise = {
  12801. limitLength: 1500,
  12802. queryKeys: [],
  12803. queryValues: [],
  12804. supermap_callbacks: {},
  12805. addQueryStrings: function (values) {
  12806. var me = this;
  12807. for (var key in values) {
  12808. me.queryKeys.push(key);
  12809. if (typeof values[key] !== 'string') {
  12810. values[key] = SuperMap.Util.toJSON(values[key]);
  12811. }
  12812. var tempValue = encodeURIComponent(values[key]);
  12813. me.queryValues.push(tempValue);
  12814. }
  12815. },
  12816. issue: function (config) {
  12817. var me = this,
  12818. uid = me.getUid(),
  12819. url = config.url,
  12820. splitQuestUrl = [];
  12821. var p = new Promise(function (resolve) {
  12822. me.supermap_callbacks[uid] = function (response) {
  12823. delete me.supermap_callbacks[uid];
  12824. resolve(response);
  12825. };
  12826. });
  12827. // me.addQueryStrings({
  12828. // callback: "SuperMap.Util.RequestJSONPPromise.supermap_callbacks[" + uid + "]"
  12829. // });
  12830. var sectionURL = url,
  12831. keysCount = 0; //此次sectionURL中有多少个key
  12832. var length = me.queryKeys ? me.queryKeys.length : 0;
  12833. for (var i = 0; i < length; i++) {
  12834. if (sectionURL.length + me.queryKeys[i].length + 2 >= me.limitLength) {
  12835. //+2 for ("&"or"?")and"="
  12836. if (keysCount == 0) {
  12837. return false;
  12838. }
  12839. splitQuestUrl.push(sectionURL);
  12840. sectionURL = url;
  12841. keysCount = 0;
  12842. i--;
  12843. } else {
  12844. if (sectionURL.length + me.queryKeys[i].length + 2 + me.queryValues[i].length > me.limitLength) {
  12845. var leftValue = me.queryValues[i];
  12846. while (leftValue.length > 0) {
  12847. var leftLength = me.limitLength - sectionURL.length - me.queryKeys[i].length - 2; //+2 for ("&"or"?")and"="
  12848. if (sectionURL.indexOf('?') > -1) {
  12849. sectionURL += '&';
  12850. } else {
  12851. sectionURL += '?';
  12852. }
  12853. var tempLeftValue = leftValue.substring(0, leftLength);
  12854. //避免 截断sectionURL时,将类似于%22这样的符号截成两半,从而导致服务端组装sectionURL时发生错误
  12855. if (tempLeftValue.substring(leftLength - 1, leftLength) === '%') {
  12856. leftLength -= 1;
  12857. tempLeftValue = leftValue.substring(0, leftLength);
  12858. } else if (tempLeftValue.substring(leftLength - 2, leftLength - 1) === '%') {
  12859. leftLength -= 2;
  12860. tempLeftValue = leftValue.substring(0, leftLength);
  12861. }
  12862. sectionURL += me.queryKeys[i] + '=' + tempLeftValue;
  12863. leftValue = leftValue.substring(leftLength);
  12864. if (tempLeftValue.length > 0) {
  12865. splitQuestUrl.push(sectionURL);
  12866. sectionURL = url;
  12867. keysCount = 0;
  12868. }
  12869. }
  12870. } else {
  12871. keysCount++;
  12872. if (sectionURL.indexOf('?') > -1) {
  12873. sectionURL += '&';
  12874. } else {
  12875. sectionURL += '?';
  12876. }
  12877. sectionURL += me.queryKeys[i] + '=' + me.queryValues[i];
  12878. }
  12879. }
  12880. }
  12881. splitQuestUrl.push(sectionURL);
  12882. me.send(
  12883. splitQuestUrl,
  12884. 'SuperMap.Util.RequestJSONPPromise.supermap_callbacks[' + uid + ']',
  12885. config && config.proxy
  12886. );
  12887. return p;
  12888. },
  12889. getUid: function () {
  12890. var uid = new Date().getTime(),
  12891. random = Math.floor(Math.random() * 1e17);
  12892. return uid * 1000 + random;
  12893. },
  12894. send: function (splitQuestUrl, callback, proxy) {
  12895. var len = splitQuestUrl.length;
  12896. if (len > 0) {
  12897. var jsonpUserID = new Date().getTime();
  12898. for (var i = 0; i < len; i++) {
  12899. var url = splitQuestUrl[i];
  12900. if (url.indexOf('?') > -1) {
  12901. url += '&';
  12902. } else {
  12903. url += '?';
  12904. }
  12905. url += 'sectionCount=' + len;
  12906. url += '&sectionIndex=' + i;
  12907. url += '&jsonpUserID=' + jsonpUserID;
  12908. if (proxy) {
  12909. url = decodeURIComponent(url);
  12910. url = proxy + encodeURIComponent(url);
  12911. }
  12912. fetch_jsonp_default()(url, {
  12913. jsonpCallbackFunction: callback,
  12914. timeout: 30000
  12915. });
  12916. }
  12917. }
  12918. },
  12919. GET: function (config) {
  12920. var me = this;
  12921. me.queryKeys.length = 0;
  12922. me.queryValues.length = 0;
  12923. me.addQueryStrings(config.params);
  12924. return me.issue(config);
  12925. },
  12926. POST: function (config) {
  12927. var me = this;
  12928. me.queryKeys.length = 0;
  12929. me.queryValues.length = 0;
  12930. me.addQueryStrings({
  12931. requestEntity: config.data
  12932. });
  12933. return me.issue(config);
  12934. },
  12935. PUT: function (config) {
  12936. var me = this;
  12937. me.queryKeys.length = 0;
  12938. me.queryValues.length = 0;
  12939. me.addQueryStrings({
  12940. requestEntity: config.data
  12941. });
  12942. return me.issue(config);
  12943. },
  12944. DELETE: function (config) {
  12945. var me = this;
  12946. me.queryKeys.length = 0;
  12947. me.queryValues.length = 0;
  12948. me.addQueryStrings({
  12949. requestEntity: config.data
  12950. });
  12951. return me.issue(config);
  12952. }
  12953. };
  12954. ;// CONCATENATED MODULE: ./src/common/security/SecurityManager.js
  12955. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  12956. * This program are made available under the terms of the Apache License, Version 2.0
  12957. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12958. /**
  12959. * @name SecurityManager
  12960. * @memberOf SuperMap
  12961. * @namespace
  12962. * @category Security
  12963. * @description 安全管理中心,提供 iServer,iPortal,Online 统一权限认证管理。
  12964. * > 使用说明:
  12965. * > 创建任何一个服务之前调用 {@link SuperMap.SecurityManager.registerToken}或
  12966. * > {@link SuperMap.SecurityManager.registerKey}注册凭据。
  12967. * > 发送请求时根据 url 或者服务 id 获取相应的 key 或者 token 并自动添加到服务地址中。
  12968. */
  12969. class SecurityManager {
  12970. /**
  12971. * @description 从服务器获取一个token,在此之前要注册服务器信息。
  12972. * @function SuperMap.SecurityManager.generateToken
  12973. * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
  12974. * @param {SuperMap.TokenServiceParameter} tokenParam - token 申请参数。
  12975. * @returns {Promise} 返回包含 token 信息的 Promise 对象。
  12976. */
  12977. static generateToken(url, tokenParam) {
  12978. var serverInfo = this.servers[url];
  12979. if (!serverInfo) {
  12980. return;
  12981. }
  12982. return FetchRequest.post(serverInfo.tokenServiceUrl, JSON.stringify(tokenParam.toJSON())).then(function (response) {
  12983. return response.text();
  12984. });
  12985. }
  12986. /**
  12987. * @description 注册安全服务器相关信息。
  12988. * @function SuperMap.SecurityManager.registerServers
  12989. * @param {SuperMap.ServerInfo} serverInfos - 服务器信息。
  12990. */
  12991. static registerServers(serverInfos) {
  12992. this.servers = this.servers || {};
  12993. if (!Util.isArray(serverInfos)) {
  12994. serverInfos = [serverInfos];
  12995. }
  12996. for (var i = 0; i < serverInfos.length; i++) {
  12997. var serverInfo = serverInfos[i];
  12998. this.servers[serverInfo.server] = serverInfo;
  12999. }
  13000. }
  13001. /**
  13002. * @description 服务请求都会自动带上这个 token。
  13003. * @function SuperMap.SecurityManager.registerToken
  13004. * @param {string} url -服务器域名+端口:如http://localhost:8090。
  13005. * @param {string} token - token
  13006. */
  13007. static registerToken(url, token) {
  13008. this.tokens = this.tokens || {};
  13009. if (!url || !token) {
  13010. return;
  13011. }
  13012. var domain = this._getTokenStorageKey(url);
  13013. this.tokens[domain] = token;
  13014. }
  13015. /**
  13016. * @description 注册 key,ids 为数组(存在一个 key 对应多个服务)。
  13017. * @function SuperMap.SecurityManager.registerKey
  13018. * @param {Array} ids - 可以是服务 id 数组或者 url 地址数组或者 webAPI 类型数组。
  13019. * @param {string} key - key
  13020. */
  13021. static registerKey(ids, key) {
  13022. this.keys = this.keys || {};
  13023. if (!ids || ids.length < 1 || !key) {
  13024. return;
  13025. }
  13026. ids = (Util.isArray(ids)) ? ids : [ids];
  13027. for (var i = 0; i < ids.length; i++) {
  13028. var id = this._getUrlRestString(ids[0]) || ids[0];
  13029. this.keys[id] = key;
  13030. }
  13031. }
  13032. /**
  13033. * @description 获取服务器信息。
  13034. * @function SuperMap.SecurityManager.getServerInfo
  13035. * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
  13036. * @returns {SuperMap.ServerInfo} 服务器信息。
  13037. */
  13038. static getServerInfo(url) {
  13039. this.servers = this.servers || {};
  13040. return this.servers[url];
  13041. }
  13042. /**
  13043. * @description 根据 Url 获取token。
  13044. * @function SuperMap.SecurityManager.getToken
  13045. * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
  13046. * @returns {string} token
  13047. */
  13048. static getToken(url) {
  13049. if (!url) {
  13050. return;
  13051. }
  13052. this.tokens = this.tokens || {};
  13053. var domain = this._getTokenStorageKey(url);
  13054. return this.tokens[domain];
  13055. }
  13056. /**
  13057. * @description 根据 Url 获取 key。
  13058. * @function SuperMap.SecurityManager.getKey
  13059. * @param {string} id - id
  13060. * @returns {string} key
  13061. */
  13062. static getKey(id) {
  13063. this.keys = this.keys || {};
  13064. var key = this._getUrlRestString(id) || id;
  13065. return this.keys[key];
  13066. }
  13067. /**
  13068. * @description iServer 登录验证。
  13069. * @function SuperMap.SecurityManager.loginiServer
  13070. * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
  13071. * @param {string} username - 用户名。
  13072. * @param {string} password - 密码。
  13073. * @param {boolean} [rememberme=false] - 是否记住。
  13074. * @returns {Promise} 返回包含 iServer 登录请求结果的 Promise 对象。
  13075. */
  13076. static loginiServer(url, username, password, rememberme) {
  13077. url = Util.urlPathAppend(url, 'services/security/login');
  13078. var loginInfo = {
  13079. username: username && username.toString(),
  13080. password: password && password.toString(),
  13081. rememberme: rememberme
  13082. };
  13083. loginInfo = JSON.stringify(loginInfo);
  13084. var requestOptions = {
  13085. headers: {
  13086. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  13087. }
  13088. };
  13089. return FetchRequest.post(url, loginInfo, requestOptions).then(function (response) {
  13090. return response.json();
  13091. });
  13092. }
  13093. /**
  13094. * @description iServer登出。
  13095. * @function SuperMap.SecurityManager.logoutiServer
  13096. * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
  13097. * @returns {Promise} 是否登出成功。
  13098. */
  13099. static logoutiServer(url) {
  13100. url = Util.urlPathAppend(url, 'services/security/logout');
  13101. var requestOptions = {
  13102. headers: {
  13103. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  13104. },
  13105. withoutFormatSuffix: true
  13106. };
  13107. return FetchRequest.get(url, "", requestOptions).then(function () {
  13108. return true;
  13109. }).catch(function () {
  13110. return false;
  13111. });
  13112. }
  13113. /**
  13114. * @description Online 登录验证。
  13115. * @function SuperMap.SecurityManager.loginOnline
  13116. * @param {string} callbackLocation - 跳转位置。
  13117. * @param {boolean} [newTab=true] - 是否新窗口打开。
  13118. */
  13119. static loginOnline(callbackLocation, newTab) {
  13120. var loginUrl = SecurityManager.SSO + "/login?service=" + callbackLocation;
  13121. this._open(loginUrl, newTab);
  13122. }
  13123. /**
  13124. * @description iPortal登录验证。
  13125. * @function SuperMap.SecurityManager.loginiPortal
  13126. * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal.
  13127. * @param {string} username - 用户名。
  13128. * @param {string} password - 密码。
  13129. * @returns {Promise} 返回包含 iPortal 登录请求结果的 Promise 对象。
  13130. */
  13131. static loginiPortal(url, username, password) {
  13132. url = Util.urlPathAppend(url, 'web/login');
  13133. var loginInfo = {
  13134. username: username && username.toString(),
  13135. password: password && password.toString()
  13136. };
  13137. loginInfo = JSON.stringify(loginInfo);
  13138. var requestOptions = {
  13139. headers: {
  13140. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  13141. },
  13142. withCredentials: true
  13143. };
  13144. return FetchRequest.post(url, loginInfo, requestOptions).then(function (response) {
  13145. return response.json();
  13146. });
  13147. }
  13148. /**
  13149. * @description iPortal 登出。
  13150. * @function SuperMap.SecurityManager.logoutiPortal
  13151. * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal.
  13152. * @returns {Promise} 如果登出成功,返回 true;否则返回 false。
  13153. */
  13154. static logoutiPortal(url) {
  13155. url = Util.urlPathAppend(url, 'services/security/logout');
  13156. var requestOptions = {
  13157. headers: {
  13158. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  13159. },
  13160. withCredentials: true,
  13161. withoutFormatSuffix: true
  13162. };
  13163. return FetchRequest.get(url, "", requestOptions).then(function () {
  13164. return true;
  13165. }).catch(function () {
  13166. return false;
  13167. });
  13168. }
  13169. /**
  13170. * @description iManager 登录验证。
  13171. * @function SuperMap.SecurityManager.loginManager
  13172. * @param {string} url - iManager 地址。地址参数为 iManager 首页地址,如: http://localhost:8390/imanager。
  13173. * @param {Object} [loginInfoParams] - iManager 登录参数。
  13174. * @param {string} loginInfoParams.userName - 用户名。
  13175. * @param {string} loginInfoParams.password - 密码。
  13176. * @param {Object} options
  13177. * @param {boolean} [options.isNewTab=true] - 不同域时是否在新窗口打开登录页面。
  13178. * @returns {Promise} 返回包含 iManager 登录请求结果的 Promise 对象。
  13179. */
  13180. static loginManager(url, loginInfoParams, options) {
  13181. if (!Util.isInTheSameDomain(url)) {
  13182. var isNewTab = options ? options.isNewTab : true;
  13183. this._open(url, isNewTab);
  13184. return;
  13185. }
  13186. var requestUrl = Util.urlPathAppend(url, 'icloud/security/tokens');
  13187. var params = loginInfoParams || {};
  13188. var loginInfo = {
  13189. username: params.userName && params.userName.toString(),
  13190. password: params.password && params.password.toString()
  13191. };
  13192. loginInfo = JSON.stringify(loginInfo);
  13193. var requestOptions = {
  13194. headers: {
  13195. 'Accept': '*/*',
  13196. 'Content-Type': 'application/json'
  13197. }
  13198. };
  13199. var me = this;
  13200. return FetchRequest.post(requestUrl, loginInfo, requestOptions).then(function (response) {
  13201. response.text().then(function (result) {
  13202. me.imanagerToken = result;
  13203. return result;
  13204. });
  13205. });
  13206. }
  13207. /**
  13208. * @description 清空全部验证信息。
  13209. * @function SuperMap.SecurityManager.destroyAllCredentials
  13210. */
  13211. static destroyAllCredentials() {
  13212. this.keys = null;
  13213. this.tokens = null;
  13214. this.servers = null;
  13215. }
  13216. /**
  13217. * @description 清空令牌信息。
  13218. * @function SuperMap.SecurityManager.destroyToken
  13219. * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal.
  13220. */
  13221. static destroyToken(url) {
  13222. if (!url) {
  13223. return;
  13224. }
  13225. var domain = this._getTokenStorageKey(url);
  13226. this.tokens = this.tokens || {};
  13227. if (this.tokens[domain]) {
  13228. delete this.tokens[domain];
  13229. }
  13230. }
  13231. /**
  13232. * @description 清空服务授权码。
  13233. * @function SuperMap.SecurityManager.destroyKey
  13234. * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
  13235. */
  13236. static destroyKey(url) {
  13237. if (!url) {
  13238. return;
  13239. }
  13240. this.keys = this.keys || {};
  13241. var key = this._getUrlRestString(url) || url;
  13242. if (this.keys[key]) {
  13243. delete this.keys[key];
  13244. }
  13245. }
  13246. static _open(url, newTab) {
  13247. newTab = (newTab != null) ? newTab : true;
  13248. var offsetX = window.screen.availWidth / 2 - this.INNER_WINDOW_WIDTH / 2;
  13249. var offsetY = window.screen.availHeight / 2 - this.INNER_WINDOW_HEIGHT / 2;
  13250. var options =
  13251. "height=" + this.INNER_WINDOW_HEIGHT + ", width=" + this.INNER_WINDOW_WIDTH +
  13252. ",top=" + offsetY + ", left=" + offsetX +
  13253. ",toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no";
  13254. if (newTab) {
  13255. window.open(url, 'login');
  13256. } else {
  13257. window.open(url, 'login', options);
  13258. }
  13259. }
  13260. static _getTokenStorageKey(url) {
  13261. var patten = /(.*?):\/\/([^\/]+)/i;
  13262. var result = url.match(patten);
  13263. if (!result) {
  13264. return url;
  13265. }
  13266. return result[0];
  13267. }
  13268. static _getUrlRestString(url) {
  13269. if (!url) {
  13270. return url;
  13271. }
  13272. // var patten = /http:\/\/(.*\/rest)/i;
  13273. var patten = /(http|https):\/\/(.*\/rest)/i;
  13274. var result = url.match(patten);
  13275. if (!result) {
  13276. return url;
  13277. }
  13278. return result[0];
  13279. }
  13280. }
  13281. SecurityManager.INNER_WINDOW_WIDTH = 600;
  13282. SecurityManager.INNER_WINDOW_HEIGHT = 600;
  13283. SecurityManager.SSO = "https://sso.supermap.com";
  13284. SecurityManager.ONLINE = "https://www.supermapol.com";
  13285. SuperMap.SecurityManager = SecurityManager;
  13286. ;// CONCATENATED MODULE: ./src/common/iManager/iManagerServiceBase.js
  13287. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13288. * This program are made available under the terms of the Apache License, Version 2.0
  13289. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13290. /**
  13291. * @class SuperMap.iManagerServiceBase
  13292. * @classdesc iManager 服务基类(有权限限制的类需要实现此类)。
  13293. * @category iManager
  13294. * @param {string} url - iManager 首页地址,如:http://localhost:8390/imanager。
  13295. * @param {Object} options - 服务参数。
  13296. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  13297. * @param {Object} [options.headers] - 请求头。
  13298. */
  13299. class IManagerServiceBase {
  13300. constructor(url,options) {
  13301. if (url) {
  13302. var end = url.substr(url.length - 1, 1);
  13303. this.serviceUrl = end === "/" ? url.substr(0, url.length - 2) : url;
  13304. }
  13305. this.options = options || {};
  13306. this.CLASS_NAME = "SuperMap.iManagerServiceBase";
  13307. }
  13308. /**
  13309. * @function SuperMap.iManagerServiceBase.prototype.request
  13310. * @description 子类统一通过该方法发送请求。
  13311. * @param {string} url - 请求 URL。
  13312. * @param {string} [method='GET'] - 请求类型。
  13313. * @param {Object} [requestOptions] - 请求选项。
  13314. * @param {Object} param - 请求参数。
  13315. * @description 发送请求。
  13316. * @returns {Promise} Promise 对象。
  13317. */
  13318. request(method, url, param, requestOptions) {
  13319. requestOptions = requestOptions || {
  13320. headers: {
  13321. 'Accept': '*/*',
  13322. 'Content-Type': 'application/json'
  13323. }
  13324. };
  13325. if (!requestOptions.hasOwnProperty("withCredentials")) {
  13326. requestOptions['withCredentials'] = true;
  13327. }
  13328. requestOptions['crossOrigin'] = this.options.crossOrigin;
  13329. requestOptions['headers'] = this.options.headers;
  13330. var token = SecurityManager.imanagerToken;
  13331. if (token) {
  13332. if (!requestOptions.headers) {
  13333. requestOptions.headers = [];
  13334. }
  13335. requestOptions.headers['X-Auth-Token'] = token;
  13336. }
  13337. if (param) {
  13338. param = JSON.stringify(param);
  13339. }
  13340. return FetchRequest.commit(method, url, param, requestOptions).then(function (response) {
  13341. return response.json();
  13342. });
  13343. }
  13344. }
  13345. SuperMap.iManagerServiceBase = IManagerServiceBase;
  13346. ;// CONCATENATED MODULE: ./src/common/iManager/iManagerCreateNodeParam.js
  13347. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13348. * This program are made available under the terms of the Apache License, Version 2.0
  13349. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13350. /**
  13351. * @class SuperMap.iManagerCreateNodeParam
  13352. * @classdesc iManager 创建节点参数。
  13353. * @category iManager
  13354. * @param {Object} [params] - iManager 创建节点参数。
  13355. *
  13356. */
  13357. class IManagerCreateNodeParam {
  13358. constructor(params) {
  13359. params = params || {};
  13360. this.nodeSpec = 'SMALL'; //取值范围: ['SMALL','MEDIUM','LARGE'] 以及自定义的环境规格名称
  13361. this.nodeCount = 1; //要创建vm的个数
  13362. this.nodeName = ''; //vm名称
  13363. this.password = ''; //vm的密码,空表示随机分配
  13364. this.description = ''; //描述信息
  13365. this.physicalMachineName = ''; //vm所属的物理机名称.
  13366. this.ips = []; //vm的ip,空数组表示随机分配
  13367. this.userName = ''; //vm所属用户
  13368. Util.extend(this, params);
  13369. }
  13370. }
  13371. SuperMap.iManagerCreateNodeParam = IManagerCreateNodeParam;
  13372. ;// CONCATENATED MODULE: ./src/common/iManager/iManager.js
  13373. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13374. * This program are made available under the terms of the Apache License, Version 2.0
  13375. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13376. /**
  13377. * @class SuperMap.iManager
  13378. * @classdesc iManager 服务类。
  13379. * @category iManager
  13380. * @param {string} serviceUrl - iManager 首页地址。
  13381. *
  13382. */
  13383. class IManager extends IManagerServiceBase {
  13384. constructor(iManagerUrl) {
  13385. super(iManagerUrl);
  13386. }
  13387. /**
  13388. * @function SuperMap.iManager.prototype.load
  13389. * @description 获取所有服务接口,验证是否已登录授权。
  13390. * @returns {Promise} Promise 对象。
  13391. */
  13392. load() {
  13393. return this.request("GET", this.serviceUrl + '/web/api/service.json');
  13394. }
  13395. /**
  13396. * @function SuperMap.iManager.prototype.createIServer
  13397. * @param {SuperMap.iManagerCreateNodeParam} createParam - 创建参数。
  13398. * @description 创建 iServer。
  13399. * @returns {Promise} Promise 对象。
  13400. */
  13401. createIServer(createParam) {
  13402. return this.request("POST", this.serviceUrl + '/icloud/web/nodes/server.json', new IManagerCreateNodeParam(createParam));
  13403. }
  13404. /**
  13405. * @function SuperMap.iManager.prototype.createIPortal
  13406. * @param {SuperMap.iManagerCreateNodeParam} createParam - 创建参数。
  13407. * @description 创建 iPortal。
  13408. * @returns {Promise} Promise 对象。
  13409. */
  13410. createIPortal(createParam) {
  13411. return this.request("POST", this.serviceUrl + '/icloud/web/nodes/portal.json', new IManagerCreateNodeParam(createParam));
  13412. }
  13413. /**
  13414. * @function SuperMap.iManager.prototype.iServerList
  13415. * @description 获取所有创建的 iServer。
  13416. * @returns {Promise} Promise 对象。
  13417. */
  13418. iServerList() {
  13419. return this.request("GET", this.serviceUrl + '/icloud/web/nodes/server.json');
  13420. }
  13421. /**
  13422. * @function SuperMap.iManager.prototype.iPortalList
  13423. * @description 获取所有创建的 iPortal。
  13424. * @returns {Promise} Promise 对象。
  13425. */
  13426. iPortalList() {
  13427. return this.request("GET", this.serviceUrl + '/icloud/web/nodes/portal.json');
  13428. }
  13429. /**
  13430. * @function SuperMap.iManager.prototype.startNodes
  13431. * @param {Array} ids - 需要启动节点的 ID 数组。e.g:['1']。
  13432. * @description 启动节点。
  13433. * @returns {Promise} Promise 对象。
  13434. */
  13435. startNodes(ids) {
  13436. return this.request("POST", this.serviceUrl + '/icloud/web/nodes/started.json', ids);
  13437. }
  13438. /**
  13439. * @function SuperMap.iManager.prototype.stopNodes
  13440. * @param {Array} ids - 需要停止节点的 ID 数组。e.g:['1']。
  13441. * @description 停止节点。
  13442. * @returns {Promise} Promise 对象。
  13443. */
  13444. stopNodes(ids) {
  13445. return this.request("POST", this.serviceUrl + '/icloud/web/nodes/stopped.json', ids);
  13446. }
  13447. }
  13448. SuperMap.iManager = IManager;
  13449. ;// CONCATENATED MODULE: ./src/common/iManager/index.js
  13450. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13451. * This program are made available under the terms of the Apache License, Version 2.0
  13452. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13453. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalServiceBase.js
  13454. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13455. * This program are made available under the terms of the Apache License, Version 2.0
  13456. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13457. /**
  13458. * @class SuperMap.iPortalServiceBase
  13459. * @classdesc iPortal 服务基类(有权限限制的类需要实现此类)。
  13460. * @category iPortal/Online
  13461. * @param {string} url - iPortal 服务地址。
  13462. * @param {Object} options - 可选参数。
  13463. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  13464. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  13465. * @param {Object} [options.headers] - 请求头。
  13466. */
  13467. class IPortalServiceBase {
  13468. constructor(url, options) {
  13469. options = options || {};
  13470. this.serviceUrl = url;
  13471. this.serverType = ServerType.iPortal;
  13472. this.CLASS_NAME = "SuperMap.iPortalServiceBase";
  13473. this.withCredentials = options.withCredentials || false;
  13474. this.crossOrigin = options.crossOrigin
  13475. this.headers = options.headers
  13476. }
  13477. /**
  13478. * @function SuperMap.iPortalServiceBase.prototype.request
  13479. * @description 子类统一通过该方法发送请求。
  13480. * @param {string} [method='GET'] - 请求类型。
  13481. * @param {string} url - 服务地址。
  13482. * @param {Object} param - 请求参数。
  13483. * @param {Object} [requestOptions] - fetch 请求配置项。
  13484. * @returns {Promise} 返回包含请求结果的 Promise 对象。
  13485. */
  13486. request(method, url, param, requestOptions = {headers: this.headers, crossOrigin: this.crossOrigin, withCredentials: this.withCredentials }) {
  13487. url = this.createCredentialUrl(url);
  13488. return FetchRequest.commit(method, url, param, requestOptions).then(function (response) {
  13489. return response.json();
  13490. });
  13491. }
  13492. /**
  13493. * @function SuperMap.iPortalServiceBase.prototype.createCredentialUrl
  13494. * @description 追加授权信息。
  13495. * @param {string} url - 创建证书 URL 地址。
  13496. * @returns {string} 携带 token 或 key 的新地址。
  13497. */
  13498. createCredentialUrl(url) {
  13499. var newUrl = url,
  13500. credential = this.getCredential();
  13501. if (credential) {
  13502. var endStr = newUrl.substring(newUrl.length - 1, newUrl.length);
  13503. if (newUrl.indexOf("?") > -1 && endStr === "?") {
  13504. newUrl += credential.getUrlParameters();
  13505. } else if (newUrl.indexOf("?") > -1 && endStr !== "?") {
  13506. newUrl += "&" + credential.getUrlParameters();
  13507. } else {
  13508. newUrl += "?" + credential.getUrlParameters();
  13509. }
  13510. }
  13511. return newUrl;
  13512. }
  13513. /**
  13514. * @function SuperMap.iPortalServiceBase.prototype.getCredential
  13515. * @description 获取 token。
  13516. * @returns {string} 返回获取的 token。
  13517. *
  13518. */
  13519. getCredential() {
  13520. var credential,
  13521. value = SecurityManager.getToken(this.serviceUrl);
  13522. credential = value ? new Credential(value, "token") : null;
  13523. if (!credential) {
  13524. value = this.getKey();
  13525. credential = value ? new Credential(value, "key") : null;
  13526. }
  13527. return credential;
  13528. }
  13529. /**
  13530. * @function SuperMap.iPortalServiceBase.prototype.getKey
  13531. * @description 其子类需要重写该方法,修改其中获取 key 的字段,存储 key 可能是服务 ID 字段,可能是 URL。
  13532. */
  13533. getKey() {
  13534. //return SuperMap.SecurityManager.getKey(this.id);
  13535. //或
  13536. //return SuperMap.SecurityManager.getKey(this.serviceUrl);
  13537. }
  13538. }
  13539. SuperMap.iPortalServiceBase = IPortalServiceBase;
  13540. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalQueryParam.js
  13541. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13542. * This program are made available under the terms of the Apache License, Version 2.0
  13543. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13544. /**
  13545. * @class SuperMap.iPortalQueryParam
  13546. * @classdesc iPortal 资源查询参数。
  13547. * @version 10.0.1
  13548. * @category iPortal/Online
  13549. * @param {Object} params - iPortal 资源查询具体参数。
  13550. * @param {SuperMap.ResourceType} [params.resourceType] - 资源类型
  13551. * @param {number} [params.pageSize] - 分页中每页大小。
  13552. * @param {number} [params.currentPage] - 分页页码。
  13553. * @param {SuperMap.OrderBy} [params.orderBy] - 排序字段。
  13554. * @param {SuperMap.OrderType} [params.orderType] - 根据升序还是降序过滤。
  13555. * @param {SuperMap.SearchType} [params.searchType] - 根据查询的范围进行过滤。
  13556. * @param {Array} [params.tags] - 标签。
  13557. * @param {Array} [params.dirIds] - 目录 id
  13558. * @param {Array} [params.resourceSubTypes] - 根据资源的子类型进行过滤。
  13559. * @param {SuperMap.AggregationTypes} [params.aggregationTypes] - 聚合查询的类型。
  13560. * @param {string} [params.text] - 搜索的关键词。
  13561. * @param {Array} [params.groupIds] - 根据群组进行过滤。
  13562. * @param {Array} [params.departmentIds] - 根据部门进行过滤。
  13563. */
  13564. class IPortalQueryParam {
  13565. constructor(params) {
  13566. params = params || {};
  13567. this.resourceType = ""; // 空为全部 MAP SERVICE SCENE DATA INSIGHTS_WORKSPACE MAP_DASHBOARD
  13568. this.pageSize = 12; // 每页多少条
  13569. this.currentPage = 1; // 第几页
  13570. this.orderBy = "UPDATETIME"; // UPDATETIME HEATLEVEL
  13571. this.orderType = "DESC"; // DESC ASC
  13572. this.searchType = "PUBLIC"; // PUBLIC SHARETOME_RES MYDEPARTMENT_RES MYGROUP_RES MY_RES
  13573. this.tags = []; // 标签
  13574. this.dirIds = []; // 类别
  13575. this.resourceSubTypes = []; // 类型
  13576. this.aggregationTypes = []; // TAG TYPE SUBTYPE
  13577. this.text = ""; // 搜索字段
  13578. this.groupIds = []; // 群组Id过滤
  13579. this.departmentIds = []; // 部门Id过滤
  13580. Util.extend(this, params);
  13581. }
  13582. }
  13583. SuperMap.iPortalQueryParam = IPortalQueryParam;
  13584. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalQueryResult.js
  13585. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13586. * This program are made available under the terms of the Apache License, Version 2.0
  13587. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13588. /**
  13589. * @class SuperMap.iPortalQueryResult
  13590. * @classdesc iPortal 资源结果集封装类。
  13591. * @version 10.0.1
  13592. * @category iPortal/Online
  13593. * @param {Object} queryResult - 资源参数。
  13594. * @param {Array} [queryResult.content] - 页面内容。
  13595. * @param {number} [queryResult.total] - 总记录数。
  13596. * @param {number} [queryResult.currentPage] - 当前第几页。
  13597. * @param {number} [queryResult.pageSize] - 每页大小。
  13598. * @param {Object} [queryResult.aggregations] - 聚合查询的结果。
  13599. */
  13600. class IPortalQueryResult {
  13601. constructor(queryResult) {
  13602. queryResult = queryResult || {};
  13603. this.content = [];
  13604. this.total = 0;
  13605. this.currentPage = 1;
  13606. this.pageSize = 12;
  13607. this.aggregations = null;
  13608. Util.extend(this, queryResult);
  13609. }
  13610. }
  13611. SuperMap.iPortalQueryResult = IPortalQueryResult;
  13612. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalResource.js
  13613. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13614. * This program are made available under the terms of the Apache License, Version 2.0
  13615. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13616. /**
  13617. * @class SuperMap.iPortalResource
  13618. * @classdesc iPortal 资源详情类。
  13619. * @version 10.0.1
  13620. * @category iPortal/Online
  13621. * @param {string} portalUrl - 资源地址。
  13622. * @param {Object} resourceInfo - 资源详情参数。
  13623. * @param {Array} [resourceInfo.authorizeSetting] - 资源的授权信息
  13624. * @param {string} [resourceInfo.bounds] - 资源的坐标范围
  13625. * @param {string} [resourceInfo.bounds4326] - 资源的坐标范围,转换为EPSG 4326坐标系统后的地理范围。
  13626. * @param {string} [resourceInfo.checkStatus] - 资源的审核状态,可以是:空,SUCCESSFUL,UNCHECKED,FAILED
  13627. * @param {Date} [resourceInfo.createTime] - 资源的创建时间
  13628. * @param {string} [resourceInfo.description] - 资源描述
  13629. * @param {number} [resourceInfo.dirId] - 资源所在的门户目录的id
  13630. * @param {number} [resourceInfo.epsgCode] - 门户资源基于的坐标系的EPSG值。
  13631. * @param {number} [resourceInfo.heatLevel] - 记录资源的访问量或下载量。
  13632. * @param {string} [resourceInfo.id] - 资源存储到ElasticSearch中的文档id
  13633. * @param {string} [resourceInfo.name] - 资源名称
  13634. * @param {number} [resourceInfo.personalDirId] - 资源所在的个人目录的id
  13635. * @param {number} [resourceInfo.resourceId] - 资源表(maps,services等)里的id
  13636. * @param {string} [resourceInfo.resourceSubType] - 某类资源的具体子类型。
  13637. * @param {SuperMap.ResourceType} [resourceInfo.resourceType] - 资源类型
  13638. * @param {number} [resourceInfo.serviceRootUrlId] - 批量注册服务时,服务根地址的ID
  13639. * @param {Array} [resourceInfo.tags] - 资源的标签
  13640. * @param {string} [resourceInfo.thumbnail] - 资源的缩略图
  13641. * @param {Date} [resourceInfo.updateTime] - 资源的更新时间
  13642. * @param {string} [resourceInfo.userName] - 搜索的关键词
  13643. * @param {Object} [resourceInfo.sourceJSON] - 提供了门户项目返回的所有信息。
  13644. * @extends {SuperMap.iPortalServiceBase}
  13645. */
  13646. class IPortalResource extends IPortalServiceBase {
  13647. constructor(portalUrl, resourceInfo) {
  13648. super(portalUrl);
  13649. resourceInfo = resourceInfo || {};
  13650. this.authorizeSetting = [];
  13651. this.bounds = "";
  13652. this.bounds4326 = "";
  13653. this.checkStatus = "";
  13654. this.createTime = 0;
  13655. this.description = null;
  13656. this.dirId = null;
  13657. this.epsgCode = 0;
  13658. this.heatLevel = 0;
  13659. this.id = 0;
  13660. this.name = "";
  13661. this.personalDirId = null;
  13662. this.resourceId = 0;
  13663. this.resourceSubType = null;
  13664. this.resourceType = null;
  13665. this.serviceRootUrlId = null;
  13666. this.tags = null;
  13667. this.thumbnail = null;
  13668. this.updateTime = 0;
  13669. this.userName = "";
  13670. this.sourceJSON = {};//返回门户资源详细信息
  13671. Util.extend(this, resourceInfo); // INSIGHTS_WORKSPACE MAP_DASHBOARD
  13672. this.resourceUrl = portalUrl + "/web/"+this.resourceType.replace("_","").toLowerCase()+"s/" + this.resourceId;
  13673. if (this.withCredentials) {
  13674. this.resourceUrl = portalUrl + "/web/mycontent/"+this.resourceType.replace("_","").toLowerCase()+"s/" + this.resourceId;
  13675. }
  13676. // if (this.id) {
  13677. // this.mapUrl = mapUrl + "/" + this.id;
  13678. // }
  13679. }
  13680. /**
  13681. * @function SuperMap.iPortalResource.prototype.load
  13682. * @description 加载资源信息。
  13683. * @returns {Promise} 返回 Promise 对象。如果成功,Promise 没有返回值,请求返回结果自动填充到该类的属性中;如果失败,Promise 返回值包含错误信息。
  13684. */
  13685. load() {
  13686. var me = this;
  13687. return me.request("GET", me.resourceUrl + ".json")
  13688. .then(function (resourceInfo) {
  13689. if (resourceInfo.error) {
  13690. return resourceInfo;
  13691. }
  13692. me.sourceJSON = resourceInfo;
  13693. });
  13694. }
  13695. /**
  13696. * @function SuperMap.iPortalResource.prototype.update
  13697. * @description 更新资源属性信息。
  13698. * @returns {Promise} 返回包含更新操作状态的 Promise 对象。
  13699. */
  13700. update() {
  13701. var resourceName = this.resourceType.replace("_","").toLowerCase();
  13702. var options = {
  13703. headers: {'Content-Type': 'application/x-www-form-urlencoded'}
  13704. };
  13705. if( resourceName === 'data') {
  13706. this.resourceUrl = this.resourceUrl + "/attributes.json";
  13707. }
  13708. var entity = JSON.stringify(this.sourceJSON);
  13709. //对服务资源进行编辑时,请求体内容只留关键字字段(目前如果是全部字段 更新返回成功 但其实没有真正的更新)
  13710. if( resourceName === 'service') {
  13711. var serviceInfo = {
  13712. authorizeSetting:this.sourceJSON.authorizeSetting,
  13713. metadata:this.sourceJSON.metadata,
  13714. tags:this.sourceJSON.tags,
  13715. thumbnail:this.sourceJSON.thumbnail,
  13716. tokenRefreshUrl:this.sourceJSON.tokenRefreshUrl
  13717. };
  13718. entity = JSON.stringify(serviceInfo);
  13719. }
  13720. return this.request("PUT", this.resourceUrl, entity, options);
  13721. }
  13722. }
  13723. SuperMap.iPortalResource = IPortalResource;
  13724. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalShareParam.js
  13725. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13726. * This program are made available under the terms of the Apache License, Version 2.0
  13727. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13728. /**
  13729. * @class SuperMap.iPortalShareParam
  13730. * @classdesc iPortal 资源共享参数。
  13731. * @version 10.0.1
  13732. * @category iPortal/Online
  13733. * @param {Object} params - iPortal 资源共享具体参数。
  13734. * @param {SuperMap.ResourceType} [params.resourceType] - 资源类型。
  13735. * @param {Array} [params.ids] - 资源的id数组。
  13736. * @param {SuperMap.iPortalShareEntity} [params.entities] - 资源的实体共享参数
  13737. */
  13738. class IPortalShareParam {
  13739. constructor(params) {
  13740. params = params || {};
  13741. this.ids = [];
  13742. this.entities = [];
  13743. this.resourceType = ""; // MAP SERVICE SCENE DATA INSIGHTS_WORKSPACE MAP_DASHBOARD
  13744. Util.extend(this, params);
  13745. }
  13746. }
  13747. SuperMap.iPortalShareParam = IPortalShareParam;
  13748. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortal.js
  13749. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13750. * This program are made available under the terms of the Apache License, Version 2.0
  13751. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13752. /**
  13753. * @class SuperMap.iPortal
  13754. * @classdesc 对接 SuperMap iPortal 基础服务。
  13755. * @category iPortal/Online
  13756. * @extends {SuperMap.iPortalServiceBase}
  13757. * @param {string} iportalUrl - 地址。
  13758. * @param {Object} options - 参数。
  13759. * @param {boolean} [options.withCredentials] - 请求是否携带 cookie。
  13760. */
  13761. class IPortal extends IPortalServiceBase {
  13762. constructor(iportalUrl, options) {
  13763. super(iportalUrl, options);
  13764. this.iportalUrl = iportalUrl;
  13765. options = options || {};
  13766. this.withCredentials = options.withCredentials || false;
  13767. }
  13768. /**
  13769. * @function SuperMap.iPortal.prototype.load
  13770. * @description 加载页面。
  13771. * @returns {Promise} 返回包含 iportal web 资源信息的 Promise 对象。
  13772. */
  13773. load() {
  13774. return FetchRequest.get(this.iportalUrl + "/web");
  13775. }
  13776. /**
  13777. * @function SuperMap.iPortal.prototype.queryResources
  13778. * @description 查询资源。
  13779. * @version 10.0.1
  13780. * @param {SuperMap.iPortalQueryParam} queryParams - 查询参数。
  13781. * @returns {Promise} 返回包含所有资源结果的 Promise 对象。
  13782. */
  13783. queryResources(queryParams) {
  13784. if (!(queryParams instanceof IPortalQueryParam)) {
  13785. return new Promise( function(resolve){
  13786. resolve(
  13787. "queryParams is not instanceof iPortalQueryParam !"
  13788. );
  13789. });
  13790. }
  13791. var me = this;
  13792. var resourceUrl = this.iportalUrl + "/gateway/catalog/resource/search.json";
  13793. queryParams.t = new Date().getTime();
  13794. return this.request("GET", resourceUrl, queryParams).then(function(result) {
  13795. var content = [];
  13796. result.content.forEach(function(item) {
  13797. content.push(new IPortalResource(me.iportalUrl, item));
  13798. });
  13799. let queryResult = new IPortalQueryResult();
  13800. queryResult.content = content;
  13801. queryResult.total = result.total;
  13802. queryResult.currentPage = result.currentPage;
  13803. queryResult.pageSize = result.pageSize;
  13804. queryResult.aggregations = result.aggregations;
  13805. return queryResult;
  13806. });
  13807. }
  13808. /**
  13809. * @function SuperMap.iPortal.prototype.updateResourcesShareSetting
  13810. * @description 更新共享设置。
  13811. * @version 10.0.1
  13812. * @param {SuperMap.iPortalShareParam} shareParams - 共享的参数。
  13813. * @returns {Promise} 返回包含共享资源结果的 Promise 对象。
  13814. */
  13815. updateResourcesShareSetting(shareParams) {
  13816. if (!(shareParams instanceof IPortalShareParam)) {
  13817. return new Promise( function(resolve){
  13818. resolve(
  13819. "shareParams is not instanceof iPortalShareParam !"
  13820. );
  13821. });
  13822. }
  13823. var resourceUrlName = shareParams.resourceType.replace("_","").toLowerCase()+"s";
  13824. if(resourceUrlName === "datas"){
  13825. resourceUrlName = "mycontent/"+resourceUrlName;
  13826. }
  13827. var cloneShareParams = {
  13828. ids: shareParams.ids,
  13829. entities: shareParams.entities
  13830. }
  13831. var shareUrl = this.iportalUrl + "/web/"+resourceUrlName+"/sharesetting.json";
  13832. return this.request("PUT", shareUrl, JSON.stringify(cloneShareParams)).then(function(result) {
  13833. return result;
  13834. });
  13835. }
  13836. }
  13837. SuperMap.iPortal = IPortal;
  13838. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalShareEntity.js
  13839. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13840. * This program are made available under the terms of the Apache License, Version 2.0
  13841. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13842. /**
  13843. * @class SuperMap.iPortalShareEntity
  13844. * @classdesc iPortal 资源共享实体参数。
  13845. * @version 10.0.1
  13846. * @category iPortal/Online
  13847. * @param {Object} shareEntity - iPortal 资源共享实体具体参数。
  13848. * @param {SuperMap.PermissionType} [shareEntity.permissionType] - 权限类型。
  13849. * @param {SuperMap.EntityType} [shareEntity.entityType] - 实体类型
  13850. * @param {string} [shareEntity.entityName] - 实体 Name。对应的 USER(用户)、 ROLE(角色)、GROUP(用户组)、IPORTALGROUP(群组)的名称。
  13851. * @param {number} [shareEntity.entityId] - 实体的 id。用于群组的授权。
  13852. */
  13853. class IPortalShareEntity {
  13854. constructor(shareEntity) {
  13855. shareEntity = shareEntity || {};
  13856. this.permissionType = ""; // SEARCH READ READWRITE DOWNLOAD
  13857. this.entityType = ""; // USER DEPARTMENT IPORTALGROUP
  13858. this.entityName = "GUEST"; // GUEST or 具体用户 name
  13859. this.entityId = null;
  13860. Util.extend(this, shareEntity);
  13861. }
  13862. }
  13863. SuperMap.iPortalShareEntity = IPortalShareEntity;
  13864. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalAddResourceParam.js
  13865. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13866. * This program are made available under the terms of the Apache License, Version 2.0
  13867. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13868. /**
  13869. * @class SuperMap.iPortalAddResourceParam
  13870. * @classdesc iPortal 添加资源参数。
  13871. * @version 10.0.1
  13872. * @category iPortal/Online
  13873. * @param {Object} params - iPortal 添加资源具体参数。
  13874. * @param {String} [params.rootUrl] - 服务地址。
  13875. * @param {Array} [params.tags] - 标签。
  13876. * @param {SuperMap.iPortalShareEntity} [params.entities] - 资源的实体共享参数
  13877. */
  13878. class IPortalAddResourceParam {
  13879. constructor(params) {
  13880. params = params || {};
  13881. this.rootUrl = "";
  13882. this.tags = [];
  13883. this.entities = [];
  13884. Util.extend(this, params);
  13885. }
  13886. }
  13887. SuperMap.iPortalAddResourceParam = IPortalAddResourceParam;
  13888. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalRegisterServiceParam.js
  13889. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13890. * This program are made available under the terms of the Apache License, Version 2.0
  13891. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13892. /**
  13893. * @class SuperMap.iPortalRegisterServiceParam
  13894. * @classdesc iPortal 注册服务参数。
  13895. * @version 10.0.1
  13896. * @category iPortal/Online
  13897. * @param {Object} params - iPortal 注册服务具体参数。
  13898. * @param {String} [params.type] - 服务类型。
  13899. * @param {Array} [params.tags] - 服务标签。
  13900. * @param {SuperMap.iPortalShareEntity} [params.entities] - 资源的实体共享参数
  13901. * @param {Object} [params.metadata] - 服务元信息。
  13902. * @param {Array} [params.addedMapNames] - 地图服务列表。
  13903. * @param {Array} [params.addedSceneNames] - 场景服务列表。
  13904. */
  13905. class IPortalRegisterServiceParam {
  13906. constructor(params) {
  13907. params = params || {};
  13908. this.type = ""; // SUPERMAP_REST ARCGIS_REST WMS WFS WCS WPS WMTS OTHERS
  13909. this.tags = [];
  13910. this.entities = [];
  13911. this.metadata = {};
  13912. this.addedMapNames = [];
  13913. this.addedSceneNames = [];
  13914. Util.extend(this, params);
  13915. }
  13916. }
  13917. SuperMap.iPortalRegisterServiceParam = IPortalRegisterServiceParam;
  13918. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalAddDataParam.js
  13919. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13920. * This program are made available under the terms of the Apache License, Version 2.0
  13921. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13922. /**
  13923. * @class SuperMap.iPortalAddDataParam
  13924. * @classdesc iPortal 上传/注册数据所需的参数。
  13925. * @version 10.0.1
  13926. * @category iPortal/Online
  13927. * @param {Object} params - iPortal 上传/注册数据所需的具体参数。
  13928. * @param {string} params.fileName - 文件名称
  13929. * @param {SuperMap.DataItemType} params.type - 数据类型。
  13930. * @param {Array} [params.tags] - 数据的标签
  13931. * @param {SuperMap.iPortalDataMetaInfoParam} [params.dataMetaInfo] - 数据元信息
  13932. */
  13933. class IPortalAddDataParam {
  13934. constructor(params) {
  13935. params = params || {};
  13936. this.fileName = "";
  13937. this.type = "";
  13938. this.tags = [];
  13939. this.dataMetaInfo = {};
  13940. Util.extend(this, params);
  13941. }
  13942. }
  13943. SuperMap.iPortalAddDataParam = IPortalAddDataParam;
  13944. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalDataMetaInfoParam.js
  13945. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13946. * This program are made available under the terms of the Apache License, Version 2.0
  13947. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13948. /**
  13949. * @class SuperMap.iPortalDataMetaInfoParam
  13950. * @classdesc iPortal 上传数据/注册数据元信息所需的参数。
  13951. * @version 10.0.1
  13952. * @category iPortal/Online
  13953. * @param {Object} params - iPortal 获取数据项id excel csv类型的数据所需数据元信息具体参数。
  13954. * @param {string} params.xField - X 坐标字段
  13955. * @param {string} params.yField - Y 坐标字段
  13956. * @param {number} params.xIndex - x所在列(关系型存储下CSV或EXCEL数据时必填)
  13957. * @param {number} params.yIndex - y所在列(关系型存储下CSV或EXCEL数据时必填)
  13958. * @param {array} [params.fieldTypes] - 设置字段类型(关系型存储下CSV或EXCEL数据时可选填)。默认类型为:WTEXT。该参数按照CSV文件字段顺序从左到右依次设置,其中默认字段类型可省略不设置。例如,CSV文件中有10个字段,如果只需设定第1,2,4个字段,可设置为[a,b,,c]。
  13959. * @param {string} params.separator - 分隔符(关系型存储下CSV数据时必填)
  13960. * @param {boolean} params.firstRowIsHead - 是否带表头(关系型存储下CSV数据时必填)
  13961. * @param {boolean} params.url - HDFS注册目录地址
  13962. * @param {SuperMap.iPortalDataStoreInfoParam} params.dataStoreInfo - 注册数据时的数据存储信息
  13963. */
  13964. class IPortalDataMetaInfoParam {
  13965. constructor(params) {
  13966. params = params || {};
  13967. this.xField = "";
  13968. this.yField = "";
  13969. this.fileEncoding = "UTF-8";
  13970. this.xIndex = 1;
  13971. this.yIndex = 1;
  13972. this.fieldTypes = [];
  13973. this.separator = "";
  13974. this.firstRowIsHead = true;
  13975. this.url = "";
  13976. this.dataStoreInfo = {};
  13977. Util.extend(this, params);
  13978. }
  13979. }
  13980. SuperMap.iPortalDataMetaInfoParam = IPortalDataMetaInfoParam;
  13981. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalDataStoreInfoParam.js
  13982. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13983. * This program are made available under the terms of the Apache License, Version 2.0
  13984. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13985. /**
  13986. * @class SuperMap.iPortalDataStoreInfoParam
  13987. * @classdesc iPortal 注册一个HBASE HDFS数据存储类。
  13988. * @version 10.0.1
  13989. * @category iPortal/Online
  13990. * @param {Object} params - iPortal 注册一个HBASE HDFS数据存储类具体参数。
  13991. * @param {string} params.type - 大数据文件共享类型和空间数据库类型,包括大数据文件共享HDFS 目录(HDFS)和空间数据库HBASE
  13992. * @param {string} params.url - HDFS数据存储目录地址
  13993. * @param {SuperMap.iPortalDataConnectionInfoParam} [params.connectionInfo] - HBASE空间数据库服务的连接信息
  13994. */
  13995. class IPortalDataStoreInfoParam {
  13996. constructor(params) {
  13997. params = params || {};
  13998. this.type = "";
  13999. this.url = "";
  14000. this.connectionInfo = {};
  14001. Util.extend(this, params);
  14002. }
  14003. }
  14004. SuperMap.iPortalDataStoreInfoParam = IPortalDataStoreInfoParam;
  14005. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalDataConnectionInfoParam.js
  14006. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14007. * This program are made available under the terms of the Apache License, Version 2.0
  14008. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14009. /**
  14010. * @class SuperMap.iPortalDataConnectionInfoParam
  14011. * @classdesc iPortal HBASE数据源连接信息类。
  14012. * @version 10.0.1
  14013. * @category iPortal/Online
  14014. * @param {Object} params - iPortal HBASE数据源连接信息类具体参数。
  14015. * @param {string} params.dataBase - 数据源连接的数据库名。
  14016. * @param {string} params.server - 服务地址。
  14017. */
  14018. class IPortalDataConnectionInfoParam {
  14019. constructor(params) {
  14020. params = params || {};
  14021. this.dataBase = "";
  14022. this.server = "";
  14023. Util.extend(this, params);
  14024. }
  14025. }
  14026. SuperMap.iPortalDataConnectionInfoParam = IPortalDataConnectionInfoParam;
  14027. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalUser.js
  14028. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14029. * This program are made available under the terms of the Apache License, Version 2.0
  14030. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14031. /**
  14032. * @class SuperMap.iPortalUser
  14033. * @classdesc iPortal 门户中用户信息的封装类。用于管理用户资源,包括可删除,添加资源。
  14034. * @version 10.0.1
  14035. * @category iPortal/Online
  14036. * @param {string} iportalUrl - iportal根地址。
  14037. * @extends {SuperMap.iPortalServiceBase}
  14038. *
  14039. */
  14040. class IPortalUser extends IPortalServiceBase {
  14041. constructor(iportalUrl) {
  14042. super(iportalUrl);
  14043. this.iportalUrl = iportalUrl;
  14044. }
  14045. /**
  14046. * @function SuperMap.iPortalUser.prototype.deleteResources
  14047. * @description 删除资源。
  14048. * @param {Object} params - 删除资源所需的参数对象:{ids,resourceType}。
  14049. * @returns {Promise} 返回包含删除操作状态的 Promise 对象。
  14050. */
  14051. deleteResources(params) {
  14052. var resourceName = params.resourceType.replace("_","").toLowerCase();
  14053. var deleteResourceUrl = this.iportalUrl+"/web/" + resourceName +"s.json?ids=" + encodeURI(JSON.stringify(params.ids));
  14054. if( resourceName === 'data') {
  14055. deleteResourceUrl = this.iportalUrl + "/web/mycontent/datas/delete.json";
  14056. return this.request("POST", deleteResourceUrl, JSON.stringify(params.ids));
  14057. }
  14058. return this.request("DELETE", deleteResourceUrl);
  14059. }
  14060. /**
  14061. * @function SuperMap.iPortalUser.prototype.addMap
  14062. * @description 添加地图。
  14063. * @version 10.1.0
  14064. * @param {SuperMap.iPortalAddResourceParam} addMapParams - 添加地图的参数。
  14065. * @returns {Promise} 返回包含添加地图结果的 Promise 对象。
  14066. */
  14067. addMap(addMapParams) {
  14068. if (!(addMapParams instanceof IPortalAddResourceParam)) {
  14069. return this.getErrMsgPromise("addMapParams is not instanceof IPortalAddResourceParam !");
  14070. }
  14071. let cloneAddMapParams = {
  14072. rootUrl: addMapParams.rootUrl,
  14073. tags: addMapParams.tags,
  14074. authorizeSetting: addMapParams.entities
  14075. }
  14076. let addMapUrl = this.iportalUrl + "/web/maps/batchaddmaps.json";
  14077. return this.request("POST", addMapUrl, JSON.stringify(cloneAddMapParams)).then(function(result) {
  14078. return result;
  14079. });
  14080. }
  14081. /**
  14082. * @function SuperMap.iPortalUser.prototype.addScene
  14083. * @description 添加场景。
  14084. * @version 10.1.0
  14085. * @param {SuperMap.iPortalAddResourceParam} addSceneParams - 添加场景的参数。
  14086. * @returns {Promise} 返回包含添加场景结果的 Promise 对象。
  14087. */
  14088. addScene(addSceneParams) {
  14089. if (!(addSceneParams instanceof IPortalAddResourceParam)) {
  14090. return this.getErrMsgPromise("addSceneParams is not instanceof IPortalAddResourceParam !");
  14091. }
  14092. let cloneAddSceneParams = {
  14093. rootUrl: addSceneParams.rootUrl,
  14094. tags: addSceneParams.tags,
  14095. authorizeSetting: addSceneParams.entities
  14096. }
  14097. let addSceneUrl = this.iportalUrl + "/web/scenes/batchaddscenes.json";
  14098. return this.request("POST", addSceneUrl, JSON.stringify(cloneAddSceneParams)).then(function(result) {
  14099. return result;
  14100. });
  14101. }
  14102. /**
  14103. * @function SuperMap.iPortalUser.prototype.registerService
  14104. * @description 注册服务。
  14105. * @version 10.1.0
  14106. * @param {SuperMap.iPortalRegisterServiceParam} registerParams - 注册服务的参数。
  14107. * @returns {Promise} 返回包含注册服务结果的 Promise 对象。
  14108. */
  14109. registerService(registerParams) {
  14110. if(!(registerParams instanceof IPortalRegisterServiceParam)) {
  14111. return this.getErrMsgPromise("registerParams is not instanceof IPortalRegisterServiceParam !");
  14112. }
  14113. let cloneRegisterParams = {
  14114. type: registerParams.type,
  14115. tags: registerParams.tags,
  14116. authorizeSetting: registerParams.entities,
  14117. metadata: registerParams.metadata,
  14118. addedMapNames: registerParams.addedMapNames,
  14119. addedSceneNames: registerParams.addedSceneNames
  14120. }
  14121. let registerUrl = this.iportalUrl + "/web/services.json";
  14122. return this.request("POST", registerUrl, JSON.stringify(cloneRegisterParams)).then(result => {
  14123. return result;
  14124. });
  14125. }
  14126. /**
  14127. * @function SuperMap.iPortalUser.prototype.getErrMsgPromise
  14128. * @description 获取包含错误信息的Promise对象。
  14129. * @version 10.1.0
  14130. * @param {String} errMsg - 传入的错误信息。
  14131. * @returns {Promise} 返回包含错误信息的 Promise 对象。
  14132. */
  14133. getErrMsgPromise(errMsg) {
  14134. return new Promise(resolve => {
  14135. resolve(errMsg);
  14136. })
  14137. }
  14138. /**
  14139. * @function SuperMap.iPortalUser.prototype.uploadDataRequest
  14140. * @description 上传数据。
  14141. * @version 10.1.0
  14142. * @param {number} id - 上传数据的资源id。
  14143. * @param {Object} formData - 请求体为文本数据流。
  14144. * @returns {Promise} 返回包含上传数据操作的 Promise 对象。
  14145. */
  14146. uploadDataRequest(id,formData) {
  14147. var uploadDataUrl = this.iportalUrl + "/web/mycontent/datas/"+id+"/upload.json";
  14148. return this.request("POST",uploadDataUrl,formData);
  14149. }
  14150. /**
  14151. * @function SuperMap.iPortalUser.prototype.addData
  14152. * @description 上传/注册数据。
  14153. * @version 10.1.0
  14154. * @param {SuperMap.iPortalAddDataParam} params - 上传/注册数据所需的参数。
  14155. * @param {Object} [formData] - 请求体为文本数据流(上传数据时传入)。
  14156. * @returns {Promise} 返回上传/注册数据的 Promise 对象。
  14157. */
  14158. addData(params,formData) {
  14159. if(!(params instanceof IPortalAddDataParam)){
  14160. return this.getErrMsgPromise("params is not instanceof iPortalAddDataParam !");
  14161. }
  14162. var datasUrl = this.iportalUrl + "/web/mycontent/datas.json";
  14163. var entity = {
  14164. fileName:params.fileName,
  14165. tags:params.tags,
  14166. type:params.type
  14167. };
  14168. var type = params.type.toLowerCase();
  14169. var dataMetaInfo;
  14170. if(type === "excel" || type === "csv"){
  14171. if(!(params.dataMetaInfo instanceof IPortalDataMetaInfoParam)){
  14172. return this.getErrMsgPromise("params.dataMetaInfo is not instanceof iPortalDataMetaInfoParam !");
  14173. }
  14174. dataMetaInfo = {
  14175. xField:params.dataMetaInfo.xField,
  14176. yField:params.dataMetaInfo.yField
  14177. }
  14178. if(type === 'csv') {
  14179. dataMetaInfo.fileEncoding = params.dataMetaInfo.fileEncoding
  14180. }
  14181. entity.coordType = "WGS84";
  14182. entity.dataMetaInfo = dataMetaInfo;
  14183. }else if(type === "hdfs" || type === "hbase") {
  14184. if(!(params.dataMetaInfo instanceof IPortalDataMetaInfoParam)){
  14185. return this.getErrMsgPromise("params.dataMetaInfo is not instanceof iPortalDataMetaInfoParam !");
  14186. }
  14187. if(!(params.dataMetaInfo.dataStoreInfo instanceof IPortalDataStoreInfoParam)){
  14188. return this.getErrMsgPromise("params.dataMetaInfo.dataStoreInfo is not instanceof iPortalDataStoreInfoParam !");
  14189. }
  14190. var dataStoreInfo = {
  14191. type:params.dataMetaInfo.dataStoreInfo.type
  14192. }
  14193. switch (type) {
  14194. case "hdfs":
  14195. dataStoreInfo.url = params.dataMetaInfo.dataStoreInfo.url;
  14196. dataMetaInfo = {
  14197. url: params.dataMetaInfo.url,
  14198. dataStoreInfo:dataStoreInfo
  14199. }
  14200. break;
  14201. case "hbase":
  14202. if(!(params.dataMetaInfo.dataStoreInfo.connectionInfo instanceof IPortalDataConnectionInfoParam)){
  14203. return this.getErrMsgPromise("params.dataMetaInfo.dataStoreInfo.connectionInfo is not instanceof iPortalDataConnectionInfoParam !");
  14204. }
  14205. dataStoreInfo.connectionInfo = {
  14206. dataBase:params.dataMetaInfo.dataStoreInfo.connectionInfo.dataBase,
  14207. server:params.dataMetaInfo.dataStoreInfo.connectionInfo.server,
  14208. engineType:'HBASE'
  14209. }
  14210. dataStoreInfo.datastoreType = "SPATIAL";//该字段SPATIAL表示HBASE注册
  14211. dataMetaInfo = {
  14212. dataStoreInfo:dataStoreInfo
  14213. }
  14214. break;
  14215. }
  14216. entity.dataMetaInfo = dataMetaInfo;
  14217. }
  14218. return this.request("POST",datasUrl,JSON.stringify(entity)).then(res=>{
  14219. if(type === "hdfs" || type === "hbase"){
  14220. return res;
  14221. }else {
  14222. if(res.childID) {
  14223. return this.uploadDataRequest(res.childID,formData);
  14224. }else {
  14225. return res.customResult;
  14226. }
  14227. }
  14228. })
  14229. }
  14230. /**
  14231. * @function SuperMap.iPortalUser.prototype.publishOrUnpublish
  14232. * @description 发布/取消发布。
  14233. * @version 10.1.0
  14234. * @param {object} options - 发布/取消发布数据服务所需的参数。
  14235. * @param {object} options.dataId - 数据项id。
  14236. * @param {object} options.serviceType - 发布的服务类型,目前支持发布的服务类型包括:RESTDATA, RESTMAP, RESTREALSPACE, RESTSPATIALANALYST。
  14237. * @param {object} [options.dataServiceId] - 发布的服务 id。
  14238. * @param {boolean} forPublish - 是否取消发布。
  14239. * @returns {Promise} 返回发布/取消发布数据服务的 Promise 对象。
  14240. */
  14241. publishOrUnpublish(option,forPublish){
  14242. if(!option.dataId || !option.serviceType) {
  14243. return this.getErrMsgPromise("option.dataID and option.serviceType are Required!");
  14244. }
  14245. var dataId = option.dataId;
  14246. var dataServiceId = option.dataServiceId;
  14247. var serviceType = option.serviceType;
  14248. var publishUrl = this.iportalUrl + "/web/mycontent/datas/" + dataId + "/publishstatus.json?serviceType=" + serviceType;
  14249. if (dataServiceId) {
  14250. publishUrl += "&dataServiceId=" + dataServiceId;
  14251. }
  14252. return this.request("PUT",publishUrl,JSON.stringify(forPublish)).then(res=>{
  14253. // 发起服务状态查询
  14254. if(forPublish) {
  14255. // 发布服务的结果异步处理
  14256. // var publishStateUrl = this.iportalUrl + "web/mycontent/datas/" + dataId + "/publishstatus.rjson";
  14257. if (!dataServiceId) { // 发布服务时会回传serviceIDs,发布服务之前serviceIDs为空
  14258. dataServiceId = res.customResult;
  14259. }
  14260. return dataServiceId;
  14261. }else {
  14262. // 取消发布的结果同步处理
  14263. return res;
  14264. }
  14265. });
  14266. }
  14267. /**
  14268. * @function SuperMap.iPortalUser.prototype.getDataPublishedStatus
  14269. * @description 查询服务状态,发起服务状态查询。
  14270. * @version 10.1.0
  14271. * @param {number} dataId - 查询服务状态的数据项id。
  14272. * @param {string} dataServiceId - 发布的服务id。
  14273. * @returns {Promise} 返回查询服务状态的 Promise 对象。
  14274. */
  14275. getDataPublishedStatus(dataId,dataServiceId){
  14276. var publishStateUrl = this.iportalUrl + "/web/mycontent/datas/" + dataId + "/publishstatus.json?dataServiceId="+dataServiceId+"&forPublish=true";
  14277. return this.request("GET",publishStateUrl);
  14278. }
  14279. /**
  14280. * @function SuperMap.iPortalUser.prototype.unPublishedDataService
  14281. * @description 取消发布。
  14282. * @version 10.1.0
  14283. * @param {object} options - 取消发布服务具体参数。
  14284. * @param {object} options.dataId - 数据项id。
  14285. * @param {object} options.serviceType - 发布的服务类型,目前支持发布的服务类型包括:RESTDATA, RESTMAP, RESTREALSPACE, RESTSPATIALANALYST。
  14286. * @param {object} [options.dataServiceId] - 发布的服务 id。
  14287. * @returns {Promise} 返回取消发布数据服务的 Promise 对象。
  14288. */
  14289. unPublishDataService(option){
  14290. return this.publishOrUnpublish(option,false);
  14291. }
  14292. /**
  14293. * @function SuperMap.iPortalUser.prototype.publishedDataService
  14294. * @description 发布数据服务。
  14295. * @version 10.1.0
  14296. * @param {object} options - 发布数据服务具体参数。
  14297. * @param {object} options.dataId - 数据项id。
  14298. * @param {object} options.serviceType - 发布的服务类型,目前支持发布的服务类型包括:RESTDATA, RESTMAP, RESTREALSPACE, RESTSPATIALANALYST。
  14299. * @param {object} [options.dataServiceId] - 发布的服务 id。
  14300. * @returns {Promise} 返回发布数据服务的 Promise 对象。
  14301. */
  14302. publishDataService(option){
  14303. return this.publishOrUnpublish(option,true);
  14304. }
  14305. }
  14306. SuperMap.iPortalUser = IPortalUser;
  14307. ;// CONCATENATED MODULE: ./src/common/iPortal/index.js
  14308. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14309. * This program are made available under the terms of the Apache License, Version 2.0
  14310. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14311. ;// CONCATENATED MODULE: ./src/common/iServer/CommonServiceBase.js
  14312. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14313. * This program are made available under the terms of the Apache License, Version 2.0
  14314. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14315. /**
  14316. * @class SuperMap.CommonServiceBase
  14317. * @category iServer
  14318. * @classdesc 对接 iServer 各种服务的 Service 的基类。
  14319. * @param {string} url - 服务地址。
  14320. * @param {Object} options - 参数。
  14321. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  14322. * @param {string} [options.proxy] - 服务代理地址。
  14323. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  14324. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  14325. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  14326. * @param {Object} [options.headers] - 请求头。
  14327. */
  14328. class CommonServiceBase {
  14329. constructor(url, options) {
  14330. let me = this;
  14331. this.EVENT_TYPES = ["processCompleted", "processFailed"];
  14332. this.events = null;
  14333. this.eventListeners = null;
  14334. this.url = null;
  14335. this.urls = null;
  14336. this.proxy = null;
  14337. this.serverType = null;
  14338. this.index = null;
  14339. this.length = null;
  14340. this.options = null;
  14341. this.totalTimes = null;
  14342. this.POLLING_TIMES = 3;
  14343. this._processSuccess = null;
  14344. this._processFailed = null;
  14345. this.isInTheSameDomain = null;
  14346. this.withCredentials = false;
  14347. if (Util.isArray(url)) {
  14348. me.urls = url;
  14349. me.length = url.length;
  14350. me.totalTimes = me.length;
  14351. if (me.length === 1) {
  14352. me.url = url[0];
  14353. } else {
  14354. me.index = parseInt(Math.random() * me.length);
  14355. me.url = url[me.index];
  14356. }
  14357. } else {
  14358. me.totalTimes = 1;
  14359. me.url = url;
  14360. }
  14361. if (Util.isArray(url) && !me.isServiceSupportPolling()) {
  14362. me.url = url[0];
  14363. me.totalTimes = 1;
  14364. }
  14365. me.serverType = me.serverType || ServerType.ISERVER;
  14366. options = options || {};
  14367. this.crossOrigin = options.crossOrigin;
  14368. this.headers = options.headers;
  14369. Util.extend(this, options);
  14370. me.isInTheSameDomain = Util.isInTheSameDomain(me.url);
  14371. me.events = new Events(me, null, me.EVENT_TYPES, true);
  14372. if (me.eventListeners instanceof Object) {
  14373. me.events.on(me.eventListeners);
  14374. }
  14375. this.CLASS_NAME = "SuperMap.CommonServiceBase";
  14376. }
  14377. /**
  14378. * @function SuperMap.CommonServiceBase.prototype.destroy
  14379. * @description 释放资源,将引用的资源属性置空。
  14380. */
  14381. destroy() {
  14382. let me = this;
  14383. if (Util.isArray(me.urls)) {
  14384. me.urls = null;
  14385. me.index = null;
  14386. me.length = null;
  14387. me.totalTimes = null;
  14388. }
  14389. me.url = null;
  14390. me.options = null;
  14391. me._processSuccess = null;
  14392. me._processFailed = null;
  14393. me.isInTheSameDomain = null;
  14394. me.EVENT_TYPES = null;
  14395. if (me.events) {
  14396. me.events.destroy();
  14397. me.events = null;
  14398. }
  14399. if (me.eventListeners) {
  14400. me.eventListeners = null;
  14401. }
  14402. }
  14403. /**
  14404. * @function SuperMap.CommonServiceBase.prototype.request
  14405. * @description: 该方法用于向服务发送请求。
  14406. * @param {Object} options - 参数。
  14407. * @param {string} [options.method='GET'] - 请求方式,包括 "GET","POST","PUT","DELETE"。
  14408. * @param {string} [options.url] - 发送请求的地址。
  14409. * @param {Object} [options.params] - 作为查询字符串添加到 URL 中的一组键值对,此参数只适用于 GET 方式发送的请求。
  14410. * @param {string} [options.data] - 发送到服务器的数据。
  14411. * @param {function} options.success - 请求成功后的回调函数。
  14412. * @param {function} options.failure - 请求失败后的回调函数。
  14413. * @param {Object} [options.scope] - 如果回调函数是对象的一个公共方法,设定该对象的范围。
  14414. * @param {boolean} [options.isInTheSameDomain] - 请求是否在当前域中。
  14415. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  14416. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  14417. * @param {Object} [options.headers] - 请求头。
  14418. */
  14419. request(options) {
  14420. let me = this;
  14421. options.url = options.url || me.url;
  14422. options.proxy = options.proxy || me.proxy;
  14423. options.withCredentials = options.withCredentials != undefined ? options.withCredentials : me.withCredentials;
  14424. options.crossOrigin = options.crossOrigin != undefined ? options.crossOrigin : me.crossOrigin;
  14425. options.headers = options.headers || me.headers;
  14426. options.isInTheSameDomain = me.isInTheSameDomain;
  14427. //为url添加安全认证信息片段
  14428. let credential = this.getCredential(options.url);
  14429. if (credential) {
  14430. options.url = Util.urlAppend(options.url, credential.getUrlParameters());
  14431. }
  14432. me.calculatePollingTimes();
  14433. me._processSuccess = options.success;
  14434. me._processFailed = options.failure;
  14435. options.scope = me;
  14436. options.success = me.getUrlCompleted;
  14437. options.failure = me.getUrlFailed;
  14438. me.options = options;
  14439. me._commit(me.options);
  14440. }
  14441. /**
  14442. * @function SuperMap.CommonServiceBase.prototype.getCredential
  14443. * @description 获取凭据信息
  14444. * @param {string} url - 服务地址。
  14445. * @returns {SuperMap.Credential} 凭据信息对象。
  14446. */
  14447. getCredential(url) {
  14448. let keyUrl = url,
  14449. credential, value;
  14450. switch (this.serverType) {
  14451. case ServerType.IPORTAL:
  14452. value = SecurityManager.getToken(keyUrl);
  14453. credential = value ? new Credential(value, "token") : null;
  14454. if (!credential) {
  14455. value = SecurityManager.getKey(keyUrl);
  14456. credential = value ? new Credential(value, "key") : null;
  14457. }
  14458. break;
  14459. case ServerType.ONLINE:
  14460. value = SecurityManager.getKey(keyUrl);
  14461. credential = value ? new Credential(value, "key") : null;
  14462. break;
  14463. default:
  14464. //iServer or others
  14465. value = SecurityManager.getToken(keyUrl);
  14466. credential = value ? new Credential(value, "token") : null;
  14467. break;
  14468. }
  14469. return credential;
  14470. }
  14471. /**
  14472. * @function SuperMap.CommonServiceBase.prototype.getUrlCompleted
  14473. * @description 请求成功后执行此方法。
  14474. * @param {Object} result - 服务器返回的结果对象。
  14475. */
  14476. getUrlCompleted(result) {
  14477. let me = this;
  14478. me._processSuccess(result);
  14479. }
  14480. /**
  14481. * @function SuperMap.CommonServiceBase.prototype.getUrlFailed
  14482. * @description 请求失败后执行此方法。
  14483. * @param {Object} result - 服务器返回的结果对象。
  14484. */
  14485. getUrlFailed(result) {
  14486. let me = this;
  14487. if (me.totalTimes > 0) {
  14488. me.totalTimes--;
  14489. me.ajaxPolling();
  14490. } else {
  14491. me._processFailed(result);
  14492. }
  14493. }
  14494. /**
  14495. *
  14496. * @function SuperMap.CommonServiceBase.prototype.ajaxPolling
  14497. * @description 请求失败后,如果剩余请求失败次数不为 0,重新获取 URL 发送请求
  14498. */
  14499. ajaxPolling() {
  14500. let me = this,
  14501. url = me.options.url,
  14502. re = /^http:\/\/([a-z]{9}|(\d+\.){3}\d+):\d{0,4}/;
  14503. me.index = parseInt(Math.random() * me.length);
  14504. me.url = me.urls[me.index];
  14505. url = url.replace(re, re.exec(me.url)[0]);
  14506. me.options.url = url;
  14507. me.options.isInTheSameDomain = Util.isInTheSameDomain(url);
  14508. me._commit(me.options);
  14509. }
  14510. /**
  14511. * @function SuperMap.CommonServiceBase.prototype.calculatePollingTimes
  14512. * @description 计算剩余请求失败执行次数。
  14513. */
  14514. calculatePollingTimes() {
  14515. let me = this;
  14516. if (me.times) {
  14517. if (me.totalTimes > me.POLLING_TIMES) {
  14518. if (me.times > me.POLLING_TIMES) {
  14519. me.totalTimes = me.POLLING_TIMES;
  14520. } else {
  14521. me.totalTimes = me.times;
  14522. }
  14523. } else {
  14524. if (me.times < me.totalTimes) {
  14525. me.totalTimes = me.times;
  14526. }
  14527. }
  14528. } else {
  14529. if (me.totalTimes > me.POLLING_TIMES) {
  14530. me.totalTimes = me.POLLING_TIMES;
  14531. }
  14532. }
  14533. me.totalTimes--;
  14534. }
  14535. /**
  14536. * @function SuperMap.CommonServiceBase.prototype.isServiceSupportPolling
  14537. * @description 判断服务是否支持轮询。
  14538. */
  14539. isServiceSupportPolling() {
  14540. let me = this;
  14541. return !(
  14542. me.CLASS_NAME === "SuperMap.REST.ThemeService" ||
  14543. me.CLASS_NAME === "SuperMap.REST.EditFeaturesService"
  14544. );
  14545. }
  14546. /**
  14547. * @function SuperMap.CommonServiceBase.prototype.serviceProcessCompleted
  14548. * @description 状态完成,执行此方法。
  14549. * @param {Object} result - 服务器返回的结果对象。
  14550. */
  14551. serviceProcessCompleted(result) {
  14552. result = Util.transformResult(result);
  14553. this.events.triggerEvent("processCompleted", {
  14554. result: result
  14555. });
  14556. }
  14557. /**
  14558. * @function SuperMap.CommonServiceBase.prototype.serviceProcessFailed
  14559. * @description 状态失败,执行此方法。
  14560. * @param {Object} result - 服务器返回的结果对象。
  14561. */
  14562. serviceProcessFailed(result) {
  14563. result = Util.transformResult(result);
  14564. let error = result.error || result;
  14565. this.events.triggerEvent("processFailed", {
  14566. error: error
  14567. });
  14568. }
  14569. _commit(options) {
  14570. if (options.method === "POST" || options.method === "PUT") {
  14571. if (options.params) {
  14572. options.url = Util.urlAppend(options.url,
  14573. Util.getParameterString(options.params || {}));
  14574. }
  14575. options.params = options.data;
  14576. }
  14577. FetchRequest.commit(options.method, options.url, options.params, {
  14578. headers: options.headers,
  14579. withCredentials: options.withCredentials,
  14580. crossOrigin: options.crossOrigin,
  14581. timeout: options.async ? 0 : null,
  14582. proxy: options.proxy
  14583. }).then(function (response) {
  14584. if (response.text) {
  14585. return response.text();
  14586. }
  14587. if (response.json) {
  14588. return response.json();
  14589. }
  14590. return response;
  14591. }).then(function (text) {
  14592. var result = text;
  14593. if (typeof text === "string") {
  14594. result = new JSONFormat().read(text);
  14595. }
  14596. if (!result || result.error || result.code >= 300 && result.code !== 304) {
  14597. if (result && result.error) {
  14598. result = {
  14599. error: result.error
  14600. };
  14601. } else {
  14602. result = {
  14603. error: result
  14604. };
  14605. }
  14606. }
  14607. if (result.error) {
  14608. var failure = (options.scope) ? FunctionExt.bind(options.failure, options.scope) : options.failure;
  14609. failure(result);
  14610. } else {
  14611. result.succeed = result.succeed == undefined ? true : result.succeed;
  14612. var success = (options.scope) ? FunctionExt.bind(options.success, options.scope) : options.success;
  14613. success(result);
  14614. }
  14615. }).catch(function (e) {
  14616. var failure = (options.scope) ? FunctionExt.bind(options.failure, options.scope) : options.failure;
  14617. failure(e);
  14618. })
  14619. }
  14620. }
  14621. SuperMap.CommonServiceBase = CommonServiceBase;
  14622. /**
  14623. * 服务器请求回调函数
  14624. * @callback RequestCallback
  14625. * @example
  14626. * var requestCallback = function (serviceResult){
  14627. * console.log(serviceResult.result);
  14628. * }
  14629. * new QueryService(url).queryByBounds(param, requestCallback);
  14630. * @param {Object} serviceResult
  14631. * @param {Object} serviceResult.result 服务器返回结果。
  14632. * @param {Object} serviceResult.object 发布应用程序事件的对象。
  14633. * @param {Object} serviceResult.type 事件类型。
  14634. * @param {Object} serviceResult.element 接受浏览器事件的 DOM 节点。
  14635. */
  14636. ;// CONCATENATED MODULE: ./src/common/iServer/GeoCodingParameter.js
  14637. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14638. * This program are made available under the terms of the Apache License, Version 2.0
  14639. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14640. /**
  14641. * @class SuperMap.GeoCodingParameter
  14642. * @category iServer AddressMatch
  14643. * @classdesc 地理正向匹配参数类。
  14644. * @param {Object} options - 参数。
  14645. * @param {string} options.address - 地点关键词。
  14646. * @param {number} [options.fromIndex] - 设置返回对象的起始索引值。
  14647. * @param {number} [options.toIndex] - 设置返回对象的结束索引值。
  14648. * @param {Array.<string>} [options.filters] - 过滤字段,限定查询区域。
  14649. * @param {string} [options.prjCoordSys] - 查询结果的坐标系。
  14650. * @param {number} [options.maxReturn] - 最大返回结果数。
  14651. */
  14652. class GeoCodingParameter {
  14653. constructor(options) {
  14654. if (options.filters && typeof(options.filters) === 'string') {
  14655. options.filters = options.filters.split(',');
  14656. }
  14657. /**
  14658. * @member {string} SuperMap.GeoCodingParameter.prototype.address
  14659. * @description 地点关键词。
  14660. */
  14661. this.address = null;
  14662. /**
  14663. * @member {number} [SuperMap.GeoCodingParameter.prototype.fromIndex]
  14664. * @description 设置返回对象的起始索引值。
  14665. */
  14666. this.fromIndex = null;
  14667. /**
  14668. * @member {number} [SuperMap.GeoCodingParameter.prototype.toIndex]
  14669. * @description 设置返回对象的结束索引值。
  14670. */
  14671. this.toIndex = null;
  14672. /**
  14673. * @member {Array.<string>} [SuperMap.GeoCodingParameter.prototype.filters]
  14674. * @description 过滤字段,限定查询区域。
  14675. */
  14676. this.filters = null;
  14677. /**
  14678. * @member {string} [SuperMap.GeoCodingParameter.prototype.prjCoordSys]
  14679. * @description 查询结果的坐标系。
  14680. */
  14681. this.prjCoordSys = null;
  14682. /**
  14683. * @member {number} [SuperMap.GeoCodingParameter.prototype.maxReturn]
  14684. * @description 最大返回结果数。
  14685. */
  14686. this.maxReturn = null;
  14687. Util.extend(this, options);
  14688. }
  14689. /**
  14690. * @function SuperMap.GeoCodingParameter.prototype.destroy
  14691. * @description 释放资源,将引用资源的属性置空。
  14692. */
  14693. destroy() {
  14694. this.address = null;
  14695. this.fromIndex = null;
  14696. this.toIndex = null;
  14697. this.filters = null;
  14698. this.prjCoordSys = null;
  14699. this.maxReturn = null;
  14700. }
  14701. }
  14702. SuperMap.GeoCodingParameter = GeoCodingParameter;
  14703. ;// CONCATENATED MODULE: ./src/common/iServer/GeoDecodingParameter.js
  14704. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14705. * This program are made available under the terms of the Apache License, Version 2.0
  14706. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14707. /**
  14708. * @class SuperMap.GeoDecodingParameter
  14709. * @category iServer AddressMatch
  14710. * @classdesc 地理反向匹配参数类。
  14711. * @param {Object} options - 参数。
  14712. * @param {number} options.x - 查询位置的横坐标。
  14713. * @param {number} options.y - 查询位置的纵坐标。
  14714. * @param {number} [options.fromIndex] - 设置返回对象的起始索引值。
  14715. * @param {Array.<string>} [options.filters] - 过滤字段,限定查询区域。
  14716. * @param {string} [options.prjCoordSys] - 查询结果的坐标系。
  14717. * @param {number} [options.maxReturn] - 最大返回结果数。
  14718. * @param {number} [options.geoDecodingRadius] - 查询半径。
  14719. */
  14720. class GeoDecodingParameter {
  14721. constructor(options) {
  14722. if (options.filters) {
  14723. options.filters = options.filters.split(',');
  14724. }
  14725. /**
  14726. * @member {number} SuperMap.GeoDecodingParameter.prototype.x
  14727. * @description 查询位置的横坐标。
  14728. */
  14729. this.x = null;
  14730. /**
  14731. * @member {number} SuperMap.GeoDecodingParameter.prototype.y
  14732. * @description 查询位置的纵坐标。
  14733. */
  14734. this.y = null;
  14735. /**
  14736. * @member {number} [SuperMap.GeoDecodingParameter.prototype.fromIndex]
  14737. * @description 设置返回对象的起始索引值。
  14738. */
  14739. this.fromIndex = null;
  14740. /**
  14741. * @member {number} [SuperMap.GeoDecodingParameter.prototype.toIndex]
  14742. * @description 设置返回对象的结束索引值。
  14743. */
  14744. this.toIndex = null;
  14745. /**
  14746. * @member {Array.<string>} [SuperMap.GeoDecodingParameter.prototype.filters]
  14747. * @description 过滤字段,限定查询区域。
  14748. */
  14749. this.filters = null;
  14750. /**
  14751. * @member {string} [SuperMap.GeoDecodingParameter.prototype.prjCoordSys]
  14752. * @description 查询结果的坐标系。
  14753. */
  14754. this.prjCoordSys = null;
  14755. /**
  14756. * @member {number} [SuperMap.GeoDecodingParameter.prototype.maxReturn]
  14757. * @description 最大返回结果数。
  14758. */
  14759. this.maxReturn = null;
  14760. /**
  14761. * @member {number} SuperMap.GeoDecodingParameter.prototype.geoDecodingRadius
  14762. * @description 查询半径。
  14763. */
  14764. this.geoDecodingRadius = null;
  14765. Util.extend(this, options);
  14766. }
  14767. /**
  14768. * @function SuperMap.GeoDecodingParameter.prototype.destroy
  14769. * @description 释放资源,将引用资源的属性置空。
  14770. */
  14771. destroy() {
  14772. this.x = null;
  14773. this.y = null;
  14774. this.fromIndex = null;
  14775. this.toIndex = null;
  14776. this.filters = null;
  14777. this.prjCoordSys = null;
  14778. this.maxReturn = null;
  14779. this.geoDecodingRadius = null;
  14780. }
  14781. }
  14782. SuperMap.GeoDecodingParameter = GeoDecodingParameter;
  14783. ;// CONCATENATED MODULE: ./src/common/iServer/AddressMatchService.js
  14784. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14785. * This program are made available under the terms of the Apache License, Version 2.0
  14786. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14787. /**
  14788. * @class SuperMap.AddressMatchService
  14789. * @category iServer AddressMatch
  14790. * @classdesc 地址匹配服务,包括正向匹配和反向匹配。
  14791. * @param {string} url - 地址匹配服务地址。
  14792. * @param {Object} options - 参数。
  14793. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  14794. * @param {Object} [options.headers] - 请求头。
  14795. */
  14796. class AddressMatchService extends CommonServiceBase {
  14797. constructor(url, options) {
  14798. super(url, options);
  14799. this.options = options || {};
  14800. this.CLASS_NAME = 'SuperMap.AddressMatchService';
  14801. }
  14802. /**
  14803. * @function SuperMap.AddressMatchService.prototype.destroy
  14804. * @override
  14805. */
  14806. destroy() {
  14807. super.destroy();
  14808. }
  14809. /**
  14810. * @function SuperMap.AddressMatchService.prototype.code
  14811. * @param {string} url - 正向地址匹配服务地址。
  14812. * @param {SuperMap.GeoCodingParameter} params - 正向地址匹配服务参数。
  14813. */
  14814. code(url, params) {
  14815. if (!(params instanceof GeoCodingParameter)) {
  14816. return;
  14817. }
  14818. this.processAsync(url, params);
  14819. }
  14820. /**
  14821. * @function SuperMap.AddressMatchService.prototype.decode
  14822. * @param {string} url - 反向地址匹配服务地址。
  14823. * @param {SuperMap.GeoDecodingParameter} params - 反向地址匹配服务参数。
  14824. */
  14825. decode(url, params) {
  14826. if (!(params instanceof GeoDecodingParameter)) {
  14827. return;
  14828. }
  14829. this.processAsync(url, params);
  14830. }
  14831. /**
  14832. * @function SuperMap.AddressMatchService.prototype.processAsync
  14833. * @description 负责将客户端的动态分段服务参数传递到服务端。
  14834. * @param {string} url - 服务地址。
  14835. * @param {Object} params - 参数。
  14836. */
  14837. processAsync(url, params) {
  14838. this.request({
  14839. method: 'GET',
  14840. url,
  14841. params,
  14842. scope: this,
  14843. success: this.serviceProcessCompleted,
  14844. failure: this.serviceProcessFailed
  14845. });
  14846. }
  14847. /**
  14848. * @function SuperMap.AddressMatchService.prototype.serviceProcessCompleted
  14849. * @param {Object} result - 服务器返回的结果对象。
  14850. * @description 服务流程是否完成
  14851. */
  14852. serviceProcessCompleted(result) {
  14853. if (result.succeed) {
  14854. delete result.succeed;
  14855. }
  14856. super.serviceProcessCompleted(result);
  14857. }
  14858. /**
  14859. * @function SuperMap.AddressMatchService.prototype.serviceProcessCompleted
  14860. * @param {Object} result - 服务器返回的结果对象。
  14861. * @description 服务流程是否失败
  14862. */
  14863. serviceProcessFailed(result) {
  14864. super.serviceProcessFailed(result);
  14865. }
  14866. }
  14867. SuperMap.AddressMatchService = AddressMatchService;
  14868. ;// CONCATENATED MODULE: ./src/common/iServer/AggQueryBuilderParameter.js
  14869. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14870. * This program are made available under the terms of the Apache License, Version 2.0
  14871. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14872. /**
  14873. * @class SuperMap.AggQueryBuilderParameter
  14874. * @classdesc 聚合查询 QueryBuilder 参数基类,该参数仅支持数据来源 Elasticsearch 服务的数据服务。
  14875. * @category iServer Data FeatureResults
  14876. * @param {Object} option - 初始化参数。
  14877. * @param {string} option.name - 查询结果名称。
  14878. * @param {SuperMap.AggregationQueryBuilderType} option.queryType - 查询类型。
  14879. */
  14880. class AggQueryBuilderParameter {
  14881. constructor(option) {
  14882. /**
  14883. * @member {string} SuperMap.AggQueryBuilderParameter.prototype.name
  14884. * @description 查询结果名称。
  14885. */
  14886. this.name = null;
  14887. /**
  14888. * @member {SuperMap.AggregationQueryBuilderType} SuperMap.AggQueryBuilderParameter.prototype.queryType
  14889. * @description 查询类型。
  14890. */
  14891. this.queryType = null;
  14892. this.CLASS_NAME = "SuperMap.AggQueryBuilderParameter";
  14893. Util.extend(this, option);
  14894. }
  14895. destroy() {
  14896. var me = this;
  14897. me.name = null;
  14898. me.queryType = null;
  14899. }
  14900. }
  14901. SuperMap.AggQueryBuilderParameter = AggQueryBuilderParameter;
  14902. ;// CONCATENATED MODULE: ./src/common/iServer/AggregationParameter.js
  14903. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14904. * This program are made available under the terms of the Apache License, Version 2.0
  14905. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14906. /**
  14907. * @class SuperMap.AggregationParameter
  14908. * @classdesc 聚合查询参数设置,该参数仅支持数据来源 Elasticsearch 服务的数据服务。
  14909. * @category iServer Data FeatureResults
  14910. * @param {Object} options - 初始化参数。
  14911. * @param {string} options.aggName - 聚合名称。
  14912. * @param {SuperMap.AggregationType} options.aggType - 聚合类型设置。
  14913. * @param {string} options.aggFieldName - 聚合字段。
  14914. * @param {SuperMap.AggregationParameter} options.subAgg - 子聚合类。
  14915. *
  14916. */
  14917. class AggregationParameter {
  14918. constructor(options) {
  14919. /**
  14920. * @member {string} SuperMap.AggregationParameter.prototype.aggName
  14921. * @description 聚合名称。
  14922. */
  14923. this.aggName = null;
  14924. /**
  14925. * @member {SuperMap.AggregationType} SuperMap.AggregationParameter.prototype.aggType
  14926. * @description 聚合类型设置类。
  14927. */
  14928. this.aggType = null;
  14929. /**
  14930. * @member {string} SuperMap.AggregationParameter.prototype.aggFieldName
  14931. * @description 聚合字段。
  14932. */
  14933. this.aggFieldName = null;
  14934. /**
  14935. * @member {SuperMap.AggregationParameter} SuperMap.AggregationParameter.prototype.subAgg
  14936. * @description 子聚合。
  14937. */
  14938. this.subAgg = null;
  14939. this.CLASS_NAME = "SuperMap.AggregationParameter";
  14940. Util.extend(this, options);
  14941. }
  14942. destroy() {
  14943. var me = this;
  14944. me.aggName = null;
  14945. me.aggFieldName = null;
  14946. me.aggType = null;
  14947. if (me.subAgg) {
  14948. me.subAgg = null;
  14949. }
  14950. }
  14951. }
  14952. SuperMap.AggregationParameter = AggregationParameter;
  14953. ;// CONCATENATED MODULE: ./src/common/iServer/AreaSolarRadiationParameters.js
  14954. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14955. * This program are made available under the terms of the Apache License, Version 2.0
  14956. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14957. /**
  14958. * @class SuperMap.AreaSolarRadiationParameters
  14959. * @category iServer SpatialAnalyst SolarRadiationAnalyst
  14960. * @classdesc 地区太阳辐射参数类。
  14961. * @param {Object} options - 参数。
  14962. * @param {string} options.dataset - 要用来做地区太阳辐射数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"的形式来表示,例如:JingjinTerrain@Jingjin。
  14963. * @param {string} options.targetDatasourceName - 指定的存储结果数据集的数据源名称, 例如:"Jingjin"。
  14964. * @param {string} options.totalGridName - 指定地区太阳辐射总辐射量数据集的名称。
  14965. * @param {string} options.diffuseDatasetGridName - 指定地区太阳辐射散射辐射量数据集的名称。
  14966. * @param {string} options.durationDatasetGridName - 指定地区太阳辐射太阳直射持续时间数据集的名称。
  14967. * @param {string} options.directDatasetGridName - 指定地区太阳辐射直射辐射量数据集的名称。
  14968. * @param {number} options.latitude - 待计算区域的纬度值。
  14969. * @param {string} [options.timeMode = 'MULTIDAYS'] - 时间模式。可选值"WITHINDAY"(单日)或"MULTIDAYS"(多日)。
  14970. * @param {number} options.dayStart - 起始日期(年内的第几天)。
  14971. * @param {number} options.dayEnd - 结束日期(年内的第几天)。
  14972. * @param {number} [options.hourStart] - 起始时间(一天中的第几个小时)。
  14973. * @param {number} [options.hourEnd] - 结束时间(一天中的第几个小时)。
  14974. * @param {number} [options.transmittance] - 太阳辐射穿过大气的透射率。
  14975. * @param {number} [options.hourInterval=0.5] - 计算时的小时间隔(设置的越小计算量越大并且计算结果更精确,如果修改此参数,必须使用整数)。
  14976. * @param {number} [options.dayInterval=5] - 计算时的天数间隔(设置的越小计算量越大并且计算结果更精确,必须使用整数)。
  14977. * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  14978. */
  14979. class AreaSolarRadiationParameters {
  14980. constructor(options) {
  14981. /**
  14982. * @member {string} SuperMap.AreaSolarRadiationParameters.prototype.dataset
  14983. * @description 要用来做地区太阳辐射数据源中数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示,例如:JingjinTerrain@Jingjin。注:地区太阳辐射数据必须为栅格数据集。
  14984. */
  14985. this.dataset = null;
  14986. /**
  14987. * @member {string} SuperMap.AreaSolarRadiationParameters.prototype.targetDatasourceName
  14988. * @description 指定的存储结果数据集的数据源名称,例如:"Jingjin"。
  14989. */
  14990. this.targetDatasourceName = null;
  14991. /**
  14992. * @member {string} SuperMap.AreaSolarRadiationParameters.prototype.totalGridName
  14993. * @description 指定地区太阳辐射总辐射量数据集的名称。
  14994. */
  14995. this.totalGridName = null;
  14996. /**
  14997. * @member {string} SuperMap.AreaSolarRadiationParameters.prototype.diffuseDatasetGridName
  14998. * @description 指定地区太阳辐射散射辐射量数据集的名称。
  14999. */
  15000. this.diffuseDatasetGridName = null;
  15001. /**
  15002. * @member {string} SuperMap.AreaSolarRadiationParameters.prototype.durationDatasetGridName
  15003. * @description 指定地区太阳辐射太阳直射持续时间数据集的名称。
  15004. */
  15005. this.durationDatasetGridName = null;
  15006. /**
  15007. * @member {string} SuperMap.AreaSolarRadiationParameters.prototype.durationDatasetGridName
  15008. * @description 指定地区太阳辐射直射辐射量数据集的名称。
  15009. */
  15010. this.directDatasetGridName = null;
  15011. /**
  15012. * @member {number} SuperMap.AreaSolarRadiationParameters.prototype.latitude
  15013. * @description 待计算区域的纬度值。
  15014. */
  15015. this.latitude = null;
  15016. /**
  15017. * @member {string} [SuperMap.AreaSolarRadiationParameters.prototype.timeMode='MULTIDAYS']
  15018. * @description 时间模式。可选值"WITHINDAY"(单日)或"MULTIDAYS"(多日)。
  15019. */
  15020. this.timeMode = "MULTIDAYS";
  15021. /**
  15022. * @member {number} SuperMap.AreaSolarRadiationParameters.prototype.dayStart
  15023. * @description 起始日期(年内的第几天)。
  15024. */
  15025. this.dayStart = null;
  15026. /**
  15027. * @member {number} SuperMap.AreaSolarRadiationParameters.prototype.dayEnd
  15028. * @description 结束日期(年内的第几天)。
  15029. */
  15030. this.dayEnd = null;
  15031. /**
  15032. * @member {number} [SuperMap.AreaSolarRadiationParameters.prototype.hourStart]
  15033. * @description 起始时间(一天中的第几个小时)。
  15034. */
  15035. this.hourStart = null;
  15036. /**
  15037. * @member {number} [SuperMap.AreaSolarRadiationParameters.prototype.hourEnd]
  15038. * @description 结束时间(一天中的第几个小时)。
  15039. */
  15040. this.hourEnd = null;
  15041. /**
  15042. * @member {number} [SuperMap.AreaSolarRadiationParameters.prototype.transmittance]
  15043. * @description 太阳辐射穿过大气的透射率。
  15044. */
  15045. this.transmittance = null;
  15046. /**
  15047. * @member {number} [SuperMap.AreaSolarRadiationParameters.prototype.hourInterval=0.5]
  15048. * @description 计算时的小时间隔(设置的越小计算量越大并且计算结果更精确, 如果修改此参数,必须使用整数)
  15049. */
  15050. this.hourInterval = null;
  15051. /**
  15052. * @member {number} [SuperMap.AreaSolarRadiationParameters.prototype.dayInterval=5]
  15053. * @description 计算时的天数间隔(设置的越小计算量越大并且计算结果更精确, 必须使用整数)
  15054. */
  15055. this.dayInterval = null;
  15056. /**
  15057. * @member {boolean} [SuperMap.AreaSolarRadiationParameters.prototype.deleteExistResultDataset=false]
  15058. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  15059. */
  15060. this.deleteExistResultDataset = false;
  15061. Util.extend(this, options);
  15062. this.CLASS_NAME = "SuperMap.AreaSolarRadiationParameters";
  15063. }
  15064. /**
  15065. * @function SuperMap.AreaSolarRadiationParameters.prototype.destroy
  15066. * @description 释放资源,将引用资源的属性置空。
  15067. */
  15068. destroy() {
  15069. var me = this;
  15070. me.dataset = null;
  15071. me.zFactor = 1.0;
  15072. me.averageCurvatureName = null;
  15073. me.profileCurvatureName = null;
  15074. me.planCurvatureName = null;
  15075. me.deleteExistResultDataset = true;
  15076. }
  15077. /**
  15078. * @function SuperMap.AreaSolarRadiationParameters.toObject
  15079. * @param {SuperMap.AreaSolarRadiationParameters} param - 地区太阳辐射参数类。
  15080. * @param {SuperMap.AreaSolarRadiationParameters} tempObj - 地区太阳辐射参数对象。
  15081. * @returns {Object} JSON对象。
  15082. * @description 将SuperMap.AreaSolarRadiationParameters对象转换成JSON对象。
  15083. */
  15084. static toObject(param, tempObj) {
  15085. var parameter = {};
  15086. for (var name in param) {
  15087. if (name !== "dataset") {
  15088. var name1 = (name === "latitude" || name === "timeMode" || name === "dayStart");
  15089. var name2 = (name === "dayEnd" || name === "hourStart" || name === "hourEnd");
  15090. var name3 = (name === "transmittance" || name === "hourInterval" || name === "dayInterval");
  15091. if (name1 || name2 || name3) {
  15092. parameter[name] = param[name];
  15093. } else {
  15094. tempObj[name] = param[name];
  15095. }
  15096. }
  15097. }
  15098. tempObj["parameter"] = parameter;
  15099. }
  15100. }
  15101. SuperMap.AreaSolarRadiationParameters = AreaSolarRadiationParameters;
  15102. ;// CONCATENATED MODULE: ./src/common/iServer/SpatialAnalystBase.js
  15103. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15104. * This program are made available under the terms of the Apache License, Version 2.0
  15105. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15106. /**
  15107. * @class SuperMap.SpatialAnalystBase
  15108. * @category iServer SpatialAnalyst
  15109. * @classdesc 空间分析服务基类。
  15110. * @param {string} url - 地址。
  15111. * @param {Object} options - 参数。
  15112. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  15113. * @param {Object} [options.headers] - 请求头。
  15114. * @extends {SuperMap.CommonServiceBase}
  15115. */
  15116. class SpatialAnalystBase extends CommonServiceBase {
  15117. constructor(url, options) {
  15118. super(url, options);
  15119. /**
  15120. * @member {SuperMap.DataFormat} [SuperMap.SpatialAnalystBase.prototype.format=SuperMap.DataFormat.GEOJSON]
  15121. * @description 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式,参数格式为 "ISERVER","GEOJSON"。
  15122. */
  15123. this.format = DataFormat.GEOJSON;
  15124. this.CLASS_NAME = "SuperMap.SpatialAnalystBase";
  15125. }
  15126. /**
  15127. * @function SuperMap.SpatialAnalystBase.prototype.destroy
  15128. * @override
  15129. */
  15130. destroy() {
  15131. super.destroy();
  15132. this.format = null;
  15133. }
  15134. /**
  15135. * @function SuperMap.SpatialAnalystBase.prototype.serviceProcessCompleted
  15136. * @description 分析完成,执行此方法。
  15137. * @param {Object} result - 服务器返回的结果对象。
  15138. */
  15139. serviceProcessCompleted(result) {
  15140. var me = this, analystResult;
  15141. result = Util.transformResult(result);
  15142. if (result && me.format === DataFormat.GEOJSON && typeof me.toGeoJSONResult === 'function') {
  15143. //批量分析时会返回多个结果
  15144. if (Util.isArray(result)) {
  15145. for (var i = 0; i < result.length; i++) {
  15146. result[i] = me.toGeoJSONResult(result[i])
  15147. }
  15148. analystResult = result;
  15149. } else {
  15150. analystResult = me.toGeoJSONResult(result);
  15151. }
  15152. }
  15153. if (!analystResult) {
  15154. analystResult = result;
  15155. }
  15156. me.events.triggerEvent("processCompleted", {result: analystResult});
  15157. }
  15158. /**
  15159. * @function SuperMap.SpatialAnalystBase.prototype.toGeoJSONResult
  15160. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  15161. * @param {Object} result - 服务器返回的结果对象。
  15162. *
  15163. */
  15164. toGeoJSONResult(result) {
  15165. if (!result) {
  15166. return null;
  15167. }
  15168. //批量叠加分析时结果这样处理
  15169. if (result.result && result.result.resultGeometry) {
  15170. result = result.result
  15171. }
  15172. var geoJSONFormat = new GeoJSON();
  15173. if (result.recordsets) {
  15174. for (var i = 0, recordsets = result.recordsets, len = recordsets.length; i < len; i++) {
  15175. if (recordsets[i].features) {
  15176. recordsets[i].features = geoJSONFormat.toGeoJSON(recordsets[i].features);
  15177. }
  15178. }
  15179. } else if (result.recordset && result.recordset.features) {
  15180. result.recordset.features =geoJSONFormat.toGeoJSON(result.recordset.features);
  15181. }
  15182. if (result.resultGeometry) {
  15183. result.resultGeometry = geoJSONFormat.toGeoJSON(result.resultGeometry);
  15184. }
  15185. if (result.regions) {
  15186. result.regions = geoJSONFormat.toGeoJSON(result.regions);
  15187. }
  15188. return result;
  15189. }
  15190. }
  15191. SuperMap.SpatialAnalystBase = SpatialAnalystBase;
  15192. ;// CONCATENATED MODULE: ./src/common/iServer/AreaSolarRadiationService.js
  15193. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15194. * This program are made available under the terms of the Apache License, Version 2.0
  15195. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15196. /**
  15197. * @class SuperMap.AreaSolarRadiationService
  15198. * @category iServer SpatialAnalyst SolarRadiationAnalyst
  15199. * @classdesc 地区太阳辐射服务类。
  15200. * @param {string} url - 服务的访问地址。如:</br>http://localhost:8090/iserver/services/spatialanalyst-sample/restjsr/spatialanalyst。</br>
  15201. * @param {Object} options - 参数。</br>
  15202. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  15203. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  15204. * @param {Object} [options.headers] - 请求头。
  15205. * @extends {SuperMap.SpatialAnalystBase}
  15206. * @example 例如:
  15207. * (start code)
  15208. * var myAreaSolarRadiationService = new SuperMap.AreaSolarRadiationService(url);
  15209. * myAreaSolarRadiationService.on({
  15210. * "processCompleted": processCompleted,
  15211. * "processFailed": processFailed
  15212. * }
  15213. * );
  15214. * (end)
  15215. *
  15216. */
  15217. class AreaSolarRadiationService extends SpatialAnalystBase {
  15218. constructor(url, options) {
  15219. super(url, options);
  15220. this.CLASS_NAME = "SuperMap.AreaSolarRadiationService";
  15221. }
  15222. /**
  15223. * @function SuperMap.AreaSolarRadiationService.prototype.destroy
  15224. * @override
  15225. */
  15226. destroy() {
  15227. super.destroy();
  15228. }
  15229. /**
  15230. * @function SuperMap.AreaSolarRadiationService.prototype.processAsync
  15231. * @description 负责将客户端的查询参数传递到服务端。
  15232. * @param {SuperMap.AreaSolarRadiationParameters} parameter - 地区太阳辐射参数。
  15233. */
  15234. processAsync(parameter) {
  15235. if (!(parameter instanceof AreaSolarRadiationParameters)) {
  15236. return;
  15237. }
  15238. var me = this;
  15239. var parameterObject = {};
  15240. if (parameter instanceof AreaSolarRadiationParameters) {
  15241. me.url = Util.urlPathAppend(me.url, `datasets/${parameter.dataset}/solarradiation`);
  15242. }
  15243. me.url = Util.urlAppend(me.url, 'returnContent=true');
  15244. AreaSolarRadiationParameters.toObject(parameter, parameterObject);
  15245. var jsonParameters = Util.toJSON(parameterObject);
  15246. me.request({
  15247. method: 'POST',
  15248. data: jsonParameters,
  15249. scope: me,
  15250. success: me.serviceProcessCompleted,
  15251. failure: me.serviceProcessFailed
  15252. });
  15253. }
  15254. }
  15255. SuperMap.AreaSolarRadiationService = AreaSolarRadiationService;
  15256. ;// CONCATENATED MODULE: ./src/common/iServer/BufferDistance.js
  15257. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15258. * This program are made available under the terms of the Apache License, Version 2.0
  15259. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15260. /**
  15261. * @class SuperMap.BufferDistance
  15262. * @category iServer SpatialAnalyst BufferAnalyst
  15263. * @classdesc 缓冲区分析的缓冲距离类。通过该类可以设置缓冲区分析的缓冲距离,距离可以是数值也可以是数值型的字段表达式。
  15264. * @param {Object} options - 参数。
  15265. * @param {string} [options.exp] - 以数值型的字段表达式作为缓冲区分析的距离值。
  15266. * @param {number} [options.value=100] - 以数值作为缓冲区分析的距离值。单位:米。
  15267. */
  15268. class BufferDistance {
  15269. constructor(options) {
  15270. /**
  15271. * @member {string} [SuperMap.BufferDistance.prototype.exp]
  15272. * @description 以数值型的字段表达式作为缓冲区分析的距离值。
  15273. */
  15274. this.exp = null;
  15275. /**
  15276. * @member {number} [SuperMap.BufferDistance.prototype.value=100]
  15277. * @description 以数值作为缓冲区分析的距离值。单位:米。
  15278. */
  15279. this.value = 100;
  15280. Util.extend(this, options);
  15281. this.CLASS_NAME = "SuperMap.BufferDistance";
  15282. }
  15283. /**
  15284. * @function SuperMap.BufferDistance.prototype.destroy
  15285. * @description 释放资源,将引用资源的属性置空。
  15286. */
  15287. destroy() {
  15288. this.exp = null;
  15289. this.value = null;
  15290. }
  15291. }
  15292. SuperMap.BufferDistance = BufferDistance;
  15293. ;// CONCATENATED MODULE: ./src/common/iServer/BufferSetting.js
  15294. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15295. * This program are made available under the terms of the Apache License, Version 2.0
  15296. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15297. /**
  15298. * @class SuperMap.BufferSetting
  15299. * @category iServer SpatialAnalyst BufferAnalyst
  15300. * @classdesc 缓冲区分析通用设置类。
  15301. * @param {Object} options - 参数。
  15302. * @param {SuperMap.BufferEndType} [options.endType=SuperMap.BufferEndType.FLAT] - 缓冲区端点枚举值。
  15303. * @param {SuperMap.BufferDistance} [options.leftDistance=100] - 左侧缓冲距离。
  15304. * @param {SuperMap.BufferDistance} [options.rightDistance=100] - 右侧缓冲距离。
  15305. * @param {number} [options.semicircleLineSegment=4] - 圆头缓冲圆弧处线段的个数。
  15306. * @param {SuperMap.BufferRadiusUnit} [options.radiusUnit=SuperMap.BufferRadiusUnit.METER] - 缓冲半径单位。
  15307. */
  15308. class BufferSetting {
  15309. constructor(options) {
  15310. /**
  15311. * @member {SuperMap.BufferEndType} [SuperMap.BufferSetting.prototype.endType = SuperMap.BufferEndType.FLAT]
  15312. * @description 缓冲区端点枚举值。分为平头和圆头两种。
  15313. */
  15314. this.endType = BufferEndType.FLAT;
  15315. /**
  15316. * @member {SuperMap.BufferDistance} [SuperMap.BufferSetting.prototype.leftDistance=100]
  15317. * @description 左侧缓冲距离。
  15318. * 当为 GeometryBufferAnalyst 时,单位为默认地图的投影系的单位(如3857为米,4326为度),
  15319. * 当为 DatasetBufferAnalyst 时,单位通过{@link BufferSetting.radiusUnit}设置(默认全部为米)。
  15320. */
  15321. this.leftDistance = new BufferDistance();
  15322. /**
  15323. * @member {SuperMap.BufferDistance} [SuperMap.BufferSetting.prototype.rightDistance=100]
  15324. * @description 右侧缓冲距离。
  15325. * 当为 GeometryBufferAnalyst 时,单位为默认地图的投影系的单位(如3857为米,4326为度),
  15326. * 当为 DatasetBufferAnalyst 时,单位通过{@link BufferSetting.radiusUnit}设置(默认全部为米)。
  15327. */
  15328. this.rightDistance = new BufferDistance();
  15329. /**
  15330. * @member {number} [SuperMap.BufferSetting.prototype.semicircleLineSegment=4]
  15331. * @description 圆头缓冲圆弧处线段的个数。即用多少个线段来模拟一个半圆。
  15332. */
  15333. this.semicircleLineSegment = 4;
  15334. /**
  15335. * @member {SuperMap.BufferRadiusUnit} [SuperMap.BufferSetting.prototype.radiusUnit = SuperMap.BufferRadiusUnit.METER]
  15336. * @description 缓冲半径单位,可以是{@link SuperMap.BufferRadiusUnit.METER}、{@link SuperMap.BufferRadiusUnit.MILIMETER}、
  15337. * {@link SuperMap.BufferRadiusUnit.CENTIMETER}、{@link SuperMap.BufferRadiusUnit.DECIMETER}、{@link SuperMap.BufferRadiusUnit.KILOMETER}、
  15338. * {@link SuperMap.BufferRadiusUnit.FOOT}、{@link SuperMap.BufferRadiusUnit.INCH}、{@link SuperMap.BufferRadiusUnit.MILE}、{@link SuperMap.BufferRadiusUnit.YARD}。
  15339. * 仅对BufferAnalyst有效。
  15340. */
  15341. this.radiusUnit = BufferRadiusUnit.METER;
  15342. if (options) {
  15343. Util.extend(this, options);
  15344. }
  15345. this.CLASS_NAME = "SuperMap.BufferSetting";
  15346. }
  15347. /**
  15348. * @function SuperMap.BufferSetting.prototype.destroy
  15349. * @description 释放资源,将引用资源的属性置空。
  15350. */
  15351. destroy() {
  15352. let me = this;
  15353. me.endType = null;
  15354. if (me.leftDistance) {
  15355. me.leftDistance.destroy();
  15356. me.leftDistance = null;
  15357. }
  15358. if (me.rightDistance) {
  15359. me.rightDistance.destroy();
  15360. me.rightDistance = null;
  15361. }
  15362. me.semicircleLineSegment = null;
  15363. me.radiusUnit = null;
  15364. }
  15365. }
  15366. SuperMap.BufferSetting = BufferSetting;
  15367. ;// CONCATENATED MODULE: ./src/common/iServer/BufferAnalystParameters.js
  15368. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15369. * This program are made available under the terms of the Apache License, Version 2.0
  15370. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15371. /**
  15372. * @class SuperMap.BufferAnalystParameters
  15373. * @category iServer SpatialAnalyst BufferAnalyst
  15374. * @classdesc 缓冲区分析参数基类。
  15375. * @param {Object} options - 参数。
  15376. * @param {SuperMap.BufferSetting} [options.bufferSetting] - 设置缓冲区通用参数。为缓冲区分析提供必要的参数信息,包括左缓冲距离、右缓冲距离、端点类型、圆头缓冲圆弧处线段的个数信息。
  15377. */
  15378. class BufferAnalystParameters {
  15379. constructor(options) {
  15380. var me = this;
  15381. /**
  15382. * @member {SuperMap.BufferSetting} [SuperMap.BufferAnalystParameters.prototype.bufferSetting]
  15383. * @description 设置缓冲区通用参数。为缓冲区分析提供必要的参数信息,包括左缓冲距离、右缓冲距离、端点类型、圆头缓冲圆弧处线段的个数信息。
  15384. */
  15385. me.bufferSetting = new BufferSetting();
  15386. Util.extend(this, options);
  15387. this.CLASS_NAME = "SuperMap.BufferAnalystParameters";
  15388. }
  15389. /**
  15390. * @function SuperMap.BufferAnalystParameters.prototype.destroy
  15391. * @description 释放资源,将引用资源的属性置空。
  15392. */
  15393. destroy() {
  15394. var me = this;
  15395. if (me.bufferSetting) {
  15396. me.bufferSetting.destroy();
  15397. me.bufferSetting = null;
  15398. }
  15399. }
  15400. }
  15401. SuperMap.BufferAnalystParameters = BufferAnalystParameters;
  15402. ;// CONCATENATED MODULE: ./src/common/iServer/DataReturnOption.js
  15403. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15404. * This program are made available under the terms of the Apache License, Version 2.0
  15405. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15406. /**
  15407. * @class SuperMap.DataReturnOption
  15408. * @category iServer SpatialAnalyst
  15409. * @classdesc 数据返回设置类。
  15410. * @param {Object} options - 参数。
  15411. * @param {number} [options.expectCount=1000] - 设置返回的最大记录数,小于或者等于 0 时表示返回所有记录数。
  15412. * @param {string} [options.dataset] - 设置结果数据集标识,当 dataReturnMode 为 {@link SuperMap.DataReturnMode.DATASET_ONLY}或{@link SuperMap.DataReturnMode.DATASET_AND_RECORDSET}时有效,
  15413. * 作为返回数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示。
  15414. * @param {SuperMap.DataReturnMode} [options.dataReturnMode=SuperMap.DataReturnMode.RECORDSET_ONLY] - 数据返回模式。
  15415. * @param {boolean} [options.deleteExistResultDataset=true] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  15416. */
  15417. class DataReturnOption {
  15418. constructor(options) {
  15419. /**
  15420. * @member {number} [SuperMap.DataReturnOption.prototype.expectCount=1000]
  15421. * @description 设置返回的最大记录数,小于或者等于0时表示返回所有记录数。
  15422. */
  15423. this.expectCount = 1000;
  15424. /**
  15425. * @member {string} [SuperMap.DataReturnOption.prototype.dataset]
  15426. * @description 设置结果数据集标识,当dataReturnMode为 {@link SuperMap.DataReturnMode.DATASET_ONLY}
  15427. * 或{@link SuperMap.DataReturnMode.DATASET_AND_RECORDSET}时有效,
  15428. * 作为返回数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示。
  15429. */
  15430. this.dataset = null;
  15431. /**
  15432. * @member {SuperMap.DataReturnMode} [SuperMap.DataReturnOption.prototype.dataReturnMode=SuperMap.DataReturnMode.RECORDSET_ONLY]
  15433. * @description 数据返回模式。
  15434. */
  15435. this.dataReturnMode = DataReturnMode.RECORDSET_ONLY;
  15436. /**
  15437. * @member {boolean} [SuperMap.DataReturnOption.prototype.deleteExistResultDataset=true]
  15438. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  15439. */
  15440. this.deleteExistResultDataset = true;
  15441. Util.extend(this, options);
  15442. this.CLASS_NAME = "SuperMap.DataReturnOption";
  15443. }
  15444. /**
  15445. * @function SuperMap.DataReturnOption.prototype.destroy
  15446. * @description 释放资源,将引用资源的属性置空。
  15447. */
  15448. destroy() {
  15449. var me = this;
  15450. me.expectCount = null;
  15451. me.dataset = null;
  15452. me.dataReturnMode = null;
  15453. me.deleteExistResultDataset = null;
  15454. }
  15455. }
  15456. SuperMap.DataReturnOption = DataReturnOption;
  15457. ;// CONCATENATED MODULE: ./src/common/iServer/JoinItem.js
  15458. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15459. * This program are made available under the terms of the Apache License, Version 2.0
  15460. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15461. /**
  15462. * @class SuperMap.JoinItem
  15463. * @category iServer
  15464. * @classdesc 连接信息类。
  15465. * 该类用于矢量数据集与外部表的连接。外部表可以为另一个矢量数据集(其中纯属性数据集中没有空间几何信息)所对应的 DBMS 表,也可以是用户自建的业务表。
  15466. * 需要注意的是,矢量数据集与外部表必须属于同一数据源。表之间的联系的建立有两种方式,一种是连接(join),一种是关联(link)。
  15467. * 连接,实际上是依据相同的字段将一个外部表追加到指定的表;而关联是基于一个相同的字段定义了两个表格之间的联系,但不是实际的追加。
  15468. * 用于连接两个表的字段的名称不一定相同,但类型必须一致。当两个表格之间建立了连接,通过对主表进行操作,可以对外部表进行查询,制作专题图以及分析等。
  15469. * 当两个表格之间是一对一或多对一的关系时,可以使用 join 连接。当为多对一的关系时,允许指定多个字段之间的关联。
  15470. *(注意:SuperMap.JoinItem 目前支持左连接和内连接,不支持全连接和右连接,UDB 引擎不支持内连接。并且用于建立连接的两个表必须在同一个数据源下。)
  15471. * @param {Object} options - 参数。
  15472. * @param {string} options.foreignTableName - 外部表的名称。
  15473. * @param {string} options.joinFilter - 矢量数据集与外部表之间的连接表达式,即设定两个表之间关联的字段。
  15474. * @param {SuperMap.JoinType} options.joinType - 两个表之间连接类型。
  15475. * @example 下面以 SQL 查询说明 joinItem 的使用方法:
  15476. *(start code)
  15477. * function queryBySQL() {
  15478. * // 设置与外部表的连接信息
  15479. * var joinItem = new SuperMap.JoinItem({
  15480. * foreignTableName: "foreignTable",
  15481. * joinFilter: "foreignTable.CONTINENT = Countries.CONTINENT",
  15482. * joinType: "LEFTJOIN"
  15483. * })
  15484. * var queryParam, queryBySQLParams, queryBySQLService;
  15485. * // 设置查询参数,在查询参数中添加joinItem关联条件信息
  15486. * queryParam = new SuperMap.FilterParameter({
  15487. * name: "Countries@World",
  15488. * joinItems: [joinItem]
  15489. * }),
  15490. * queryBySQLParams = new SuperMap.QueryBySQLParameters({
  15491. * queryParams: [queryParam]
  15492. * }),
  15493. * queryBySQLService = new SuperMap.QueryBySQLService(url, {
  15494. * eventListeners: { "processCompleted": processCompleted, "processFailed": processFailed}
  15495. * });
  15496. * queryBySQLService.processAsync(queryBySQLParams);
  15497. * }
  15498. * function processCompleted(queryEventArgs) {//todo}
  15499. * function processFailed(e) {//todo}
  15500. * (end)
  15501. */
  15502. class JoinItem {
  15503. constructor(options) {
  15504. /**
  15505. * @member {string} SuperMap.JoinItem.prototype.foreignTableName
  15506. * @description 外部表的名称。
  15507. * 如果外部表的名称是以 “表名@数据源名” 命名方式,则该属性只需赋值表名。
  15508. * 例如:外部表 Name@changchun,Name 为表名,changchun 为数据源名称,则该属性的赋值应为:Name。
  15509. */
  15510. this.foreignTableName = null;
  15511. /**
  15512. * @member {string} SuperMap.JoinItem.prototype.joinFilter
  15513. * @description 矢量数据集与外部表之间的连接表达式,即设定两个表之间关联的字段。
  15514. * 例如,将房屋面数据集(Building)的 district 字段与房屋拥有者的纯属性数据集(Owner)的 region 字段相连接,
  15515. * 两个数据集对应的表名称分别为 Table_Building 和 Table_Owner,
  15516. * 则连接表达式为 Table_Building.district = Table_Owner.region。
  15517. * 当有多个字段相连接时,用 AND 将多个表达式相连。
  15518. */
  15519. this.joinFilter = null;
  15520. /**
  15521. * @member {SuperMap.JoinType} SuperMap.JoinItem.prototype.joinType
  15522. * @description 两个表之间连接类型。
  15523. * 连接类型决定了对两个表进行连接查询后返回的记录的情况。
  15524. */
  15525. this.joinType = null;
  15526. if (options) {
  15527. Util.extend(this, options);
  15528. }
  15529. this.CLASS_NAME = "SuperMap.JoinItem";
  15530. }
  15531. /**
  15532. * @function SuperMap.JoinItem.prototype.destroy
  15533. * @description 释放资源,将引用资源的属性置空。
  15534. */
  15535. destroy() {
  15536. var me = this;
  15537. me.foreignTableName = null;
  15538. me.joinFilter = null;
  15539. me.joinType = null;
  15540. }
  15541. /**
  15542. * @function SuperMap.JoinItem.prototype.toServerJSONObject
  15543. * @description 转换成对应的 JSON 格式对象。
  15544. */
  15545. toServerJSONObject() {
  15546. var dataObj = {};
  15547. dataObj = Util.copyAttributes(dataObj, this);
  15548. //joinFilter基本是个纯属性对象,这里不再做转换
  15549. return dataObj;
  15550. }
  15551. }
  15552. SuperMap.JoinItem = JoinItem;
  15553. ;// CONCATENATED MODULE: ./src/common/iServer/DatasourceConnectionInfo.js
  15554. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15555. * This program are made available under the terms of the Apache License, Version 2.0
  15556. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15557. // eslint-disable-line no-unused-vars
  15558. /**
  15559. * @class SuperMap.DatasourceConnectionInfo
  15560. * @category iServer Data
  15561. * @classdesc 数据源连接信息类。该类包括了进行数据源连接的所有信息,如所要连接的服务器名称、数据库名称、用户名以及密码等。
  15562. * 当保存为工作空间时, 工作空间中的数据源的连接信息都将存储到工作空间文件中。对于不同类型的数据源,其连接信息有所区别。
  15563. * 所以在使 用该类所包含的成员时,请注意该成员所适用的数据源类型。对于从数据源对象中返回的数据连接信息对象,只有 connect 方法可以被修改,
  15564. * 其他内容是不可以被修改的。对于用户创建的数据源连接信息对象,其内容都可以修改。
  15565. * @category iServer Data
  15566. * @param {Object} options - 参数。
  15567. * @param {string} options.alias - 数据源别名。
  15568. * @param {string} options.dataBase - 数据源连接的数据库名。
  15569. * @param {boolean} [options.connect] - 数据源是否自动连接数据。
  15570. * @param {string} [options.driver] - 使用 ODBC(Open Database Connectivity,开放数据库互连)的数据库的驱动程序名。
  15571. * @param {SuperMap.EngineType} [options.engineType] - 数据源连接的引擎类型。
  15572. * @param {boolean} [options.exclusive] - 是否以独占方式打开数据源。
  15573. * @param {boolean} [options.OpenLinkTable] - 是否把数据库中的其他非 SuperMap 数据表作为 LinkTable 打开。
  15574. * @param {string} [options.password] - 登录数据源连接的数据库或文件的密码。
  15575. * @param {boolean} [options.readOnly] - 是否以只读方式打开数据源。
  15576. * @param {string} [options.server] - 数据库服务器名或 SDB 文件名。
  15577. * @param {string} [options.user] - 登录数据库的用户名。
  15578. */
  15579. class DatasourceConnectionInfo {
  15580. constructor(options) {
  15581. /**
  15582. * @member {string} SuperMap.DatasourceConnectionInfo.prototype.alias
  15583. * @description 数据源别名。
  15584. */
  15585. this.alias = null;
  15586. /**
  15587. * @member {boolean} [SuperMap.DatasourceConnectionInfo.prototype.connect]
  15588. * @description 数据源是否自动连接数据。
  15589. */
  15590. this.connect = null;
  15591. /**
  15592. * @member {string} SuperMap.DatasourceConnectionInfo.prototype.dataBase
  15593. * @description 数据源连接的数据库名。
  15594. */
  15595. this.dataBase = null;
  15596. /**
  15597. * @member {string} [SuperMap.DatasourceConnectionInfo.prototype.driver]
  15598. * @description 使用 ODBC(Open Database Connectivity,开放数据库互连) 的数据库的驱动程序名。
  15599. * 其中,对于 SQL Server 数据库与 iServer 发布的 WMTS 服务,此为必设参数。
  15600. * 对于 SQL Server 数据库,它使用 ODBC 连接,所设置的驱动程序名为 "SQL Server" 或 "SQL Native Client";
  15601. * 对于 iServer 发布的 WMTS 服务,设置的驱动名称为 "WMTS"。
  15602. */
  15603. this.driver = null;
  15604. /**
  15605. * @member {SuperMap.EngineType} [SuperMap.DatasourceConnectionInfo.prototype.engineType]
  15606. * @description 数据源连接的引擎类型。
  15607. */
  15608. this.engineType = null;
  15609. /**
  15610. * @member {boolean} [SuperMap.DatasourceConnectionInfo.prototype.exclusive]
  15611. * @description 是否以独占方式打开数据源。
  15612. */
  15613. this.exclusive = null;
  15614. /**
  15615. * @member {boolean} [SuperMap.DatasourceConnectionInfo.prototype.OpenLinkTable]
  15616. * @description 是否把数据库中的其他非 SuperMap 数据表作为 LinkTable 打开。
  15617. */
  15618. this.OpenLinkTable = null;
  15619. /**
  15620. * @member {string} [SuperMap.DatasourceConnectionInfo.prototype.password]
  15621. * @description 登录数据源连接的数据库或文件的密码。
  15622. */
  15623. this.password = null;
  15624. /**
  15625. * @member {boolean} [SuperMap.DatasourceConnectionInfo.prototype.readOnly]
  15626. * @description 是否以只读方式打开数据源。
  15627. */
  15628. this.readOnly = null;
  15629. /**
  15630. * @member {string} [SuperMap.DatasourceConnectionInfo.prototype.server]
  15631. * @description 数据库服务器名、文件名或服务地址。
  15632. * 1.对于 SDB 和 UDB 文件,为其文件的绝对路径。注意:当绝对路径的长度超过 UTF-8 编码格式的 260 字节长度,该数据源无法打开。
  15633. * 2.对于 Oracle 数据库,其服务器名为其 TNS 服务名称。
  15634. * 3.对于 SQL Server 数据库,其服务器名为其系统的 DSN(Database Source Name) 名称。
  15635. * 4.对于 PostgreSQL 数据库,其服务器名为 “IP:端口号”,默认的端口号是 5432。
  15636. * 5.对于 DB2 数据库,已经进行了编目,所以不需要进行服务器的设置。
  15637. * 6.对于 Kingbase 数据库,其服务器名为其 IP 地址。
  15638. * 7.对于 GoogleMaps 数据源,其服务器地址,默认设置为 “{@link http://maps.google.com}”,且不可更改。
  15639. * 8.对于 SuperMapCould 数据源,为其服务地址。
  15640. * 9.对于 MAPWORLD 数据源,为其服务地址,默认设置为 “{@link http://www.tianditu.cn}”,且不可更改。
  15641. * 10.对于 OGC 和 REST 数据源,为其服务地址。
  15642. */
  15643. this.server = null;
  15644. /**
  15645. * @member {string} SuperMap.DatasourceConnectionInfo.prototype.user
  15646. * @description 登录数据库的用户名。
  15647. */
  15648. this.user = null;
  15649. if (options) {
  15650. Util.extend(this, options);
  15651. }
  15652. this.CLASS_NAME = "SuperMap.DatasourceConnectionInfo";
  15653. }
  15654. /**
  15655. * @function SuperMap.DatasourceConnectionInfo.prototype.destroy
  15656. * @description 释放资源,将引用资源的属性置空。
  15657. */
  15658. destroy() {
  15659. var me = this;
  15660. me.alias = null;
  15661. me.connect = null;
  15662. me.dataBase = null;
  15663. me.driver = null;
  15664. me.engineType = null;
  15665. me.exclusive = null;
  15666. me.OpenLinkTable = null;
  15667. me.password = null;
  15668. me.readOnly = null;
  15669. me.server = null;
  15670. me.user = null;
  15671. }
  15672. }
  15673. SuperMap.DatasourceConnectionInfo = DatasourceConnectionInfo;
  15674. ;// CONCATENATED MODULE: ./src/common/iServer/LinkItem.js
  15675. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15676. * This program are made available under the terms of the Apache License, Version 2.0
  15677. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15678. /**
  15679. * @class SuperMap.LinkItem
  15680. * @constructs SuperMap.LinkItem
  15681. * @category iServer
  15682. * @classdesc 关联信息类。
  15683. * @description 该类用于矢量数据集与外部表的关联。 外部表是另一个数据集(其中纯属性数据集中没有空间几何信息)中的 DBMS 表,
  15684. * 矢量数据集与外部表可以属于不同的数据源,但数据源类型目前只支持 SQL Server 和 Oracle 类型。使用 LinkItem 时,
  15685. * 空间数据和属性数据必须满足关联条件,即主空间数据集与外部属性表之间存在关联字段。{@link SuperMap.LinkItem}
  15686. * 只支持左连接,UDB、PostgreSQL 和 DB2 数据源不支持 {@link SuperMap.LinkItem};另外,用于建立关联关系的两个表可以不在同一个数据源下。注意:<br>
  15687. * 1. 使用 {@link SuperMap.LinkItem} 的约束条件为:空间数据和属性数据必须有关联条件,即主空间数据集与外部属性表之间存在关联字段;<br>
  15688. * 2. 使用外关联表制作专题图时,所关联的字段必须设置表名,例如,如果所关联的字段为 BaseMap_R 数据集的 SmID,就要写成 BaseMap_R.SMID。
  15689. * @param {Object} options - 参数。
  15690. * @param {SuperMap.DatasourceConnectionInfo} options.datasourceConnectionInfo - 关联的外部数据源信息。
  15691. * @param {Array.<string>} options.foreignKeys - 主空间数据集的外键。
  15692. * @param {string} options.foreignTable - 关联的外部属性表的名称。
  15693. * @param {Array.<string>} options.linkFields - 欲保留的外部属性表的字段。
  15694. * @param {string} options.linkFilter - 与外部属性表的连接条件。
  15695. * @param {string} options.name - 此关联信息对象的名称。
  15696. * @param {Array.<string>} options.primaryKeys - 需要关联的外部属性表的主键。
  15697. * @example 下面以 SQL 查询说明 linkitem 的使用方法:
  15698. * function queryBySQL() {
  15699. * // 设置关联的外部数据库信息,alias表示数据库别名
  15700. * var dc = new SuperMap.DatasourceConnectionInfo({
  15701. * dataBase: "RelQuery",
  15702. * server: "{ip}:{port}",
  15703. * user: "sa",
  15704. * password: "map",
  15705. * driver: "SQL Server",
  15706. * connect: true,
  15707. * OpenLinkTable: false,
  15708. * alias: "RelQuery",
  15709. * engineType: EngineType.SQLPLUS,
  15710. * readOnly: false,
  15711. * exclusive: false
  15712. * });
  15713. * // 设置关联信息
  15714. * var linkItem = new SuperMap.LinkItem({
  15715. * datasourceConnectionInfo: dc,
  15716. * foreignKeys: ["name"],
  15717. * foreignTable: "Pop_2011",
  15718. * linkFields: ["SmID as Pid","pop"],
  15719. * name: "link",
  15720. * primatryKeys: ["name"],
  15721. * });
  15722. * // 设置查询参数,在查询参数中添加linkItem关联条件信息
  15723. * var queryParam, queryBySQLParams, queryBySQLService;
  15724. * queryParam = new SuperMap.FilterParameter({
  15725. * name: "Province@RelQuery",
  15726. * fields: ["SmID","name"],
  15727. * attributeFilter: "SmID<7",
  15728. * linkItems: [linkItem]
  15729. * }),
  15730. * queryBySQLParams = new SuperMap.QueryBySQLParameters({
  15731. * queryParams: [queryParam]
  15732. * }),
  15733. * queryBySQLService = new SuperMap.QueryBySQLService(url, {
  15734. * eventListeners: {
  15735. * "processCompleted": processCompleted,
  15736. * "processFailed": processFailed
  15737. * }
  15738. * });
  15739. * queryBySQLService.processAsync(queryBySQLParams);
  15740. * }
  15741. * function processCompleted(queryEventArgs) {//todo}
  15742. * function processFailed(e) {//todo}
  15743. *
  15744. */
  15745. class LinkItem {
  15746. constructor(options) {
  15747. /**
  15748. * @member {SuperMap.DatasourceConnectionInfo} SuperMap.LinkItem.prototype.datasourceConnectionInfo
  15749. * @description 关联的外部数据源信息。
  15750. */
  15751. this.datasourceConnectionInfo = null;
  15752. /**
  15753. * @member {Array.<string>} SuperMap.LinkItem.prototype.foreignKeys
  15754. * @description 主空间数据集的外键。
  15755. */
  15756. this.foreignKeys = null;
  15757. /**
  15758. * @member {string} SuperMap.LinkItem.prototype.foreignTable
  15759. * @description 关联的外部属性表的名称,目前仅支持 Supermap 管理的表,即另一个矢量数据集所对应的 DBMS 表。
  15760. */
  15761. this.foreignTable = null;
  15762. /**
  15763. * @member {Array.<string>} SuperMap.LinkItem.prototype.linkFields
  15764. * @description 欲保留的外部属性表的字段。如果不设置字段或者设置的字段在外部属性表中不存在的话则不返
  15765. * 回任何外部属性表的属性信息。如果欲保留的外部表字段与主表字段存在同名,则还需要指定一个不存在字段名作为外部表的字段别名。
  15766. */
  15767. this.linkFields = null;
  15768. /**
  15769. * @member {string} SuperMap.LinkItem.prototype.linkFilter
  15770. * @description 与外部属性表的连接条件。
  15771. */
  15772. this.linkFilter = null;
  15773. /**
  15774. * @member {string} SuperMap.LinkItem.prototype.name
  15775. * @description 此关联信息对象的名称。
  15776. */
  15777. this.name = null;
  15778. /**
  15779. * @member {Array.<string>} SuperMap.LinkItem.prototype.primaryKeys
  15780. * @description 需要关联的外部属性表的主键。
  15781. */
  15782. this.primaryKeys = null;
  15783. if (options) {
  15784. Util.extend(this, options);
  15785. }
  15786. this.CLASS_NAME = "SuperMap.LinkItem";
  15787. }
  15788. /**
  15789. * @function SuperMap.LinkItem.prototype.destroy
  15790. * @description 释放资源,将引用资源的属性置空。
  15791. */
  15792. destroy() {
  15793. var me = this;
  15794. if (me.datasourceConnectionInfo instanceof DatasourceConnectionInfo) {
  15795. me.datasourceConnectionInfo.destroy();
  15796. me.datasourceConnectionInfo = null;
  15797. }
  15798. me.foreignKeys = null;
  15799. me.foreignTable = null;
  15800. me.linkFields = null;
  15801. me.linkFilter = null;
  15802. me.name = null;
  15803. me.primaryKeys = null;
  15804. }
  15805. }
  15806. SuperMap.LinkItem = LinkItem;
  15807. ;// CONCATENATED MODULE: ./src/common/iServer/FilterParameter.js
  15808. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15809. * This program are made available under the terms of the Apache License, Version 2.0
  15810. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15811. /**
  15812. * @class SuperMap.FilterParameter
  15813. * @category iServer
  15814. * @classdesc 查询过滤条件参数类。该类用于设置查询数据集的查询过滤参数。
  15815. * @param {Object} options - 参数。
  15816. * @param {string} options.attributeFilter - 属性过滤条件。
  15817. * @param {string} options.name - 查询数据集名称或者图层名称。
  15818. * @param {Array.<SuperMap.JoinItem>} [options.joinItems] - 与外部表的连接信息 SuperMap.JoinItem 数组。
  15819. * @param {Array.<SuperMap.LinkItem>} [options.linkItems] - 与外部表的关联信息 SuperMap.LinkItem 数组。
  15820. * @param {Array.<string>} [options.ids] - 查询 id 数组,即属性表中的 SmID 值。
  15821. * @param {string} [options.orderBy] - 查询排序的字段,orderBy 的字段须为数值型的。
  15822. * @param {string} [options.groupBy] - 查询分组条件的字段。
  15823. * @param {Array.<string>} [options.fields] - 查询字段数组。
  15824. */
  15825. class FilterParameter {
  15826. constructor(options) {
  15827. /**
  15828. * @member {string} SuperMap.FilterParameter.prototype.attributeFilter
  15829. * @description 属性过滤条件。
  15830. * 相当于 SQL 语句中的 WHERE 子句,其格式为:WHERE <条件表达式>,
  15831. * attributeFilter 就是其中的“条件表达式”。
  15832. * 该字段的用法为 attributeFilter = "过滤条件"。
  15833. * 例如,要查询字段 fieldValue 小于100的记录,设置 attributeFilter = "fieldValue < 100";
  15834. * 要查询字段 name 的值为“酒店”的记录,设置 attributeFilter = "name like '%酒店%'",等等。
  15835. */
  15836. this.attributeFilter = null;
  15837. /**
  15838. * @member {string} SuperMap.FilterParameter.prototype.name
  15839. * @description 查询数据集名称或者图层名称,根据实际的查询对象而定。
  15840. * 一般情况下该字段为数据集名称,但在进行与地图相关功能的操作时,
  15841. * 需要设置为图层名称(图层名称格式:数据集名称@数据源别名)。
  15842. * 因为一个地图的图层可能是来自于不同数据源的数据集,
  15843. * 而不同的数据源中可能存在同名的数据集,
  15844. * 使用数据集名称不能唯一的确定数据集,
  15845. * 所以在进行与地图相关功能的操作时,该值需要设置为图层名称。
  15846. */
  15847. this.name = null;
  15848. /**
  15849. * @member {Array.<SuperMap.JoinItem>} [SuperMap.FilterParameter.prototype.joinItems]
  15850. * @description 与外部表的连接信息 SuperMap.JoinItem 数组。
  15851. */
  15852. this.joinItems = null;
  15853. /**
  15854. * @member {Array.<SuperMap.LinkItem>} [SuperMap.FilterParameter.prototype.linkItems]
  15855. * @description 与外部表的关联信息 LinkItem 数组。
  15856. */
  15857. this.linkItems = null;
  15858. /**
  15859. * @member {Array.<string>} [SuperMap.FilterParameter.prototype.ids]
  15860. * @description 查询 id 数组,即属性表中的 SmID 值。
  15861. */
  15862. this.ids = null;
  15863. /**
  15864. * @member {string} [SuperMap.FilterParameter.prototype.orderBy]
  15865. * @description 查询排序的字段,orderBy的字段须为数值型的。
  15866. * 相当于 SQL 语句中的 ORDER BY 子句,其格式为:ORDER BY <列名>,
  15867. * 列名即属性表中每一列的名称,列又可称为属性,在 SuperMap 中又称为字段。
  15868. * 对单个字段排序时,该字段的用法为 orderBy = "字段名";
  15869. * 对多个字段排序时,字段之间以英文逗号进行分割,用法为 orderBy = "字段名1, 字段名2"。
  15870. * 例如,现有一个国家数据集,它有两个字段分别为“SmArea”和“pop_1994”,
  15871. * 分别表示国家的面积和1994年的各国人口数量。
  15872. * 如果要按照各国人口数量对记录进行排序,则 orderBy = "pop_1994";
  15873. * 如果要以面积和人口进行排序,则 orderBy = "SmArea, pop_1994"。
  15874. */
  15875. this.orderBy = null;
  15876. /**
  15877. * @member {string} [SuperMap.FilterParameter.prototype.groupBy]
  15878. * @description 查询分组条件的字段。
  15879. * 相当于 SQL 语句中的 GROUP BY 子句,其格式为:GROUP BY <列名>,
  15880. * 列名即属性表中每一列的名称,列又可称为属性,在 SuperMap 中又称为字段。
  15881. * 对单个字段分组时,该字段的用法为 groupBy = "字段名";
  15882. * 对多个字段分组时,字段之间以英文逗号进行分割,用法为 groupBy = "字段名1, 字段名2"。
  15883. * 例如,现有一个全球城市数据集,该数据集有两个字段分别为“Continent”和“Country”,
  15884. * 分别表示某个城市所属的洲和国家。
  15885. * 如果要按照国家对全球的城市进行分组, 可以设置 groupBy = "Country";
  15886. * 如果以洲和国家对城市进行分组,设置 groupBy = "Continent, Country"。
  15887. */
  15888. this.groupBy = null;
  15889. /**
  15890. * @member {Array.<string>} [SuperMap.FilterParameter.prototype.fields]
  15891. * @description 查询字段数组,如果不设置则使用系统返回的所有字段。
  15892. */
  15893. this.fields = null;
  15894. if (options) {
  15895. Util.extend(this, options);
  15896. }
  15897. this.CLASS_NAME = "SuperMap.FilterParameter";
  15898. }
  15899. /**
  15900. * @function SuperMap.FilterParameter.prototype.destroy
  15901. * @description 释放资源,将引用资源的属性置空。
  15902. */
  15903. destroy() {
  15904. var me = this;
  15905. me.attributeFilter = null;
  15906. me.name = null;
  15907. if (me.joinItems) {
  15908. for (let i = 0, joinItems = me.joinItems, len = joinItems.length; i < len; i++) {
  15909. joinItems[i].destroy();
  15910. }
  15911. me.joinItems = null;
  15912. }
  15913. if (me.linkItems) {
  15914. for (let i = 0, linkItems = me.linkItems, len = linkItems.length; i < len; i++) {
  15915. linkItems[i].destroy();
  15916. }
  15917. me.linkItems = null;
  15918. }
  15919. me.ids = null;
  15920. me.orderBy = null;
  15921. me.groupBy = null;
  15922. me.fields = null;
  15923. }
  15924. }
  15925. SuperMap.FilterParameter = FilterParameter;
  15926. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetBufferAnalystParameters.js
  15927. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15928. * This program are made available under the terms of the Apache License, Version 2.0
  15929. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15930. /**
  15931. * @class SuperMap.DatasetBufferAnalystParameters
  15932. * @category iServer SpatialAnalyst BufferAnalyst
  15933. * @classdesc 数据集缓冲区分析参数类。
  15934. * @param {Object} options - 参数。
  15935. * @param {string} options.dataset - 要用来做缓冲区分析的数据源中数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示。
  15936. * @param {SuperMap.FilterParameter} [options.filterQueryParameter] - 设置数据集中几何对象的过滤条件。只有满足此条件的几何对象才参与缓冲区分析。
  15937. * @param {SuperMap.DataReturnOption} [options.resultSetting] - 结果返回设置类。
  15938. * @param {boolean} [options.isAttributeRetained=true] - 是否保留进行缓冲区分析的对象的字段属性。当 isUnion 字段为 false 时该字段有效。
  15939. * @param {boolean} [options.isUnion=false] - 是否将缓冲区与源记录集中的对象合并后返回。对于面对象而言,要求源数据集中的面对象不相交。
  15940. * @param {SuperMap.BufferSetting} [options.bufferSetting] - 设置缓冲区通用参数。
  15941. *
  15942. * @extends {SuperMap.BufferAnalystParameters}
  15943. */
  15944. class DatasetBufferAnalystParameters extends BufferAnalystParameters {
  15945. constructor(options) {
  15946. super(options);
  15947. /**
  15948. * @member {string} SuperMap.DatasetBufferAnalystParameters.prototype.dataset
  15949. * @description 要用来做缓冲区分析的数据源中数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示。
  15950. */
  15951. this.dataset = null;
  15952. /**
  15953. * @member {SuperMap.FilterParameter} [SuperMap.DatasetBufferAnalystParameters.prototype.filterQueryParameter]
  15954. * @description 设置数据集中几何对象的过滤条件。只有满足此条件的几何对象才参与缓冲区分析。
  15955. */
  15956. this.filterQueryParameter = new FilterParameter();
  15957. /**
  15958. * @member {SuperMap.DataReturnOption} [SuperMap.DatasetBufferAnalystParameters.prototype.resultSetting]
  15959. * @description 结果返回设置类。
  15960. */
  15961. this.resultSetting = new DataReturnOption();
  15962. /**
  15963. * @member {boolean} [SuperMap.DatasetBufferAnalystParameters.prototype.isAttributeRetained=true]
  15964. * @description 是否保留进行缓冲区分析的对象的字段属性。当 isUnion 字段为 false 时该字段有效。
  15965. */
  15966. this.isAttributeRetained = true;
  15967. /**
  15968. * @member {boolean} [SuperMap.DatasetBufferAnalystParameters.prototype.isUnion=false]
  15969. * @description 是否将缓冲区与源记录集中的对象合并后返回。对于面对象而言,要求源数据集中的面对象不相交。
  15970. */
  15971. this.isUnion = false;
  15972. Util.extend(this, options);
  15973. this.CLASS_NAME = "SuperMap.DatasetBufferAnalystParameters";
  15974. }
  15975. /**
  15976. * @function SuperMap.DatasetBufferAnalystParameters.prototype.destroy
  15977. * @override
  15978. */
  15979. destroy() {
  15980. super.destroy();
  15981. var me = this;
  15982. me.dataset = null;
  15983. if (me.filterQueryParameter) {
  15984. me.filterQueryParameter.destroy();
  15985. me.filterQueryParameter = null;
  15986. }
  15987. if (me.resultSetting) {
  15988. me.resultSetting.destroy();
  15989. me.resultSetting = null;
  15990. }
  15991. me.isAttributeRetained = null;
  15992. me.isUnion = null;
  15993. }
  15994. /**
  15995. * @function SuperMap.DatasetBufferAnalystParameters.toObject
  15996. * @param {SuperMap.DatasetBufferAnalystParameters} datasetBufferAnalystParameters - 数据集缓冲区分析参数类。
  15997. * @param {SuperMap.DatasetBufferAnalystParameters} tempObj - 数据集缓冲区分析参数对象。
  15998. * @description 将数据集缓冲区分析参数对象转换为 JSON 对象。
  15999. * @returns {Object} JSON 对象。
  16000. */
  16001. static toObject(datasetBufferAnalystParameters, tempObj) {
  16002. for (var name in datasetBufferAnalystParameters) {
  16003. if (name === "bufferSetting") {
  16004. datasetBufferAnalystParameters.bufferSetting.radiusUnit = datasetBufferAnalystParameters.bufferSetting.radiusUnit.toUpperCase();
  16005. tempObj.bufferAnalystParameter = datasetBufferAnalystParameters.bufferSetting;
  16006. } else if (name === "resultSetting") {
  16007. tempObj.dataReturnOption = datasetBufferAnalystParameters.resultSetting;
  16008. } else if (name === "dataset") {
  16009. continue;
  16010. } else {
  16011. tempObj[name] = datasetBufferAnalystParameters[name];
  16012. }
  16013. }
  16014. }
  16015. }
  16016. SuperMap.DatasetBufferAnalystParameters = DatasetBufferAnalystParameters;
  16017. ;// CONCATENATED MODULE: ./src/common/iServer/GeometryBufferAnalystParameters.js
  16018. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16019. * This program are made available under the terms of the Apache License, Version 2.0
  16020. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16021. /**
  16022. * @class SuperMap.GeometryBufferAnalystParameters
  16023. * @category iServer SpatialAnalyst BufferAnalyst
  16024. * @classdesc 几何对象缓冲区分析参数类
  16025. * 对指定的某个几何对象做缓冲区分析。通过该类可以指定要做缓冲区分析的几何对象、缓冲区参数等。
  16026. * @param {Object} options - 参数。
  16027. * @param {Object} options.sourceGeometry - 要做缓冲区分析的几何对象。
  16028. * @param {number} options.sourceGeometrySRID - 缓冲区几何对象投影坐标参数, 如 4326,3857。
  16029. * @param {SuperMap.BufferSetting} [options.bufferSetting] - 设置缓冲区通用参数。
  16030. * @extends {SuperMap.BufferAnalystParameters}
  16031. */
  16032. class GeometryBufferAnalystParameters extends BufferAnalystParameters {
  16033. constructor(options) {
  16034. super(options);
  16035. /**
  16036. * @member {Object} SuperMap.GeometryBufferAnalystParameters.prototype.sourceGeometry
  16037. * @description 要做缓冲区分析的几何对象。<br>
  16038. * 点类型可以是:{@link SuperMap.Geometry.Point}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}。</br>
  16039. * 线类型可以是:{@link SuperMap.Geometry.LineString}|{@link SuperMap.Geometry.LinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}。</br>
  16040. * 面类型可以是:{@link SuperMap.Geometry.Polygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}。
  16041. */
  16042. this.sourceGeometry = null;
  16043. /**
  16044. * @member {number} SuperMap.GeometryBufferAnalystParameters.prototype.sourceGeometrySRID
  16045. * @description 缓冲区几何对象投影坐标参数, 如 4326,3857。
  16046. */
  16047. this.sourceGeometrySRID = null;
  16048. if (options) {
  16049. Util.extend(this, options);
  16050. }
  16051. this.CLASS_NAME = " SuperMap.GeometryBufferAnalystParameters";
  16052. }
  16053. /**
  16054. * @function SuperMap.GeometryBufferAnalystParameters.prototype.destroy
  16055. * @override
  16056. */
  16057. destroy() {
  16058. super.destroy();
  16059. var me = this;
  16060. if (me.sourceGeometry) {
  16061. me.sourceGeometry.destroy();
  16062. me.sourceGeometry = null;
  16063. }
  16064. }
  16065. /**
  16066. * @function SuperMap.GeometryBufferAnalystParameters.toObject
  16067. * @param {SuperMap.GeometryBufferAnalystParameters} geometryBufferAnalystParameters - 几何对象缓冲区分析参数类。
  16068. * @param {SuperMap.GeometryBufferAnalystParameters} tempObj - 几何对象缓冲区分析参数对象。
  16069. * @description 将几何对象缓冲区分析参数对象转换为 JSON 对象。
  16070. * @returns {Object} JSON 对象。
  16071. */
  16072. static toObject(geometryBufferAnalystParameters, tempObj) {
  16073. for (var name in geometryBufferAnalystParameters) {
  16074. if (name === "bufferSetting") {
  16075. var tempBufferSetting = {};
  16076. for (var key in geometryBufferAnalystParameters.bufferSetting) {
  16077. tempBufferSetting[key] = geometryBufferAnalystParameters.bufferSetting[key];
  16078. }
  16079. tempObj.analystParameter = tempBufferSetting;
  16080. } else if (name === "sourceGeometry") {
  16081. tempObj.sourceGeometry = ServerGeometry.fromGeometry(geometryBufferAnalystParameters.sourceGeometry);
  16082. } else {
  16083. tempObj[name] = geometryBufferAnalystParameters[name];
  16084. }
  16085. }
  16086. }
  16087. }
  16088. SuperMap.GeometryBufferAnalystParameters = GeometryBufferAnalystParameters;
  16089. ;// CONCATENATED MODULE: ./src/common/iServer/BufferAnalystService.js
  16090. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16091. * This program are made available under the terms of the Apache License, Version 2.0
  16092. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16093. /**
  16094. * @class SuperMap.BufferAnalystService
  16095. * @category iServer SpatialAnalyst BufferAnalyst
  16096. * @classdesc 缓冲区分析服务类。
  16097. * 该类负责将客户设置的缓冲区分析参数传递给服务端,并接收服务端返回的缓冲区分析结果数据。
  16098. * 缓冲区分析结果通过该类支持的事件的监听函数参数获取。
  16099. * @param {string} url - 服务的访问地址。如:http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  16100. * @param {Object} options - 参数。</br>
  16101. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  16102. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  16103. * @param {Object} [options.headers] - 请求头。
  16104. * @extends {SuperMap.SpatialAnalystBase}
  16105. * @example 例如:
  16106. * (start code)
  16107. * var myBufferAnalystService = new SuperMap.BufferAnalystService(url, {
  16108. * eventListeners: {
  16109. * "processCompleted": bufferCompleted,
  16110. * "processFailed": bufferFailed
  16111. * }
  16112. * });
  16113. * (end)
  16114. *
  16115. *
  16116. */
  16117. class BufferAnalystService extends SpatialAnalystBase {
  16118. constructor(url, options) {
  16119. super(url, options);
  16120. /**
  16121. * @member {string} SuperMap.BufferAnalystService.prototype.mode
  16122. * @description 缓冲区分析类型
  16123. */
  16124. this.mode = null;
  16125. if (options) {
  16126. Util.extend(this, options);
  16127. }
  16128. this.CLASS_NAME = "SuperMap.BufferAnalystService";
  16129. }
  16130. /**
  16131. * @function SuperMap.BufferAnalystService.prototype.destroy
  16132. * @override
  16133. */
  16134. destroy() {
  16135. super.destroy();
  16136. this.mode = null;
  16137. }
  16138. /**
  16139. * @method SuperMap.BufferAnalystService.prototype.processAsync
  16140. * @description 负责将客户端的查询参数传递到服务端。
  16141. * @param {SuperMap.BufferAnalystParameters} parameter - 缓冲区分析参数
  16142. */
  16143. processAsync(parameter) {
  16144. var parameterObject = {};
  16145. var me = this;
  16146. if (parameter instanceof DatasetBufferAnalystParameters) {
  16147. me.mode = 'datasets';
  16148. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/buffer');
  16149. DatasetBufferAnalystParameters.toObject(parameter, parameterObject);
  16150. } else if (parameter instanceof GeometryBufferAnalystParameters) {
  16151. me.mode = 'geometry';
  16152. me.url = Util.urlPathAppend(me.url, 'geometry/buffer');
  16153. GeometryBufferAnalystParameters.toObject(parameter, parameterObject);
  16154. }
  16155. var jsonParameters = Util.toJSON(parameterObject);
  16156. me.url = Util.urlAppend(me.url, 'returnContent=true');
  16157. me.request({
  16158. method: "POST",
  16159. data: jsonParameters,
  16160. scope: me,
  16161. success: me.serviceProcessCompleted,
  16162. failure: me.serviceProcessFailed
  16163. });
  16164. }
  16165. }
  16166. SuperMap.BufferAnalystService = BufferAnalystService;
  16167. ;// CONCATENATED MODULE: ./src/common/iServer/OutputSetting.js
  16168. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16169. * This program are made available under the terms of the Apache License, Version 2.0
  16170. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16171. /**
  16172. * @class SuperMap.OutputSetting
  16173. * @category iServer ProcessingService
  16174. * @classdesc 分布式分析输出类型设置类。
  16175. * @param {Object} options - 参数。
  16176. * @param {SuperMap.DatasourceConnectionInfo} options.datasourceInfo - 数据源连接信息。
  16177. * @param {string} [options.datasetName='analystResult'] - 结果数据集名称。
  16178. * @param {SuperMap.OutputType} [options.type=SuperMap.OutputType.UDB] - 输出类型。
  16179. * @param {string} [options.outputPath] - 分析结果输出路径。
  16180. */
  16181. class OutputSetting {
  16182. constructor(options) {
  16183. /**
  16184. * @member {SuperMap.OutputType} SuperMap.OutputSetting.prototype.type
  16185. * @description 分布式分析的输出类型。
  16186. */
  16187. this.type = OutputType.UDB;
  16188. /**
  16189. * @member {string} [SuperMap.OutputSetting.prototype.datasetName='analystResult']
  16190. * @description 分布式分析的输出结果数据集名称。
  16191. */
  16192. this.datasetName = "analystResult";
  16193. /**
  16194. * @member {SuperMap.DatasourceConnectionInfo} SuperMap.OutputSetting.prototype.datasourceInfo
  16195. * @description 分布式分析的输出结果数据源连接信息。
  16196. */
  16197. this.datasourceInfo = null;
  16198. /**
  16199. * @member {string} [SuperMap.OutputSetting.prototype.outputPath]
  16200. * @description 分布式分析的分析结果输出路径。
  16201. */
  16202. this.outputPath = "";
  16203. Util.extend(this, options);
  16204. this.CLASS_NAME = "SuperMap.OutputSetting";
  16205. }
  16206. /**
  16207. * @function SuperMap.OutputSetting.prototype.destroy
  16208. * @description 释放资源,将引用资源的属性置空。
  16209. */
  16210. destroy() {
  16211. var me = this;
  16212. me.type = null;
  16213. me.datasetName = null;
  16214. me.outputPath = null;
  16215. if (me.datasourceInfo instanceof DatasourceConnectionInfo) {
  16216. me.datasourceInfo.destroy();
  16217. me.datasourceInfo = null;
  16218. }
  16219. }
  16220. }
  16221. SuperMap.OutputSetting = OutputSetting;
  16222. ;// CONCATENATED MODULE: ./src/common/iServer/MappingParameters.js
  16223. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16224. * This program are made available under the terms of the Apache License, Version 2.0
  16225. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16226. /**
  16227. * @class SuperMap.MappingParameters
  16228. * @category iServer ProcessingService
  16229. * @classdesc 分析后结果可视化的参数类。
  16230. * @param {Object} options - 参数。
  16231. * @param {Array.<SuperMap.ThemeGridRangeItem>} [options.items] - 栅格分段专题图子项数组。
  16232. * @param {number} [options.numericPrecision=1] - 精度,此字段用于设置分析结果标签专题图中标签数值的精度,如“1”表示精确到小数点的后一位。
  16233. * @param {SuperMap.RangeMode} [options.rangeMode=SuperMap.RangeMode.EQUALINTERVAL] - 专题图分段模式。
  16234. * @param {number} [options.rangeCount] - 专题图分段个数。
  16235. * @param {SuperMap.ColorGradientType} [options.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED] - 专题图颜色渐变模式。
  16236. */
  16237. class MappingParameters {
  16238. constructor(options) {
  16239. /**
  16240. * @member {Array.<SuperMap.ThemeGridRangeItem>} [SuperMap.MappingParameters.prototype.items]
  16241. * @description 栅格分段专题图子项数组。
  16242. */
  16243. this.items = null;
  16244. /**
  16245. * @member {number} [SuperMap.MappingParameters.prototype.numericPrecision=1]
  16246. * @description 精度,此字段用于设置分析结果标签专题图中标签数值的精度,如“1”表示精确到小数点的后一位。
  16247. */
  16248. this.numericPrecision = 1;
  16249. /**
  16250. * @member {SuperMap.RangeMode} [SuperMap.MappingParameters.prototype.RangeMode=SuperMap.RangeMode.EQUALINTERVAL]
  16251. * @description 专题图分段模式。
  16252. */
  16253. this.rangeMode = RangeMode.EQUALINTERVAL;
  16254. /**
  16255. * @member {number} [SuperMap.MappingParameters.prototype.rangeCount]
  16256. * @description 专题图分段个数。
  16257. */
  16258. this.rangeCount = "";
  16259. /**
  16260. * @member {SuperMap.ColorGradientType} [SuperMap.MappingParameters.prototype.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED]
  16261. * @description 专题图颜色渐变模式。
  16262. */
  16263. this.colorGradientType = ColorGradientType.YELLOW_RED;
  16264. Util.extend(this, options);
  16265. this.CLASS_NAME = "SuperMap.MappingParameters";
  16266. }
  16267. /**
  16268. * @function SuperMap.MappingParameters.prototype.destroy
  16269. * @description 释放资源,将引用资源的属性置空。
  16270. */
  16271. destroy() {
  16272. var me = this;
  16273. if (me.items) {
  16274. if (me.items.length > 0) {
  16275. for (var item in me.items) {
  16276. me.items[item].destroy();
  16277. me.items[item] = null;
  16278. }
  16279. }
  16280. me.items = null;
  16281. }
  16282. me.numericPrecision = null;
  16283. me.rangeMode = null;
  16284. me.rangeCount = null;
  16285. me.colorGradientType = null;
  16286. }
  16287. }
  16288. SuperMap.MappingParameters = MappingParameters;
  16289. ;// CONCATENATED MODULE: ./src/common/iServer/BuffersAnalystJobsParameter.js
  16290. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16291. * This program are made available under the terms of the Apache License, Version 2.0
  16292. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16293. /**
  16294. * @class SuperMap.BuffersAnalystJobsParameter
  16295. * @category iServer ProcessingService BufferAnalyst
  16296. * @classdesc 缓冲区分析任务参数类。
  16297. * @param {Object} options - 参数。
  16298. * @param {string} options.datasetName - 数据集名。
  16299. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} [options.bounds] - 分析范围(默认为全图范围)。
  16300. * @param {string} [options.distance='15'] - 缓冲距离,或缓冲区半径。
  16301. * @param {string} [options.distanceField='pickup_latitude'] - 缓冲区分析距离字段。
  16302. * @param {SuperMap.AnalystSizeUnit} [options.distanceUnit=SuperMap.AnalystSizeUnit.METER] - 缓冲距离单位单位。
  16303. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  16304. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  16305. */
  16306. class BuffersAnalystJobsParameter {
  16307. constructor(options) {
  16308. /**
  16309. * @member {string} SuperMap.BuffersAnalystJobsParameter.prototype.datasetName
  16310. * @description 数据集名。
  16311. */
  16312. this.datasetName = '';
  16313. /**
  16314. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.BuffersAnalystJobsParameter.prototype.bounds
  16315. * @description 分析范围。
  16316. */
  16317. this.bounds = '';
  16318. /**
  16319. * @member {string} [SuperMap.BuffersAnalystJobsParameter.prototype.distance='15']
  16320. * @description 缓冲距离,或称为缓冲区半径。当缓冲距离字段位空时,此参数有效。
  16321. */
  16322. this.distance = '';
  16323. /**
  16324. * @member {string} [SuperMap.BuffersAnalystJobsParameter.prototype.distanceField='pickup_latitude']
  16325. * @description 缓冲距离字段。
  16326. */
  16327. this.distanceField = '';
  16328. /**
  16329. * @member {SuperMap.AnalystSizeUnit} [SuperMap.BuffersAnalystJobsParameter.prototype.distanceUnit=SuperMap.AnalystSizeUnit.METER]
  16330. * @description 缓冲距离单位。
  16331. */
  16332. this.distanceUnit = AnalystSizeUnit.METER;
  16333. /**
  16334. * @member {string} SuperMap.BuffersAnalystJobsParameter.prototype.dissolveField
  16335. * @description 融合字段,根据字段值对缓冲区结果面对象进行融合。
  16336. */
  16337. this.dissolveField = '';
  16338. /**
  16339. * @member {SuperMap.OutputSetting} [SuperMap.BuffersAnalystJobsParameter.prototype.output]
  16340. * @description 输出参数设置类。
  16341. */
  16342. this.output = null;
  16343. /**
  16344. * @member {SuperMap.MappingParameters} [SuperMap.BuffersAnalystJobsParameter.prototype.mappingParameters]
  16345. * @description 分析后结果可视化的参数类。
  16346. */
  16347. this.mappingParameters = null;
  16348. if (!options) {
  16349. return this;
  16350. }
  16351. Util.extend(this, options);
  16352. this.CLASS_NAME = 'SuperMap.BuffersAnalystJobsParameter';
  16353. }
  16354. /**
  16355. * @function SuperMap.BuffersAnalystJobsParameter.prototype.destroy
  16356. * @description 释放资源,将引用资源的属性置空。
  16357. */
  16358. destroy() {
  16359. this.datasetName = null;
  16360. this.bounds = null;
  16361. this.distance = null;
  16362. this.distanceField = null;
  16363. this.distanceUnit = null;
  16364. this.dissolveField = null;
  16365. if (this.output instanceof OutputSetting) {
  16366. this.output.destroy();
  16367. this.output = null;
  16368. }
  16369. if (this.mappingParameters instanceof MappingParameters) {
  16370. this.mappingParameters.destroy();
  16371. this.mappingParameters = null;
  16372. }
  16373. }
  16374. /**
  16375. * @function SuperMap.BuffersAnalystJobsParameter.toObject
  16376. * @param {SuperMap.BuffersAnalystJobsParameter} BuffersAnalystJobsParameter - 缓冲区分析任务参数。
  16377. * @param {Object} tempObj - 目标对象。
  16378. * @description 生成缓冲区分析任务对象。
  16379. */
  16380. static toObject(BuffersAnalystJobsParameter, tempObj) {
  16381. for (var name in BuffersAnalystJobsParameter) {
  16382. if (name === 'datasetName') {
  16383. tempObj['input'] = tempObj['input'] || {};
  16384. tempObj['input'][name] = BuffersAnalystJobsParameter[name];
  16385. continue;
  16386. }
  16387. if (name === 'output') {
  16388. tempObj['output'] = tempObj['output'] || {};
  16389. tempObj['output'] = BuffersAnalystJobsParameter[name];
  16390. continue;
  16391. }
  16392. tempObj['analyst'] = tempObj['analyst'] || {};
  16393. if (name === 'bounds' && BuffersAnalystJobsParameter[name]) {
  16394. tempObj['analyst'][name] = BuffersAnalystJobsParameter[name].toBBOX();
  16395. } else {
  16396. tempObj['analyst'][name] = BuffersAnalystJobsParameter[name];
  16397. }
  16398. if (name === 'mappingParameters') {
  16399. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  16400. tempObj['analyst']['mappingParameters'] = BuffersAnalystJobsParameter[name];
  16401. }
  16402. }
  16403. }
  16404. }
  16405. SuperMap.BuffersAnalystJobsParameter = BuffersAnalystJobsParameter;
  16406. ;// CONCATENATED MODULE: ./src/common/iServer/ProcessingServiceBase.js
  16407. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16408. * This program are made available under the terms of the Apache License, Version 2.0
  16409. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16410. /**
  16411. * @class SuperMap.ProcessingServiceBase
  16412. * @category iServer ProcessingService
  16413. * @classdesc 分布式分析服务基类
  16414. * @extends {SuperMap.CommonServiceBase}
  16415. * @param {string} url - 分布式分析服务地址。
  16416. * @param {Object} options - 参数。
  16417. * @param {SuperMap.Events} options.events - 处理所有事件的对象。
  16418. * @param {number} options.index - 服务访问地址在数组中的位置。
  16419. * @param {number} options.length - 服务访问地址数组长度。
  16420. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  16421. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  16422. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  16423. * @param {Object} [options.headers] - 请求头。
  16424. */
  16425. class ProcessingServiceBase extends CommonServiceBase {
  16426. constructor(url, options) {
  16427. options = options || {};
  16428. /*
  16429. * Constant: EVENT_TYPES
  16430. * {Array.<string>}
  16431. * 此类支持的事件类型
  16432. * - *processCompleted* 创建成功后触发的事件。
  16433. * - *processFailed* 创建失败后触发的事件 。
  16434. * - *processRunning* 创建过程的整个阶段都会触发的事件,用于获取创建过程的状态 。
  16435. */
  16436. options.EVENT_TYPES = ["processCompleted", "processFailed", "processRunning"];
  16437. super(url, options);
  16438. this.CLASS_NAME = "SuperMap.ProcessingServiceBase";
  16439. }
  16440. /**
  16441. * @function SuperMap.ProcessingServiceBase.prototype.destroy
  16442. * @override
  16443. */
  16444. destroy() {
  16445. super.destroy();
  16446. }
  16447. /**
  16448. * @function SuperMap.ProcessingServiceBase.prototype.getJobs
  16449. * @description 获取分布式分析任务。
  16450. * @param {string} url - 资源地址。
  16451. */
  16452. getJobs(url) {
  16453. var me = this;
  16454. FetchRequest.get(me._processUrl(url), null, {
  16455. proxy: me.proxy
  16456. }).then(function (response) {
  16457. return response.json();
  16458. }).then(function (result) {
  16459. me.events.triggerEvent("processCompleted", {
  16460. result: result
  16461. });
  16462. }).catch(function (e) {
  16463. me.eventListeners.processFailed({
  16464. error: e
  16465. });
  16466. });
  16467. }
  16468. /**
  16469. * @function SuperMap.ProcessingServiceBase.prototype.addJob
  16470. * @description 添加分布式分析任务。
  16471. * @param {string} url - 资源根地址。
  16472. * @param {Object} params - 创建一个空间分析的请求参数。
  16473. * @param {string} paramType - 请求参数类型。
  16474. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  16475. */
  16476. addJob(url, params, paramType, seconds) {
  16477. var me = this,
  16478. parameterObject = null;
  16479. if (params && params instanceof paramType) {
  16480. parameterObject = new Object();
  16481. paramType.toObject(params, parameterObject);
  16482. }
  16483. let headers = Object.assign({
  16484. 'Content-Type': 'application/x-www-form-urlencoded'
  16485. }, me.headers || {})
  16486. var options = {
  16487. proxy: me.proxy,
  16488. headers,
  16489. withCredentials: me.withCredentials,
  16490. crossOrigin: me.crossOrigin,
  16491. isInTheSameDomain: me.isInTheSameDomain
  16492. };
  16493. FetchRequest.post(me._processUrl(url), JSON.stringify(parameterObject), options).then(function (response) {
  16494. return response.json();
  16495. }).then(function (result) {
  16496. if (result.succeed) {
  16497. me.serviceProcessCompleted(result, seconds);
  16498. } else {
  16499. me.serviceProcessFailed(result);
  16500. }
  16501. }).catch(function (e) {
  16502. me.serviceProcessFailed({
  16503. error: e
  16504. });
  16505. });
  16506. }
  16507. serviceProcessCompleted(result, seconds) {
  16508. result = Util.transformResult(result);
  16509. seconds = seconds || 1000;
  16510. var me = this;
  16511. if (result) {
  16512. var id = setInterval(function () {
  16513. FetchRequest.get(me._processUrl(result.newResourceLocation), {
  16514. _t: new Date().getTime()
  16515. })
  16516. .then(function (response) {
  16517. return response.json();
  16518. }).then(function (job) {
  16519. me.events.triggerEvent("processRunning", {
  16520. id: job.id,
  16521. state: job.state
  16522. });
  16523. if (job.state.runState === 'LOST' || job.state.runState === 'KILLED' || job.state.runState === 'FAILED') {
  16524. clearInterval(id);
  16525. me.events.triggerEvent("processFailed", {
  16526. error: job.state.errorMsg,
  16527. state: job.state.runState
  16528. });
  16529. }
  16530. if (job.state.runState === 'FINISHED' && job.setting.serviceInfo) {
  16531. clearInterval(id);
  16532. me.events.triggerEvent("processCompleted", {
  16533. result: job
  16534. });
  16535. }
  16536. }).catch(function (e) {
  16537. clearInterval(id);
  16538. me.events.triggerEvent("processFailed", {
  16539. error: e
  16540. });
  16541. });
  16542. }, seconds);
  16543. }
  16544. }
  16545. serviceProcessFailed(result) {
  16546. super.serviceProcessFailed(result);
  16547. }
  16548. _processUrl(url) {
  16549. if (SecurityManager.getToken(url)) {
  16550. url = Util.urlAppend(url, 'token=' + SecurityManager.getToken(url));
  16551. }
  16552. return url;
  16553. }
  16554. }
  16555. SuperMap.ProcessingServiceBase = ProcessingServiceBase;
  16556. ;// CONCATENATED MODULE: ./src/common/iServer/BuffersAnalystJobsService.js
  16557. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16558. * This program are made available under the terms of the Apache License, Version 2.0
  16559. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16560. /**
  16561. * @class SuperMap.BuffersAnalystJobsService
  16562. * @category iServer ProcessingService BufferAnalyst
  16563. * @classdesc 缓冲区分析服务类
  16564. * @extends {SuperMap.ProcessingServiceBase}
  16565. * @param {string} url - 服务地址。
  16566. * @param {Object} options - 参数。
  16567. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  16568. * @param {Object} [options.headers] - 请求头。
  16569. */
  16570. class BuffersAnalystJobsService extends ProcessingServiceBase {
  16571. constructor(url, options) {
  16572. super(url, options);
  16573. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/buffers');
  16574. this.CLASS_NAME = 'SuperMap.BuffersAnalystJobsService';
  16575. }
  16576. /**
  16577. *@override
  16578. */
  16579. destroy() {
  16580. super.destroy();
  16581. }
  16582. /**
  16583. * @function SuperMap.BuffersAnalystJobsService.prototype.getBufferJobs
  16584. * @description 获取缓冲区分析所有任务
  16585. */
  16586. getBuffersJobs() {
  16587. super.getJobs(this.url);
  16588. }
  16589. /**
  16590. * @function SuperMap.BuffersAnalystJobsService.prototype.getBufferJob
  16591. * @description 获取指定id的缓冲区分析服务
  16592. * @param {string} id - 指定要获取数据的id。
  16593. */
  16594. getBuffersJob(id) {
  16595. super.getJobs(Util.urlPathAppend(this.url, id));
  16596. }
  16597. /**
  16598. * @function SuperMap.BuffersAnalystJobsService.prototype.addBufferJob
  16599. * @description 新建缓冲区分析服务
  16600. * @param {SuperMap.BuffersAnalystJobsParameter} params - 创建一个空间分析的请求参数。
  16601. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  16602. */
  16603. addBuffersJob(params, seconds) {
  16604. super.addJob(this.url, params, BuffersAnalystJobsParameter, seconds);
  16605. }
  16606. }
  16607. SuperMap.BuffersAnalystJobsService = BuffersAnalystJobsService;
  16608. ;// CONCATENATED MODULE: ./src/common/iServer/BurstPipelineAnalystParameters.js
  16609. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16610. * This program are made available under the terms of the Apache License, Version 2.0
  16611. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16612. /**
  16613. * @class SuperMap.BurstPipelineAnalystParameters
  16614. * @category iServer NetworkAnalyst BurstAnalyse
  16615. * @classdesc 爆管分析参数类。
  16616. * @param {Object} options - 参数。
  16617. * @param {Array.<number>} options.sourceNodeIDs - 指定的设施点 ID 数组。
  16618. * @param {number} [options.edgeID] - 指定的弧段ID,edgeID 与 nodeID 必须指定一个。
  16619. * @param {number} [options.nodeID] - 指定的结点ID,edgeID 与 nodeID 必须指定一个。
  16620. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。
  16621. */
  16622. class BurstPipelineAnalystParameters {
  16623. constructor(options) {
  16624. var me = this;
  16625. /**
  16626. * @member {Array.<number>} SuperMap.BurstPipelineAnalystParameters.prototype.sourceNodeIDs
  16627. * @description 指定的设施点 ID 数组。
  16628. */
  16629. this.sourceNodeIDs = null;
  16630. /**
  16631. * @member {number} [SuperMap.BurstPipelineAnalystParameters.prototype.edgeID]
  16632. * @description 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  16633. */
  16634. this.edgeID = null;
  16635. /**
  16636. * @member {number} [SuperMap.BurstPipelineAnalystParameters.prototype.nodeID]
  16637. * @description 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  16638. */
  16639. this.nodeID = null;
  16640. /**
  16641. * @member {boolean} [SuperMap.BurstPipelineAnalystParameters.prototype.isUncertainDirectionValid=false]
  16642. * @description 指定不确定流向是否有效。
  16643. * 指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行。
  16644. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  16645. */
  16646. this.isUncertainDirectionValid = false;
  16647. Util.extend(me, options);
  16648. this.CLASS_NAME = "SuperMap.BurstPipelineAnalystParameters";
  16649. }
  16650. /**
  16651. * @function SuperMap.BurstPipelineAnalystParameters.prototype.destroy
  16652. * @description 释放资源,将引用资源的属性置空。
  16653. */
  16654. destroy() {
  16655. var me = this;
  16656. me.sourceNodeIDs = null;
  16657. me.edgeID = null;
  16658. me.nodeID = null;
  16659. me.isUncertainDirectionValid = null;
  16660. }
  16661. }
  16662. SuperMap.BurstPipelineAnalystParameters = BurstPipelineAnalystParameters;
  16663. ;// CONCATENATED MODULE: ./src/common/iServer/NetworkAnalystServiceBase.js
  16664. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16665. * This program are made available under the terms of the Apache License, Version 2.0
  16666. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16667. /**
  16668. * @class SuperMap.NetworkAnalystServiceBase
  16669. * @category iServer NetworkAnalyst
  16670. * @classdesc 网络分析服务基类。
  16671. * @description 网络分析服务基类。
  16672. * @extends {SuperMap.CommonServiceBase}
  16673. * @param {string} url - 网络分析服务地址。
  16674. * @param {Object} options - 参数。
  16675. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  16676. * @param {Object} [options.headers] - 请求头。
  16677. */
  16678. class NetworkAnalystServiceBase extends CommonServiceBase {
  16679. constructor(url, options) {
  16680. super(url, options);
  16681. /**
  16682. * @member {SuperMap.DataFormat} [SuperMap.NetworkAnalystServiceBase.prototype.format=SuperMap.DataFormat.GEOJSON]
  16683. * @description 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式,参数格式为 "ISERVER","GEOJSON"
  16684. */
  16685. this.format = DataFormat.GEOJSON;
  16686. this.CLASS_NAME = "SuperMap.NetworkAnalystServiceBase";
  16687. }
  16688. /**
  16689. * @function SuperMap.NetworkAnalystServiceBase.prototype.destroy
  16690. * @description 释放资源,将引用的资源属性置空。
  16691. */
  16692. destroy() {
  16693. super.destroy();
  16694. this.format = null;
  16695. }
  16696. /**
  16697. * @function SuperMap.NetworkAnalystServiceBase.prototype.serviceProcessCompleted
  16698. * @description 分析完成,执行此方法。
  16699. * @param {Object} result - 服务器返回的结果对象。
  16700. */
  16701. serviceProcessCompleted(result) {
  16702. var me = this, analystResult;
  16703. result = Util.transformResult(result);
  16704. if (result && me.format === DataFormat.GEOJSON && typeof me.toGeoJSONResult === 'function') {
  16705. analystResult = me.toGeoJSONResult(result);
  16706. }
  16707. if (!analystResult) {
  16708. analystResult = result;
  16709. }
  16710. me.events.triggerEvent("processCompleted", {result: analystResult});
  16711. }
  16712. /**
  16713. * @function SuperMap.NetworkAnalystServiceBase.prototype.toGeoJSONResult
  16714. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。只处理结果中的路由,由子类实现。
  16715. * @param {Object} result - 服务器返回的结果对象。
  16716. * @returns {GeoJSONObject} GeoJSON 对象。
  16717. */
  16718. toGeoJSONResult(result) { // eslint-disable-line no-unused-vars
  16719. return null;
  16720. }
  16721. }
  16722. SuperMap.NetworkAnalystServiceBase = NetworkAnalystServiceBase;
  16723. ;// CONCATENATED MODULE: ./src/common/iServer/BurstPipelineAnalystService.js
  16724. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16725. * This program are made available under the terms of the Apache License, Version 2.0
  16726. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16727. /**
  16728. * @class SuperMap.BurstPipelineAnalystService
  16729. * @category iServer NetworkAnalyst BurstAnalyse
  16730. * @classdesc 爆管分析服务类,即将给定弧段或节点作为爆管点来进行分析,返回关键结点 ID 数组、普通结点 ID 数组及其上下游弧段 ID 数组。
  16731. * @extends {SuperMap.NetworkAnalystServiceBase}
  16732. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  16733. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源},
  16734. * 例如: "http://localhost:8090/iserver/services/test/rest/networkanalyst/WaterNet@FacilityNet"。
  16735. * @param {Object} options - 参数。
  16736. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  16737. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  16738. * @param {Object} [options.headers] - 请求头。
  16739. */
  16740. class BurstPipelineAnalystService extends NetworkAnalystServiceBase {
  16741. constructor(url, options) {
  16742. super(url, options);
  16743. this.CLASS_NAME = "SuperMap.BurstPipelineAnalystService";
  16744. }
  16745. /**
  16746. * @function SuperMap.BurstPipelineAnalystService.prototype.destroy
  16747. * @override
  16748. */
  16749. destroy() {
  16750. super.destroy();
  16751. }
  16752. /**
  16753. * @function SuperMap.BurstPipelineAnalystService.prototype.processAsync
  16754. * @description 负责将客户端的查询参数传递到服务端。
  16755. * @params {SuperMap.BurstPipelineAnalystParameters} params - 爆管分析参数类
  16756. */
  16757. processAsync(params) {
  16758. if (!(params instanceof BurstPipelineAnalystParameters)) {
  16759. return null;
  16760. }
  16761. var me = this, jsonObject;
  16762. me.url = Util.urlPathAppend(me.url, 'burstAnalyse');
  16763. jsonObject = {
  16764. sourceNodeIDs: params.sourceNodeIDs,
  16765. isUncertainDirectionValid: params.isUncertainDirectionValid
  16766. };
  16767. //必传参数不正确,就终止
  16768. if (params.edgeID !== null && params.nodeID !== null) {
  16769. throw new Error('edgeID and nodeID cannot be null at the same time.');
  16770. }
  16771. if (params.edgeID === null && params.nodeID === null) {
  16772. throw new Error('edgeID and nodeID cannot be null at the same time.');
  16773. }
  16774. if (params.edgeID !== null) {
  16775. jsonObject.edgeID = params.edgeID;
  16776. } else {
  16777. jsonObject.nodeID = params.nodeID;
  16778. }
  16779. me.request({
  16780. method: "GET",
  16781. params: jsonObject,
  16782. scope: me,
  16783. success: me.serviceProcessCompleted,
  16784. failure: me.serviceProcessFailed
  16785. });
  16786. }
  16787. }
  16788. SuperMap.BurstPipelineAnalystService = BurstPipelineAnalystService;
  16789. ;// CONCATENATED MODULE: ./src/common/iServer/ChartFeatureInfoSpecsService.js
  16790. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16791. * This program are made available under the terms of the Apache License, Version 2.0
  16792. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16793. /**
  16794. * @class SuperMap.ChartFeatureInfoSpecsService
  16795. * @category iServer Map Chart
  16796. * @classdesc 海图物标信息服务类,通过该服务类可以查询到服务端支持的所有海图物标信息。
  16797. * 用户可以通过两种方式获取查询结果:
  16798. * 一种是通过监听 ChartFeatureInfoSpecsEvent.PROCESS_COMPLETE 事件;
  16799. * 另一种是使用 AsyncResponder 类实现异步处理。
  16800. * @extends {SuperMap.CommonServiceBase}
  16801. * @param {string} url - 地图(特指海图)服务地址。
  16802. * 如:"http://localhost:8090/iserver/services/map-ChartW/rest/maps/海图"。
  16803. * 发送请求格式类似于:"http://localhost:8090/iserver/services/map-ChartW/rest/maps/海图/chartFeatureInfoSpecs.json"。
  16804. * @param {Object} options - 参数。
  16805. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  16806. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  16807. * @param {SuperMap.DataFormat} [options.format] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式,参数格式为"ISERVER","GEOJSON"。
  16808. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  16809. * @param {Object} [options.headers] - 请求头。
  16810. */
  16811. class ChartFeatureInfoSpecsService extends CommonServiceBase {
  16812. constructor(url, options) {
  16813. super(url, options);
  16814. this.CLASS_NAME = "SuperMap.ChartFeatureInfoSpecsService";
  16815. }
  16816. /**
  16817. * @function SuperMap.ChartFeatureInfoSpecsService.prototype.destroy
  16818. * @override
  16819. */
  16820. destroy() {
  16821. super.destroy();
  16822. Util.reset(this);
  16823. }
  16824. /**
  16825. * @function SuperMap.ChartFeatureInfoSpecsService.prototype.processAsync
  16826. * @description 根据地图(特指海图)服务地址与服务端完成异步通讯,获取物标信息。
  16827. * 当查询物标信息成功时,将触发 ChartFeatureInfoSpecsEvent.PROCESS_COMPLETE
  16828. * 事件。用可以通过户两种方式获取图层信息:
  16829. * 1. 通过 AsyncResponder 类获取(推荐使用);
  16830. * 2. 通过监听 ChartFeatureInfoSpecsEvent.PROCESS_COMPLETE 事件获取。
  16831. */
  16832. processAsync() {
  16833. var me = this, method = "GET";
  16834. if (!me.isTempLayers) {
  16835. Util.urlPathAppend(me.url,'chartFeatureInfoSpecs');
  16836. }
  16837. me.request({
  16838. method: method,
  16839. params: null,
  16840. scope: me,
  16841. success: me.serviceProcessCompleted,
  16842. failure: me.serviceProcessFailed
  16843. });
  16844. }
  16845. }
  16846. SuperMap.ChartFeatureInfoSpecsService = ChartFeatureInfoSpecsService;
  16847. ;// CONCATENATED MODULE: ./src/common/iServer/ChartQueryFilterParameter.js
  16848. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16849. * This program are made available under the terms of the Apache License, Version 2.0
  16850. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16851. /**
  16852. * @class SuperMap.ChartQueryFilterParameter
  16853. * @category iServer Map Chart
  16854. * @classdesc 海图查询过滤参数类,用于设置海图查询的过滤参数。包括:物标代码、物标可应用对象的选择(是否查询点、线或面)、属性字段过滤条件。
  16855. * @param {Object} options - 参数。
  16856. * @param {string} options.attributeFilter - 属性字段过滤条件。
  16857. * @param {number} options.chartFeatureInfoSpecCode - 查询的物标代号。
  16858. * @param {boolean} [options.isQueryPoint] - 是否查询点。
  16859. * @param {boolean} [options.isQueryLine] - 是否查询线。
  16860. * @param {boolean} [options.isQueryRegion] - 是否查询面。
  16861. */
  16862. class ChartQueryFilterParameter {
  16863. constructor(options) {
  16864. /**
  16865. * @member {boolean} [SuperMap.ChartQueryFilterParameter.prototype.isQueryPoint]
  16866. * @description 是否查询点。
  16867. */
  16868. this.isQueryPoint = null;
  16869. /**
  16870. * @member {boolean} [SuperMap.ChartQueryFilterParameter.prototype.isQueryLine]
  16871. * @description 是否查询线。
  16872. */
  16873. this.isQueryLine = null;
  16874. /**
  16875. * @member {boolean} [SuperMap.ChartQueryFilterParameter.prototype.isQueryRegion]
  16876. * @description 是否查询面。
  16877. */
  16878. this.isQueryRegion = null;
  16879. /**
  16880. * @member {string} SuperMap.ChartQueryFilterParameter.prototype.attributeFilter
  16881. * @description 属性字段过滤条件。
  16882. */
  16883. this.attributeFilter = null;
  16884. /**
  16885. * @member {number} SuperMap.ChartQueryFilterParameter.prototype.chartFeatureInfoSpecCode
  16886. * @description 查询的物标代号。
  16887. */
  16888. this.chartFeatureInfoSpecCode = null;
  16889. Util.extend(this, options);
  16890. this.CLASS_NAME = "SuperMap.ChartQueryFilterParameter";
  16891. }
  16892. /**
  16893. * @function SuperMap.ChartQueryFilterParameter.prototype.destroy
  16894. * @description 释放资源,将引用资源的属性置空。
  16895. */
  16896. destroy() {
  16897. var me = this;
  16898. me.isQueryPoint = null;
  16899. me.isQueryLine = null;
  16900. me.isQueryRegion = null;
  16901. me.attributeFilter = null;
  16902. me.chartFeatureInfoSpecCode = null;
  16903. }
  16904. /**
  16905. * @function SuperMap.ChartQueryFilterParameter.prototype.toJson
  16906. * @description 将属性信息转化成 JSON 格式字符串。
  16907. */
  16908. toJson() {
  16909. var json = "";
  16910. json += "\"isQueryPoint\":" + this.isQueryPoint + ",";
  16911. json += "\"isQueryLine\":" + this.isQueryLine + ",";
  16912. json += "\"isQueryRegion\":" + this.isQueryRegion + ",";
  16913. if (this.attributeFilter) {
  16914. json += "\"attributeFilter\": \"" + this.attributeFilter + "\",";
  16915. }
  16916. json += "\"chartFeatureInfoSpecCode\":" + this.chartFeatureInfoSpecCode;
  16917. json = "{" + json + "}";
  16918. return json;
  16919. }
  16920. }
  16921. SuperMap.ChartQueryFilterParameter = ChartQueryFilterParameter;
  16922. ;// CONCATENATED MODULE: ./src/common/iServer/ChartQueryParameters.js
  16923. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16924. * This program are made available under the terms of the Apache License, Version 2.0
  16925. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16926. /**
  16927. * @class SuperMap.ChartQueryParameters
  16928. * @category iServer Map Chart
  16929. * @classdesc 海图查询参数类,该类用于设置海图查询时的相关参数,海图查询分为海图属性查询和海图范围查询两类,通过属性 queryMode 指定查询模式。
  16930. * 必设属性有:queryMode、chartLayerNames、chartQueryFilterParameters。当进行海图范围查询时,必设属性还包括 bounds。
  16931. * @param {Object} options - 参数。
  16932. * @param {string} options.queryMode - 海图查询模式类型,支持两种查询方式:海图属性查询("ChartAttributeQuery")和海图空间查询("ChartBoundsQuery")。
  16933. * @param {Array.<string>} options.chartLayerNames - 查询的海图图层的名称。
  16934. * @param {Array.<{SuperMap.ChartQueryFilterParameter}>} options.chartQueryFilterParameters - 海图查询过滤参数。包括:物标代码、物标可应用对象的选择(是否查询点、线或面)、属性字段过滤条件。
  16935. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} [options.bounds] - 海图查询范围。当进行海图范围查询时,此参数为必选。
  16936. * @param {boolean} [options.returnContent=true] - 获取或设置是返回查询结果记录集 recordsets,还是返回查询结果的资源 resourceInfo。
  16937. * @param {number} [options.startRecord=0] - 查询起始记录位置。
  16938. * @param {number} [options.expectCount] - 期望查询结果返回的记录数,该值大于0。
  16939. */
  16940. class ChartQueryParameters {
  16941. constructor(options) {
  16942. /**
  16943. * @member {string} SuperMap.ChartQueryParameters.prototype.queryMode
  16944. * @description 海图查询模式类型,支持两种查询方式:海图属性查询("ChartAttributeQuery")和海图空间查询("ChartBoundsQuery") 。
  16945. */
  16946. this.queryMode = null;
  16947. /**
  16948. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.ChartQueryParameters.prototype.bounds
  16949. * @description 海图查询范围。
  16950. */
  16951. this.bounds = null;
  16952. /**
  16953. * @member {Array.<string>} SuperMap.ChartQueryParameters.prototype.chartLayerNames
  16954. * @description 查询的海图图层的名称。
  16955. */
  16956. this.chartLayerNames = null;
  16957. /**
  16958. * @member {Array.<SuperMap.ChartQueryFilterParameter>} SuperMap.ChartQueryParameters.prototype.chartQueryFilterParameters
  16959. * @description 海图查询过滤参数。包括:物标代码、物标可应用对象的选择(是否查询点、线或面)、属性字段过滤条件。
  16960. */
  16961. this.chartQueryFilterParameters = null;
  16962. /**
  16963. * @member {boolean} [SuperMap.ChartQueryParameters.prototype.returnContent=true]
  16964. * @description 获取或设置是返回查询结果记录集 recordsets,还是返回查询结果的资源 resourceInfo。
  16965. */
  16966. this.returnContent = true;
  16967. /**
  16968. * @member {number} [SuperMap.ChartQueryParameters.prototype.startRecord=0]
  16969. * @description 查询起始记录位置。
  16970. */
  16971. this.startRecord = 0;
  16972. /**
  16973. * @member {number} [SuperMap.ChartQueryParameters.prototype.expectCount]
  16974. * @description 期望查询结果返回的记录数,该值大于0。
  16975. */
  16976. this.expectCount = null;
  16977. Util.extend(this, options);
  16978. this.CLASS_NAME = "SuperMap.ChartQueryParameters";
  16979. }
  16980. /**
  16981. * @function SuperMap.ChartQueryParameters.prototype.destroy
  16982. * @description 释放资源,将引用资源的属性置空。
  16983. */
  16984. destroy() {
  16985. var me = this;
  16986. me.queryMode = null;
  16987. me.bounds = null;
  16988. me.chartLayerNames = null;
  16989. me.chartQueryFilterParameters = null;
  16990. me.returnContent = true;
  16991. me.startRecord = 0;
  16992. me.expectCount = null;
  16993. }
  16994. /**
  16995. * @function SuperMap.ChartQueryParameters.prototype.getVariablesJson
  16996. * @description 将属性信息转换成能够被服务识别的 JSON 格式字符串。
  16997. * @returns {string} JSON 字符串。
  16998. */
  16999. getVariablesJson() {
  17000. var json = "";
  17001. json += "\"queryMode\":\"" + this.queryMode + "\",";
  17002. if (this.chartLayerNames && this.chartLayerNames.length) {
  17003. var chartLayersArray = [];
  17004. var layerLength = this.chartLayerNames.length;
  17005. for (var i = 0; i < layerLength; i++) {
  17006. chartLayersArray.push("\"" + this.chartLayerNames[i] + "\"");
  17007. }
  17008. var layerNames = "[" + chartLayersArray.join(",") + "]";
  17009. json += "\"chartLayerNames\":" + layerNames + ",";
  17010. }
  17011. if (this.queryMode === "ChartBoundsQuery" && this.bounds) {
  17012. json += "\"bounds\":" + "{" + "\"leftBottom\":" + "{" + "\"x\":" + this.bounds.left + "," +
  17013. "\"y\":" + this.bounds.bottom + "}" + "," + "\"rightTop\":" + "{" + "\"x\":" + this.bounds.right + "," +
  17014. "\"y\":" + this.bounds.top + "}" + "},";
  17015. }
  17016. if (this.chartQueryFilterParameters && this.chartQueryFilterParameters.length) {
  17017. var chartParamArray = [];
  17018. var chartLength = this.chartQueryFilterParameters.length;
  17019. for (var j = 0; j < chartLength; j++) {
  17020. var chartQueryFilterParameter = this.chartQueryFilterParameters[j];
  17021. if (!(chartQueryFilterParameter instanceof ChartQueryFilterParameter)) {
  17022. continue;
  17023. }
  17024. chartParamArray.push(chartQueryFilterParameter.toJson());
  17025. }
  17026. var chartParamsJson = "[" + chartParamArray.join(",") + "]";
  17027. chartParamsJson = "\"chartQueryParams\":" + chartParamsJson + ",";
  17028. chartParamsJson += "\"startRecord\":" + this.startRecord + ",";
  17029. chartParamsJson += "\"expectCount\":" + this.expectCount;
  17030. chartParamsJson = "{" + chartParamsJson + "}";
  17031. json += "\"chartQueryParameters\":" + chartParamsJson;
  17032. }
  17033. json = "{" + json + "}";
  17034. return json;
  17035. }
  17036. }
  17037. SuperMap.ChartQueryParameters = ChartQueryParameters;
  17038. ;// CONCATENATED MODULE: ./src/common/iServer/QueryParameters.js
  17039. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17040. * This program are made available under the terms of the Apache License, Version 2.0
  17041. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17042. /**
  17043. * @class SuperMap.QueryParameters
  17044. * @category iServer Map QueryResults
  17045. * @classdesc 查询参数基类。距离查询、SQL 查询、几何地物查询等各自的参数均继承此类。
  17046. * @param {Object} options - 参数。
  17047. * @param {Array.<SuperMap.FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  17048. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  17049. * @param {Object} [options.prjCoordSys] - 自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  17050. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  17051. * @param {SuperMap.GeometryType} [options.networkType=SuperMap.GeometryType.LINE] - 网络数据集对应的查询类型。
  17052. * @param {SuperMap.QueryOption} [options.queryOption=SuperMap.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  17053. * @param {number} [options.startRecord=0] - 查询起始记录号。
  17054. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  17055. * @param {boolean} [options.returnCustomResult=false] - 仅供三维使用。
  17056. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  17057. */
  17058. class QueryParameters {
  17059. constructor(options) {
  17060. if (!options) {
  17061. return;
  17062. }
  17063. /**
  17064. * @member {string} [SuperMap.QueryParameters.prototype.customParams]
  17065. * @description 自定义参数,供扩展使用。
  17066. */
  17067. this.customParams = null;
  17068. /**
  17069. * @member {Object} [SuperMap.QueryParameters.prototype.prjCoordSys]
  17070. * @description 自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}
  17071. */
  17072. this.prjCoordSys = null;
  17073. /**
  17074. * @member {number} [SuperMap.QueryParameters.prototype.expectCount=100000]
  17075. * @description 期望返回结果记录个数,默认返回100000条查询记录,
  17076. * 如果实际不足100000条则返回实际记录条数。
  17077. */
  17078. this.expectCount = 100000;
  17079. /**
  17080. * @member {SuperMap.GeometryType} [SuperMap.QueryParameters.prototype.networkType=SuperMap.GeometryType.LINE]
  17081. * @description 网络数据集对应的查询类型,分为点和线两种类型。
  17082. */
  17083. this.networkType = GeometryType.LINE;
  17084. /**
  17085. * @member {SuperMap.QueryOption} [SuperMap.QueryParameters.prototype.queryOption=SuperMap.QueryOption.ATTRIBUTEANDGEOMETRY]
  17086. * @description 查询结果类型枚举类。
  17087. * 该类描述查询结果返回类型,包括只返回属性、
  17088. * 只返回几何实体以及返回属性和几何实体。
  17089. */
  17090. this.queryOption = QueryOption.ATTRIBUTEANDGEOMETRY;
  17091. /**
  17092. * @member {Array.<SuperMap.FilterParameter>} SuperMap.QueryParameters.prototype.queryParams
  17093. * @description 查询过滤条件参数数组。
  17094. * 该类用于设置查询数据集的查询过滤参数。
  17095. */
  17096. this.queryParams = null;
  17097. /**
  17098. * @member {number} [SuperMap.QueryParameters.prototype.startRecord=0]
  17099. * @description 查询起始记录号。
  17100. */
  17101. this.startRecord = 0;
  17102. /**
  17103. * @member {number} [SuperMap.QueryParameters.prototype.holdTime=10]
  17104. * @description 资源在服务端保存的时间,单位为分钟。
  17105. */
  17106. this.holdTime = 10;
  17107. /**
  17108. * @member {boolean} [SuperMap.QueryParameters.prototype.returnCustomResult=false]
  17109. * @description 仅供三维使用。
  17110. */
  17111. this.returnCustomResult = false;
  17112. /**
  17113. * @member {boolean} [SuperMap.QueryParameters.prototype.returnFeatureWithFieldCaption=false]
  17114. * @description 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  17115. */
  17116. this.returnFeatureWithFieldCaption = false;
  17117. Util.extend(this, options);
  17118. this.CLASS_NAME = "SuperMap.QueryParameters";
  17119. }
  17120. /**
  17121. * @function SuperMap.QueryParameters.prototype.destroy
  17122. * @description 释放资源,将引用资源的属性置空。
  17123. */
  17124. destroy() {
  17125. var me = this;
  17126. me.customParams = null;
  17127. me.expectCount = null;
  17128. me.networkType = null;
  17129. me.queryOption = null;
  17130. if (me.queryParams) {
  17131. for (var i = 0, qps = me.queryParams, len = qps.length; i < len; i++) {
  17132. qps[i].destroy();
  17133. }
  17134. me.queryParams = null;
  17135. }
  17136. me.startRecord = null;
  17137. me.holdTime = null;
  17138. me.returnCustomResult = null;
  17139. me.prjCoordSys = null;
  17140. }
  17141. }
  17142. SuperMap.QueryParameters = QueryParameters;
  17143. ;// CONCATENATED MODULE: ./src/common/iServer/ChartQueryService.js
  17144. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17145. * This program are made available under the terms of the Apache License, Version 2.0
  17146. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17147. /**
  17148. * @class SuperMap.ChartQueryService
  17149. * @category iServer Map Chart
  17150. * @classdesc 海图查询服务类。该类负责将海图查询所需参数(ChartQueryParameters)传递至服务端,并获取服务端的返回结果。
  17151. * 用户可以通过两种方式获取查询结果:
  17152. * 1.通过 AsyncResponder 类获取(推荐使用);
  17153. * 2.通过监听 QueryEvent.PROCESS_COMPLETE 事件获取。
  17154. * @extends {SuperMap.CommonServiceBase}
  17155. * @param {string} url - 地图查询服务访问地址。如:"http://localhost:8090/iserver/services/map-ChartW/rest/maps/海图"。
  17156. * @param {Object} options - 参数。
  17157. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  17158. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  17159. * @param {SuperMap.DataFormat} [options.format] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为"ISERVER","GEOJSON"。
  17160. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  17161. * @param {Object} [options.headers] - 请求头。
  17162. * @example
  17163. * 下面示例显示了如何进行海图属性查询:
  17164. * var nameArray = ["GB4X0000_52000"];
  17165. * var chartQueryFilterParameter = new ChartQueryFilterParameter({
  17166. * isQueryPoint:true,
  17167. * isQueryLine:true,
  17168. * isQueryRegion:true,
  17169. * attributeFilter:"SmID<10",
  17170. * chartFeatureInfoSpecCode:1
  17171. * });
  17172. *
  17173. * var chartQueryParameters = new SuperMap.ChartQueryParameters({
  17174. * queryMode:"ChartAttributeQuery",
  17175. * chartLayerNames:nameArray,
  17176. * returnContent:true,
  17177. * chartQueryFilterParameters:[chartQueryFilterParameter]
  17178. * });
  17179. *
  17180. * var chartQueryService = new SuperMap.ChartQueryService(url);
  17181. *
  17182. * chartQueryService.events.on({
  17183. * "processCompleted":processCompleted,
  17184. * "processFailed":processFailed
  17185. * });
  17186. * chartQueryService.processAsync(chartQueryParameters);
  17187. */
  17188. class ChartQueryService extends CommonServiceBase {
  17189. constructor(url, options) {
  17190. super(url, options);
  17191. options = options || {};
  17192. /**
  17193. * @member {boolean} SuperMap.ChartQueryService.prototype.returnContent
  17194. * @description 是否立即返回新创建资源的表述还是返回新资源的URI。
  17195. */
  17196. this.returnContent = null;
  17197. /**
  17198. * @member {SuperMap.DataFormat} SuperMap.ChartQueryService.prototype.format
  17199. * @description 查询结果返回格式,目前支持iServerJSON 和GeoJSON两种格式
  17200. * 参数格式为"ISERVER","GEOJSON",GEOJSON
  17201. */
  17202. this.format = DataFormat.GEOJSON;
  17203. Util.extend(this, options);
  17204. var me = this;
  17205. if (options.format) {
  17206. me.format = options.format.toUpperCase();
  17207. }
  17208. if (!me.url) {
  17209. return;
  17210. }
  17211. me.url = Util.urlPathAppend(me.url, 'queryResults');
  17212. this.CLASS_NAME = "SuperMap.ChartQueryService";
  17213. }
  17214. /**
  17215. * @function SuperMap.ChartQueryService.prototype.destroy
  17216. * @override
  17217. */
  17218. destroy() {
  17219. var me = this;
  17220. CommonServiceBase.prototype.destroy.apply(this, arguments);
  17221. me.returnContent = null;
  17222. me.format = null;
  17223. }
  17224. /**
  17225. * @function SuperMap.ChartQueryService.prototype.processAsync
  17226. * @description 使用服务地址 URL 实例化 ChartQueryService 对象。
  17227. * @param {SuperMap.ChartQueryParameters} params - 查询参数。
  17228. */
  17229. processAsync(params) {
  17230. //todo重点需要添加代码的地方
  17231. if (!(params instanceof ChartQueryParameters)) {
  17232. return;
  17233. }
  17234. var me = this, jsonParameters;
  17235. me.returnContent = params.returnContent;
  17236. jsonParameters = params.getVariablesJson();
  17237. if (me.returnContent) {
  17238. me.url = Util.urlAppend(me.url, 'returnContent=true');
  17239. }
  17240. me.request({
  17241. method: "POST",
  17242. data: jsonParameters,
  17243. scope: me,
  17244. success: me.serviceProcessCompleted,
  17245. failure: me.serviceProcessFailed
  17246. });
  17247. }
  17248. /**
  17249. * @function SuperMap.ChartQueryService.prototype.serviceProcessCompleted
  17250. * @description 查询完成,执行此方法。
  17251. * @param {Object} result - 服务器返回的结果对象。
  17252. */
  17253. serviceProcessCompleted(result) {
  17254. var me = this;
  17255. result = Util.transformResult(result);
  17256. if (result && result.recordsets && me.format === DataFormat.GEOJSON) {
  17257. for (var i = 0, recordsets = result.recordsets, len = recordsets.length; i < len; i++) {
  17258. if (recordsets[i].features) {
  17259. var geoJSONFormat = new GeoJSON();
  17260. recordsets[i].features = geoJSONFormat.toGeoJSON(recordsets[i].features);
  17261. }
  17262. }
  17263. }
  17264. me.events.triggerEvent("processCompleted", {result: result});
  17265. }
  17266. /**
  17267. * @function SuperMap.ChartQueryService.prototype.getQueryParameters
  17268. * @description 将 JSON 对象表示的查询参数转化为 QueryParameters 对象。
  17269. * @param {Object} params - JSON 字符串表示的查询参数。
  17270. * @returns {SuperMap.QueryParameters} 返回查询结果
  17271. */
  17272. getQueryParameters(params) {
  17273. return new QueryParameters({
  17274. queryMode: params.queryMode,
  17275. bounds: params.bounds,
  17276. chartLayerNames: params.chartLayerNames,
  17277. chartQueryFilterParameters: params.chartQueryFilterParameters,
  17278. returnContent: params.returnContent
  17279. });
  17280. }
  17281. }
  17282. SuperMap.ChartQueryService = ChartQueryService;
  17283. ;// CONCATENATED MODULE: ./src/common/iServer/ClipParameter.js
  17284. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17285. * This program are made available under the terms of the Apache License, Version 2.0
  17286. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17287. /**
  17288. * @class SuperMap.ClipParameter
  17289. * @category iServer SpatialAnalyst InterpolationAnalyst
  17290. * @classdesc 用于裁剪的参数。
  17291. * @description 优先使用用户指定的裁剪区域多边形进行裁剪,也可以通过指定数据源和数据集名,从而使用指定数据集的边界多边形进行裁剪。
  17292. * @param {Object} options - 参数。
  17293. * @param {string} [options.clipDatasetName] - 裁剪的数据集名。
  17294. * @param {string} [options.clipDatasourceName] - 裁剪的数据集所在数据源的名字。
  17295. * @param {(SuperMap.Geometry.Polygon|L.Polygon|L.GeoJSON|ol.geom.Polygon|ol.format.GeoJSON)} [options.clipRegion] - 用户指定的裁剪区域。
  17296. * @param {boolean} [options.isClipInRegion=true] - 是否对裁剪区内的数据集进行裁剪。
  17297. * @param {boolean} [options.isExactClip=true] - 是否使用精确裁剪。
  17298. */
  17299. class ClipParameter {
  17300. constructor(options) {
  17301. /**
  17302. * @member {string} SuperMap.ClipParameter.prototype.clipDatasetName
  17303. * @description 用于裁剪的数据集名,clipDatasetName 与 clipRegion 必须设置一个。
  17304. */
  17305. this.clipDatasetName = null;
  17306. /**
  17307. * @member {string} SuperMap.ClipParameter.prototype.clipDatasourceName
  17308. * @description 用于裁剪的数据集所在数据源的名字。当 clipRegion 不设置时起作用。
  17309. */
  17310. this.clipDatasourceName = null;
  17311. /**
  17312. * @member {(SuperMap.Geometry.Polygon|L.Polygon|L.GeoJSON|ol.geom.Polygon|ol.format.GeoJSON)} SuperMap.ClipParameter.prototype.clipRegion
  17313. * @description 用户指定的裁剪区域,优先使用,clipDatasetName 与 clipRegion 必须设置一个。
  17314. */
  17315. this.clipRegion = null;
  17316. /**
  17317. * @member {boolean} [SuperMap.ClipParameter.prototype.isClipInRegion=true]
  17318. * @description 是否对裁剪区内的数据集进行裁剪。若为 true,则对裁剪区域内的结果进行裁剪,若为 false,则对裁剪区域外的结果进行裁剪。
  17319. */
  17320. this.isClipInRegion = true;
  17321. /**
  17322. * @member {boolean} [SuperMap.ClipParameter.prototype.isExactClip=true]
  17323. * @description 是否使用精确裁剪。
  17324. */
  17325. this.isExactClip = null;
  17326. if (options) {
  17327. Util.extend(this, options);
  17328. }
  17329. this.CLASS_NAME = "SuperMap.ClipParameter";
  17330. }
  17331. /**
  17332. * @function SuperMap.ClipParameter.prototype.destroy
  17333. * @description 释放资源,将引用资源的属性置空。
  17334. */
  17335. destroy() {
  17336. var me = this;
  17337. me.clipDatasetName = null;
  17338. me.clipDatasourceName = null;
  17339. me.clipRegion = null;
  17340. me.isClipInRegion = null;
  17341. me.isExactClip = null;
  17342. }
  17343. /**
  17344. * @function SuperMap.ClipParameter.prototype.toJSON
  17345. * @description 将 ClipParameter 对象转化为 JSON 字符串。
  17346. * @returns {string} 返回转换后的 JSON 字符串。
  17347. */
  17348. toJSON() {
  17349. return Util.toJSON({
  17350. isClipInRegion: this.isClipInRegion,
  17351. clipDatasetName: this.clipDatasetName,
  17352. clipDatasourceName: this.clipDatasourceName,
  17353. isExactClip: this.isExactClip,
  17354. clipRegion: ServerGeometry.fromGeometry(this.clipRegion)
  17355. });
  17356. }
  17357. }
  17358. SuperMap.ClipParameter = ClipParameter;
  17359. ;// CONCATENATED MODULE: ./src/common/iServer/ColorDictionary.js
  17360. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17361. * This program are made available under the terms of the Apache License, Version 2.0
  17362. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17363. /**
  17364. * @class SuperMap.ColorDictionary
  17365. * @category iServer Map Theme
  17366. * @classdesc 颜色对照表类。
  17367. * @description 颜色对照表中的键名为具体的高程值,键值表示该高程值要显示的颜色。对于栅格图层中高程值小于颜色对照表中高程最小值的点使用颜色对照表中高程最小值对应的颜色,对于栅格图层中高程值大于颜色对照表中高程最大值的点使用颜色对照表中高程最大值对应的颜色,对于栅格图层中高程值在颜色对照表中没有对应颜色的点,则查找颜色对照表中与当前高程值相邻的两个高程对应的颜色,然后通过渐变运算要显示的颜色。如果设置了颜色对照表的话,则颜色表设置无效。
  17368. * @param {Object} options - 参数。
  17369. * @param {number} options.elevation - 高程值。
  17370. * @param {SuperMap.ServerColor} options.color - 服务端颜色类。
  17371. */
  17372. class ColorDictionary {
  17373. constructor(options) {
  17374. options = options || {};
  17375. /**
  17376. * @member {number} SuperMap.ColorDictionary.prototype.elevation
  17377. * @description 高程值。
  17378. */
  17379. this.elevation = null;
  17380. /**
  17381. * @member {SuperMap.ServerColor} SuperMap.ColorDictionary.prototype.color
  17382. * @description 服务端颜色类。
  17383. */
  17384. this.color = null;
  17385. Util.extend(this, options);
  17386. var me = this,
  17387. c = me.color;
  17388. if (c) {
  17389. me.color = new ServerColor(c.red, c.green, c.blue);
  17390. }
  17391. this.CLASS_NAME = "SuperMap.ColorDictionary";
  17392. }
  17393. /**
  17394. * @function SuperMap.ColorDictionary.prototype.destroy
  17395. * @description 释放资源,将引用资源的属性置空。
  17396. */
  17397. destroy() {
  17398. Util.reset(this);
  17399. }
  17400. /**
  17401. * @function SuperMap.ColorDictionary.prototype.toServerJSONObject
  17402. * @description 转换成对应的 JSON 格式对象。
  17403. * @returns {Object} JSON 对象。
  17404. */
  17405. toServerJSONObject() {
  17406. var dataObj = {};
  17407. dataObj = Util.copyAttributes(dataObj, this);
  17408. return dataObj;
  17409. }
  17410. }
  17411. SuperMap.ColorDictionary = ColorDictionary;
  17412. ;// CONCATENATED MODULE: ./src/common/iServer/TransportationAnalystResultSetting.js
  17413. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17414. * This program are made available under the terms of the Apache License, Version 2.0
  17415. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17416. /**
  17417. * @class SuperMap.TransportationAnalystResultSetting
  17418. * @category iServer NetworkAnalyst
  17419. * @classdesc 交通网络分析结果参数类。
  17420. * @description 通过该类设置交通网络分析返回的结果,包括是否返回图片、是否返回弧段空间信息、是否返回结点空间信息等。
  17421. * @param {Object} options - 参数。
  17422. * @param {boolean} [options.returnEdgeFeatures=false] - 是否在分析结果中包含弧段要素集合。
  17423. * @param {boolean} [options.returnEdgeGeometry=false] - 返回的弧段要素集合中是否包含几何对象信息。
  17424. * @param {boolean} [options.returnEdgeIDs=false] - 返回结果中是否包含经过弧段 ID 集合。
  17425. * @param {boolean} [options.returnNodeFeatures=false] - 是否在分析结果中包含结点要素集合。
  17426. * @param {boolean} [options.returnNodeGeometry=false] - 返回的结点要素集合中是否包含几何对象信息。
  17427. * @param {boolean} [options.returnNodeIDs=false] - 返回结果中是否包含经过结点 ID 集合。
  17428. * @param {boolean} [options.returnPathGuides=false] - 返回分析结果中是否包含行驶导引集合。
  17429. * @param {boolean} [options.returnRoutes=false] - 返回分析结果中是否包含路由对象的集合。
  17430. */
  17431. class TransportationAnalystResultSetting {
  17432. constructor(options) {
  17433. if (!options) {
  17434. return;
  17435. }
  17436. /**
  17437. * @member {boolean} SuperMap.TransportationAnalystResultSetting.prototype.returnEdgeFeatures
  17438. * @description 是否在分析结果中包含弧段要素集合。弧段要素包括弧段的空间信息和属性信息。
  17439. */
  17440. this.returnEdgeFeatures = false;
  17441. /**
  17442. * @member {boolean} [SuperMap.TransportationAnalystResultSetting.prototype.returnEdgeGeometry=false]
  17443. * @description 返回的弧段要素集合中是否包含几何对象信息。
  17444. */
  17445. this.returnEdgeGeometry = false;
  17446. /**
  17447. * @member {boolean} [SuperMap.TransportationAnalystResultSetting.prototype.returnEdgeIDs=false]
  17448. * @description 返回结果中是否包含经过弧段 ID 集合。
  17449. */
  17450. this.returnEdgeIDs = false;
  17451. /**
  17452. * @member {boolean} [SuperMap.TransportationAnalystResultSetting.prototype.returnNodeFeatures=false]
  17453. * @description 是否在分析结果中包含结点要素集合。
  17454. * 结点要素包括结点的空间信息和属性信息。其中返回的结点要素是否包含空间信息可通过 returnNodeGeometry 字段设置。
  17455. */
  17456. this.returnNodeFeatures = false;
  17457. /**
  17458. * @member {boolean} [SuperMap.TransportationAnalystResultSetting.prototype.returnNodeGeometry=false]
  17459. * @description 返回的结点要素集合中是否包含几何对象信息。
  17460. */
  17461. this.returnNodeGeometry = false;
  17462. /**
  17463. * @member {boolean} [SuperMap.TransportationAnalystResultSetting.prototype.returnNodeIDs=false]
  17464. * @description 返回结果中是否包含经过结点 ID 集合。
  17465. */
  17466. this.returnNodeIDs = false;
  17467. /**
  17468. * @member {boolean} SuperMap.TransportationAnalystResultSetting.prototype.returnPathGuides
  17469. * @description 返回分析结果中是否包含行驶导引集合。
  17470. */
  17471. this.returnPathGuides = false;
  17472. /**
  17473. * @member {boolean} SuperMap.TransportationAnalystResultSetting.prototype.returnRoutes
  17474. * @description 返回分析结果中是否包含路由对象的集合。
  17475. */
  17476. this.returnRoutes = false;
  17477. Util.extend(this, options);
  17478. this.CLASS_NAME = "SuperMap.TransportationAnalystResultSetting";
  17479. }
  17480. /**
  17481. * @function SuperMap.TransportationAnalystResultSetting.prototype.destroy
  17482. * @description 释放资源,将引用资源的属性置空。
  17483. */
  17484. destroy() {
  17485. var me = this;
  17486. me.returnEdgeFeatures = null;
  17487. me.returnEdgeGeometry = null;
  17488. me.returnEdgeIDs = null;
  17489. me.returnNodeFeatures = null;
  17490. me.returnNodeGeometry = null;
  17491. me.returnNodeIDs = null;
  17492. me.returnPathGuides = null;
  17493. me.returnRoutes = null;
  17494. }
  17495. }
  17496. SuperMap.TransportationAnalystResultSetting = TransportationAnalystResultSetting;
  17497. ;// CONCATENATED MODULE: ./src/common/iServer/TransportationAnalystParameter.js
  17498. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17499. * This program are made available under the terms of the Apache License, Version 2.0
  17500. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17501. /**
  17502. * @class SuperMap.TransportationAnalystParameter
  17503. * @category iServer NetworkAnalyst
  17504. * @classdesc 交通网络分析通用参数类。
  17505. * @description 该类主要用来提供交通网络分析所需的通用参数。
  17506. * 通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息,还可以对分析结果包含的内容进行一些设置。
  17507. * @param {Object} options - 参数。
  17508. * @param {Array.<number>} options.barrierEdgeIDs - 网络分析中障碍弧段的 ID 数组。
  17509. * @param {Array.<number>} options.barrierNodeIDs - 网络分析中障碍点的 ID 数组。
  17510. * @param {string} options.turnWeightField - 转向权重字段的名称。
  17511. * @param {SuperMap.TransportationAnalystResultSetting} options.resultSetting - 分析结果返回内容。
  17512. * @param {Array.<(SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point)>} [options.barrierPoints] - 网络分析中 Point2D 类型的障碍点数组。
  17513. * @param {string} [options.weightFieldName] - 阻力字段的名称。
  17514. */
  17515. class TransportationAnalystParameter {
  17516. constructor(options) {
  17517. if (!options) {
  17518. return;
  17519. }
  17520. /**
  17521. * @member {Array.<number>} SuperMap.TransportationAnalystParameter.prototype.barrierEdgeIDs
  17522. * @description 网络分析中障碍弧段的 ID 数组。弧段设置为障碍边之后,表示双向都不通。
  17523. */
  17524. this.barrierEdgeIDs = null;
  17525. /**
  17526. * @member {Array.<number>} SuperMap.TransportationAnalystParameter.prototype.barrierNodeIDs
  17527. * @description 网络分析中障碍点的 ID 数组。结点设置为障碍点之后,表示任何方向都不能通过此结点。
  17528. */
  17529. this.barrierNodeIDs = null;
  17530. /**
  17531. * @member {Array.<(SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point)>} SuperMap.TransportationAnalystParameter.prototype.barrierPoints
  17532. * @description 网络分析中 Point2D 类型的障碍点数组。障碍点表示任何方向都不能通过此点。</br>
  17533. * 当各网络分析参数类中的 isAnalyzeById 属性设置为 false 时,该属性才生效。
  17534. */
  17535. this.barrierPoints = null;
  17536. /**
  17537. * @member {string} [SuperMap.TransportationAnalystParameter.prototype.weightFieldName]
  17538. * @description 阻力字段的名称,标识了进行网络分析时所使用的阻力字段,例如表示时间、长度等的字段都可以用作阻力字段。
  17539. * 该字段默值为服务器发布的所有耗费字段的第一个字段。
  17540. */
  17541. this.weightFieldName = null;
  17542. /**
  17543. * @member {string} SuperMap.TransportationAnalystParameter.prototype.turnWeightField
  17544. * @description 转向权重字段的名称。
  17545. */
  17546. this.turnWeightField = null;
  17547. /**
  17548. * @member {SuperMap.TransportationAnalystResultSetting} SuperMap.TransportationAnalystParameter.prototype.resultSetting
  17549. * @description 分析结果返回内容。
  17550. */
  17551. this.resultSetting = new TransportationAnalystResultSetting();
  17552. Util.extend(this, options);
  17553. this.CLASS_NAME = "SuperMap.TransportationAnalystParameter";
  17554. }
  17555. /**
  17556. * @function SuperMap.TransportationAnalystParameter.prototype.destroy
  17557. * @description 释放资源,将引用资源的属性置空。
  17558. */
  17559. destroy() {
  17560. var me = this;
  17561. me.barrierEdgeIDs = null;
  17562. me.barrierNodeIDs = null;
  17563. me.weightFieldName = null;
  17564. me.turnWeightField = null;
  17565. if (me.resultSetting) {
  17566. me.resultSetting.destroy();
  17567. me.resultSetting = null;
  17568. }
  17569. if (me.barrierPoints && me.barrierPoints.length) {
  17570. for (var i in me.barrierPoints) {
  17571. me.barrierPoints[i].destroy();
  17572. }
  17573. }
  17574. me.barrierPoints = null;
  17575. }
  17576. }
  17577. SuperMap.TransportationAnalystParameter = TransportationAnalystParameter;
  17578. ;// CONCATENATED MODULE: ./src/common/iServer/ComputeWeightMatrixParameters.js
  17579. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17580. * This program are made available under the terms of the Apache License, Version 2.0
  17581. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17582. /**
  17583. * @class SuperMap.ComputeWeightMatrixParameters
  17584. * @category iServer NetworkAnalyst WeightMatrix
  17585. * @classdesc 耗费矩阵分析参数类。根据交通网络分析参数中的耗费字段返回一个耗费矩阵。该矩阵是一个二维数组,用来存储任意两点间的资源消耗。
  17586. * @param {Object} options - 参数。
  17587. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 指定路径分析的结点。
  17588. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} options.nodes - 要计算耗费矩阵的点数组。
  17589. * @param {SuperMap.TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  17590. */
  17591. class ComputeWeightMatrixParameters {
  17592. constructor(options) {
  17593. /**
  17594. * @member {boolean} [SuperMap.ComputeWeightMatrixParameters.prototype.isAnalyzeById=false]
  17595. * @description 是否通过节点 ID 指定路径分析的结点,即通过坐标点指定。
  17596. */
  17597. this.isAnalyzeById = false;
  17598. /**
  17599. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} SuperMap.ComputeWeightMatrixParameters.prototype.nodes
  17600. * @description 要计算耗费矩阵的点数组。
  17601. * 当 {@link SuperMap.ComputeWeightMatrixParameters.isAnalyzeById} = false 时,nodes 应为点的坐标数组;
  17602. * 当 {@link SuperMap.ComputeWeightMatrixParameters.isAnalyzeById} = true 时,nodes 应为点的 ID 数组。
  17603. */
  17604. this.nodes = null;
  17605. /**
  17606. * @member {SuperMap.TransportationAnalystParameter} SuperMap.ComputeWeightMatrixParameters.prototype.parameter
  17607. * @description 交通网络分析通用参数。
  17608. */
  17609. this.parameter = new TransportationAnalystParameter();
  17610. Util.extend(this, options);
  17611. this.CLASS_NAME = "SuperMap.ComputeWeightMatrixParameters";
  17612. }
  17613. /**
  17614. * @function SuperMap.ComputeWeightMatrixParameters.prototype.destroy
  17615. * @description 释放资源,将引用资源的属性置空。
  17616. */
  17617. destroy() {
  17618. var me = this;
  17619. me.isAnalyzeById = null;
  17620. me.nodes = null;
  17621. if (me.parameter) {
  17622. me.parameter.destroy();
  17623. me.parameter = null;
  17624. }
  17625. }
  17626. }
  17627. SuperMap.ComputeWeightMatrixParameters = ComputeWeightMatrixParameters;
  17628. ;// CONCATENATED MODULE: ./src/common/iServer/ComputeWeightMatrixService.js
  17629. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17630. * This program are made available under the terms of the Apache License, Version 2.0
  17631. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17632. /**
  17633. * @class SuperMap.ComputeWeightMatrixService
  17634. * @category iServer NetworkAnalyst WeightMatrix
  17635. * @classdesc 耗费矩阵分析服务类。
  17636. * 耗费矩阵是根据交通网络分析参数中的耗费字段来计算一个二维数组,
  17637. * 用来存储指定的任意两点间的资源消耗。
  17638. * 耗费矩阵分析结果通过该类支持的事件的监听函数参数获取
  17639. * @extends {SuperMap.NetworkAnalystServiceBase}
  17640. * @example
  17641. * var mycomputeWeightMatrixService = new SuperMap.ComputeWeightMatrixService(url,{
  17642. * eventListeners: {
  17643. * "processCompleted": computeWeightMatrixCompleted,
  17644. * "processFailed": computeWeightMatrixnError
  17645. * }
  17646. * });
  17647. * @param {string} url - 耗费矩阵分析服务地址。请求服务的URL应为:
  17648. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  17649. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  17650. * @param {Object} options - 参数。
  17651. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  17652. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  17653. * @param {Object} [options.headers] - 请求头。
  17654. */
  17655. class ComputeWeightMatrixService extends NetworkAnalystServiceBase {
  17656. constructor(url, options) {
  17657. super(url, options);
  17658. this.CLASS_NAME = "SuperMap.ComputeWeightMatrixService";
  17659. }
  17660. /**
  17661. * @function SuperMap.ComputeWeightMatrixService.prototype.destroy
  17662. * @override
  17663. */
  17664. destroy() {
  17665. super.destroy();
  17666. }
  17667. /**
  17668. * @function SuperMap.ComputeWeightMatrixService.prototype.processAsync
  17669. * @description 负责将客户端的查询参数传递到服务端。
  17670. * @param {SuperMap.ComputeWeightMatrixParameters} params - 耗费矩阵分析参数类
  17671. */
  17672. processAsync(params) {
  17673. if (!(params instanceof ComputeWeightMatrixParameters)) {
  17674. return;
  17675. }
  17676. var me = this,
  17677. jsonObject;
  17678. me.url = Util.urlPathAppend(me.url, 'weightmatrix');
  17679. jsonObject = {
  17680. parameter: Util.toJSON(params.parameter),
  17681. nodes: me.getJson(params.isAnalyzeById, params.nodes)
  17682. };
  17683. me.request({
  17684. method: "GET",
  17685. params: jsonObject,
  17686. scope: me,
  17687. success: me.serviceProcessCompleted,
  17688. failure: me.serviceProcessFailed
  17689. });
  17690. }
  17691. /**
  17692. * @function SuperMap.ComputeWeightMatrixService.prototype.getJson
  17693. * @description 将对象转化为JSON字符串。
  17694. * @param {boolean} isAnalyzeById - 是否通过id分析
  17695. * @param {Array.<SuperMap.ComputeWeightMatrixParameters>} params - 分析参数数组
  17696. * @returns {string} 转化后的JSON字符串。
  17697. */
  17698. getJson(isAnalyzeById, params) {
  17699. var jsonString = "[",
  17700. len = params ? params.length : 0;
  17701. if (isAnalyzeById === false) {
  17702. for (let i = 0; i < len; i++) {
  17703. if (i > 0) {
  17704. jsonString += ",";
  17705. }
  17706. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  17707. }
  17708. } else if (isAnalyzeById === true) {
  17709. for (let i = 0; i < len; i++) {
  17710. if (i > 0) {
  17711. jsonString += ",";
  17712. }
  17713. jsonString += params[i];
  17714. }
  17715. }
  17716. jsonString += ']';
  17717. return jsonString;
  17718. }
  17719. }
  17720. SuperMap.ComputeWeightMatrixService = ComputeWeightMatrixService;
  17721. ;// CONCATENATED MODULE: ./src/common/iServer/DataFlowService.js
  17722. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17723. * This program are made available under the terms of the Apache License, Version 2.0
  17724. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17725. /**
  17726. * @class SuperMap.DataFlowService
  17727. * @category iServer DataFlow
  17728. * @classdesc 数据流服务类
  17729. * @extends {SuperMap.CommonServiceBase}
  17730. * @param {string} url - 数据流服务地址
  17731. * @param {Object} options - 参数。
  17732. * @param {function} options.style - 设置数据加载样式。
  17733. * @param {function} [options.onEachFeature] - 设置每个数据加载popup等。
  17734. * @param {GeoJSONObject} [options.geometry] - 指定几何范围,该范围内的要素才能被订阅。
  17735. * @param {Object} [options.excludeField] - -排除字段。
  17736. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  17737. * @param {Object} [options.headers] - 请求头。
  17738. */
  17739. class DataFlowService extends CommonServiceBase {
  17740. constructor(url, options) {
  17741. options = options || {};
  17742. /*
  17743. * @constant EVENT_TYPES
  17744. * {Array.<string>}
  17745. * 此类支持的事件类型
  17746. */
  17747. options.EVENT_TYPES = ["broadcastSocketConnected", "broadcastSocketError", "broadcastFailed", "broadcastSucceeded", "subscribeSocketConnected", "subscribeSocketError", "messageSucceeded", "setFilterParamSucceeded"]
  17748. super(url, options);
  17749. /**
  17750. * @member {GeoJSONObject} SuperMap.DataFlowService.prototype.geometry
  17751. * @description 指定几何范围,该范围内的要素才能被订阅。
  17752. */
  17753. this.geometry = null;
  17754. /**
  17755. * @member {Object} SuperMap.DataFlowService.prototype.prjCoordSys
  17756. * @description 动态投影参数
  17757. */
  17758. this.prjCoordSys = null;
  17759. /**
  17760. * @member {Object} SuperMap.DataFlowService.prototype.excludeField
  17761. * @description 排除字段
  17762. */
  17763. this.excludeField = null;
  17764. Util.extend(this, options);
  17765. this.CLASS_NAME = "SuperMap.DataFlowService";
  17766. }
  17767. /**
  17768. * @function SuperMap.DataFlowService.prototype.initBroadcast
  17769. * @description 初始化广播
  17770. * @returns {SuperMap.DataFlowService}
  17771. */
  17772. initBroadcast() {
  17773. var me = this;
  17774. this.broadcastWebSocket = this._connect(Util.urlPathAppend(me.url, 'broadcast'));
  17775. this.broadcastWebSocket.onopen = function (e) {
  17776. me.broadcastWebSocket.isOpen = true;
  17777. e.eventType = 'broadcastSocketConnected';
  17778. me.events.triggerEvent('broadcastSocketConnected', e);
  17779. };
  17780. this.broadcastWebSocket.onclose = function (e) {
  17781. me.broadcastWebSocket.isOpen = false;
  17782. e.eventType = 'broadcastSocketConnected';
  17783. me.events.triggerEvent('broadcastSocketConnected', e);
  17784. };
  17785. this.broadcastWebSocket.onerror = function (e) {
  17786. e.eventType = 'broadcastSocketError';
  17787. me.events.triggerEvent('broadcastSocketError', e);
  17788. };
  17789. return this;
  17790. }
  17791. /**
  17792. * @function SuperMap.DataFlowService.prototype.broadcast
  17793. * @description 加载广播数据。
  17794. * @param {GeoJSONObject} geoJSONFeature - JSON 格式的要素数据。
  17795. */
  17796. broadcast(geoJSONFeature) {
  17797. if (!this.broadcastWebSocket||!this.broadcastWebSocket.isOpen) {
  17798. this.events.triggerEvent('broadcastFailed');
  17799. return;
  17800. }
  17801. this.broadcastWebSocket.send(JSON.stringify(geoJSONFeature));
  17802. this.events.triggerEvent('broadcastSucceeded');
  17803. }
  17804. /**
  17805. * @function SuperMap.DataFlowService.prototype.initSubscribe
  17806. * @description 初始化订阅数据
  17807. * @returns {this} this
  17808. */
  17809. initSubscribe() {
  17810. var me = this;
  17811. this.subscribeWebSocket = this._connect(Util.urlPathAppend(me.url, 'subscribe'));
  17812. this.subscribeWebSocket.onopen = function (e) {
  17813. me.subscribeWebSocket.send(me._getFilterParams());
  17814. e.eventType = 'subscribeSocketConnected';
  17815. me.events.triggerEvent('subscribeSocketConnected', e);
  17816. };
  17817. this.subscribeWebSocket.onerror = function (e) {
  17818. e.eventType = 'subscribeSocketError';
  17819. me.events.triggerEvent('subscribeSocketError', e);
  17820. };
  17821. this.subscribeWebSocket.onmessage = function (e) {
  17822. me._onMessage(e);
  17823. };
  17824. return this;
  17825. }
  17826. /**
  17827. * @function SuperMap.DataFlowService.prototype.setExcludeField
  17828. * @description 设置排除字段
  17829. * @param {Object} excludeField - 排除字段
  17830. * @returns {this} this
  17831. */
  17832. setExcludeField(excludeField) {
  17833. this.excludeField = excludeField;
  17834. this.subscribeWebSocket.send(this._getFilterParams());
  17835. return this;
  17836. }
  17837. /**
  17838. * @function SuperMap.DataFlowService.prototype.setGeometry
  17839. * @description 设置添加的几何要素数据
  17840. * @param {GeoJSONObject} geometry - 指定几何范围,该范围内的要素才能被订阅。
  17841. * @returns {this} this
  17842. */
  17843. setGeometry(geometry) {
  17844. this.geometry = geometry;
  17845. this.subscribeWebSocket.send(this._getFilterParams());
  17846. return this;
  17847. }
  17848. /**
  17849. * @function SuperMap.DataFlowService.prototype.unSubscribe
  17850. * @description 结束订阅数据
  17851. */
  17852. unSubscribe() {
  17853. if (!this.subscribeWebSocket) {
  17854. return;
  17855. }
  17856. this.subscribeWebSocket.close();
  17857. this.subscribeWebSocket = null;
  17858. }
  17859. /**
  17860. * @function SuperMap.DataFlowService.prototype.unBroadcast
  17861. * @description 结束加载广播
  17862. */
  17863. unBroadcast() {
  17864. if (!this.broadcastWebSocket) {
  17865. return;
  17866. }
  17867. this.broadcastWebSocket.close();
  17868. this.broadcastWebSocket = null;
  17869. }
  17870. /**
  17871. * @function SuperMap.DataFlowService.prototype.destroy
  17872. * @override
  17873. */
  17874. destroy() {
  17875. CommonServiceBase.prototype.destroy.apply(this, arguments);
  17876. var me = this;
  17877. me.geometry = null;
  17878. me.prjCoordSys = null;
  17879. me.excludeField = null;
  17880. this.unBroadcast();
  17881. this.unSubscribe();
  17882. }
  17883. _getFilterParams() {
  17884. var filter = {
  17885. filterParam: {
  17886. prjCoordSys: this.prjCoordSys,
  17887. excludeField: this.excludeField,
  17888. geometry: this.geometry
  17889. }
  17890. };
  17891. return Util.toJSON(filter);
  17892. }
  17893. _onMessage(e) {
  17894. if (e.data && e.data.indexOf("filterParam") >= 0) {
  17895. var filterParam = JSON.parse(e.data);
  17896. e.filterParam = filterParam;
  17897. e.eventType = 'setFilterParamSucceeded';
  17898. this.events.triggerEvent('setFilterParamSucceeded', e);
  17899. return;
  17900. }
  17901. var feature = JSON.parse(e.data);
  17902. e.featureResult = feature;
  17903. e.eventType = 'messageSucceeded';
  17904. this.events.triggerEvent('messageSucceeded', e);
  17905. }
  17906. _connect(url) {
  17907. url = this._appendCredentials(url);
  17908. if ("WebSocket" in window) {
  17909. return new WebSocket(url);
  17910. } else if ("MozWebSocket" in window) {
  17911. var mozWebSocket = window.MozWebSocket;
  17912. return new mozWebSocket(url);
  17913. } else {
  17914. console.log("no WebSocket");
  17915. return null;
  17916. }
  17917. }
  17918. _appendCredentials(url) {
  17919. var token = SecurityManager.getToken(url);
  17920. if (token) {
  17921. url = Util.urlAppend(url, "token=" + token);
  17922. }
  17923. return url;
  17924. }
  17925. }
  17926. SuperMap.DataFlowService = DataFlowService;
  17927. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetInfo.js
  17928. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17929. * This program are made available under the terms of the Apache License, Version 2.0
  17930. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17931. /**
  17932. * @class SuperMap.DatasetInfo
  17933. * @category iServer Data
  17934. * @classdesc 数据集信息类。
  17935. * @description 数据集一般为存储在一起的相关数据的集合;根据数据类型的不同,分为矢量数据集、栅格数据集(griddataset)和
  17936. * 影像数据集(image dataset),以及为了处理特定问题而设计的数据集,如拓扑数据集,网络数据集等。
  17937. * 数据集是 GIS 数据组织的最小单位。其中矢量数据集是由同种类型空间要素组成的集合,
  17938. * 所以也可以称为要素集。根据要素的空间特征的不同,矢量数据集又分为点数据集,
  17939. * 线数据集,面数据集等,各矢量数据集是空间特征和性质相同的数据组织起来的集合。
  17940. * 目前版本支持的数据集主要有点数据集,线数据集,面数据集,文本数据集,复合数据集(CAD 数据集)、
  17941. * 网络数据集,栅格数据集(grid dataset)和影像数据集(image dataset)。
  17942. * @param {Object} options - 参数。
  17943. * @param {SuperMap.Bounds} [options.bounds] - 数据集范围,该字段只读。
  17944. * @param {string} [options.dataSourceName] - 数据源名称,该字段只读。
  17945. * @param {string} [options.description] - 数据集的描述信息。
  17946. * @param {string} [options.encodeType] - 数据集存储时的压缩编码方式,该字段只读。
  17947. * @param {boolean} [options.isReadOnly] - 数据集是否为只读。
  17948. * @param {string} options.name - 数据集名称,该字段必须且只读。
  17949. * @param {SuperMap.Projection} [options.prjCoordSys] - 数据集的投影信息。
  17950. * @param {string} [options.tableName] - 表名,该字段只读。
  17951. * @param {string} options.type - 数据集类型。主要有点数据集,线数据集,面数据集,文本数据集,复合数据集(CAD 数据集)、网络数据集,栅格数据集(grid dataset)和影像数据集(image dataset)。
  17952. */
  17953. class DatasetInfo {
  17954. constructor(options) {
  17955. options = options || {};
  17956. /**
  17957. * @member {SuperMap.Bounds} [SuperMap.DatasetInfo.prototype.bounds]
  17958. * @description 数据集范围,该字段只读。
  17959. */
  17960. this.bounds = null;
  17961. /**
  17962. * @member {string} [SuperMap.DatasetInfo.prototype.dataSourceName]
  17963. * @description 数据源名称,该字段只读。
  17964. */
  17965. this.dataSourceName = null;
  17966. /**
  17967. * @member {string} [SuperMap.DatasetInfo.prototype.description]
  17968. * @description 数据集的描述信息。
  17969. */
  17970. this.description = null;
  17971. /**
  17972. * @member {string} [SuperMap.DatasetInfo.prototype.encodeType]
  17973. * @description 数据集存储时的压缩编码方式,该字段只读。
  17974. */
  17975. this.encodeType = null;
  17976. /**
  17977. * @member {boolean} [SuperMap.DatasetInfo.prototype.isReadOnly]
  17978. * @description 数据集是否为只读。
  17979. */
  17980. this.isReadOnly = null;
  17981. /**
  17982. * @member {string} SuperMap.DatasetInfo.prototype.name
  17983. * @description 数据集名称,该字段必须且只读。
  17984. */
  17985. this.name = null;
  17986. /**
  17987. * @member {SuperMap.Projection} [SuperMap.DatasetInfo.prototype.prjCoordSys]
  17988. * @description 数据集的投影信息。
  17989. */
  17990. this.prjCoordSys = null;
  17991. /**
  17992. * @member {string} [SuperMap.DatasetInfo.prototype.tableName]
  17993. * @description 表名,该字段只读。
  17994. */
  17995. this.tableName = null;
  17996. /**
  17997. * @member {string} SuperMap.DatasetInfo.prototype.type
  17998. * @description 数据集类型,该字段必设。主要有点数据集,线数据集,面数据集,文本数据集,复合数据集(CAD 数据集)、网络数据集,栅格数据集(grid dataset)和影像数据集(image dataset)。
  17999. */
  18000. this.type = null;
  18001. Util.extend(this, options);
  18002. var b = this.bounds;
  18003. if (b) {
  18004. this.bounds = new Bounds(b.leftBottom.x, b.leftBottom.y, b.rightTop.x, b.rightTop.y);
  18005. }
  18006. this.CLASS_NAME = "SuperMap.DatasetInfo";
  18007. }
  18008. /**
  18009. * @function SuperMap.DatasetInfo.prototype.destroy
  18010. * @description 释放资源,将引用资源的属性置空。
  18011. */
  18012. destroy() {
  18013. Util.reset(this);
  18014. }
  18015. /**
  18016. * @function SuperMap.DatasetInfo.prototype.toServerJSONObject
  18017. * @description 转换成对应的 JSON 格式对象。
  18018. * @returns {Object} JSON 对象。
  18019. */
  18020. toServerJSONObject() {
  18021. var dataObj = {};
  18022. dataObj = Util.copyAttributes(dataObj, this);
  18023. if (dataObj.bounds) {
  18024. if (dataObj.bounds.toServerJSONObject) {
  18025. dataObj.bounds = dataObj.bounds.toServerJSONObject();
  18026. }
  18027. }
  18028. return dataObj;
  18029. }
  18030. }
  18031. SuperMap.DatasetInfo = DatasetInfo;
  18032. ;// CONCATENATED MODULE: ./src/common/iServer/OverlayAnalystParameters.js
  18033. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18034. * This program are made available under the terms of the Apache License, Version 2.0
  18035. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18036. /**
  18037. * @class SuperMap.OverlayAnalystParameters
  18038. * @category iServer SpatialAnalyst OverlayAnalyst
  18039. * @classdesc 叠加分析参数基类。数据集叠加分析参数和几何对象叠加分析参数均继承此基类。
  18040. * @param {Object} options - 参数。
  18041. */
  18042. class OverlayAnalystParameters {
  18043. constructor(options) {
  18044. /**
  18045. * @member {SuperMap.OverlayOperationType} [SuperMap.OverlayAnalystParameters.prototype.operation=SuperMap.OverlayOperationType.UNION]
  18046. * @description 指定叠加分析操作类型。
  18047. */
  18048. this.operation = OverlayOperationType.UNION;
  18049. if (options) {
  18050. Util.extend(this, options);
  18051. }
  18052. this.CLASS_NAME = "SuperMap.OverlayAnalystParameters";
  18053. }
  18054. /**
  18055. * @function SuperMap.OverlayAnalystParameters.prototype.destroy
  18056. * @description 释放资源,将引用资源的属性置空。
  18057. */
  18058. destroy() {
  18059. var me = this;
  18060. me.operation = null;
  18061. }
  18062. }
  18063. SuperMap.OverlayAnalystParameters = OverlayAnalystParameters;
  18064. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetOverlayAnalystParameters.js
  18065. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18066. * This program are made available under the terms of the Apache License, Version 2.0
  18067. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18068. /**
  18069. * @class SuperMap.DatasetOverlayAnalystParameters
  18070. * @category iServer SpatialAnalyst OverlayAnalyst
  18071. * @classdesc 数据集叠加分析参数类。
  18072. * @param {Object} options - 参数。
  18073. * @param {string} options.operateDataset - 叠加分析中操作数据集的名称。
  18074. * @param {string} options.sourceDataset - 叠加分析中源数据集的名称。
  18075. * @param {Array.<string>} [options.operateDatasetFields] - 叠加分析中操作数据集保留在结果数据集中的字段名列表。
  18076. * @param {SuperMap.FilterParameter} [options.operateDatasetFilter] - 设置操作数据集中空间对象过滤条件。
  18077. * @param {Array.<SuperMap.Geometry.Polygon|L.Polygon|ol.geom.Polygon>} [options.operateRegions] - 操作面对象集合,表示与这些面对象进行叠加分析。与 operateDataset 参数互斥,冲突时以 operateDataset 为准。
  18078. * @param {Array.<string>} [options.sourceDatasetFields] - 叠加分析中源数据集保留在结果数据集中的字段名列表。
  18079. * @param {SuperMap.FilterParameter} [options.sourceDatasetFilter] - 设置源数据集中空间对象过滤条件。
  18080. * @param {number} [options.tolerance=0] - 容限。
  18081. * @param {SuperMap.OverlayOperationType} options.operation - 叠加操作枚举值。
  18082. * @param {SuperMap.DataReturnOption} [options.resultSetting] - 结果返回设置类。
  18083. * @extends {SuperMap.GetFeaturesParametersBase}
  18084. */
  18085. class DatasetOverlayAnalystParameters extends OverlayAnalystParameters {
  18086. constructor(options) {
  18087. super(options);
  18088. /**
  18089. * @member {string} SuperMap.DatasetOverlayAnalystParameters.prototype.operateDataset
  18090. * @description 叠加分析中操作数据集的名称。
  18091. */
  18092. this.operateDataset = null;
  18093. /**
  18094. * @member {Array.<string>} [SuperMap.DatasetOverlayAnalystParameters.prototype.operateDatasetFields]
  18095. * @description 叠加分析中操作数据集保留在结果数据集中的字段名列表。
  18096. */
  18097. this.operateDatasetFields = [];
  18098. /**
  18099. * @member {SuperMap.FilterParameter} SuperMap.DatasetOverlayAnalystParameters.prototype.operateDatasetFilter
  18100. * @description 设置操作数据集中空间对象过滤条件。
  18101. */
  18102. this.operateDatasetFilter = new FilterParameter();
  18103. /**
  18104. * @member {Array.<SuperMap.Geometry.Polygon|L.Polygon|ol.geom.Polygon>} [SuperMap.DatasetOverlayAnalystParameters.prototype.operateRegions]
  18105. * @description 操作面对象集合,表示与这些面对象进行叠加分析。与 operateDataset 参数互斥,冲突时以 operateDataset 为准。
  18106. */
  18107. this.operateRegions = [];
  18108. /**
  18109. * @member {string} SuperMap.DatasetOverlayAnalystParameters.prototype.sourceDataset
  18110. * @description 叠加分析中源数据集的名称。
  18111. */
  18112. this.sourceDataset = null;
  18113. /**
  18114. * @member {Array.<string>} [SuperMap.DatasetOverlayAnalystParameters.prototype.sourceDatasetFields]
  18115. * @description 叠加分析中源数据集保留在结果数据集中的字段名列表。
  18116. */
  18117. this.sourceDatasetFields = [];
  18118. /**
  18119. * @member {SuperMap.FilterParameter} [SuperMap.DatasetOverlayAnalystParameters.prototype.filterQueryParameter]
  18120. * @description 设置源数据集中空间对象过滤条件。
  18121. */
  18122. this.sourceDatasetFilter = new FilterParameter();
  18123. /**
  18124. * @member {number} [SuperMap.DatasetOverlayAnalystParameters.prototype.tolerance=0]
  18125. * @description 容限。
  18126. */
  18127. this.tolerance = 0;
  18128. /**
  18129. * @member {SuperMap.DataReturnOption} [SuperMap.DatasetOverlayAnalystParameters.prototype.resultSetting]
  18130. * @description 结果返回设置类。
  18131. */
  18132. this.resultSetting = new DataReturnOption();
  18133. Util.extend(this, options);
  18134. this.CLASS_NAME = "SuperMap.DatasetOverlayAnalystParameters";
  18135. }
  18136. /**
  18137. * @function SuperMap.DatasetOverlayAnalystParameters.prototype.destroy
  18138. * @override
  18139. */
  18140. destroy() {
  18141. super.destroy();
  18142. var me = this;
  18143. me.operateDataset = null;
  18144. me.operateDatasetFields = null;
  18145. if (me.operateDatasetFilter) {
  18146. me.operateDatasetFilter.destroy();
  18147. me.operateDatasetFilter = null;
  18148. }
  18149. if (me.operateRegions) {
  18150. for (var i = 0, opRegions = me.operateRegions, len = opRegions.length; i < len; i++) {
  18151. opRegions[i].destroy();
  18152. }
  18153. me.operateRegions = null;
  18154. }
  18155. me.sourceDataset = null;
  18156. me.sourceDatasetFields = null;
  18157. if (me.sourceDatasetFilter) {
  18158. me.sourceDatasetFilter.destroy();
  18159. me.sourceDatasetFilter = null;
  18160. }
  18161. me.tolerance = null;
  18162. if (me.resultSetting) {
  18163. me.resultSetting.destroy();
  18164. me.resultSetting = null;
  18165. }
  18166. }
  18167. /**
  18168. * @function SuperMap.DatasetOverlayAnalystParameters.toObject
  18169. * @param {SuperMap.DatasetOverlayAnalystParameters} datasetOverlayAnalystParameters - 数据集叠加分析参数类。
  18170. * @param {SuperMap.DatasetOverlayAnalystParameters} tempObj - 数据集叠加分析参数对象。
  18171. * @description 将数据集叠加分析参数类转换为 JSON 对象。
  18172. * @returns {Object} JSON 对象。
  18173. */
  18174. static toObject(datasetOverlayAnalystParameters, tempObj) {
  18175. for (var name in datasetOverlayAnalystParameters) {
  18176. if (name === "sourceDataset") {
  18177. continue;
  18178. } else if (name === "operateRegions") {
  18179. tempObj.operateRegions = [];
  18180. var ors = datasetOverlayAnalystParameters.operateRegions;
  18181. for (var index in ors) {
  18182. if (ors.hasOwnProperty(index)) { //icl542
  18183. tempObj.operateRegions[index] = ServerGeometry.fromGeometry(ors[index]);
  18184. }
  18185. }
  18186. } else if (name === "resultSetting") {
  18187. tempObj.dataReturnOption = datasetOverlayAnalystParameters.resultSetting;
  18188. } else {
  18189. tempObj[name] = datasetOverlayAnalystParameters[name];
  18190. }
  18191. }
  18192. }
  18193. }
  18194. SuperMap.DatasetOverlayAnalystParameters = DatasetOverlayAnalystParameters;
  18195. ;// CONCATENATED MODULE: ./src/common/iServer/SurfaceAnalystParametersSetting.js
  18196. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18197. * This program are made available under the terms of the Apache License, Version 2.0
  18198. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18199. /**
  18200. * @class SuperMap.SurfaceAnalystParametersSetting
  18201. * @category iServer SpatialAnalyst SurfaceAnalyst
  18202. * @classdesc 表面分析参数设置类。
  18203. * 通过该类可以设置表面分析提取等值线、提取等值面的一些参数,包括基准值、等值距、光滑度、光滑方法等。
  18204. * @param {Object} options - 参数。
  18205. * @param {(SuperMap.Geometry.Polygon|L.Polygon|ol.geom.Polygon)} [options.clipRegion] - 获取或设置裁剪面对象,如果不需要对操作结果进行裁剪,可以使用 null 值取代该参数。
  18206. * @param {number} [options.datumValue=0] - 获取或设置表面分析中提取等值线、提取等值面的基准值。
  18207. * @param {Array.<number>} options.expectedZValues - 获取或设置期望分析结果的 Z 值集合。
  18208. * @param {number} [options.interval=0] - 获取或设置等值距。等值距是两条等值线之间的间隔值。
  18209. * @param {number} [options.resampleTolerance=0] - 获取或设置重采样容限。
  18210. * @param {SuperMap.SmoothMethod} [options.smoothMethod=SuperMap.SmoothMethod.BSPLINE] - 获取或设置光滑处理所使用的方法。
  18211. * @param {number} [options.smoothness=0] - 获取或设置表面分析中等值线或等值面的边界线的光滑度。
  18212. */
  18213. class SurfaceAnalystParametersSetting {
  18214. constructor(options) {
  18215. /**
  18216. * @member {(SuperMap.Geometry.Polygon|L.Polygon|ol.geom.Polygon)} [SuperMap.SurfaceAnalystParametersSetting.prototype.clipRegion]
  18217. * @description 获取或设置裁剪面对象,如果不需要对操作结果进行裁剪,可以使用 null 值取代该参数。
  18218. */
  18219. this.clipRegion = null;
  18220. /**
  18221. * @member {number} [SuperMap.SurfaceAnalystParametersSetting.prototype.datumValue=0]
  18222. * @description 获取或设置表面分析中提取等值线、提取等值面的基准值。
  18223. * 基准值是作为一个生成等值线的初始起算值,并不一定是最小等值线的值。 例如,高程范围为 220 -1550 的 DEM 栅格数据,
  18224. * 如果设基准值为 0, 等值距为 50,则提取等值线时,以基准值 0 为起点,等值距 50 为间隔提取等值线,
  18225. * 因为给定高程的最小值是 220,所以,在给定范围内提取等值线的最小高程是 250。
  18226. * 提取等值线的结果是:最小等值线值为 250,最大等值线值为 1550。
  18227. */
  18228. this.datumValue = 0;
  18229. /**
  18230. * @member {Array.<number>} SuperMap.SurfaceAnalystParametersSetting.prototype.expectedZValues
  18231. * @description 获取或设置期望分析结果的 Z 值集合。
  18232. * Z 值集合存储一系列数值,该数值为待提取等值线的值。即仅高程值在 Z 值集合中的等值线会被提取。
  18233. */
  18234. this.expectedZValues = null;
  18235. /**
  18236. * @member {number} [SuperMap.SurfaceAnalystParametersSetting.prototype.interval=0]
  18237. * @description 获取或设置等值距。等值距是两条等值线之间的间隔值。
  18238. */
  18239. this.interval = 0;
  18240. /**
  18241. * @member {number} [SuperMap.SurfaceAnalystParametersSetting.prototype.resampleTolerance=0]
  18242. * @description 获取或设置重采样容限。
  18243. * 容限值越大,采样结果数据越简化。当分析结果出现交叉时,可通过调整重采样容限为较小的值来处理。
  18244. */
  18245. this.resampleTolerance = 0;
  18246. /**
  18247. * @member {SuperMap.SmoothMethod} [SuperMap.SurfaceAnalystParametersSetting.prototype.smoothMethod=SuperMap.SmoothMethod.BSPLINE]
  18248. * @description 获取或设置光滑处理所使用的方法。
  18249. */
  18250. this.smoothMethod = SmoothMethod.BSPLINE;
  18251. /**
  18252. * @member {number} [SuperMap.SurfaceAnalystParametersSetting.prototype.smoothness=0]
  18253. * @description 获取或设置表面分析中等值线或等值面的边界线的光滑度。
  18254. * 以为 0-5 为例,光滑度为 0 表示不进行光滑操作,值越大表示光滑度越高。
  18255. * 随着光滑度的增加,提取的等值线越光滑.当然光滑度越大,
  18256. * 计算所需的时间和占用的内存也就越大。而且,当等值距较小时,
  18257. * 光滑度太高会出现等值线相交的问题。
  18258. */
  18259. this.smoothness = 0;
  18260. if (options) {
  18261. Util.extend(this, options);
  18262. }
  18263. this.CLASS_NAME = "SuperMap.SurfaceAnalystParametersSetting";
  18264. }
  18265. /**
  18266. * @function SuperMap.SurfaceAnalystParametersSetting.prototype.destroy
  18267. * @description 释放资源,将引用资源的属性置空。
  18268. */
  18269. destroy() {
  18270. var me = this;
  18271. if (me.clipRegion) {
  18272. me.clipRegion.destroy();
  18273. me.clipRegion = null;
  18274. }
  18275. me.datumValue = null;
  18276. me.expectedZValues = null;
  18277. me.interval = null;
  18278. me.resampleTolerance = null;
  18279. me.smoothMethod = null;
  18280. me.smoothness = null;
  18281. }
  18282. /**
  18283. * @function SuperMap.SurfaceAnalystParametersSetting.prototype.toJSON
  18284. * @description 将对象转化为 JSON 字符串。
  18285. * @returns {string} 对象 JSON 字符串。
  18286. */
  18287. toJSON() {
  18288. let json = "'datumValue':" + Util.toJSON(this.datumValue);
  18289. json += ",'interval':" + Util.toJSON(this.interval);
  18290. json += ",'resampleTolerance':" + Util.toJSON(this.resampleTolerance);
  18291. json += ",'smoothMethod':" + Util.toJSON(this.smoothMethod);
  18292. json += ",'smoothness':" + Util.toJSON(this.smoothness);
  18293. if (this.expectedZValues != null) {
  18294. json += "," + "'expectedZValues':" + Util.toJSON(this.expectedZValues);
  18295. }
  18296. if (this.clipRegion != null) {
  18297. var serverGeometry = this.clipRegion;
  18298. if (this.clipRegion instanceof Geometry && this.clipRegion.components) {
  18299. serverGeometry = ServerGeometry.fromGeometry(this.clipRegion)
  18300. }
  18301. json += ",'clipRegion':" + Util.toJSON(serverGeometry);
  18302. }
  18303. return "{" + json + "}";
  18304. }
  18305. }
  18306. SuperMap.SurfaceAnalystParametersSetting = SurfaceAnalystParametersSetting;
  18307. ;// CONCATENATED MODULE: ./src/common/iServer/SurfaceAnalystParameters.js
  18308. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18309. * This program are made available under the terms of the Apache License, Version 2.0
  18310. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18311. /**
  18312. * @class SuperMap.SurfaceAnalystParameters
  18313. * @category iServer SpatialAnalyst SurfaceAnalyst
  18314. * @classdesc 表面分析提取操作参数类。
  18315. * @description 通过该类可以为进行表面分析提供参数信息,包括表面分析的方法提取等值线、提取等值面和中间结果的分辨率,
  18316. * {@link SuperMap.DatasetSurfaceAnalystParameters} 和 {@link SuperMap.GeometrySurfaceAnalystParameters} 继承自该类。
  18317. * @param {Object} options - 参数。
  18318. * @param {SuperMap.SurfaceAnalystParametersSetting} options.extractParameter - 获取或设置表面分析参数。
  18319. * @param {number} options.resolution - 指定中间结果(栅格数据集)的分辨率。
  18320. * @param {SuperMap.DataReturnOption} options.resultSetting - 结果返回设置类。
  18321. * @param {SuperMap.SurfaceAnalystMethod} [options.surfaceAnalystMethod=SuperMap.SurfaceAnalystMethod.ISOLINE] - 获取或设置表面分析的提取方法,提取等值线和提取等值面。
  18322. */
  18323. class SurfaceAnalystParameters {
  18324. constructor(options) {
  18325. /**
  18326. * @member {number} SuperMap.SurfaceAnalystParameters.prototype.resolution
  18327. * @description 获取或设置指定中间结果(栅格数据集)的分辨率。
  18328. */
  18329. this.resolution = 0;
  18330. /**
  18331. * @member {SuperMap.SurfaceAnalystParametersSetting} SuperMap.SurfaceAnalystParameters.prototype.extractParameter
  18332. * @description 获取或设置表面分析参数。
  18333. * 在进行点数据集进行提取等值面分析时,暂时不支持 SurfaceAnalystParametersSetting 类中的 expectedZValues 字段。
  18334. */
  18335. this.extractParameter = new SurfaceAnalystParametersSetting();
  18336. /**
  18337. * @member {SuperMap.DataReturnOption} SuperMap.SurfaceAnalystParameters.prototype.resultSetting
  18338. * @description 结果返回设置类。
  18339. */
  18340. this.resultSetting = new DataReturnOption();
  18341. /**
  18342. * @member {SuperMap.SurfaceAnalystMethod} [SuperMap.SurfaceAnalystParameters.prototype.surfaceAnalystMethod=SuperMap.SurfaceAnalystMethod.ISOLINE]
  18343. * @description 获取或设置表面分析的提取方法,提取等值线和提取等值面。
  18344. */
  18345. this.surfaceAnalystMethod = SurfaceAnalystMethod.ISOLINE;
  18346. if (options) {
  18347. Util.extend(this, options);
  18348. }
  18349. this.CLASS_NAME = "SuperMap.SurfaceAnalystParameters";
  18350. }
  18351. /**
  18352. * @function SuperMap.SurfaceAnalystParameters.prototype.destroy
  18353. * @description 释放资源,将引用资源的属性置空。
  18354. */
  18355. destroy() {
  18356. var me = this;
  18357. me.resolution = null;
  18358. if (me.extractParameter) {
  18359. me.extractParameter.destroy();
  18360. me.extractParameter = null;
  18361. }
  18362. if (me.resultSetting) {
  18363. me.resultSetting.destroy();
  18364. me.resultSetting = null;
  18365. }
  18366. me.surfaceAnalystMethod = null;
  18367. }
  18368. }
  18369. SuperMap.SurfaceAnalystParameters = SurfaceAnalystParameters;
  18370. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetSurfaceAnalystParameters.js
  18371. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18372. * This program are made available under the terms of the Apache License, Version 2.0
  18373. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18374. /**
  18375. * @class SuperMap.DatasetSurfaceAnalystParameters
  18376. * @category iServer SpatialAnalyst SurfaceAnalyst
  18377. * @classdesc 数据集表面分析参数类。该类对数据集表面分析所用到的参数进行设置。
  18378. * @param {Object} options - 参数。
  18379. * @param {string} options.dataset - 要用来做数据集表面分析的数据源中数据集的名称。
  18380. * @param {string} options.zValueFieldName - 获取或设置用于提取操作的字段名称。
  18381. * @param {integer} options.resolution - 获取或设置指定中间结果(栅格数据集)的分辨率。
  18382. * @param {SuperMap.SurfaceAnalystParametersSetting} options.extractParameter - 表面分析参数设置类。获取或设置表面分析参数。
  18383. * @param {SuperMap.FilterParameter} [options.filterQueryParameter] - 获取或设置查询过滤条件参数。
  18384. * @param {SuperMap.DataReturnOption} [options.resultSetting] - 结果返回设置类。
  18385. * @param {SuperMap.SurfaceAnalystMethod} [options.surfaceAnalystMethod=SuperMap.SurfaceAnalystMethod.ISOLINE] - 获取或设置表面分析的提取方法,提取等值线和提取等值面。
  18386. * @extends {SuperMap.SurfaceAnalystParameters}
  18387. */
  18388. class DatasetSurfaceAnalystParameters extends SurfaceAnalystParameters {
  18389. constructor(options) {
  18390. super(options);
  18391. /**
  18392. * @member {string} SuperMap.DatasetSurfaceAnalystParameters.prototype.dataset
  18393. * @description 要用来做数据集表面分析的数据源中数据集的名称。该名称用形如 "数据集名称@数据源别名" 形式来表示,例如:Country@World。
  18394. */
  18395. this.dataset = null;
  18396. /**
  18397. * @member {SuperMap.FilterParameter} SuperMap.DatasetSurfaceAnalystParameters.prototype.filterQueryParameter
  18398. * @description 获取或设置查询过滤条件参数。
  18399. */
  18400. this.filterQueryParameter = new FilterParameter();
  18401. /**
  18402. * @member {string} SuperMap.DatasetSurfaceAnalystParameters.prototype.zValueFieldName
  18403. * @description 获取或设置用于提取操作的字段名称。提取等值线时,将使用该字段中的值,对点记录集中的点数据进行插值分析,得到栅格数据集(中间结果),接着从栅格数据集提取等值线。
  18404. */
  18405. this.zValueFieldName = null;
  18406. if (options) {
  18407. Util.extend(this, options);
  18408. }
  18409. this.CLASS_NAME = "SuperMap.DatasetSurfaceAnalystParameters";
  18410. }
  18411. /**
  18412. * @function SuperMap.DatasetSurfaceAnalystParameters.prototype.destroy
  18413. * @override
  18414. */
  18415. destroy() {
  18416. super.destroy();
  18417. var me = this;
  18418. me.dataset = null;
  18419. if (me.filterQueryParameter) {
  18420. me.filterQueryParameter.destroy();
  18421. me.filterQueryParameter = null;
  18422. }
  18423. me.zValueFieldName = null;
  18424. }
  18425. /**
  18426. * @function SuperMap.DatasetSurfaceAnalystParameters.toObject
  18427. * @param {SuperMap.DatasetSurfaceAnalystParameters} datasetSurfaceAnalystParameters - 数据集表面分析参数类。
  18428. * @param {SuperMap.DatasetSurfaceAnalystParameters} tempObj - 数据集表面分析参数对象。
  18429. * @description 将数据集表面分析参数对象转换为 JSON 对象。
  18430. * @returns JSON 对象。
  18431. */
  18432. static toObject(datasetSurfaceAnalystParameters, tempObj) {
  18433. for (var name in datasetSurfaceAnalystParameters) {
  18434. if (name === "filterQueryParameter") {
  18435. tempObj.filterQueryParameter = datasetSurfaceAnalystParameters.filterQueryParameter;
  18436. }
  18437. if (name === "extractParameter") {
  18438. if (datasetSurfaceAnalystParameters.extractParameter.clipRegion instanceof Geometry && datasetSurfaceAnalystParameters.extractParameter.clipRegion.components) {
  18439. datasetSurfaceAnalystParameters.extractParameter.clipRegion = ServerGeometry.fromGeometry(datasetSurfaceAnalystParameters.extractParameter.clipRegion);
  18440. }
  18441. tempObj.extractParameter = datasetSurfaceAnalystParameters.extractParameter;
  18442. } else if (name === "dataset") {
  18443. continue;
  18444. } else if (name === "surfaceAnalystMethod") {
  18445. continue;
  18446. } else {
  18447. tempObj[name] = datasetSurfaceAnalystParameters[name];
  18448. }
  18449. }
  18450. }
  18451. }
  18452. SuperMap.DatasetSurfaceAnalystParameters = DatasetSurfaceAnalystParameters;
  18453. ;// CONCATENATED MODULE: ./src/common/iServer/ThiessenAnalystParameters.js
  18454. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18455. * This program are made available under the terms of the Apache License, Version 2.0
  18456. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18457. /**
  18458. * @class SuperMap.ThiessenAnalystParameters
  18459. * @category iServer SpatialAnalyst ThiessenPolygonAnalyst
  18460. * @classdesc 泰森多边形分析参数基类。
  18461. * @param {Object} options - 参数。
  18462. * @param {(SuperMap.Geometry.Polygon|L.Polygon|ol.geom.Polygon)} [options.clipRegion] - 结果数据裁剪区域,可以为 null,表示不对结果进行裁剪。
  18463. * @param {boolean} [options.createResultDataset=false] - 是否返回结果数据集。
  18464. * @param {string} [options.resultDatasetName] - 指定结果数据集名称。
  18465. * @param {string} [options.resultDatasourceName] - 指定结果数据集所在数据源,默认为当前数据源。
  18466. * @param {boolean} [options.returnResultRegion=true] - 是否返回分析得到的多边形面数组。
  18467. */
  18468. class ThiessenAnalystParameters {
  18469. constructor(options) {
  18470. if (!options) {
  18471. return;
  18472. }
  18473. /**
  18474. * @member {(SuperMap.Geometry.Polygon|L.Polygon|ol.geom.Polygon)} [SuperMap.ThiessenAnalystParameters.prototype.clipRegion]
  18475. * @description 结果数据裁剪区域,可以为 null,表示不对结果进行裁剪。
  18476. */
  18477. this.clipRegion = null;
  18478. /**
  18479. * @member {boolean} [SuperMap.ThiessenAnalystParameters.prototype.createResultDataset=false]
  18480. * @description 是否返回结果数据集。如果为 true,则必须设置属性 resultDatasetName 和 resultDatasourceName。
  18481. */
  18482. this.createResultDataset = false;
  18483. /**
  18484. * @member {string} SuperMap.ThiessenAnalystParameters.prototype.resultDatasetName
  18485. * @description 指定结果数据集名称。
  18486. */
  18487. this.resultDatasetName = null;
  18488. /**
  18489. * @member {string} SuperMap.ThiessenAnalystParameters.prototype.resultDatasourceName
  18490. * @description 指定结果数据集所在数据源。
  18491. */
  18492. this.resultDatasourceName = null;
  18493. /**
  18494. * @member {boolean} SuperMap.ThiessenAnalystParameters.prototype.returnResultRegion
  18495. * @description 是否返回分析得到的多边形面数组。
  18496. */
  18497. this.returnResultRegion = true;
  18498. Util.extend(this, options);
  18499. this.CLASS_NAME = "SuperMap.ThiessenAnalystParameters";
  18500. }
  18501. /**
  18502. * @function SuperMap.ThiessenAnalystParameters.prototype.destroy
  18503. * @description 释放资源,将引用资源的属性置空。
  18504. */
  18505. destroy() {
  18506. var me = this;
  18507. if (me.clipRegion) {
  18508. me.clipRegion.destroy();
  18509. me.clipRegion = null;
  18510. }
  18511. me.createResultDataset = null;
  18512. me.resultDatasetName = null;
  18513. me.resultDatasourceName = null;
  18514. me.returnResultRegion = null;
  18515. }
  18516. }
  18517. SuperMap.ThiessenAnalystParameters = ThiessenAnalystParameters;
  18518. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetThiessenAnalystParameters.js
  18519. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18520. * This program are made available under the terms of the Apache License, Version 2.0
  18521. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18522. /**
  18523. * @class SuperMap.DatasetThiessenAnalystParameters
  18524. * @category iServer SpatialAnalyst ThiessenAnalyst
  18525. * @classdesc 数据集泰森多边形分析参数类。
  18526. * @param {Object} options - 参数。
  18527. * @param {SuperMap.FilterParameter} [options.filterQueryParameter] - 对待分析数据集中的点进行过滤,即对数据集中的所有点进行分析。
  18528. * @extends {SuperMap.ThiessenAnalystParameters}
  18529. */
  18530. class DatasetThiessenAnalystParameters extends ThiessenAnalystParameters {
  18531. constructor(options) {
  18532. super(options);
  18533. /**
  18534. * @member {SuperMap.FilterParameter} [SuperMap.DatasetThiessenAnalystParameters.prototype.filterQueryParameter]
  18535. * @description 过滤条件,对待分析数据集中的点进行过滤,即对数据集中的所有点进行分析。
  18536. * @example
  18537. * var filterQueryParameter = new SuperMap.FilterParameter({
  18538. * name: "Countries@World",
  18539. * attributeFilter: "SmID>100"
  18540. * });
  18541. */
  18542. this.filterQueryParameter = null;
  18543. /**
  18544. * @member {string} SuperMap.DatasetThiessenAnalystParameters.prototype.dataset
  18545. * @description 数据集名称待分析的数据集名称,请使用 "datasetName@datasourceName" 格式来表示。
  18546. */
  18547. this.dataset = null;
  18548. if (options) {
  18549. Util.extend(this, options);
  18550. }
  18551. this.CLASS_NAME = "SuperMap.DatasetThiessenAnalystParameters";
  18552. }
  18553. /**
  18554. * @function SuperMap.DatasetThiessenAnalystParameters.prototype.destroy
  18555. * @override
  18556. */
  18557. destroy() {
  18558. super.destroy();
  18559. var me = this;
  18560. if (me.filterQueryParameter) {
  18561. me.filterQueryParameter.destroy();
  18562. me.filterQueryParameter = null;
  18563. }
  18564. }
  18565. /**
  18566. * @function SuperMap.DatasetThiessenAnalystParameters.toObject
  18567. * @param {SuperMap.DatasetThiessenAnalystParameters} datasetThiessenAnalystParameters - 泰森多边形分析服务参数类。
  18568. * @param {SuperMap.DatasetThiessenAnalystParameters} tempObj - 泰森多边形分析服务参数对象。
  18569. * @description 将泰森多边形分析服务参数对象转换为 JSON 对象。
  18570. * @returns JSON 对象。
  18571. */
  18572. static toObject(datasetThiessenAnalystParameters, tempObj) {
  18573. for (var name in datasetThiessenAnalystParameters) {
  18574. if (name === "clipRegion") {
  18575. tempObj.clipRegion = ServerGeometry.fromGeometry(datasetThiessenAnalystParameters.clipRegion);
  18576. } else {
  18577. tempObj[name] = datasetThiessenAnalystParameters[name];
  18578. }
  18579. }
  18580. }
  18581. }
  18582. SuperMap.DatasetThiessenAnalystParameters = DatasetThiessenAnalystParameters;
  18583. ;// CONCATENATED MODULE: ./src/common/iServer/DensityKernelAnalystParameters.js
  18584. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18585. * This program are made available under the terms of the Apache License, Version 2.0
  18586. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18587. /**
  18588. * @class SuperMap.DensityKernelAnalystParameters
  18589. * @category iServer SpatialAnalyst DensityAnalyst
  18590. * @classdesc 核密度分析参数类。
  18591. * @param {Object} options - 参数。
  18592. * @param {string} options.dataset - 要用来做核密度分析数据源中数据集的名称。该名称用形如 "数据集名称@数据源别名" 形式来表示,例如:BaseMap_P@Jingjin。
  18593. * @param {string} options.fieldName - 用于进行核密度分析的测量值的字段名称,核密度分析不支持文本类型的字段。
  18594. * @param {string} options.resultGridName - 指定结果数据集名称。
  18595. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} [options.bounds] - 核密度分析的范围,用于确定结果栅格数据集的范围。如果缺省,则默认为原数据集的范围。
  18596. * @param {number} [options.searchRadius] - 栅格邻域内用于计算密度的查找半径,单位与当前数据集相同。默认值为当前数据集的长宽中的最大值除30。
  18597. * @param {number} [options.resultGridDatasetResolution] - 密度分析结果栅格数据的分辨率,单位与当前数据集相同。默认值为当前数据集的长宽中的最小值除500。
  18598. * @param {string} [options.targetDatasource] - 指定的存储结果数据集的数据源,默认为当前分析的数据集所在的数据源。
  18599. * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  18600. */
  18601. class DensityKernelAnalystParameters {
  18602. constructor(options) {
  18603. /**
  18604. * @member {string} SuperMap.DensityKernelAnalystParameters.prototype.dataset
  18605. * @description 要用来做核密度分析数据源中数据集的名称。
  18606. * 该名称用形如 "数据集名称@数据源别名" 形式来表示,例如:Railway@Changchun。
  18607. * 注:核密度分析支持点数据集和线数据集。
  18608. */
  18609. this.dataset = null;
  18610. /**
  18611. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} [SuperMap.DensityKernelAnalystParameters.prototype.bounds]
  18612. * @description 核密度分析的范围,用于确定结果栅格数据集的范围。
  18613. * 如果缺省,则默认为原数据集的范围。
  18614. */
  18615. this.bounds = null;
  18616. /**
  18617. * @member {string} SuperMap.DensityKernelAnalystParameters.prototype.fieldName
  18618. * @description 用于进行核密度分析的测量值的字段名称,核密度分析不支持文本类型的字段。
  18619. */
  18620. this.fieldName = null;
  18621. /**
  18622. * @member {number} [SuperMap.DensityKernelAnalystParameters.prototype.resultGridDatasetResolution]
  18623. * @description 密度分析结果栅格数据的分辨率,单位与当前数据集相同。默认值为当前数据集的长宽中的最小值除500。
  18624. */
  18625. this.resultGridDatasetResolution = null;
  18626. /**
  18627. * @member {number} [SuperMap.DensityKernelAnalystParameters.prototype.searchRadius]
  18628. * @description 栅格邻域内用于计算密度的查找半径,单位与当前数据集相同。默认值为当前数据集的长宽中的最大值除30。
  18629. */
  18630. this.searchRadius = null;
  18631. /**
  18632. * @member {string} [SuperMap.DensityKernelAnalystParameters.prototype.targetDatasource]
  18633. * @description 指定的存储结果数据集的数据源,默认为当前分析的数据集所在的数据源。
  18634. */
  18635. this.targetDatasource = null;
  18636. /**
  18637. * @member {string} SuperMap.DensityKernelAnalystParameters.prototype.resultGridName
  18638. * @description 指定结果数据集名称。
  18639. */
  18640. this.resultGridName = null;
  18641. /**
  18642. * @member {boolean} [SuperMap.DensityKernelAnalystParameters.prototype.deleteExistResultDataset=false]
  18643. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  18644. */
  18645. this.deleteExistResultDataset = false;
  18646. Util.extend(this, options);
  18647. this.CLASS_NAME = "SuperMap.DensityKernelAnalystParameters";
  18648. }
  18649. /**
  18650. * @function SuperMap.DensityKernelAnalystParameters.prototype.destroy
  18651. * @description 释放资源,将引用资源的属性置空。
  18652. */
  18653. destroy() {
  18654. var me = this;
  18655. me.dataset = null;
  18656. me.bounds = null;
  18657. me.fieldName = null;
  18658. me.resultGridDatasetResolution = null;
  18659. me.searchRadius = null;
  18660. me.targetDatasource = null;
  18661. me.resultGridName = null;
  18662. me.deleteExistResultDataset = null;
  18663. }
  18664. /**
  18665. * @function SuperMap.DensityKernelAnalystParameters.toObject
  18666. * @param {SuperMap.DensityKernelAnalystParameters} densityKernelAnalystParameters -核密度分析参数类。
  18667. * @param {SuperMap.DensityKernelAnalystParameters} tempObj - 核密度分析参数对象。
  18668. * @description 将核密度分析参数对象转换成 JSON 对象。
  18669. * @returns JSON 对象。
  18670. */
  18671. static toObject(densityKernelAnalystParameters, tempObj) {
  18672. for (var name in densityKernelAnalystParameters) {
  18673. if (name !== "dataset") {
  18674. tempObj[name] = densityKernelAnalystParameters[name];
  18675. }
  18676. }
  18677. }
  18678. }
  18679. SuperMap.DensityKernelAnalystParameters = DensityKernelAnalystParameters;
  18680. ;// CONCATENATED MODULE: ./src/common/iServer/DensityAnalystService.js
  18681. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18682. * This program are made available under the terms of the Apache License, Version 2.0
  18683. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18684. /**
  18685. * @class SuperMap.DensityAnalystService
  18686. * @category iServer SpatialAnalyst DensityAnalyst
  18687. * @classdesc
  18688. * 密度分析服务类,密度分析可计算每个输出栅格像元周围圆形邻域内输入的点或线对象的密度。
  18689. * 密度分析,在某种意义上来说,相当于在表面上将输入的点线对象的测量值散开来,将每个点或线对象的测量量分布在整个研究区域,并计算输出栅格中每个像元的密度值。目前提供1种密度分析:核密度分析(Kernel)。
  18690. * @param {string} url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst 。
  18691. * @param {Object} options - 参数。</br>
  18692. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  18693. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  18694. * @param {Object} [options.headers] - 请求头。
  18695. * @extends {SuperMap.SpatialAnalystBase}
  18696. * @example 例如:
  18697. * var myDensityAnalystService = new SuperMap.DensityAnalystService(url);
  18698. * myDensityAnalystService.on({
  18699. * "processCompleted": processCompleted,
  18700. * "processFailed": processFailed
  18701. * }
  18702. * );
  18703. */
  18704. class DensityAnalystService extends SpatialAnalystBase {
  18705. constructor(url, options) {
  18706. super(url, options);
  18707. /**
  18708. * @member {string} SuperMap.DensityAnalystService.prototype.mode
  18709. * @description 密度分析类型。
  18710. */
  18711. this.mode = null;
  18712. if (options) {
  18713. Util.extend(this, options);
  18714. }
  18715. this.CLASS_NAME = "SuperMap.DensityAnalystService";
  18716. }
  18717. /**
  18718. * @function SuperMap.DensityAnalystService.prototype.destroy
  18719. * @description 释放资源,将引用资源的属性置空。
  18720. */
  18721. destroy() {
  18722. super.destroy();
  18723. this.mode = null;
  18724. }
  18725. /**
  18726. * @function SuperMap.DensityAnalystService.prototype.processAsync
  18727. * @description 负责将客户端的查询参数传递到服务端。
  18728. * @param {SuperMap.DensityKernelAnalystParameters} parameter - 核密度分析参数。
  18729. */
  18730. processAsync(parameter) {
  18731. var me = this;
  18732. var parameterObject = new Object();
  18733. if (parameter instanceof DensityKernelAnalystParameters) {
  18734. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/densityanalyst/kernel');
  18735. me.mode = "kernel";
  18736. }
  18737. DensityKernelAnalystParameters.toObject(parameter, parameterObject);
  18738. var jsonParameters = Util.toJSON(parameterObject);
  18739. me.url = Util.urlAppend(me.url, 'returnContent=true');
  18740. me.request({
  18741. method: "POST",
  18742. data: jsonParameters,
  18743. scope: me,
  18744. success: me.serviceProcessCompleted,
  18745. failure: me.serviceProcessFailed
  18746. });
  18747. }
  18748. }
  18749. SuperMap.DensityAnalystService = DensityAnalystService;
  18750. ;// CONCATENATED MODULE: ./src/common/iServer/EditFeaturesParameters.js
  18751. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18752. * This program are made available under the terms of the Apache License, Version 2.0
  18753. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18754. /**
  18755. * @class SuperMap.EditFeaturesParameters
  18756. * @category iServer Data Feature
  18757. * @classdesc 数据服务中数据集添加、修改、删除参数类。
  18758. * @category iServer Data
  18759. * @param {Object} options - 参数。
  18760. * @param {Array.<SuperMap.Feature.Vector|GeoJSONObject|ol.feature>} options.features - 当前需要创建或者是修改的要素集。
  18761. * @param {boolean} [options.returnContent=false] - 是返回创建要素的 ID 数组还是返回 featureResult 资源的 URI。
  18762. * @param {SuperMap.EditType} [options.editType=SuperMap.EditType.ADD] - POST 动作类型 (ADD、UPDATE、DELETE)。
  18763. * @param {Array.<string|integer>} [options.IDs] - 删除要素时的要素的 ID 数组。
  18764. */
  18765. class EditFeaturesParameters {
  18766. constructor(options) {
  18767. /**
  18768. * @member {string} SuperMap.EditFeaturesParameters.prototype.dataSourceName
  18769. * @description 当前需要创建或者是修改的要素的数据源。
  18770. */
  18771. this.dataSourceName = null;
  18772. /**
  18773. * @member {string} SuperMap.EditFeaturesParameters.prototype.dataSetName
  18774. * @description 当前需要创建或者是修改的要素的数据集。
  18775. */
  18776. this.dataSetName = null;
  18777. /**
  18778. * @member {Array.<SuperMap.Feature.Vector|GeoJSONObject|ol.feature>} SuperMap.EditFeaturesParameters.prototype.features
  18779. * @description 当前需要创建或者是修改的要素集。
  18780. */
  18781. this.features = null;
  18782. /**
  18783. * @member {SuperMap.EditType} [SuperMap.EditFeaturesParameters.prototype.editType=SuperMap.EditType.ADD]
  18784. * @description 要素集更新类型 (add、update、delete)。
  18785. */
  18786. this.editType = EditType.ADD;
  18787. /**
  18788. * @member {Array.<string|number>} [SuperMap.EditFeaturesParameters.prototype.IDs]
  18789. * @description 执行删除时要素集 ID 集合。
  18790. */
  18791. this.IDs = null;
  18792. /**
  18793. * @member {boolean} [SuperMap.EditFeaturesParameters.prototype.returnContent=false]
  18794. * @description 要素添加时,isUseBatch 不传或传为 false 的情况下有效。
  18795. * true 表示直接返回新创建的要素的 ID 数组;false 表示返回创建的 featureResult 资源的 URI。
  18796. */
  18797. this.returnContent = false;
  18798. /**
  18799. * @member {boolean} [SuperMap.EditFeaturesParameters.prototype.isUseBatch=false]
  18800. * @description 是否使用批量添加要素功能,要素添加时有效。批量添加能够提高要素编辑效率。true 表示批量添加;false 表示不使用批量添加。
  18801. */
  18802. this.isUseBatch = false;
  18803. Util.extend(this, options);
  18804. this.CLASS_NAME = "SuperMap.EditFeaturesParameters";
  18805. }
  18806. /**
  18807. * @function SuperMap.EditFeaturesParameters.prototype.destroy
  18808. * @description 释放资源,将引用资源的属性置空。
  18809. */
  18810. destroy() {
  18811. var me = this;
  18812. me.dataSourceName = null;
  18813. me.dataSetName = null;
  18814. me.features = null;
  18815. me.editType = null;
  18816. me.IDs = null;
  18817. me.returnContent = null;
  18818. }
  18819. /**
  18820. * @function SuperMap.EditFeaturesParameters.prototype.toJsonParameters
  18821. * @description 将 EditFeaturesParameters 对象参数转换为 JSON 字符串。
  18822. * @param {SuperMap.EditFeaturesParameters} params - 地物编辑参数。
  18823. * @returns {string} JSON 字符串。
  18824. */
  18825. static toJsonParameters(params) {
  18826. var feature,
  18827. len,
  18828. features,
  18829. editType = params.editType;
  18830. if (editType === EditType.DELETE) {
  18831. if (params.IDs === null) {
  18832. return;
  18833. }
  18834. features = {ids: params.IDs};
  18835. } else {
  18836. features = [];
  18837. if (params.features) {
  18838. len = params.features.length;
  18839. for (var i = 0; i < len; i++) {
  18840. feature = params.features[i];
  18841. feature.geometry = ServerGeometry.fromGeometry(feature.geometry);
  18842. features.push(feature);
  18843. }
  18844. }
  18845. }
  18846. return Util.toJSON(features);
  18847. }
  18848. }
  18849. SuperMap.EditFeaturesParameters = EditFeaturesParameters;
  18850. ;// CONCATENATED MODULE: ./src/common/iServer/EditFeaturesService.js
  18851. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18852. * This program are made available under the terms of the Apache License, Version 2.0
  18853. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18854. /**
  18855. * @class SuperMap.EditFeaturesService
  18856. * @category iServer Data Feature
  18857. * @classdesc 数据服务中数据集添加、更新、删除服务类。
  18858. * @extends {SuperMap.CommonServiceBase}
  18859. * @param {string} url - 服务端的数据服务资源地址。请求数据服务中数据集编辑服务,URL 应为:</br>
  18860. * http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/datasources/name/{数据源名}/datasets/name/{数据集名} 。</br>
  18861. * 例如:http://localhost:8090/iserver/services/data-jingjin/rest/data/datasources/name/Jingjin/datasets/name/Landuse_R
  18862. * @param {Object} options - 参数。</br>
  18863. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  18864. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  18865. * @param {SuperMap.DataFormat} [format] -查询结果返回格式,目前支持iServerJSON 和GeoJSON两种格式。参数格式为"ISERVER","GEOJSON"。
  18866. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  18867. * @param {Object} [options.headers] - 请求头。
  18868. * @example
  18869. * var myService = new SuperMap.EditFeaturesService(url, {eventListeners: {
  18870. * "processCompleted": editFeatureCompleted,
  18871. * "processFailed": editFeatureError
  18872. * }
  18873. * };
  18874. *
  18875. */
  18876. class EditFeaturesService extends CommonServiceBase {
  18877. constructor(url, options) {
  18878. super(url, options);
  18879. /**
  18880. * @member {boolean} [SuperMap.EditFeaturesService.prototype.returnContent=false]
  18881. * @description要素添加时,isUseBatch 不传或传为 false 的情况下有效。true 表示直接返回新创建的要素的 ID 数组;false 表示返回创建的 featureResult 资源的 URI。
  18882. */
  18883. this.returnContent = false;
  18884. /**
  18885. * @member {boolean} [SuperMap.EditFeaturesService.prototype.isUseBatch=false]
  18886. * @description 是否使用批量添加要素功能,要素添加时有效。
  18887. * 批量添加能够提高要素编辑效率。
  18888. * true 表示批量添加;false 表示不使用批量添加。
  18889. */
  18890. this.isUseBatch = false;
  18891. if (options) {
  18892. Util.extend(this, options);
  18893. }
  18894. this.url = Util.urlPathAppend(this.url, 'features');
  18895. this.CLASS_NAME = "SuperMap.EditFeaturesService";
  18896. }
  18897. /**
  18898. * @function SuperMap.EditFeaturesService.prototype.destroy
  18899. * @override
  18900. */
  18901. destroy() {
  18902. super.destroy();
  18903. var me = this;
  18904. me.returnContent = null;
  18905. me.isUseBatch = null;
  18906. me.fromIndex = null;
  18907. me.toIndex = null;
  18908. }
  18909. /**
  18910. * @function SuperMap.EditFeaturesService.prototype.processAsync
  18911. * @description 负责将客户端的更新参数传递到服务端。
  18912. * @param {SuperMap.EditFeaturesParameters} params - 编辑要素参数。
  18913. */
  18914. processAsync(params) {
  18915. if (!(params instanceof EditFeaturesParameters)) {
  18916. return;
  18917. }
  18918. var me = this,
  18919. method = "POST",
  18920. ids = "",
  18921. editType = params.editType,
  18922. jsonParameters = null;
  18923. me.returnContent = params.returnContent;
  18924. me.isUseBatch = params.isUseBatch;
  18925. jsonParameters = EditFeaturesParameters.toJsonParameters(params);
  18926. if (editType === EditType.DELETE) {
  18927. ids = Util.toJSON(params.IDs);
  18928. me.url = Util.urlAppend(me.url, "ids=" + ids);
  18929. method = "DELETE";
  18930. jsonParameters = ids;
  18931. } else if (editType === EditType.UPDATE) {
  18932. method = "PUT";
  18933. } else {
  18934. if (me.isUseBatch) {
  18935. me.url = Util.urlAppend(me.url, `isUseBatch=${me.isUseBatch}`);
  18936. me.returnContent = false;
  18937. }
  18938. if (me.returnContent) {
  18939. me.url = Util.urlAppend(me.url, 'returnContent=true');
  18940. method = "POST";
  18941. }
  18942. }
  18943. me.request({
  18944. method: method,
  18945. data: jsonParameters,
  18946. scope: me,
  18947. success: me.serviceProcessCompleted,
  18948. failure: me.serviceProcessFailed
  18949. });
  18950. }
  18951. }
  18952. SuperMap.EditFeaturesService = EditFeaturesService;
  18953. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalyst3DParameters.js
  18954. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18955. * This program are made available under the terms of the Apache License, Version 2.0
  18956. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18957. /**
  18958. * @class SuperMap.FacilityAnalyst3DParameters
  18959. * @category iServer FacilityAnalyst3D
  18960. * @classdesc 最近设施分析参数基类。最近设施分析是指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  18961. * 设施点一般为学校、超市、加油站等服务设施;事件点为需要服务设施的事件位置。例如事件发生点是一起交通事故,要求查找在 10 分钟内能到达的最近医院,
  18962. * 超过 10 分钟能到达的都不予考虑。此例中,事故发生地即是一个事件点,周边的医院则是设施点。最近设施查找实际上也是一种路径分析,因此对路径分析起
  18963. * 作用的障碍边、障碍点、转向表、耗费等属性在最近设施分析时同样可设置。
  18964. * @param {Object} options - 参数。
  18965. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  18966. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  18967. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  18968. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  18969. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  18970. */
  18971. class FacilityAnalyst3DParameters {
  18972. constructor(options) {
  18973. /**
  18974. * @member {number} [SuperMap.FacilityAnalyst3DParameters.prototype.edgeID]
  18975. * @description 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  18976. */
  18977. this.edgeID = null;
  18978. /**
  18979. * @member {number} [SuperMap.FacilityAnalyst3DParameters.prototype.nodeID]
  18980. * @description 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  18981. */
  18982. this.nodeID = null;
  18983. /**
  18984. * @member {string} SuperMap.FacilityAnalyst3DParameters.prototype.weightName
  18985. * @description 指定的权值字段信息对象的名称。
  18986. */
  18987. this.weightName = null;
  18988. /**
  18989. * @member {boolean} [SuperMap.FacilityAnalyst3DParameters.prototype.isUncertainDirectionValid=false]
  18990. * @description 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  18991. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找
  18992. */
  18993. this.isUncertainDirectionValid = false;
  18994. Util.extend(this, options);
  18995. this.CLASS_NAME = "SuperMap.FacilityAnalyst3DParameters";
  18996. }
  18997. /**
  18998. * @function SuperMap.FacilityAnalyst3DParameters.prototype.destroy
  18999. * @override
  19000. */
  19001. destroy() {
  19002. var me = this;
  19003. me.edgeID = null;
  19004. me.nodeID = null;
  19005. me.weightName = null;
  19006. me.isUncertainDirectionValid = null;
  19007. }
  19008. }
  19009. SuperMap.FacilityAnalyst3DParameters = FacilityAnalyst3DParameters;
  19010. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSinks3DParameters.js
  19011. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19012. * This program are made available under the terms of the Apache License, Version 2.0
  19013. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19014. /**
  19015. * @class SuperMap.FacilityAnalystSinks3DParameters
  19016. * @category iServer FacilityAnalyst3D Sinks
  19017. * @classdesc 最近设施分析参数类(汇查找资源)。最近设施分析是指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  19018. * 设施点一般为学校、超市、加油站等服务设施;事件点为需要服务设施的事件位置。例如事件发生点是一起交通事故,要求查找在10分钟内能到达的最近医院,超过10分钟
  19019. * 能到达的都不予考虑。此例中,事故发生地即是一个事件点,周边的医院则是设施点。最近设施查找实际上也是一种路径分析,因此对路径分析起作用的障碍边、障碍点、
  19020. * 转向表、耗费等属性在最近设施分析时同样可设置。
  19021. * @extends {SuperMap.FacilityAnalyst3DParameters}
  19022. * @param {Object} options - 参数。
  19023. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  19024. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  19025. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  19026. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  19027. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  19028. */
  19029. class FacilityAnalystSinks3DParameters extends FacilityAnalyst3DParameters {
  19030. constructor(options) {
  19031. super(options);
  19032. this.CLASS_NAME = "SuperMap.FacilityAnalystSinks3DParameters";
  19033. }
  19034. /**
  19035. * @function SuperMap.FacilityAnalystSinks3DParameters.prototype.destroy
  19036. * @override
  19037. */
  19038. destroy() {
  19039. super.destroy();
  19040. }
  19041. }
  19042. SuperMap.FacilityAnalystSinks3DParameters = FacilityAnalystSinks3DParameters;
  19043. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSinks3DService.js
  19044. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19045. * This program are made available under the terms of the Apache License, Version 2.0
  19046. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19047. /**
  19048. * @class SuperMap.FacilityAnalystSinks3DService
  19049. * @category iServer FacilityAnalyst3D Sinks
  19050. * @classdesc 最近设施分析服务类(汇查找资源)<br>
  19051. * 最近设施分析是指在网络上给定一个事件点和一组设施点,
  19052. * 查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  19053. * 该类负责将客户端指定的最近设施分析参数传递给服务端,并接收服务端返回的结果数据。
  19054. * 最近设施分析结果通过该类支持的事件的监听函数参数获取
  19055. * @extends {SuperMap.CommonServiceBase}
  19056. * @example
  19057. * var myFacilityAnalystSinks3DService = new SuperMap.FacilityAnalystSinks3DService(url, {
  19058. * eventListeners: {
  19059. * "processCompleted": facilityAnalystSinks3DCompleted,
  19060. * "processFailed": facilityAnalystSinks3DError
  19061. * }
  19062. * });
  19063. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:<br>
  19064. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};<br>
  19065. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。<br>
  19066. * @param {Object} options - 参数。<br>
  19067. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  19068. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  19069. * @param {Object} [options.headers] - 请求头。
  19070. */
  19071. class FacilityAnalystSinks3DService extends CommonServiceBase {
  19072. constructor(url, options) {
  19073. super(url, options);
  19074. this.CLASS_NAME = "SuperMap.FacilityAnalystSinks3DService";
  19075. }
  19076. /**
  19077. * @function SuperMap.FacilityAnalystSinks3DService.prototype.destroy
  19078. * @override
  19079. */
  19080. destroy() {
  19081. CommonServiceBase.prototype.destroy.apply(this, arguments);
  19082. }
  19083. /**
  19084. * @function SuperMap.FacilityAnalystSinks3DService.prototype.processAsync
  19085. * @description 负责将客户端的查询参数传递到服务端。
  19086. * @param {SuperMap.FacilityAnalystSinks3DParameters} params - 最近设施分析参数类(汇查找资源)
  19087. */
  19088. processAsync(params) {
  19089. if (!(params instanceof FacilityAnalystSinks3DParameters)) {
  19090. return;
  19091. }
  19092. var me = this, jsonObject;
  19093. me.url = Util.urlPathAppend(me.url, 'sinks');
  19094. jsonObject = {
  19095. edgeID: params.edgeID,
  19096. nodeID: params.nodeID,
  19097. weightName: params.weightName,
  19098. isUncertainDirectionValid: params.isUncertainDirectionValid
  19099. };
  19100. me.request({
  19101. method: "GET",
  19102. params: jsonObject,
  19103. scope: me,
  19104. success: me.serviceProcessCompleted,
  19105. failure: me.serviceProcessFailed
  19106. });
  19107. }
  19108. }
  19109. SuperMap.FacilityAnalystSinks3DService = FacilityAnalystSinks3DService;
  19110. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSources3DParameters.js
  19111. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19112. * This program are made available under the terms of the Apache License, Version 2.0
  19113. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19114. /**
  19115. * @class SuperMap.FacilityAnalystSources3DParameters
  19116. * @category iServer FacilityAnalyst3D Sources
  19117. * @classdesc 最近设施分析参数类(源查找资源)。最近设施分析是指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  19118. * 设施点一般为学校、超市、加油站等服务设施;事件点为需要服务设施的事件位置。例如事件发生点是一起交通事故,要求查找在10分钟内能到达的最近医院,超过10分
  19119. * 钟能到达的都不予考虑。此例中,事故发生地即是一个事件点,周边的医院则是设施点。最近设施查找实际上也是一种路径分析,因此对路径分析起作用的障碍边、障碍
  19120. * 点、转向表、耗费等属性在最近设施分析时同样可设置。
  19121. * @extends {SuperMap.FacilityAnalyst3DParameters}
  19122. * @param {Object} options - 参数。
  19123. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  19124. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  19125. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  19126. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  19127. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  19128. */
  19129. class FacilityAnalystSources3DParameters extends FacilityAnalyst3DParameters {
  19130. constructor(options) {
  19131. super(options);
  19132. this.CLASS_NAME = "SuperMap.FacilityAnalystSources3DParameters";
  19133. }
  19134. /**
  19135. * @function SuperMap.FacilityAnalystSources3DParameters.prototype.destroy
  19136. * @override
  19137. */
  19138. destroy() {
  19139. super.destroy();
  19140. }
  19141. }
  19142. SuperMap.FacilityAnalystSources3DParameters = FacilityAnalystSources3DParameters;
  19143. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSources3DService.js
  19144. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19145. * This program are made available under the terms of the Apache License, Version 2.0
  19146. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19147. /**
  19148. * @class SuperMap.FacilityAnalystSources3DService
  19149. * @category iServer FacilityAnalyst3D Sources
  19150. * @classdesc 最近设施分析服务类(源查找资源)
  19151. * 最近设施分析是指在网络上给定一个事件点和一组设施点,
  19152. * 查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  19153. * 该类负责将客户端指定的最近设施分析参数传递给服务端,并接收服务端返回的结果数据。
  19154. * 最近设施分析结果通过该类支持的事件的监听函数参数获取。
  19155. * @extends {SuperMap.CommonServiceBase}
  19156. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  19157. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  19158. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  19159. * @param {Object} options - 参数。
  19160. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  19161. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  19162. * @param {Object} [options.headers] - 请求头。
  19163. */
  19164. class FacilityAnalystSources3DService extends CommonServiceBase {
  19165. constructor(url, options) {
  19166. super(url, options);
  19167. this.CLASS_NAME = "SuperMap.FacilityAnalystSources3DService";
  19168. }
  19169. /**
  19170. * @function SuperMap.FacilityAnalystSources3DService.prototype.destroy
  19171. * @override
  19172. */
  19173. destroy() {
  19174. super.destroy();
  19175. }
  19176. /**
  19177. * @function SuperMap.FacilityAnalystSources3DService.prototype.processAsync
  19178. * @description 负责将客户端的查询参数传递到服务端。
  19179. * @param {SuperMap.FacilityAnalystSources3DParameters} params - 最近设施分析参数类(源查找资源)
  19180. */
  19181. processAsync(params) {
  19182. if (!(params instanceof FacilityAnalystSources3DParameters)) {
  19183. return;
  19184. }
  19185. var me = this, jsonObject;
  19186. me.url = Util.urlPathAppend(me.url, 'sources');
  19187. jsonObject = {
  19188. edgeID: params.edgeID,
  19189. nodeID: params.nodeID,
  19190. weightName: params.weightName,
  19191. isUncertainDirectionValid: params.isUncertainDirectionValid
  19192. };
  19193. me.request({
  19194. method: "GET",
  19195. params: jsonObject,
  19196. scope: me,
  19197. success: me.serviceProcessCompleted,
  19198. failure: me.serviceProcessFailed
  19199. });
  19200. }
  19201. }
  19202. SuperMap.FacilityAnalystSources3DService = FacilityAnalystSources3DService;
  19203. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystStreamParameters.js
  19204. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19205. * This program are made available under the terms of the Apache License, Version 2.0
  19206. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19207. /**
  19208. * @class SuperMap.FacilityAnalystStreamParameters
  19209. * @category iServer NetworkAnalyst UpstreamCriticalFacilities
  19210. * @classdesc 上游/下游关键设施查找资源参数类。
  19211. * @param {Object} options - 参数。
  19212. * @param {Array.<number>} options.sourceNodeIDs - 指定的设施点 ID 数组。
  19213. * @param {number} options.queryType - 分析类型,只能是 0 (上游关键设施查询) 或者是 1(下游关键设施查询)。
  19214. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  19215. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  19216. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。
  19217. */
  19218. class FacilityAnalystStreamParameters {
  19219. constructor(options) {
  19220. /**
  19221. * @member {Array.<number>} [SuperMap.FacilityAnalystStreamParameters.prototype.sourceNodeIDs]
  19222. * @description 指定的设施点 ID 数组。
  19223. */
  19224. this.sourceNodeIDs = null;
  19225. /**
  19226. * @member {number} [SuperMap.FacilityAnalystStreamParameters.prototype.edgeID]
  19227. * @description 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  19228. */
  19229. this.edgeID = null;
  19230. /**
  19231. * @member {number} [SuperMap.FacilityAnalystStreamParameters.prototype.nodeID]
  19232. * @description 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  19233. */
  19234. this.nodeID = null;
  19235. /**
  19236. * @member {boolean} [SuperMap.FacilityAnalystStreamParameters.prototype.isUncertainDirectionValid=false]
  19237. * @description 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  19238. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  19239. */
  19240. this.isUncertainDirectionValid = false;
  19241. /**
  19242. * @member {number} SuperMap.FacilityAnalystStreamParameters.prototype.queryType
  19243. * @description 分析类型,只能是 0 (上游关键设施查询) 或者是 1(下游关键设施查询)。
  19244. */
  19245. this.queryType = null;
  19246. Util.extend(this, options);
  19247. this.CLASS_NAME = "SuperMap.FacilityAnalystStreamParameters";
  19248. }
  19249. /**
  19250. * @function SuperMap.FacilityAnalystStreamParameters.prototype.destroy
  19251. * @description 释放资源,将引用资源的属性置空。
  19252. */
  19253. destroy() {
  19254. var me = this;
  19255. me.edgeID = null;
  19256. me.nodeID = null;
  19257. me.weightName = null;
  19258. me.isUncertainDirectionValid = null;
  19259. me.type = null;
  19260. }
  19261. }
  19262. SuperMap.FacilityAnalystStreamParameters = FacilityAnalystStreamParameters;
  19263. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystStreamService.js
  19264. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19265. * This program are made available under the terms of the Apache License, Version 2.0
  19266. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19267. /**
  19268. * @class SuperMap.FacilityAnalystStreamService
  19269. * @category iServer NetworkAnalyst UpstreamCriticalFacilities
  19270. * @classdesc 上游/下游 关键设施查找资源服务类;即查找给定弧段或节点的上游/下游中的关键设施结点,返回关键结点 ID 数组及其下游弧段 ID 数组。
  19271. * @extends SuperMap.NetworkAnalystServiceBase
  19272. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  19273. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  19274. * 例如: "http://localhost:8090/iserver/services/test/rest/networkanalyst/WaterNet@FacilityNet";
  19275. * @param {Object} options - 参数。
  19276. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  19277. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  19278. * @param {Object} [options.headers] - 请求头。
  19279. */
  19280. class FacilityAnalystStreamService extends NetworkAnalystServiceBase {
  19281. constructor(url, options) {
  19282. super(url, options);
  19283. this.CLASS_NAME = "SuperMap.FacilityAnalystStreamService";
  19284. }
  19285. /**
  19286. * @function SuperMap.FacilityAnalystStreamService.prototype.destroy
  19287. * @override
  19288. */
  19289. destroy() {
  19290. super.destroy();
  19291. }
  19292. /**
  19293. * @function SuperMap.FacilityAnalystStreamService.prototype.processAsync
  19294. * @description 负责将客户端的查询参数传递到服务端。
  19295. * @param {SuperMap.FacilityAnalystStreamParameters} params - 上游/下游关键设施查找资源参数类。
  19296. */
  19297. processAsync(params) {
  19298. if (!(params instanceof FacilityAnalystStreamParameters)) {
  19299. return;
  19300. }
  19301. var me = this,
  19302. jsonObject;
  19303. //URL 通过参数类型来判断是 上游 还是下游 查询
  19304. if (params.queryType === 0) {
  19305. me.url = Util.urlPathAppend(me.url, 'upstreamcirticalfaclilities');
  19306. } else if (params.queryType === 1) {
  19307. me.url = Util.urlPathAppend(me.url, 'downstreamcirticalfaclilities');
  19308. } else {
  19309. return;
  19310. }
  19311. jsonObject = {
  19312. sourceNodeIDs: params.sourceNodeIDs,
  19313. isUncertainDirectionValid: params.isUncertainDirectionValid
  19314. };
  19315. if (params.edgeID !== null && params.nodeID !== null) {
  19316. return;
  19317. }
  19318. if (params.edgeID === null && params.nodeID === null) {
  19319. return;
  19320. }
  19321. if (params.edgeID !== null) {
  19322. jsonObject.edgeID = params.edgeID;
  19323. } else {
  19324. jsonObject.nodeID = params.nodeID;
  19325. }
  19326. me.request({
  19327. method: "GET",
  19328. params: jsonObject,
  19329. scope: me,
  19330. success: me.serviceProcessCompleted,
  19331. failure: me.serviceProcessFailed
  19332. });
  19333. }
  19334. }
  19335. SuperMap.FacilityAnalystStreamService = FacilityAnalystStreamService;
  19336. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTracedown3DParameters.js
  19337. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19338. * This program are made available under the terms of the Apache License, Version 2.0
  19339. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19340. /**
  19341. * @class SuperMap.FacilityAnalystTracedown3DParameters
  19342. * @category iServer FacilityAnalyst3D TraceDownResult
  19343. * @classdesc 下游追踪资源参数类。
  19344. * @extends {SuperMap.FacilityAnalyst3DParameters}
  19345. * @param {Object} options - 参数。
  19346. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  19347. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  19348. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  19349. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  19350. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  19351. */
  19352. class FacilityAnalystTracedown3DParameters extends FacilityAnalyst3DParameters {
  19353. constructor(options) {
  19354. super(options);
  19355. this.CLASS_NAME = "SuperMap.FacilityAnalystTracedown3DParameters";
  19356. }
  19357. /**
  19358. * @function SuperMap.FacilityAnalystTracedown3DParameters.prototype.destroy
  19359. * @override
  19360. */
  19361. destroy() {
  19362. super.destroy();
  19363. }
  19364. }
  19365. SuperMap.FacilityAnalystTracedown3DParameters = FacilityAnalystTracedown3DParameters;
  19366. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTracedown3DService.js
  19367. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19368. * This program are made available under the terms of the Apache License, Version 2.0
  19369. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19370. /**
  19371. * @class SuperMap.FacilityAnalystTracedown3DService
  19372. * @category iServer FacilityAnalyst3D TraceDownResult
  19373. * @classdesc 下游追踪资源服务类
  19374. * @extends {SuperMap.CommonServiceBase}
  19375. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  19376. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  19377. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  19378. * @param {Object} options - 参数。
  19379. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  19380. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  19381. * @param {Object} [options.headers] - 请求头。
  19382. */
  19383. class FacilityAnalystTracedown3DService extends CommonServiceBase {
  19384. constructor(url, options) {
  19385. super(url, options);
  19386. this.CLASS_NAME = "SuperMap.FacilityAnalystTracedown3DService";
  19387. }
  19388. /**
  19389. * @function SuperMap.FacilityAnalystTracedown3DService.prototype.destroy
  19390. * @override
  19391. */
  19392. destroy() {
  19393. super.destroy();
  19394. }
  19395. /**
  19396. * @function SuperMap.FacilityAnalystTracedown3DService.prototype.processAsync
  19397. * @description 负责将客户端的查询参数传递到服务端。
  19398. * @param {SuperMap.FacilityAnalystTracedown3DParameters} params - 下游追踪资源参数类。
  19399. */
  19400. processAsync(params) {
  19401. if (!(params instanceof FacilityAnalystTracedown3DParameters)) {
  19402. return;
  19403. }
  19404. var me = this, jsonObject;
  19405. me.url = Util.urlPathAppend(me.url, 'tracedownresult');
  19406. jsonObject = {
  19407. edgeID: params.edgeID,
  19408. nodeID: params.nodeID,
  19409. weightName: params.weightName,
  19410. isUncertainDirectionValid: params.isUncertainDirectionValid
  19411. };
  19412. me.request({
  19413. method: "GET",
  19414. params: jsonObject,
  19415. scope: me,
  19416. success: me.serviceProcessCompleted,
  19417. failure: me.serviceProcessFailed
  19418. });
  19419. }
  19420. }
  19421. SuperMap.FacilityAnalystTracedown3DService = FacilityAnalystTracedown3DService;
  19422. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTraceup3DParameters.js
  19423. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19424. * This program are made available under the terms of the Apache License, Version 2.0
  19425. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19426. /**
  19427. * @class SuperMap.FacilityAnalystTraceup3DParameters
  19428. * @category iServer FacilityAnalyst3D TraceUpResult
  19429. * @classdesc 上游追踪资源参数类。
  19430. * @extends {SuperMap.FacilityAnalyst3DParameters}
  19431. * @param {Object} options - 参数。
  19432. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  19433. * @param {number} [options.edgeID] - 指定的弧段ID,edgeID 与 nodeID 必须指定一个。
  19434. * @param {number} [options.nodeID] - 指定的结点ID,edgeID 与 nodeID 必须指定一个。
  19435. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  19436. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  19437. */
  19438. class FacilityAnalystTraceup3DParameters extends FacilityAnalyst3DParameters {
  19439. constructor(options) {
  19440. super(options);
  19441. this.CLASS_NAME = "SuperMap.FacilityAnalystTraceup3DParameters";
  19442. }
  19443. /**
  19444. * @function SuperMap.FacilityAnalystTraceup3DParameters.prototype.destroy
  19445. * @override
  19446. */
  19447. destroy() {
  19448. super.destroy();
  19449. }
  19450. }
  19451. SuperMap.FacilityAnalystTraceup3DParameters = FacilityAnalystTraceup3DParameters;
  19452. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTraceup3DService.js
  19453. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19454. * This program are made available under the terms of the Apache License, Version 2.0
  19455. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19456. /**
  19457. * @class SuperMap.FacilityAnalystTraceup3DService
  19458. * @category iServer FacilityAnalyst3D TraceUpResult
  19459. * @classdesc 上游追踪资源服务类
  19460. * @extends {SuperMap.CommonServiceBase}
  19461. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  19462. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  19463. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  19464. * @param {Object} options - 参数。
  19465. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  19466. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  19467. * @param {Object} [options.headers] - 请求头。
  19468. */
  19469. class FacilityAnalystTraceup3DService extends CommonServiceBase {
  19470. /**
  19471. * @function SuperMap.FacilityAnalystTraceup3DService.constructor
  19472. * @description 上游追踪资源服务类构造函数。
  19473. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  19474. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  19475. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  19476. * @param {Object} options - 参数。
  19477. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  19478. */
  19479. constructor(url, options) {
  19480. super(url, options);
  19481. this.CLASS_NAME = "SuperMap.FacilityAnalystTraceup3DService";
  19482. }
  19483. /**
  19484. * @function SuperMap.FacilityAnalystTraceup3DService.prototype.destroy
  19485. * @override
  19486. */
  19487. destroy() {
  19488. super.destroy();
  19489. }
  19490. /**
  19491. * @function SuperMap.FacilityAnalystTraceup3DService.prototype.processAsync
  19492. * @description 负责将客户端的查询参数传递到服务端。
  19493. * @param {SuperMap.FacilityAnalystTraceup3DParameters} params - 上游追踪资源参数类
  19494. */
  19495. processAsync(params) {
  19496. if (!(params instanceof FacilityAnalystTraceup3DParameters)) {
  19497. return;
  19498. }
  19499. var me = this, jsonObject;
  19500. me.url = Util.urlPathAppend(me.url, 'traceupresult');
  19501. jsonObject = {
  19502. edgeID: params.edgeID,
  19503. nodeID: params.nodeID,
  19504. weightName: params.weightName,
  19505. isUncertainDirectionValid: params.isUncertainDirectionValid
  19506. };
  19507. me.request({
  19508. method: "GET",
  19509. params: jsonObject,
  19510. scope: me,
  19511. success: me.serviceProcessCompleted,
  19512. failure: me.serviceProcessFailed
  19513. });
  19514. }
  19515. }
  19516. SuperMap.FacilityAnalystTraceup3DService = FacilityAnalystTraceup3DService;
  19517. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystUpstream3DParameters.js
  19518. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19519. * This program are made available under the terms of the Apache License, Version 2.0
  19520. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19521. /**
  19522. * @class SuperMap.FacilityAnalystUpstream3DParameters
  19523. * @category iServer FacilityAnalyst3D UpstreamCriticalFacilities
  19524. * @classdesc 上游关键设施查找资源参数类。
  19525. * @extends {SuperMap.FacilityAnalyst3DParameters}
  19526. * @param {Object} options - 参数。
  19527. * @param {Array.<number>} options.sourceNodeIDs - 指定的设施点 ID 数组。
  19528. * @param {number} [options.edgeID] - 指定的弧段ID。edgeID 与 nodeID 必须指定一个。
  19529. * @param {number} [options.nodeID] - 指定的结点ID。edgeID 与 edgeID 必须指定一个。
  19530. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  19531. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  19532. */
  19533. class FacilityAnalystUpstream3DParameters extends FacilityAnalyst3DParameters {
  19534. constructor(options) {
  19535. super(options);
  19536. options = options || {};
  19537. this.sourceNodeIDs = null;
  19538. Util.extend(this, options);
  19539. this.CLASS_NAME = "SuperMap.FacilityAnalystUpstream3DParameters";
  19540. }
  19541. /**
  19542. * @function SuperMap.FacilityAnalystUpstream3DParameters.prototype.destroy
  19543. * @override
  19544. */
  19545. destroy() {
  19546. super.destroy();
  19547. this.sourceNodeIDs = null;
  19548. }
  19549. }
  19550. SuperMap.FacilityAnalystUpstream3DParameters = FacilityAnalystUpstream3DParameters;
  19551. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystUpstream3DService.js
  19552. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19553. * This program are made available under the terms of the Apache License, Version 2.0
  19554. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19555. /**
  19556. * @class SuperMap.FacilityAnalystUpstream3DService
  19557. * @category iServer FacilityAnalyst3D UpstreamCriticalFacilities
  19558. * @classdesc 上游关键设施查找资源服务类
  19559. * @extends {SuperMap.CommonServiceBase}
  19560. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  19561. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  19562. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  19563. * @param {Object} options - 参数。
  19564. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  19565. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  19566. * @param {Object} [options.headers] - 请求头。
  19567. */
  19568. class FacilityAnalystUpstream3DService extends CommonServiceBase {
  19569. constructor(url, options) {
  19570. super(url, options);
  19571. this.CLASS_NAME = "SuperMap.FacilityAnalystUpstream3DService";
  19572. }
  19573. /**
  19574. * @function SuperMap.FacilityAnalystUpstream3DService.prototype.destroy
  19575. * @override
  19576. */
  19577. destroy() {
  19578. super.destroy();
  19579. }
  19580. /**
  19581. * @function SuperMap.FacilityAnalystUpstream3DService.prototype.processAsync
  19582. * @description 负责将客户端的查询参数传递到服务端。
  19583. * @param {SuperMap.FacilityAnalystUpstream3DParameters} params - 上游关键设施查找资源参数类
  19584. */
  19585. processAsync(params) {
  19586. if (!(params instanceof FacilityAnalystUpstream3DParameters)) {
  19587. return;
  19588. }
  19589. var me = this, jsonObject;
  19590. me.url = Util.urlPathAppend(me.url, 'upstreamcirticalfaclilities');
  19591. jsonObject = {
  19592. sourceNodeIDs: params.sourceNodeIDs,
  19593. edgeID: params.edgeID,
  19594. nodeID: params.nodeID,
  19595. isUncertainDirectionValid: params.isUncertainDirectionValid
  19596. };
  19597. me.request({
  19598. method: "GET",
  19599. params: jsonObject,
  19600. scope: me,
  19601. success: me.serviceProcessCompleted,
  19602. failure: me.serviceProcessFailed
  19603. });
  19604. }
  19605. }
  19606. SuperMap.FacilityAnalystUpstream3DService = FacilityAnalystUpstream3DService;
  19607. ;// CONCATENATED MODULE: ./src/common/iServer/FilterAggParameter.js
  19608. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19609. * This program are made available under the terms of the Apache License, Version 2.0
  19610. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19611. /**
  19612. * @class SuperMap.FilterAggParameter
  19613. * @classdesc 过滤条件参数设置,该参数仅支持数据来源 Elasticsearch 服务的数据服务。
  19614. * @category iServer Data FeatureResults
  19615. * @param {Object} options - 初始化参数。
  19616. * @param {SuperMap.AggQueryBuilderParameter} options.filterParam - 过滤条件参数设置类。
  19617. * @param {SuperMap.AggregationType} [options.aggType=AggregationType.FILTER] - 聚合类型。
  19618. */
  19619. class FilterAggParameter extends AggregationParameter {
  19620. constructor(options) {
  19621. super(options);
  19622. /**
  19623. * @member {SuperMap.AggQueryBuilderParameter} SuperMap.FilterAggParameter.prototype.filterParam
  19624. * @description 过滤条件参数设置类。
  19625. */
  19626. this.filterParam = null;
  19627. /**
  19628. * @member {SuperMap.AggregationType} [SuperMap.FilterAggParameter.prototype.aggType=AggregationType.FILTER]
  19629. * @description 聚合类型。
  19630. */
  19631. this.aggType = AggregationType.FILTER;
  19632. this.CLASS_NAME = "SuperMap.FilterAggParameter";
  19633. Util.extend(this, options);
  19634. }
  19635. destroy() {
  19636. super.destroy();
  19637. var me = this;
  19638. if (me.filterParam) {
  19639. me.filterParam = null;
  19640. }
  19641. }
  19642. }
  19643. SuperMap.FilterAggParameter = FilterAggParameter;
  19644. ;// CONCATENATED MODULE: ./src/common/iServer/FieldParameters.js
  19645. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19646. * This program are made available under the terms of the Apache License, Version 2.0
  19647. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19648. /**
  19649. * @class SuperMap.FieldParameters
  19650. * @category iServer Data Field
  19651. * @classdesc 字段信息查询参数类。
  19652. * @param {Object} options - 参数。
  19653. * @param {string} options.datasource - 数据源名称。
  19654. * @param {string} options.dataset - 数据集名称。
  19655. */
  19656. class FieldParameters {
  19657. constructor(options) {
  19658. /**
  19659. * @member {string} SuperMap.FieldParameters.prototype.datasource
  19660. * @description 要查询的数据集所在的数据源名称。
  19661. */
  19662. this.datasource = null;
  19663. /**
  19664. * @member {string} SuperMap.FieldParameters.prototype.dataset
  19665. * @description 要查询的数据集名称。
  19666. */
  19667. this.dataset = null;
  19668. if (options) {
  19669. Util.extend(this, options);
  19670. }
  19671. this.CLASS_NAME = "SuperMap.FieldParameters";
  19672. }
  19673. /**
  19674. * @function SuperMap.FieldParameters.prototype.destroy
  19675. * @description 释放资源,将引用资源的属性置空。
  19676. */
  19677. destroy() {
  19678. var me = this;
  19679. me.datasource = null;
  19680. me.dataset = null;
  19681. }
  19682. }
  19683. SuperMap.FieldParameters = FieldParameters;
  19684. ;// CONCATENATED MODULE: ./src/common/iServer/FieldStatisticsParameters.js
  19685. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19686. * This program are made available under the terms of the Apache License, Version 2.0
  19687. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19688. /**
  19689. * @class SuperMap.FieldStatisticsParameters
  19690. * @category iServer Data Field
  19691. * @classdesc 字段统计信息查询参数类。
  19692. * @param {Object} options - 参数。
  19693. * @param {string} options.datasource - 数据源名称。
  19694. * @param {string} options.dataset - 数据集名称。
  19695. * @param {string} options.fieldName - 字段名。
  19696. * @param {(string.<SuperMap.StatisticMode>|Array.<string.<SuperMap.StatisticMode>>)} statisticMode - 字段统计方法类型。
  19697. * @extends {SuperMap.FieldParameters}
  19698. */
  19699. class FieldStatisticsParameters extends FieldParameters {
  19700. constructor(options) {
  19701. super(options);
  19702. /**
  19703. * @member {string} SuperMap.FieldStatisticsParameters.prototype.fieldName
  19704. * @description 字段名
  19705. */
  19706. this.fieldName = null;
  19707. /**
  19708. * @member {(string.<SuperMap.StatisticMode>|Array.<string.<SuperMap.StatisticMode>>)} SuperMap.FieldStatisticsParameters.prototype.statisticMode
  19709. * @description 字段统计方法类型
  19710. */
  19711. this.statisticMode = null;
  19712. if (options) {
  19713. Util.extend(this, options);
  19714. }
  19715. this.CLASS_NAME = "SuperMap.FieldStatisticsParameters";
  19716. }
  19717. /**
  19718. * @function SuperMap.FieldStatisticsParameters.prototype.destroy
  19719. * @description 释放资源,将引用资源的属性置空。
  19720. */
  19721. destroy() {
  19722. var me = this;
  19723. me.fieldName = null;
  19724. me.statisticMode = null;
  19725. }
  19726. }
  19727. SuperMap.FieldStatisticsParameters = FieldStatisticsParameters;
  19728. ;// CONCATENATED MODULE: ./src/common/iServer/FieldStatisticService.js
  19729. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19730. * This program are made available under the terms of the Apache License, Version 2.0
  19731. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19732. /**
  19733. * @class SuperMap.FieldStatisticService
  19734. * @category iServer Data Field
  19735. * @classdesc 字段查询统计服务类。用来完成对指定数据集指定字段的查询统计分析,即求平均值,最大值等。
  19736. * @extends {SuperMap.CommonServiceBase}
  19737. * @param {string} url - 服务的访问地址。如访问 World Map 服务,只需将 url 设为:http://localhost:8090/iserver/services/data-world/rest/data 即可。
  19738. * @param {Object} options - 参数。
  19739. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  19740. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  19741. * @param {SuperMap.DataFormat} [options.format] - 查询结果返回格式,目前支持 iServerJSON 和GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  19742. * @param {string} options.datasource - 数据集所在的数据源名称。
  19743. * @param {string} options.dataset - 数据集名称。
  19744. * @param {string} options.field - 查询统计的目标字段名称。
  19745. * @param {SuperMap.StatisticMode} options.statisticMode - 字段查询统计的方法类型。
  19746. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  19747. * @param {Object} [options.headers] - 请求头。
  19748. * @example
  19749. * var myService = new SuperMap.FieldStatisticService(url, {eventListeners: {
  19750. * "processCompleted": fieldStatisticCompleted,
  19751. * "processFailed": fieldStatisticError
  19752. * },
  19753. * datasource: "World",
  19754. * dataset: "Countries",
  19755. * field: "SmID",
  19756. * statisticMode: StatisticMode.AVERAGE
  19757. * };
  19758. */
  19759. class FieldStatisticService extends CommonServiceBase {
  19760. constructor(url, options) {
  19761. super(url, options);
  19762. /**
  19763. * @member {string} SuperMap.FieldStatisticService.prototype.datasource
  19764. * @description 数据集所在的数据源名称。
  19765. */
  19766. this.datasource = null;
  19767. /**
  19768. * @member {string} SuperMap.FieldStatisticService.prototype.dataset
  19769. * @description 数据集名称。
  19770. */
  19771. this.dataset = null;
  19772. /**
  19773. * @member {string} SuperMap.FieldStatisticService.prototype.field
  19774. * @description 查询统计的目标字段名称。
  19775. */
  19776. this.field = null;
  19777. /**
  19778. * @member {SuperMap.StatisticMode} SuperMap.FieldStatisticService.prototype.statisticMode
  19779. * @description 字段查询统计的方法类型。
  19780. */
  19781. this.statisticMode = null;
  19782. if (options) {
  19783. Util.extend(this, options);
  19784. }
  19785. this.CLASS_NAME = "SuperMap.FieldStatisticService";
  19786. }
  19787. /**
  19788. * @function SuperMap.FieldStatisticService.prototype.destroy
  19789. * @override
  19790. */
  19791. destroy() {
  19792. super.destroy();
  19793. var me = this;
  19794. me.datasource = null;
  19795. me.dataset = null;
  19796. me.field = null;
  19797. me.statisticMode = null;
  19798. }
  19799. /**
  19800. * @function SuperMap.FieldStatisticService.prototype.processAsync
  19801. * @description 执行服务,进行指定字段的查询统计。
  19802. */
  19803. processAsync() {
  19804. var me = this,
  19805. fieldStatisticURL = "datasources/" + me.datasource + "/datasets/" + me.dataset + "/fields/" + me.field + "/" + me.statisticMode;
  19806. me.url = Util.urlPathAppend(me.url, fieldStatisticURL);
  19807. me.request({
  19808. method: "GET",
  19809. data: null,
  19810. scope: me,
  19811. success: me.serviceProcessCompleted,
  19812. failure: me.serviceProcessFailed
  19813. });
  19814. }
  19815. }
  19816. SuperMap.FieldStatisticService = FieldStatisticService;
  19817. ;// CONCATENATED MODULE: ./src/common/iServer/FindClosestFacilitiesParameters.js
  19818. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19819. * This program are made available under the terms of the Apache License, Version 2.0
  19820. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19821. /**
  19822. * @class SuperMap.FindClosestFacilitiesParameters
  19823. * @category iServer NetworkAnalyst ClosestFacility
  19824. * @classdesc 最近设施分析参数类。
  19825. * @param {Object} options - 参数。
  19826. * @param {(SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number)} options.event - 事件点,一般为需要获得服务设施服务的事件位置。
  19827. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} options.facilities - 设施点集合,一般为提供服务的服务设施位置。
  19828. * @param {number} [options.expectFacilityCount=1] - 要查找的设施点数量。
  19829. * @param {boolean} [options.fromEvent=false] - 是否从事件点到设施点进行查找。
  19830. * @param {boolean} [options.isAnalyzeById=false] - 事件点和设施点是否通过节点 ID 号来指定。
  19831. * @param {number} [options.maxWeight=0] - 查找半径。单位与该类中 parameter 字段(交通网络分析通用参数)中设置的耗费字段一致。
  19832. * @param {SuperMap.TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  19833. */
  19834. class FindClosestFacilitiesParameters {
  19835. constructor(options) {
  19836. /**
  19837. * @member {(SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number)} SuperMap.FindClosestFacilitiesParameters.prototype.event
  19838. * @description 事件点,一般为需要获得服务设施服务的事件位置。
  19839. * 可以通过两种方式赋予事件点:当该类中字段 isAnalyzeById = true 时,应输入事件点 ID 号;当 isAnalyzeById = false 时,应输入事件点坐标。
  19840. */
  19841. this.event = null;
  19842. /**
  19843. * @member {number} [SuperMap.FindClosestFacilitiesParameters.prototype.expectFacilityCount=1]
  19844. * @description 要查找的设施点数量。
  19845. */
  19846. this.expectFacilityCount = 1;
  19847. /**
  19848. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} [SuperMap.FindClosestFacilitiesParameters.prototype.facilities=false]
  19849. * @description 设施点集合,一般为提供服务的服务设施位置。
  19850. * 可以通过两种方式赋予设施点:当该类中字段 isAnalyzeById = true 时,应输入设施点 ID 号;当 isAnalyzeById = false 时,应输入设施点坐标。
  19851. */
  19852. this.facilities = null;
  19853. /**
  19854. * @member {boolean} [SuperMap.FindClosestFacilitiesParameters.prototype.fromEvent=false]
  19855. * @description 是否从事件点到设施点进行查找。最近设施分析主要是通过设施点和事件点之间最优的路线来分析在一定范围内哪个或哪些设施与事件点有最优路线的关系。
  19856. * 这个行走线路是通过网络图层进行网络分析算法计算出来的两点间的最优路线。由于存在从 A 点到 B 点与从 B 点到 A 点的耗费不一样的情况,因此起止点
  19857. * 不同可能会得到不同的最优路线。因此在进行最近设施分析之前,需要设置获取的最优路线的方向,即是以事件点作为起点到最近设施点的方向分析,还是以最
  19858. * 近设施点为起点到事件点的方向分析。如果需要以事件点作为起点到设施点方向进行查找,设置该字段值为 true;设置为 false,表示从设施点到事件点进行查找。
  19859. */
  19860. this.fromEvent = false;
  19861. /**
  19862. * @member {boolean} [SuperMap.FindClosestFacilitiesParameters.prototype.isAnalyzeById=false]
  19863. * @description 事件点和设施点是否通过节点 ID 号来指定,设置为 false,表示通过坐标点指定事件点和设施点。
  19864. */
  19865. this.isAnalyzeById = false;
  19866. /**
  19867. * @member {number} [SuperMap.FindClosestFacilitiesParameters.prototype.maxWeight=0]
  19868. * @description 查找半径。单位与该类中 parameter 字段(交通网络分析通用参数)中设置的耗费字段一致。
  19869. * 例如事件发生点是一起交通事故,要求查找在 10 分钟内能到达的最近医院,超过 10 分钟能到达的都不予考虑。
  19870. * 那么需要将网络分析参数中 parameter.weightFieldName 设置为表示时间的字段,然后设置查找范围的半径值为10。
  19871. */
  19872. this.maxWeight = 0;
  19873. /**
  19874. * @member {SuperMap.TransportationAnalystParameter} [SuperMap.FindClosestFacilitiesParameters.prototype.parameter]
  19875. * @description 交通网络分析通用参数。通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息。
  19876. * 它为 SuperMap.TransportationAnalystParameter 类型,虽然为可选参数,但是如果不设置其中的 resultSetting 字段,
  19877. * 则返回结果空间信息等都为空。
  19878. */
  19879. this.parameter = new TransportationAnalystParameter();
  19880. Util.extend(this, options);
  19881. this.CLASS_NAME = "SuperMap.FindClosestFacilitiesParameters";
  19882. }
  19883. /**
  19884. * @function SuperMap.FindClosestFacilitiesParameters.prototype.destroy
  19885. * @description 释放资源,将引用资源的属性置空。
  19886. */
  19887. destroy() {
  19888. var me = this;
  19889. me.event = null;
  19890. me.expectFacilityCount = null;
  19891. me.facilities = null;
  19892. me.fromEvent = null;
  19893. me.isAnalyzeById = null;
  19894. me.maxWeight = null;
  19895. if (me.parameter) {
  19896. me.parameter.destroy();
  19897. me.parameter = null;
  19898. }
  19899. }
  19900. }
  19901. SuperMap.FindClosestFacilitiesParameters = FindClosestFacilitiesParameters;
  19902. ;// CONCATENATED MODULE: ./src/common/iServer/FindClosestFacilitiesService.js
  19903. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19904. * This program are made available under the terms of the Apache License, Version 2.0
  19905. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19906. /**
  19907. * @class SuperMap.FindClosestFacilitiesService
  19908. * @category iServer NetworkAnalyst ClosestFacility
  19909. * @classdesc 最近设施分析服务类。
  19910. * 最近设施分析是指在网络上给定一个事件点和一组设施点,
  19911. * 查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  19912. * 该类负责将客户端指定的最近设施分析参数传递给服务端,并接收服务端返回的结果数据。
  19913. * 最近设施分析结果通过该类支持的事件的监听函数参数获取
  19914. * @extends {SuperMap.NetworkAnalystServiceBase}
  19915. * @example
  19916. * var myfindClosestFacilitiesService = new SuperMap.FindClosestFacilitiesService(url, {
  19917. * eventListeners: {
  19918. * "processCompleted": findClosestFacilitiesCompleted,
  19919. * "processFailed": findClosestFacilitiesError
  19920. * }
  19921. * });
  19922. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  19923. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  19924. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  19925. * @param {Object} options - 参数。
  19926. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  19927. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  19928. * @param {Object} [options.headers] - 请求头。
  19929. */
  19930. class FindClosestFacilitiesService extends NetworkAnalystServiceBase {
  19931. /*
  19932. * @function SuperMap.FindClosestFacilitiesService.prototype.constructor
  19933. * @description 最近设施分析服务类构造函数。
  19934. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  19935. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  19936. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  19937. * @param {Object} options - 选参数。<br>
  19938. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  19939. */
  19940. constructor(url, options) {
  19941. super(url, options);
  19942. this.CLASS_NAME = "SuperMap.FindClosestFacilitiesService";
  19943. }
  19944. /**
  19945. * @function SuperMap.FindClosestFacilitiesService.prototype.destroy
  19946. * @override
  19947. */
  19948. destroy() {
  19949. super.destroy();
  19950. }
  19951. /**
  19952. * @function SuperMap.FindClosestFacilitiesService.prototype.processAsync
  19953. * @description 负责将客户端的查询参数传递到服务端。
  19954. * @param {SuperMap.FindClosestFacilitiesParameters} params - 最近设施分析服务参数类
  19955. */
  19956. processAsync(params) {
  19957. if (!(params instanceof FindClosestFacilitiesParameters)) {
  19958. return;
  19959. }
  19960. var me = this,
  19961. jsonObject;
  19962. me.url = Util.urlPathAppend(me.url, 'closestfacility');
  19963. jsonObject = {
  19964. expectFacilityCount: params.expectFacilityCount,
  19965. fromEvent: params.fromEvent,
  19966. maxWeight: params.maxWeight,
  19967. parameter: Util.toJSON(params.parameter),
  19968. event: Util.toJSON(params.event),
  19969. facilities: me.getJson(params.isAnalyzeById, params.facilities)
  19970. };
  19971. me.request({
  19972. method: "GET",
  19973. params: jsonObject,
  19974. scope: me,
  19975. success: me.serviceProcessCompleted,
  19976. failure: me.serviceProcessFailed
  19977. });
  19978. }
  19979. /**
  19980. * @function SuperMap.FindClosestFacilitiesService.prototype.getJson
  19981. * @description 将对象转化为JSON字符串。
  19982. * @param {boolean} isAnalyzeById - 是否通过ID来分析
  19983. * @param {Array} params - 分析参数数组
  19984. * @returns {Object} 转化后的JSON字符串。
  19985. */
  19986. getJson(isAnalyzeById, params) {
  19987. var jsonString = "[",
  19988. len = params ? params.length : 0;
  19989. if (isAnalyzeById === false) {
  19990. for (let i = 0; i < len; i++) {
  19991. if (i > 0) {
  19992. jsonString += ",";
  19993. }
  19994. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  19995. }
  19996. } else if (isAnalyzeById === true) {
  19997. for (let i = 0; i < len; i++) {
  19998. if (i > 0) {
  19999. jsonString += ",";
  20000. }
  20001. jsonString += params[i];
  20002. }
  20003. }
  20004. jsonString += ']';
  20005. return jsonString;
  20006. }
  20007. /**
  20008. * @function SuperMap.FindClosestFacilitiesService.prototype.toGeoJSONResult
  20009. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  20010. * @param {Object} result - 服务器返回的结果对象。
  20011. */
  20012. toGeoJSONResult(result) {
  20013. if (!result || !result.facilityPathList) {
  20014. return result;
  20015. }
  20016. var geoJSONFormat = new GeoJSON();
  20017. result.facilityPathList.map(function (path) {
  20018. if (path.route) {
  20019. path.route = geoJSONFormat.toGeoJSON(path.route);
  20020. }
  20021. if (path.pathGuideItems) {
  20022. path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
  20023. }
  20024. if (path.edgeFeatures) {
  20025. path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
  20026. }
  20027. if (path.nodeFeatures) {
  20028. path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
  20029. }
  20030. return path;
  20031. });
  20032. return result;
  20033. }
  20034. }
  20035. SuperMap.FindClosestFacilitiesService = FindClosestFacilitiesService;
  20036. ;// CONCATENATED MODULE: ./src/common/iServer/FindLocationParameters.js
  20037. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20038. * This program are made available under the terms of the Apache License, Version 2.0
  20039. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20040. /**
  20041. * @class SuperMap.FindLocationParameters
  20042. * @category iServer NetworkAnalyst Location
  20043. * @classdesc 选址分区分析参数类。
  20044. * @param {Object} options - 参数。
  20045. * @param {string} options.turnWeightField - 转向权值字段的名称。
  20046. * @param {string} options.weightName - 阻力字段的名称,标识了进行网络分析时所使用的阻力字段。
  20047. * @param {Array.<SuperMap.SupplyCenter>} options.supplyCenters - 资源供给中心集合。
  20048. * @param {number} [options.expectedSupplyCenterCount=1] - 期望用于最终设施选址的资源供给中心数量。
  20049. * @param {boolean} [options.isFromCenter=false] - 是否从中心点开始分配资源。
  20050. */
  20051. class FindLocationParameters {
  20052. constructor(options) {
  20053. /**
  20054. * @member {number} [SuperMap.FindLocationParameters.prototype.expectedSupplyCenterCount=1]
  20055. * @description 期望用于最终设施选址的资源供给中心数量。
  20056. * 当输入值为 0 时,最终设施选址的资源供给中心数量默认为覆盖分析区域内的所需最少的供给中心数。
  20057. */
  20058. this.expectedSupplyCenterCount = null;
  20059. /**
  20060. * @member {boolean} [SuperMap.FindLocationParameters.prototype.isFromCenter=false]
  20061. * @description 是否从中心点开始分配资源。
  20062. * 由于网路数据中的弧段具有正反阻力,即弧段的正向阻力值与其反向阻力值可能不同,
  20063. * 因此,在进行分析时,从资源供给中心开始分配资源到需求点与从需求点向资源供给中心分配这两种分配形式下,所得的分析结果会不同。
  20064. */
  20065. this.isFromCenter = false;
  20066. /**
  20067. * @member {Array.<SuperMap.SupplyCenter>} SuperMap.FindLocationParameters.prototype.supplyCenters
  20068. * @description 资源供给中心集合。
  20069. * 资源供给中心是提供资源和服务的设施,对应于网络结点,
  20070. * 资源供给中心的相关信息包括资源量、最大阻力值、资源供给中心类型,资源供给中心在网络中所处结点的 ID 等,以便在进行选址分区分析时使用。
  20071. */
  20072. this.supplyCenters = null;
  20073. /**
  20074. * @member {string} SuperMap.FindLocationParameters.prototype.turnWeightField
  20075. * @description 转向权值字段的名称。
  20076. */
  20077. this.turnWeightField = null;
  20078. /**
  20079. * @member {string} SuperMap.FindLocationParameters.prototype.weightName
  20080. * @description 阻力字段的名称,标识了进行网络分析时所使用的阻力字段。
  20081. */
  20082. this.weightName = null;
  20083. Util.extend(this, options);
  20084. this.CLASS_NAME = "SuperMap.FindLocationParameters";
  20085. }
  20086. /**
  20087. * @function SuperMap.FindLocationParameters.prototype.destroy
  20088. * @description 释放资源,将引用资源的属性置空。
  20089. */
  20090. destroy() {
  20091. var me = this;
  20092. me.expectedSupplyCenterCount = null;
  20093. me.isFromCenter = null;
  20094. me.turnWeightField = null;
  20095. me.weightName = null;
  20096. if (me.supplyCenters) {
  20097. for (var i = 0, supplyCenters = me.supplyCenters, len = supplyCenters.length; i < len; i++) {
  20098. supplyCenters[i].destroy();
  20099. }
  20100. me.supplyCenters = null;
  20101. }
  20102. }
  20103. }
  20104. SuperMap.FindLocationParameters = FindLocationParameters;
  20105. ;// CONCATENATED MODULE: ./src/common/iServer/FindLocationService.js
  20106. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20107. * This program are made available under the terms of the Apache License, Version 2.0
  20108. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20109. /**
  20110. * @class SuperMap.FindLocationService
  20111. * @category iServer NetworkAnalyst Location
  20112. * @classdesc 选址分区分析服务类。
  20113. * 选址分区分析是为了确定一个或多个待建设施的最佳或最优位置,使得设施可以用一种最经济有效的方式为需求方提供服务或者商品。
  20114. * 选址分区不仅仅是一个选址过程,还要将需求点的需求分配到相应的新建设施的服务区中,因此称之为选址与分区。
  20115. * 选址分区分析结果通过该类支持的事件的监听函数参数获取
  20116. * @extends {SuperMap.NetworkAnalystServiceBase}
  20117. * @example
  20118. * (start code)
  20119. * var findLocationService = new SuperMap.FindLocationService(url, {
  20120. * eventListeners: {
  20121. * "processCompleted": findLocationCompleted,
  20122. * "processFailed": findLocationError
  20123. * }
  20124. * });
  20125. * (end)
  20126. * @param {string} url - 服务的访问地址。
  20127. * 如 http://localhost:8090/iserver/services/transportationanalyst-sample/rest/networkanalyst/RoadNet@Changchun 。
  20128. * @param {Object} options - 参数。
  20129. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  20130. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  20131. * @param {Object} [options.headers] - 请求头。
  20132. */
  20133. class FindLocationService extends NetworkAnalystServiceBase {
  20134. constructor(url, options) {
  20135. super(url, options);
  20136. this.CLASS_NAME = "SuperMap.FindLocationService";
  20137. }
  20138. /**
  20139. * @function SuperMap.FindLocationService.prototype.destroy
  20140. * @override
  20141. */
  20142. destroy() {
  20143. super.destroy();
  20144. }
  20145. /**
  20146. * @function SuperMap.FindLocationService.prototype.processAsync
  20147. * @description 负责将客户端的查询参数传递到服务端。
  20148. * @param {SuperMap.FindLocationParameters} params - 选址分区分析服务参数类
  20149. */
  20150. processAsync(params) {
  20151. if (!(params instanceof FindLocationParameters)) {
  20152. return;
  20153. }
  20154. var me = this,
  20155. jsonObject;
  20156. me.url = Util.urlPathAppend(me.url, 'location');
  20157. jsonObject = {
  20158. isFromCenter: params.isFromCenter,
  20159. expectedSupplyCenterCount: params.expectedSupplyCenterCount,
  20160. weightName: params.weightName,
  20161. turnWeightField: params.turnWeightField,
  20162. returnEdgeFeature: true,
  20163. returnEdgeGeometry: true,
  20164. returnNodeFeature: true,
  20165. mapParameter: Util.toJSON(params.mapParameter),
  20166. supplyCenters: me.getCentersJson(params.supplyCenters)
  20167. };
  20168. me.request({
  20169. method: "GET",
  20170. params: jsonObject,
  20171. scope: me,
  20172. success: me.serviceProcessCompleted,
  20173. failure: me.serviceProcessFailed
  20174. });
  20175. }
  20176. /**
  20177. * @function SuperMap.FindLocationService.prototype.getCentersJson
  20178. * @description 将数组对象转化为JSON字符串。
  20179. * @param {Array} params - 需要转换的参数
  20180. * @returns {string} 转化后的JSON字符串。
  20181. */
  20182. getCentersJson(params) {
  20183. var json = "[",
  20184. len = params ? params.length : 0;
  20185. for (var i = 0; i < len; i++) {
  20186. if (i > 0) {
  20187. json += ",";
  20188. }
  20189. json += Util.toJSON(params[i]);
  20190. }
  20191. json += "]";
  20192. return json;
  20193. }
  20194. /**
  20195. * @function SuperMap.FindLocationService.prototype.toGeoJSONResult
  20196. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  20197. * @param {Object} result - 服务器返回的结果对象。
  20198. */
  20199. toGeoJSONResult(result) {
  20200. if (!result) {
  20201. return null;
  20202. }
  20203. var geoJSONFormat = new GeoJSON();
  20204. if (result.demandResults) {
  20205. result.demandResults = geoJSONFormat.toGeoJSON(result.demandResults);
  20206. }
  20207. if (result.supplyResults) {
  20208. result.supplyResults = geoJSONFormat.toGeoJSON(result.supplyResults);
  20209. }
  20210. return result;
  20211. }
  20212. }
  20213. SuperMap.FindLocationService = FindLocationService;
  20214. ;// CONCATENATED MODULE: ./src/common/iServer/FindMTSPPathsParameters.js
  20215. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20216. * This program are made available under the terms of the Apache License, Version 2.0
  20217. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20218. /**
  20219. * @class SuperMap.FindMTSPPathsParameters
  20220. * @category iServer NetworkAnalyst MTSPPath
  20221. * @classdesc 多旅行商分析参数类
  20222. * @param {Object} options - 参数。
  20223. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} options.centers - 配送中心集合。
  20224. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} options.nodes - 配送目标集合。
  20225. * @param {boolean} [options.hasLeastTotalCost=false] - 配送模式是否为总花费最小方案。
  20226. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 号来指定配送中心点和配送目的点,即通过坐标点指定。
  20227. * @param {SuperMap.TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  20228. */
  20229. class FindMTSPPathsParameters {
  20230. constructor(options) {
  20231. /**
  20232. * @member SuperMap.FindMTSPPathsParameters.prototype.centers - {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>}
  20233. * @description 配送中心集合。
  20234. * 当 SuperMap.FindMTSPPathsParameters.isAnalyzeById = false 时,centers 应为点的坐标数组;
  20235. * 当 SuperMap.FindMTSPPathsParameters.isAnalyzeById = true 时,centers 应为点的 ID 数组。
  20236. */
  20237. this.centers = null;
  20238. /**
  20239. * @member {boolean} [SuperMap.FindMTSPPathsParameters.prototype.hasLeastTotalCost=false]
  20240. * @description 配送模式是否为总花费最小方案。
  20241. * 若为 true,则按照总花费最小的模式进行配送,此时可能会出现某几个配送中心点配送的花费较多而其他配送中心点的花费很少的情况。
  20242. * 若为 false,则为局部最优,此方案会控制每个配送中心点的花费,使各个中心点花费相对平均,此时总花费不一定最小。
  20243. */
  20244. this.hasLeastTotalCost = false;
  20245. /**
  20246. * @member {boolean} [SuperMap.FindMTSPPathsParameters.prototype.isAnalyzeById=false]
  20247. * @description 是否通过节点 ID 号来指定配送中心点和配送目的点,即通过坐标点指定。
  20248. */
  20249. this.isAnalyzeById = false;
  20250. /**
  20251. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} SuperMap.FindMTSPPathsParameters.prototype.nodes
  20252. * @description 配送目标集合。
  20253. * 当 SuperMap.FindMTSPPathsParameters.isAnalyzeById = false 时,nodes 应为点的坐标数组;
  20254. * 当 SuperMap.FindMTSPPathsParameters.isAnalyzeById = true 时,nodes 应为点的 ID 数组。
  20255. */
  20256. this.nodes = null;
  20257. /**
  20258. * @member {SuperMap.TransportationAnalystParameter} [SuperMap.FindMTSPPathsParameters.prototype.parameter]
  20259. * @description 交通网络分析通用参数。
  20260. * 通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息。
  20261. * SuperMap.TransportationAnalystParameter 类型,它虽然为可选参数,但是如果不设置其中的 resultSetting 字段,则返回结果空间信息等都为空。
  20262. */
  20263. this.parameter = new TransportationAnalystParameter();
  20264. Util.extend(this, options);
  20265. this.CLASS_NAME = "SuperMap.FindMTSPPathsParameters";
  20266. }
  20267. /**
  20268. * @function SuperMap.FindMTSPPathsParameters.prototype.destroy
  20269. * @description 释放资源,将引用资源的属性置空。
  20270. */
  20271. destroy() {
  20272. var me = this;
  20273. me.centers = null;
  20274. me.hasLeastTotalCost = null;
  20275. me.isAnalyzeById = null;
  20276. me.nodes = null;
  20277. me.maxWeight = null;
  20278. if (me.parameter) {
  20279. me.parameter.destroy();
  20280. me.parameter = null;
  20281. }
  20282. }
  20283. }
  20284. SuperMap.FindMTSPPathsParameters = FindMTSPPathsParameters;
  20285. ;// CONCATENATED MODULE: ./src/common/iServer/FindMTSPPathsService.js
  20286. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20287. * This program are made available under the terms of the Apache License, Version 2.0
  20288. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20289. /**
  20290. * @class SuperMap.FindMTSPPathsService
  20291. * @category iServer NetworkAnalyst MTSPPath
  20292. * @classdesc 多旅行商分析服务类
  20293. * 多旅行商分析也称为物流配送,是指在网络数据集中,给定 M 个配送中心点和 N 个配送目的地(M,N 为大于零的整数)。
  20294. * 查找经济有效的配送路径,并给出相应的行走路线。
  20295. * 物流配送功能就是解决如何合理分配配送次序和送货路线,使配送总花费达到最小或每个配送中心的花费达到最小。
  20296. * 该类负责将客户端指定的多旅行商分析参数传递给服务端,并接收服务端返回的结果数据。
  20297. * 多旅行商分析结果通过该类支持的事件的监听函数参数获取
  20298. * @extends {SuperMap.NetworkAnalystServiceBase}
  20299. * @example
  20300. * var myFindMTSPPathsService = new SuperMap.FindMTSPPathsService(url, {
  20301. * eventListeners: {
  20302. * "processCompleted": findMTSPPathsCompleted,
  20303. * "processFailed": findMTSPPathsError
  20304. * }
  20305. * });
  20306. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  20307. * http://{服务器地址}:{服务端口号}/iserver/services/网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  20308. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  20309. * @param {Object} options - 互服务时所需可选参数。如:
  20310. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  20311. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  20312. * @param {Object} [options.headers] - 请求头。
  20313. */
  20314. class FindMTSPPathsService extends NetworkAnalystServiceBase {
  20315. constructor(url, options) {
  20316. super(url, options);
  20317. this.CLASS_NAME = "SuperMap.FindMTSPPathsService";
  20318. }
  20319. /**
  20320. * @function SuperMap.FindMTSPPathsService.prototype.destroy
  20321. * @override
  20322. */
  20323. destroy() {
  20324. super.destroy();
  20325. }
  20326. /**
  20327. * @function SuperMap.FindMTSPPathsService..prototype.processAsync
  20328. * @description 负责将客户端的查询参数传递到服务端。
  20329. * @param {SuperMap.FindMTSPPathsParameters} params - 多旅行商分析服务参数类
  20330. */
  20331. processAsync(params) {
  20332. if (!(params instanceof FindMTSPPathsParameters)) {
  20333. return;
  20334. }
  20335. var me = this,
  20336. jsonObject,
  20337. //end = me.url.substr(me.url.length - 1, 1),
  20338. centers = me.getJson(params.isAnalyzeById, params.centers),
  20339. nodes = me.getJson(params.isAnalyzeById, params.nodes);
  20340. me.url = Util.urlPathAppend(me.url, 'mtsppath');
  20341. jsonObject = {
  20342. centers: centers,
  20343. nodes: nodes,
  20344. parameter: Util.toJSON(params.parameter),
  20345. hasLeastTotalCost: params.hasLeastTotalCost
  20346. };
  20347. me.request({
  20348. method: "GET",
  20349. params: jsonObject,
  20350. scope: me,
  20351. success: me.serviceProcessCompleted,
  20352. failure: me.serviceProcessFailed
  20353. });
  20354. }
  20355. /**
  20356. * @function SuperMap.FindMTSPPathsService.prototype.getJson
  20357. * @description 将对象转化为JSON字符串。
  20358. * @param {boolean} isAnalyzeById - 是否通过id分析
  20359. * @param {Array} params - 需要转换的数字
  20360. * @returns {Object} 转化后的JSON字符串。
  20361. */
  20362. getJson(isAnalyzeById, params) {
  20363. var jsonString = "[",
  20364. len = params ? params.length : 0;
  20365. if (isAnalyzeById === false) {
  20366. for (let i = 0; i < len; i++) {
  20367. if (i > 0) {
  20368. jsonString += ",";
  20369. }
  20370. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  20371. }
  20372. } else if (isAnalyzeById === true) {
  20373. for (let i = 0; i < len; i++) {
  20374. if (i > 0) {
  20375. jsonString += ",";
  20376. }
  20377. jsonString += params[i];
  20378. }
  20379. }
  20380. jsonString += ']';
  20381. return jsonString;
  20382. }
  20383. /**
  20384. * @function SuperMap.FindMTSPPathsService.prototype.toGeoJSONResult
  20385. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  20386. * @param {Object} result - 服务器返回的结果对象。
  20387. */
  20388. toGeoJSONResult(result) {
  20389. if (!result || !result.pathList) {
  20390. return null;
  20391. }
  20392. var geoJSONFormat = new GeoJSON();
  20393. result.pathList.map(function (path) {
  20394. if (path.route) {
  20395. path.route = geoJSONFormat.toGeoJSON(path.route);
  20396. }
  20397. if (path.pathGuideItems) {
  20398. path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
  20399. }
  20400. if (path.edgeFeatures) {
  20401. path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
  20402. }
  20403. if (path.nodeFeatures) {
  20404. path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
  20405. }
  20406. return path;
  20407. });
  20408. return result;
  20409. }
  20410. }
  20411. SuperMap.FindMTSPPathsService = FindMTSPPathsService;
  20412. ;// CONCATENATED MODULE: ./src/common/iServer/FindPathParameters.js
  20413. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20414. * This program are made available under the terms of the Apache License, Version 2.0
  20415. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20416. /**
  20417. * @class SuperMap.FindPathParameters
  20418. * @category iServer NetworkAnalyst Path
  20419. * @classdesc 最佳路径分析参数类。最佳路径是在网络数据集中指定一些结点,按照顺序访问结点从而求解起止点之间阻抗最小的路径。
  20420. * 例如如果要顺序访问 1、2、3、4 四个结点,则需要分别找到1、2结点间的最佳路径 R1—2,2、3 间的最佳路径 R2—3 和 3、4 结点间的最佳路径 R3—4,
  20421. * 顺序访问 1、2、3、4 四个结点的最佳路径就是 R = R1—2 + R2—3 + R3—4。
  20422. * 阻抗就是指从一点到另一点的耗费,在实际应用中我们可以将距离、时间、花费等作为阻抗条件。
  20423. * 阻抗最小也就可以理解为从一点到另一点距离最短、时间最少、花费最低等。当两点间距离最短时为最短路径,它是最佳路径问题的一个特例。
  20424. * 阻抗值通过 SuperMap.TransportationAnalystParameter.weightFieldName 设置。
  20425. * 计算最佳路径除了受阻抗影响外,还受转向字段的影响。转向值通过 {@link SuperMap.TransportationAnalystParameter.turnWeightField} 设置。
  20426. *
  20427. * @param {Object} options - 参数。
  20428. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} options.nodes - 最佳路径分析经过的结点或设施点数组。该字段至少包含两个点。
  20429. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 指定路径分析的结点。
  20430. * @param {boolean} [options.hasLeastEdgeCount=false] - 是否按照弧段数最少的进行最佳路径分析。
  20431. * @param {SuperMap.TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  20432. */
  20433. class FindPathParameters {
  20434. constructor(options) {
  20435. /**
  20436. * @member {boolean} [SuperMap.FindPathParameters.prototype.isAnalyzeById=false]
  20437. * @description 是否通过节点 ID 指定路径分析的结点。
  20438. * 指定路径分析经过的结点或设施点有两种方式:输入结点 ID 号或直接输入点坐标。
  20439. * 当该字段为 true 时,表示通过结点 ID 指定途经点,即 SuperMap.FindPathParameters.nodes = [ID1,ID2,...];
  20440. * 反之表示通过结点坐标指定途经点,即 SuperMap.FindPathParameters.nodes = [{x1,y1},{x2,y2},...] 。
  20441. */
  20442. this.isAnalyzeById = false;
  20443. /**
  20444. * @member {boolean} [SuperMap.FindPathParameters.prototype.hasLeastEdgeCount=false]
  20445. * @description 是否按照弧段数最少的进行最佳路径分析。
  20446. * true 表示按照弧段数最少进行分析,返回弧段数最少的路径中一个阻抗最小的最佳路径;
  20447. * false 表示直接返回阻抗最小的路径,而不考虑弧段的多少。
  20448. */
  20449. this.hasLeastEdgeCount = null;
  20450. /**
  20451. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} SuperMap.FindPathParameters.prototype.nodes
  20452. * @description 最佳路径分析经过的结点或设施点数组,必设字段。该字段至少包含两个点。
  20453. * 当 SuperMap.FindPathParameters.isAnalyzeById = false 时,nodes 应为点的坐标数组;
  20454. * 当 SuperMap.FindPathParameters.isAnalyzeById = true 时,nodes 应为点的 ID 数组。
  20455. */
  20456. this.nodes = null;
  20457. /**
  20458. * @member {SuperMap.TransportationAnalystParameter} SuperMap.FindPathParameters.prototype.parameter
  20459. * @description 交通网络分析通用参数。
  20460. */
  20461. this.parameter = new TransportationAnalystParameter();
  20462. Util.extend(this, options);
  20463. this.CLASS_NAME = "SuperMap.FindPathParameters";
  20464. }
  20465. /**
  20466. * @function SuperMap.FindPathParameters.prototype.destroy
  20467. * @description 释放资源,将引用资源的属性置空。
  20468. */
  20469. destroy() {
  20470. var me = this;
  20471. me.isAnalyzeById = null;
  20472. me.hasLeastEdgeCount = null;
  20473. me.nodes = null;
  20474. if (me.parameter) {
  20475. me.parameter.destroy();
  20476. me.parameter = null;
  20477. }
  20478. }
  20479. }
  20480. SuperMap.FindPathParameters = FindPathParameters;
  20481. ;// CONCATENATED MODULE: ./src/common/iServer/FindPathService.js
  20482. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20483. * This program are made available under the terms of the Apache License, Version 2.0
  20484. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20485. /**
  20486. * @class SuperMap.FindPathService
  20487. * @category iServer NetworkAnalyst Path
  20488. * @classdesc 最佳路径分析服务类。
  20489. * 最佳路径是在网络数据集中指定一些节点,按照节点的选择顺序,
  20490. * 顺序访问这些节点从而求解起止点之间阻抗最小的路经。
  20491. * 该类负责将客户端指定的最佳路径分析参数传递给服务端,并接收服务端返回的结果数据。
  20492. * 最佳路径分析结果通过该类支持的事件的监听函数参数获取
  20493. * @extends {SuperMap.NetworkAnalystServiceBase}
  20494. * @example
  20495. * var myFindPathService = new SuperMap.FindPathService(url, {
  20496. * eventListeners: {
  20497. * "processCompleted": findPathCompleted,
  20498. * "processFailed": findPathError
  20499. * }
  20500. * });
  20501. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  20502. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  20503. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  20504. * @param {Object} options - 参数。
  20505. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  20506. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  20507. * @param {Object} [options.headers] - 请求头。
  20508. */
  20509. class FindPathService extends NetworkAnalystServiceBase {
  20510. constructor(url, options) {
  20511. super(url, options);
  20512. this.CLASS_NAME = "SuperMap.FindPathService";
  20513. }
  20514. /**
  20515. * @function SuperMap.FindPathService.prototype.destroy
  20516. * @override
  20517. */
  20518. destroy() {
  20519. super.destroy();
  20520. }
  20521. /**
  20522. * @function SuperMap.FindPathService.prototype.processAsync
  20523. * @description 负责将客户端的查询参数传递到服务端。
  20524. * @param {SuperMap.FindPathParameters} params - 最佳路径分析服务参数类
  20525. */
  20526. processAsync(params) {
  20527. if (!(params instanceof FindPathParameters)) {
  20528. return;
  20529. }
  20530. var me = this, jsonObject;
  20531. me.url = Util.urlPathAppend(me.url, 'path');
  20532. jsonObject = {
  20533. hasLeastEdgeCount: params.hasLeastEdgeCount,
  20534. parameter: Util.toJSON(params.parameter),
  20535. nodes: me.getJson(params.isAnalyzeById, params.nodes)
  20536. };
  20537. me.request({
  20538. method: "GET",
  20539. params: jsonObject,
  20540. scope: me,
  20541. success: me.serviceProcessCompleted,
  20542. failure: me.serviceProcessFailed
  20543. });
  20544. }
  20545. /**
  20546. * @function SuperMap.FindPathService.prototype.getJson
  20547. * @description 将对象转化为JSON字符串。
  20548. * @param {boolean} isAnalyzeById - 是否通过id分析
  20549. * @param {Array} params - 需要转换的数字
  20550. * @returns {Object} 转化后的JSON字符串。
  20551. */
  20552. getJson(isAnalyzeById, params) {
  20553. var jsonString = "[",
  20554. len = params ? params.length : 0;
  20555. if (isAnalyzeById === false) {
  20556. for (let i = 0; i < len; i++) {
  20557. if (i > 0) {
  20558. jsonString += ",";
  20559. }
  20560. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  20561. }
  20562. } else if (isAnalyzeById === true) {
  20563. for (let i = 0; i < len; i++) {
  20564. if (i > 0) {
  20565. jsonString += ",";
  20566. }
  20567. jsonString += params[i];
  20568. }
  20569. }
  20570. jsonString += ']';
  20571. return jsonString;
  20572. }
  20573. /**
  20574. * @function SuperMap.FindMTSPPathsService.prototype.toGeoJSONResult
  20575. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  20576. * @param {Object} result - 服务器返回的结果对象。
  20577. */
  20578. toGeoJSONResult(result) {
  20579. if (!result || !result.pathList || result.pathList.length < 1) {
  20580. return null;
  20581. }
  20582. var geoJSONFormat = new GeoJSON();
  20583. result.pathList.forEach(function (path) {
  20584. if (path.route) {
  20585. path.route = geoJSONFormat.toGeoJSON(path.route);
  20586. }
  20587. if (path.pathGuideItems) {
  20588. path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
  20589. }
  20590. if (path.edgeFeatures) {
  20591. path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
  20592. }
  20593. if (path.nodeFeatures) {
  20594. path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
  20595. }
  20596. });
  20597. return result;
  20598. }
  20599. }
  20600. SuperMap.FindPathService = FindPathService;
  20601. ;// CONCATENATED MODULE: ./src/common/iServer/FindServiceAreasParameters.js
  20602. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20603. * This program are made available under the terms of the Apache License, Version 2.0
  20604. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20605. /**
  20606. * @class SuperMap.FindServiceAreasParameters
  20607. * @category iServer NetworkAnalyst ServiceArea
  20608. * @classdesc 服务区分析参数类。
  20609. * 服务区分析是以指定服务站点为中心,在一定服务范围内查找网络上服务站点能够提供服务的区域范围。
  20610. * 例如:计算某快餐店能够在30分钟内送达快餐的区域。
  20611. * @param {Object} options - 参数。
  20612. * @param {Array.<number>} options.weights - 每个服务站点提供服务的阻力半径,超过这个阻力半径的区域不予考虑,其单位与阻力字段一致。
  20613. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} options.centers - 服务站点数组。
  20614. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 指定路径分析的结点。
  20615. * @param {boolean} [options.isCenterMutuallyExclusive=false] - 是否中心点互斥。
  20616. * @param {boolean} [options.isFromCenter=false] - 是否从中心点开始分析。
  20617. * @param {SuperMap.TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  20618. */
  20619. class FindServiceAreasParameters {
  20620. constructor(options) {
  20621. /**
  20622. * @member {boolean} [SuperMap.FindServiceAreasParameters.prototype.isAnalyzeById=false]
  20623. * @description 是否通过节点 ID 指定路径分析的结点。
  20624. * 指定路径分析经过的结点或设施点有两种方式:输入结点 ID 号或直接输入点坐标。
  20625. * 当该字段为 true 时,表示通过结点 ID 指定途经点,即 SuperMap.FindServiceAreasParameters.centers = [ID1,ID2,...];
  20626. * 反之表示通过结点坐标指定途经点,即 SuperMap.FindServiceAreasParameters.centers = [{x1,y1},{x2,y2},...]。
  20627. */
  20628. this.isAnalyzeById = false;
  20629. /**
  20630. * @member {boolean} [SuperMap.FindServiceAreasParameters.prototype.isCenterMutuallyExclusive=false]
  20631. * @description 是否中心点互斥,即按照中心点的距离进行判断是否要进行互斥处理。
  20632. * 若分析出的服务区有重叠的部分,则通过设置该参数进行互斥处理。
  20633. */
  20634. this.isCenterMutuallyExclusive = false;
  20635. /**
  20636. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} SuperMap.FindServiceAreasParameters.prototype.centers
  20637. * @description 服务站点数组。
  20638. * 当该类的 iSAnalyzeById = true 时,通过结点 ID 号指定服务站点;当 iSAnalyzeById = false 时,通过点坐标指定服务站点。
  20639. */
  20640. this.centers = null;
  20641. /**
  20642. * @member {boolean} [SuperMap.FindServiceAreasParameters.prototype.isFromCenter=false]
  20643. * @description 是否从中心点开始分析。
  20644. * 从中心点开始分析和不从中心点开始分析,体现了服务中心和需要该服务的需求地的关系模式。
  20645. * 从中心点开始分析,是一个服务中心向服务需求地提供服务;
  20646. * 而不从中心点开始分析,是一个服务需求地主动到服务中心获得服务。
  20647. */
  20648. this.isFromCenter = false;
  20649. /**
  20650. * APIProperty: weights
  20651. * @member {Array.<number>} SuperMap.FindServiceAreasParameters.prototype.weights
  20652. * @description 每个服务站点提供服务的阻力半径,即超过这个阻力半径的区域不予考虑,其单位与阻力字段一致。
  20653. * 该字段为一个数组,数组长度跟服务中心个数一致,按照索引顺序与站点一一对应,每个元素表示了在对每个服务中心进行服务区分析时,所用的服务半径。
  20654. */
  20655. this.weights = null;
  20656. /**
  20657. * @member {SuperMap.TransportationAnalystParameter} SuperMap.FindServiceAreasParameters.prototype.parameter
  20658. * @description 交通网络分析通用参数。
  20659. */
  20660. this.parameter = new TransportationAnalystParameter();
  20661. Util.extend(this, options);
  20662. this.CLASS_NAME = "SuperMap.FindServiceAreasParameters";
  20663. }
  20664. /**
  20665. * @function SuperMap.FindServiceAreasParameters.prototype.destroy
  20666. * @description 释放资源,将引用资源的属性置空。
  20667. */
  20668. destroy() {
  20669. var me = this;
  20670. me.isAnalyzeById = null;
  20671. me.isCenterMutuallyExclusive = null;
  20672. me.centers = null;
  20673. me.isFromCenter = null;
  20674. me.weights = null;
  20675. if (me.parameter) {
  20676. me.parameter.destroy();
  20677. me.parameter = null;
  20678. }
  20679. }
  20680. }
  20681. SuperMap.FindServiceAreasParameters = FindServiceAreasParameters;
  20682. ;// CONCATENATED MODULE: ./src/common/iServer/FindServiceAreasService.js
  20683. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20684. * This program are made available under the terms of the Apache License, Version 2.0
  20685. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20686. /**
  20687. * @class SuperMap.FindServiceAreasService
  20688. * @category iServer NetworkAnalyst ServiceArea
  20689. * @classdesc 服务区分析服务类。
  20690. * 服务区分析是以指定服务站点为中心,
  20691. * 在一定服务范围内查找网络上服务站点能够提供服务的区域范围。
  20692. * 该类负责将客户端指定的服务区分析参数传递给服务端,并接收服务端返回的结果数据。
  20693. * 服务区分析结果通过该类支持的事件的监听函数参数获取
  20694. * @extends {SuperMap.NetworkAnalystServiceBase}
  20695. * @example
  20696. * var myFindServiceAreasService = new SuperMap.FindServiceAreasService(url, {
  20697. * eventListeners: {
  20698. * "processCompleted": findServiceAreasCompleted,
  20699. * "processFailed": findServiceAreasError
  20700. * }
  20701. * });
  20702. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  20703. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  20704. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  20705. * @param {Object} options - 互服务时所需可选参数。如:
  20706. * @param {Object} options.eventListeners - 需要被注册的监听器对象
  20707. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  20708. * @param {Object} [options.headers] - 请求头。
  20709. */
  20710. class FindServiceAreasService extends NetworkAnalystServiceBase {
  20711. constructor(url, options) {
  20712. super(url, options);
  20713. this.CLASS_NAME = "SuperMap.FindServiceAreasService";
  20714. }
  20715. /**
  20716. * @function SuperMap.FindServiceAreasService.prototype.destroy
  20717. * @override
  20718. */
  20719. destroy() {
  20720. super.destroy();
  20721. }
  20722. /**
  20723. * @function SuperMap.FindServiceAreasService.prototype.processAsync
  20724. * @description 负责将客户端的查询参数传递到服务端。
  20725. * @param {SuperMap.FindServiceAreasParameters} params - 服务区分析服务参数类
  20726. */
  20727. processAsync(params) {
  20728. if (!(params instanceof FindServiceAreasParameters)) {
  20729. return;
  20730. }
  20731. var me = this, jsonObject;
  20732. me.url = Util.urlPathAppend(me.url, 'servicearea');
  20733. jsonObject = {
  20734. isFromCenter: params.isFromCenter,
  20735. isCenterMutuallyExclusive: params.isCenterMutuallyExclusive,
  20736. parameter: Util.toJSON(params.parameter),
  20737. centers: me.getJson(params.isAnalyzeById, params.centers),
  20738. weights: me.getJson(true, params.weights)
  20739. };
  20740. me.request({
  20741. method: "GET",
  20742. params: jsonObject,
  20743. scope: me,
  20744. success: me.serviceProcessCompleted,
  20745. failure: me.serviceProcessFailed
  20746. });
  20747. }
  20748. /**
  20749. * @function SuperMap.FindServiceAreasService.prototype.getJson
  20750. * @description 将对象转化为JSON字符串。
  20751. * @param {boolean} isAnalyzeById - 是否通过id分析
  20752. * @param {Array} params - 需要转换的数字
  20753. * @returns {Object} 转化后的JSON字符串。
  20754. */
  20755. getJson(isAnalyzeById, params) {
  20756. var jsonString = "[",
  20757. len = params ? params.length : 0;
  20758. if (isAnalyzeById === false) {
  20759. for (let i = 0; i < len; i++) {
  20760. if (i > 0) {
  20761. jsonString += ",";
  20762. }
  20763. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  20764. }
  20765. } else if (isAnalyzeById === true) {
  20766. for (let i = 0; i < len; i++) {
  20767. if (i > 0) {
  20768. jsonString += ",";
  20769. }
  20770. jsonString += params[i];
  20771. }
  20772. }
  20773. jsonString += ']';
  20774. return jsonString;
  20775. }
  20776. /**
  20777. * @function SuperMap.FindServiceAreasService.prototype.toGeoJSONResult
  20778. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  20779. * @param {Object} result - 服务器返回的结果对象。。
  20780. */
  20781. toGeoJSONResult(result) {
  20782. if (!result || !result.serviceAreaList) {
  20783. return result;
  20784. }
  20785. var geoJSONFormat = new GeoJSON();
  20786. result.serviceAreaList.map(function (serviceArea) {
  20787. if (serviceArea.serviceRegion) {
  20788. serviceArea.serviceRegion = geoJSONFormat.toGeoJSON(serviceArea.serviceRegion);
  20789. }
  20790. if (serviceArea.edgeFeatures) {
  20791. serviceArea.edgeFeatures = geoJSONFormat.toGeoJSON(serviceArea.edgeFeatures);
  20792. }
  20793. if (serviceArea.nodeFeatures) {
  20794. serviceArea.nodeFeatures = geoJSONFormat.toGeoJSON(serviceArea.nodeFeatures);
  20795. }
  20796. if (serviceArea.routes) {
  20797. serviceArea.routes = geoJSONFormat.toGeoJSON(serviceArea.routes);
  20798. }
  20799. return serviceArea;
  20800. });
  20801. return result;
  20802. }
  20803. }
  20804. SuperMap.FindServiceAreasService = FindServiceAreasService;
  20805. ;// CONCATENATED MODULE: ./src/common/iServer/FindTSPPathsParameters.js
  20806. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20807. * This program are made available under the terms of the Apache License, Version 2.0
  20808. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20809. /**
  20810. * @class SuperMap.FindTSPPathsParameters
  20811. * @category iServer NetworkAnalyst TSPPath
  20812. * @classdesc 旅行商分析参数类。
  20813. * 旅行商分析是路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。
  20814. * 旅行商分析也可以指定到达的终点,这时查找从起点能够遍历所有途经点最后到达终点,且花费最小的路径。
  20815. * 旅行商分析和最佳路径分析都是在网络中寻找遍历所有站点的最经济的路径,区别是在遍历网络所有站点的过程中对结点访问顺序不同
  20816. * 最佳路径分析必须按照指定顺序对站点进行访问,而旅行商分析是无序的路径分析。
  20817. * @param {Object} options - 参数。
  20818. * @param {boolean} [options.endNodeAssigned=false] - 是否指定终止点,将指定的途经点的最后一个点作为终止点。true 表示指定终止点,则旅行商必须最后一个访问终止点。
  20819. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 号来指定配送中心点和配送目的点。
  20820. * @param {Array.<(SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number)>} options.nodes - 配送目标集合。
  20821. * @param {SuperMap.TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  20822. */
  20823. class FindTSPPathsParameters {
  20824. constructor(options) {
  20825. /**
  20826. * @member {boolean} [SuperMap.FindTSPPathsParameters.prototype.endNodeAssigned=false]
  20827. * @description 是否指定终止点,将指定的途经点的最后一个点作为终止点。
  20828. * true 表示指定终止点,则旅行商必须最后一个访问终止点。
  20829. */
  20830. this.endNodeAssigned = false;
  20831. /**
  20832. * @member {boolean} [SuperMap.FindTSPPathsParameters.prototype.isAnalyzeById=false]
  20833. * @description 是否通过节点 ID 号来指定途经点。
  20834. */
  20835. this.isAnalyzeById = false;
  20836. /**
  20837. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} SuperMap.FindTSPPathsParameters.prototype.nodes
  20838. * @description 旅行商分析途经点数组。
  20839. * 当 SuperMap.FindTSPPathsParameters.isAnalyzeById = false 时,nodes 应为点的坐标数组;
  20840. * 当 SuperMap.FindTSPPathsParameters.isAnalyzeById = true 时,nodes 应为点的 ID 数组。
  20841. */
  20842. this.nodes = null;
  20843. /**
  20844. * @member {SuperMap.TransportationAnalystParameter} [SuperMap.FindTSPPathsParameters.prototype.parameter]
  20845. * @description 交通网络分析通用参数。通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息。
  20846. * SuperMap.TransportationAnalystParameter 类型,它虽然为可选参数,但是如果不设置其中的 resultSetting
  20847. * 字段,则返回结果空间信息等都为空。
  20848. */
  20849. this.parameter = new TransportationAnalystParameter();
  20850. Util.extend(this, options);
  20851. this.CLASS_NAME = "SuperMap.FindTSPPathsParameters";
  20852. }
  20853. /**
  20854. * @function SuperMap.FindTSPPathsParameters.prototype.destroy
  20855. * @description 释放资源,将引用资源的属性置空。
  20856. */
  20857. destroy() {
  20858. var me = this;
  20859. me.endNodeAssigned = null;
  20860. me.isAnalyzeById = null;
  20861. me.nodes = null;
  20862. if (me.parameter) {
  20863. me.parameter.destroy();
  20864. me.parameter = null;
  20865. }
  20866. }
  20867. }
  20868. SuperMap.FindTSPPathsParameters = FindTSPPathsParameters;
  20869. ;// CONCATENATED MODULE: ./src/common/iServer/FindTSPPathsService.js
  20870. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20871. * This program are made available under the terms of the Apache License, Version 2.0
  20872. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20873. /**
  20874. * @class SuperMap.FindTSPPathsService
  20875. * @category iServer NetworkAnalyst TSPPath
  20876. * @classdesc 旅行商分析服务类
  20877. * 旅行商分析是路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。
  20878. * 旅行商分析也可以指定到达的终点,这时查找从起点能够遍历所有途经点最后到达终点,且花费最小的路径。
  20879. * 该类负责将客户端指定的旅行商分析参数传递给服务端,并接收服务端返回的结果数据。
  20880. * 旅行商分析结果通过该类支持的事件的监听函数参数获取
  20881. * @extends {SuperMap.NetworkAnalystServiceBase}
  20882. * @example
  20883. * (start code)
  20884. * var myFindTSPPathsService = new SuperMap.FindTSPPathsService(url, {
  20885. * eventListeners: {
  20886. * "processCompleted": findTSPPathsCompleted,
  20887. * "processFailed": findTSPPathsError
  20888. * }
  20889. * });
  20890. * (end)
  20891. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  20892. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  20893. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  20894. * @param {Object} options - 参数。
  20895. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  20896. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  20897. * @param {Object} [options.headers] - 请求头。
  20898. */
  20899. class FindTSPPathsService extends NetworkAnalystServiceBase {
  20900. constructor(url, options) {
  20901. super(url, options);
  20902. this.CLASS_NAME = "SuperMap.FindTSPPathsService";
  20903. }
  20904. /**
  20905. * @function SuperMap.FindTSPPathsService.prototype.destroy
  20906. * @override
  20907. */
  20908. destroy() {
  20909. super.destroy();
  20910. }
  20911. /**
  20912. * @function SuperMap.FindTSPPathsService.prototype.processAsync
  20913. * @description 负责将客户端的查询参数传递到服务端。
  20914. * @param {SuperMap.FindTSPPathsParameters} params - 旅行商分析服务参数类。
  20915. */
  20916. processAsync(params) {
  20917. if (!(params instanceof FindTSPPathsParameters)) {
  20918. return;
  20919. }
  20920. var me = this, jsonObject;
  20921. me.url = Util.urlPathAppend(me.url, 'tsppath');
  20922. jsonObject = {
  20923. parameter: SuperMap.Util.toJSON(params.parameter),
  20924. endNodeAssigned: params.endNodeAssigned,
  20925. nodes: me.getNodesJson(params)
  20926. };
  20927. me.request({
  20928. method: "GET",
  20929. params: jsonObject,
  20930. scope: me,
  20931. success: me.serviceProcessCompleted,
  20932. failure: me.serviceProcessFailed
  20933. });
  20934. }
  20935. /**
  20936. * @function SuperMap.FindTSPPathsService.prototype.getNodesJson
  20937. * @description 将节点对象转化为JSON字符串。
  20938. * @param {SuperMap.FindTSPPathsParameters} params - 旅行商分析服务参数类。
  20939. * @returns {string} 转化后的JSON字符串。
  20940. */
  20941. getNodesJson(params) {
  20942. var jsonParameters = "", nodesString, i, len, nodes;
  20943. if (params.isAnalyzeById === false) {
  20944. for (nodesString = "[", i = 0, nodes = params.nodes, len = nodes.length; i < len; i++) {
  20945. if (i > 0) {
  20946. nodesString += ",";
  20947. }
  20948. nodesString += '{"x":' + nodes[i].x + ',"y":' + nodes[i].y + '}';
  20949. }
  20950. nodesString += ']';
  20951. jsonParameters += nodesString;
  20952. } else if (params.isAnalyzeById === true) {
  20953. let nodeIDsString = "[", nodes = params.nodes, len = nodes.length;
  20954. for (let i = 0; i < len; i++) {
  20955. if (i > 0) {
  20956. nodeIDsString += ",";
  20957. }
  20958. nodeIDsString += nodes[i];
  20959. }
  20960. nodeIDsString += ']';
  20961. jsonParameters += nodeIDsString;
  20962. }
  20963. return jsonParameters;
  20964. }
  20965. /**
  20966. * @function SuperMap.FindTSPPathsService.prototype.toGeoJSONResult
  20967. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  20968. * @param {Object} result - 服务器返回的结果对象。
  20969. */
  20970. toGeoJSONResult(result) {
  20971. if (!result || !result.tspPathList) {
  20972. return null;
  20973. }
  20974. var geoJSONFormat = new GeoJSON();
  20975. result.tspPathList.forEach(function (path) {
  20976. if (path.route) {
  20977. path.route = geoJSONFormat.toGeoJSON(path.route);
  20978. }
  20979. if (path.pathGuideItems) {
  20980. path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
  20981. }
  20982. if (path.edgeFeatures) {
  20983. path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
  20984. }
  20985. if (path.nodeFeatures) {
  20986. path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
  20987. }
  20988. });
  20989. return result;
  20990. }
  20991. }
  20992. SuperMap.FindTSPPathsService = FindTSPPathsService;
  20993. ;// CONCATENATED MODULE: ./src/common/iServer/GenerateSpatialDataParameters.js
  20994. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20995. * This program are made available under the terms of the Apache License, Version 2.0
  20996. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20997. /**
  20998. * @class SuperMap.GenerateSpatialDataParameters
  20999. * @category iServer SpatialAnalyst GenerateSpatialData
  21000. * @classdesc 动态分段操作参数类。通过该类可以为动态分段提供参数信息。
  21001. * @param {Object} options - 参数。
  21002. * @param {string} options.routeTable - 路由数据集。
  21003. * @param {string} options.routeIDField - 路由数据集的标识字段。
  21004. * @param {string} options.eventTable - 用于生成空间数据的事件表名。
  21005. * @param {SuperMap.DataReturnOption} options.dataReturnOption - 设置数据返回选项。
  21006. * @param {string} [options.attributeFilter] - 属性过滤条件。
  21007. * @param {string} options.eventRouteIDField - 用于生成空间数据的事件表的路由标识字段。
  21008. * @param {string} [options.measureField] - 用于生成空间数据的事件表的刻度字段,只有当事件为点事件的时候该属性才有意义。
  21009. * @param {string} [options.measureStartField] - 用于生成空间数据的事件表的起始刻度字段,只有当事件为线事件的时候该属性才有意义。
  21010. * @param {string} [options.measureEndField] - 用于生成空间数据的事件表的终止刻度字段,只有当事件为线事件的时候该属性才有意义。
  21011. * @param {string} [options.measureOffsetField] - 刻度偏移量字段。
  21012. * @param {string} [options.errorInfoField] - 错误信息字段,直接写入原事件表,用于描述事件未能生成对应的点或线时的错误信息。
  21013. * @param {Array.<string>} [options.retainedFields] - 欲保留到结果空间数据中的字段集合(系统字段除外)。
  21014. */
  21015. class GenerateSpatialDataParameters {
  21016. constructor(options) {
  21017. /**
  21018. * @member {string} SuperMap.GenerateSpatialDataParameters.prototype.routeTable
  21019. * @description 路由数据集。
  21020. */
  21021. this.routeTable = null;
  21022. /**
  21023. * @member {string} SuperMap.GenerateSpatialDataParameters.prototype.routeIDField
  21024. * @description 路由数据集的标识字段。
  21025. */
  21026. this.routeIDField = null;
  21027. /**
  21028. * @member {string} [SuperMap.GenerateSpatialDataParameters.prototype.attributeFilter]
  21029. * @description 属性过滤条件。
  21030. * 当 {@link SuperMap.GenerateSpatialDataParameters.prototype.dataReturnOption.dataReturnMode} 为 {@link DataReturnMode.DATASET_AND_RECORDSET} 或 {@link DataReturnMode.RECORDSET_ONLY} 时有效。
  21031. */
  21032. this.attributeFilter = null;
  21033. /**
  21034. * @member {string} SuperMap.GenerateSpatialDataParameters.prototype.eventTable
  21035. * @description 用于生成空间数据的事件表名。
  21036. */
  21037. this.eventTable = null;
  21038. /**
  21039. * @member {string} SuperMap.GenerateSpatialDataParameters.prototype.eventRouteIDField
  21040. * @description 用于生成空间数据的事件表的路由标识字段。
  21041. */
  21042. this.eventRouteIDField = null;
  21043. /**
  21044. * @member {string} [SuperMap.GenerateSpatialDataParameters.prototype.measureField]
  21045. * @description 用于生成空间数据的事件表的刻度字段,只有当事件为点事件的时候该属性才有意义
  21046. */
  21047. this.measureField = null;
  21048. /**
  21049. * @member {string} [SuperMap.GenerateSpatialDataParameters.prototype.measureStartField]
  21050. * @description 用于生成空间数据的事件表的起始刻度字段,只有当事件为线事件的时候该属性才有意义。
  21051. */
  21052. this.measureStartField = null;
  21053. /**
  21054. * @member {string} [SuperMap.GenerateSpatialDataParameters.prototype.measureEndField]
  21055. * @description 用于生成空间数据的事件表的终止刻度字段,只有当事件为线事件的时候该属性才有意义。
  21056. */
  21057. this.measureEndField = null;
  21058. /**
  21059. * @member {string} [SuperMap.GenerateSpatialDataParameters.prototype.measureOffsetField]
  21060. * @description 刻度偏移量字段。
  21061. */
  21062. this.measureOffsetField = null;
  21063. /**
  21064. * @member {string} [SuperMap.GenerateSpatialDataParameters.prototype.errorInfoField]
  21065. * @description 错误信息字段,直接写入原事件表,用于描述事件未能生成对应的点或线时的错误信息。
  21066. */
  21067. this.errorInfoField = null;
  21068. /**
  21069. * @member {Array.<string>} [SuperMap.GenerateSpatialDataParameters.prototype.retainedFields]
  21070. * @description 欲保留到结果空间数据中的字段集合(系统字段除外)。
  21071. * 生成空间数据时,无论是否指定保留字段,路由 ID 字段、刻度偏移量字段、刻度值字段(点事件为刻度字段,线事件是起始和终止刻度字段)都会保留到结果空间数据中;
  21072. * 如果没有指定 retainedFields 参数或者 retainedFields 参数数组长度为 0,则返回所有用户字段。
  21073. */
  21074. this.retainedFields = null;
  21075. /**
  21076. * @member {SuperMap.DataReturnOption} SuperMap.GenerateSpatialDataParameters.prototype.dataReturnOption
  21077. * @description 设置数据返回的选项。
  21078. */
  21079. this.dataReturnOption = null;
  21080. if (options) {
  21081. Util.extend(this, options);
  21082. }
  21083. this.CLASS_NAME = "SuperMap.GenerateSpatialDataParameters";
  21084. }
  21085. /**
  21086. * @function SuperMap.GenerateSpatialDataParameters.prototype.destroy
  21087. * @description 释放资源,将引用资源的属性置空。
  21088. */
  21089. destroy() {
  21090. var me = this;
  21091. if (me.routeTable) {
  21092. me.routeTable = null;
  21093. }
  21094. me.routeIDField = null;
  21095. me.attributeFilter = null;
  21096. me.eventTable = null;
  21097. me.eventRouteIDField = null;
  21098. me.measureField = null;
  21099. me.measureStartField = null;
  21100. me.measureEndField = null;
  21101. me.measureOffsetField = null;
  21102. me.errorInfoField = null;
  21103. if (me.dataReturnOption) {
  21104. me.dataReturnOption.destroy();
  21105. me.dataReturnOption = null;
  21106. }
  21107. }
  21108. }
  21109. SuperMap.GenerateSpatialDataParameters = GenerateSpatialDataParameters;
  21110. ;// CONCATENATED MODULE: ./src/common/iServer/GenerateSpatialDataService.js
  21111. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21112. * This program are made available under the terms of the Apache License, Version 2.0
  21113. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21114. /**
  21115. * @class SuperMap.GenerateSpatialDataService
  21116. * @category iServer SpatialAnalyst GenerateSpatialData
  21117. * @classdesc 动态分段分析服务类。该类负责将客户设置的动态分段分析服务参数传递给服务端,并接收服务端返回的动态分段分析结果数据。
  21118. * 获取的结果数据包括 originResult 、result 两种,其中,originResult 为服务端返回的用 JSON 对象表示的动态分段分析结果数据,result 为服务端返回的动态分段分析结果数据。
  21119. * @param {string} url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  21120. * @param {Object} options - 参数。</br>
  21121. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  21122. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  21123. * @param {Object} [options.headers] - 请求头。
  21124. * @extends {SuperMap.SpatialAnalystBase}
  21125. * @example 实例化该类如下例所示:
  21126. * (start code)
  21127. * function GenerateSpatialData(){
  21128. *
  21129. * //配置数据返回选项(option)
  21130. * var option = new SuperMap.DataReturnOption({
  21131. * expectCount: 1000,
  21132. * dataset: "generateSpatialData",
  21133. * deleteExistResultDataset: true,
  21134. * dataReturnMode: SuperMap.DataReturnMode.DATASET_ONLY
  21135. * }),
  21136. * //配置动态分段参数(Parameters)
  21137. * parameters = new SuperMap.GenerateSpatialDataParameters({
  21138. * routeTable: "RouteDT_road@Changchun",
  21139. * routeIDField: "RouteID",
  21140. * eventTable: "LinearEventTabDT@Changchun",
  21141. * eventRouteIDField: "RouteID",
  21142. * measureField: "",
  21143. * measureStartField: "LineMeasureFrom",
  21144. * measureEndField: "LineMeasureTo",
  21145. * measureOffsetField: "",
  21146. * errorInfoField: "",
  21147. * retainedFields:[],
  21148. * dataReturnOption: option
  21149. * }),
  21150. * //配置动态分段iService
  21151. * iService = new SuperMap.GenerateSpatialDataService(Changchun_spatialanalyst, {
  21152. * eventListeners: {
  21153. * processCompleted: generateCompleted,
  21154. * processFailed: generateFailded
  21155. * }
  21156. * });
  21157. * //执行
  21158. * iService.processAsync(parameters);
  21159. * function Completed(generateSpatialDataEventArgs){//todo};
  21160. * function Error(generateSpatialDataEventArgs){//todo};
  21161. * (end)
  21162. */
  21163. class GenerateSpatialDataService extends SpatialAnalystBase {
  21164. constructor(url, options) {
  21165. super(url, options);
  21166. this.CLASS_NAME = "SuperMap.GenerateSpatialDataService";
  21167. }
  21168. /**
  21169. * @function SuperMap.GenerateSpatialDataService.prototype.destroy
  21170. * @override
  21171. */
  21172. destroy() {
  21173. super.destroy();
  21174. }
  21175. /**
  21176. * @function SuperMap.GenerateSpatialDataService.prototype.processAsync
  21177. * @description 负责将客户端的动态分段服务参数传递到服务端。
  21178. * @param {SuperMap.GenerateSpatialDataParameters} params - 动态分段操作参数类。
  21179. */
  21180. processAsync(params) {
  21181. if (!(params instanceof GenerateSpatialDataParameters)) {
  21182. return;
  21183. }
  21184. var me = this,
  21185. jsonParameters;
  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 SuperMap.GenerateSpatialDataService.prototype.getJsonParameters
  21197. * @description 将参数转化为 JSON 字符串。
  21198. * @param {SuperMap.GenerateSpatialDataParameters} params - 动态分段操作参数类。
  21199. * @returns {string}转化后的JSON字符串。
  21200. */
  21201. getJsonParameters(params) {
  21202. var jsonParameters = "",
  21203. jsonStr = "datasets/" + params.routeTable + "/linearreferencing/generatespatialdata",
  21204. me = this;
  21205. me.url = Util.urlPathAppend(me.url, jsonStr);
  21206. me.url = Util.urlAppend(me.url, 'returnContent=true');
  21207. jsonParameters = Util.toJSON(params);
  21208. return jsonParameters;
  21209. }
  21210. }
  21211. SuperMap.GenerateSpatialDataService = GenerateSpatialDataService;
  21212. ;// CONCATENATED MODULE: ./src/common/iServer/GeoBoundingBoxQueryBuilderParameter.js
  21213. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21214. * This program are made available under the terms of the Apache License, Version 2.0
  21215. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21216. /**
  21217. * @class SuperMap.GeoBoundingBoxQueryBuilderParameter
  21218. * @classdesc bounds 查询参数设置类,该参数仅支持数据来源 Elasticsearch 服务的数据服务。
  21219. * @category iServer Data FeatureResults
  21220. * @param {Object} options - 参数。
  21221. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} options.bounds - 查询范围。
  21222. * @param {SuperMap.AggregationQueryBuilderType} [options.queryType=SuperMap.AggregationQueryBuilderType.GEO_BOUNDING_BOX] - 查询类型。
  21223. */
  21224. class GeoBoundingBoxQueryBuilderParameter extends AggQueryBuilderParameter {
  21225. constructor(options) {
  21226. super(options);
  21227. /**
  21228. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.GeoBoundingBoxQueryBuilderParameter.prototype.bounds
  21229. * @description 查询范围。
  21230. */
  21231. this.bounds = null;
  21232. /**
  21233. * @member {SuperMap.AggregationQueryBuilderType} [SuperMap.GeoBoundingBoxQueryBuilderParameter.prototype.queryType=SuperMap.AggregationQueryBuilderType.GEO_BOUNDING_BOX]
  21234. * @description 查询类型。
  21235. */
  21236. this.queryType = AggregationQueryBuilderType.GEO_BOUNDING_BOX;
  21237. this.CLASS_NAME = "SuperMap.GeoBoundingBoxQueryBuilderParameter";
  21238. Util.extend(this, options);
  21239. }
  21240. destroy() {
  21241. super.destroy();
  21242. this.bounds = null;
  21243. this.queryType = null;
  21244. }
  21245. }
  21246. SuperMap.GeoBoundingBoxQueryBuilderParameter = GeoBoundingBoxQueryBuilderParameter
  21247. ;// CONCATENATED MODULE: ./src/common/iServer/GeoHashGridAggParameter.js
  21248. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21249. * This program are made available under the terms of the Apache License, Version 2.0
  21250. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21251. /**
  21252. * @class SuperMap.GeoHashGridAggParameter
  21253. * @classdesc 格网聚合查询参数类,该参数仅支持数据来源 Elasticsearch 服务的数据服务。
  21254. * @category iServer Data FeatureResults
  21255. * @param {Object} option - 初始化参数。
  21256. * @param {number} [option.precision=5] - 网格中数字的精度。
  21257. * @param {SuperMap.AggregationType} [option.aggType=SuperMap.AggregationType.GEOHASH_GRID] - 格网聚合类型。
  21258. */
  21259. class GeoHashGridAggParameter extends AggregationParameter {
  21260. constructor(option) {
  21261. super(option);
  21262. /**
  21263. * @member {number} [SuperMap.GeoHashGridAggParameter.prototype.precision=5]
  21264. * @description 网格中数字的精度。
  21265. */
  21266. this.precision = 5;
  21267. /**
  21268. * @member {SuperMap.AggregationType} [SuperMap.GeoHashGridAggParameter.prototype.aggType=SuperMap.AggregationType.GEOHASH_GRID]
  21269. * @description 格网聚合类型。
  21270. */
  21271. this.aggType = AggregationType.GEOHASH_GRID;
  21272. Util.extend(this, option);
  21273. this.CLASS_NAME = "SuperMap.GeoHashGridAggParameter";
  21274. }
  21275. destroy() {
  21276. super.destroy();
  21277. this.aggType = null;
  21278. }
  21279. /**
  21280. * @function SuperMap.GeoHashGridAggParameter.toJsonParameters
  21281. * @description 将对象转为 JSON 格式。
  21282. * @param param 转换对象。
  21283. * @returns {string|object}
  21284. */
  21285. static toJsonParameters(param) {
  21286. var parameters = {
  21287. aggName: param.aggName,
  21288. aggFieldName: param.aggFieldName,
  21289. aggType: param.aggType,
  21290. precision: param.precision
  21291. };
  21292. if (param.subAgg) {
  21293. parameters.subAgg = param.subAgg;
  21294. }
  21295. return Util.toJson(parameters);
  21296. }
  21297. }
  21298. SuperMap.GeoHashGridAggParameter = GeoHashGridAggParameter;
  21299. ;// CONCATENATED MODULE: ./src/common/iServer/GeometryOverlayAnalystParameters.js
  21300. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21301. * This program are made available under the terms of the Apache License, Version 2.0
  21302. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21303. /**
  21304. * @class SuperMap.GeometryOverlayAnalystParameters
  21305. * @category iServer SpatialAnalyst OverlayAnalyst
  21306. * @classdesc
  21307. * 几何对象叠加分析参数类。对指定的某两个几何对象做叠加分析。通过该类可以指定要做叠加分析的几何对象、叠加操作类型。
  21308. * @param {Object} options - 参数。
  21309. * @param {Object} options.operateGeometry - 叠加分析的操作几何对象。 </br>
  21310. * 点类型可以是:{@link SuperMap.Geometry.Point}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}。</br>
  21311. * 线类型可以是:{@link SuperMap.Geometry.LineString}|{@link SuperMap.Geometry.LinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link GeoJSONObject}。</br>
  21312. * 面类型可以是:{@link SuperMap.Geometry.Polygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link GeoJSONObject}。
  21313. * @param {Object} options.sourceGeometry - 叠加分析的源几何对象。
  21314. * @param {Array.<Object>} [options.operateGeometries] - 批量叠加分析的操作几何对象数组。
  21315. * @param {Array.<Object>} [options.sourceGeometries] -批量叠加分析的源几何对象数组。
  21316. * @param {SuperMap.OverlayOperationType} [options.operation] - 叠加操作枚举值。
  21317. * @extends {SuperMap.OverlayAnalystParameters}
  21318. */
  21319. class GeometryOverlayAnalystParameters extends OverlayAnalystParameters {
  21320. constructor(options) {
  21321. super(options);
  21322. if (options && options.operateGeometry) {
  21323. this.operateGeometry = options.operateGeometry;
  21324. }
  21325. if (options && options.sourceGeometry) {
  21326. this.sourceGeometry = options.sourceGeometry;
  21327. }
  21328. if (options && options.operateGeometries) {
  21329. this.operateGeometries = options.operateGeometries;
  21330. }
  21331. if (options && options.sourceGeometries) {
  21332. this.sourceGeometries = options.sourceGeometries;
  21333. }
  21334. if (options) {
  21335. Util.extend(this, options);
  21336. }
  21337. this.CLASS_NAME = "SuperMap.GeometryOverlayAnalystParameters";
  21338. }
  21339. /**
  21340. * @function SuperMap.GeometryOverlayAnalystParameters.prototype.destroy
  21341. * @override
  21342. */
  21343. destroy() {
  21344. super.destroy();
  21345. var me = this;
  21346. if (me.sourceGeometry) {
  21347. me.sourceGeometry.destroy();
  21348. me.sourceGeometry = null;
  21349. }
  21350. if (me.sourceGeometries) {
  21351. me.sourceGeometries.destroy();
  21352. me.sourceGeometries = null;
  21353. }
  21354. if (me.sourceGeometry) {
  21355. me.sourceGeometry.destroy();
  21356. me.sourceGeometry = null;
  21357. }
  21358. if (me.operateGeometries) {
  21359. me.operateGeometries.destroy();
  21360. me.operateGeometries = null;
  21361. }
  21362. }
  21363. /**
  21364. * @function SuperMap.GeometryOverlayAnalystParameters.toObject
  21365. * @param {SuperMap.GeometryOverlayAnalystParameters} geometryOverlayAnalystParameters - 几何对象叠加分析参数类。
  21366. * @param {SuperMap.GeometryOverlayAnalystParameters} tempObj - 几何对象叠加分析参数对象。
  21367. * @description 将几何对象叠加分析参数对象转换为 JSON 对象。
  21368. * @returns {Object} JSON 对象。
  21369. */
  21370. static toObject(geometryOverlayAnalystParameters, tempObj) {
  21371. for (var name in geometryOverlayAnalystParameters) {
  21372. if (name === "sourceGeometry") {
  21373. tempObj.sourceGeometry = ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.sourceGeometry);
  21374. } else if (name === "sourceGeometries") {
  21375. var sourceGeometries = [];
  21376. for (var i = 0; i < geometryOverlayAnalystParameters.sourceGeometries.length; i++) {
  21377. sourceGeometries.push(ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.sourceGeometries[i]));
  21378. }
  21379. tempObj.sourceGeometries = sourceGeometries;
  21380. } else if (name === "operateGeometry") {
  21381. tempObj.operateGeometry = ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.operateGeometry);
  21382. } else if (name === "operateGeometries") {
  21383. var operateGeometries = [];
  21384. for (var j = 0; j < geometryOverlayAnalystParameters.operateGeometries.length; j++) {
  21385. operateGeometries.push(ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.operateGeometries[j]));
  21386. }
  21387. tempObj.operateGeometries = operateGeometries;
  21388. } else {
  21389. tempObj[name] = geometryOverlayAnalystParameters[name];
  21390. }
  21391. }
  21392. }
  21393. }
  21394. SuperMap.GeometryOverlayAnalystParameters = GeometryOverlayAnalystParameters;
  21395. ;// CONCATENATED MODULE: ./src/common/iServer/GeometrySurfaceAnalystParameters.js
  21396. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21397. * This program are made available under the terms of the Apache License, Version 2.0
  21398. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21399. /**
  21400. * @class SuperMap.GeometrySurfaceAnalystParameters
  21401. * @category iServer SpatialAnalyst SurfaceAnalyst
  21402. * @classdesc 几何对象表面分析参数类。该类对几何对象表面分析所用到的参数进行设置。
  21403. * @param {Object} options - 参数。
  21404. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} options.points - 表面分析的坐标点数组。
  21405. * @param {Array.<number>} options.zValues - 表面分析的坐标点的 Z 值数组。
  21406. * @param {number} [options.resolution] - 获取或设置指定中间结果(栅格数据集)的分辨率。
  21407. * @param {SuperMap.DataReturnOption} [options.resultSetting] - 结果返回设置类。
  21408. * @param {SuperMap.SurfaceAnalystParametersSetting} options.extractParameter - 获取或设置表面分析参数。
  21409. * @param {SuperMap.SurfaceAnalystMethod} [options.surfaceAnalystMethod = SuperMap.SurfaceAnalystMethod.ISOLINE] - 获取或设置表面分析的提取方法,提取等值线和提取等值面。
  21410. * @extends {SuperMap.SurfaceAnalystParameters}
  21411. */
  21412. class GeometrySurfaceAnalystParameters extends SurfaceAnalystParameters {
  21413. constructor(options) {
  21414. super(options);
  21415. /**
  21416. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} SuperMap.GeometrySurfaceAnalystParameters.prototype.points
  21417. * @description 获取或设置用于表面分析的坐标点数组。
  21418. */
  21419. this.points = null;
  21420. /**
  21421. * @member {Array.<number>} SuperMap.GeometrySurfaceAnalystParameters.prototype.zValues
  21422. * @description 获取或设置用于提取操作的值。提取等值线时,将使用该数组中的值,
  21423. * 对几何对象中的坐标点数组进行插值分析,得到栅格数据集(中间结果),接着从栅格数据集提取等值线。
  21424. */
  21425. this.zValues = null;
  21426. if (options) {
  21427. Util.extend(this, options);
  21428. }
  21429. this.CLASS_NAME = "SuperMap.GeometrySurfaceAnalystParameters";
  21430. }
  21431. /**
  21432. * @function SuperMap.GeometrySurfaceAnalystParameters.prototype.destroy
  21433. * @override
  21434. */
  21435. destroy() {
  21436. super.destroy();
  21437. var me = this;
  21438. if (me.points) {
  21439. for (var i = 0, points = me.points, len = points.length; i < len; i++) {
  21440. points[i].destroy();
  21441. }
  21442. me.points = null;
  21443. }
  21444. me.zValues = null;
  21445. }
  21446. }
  21447. SuperMap.GeometrySurfaceAnalystParameters = GeometrySurfaceAnalystParameters;
  21448. ;// CONCATENATED MODULE: ./src/common/iServer/GeometryThiessenAnalystParameters.js
  21449. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21450. * This program are made available under the terms of the Apache License, Version 2.0
  21451. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21452. /**
  21453. * @class SuperMap.GeometryThiessenAnalystParameters
  21454. * @constructs SuperMap.GeometryThiessenAnalystParameters
  21455. * @category iServer SpatialAnalyst ThiessenPolygonAnalyst
  21456. * @classdesc 几何对象泰森多边形分析参数类。对指定的某个几何对象做泰森多边形分析。通过该类可以指定要做泰森多边形分析的几何对象、返回数据集名称等。
  21457. * @param {Object} options - 参数。
  21458. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} options.points - 使用点数组进行分析时使用的几何对象。
  21459. * @extends {SuperMap.ThiessenAnalystParameters}
  21460. */
  21461. class GeometryThiessenAnalystParameters extends ThiessenAnalystParameters {
  21462. constructor(options) {
  21463. super(options);
  21464. /**
  21465. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} SuperMap.GeometryThiessenAnalystParameters.prototype.points
  21466. * @description 使用点数组进行分析时使用的几何对象。
  21467. */
  21468. this.points = null;
  21469. if (options) {
  21470. Util.extend(this, options);
  21471. }
  21472. this.CLASS_NAME = "SuperMap.GeometryThiessenAnalystParameters";
  21473. }
  21474. /**
  21475. * @function SuperMap.GeometryThiessenAnalystParameters.prototype.destroy
  21476. * @override
  21477. */
  21478. destroy() {
  21479. super.destroy();
  21480. var me = this;
  21481. if (me.points) {
  21482. for (var i = me.points.length - 1; i >= 0; i--) {
  21483. me.points[i].destroy();
  21484. }
  21485. me.points = null;
  21486. }
  21487. }
  21488. /**
  21489. * @function SuperMap.GeometryThiessenAnalystParameters.toObject
  21490. * @param {SuperMap.GeometryThiessenAnalystParameters} geometryThiessenAnalystParameters - 几何对象泰森多边形分析参数类。
  21491. * @param {SuperMap.GeometryThiessenAnalystParameters} tempObj - 几何对象泰森多边形分析参数对象。
  21492. * @description 将几何对象泰森多边形分析参数对象转换为 JSON 对象。
  21493. * @returns {Object} JSON 对象。
  21494. */
  21495. static toObject(geometryThiessenAnalystParameters, tempObj) {
  21496. for (var name in geometryThiessenAnalystParameters) {
  21497. if (name === "clipRegion") {
  21498. tempObj.clipRegion = ServerGeometry.fromGeometry(geometryThiessenAnalystParameters.clipRegion);
  21499. } else {
  21500. tempObj[name] = geometryThiessenAnalystParameters[name];
  21501. }
  21502. }
  21503. }
  21504. }
  21505. SuperMap.GeometryThiessenAnalystParameters = GeometryThiessenAnalystParameters;
  21506. ;// CONCATENATED MODULE: ./src/common/iServer/GeoprocessingService.js
  21507. /**
  21508. * @class SuperMap.GeoprocessingService
  21509. * @category iServer GeoprocessingService
  21510. * @classdesc 地理处理服务接口的基类。
  21511. * @version 10.1.0
  21512. * @extends {SuperMap.CommonServiceBase}
  21513. * @param {string} url - 服务地址。
  21514. * @param {Object} options - 参数。
  21515. * @param {SuperMap.Events} options.events - 处理所有事件的对象。
  21516. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,iServer|iPortal|Online。
  21517. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  21518. */
  21519. class GeoprocessingService extends CommonServiceBase {
  21520. constructor(url, options) {
  21521. options = options || {};
  21522. options.EVENT_TYPES = ['processCompleted', 'processFailed', 'processRunning'];
  21523. super(url, options);
  21524. this.CLASS_NAME = 'SuperMap.GeoprocessingService';
  21525. this.headers = {};
  21526. this.crossOrigin = true;
  21527. }
  21528. /**
  21529. * @function SuperMap.GeoprocessingService.prototype.getTools
  21530. * @description 获取地理处理工具列表。
  21531. */
  21532. getTools() {
  21533. this._get(`${this.url}/list`);
  21534. }
  21535. /**
  21536. * @function SuperMap.GeoprocessingService.prototype.getTool
  21537. * @description 获取地理处理工具的ID、名称、描述、输入参数、环境参数和输出结果等相关参数。
  21538. * @param {string} identifier - 地理处理工具ID。
  21539. */
  21540. getTool(identifier) {
  21541. this._get(`${this.url}/${identifier}`);
  21542. }
  21543. /**
  21544. * @function SuperMap.GeoprocessingService.prototype.execute
  21545. * @description 同步执行地理处理工具。
  21546. * @param {string} identifier - 地理处理工具ID。
  21547. * @param {Object} parameter - 地理处理工具的输入参数。
  21548. * @param {Object} environment - 地理处理工具的环境参数。
  21549. */
  21550. execute(identifier, parameter, environment) {
  21551. parameter = parameter ? parameter : null;
  21552. environment = environment ? environment : null;
  21553. const executeParamter = { parameter, environment };
  21554. this._get(`${this.url}/${identifier}/execute`, executeParamter);
  21555. }
  21556. /**
  21557. * @function SuperMap.GeoprocessingService.prototype.submitJob
  21558. * @description 异步执行地理处理工具。
  21559. * @param {string} identifier - 地理处理工具ID。
  21560. * @param {Object} parameter - 地理处理工具的输入参数。
  21561. * @param {Object} environments - 地理处理工具的环境参数。
  21562. */
  21563. submitJob(identifier, parameter, environments) {
  21564. parameter = parameter ? parameter : null;
  21565. environments = environments ? environments : null;
  21566. const asyncParamter = { parameter: parameter, environments: environments };
  21567. this.request({
  21568. url: `${this.url}/${identifier}/jobs`,
  21569. headers: { 'Content-type': 'application/json' },
  21570. method: 'POST',
  21571. data: JSON.stringify(asyncParamter),
  21572. scope: this,
  21573. success: this.serviceProcessCompleted,
  21574. failure: this.serviceProcessFailed
  21575. });
  21576. }
  21577. /**
  21578. * @function SuperMap.GeoprocessingService.prototype.waitForJobCompletion
  21579. * @description 获取地理处理异步执行状态信息。
  21580. * @param {string} jobId - 地理处理任务ID。
  21581. * @param {string} identifier - 地理处理工具ID。
  21582. * @param {Object} options - 状态信息参数。
  21583. * @param {number} options.interval - 定时器时间间隔。
  21584. * @param {Callback} options.statusCallback - 任务状态的回调函数。
  21585. */
  21586. waitForJobCompletion(jobId, identifier, options) {
  21587. const me = this;
  21588. const timer = setInterval(function () {
  21589. const serviceProcessCompleted = function (serverResult) {
  21590. const state = serverResult.state.runState;
  21591. if (options.statusCallback) {
  21592. options.statusCallback(state);
  21593. }
  21594. switch (state) {
  21595. case 'FINISHED':
  21596. clearInterval(timer);
  21597. me.events.triggerEvent('processCompleted', {
  21598. result: serverResult
  21599. });
  21600. break;
  21601. case 'FAILED':
  21602. clearInterval(timer);
  21603. me.events.triggerEvent('processFailed', {
  21604. result: serverResult
  21605. });
  21606. break;
  21607. case 'CANCELED':
  21608. clearInterval(timer);
  21609. me.events.triggerEvent('processFailed', {
  21610. result: serverResult
  21611. });
  21612. break;
  21613. }
  21614. };
  21615. me._get(`${me.url}/${identifier}/jobs/${jobId}`, null, serviceProcessCompleted);
  21616. }, options.interval);
  21617. }
  21618. /**
  21619. * @function SuperMap.GeoprocessingService.prototype.getJobInfo
  21620. * @description 获取地理处理任务的执行信息。
  21621. * @param {string} identifier - 地理处理工具ID。
  21622. * @param {string} jobId - 地理处理任务ID。
  21623. */
  21624. getJobInfo(identifier, jobId) {
  21625. this._get(`${this.url}/${identifier}/jobs/${jobId}`);
  21626. }
  21627. /**
  21628. * @function SuperMap.GeoprocessingService.prototype.cancelJob
  21629. * @description 取消地理处理任务的异步执行。
  21630. * @param {string} identifier - 地理处理工具ID。
  21631. * @param {string} jobId - 地理处理任务ID。
  21632. */
  21633. cancelJob(identifier, jobId) {
  21634. this._get(`${this.url}/${identifier}/jobs/${jobId}/cancel`);
  21635. }
  21636. /**
  21637. * @function SuperMap.GeoprocessingService.prototype.getJobs
  21638. * @description 获取地理处理服务任务列表。
  21639. * @param {string} identifier - 地理处理工具ID。(传参代表identifier算子的任务列表,不传参代表所有任务的列表)
  21640. */
  21641. getJobs(identifier) {
  21642. let url = `${this.url}/jobs`;
  21643. if (identifier) {
  21644. url = `${this.url}/${identifier}/jobs`;
  21645. }
  21646. this._get(url);
  21647. }
  21648. /**
  21649. * @function SuperMap.GeoprocessingService.prototype.getResults
  21650. * @description 地理处理工具执行的结果等,支持结果过滤。
  21651. * @param {string} identifier - 地理处理工具ID。
  21652. * @param {string} jobId - 地理处理任务ID。
  21653. * @param {string} filter - 输出异步结果的id。(可选,传入filter参数时对该地理处理工具执行的结果进行过滤获取,不填参时显示所有的执行结果)
  21654. */
  21655. getResults(identifier, jobId, filter) {
  21656. let url = `${this.url}/${identifier}/jobs/${jobId}/results`;
  21657. if (filter) {
  21658. url = `${url}/${filter}`;
  21659. }
  21660. this._get(url);
  21661. }
  21662. _get(url, paramter, serviceProcessCompleted, serviceProcessFailed) {
  21663. this.request({
  21664. url: url,
  21665. method: 'GET',
  21666. params: paramter,
  21667. headers: { 'Content-type': 'application/json' },
  21668. scope: this,
  21669. success: serviceProcessCompleted ? serviceProcessCompleted : this.serviceProcessCompleted,
  21670. failure: serviceProcessFailed ? serviceProcessFailed : this.serviceProcessFailed
  21671. });
  21672. }
  21673. }
  21674. SuperMap.GeoprocessingService = GeoprocessingService;
  21675. ;// CONCATENATED MODULE: ./src/common/iServer/GeoRelationAnalystParameters.js
  21676. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21677. * This program are made available under the terms of the Apache License, Version 2.0
  21678. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21679. /**
  21680. * @class SuperMap.GeoRelationAnalystParameters
  21681. * @category iServer SpatialAnalyst GeoRelationAnalyst
  21682. * @classdesc 空间关系分析服务参数类。使用该类可以为空间关系分析服务提供所需的参数信息。
  21683. * @param {Object} options - 参数。
  21684. * @param {SuperMap.FilterParameter} options.sourceFilter - 空间关系分析中的源数据集查询参数。仅 name, ids, attributeFilter 和 fields 字段有效。
  21685. * @param {SuperMap.FilterParameter} options.referenceFilter - 空间关系分析中的参考数据集查询参数。仅 name, ids, attributeFilter 和 fields 字段有效。
  21686. * @param {SuperMap.SpatialRelationType} options.spatialRelationType - 指定的空间关系类型。
  21687. * @param {boolean} [options.isBorderInside] - 边界处理方式,即位于面边线上的点是否被面包含。此参数仅用于空间关系为包含或被包含的情况。
  21688. * @param {boolean} [options.returnFeature] - 是否返回 Feature 信息。
  21689. * @param {boolean} [options.returnGeoRelatedOnly=true] - 仅返回满足指定空间关系的空间对象。
  21690. * @param {number} [options.startRecord=0] - 分析结果起始记录位置。
  21691. * @param {number} [options.expectCount=500] - 空间关系分析期望返回结果记录数,如果实际不足500条结果则返回所有分析结果。
  21692. */
  21693. class GeoRelationAnalystParameters {
  21694. constructor(options) {
  21695. /**
  21696. * @member {string} SuperMap.GeoRelationAnalystParameters.prototype.dataset
  21697. * @description 源数据集名称。
  21698. */
  21699. this.dataset = null;
  21700. /**
  21701. * @member {SuperMap.FilterParameter} SuperMap.GeoRelationAnalystParameters.prototype.sourceFilter
  21702. * @description 空间关系分析中的源数据集查询参数。仅 ids、attributeFilter 和 fields 字段有效。
  21703. */
  21704. this.sourceFilter = null;
  21705. /**
  21706. * @member {SuperMap.FilterParameter} SuperMap.GeoRelationAnalystParameters.prototype.referenceFilter
  21707. * @description 空间关系分析中的参考数据集查询参数。仅 name,ids,attributeFilter 和 fields 字段有效。
  21708. */
  21709. this.referenceFilter = null;
  21710. /**
  21711. * @member {SuperMap.SpatialRelationType} SuperMap.GeoRelationAnalystParameters.prototype.spatialRelationType
  21712. * @description 指定的空间关系类型。
  21713. */
  21714. this.spatialRelationType = null;
  21715. /**
  21716. * @member {boolean} [SuperMap.GeoRelationAnalystParameters.prototype.isBorderInside]
  21717. * @description 边界处理方式,即位于面边线上的点是否被面包含。此参数仅用于空间关系为包含或被包含的情况。
  21718. */
  21719. this.isBorderInside = null;
  21720. /**
  21721. * @member {boolean} [SuperMap.GeoRelationAnalystParameters.prototype.returnFeature]
  21722. * @description 是否返回 Feature 信息。
  21723. */
  21724. this.returnFeature = null;
  21725. /**
  21726. * @member {boolean} [SuperMap.GeoRelationAnalystParameters.prototype.returnGeoRelatedOnly=true]
  21727. * @description 是否仅返回满足指定空间关系的空间对象。
  21728. */
  21729. this.returnGeoRelatedOnly = null;
  21730. /**
  21731. * @member {number} [SuperMap.GeoRelationAnalystParameters.prototype.returnGeoRelatedOnly=0]
  21732. * @description 分析结果起始记录位置。
  21733. */
  21734. this.startRecord = 0;
  21735. /**
  21736. * @member {number} [SuperMap.GeoRelationAnalystParameters.prototype.expectCount=500]
  21737. * @description 空间关系分析期望返回结果记录数,如果实际不足 500 条结果则返回所有分析结果。
  21738. */
  21739. this.expectCount = 500;
  21740. if (options) {
  21741. Util.extend(this, options);
  21742. }
  21743. this.CLASS_NAME = "SuperMap.GeoRelationAnalystParameters";
  21744. }
  21745. /**
  21746. * @function SuperMap.GeoRelationAnalystParameters.prototype.destroy
  21747. * @description 释放资源,将引用资源的属性置空。
  21748. */
  21749. destroy() {
  21750. var me = this;
  21751. if (me.sourceFilter) {
  21752. me.sourceFilter.destroy();
  21753. }
  21754. me.sourceFilter = null;
  21755. if (me.referenceFilter) {
  21756. me.referenceFilter.destroy();
  21757. }
  21758. me.referenceFilter = null;
  21759. me.dataset = null;
  21760. me.spatialRelationType = null;
  21761. me.isBorderInside = null;
  21762. me.returnFeature = null;
  21763. me.returnGeoRelatedOnly = null;
  21764. me.startRecord = null;
  21765. me.expectCount = null;
  21766. }
  21767. }
  21768. SuperMap.GeoRelationAnalystParameters = GeoRelationAnalystParameters;
  21769. ;// CONCATENATED MODULE: ./src/common/iServer/GeoRelationAnalystService.js
  21770. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21771. * This program are made available under the terms of the Apache License, Version 2.0
  21772. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21773. /**
  21774. * @class SuperMap.GeoRelationAnalystService
  21775. * @category iServer SpatialAnalyst GeoRelationAnalyst
  21776. * @classdesc 空间关系分析服务类。该类负责将客户设置的空间关系分析服务参数传递给服务端,并接收服务端返回的空间关系分析结果数据。
  21777. * @param {string} url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  21778. * @param {Object} options - 参数。</br>
  21779. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  21780. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  21781. * @param {Object} [options.headers] - 请求头。
  21782. * @extends {SuperMap.SpatialAnalystBase}
  21783. * @example 实例化该类如下例所示:
  21784. * (start code)
  21785. * function datasetGeoRelationAnalystProcess() {
  21786. * var referenceFilter = new SuperMap.FilterParameter({
  21787. * name:"Frame_R@Changchun",
  21788. * attributeFilter:"SmID>0"});
  21789. * var sourceFilter = new SuperMap.FilterParameter({
  21790. * attributeFilter:"SmID>0"});
  21791. * //初始化服务类
  21792. * var datasetGeoRelationService = new SuperMap.GeoRelationAnalystService(
  21793. * "http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst/"),
  21794. * //构建参数类
  21795. * datasetGeoRelationParameters = new SuperMap.GeoRelationAnalystParameters({
  21796. * dataset: "Park@Changchun",
  21797. * startRecord: 0,
  21798. * expectCount: 20,
  21799. * sourceFilter: sourceFilter,
  21800. * referenceFilter: referenceFilter,
  21801. * spatialRelationType: SuperMap.SpatialRelationType.INTERSECT,
  21802. * isBorderInside: true,
  21803. * returnFeature: true,
  21804. * returnGeoRelatedOnly: true
  21805. * });
  21806. * datasetGeoRelationService.events.on({
  21807. * "processCompleted": datasetGeoRelationAnalystCompleted,
  21808. * "processFailed": datasetGeoRelationAnalystFailed});
  21809. * //执行
  21810. * datasetGeoRelationService.processAsync(datasetGeoRelationParameters);
  21811. * }
  21812. * function Completed(datasetGeoRelationAnalystCompleted){//todo};
  21813. * function Error(datasetGeoRelationAnalystFailed){//todo};
  21814. * (end)
  21815. *
  21816. */
  21817. class GeoRelationAnalystService extends SpatialAnalystBase {
  21818. constructor(url, options) {
  21819. super(url, options);
  21820. this.CLASS_NAME = "SuperMap.GeoRelationAnalystService";
  21821. }
  21822. /**
  21823. * @function SuperMap.GeoRelationAnalystService.prototype.destroy
  21824. * @override
  21825. */
  21826. destroy() {
  21827. super.destroy();
  21828. }
  21829. /**
  21830. * @function SuperMap.GeoRelationAnalystService.prototype.processAsync
  21831. * @description 负责将客户端的空间关系分析参数传递到服务端
  21832. * @param {SuperMap.GeoRelationAnalystParameters} parameter - 空间关系分析所需的参数信息。
  21833. */
  21834. processAsync(parameter) {
  21835. if (!(parameter instanceof GeoRelationAnalystParameters)) {
  21836. return;
  21837. }
  21838. var me = this;
  21839. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/georelation');
  21840. var jsonParameters = SuperMap.Util.toJSON(parameter);
  21841. me.url = Util.urlAppend(me.url, 'returnContent=true');
  21842. me.request({
  21843. method: "POST",
  21844. data: jsonParameters,
  21845. scope: me,
  21846. success: me.serviceProcessCompleted,
  21847. failure: me.serviceProcessFailed
  21848. });
  21849. }
  21850. }
  21851. SuperMap.GeoRelationAnalystService = GeoRelationAnalystService;
  21852. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesParametersBase.js
  21853. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21854. * This program are made available under the terms of the Apache License, Version 2.0
  21855. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21856. /**
  21857. * @class SuperMap.GetFeaturesParametersBase
  21858. * @category iServer Data FeatureResults
  21859. * @classdesc 要素查询参数基类。
  21860. * @param {Object} options - 参数。
  21861. * @param {Array.<string>} options.datasetNames - 数据集集合中的数据集名称列表。
  21862. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  21863. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  21864. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  21865. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  21866. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  21867. */
  21868. class GetFeaturesParametersBase {
  21869. constructor(options) {
  21870. /**
  21871. * @member {Array.<string>} SuperMap.GetFeaturesParametersBase.prototype.datasetName
  21872. * @description 数据集集合中的数据集名称列表。
  21873. */
  21874. this.datasetNames = null;
  21875. /**
  21876. * @member {string} SuperMap.GetFeaturesParametersBase.prototype.targetEpsgCode
  21877. * @description 动态投影的目标坐标系对应的 EPSG Code,使用时需设置 returnContent 参数为 true。
  21878. */
  21879. this.targetEpsgCode = null;
  21880. /**
  21881. * @member {Object} SuperMap.GetFeaturesParametersBase.prototype.targetEpsgCode
  21882. * @description 动态投影的目标坐标系。使用时需设置 returnContent 参数为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  21883. */
  21884. this.targetPrj = null;
  21885. /**
  21886. * @member {boolean} [SuperMap.GetFeaturesParametersBase.prototype.returnContent=true]
  21887. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  21888. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  21889. * 如果为 false,则返回的是查询结果资源的 URI。
  21890. */
  21891. this.returnContent = true;
  21892. /**
  21893. * @member {number} [SuperMap.GetFeaturesParametersBase.prototype.fromIndex=0]
  21894. * @description 查询结果的最小索引号。如果该值大于查询结果的最大索引号,则查询结果为空。
  21895. */
  21896. this.fromIndex = 0;
  21897. /**
  21898. * @member {number} [SuperMap.GetFeaturesParametersBase.prototype.toIndex=19]
  21899. * @description 查询结果的最大索引号。如果该值大于查询结果的最大索引号,则以查询结果的最大索引号为终止索引号。
  21900. */
  21901. this.toIndex = 19;
  21902. /**
  21903. * @member {boolean} [SuperMap.GetFeaturesParametersBase.prototype.returnCountOnly=false]
  21904. * @description 只返回查询结果的总数。
  21905. */
  21906. this.returnCountOnly = false;
  21907. /**
  21908. * @member {number} [SuperMap.GetFeaturesParametersBase.prototype.maxFeatures=1000]
  21909. * @description 进行 SQL 查询时,用于设置服务端返回查询结果条目数量。
  21910. */
  21911. this.maxFeatures = null;
  21912. /**
  21913. * @member {Object} SuperMap.GetFeaturesParametersBase.prototype.aggregations
  21914. * @description 聚合查询参数,该参数仅支持数据来源 Elasticsearch 服务的数据服务。
  21915. */
  21916. this.aggregations = null;
  21917. Util.extend(this, options);
  21918. this.CLASS_NAME = "SuperMap.GetFeaturesParametersBase";
  21919. }
  21920. /**
  21921. *
  21922. * @function SuperMap.GetFeaturesParametersBase.prototype.destroy
  21923. * @description 释放资源,将引用资源的属性置空。
  21924. */
  21925. destroy() {
  21926. var me = this;
  21927. me.datasetNames = null;
  21928. me.returnContent = null;
  21929. me.fromIndex = null;
  21930. me.toIndex = null;
  21931. me.maxFeatures = null;
  21932. me.targetEpsgCode = null;
  21933. me.targetPrj = null;
  21934. if (me.aggregation) {
  21935. me.aggregation = null;
  21936. }
  21937. }
  21938. }
  21939. SuperMap.GetFeaturesParametersBase = GetFeaturesParametersBase;
  21940. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBoundsParameters.js
  21941. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21942. * This program are made available under the terms of the Apache License, Version 2.0
  21943. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21944. /**
  21945. * @class SuperMap.GetFeaturesByBoundsParameters
  21946. * @category iServer Data FeatureResults
  21947. * @classdesc 数据集范围查询参数类,该类用于设置数据集范围查询的相关参数。
  21948. * @param {Object} options - 参数。
  21949. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} options.bounds - 用于查询的范围对象。
  21950. * @param {Array.<string>} options.datasetNames - 数据集集合中的数据集名称列表。
  21951. * @param {string} [options.attributeFilter] - 范围查询属性过滤条件。
  21952. * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
  21953. * @param {SuperMap.SpatialQueryMode} [options.spatialQueryMode=SuperMap.SpatialQueryMode.CONTAIN] - 空间查询模式常量。
  21954. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  21955. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  21956. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  21957. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  21958. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  21959. * @extends {SuperMap.GetFeaturesParametersBase}
  21960. */
  21961. class GetFeaturesByBoundsParameters extends GetFeaturesParametersBase {
  21962. constructor(options) {
  21963. super(options);
  21964. /**
  21965. * @member {string} SuperMap.GetFeaturesByBoundsParameters.prototype.getFeatureMode
  21966. * @description 数据集查询模式。范围查询有 "BOUNDS","BOUNDS_ATTRIBUTEFILTER" 两种,当用户设置 attributeFilter 时会自动切换到 BOUNDS_ATTRIBUTEFILTER 访问服务。
  21967. */
  21968. this.getFeatureMode = GetFeaturesByBoundsParameters.getFeatureMode.BOUNDS;
  21969. /**
  21970. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.GetFeaturesByBoundsParameters.prototype.bounds
  21971. * @description 用于查询的范围对象。
  21972. *
  21973. */
  21974. this.bounds = null;
  21975. /**
  21976. * @member {Array.<string>} SuperMap.GetFeaturesByBoundsParameters.prototype.fields
  21977. * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
  21978. */
  21979. this.fields = null;
  21980. /**
  21981. * @member {string} SuperMap.GetFeaturesByBoundsParameters.prototype.attributeFilter
  21982. * @description 范围查询属性过滤条件。
  21983. */
  21984. this.attributeFilter = null;
  21985. /**
  21986. * @member {SuperMap.SpatialQueryMode} [SuperMap.GetFeaturesByBoundsParameters.prototype.spatialQueryMode=SuperMap.SpatialQueryMode.CONTAIN]
  21987. * @description 空间查询模式常量。
  21988. */
  21989. this.spatialQueryMode = SpatialQueryMode.CONTAIN;
  21990. Util.extend(this, options);
  21991. this.CLASS_NAME = "SuperMap.GetFeaturesByBoundsParameters";
  21992. }
  21993. /**
  21994. * @function SuperMap.GetFeaturesByBoundsParameters.prototype.destroy
  21995. * @override
  21996. */
  21997. destroy() {
  21998. super.destroy();
  21999. var me = this;
  22000. if (me.bounds) {
  22001. me.bounds.destroy();
  22002. me.bounds = null;
  22003. }
  22004. if (me.fields) {
  22005. while (me.fields.length > 0) {
  22006. me.fields.pop();
  22007. }
  22008. me.fields = null;
  22009. }
  22010. me.attributeFilter = null;
  22011. me.spatialQueryMode = null;
  22012. me.getFeatureMode = null;
  22013. }
  22014. /**
  22015. * @function SuperMap.GetFeaturesByBoundsParameters.toJsonParameters
  22016. * @description 将 {@link SuperMap.GetFeaturesByBoundsParameters} 对象参数转换为 JSON 字符串。
  22017. * @param {SuperMap.GetFeaturesByBoundsParameters} params - 范围查询参数。
  22018. * @returns {string} 转化后的 JSON 字符串。
  22019. *
  22020. */
  22021. static toJsonParameters(params) {
  22022. var filterParameter,
  22023. bounds,
  22024. parasByBounds;
  22025. bounds = {
  22026. "leftBottom": {"x": params.bounds.left, "y": params.bounds.bottom},
  22027. "rightTop": {"x": params.bounds.right, "y": params.bounds.top}
  22028. };
  22029. parasByBounds = {
  22030. datasetNames: params.datasetNames,
  22031. getFeatureMode: GetFeaturesByBoundsParameters.getFeatureMode.BOUNDS,
  22032. bounds: bounds,
  22033. spatialQueryMode: params.spatialQueryMode
  22034. };
  22035. if (params.fields) {
  22036. filterParameter = new FilterParameter();
  22037. filterParameter.name = params.datasetNames;
  22038. filterParameter.fields = params.fields;
  22039. parasByBounds.queryParameter = filterParameter;
  22040. }
  22041. if (params.attributeFilter) {
  22042. parasByBounds.attributeFilter = params.attributeFilter;
  22043. parasByBounds.getFeatureMode = GetFeaturesByBoundsParameters.getFeatureMode.BOUNDS_ATTRIBUTEFILTER;
  22044. }
  22045. if (params.maxFeatures && !isNaN(params.maxFeatures)) {
  22046. parasByBounds.maxFeatures = params.maxFeatures;
  22047. }
  22048. if (params.targetEpsgCode) {
  22049. parasByBounds.targetEpsgCode = params.targetEpsgCode;
  22050. }
  22051. if (!params.targetEpsgCode && params.targetPrj) {
  22052. parasByBounds.targetPrj = params.targetPrj;
  22053. }
  22054. return Util.toJSON(parasByBounds);
  22055. }
  22056. }
  22057. GetFeaturesByBoundsParameters.getFeatureMode = {
  22058. "BOUNDS": "BOUNDS",
  22059. "BOUNDS_ATTRIBUTEFILTER": "BOUNDS_ATTRIBUTEFILTER"
  22060. };
  22061. SuperMap.GetFeaturesByBoundsParameters = GetFeaturesByBoundsParameters;
  22062. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesServiceBase.js
  22063. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  22064. * This program are made available under the terms of the Apache License, Version 2.0
  22065. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22066. /**
  22067. * @class SuperMap.GetFeaturesServiceBase
  22068. * @category iServer Data FeatureResults
  22069. * @classdesc 数据服务中数据集查询服务基类。获取结果数据类型为 Object。包含 result 属性,result 的数据格式根据 format 参数决定为 GeoJSON 或者 iServerJSON。
  22070. * @extends SuperMap.CommonServiceBase
  22071. * @param {string} url - 数据查询结果资源地址。请求数据服务中数据集查询服务,
  22072. * URL应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/
  22073. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  22074. * @param {Object} options - 参数。
  22075. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  22076. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  22077. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  22078. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  22079. * @param {Object} [options.headers] - 请求头。
  22080. * @example
  22081. * var myService = new SuperMap.GetFeaturesServiceBase(url, {
  22082. * eventListeners: {
  22083. * "processCompleted": getFeatureCompleted,
  22084. * "processFailed": getFeatureError
  22085. * }
  22086. * });
  22087. */
  22088. class GetFeaturesServiceBase extends CommonServiceBase {
  22089. constructor(url, options) {
  22090. super(url, options);
  22091. options = options || {};
  22092. /**
  22093. * @member {boolean} [SuperMap.GetFeaturesServiceBase.prototype.returnContent=true]
  22094. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  22095. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  22096. * 如果为 false,则返回的是查询结果资源的 URI。
  22097. */
  22098. this.returnContent = true;
  22099. /**
  22100. * @member {number} [SuperMap.GetFeaturesServiceBase.prototype.fromIndex=0]
  22101. * @description 查询结果的最小索引号。如果该值大于查询结果的最大索引号,则查询结果为空。
  22102. */
  22103. this.fromIndex = 0;
  22104. /**
  22105. * @member {number} [SuperMap.GetFeaturesServiceBase.prototype.toIndex=19]
  22106. * @description 查询结果的最大索引号。
  22107. * 如果该值大于查询结果的最大索引号,则以查询结果的最大索引号为终止索引号。
  22108. */
  22109. this.toIndex = 19;
  22110. /**
  22111. * @member {number} [SuperMap.GetFeaturesServiceBase.prototype.maxFeatures=1000]
  22112. * @description 进行 SQL 查询时,用于设置服务端返回查询结果条目数量。
  22113. */
  22114. this.maxFeatures = null;
  22115. /**
  22116. * @member {string} [SuperMap.GetFeaturesServiceBase.prototype.format=SuperMap.DataFormat.GEOJSON]
  22117. * @description 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。
  22118. * 参数格式为 "ISERVER","GEOJSON"。
  22119. */
  22120. this.format = DataFormat.GEOJSON;
  22121. Util.extend(this, options);
  22122. this.url = Util.urlPathAppend(this.url, 'featureResults');
  22123. this.CLASS_NAME = "SuperMap.GetFeaturesServiceBase";
  22124. }
  22125. /**
  22126. * @function SuperMap.GetFeaturesServiceBase.prototype.destroy
  22127. * @description 释放资源,将引用资源的属性置空。
  22128. */
  22129. destroy() {
  22130. super.destroy();
  22131. var me = this;
  22132. me.returnContent = null;
  22133. me.fromIndex = null;
  22134. me.toIndex = null;
  22135. me.maxFeatures = null;
  22136. me.format = null;
  22137. }
  22138. /**
  22139. * @function SuperMap.GetFeaturesServiceBase.prototype.processAsync
  22140. * @description 将客户端的查询参数传递到服务端。
  22141. * @param {Object} params - 查询参数。
  22142. */
  22143. processAsync(params) {
  22144. if (!params) {
  22145. return;
  22146. }
  22147. var me = this,
  22148. jsonParameters = null,
  22149. firstPara = true;
  22150. me.returnContent = params.returnContent;
  22151. me.fromIndex = params.fromIndex;
  22152. me.toIndex = params.toIndex;
  22153. me.maxFeatures = params.maxFeatures;
  22154. if (me.returnContent) {
  22155. me.url = Util.urlAppend(me.url, 'returnContent=' + me.returnContent);
  22156. firstPara = false;
  22157. }
  22158. var isValidNumber = me.fromIndex != null && me.toIndex != null && !isNaN(me.fromIndex) && !isNaN(me.toIndex);
  22159. if (isValidNumber && me.fromIndex >= 0 && me.toIndex >= 0 && !firstPara) {
  22160. me.url = Util.urlAppend(me.url, `fromIndex=${me.fromIndex}&toIndex=${me.toIndex}`);
  22161. }
  22162. if (params.returnCountOnly) {
  22163. me.url = Util.urlAppend(me.url, "&returnCountOnly=" + params.returnContent)
  22164. }
  22165. jsonParameters = me.getJsonParameters(params);
  22166. me.request({
  22167. method: "POST",
  22168. data: jsonParameters,
  22169. scope: me,
  22170. success: me.serviceProcessCompleted,
  22171. failure: me.serviceProcessFailed
  22172. });
  22173. }
  22174. /**
  22175. * @function SuperMap.GetFeaturesServiceBase.prototype.getFeatureComplete
  22176. * @description 查询完成,执行此方法。
  22177. * @param {Object} result - 服务器返回的结果对象。
  22178. */
  22179. serviceProcessCompleted(result) {
  22180. var me = this;
  22181. result = Util.transformResult(result);
  22182. if (me.format === DataFormat.GEOJSON && result.features) {
  22183. var geoJSONFormat = new GeoJSON();
  22184. result.features = geoJSONFormat.toGeoJSON(result.features);
  22185. }
  22186. me.events.triggerEvent("processCompleted", {result: result});
  22187. }
  22188. }
  22189. SuperMap.GetFeaturesServiceBase = GetFeaturesServiceBase;
  22190. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBoundsService.js
  22191. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  22192. * This program are made available under the terms of the Apache License, Version 2.0
  22193. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22194. /**
  22195. * @class SuperMap.GetFeaturesByBoundsService
  22196. * @category iServer Data FeatureResults
  22197. * @classdesc 数据集范围查询服务类,查询与指定范围对象符合一定空间关系的矢量要素。
  22198. * @description 数据集范围查询服务类构造函数。
  22199. * @extends {SuperMap.GetFeaturesServiceBase}
  22200. * @param {string} url - 数据查询结果资源地址。请求数据服务中数据集查询服务,URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;
  22201. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  22202. * @param {Object} options - 参数。
  22203. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  22204. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  22205. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  22206. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  22207. * @param {Object} [options.headers] - 请求头。
  22208. * @example
  22209. * var myGetFeaturesByBoundsService = new SuperMa.GetFeaturesByBoundsService(url, {
  22210. * eventListeners: {
  22211. * "processCompleted": getFeatureCompleted,
  22212. * "processFailed": getFeatureError
  22213. * }
  22214. * });
  22215. * function getFeatureCompleted(object){//todo};
  22216. * function getFeatureError(object){//todo}
  22217. */
  22218. class GetFeaturesByBoundsService extends GetFeaturesServiceBase {
  22219. constructor(url, options) {
  22220. super(url, options);
  22221. this.CLASS_NAME = "SuperMap.GetFeaturesByBoundsService";
  22222. }
  22223. /**
  22224. * @function SuperMap.GetFeaturesByBoundsService.prototype.destroy
  22225. * @override
  22226. */
  22227. destroy() {
  22228. super.destroy();
  22229. }
  22230. /**
  22231. * @function SuperMap.GetFeaturesByBoundsService.prototype.getJsonParameters
  22232. * @description 将查询参数转化为 JSON 字符串。在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry,Bounds等)。
  22233. * @param params {SuperMap.GetFeaturesByBoundsParameters}
  22234. * @returns {string} 转化后的 JSON 字符串。
  22235. *
  22236. */
  22237. getJsonParameters(params) {
  22238. return GetFeaturesByBoundsParameters.toJsonParameters(params);
  22239. }
  22240. }
  22241. SuperMap.GetFeaturesByBoundsService = GetFeaturesByBoundsService;
  22242. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBufferParameters.js
  22243. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  22244. * This program are made available under the terms of the Apache License, Version 2.0
  22245. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22246. /**
  22247. * @class SuperMap.GetFeaturesByBufferParameters
  22248. * @category iServer Data FeatureResults
  22249. * @classdesc 数据服务中数据集缓冲区查询参数类。
  22250. * @param {Object} options - 参数。
  22251. * @param {number} options.bufferDistance - buffer 距离,单位与所查询图层对应的数据集单位相同。
  22252. * @param {Object} options.geometry - 空间查询条件。</br>
  22253. * @param {Array.<string>} options.dataSetNames - 数据集集合中的数据集名称列表。
  22254. * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
  22255. * @param {string} [options.attributeFilter] - 属性查询条件。
  22256. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  22257. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  22258. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  22259. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  22260. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  22261. * @extends {SuperMap.GetFeaturesParametersBase}
  22262. */
  22263. class GetFeaturesByBufferParameters extends GetFeaturesParametersBase {
  22264. constructor(options) {
  22265. super(options);
  22266. /**
  22267. * @member {number} SuperMap.GetFeaturesByBufferParameters.prototype.bufferDistance
  22268. * @description buffer 距离,单位与所查询图层对应的数据集单位相同。
  22269. */
  22270. this.bufferDistance = null;
  22271. /**
  22272. * @member {string} SuperMap.GetFeaturesByBufferParameters.prototype.attributeFilter
  22273. * @description 属性查询条件。
  22274. */
  22275. this.attributeFilter = null;
  22276. /**
  22277. * @member {Object} SuperMap.GetFeaturesByBufferParameters.prototype.geometry
  22278. * @description 空间查询条件。 <br>
  22279. * 点类型可以是:{@link SuperMap.Geometry.Point}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}。</br>
  22280. * 线类型可以是:{@link SuperMap.Geometry.LineString}|{@link SuperMap.Geometry.LinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}。</br>
  22281. * 面类型可以是:{@link SuperMap.Geometry.Polygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}。
  22282. */
  22283. this.geometry = null;
  22284. /**
  22285. * @member {Array.<string>} SuperMap.GetFeaturesByBufferParameters.prototype.fields
  22286. * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
  22287. */
  22288. this.fields = null;
  22289. Util.extend(this, options);
  22290. this.CLASS_NAME = "SuperMap.GetFeaturesByBufferParameters";
  22291. }
  22292. /**
  22293. * @function SuperMap.GetFeaturesByBufferParameters.prototype.destroy
  22294. * @override
  22295. */
  22296. destroy() {
  22297. super.destroy();
  22298. var me = this;
  22299. me.bufferDistance = null;
  22300. me.attributeFilter = null;
  22301. if (me.fields) {
  22302. while (me.fields.length > 0) {
  22303. me.fields.pop();
  22304. }
  22305. me.fields = null;
  22306. }
  22307. if (me.geometry) {
  22308. me.geometry.destroy();
  22309. me.geometry = null;
  22310. }
  22311. }
  22312. /**
  22313. * @function SuperMap.GetFeaturesByBufferParameters.toJsonParameters
  22314. * @description 将 SuperMap.GetFeaturesByBufferParameters 对象转换为 JSON 字符串。
  22315. * @param {SuperMap.GetFeaturesByBufferParameters} params - 数据集缓冲区查询参数对象。
  22316. * @returns {string} 转化后的 JSON 字符串。
  22317. */
  22318. static toJsonParameters(params) {
  22319. var filterParameter,
  22320. paramsBySql,
  22321. geometry;
  22322. geometry = ServerGeometry.fromGeometry(params.geometry);
  22323. paramsBySql = {
  22324. datasetNames: params.datasetNames,
  22325. getFeatureMode: "BUFFER",
  22326. bufferDistance: params.bufferDistance,
  22327. geometry: geometry
  22328. };
  22329. if (params.fields) {
  22330. filterParameter = new FilterParameter();
  22331. filterParameter.name = params.datasetNames;
  22332. filterParameter.fields = params.fields;
  22333. paramsBySql.queryParameter = filterParameter;
  22334. }
  22335. if (params.attributeFilter) {
  22336. paramsBySql.attributeFilter = params.attributeFilter;
  22337. paramsBySql.getFeatureMode = "BUFFER_ATTRIBUTEFILTER";
  22338. }
  22339. if (params.maxFeatures && !isNaN(params.maxFeatures)) {
  22340. paramsBySql.maxFeatures = params.maxFeatures;
  22341. }
  22342. if (params.targetEpsgCode) {
  22343. paramsBySql.targetEpsgCode = params.targetEpsgCode;
  22344. }
  22345. if (!params.targetEpsgCode && params.targetPrj) {
  22346. paramsBySql.targetPrj = params.targetPrj;
  22347. }
  22348. return Util.toJSON(paramsBySql);
  22349. }
  22350. }
  22351. SuperMap.GetFeaturesByBufferParameters = GetFeaturesByBufferParameters;
  22352. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBufferService.js
  22353. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  22354. * This program are made available under the terms of the Apache License, Version 2.0
  22355. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22356. /**
  22357. * @class SuperMap.GetFeaturesByBufferService
  22358. * @category iServer Data FeatureResults
  22359. * @classdesc 数据服务中数据集缓冲区查询服务类。
  22360. * @param {string} url - 数据查询结果资源地址。请求数据服务中数据集查询服务,
  22361. * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;
  22362. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  22363. * @param {Object} options - 参数。
  22364. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  22365. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  22366. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  22367. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  22368. * @param {Object} [options.headers] - 请求头。
  22369. * @extends {SuperMap.GetFeaturesServiceBase}
  22370. * @example
  22371. * var myGetFeaturesByBufferService = new SuperMap.GetFeaturesByBufferService(url, {
  22372. * eventListeners: {
  22373. * "processCompleted": GetFeaturesCompleted,
  22374. * "processFailed": GetFeaturesError
  22375. * }
  22376. * });
  22377. * function GetFeaturesCompleted(object){//todo};
  22378. * function GetFeaturesError(object){//todo};
  22379. */
  22380. class GetFeaturesByBufferService extends GetFeaturesServiceBase {
  22381. constructor(url, options) {
  22382. super(url, options);
  22383. this.CLASS_NAME = "SuperMap.GetFeaturesByBufferService";
  22384. }
  22385. /**
  22386. * @function SuperMap.GetFeaturesByBufferService.prototype.destroy
  22387. * @override
  22388. */
  22389. destroy() {
  22390. super.destroy();
  22391. }
  22392. /**
  22393. * @function SuperMap.GetFeaturesByBufferService.prototype.getJsonParameters
  22394. * @description 将查询参数转化为 JSON 字符串。在本类中重写此方法,可以实现不同种类的查询(IDs, SQL, Buffer, Geometry等)。
  22395. * @param {SuperMap.GetFeaturesByBufferParameters} params - 数据集缓冲区查询参数类。
  22396. * @returns {Object} 转化后的 JSON 字符串。
  22397. */
  22398. getJsonParameters(params) {
  22399. if (!(params instanceof GetFeaturesByBufferParameters)) {
  22400. return;
  22401. }
  22402. return SuperMap.GetFeaturesByBufferParameters.toJsonParameters(params);
  22403. }
  22404. }
  22405. SuperMap.GetFeaturesByBufferService = GetFeaturesByBufferService;
  22406. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByGeometryParameters.js
  22407. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  22408. * This program are made available under the terms of the Apache License, Version 2.0
  22409. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22410. /**
  22411. * @class SuperMap.GetFeaturesByGeometryParameters
  22412. * @category iServer Data FeatureResults
  22413. * @classdesc 数据集几何查询参数类。该类用于设置数据集几何查询的相关参数。
  22414. * @param {Object} options - 参数。
  22415. * @param {Object} options.geometry - 用于查询的几何对象。
  22416. * @param {Array.<string>} options.datasetNames - 数据集集合中的数据集名称列表。
  22417. * @param {string} [options.attributeFilter] - 几何查询属性过滤条件。
  22418. * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
  22419. * @param {SuperMap.SpatialQueryMode} [options.spatialQueryMode=SuperMap.SpatialQueryMode.CONTAIN] - 空间查询模式常量。
  22420. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  22421. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  22422. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  22423. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  22424. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  22425. * @extends {SuperMap.GetFeaturesParametersBase}
  22426. */
  22427. class GetFeaturesByGeometryParameters extends GetFeaturesParametersBase {
  22428. constructor(options) {
  22429. super(options);
  22430. /**
  22431. * @member {string} SuperMap.GetFeaturesByGeometryParameters.prototype.getFeatureMode
  22432. * @description 数据集查询模式。几何查询有 "SPATIAL","SPATIAL_ATTRIBUTEFILTER" 两种,当用户设置 attributeFilter 时会自动切换到 SPATIAL_ATTRIBUTEFILTER 访问服务。
  22433. */
  22434. this.getFeatureMode = "SPATIAL";
  22435. /**
  22436. * @member {Object} SuperMap.GetFeaturesByGeometryParameters.prototype.geometry
  22437. * @description 用于查询的几何对象。 </br>
  22438. * 点类型可以是:{@link SuperMap.Geometry.Point}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}。</br>
  22439. * 线类型可以是:{@link SuperMap.Geometry.LineString}|{@link SuperMap.Geometry.LinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}。</br>
  22440. * 面类型可以是:{@link SuperMap.Geometry.Polygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}。
  22441. */
  22442. this.geometry = null;
  22443. /**
  22444. * @member {Array.<string>} SuperMap.GetFeaturesByGeometryParameters.prototype.fields
  22445. * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
  22446. */
  22447. this.fields = null;
  22448. /**
  22449. * @member {string} SuperMap.GetFeaturesByGeometryParameters.prototype.attributeFilter
  22450. * @description 几何查询属性过滤条件。
  22451. */
  22452. this.attributeFilter = null;
  22453. /**
  22454. * @member {SuperMap.SpatialQueryMode} [SuperMap.GetFeaturesByGeometryParameters.prototype.spatialQueryMode=SuperMap.SpatialQueryMode.CONTAIN]
  22455. * @description 空间查询模式常量。
  22456. */
  22457. this.spatialQueryMode = SpatialQueryMode.CONTAIN;
  22458. Util.extend(this, options);
  22459. this.CLASS_NAME = "SuperMap.GetFeaturesByGeometryParameters";
  22460. }
  22461. /**
  22462. * @function SuperMap.GetFeaturesByGeometryParameters.prototype.destroy
  22463. * @description 释放资源,将引用资源的属性置空。
  22464. */
  22465. destroy() {
  22466. super.destroy();
  22467. var me = this;
  22468. if (me.geometry) {
  22469. me.geometry.destroy();
  22470. me.geometry = null;
  22471. }
  22472. if (me.fields) {
  22473. while (me.fields.length > 0) {
  22474. me.fields.pop();
  22475. }
  22476. me.fields = null;
  22477. }
  22478. me.attributeFilter = null;
  22479. me.spatialQueryMode = null;
  22480. me.getFeatureMode = null;
  22481. }
  22482. /**
  22483. * @function SuperMap.GetFeaturesByGeometryParameters.toJsonParameters
  22484. * @description 将 SuperMap.GetFeaturesByGeometryParameters 对象参数转换为 JSON 字符串。
  22485. * @param {SuperMap.GetFeaturesByGeometryParameters} params - 查询参数对象。
  22486. * @returns {string} 转化后的 JSON 字符串。
  22487. */
  22488. static toJsonParameters(params) {
  22489. var filterParameter,
  22490. geometry,
  22491. parasByGeometry;
  22492. geometry = ServerGeometry.fromGeometry(params.geometry);
  22493. parasByGeometry = {
  22494. datasetNames: params.datasetNames,
  22495. getFeatureMode: "SPATIAL",
  22496. geometry: geometry,
  22497. spatialQueryMode: params.spatialQueryMode
  22498. };
  22499. if (params.fields) {
  22500. filterParameter = new FilterParameter();
  22501. filterParameter.name = params.datasetNames;
  22502. filterParameter.fields = params.fields;
  22503. parasByGeometry.queryParameter = filterParameter;
  22504. }
  22505. if (params.attributeFilter) {
  22506. parasByGeometry.attributeFilter = params.attributeFilter;
  22507. parasByGeometry.getFeatureMode = "SPATIAL_ATTRIBUTEFILTER";
  22508. }
  22509. if (params.maxFeatures && !isNaN(params.maxFeatures)) {
  22510. parasByGeometry.maxFeatures = params.maxFeatures;
  22511. }
  22512. if (params.targetEpsgCode) {
  22513. parasByGeometry.targetEpsgCode = params.targetEpsgCode;
  22514. }
  22515. if (!params.targetEpsgCode && params.targetPrj) {
  22516. parasByGeometry.targetPrj = params.targetPrj;
  22517. }
  22518. return Util.toJSON(parasByGeometry);
  22519. }
  22520. }
  22521. SuperMap.GetFeaturesByGeometryParameters = GetFeaturesByGeometryParameters;
  22522. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByGeometryService.js
  22523. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  22524. * This program are made available under the terms of the Apache License, Version 2.0
  22525. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22526. /**
  22527. * @class SuperMap.GetFeaturesByGeometryService
  22528. * @category iServer Data FeatureResults
  22529. * @classdesc 数据集几何查询服务类,查询与指定几何对象符合一定空间关系的矢量要素。
  22530. * @param {string} url - 数据查询结果资源地址。请求数据服务中数据集查询服务。
  22531. * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data;
  22532. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data"
  22533. * @param {Object} options - 参数。</br>
  22534. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  22535. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  22536. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  22537. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  22538. * @param {Object} [options.headers] - 请求头。
  22539. * @extends {SuperMap.GetFeaturesServiceBase}
  22540. * @example
  22541. * var myService = new SuperMap.GetFeaturesByGeometryService(url, {
  22542. * eventListeners: {
  22543. * "processCompleted": getFeatureCompleted,
  22544. * "processFailed": getFeatureError
  22545. * }
  22546. * });
  22547. * function getFeatureCompleted(object){//todo};
  22548. * function getFeatureError(object){//todo}
  22549. */
  22550. class GetFeaturesByGeometryService extends GetFeaturesServiceBase {
  22551. constructor(url, options) {
  22552. super(url, options);
  22553. this.CLASS_NAME = "SuperMap.GetFeaturesByGeometryService";
  22554. }
  22555. /**
  22556. * @function SuperMap.GetFeaturesByGeometryService.prototype.destroy
  22557. * @override
  22558. */
  22559. destroy() {
  22560. super.destroy();
  22561. }
  22562. /**
  22563. * @function SuperMap.GetFeaturesByGeometryService.prototype.getJsonParameters
  22564. * @param {SuperMap.GetFeaturesByGeometryParameters} params - 数据集几何查询参数类。
  22565. * @description 将查询参数转化为 JSON 字符串。
  22566. * 在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry等)。
  22567. * @returns {Object} 转化后的 JSON 字符串。
  22568. */
  22569. getJsonParameters(params) {
  22570. return GetFeaturesByGeometryParameters.toJsonParameters(params);
  22571. }
  22572. }
  22573. SuperMap.GetFeaturesByGeometryService = GetFeaturesByGeometryService;
  22574. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByIDsParameters.js
  22575. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  22576. * This program are made available under the terms of the Apache License, Version 2.0
  22577. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22578. /**
  22579. * @class SuperMap.GetFeaturesByIDsParameters
  22580. * @category iServer Data FeatureResults
  22581. * @classdesc ID查询参数类。
  22582. * @param {Object} options - 参数。
  22583. * @param {Array.<number>} options.IDs - 所要查询指定的元素 ID 信息。
  22584. * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
  22585. * @param {Array.<string>} options.dataSetNames - 数据集集合中的数据集名称列表。
  22586. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  22587. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  22588. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  22589. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  22590. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  22591. * @extends {SuperMap.GetFeaturesParametersBase}
  22592. */
  22593. class GetFeaturesByIDsParameters extends GetFeaturesParametersBase {
  22594. constructor(options) {
  22595. super(options);
  22596. /**
  22597. * @member {string} SuperMap.GetFeaturesByIDsParameters.prototype.getFeatureMode
  22598. * @description 数据集查询模式。
  22599. */
  22600. this.getFeatureMode = "ID";
  22601. /**
  22602. * @member {Array.<number>} SuperMap.GetFeaturesByIDsParameters.prototype.IDs
  22603. * @description 所要查询指定的元素 ID 信息。
  22604. */
  22605. this.IDs = null;
  22606. /**
  22607. * @member {Array.<string>} SuperMap.GetFeaturesByIDsParameters.prototype.fields
  22608. * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
  22609. */
  22610. this.fields = null;
  22611. Util.extend(this, options);
  22612. this.CLASS_NAME = "SuperMap.GetFeaturesByIDsParameters";
  22613. }
  22614. /**
  22615. * @function SuperMap.GetFeaturesByIDsParameters.prototype.destroy
  22616. * @override
  22617. */
  22618. destroy() {
  22619. super.destroy();
  22620. var me = this;
  22621. me.IDs = null;
  22622. me.getFeatureMode = null;
  22623. if (me.fields) {
  22624. while (me.fields.length > 0) {
  22625. me.fields.pop();
  22626. }
  22627. me.fields = null;
  22628. }
  22629. }
  22630. /**
  22631. * @function SuperMap.GetFeaturesByIDsParameters.toJsonParameters
  22632. * @description 将 SuperMap.GetFeaturesByIDsParameters 对象转换为 JSON 字符串。
  22633. * @param {SuperMap.GetFeaturesByIDsParameters} params - ID 查询参数对象。
  22634. * @returns {string} 转化后的 JSON 字符串。
  22635. */
  22636. static toJsonParameters(params) {
  22637. var parasByIDs, filterParameter;
  22638. parasByIDs = {
  22639. datasetNames: params.datasetNames,
  22640. getFeatureMode: "ID",
  22641. ids: params.IDs
  22642. };
  22643. if (params.fields) {
  22644. filterParameter = new FilterParameter();
  22645. filterParameter.name = params.datasetNames;
  22646. filterParameter.fields = params.fields;
  22647. parasByIDs.queryParameter = filterParameter;
  22648. }
  22649. if (params.targetEpsgCode) {
  22650. parasByIDs.targetEpsgCode = params.targetEpsgCode;
  22651. }
  22652. if (!params.targetEpsgCode && params.targetPrj) {
  22653. parasByIDs.targetPrj = params.targetPrj;
  22654. }
  22655. return Util.toJSON(parasByIDs);
  22656. }
  22657. }
  22658. SuperMap.GetFeaturesByIDsParameters = GetFeaturesByIDsParameters;
  22659. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByIDsService.js
  22660. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  22661. * This program are made available under the terms of the Apache License, Version 2.0
  22662. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22663. /**
  22664. * @class SuperMap.GetFeaturesByIDsService
  22665. * @category iServer Data FeatureResults
  22666. * @classdesc 数据集ID查询服务类。在数据集集合中查找指定 ID 号对应的空间地物要素。
  22667. * @param {string} url - 数据查询结果资源地址。请求数据服务中数据集查询服务。
  22668. * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;</br>
  22669. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  22670. * @param {Object} options - 参数。</br>
  22671. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  22672. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  22673. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  22674. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  22675. * @param {Object} [options.headers] - 请求头。
  22676. * @extends {SuperMap.GetFeaturesServiceBase}
  22677. * @example
  22678. * var myGetFeaturesByIDsService = new SuperMap.GetFeaturesByIDsService(url, {
  22679. * eventListeners: {
  22680. * "processCompleted": getFeatureCompleted,
  22681. * "processFailed": getFeatureError
  22682. * }
  22683. * });
  22684. * function getFeatureCompleted(object){//todo};
  22685. * function getFeatureError(object){//todo}
  22686. */
  22687. class GetFeaturesByIDsService extends GetFeaturesServiceBase {
  22688. constructor(url, options) {
  22689. super(url, options);
  22690. this.CLASS_NAME = "SuperMap.GetFeaturesByIDsService";
  22691. }
  22692. /**
  22693. * @function SuperMap.GetFeaturesByIDsService.prototype.destroy
  22694. * @override
  22695. */
  22696. destroy() {
  22697. super.destroy();
  22698. }
  22699. /**
  22700. * @function SuperMap.GetFeaturesByIDsService.prototype.getJsonParameters
  22701. * @description 将查询参数转化为 JSON 字符串。
  22702. * 在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry等)。
  22703. * @param {SuperMap.GetFeaturesByIDsParameters} params - ID查询参数类。
  22704. * @returns {string} 转化后的 JSON 字符串。
  22705. */
  22706. getJsonParameters(params) {
  22707. return GetFeaturesByIDsParameters.toJsonParameters(params);
  22708. }
  22709. }
  22710. SuperMap.GetFeaturesByIDsService = GetFeaturesByIDsService;
  22711. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesBySQLParameters.js
  22712. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  22713. * This program are made available under the terms of the Apache License, Version 2.0
  22714. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22715. /**
  22716. * @class SuperMap.GetFeaturesBySQLParameters
  22717. * @category iServer Data FeatureResults
  22718. * @classdesc 数据服务中数据集 SQL 查询参数类。
  22719. * @param {Object} options - 参数。
  22720. * @param {SuperMap.FilterParameter} options.queryParameter - 查询过滤条件参数。
  22721. * @param {Array.<string>} options.datasetNames - 数据集集合中的数据集名称列表。
  22722. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  22723. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  22724. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  22725. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  22726. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  22727. * @extends {SuperMap.GetFeaturesParametersBase}
  22728. */
  22729. class GetFeaturesBySQLParameters extends GetFeaturesParametersBase {
  22730. constructor(options) {
  22731. super(options);
  22732. /**
  22733. * @member {string} SuperMap.GetFeaturesBySQLParameters.prototype.getFeatureMode
  22734. * @description 数据集查询模式。
  22735. */
  22736. this.getFeatureMode = "SQL";
  22737. /**
  22738. * @member {SuperMap.FilterParameter} SuperMap.GetFeaturesBySQLParameters.prototype.queryParameter
  22739. * @description 查询过滤条件参数类。
  22740. */
  22741. this.queryParameter = null;
  22742. Util.extend(this, options);
  22743. this.CLASS_NAME = "SuperMap.GetFeaturesBySQLParameters";
  22744. }
  22745. /**
  22746. * @function SuperMap.GetFeaturesBySQLParameters.prototype.destroy
  22747. * @override
  22748. */
  22749. destroy() {
  22750. super.destroy();
  22751. var me = this;
  22752. me.getFeatureMode = null;
  22753. if (me.queryParameter) {
  22754. me.queryParameter.destroy();
  22755. me.queryParameter = null;
  22756. }
  22757. }
  22758. /**
  22759. * @function SuperMap.GetFeaturesBySQLParameters.prototype.toJsonParameters
  22760. * @description 将 SuperMap.GetFeaturesBySQLParameters 对象转换为 JSON 字符串。
  22761. * @param {SuperMap.GetFeaturesBySQLParameters} params - 数据集 SQL 查询参数对象。
  22762. * @returns {string} 转化后的 JSON 字符串。
  22763. */
  22764. static toJsonParameters(params) {
  22765. var paramsBySql = {
  22766. datasetNames: params.datasetNames,
  22767. getFeatureMode: "SQL",
  22768. queryParameter: params.queryParameter
  22769. };
  22770. if (params.maxFeatures && !isNaN(params.maxFeatures)) {
  22771. paramsBySql.maxFeatures = params.maxFeatures;
  22772. }
  22773. if (params.aggregations) {
  22774. paramsBySql.aggregations = params.aggregations;
  22775. }
  22776. if (params.targetEpsgCode) {
  22777. paramsBySql.targetEpsgCode = params.targetEpsgCode;
  22778. }
  22779. if (!params.targetEpsgCode && params.targetPrj) {
  22780. paramsBySql.targetPrj = params.targetPrj;
  22781. }
  22782. return Util.toJSON(paramsBySql);
  22783. }
  22784. }
  22785. SuperMap.GetFeaturesBySQLParameters = GetFeaturesBySQLParameters;
  22786. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesBySQLService.js
  22787. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  22788. * This program are made available under the terms of the Apache License, Version 2.0
  22789. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22790. /**
  22791. * @class SuperMap.GetFeaturesBySQLService
  22792. * @constructs SuperMap.GetFeaturesBySQLService
  22793. * @category iServer Data FeatureResults
  22794. * @classdesc 数据服务中数据集 SQL 查询服务类。在一个或多个指定的图层上查询符合 SQL 条件的空间地物信息。
  22795. * @param {string} url - 数据查询结果资源地址。请求数据服务中数据集查询服务,
  22796. * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;</br>
  22797. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  22798. * @param {Object} options - 参数。</br>
  22799. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  22800. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  22801. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  22802. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  22803. * @param {Object} [options.headers] - 请求头。
  22804. * @extends {SuperMap.GetFeaturesServiceBase}
  22805. * @example
  22806. * var myGetFeaturesBySQLService = new SuperMap.GetFeaturesBySQLService(url, {
  22807. * eventListeners: {
  22808. * "processCompleted": GetFeaturesCompleted,
  22809. * "processFailed": GetFeaturesError
  22810. * }
  22811. * });
  22812. * function getFeaturesCompleted(object){//todo};
  22813. * function getFeaturesError(object){//todo};
  22814. *
  22815. */
  22816. class GetFeaturesBySQLService extends GetFeaturesServiceBase {
  22817. constructor(url, options) {
  22818. super(url, options);
  22819. this.CLASS_NAME = "SuperMap.GetFeaturesBySQLService";
  22820. }
  22821. /**
  22822. * @function SuperMap.GetFeaturesBySQLService.prototype.destroy
  22823. * @override
  22824. */
  22825. destroy() {
  22826. super.destroy();
  22827. }
  22828. /*
  22829. * @function SuperMap.GetFeaturesBySQLService.prototype.getJsonParameters
  22830. * @description 将查询参数转化为 JSON 字符串。
  22831. * 在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry等)。
  22832. * @param {SuperMap.GetFeaturesBySQLParameters} params - 数据集SQL查询参数类。
  22833. * @returns {string} 转化后的 JSON 字符串。
  22834. */
  22835. getJsonParameters(params) {
  22836. return GetFeaturesBySQLParameters.toJsonParameters(params);
  22837. }
  22838. }
  22839. SuperMap.GetFeaturesBySQLService = GetFeaturesBySQLService;
  22840. ;// CONCATENATED MODULE: ./src/common/iServer/GetFieldsService.js
  22841. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  22842. * This program are made available under the terms of the Apache License, Version 2.0
  22843. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22844. /**
  22845. * @class SuperMap.GetFieldsService
  22846. * @category iServer Data Field
  22847. * @classdesc 字段查询服务,支持查询指定数据集的中所有属性字段(field)的集合。
  22848. * @param {string} url - 服务的访问地址。如访问World Map服务,只需将url设为:http://localhost:8090/iserver/services/data-world/rest/data 即可。
  22849. * @param {Object} options - 参数。</br>
  22850. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  22851. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  22852. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  22853. * @param {string}options.datasource - 要查询的数据集所在的数据源名称。</br>
  22854. * @param {string}options.dataset - 要查询的数据集名称。</br>
  22855. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  22856. * @param {Object} [options.headers] - 请求头。
  22857. * @extends {SuperMap.CommonServiceBase}
  22858. * @example
  22859. * var myService = new SuperMap.GetFieldsService(url, {eventListeners: {
  22860. * "processCompleted": getFieldsCompleted,
  22861. * "processFailed": getFieldsError
  22862. * },
  22863. * datasource: "World",
  22864. * dataset: "Countries"
  22865. * };
  22866. *
  22867. */
  22868. class GetFieldsService extends CommonServiceBase {
  22869. constructor(url, options) {
  22870. super(url, options);
  22871. /**
  22872. * @member {string} SuperMap.GetFieldsService.prototype.datasource
  22873. * @description 要查询的数据集所在的数据源名称。
  22874. */
  22875. this.datasource = null;
  22876. /**
  22877. * @member {string} SuperMap.GetFieldsService.prototype.dataset
  22878. * @description 要查询的数据集名称。
  22879. */
  22880. this.dataset = null;
  22881. if (options) {
  22882. Util.extend(this, options);
  22883. }
  22884. this.CLASS_NAME = "SuperMap.GetFieldsService";
  22885. }
  22886. /**
  22887. * @function SuperMap.GetFieldsService.prototype.destroy
  22888. * @override
  22889. */
  22890. destroy() {
  22891. super.destroy();
  22892. var me = this;
  22893. me.datasource = null;
  22894. me.dataset = null;
  22895. }
  22896. /**
  22897. * @function SuperMap.GetFieldsService.prototype.processAsync
  22898. * @description 执行服务,查询指定数据集的字段信息。
  22899. */
  22900. processAsync() {
  22901. var me = this;
  22902. me.url = Util.urlPathAppend(me.url,`datasources/${me.datasource}/datasets/${me.dataset}/fields`);
  22903. me.request({
  22904. method: "GET",
  22905. data: null,
  22906. scope: me,
  22907. success: me.serviceProcessCompleted,
  22908. failure: me.serviceProcessFailed
  22909. });
  22910. }
  22911. }
  22912. SuperMap.GetFieldsService = GetFieldsService;
  22913. ;// CONCATENATED MODULE: ./src/common/iServer/GetGridCellInfosParameters.js
  22914. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  22915. * This program are made available under the terms of the Apache License, Version 2.0
  22916. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22917. /**
  22918. * @class SuperMap.GetGridCellInfosParameters
  22919. * @category iServer Data Grid
  22920. * @classdesc 数据服务栅格查询参数类。
  22921. * @param {Object} options - 参数。
  22922. * @param {string} options.datasetName - 数据集名称。
  22923. * @param {string} options.dataSourceName - 数据源名称。
  22924. * @param {number} options.X - 要查询的地理位置 X 轴。
  22925. * @param {number} options.Y - 要查询的地理位置 Y 轴。
  22926. */
  22927. class GetGridCellInfosParameters {
  22928. constructor(options) {
  22929. /**
  22930. * @member {string} SuperMap.GetGridCellInfosParameters.prototype.datasetName
  22931. * @description 数据集名称。
  22932. */
  22933. this.datasetName = null;
  22934. /**
  22935. * @member {string} SuperMap.GetGridCellInfosParameters.prototype.dataSourceName
  22936. * @description 数据源名称。
  22937. */
  22938. this.dataSourceName = null;
  22939. /**
  22940. * @member {number} SuperMap.GetGridCellInfosParameters.prototype.X
  22941. * @description 要查询的地理位置 X 轴。
  22942. */
  22943. this.X = null;
  22944. /**
  22945. * @member {number} SuperMap.GetGridCellInfosParameters.prototype.Y
  22946. * @description 要查询的地理位置 Y 轴。
  22947. */
  22948. this.Y = null;
  22949. Util.extend(this, options);
  22950. this.CLASS_NAME = "SuperMap.GetGridCellInfosParameters";
  22951. }
  22952. /**
  22953. * @function SuperMap.GetGridCellInfosParameters.prototype.destroy
  22954. * @description 释放资源,将引用的资源属性置空。
  22955. */
  22956. destroy() {
  22957. var me = this;
  22958. me.datasetName = null;
  22959. me.dataSourceName = null;
  22960. me.X = null;
  22961. me.Y = null;
  22962. }
  22963. }
  22964. SuperMap.GetGridCellInfosParameters = GetGridCellInfosParameters;
  22965. ;// CONCATENATED MODULE: ./src/common/iServer/GetGridCellInfosService.js
  22966. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  22967. * This program are made available under the terms of the Apache License, Version 2.0
  22968. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22969. /**
  22970. * @class SuperMap.GetGridCellInfosService
  22971. * @category iServer Data Grid
  22972. * @classdesc 数据栅格查询服务,支持查询指定地理位置的栅格信息。
  22973. * @param {string} url - 查询服务地址。例如: http://localhost:8090/iserver/services/data-jingjin/rest/data
  22974. * @param {Object} options - 参数。</br>
  22975. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。<br>
  22976. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  22977. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  22978. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  22979. * @param {Object} [options.headers] - 请求头。
  22980. * @extends {SuperMap.CommonServiceBase}
  22981. * @example
  22982. * var myService = new SuperMap.GetGridCellInfosService(url, {eventListeners: {
  22983. * "processCompleted": queryCompleted,
  22984. * "processFailed": queryError
  22985. * }
  22986. * });
  22987. *
  22988. */
  22989. class GetGridCellInfosService extends CommonServiceBase {
  22990. constructor(url, options) {
  22991. super(url, options);
  22992. /**
  22993. * @member {string} SuperMap.GetGridCellInfosService.prototype.datasetName
  22994. * @description 数据集名称。
  22995. */
  22996. this.datasetName = null;
  22997. /**
  22998. * @member {string} SuperMap.GetGridCellInfosService.prototype.dataSourceName
  22999. * @description 数据源名称。
  23000. */
  23001. this.dataSourceName = null;
  23002. /**
  23003. * @member {string} SuperMap.GetGridCellInfosService.prototype.datasetType
  23004. * @description 数据集类型。
  23005. */
  23006. this.datasetType = null;
  23007. /**
  23008. * @member {number} SuperMap.GetGridCellInfosService.prototype.X
  23009. * @description 要查询的地理位置X轴
  23010. */
  23011. this.X = null;
  23012. /**
  23013. * @member {number} SuperMap.GetGridCellInfosService.prototype.Y
  23014. * @description 要查询的地理位置Y轴
  23015. */
  23016. this.Y = null;
  23017. if (options) {
  23018. Util.extend(this, options);
  23019. }
  23020. this.CLASS_NAME = "SuperMap.GetGridCellInfosService";
  23021. }
  23022. /**
  23023. * @function SuperMap.GetGridCellInfosService.prototype.destroy
  23024. * @override
  23025. */
  23026. destroy() {
  23027. super.destroy();
  23028. var me = this;
  23029. me.X = null;
  23030. me.Y = null;
  23031. me.datasetName = null;
  23032. me.dataSourceName = null;
  23033. me.datasetType = null;
  23034. }
  23035. /**
  23036. * @function SuperMap.GetGridCellInfosService.prototype.processAsync
  23037. * @description 执行服务,查询数据集信息。
  23038. * @param {SuperMap.GetGridCellInfosParameters} params - 查询参数。
  23039. */
  23040. processAsync(params) {
  23041. if (!(params instanceof GetGridCellInfosParameters)) {
  23042. return;
  23043. }
  23044. Util.extend(this, params);
  23045. var me = this;
  23046. me.url = Util.urlPathAppend(me.url,`datasources/${me.dataSourceName}/datasets/${me.datasetName}`);
  23047. me.queryRequest(me.getDatasetInfoCompleted, me.getDatasetInfoFailed);
  23048. }
  23049. /**
  23050. * @function SuperMap.GetGridCellInfosService.prototype.queryRequest
  23051. * @description 执行服务,查询。
  23052. * @callback {function} successFun - 成功后执行的函数。
  23053. * @callback {function} failedFunc - 失败后执行的函数。
  23054. */
  23055. queryRequest(successFun, failedFunc) {
  23056. var me = this;
  23057. me.request({
  23058. method: "GET",
  23059. data: null,
  23060. scope: me,
  23061. success: successFun,
  23062. failure: failedFunc
  23063. });
  23064. }
  23065. /**
  23066. * @function SuperMap.GetGridCellInfosService.prototype.getDatasetInfoCompleted
  23067. * @description 数据集查询完成,执行此方法。
  23068. * @param {Object} result - 服务器返回的结果对象。
  23069. */
  23070. getDatasetInfoCompleted(result) {
  23071. var me = this;
  23072. result = Util.transformResult(result);
  23073. me.datasetType = result.datasetInfo.type;
  23074. me.queryGridInfos();
  23075. }
  23076. /**
  23077. * @function SuperMap.GetGridCellInfosService.prototype.queryGridInfos
  23078. * @description 执行服务,查询数据集栅格信息信息。
  23079. */
  23080. queryGridInfos() {
  23081. var me = this;
  23082. me.url = Util.urlPathAppend(me.url, me.datasetType == 'GRID' ? 'gridValue' : 'imageValue');
  23083. if (me.X != null && me.Y != null) {
  23084. me.url = Util.urlAppend(me.url, `x=${me.X}&y=${me.Y}`);
  23085. }
  23086. me.queryRequest(me.serviceProcessCompleted, me.serviceProcessFailed);
  23087. }
  23088. /**
  23089. * @function SuperMap.GetGridCellInfosService.prototype.getDatasetInfoFailed
  23090. * @description 数据集查询失败,执行此方法。
  23091. * @param {Object} result - 服务器返回的结果对象。
  23092. */
  23093. getDatasetInfoFailed(result) {
  23094. var me = this;
  23095. me.serviceProcessFailed(result);
  23096. }
  23097. }
  23098. SuperMap.GetGridCellInfosService = GetGridCellInfosService;
  23099. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeMemoryData.js
  23100. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23101. * This program are made available under the terms of the Apache License, Version 2.0
  23102. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23103. /**
  23104. * @class SuperMap.ThemeMemoryData
  23105. * @category iServer Map Theme
  23106. * @classdesc 专题图内存数据类。
  23107. * @param {Array} srcData - 原始值数组。
  23108. * @param {Array} targetData - 外部值数组。
  23109. */
  23110. class ThemeMemoryData {
  23111. constructor(srcData, targetData) {
  23112. /**
  23113. * @member {Array} SuperMap.ThemeMemoryData.prototype.srcData
  23114. * @description 原始值数组,该属性值将被 targetData 属性所指定的值替换掉,然后制作专题图,但数据库中的值并不会改变。
  23115. */
  23116. this.srcData = srcData;
  23117. /**
  23118. * @member {Array} SuperMap.ThemeMemoryData.prototype.targetData
  23119. * @description 外部值数组,即用于制作专题图的内存数据,设定该属性值后,会将 srcData 属性所指定的原始值替换掉制作专题图,但数据库中的值并不会改变。
  23120. */
  23121. this.targetData = targetData;
  23122. this.CLASS_NAME = "SuperMap.ThemeMemoryData";
  23123. }
  23124. /**
  23125. * @function SuperMap.ThemeMemoryData.prototype.destroy
  23126. * @description 释放资源,将引用资源的属性置空。
  23127. */
  23128. destroy() {
  23129. var me = this;
  23130. me.srcData = null;
  23131. me.targetData = null;
  23132. }
  23133. /**
  23134. * @function SuperMap.ThemeMemoryData.prototype.toJSON
  23135. * @description 将 SuperMap.ThemeMemoryData 对象转化为 JSON 字符串。
  23136. * @returns {string} 返回转换后的 JSON 字符串。
  23137. */
  23138. toJSON() {
  23139. if (this.srcData && this.targetData) {
  23140. var memoryDataStr = "";
  23141. var count = Math.min(this.srcData.length, this.targetData.length);
  23142. for (var i = 0; i < count; i++) {
  23143. memoryDataStr += "\'" + this.srcData[i] + "\':\'" + this.targetData[i] + "\',";
  23144. }
  23145. //去除多余的逗号
  23146. if (i > 0) {
  23147. memoryDataStr = memoryDataStr.substring(0, memoryDataStr.length - 1);
  23148. }
  23149. return "{" + memoryDataStr + "}";
  23150. } else {
  23151. return null;
  23152. }
  23153. }
  23154. }
  23155. SuperMap.ThemeMemoryData = ThemeMemoryData;
  23156. ;// CONCATENATED MODULE: ./src/common/iServer/Theme.js
  23157. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23158. * This program are made available under the terms of the Apache License, Version 2.0
  23159. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23160. /**
  23161. * @class SuperMap.Theme
  23162. * @category iServer Map Theme
  23163. * @classdesc 专题图基类。
  23164. * @param {string} type - 专题图类型。
  23165. * @param {Object} options - 参数。
  23166. * @param {SuperMap.ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  23167. */
  23168. class Theme {
  23169. constructor(type, options) {
  23170. if (!type) {
  23171. return this;
  23172. }
  23173. /**
  23174. * @member {SuperMap.ThemeMemoryData} SuperMap.Theme.prototype.memoryData
  23175. * @description 专题图内存数据。<br>
  23176. * 用内存数据制作专题图的方式与表达式制作专题图的方式互斥,前者优先级较高。
  23177. * 第一个参数代表专题值,即数据集中用来做专题图的字段或表达式的值;第二个参数代表外部值。在制作专题图时,会用外部值代替专题值来制作相应的专题图。
  23178. */
  23179. this.memoryData = null;
  23180. /**
  23181. * @member {string} SuperMap.Theme.prototype.type
  23182. * @description 专题图类型。
  23183. */
  23184. this.type = type;
  23185. if (options) {
  23186. Util.extend(this, options);
  23187. }
  23188. this.CLASS_NAME = "SuperMap.Theme";
  23189. }
  23190. /**
  23191. * @function SuperMap.Theme.prototype.destroy
  23192. * @description 释放资源,将引用资源的属性置空。
  23193. */
  23194. destroy() {
  23195. var me = this;
  23196. if (me.memoryData) {
  23197. me.memoryData.destroy();
  23198. me.memoryData = null;
  23199. }
  23200. me.type = null;
  23201. }
  23202. /**
  23203. * @function SuperMap.Theme.prototype.toServerJSONObject
  23204. * @description 转换成对应的 JSON 格式对象。
  23205. * @returns {Object} 对应的 JSON 格式对象。
  23206. */
  23207. toServerJSONObject() {
  23208. //return 子类实现
  23209. return;
  23210. }
  23211. }
  23212. SuperMap.Theme = Theme;
  23213. ;// CONCATENATED MODULE: ./src/common/iServer/ServerTextStyle.js
  23214. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23215. * This program are made available under the terms of the Apache License, Version 2.0
  23216. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23217. /**
  23218. * @class SuperMap.ServerTextStyle
  23219. * @category iServer Map Theme
  23220. * @classdesc 服务端文本风格类。
  23221. * @description 该类用于定义文本风格的相关属性。
  23222. * @param {Object} options - 参数。
  23223. * @param {SuperMap.TextAlignment} [options.align=SuperMap.TextAlignment.BASELINECENTER] - 文本的对齐方式。
  23224. * @param {SuperMap.ServerColor} [options.backColor] - 文本的背景色。默认 backColor = new ServerColor(255, 255, 255)。
  23225. * @param {SuperMap.ServerColor} [options.foreColor] - 文本的前景色。默认 foreColor = new ServerColor(0, 0, 0)。
  23226. * @param {boolean} [options.backOpaque=false] - 文本背景是否不透明。
  23227. * @param {boolean} [options.sizeFixed=true] - 文本大小是否固定。
  23228. * @param {number} [options.fontHeight=6] - 文本字体的高度。
  23229. * @param {number} [options.fontWidth=0] - 文本字体的宽度。
  23230. * @param {number} [options.fontWeight=400] - 文本字体的磅数。
  23231. * @param {string} [options.fontName='Times New Roman'] - 文本字体的名称。
  23232. * @param {boolean} [options.bold=false] - 文本是否为粗体字。
  23233. * @param {boolean} [options.italic=false] - 文本是否采用斜体。
  23234. * @param {number} [options.italicAngle=0] - 字体倾斜角度。
  23235. * @param {boolean} [options.shadow=false] - 文本是否有阴影。
  23236. * @param {boolean} [options.strikeout=false] - 文本字体是否加删除线。
  23237. * @param {boolean} [options.outline=false] - 是否以轮廓的方式来显示文本的背景。
  23238. * @param {number} [options.opaqueRate=0] - 注记文字的不透明度。
  23239. * @param {boolean} [options.underline=false] - 文本字体是否加下划线。
  23240. * @param {number} [options.rotation=0.0] - 文本旋转的角度。
  23241. */
  23242. class ServerTextStyle {
  23243. constructor(options) {
  23244. /**
  23245. * @member {SuperMap.TextAlignment} [SuperMap.ServerTextStyle.prototype.align= SuperMap.TextAlignment.BASELINECENTER]
  23246. * @description 文本的对齐方式。
  23247. */
  23248. this.align = TextAlignment.BASELINECENTER;
  23249. /**
  23250. * @member {SuperMap.ServerColor} [SuperMap.ServerTextStyle.prototype.backColor=(255, 255, 255)]
  23251. * @description 文本的背景色。
  23252. */
  23253. this.backColor = new ServerColor(255, 255, 255);
  23254. /**
  23255. * @member {SuperMap.ServerColor} [SuperMap.ServerTextStyle.prototype.foreColor=(0, 0, 0)]
  23256. * @description 文本的前景色。
  23257. */
  23258. this.foreColor = new ServerColor(0, 0, 0);
  23259. /**
  23260. * @member {boolean} [SuperMap.ServerTextStyle.prototype.backOpaque=false]
  23261. * @description 文本背景是否不透明。true 表示文本背景不透明。
  23262. */
  23263. this.backOpaque = false;
  23264. /**
  23265. * @member {boolean} [SuperMap.ServerTextStyle.prototype.sizeFixed=true]
  23266. * @description 文本大小是否固定。设置为 true,表示图片为固定像素大小,具体大小请参考 fontHeight。当设为 false 时,图片会随着地图缩放而缩放。
  23267. */
  23268. this.sizeFixed = true;
  23269. /**
  23270. * @member {number} [SuperMap.ServerTextStyle.prototype.fontHeight=6]
  23271. * @description 文本字体的高度,单位与 sizeFixed 有关,当 sizeFixed 为 False 时,即非固定文本大小时使用地图坐标单位,
  23272. * 如地理坐标系下的地图中单位为度;当 sizeFixed 为 True 时,单位为毫米(mm)。
  23273. */
  23274. this.fontHeight = 6;
  23275. /**
  23276. * @member {number} [SuperMap.ServerTextStyle.prototype.fontWidth=0]
  23277. * @description 文本字体的宽度。字体的宽度以英文字符为标准,由于一个中文字符相当于两个英文字符。
  23278. */
  23279. this.fontWidth = 0;
  23280. /**
  23281. * @member {number} [SuperMap.ServerTextStyle.prototype.fontWeight=400]
  23282. * @description 文本字体的磅数。表示粗体的具体数值。取值范围为从0-900之间的整百数。
  23283. */
  23284. this.fontWeight = 400;
  23285. /**
  23286. * @member {string} [SuperMap.ServerTextStyle.prototype.fontName="Times New Roman"]
  23287. * @description 文本字体的名称。
  23288. */
  23289. this.fontName = "Times New Roman";
  23290. /**
  23291. * @member {boolean} [SuperMap.ServerTextStyle.prototype.bold=false]
  23292. * @description 文本是否为粗体字。true 表示为粗体。false 表示文本不是粗体字。
  23293. */
  23294. this.bold = false;
  23295. /**
  23296. * @member {boolean} [SuperMap.ServerTextStyle.prototype.italic=false]
  23297. * @description 文本是否采用斜体。true 表示采用斜体。
  23298. */
  23299. this.italic = false;
  23300. /**
  23301. * @member {number} [SuperMap.ServerTextStyle.prototype.italicAngle=0]
  23302. * @description 字体倾斜角度。正负度之间,以度为单位,精确到0.1度。当倾斜角度为0度,为系统默认的字体倾斜样式。
  23303. * 正负度是指以纵轴为起始零度线,其纵轴左侧为正,右侧为负。允许的最大角度为60,最小-60。大于60按照60处理,小于-60按照-60处理。目前只对标签专题图有效。
  23304. */
  23305. this.italicAngle = 0;
  23306. /**
  23307. * @member {boolean} [SuperMap.ServerTextStyle.prototype.shadow=false]
  23308. * @description 文本是否有阴影。true 表示给文本增加阴影。false 表示文本没有阴影。
  23309. */
  23310. this.shadow = false;
  23311. /**
  23312. * @member {boolean} [SuperMap.ServerTextStyle.prototype.strikeout=false]
  23313. * @description 文本字体是否加删除线。true 表示加删除线。false 表示文本字体不加删除线。
  23314. */
  23315. this.strikeout = false;
  23316. /**
  23317. * @member {boolean} [SuperMap.ServerTextStyle.prototype.outline=false]
  23318. * @description 是否以轮廓的方式来显示文本的背景。true 表示以轮廓的方式来显示文本的背景。false 表示不以轮廓的方式来显示文本的背景。
  23319. */
  23320. this.outline = false;
  23321. /**
  23322. * @member {number} [SuperMap.ServerTextStyle.prototype.opaqueRate=0]
  23323. * @description 注记文字的不透明度。不透明度的范围为0-100。0表示透明。
  23324. */
  23325. this.opaqueRate = 0;
  23326. /**
  23327. * @member {boolean} [SuperMap.ServerTextStyle.prototype.underline=false]
  23328. * @description 文本字体是否加下划线。true 表示加下划线。
  23329. */
  23330. this.underline = false;
  23331. /**
  23332. * @member {number} [SuperMap.ServerTextStyle.prototype.rotation=0.0]
  23333. * @description 文本旋转的角度。逆时针方向为正方向,单位为度,精确到0.1度。
  23334. */
  23335. this.rotation = 0.0;
  23336. if (options) {
  23337. Util.extend(this, options);
  23338. }
  23339. this.CLASS_NAME = "SuperMap.ServerTextStyle";
  23340. }
  23341. /**
  23342. * @function SuperMap.ServerTextStyle.prototype.destroy
  23343. * @description 释放资源,将引用资源的属性置空。
  23344. */
  23345. destroy() {
  23346. var me = this;
  23347. me.align = null;
  23348. if (me.backColor) {
  23349. me.backColor.destroy();
  23350. me.backColor = null;
  23351. }
  23352. if (me.foreColor) {
  23353. me.foreColor.destroy();
  23354. me.foreColor = null;
  23355. }
  23356. me.backOpaque = null;
  23357. me.sizeFixed = null;
  23358. me.fontHeight = null;
  23359. me.fontWidth = null;
  23360. me.fontWeight = null;
  23361. me.fontName = null;
  23362. me.bold = null;
  23363. me.italic = null;
  23364. me.italicAngle = null;
  23365. me.shadow = null;
  23366. me.strikeout = null;
  23367. me.outline = null;
  23368. me.opaqueRate = null;
  23369. me.underline = null;
  23370. me.rotation = null;
  23371. }
  23372. /**
  23373. * @function SuperMap.ServerTextStyle.fromObj
  23374. * @description 从传入对象获服务端文本风格类。
  23375. * @param {Object} obj - 传入对象
  23376. * @returns {SuperMap.ServerTextStyle} 返回服务端文本风格对象
  23377. */
  23378. static fromObj(obj) {
  23379. var res = new ServerTextStyle(obj);
  23380. Util.copy(res, obj);
  23381. res.backColor = ServerColor.fromJson(obj.backColor);
  23382. res.foreColor = ServerColor.fromJson(obj.foreColor);
  23383. return res;
  23384. }
  23385. }
  23386. SuperMap.ServerTextStyle = ServerTextStyle;
  23387. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelItem.js
  23388. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23389. * This program are made available under the terms of the Apache License, Version 2.0
  23390. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23391. /**
  23392. * @class SuperMap.ThemeLabelItem
  23393. * @category iServer Map Theme
  23394. * @classdesc 分段标签专题图的子项。
  23395. * @description 标签专题图用专题值对点、线、面等对象做标注,值得注意的是,分段标签专题图允许用户通过 rangeExpression
  23396. * 字段指定用于分段的数值型字段,同一范围段内的标签具有相同的显示风格,其中每一个范围段就是一个专题图子项,
  23397. * 每一个子项都具有其名称、风格、起始值和终止值。注意:每个分段所表示的范围为 [Start, End)。例如:标签专题图的分段点有两个子项,
  23398. * 他们所代表的分段区间分别为[0,5),[5,10)。那么需要分别设置 SuperMap.ThemeLabelItem[0].start=0,
  23399. * SuperMap.ThemeLabelItem[0].end=5,SuperMap.ThemeLabelItem[1].start=5,SuperMap.ThemeLabelItem[1].end=10。
  23400. * @param {Object} options - 参数。
  23401. * @param {string} [options.caption] - 专题图子项的名称。
  23402. * @param {number} [options.end=0] - 标签专题图子项的终止值。
  23403. * @param {number} [options.start=0] - 标签专题图子项的分段起始值。
  23404. * @param {boolean} [options.visible=true] - 标签专题图子项是否可见。
  23405. * @param {SuperMap.ServerTextStyle} [options.style] - 标签专题图子项文本的显示风格。
  23406. */
  23407. class ThemeLabelItem {
  23408. constructor(options) {
  23409. /**
  23410. * @member {string} [SuperMap.ThemeLabelItem.prototype.caption]
  23411. * @description 标签专题子项的标题。
  23412. */
  23413. this.caption = null;
  23414. /**
  23415. * @member {number} [SuperMap.ThemeLabelItem.prototype.end=0]
  23416. * @description 标签专题图子项的终止值。如果该子项是分段中最后一个子项,那么该终止值就是分段的最大值;
  23417. * 如果不是最后一项,该终止值必须与其下一子项的起始值相同,否则系统抛出异常。
  23418. */
  23419. this.end = 0;
  23420. /**
  23421. * @member {number} [SuperMap.ThemeLabelItem.prototype.start=0]
  23422. * @description 标签专题图子项的分段起始值。如果该子项是分段中第一项,那么该起始值就是分段的最小值;
  23423. * 如果该子项的序号大于等于 1 的时候,该起始值必须与前一子项的终止值相同,否则系统会抛出异常。
  23424. */
  23425. this.start = 0;
  23426. /**
  23427. * @member {boolean} [SuperMap.ThemeLabelItem.prototype.visible=true]
  23428. * @description 标签专题图子项是否可见。如果标签专题图子项可见,则为 true,否则为 false。
  23429. */
  23430. this.visible = true;
  23431. /**
  23432. * @member {SuperMap.ServerTextStyle} SuperMap.ThemeLabelItem.prototype.style
  23433. * @description 标签专题图子项文本的显示风格。各种风格的优先级从高到低为:<br>
  23434. * uniformMixedStyle(标签文本的复合风格),SuperMap.ThemeLabelItem.style(分段子项的文本风格),uniformStyle(统一文本风格)。
  23435. */
  23436. this.style = new ServerTextStyle();
  23437. if (options) {
  23438. Util.extend(this, options);
  23439. }
  23440. this.CLASS_NAME = "SuperMap.ThemeLabelItem";
  23441. }
  23442. /**
  23443. * @function SuperMap.ThemeLabelItem.prototype.destroy
  23444. * @description 释放资源,将引用资源的属性置空。
  23445. */
  23446. destroy() {
  23447. var me = this;
  23448. me.caption = null;
  23449. me.end = null;
  23450. me.start = null;
  23451. if (me.style) {
  23452. me.style.destroy();
  23453. me.style = null;
  23454. }
  23455. me.visible = null;
  23456. }
  23457. /**
  23458. * @function SuperMap.ThemeLabelItem.fromObj
  23459. * @description 从传入对象获取分段标签专题图的子项类。
  23460. * @param {Object} obj - 传入对象。
  23461. * @returns {SuperMap.ThemeLabelItem} ThemeLabelItem 对象。
  23462. */
  23463. static fromObj(obj) {
  23464. if (!obj) {
  23465. return;
  23466. }
  23467. var t = new ThemeLabelItem();
  23468. Util.copy(t, obj);
  23469. return t;
  23470. }
  23471. }
  23472. SuperMap.ThemeLabelItem = ThemeLabelItem;
  23473. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeUniqueItem.js
  23474. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23475. * This program are made available under the terms of the Apache License, Version 2.0
  23476. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23477. /**
  23478. * @class SuperMap.ThemeUniqueItem
  23479. * @category iServer Map Theme
  23480. * @classdesc 单值专题图子项类。
  23481. * @description 单值专题图是将专题值相同的要素归为一类,为每一类设定一种渲染风格,其中每一类就是一个专题图子项。比如,利用单值专题图制作行政区划图,Name 字段代表
  23482. * 省/直辖市名,该字段用来做专题变量,如果该字段的字段值总共有 5 种不同值,则该行政区划图有 5 个专题图子项。
  23483. * @param {Object} options - 参数。
  23484. * @param {string} options.unique - 单值专题图子项的单值。
  23485. * @param {string} [options.caption] - 单值专题图子项的标题。
  23486. * @param {SuperMap.ServerStyle} [options.style] - 单值专题图子项的风格。
  23487. * @param {boolean} [options.visible=true] - 单值专题图子项是否可见。
  23488. */
  23489. class ThemeUniqueItem {
  23490. constructor(options) {
  23491. /**
  23492. * @member {string} [SuperMap.ThemeUniqueItem.prototype.caption]
  23493. * @description 单值专题图子项的标题。
  23494. */
  23495. this.caption = null;
  23496. /**
  23497. * @member {SuperMap.ServerStyle} [SuperMap.ThemeUniqueItem.prototype.style]
  23498. * @description 单值专题图子项的显示风格。
  23499. */
  23500. this.style = new ServerStyle();
  23501. /**
  23502. * @member {string} SuperMap.ThemeUniqueItem.prototype.unique
  23503. * @description 单值专题图子项的值,可以为数字、字符串等。
  23504. */
  23505. this.unique = null;
  23506. /**
  23507. * @member {boolean} [SuperMap.ThemeUniqueItem.prototype.visible=true]
  23508. * @description 单值专题图子项的可见性。
  23509. */
  23510. this.visible = true;
  23511. if (options) {
  23512. Util.extend(this, options);
  23513. }
  23514. this.CLASS_NAME = "SuperMap.ThemeUniqueItem";
  23515. }
  23516. /**
  23517. * @function SuperMap.ThemeUniqueItem.prototype.destroy
  23518. * @description 释放资源,将引用资源的属性置空。
  23519. */
  23520. destroy() {
  23521. var me = this;
  23522. me.caption = null;
  23523. me.unique = null;
  23524. if (me.style) {
  23525. me.style.destroy();
  23526. me.style = null;
  23527. }
  23528. me.visible = null;
  23529. }
  23530. /**
  23531. * @function SuperMap.ThemeUniqueItem.prototype.toServerJSONObject
  23532. * @description 转换成对应的 JSON 格式对象。
  23533. * @returns {Object} 对应的 JSON 格式对象。
  23534. */
  23535. toServerJSONObject() {
  23536. var obj = {};
  23537. obj = Util.copyAttributes(obj, this);
  23538. if (obj.style) {
  23539. if (obj.style.toServerJSONObject) {
  23540. obj.style = obj.style.toServerJSONObject();
  23541. }
  23542. }
  23543. return obj;
  23544. }
  23545. /**
  23546. * @function SuperMap.ThemeUniqueItem.fromObj
  23547. * @description 从传入对象获取单值专题图子项类。
  23548. * @param {Object} obj - 传入对象。
  23549. * @returns {SuperMap.ThemeUniqueItem} ThemeUniqueItem 对象。
  23550. */
  23551. static fromObj(obj) {
  23552. var res = new ThemeUniqueItem();
  23553. Util.copy(res, obj);
  23554. res.style = ServerStyle.fromJson(obj.style);
  23555. return res;
  23556. }
  23557. }
  23558. SuperMap.ThemeUniqueItem = ThemeUniqueItem;
  23559. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeFlow.js
  23560. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23561. * This program are made available under the terms of the Apache License, Version 2.0
  23562. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23563. /**
  23564. * @class SuperMap.ThemeFlow
  23565. * @category iServer Map Theme
  23566. * @classdesc 标签或符号流动显示和牵引线风格设置类。
  23567. * 通过该类可以设置专题图中符号是否流动显示、是否使用牵引线以及牵引线风格。
  23568. * @param {Object} options - 参数。
  23569. * @param {boolean} [options.flowEnabled=false] - 是否流动显示标签或符号。
  23570. * @param {boolean} [options.leaderLineDisplayed=false] - 是否显示标签或符号和它标注的对象之间的牵引线。
  23571. * @param {SuperMap.ServerStyle} [options.leaderLineStyle] - 标签或符号与其标注对象之间牵引线的风格。
  23572. */
  23573. class ThemeFlow {
  23574. constructor(options) {
  23575. /**
  23576. * @member {boolean} [SuperMap.ThemeFlow.prototype.flowEnabled=false]
  23577. * @description 是否流动显示标签或符号。<br>
  23578. * 对于标签专题图而言,对于跨越比较大的区域和线条状的几何对象,在一个地图窗口中不能完全显示的情况下,如果其标签位置比较固定,
  23579. * 在当前地图窗口中该对象的标签不可见,则需要通过平移地图来查看对象的标签信息。如果采用了流动显示的效果,在当前地图窗口中,对象即使是部分显示,
  23580. * 其标签也会显示在当前地图窗口中。当平移地图时,对象的标签会随之移动,以保证在当前地图窗口中部分或全部显示的对象其标签都可见,从而可以方便地查看各要素的标签信息。
  23581. */
  23582. this.flowEnabled = false;
  23583. /**
  23584. * @member {boolean} [SuperMap.ThemeFlow.prototype.leaderLineDisplayed=false]
  23585. * @description 是否显示标签或符号和它标注的对象之间的牵引线。false表示不显示标签或符号和它标注的对象之间的牵引线。<br>
  23586. * 只有当 flowEnabled 为 true 时,牵引线才起作用。在当标签流动显示时,其位置不固定,由于牵引线始终指向要素的内点,
  23587. * 因而通过牵引线显示功能可以找到流动的标签或符号实际对应的要素。或者渲染符号偏移它所指向的对象时,图与对象之间可以采用牵引线进行连接。
  23588. */
  23589. this.leaderLineDisplayed = false;
  23590. /**
  23591. * @member {SuperMap.ServerStyle} SuperMap.ThemeFlow.prototype.leaderLineStyle
  23592. * @description 标签或符号与其标注对象之间牵引线的风格。
  23593. */
  23594. this.leaderLineStyle = new ServerStyle();
  23595. if (options) {
  23596. Util.extend(this, options);
  23597. }
  23598. this.CLASS_NAME = "SuperMap.ThemeFlow";
  23599. }
  23600. /**
  23601. * @function SuperMap.ThemeFlow.prototype.destroy
  23602. * @description 释放资源,将引用资源的属性置空。
  23603. */
  23604. destroy() {
  23605. var me = this;
  23606. me.flowEnabled = null;
  23607. me.leaderLineDisplayed = null;
  23608. if (me.leaderLineStyle) {
  23609. me.leaderLineStyle.destroy();
  23610. me.leaderLineStyle = null;
  23611. }
  23612. }
  23613. /**
  23614. * @function SuperMap.ThemeFlow.fromObj
  23615. * @description 从传入对象获取标签或符号流动显示和牵引线风格设置类。
  23616. * @param {Object} obj - 传入对象。
  23617. * @returns {SuperMap.ThemeFlow} ThemeFlow 对象。
  23618. */
  23619. static fromObj(obj) {
  23620. if (!obj) {
  23621. return;
  23622. }
  23623. var res = new ThemeFlow();
  23624. Util.copy(res, obj);
  23625. res.leaderLineStyle = ServerStyle.fromJson(obj.leaderLineStyle);
  23626. return res;
  23627. }
  23628. }
  23629. SuperMap.ThemeFlow = ThemeFlow;
  23630. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeOffset.js
  23631. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23632. * This program are made available under the terms of the Apache License, Version 2.0
  23633. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23634. /**
  23635. * @class SuperMap.ThemeOffset
  23636. * @category iServer Map Theme
  23637. * @classdesc 专题图中文本或符号相对于要素内点的偏移量设置类。
  23638. * 通过该类可以设置专题图中标记文本或符号的偏移量以及偏移量是否随地图缩放而改变。
  23639. * @param {Object} options - 参数。
  23640. * @param {boolean} [options.offsetFixed=false] - 当前专题图是否固定标记文本或符号的偏移量。
  23641. * @param {string} [options.offsetX='0.0'] - 专题图中文本或符号相对于要素内点的水平偏移量。
  23642. * @param {string} [options.offsetY='0.0'] - 专题图中文本或符号相对于要素内点的垂直偏移量。
  23643. */
  23644. class ThemeOffset {
  23645. constructor(options) {
  23646. /**
  23647. * @member {boolean} [SuperMap.ThemeOffset.prototype.offsetFixed=false]
  23648. * @description 当前专题图是否固定标记文本或符号的偏移量。所谓固定偏移量,则文本或符号的偏移量不随地图的缩放而变化。
  23649. */
  23650. this.offsetFixed = false;
  23651. /**
  23652. * @member {string} [SuperMap.ThemeOffset.prototype.offsetX=0.0]
  23653. * @description 专题图中文本或符号相对于要素内点的水平偏移量。偏移量的单位为地图单位。
  23654. * 该偏移量的值为一个常量值或者字段表达式所表示的值,即如果字段表达式为 SmID,其中 SmID = 2,那么水平偏移量为2。
  23655. */
  23656. this.offsetX = "0.0";
  23657. /**
  23658. * @member {string} [SuperMap.ThemeOffset.prototype.offsetY=0.0]
  23659. * @description 专题图中文本或符号相对于要素内点的垂直偏移量。偏移量的单位为地图单位。
  23660. * 该偏移量的值为一个常量值或者字段表达式所表示的值,即如果字段表达式为 SmID,其中 SmID = 2,那么垂直偏移量为2。
  23661. */
  23662. this.offsetY = "0.0";
  23663. if (options) {
  23664. Util.extend(this, options);
  23665. }
  23666. this.CLASS_NAME = "SuperMap.ThemeOffset";
  23667. }
  23668. /**
  23669. * @function SuperMap.ThemeOffset.prototype.destroy
  23670. * @description 释放资源,将引用资源的属性置空。
  23671. */
  23672. destroy() {
  23673. var me = this;
  23674. me.offsetFixed = null;
  23675. me.offsetX = null;
  23676. me.offsetY = null;
  23677. }
  23678. /**
  23679. * @function SuperMap.ThemeOffset.fromObj
  23680. * @description 从传入对象获取专题图中文本或符号相对于要素内点的偏移量设置类。
  23681. * @param {Object} obj - 传入对象。
  23682. * @returns {SuperMap.ThemeOffset} ThemeOffset 对象。
  23683. */
  23684. static fromObj(obj) {
  23685. if (!obj) {
  23686. return;
  23687. }
  23688. var res = new ThemeOffset();
  23689. Util.copy(res, obj);
  23690. return res;
  23691. }
  23692. }
  23693. SuperMap.ThemeOffset = ThemeOffset;
  23694. ;// CONCATENATED MODULE: ./src/common/iServer/LabelMixedTextStyle.js
  23695. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23696. * This program are made available under the terms of the Apache License, Version 2.0
  23697. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23698. /**
  23699. * @class SuperMap.LabelMixedTextStyle
  23700. * @category iServer Map Theme
  23701. * @classdesc 标签文本复合风格类
  23702. * @description 该类主要用于对标签专题图中标签的文本内容进行风格设置。通过该类用户可以使标签的文字显示不同的风格,比如文本 “喜马拉雅山”,通过本类可以将前三个字用红色显示,后两个字用蓝色显示。对同一文本设置不同的风格实质上是对文本的字符进行分段,同一分段内的字符具有相同的显示风格。对字符分段有两种方式,一种是利用分隔符对文本进行分段;另一种是根据分段索引值进行分段。<br>
  23703. * 1. 利用分隔符对文本进行分段: 比如文本 “5&109” 被分隔符 “&” 分为 “5” 和 “109” 两部分,
  23704. * 在显示时,“5” 和分隔符 “&” 使用同一个风格,字符串 “109” 使用相同的风格。<br>
  23705. * 2. 利用分段索引值进行分段: 文本中字符的索引值是以0开始的整数,比如文本 “珠穆朗玛峰”,
  23706. * 第一个字符(“珠”)的索引值为 0,第二个字符(“穆”)的索引值为 1,以此类推;当设置分段索引值为 1,3,4,9 时,
  23707. * 字符分段范围相应的就是 (-∞,1),[1,3),[3,4),[4,9),[9,+∞),可以看出索引号为 0 的字符(即“珠” )在第一个分段内,
  23708. * 索引号为 1,2 的字符(即“穆”、“朗”)位于第二个分段内,索引号为 3 的字符(“玛”)在第三个分段内,索引号为 4 的字符(“峰”)在第四个分段内,其余分段中没有字符。
  23709. * @param {Object} options - 参数。
  23710. * @param {SuperMap.ServerTextStyle} [options.defaultStyle] - 默认的文本复合风格。
  23711. * @param {string} [options.separator] - 文本的分隔符。
  23712. * @param {boolean} [options.separatorEnabled=false] - 文本的分隔符是否有效。
  23713. * @param {Array.<number>} [options.splitIndexes] - 分段索引值,分段索引值用来对文本中的字符进行分段。
  23714. * @param {Array.<SuperMap.ServerTextStyle>} [options.styles] - 文本样式集合。
  23715. */
  23716. class LabelMixedTextStyle {
  23717. constructor(options) {
  23718. /**
  23719. * @member {SuperMap.ServerTextStyle} SuperMap.LabelMixedTextStyle.prototype.defaultStyle
  23720. * @description 默认的文本复合风格,即 SuperMap.ServerTextStyle 各字段的默认值。
  23721. */
  23722. this.defaultStyle = null;
  23723. /**
  23724. * @member {string} SuperMap.LabelMixedTextStyle.prototype.separator
  23725. * @description 文本的分隔符,分隔符的风格与前一个字符的风格一样。文本的分隔符是一个将文本分割开的符号,
  23726. * 比如文本 “5_109” 被 “_” 隔符为 “5” 和 “109” 两部分,假设有风格数组:style1、style2。
  23727. * 在显示时,“5” 和分隔符 “_” 使用 Style1 风格渲染,字符串 “109” 使用 Style2 的风格。
  23728. */
  23729. this.separator = null;
  23730. /**
  23731. * @member {boolean} [SuperMap.LabelMixedTextStyle.prototype.separatorEnabled=false]
  23732. * @description 文本的分隔符是否有效。分隔符有效时利用分隔符对文本进行分段;无效时根据文本中字符的位置进行分段。
  23733. * 分段后,同一分段内的字符具有相同的显示风格。
  23734. */
  23735. this.separatorEnabled = false;
  23736. /**
  23737. * @member {Array.<number>} SuperMap.LabelMixedTextStyle.prototype.splitIndexes
  23738. * @description 分段索引值,分段索引值用来对文本中的字符进行分段。
  23739. * 文本中字符的索引值是以 0 开始的整数,比如文本“珠穆朗玛峰”,第一个字符(“珠”)的索引值为0,第二个字符(“穆”)的索引值为 1,
  23740. * 以此类推;当设置分段索引值数组为 [1,3,4,9] 时,字符分段范围相应的就是 (-∞,1),[1,3),[3,4),[4,9),[9,+∞),
  23741. * 可以看出索引号为 0 的字符(即 “珠”)在第一个分段内,索引号为 1,2 的字符(即 “穆”、“朗”)位于第二个分段内,
  23742. * 索引号为 3 的字符(“玛”)在第三个分段内,索引号为 4 的字符(“峰”)在第四个分段内,其余分段中没有字符。
  23743. */
  23744. this.splitIndexes = null;
  23745. /**
  23746. * @member {Array.<SuperMap.ServerTextStyle>} SuperMap.LabelMixedTextStyle.prototype.styles
  23747. * @description 文本样式集合。文本样式集合中的样式根据索引与不同分段一一对应,
  23748. * 如果有分段没有风格对应则使用 defaultStyle。
  23749. */
  23750. this.styles = new ServerTextStyle();
  23751. if (options) {
  23752. Util.extend(this, options);
  23753. }
  23754. this.CLASS_NAME = "SuperMap.LabelMixedTextStyle"
  23755. }
  23756. /**
  23757. * @function SuperMap.LabelMixedTextStyle.prototype.destroy
  23758. * @description 释放资源,将引用资源的属性置空。
  23759. */
  23760. destroy() {
  23761. var me = this;
  23762. if (me.defaultStyle) {
  23763. me.defaultStyle.destroy();
  23764. me.defaultStyle = null;
  23765. }
  23766. me.separator = null;
  23767. me.separatorEnabled = null;
  23768. if (me.splitIndexes) {
  23769. me.splitIndexes = null;
  23770. }
  23771. if (me.styles) {
  23772. for (var i = 0, styles = me.styles, len = styles.length; i < len; i++) {
  23773. styles[i].destroy();
  23774. }
  23775. me.styles = null;
  23776. }
  23777. }
  23778. /**
  23779. * @function SuperMap.LabelMixedTextStyle.fromObj
  23780. * @description 从传入对象获取标签文本复合风格类。
  23781. * @param {Object} obj - 传入对象。
  23782. * @returns {SuperMap.LabelMixedTextStyle} 返回新的 LabelMixedTextStyle 对象。
  23783. */
  23784. static fromObj(obj) {
  23785. if (!obj) {
  23786. return;
  23787. }
  23788. var res = new LabelMixedTextStyle();
  23789. var stys = obj.styles;
  23790. Util.copy(res, obj);
  23791. res.defaultStyle = new ServerTextStyle(obj.defaultStyle);
  23792. if (stys) {
  23793. res.styles = [];
  23794. for (var i = 0, len = stys.length; i < len; i++) {
  23795. res.styles.push(new ServerTextStyle(stys[i]));
  23796. }
  23797. }
  23798. return res;
  23799. }
  23800. }
  23801. SuperMap.LabelMixedTextStyle = LabelMixedTextStyle;
  23802. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelText.js
  23803. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23804. * This program are made available under the terms of the Apache License, Version 2.0
  23805. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23806. /**
  23807. * @class SuperMap.ThemeLabelText
  23808. * @category iServer Map Theme
  23809. * @classdesc 标签中文本风格类。
  23810. * 通过该类可以设置标签中的文本字体大小和显示风格。
  23811. * @param {Object} options - 参数。
  23812. * @param {number} [options.maxTextHeight=0] - 标签中文本的最大高度。
  23813. * @param {number} [options.maxTextWidth=0] - 标签中文本的最大宽度。
  23814. * @param {number} [options.minTextHeight=0] - 标签中文本的最小高度。
  23815. * @param {number} [options.minTextWidth=0] - 标签中文本的最小宽度。
  23816. * @param {SuperMap.ServerTextStyle} [options.uniformStyle] - 统一文本风格。
  23817. * @param {SuperMap.LabelMixedTextStyle} [options.uniformMixedStyle] - 标签专题图统一的文本复合风格。
  23818. */
  23819. class ThemeLabelText {
  23820. constructor(options) {
  23821. /**
  23822. * @member {number} [SuperMap.ThemeLabelText.prototype.maxTextHeight=0]
  23823. * @description 标签中文本的最大高度。当标签文本不固定大小时,即 SuperMap.ServerTextStyle.sizeFixed = false 有效,
  23824. * 当放大后的文本高度超过最大高度之后就不再放大。高度单位为 0.1 毫米。
  23825. */
  23826. this.maxTextHeight = 0;
  23827. /**
  23828. * @member {number} [SuperMap.ThemeLabelText.prototype.maxTextWidth=0]
  23829. * @description 标签中文本的最大宽度。当标签文本不固定大小时,即 SuperMap.ServerTextStyle.sizeFixed = false 有效,
  23830. * 当放大后的文本宽度超过最大高度之后就不再放大。宽度单位为 0.1 毫米。
  23831. */
  23832. this.maxTextWidth = 0;
  23833. /**
  23834. * @member {number} [SuperMap.ThemeLabelText.prototype.minTextHeight=0]
  23835. * @description 标签中文本的最小高度。当标签文本不固定大小时,即 SuperMap.ServerTextStyle.sizeFixed = false 有效,
  23836. * 当缩小后的文本高度小于最小高度之后就不再缩小。高度单位为 0.1 毫米。
  23837. */
  23838. this.minTextHeight = 0;
  23839. /**
  23840. * @member {number} [SuperMap.ThemeLabelText.prototype.minTextWidth=0]
  23841. * @description 标签中文本的最小宽度。当标签文本不固定大小时,即 SuperMap.ServerTextStyle.sizeFixed = false 有效,
  23842. * 当缩小后的文本宽度小于最小宽度之后就不再缩小。宽度单位为 0.1 毫米。
  23843. */
  23844. this.minTextWidth = 0;
  23845. /**
  23846. * @member {SuperMap.ServerTextStyle} [SuperMap.ThemeLabelText.prototype.uniformStyle]
  23847. * @description 统一文本风格。当标签专题图子项的个数大于等于1时,
  23848. * uniformStyle 不起作用,各标签的风格使用子项中设置的风格。各种风格的优先级从高到低为:uniformMixedStyle(标签文本的复合风格),
  23849. * SuperMap.ThemeLabelItem.style(分段子项的文本风格),uniformStyle(统一文本风格)。
  23850. */
  23851. this.uniformStyle = new ServerTextStyle();
  23852. /**
  23853. *@member {SuperMap.LabelMixedTextStyle} [SuperMap.ThemeLabelText.prototype.uniformMixedStyle]
  23854. *@description 标签专题图统一的文本复合风格。通过该类可以使同一个标
  23855. * 签中的文字使用多种风格显示。各种风格的优先级从高到低为:uniformMixedStyle(标签文本的复合风格),
  23856. * SuperMap.ThemeLabelItem.style(分段子项的文本风格),uniformStyle(统一文本风格)。
  23857. */
  23858. this.uniformMixedStyle = null;
  23859. if (options) {
  23860. Util.extend(this, options);
  23861. }
  23862. this.CLASS_NAME = "SuperMap.ThemeLabelText";
  23863. }
  23864. /**
  23865. * @function SuperMap.ThemeLabelText.prototype.destroy
  23866. * @description 释放资源,将引用资源的属性置空。
  23867. */
  23868. destroy() {
  23869. var me = this;
  23870. me.maxTextHeight = null;
  23871. me.maxTextWidth = null;
  23872. me.minTextHeight = null;
  23873. me.minTextWidth = null;
  23874. if (me.uniformStyle) {
  23875. me.uniformStyle.destroy();
  23876. me.uniformStyle = null;
  23877. }
  23878. if (me.uniformMixedStyle) {
  23879. me.uniformMixedStyle.destroy();
  23880. me.uniformMixedStyle = null;
  23881. }
  23882. }
  23883. /**
  23884. * @function SuperMap.ThemeLabelText.fromObj
  23885. * @description 从传入对象获取标签中文本风格类。
  23886. * @param {Object} obj - 传入对象。
  23887. * @returns {SuperMap.ThemeLabelText} ThemeLabelText 对象。
  23888. */
  23889. static fromObj(obj) {
  23890. if (!obj) {
  23891. return;
  23892. }
  23893. var res = new ThemeLabelText();
  23894. Util.copy(res, obj);
  23895. res.uniformStyle = ServerTextStyle.fromObj(obj.uniformStyle);
  23896. res.uniformMixedStyle = LabelMixedTextStyle.fromObj(obj.uniformMixedStyle);
  23897. return res;
  23898. }
  23899. }
  23900. SuperMap.ThemeLabelText = ThemeLabelText;
  23901. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelAlongLine.js
  23902. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23903. * This program are made available under the terms of the Apache License, Version 2.0
  23904. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23905. /**
  23906. * @class SuperMap.ThemeLabelAlongLine
  23907. * @category iServer Map Theme
  23908. * @classdesc 标签沿线标注样式类。
  23909. * @param {Object} options - 参数。
  23910. * @param {boolean} [options.isAlongLine=true] - 是否沿线显示文本。
  23911. * @param {SuperMap.AlongLineDirection} [options.alongLineDirection=SuperMap.AlongLineDirection.LB_TO_RT] - 标签沿线标注方向。
  23912. * @param {boolean} [options.angleFixed=false] - 当沿线显示文本时,是否将文本角度固定。
  23913. * @param {boolean} [options.repeatedLabelAvoided=false] - 沿线循环标注时是否避免标签重复标注。
  23914. * @param {boolean} [options.repeatIntervalFixed=false] - 循环标注间隔是否固定。
  23915. * @param {number} [options.labelRepeatInterval=0] - 沿线且循环标注时循环标注的间隔。
  23916. */
  23917. class ThemeLabelAlongLine {
  23918. constructor(options) {
  23919. /**
  23920. * @member {boolean} [SuperMap.ThemeLabelAlongLine.prototype.isAlongLine=true]
  23921. * @description 是否沿线显示文本。true 表示沿线显示文本,false 表示正常显示文本。
  23922. */
  23923. this.isAlongLine = true;
  23924. /**
  23925. * @member {SuperMap.AlongLineDirection} [SuperMap.ThemeLabelAlongLine.prototype.alongLineDirection=SuperMap.AlongLineDirection.LB_TO_RT]
  23926. * @description 标签沿线标注方向。
  23927. */
  23928. this.alongLineDirection = AlongLineDirection.LB_TO_RT;
  23929. /**
  23930. * @member {boolean} [SuperMap.ThemeLabelAlongLine.prototype.angleFixed=false]
  23931. * @description 当沿线显示文本时,是否将文本角度固定。true 表示按固定文本角度显示文本,false 表示按照沿线角度显示文本。
  23932. * 如果固定角度,则所有标签均按所设置的文本风格中字体的旋转角度来显示,不考虑沿线标注的方向;
  23933. * 如果不固定角度,在显示标签时会同时考虑字体的旋转角度和沿线标注的方向。
  23934. */
  23935. this.angleFixed = false;
  23936. /**
  23937. * @member {boolean} SuperMap.ThemeLabelAlongLine.prototype.repeatedLabelAvoided
  23938. * @description 沿线循环标注时是否避免标签重复标注。
  23939. */
  23940. this.repeatedLabelAvoided = false;
  23941. /**
  23942. * @member {boolean} [SuperMap.ThemeLabelAlongLine.prototype.repeatIntervalFixed=false]
  23943. * @description 循环标注间隔是否固定。true 表示使用固定循环标注间隔,即使用逻辑坐标来显示循环标注间隔;
  23944. * false 表示循环标注间隔随地图的缩放而变化,即使用地理坐标来显示循环标注间隔。
  23945. */
  23946. this.repeatIntervalFixed = false;
  23947. /**
  23948. * @member {number} [SuperMap.ThemeLabelAlongLine.prototype.labelRepeatInterval=0]
  23949. * @description 沿线且循环标注时循环标注的间隔。长度的单位与地图的地理单位一致。只有设定 RepeatedLabelAvoided 为 true
  23950. * 的时候,labelRepeatInterval 属性才有效。
  23951. */
  23952. this.labelRepeatInterval = 0;
  23953. if (options) {
  23954. Util.extend(this, options);
  23955. }
  23956. this.CLASS_NAME = "SuperMap.ThemeLabelAlongLine";
  23957. }
  23958. /**
  23959. * @function SuperMap.ThemeLabelAlongLine.prototype.destroy
  23960. * @description 释放资源,将引用资源的属性置空。
  23961. */
  23962. destroy() {
  23963. var me = this;
  23964. me.isAlongLine = null;
  23965. me.alongLineDirection = null;
  23966. me.angleFixed = null;
  23967. me.repeatedLabelAvoided = null;
  23968. me.repeatIntervalFixed = null;
  23969. me.labelRepeatInterval = null;
  23970. }
  23971. /**
  23972. * @function SuperMap.ThemeLabelAlongLine.fromObj
  23973. * @description 从传入对象获取标签沿线标注样式类。
  23974. * @param {Object} obj - 传入对象。
  23975. * @returns {SuperMap.ThemeLabelAlongLine} ThemeLabelAlongLine 对象。
  23976. */
  23977. static fromObj(obj) {
  23978. if (!obj) {
  23979. return;
  23980. }
  23981. var t = new ThemeLabelAlongLine();
  23982. Util.copy(t, obj);
  23983. return t;
  23984. }
  23985. }
  23986. SuperMap.ThemeLabelAlongLine = ThemeLabelAlongLine;
  23987. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelBackground.js
  23988. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23989. * This program are made available under the terms of the Apache License, Version 2.0
  23990. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23991. /**
  23992. * @class SuperMap.ThemeLabelBackground
  23993. * @category iServer Map Theme
  23994. * @classdesc 标签背景风格类。通过该类可以设置标签的背景形状和风格。
  23995. * @param {Object} options - 参数。
  23996. * @param {SuperMap.LabelBackShape} [options.labelBackShape=SuperMap.LabelBackShape.NONE] - 标签专题图中标签背景风格。
  23997. * @param {SuperMap.ServerStyle} [options.backStyle=SuperMap.LabelBackShape.NONE] - 标签专题图中标签背景的形状枚举类。
  23998. */
  23999. class ThemeLabelBackground {
  24000. constructor(options) {
  24001. /**
  24002. * @member {SuperMap.LabelBackShape} [SuperMap.ThemeLabelBackground.prototype.labelBackShape=SuperMap.LabelBackShape.NONE]
  24003. * @description 标签专题图中标签背景风格。当背景形状
  24004. * labelBackShape 属性设为 NONE(即无背景形状) 时,backStyle 属性无效。
  24005. */
  24006. this.labelBackShape = LabelBackShape.NONE;
  24007. /**
  24008. * @member {SuperMap.ServerStyle} [SuperMap.ThemeLabelBackground.prototype.backStyle=SuperMap.LabelBackShape.NON]
  24009. * @description 标签专题图中标签背景的形状枚举类。背景类型可
  24010. * 以是矩形、圆角矩形、菱形、椭圆形、三角形和符号等,即不使用任何的形状作为标签的背景。
  24011. */
  24012. this.backStyle = new ServerStyle();
  24013. if (options) {
  24014. Util.extend(this, options);
  24015. }
  24016. this.CLASS_NAME = "SuperMap.ThemeLabelBackground";
  24017. }
  24018. /**
  24019. * @function SuperMap.ThemeLabelBackground.prototype.destroy
  24020. * @description 释放资源,将引用资源的属性置空。
  24021. */
  24022. destroy() {
  24023. var me = this;
  24024. me.labelBackShape = null;
  24025. if (me.backStyle) {
  24026. me.backStyle.destroy();
  24027. me.backStyle = null;
  24028. }
  24029. }
  24030. /**
  24031. * @function SuperMap.ThemeLabelBackground.fromObj
  24032. * @description 从传入对象获取标签背景风格类。
  24033. * @param {Object} obj - 传入对象。
  24034. * @returns {SuperMap.ThemeLabelBackground} ThemeLabelBackground 对象。
  24035. */
  24036. static fromObj(obj) {
  24037. if (!obj) {
  24038. return;
  24039. }
  24040. var t = new ThemeLabelBackground();
  24041. t.labelBackShape = obj.labelBackShape;
  24042. t.backStyle = ServerStyle.fromJson(obj.backStyle);
  24043. return t;
  24044. }
  24045. }
  24046. SuperMap.ThemeLabelBackground = ThemeLabelBackground;
  24047. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabel.js
  24048. /* Copyright© 2000 - 2021 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 SuperMap.ThemeLabel
  24053. * @category iServer Map Theme
  24054. * @classdesc 标签专题图类。
  24055. * @extends SuperMap.Theme
  24056. * @param {Object} options - 参数。
  24057. * @param {Array.<SuperMap.ThemeUniqueItem>} options.items - 分段标签专题图的子项数组。
  24058. * @param {string} options.labelExpression - 标注字段表达式。
  24059. * @param {Array.<SuperMap.LabelMatrixCell>} options.matrixCells - 矩阵标签元素数组。
  24060. * @param {SuperMap.ThemeLabelAlongLine} [options.alongLine] - 标签沿线标注方向样式类。
  24061. * @param {SuperMap.ThemeLabelBackground} [options.background] - 标签专题图中标签的背景风格类。
  24062. * @param {SuperMap.ThemeFlow} [options.flow] - 标签专题图标签流动显示与牵引线设置类。
  24063. * @param {SuperMap.LabelOverLengthMode} [options.labelOverLengthMode=SuperMap.LabelOverLengthMode.NONE] - 标签专题图中超长标签的处理模式枚举类。
  24064. * @param {number} [options.maxLabelLength=256] - 标签在每一行显示的最大长度。
  24065. * @param {number} [options.numericPrecision=0] - 通过该字段设置其显示的精度。
  24066. * @param {SuperMap.ThemeOffset} [options.offset] - 用于设置标签专题图中标记文本相对于要素内点的偏移量对象。
  24067. * @param {boolean} [options.overlapAvoided=true] - 是否允许以文本避让方式显示文本。
  24068. * @param {string} [options.rangeExpression] - 制作分段标签专题的分段字段或字段表达式。
  24069. * @param {boolean} [options.smallGeometryLabeled=false] - 是否显示长度大于被标注对象本身长度的标签。
  24070. * @param {SuperMap.ThemeLabelText} options.text - 标签中文本风格。
  24071. * @param {number} [options.textSpace=0] - 沿线标注,相邻两个文字之间的间距,单位当前设置的字高。
  24072. * @param {SuperMap.ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  24073. */
  24074. class ThemeLabel extends Theme {
  24075. constructor(options) {
  24076. super("LABEL", options);
  24077. /**
  24078. * @member {SuperMap.ThemeLabelAlongLine} [SuperMap.ThemeLabel.prototype.alongLine]
  24079. * @description 标签沿线标注方向样式类。
  24080. * 在该类中可以设置标签是否沿线标注以及沿线标注的多种方式。沿线标注属性只适用于线数据集专题图。
  24081. */
  24082. this.alongLine = new ThemeLabelAlongLine();
  24083. /**
  24084. * @member {SuperMap.ThemeLabelBackground} [SuperMap.ThemeLabel.prototype.background]
  24085. * @description 标签专题图中标签的背景风格类。通过该字段可以设置标签的背景形状和风格。
  24086. */
  24087. this.background = new ThemeLabelBackground();
  24088. /**
  24089. * @member {SuperMap.ThemeFlow} [SuperMap.ThemeLabel.prototype.flow]
  24090. * @description 标签专题图标签流动显示与牵引线设置类。通过该字段可以设置标签是否流动显示和牵引线风格。
  24091. */
  24092. this.flow = new ThemeFlow();
  24093. /**
  24094. * @member {Array.<SuperMap.ThemeUniqueItem>} [SuperMap.ThemeLabel.prototype.items]
  24095. * @description 分段标签专题图的子项数组。分段标签专题图使用 rangeExpression
  24096. * 指定数字型的字段作为分段数据,items 中的每个子对象的 [start,end) 分段值必须来源于属性 rangeExpression 的字段值。每个子项拥有自己的风格。
  24097. */
  24098. this.items = null;
  24099. /**
  24100. * @member {Array.<SuperMap.ThemeLabelUniqueItem>} SuperMap.ThemeLabel.prototype.uniqueItems
  24101. * @description 单值标签专题图子项数组。单值标签专题图使用 uniqueExpression单值标签专题图子项集合。
  24102. */
  24103. this.uniqueItems = null;
  24104. /**
  24105. * @member {string} SuperMap.ThemeLabel.prototype.labelExpression
  24106. * @description 标注字段表达式。系统将 labelExpression 对应的字段或字段表达式的值以标签的形式显示在图层中。
  24107. */
  24108. this.labelExpression = null;
  24109. /**
  24110. * @member {SuperMap.LabelOverLengthMode} [SuperMap.ThemeLabel.prototype.labelOverLengthMode=SuperMap.LabelOverLengthMode.NONE] - 标签专题图中超长标签的处理模式枚举类。
  24111. * @description 对于标签的长度超过设置的标签最大长度 maxLabelLength 时称为超长标签。
  24112. */
  24113. this.labelOverLengthMode = LabelOverLengthMode.NONE;
  24114. /**
  24115. * @member {Array.<SuperMap.LabelMatrixCell>} SuperMap.ThemeLabel.prototype.matrixCells
  24116. * @description 矩阵标签元素数组,用于制作矩阵标签专题图。
  24117. * 数组中可以放置符号类型的矩阵标签元素和图片类型的矩阵标签元素。
  24118. */
  24119. this.matrixCells = null;
  24120. /**
  24121. * @member {number} [SuperMap.ThemeLabel.prototype.maxLabelLength=256]
  24122. * @description 标签在每一行显示的最大长度,一个中文为两个字符。
  24123. * 如果超过最大长度,可以采用两种方式来处理,一种是换行的模式进行显示,另一种是以省略号方式显示。单位为字符。
  24124. */
  24125. this.maxLabelLength = 256;
  24126. /**
  24127. * @member {number} [SuperMap.ThemeLabel.prototype.numericPrecision=0]
  24128. * @description 如果显示的标签内容为数字,通过该字段设置其显示的精度。例如标签对应的数字是8071.64529347,
  24129. * 如果该属性为0时,显示8071;为1时,显示8071.6;为3时,则是8071.645。
  24130. */
  24131. this.numericPrecision = 0;
  24132. /**
  24133. * @member {SuperMap.ThemeOffset} [SuperMap.ThemeLabel.prototype.offset]
  24134. * @description 用于设置标签专题图中标记文本相对于要素内点的偏移量对象。
  24135. */
  24136. this.offset = new ThemeOffset();
  24137. /**
  24138. * @member {boolean} [SuperMap.ThemeLabel.prototype.overlapAvoided=true]
  24139. * @description 是否允许以文本避让方式显示文本。true 表示自动避免文本叠盖。只针对该标签专题图层中的文本数据。
  24140. * 在标签重叠度很大的情况下,即使使用自动避让功能,可能也无法完全避免标签重叠现象。
  24141. */
  24142. this.overlapAvoided = true;
  24143. /**
  24144. * @member {string} SuperMap.ThemeLabel.prototype.rangeExpression
  24145. * @description 制作分段标签专题的分段字段或字段表达式。该表达式对应的字段(或者字段表达式)的值应该为数值型。
  24146. * 该字段与 items 分段子项联合使用,每个子项的起始值 [start,end)来源于 rangeExpression 字段值。
  24147. * 最后 labelExpression 指定的标签字段(标签专题图要显示的具体内容)会根据分段子项的风格进行分段显示。
  24148. */
  24149. this.rangeExpression = null;
  24150. /**
  24151. * @member {string} SuperMap.ThemeLabel.prototype.uniqueExpression
  24152. * @description 用于制作单值专题图的字段或字段表达式。
  24153. * 该字段值的数据类型可以为数值型或字符型。如果设置字段表达式,只能是相同数据类型字段间的运算。必须与labelExpression一起使用。
  24154. */
  24155. this.uniqueExpression = null;
  24156. /**
  24157. * @member {boolean} [SuperMap.ThemeLabel.prototype.smallGeometryLabeled=false]
  24158. * @description 是否显示长度大于被标注对象本身长度的标签。在标签的长度大于线或者面对象本身的长度时,
  24159. * 如果该值为 true,则标签文字会叠加在一起显示,为了清楚完整的显示该标签,
  24160. * 可以采用换行模式来显示标签,但必须保证每行的长度小于对象本身的长度。
  24161. */
  24162. this.smallGeometryLabeled = false;
  24163. /**
  24164. * @member {SuperMap.ThemeLabelText} SuperMap.ThemeLabel.prototype.text
  24165. * @description 标签中文本风格。
  24166. */
  24167. this.text = new ThemeLabelText();
  24168. /**
  24169. * @member {number} [SuperMap.ThemeLabel.prototype.textSpace=0]
  24170. * @description 沿线标注,相邻两个文字之间的间距,单位当前设置的字高。
  24171. */
  24172. this.textSpace = 0;
  24173. if (options) {
  24174. Util.extend(this, options);
  24175. }
  24176. this.CLASS_NAME = "SuperMap.ThemeLabel";
  24177. }
  24178. /**
  24179. * @function SuperMap.ThemeLabel.prototype.destroy
  24180. * @override
  24181. */
  24182. destroy() {
  24183. super.destroy();
  24184. var me = this;
  24185. me.alongLine = null;
  24186. if (me.background) {
  24187. me.background.destroy();
  24188. me.background = null;
  24189. }
  24190. me.flow = null;
  24191. if (me.items) {
  24192. for (var i = 0, items = me.items, len = items.length; i < len; i++) {
  24193. items[i].destroy();
  24194. }
  24195. me.items = null;
  24196. }
  24197. if (me.uniqueItems) {
  24198. for (var j = 0, uniqueItems = me.uniqueItems, uniqueLen = uniqueItems.length; j < uniqueLen; j++) {
  24199. uniqueItems[j].destory();
  24200. }
  24201. me.uniqueItems = null;
  24202. }
  24203. me.labelExpression = null;
  24204. me.labelOverLengthMode = null;
  24205. me.matrixCells = null;
  24206. me.maxLabelLength = null;
  24207. me.numericPrecision = null;
  24208. me.overlapAvoided = null;
  24209. me.rangeExpression = null;
  24210. me.uniqueExpression = null;
  24211. if (me.offset) {
  24212. me.offset.destroy();
  24213. me.offset = null;
  24214. }
  24215. me.overlapAvoided = null;
  24216. me.smallGeometryLabeled = null;
  24217. if (me.text) {
  24218. me.text.destroy();
  24219. me.text = null;
  24220. }
  24221. me.textSpace = null;
  24222. }
  24223. /**
  24224. * @function SuperMap.ThemeLabel.prototype.toJSON
  24225. * @description 将themeLabel对象转化为 JSON 字符串。
  24226. * @returns {string} 返回转换后的 JSON 字符串。
  24227. */
  24228. toJSON() {
  24229. return Util.toJSON(this.toServerJSONObject());
  24230. }
  24231. /**
  24232. * @function SuperMap.ThemeLabel.prototype.toServerJSONObject
  24233. * @description 转换成对应的 JSON 格式对象。
  24234. * @returns {Object} 对应的 JSON 格式对象。
  24235. */
  24236. toServerJSONObject() {
  24237. var obj = {};
  24238. obj.type = this.type;
  24239. obj.memoryData = this.memoryData;
  24240. if (this.alongLine) {
  24241. obj.alongLine = this.alongLine.isAlongLine;
  24242. obj.alongLineDirection = this.alongLine.alongLineDirection;
  24243. obj.angleFixed = this.alongLine.angleFixed;
  24244. obj.isLabelRepeated = this.alongLine.isLabelRepeated;
  24245. obj.labelRepeatInterval = this.alongLine.labelRepeatInterval;
  24246. obj.repeatedLabelAvoided = this.alongLine.repeatedLabelAvoided;
  24247. obj.repeatIntervalFixed = this.alongLine.repeatIntervalFixed;
  24248. }
  24249. if (this.offset) {
  24250. obj.offsetFixed = this.offset.offsetFixed;
  24251. obj.offsetX = this.offset.offsetX;
  24252. obj.offsetY = this.offset.offsetY;
  24253. }
  24254. if (this.flow) {
  24255. obj.flowEnabled = this.flow.flowEnabled;
  24256. obj.leaderLineDisplayed = this.flow.leaderLineDisplayed;
  24257. obj.leaderLineStyle = this.flow.leaderLineStyle;
  24258. }
  24259. if (this.text) {
  24260. obj.maxTextHeight = this.text.maxTextHeight;
  24261. obj.maxTextWidth = this.text.maxTextWidth;
  24262. obj.minTextHeight = this.text.minTextHeight;
  24263. obj.minTextWidth = this.text.minTextWidth;
  24264. obj.uniformStyle = this.text.uniformStyle;
  24265. obj.uniformMixedStyle = this.text.uniformMixedStyle;
  24266. }
  24267. if (this.background) {
  24268. obj.labelBackShape = this.background.labelBackShape;
  24269. obj.backStyle = this.background.backStyle;
  24270. }
  24271. obj.labelOverLengthMode = this.labelOverLengthMode;
  24272. obj.maxLabelLength = this.maxLabelLength;
  24273. obj.smallGeometryLabeled = this.smallGeometryLabeled;
  24274. obj.rangeExpression = this.rangeExpression;
  24275. obj.uniqueExpression = this.uniqueExpression;
  24276. obj.numericPrecision = this.numericPrecision;
  24277. obj.items = this.items;
  24278. obj.uniqueItems = this.uniqueItems;
  24279. obj.labelExpression = this.labelExpression;
  24280. obj.overlapAvoided = this.overlapAvoided;
  24281. obj.matrixCells = this.matrixCells;
  24282. obj.textSpace = this.textSpace;
  24283. return obj;
  24284. }
  24285. /**
  24286. * @function SuperMap.ThemeLabel.fromObj
  24287. * @description 从传入对象获取标签专题图类。
  24288. * @param {Object} obj - 传入对象。
  24289. * @returns {SuperMap.ThemeLabel} ThemeLabel 对象。
  24290. */
  24291. static fromObj(obj) {
  24292. if (!obj) {
  24293. return;
  24294. }
  24295. var lab = new ThemeLabel();
  24296. var itemsL = obj.items, itemsU = obj.uniqueItems, cells = obj.matrixCells;
  24297. obj.matrixCells = null;
  24298. Util.copy(lab, obj);
  24299. lab.alongLine = ThemeLabelAlongLine.fromObj(obj);
  24300. lab.background = ThemeLabelBackground.fromObj(obj);
  24301. lab.flow = new ThemeFlow({
  24302. flowEnabled: obj.flowEnabled,
  24303. leaderLineDisplayed: obj.leaderLineDisplayed,
  24304. leaderLineStyle: obj.leaderLineStyle
  24305. });
  24306. if (itemsL) {
  24307. lab.items = [];
  24308. for (var i = 0, len = itemsL.length; i < len; i++) {
  24309. lab.items.push(ThemeLabelItem.fromObj(itemsL[i]));
  24310. }
  24311. }
  24312. if (itemsU) {
  24313. lab.uniqueItems = [];
  24314. for (let j = 0, uniqueLen = itemsU.length; j < uniqueLen; j++) {
  24315. lab.uniqueItems.push(ThemeUniqueItem.fromObj(itemsU[j]));
  24316. }
  24317. }
  24318. if (cells) {
  24319. lab.matrixCells = [];
  24320. for (let i = 0, len = cells.length; i < len; i++) {
  24321. //TODO
  24322. //lab.matrixCells.push(SuperMap.LabelMatrixCell.fromObj(cells[i]));
  24323. }
  24324. }
  24325. lab.offset = ThemeOffset.fromObj(obj);
  24326. lab.text = ThemeLabelText.fromObj(obj);
  24327. return lab;
  24328. }
  24329. }
  24330. SuperMap.ThemeLabel = ThemeLabel;
  24331. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeUnique.js
  24332. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  24333. * This program are made available under the terms of the Apache License, Version 2.0
  24334. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24335. /**
  24336. * @class SuperMap.ThemeUnique
  24337. * @category iServer Map Theme
  24338. * @classdesc 单值专题图。
  24339. * @description 单值专题图是利用不同的颜色或符号(线型、填充)表示图层中某一属性信息的不同属性值,属性值相同的要素具有相同的渲染风格。单值专题图多用于具有分类属性的地图上,
  24340. * 比如土壤类型分布图、土地利用图、行政区划图等。单值专题图着重表示现象质的差别,一般不表示数量的特征。尤其是有交叉或重叠现象时,此类不推荐使用,例如:民族分布区等。
  24341. * @extends {SuperMap.Theme}
  24342. * @param {Object} options - 参数。
  24343. * @param {Array.<SuperMap.ThemeUniqueItem>} options.items - 单值专题图子项类数组。
  24344. * @param {string} options.uniqueExpression - 用于制作单值专题图的字段或字段表达式。
  24345. * @param {SuperMap.ServerStyle} [options.defaultStyle] - 未参与单值专题图制作的对象的显示风格。
  24346. * @param {SuperMap.ColorGradientType} [options.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED] - 渐变颜色枚举类。
  24347. * @param {SuperMap.ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  24348. */
  24349. class ThemeUnique extends Theme {
  24350. constructor(options) {
  24351. super("UNIQUE", options);
  24352. /**
  24353. * @member {SuperMap.ServerStyle} SuperMap.ThemeUnique.prototype.defaultStyle
  24354. * @description 未参与单值专题图制作的对象的显示风格。
  24355. * 通过单值专题图子项数组 (items)可以指定某些要素参与单值专题图制作,对于那些没有被包含的要素,即不参加单值专题表达的要素,使用该风格显示。
  24356. */
  24357. this.defaultStyle = new ServerStyle();
  24358. /**
  24359. * @member {Array.<SuperMap.ThemeUniqueItem>} SuperMap.ThemeUnique.prototype.items
  24360. * @description 单值专题图子项类数组。
  24361. * 单值专题图是将专题值相同的要素归为一类,为每一类设定一种渲染风格,其中每一类就是一个专题图子项。比如,利用单值专题图制作行政区划图,
  24362. * Name 字段代表省/直辖市名,该字段用来做专题变量,如果该字段的字段值总共有5种不同值,则该行政区划图有 5 个专题图子项。
  24363. */
  24364. this.items = null;
  24365. /**
  24366. * @member {string} SuperMap.ThemeUnique.prototype.uniqueExpression
  24367. * @description 用于制作单值专题图的字段或字段表达式。
  24368. * 该字段值的数据类型可以为数值型或字符型。如果设置字段表达式,只能是相同数据类型字段间的运算。
  24369. */
  24370. this.uniqueExpression = null;
  24371. /**
  24372. * @member {SuperMap.ColorGradientType} [SuperMap.ThemeUnique.prototype.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED]
  24373. * @description 渐变颜色枚举类。
  24374. * 渐变色是由起始色根据一定算法逐渐过渡到终止色的一种混合型颜色。
  24375. * 该类作为单值专题图参数类、分段专题图参数类的属性,负责设置单值专题图、分段专题图的配色方案,在默认情况下专题图所有子项会根据这个配色方案完成填充。
  24376. * 但如果为某几个子项的风格进行单独设置后(设置了 ThemeUniqueItem 或 ThemeRangeItem 类中Style属性),
  24377. * 该配色方案对于这几个子项将不起作用。
  24378. */
  24379. this.colorGradientType = ColorGradientType.YELLOW_RED;
  24380. if (options) {
  24381. Util.extend(this, options);
  24382. }
  24383. this.CLASS_NAME = "SuperMap.ThemeUnique";
  24384. }
  24385. /**
  24386. * @function SuperMap.ThemeUnique.prototype.destroy
  24387. * @override
  24388. */
  24389. destroy() {
  24390. super.destroy();
  24391. var me = this;
  24392. me.uniqueExpression = null;
  24393. me.colorGradientType = null;
  24394. if (me.items) {
  24395. if (me.items.length > 0) {
  24396. for (var item in me.items) {
  24397. me.items[item].destroy();
  24398. me.items[item] = null;
  24399. }
  24400. }
  24401. me.items = null;
  24402. }
  24403. if (me.defaultStyle) {
  24404. me.defaultStyle.destroy();
  24405. me.defaultStyle = null;
  24406. }
  24407. }
  24408. /**
  24409. * @function SuperMap.ThemeUnique.prototype.toServerJSONObject
  24410. * @description 转换成对应的 JSON 格式对象。
  24411. * @returns {Object} 对应的 JSON 格式对象。
  24412. */
  24413. toServerJSONObject() {
  24414. var obj = {};
  24415. obj = Util.copyAttributes(obj, this);
  24416. if (obj.defaultStyle) {
  24417. if (obj.defaultStyle.toServerJSONObject) {
  24418. obj.defaultStyle = obj.defaultStyle.toServerJSONObject();
  24419. }
  24420. }
  24421. if (obj.items) {
  24422. var items = [],
  24423. len = obj.items.length;
  24424. for (var i = 0; i < len; i++) {
  24425. items.push(obj.items[i].toServerJSONObject());
  24426. }
  24427. obj.items = items;
  24428. }
  24429. return obj;
  24430. }
  24431. /**
  24432. * @function SuperMap.ThemeUnique.fromObj
  24433. * @description 从传入对象获取单值专题图类。
  24434. * @param {Object} obj - 传入对象。
  24435. * @returns {SuperMap.ThemeUnique} ThemeUnique 对象。
  24436. */
  24437. static fromObj(obj) {
  24438. var res = new ThemeUnique();
  24439. var uItems = obj.items;
  24440. var len = uItems ? uItems.length : 0;
  24441. Util.extend(res, obj);
  24442. res.items = [];
  24443. res.defaultStyle = ServerStyle.fromJson(obj.defaultStyle);
  24444. for (var i = 0; i < len; i++) {
  24445. res.items.push(ThemeUniqueItem.fromObj(uItems[i]));
  24446. }
  24447. return res;
  24448. }
  24449. }
  24450. SuperMap.ThemeUnique = ThemeUnique;
  24451. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraphAxes.js
  24452. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  24453. * This program are made available under the terms of the Apache License, Version 2.0
  24454. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24455. /**
  24456. * @class SuperMap.ThemeGraphAxes
  24457. * @category iServer Map Theme
  24458. * @classdesc 统计专题图坐标轴样式类。
  24459. * @param {Object} options - 参数。
  24460. * @param {SuperMap.ServerColor} [options.axesColor=(0, 0, 0)] - 坐标轴颜色。
  24461. * @param {boolean} [options.axesDisplayed=false] - 是否显示坐标轴。
  24462. * @param {boolean} [options.axesGridDisplayed=false] - 是否在统计图坐标轴上显示网格。
  24463. * @param {boolean} [options.axesTextDisplayed=false] - 是否显示坐标轴的文本标注。
  24464. * @param {SuperMap.ServerTextStyle} [options.axesTextStyle] - 统计符号的最大最小尺寸。
  24465. */
  24466. class ThemeGraphAxes {
  24467. constructor(options) {
  24468. /**
  24469. * @member {SuperMap.ServerColor} [SuperMap.ThemeGraphAxes.prototype.axesColor=(0, 0, 0)]
  24470. * @description 坐标轴颜色。当 axesDisplayed = true 时有效。
  24471. */
  24472. this.axesColor = new ServerColor(0, 0, 0);
  24473. /**
  24474. * @member {boolean} [SuperMap.ThemeGraphAxes.prototype.axesDisplayed=false]
  24475. * @description 是否显示坐标轴。<br>
  24476. * 由于饼状图和环状图无坐标轴,故该属性以及所有与坐标轴设置相关的属性都不适用于它们。并且只有当该值为 true 时,其它设置坐标轴的属性才起作用。
  24477. */
  24478. this.axesDisplayed = false;
  24479. /**
  24480. * @member {boolean} [SuperMap.ThemeGraphAxes.prototype.axesGridDisplayed=false]
  24481. * @description 是否在统计图坐标轴上显示网格。
  24482. */
  24483. this.axesGridDisplayed = false;
  24484. /**
  24485. * @member {boolean} [SuperMap.ThemeGraphAxes.prototype.axesTextDisplayed=false]
  24486. * @description 是否显示坐标轴的文本标注。
  24487. */
  24488. this.axesTextDisplayed = false;
  24489. /**
  24490. * @member {SuperMap.ServerTextStyle} SuperMap.ThemeGraphAxes.prototype.axesTextStyle
  24491. * @description 坐标轴文本风格。当 axesTextDisplayed = true 时有效。
  24492. */
  24493. this.axesTextStyle = new ServerTextStyle();
  24494. if (options) {
  24495. Util.extend(this, options);
  24496. }
  24497. this.CLASS_NAME = "SuperMap.ThemeGraphAxes";
  24498. }
  24499. /**
  24500. * @function SuperMap.ThemeGraphAxes.prototype.destroy
  24501. * @description 释放资源,将引用资源的属性置空。
  24502. */
  24503. destroy() {
  24504. var me = this;
  24505. if (me.axesColor) {
  24506. me.axesColor.destroy();
  24507. me.axesColor = null;
  24508. }
  24509. me.axesDisplayed = null;
  24510. me.axesGridDisplayed = null;
  24511. me.axesTextDisplayed = null;
  24512. if (me.axesTextStyle) {
  24513. me.axesTextStyle.destroy();
  24514. me.axesTextStyle = null;
  24515. }
  24516. }
  24517. /**
  24518. * @function SuperMap.ThemeGraphAxes.fromObj
  24519. * @description 从传入对象获取统计专题图坐标轴样式类。
  24520. * @param {Object} obj - 传入对象。
  24521. * @returns {SuperMap.ThemeGraphAxes} ThemeGraphAxes 对象。
  24522. */
  24523. static fromObj(obj) {
  24524. if (!obj) {
  24525. return;
  24526. }
  24527. var res = new ThemeGraphAxes();
  24528. Util.copy(res, obj);
  24529. res.axesColor = ServerColor.fromJson(obj.axesColor);
  24530. res.axesTextStyle = ServerTextStyle.fromObj(obj.axesTextStyle);
  24531. return res;
  24532. }
  24533. }
  24534. SuperMap.ThemeGraphAxes = ThemeGraphAxes;
  24535. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraphSize.js
  24536. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  24537. * This program are made available under the terms of the Apache License, Version 2.0
  24538. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24539. /**
  24540. * @class SuperMap.ThemeGraphSize
  24541. * @category iServer Map Theme
  24542. * @classdesc 统计专题图符号尺寸类。
  24543. * @param {Object} options - 参数。
  24544. * @param {number} [options.maxGraphSize=0] - 统计图中显示的最大图表尺寸基准值。
  24545. * @param {number} [options.minGraphSize=0] - 统计图中显示的最小图表尺寸基准值。
  24546. */
  24547. class ThemeGraphSize {
  24548. constructor(options) {
  24549. /**
  24550. * @member {number} [SuperMap.ThemeGraphSize.prototype.maxGraphSize=0]
  24551. * @description 获取或设置统计图中显示的最大图表尺寸基准值,单位为像素。
  24552. */
  24553. this.maxGraphSize = 0;
  24554. /**
  24555. * @member {number} [SuperMap.ThemeGraphSize.prototype.minGraphSize=0]
  24556. * @description 获取或设置统计图中显示的最小图表尺寸基准值,单位为像素。
  24557. */
  24558. this.minGraphSize = 0;
  24559. if (options) {
  24560. Util.extend(this, options);
  24561. }
  24562. this.CLASS_NAME = "SuperMap.ThemeGraphSize";
  24563. }
  24564. /**
  24565. * @function SuperMap.ThemeGraphSize.prototype.destroy
  24566. * @description 释放资源,将引用资源的属性置空。
  24567. */
  24568. destroy() {
  24569. var me = this;
  24570. me.maxGraphSize = null;
  24571. me.minGraphSize = null;
  24572. }
  24573. /**
  24574. * @function SuperMap.ThemeGraphSize.fromObj
  24575. * @description 从传入对象获统计专题图符号尺寸类。
  24576. * @param {Object} obj - 传入对象。
  24577. * @returns {SuperMap.ThemeGraphSize} ThemeGraphSize 对象。
  24578. */
  24579. static fromObj(obj) {
  24580. var res = new ThemeGraphSize();
  24581. Util.copy(res, obj);
  24582. return res;
  24583. }
  24584. }
  24585. SuperMap.ThemeGraphSize = ThemeGraphSize;
  24586. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraphText.js
  24587. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  24588. * This program are made available under the terms of the Apache License, Version 2.0
  24589. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24590. /**
  24591. * @class SuperMap.ThemeGraphText
  24592. * @category iServer Map Theme
  24593. * @classdesc 统计图文字标注风格类。
  24594. * @param {Object} options - 可选参数。
  24595. * @param {boolean} [options.graphTextDisplayed=false] - 是否显示统计图上的文字标注。
  24596. * @param {SuperMap.ThemeGraphTextFormat} [options.graphTextFormat=SuperMap.ThemeGraphTextFormat.CAPTION] - 统计专题图文本显示格式。
  24597. * @param {SuperMap.ServerTextStyle} [options.graphTextStyle] - 统计图上的文字标注风格。
  24598. */
  24599. class ThemeGraphText {
  24600. constructor(options) {
  24601. /**
  24602. * @member {boolean} [SuperMap.ThemeGraphText.prototype.graphTextDisplayed=false]
  24603. * @description 是否显示统计图上的文字标注。
  24604. */
  24605. this.graphTextDisplayed = false;
  24606. /**
  24607. * @member {SuperMap.ThemeGraphTextFormat} [SuperMap.ThemeGraphText.prototype.graphTextFormat=SuperMap.ThemeGraphTextFormat.CAPTION]
  24608. * @description 统计专题图文本显示格式。
  24609. * 文本显示格式包括百分数、真实数值、标题、标题+百分数、标题+真实数值。
  24610. */
  24611. this.graphTextFormat = ThemeGraphTextFormat.CAPTION;
  24612. /**
  24613. * @member {SuperMap.ServerTextStyle} SuperMap.ThemeGraphText.prototype.graphTextStyle
  24614. * @description 统计图上的文字标注风格。
  24615. */
  24616. this.graphTextStyle = new ServerTextStyle();
  24617. if (options) {
  24618. Util.extend(this, options);
  24619. }
  24620. this.CLASS_NAME = "SuperMap.ThemeGraphText";
  24621. }
  24622. /**
  24623. * @function SuperMap.ThemeGraphText.prototype.destroy
  24624. * @description 释放资源,将引用资源的属性置空。
  24625. */
  24626. destroy() {
  24627. var me = this;
  24628. me.graphTextDisplayed = null;
  24629. me.graphTextFormat = null;
  24630. if (me.graphTextStyle) {
  24631. me.graphTextStyle.destroy();
  24632. me.graphTextStyle = null;
  24633. }
  24634. }
  24635. /**
  24636. * @function SuperMap.ThemeGraphText.fromObj
  24637. * @description 从传入对象获取统计图文字标注风格类。
  24638. * @param {Object} obj - 传入对象。
  24639. * @returns {SuperMap.ThemeGraphText} ThemeGraphText 对象。
  24640. */
  24641. static fromObj(obj) {
  24642. var res = new ThemeGraphText();
  24643. Util.copy(res, obj);
  24644. res.graphTextStyle = ServerTextStyle.fromObj(obj.graphTextStyle);
  24645. return res;
  24646. }
  24647. }
  24648. SuperMap.ThemeGraphText = ThemeGraphText;
  24649. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraphItem.js
  24650. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  24651. * This program are made available under the terms of the Apache License, Version 2.0
  24652. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24653. /**
  24654. * @class SuperMap.ThemeGraphItem
  24655. * @category iServer Map Theme
  24656. * @classdesc 统计专题图子项类。
  24657. * @param {Object} options - 参数。
  24658. * @param {string} [options.caption] - 专题图子项的名称。
  24659. * @param {string} options.graphExpression - 统计专题图的专题变量。
  24660. * @param {Array.<number>} [options.memoryDoubleValues] - 内存数组方式制作专题图时的值数组。
  24661. * @param {SuperMap.ServerStyle} [options.uniformStyle] - 统计专题图子项的显示风格
  24662. */
  24663. class ThemeGraphItem {
  24664. constructor(options) {
  24665. /**
  24666. * @member {string} [SuperMap.ThemeGraphItem.prototype.caption]
  24667. * @description 专题图子项的名称。
  24668. */
  24669. this.caption = null;
  24670. /**
  24671. * @member {string} SuperMap.ThemeGraphItem.prototype.graphExpression
  24672. * @description 统计专题图的专题变量。专题变量可以是一个字段或字段表达式。字段必须为数值型;表达式只能为数值型的字段间的运算。
  24673. */
  24674. this.graphExpression = null;
  24675. /**
  24676. * @member {Array.<number>} [SuperMap.ThemeGraphItem.prototype.memoryDoubleValues]
  24677. * @description 内存数组方式制作专题图时的值数组。<br>
  24678. * 内存数组方式制作专题图时,只对 SmID 值在键数组({@link SuperMap.ThemeGraph.memoryKeys})中的记录制作专题图。
  24679. * 值数组的数值个数必须与键数组中数值的个数一致。 值数组中的值将代替原来的专题值来制作统计专题图。
  24680. * 比如:利用面积字段和周长字段(即有两个统计专题图子项 )作为专题变量制作统计专题图。
  24681. */
  24682. this.memoryDoubleValues = null;
  24683. /**
  24684. * @member {SuperMap.ServerStyle} [SuperMap.ThemeGraphItem.prototype.uniformStyle]
  24685. * @description 统计专题图子项的显示风格。
  24686. * 每一个统计专题图子项都对应一种显示风格。
  24687. */
  24688. this.uniformStyle = new ServerStyle();
  24689. if (options) {
  24690. Util.extend(this, options);
  24691. }
  24692. this.CLASS_NAME = "SuperMap.ThemeGraphItem";
  24693. }
  24694. /**
  24695. * @function SuperMap.ThemeGraphItem.prototype.destroy
  24696. * @description 释放资源,将引用资源的属性置空。
  24697. */
  24698. destroy() {
  24699. var me = this;
  24700. me.caption = null;
  24701. me.graphExpression = null;
  24702. me.memoryDoubleValues = null;
  24703. me.uniformStyle = null;
  24704. }
  24705. /**
  24706. * @function SuperMap.ThemeGraphItem.fromObj
  24707. * @description 从传入对象获取统计专题图子项类。
  24708. * @param {Object} obj - 传入对象。
  24709. * @returns {SuperMap.ThemeGraphItem} ThemeGraphItem 对象。
  24710. */
  24711. static fromObj(obj) {
  24712. if (!obj) {
  24713. return;
  24714. }
  24715. var res = new ThemeGraphItem();
  24716. Util.copy(res, obj);
  24717. res.uniformStyle = ServerStyle.fromJson(obj.uniformStyle);
  24718. return res;
  24719. }
  24720. }
  24721. SuperMap.ThemeGraphItem = ThemeGraphItem;
  24722. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraph.js
  24723. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  24724. * This program are made available under the terms of the Apache License, Version 2.0
  24725. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24726. /**
  24727. * @class SuperMap.ThemeGraph
  24728. * @category iServer Map Theme
  24729. * @classdesc 统计专题图类。
  24730. * @extends {SuperMap.Theme}
  24731. * @param {Object} options - 参数。
  24732. * @param {Array.<SuperMap.ThemeGraphItem>} options.items - 统计专题图子项集合。
  24733. * @param {number} [options.barWidth=0] - 柱状专题图中每一个柱的宽度。
  24734. * @param {SuperMap.ThemeFlow} [options.flow] - 统计专题图流动显示与牵引线设置。
  24735. * @param {SuperMap.GraduatedMode} [options.graduatedMode=SuperMap.GraduatedMode.CONSTANT] - 统计图中地理要素的值与图表尺寸间的映射关系。
  24736. * @param {SuperMap.ThemeGraphAxes} [options.graphAxes] - 统计图中坐标轴样式相关信息。
  24737. * @param {SuperMap.ThemeGraphSize} [options.graphSize=0] - 统计符号的最大最小尺寸。
  24738. * @param {boolean} [options.graphSizeFixed=false] - 缩放地图时统计图符号是否固定大小。
  24739. * @param {SuperMap.ThemeGraphText} [options.graphText] - 统计图上的文字是否可以见以及文字标注风格。
  24740. * @param {SuperMap.GraphAxesTextDisplayMode} [options.graphAxesTextDisplayMode=SuperMap.GraphAxesTextDisplayMode.NONE] - 统计专题图坐标轴文本显示模式。
  24741. * @param {SuperMap.ThemeGraphType} [options.graphType=SuperMap.ThemeGraphType.AREA] - 统计专题图类型。
  24742. * @param {Array.<number>} [options.memoryKeys] - 以内存数组方式制作专题图时的键数组。
  24743. * @param {boolean} [options.negativeDisplayed=false] - 专题图中是否显示属性为负值的数据。
  24744. * @param {SuperMap.ThemeOffset} [options.offset] - 统计图相对于要素内点的偏移量。
  24745. * @param {boolean} [options.overlapAvoided=true] - 统计图是否采用避让方式显示。
  24746. * @param {number} [options.roseAngle=0] - 统计图中玫瑰图或三维玫瑰图用于等分的角度。
  24747. * @param {number} [options.startAngle=0] - 饼状统计图扇形的起始角度。
  24748. */
  24749. class ThemeGraph extends Theme {
  24750. constructor(options) {
  24751. super("GRAPH", options);
  24752. /**
  24753. * @member {number} [SuperMap.ThemeGraph.prototype.barWidth=0]
  24754. * @description 柱状专题图中每一个柱的宽度。使用地图坐标单位。
  24755. * 只有选择的统计图类型为柱状图(柱状图、三维柱状图、堆叠柱状图、三维堆叠柱状图)时,此项才可设置。
  24756. */
  24757. this.barWidth = 0;
  24758. /**
  24759. * @member {SuperMap.ThemeFlow} SuperMap.ThemeGraph.prototype.flow
  24760. * @description 统计专题图流动显示与牵引线设置。
  24761. * 通过该字段可以设置统计符号是否流动显示和牵引线风格。
  24762. */
  24763. this.flow = new ThemeFlow();
  24764. /**
  24765. * @member {SuperMap.GraduatedMode} [SuperMap.ThemeGraph.prototype.graduatedMode=SuperMap.GraduatedMode.CONSTANT]
  24766. * @description 统计图中地理要素的值与图表尺寸间的映射关系(常数、对数、平方根),即分级方式。
  24767. * 分级主要是为了减少制作统计专题图中数据大小之间的差异,使得统计图的视觉效果比较好,同时不同类别之间的比较也还是有意义的。
  24768. * 提供三种分级模式:常数、对数和平方根,对于有值为负数的字段,不可以采用对数和平方根的分级方式。不同的等级方式用于确定符号大小的数值是不相同的。
  24769. */
  24770. this.graduatedMode = GraduatedMode.CONSTANT;
  24771. /**
  24772. * @member {SuperMap.ThemeGraphAxes} SuperMap.ThemeGraph.prototype.graphAxes
  24773. * @description 用于设置统计图中坐标轴样式相关信息,如坐标轴颜色、是否显示、坐标文本样式等。
  24774. */
  24775. this.graphAxes = new ThemeGraphAxes();
  24776. /**
  24777. * @member {SuperMap.ThemeGraphSize} [SuperMap.ThemeGraph.prototype.graphSize=0]
  24778. * @description 用于设置统计符号的最大最小尺寸。
  24779. */
  24780. this.graphSize = new ThemeGraphSize();
  24781. /**
  24782. * @member {boolean} [SuperMap.ThemeGraph.prototype.graphSizeFixed=false]
  24783. * @description 缩放地图时统计图符号是否固定大小。即统计图符号将随地图缩放。
  24784. */
  24785. this.graphSizeFixed = false;
  24786. /**
  24787. * @member {SuperMap.ThemeGraphText} SuperMap.ThemeGraph.prototype.graphText
  24788. * @description 统计图上的文字是否可以见以及文字标注风格。
  24789. */
  24790. this.graphText = new ThemeGraphText();
  24791. /**
  24792. * @member {SuperMap.ThemeGraphType} [SuperMap.ThemeGraph.prototype.graphType=SuperMap.ThemeGraphType.AREA]
  24793. * @description 统计专题图类型。SuperMap 提供了多种类型的统计图,
  24794. * 分别为面积图、阶梯图、折线图、点状图、柱状图、三维柱状图、饼图、三维饼图、玫瑰图、三维玫瑰图、堆叠柱状图、三维堆叠柱状图、环状图。默认为面积图。
  24795. */
  24796. this.graphType = ThemeGraphType.AREA;
  24797. /**
  24798. * @member {SuperMap.GraphAxesTextDisplayMode} [SuperMap.ThemeGraph.prototype.graphAxesTextDisplayMode=SuperMap.GraphAxesTextDisplayMode.NONE]
  24799. * @description 统计专题图坐标轴文本显示模式。
  24800. */
  24801. this.graphAxesTextDisplayMode = GraphAxesTextDisplayMode.NONE;
  24802. /**
  24803. * @member {Array.<SuperMap.ThemeGraphItem>} SuperMap.ThemeGraph.prototype.items
  24804. * @description 统计专题图子项集合。
  24805. * 统计专题图可以基于多个变量,反映多种属性,即可以将多个专题变量的值绘制在一个统计图上。每一个专题变量对应的统计图即为一个专题图子项。
  24806. * 对于每个专题图子项可以为其设置标题、风格,甚至可以将该子项再制作成范围分段专题图。
  24807. */
  24808. this.items = null;
  24809. /**
  24810. * @member {Array.<number>} SuperMap.ThemeGraph.prototype.memoryKeys
  24811. * @description 以内存数组方式制作专题图时的键数组。
  24812. * 键数组内的数值代表 SmID 值,它与 SuperMap.ThemeGraphItem 类中的值数组(SuperMap.ThemeGraphItem.memoryDoubleValues)要关联起来应用。
  24813. * 键数组中数值的个数必须要与值数组的数值个数一致。值数组中的值将代替原来的专题值来制作统计专题图。
  24814. * 目前所有的专题图都支持以内存数组的方式制作专题图,但统计专题图与其他专题图指定内存数组的方式不同,
  24815. * 统计专题图使用 memoryKeys 指定内存数组,而其他专题图则使用 memoryData 来指定内存数组。
  24816. * @example
  24817. * memoryKeys 的使用方法如下:
  24818. * function addThemeGraph() {
  24819. * removeTheme();
  24820. * //创建统计专题图对象,SuperMap.ThemeGraph 必设 items。
  24821. * //专题图参数 ThemeParameters 必设 theme(即以设置好的分段专题图对象)、dataSourceName 和 datasetName
  24822. * var style1 = new SuperMap.ServerStyle({
  24823. * fillForeColor: new SuperMap.ServerColor(92,73,234),
  24824. * lineWidth: 0.1
  24825. * }),
  24826. * style2 = new SuperMap.ServerStyle({
  24827. * fillForeColor: new SuperMap.ServerColor(211,111,240),
  24828. * lineWidth: 0.1
  24829. * }),
  24830. * item1 = new SuperMap.ThemeGraphItem({
  24831. * memoryDoubleValues:[1.18,0.95,0.37,1.31,0.8,1.5],
  24832. * caption: "1992-1995人口增长率",
  24833. * graphExpression: "Pop_Rate95",
  24834. * uniformStyle: style1
  24835. * }),
  24836. * item2 = new SuperMap.ThemeGraphItem({
  24837. * //以内存数组方式制作专题图时的值数组
  24838. * memoryDoubleValues:[2.71,0,0.74,3.1,2.2,3.5],
  24839. * caption: "1995-1999人口增长率", //专题图子项的名称
  24840. * graphExpression: "Pop_Rate99", //统计专题图的专题变量
  24841. * uniformStyle: style2 //统计专题图子项的显示风格
  24842. * }),
  24843. * themeGraph = new SuperMap.ThemeGraph({
  24844. * //以内存数组方式制作专题图时的键数组,键数组内的数值代表 SmID 值
  24845. * memoryKeys:[1,2,4,8,10,12],
  24846. * items: new Array(item1,item2),
  24847. * barWidth: 0.03,
  24848. * //统计图中地理要素的值与图表尺寸间的映射关系为平方根
  24849. * graduatedMode: SuperMap.GraduatedMode.SQUAREROOT,
  24850. * //graphAxes用于设置统计图中坐标轴样式相关信息
  24851. * graphAxes: new SuperMap.ThemeGraphAxes({
  24852. * axesDisplayed: true
  24853. * }),
  24854. * graphSize: new SuperMap.ThemeGraphSize({
  24855. * maxGraphSize: 1,
  24856. * minGraphSize: 0.35
  24857. * }),
  24858. * //统计图上的文字是否可以见以及文字标注风格
  24859. * graphText: new SuperMap.ThemeGraphText({
  24860. * graphTextDisplayed: true,
  24861. * graphTextFormat: SuperMap.ThemeGraphTextFormat.VALUE,
  24862. * graphTextStyle: new SuperMap.ServerTextStyle({
  24863. * sizeFixed: true,
  24864. * fontHeight: 9,
  24865. * fontWidth: 5
  24866. * })
  24867. * }),
  24868. * //统计专题图类型为三维柱状图
  24869. * graphType: SuperMap.ThemeGraphType.BAR3D
  24870. * }),
  24871. * //专题图参数对象
  24872. * themeParameters = new SuperMap.ThemeParameters({
  24873. * themes: [themeGraph],
  24874. * dataSourceNames: ["Jingjin"],
  24875. * datasetNames: ["BaseMap_R"]
  24876. * }),
  24877. * //与服务端交互
  24878. * themeService=new SuperMap.ThemeService(url, {
  24879. * eventListeners: {
  24880. * "processCompleted": ThemeCompleted,
  24881. * "processFailed": themeFailed
  24882. * }
  24883. * });
  24884. * themeService.processAsync(themeParameters);
  24885. * }
  24886. */
  24887. this.memoryKeys = null;
  24888. /**
  24889. * @member {boolean} [SuperMap.ThemeGraph.prototype.negativeDisplayed=false]
  24890. * @description 专题图中是否显示属性为负值的数据。true 表示显示;falese 不显示。
  24891. */
  24892. this.negativeDisplayed = false;
  24893. /**
  24894. * @member {SuperMap.ThemeOffset} SuperMap.ThemeGraph.prototype.offset
  24895. * @description 用于设置统计图相对于要素内点的偏移量。
  24896. */
  24897. this.offset = new ThemeOffset();
  24898. /**
  24899. * @member {boolean} SuperMap.ThemeGraph.prototype.overlapAvoided
  24900. * @description 统计图是否采用避让方式显示。<br>
  24901. * 1.对数据集制作统计专题图:当统计图采用避让方式显示时,如果 overlapAvoided 为 true,则在统计图重叠度很大的情况下,
  24902. * 会出现无法完全避免统计图重叠的现象;如果 overlapAvoided 为 false,会过滤掉一些统计图,从而保证所有的统计图均不重叠。<br>
  24903. * 2.对数据集同时制作统计专题图和标签专题图:当统计图不显示子项文本时,标签专题图的标签即使和统计图重叠,两者也都可正常显示;
  24904. * 当统计图显示子项文本时,如果统计图中的子项文本和标签专题图中的标签不重叠,则两者均正常显示;如果重叠,则会过滤掉统计图的子项文本,只显示标签。
  24905. */
  24906. this.overlapAvoided = true;
  24907. /**
  24908. * @member {number} [SuperMap.ThemeGraph.prototype.roseAngle=0]
  24909. * @description 统计图中玫瑰图或三维玫瑰图用于等分的角度,默认为 0 度,精确到 0.1 度。在角度为0或者大于 360 度的情况下均使用 360 度来等分制作统计图的字段数。
  24910. */
  24911. this.roseAngle = 0;
  24912. /**
  24913. * @member {number} [SuperMap.ThemeGraph.prototype.startAngle=0]
  24914. * @description 饼状统计图扇形的起始角度。精确到 0.1 度,以水平方向为正向。只有选择的统计图类型为饼状图(饼图、三维饼图、玫瑰图、三维玫瑰图)时,此项才可设置。
  24915. */
  24916. this.startAngle = 0;
  24917. if (options) {
  24918. Util.extend(this, options);
  24919. }
  24920. this.CLASS_NAME = "SuperMap.ThemeGraph";
  24921. }
  24922. /**
  24923. * @function SuperMap.ThemeGraph.prototype.destroy
  24924. * @override
  24925. */
  24926. destroy() {
  24927. super.destroy();
  24928. var me = this;
  24929. me.barWidth = null;
  24930. if (me.flow) {
  24931. me.flow.destroy();
  24932. me.flow = null;
  24933. }
  24934. me.graduatedMode = null;
  24935. if (me.graphAxes) {
  24936. me.graphAxes.destroy();
  24937. me.graphAxes = null;
  24938. }
  24939. if (me.graphSize) {
  24940. me.graphSize.destroy();
  24941. me.graphSize = null;
  24942. }
  24943. me.graphSizeFixed = null;
  24944. if (me.graphText) {
  24945. me.graphText.destroy();
  24946. me.graphText = null;
  24947. }
  24948. me.graphType = null;
  24949. if (me.items) {
  24950. for (var i = 0, items = me.items, len = items.length; i < len; i++) {
  24951. items[i].destroy();
  24952. }
  24953. me.items = null;
  24954. }
  24955. me.memoryKeys = null;
  24956. me.negativeDisplayed = null;
  24957. if (me.offset) {
  24958. me.offset.destroy();
  24959. me.offset = null;
  24960. }
  24961. me.overlapAvoided = null;
  24962. me.roseAngle = null;
  24963. me.startAngle = null;
  24964. me.graphAxesTextDisplayMode = null;
  24965. }
  24966. /**
  24967. * @function SuperMap.ThemeGraph.prototype.toJSON
  24968. * @description 将 SuperMap.ThemeGraph 对象转化为 JSON 字符串。
  24969. * @returns {string} 返回转换后的 JSON 字符串。
  24970. */
  24971. toJSON() {
  24972. return Util.toJSON(this.toServerJSONObject());
  24973. }
  24974. /**
  24975. * @function SuperMap.ThemeGraph.prototype.toServerJSONObject
  24976. * @description 转换成对应的 JSON 格式对象。
  24977. * @returns {Object} 对应的 JSON 格式对象。
  24978. */
  24979. toServerJSONObject() {
  24980. var obj = {};
  24981. obj.type = this.type;
  24982. if (this.graphText) {
  24983. obj.graphTextDisplayed = this.graphText.graphTextDisplayed;
  24984. obj.graphTextFormat = this.graphText.graphTextFormat;
  24985. obj.graphTextStyle = this.graphText.graphTextStyle;
  24986. }
  24987. if (this.flow) {
  24988. obj.flowEnabled = this.flow.flowEnabled;
  24989. obj.leaderLineDisplayed = this.flow.leaderLineDisplayed;
  24990. obj.leaderLineStyle = this.flow.leaderLineStyle;
  24991. }
  24992. if (this.graphAxes) {
  24993. obj.axesColor = this.graphAxes.axesColor;
  24994. obj.axesDisplayed = this.graphAxes.axesDisplayed;
  24995. obj.axesGridDisplayed = this.graphAxes.axesGridDisplayed;
  24996. obj.axesTextDisplayed = this.graphAxes.axesTextDisplayed;
  24997. obj.axesTextStyle = this.graphAxes.axesTextStyle;
  24998. }
  24999. if (this.graphSize) {
  25000. obj.maxGraphSize = this.graphSize.maxGraphSize;
  25001. obj.minGraphSize = this.graphSize.minGraphSize;
  25002. }
  25003. if (this.offset) {
  25004. obj.offsetFixed = this.offset.offsetFixed;
  25005. obj.offsetX = this.offset.offsetX;
  25006. obj.offsetY = this.offset.offsetY;
  25007. }
  25008. obj.barWidth = this.barWidth;
  25009. obj.graduatedMode = this.graduatedMode;
  25010. obj.graphSizeFixed = this.graphSizeFixed;
  25011. obj.graphType = this.graphType;
  25012. obj.graphAxesTextDisplayMode = this.graphAxesTextDisplayMode;
  25013. obj.items = this.items;
  25014. obj.memoryKeys = this.memoryKeys;
  25015. obj.negativeDisplayed = this.negativeDisplayed;
  25016. obj.overlapAvoided = this.overlapAvoided;
  25017. obj.roseAngle = this.roseAngle;
  25018. obj.startAngle = this.startAngle;
  25019. return obj;
  25020. }
  25021. /**
  25022. * @function SuperMap.ThemeGraph.fromObj
  25023. * @description 从传入对象获取统计专题图类。
  25024. * @param {Object} obj - 传入对象。
  25025. * @returns {SuperMap.ThemeGraph} ThemeGraph 对象。
  25026. */
  25027. static fromObj(obj) {
  25028. var res = new ThemeGraph();
  25029. var itemsG = obj.items;
  25030. var len = itemsG ? itemsG.length : 0;
  25031. Util.copy(res, obj);
  25032. res.items = [];
  25033. res.flow = ThemeFlow.fromObj(obj);
  25034. res.graphAxes = ThemeGraphAxes.fromObj(obj);
  25035. res.graphSize = ThemeGraphSize.fromObj(obj);
  25036. res.graphText = ThemeGraphText.fromObj(obj);
  25037. res.offset = ThemeOffset.fromObj(obj);
  25038. for (var i = 0; i < len; i++) {
  25039. res.items.push(ThemeGraphItem.fromObj(itemsG[i]));
  25040. }
  25041. return res;
  25042. }
  25043. }
  25044. SuperMap.ThemeGraph = ThemeGraph;
  25045. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeDotDensity.js
  25046. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  25047. * This program are made available under the terms of the Apache License, Version 2.0
  25048. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25049. /**
  25050. * @class SuperMap.ThemeDotDensity
  25051. * @category iServer Map Theme
  25052. * @classdesc 点密度专题图。
  25053. * @description 点密度专题图用一定大小、形状相同的点表示现象分布范围、数量特征和分布密度。点的多少和所代表的意义由地图的内容确定。
  25054. * 点密度专题图利用图层的某一数值属性信息(专题值)映射为不同等级,每一级别使用不同数量或表现为密度的点符号来表示。
  25055. * 该专题值在各个分区内的分布情况,体现不同区域的相对数量差异。多用于具有数量特征的地图上,
  25056. * 比如表示不同地区的粮食产量、GDP、人口等的分级,主要针对区域或面状的要素,因而,点密度专题图适用于面数据集。
  25057. * 注意:点密度专题图中点的分布是随机的,并不代表实际的分布位置。即使在相关设置完全相同的情况下,
  25058. * 每次制作出的专题图,点的数量相同,但点的位置都有差异。
  25059. * @extends {SuperMap.Theme}
  25060. * @param {Object} options - 参数。
  25061. * @param {string} options.dotExpression - 创建点密度专题图的字段或字段表达式。
  25062. * @param {SuperMap.ServerStyle} [options.style] - 点密度专题图中点的风格。
  25063. * @param {number} [options.value] - 专题图中每一个点所代表的数值。
  25064. * @param {SuperMap.ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  25065. */
  25066. class ThemeDotDensity extends Theme {
  25067. constructor(options) {
  25068. super("DOTDENSITY", options);
  25069. /**
  25070. * @member {string} SuperMap.ThemeDotDensity.prototype.dotExpression
  25071. * @description 创建点密度专题图的字段或字段表达式。点的数目或密集程度的来源。
  25072. */
  25073. this.dotExpression = null;
  25074. /**
  25075. * @member {SuperMap.ServerStyle} SuperMap.ThemeDotDensity.prototype.style
  25076. * @description 点密度专题图中点的风格。
  25077. */
  25078. this.style = new ServerStyle();
  25079. /**
  25080. * @member {number} SuperMap.ThemeDotDensity.prototype.value
  25081. * @description 专题图中每一个点所代表的数值。<br>
  25082. * 点值的确定与地图比例尺以及点的大小有关。地图比例尺越大,相应的图面范围也越大,
  25083. * 点相应就可以越多,此时点值就可以设置相对小一些。点形状越大,
  25084. * 点值相应就应该设置的小一些。点值过大或过小都是不合适的。
  25085. */
  25086. this.value = null;
  25087. if (options) {
  25088. Util.extend(this, options);
  25089. }
  25090. this.CLASS_NAME = "SuperMap.ThemeDotDensity";
  25091. }
  25092. /**
  25093. * @function SuperMap.ThemeDotDensity.prototype.destroy
  25094. * @description 释放资源,将引用资源的属性置空。
  25095. */
  25096. destroy() {
  25097. var me = this;
  25098. me.dotExpression = null;
  25099. me.value = null;
  25100. if (me.style) {
  25101. me.style.destroy();
  25102. me.style = null;
  25103. }
  25104. }
  25105. /**
  25106. * @function SuperMap.ThemeDotDensity.prototype.toServerJSONObject
  25107. * @description 转换成对应的 JSON 格式对象。
  25108. * @returns {Object} 对应的 JSON 格式对象。
  25109. */
  25110. toServerJSONObject() {
  25111. var obj = {};
  25112. obj = Util.copyAttributes(obj, this);
  25113. if (obj.style) {
  25114. if (obj.style.toServerJSONObject) {
  25115. obj.style = obj.style.toServerJSONObject();
  25116. }
  25117. }
  25118. return obj;
  25119. }
  25120. /**
  25121. * @function SuperMap.ThemeDotDensity.fromObj
  25122. * @description 从传入对象获取点密度专题图中点的风格。
  25123. * @param {Object} obj - 传入对象。
  25124. * @returns {SuperMap.ThemeDotDensity} ThemeDotDensity 对象。
  25125. */
  25126. static fromObj(obj) {
  25127. if (!obj) {
  25128. return;
  25129. }
  25130. var res = new ThemeDotDensity();
  25131. Util.copy(res, obj);
  25132. res.style = ServerStyle.fromJson(obj.style);
  25133. return res;
  25134. }
  25135. }
  25136. SuperMap.ThemeDotDensity = ThemeDotDensity;
  25137. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraduatedSymbolStyle.js
  25138. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  25139. * This program are made available under the terms of the Apache License, Version 2.0
  25140. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25141. /**
  25142. * @class SuperMap.ThemeGraduatedSymbolStyle
  25143. * @category iServer Map Theme
  25144. * @classdesc 等级符号专题图正负零值显示风格类。
  25145. * @param {Object} options - 参数。
  25146. * @param {boolean} [options.negativeDisplayed=false] - 是否显示负值。
  25147. * @param {SuperMap.ServerStyle} [options.negativeStyle] - 负值的等级符号风格。
  25148. * @param {SuperMap.ServerStyle} [options.positiveStyle] - 正值的等级符号风格。
  25149. * @param {boolean} [options.zeroDisplayed=false] - 是否显示 0 值。
  25150. * @param {SuperMap.ServerStyle} [options.zeroStyle] - 0 值的等级符号风格。
  25151. */
  25152. class ThemeGraduatedSymbolStyle {
  25153. constructor(options) {
  25154. /**
  25155. * @member {boolean} [SuperMap.ThemeGraduatedSymbolStyle.prototype.negativeDisplayed=false]
  25156. * @description 是否显示负值。
  25157. */
  25158. this.negativeDisplayed = false;
  25159. /**
  25160. * @member {SuperMap.ServerStyle} [SuperMap.ThemeGraduatedSymbolStyle.prototype.negativeStyle]
  25161. * @description 负值的等级符号风格。
  25162. */
  25163. this.negativeStyle = new ServerStyle();
  25164. /**
  25165. * @member {SuperMap.ServerStyle} [SuperMap.ThemeGraduatedSymbolStyle.prototype.positiveStyle]
  25166. * @description 正值的等级符号风格。
  25167. */
  25168. this.positiveStyle = new ServerStyle();
  25169. /**
  25170. * @member {boolean} [SuperMap.ThemeGraduatedSymbolStyle.prototype.zeroDisplayed=false]
  25171. * @description 是否显示 0 值。
  25172. */
  25173. this.zeroDisplayed = false;
  25174. /**
  25175. * @member {SuperMap.ServerStyle} SuperMap.ThemeGraduatedSymbolStyle.prototype.zeroStyle
  25176. * @description 0 值的等级符号风格。
  25177. */
  25178. this.zeroStyle = new ServerStyle();
  25179. if (options) {
  25180. Util.extend(this, options);
  25181. }
  25182. this.CLASS_NAME = "SuperMap.ThemeGraduatedSymbolStyle";
  25183. }
  25184. /**
  25185. * @function SuperMap.ThemeGraduatedSymbolStyle.prototype.destroy
  25186. * @description 释放资源,将引用资源的属性置空。
  25187. */
  25188. destroy() {
  25189. var me = this;
  25190. me.negativeDisplayed = null;
  25191. me.negativeStyle = null;
  25192. me.positiveStyle = null;
  25193. me.zeroDisplayed = null;
  25194. me.zeroStyle = null;
  25195. }
  25196. /**
  25197. * @function SuperMap.ThemeGraduatedSymbolStyle.fromObj
  25198. * @description 从传入对象获取等级符号专题图正负零值显示风格类。
  25199. * @param {Object} obj - 传入对象。
  25200. * @returns {SuperMap.ThemeGraduatedSymbolStyle} ThemeGraduatedSymbolStyle 对象。
  25201. */
  25202. static fromObj(obj) {
  25203. if (!obj) {
  25204. return;
  25205. }
  25206. var res = new ThemeGraduatedSymbolStyle();
  25207. Util.copy(res, obj);
  25208. res.negativeStyle = ServerStyle.fromJson(obj.negativeStyle);
  25209. res.positiveStyle = ServerStyle.fromJson(obj.positiveStyle);
  25210. res.zeroStyle = ServerStyle.fromJson(obj.zeroStyle);
  25211. return res;
  25212. }
  25213. }
  25214. SuperMap.ThemeGraduatedSymbolStyle = ThemeGraduatedSymbolStyle;
  25215. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraduatedSymbol.js
  25216. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  25217. * This program are made available under the terms of the Apache License, Version 2.0
  25218. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25219. /**
  25220. * @class SuperMap.ThemeGraduatedSymbol
  25221. * @category iServer Map Theme
  25222. * @classdesc 等级符号专题图。
  25223. * @extends {SuperMap.Theme}
  25224. * @param {Object} options - 参数。
  25225. * @param {SuperMap.ThemeGraduatedSymbolStyle} options.style - 用于设置等级符号图正负和零值显示风格。
  25226. * @param {string} options.expression - 等级符号专题图的字段或字段表达式。
  25227. * @param {number} [options.baseValue=0] - 等级符号专题图的基准值,单位同专题变量的单位。
  25228. * @param {SuperMap.ThemeFlow} [options.flow] - 等级符号专题图符号流动显示与牵引线设置类。
  25229. * @param {SuperMap.GraduatedMode} [options.graduatedMode=SuperMap.GraduatedMode.CONSTANT] - 等级符号专题图分级模式。
  25230. * @param {SuperMap.ThemeOffset} [options.offset] - 用于设置标签专题图中标记文本相对于要素内点的偏移量对象。
  25231. * @param {SuperMap.ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  25232. */
  25233. class ThemeGraduatedSymbol extends Theme {
  25234. constructor(options) {
  25235. super("GRADUATEDSYMBOL", options);
  25236. /**
  25237. * @member {number} [SuperMap.ThemeGraduatedSymbol.prototype.baseValue=0]
  25238. * @description 等级符号专题图的基准值,单位同专题变量的单位。<br>
  25239. * 依据此值系统会自动根据分级方式计算其余值对应的符号大小,每个符号的显示大小等于
  25240. * ThemeValueSection.positiveStyle(或 zeroStyle,negativeStyle).markerSize * value / basevalue,
  25241. * 其中 value 是 expression 所指定字段对应的值经过分级计算之后的值。默认值为0,建议通过多次尝试设置该值才能达到较好的显示效果。
  25242. */
  25243. this.baseValue = 0;
  25244. /**
  25245. * @member {string} SuperMap.ThemeGraduatedSymbol.prototype.expression
  25246. * @description 用于创建等级符号专题图的字段或字段表达式,字段或字段表达式应为数值型。
  25247. */
  25248. this.expression = null;
  25249. /**
  25250. * @member {SuperMap.ThemeFlow} SuperMap.ThemeGraduatedSymbol.prototype.flow
  25251. * @description 等级符号专题图符号流动显示与牵引线设置类。<br>
  25252. * 通过该字段可以设置等级符号是否流动显示和牵引线风格。
  25253. */
  25254. this.flow = new ThemeFlow();
  25255. /**
  25256. * @member {SuperMap.GraduatedMode} [SuperMap.ThemeGraduatedSymbol.prototype.graduatedMode=SuperMap.GraduatedMode.CONSTANT]
  25257. * @description 等级符号专题图分级模式。<br>
  25258. * 分级主要是为了减少制作等级符号专题图中数据大小之间的差异。如果数据之间差距较大,则可以采用对数或者平方根的分级方式来进行,
  25259. * 这样就减少了数据之间的绝对大小的差异,使得等级符号图的视觉效果比较好,同时不同类别之间的比较也是有意义的。
  25260. * 有三种分级模式:常数、对数和平方根,对于有值为负数的字段,在用对数或平方根方式分级时,默认对负数取正。
  25261. * 不同的分级模式用于确定符号大小的数值是不相同的:常数按照字段的原始数据进行;对数则是对每条记录对应的专题变量取自然对数;
  25262. * 平方根则是对其取平方根,然后用最终得到的结果来确定其等级符号的大小。
  25263. */
  25264. this.graduatedMode = SuperMap.GraduatedMode.CONSTAN;
  25265. /**
  25266. * @member {SuperMap.ThemeOffset} [SuperMap.ThemeGraduatedSymbol.prototype.offset]
  25267. * @description 用于设置等级符号图相对于要素内点的偏移量。
  25268. */
  25269. this.offset = new ThemeOffset();
  25270. /**
  25271. * @member {SuperMap.ThemeGraduatedSymbolStyle} SuperMap.ThemeGraduatedSymbol.prototype.style
  25272. * @description 用于设置等级符号图正负和零值显示风格。
  25273. */
  25274. this.style = new ThemeGraduatedSymbolStyle();
  25275. if (options) {
  25276. Util.extend(this, options);
  25277. }
  25278. this.CLASS_NAME = "SuperMap.ThemeGraduatedSymbol";
  25279. }
  25280. /**
  25281. * @function SuperMap.ThemeGraduatedSymbol.prototype.destroy
  25282. * @description 释放资源,将引用资源的属性置空。
  25283. */
  25284. destroy() {
  25285. super.destroy();
  25286. var me = this;
  25287. me.expression = null;
  25288. if (me.flow) {
  25289. me.flow.destroy();
  25290. me.flow = null;
  25291. }
  25292. me.graduatedMode = GraduatedMode.CONSTANT;
  25293. if (me.offset) {
  25294. me.offset.destroy();
  25295. me.offset = null;
  25296. }
  25297. if (me.style) {
  25298. me.style.destroy();
  25299. me.style = null;
  25300. }
  25301. }
  25302. /**
  25303. * @function SuperMap.ThemeGraduatedSymbol.prototype.toJSON
  25304. * @description 将 themeLabel 对象转化为 JSON 字符串。
  25305. * @returns {string} 返回转换后的 JSON 字符串。
  25306. */
  25307. toJSON() {
  25308. return Util.toJSON(this.toServerJSONObject());
  25309. }
  25310. /**
  25311. * @function SuperMap.ThemeGraduatedSymbol.prototype.toServerJSONObject
  25312. * @description 转换成对应的 JSON 格式对象。
  25313. * @returns {Object} 对应的 JSON 格式对象。
  25314. */
  25315. toServerJSONObject() {
  25316. var obj = {};
  25317. obj.type = this.type;
  25318. obj.memoryData = this.memoryData;
  25319. obj.baseValue = this.baseValue;
  25320. obj.expression = this.expression;
  25321. obj.graduatedMode = this.graduatedMode;
  25322. if (this.flow) {
  25323. obj.flowEnabled = this.flow.flowEnabled;
  25324. obj.leaderLineDisplayed = this.flow.leaderLineDisplayed;
  25325. obj.leaderLineStyle = this.flow.leaderLineStyle;
  25326. }
  25327. if (this.offset) {
  25328. obj.offsetFixed = this.offset.offsetFixed;
  25329. obj.offsetX = this.offset.offsetX;
  25330. obj.offsetY = this.offset.offsetY;
  25331. }
  25332. if (this.style) {
  25333. obj.negativeStyle = this.style.negativeStyle;
  25334. obj.negativeDisplayed = this.style.negativeDisplayed;
  25335. obj.positiveStyle = this.style.positiveStyle;
  25336. obj.zeroDisplayed = this.style.zeroDisplayed;
  25337. obj.zeroStyle = this.style.zeroStyle;
  25338. }
  25339. return obj;
  25340. }
  25341. /**
  25342. * @function SuperMap.ThemeGraduatedSymbol.fromObj
  25343. * @description 从传入对象获取等级符号专题图。
  25344. * @param {Object} obj - 传入对象。
  25345. * @returns {SuperMap.ThemeGraduatedSymbol} 等级符号专题图对象。
  25346. */
  25347. static fromObj(obj) {
  25348. if (!obj) {
  25349. return;
  25350. }
  25351. var res = new SuperMap.ThemeGraduatedSymbol();
  25352. Util.copy(res, obj);
  25353. res.flow = ThemeFlow.fromObj(obj);
  25354. res.offset = ThemeOffset.fromObj(obj);
  25355. res.style = ThemeGraduatedSymbolStyle.fromObj(obj);
  25356. return res;
  25357. }
  25358. }
  25359. SuperMap.ThemeGraduatedSymbol = ThemeGraduatedSymbol;
  25360. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeRangeItem.js
  25361. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  25362. * This program are made available under the terms of the Apache License, Version 2.0
  25363. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25364. /**
  25365. * @class SuperMap.ThemeRangeItem
  25366. * @category iServer Map Theme
  25367. * @classdesc 范围分段专题图子项类。
  25368. * @description 在分段专题图中,字段值按照某种分段模式被分成多个范围段,每个范围段即为一个子项,同一范围段的要素属于同一个分段专题图子项。
  25369. * 每个子项都有其分段起始值、终止值、名称和风格等。每个分段所表示的范围为[start, end)。
  25370. * @param {Object} options - 参数。
  25371. * @param {string} [options.caption] - 分段专题图子项的标题。
  25372. * @param {number} [options.end=0] - 分段专题图子项的终止值。
  25373. * @param {number} [options.start=0] - 分段专题图子项的起始值。
  25374. * @param {SuperMap.ServerStyle} options.style - 分段专题图子项的风格。
  25375. * @param {boolean} [options.visible=true] - 分段专题图子项是否可见。
  25376. */
  25377. class ThemeRangeItem {
  25378. constructor(options) {
  25379. /**
  25380. * @member {string} [SuperMap.ThemeRangeItem.prototype.caption]
  25381. * @description 分段专题图子项的标题。
  25382. */
  25383. this.caption = null;
  25384. /**
  25385. * @member {number} [SuperMap.ThemeRangeItem.prototype.end=0]
  25386. * @description 分段专题图子项的终止值,即该段专题值范围的最大值。<br>
  25387. * 如果该子项是分段中最后一个子项,则该终止值应大于分段字段(ThemeRange 类的 rangeExpression 属性)的最大值,若该终止值小于分段字段最大值,
  25388. * 则剩余部分由内部随机定义其颜色;如果不是最后一项,该终止值必须与其下一子项的起始值相同,否则系统抛出异常;
  25389. * 如果设置了范围分段模式和分段数,则会自动计算每段的范围 [start, end),故无需设置 [start, end);当然可以设置,那么结果就会按您设置的值对分段结果进行调整。
  25390. */
  25391. this.end = 0;
  25392. /**
  25393. * @member {number} [SuperMap.ThemeRangeItem.prototype.start=0]
  25394. * @description 分段专题图子项的起始值,即该段专题值范围的最小值。<br>
  25395. * 如果该子项是分段中第一个子项,那么该起始值就是分段的最小值;如果子项的序号大于等于 1 的时候,该起始值必须与前一子项的终止值相同,否则系统会抛出异常。
  25396. * 如果设置了范围分段模式和分段数,则会自动计算每段的范围 [start, end),故无需设置 [start, end);当然可以设置,那么结果就会按您设置的值对分段结果进行调整。
  25397. */
  25398. this.start = 0;
  25399. /**
  25400. * @member {SuperMap.ServerStyle} SuperMap.ThemeRangeItem.prototype.style
  25401. * @description 分段专题图子项的风格。
  25402. * 每一个分段专题图子项都对应一种显示风格。
  25403. */
  25404. this.style = new ServerStyle();
  25405. /**
  25406. * @member {boolean} [SuperMap.ThemeRangeItem.prototype.visible=true]
  25407. * @description 分段专题图子项是否可见。
  25408. */
  25409. this.visible = true;
  25410. if (options) {
  25411. Util.extend(this, options);
  25412. }
  25413. this.CLASS_NAME = "SuperMap.ThemeRangeItem";
  25414. }
  25415. /**
  25416. * @function SuperMap.ThemeRangeItem.prototype.destroy
  25417. * @description 释放资源,将引用资源的属性置空。
  25418. */
  25419. destroy() {
  25420. var me = this;
  25421. me.caption = null;
  25422. me.end = null;
  25423. me.start = null;
  25424. if (me.style) {
  25425. me.style.destroy();
  25426. me.style = null;
  25427. }
  25428. me.visible = null;
  25429. }
  25430. /**
  25431. * @function SuperMap.ThemeRangeItem.prototypetoServerJSONObject
  25432. * @description 转换成对应的 JSON 格式对象。
  25433. * @returns {Object} 对应的 JSON 格式对象。
  25434. */
  25435. toServerJSONObject() {
  25436. var obj = {};
  25437. obj = Util.copyAttributes(obj, this);
  25438. if (obj.style) {
  25439. if (obj.style.toServerJSONObject) {
  25440. obj.style = obj.style.toServerJSONObject();
  25441. }
  25442. }
  25443. return obj;
  25444. }
  25445. /**
  25446. * @function SuperMap.ThemeRangeItem.fromObj
  25447. * @description 从传入对象获取范围分段专题图子项类。
  25448. * @param {Object} obj - 传入对象。
  25449. * @returns {SuperMap.ThemeRangeItem} ThemeRangeItem 对象。
  25450. */
  25451. static fromObj(obj) {
  25452. if (!obj) {
  25453. return;
  25454. }
  25455. var res = new ThemeRangeItem();
  25456. Util.copy(res, obj);
  25457. res.style = ServerStyle.fromJson(obj.style);
  25458. return res;
  25459. }
  25460. }
  25461. SuperMap.ThemeRangeItem = ThemeRangeItem;
  25462. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeRange.js
  25463. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  25464. * This program are made available under the terms of the Apache License, Version 2.0
  25465. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25466. /**
  25467. * @class SuperMap.ThemeRange
  25468. * @category iServer Map Theme
  25469. * @classdesc 范围分段专题图。
  25470. * @description 范围分段专题图是按照指定的分段方法(如:等距离分段法)对字段的属性值进行分段,使用不同的颜色或符号(线型、填充)表示不同范围段落的属性值在整体上的分布情况,体现区域的差异。
  25471. * 在分段专题图中,专题值按照某种分段方式被分成多个范围段,要素根据各自的专题值被分配到其中一个范围段中,在同一个范围段中的要素使用相同的颜色,填充,符号等风格进行显示。
  25472. * 分段专题图所基于的专题变量必须为数值型,分段专题图一般用来反映连续分布现象的数量或程度特征,如降水量的分布,土壤侵蚀强度的分布等。
  25473. * @extends {SuperMap.Theme}
  25474. * @param {Object} options - 参数。
  25475. * @param {Array.<SuperMap.ThemeRangeItem>} options.items - 分段专题图子项数组。
  25476. * @param {string} options.rangeExpression - 分段字段表达式。
  25477. * @param {number} options.rangeParameter - 分段参数。
  25478. * @param {number} options.rangeParameter - 分段参数。
  25479. * @param {SuperMap.RangeMode} [options.rangeMode=SuperMap.RangeMode.EQUALINTERVAL] - 分段专题图的分段模式。
  25480. * @param {SuperMap.ColorGradientType} [options.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED] - 渐变颜色枚举类。
  25481. * @param {SuperMap.ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  25482. */
  25483. class ThemeRange extends Theme {
  25484. constructor(options) {
  25485. super("RANGE", options);
  25486. /**
  25487. * @member {string} SuperMap.ThemeRange.prototype.precision
  25488. * @description 精准度
  25489. */
  25490. this.precision = '1.0E-12';
  25491. /**
  25492. * @member {Array.<SuperMap.ThemeRangeItem>} SuperMap.ThemeRange.prototype.items
  25493. * @description 分段专题图子项数组。<br>
  25494. * 在分段专题图中,字段值按照某种分段模式被分成多个范围段,每个范围段即为一个子项,同一范围段的要素属于同一个分段专题图子项。
  25495. * 每个子项都有其分段起始值、终止值、名称和风格等。每个分段所表示的范围为 [start, end)。
  25496. * 如果设置了范围分段模式和分段数,则会自动计算每段的范围 [start, end),故无需设置 [start, end);当然可以设置,那么结果就会按照您设置的值对分段结果进行调整。
  25497. */
  25498. this.items = null;
  25499. /**
  25500. * @member {string} SuperMap.ThemeRange.prototype.rangeExpression
  25501. * @description 分段字段表达式。<br>
  25502. * 由于范围分段专题图基于各种分段方法根据一定的距离进行分段,因而范围分段专题图所基于的字段值的数据类型必须为数值型。对于字段表达式,只能为数值型的字段间的运算。
  25503. */
  25504. this.rangeExpression = null;
  25505. /**
  25506. * @member {SuperMap.RangeMode} [SuperMap.ThemeRange.prototype.rangeMode=SuperMap.RangeMode.EQUALINTERVAL]
  25507. * @description 分段专题图的分段模式。<br>
  25508. * 在分段专题图中,作为专题变量的字段或表达式的值按照某种分段方式被分成多个范围段。
  25509. * 目前 SuperMap 提供的分段方式包括:等距离分段法、平方根分段法、标准差分段法、对数分段法、等计数分段法和自定义距离法,
  25510. * 显然这些分段方法根据一定的距离进行分段,因而范围分段专题图所基于的专题变量必须为数值型。
  25511. */
  25512. this.rangeMode = RangeMode.EQUALINTERVAL;
  25513. /**
  25514. * @member {number} SuperMap.ThemeRange.prototype.rangeParameter
  25515. * @description 分段参数。
  25516. * 当分段模式为等距离分段法,平方根分段,对数分段法,计数分段法其中一种模式时,该参数用于设置分段个数;当分段模式为标准差分段法时,
  25517. * 该参数不起作用;当分段模式为自定义距离时,该参数用于设置自定义距离。
  25518. */
  25519. this.rangeParameter = 0;
  25520. /**
  25521. * @member {SuperMap.ColorGradientType} [SuperMap.ThemeRange.prototype.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED]
  25522. * @description 渐变颜色枚举类。<br>
  25523. * 渐变色是由起始色根据一定算法逐渐过渡到终止色的一种混合型颜色。
  25524. * 该类作为单值专题图参数类、分段专题图参数类的属性,负责设置单值专题图、分段专题图的配色方案,在默认情况下专题图所有子项会根据这个配色
  25525. * 方案完成填*充。但如果为某几个子项的风格进行单独设置后(设置了 {@link SuperMap.ThemeUniqueItem} 或 {@link SuperMap.ThemeRangeItem} 类中Style属性),
  25526. * 该配色方案对于这几个子项将不起作用。
  25527. */
  25528. this.colorGradientType = ColorGradientType.YELLOW_RED;
  25529. if (options) {
  25530. Util.extend(this, options);
  25531. }
  25532. this.CLASS_NAME = "SuperMap.ThemeRange";
  25533. }
  25534. /**
  25535. * @function SuperMap.ThemeRange.prototype.destroy
  25536. * @override
  25537. */
  25538. destroy() {
  25539. super.destroy();
  25540. var me = this;
  25541. if (me.items) {
  25542. if (me.items.length > 0) {
  25543. for (var item in me.items) {
  25544. me.items[item].destroy();
  25545. me.items[item] = null;
  25546. }
  25547. }
  25548. me.items = null;
  25549. }
  25550. me.rangeExpression = null;
  25551. me.rangeMode = null;
  25552. me.rangeParameter = null;
  25553. me.colorGradientType = null;
  25554. }
  25555. /**
  25556. * @function SuperMap.ThemeRange.fromObj
  25557. * @description 从传入对象获取范围分段专题图类。
  25558. * @param {Object} obj - 传入对象。
  25559. * @returns {SuperMap.ThemeRange} ThemeRange 对象。
  25560. */
  25561. static fromObj(obj) {
  25562. if (!obj) {
  25563. return;
  25564. }
  25565. var res = new ThemeRange();
  25566. Util.copy(res, obj);
  25567. var itemsR = obj.items;
  25568. var len = itemsR ? itemsR.length : 0;
  25569. res.items = [];
  25570. for (var i = 0; i < len; i++) {
  25571. res.items.push(ThemeRangeItem.fromObj(itemsR[i]));
  25572. }
  25573. return res;
  25574. }
  25575. }
  25576. SuperMap.ThemeRange = ThemeRange;
  25577. ;// CONCATENATED MODULE: ./src/common/iServer/UGCLayer.js
  25578. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  25579. * This program are made available under the terms of the Apache License, Version 2.0
  25580. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25581. /**
  25582. * @class SuperMap.UGCLayer
  25583. * @category iServer Map Layer
  25584. * @classdesc UGC 图层类。
  25585. * @param {Object} options - 参数。
  25586. * @param {SuperMap.Bounds} options.bounds - 图层范围。
  25587. * @param {string} options.name - 图层的名称。
  25588. * @param {SuperMap.UGCLayerType} options.type - 图层类型
  25589. * @param {string} [options.caption] - 图层的标题。
  25590. * @param {string} [options.description] - 图层的描述信息。
  25591. * @param {boolean} [options.queryable] - 图层中的对象是否可以查询。
  25592. * @param {boolean} [options.subUGCLayers] - 是否允许图层的符号大小随图缩放。
  25593. * @param {boolean} [options.visible=false] - 地图对象在同一范围内时,是否重叠显示。
  25594. */
  25595. class UGCLayer {
  25596. constructor(options) {
  25597. options = options || {};
  25598. /**
  25599. * @member {SuperMap.Bounds} SuperMap.UGCLayer.prototype.bounds
  25600. * @description 图层范围。
  25601. */
  25602. this.bounds = null;
  25603. /**
  25604. * @member {string} [SuperMap.UGCLayer.prototype.caption]
  25605. * @description 图层的标题。默认情况下图层的标题与图层的名称一致。在图例、图层控制列表中显示的图层名称就是该图层的标题值。
  25606. */
  25607. this.caption = null;
  25608. /**
  25609. * @member {string} SuperMap.UGCLayer.prototype.description
  25610. * @description 图层的描述信息。
  25611. */
  25612. this.description = null;
  25613. /**
  25614. * @member {string} SuperMap.UGCLayer.prototype.name
  25615. * @description 图层的名称。图层的名称在图层所在的地图中唯一标识此图层。该属性区分大小写。
  25616. */
  25617. this.name = null;
  25618. /**
  25619. * @member {boolean} SuperMap.UGCLayer.prototype.queryable
  25620. * @description 图层中的对象是否可以查询。
  25621. */
  25622. this.queryable = null;
  25623. /**
  25624. * @member {Array} SuperMap.UGCLayer.prototype.subLayers
  25625. * @description 子图层集。
  25626. */
  25627. this.subLayers = null;
  25628. /**
  25629. * @member {SuperMap.UGCLayerType} SuperMap.UGCLayer.prototype.type
  25630. * @description 图层类型。
  25631. */
  25632. this.type = null;
  25633. /**
  25634. * @member {boolean} SuperMap.UGCLayer.prototype.visible
  25635. * @description 地图对象在同一范围内时,是否重叠显示。
  25636. */
  25637. this.visible = null;
  25638. Util.extend(this, options);
  25639. this.CLASS_NAME = "SuperMap.UGCLayer";
  25640. }
  25641. /**
  25642. * @function SuperMap.UGCLayer.prototype.destroy
  25643. * @description 释放资源,将引用资源的属性置空。
  25644. */
  25645. destroy() {
  25646. var me = this;
  25647. Util.reset(me);
  25648. }
  25649. /**
  25650. * @function SuperMap.UGCLayer.prototype.fromJson
  25651. * @description 将服务端 JSON 对象转换成当前客户端对象。
  25652. * @param {Object} jsonObject - 要转换的 JSON 对象。
  25653. */
  25654. fromJson(jsonObject) {
  25655. jsonObject = jsonObject ? jsonObject : {};
  25656. Util.extend(this, jsonObject);
  25657. var b = this.bounds;
  25658. if (b) {
  25659. this.bounds = new Bounds(b.leftBottom.x, b.leftBottom.y, b.rightTop.x, b.rightTop.y);
  25660. }
  25661. }
  25662. /**
  25663. * @function SuperMap.UGCLayer.prototype.toServerJSONObject
  25664. * @description 转换成对应的 JSON 格式对象。
  25665. * @returns {Object} 对应的 JSON 格式对象。
  25666. */
  25667. toServerJSONObject() {
  25668. var jsonObject = {};
  25669. jsonObject = Util.copyAttributes(jsonObject, this);
  25670. if (jsonObject.bounds) {
  25671. if (jsonObject.bounds.toServerJSONObject) {
  25672. jsonObject.bounds = jsonObject.bounds.toServerJSONObject();
  25673. }
  25674. }
  25675. return jsonObject;
  25676. }
  25677. }
  25678. SuperMap.UGCLayer = UGCLayer;
  25679. ;// CONCATENATED MODULE: ./src/common/iServer/OverlapDisplayedOptions.js
  25680. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  25681. * This program are made available under the terms of the Apache License, Version 2.0
  25682. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25683. /**
  25684. * @class SuperMap.OverlapDisplayedOptions
  25685. * @category iServer Map Layer
  25686. * @classdesc 地图压盖过滤显示选项。
  25687. * @description 在文本或专题图元素显示较密集的区域,文本之间或专题元素之间会发生相互压盖的现象,
  25688. * 该类可以分别控制各种类型的对象的压盖显示情况,进而很好地处理地图中各种类型对象的压盖显示问题。
  25689. * @param {Object} options - 参数。
  25690. * @param {boolean} [options.allowPointOverlap=true] - 点和点压盖时是否显示压盖的点对象。
  25691. * @param {boolean} [options.allowPointWithTextDisplay=true] - 标签和相应普通图层上的点是否一起过滤显示,如果过滤显示,
  25692. * 只以图层集合中对应数据集的索引最小的图层的点风格来绘制点。
  25693. * @param {boolean} [options.allowTextOverlap=false] - 文本压盖时是否显示压盖的文本对象。
  25694. * @param {boolean} [options.allowTextAndPointOverlap=true] - 文本和点压盖时是否显示压盖的文本或点对象(此属性不处理文本之间的压盖和点之间的压盖)。
  25695. * @param {boolean} [options.allowThemeGraduatedSymbolOverlap=false] - 等级符号元素压盖时是否显示压盖的等级符号元素。
  25696. * @param {boolean} [options.allowThemeGraphOverlap=false] - 统计专题图元素压盖时是否显示压盖的统计专题图元素。
  25697. * @param {number} [options.horizontalOverlappedSpaceSize=0] - 两个对象之间的横向压盖间距,单位为 0.1 毫米,跟 verticalOverlappedSpaceSize 结合使用,
  25698. * 当两个对象的横向间距小于该值,且纵向间距小于 verticalOverlappedSpaceSize 时认为压盖。
  25699. * @param {number} [options.verticalOverlappedSpaceSize=0] - 两个对象之间的纵向压盖间距,单位为 0.1 毫米,跟 horizontalOverlappedSpaceSize 结合使用,
  25700. * 当两个对象的纵向间距小于该值,且横向间距小于 horizontalOverlappedSpaceSize 时认为压盖。
  25701. */
  25702. class OverlapDisplayedOptions {
  25703. constructor(options) {
  25704. options = options || {};
  25705. /**
  25706. * @member {boolean} [SuperMap.OverlapDisplayedOptions.prototype.allowPointOverlap=true]
  25707. * @description 点和点压盖时是否显示压盖的点对象。
  25708. */
  25709. this.allowPointOverlap = true;
  25710. /**
  25711. * @member {boolean} [SuperMap.OverlapDisplayedOptions.prototype.allowPointWithTextDisplay=true]
  25712. * @description 标签和相应普通图层上的点是否一起过滤显示,如果过滤显示,
  25713. * 只以图层集合中对应数据集的索引最小的图层的点风格来绘制点。
  25714. */
  25715. this.allowPointWithTextDisplay = true;
  25716. /**
  25717. * @member {boolean} [SuperMap.OverlapDisplayedOptions.prototype.allowTextOverlap=false]
  25718. * @description 文本压盖时是否显示压盖的文本对象。
  25719. */
  25720. this.allowTextOverlap = false;
  25721. /**
  25722. * @member {boolean} [SuperMap.OverlapDisplayedOptions.prototype.allowTextAndPointOverlap=true]
  25723. * @description 文本和点压盖时是否显示压盖的文本或点对象(此属性不处理文本之间的压盖和点之间的压盖)。
  25724. */
  25725. this.allowTextAndPointOverlap = true;
  25726. /**
  25727. * @member {boolean} [SuperMap.OverlapDisplayedOptions.prototype.allowThemeGraduatedSymbolOverlap=false]
  25728. * @description 等级符号元素压盖时是否显示压盖的等级符号元素。
  25729. */
  25730. this.allowThemeGraduatedSymbolOverlap = false;
  25731. /**
  25732. * @member {boolean} [SuperMap.OverlapDisplayedOptions.prototype.allowThemeGraphOverlap=false]
  25733. * @description 统计专题图元素压盖时是否显示压盖的统计专题图元素。
  25734. */
  25735. this.allowThemeGraphOverlap = false;
  25736. /**
  25737. * @member {number} [SuperMap.OverlapDisplayedOptions.prototype.horizontalOverlappedSpaceSize=0]
  25738. * @description 两个对象之间的横向压盖间距,单位为0.1毫米,跟 verticalOverlappedSpaceSize 结合使用,
  25739. * 当两个对象的横向间距小于该值,且纵向间距小于 verticalOverlappedSpaceSize 时认为压盖。
  25740. */
  25741. this.horizontalOverlappedSpaceSize = 0;
  25742. /**
  25743. * @member {number} [SuperMap.OverlapDisplayedOptions.prototype.verticalOverlappedSpaceSize=0]
  25744. * @description 两个对象之间的纵向压盖间距,单位为0.1毫米,跟 horizontalOverlappedSpaceSize 结合使用,
  25745. * 当两个对象的纵向间距小于该值,且横向间距小于 horizontalOverlappedSpaceSize 时认为压盖。
  25746. */
  25747. this.verticalOverlappedSpaceSize = 0;
  25748. Util.extend(this, options);
  25749. this.ugcLayer = new UGCLayer(options);
  25750. this.CLASS_NAME = "SuperMap.OverlapDisplayedOptions";
  25751. }
  25752. /**
  25753. * @function SuperMap.OverlapDisplayedOptions.prototype.destroy
  25754. * @description 释放资源,将资源的属性置空。
  25755. */
  25756. destroy() {
  25757. Util.reset(this);
  25758. }
  25759. /**
  25760. * @function SuperMap.OverlapDisplayedOptions.prototype.fromJson
  25761. * @description 将服务端 JSON 对象转换成当前客户端对象。
  25762. * @param {Object} jsonObject - 要转换的 JSON 对象。
  25763. */
  25764. fromJson(jsonObject) {
  25765. this.ugcLayer.fromJson.apply(this, [jsonObject]);
  25766. }
  25767. /**
  25768. * @function SuperMap.OverlapDisplayedOptions.prototype.toServerJSONObject
  25769. * @description 转换成对应的 JSON 格式对象。
  25770. * @returns {Object} 对应的 JSON 格式对象。
  25771. */
  25772. toServerJSONObject() {
  25773. var jsonObject = this.ugcLayer.toServerJSONObject.apply(this, arguments);
  25774. return jsonObject;
  25775. }
  25776. /**
  25777. * @function SuperMap.OverlapDisplayedOptions.prototype.toString
  25778. * @description 转换成对应的 tileLayer 请求瓦片时 overlapDisplayedOptions 参数。
  25779. * @returns {string} 对应的 tileLayer 请求瓦片时 overlapDisplayedOptions 参数。
  25780. */
  25781. toString() {
  25782. var jsonObject = this.ugcLayer.toServerJSONObject.apply(this, arguments);
  25783. var str = "{";
  25784. for (var attr in jsonObject) {
  25785. if (jsonObject.hasOwnProperty(attr)) {
  25786. str += "'" + attr + "':" + jsonObject[attr] + ",";
  25787. }
  25788. }
  25789. str = str.substr(0, str.length - 1);
  25790. str += "}";
  25791. return str;
  25792. }
  25793. }
  25794. SuperMap.OverlapDisplayedOptions = OverlapDisplayedOptions;
  25795. ;// CONCATENATED MODULE: ./src/common/iServer/UGCMapLayer.js
  25796. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  25797. * This program are made available under the terms of the Apache License, Version 2.0
  25798. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25799. /**
  25800. * @class SuperMap.UGCMapLayer
  25801. * @category iServer Map Layer
  25802. * @classdesc UGC 地图图层类。
  25803. * @extends {SuperMap.UGCLayer}
  25804. * @param {Object} options - 参数。
  25805. * @param {boolean} [options.completeLineSymbolDisplayed] - 是否显示完整线型。
  25806. * @param {number} [options.maxScale] - 地图最大比例尺。
  25807. * @param {number} [options.minScale] - 地图最小比例尺。
  25808. * @param {number} [options.minVisibleGeometrySize] - 几何对象的最小可见大小,以像素为单位。
  25809. * @param {number} [options.opaqueRate] - 图层的不透明度。
  25810. * @param {boolean} [options.symbolScalable] - 是否允许图层的符号大小随图缩放。
  25811. * @param {number} [options.symbolScale] - 图层的符号缩放基准比例尺。
  25812. * @param {boolean} [options.overlapDisplayed=false] - 地图对象在同一范围内时,是否重叠显示。
  25813. * @param {SuperMap.OverlapDisplayedOptions} [options.overlapDisplayedOptions] - 地图的压盖过滤显示选项,当overlapDisplayed 为 false 时有效。
  25814. */
  25815. class UGCMapLayer extends UGCLayer {
  25816. constructor(options) {
  25817. options = options || {};
  25818. super(options);
  25819. /**
  25820. * @member {boolean} SuperMap.UGCMapLayer.prototype.completeLineSymbolDisplayed
  25821. * @description 是否显示完整线型。
  25822. */
  25823. this.completeLineSymbolDisplayed = null;
  25824. /**
  25825. * @member {number} SuperMap.UGCMapLayer.prototype.maxScale
  25826. * @description 地图最大比例尺。
  25827. */
  25828. this.maxScale = null;
  25829. /**
  25830. * @member {number} SuperMap.UGCMapLayer.prototype.minScale
  25831. * @description 地图最小比例尺。
  25832. */
  25833. this.minScale = null;
  25834. /**
  25835. * @member {number} SuperMap.UGCMapLayer.prototype.minVisibleGeometrySize
  25836. * @description 几何对象的最小可见大小,以像素为单位。
  25837. */
  25838. this.minVisibleGeometrySize = null;
  25839. /**
  25840. * @member {number} SuperMap.UGCMapLayer.prototype.opaqueRate
  25841. * @description 图层的不透明度。
  25842. */
  25843. this.opaqueRate = null;
  25844. /**
  25845. * @member {boolean} SuperMap.UGCMapLayer.prototype.symbolScalable
  25846. * @description 是否允许图层的符号大小随图缩放。
  25847. */
  25848. this.symbolScalable = null;
  25849. /**
  25850. * @member {number} SuperMap.UGCMapLayer.prototype.symbolScale
  25851. * @description 图层的符号缩放基准比例尺。
  25852. */
  25853. this.symbolScale = null;
  25854. /**
  25855. * @member {boolean} [SuperMap.UGCMapLayer.prototype.overlapDisplayed=false]
  25856. * @description 地图对象在同一范围内时,是否重叠显示。
  25857. */
  25858. this.overlapDisplayed = null;
  25859. /**
  25860. * @member {SuperMap.OverlapDisplayedOptions} SuperMap.UGCMapLayer.prototype.overlapDisplayedOptions
  25861. * @description 地图的压盖过滤显示选项,当 overlapDisplayed 为 false 时有效。
  25862. */
  25863. this.overlapDisplayedOptions = null;
  25864. this.CLASS_NAME = "SuperMap.UGCMapLayer";
  25865. }
  25866. /**
  25867. * @function SuperMap.UGCMapLayer.prototype.destroy
  25868. * @override
  25869. */
  25870. destroy() {
  25871. super.destroy();
  25872. Util.reset(this);
  25873. }
  25874. /**
  25875. * @function SuperMap.UGCMapLayer.prototype.fromJson
  25876. * @description 将服务端 JSON 对象转换成当前客户端对象
  25877. * @param {Object} jsonObject - 要转换的 JSON 对象。
  25878. */
  25879. fromJson(jsonObject) {
  25880. super.fromJson(jsonObject);
  25881. }
  25882. /**
  25883. * @function SuperMap.UGCMapLayer.prototype.toServerJSONObject
  25884. * @description 转换成对应的 JSON 格式对象。
  25885. * @returns {Object} 对应的 JSON 格式对象。
  25886. */
  25887. toServerJSONObject() {
  25888. return super.toServerJSONObject();
  25889. }
  25890. }
  25891. SuperMap.UGCMapLayer = UGCMapLayer;
  25892. ;// CONCATENATED MODULE: ./src/common/iServer/UGCSubLayer.js
  25893. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  25894. * This program are made available under the terms of the Apache License, Version 2.0
  25895. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25896. /**
  25897. * @class SuperMap.UGCSubLayer
  25898. * @category iServer Map Layer
  25899. * @classdesc 地图服务图层属性信息类。影像图层(Image)、专题图层(ServerTheme)、栅格图层(Grid)、矢量图层(Vector)等图层均继承该类。
  25900. * @extends {SuperMap.UGCMapLayer}
  25901. * @param {Object} options - 参数。
  25902. * @param {SuperMap.DatasetInfo} options.datasetInfo - 数据集信息。
  25903. * @param {string} [options.displayFilter] - 图层显示过滤条件。
  25904. * @param {SuperMap.JoinItem} [options.joinItems] - 连接信息类。
  25905. * @param {string} [options.representationField] - 存储制图表达信息的字段。
  25906. * @param {SuperMap.LayerType} [options.ugcLayerType] - 图层类型。
  25907. */
  25908. class UGCSubLayer extends UGCMapLayer {
  25909. constructor(options) {
  25910. options = options || {};
  25911. super(options);
  25912. /**
  25913. * @member {SuperMap.DatasetInfo} SuperMap.UGCSubLayer.prototype.datasetInfo
  25914. * @description 数据集信息。
  25915. */
  25916. this.datasetInfo = null;
  25917. /**
  25918. * @member {string} SuperMap.UGCSubLayer.prototype.displayFilter
  25919. * @description 图层显示过滤条件。
  25920. */
  25921. this.displayFilter = null;
  25922. /**
  25923. * @member {SuperMap.JoinItem} SuperMap.UGCSubLayer.prototype.joinItems
  25924. * @description 连接信息类。
  25925. */
  25926. this.joinItems = null;
  25927. /**
  25928. * @member {string} SuperMap.UGCSubLayer.prototype.representationField
  25929. * @description 存储制图表达信息的字段。
  25930. */
  25931. this.representationField = null;
  25932. /**
  25933. * @member {SuperMap.LayerType} SuperMap.UGCSubLayer.prototype.ugcLayerType
  25934. * @description 图层类型。
  25935. */
  25936. this.ugcLayerType = null;
  25937. this.CLASS_NAME = "SuperMap.UGCSubLayer";
  25938. }
  25939. /**
  25940. * @function SuperMap.UGCSubLayer.prototype.fromJson
  25941. * @description 将服务端 JSON 对象转换成当前客户端对象
  25942. * @param {Object} jsonObject - 要转换的 JSON 对象。
  25943. */
  25944. fromJson(jsonObject) {
  25945. super.fromJson(jsonObject);
  25946. if (this.datasetInfo) {
  25947. this.datasetInfo = new DatasetInfo(this.datasetInfo);
  25948. }
  25949. if (this.joinItems && this.joinItems.length) {
  25950. var newJoinItems = [];
  25951. for (var i = 0; i < this.joinItems.length; i++) {
  25952. newJoinItems[i] = new JoinItem(this.joinItems[i]);
  25953. }
  25954. this.joinItems = newJoinItems;
  25955. }
  25956. }
  25957. /**
  25958. * @function SuperMap.UGCSubLayer.prototype.destroy
  25959. * @override
  25960. */
  25961. destroy() {
  25962. super.destroy();
  25963. Util.reset(this);
  25964. }
  25965. /**
  25966. * @function SuperMap.UGCSubLayer.prototype.toServerJSONObject
  25967. * @description 转换成对应的 JSON 格式对象。
  25968. * @returns {Object} 对应的 JSON 格式对象。
  25969. */
  25970. toServerJSONObject() {
  25971. var jsonObject = super.toServerJSONObject();
  25972. if (jsonObject.joinItems) {
  25973. var joinItems = [];
  25974. for (var i = 0; i < jsonObject.joinItems.length; i++) {
  25975. if (jsonObject.joinItems[i].toServerJSONObject) {
  25976. joinItems[i] = jsonObject.joinItems[i].toServerJSONObject();
  25977. }
  25978. }
  25979. jsonObject.joinItems = joinItems;
  25980. }
  25981. if (jsonObject.datasetInfo) {
  25982. if (jsonObject.datasetInfo.toServerJSONObject) {
  25983. jsonObject.datasetInfo = jsonObject.datasetInfo.toServerJSONObject();
  25984. }
  25985. }
  25986. return jsonObject;
  25987. }
  25988. }
  25989. SuperMap.UGCSubLayer = UGCSubLayer;
  25990. ;// CONCATENATED MODULE: ./src/common/iServer/ServerTheme.js
  25991. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  25992. * This program are made available under the terms of the Apache License, Version 2.0
  25993. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25994. /**
  25995. * @class SuperMap.ServerTheme
  25996. * @category iServer Map Theme
  25997. * @classdesc UGC 专题图图层类。
  25998. * @extends {SuperMap.UGCSubLayer}
  25999. * @param {SuperMap.Theme} theme - 专题图对象。
  26000. * @param {SuperMap.LonLat} themeElementPosition - 专题图元素位置。
  26001. */
  26002. class ServerTheme extends UGCSubLayer {
  26003. constructor(options) {
  26004. options = options || {};
  26005. super(options);
  26006. /**
  26007. * @member {SuperMap.Theme} SuperMap.ServerTheme.prototype.theme
  26008. * @description 专题图对象。
  26009. */
  26010. this.theme = null;
  26011. /**
  26012. * @member {SuperMap.LonLat} SuperMap.ServerTheme.prototype.themeElementPosition
  26013. * @description 专题图元素位置。
  26014. */
  26015. this.themeElementPosition = null;
  26016. this.CLASS_NAME = "SuperMap.ServerTheme";
  26017. }
  26018. /**
  26019. * @function SuperMap.ServerTheme.prototype.destroy
  26020. * @override
  26021. */
  26022. destroy() {
  26023. super.destroy();
  26024. Util.reset(this);
  26025. }
  26026. /**
  26027. * @function SuperMap.ServerTheme.prototype.fromJson
  26028. * @description 将服务端 JSON 对象转换成当前客户端对象
  26029. * @param {Object} jsonObject - 要转换的 JSON 对象。
  26030. */
  26031. fromJson(jsonObject) {
  26032. super.fromJson(jsonObject);
  26033. var themeObj = this.theme;
  26034. var themeT = themeObj && themeObj.type;
  26035. switch (themeT) {
  26036. case 'LABEL':
  26037. this.theme = ThemeLabel.fromObj(themeObj);
  26038. break;
  26039. case 'UNIQUE':
  26040. this.theme = ThemeUnique.fromObj(themeObj);
  26041. break;
  26042. case 'GRAPH':
  26043. this.theme = ThemeGraph.fromObj(themeObj);
  26044. break;
  26045. case 'DOTDENSITY':
  26046. this.theme = ThemeDotDensity.fromObj(themeObj);
  26047. break;
  26048. case 'GRADUATEDSYMBOL':
  26049. this.theme = ThemeGraduatedSymbol.fromObj(themeObj);
  26050. break;
  26051. case 'RANGE':
  26052. this.theme = ThemeRange.fromObj(themeObj);
  26053. break;
  26054. default:
  26055. break;
  26056. }
  26057. if (this.themeElementPosition) {
  26058. //待测试
  26059. this.themeElementPosition = new LonLat(this.themeElementPosition.x, this.themeElementPosition.y);
  26060. }
  26061. }
  26062. /**
  26063. * @function SuperMap.ServerTheme.prototype.toServerJSONObject
  26064. * @description 转换成对应的 JSON 格式对象。
  26065. */
  26066. toServerJSONObject() {
  26067. //普通属性直接赋值
  26068. var jsonObject = super.toServerJSONObject();
  26069. if (jsonObject.themeElementPosition) {
  26070. if (jsonObject.themeElementPosition.toServerJSONObject) {
  26071. jsonObject.themeElementPosition = jsonObject.themeElementPosition.toServerJSONObject();
  26072. }
  26073. }
  26074. if (jsonObject.theme) {
  26075. if (jsonObject.theme.toServerJSONObject) {
  26076. jsonObject.theme = jsonObject.theme.toServerJSONObject();
  26077. }
  26078. }
  26079. return jsonObject;
  26080. }
  26081. }
  26082. SuperMap.ServerTheme = ServerTheme;
  26083. ;// CONCATENATED MODULE: ./src/common/iServer/Grid.js
  26084. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  26085. * This program are made available under the terms of the Apache License, Version 2.0
  26086. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26087. /**
  26088. * @class SuperMap.Grid
  26089. * @category iServer Map Layer
  26090. * @classdesc UGC 栅格图层类。
  26091. * @extends {SuperMap.UGCSubLayer}
  26092. * @param {Object} options - 参数。
  26093. * @param {Array.<Object>} [options.colorDictionary] - 颜色对照表对象。
  26094. * @param {number} [options.brightness] - Grid 图层的亮度。
  26095. * @param {SuperMap.ColorGradientType} [options.colorGradientType] - 颜色渐变枚举。
  26096. * @param {SuperMap.ServerColor} [options.colors] - 颜色表对象。
  26097. * @param {number} [options.contrast] - Grid 图层的对比度。
  26098. * @param {SuperMap.GridType} [options.gridType] - 格网类型。
  26099. * @param {number} [options.horizontalSpacing] - 格网水平间隔大小。
  26100. * @param {boolean} [options.sizeFixed] - 格网是否固定大小,如果不固定大小,则格网随着地图缩放。
  26101. * @param {SuperMap.ServerStyle} [options.solidStyle] - 格网实线的样式。
  26102. * @param {SuperMap.ServerColor} [options.specialColor] - 栅格数据集无值数据的颜色。
  26103. * @param {number} [options.specialValue] - 图层的特殊值。
  26104. * @param {boolean} [options.specialValueTransparent] - 图层的特殊值(specialValue)所处区域是否透明。
  26105. * @param {number} [options.verticalSpacing] - 格网垂直间隔大小。
  26106. */
  26107. class Grid extends UGCSubLayer {
  26108. constructor(options) {
  26109. options = options || {};
  26110. super(options);
  26111. /**
  26112. * @member {Array.<SuperMap.ColorDictionary>} SuperMap.Grid.prototype.colorDictionarys
  26113. * @description 颜色对照表对象。
  26114. */
  26115. this.colorDictionarys = null;
  26116. /**
  26117. * @member {number} SuperMap.Grid.prototype.brightness
  26118. * @description Grid 图层的亮度。
  26119. */
  26120. this.brightness = null;
  26121. /**
  26122. * @member {SuperMap.ColorGradientType} SuperMap.Grid.prototype.colorGradientType
  26123. * @description 渐变颜色枚举值。
  26124. */
  26125. this.colorGradientType = null;
  26126. /**
  26127. * @member {SuperMap.ServerColor} SuperMap.Grid.prototype.colors
  26128. * @description 颜色表对象。
  26129. */
  26130. this.colors = null;
  26131. /**
  26132. * @member {number} SuperMap.Grid.prototype.contrast
  26133. * @description Grid 图层的对比度。
  26134. */
  26135. this.contrast = null;
  26136. /**
  26137. * @member {SuperMap.ServerStyle} SuperMap.Grid.prototype.dashStyle
  26138. * @description 栅格数据集特殊值数据的颜色。
  26139. */
  26140. this.dashStyle = null;
  26141. /**
  26142. * @member {SuperMap.GridType} SuperMap.Grid.prototype.gridType
  26143. * @description 格网类型。
  26144. */
  26145. this.gridType = null;
  26146. /**
  26147. * @member {number} SuperMap.Grid.prototype.horizontalSpacing
  26148. * @description 格网水平间隔大小。
  26149. */
  26150. this.horizontalSpacing = null;
  26151. /**
  26152. * @member {boolean} SuperMap.Grid.prototype.sizeFixed
  26153. * @description 格网是否固定大小,如果不固定大小,则格网随着地图缩放。
  26154. */
  26155. this.sizeFixed = null;
  26156. /**
  26157. * @member {SuperMap.ServerStyle} SuperMap.Grid.prototype.solidStyle
  26158. * @description 格网实线的样式。
  26159. */
  26160. this.solidStyle = null;
  26161. /**
  26162. * @member {SuperMap.ServerColor} SuperMap.Grid.prototype.specialColor
  26163. * @description 栅格数据集无值数据的颜色。
  26164. */
  26165. this.specialColor = null;
  26166. /**
  26167. * @member {number} SuperMap.Grid.prototype.specialValue
  26168. * @description 图层的特殊值。
  26169. */
  26170. this.specialValue = null;
  26171. /**
  26172. * @member {boolean} SuperMap.Grid.prototype.specialValueTransparent
  26173. * @description 图层的特殊值(specialValue)所处区域是否透明。
  26174. */
  26175. this.specialValueTransparent = null;
  26176. /**
  26177. * @member {number} SuperMap.Grid.prototype.verticalSpacing
  26178. * @description 格网垂直间隔大小。
  26179. */
  26180. this.verticalSpacing = null;
  26181. this.CLASS_NAME = "SuperMap.Grid";
  26182. }
  26183. /**
  26184. * @function SuperMap.Grid.prototype.destroy
  26185. * @description 释放资源,将引用资源的属性置空。
  26186. */
  26187. destroy() {
  26188. super.destroy();
  26189. Util.reset(this);
  26190. }
  26191. /**
  26192. * @function SuperMap.Grid.prototype.fromJson
  26193. * @description 将服务端 JSON 对象转换成当前客户端对象。
  26194. * @param {Object} jsonObject - 要转换的 JSON 对象。
  26195. */
  26196. fromJson(jsonObject) {
  26197. super.fromJson(jsonObject);
  26198. if (this.specialColor) {
  26199. this.specialColor = new ServerColor(this.specialColor.red,
  26200. this.specialColor.green,
  26201. this.specialColor.blue);
  26202. }
  26203. if (this.colors) {
  26204. var colors = [],
  26205. color;
  26206. for (var i in this.colors) {
  26207. color = this.colors[i];
  26208. colors.push(new ServerColor(color.red, color.green, color.blue));
  26209. }
  26210. this.colors = colors;
  26211. }
  26212. if (this.dashStyle) {
  26213. this.dashStyle = new ServerStyle(this.dashStyle);
  26214. }
  26215. if (this.solidStyle) {
  26216. this.solidStyle = new ServerStyle(this.solidStyle);
  26217. }
  26218. if (this.colorDictionary) {
  26219. var colorDics = [],
  26220. colorDic;
  26221. for (var key in this.colorDictionary) {
  26222. colorDic = this.colorDictionary[key];
  26223. colorDics.push(new ColorDictionary({elevation: key, color: colorDic}));
  26224. }
  26225. this.colorDictionarys = colorDics;
  26226. }
  26227. delete this.colorDictionary;
  26228. }
  26229. /**
  26230. * @function SuperMap.Grid.prototype.toServerJSONObject
  26231. * @description 转换成对应的 JSON 对象。
  26232. * @returns JSON 对象。
  26233. */
  26234. toServerJSONObject() {
  26235. var jsonObject = super.toServerJSONObject();
  26236. if (jsonObject.dashStyle) {
  26237. if (jsonObject.dashStyle.toServerJSONObject) {
  26238. jsonObject.dashStyle = jsonObject.dashStyle.toServerJSONObject();
  26239. }
  26240. }
  26241. if (jsonObject.solidStyle) {
  26242. if (jsonObject.solidStyle.toServerJSONObject) {
  26243. jsonObject.solidStyle = jsonObject.solidStyle.toServerJSONObject();
  26244. }
  26245. }
  26246. return jsonObject;
  26247. }
  26248. }
  26249. SuperMap.Grid = Grid;
  26250. ;// CONCATENATED MODULE: ./src/common/iServer/Image.js
  26251. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  26252. * This program are made available under the terms of the Apache License, Version 2.0
  26253. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26254. /**
  26255. * @class SuperMap.Image
  26256. * @category iServer Map Layer
  26257. * @classdesc UGC 影像图层类
  26258. * @extends {SuperMap.UGCSubLayer}
  26259. * @param {Object} options - 参数。
  26260. * @param {SuperMap.ColorSpaceType} [options.colorSpaceType] - 返回影像图层的色彩显示模式。
  26261. * @param {number} [options.brightness] - 影像图层的亮度。
  26262. * @param {Array.<number>} [options.displayBandIndexes] - 返回当前影像图层显示的波段索引。
  26263. * @param {number} [options.contrast] - 影像图层的对比度。
  26264. * @param {boolean} [options.transparent] - 是否背景透明。
  26265. * @param {SuperMap.ServerColor} [options.transparentColor] - 返回背景透明色。
  26266. * @param {number} [options.transparentColorTolerance] - 背景透明色容限。
  26267. */
  26268. class UGCImage extends UGCSubLayer {
  26269. constructor(options) {
  26270. options = options || {};
  26271. super(options);
  26272. /**
  26273. * @member {number} SuperMap.Image.prototype.brightness
  26274. * @description 影像图层的亮度。
  26275. */
  26276. this.brightness = null;
  26277. /**
  26278. * @member {SuperMap.ColorSpaceType} SuperMap.Image.prototype.colorSpaceType
  26279. * @description 返回影像图层的色彩显示模式。
  26280. */
  26281. this.colorSpaceType = null;
  26282. /**
  26283. * @member {number} SuperMap.Image.prototype.contrast
  26284. * @description 影像图层的对比度。
  26285. */
  26286. this.contrast = null;
  26287. /**
  26288. * @member {Array.<number>} SuperMap.Image.prototype.displayBandIndexes
  26289. * @description 返回当前影像图层显示的波段索引。
  26290. */
  26291. this.displayBandIndexes = null;
  26292. /**
  26293. * @member {boolean} SuperMap.Image.prototype.transparent
  26294. * @description 是否背景透明。
  26295. */
  26296. this.transparent = null;
  26297. /**
  26298. * @member {SuperMap.ServerColor} SuperMap.Image.prototype.transparentColor
  26299. * @description 返回背景透明色。
  26300. */
  26301. this.transparentColor = null;
  26302. /**
  26303. * @member {number} SuperMap.Image.prototype.transparentColorTolerance
  26304. * @description 背景透明色容限。
  26305. */
  26306. this.transparentColorTolerance = null;
  26307. this.CLASS_NAME = "SuperMap.Image";
  26308. }
  26309. /**
  26310. * @function SuperMap.Image.prototype.destroy
  26311. * @override
  26312. */
  26313. destroy() {
  26314. super.destroy();
  26315. Util.reset(this);
  26316. }
  26317. /**
  26318. * @function SuperMap.Image.prototype.fromJson
  26319. * @description 将服务端 JSON 对象转换成当前客户端对象。
  26320. * @param {Object} jsonObject - 要转换的 JSON 对象。
  26321. */
  26322. fromJson(jsonObject) {
  26323. super.fromJson(jsonObject);
  26324. if (this.transparentColor) {
  26325. this.transparentColor = new ServerColor(this.transparentColor.red,
  26326. this.transparentColor.green,
  26327. this.transparentColor.blue);
  26328. }
  26329. }
  26330. /**
  26331. * @function SuperMap.Image.prototype.toServerJSONObject
  26332. * @description 转换成对应的 JSON 格式对象。
  26333. */
  26334. toServerJSONObject() {
  26335. return super.toServerJSONObject();
  26336. }
  26337. }
  26338. SuperMap.Image = UGCImage;
  26339. ;// CONCATENATED MODULE: ./src/common/iServer/Vector.js
  26340. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  26341. * This program are made available under the terms of the Apache License, Version 2.0
  26342. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26343. /**
  26344. * @class SuperMap.Vector
  26345. * @category iServer Map TileFeature
  26346. * @classdesc UGC 矢量图层类。
  26347. * @extends {SuperMap.UGCSubLayer}
  26348. * @param {Object} options - 参数。
  26349. * @param {SuperMap.ServerStyle} [options.style] - 矢量图层的风格。
  26350. */
  26351. class Vector_Vector extends UGCSubLayer {
  26352. constructor(options) {
  26353. options = options || {};
  26354. super(options);
  26355. /**
  26356. * @member {SuperMap.ServerStyle} SuperMap.Vector.prototype.style
  26357. * @description 矢量图层的风格。
  26358. */
  26359. this.style = null;
  26360. this.CLASS_NAME = "SuperMap.Vector";
  26361. }
  26362. /**
  26363. * @function SuperMap.Vector.prototype.destroy
  26364. * @override
  26365. */
  26366. destroy() {
  26367. super.destroy();
  26368. Util.reset(this);
  26369. }
  26370. /**
  26371. * @function SuperMap.Vector.prototype.fromJson
  26372. * @description 将服务端 JSON 对象转换成当前客户端对象。
  26373. * @param {Object} jsonObject - 要转换的 JSON 对象。
  26374. */
  26375. fromJson(jsonObject) {
  26376. super.fromJson(jsonObject);
  26377. var sty = this.style;
  26378. if (sty) {
  26379. this.style = new ServerStyle(sty);
  26380. }
  26381. }
  26382. /**
  26383. * @function SuperMap.Vector.prototype.toServerJSONObject
  26384. * @description 转换成对应的 JSON 格式对象。
  26385. * @returns {Object} 对应的 JSON 格式对象
  26386. */
  26387. toServerJSONObject() {
  26388. var jsonObject = SuperMap.toServerJSONObject();
  26389. if (jsonObject.style) {
  26390. if (jsonObject.style.toServerJSONObject) {
  26391. jsonObject.style = jsonObject.style.toServerJSONObject();
  26392. }
  26393. }
  26394. return jsonObject;
  26395. }
  26396. }
  26397. SuperMap.Vector = Vector_Vector;
  26398. ;// CONCATENATED MODULE: ./src/common/iServer/GetLayersInfoService.js
  26399. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  26400. * This program are made available under the terms of the Apache License, Version 2.0
  26401. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26402. /**
  26403. * @class SuperMap.GetLayersInfoService
  26404. * @category iServer Map Layer
  26405. * @classdesc 获取图层信息服务类构造函数。
  26406. * @extends {SuperMap.CommonServiceBase}
  26407. * @param {string} url - 与客户端交互的地图服务地址。请求地图服务,URL 应为:
  26408. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  26409. * 如 http://localhost:8090/iserver/services/map-world/rest/maps/World 。
  26410. * 如果查询临时图层的信息,请指定完成的url,包含临时图层ID信息,如:
  26411. * http://localhost:8090/iserver/services/map-world/rest/maps/World/tempLayersSet/resourceID
  26412. * @param {Object} options - 参数。
  26413. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  26414. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  26415. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  26416. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  26417. * @param {Object} [options.headers] - 请求头。
  26418. * @param {boolean} options.isTempLayers - 当前url对应的图层是否是临时图层。
  26419. */
  26420. class GetLayersInfoService extends CommonServiceBase {
  26421. constructor(url, options) {
  26422. super(url, options);
  26423. /**
  26424. * @member {boolean} SuperMap.GetLayersInfoService.prototype.isTempLayers
  26425. * @description 当前url对应的图层是否是临时图层。
  26426. */
  26427. this.isTempLayers = false;
  26428. if (options) {
  26429. Util.extend(this, options);
  26430. }
  26431. this.CLASS_NAME = "SuperMap.GetLayersInfoService";
  26432. }
  26433. /**
  26434. * @function SuperMap.GetLayersInfoService.prototype.destroy
  26435. * @override
  26436. */
  26437. destroy() {
  26438. super.destroy();
  26439. Util.reset(this);
  26440. }
  26441. /**
  26442. * @function SuperMap.GetLayersInfoService.prototype.processAsync
  26443. * @description 负责将客户端的更新参数传递到服务端。
  26444. */
  26445. processAsync() {
  26446. var me = this,
  26447. method = "GET";
  26448. if (!me.isTempLayers) {
  26449. me.url = Util.urlPathAppend(me.url, 'layers');
  26450. }
  26451. me.request({
  26452. method: method,
  26453. params: null,
  26454. scope: me,
  26455. success: me.serviceProcessCompleted,
  26456. failure: me.serviceProcessFailed
  26457. });
  26458. }
  26459. /**
  26460. * @function SuperMap.GetLayersInfoService.prototype.serviceProcessCompleted
  26461. * @description 编辑完成,执行此方法。
  26462. * @param {Object} result - 服务器返回的结果对象。
  26463. */
  26464. serviceProcessCompleted(result) {
  26465. var me = this, existRes, layers, len;
  26466. result = Util.transformResult(result);
  26467. existRes = !!result && result.length > 0;
  26468. layers = existRes ? result[0].subLayers.layers : null;
  26469. len = layers ? layers.length : 0;
  26470. me.handleLayers(len, layers);
  26471. me.events.triggerEvent("processCompleted", {result: result[0]});
  26472. }
  26473. /**
  26474. * TODO 专题图时候可能会用到
  26475. * @function SuperMap.GetLayersInfoService.prototype.handleLayers
  26476. * @description 处理 iServer 新增图层组数据 (subLayers.layers 中可能还会含有 subLayers.layers)
  26477. * @param {number} len - subLayers.layers的长度
  26478. * @param {Array.<number>} layers - subLayers.layers的长度数组
  26479. */
  26480. handleLayers(len, layers) {
  26481. var me = this, tempLayer;
  26482. if (len) {
  26483. for (var i = 0; i < len; i++) {
  26484. if (layers[i].subLayers && layers[i].subLayers.layers && layers[i].subLayers.layers.length > 0) {
  26485. me.handleLayers(layers[i].subLayers.layers.length, layers[i].subLayers.layers);
  26486. } else {
  26487. var type = layers[i].ugcLayerType;
  26488. switch (type) {
  26489. case 'THEME':
  26490. tempLayer = new ServerTheme();
  26491. tempLayer.fromJson(layers[i]);
  26492. layers[i] = tempLayer;
  26493. break;
  26494. case 'GRID':
  26495. tempLayer = new Grid();
  26496. tempLayer.fromJson(layers[i]);
  26497. layers[i] = tempLayer;
  26498. break;
  26499. case 'IMAGE':
  26500. tempLayer = new UGCImage();
  26501. tempLayer.fromJson(layers[i]);
  26502. layers[i] = tempLayer;
  26503. break;
  26504. case 'VECTOR':
  26505. tempLayer = new Vector_Vector();
  26506. tempLayer.fromJson(layers[i]);
  26507. layers[i] = tempLayer;
  26508. break;
  26509. default:
  26510. break;
  26511. }
  26512. }
  26513. }
  26514. }
  26515. }
  26516. }
  26517. SuperMap.GetLayersInfoService = GetLayersInfoService;
  26518. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationAnalystParameters.js
  26519. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  26520. * This program are made available under the terms of the Apache License, Version 2.0
  26521. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26522. /**
  26523. * @class SuperMap.InterpolationAnalystParameters
  26524. * @category iServer SpatialAnalyst InterpolationAnalyst
  26525. * @classdesc 插值分析参数类。
  26526. * @param {Object} options - 参数。
  26527. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  26528. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  26529. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  26530. * @param {string} [options.zValueFieldName] - 存储用于进行插值分析的字段名称,插值分析不支持文本类型的字段。
  26531. * @param {string} [options.dataset] - 用于做插值分析的数据源中数据集的名称。当插值分析类型(InterpolationAnalystType)为 dataset 时,此参数为必选。
  26532. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(InterpolationAnalystType)为 geometry 时,此参数为必设参数。
  26533. * @param {number} [options.searchRadius=0] - 查找半径,即参与运算点的查找范围,与点数据集单位相同。
  26534. * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
  26535. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  26536. * @param {SuperMap.FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  26537. * @param {SuperMap.PixelFormat} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  26538. * @param {string} [options.InterpolationAnalystType="dataset"] - 插值分析类型("dataset" 或 "geometry")。
  26539. */
  26540. class InterpolationAnalystParameters {
  26541. constructor(options) {
  26542. if (!options) {
  26543. return;
  26544. }
  26545. /**
  26546. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.InterpolationAnalystParameters.prototype.bounds
  26547. * @description 插值分析的范围,用于确定结果栅格数据集的范围。
  26548. * 如果缺省,则默认为原数据集的范围。鉴于此插值方法为内插方法,原数据集的范围内的插值结果才相对有参考价值,
  26549. * 因此建议此参数不大于原数据集范围。
  26550. */
  26551. this.bounds = null;
  26552. /**
  26553. * @member {number} [SuperMap.InterpolationAnalystParameters.prototype.searchRadius=0]
  26554. * @description 查找半径,即参与运算点的查找范围,与点数据集单位相同。
  26555. * 计算某个位置的Z 值时,会以该位置为圆心,以查找范围的值为半径,落在这个范围内的采样点都将参与运算。
  26556. * 该值需要根据待插值点数据的分布状况和点数据集范围进行设置。
  26557. */
  26558. this.searchRadius = 0;
  26559. /**
  26560. * @member {string} SuperMap.InterpolationAnalystParameters.prototype.zValueFieldName
  26561. * @description 数据集插值分析中,用于指定进行插值分析的目标字段名,插值分析不支持文本类型的字段。
  26562. * 含义为每个插值点在插值过程中的权重,可以将所有点此字段值设置为 1,即所有点在整体插值中权重相同。
  26563. * 当插值分析类型(InterpolationAnalystType)为 dataset 时,此为必选参数。
  26564. */
  26565. this.zValueFieldName = null;
  26566. /**
  26567. * @member {number} [SuperMap.InterpolationAnalystParameters.prototype.zValueScale=1]
  26568. * @description 用于进行插值分析值的缩放比率。
  26569. * 参加插值分析的值将乘以该参数值后再进行插值,也就是对进行插值分析的值进行统一的扩大或缩小。
  26570. */
  26571. this.zValueScale = 1;
  26572. /**
  26573. * @member {number} SuperMap.InterpolationAnalystParameters.prototype.resolution
  26574. * @description 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  26575. * 该值不能超过待分析数据集的范围边长。
  26576. * 且该值设置时,应该考虑点数据集范围大小来取值,一般为结果栅格行列值(即结果栅格数据集范围除以分辨率),在 500 以内可以较好地体现密度走势。
  26577. */
  26578. this.resolution = null;
  26579. /**
  26580. * @member {SuperMap.FilterParameter} [SuperMap.InterpolationAnalystParameters.prototype.filterQueryParameter]
  26581. * @description 过滤条件,对分析数据集中的点进行过滤,设置为 null 表示对数据集中的所有点进行分析。
  26582. */
  26583. this.filterQueryParameter = null;
  26584. /**
  26585. * @member {string} SuperMap.InterpolationAnalystParameters.prototype.outputDatasetName
  26586. * @description 插值分析结果数据集的名称。
  26587. */
  26588. this.outputDatasetName = null;
  26589. /**
  26590. * @member {string} SuperMap.InterpolationAnalystParameters.prototype.outputDatasourceName
  26591. * @description 插值分析结果数据源的名称。
  26592. */
  26593. this.outputDatasourceName = null;
  26594. /**
  26595. * @member {SuperMap.PixelFormat} [SuperMap.InterpolationAnalystParameters.prototype.pixelFormat]
  26596. * @description 指定结果栅格数据集存储的像素格式。支持存储的像素格式有 BIT16、BIT32、DOUBLE、SINGLE、UBIT1、UBIT4、UBIT8、UBIT24、UBIT32。
  26597. */
  26598. this.pixelFormat = null;
  26599. /**
  26600. * @member {string} [SuperMap.InterpolationAnalystParameters.prototype.dataset]
  26601. * @description 用来做插值分析的数据源中数据集的名称,该名称用形如 "数据集名称@数据源别名" 形式来表示。
  26602. * 当插值分析类型(InterpolationAnalystType)为 dataset 时,此参数为必选。
  26603. */
  26604. this.dataset = null;
  26605. /**
  26606. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} [SuperMap.InterpolationAnalystParameters.prototype.inputPoints]
  26607. * @description 用于做插值分析的离散点(离散点包括Z值)集合。
  26608. * 当插值分析类型(InterpolationAnalystType)为 geometry 时,此参数为必设参数。
  26609. * 通过离散点直接进行插值分析不需要指定输入数据集inputDatasourceName,inputDatasetName以及zValueFieldName。
  26610. */
  26611. this.inputPoints = null;
  26612. /**
  26613. * @member {string} [SuperMap.InterpolationAnalystParameters.prototype.InterpolationAnalystType="dataset"]
  26614. * @description 插值分析类型。差值分析包括数据集插值分析和几何插值分析两类,
  26615. * "dataset" 表示对数据集进行插值分析,"geometry" 表示对离散点数组进行插值分析。
  26616. */
  26617. this.InterpolationAnalystType = "dataset";
  26618. /**
  26619. * @member {Object} SuperMap.InterpolationAnalystParameters.prototype.clipParam
  26620. * @description 对插值分析结果进行裁剪的参数。
  26621. */
  26622. this.clipParam = null;
  26623. Util.extend(this, options);
  26624. this.CLASS_NAME = "SuperMap.InterpolationAnalystParameters";
  26625. }
  26626. /**
  26627. * @function SuperMap.InterpolationAnalystParameters.prototype.destroy
  26628. * @description 释放资源,将引用资源的属性置空。
  26629. */
  26630. destroy() {
  26631. var me = this;
  26632. me.bounds = null;
  26633. me.searchRadius = null;
  26634. me.zValueFieldName = null;
  26635. me.zValueScale = null;
  26636. me.resolution = null;
  26637. me.filterQueryParameter = null;
  26638. me.outputDatasetName = null;
  26639. me.pixelFormat = null;
  26640. }
  26641. /**
  26642. * @function SuperMap.InterpolationAnalystParameters.toObject
  26643. * @param {SuperMap.InterpolationAnalystParameters} interpolationAnalystParameters - 插值分析参数类。
  26644. * @param {SuperMap.InterpolationAnalystParameters} tempObj - 插值分析参数对象。
  26645. * @description 将插值分析参数对象转换成 JSON 对象。
  26646. * @returns JSON 对象。
  26647. */
  26648. static toObject(interpolationAnalystParameters, tempObj) {
  26649. for (var name in interpolationAnalystParameters) {
  26650. if (name === "inputPoints" && interpolationAnalystParameters.InterpolationAnalystType === "geometry") {
  26651. var objs = [];
  26652. for (var i = 0; i < interpolationAnalystParameters.inputPoints.length; i++) {
  26653. var item = interpolationAnalystParameters.inputPoints[i];
  26654. var obj = {
  26655. x: item.x,
  26656. y: item.y,
  26657. z: item.tag
  26658. };
  26659. objs.push(obj);
  26660. }
  26661. tempObj[name] = objs;
  26662. } else {
  26663. tempObj[name] = interpolationAnalystParameters[name];
  26664. }
  26665. }
  26666. }
  26667. }
  26668. SuperMap.InterpolationAnalystParameters = InterpolationAnalystParameters;
  26669. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationRBFAnalystParameters.js
  26670. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  26671. * This program are made available under the terms of the Apache License, Version 2.0
  26672. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26673. /**
  26674. * @class SuperMap.InterpolationRBFAnalystParameters
  26675. * @category iServer SpatialAnalyst InterpolationAnalyst
  26676. * @classdesc 样条插值(径向基函数插值法)分析参数类。
  26677. * @extends {SuperMap.InterpolationAnalystParameters}
  26678. * @param {Object} options - 参数。
  26679. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  26680. * @param {string} options.searchMode - 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。
  26681. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  26682. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  26683. * @param {string} [options.zValueFieldName] - 存储用于进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,此为必选参数。
  26684. * @param {number} [options.smooth=0.1] - 光滑系数,该值表示插值函数曲线与点的逼近程度,值域为0到1。
  26685. * @param {number} [options.tension=40] - 张力系数,用于调整结果栅格数据表面的特性。
  26686. * @param {number} [options.expectedCount=12] - 【固定点数查找】方式下,设置参与差值运算的点数。
  26687. * @param {number} [options.searchRadius=0] - 【定长查找】方式下,设置参与运算点的查找范围。
  26688. * @param {number} [options.maxPointCountForInterpolation=200] - 【块查找】方式下,设置最多参与插值的点数。
  26689. * @param {number} [options.maxPointCountInNode=50] - 【块查找】方式下,设置单个块内最多参与运算点数。
  26690. * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
  26691. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  26692. * @param {SuperMap.FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  26693. * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  26694. * @param {string} [options.dataset] - 要用来做插值分析的数据源中数据集的名称。该名称用形如”数据集名称@数据源别名”形式来表示。当插值分析类型(InterpolationAnalystType)为 dataset 时。此参数为必选。
  26695. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(InterpolationAnalystType)为 geometry 时。此参数为必选。
  26696. * @example
  26697. * var myInterpolationRBFAnalystParameters = new SuperMap.InterpolationRBFAnalystParameters({
  26698. * dataset:"SamplesP@Interpolation",
  26699. * smooth: 0.1,
  26700. * tension: 40,
  26701. * searchMode: "QUADTREE",
  26702. * maxPointCountForInterpolation: 20,
  26703. * maxPointCountInNode: 5,
  26704. * pixelFormat: "BIT16",
  26705. * zValueFieldName: "AVG_TMP",
  26706. * resolution: 3000,
  26707. * filterQueryParameter: {
  26708. * attributeFilter: ""
  26709. * },
  26710. * outputDatasetName: "myRBF"
  26711. * });
  26712. */
  26713. class InterpolationRBFAnalystParameters extends InterpolationAnalystParameters {
  26714. constructor(options) {
  26715. super(options);
  26716. /**
  26717. * @member {number} [SuperMap.InterpolationRBFAnalystParameters.prototype.smooth=0.1]
  26718. * @description 光滑系数,值域为 0 到 1,常用取值如 0、0.001、0.01、0.1、和 0.5。
  26719. * 该值表示插值函数曲线与点的逼近程度,此数值越大,函数曲线与点的偏差越大,反之越小。
  26720. */
  26721. this.smooth = 0.1;
  26722. /**
  26723. * @member {number} [SuperMap.InterpolationRBFAnalystParameters.prototype.tension=40]
  26724. * @description 张力系数,常用取值如 0、1、5 和 10。
  26725. * 用于调整结果栅格数据表面的特性,张力越大,插值时每个点对计算结果影响越小,反之越大。
  26726. */
  26727. this.tension = 40;
  26728. /**
  26729. * @member {SuperMap.SearchMode} SuperMap.InterpolationRBFAnalystParameters.prototype.searchMode
  26730. * @description 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。必设参数。
  26731. * 具体如下:
  26732. * {KDTREE_FIXED_COUNT} 使用 KDTREE 的固定点数方式查找参与内插分析的点。
  26733. * {KDTREE_FIXED_RADIUS} 使用 KDTREE 的定长方式查找参与内插分析的点。
  26734. * {QUADTREE} 使用 QUADTREE 方式查找参与内插分析的点(块查找)。
  26735. */
  26736. this.searchMode = null;
  26737. /**
  26738. * @member {number} [SuperMap.InterpolationRBFAnalystParameters.prototype.expectedCount=12]
  26739. * @description 【固定点数查找】方式下,设置待查找的点数,即参与差值运算的点数。
  26740. */
  26741. this.expectedCount = 12;
  26742. /**
  26743. * @member {number} [SuperMap.InterpolationRBFAnalystParameters.prototype.maxPointCountForInterpolation=200]
  26744. * @description 【块查找】方式下,最多参与插值的点数。
  26745. */
  26746. this.maxPointCountForInterpolation = 200;
  26747. /**
  26748. * @member {number} [SuperMap.InterpolationRBFAnalystParameters.prototype.maxPointCountInNode=50]
  26749. * @description 【块查找】方式下,单个块内最多参与运算点数。
  26750. */
  26751. this.maxPointCountInNode = 50;
  26752. if (options) {
  26753. Util.extend(this, options);
  26754. }
  26755. this.CLASS_NAME = "SuperMap.InterpolationRBFAnalystParameters";
  26756. }
  26757. /**
  26758. * @function SuperMap.InterpolationRBFAnalystParameters.prototype.destroy
  26759. * @description 释放资源,将引用资源的属性置空。
  26760. */
  26761. destroy() {
  26762. super.destroy();
  26763. var me = this;
  26764. me.smooth = null;
  26765. me.tension = null;
  26766. me.searchMode = null;
  26767. me.expectedCount = null;
  26768. me.maxPointCountForInterpolation = null;
  26769. me.maxPointCountInNode = null;
  26770. }
  26771. /**
  26772. * @function SuperMap.InterpolationRBFAnalystParameters.toObject
  26773. * @param {SuperMap.InterpolationRBFAnalystParameters} datasetInterpolationRBFAnalystParameters - 样条插值(径向基函数插值法)分析参数类
  26774. * @param {SuperMap.InterpolationRBFAnalystParameters} tempObj - 样条插值(径向基函数插值法)分析参数对象
  26775. * @description 将样条插值(径向基函数插值法)分析参数对象转换为 JSON 对象。
  26776. * @returns JSON 对象。
  26777. */
  26778. static toObject(datasetInterpolationRBFAnalystParameters, tempObj) {
  26779. for (var name in datasetInterpolationRBFAnalystParameters) {
  26780. tempObj[name] = datasetInterpolationRBFAnalystParameters[name];
  26781. }
  26782. }
  26783. }
  26784. SuperMap.InterpolationRBFAnalystParameters = InterpolationRBFAnalystParameters;
  26785. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationDensityAnalystParameters.js
  26786. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  26787. * This program are made available under the terms of the Apache License, Version 2.0
  26788. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26789. /**
  26790. * @class SuperMap.InterpolationDensityAnalystParameters
  26791. * @category iServer SpatialAnalyst InterpolationAnalyst
  26792. * @classdesc 点密度差值分析参数类。
  26793. * @param {Object} options - 参数。
  26794. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  26795. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  26796. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  26797. * @param {number} [options.searchRadius=0] - 查找半径,即参与运算点的查找范围,与点数据集单位相同。
  26798. * @param {string} [options.zValueFieldName] - 存储用于进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型( SuperMap.InterpolationAnalystType)为 dataset 时。此为必选参数。
  26799. * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
  26800. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  26801. * @param {SuperMap.FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  26802. * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  26803. * @param {string} [options.dataset] - 用来做插值分析的数据源中数据集的名称,该名称用形如 "数据集名称@数据源别名" 形式来表示。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,必设参数。
  26804. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(SuperMap.InterpolationAnalystType)为 geometry 时,必设参数。
  26805. * @extends {SuperMap.InterpolationAnalystParameters}
  26806. * @example
  26807. * var myInterpolationDensityAnalystParameters = new SuperMap.InterpolationDensityAnalystParameters({
  26808. * dataset: "SamplesP@Interpolation",
  26809. * searchRadius: "100000",
  26810. * pixelFormat: "BIT16",
  26811. * zValueFieldName: "AVG_TMP",
  26812. * resolution: 3000,
  26813. * filterQueryParameter: {
  26814. * attributeFilter: ""
  26815. * },
  26816. * outputDatasetName: "myDensity"
  26817. * });
  26818. */
  26819. class InterpolationDensityAnalystParameters extends InterpolationAnalystParameters {
  26820. constructor(options) {
  26821. super(options);
  26822. if (options) {
  26823. Util.extend(this, options);
  26824. }
  26825. this.CLASS_NAME = "SuperMap.InterpolationDensityAnalystParameters";
  26826. }
  26827. /**
  26828. * @function SuperMap.InterpolationDensityAnalystParameters.prototype.destroy
  26829. * @description 释放资源,将引用资源的属性置空。
  26830. */
  26831. destroy() {
  26832. super.destroy();
  26833. }
  26834. }
  26835. SuperMap.InterpolationDensityAnalystParameters = InterpolationDensityAnalystParameters;
  26836. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationIDWAnalystParameters.js
  26837. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  26838. * This program are made available under the terms of the Apache License, Version 2.0
  26839. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26840. /**
  26841. * @class SuperMap.InterpolationIDWAnalystParameters
  26842. * @category iServer SpatialAnalyst InterpolationAnalyst
  26843. * @classdesc 反距离加权插值(IDW)分析参数类。
  26844. * @param {Object} options - 参数。
  26845. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  26846. * @param {string} options.searchMode - 插值运算时,查找参与运算点的方式,支持固定点数查找、定长查找。
  26847. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  26848. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  26849. * @param {string} [options.zValueFieldName] - 存储用于进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,此为必选参数。
  26850. * @param {number} [options.expectedCount=12] - 【固定点数查找】方式下,设置待查找的点数,即参与差值运算的点数。
  26851. * @param {number} [options.searchRadius=0] - 【定长查找】方式下,设置查找半径,即参与运算点的查找范围,与点数据集单位相同。
  26852. * @param {number} [options.power=2] - 距离权重计算的幂次。
  26853. * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
  26854. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  26855. * @param {SuperMap.FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  26856. * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  26857. * @param {string} [options.dataset] - 要用来做插值分析的数据源中数据集的名称。该名称用形如”数据集名称@数据源别名”形式来表示。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,必设参数。
  26858. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(SuperMap.InterpolationAnalystType)为 geometry 时,必设参数。
  26859. * @extends {SuperMap.InterpolationAnalystParameters}
  26860. * @example 例如:
  26861. * var myInterpolationIDWAnalystParameters = new SuperMap.InterpolationIDWAnalystParameters({
  26862. * dataset:"SamplesP@Interpolation",
  26863. * power: 2,
  26864. * searchMode: "KDTREE_FIXED_COUNT",
  26865. * expectedCount: 12,
  26866. * pixelFormat: "BIT16",
  26867. * zValueFieldName: "AVG_TMP",
  26868. * resolution: 3000,
  26869. * filterQueryParameter: {
  26870. * attributeFilter: ""
  26871. * },
  26872. * outputDatasetName: "myIDW"
  26873. * });
  26874. *
  26875. */
  26876. class InterpolationIDWAnalystParameters extends InterpolationAnalystParameters {
  26877. constructor(options) {
  26878. super(options);
  26879. /**
  26880. * @member {number} [SuperMap.InterpolationIDWAnalystParameters.prototype.power=2]
  26881. * @description 距离权重计算的幂次。
  26882. * 该值决定了权值下降的速度,幂次越大,随距离的增大权值下降越快,距离预测点越远的点的权值也越小。
  26883. * 理论上,参数值必须大于0,但是0.5到3之间时运算结果更合理,因此推荐值为0.5~3。
  26884. */
  26885. this.power = 2;
  26886. /**
  26887. * @member {SuperMap.SearchMode} SuperMap.InterpolationIDWAnalystParameters.prototype.searchMode
  26888. * @description 插值运算时,查找参与运算点的方式,支持固定点数查找、定长查找。
  26889. * 具体如下:
  26890. * {KDTREE_FIXED_COUNT} 使用 KDTREE 的固定点数方式查找参与内插分析的点。
  26891. * {KDTREE_FIXED_RADIUS} 使用 KDTREE 的定长方式查找参与内插分析的点。
  26892. */
  26893. this.searchMode = null;
  26894. /**
  26895. * @member {number} [SuperMap.InterpolationIDWAnalystParameters.prototype.expectedCount=12]
  26896. * @description 【固定点数查找】方式下,设置待查找的点数,即参与差值运算的点数。
  26897. */
  26898. this.expectedCount = 12;
  26899. if (options) {
  26900. Util.extend(this, options);
  26901. }
  26902. this.CLASS_NAME = "SuperMap.InterpolationIDWAnalystParameters";
  26903. }
  26904. /**
  26905. * @function SuperMap.InterpolationIDWAnalystParameters.prototype.destroy
  26906. * @description 释放资源,将引用资源的属性置空。
  26907. */
  26908. destroy() {
  26909. super.destroy();
  26910. var me = this;
  26911. me.power = null;
  26912. me.searchMode = null;
  26913. me.expectedCount = null;
  26914. }
  26915. }
  26916. SuperMap.InterpolationIDWAnalystParameters = InterpolationIDWAnalystParameters;
  26917. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationKrigingAnalystParameters.js
  26918. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  26919. * This program are made available under the terms of the Apache License, Version 2.0
  26920. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26921. /**
  26922. * @class SuperMap.InterpolationKrigingAnalystParameters
  26923. * @category iServer SpatialAnalyst InterpolationAnalyst
  26924. * @classdesc 克吕金插值分析参数类。
  26925. * @description 通过该类可以设置克吕金插值分析所需的参数。
  26926. * 克吕金(Kriging)法为地统计学上一种空间数据内插处理方法,主要的目的是利用各数据点间变异数(variance)的大小来推求某一未知点与各已知点的权重关系,
  26927. * 再由各数据点的值和其与未知点的权重关系推求未知点的值。Kriging 法最大的特色不仅是提供一个最小估计误差的预测值,并且可明确的指出误差值的大小。
  26928. * 一般而言,许多地质参数,如地形面,本身即具有连续性,故在一段距离内的任两点必有空间上的关系。反之,在一不规则面上的两点若相距甚远,
  26929. * 则在统计意义上可视为互为独立 (stastically indepedent)。这种随距离而改变的空间上连续性,可用半变异图 (semivariogram) 来表现。
  26930. * 因此,若想由已知的散乱点来推求某一未知点的值,则可利用半变异图推求各已知点与未知点的空间关系,即以下四个参数。
  26931. * 然后,由此空间参数推求半变异数,由各数据点间的半变异数可推求未知点与已知点间的权重关系,进而推求出未知点的值。<br>
  26932. *
  26933. * · 块金值(nugget):当采样点间距为0时,理论上半变异函数值为0,但时间上两采样点非常接近时半变异函数值并不为0,即产生了上图所示的块金效应,
  26934. * 对应的半变异函数值为块金值。块金值可能由于测量误差或者空间变异产生。<br>
  26935. *
  26936. * · 基台值(sill):随着采样点间距的不断增大,半变异函数的值趋向一个稳定的常数,该常数成为基台值。到达基台值后,半变异函数的值不再随采样点间距而改变,
  26937. * 即大于此间距的采样点不再具有空间相关性。<br>
  26938. *
  26939. * · 偏基台值:基台值与块金值的差值。<br>
  26940. *
  26941. * · 自相关阈值(range):也称变程,是半变异函数值达到基台值时,采样点的间距。超过自相关阈值的采样点不再具有空间相关性,将不对预测结果产生影响。<br>
  26942. *
  26943. * 由上述可知,半变异函数是克吕金插值的关键,因此选择合适的半变异函数模型非常重要,SuperMap 提供了以下三种半变异函数模型:<br>
  26944. *
  26945. * · 指数型(EXPONENTIAL):适用于空间相关关系随样本间距的增加成指数递减的情况,其空间自相关关系在样本间距的无穷远处完全消失。<br>
  26946. *
  26947. * · 球型(SPHERICAL):适用于空间自相关关系随样本间距的增加而逐渐减少,直到超出一定的距离时空间自相关关系消失的情况。<br>
  26948. *
  26949. * · 高斯型(GAUSSIAN):适用于半变异函数值渐进地逼近基台值的情况。<br>
  26950. *
  26951. * 半变异函数中,有一个关键参数即插值的字段值的期望(平均值),由于对于此参数的不同处理方法而衍生出了不同的 Kriging 方法。SuperMap的差值功能基于以下三种常用 Kriging 算法:<br>
  26952. *
  26953. * 1. 简单克吕金(Simple Kriging):该方法假定用于插值的字段值的期望(平均值)已知的某一常数。<br>
  26954. *
  26955. * 2. 普通克吕金(Kriging):该方法假定用于插值的字段值的期望(平均值)未知且恒定。它利用一定的数学函数,通过对给定的空间点进行拟合来估算单元格的值,<br>
  26956. * 生成格网数据集。它不仅可以生成一个表面,还可以给出预测结果的精度或者确定性的度量。因此,此方法计算精度较高,常用于地学领域。
  26957. *
  26958. * 3. 泛克吕金(Universal Kriging):该方法假定用于插值的字段值的期望(平均值)是未知的变量。在样点数据中存在某种主导趋势且该趋势可以通过某一个确定<br>
  26959. * 的函数或者多项式进行拟合的情况下,适用泛克吕金插值法。
  26960. *
  26961. * 克吕金法的优点是以空间统计学作为其坚实的理论基础,物理含义明确;不但能估计测定参数的空间变异分布,而且还可以估算参数的方差分布。克吕金法的缺点是计算步骤较烦琐,
  26962. * 计算量大,且变异函数有时需要根据经验人为选定。
  26963. * @param {Object} options - 参数。
  26964. * @param {string} options.type - 克吕金插值的类型。
  26965. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  26966. * @param {string} options.searchMode - 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。
  26967. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  26968. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  26969. * @param {string} [options.zValueFieldName] - 存储用于进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,此为必选参数。
  26970. * @param {number} [options.mean] - 【简单克吕金】类型下,插值字段的平均值。
  26971. * @param {number} [options.angle=0] - 克吕金算法中旋转角度值。
  26972. * @param {number} [options.nugget=0] - 克吕金算法中块金效应值。
  26973. * @param {number} [options.range=0] - 克吕金算法中自相关阈值,单位与原数据集单位相同。
  26974. * @param {number} [options.sill=0] - 克吕金算法中基台值。
  26975. * @param {string} [options.variogramMode="SPHERICAL"] - 克吕金插值时的半变函数类型。
  26976. * @param {string} [options.exponent='exp1'] - 【泛克吕金】类型下,用于插值的样点数据中趋势面方程的阶数,可选值为 exp1、exp2。
  26977. * @param {number} [options.expectedCount=12] - 【固定点数查找】方式下,设置待查找的点数;【定长查找】方式下,设置查找的最小点数。
  26978. * @param {number} [options.searchRadius=0] - 【定长查找】方式下,设置参与运算点的查找范围。
  26979. * @param {number} [options.maxPointCountForInterpolation=200] - 【块查找】方式下,设置最多参与插值的点数。
  26980. * @param {number} [options.maxPointCountInNode=50] - 【块查找】方式下,设置单个块内最多参与运算点数。
  26981. * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
  26982. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  26983. * @param {SuperMap.FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  26984. * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  26985. * @param {string} [options.dataset] - 要用来做插值分析的数据源中数据集的名称。该名称用形如 ”数据集名称@数据源别名” 形式来表示。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时。
  26986. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(InterpolationAnalystType)为 geometry 时。
  26987. * @extends {SuperMap.InterpolationAnalystParameters}
  26988. * @example 例如:
  26989. * var myInterpolationKrigingAnalystParameters = new SuperMap.InterpolationKrigingAnalystParameters({
  26990. * dataset:"SamplesP@Interpolation",
  26991. * type: "KRIGING",
  26992. * angle: 0,
  26993. * mean: 5,
  26994. * nugget: 30,
  26995. * range: 50,
  26996. * sill: 300,
  26997. * variogramMode: "EXPONENTIAL",
  26998. * searchMode: "QUADTREE",
  26999. * maxPointCountForInterpolation: 20,
  27000. * maxPointCountInNode: 5,
  27001. * pixelFormat: "BIT16",
  27002. * zValueFieldName: "AVG_TMP",
  27003. * resolution: 30000,
  27004. * filterQueryParameter: {
  27005. * attributeFilter: ""
  27006. * },
  27007. * outputDatasetName: "myKriging"
  27008. * });
  27009. *
  27010. */
  27011. class InterpolationKrigingAnalystParameters extends InterpolationAnalystParameters {
  27012. constructor(options) {
  27013. super(options);
  27014. /**
  27015. * @member {SuperMap.InterpolationAlgorithmType} SuperMap.InterpolationKrigingAnalystParameters.prototype.type
  27016. * @description 克吕金插值的类型。
  27017. * 具体如下:<br>
  27018. * {KRIGING} 普通克吕金插值法。
  27019. * {SimpleKriging} 简单克吕金插值法。
  27020. * {UniversalKriging} 泛克吕金插值法。
  27021. */
  27022. this.type = null;
  27023. /**
  27024. * @member {number} SuperMap.InterpolationKrigingAnalystParameters.prototype.mean
  27025. * @description 【简单克吕金】方式下,插值字段的平均值。
  27026. * 即采样点插值字段值总和除以采样点数目。
  27027. */
  27028. this.mean = null;
  27029. /**
  27030. * @member {number} [SuperMap.InterpolationKrigingAnalystParameters.prototype.angle=0]
  27031. * @description 克吕金算法中旋转角度值。
  27032. * 此角度值指示了每个查找邻域相对于水平方向逆时针旋转的角度。
  27033. */
  27034. this.angle = 0;
  27035. /**
  27036. * @member {number} [SuperMap.InterpolationKrigingAnalystParameters.prototype.nugget=0]
  27037. * @description 克吕金算法中块金效应值。
  27038. */
  27039. this.nugget = 0;
  27040. /**
  27041. * @member {number} [SuperMap.InterpolationKrigingAnalystParameters.prototype.range=0]
  27042. * @description 克吕金算法中自相关阈值,单位与原数据集单位相同。
  27043. */
  27044. this.range = 0;
  27045. /**
  27046. * @member {number} [SuperMap.InterpolationKrigingAnalystParameters.prototype.sill=0]
  27047. * @description 克吕金算法中基台值。
  27048. */
  27049. this.sill = 0;
  27050. /**
  27051. * @member {SuperMap.VariogramMode} [SuperMap.InterpolationKrigingAnalystParameters.prototype.variogramMode=SuperMap.VariogramMode.SPHERICAL]
  27052. * @description 克吕金插值时的半变函数类型。
  27053. * 用户所选择的半变函数类型会影响未知点的预测,特别是曲线在原点处的不同形状有重要意义。
  27054. * 曲线在原点处越陡,则较近领域对该预测值的影响就越大,因此输出表面就会越不光滑。
  27055. */
  27056. this.variogramMode = VariogramMode.SPHERICAL;
  27057. /**
  27058. * @member {SuperMap.Exponent} [SuperMap.InterpolationKrigingAnalystParameters.prototype.exponent=SuperMap.Exponent.EXP1]
  27059. * @description 【泛克吕金】类型下,用于插值的样点数据中趋势面方程的阶数。
  27060. */
  27061. this.exponent = Exponent.EXP1;
  27062. /**
  27063. * @member {SuperMap.SearchMode} SuperMap.InterpolationKrigingAnalystParameters.prototype.searchMode
  27064. * @description 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。必设参数。
  27065. * 简单克吕金和泛克吕金不支持块查找。
  27066. * 具体如下:<br>
  27067. * {KDTREE_FIXED_COUNT} 使用 KDTREE 的固定点数方式查找参与内插分析的点。<br>
  27068. * {KDTREE_FIXED_RADIUS} 使用 KDTREE 的定长方式查找参与内插分析的点。<br>
  27069. * {QUADTREE} 使用 QUADTREE 方式查找参与内插分析的点(块查找)。
  27070. */
  27071. this.searchMode = null;
  27072. /**
  27073. * @member {number} [SuperMap.InterpolationKrigingAnalystParameters.prototype.expectedCount=12]
  27074. * @description 【固定点数查找】方式下,设置待查找的点数,即参与差值运算的点数,默认值为12。
  27075. * 【定长查找】方式下,设置查找的最小点数,默认值为12。
  27076. */
  27077. this.expectedCount = 12;
  27078. /**
  27079. * @member {number} [SuperMap.InterpolationKrigingAnalystParameters.prototype.maxPointCountForInterpolation=200]
  27080. * @description 【块查找】方式下,最多参与插值的点数。
  27081. * 仅用于普通克吕金插值,简单克吕金和泛克吕金不支持块查找。
  27082. */
  27083. this.maxPointCountForInterpolation = 200;
  27084. /**
  27085. * @member {number} [SuperMap.InterpolationKrigingAnalystParameters.prototype.maxPointCountForInterpolation=50]
  27086. * @description 【块查找】方式下,设置单个块内最多参与运算点数。
  27087. * 仅用于普通克吕金插值,简单克吕金和泛克吕金不支持块查找。
  27088. */
  27089. this.maxPointCountInNode = 50;
  27090. if (options) {
  27091. Util.extend(this, options);
  27092. }
  27093. this.CLASS_NAME = "SuperMap.InterpolationKrigingAnalystParameters";
  27094. }
  27095. /**
  27096. * @function SuperMap.InterpolationKrigingAnalystParameters.prototype.destroy
  27097. * @description 释放资源,将引用资源的属性置空。
  27098. */
  27099. destroy() {
  27100. super.destroy();
  27101. var me = this;
  27102. me.type = null;
  27103. me.mean = null;
  27104. me.angle = null;
  27105. me.nugget = null;
  27106. me.range = null;
  27107. me.sill = null;
  27108. me.variogramMode = null;
  27109. me.exponent = null;
  27110. me.searchMode = null;
  27111. me.expectedCount = null;
  27112. me.maxPointCountForInterpolation = null;
  27113. me.maxPointCountInNode = null;
  27114. }
  27115. }
  27116. SuperMap.InterpolationKrigingAnalystParameters = InterpolationKrigingAnalystParameters;
  27117. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationAnalystService.js
  27118. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27119. * This program are made available under the terms of the Apache License, Version 2.0
  27120. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27121. /**
  27122. * @class SuperMap.InterpolationAnalystService
  27123. * @category iServer SpatialAnalyst InterpolationAnalyst
  27124. * @classdesc 插值分析服务类。
  27125. * 插值分析可以将有限的采样点数据,通过插值算法对采样点周围的数值情况进行预测,可以掌握研究区域内数据的总体分布状况,从而使采样的离散点不仅仅反映其所在位置的数值情况,
  27126. * 还可以反映区域的数值分布。目前SuperMap iServer的插值功能提供从点数据集插值得到栅格数据集的功能,支持以下常用的内插方法,
  27127. * 包括:反距离加权插值、克吕金(Kriging)插值法、样条(径向基函数,Radial Basis Function)插值、点密度插值。
  27128. * @param {string} url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  27129. * @param {Object} options - 参数。</br>
  27130. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  27131. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  27132. * @param {Object} [options.headers] - 请求头。
  27133. * @extends {SuperMap.SpatialAnalystBase}
  27134. * @example 例如:
  27135. * (start code)
  27136. * var myTInterpolationAnalystService = new SuperMap.InterpolationAnalystService(url);
  27137. * myTInterpolationAnalystService.events.on({
  27138. * "processCompleted": processCompleted,
  27139. * "processFailed": processFailed
  27140. * }
  27141. * );
  27142. * (end)
  27143. *
  27144. */
  27145. class InterpolationAnalystService extends SpatialAnalystBase {
  27146. constructor(url, options) {
  27147. super(url, options);
  27148. /**
  27149. * @member {string} SuperMap.InterpolationAnalystService.prototype.mode
  27150. * @description 插值分析类型。
  27151. */
  27152. this.mode = null;
  27153. if (options) {
  27154. Util.extend(this, options);
  27155. }
  27156. }
  27157. /**
  27158. * @function SuperMap.InterpolationAnalystService.prototype.destroy
  27159. * @description 释放资源,将引用资源的属性置空。
  27160. */
  27161. destroy() {
  27162. super.destroy();
  27163. this.mode = null;
  27164. this.CLASS_NAME = "SuperMap.InterpolationAnalystService";
  27165. }
  27166. /**
  27167. * @function SuperMap.InterpolationAnalystService.prototype.processAsync
  27168. * @description 负责将客户端的查询参数传递到服务端。
  27169. * @param {SuperMap.InterpolationAnalystParameters} parameter - 插值分析参数类。
  27170. */
  27171. processAsync(parameter) {
  27172. var parameterObject = {};
  27173. var me = this;
  27174. if (parameter instanceof InterpolationDensityAnalystParameters) {
  27175. me.mode = 'Density';
  27176. if (parameter.InterpolationAnalystType === 'geometry') {
  27177. me.url = Util.urlPathAppend(me.url, 'geometry/interpolation/density');
  27178. } else {
  27179. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/density');
  27180. }
  27181. } else if (parameter instanceof InterpolationIDWAnalystParameters) {
  27182. me.mode = 'IDW';
  27183. if (parameter.InterpolationAnalystType === 'geometry') {
  27184. me.url = Util.urlPathAppend(me.url, 'geometry/interpolation/idw');
  27185. } else {
  27186. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/idw');
  27187. }
  27188. } else if (parameter instanceof InterpolationRBFAnalystParameters) {
  27189. me.mode = 'RBF';
  27190. if (parameter.InterpolationAnalystType === 'geometry') {
  27191. me.url = Util.urlPathAppend(me.url, 'geometry/interpolation/rbf');
  27192. } else {
  27193. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/rbf');
  27194. }
  27195. } else if (parameter instanceof InterpolationKrigingAnalystParameters) {
  27196. me.mode = 'Kriging';
  27197. if (parameter.InterpolationAnalystType === 'geometry') {
  27198. me.url = Util.urlPathAppend(me.url, 'geometry/interpolation/kriging');
  27199. } else {
  27200. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/kriging');
  27201. }
  27202. }
  27203. InterpolationAnalystParameters.toObject(parameter, parameterObject);
  27204. var jsonParameters = Util.toJSON(parameterObject);
  27205. me.url = Util.urlAppend(me.url, 'returnContent=true');
  27206. me.request({
  27207. method: "POST",
  27208. data: jsonParameters,
  27209. scope: me,
  27210. success: me.serviceProcessCompleted,
  27211. failure: me.serviceProcessFailed
  27212. });
  27213. }
  27214. }
  27215. SuperMap.InterpolationAnalystService = InterpolationAnalystService;
  27216. ;// CONCATENATED MODULE: ./src/common/iServer/KernelDensityJobParameter.js
  27217. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27218. * This program are made available under the terms of the Apache License, Version 2.0
  27219. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27220. /**
  27221. * @class SuperMap.KernelDensityJobParameter
  27222. * @category iServer ProcessingService DensityAnalyst
  27223. * @classdesc 密度分析任务参数类。
  27224. * @param {Object} options - 参数。
  27225. * @param {string} options.datasetName - 数据集名。
  27226. * @param {string} options.fields - 权重索引。
  27227. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} [options.query] - 分析范围(默认为全图范围)。
  27228. * @param {number} [options.resolution=80] - 分辨率。
  27229. * @param {number} [options.method=0] - 分析方法。
  27230. * @param {number} [options.meshType=0] - 分析类型。
  27231. * @param {number} [options.radius=300] - 分析的影响半径。
  27232. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  27233. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  27234. */
  27235. class KernelDensityJobParameter {
  27236. constructor(options) {
  27237. if (!options) {
  27238. return;
  27239. }
  27240. /**
  27241. * @member {string} SuperMap.KernelDensityJobParameter.prototype.datasetName
  27242. * @description 数据集名。
  27243. */
  27244. this.datasetName = "";
  27245. /**
  27246. * @member {SuperMap.Bounds|L.Bounds|ol.extent} [SuperMap.KernelDensityJobParameter.prototype.query]
  27247. * @description 分析范围。
  27248. */
  27249. this.query = "";
  27250. /**
  27251. * @member {number} [SuperMap.KernelDensityJobParameter.prototype.resolution=80]
  27252. * @description 网格大小。
  27253. */
  27254. this.resolution = 80;
  27255. /**
  27256. * @member {number} [SuperMap.KernelDensityJobParameter.prototype.method=0]
  27257. * @description 分析方法。
  27258. */
  27259. this.method = 0;
  27260. /**
  27261. * @member {number} [SuperMap.KernelDensityJobParameter.prototype.meshType=0]
  27262. * @description 分析类型。
  27263. */
  27264. this.meshType = 0;
  27265. /**
  27266. * @member {string} SuperMap.KernelDensityJobParameter.prototype.fields
  27267. * @description 权重索引。
  27268. */
  27269. this.fields = "";
  27270. /**
  27271. * @member {number} [SuperMap.KernelDensityJobParameter.prototype.radius=300]
  27272. * @description 分析的影响半径。
  27273. */
  27274. this.radius = 300;
  27275. /**
  27276. * @member {SuperMap.AnalystSizeUnit} [SuperMap.KernelDensityJobParameter.prototype.meshSizeUnit=SuperMap.AnalystSizeUnit.METER]
  27277. * @description 网格大小单位。
  27278. */
  27279. this.meshSizeUnit = AnalystSizeUnit.METER;
  27280. /**
  27281. * @member {SuperMap.AnalystSizeUnit} [SuperMap.KernelDensityJobParameter.prototype.radiusUnit=SuperMap.AnalystSizeUnit.METER]
  27282. * @description 搜索半径单位。
  27283. */
  27284. this.radiusUnit = AnalystSizeUnit.METER;
  27285. /**
  27286. * @member {SuperMap.AnalystAreaUnit} [SuperMap.KernelDensityJobParameter.prototype.areaUnit=SuperMap.AnalystAreaUnit.SQUAREMILE]
  27287. * @description 面积单位。
  27288. */
  27289. this.areaUnit = AnalystAreaUnit.SQUAREMILE;
  27290. /**
  27291. * @member {SuperMap.OutputSetting} SuperMap.KernelDensityJobParameter.prototype.output
  27292. * @description 输出参数设置类
  27293. */
  27294. this.output = null;
  27295. /**
  27296. * @member {SuperMap.MappingParameters} [SuperMap.KernelDensityJobParameter.prototype.mappingParameters]
  27297. * @description 分析后结果可视化的参数类。
  27298. */
  27299. this.mappingParameters = null;
  27300. Util.extend(this, options);
  27301. this.CLASS_NAME = "SuperMap.KernelDensityJobParameter";
  27302. }
  27303. /**
  27304. * @function SuperMap.KernelDensityJobParameter.prototype.destroy
  27305. * @description 释放资源,将引用资源的属性置空。
  27306. */
  27307. destroy() {
  27308. this.datasetName = null;
  27309. this.query = null;
  27310. this.resolution = null;
  27311. this.method = null;
  27312. this.radius = null;
  27313. this.meshType = null;
  27314. this.fields = null;
  27315. this.meshSizeUnit = null;
  27316. this.radiusUnit = null;
  27317. this.areaUnit = null;
  27318. if (this.output instanceof OutputSetting) {
  27319. this.output.destroy();
  27320. this.output = null;
  27321. }
  27322. if (this.mappingParameters instanceof MappingParameters) {
  27323. this.mappingParameters.destroy();
  27324. this.mappingParameters = null;
  27325. }
  27326. }
  27327. /**
  27328. * @function SuperMap.KernelDensityJobParameter.toObject
  27329. * @param {SuperMap.KernelDensityJobParameter} kernelDensityJobParameter - 密度分析任务参数类。
  27330. * @param {SuperMap.KernelDensityJobParameter} tempObj - 密度分析任务参数对象。
  27331. * @description 将密度分析任务参数对象转换为 JSON 对象。
  27332. * @returns JSON 对象。
  27333. */
  27334. static toObject(kernelDensityJobParameter, tempObj) {
  27335. for (var name in kernelDensityJobParameter) {
  27336. if (name === "datasetName") {
  27337. tempObj['input'] = tempObj['input'] || {};
  27338. tempObj['input'][name] = kernelDensityJobParameter[name];
  27339. continue;
  27340. }
  27341. if (name === "output") {
  27342. tempObj['output'] = tempObj['output'] || {};
  27343. tempObj['output'] = kernelDensityJobParameter[name];
  27344. continue;
  27345. }
  27346. tempObj['analyst'] = tempObj['analyst'] || {};
  27347. if (name === 'query' && kernelDensityJobParameter[name]) {
  27348. tempObj['analyst'][name] = kernelDensityJobParameter[name].toBBOX();
  27349. } else {
  27350. tempObj['analyst'][name] = kernelDensityJobParameter[name];
  27351. }
  27352. if (name === 'mappingParameters') {
  27353. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  27354. tempObj['analyst']['mappingParameters'] = kernelDensityJobParameter[name];
  27355. }
  27356. }
  27357. }
  27358. }
  27359. SuperMap.KernelDensityJobParameter = KernelDensityJobParameter;
  27360. ;// CONCATENATED MODULE: ./src/common/iServer/KernelDensityJobsService.js
  27361. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27362. * This program are made available under the terms of the Apache License, Version 2.0
  27363. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27364. /**
  27365. * @class SuperMap.KernelDensityJobsService
  27366. * @category iServer ProcessingService DensityAnalyst
  27367. * @classdesc 核密度分析服务类
  27368. * @extends {SuperMap.ProcessingServiceBase}
  27369. * @param {string} url -核密度分析服务地址。
  27370. * @param {Object} options - 交互服务时所需可选参数。
  27371. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  27372. * @param {Object} [options.headers] - 请求头。
  27373. */
  27374. class KernelDensityJobsService extends ProcessingServiceBase {
  27375. constructor(url, options) {
  27376. super(url, options);
  27377. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/density');
  27378. this.CLASS_NAME = "SuperMap.KernelDensityJobsService";
  27379. }
  27380. /**
  27381. * @function SuperMap.KernelDensityJobsService.prototype.destroy
  27382. * @override
  27383. */
  27384. destroy() {
  27385. super.destroy();
  27386. }
  27387. /**
  27388. * @function SuperMap.KernelDensityJobsService.prototype.getKernelDensityJobs
  27389. * @description 获取核密度分析任务
  27390. */
  27391. getKernelDensityJobs() {
  27392. super.getJobs(this.url);
  27393. }
  27394. /**
  27395. * @function SuperMap.KernelDensityJobsService.prototype.getKernelDensityJobs
  27396. * @description 获取指定id的核密度分析服务
  27397. * @param {string} id - 指定要获取数据的id
  27398. */
  27399. getKernelDensityJob(id) {
  27400. super.getJobs(Util.urlPathAppend(this.url, id));
  27401. }
  27402. /**
  27403. * @function SuperMap.KernelDensityJobsService.prototype.addKernelDensityJob
  27404. * @description 新建核密度分析服务
  27405. * @param {SuperMap.KernelDensityJobParameter} params - 创建一个空间分析的请求参数。
  27406. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  27407. */
  27408. addKernelDensityJob(params, seconds) {
  27409. super.addJob(this.url, params, KernelDensityJobParameter, seconds);
  27410. }
  27411. }
  27412. SuperMap.KernelDensityJobsService = KernelDensityJobsService;
  27413. ;// CONCATENATED MODULE: ./src/common/iServer/LabelMatrixCell.js
  27414. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27415. * This program are made available under the terms of the Apache License, Version 2.0
  27416. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27417. /**
  27418. * @class SuperMap.LabelMatrixCell
  27419. * @category iServer Map Theme
  27420. * @classdesc 矩阵标签元素抽象类。
  27421. * @description 该类可以包含 n*n 个矩阵标签元素,矩阵标签元素的类型可以是图片,符号,标签专题图等。
  27422. * 符号类型的矩阵标签元素类、图片类型的矩阵标签元素类和专题图类型的矩阵标签元素类均继承自该类。
  27423. */
  27424. class LabelMatrixCell {
  27425. constructor() {
  27426. this.CLASS_NAME = "LabelMatrixCell";
  27427. }
  27428. }
  27429. SuperMap.LabelMatrixCell = LabelMatrixCell;
  27430. ;// CONCATENATED MODULE: ./src/common/iServer/LabelImageCell.js
  27431. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27432. * This program are made available under the terms of the Apache License, Version 2.0
  27433. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27434. /**
  27435. * @class SuperMap.LabelImageCell
  27436. * @category iServer Map Theme
  27437. * @classdesc 图片类型的矩阵标签元素类。
  27438. * @description 该类继承自 {@link SuperMap.LabelMatrixCell}类,主要对矩阵标签中的专题图类型的矩阵标签元素进行设置。
  27439. * 矩阵标签专题图是标签专题图(ThemeLabel)的一种,其中矩阵标签中的填充元素又可分为图片类型({@link SuperMap.LabelImageCell})、
  27440. * 符号类型({@link SuperMap.LabelSymbolCell})、专题图类型({@link SuperMap.LabelThemeCell})三种,该类是这三种类型的矩阵标签元素其中的一种,
  27441. * 用于定义符号类型的矩阵标签,如符号 ID 字段名称(符号 ID 与 SuperMap 桌面产品中点、线、面符号的 ID 对应) 、大小等。
  27442. * 用户在实现矩阵标签专题图时只需将定义好的矩阵标签元素赋值予 {@link SuperMap.ThemeLabel.matrixCells} 属性即可。matrixCells 是一个二维数组,
  27443. * 每一维可以是任意类型的矩阵标签元素组成的数组(也可是单个标签元素组成的数组,即数组中只有一个元素)。
  27444. * @extends {SuperMap.LabelMatrixCell}
  27445. * @param {Object} options - 参数。
  27446. * @param {number} [options.height=0] - 设置图片的高度,单位为毫米。
  27447. * @param {string} [options.pathField] - 设置矩阵标签元素所使用图片的路径。
  27448. * @param {number} [options.rotation=0.0] - 图片的旋转角度。逆时针方向为正方向,单位为度,精确到0.1度。
  27449. * @param {number} [options.width=0] - 设置图片的宽度,单位为毫米。
  27450. * @param {boolean} [options.sizeFixed=false] - 是否固定图片的大小。
  27451. */
  27452. class LabelImageCell extends LabelMatrixCell {
  27453. constructor(options) {
  27454. super(options);
  27455. /**
  27456. * @member {number} SuperMap.LabelImageCell.prototype.height
  27457. * @description 设置图片的高度,单位为毫米。
  27458. */
  27459. this.height = 0;
  27460. /**
  27461. * @member {string} SuperMap.LabelImageCell.prototype.pathField
  27462. * @description 设置矩阵标签元素所使用的图片路径对应的字段名。
  27463. */
  27464. this.pathField = null;
  27465. /**
  27466. * @member {number} [SuperMap.LabelImageCell.prototype.rotation=0.0]
  27467. * @description 图片的旋转角度。逆时针方向为正方向,单位为度,精确到0.1度。
  27468. */
  27469. this.rotation = 0.0;
  27470. /**
  27471. * @member {number} SuperMap.LabelImageCell.prototype.width
  27472. * @description 设置图片的宽度,单位为毫米。
  27473. */
  27474. this.width = 0;
  27475. /**
  27476. * @member {boolean} [SuperMap.LabelImageCell.prototype.sizeFixed=false]
  27477. * @description 是否固定图片的大小。
  27478. */
  27479. this.sizeFixed = false;
  27480. /**
  27481. * @member {string} SuperMap.LabelImageCell.prototype.type
  27482. * @description 制作矩阵专题图时是必须的。
  27483. */
  27484. this.type = "IMAGE";
  27485. if (options) {
  27486. Util.extend(this, options);
  27487. }
  27488. this.CLASS_NAME = "SuperMap.LabelImageCell";
  27489. }
  27490. /**
  27491. * @function SuperMap.LabelImageCell.prototype.destroy
  27492. * @description 释放资源,将引用资源的属性置空。
  27493. */
  27494. destroy() {
  27495. var me = this;
  27496. me.height = null;
  27497. me.pathField = null;
  27498. me.rotation = null;
  27499. me.width = null;
  27500. me.sizeFixed = null;
  27501. }
  27502. }
  27503. SuperMap.LabelImageCell = LabelImageCell;
  27504. ;// CONCATENATED MODULE: ./src/common/iServer/LabelSymbolCell.js
  27505. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27506. * This program are made available under the terms of the Apache License, Version 2.0
  27507. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27508. /**
  27509. * @class SuperMap.LabelSymbolCell
  27510. * @category iServer Map Theme
  27511. * @classdesc 符号类型的矩阵标签元素类。
  27512. * @description 该类继承自 {@link SuperMap.LabelMatrixCell}类,主要对矩阵标签中的专题图类型的矩阵标签元素进行设置。
  27513. * 矩阵标签专题图是标签专题图({@link SuperMap.ThemeLabel})的一种,其中矩阵标签中的填充元素又可分为图片类型({@link SuperMap.LabelImageCell})、
  27514. * 符号类型({@link SuperMap.LabelSymbolCell})、专题图类型({@link SuperMap.LabelThemeCell})三种,该类是这三种类型的矩阵标签元素其中的一种,
  27515. * 用于定义符号类型的矩阵标签,如符号 ID 字段名称(符号 ID 与 SuperMap 桌面产品中点、线、面符号的 ID 对应) 、大小等。
  27516. * 用户在实现矩阵标签专题图时只需将定义好的矩阵标签元素赋值予 {@link SuperMap.ThemeLabel.matrixCells} 属性即可。matrixCells 属是一个二维数组,
  27517. * 每一维可以是任意类型的矩阵标签元素组成的数组(也可是单个标签元素组成的数组,即数组中只有一个元素)。
  27518. * @extends {SuperMap.LabelMatrixCell}
  27519. * @param {Object} options - 参数。
  27520. * @param {SuperMap.ServerStyle} options.style - 获取或设置符号样式。
  27521. * @param {string} options.symbolIDField - 符号 ID 或符号 ID 所对应的字段名称。
  27522. */
  27523. class LabelSymbolCell extends LabelMatrixCell {
  27524. constructor(options) {
  27525. super(options);
  27526. /**
  27527. * @member {SuperMap.ServerStyle} SuperMap.LabelSymbolCell.prototype.style
  27528. * @description 获取或设置符号样式—— {@link SuperMap.ServerStyle} 对象,包括符号大小({@link SuperMap.ServerStyle.markerSize})
  27529. * 和符号旋转({@link SuperMap.ServerStyle.markerAngle})角度,其中用于设置符号 ID 的属性({@link SuperMap.ServerStyle.markerSymbolID})在此处不起作用。
  27530. */
  27531. this.style = new ServerStyle();
  27532. /**
  27533. * @member {string} SuperMap.LabelSymbolCell.prototype.symbolIDField
  27534. * @description 获取或设置符号 ID 或符号 ID 所对应的字段名称。
  27535. */
  27536. this.symbolIDField = null;
  27537. /**
  27538. * @member {string} SuperMap.LabelSymbolCell.prototype.type
  27539. * @description 制作矩阵专题图时是必须的。
  27540. */
  27541. this.type = "SYMBOL";
  27542. if (options) {
  27543. Util.extend(this, options);
  27544. }
  27545. this.CLASS_NAME = "SuperMap.LabelSymbolCell";
  27546. }
  27547. /**
  27548. * @function SuperMap.LabelSymbolCell.prototype.destroy
  27549. * @description 释放资源,将引用资源的属性置空。
  27550. */
  27551. destroy() {
  27552. var me = this;
  27553. if (me.style) {
  27554. me.style.destroy();
  27555. me.style = null;
  27556. }
  27557. me.symbolIDField = null;
  27558. }
  27559. }
  27560. SuperMap.LabelSymbolCell = LabelSymbolCell;
  27561. ;// CONCATENATED MODULE: ./src/common/iServer/LabelThemeCell.js
  27562. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27563. * This program are made available under the terms of the Apache License, Version 2.0
  27564. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27565. /**
  27566. * @class SuperMap.LabelThemeCell
  27567. * @category iServer Map Theme
  27568. * @classdesc 专题图类型的矩阵标签元素类。
  27569. * @description 该类继承自 {@link SuperMap.LabelMatrixCell} 类,主要对矩阵标签中的专题图类型的矩阵标签元素进行设置。
  27570. * 矩阵标签专题图是标签专题图({@link SuperMap.ThemeLabel})的一种,其中矩阵标签中的填充元素又可分为图片类型({@link SuperMap.LabelImageCell})、
  27571. * 符号类型({@link SuperMap.LabelSymbolCell})、专题图类型({@link SuperMap.LabelThemeCell})三种,该类是这三种类型的矩阵标签元素其中的一种,
  27572. * 用于定义符号类型的矩阵标签,如符号 ID 字段名称(符号 ID 与 SuperMap 桌面产品中点、线、面符号的 ID 对应) 、大小等。
  27573. * 用户在实现矩阵标签专题图时只需将定义好的矩阵标签元素赋值予 {@link SuperMap.ThemeLabel.matrixCells} 属性即可。matrixCells 属是一个二维数组,
  27574. * 每一维可以是任意类型的矩阵标签元素组成的数组(也可是单个标签元素组成的数组,即数组中只有一个元素)。
  27575. * @extends {SuperMap.LabelMatrixCell}
  27576. * @param {Object} options -参数。
  27577. * @param {SuperMap.ThemeLabel} options.themeLabel - 使用专题图对象作为矩阵标签的一个元素。
  27578. */
  27579. class LabelThemeCell extends LabelMatrixCell {
  27580. constructor(options) {
  27581. super(options);
  27582. /**
  27583. * @member {SuperMap.ThemeLabel} SuperMap.LabelThemeCell.prototype.themeLabel
  27584. * @description 使用专题图对象作为矩阵标签的一个元素。
  27585. */
  27586. this.themeLabel = new ThemeLabel();
  27587. /**
  27588. * @member {string} SuperMap.LabelThemeCell.prototype.type
  27589. * @description 制作矩阵专题图时是必须的。
  27590. */
  27591. this.type = "THEME";
  27592. if (options) {
  27593. Util.extend(this, options);
  27594. }
  27595. this.CLASS_NAME = " SuperMap.LabelThemeCell";
  27596. }
  27597. /**
  27598. * @function SuperMap.LabelThemeCell.prototype.destroy
  27599. * @description 释放资源,将引用资源的属性置空。
  27600. */
  27601. destroy() {
  27602. var me = this;
  27603. if (me.themeLabel) {
  27604. me.themeLabel.destroy();
  27605. me.themeLabel = null;
  27606. }
  27607. }
  27608. }
  27609. SuperMap.LabelThemeCell = LabelThemeCell;
  27610. ;// CONCATENATED MODULE: ./src/common/iServer/LayerStatus.js
  27611. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27612. * This program are made available under the terms of the Apache License, Version 2.0
  27613. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27614. /**
  27615. * @class SuperMap.LayerStatus
  27616. * @category iServer Map Theme
  27617. * @classdesc 子图层显示参数类。
  27618. * @description 该类存储了各个子图层的名字和是否可见的状态。
  27619. * @param {Object} options - 参数。
  27620. * @param {string} options.layerName - 获取或设置图层名称。
  27621. * @param {boolean} [options.isVisible=true] - 获取或设置图层是否可见,true 表示可见。
  27622. * @param {string} [options.displayFilter] - 图层显示 SQL 过滤条件。
  27623. */
  27624. class LayerStatus {
  27625. constructor(options) {
  27626. /**
  27627. * @member {string} SuperMap.LayerStatus.prototype.layerName
  27628. * @description 获取或设置图层名称。
  27629. */
  27630. this.layerName = null;
  27631. /**
  27632. * @member {boolean} SuperMap.LayerStatus.prototype.isVisible
  27633. * @description 获取或设置图层是否可见,true 表示可见。
  27634. */
  27635. this.isVisible = null;
  27636. /**
  27637. * @member {string} [SuperMap.LayerStatus.prototype.displayFilter]
  27638. * @description 图层显示 SQL 过滤条件,如 layerStatus.displayFilter = "smid < 10",表示仅显示 smid 值小于 10 的对象。
  27639. */
  27640. this.displayFilter = null;
  27641. /**
  27642. * @member {Object} [SuperMap.LayerStatus.prototype.fieldValuesDisplayFilter]
  27643. * @property {Array.<number>} values - 要过滤的值。
  27644. * @property {string} fieldName - 要过滤的字段名称只支持数字类型的字段。
  27645. * @property {string} fieldValuesDisplayMode - 目前有两个 DISPLAY/DISABLE。当为 DISPLAY 时,表示只显示以上设置的相应属性值的要素,否则表示不显示以上设置的相应属性值的要素。
  27646. */
  27647. this.fieldValuesDisplayFilter = null;
  27648. if (options) {
  27649. Util.extend(this, options);
  27650. }
  27651. this.CLASS_NAME = "SuperMap.LayerStatus";
  27652. }
  27653. /**
  27654. * @function SuperMap.LayerStatus.prototype.destroy
  27655. * @description 释放资源,将引用资源的属性置空。
  27656. */
  27657. destroy() {
  27658. var me = this;
  27659. me.layerName = null;
  27660. me.isVisible = null;
  27661. me.displayFilter = null;
  27662. }
  27663. /**
  27664. * @function SuperMap.LayerStatus.prototype.toJSON
  27665. * @description 生成对应的 JSON。
  27666. * @returns {Object} 对应的 JSON。
  27667. */
  27668. toJSON() {
  27669. var json = '{';
  27670. json += '"type":"UGC",';
  27671. var v = [];
  27672. if (this.layerName) {
  27673. v.push('"name":"' + this.layerName + '"');
  27674. v.push('"visible":' + this.isVisible);
  27675. }
  27676. if (this.displayFilter) {
  27677. v.push('"displayFilter":"' + this.displayFilter + '"');
  27678. }
  27679. if (this.minScale || this.minScale == 0) {
  27680. v.push('"minScale":' + this.minScale);
  27681. }
  27682. if (this.maxScale || this.maxScale == 0) {
  27683. v.push('"maxScale":' + this.maxScale);
  27684. }
  27685. if (this.fieldValuesDisplayFilter) {
  27686. v.push('"fieldValuesDisplayFilter":' + Util.toJSON(this.fieldValuesDisplayFilter));
  27687. }
  27688. json += v;
  27689. json += '}';
  27690. return json;
  27691. }
  27692. }
  27693. SuperMap.LayerStatus = LayerStatus;
  27694. ;// CONCATENATED MODULE: ./src/common/iServer/MapService.js
  27695. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27696. * This program are made available under the terms of the Apache License, Version 2.0
  27697. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27698. /**
  27699. * @class SuperMap.MapService
  27700. * @category iServer Map
  27701. * @classdesc 地图信息服务类。
  27702. * @extends {SuperMap.CommonServiceBase}
  27703. * @example
  27704. * var myMapService = new SuperMap.MapService(url, {
  27705. * eventListeners:{
  27706. * "processCompleted": MapServiceCompleted,
  27707. * "processFailed": MapServiceFailed
  27708. * }
  27709. * });
  27710. *
  27711. * @param {string} url - 服务的访问地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 。
  27712. * @param {Object} options - 参数。
  27713. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  27714. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  27715. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  27716. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  27717. * @param {Object} [options.headers] - 请求头。
  27718. */
  27719. class MapService extends CommonServiceBase {
  27720. constructor(url, options) {
  27721. super(url, options);
  27722. /**
  27723. * @member {string} SuperMap.MapService.prototype.projection
  27724. * @description 根据投影参数获取地图状态信息。如"EPSG:4326"
  27725. */
  27726. this.projection = null;
  27727. this.CLASS_NAME = "SuperMap.MapService";
  27728. if (options) {
  27729. Util.extend(this, options);
  27730. }
  27731. var me = this;
  27732. if (me.projection) {
  27733. var arr = me.projection.split(":");
  27734. if (arr instanceof Array) {
  27735. if (arr.length === 2) {
  27736. me.url = Util.urlAppend(me.url,`prjCoordSys=${encodeURIComponent(`{\"epsgCode\":"${arr[1]}"}`)}`)
  27737. }
  27738. if (arr.length === 1) {
  27739. me.url = Util.urlAppend(me.url,`prjCoordSys=${encodeURIComponent(`{\"epsgCode\":"${arr[0]}"}`)}`)
  27740. }
  27741. }
  27742. }
  27743. }
  27744. /**
  27745. * @function destroy
  27746. * @description 释放资源,将引用的资源属性置空。
  27747. */
  27748. destroy() {
  27749. super.destroy();
  27750. var me = this;
  27751. if (me.events) {
  27752. me.events.un(me.eventListeners);
  27753. me.events.listeners = null;
  27754. me.events.destroy();
  27755. me.events = null;
  27756. me.eventListeners = null;
  27757. }
  27758. }
  27759. /**
  27760. * @function SuperMap.MapService.prototype.processAsync
  27761. * @description 负责将客户端的设置的参数传递到服务端,与服务端完成异步通讯。
  27762. */
  27763. processAsync() {
  27764. var me = this;
  27765. me.request({
  27766. method: "GET",
  27767. scope: me,
  27768. success: me.serviceProcessCompleted,
  27769. failure: me.serviceProcessFailed
  27770. });
  27771. }
  27772. /*
  27773. * Method: getMapStatusCompleted
  27774. * 获取地图状态完成,执行此方法。
  27775. *
  27776. * Parameters:
  27777. * {Object} result - 服务器返回的结果对象。
  27778. */
  27779. serviceProcessCompleted(result) {
  27780. var me = this;
  27781. result = Util.transformResult(result);
  27782. var codeStatus = (result.code >= 200 && result.code < 300) || result.code == 0 || result.code === 304;
  27783. var isCodeValid = result.code && codeStatus;
  27784. if (!result.code || isCodeValid) {
  27785. me.events && me.events.triggerEvent("processCompleted", {result: result});
  27786. } else {
  27787. ////在没有token是返回的是200,但是其实是没有权限,所以这里也应该是触发失败事件
  27788. me.events.triggerEvent("processFailed", {error: result});
  27789. }
  27790. }
  27791. }
  27792. SuperMap.MapService = MapService;
  27793. ;// CONCATENATED MODULE: ./src/common/iServer/MathExpressionAnalysisParameters.js
  27794. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27795. * This program are made available under the terms of the Apache License, Version 2.0
  27796. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27797. /**
  27798. * @class SuperMap.MathExpressionAnalysisParameters
  27799. * @category iServer SpatialAnalyst GridMathAnalyst
  27800. * @classdesc 栅格代数运算参数类。
  27801. * @param {Object} options - 参数。
  27802. * @param {string} options.dataset - 要用来做栅格代数运算数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示,例如:BaseMap_P@Jingjin。
  27803. * @param {string} options.resultGridName - 指定结果数据集名称。
  27804. * @param {string} options.expression - 指定的栅格运算表达式。如:[DatasourceAlias1.Raster1]*2-10。
  27805. * @param {string} options.targetDatasource - 指定存储结果数据集的数据源。
  27806. * @param {(SuperMap.Geometry.Polygon|L.Polygon|ol.geom.Polygon)} [options.extractRegion] - 栅格代数运算的范围,指定数据集中参与栅格代数运算的区域。
  27807. * 如果缺省,则计算全部区域,如果参与运算的数据集范围不一致,将使用所有数据集的范围的交集作为计算区域 。
  27808. * @param {boolean} [options.isZip=false] - 是否对结果数据集进行压缩处理。
  27809. * @param {boolean} [options.ignoreNoValue=false] - 是否忽略无值栅格数据。true 表示忽略无值数据,即无值栅格不参与运算。
  27810. * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  27811. */
  27812. class MathExpressionAnalysisParameters {
  27813. constructor(options) {
  27814. if (!options) {
  27815. return;
  27816. }
  27817. /**
  27818. * @member {string} SuperMap.MathExpressionAnalysisParameters.prototype.dataset
  27819. * @description 要用来做栅格代数运算数据源中数据集的名称。
  27820. * 该名称用形如"数据集名称@数据源别名"形式来表示,例如:JingjinTerrain@Jingjin。
  27821. *
  27822. */
  27823. this.dataset = null;
  27824. /**
  27825. * @member {(SuperMap.Geometry.Polygon|L.Polygon|ol.geom.Polygon)} [SuperMap.MathExpressionAnalysisParameters.prototype.extractRegion]
  27826. * @description 栅格代数运算的范围,指定数据集中参与栅格代数运算的区域。
  27827. * 如果缺省,则计算全部区域,如果参与运算的数据集范围不一致,将使用所有数据集的范围的交集作为计算区域 。
  27828. */
  27829. this.extractRegion = null;
  27830. /**
  27831. * @member {string} SuperMap.MathExpressionAnalysisParameters.prototype.expression
  27832. * @description 指定的栅格运算表达式。如:"[DatasourceAlias1.Raster1]*2-10"。
  27833. */
  27834. this.expression = null;
  27835. /**
  27836. * @member {boolean} [SuperMap.MathExpressionAnalysisParameters.prototype.isZip=false]
  27837. * @description 是否对结果数据集进行压缩处理。
  27838. */
  27839. this.isZip = false;
  27840. /**
  27841. * @member {boolean} [SuperMap.MathExpressionAnalysisParameters.prototype.ignoreNoValue=false]
  27842. * @description 是否忽略无值栅格数据。
  27843. */
  27844. this.ignoreNoValue = false;
  27845. /**
  27846. * @member {string} SuperMap.MathExpressionAnalysisParameters.prototype.targetDatasource
  27847. * @description 指定存储结果数据集的数据源。
  27848. */
  27849. this.targetDatasource = null;
  27850. /**
  27851. * @member {string} SuperMap.MathExpressionAnalysisParameters.prototype.resultGridName
  27852. * @description 指定结果数据集名称。
  27853. */
  27854. this.resultGridName = null;
  27855. /**
  27856. * @member {boolean} [SuperMap.MathExpressionAnalysisParameters.prototype.deleteExistResultDataset=false]
  27857. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  27858. */
  27859. this.deleteExistResultDataset = false;
  27860. Util.extend(this, options);
  27861. this.CLASS_NAME = "SuperMap.MathExpressionAnalysisParameters"
  27862. }
  27863. /**
  27864. * @function SuperMap.MathExpressionAnalysisParameters.prototype.destroy
  27865. * @description 释放资源,将引用资源的属性置空。
  27866. */
  27867. destroy() {
  27868. var me = this;
  27869. me.dataset = null;
  27870. me.bounds = null;
  27871. me.expression = null;
  27872. me.isZip = true;
  27873. me.ignoreNoValue = true;
  27874. me.targetDatasource = null;
  27875. me.resultGridName = null;
  27876. me.deleteExistResultDataset = null;
  27877. }
  27878. /**
  27879. * @function SuperMap.MathExpressionAnalysisParameters.toObject
  27880. * @param {Object} mathExpressionAnalysisParameters - 栅格代数运算参数。
  27881. * @param {Object} tempObj - 目标对象。
  27882. * @description 生成栅格代数运算对象。
  27883. */
  27884. static toObject(mathExpressionAnalysisParameters, tempObj) {
  27885. for (var name in mathExpressionAnalysisParameters) {
  27886. if (name !== "dataset") {
  27887. tempObj[name] = mathExpressionAnalysisParameters[name];
  27888. }
  27889. if (name === "extractRegion") {
  27890. if (mathExpressionAnalysisParameters[name]) {
  27891. var bs = mathExpressionAnalysisParameters[name].components[0].components;
  27892. var region = {},
  27893. points = [],
  27894. type = "REGION";
  27895. var len = bs.length;
  27896. for (var i = 0; i < len - 1; i++) {
  27897. var poi = {};
  27898. poi["x"] = bs[i].x;
  27899. poi["y"] = bs[i].y;
  27900. points.push(poi);
  27901. }
  27902. region["points"] = points;
  27903. region["type"] = type;
  27904. tempObj[name] = region;
  27905. }
  27906. }
  27907. }
  27908. }
  27909. }
  27910. SuperMap.MathExpressionAnalysisParameters = MathExpressionAnalysisParameters;
  27911. ;// CONCATENATED MODULE: ./src/common/iServer/MathExpressionAnalysisService.js
  27912. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27913. * This program are made available under the terms of the Apache License, Version 2.0
  27914. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27915. /**
  27916. * @class SuperMap.MathExpressionAnalysisService
  27917. * @category iServer SpatialAnalyst GridMathAnalyst
  27918. * @classdesc 栅格代数运算服务类。
  27919. * @param {string} url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst
  27920. * @param {Object} options - 参数。</br>
  27921. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  27922. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  27923. * @param {Object} [options.headers] - 请求头。
  27924. * @extends {SuperMap.SpatialAnalystBase}
  27925. * @example 例如:
  27926. * (start code)
  27927. * var myMathExpressionAnalysisService = new SuperMap.MathExpressionAnalysisService(url);
  27928. * myMathExpressionAnalysisService.on({
  27929. * "processCompleted": processCompleted,
  27930. * "processFailed": processFailed
  27931. * }
  27932. * );
  27933. * (end)
  27934. *
  27935. */
  27936. class MathExpressionAnalysisService extends SpatialAnalystBase {
  27937. constructor(url, options) {
  27938. super(url, options);
  27939. this.CLASS_NAME = "SuperMap.MathExpressionAnalysisService";
  27940. }
  27941. /**
  27942. * @override
  27943. */
  27944. destroy() {
  27945. super.destroy();
  27946. }
  27947. /**
  27948. * @function SuperMap.MathExpressionAnalysisService.prototype.processAsync
  27949. * @description 负责将客户端的查询参数传递到服务端。
  27950. * @param {SuperMap.MathExpressionAnalysisParameters} parameter - 栅格代数运算参数类。
  27951. */
  27952. processAsync(parameter) {
  27953. var me = this;
  27954. var parameterObject = {};
  27955. if (parameter instanceof MathExpressionAnalysisParameters) {
  27956. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/mathanalyst');
  27957. }
  27958. MathExpressionAnalysisParameters.toObject(parameter, parameterObject);
  27959. var jsonParameters = Util.toJSON(parameterObject);
  27960. me.url = Util.urlAppend(me.url, 'returnContent=true');
  27961. me.request({
  27962. method: "POST",
  27963. data: jsonParameters,
  27964. scope: me,
  27965. success: me.serviceProcessCompleted,
  27966. failure: me.serviceProcessFailed
  27967. });
  27968. }
  27969. }
  27970. SuperMap.MathExpressionAnalysisService = MathExpressionAnalysisService;
  27971. ;// CONCATENATED MODULE: ./src/common/iServer/MeasureParameters.js
  27972. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27973. * This program are made available under the terms of the Apache License, Version 2.0
  27974. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27975. /**
  27976. * @class SuperMap.MeasureParameters
  27977. * @category iServer Map Measure
  27978. * @classdesc 量算参数类。
  27979. * @param {Object} geometry - 要量算的几何对象。
  27980. * @param {Object} options - 参数。
  27981. * @param {SuperMap.Unit} [options.unit=SuperMap.Unit.METER] - 量算单位。
  27982. * @param {string} [options.prjCoordSys] - 用来指定该量算操作所使用的投影。
  27983. * @param {string} [options.distanceMode="Geodesic"] - 用来指定量算的方式为按球面长度 'Geodesic' 或者平面长度 'Planar' 来计算。
  27984. */
  27985. class MeasureParameters {
  27986. constructor(geometry, options) {
  27987. if (!geometry) {
  27988. return;
  27989. }
  27990. /**
  27991. * @member {Object} SuperMap.MeasureParameters.prototype.geometry
  27992. * @description 要量算的几何对象。<br>
  27993. * 点类型可以是:{@link SuperMap.Geometry.Point}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}。<br>
  27994. * 线类型可以是:{@link SuperMap.Geometry.LineString}|{@link SuperMap.Geometry.LinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}。<br>
  27995. * 面类型可以是:{@link SuperMap.Geometry.Polygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}。
  27996. */
  27997. this.geometry = geometry;
  27998. /**
  27999. * @member {SuperMap.Unit} [SuperMap.MeasureParameters.prototype.unit=SuperMap.Unit.METER]
  28000. * @description 量算单位。即量算结果以米为单位。
  28001. */
  28002. this.unit = Unit.METER;
  28003. /**
  28004. * @member {string} [SuperMap.MeasureParameters.prototype.prjCoordSys]
  28005. * @description 用来指定该量算操作所使用的投影。
  28006. */
  28007. this.prjCoordSys = null;
  28008. /**
  28009. * @member {string} [SuperMap.MeasureParameters.prototype.distanceMode="Geodesic"]
  28010. * @description 用来指定量算的方式为按球面长度 'Geodesic' 或者平面长度 'Planar' 来计算。
  28011. * @example
  28012. * var param = new SuperMap.MeasureParameters(getmetry,{distanceMode:'Planar'});
  28013. */
  28014. this.distanceMode = null;
  28015. if (options) {
  28016. Util.extend(this, options);
  28017. }
  28018. this.CLASS_NAME = "SuperMap.MeasureParameters";
  28019. }
  28020. /**
  28021. * @function SuperMap.MeasureParameters.prototype.destroy
  28022. * @description 释放资源,将引用资源的属性置空。
  28023. */
  28024. destroy() {
  28025. var me = this;
  28026. me.geometry = null;
  28027. me.unit = null;
  28028. me.prjCoordSys = null;
  28029. }
  28030. }
  28031. SuperMap.MeasureParameters = MeasureParameters;
  28032. ;// CONCATENATED MODULE: ./src/common/iServer/MeasureService.js
  28033. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28034. * This program are made available under the terms of the Apache License, Version 2.0
  28035. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28036. /**
  28037. * @class SuperMap.MeasureService
  28038. * @category iServer Map Measure
  28039. * @classdesc 量算服务类。
  28040. * 该类负责将量算参数传递到服务端,并获取服务端返回的量算结果。
  28041. * @extends {SuperMap.CommonServiceBase}
  28042. * @example
  28043. * var myMeasuerService = new SuperMap.MeasureService(url, {
  28044. * measureMode: SuperMap.MeasureMode.DISTANCE,
  28045. * eventListeners:{
  28046. * "processCompleted": measureCompleted
  28047. * }
  28048. * });
  28049. * @param {string} url - 服务访问的地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 。
  28050. * @param {Object} options - 参数。
  28051. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  28052. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  28053. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  28054. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28055. * @param {Object} [options.headers] - 请求头。
  28056. * @param {MeasureMode} options.measureMode - 量算模式,包括距离量算模式和面积量算模式。
  28057. */
  28058. class MeasureService extends CommonServiceBase {
  28059. constructor(url, options) {
  28060. super(url, options);
  28061. /**
  28062. * @member {SuperMap.MeasureMode} [SuperMap.MeasureService.prototype.measureMode=MeasureMode.DISTANCE]
  28063. * @description 量算模式,包括距离量算模式和面积量算模式。
  28064. */
  28065. this.measureMode = MeasureMode.DISTANCE;
  28066. if (options) {
  28067. Util.extend(this, options);
  28068. }
  28069. this.CLASS_NAME = "SuperMap.MeasureService";
  28070. }
  28071. /**
  28072. * @override
  28073. */
  28074. destroy() {
  28075. super.destroy();
  28076. var me = this;
  28077. me.measureMode = null;
  28078. }
  28079. /**
  28080. * @function SuperMap.MeasureService.prototype.processAsync
  28081. * @description 负责将客户端的量算参数传递到服务端。
  28082. * @param {SuperMap.MeasureParameters} params - 量算参数。
  28083. */
  28084. processAsync(params) {
  28085. if (!(params instanceof MeasureParameters)) {
  28086. return;
  28087. }
  28088. var me = this,
  28089. geometry = params.geometry,
  28090. pointsCount = 0,
  28091. point2ds = null;
  28092. if (!geometry) {
  28093. return;
  28094. }
  28095. me.url = Util.urlPathAppend(me.url, me.measureMode === MeasureMode.AREA ? 'area' : 'distance');
  28096. var serverGeometry = ServerGeometry.fromGeometry(geometry);
  28097. if (!serverGeometry) {
  28098. return;
  28099. }
  28100. pointsCount = serverGeometry.parts[0];
  28101. point2ds = serverGeometry.points.splice(0, pointsCount);
  28102. var prjCoordSysTemp, prjCodeTemp, paramsTemp;
  28103. if (params.prjCoordSys) {
  28104. if (typeof (params.prjCoordSys) === "object") {
  28105. prjCodeTemp = params.prjCoordSys.projCode;
  28106. prjCoordSysTemp = '{"epsgCode"' + prjCodeTemp.substring(prjCodeTemp.indexOf(":"), prjCodeTemp.length) + "}";
  28107. } else if (typeof (params.prjCoordSys) === "string") {
  28108. prjCoordSysTemp = '{"epsgCode"' + params.prjCoordSys.substring(params.prjCoordSys.indexOf(":"), params.prjCoordSys.length) + "}";
  28109. }
  28110. paramsTemp = {
  28111. "point2Ds": Util.toJSON(point2ds),
  28112. "unit": params.unit,
  28113. "prjCoordSys": prjCoordSysTemp
  28114. };
  28115. } else {
  28116. paramsTemp = {"point2Ds": Util.toJSON(point2ds), "unit": params.unit};
  28117. }
  28118. me.request({
  28119. method: "GET",
  28120. params: paramsTemp,
  28121. scope: me,
  28122. success: me.serviceProcessCompleted,
  28123. failure: me.serviceProcessFailed
  28124. });
  28125. }
  28126. }
  28127. SuperMap.MeasureService = MeasureService;
  28128. ;// CONCATENATED MODULE: ./src/common/iServer/OverlayAnalystService.js
  28129. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28130. * This program are made available under the terms of the Apache License, Version 2.0
  28131. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28132. /**
  28133. * @class SuperMap.OverlayAnalystService
  28134. * @category iServer SpatialAnalyst OverlayAnalyst
  28135. * @classdesc 叠加分析服务类。
  28136. * 该类负责将客户设置的叠加分析参数传递给服务端,并接收服务端返回的叠加分析结果数据。
  28137. * 叠加分析结果通过该类支持的事件的监听函数参数获取
  28138. * @param {string} url - 服务的访问地址。如http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  28139. * @param {Object} options - 参数。</br>
  28140. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  28141. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28142. * @param {Object} [options.headers] - 请求头。
  28143. * @extends {SuperMap.CommonServiceBase}
  28144. * @example 例如:
  28145. * (start code)
  28146. * var myOverlayAnalystService = new SuperMap.OverlayAnalystService(url, {
  28147. * eventListeners: {
  28148. * "processCompleted": OverlayCompleted,
  28149. * "processFailed": OverlayFailed
  28150. * }
  28151. * });
  28152. * (end)
  28153. */
  28154. class OverlayAnalystService extends SpatialAnalystBase {
  28155. constructor(url, options) {
  28156. super(url, options);
  28157. /**
  28158. * @member {string} SuperMap.OverlayAnalystService.prototype.mode
  28159. * @description 叠加分析类型
  28160. */
  28161. this.mode = null;
  28162. if (options) {
  28163. Util.extend(this, options);
  28164. }
  28165. this.CLASS_NAME = "SuperMap.OverlayAnalystService";
  28166. }
  28167. /**
  28168. * @override
  28169. */
  28170. destroy() {
  28171. super.destroy();
  28172. this.mode = null;
  28173. }
  28174. /**
  28175. * @function SuperMap.OverlayAnalystService.prototype.processAsync
  28176. * @description 负责将客户端的查询参数传递到服务端。
  28177. * @param {SuperMap.OverlayAnalystParameters} parameter - 叠加分析参数类。
  28178. */
  28179. processAsync(parameter) {
  28180. var parameterObject = {};
  28181. var me = this;
  28182. if (parameter instanceof DatasetOverlayAnalystParameters) {
  28183. me.mode = "datasets";
  28184. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.sourceDataset + '/overlay');
  28185. DatasetOverlayAnalystParameters.toObject(parameter, parameterObject);
  28186. } else if (parameter instanceof GeometryOverlayAnalystParameters) {
  28187. me.mode = "geometry";
  28188. //支持传入多个几何要素进行叠加分析
  28189. if(parameter.operateGeometries && parameter.sourceGeometries){
  28190. me.url = Util.urlPathAppend(me.url, 'geometry/overlay/batch');
  28191. me.url = Util.urlAppend(me.url, 'ignoreAnalystParam=true');
  28192. }else {
  28193. me.url = Util.urlPathAppend(me.url, 'geometry/overlay');
  28194. }
  28195. GeometryOverlayAnalystParameters.toObject(parameter, parameterObject);
  28196. }
  28197. me.url = Util.urlAppend(me.url, 'returnContent=true');
  28198. var jsonParameters = Util.toJSON(parameterObject);
  28199. me.request({
  28200. method: "POST",
  28201. data: jsonParameters,
  28202. scope: me,
  28203. success: me.serviceProcessCompleted,
  28204. failure: me.serviceProcessFailed
  28205. });
  28206. }
  28207. }
  28208. SuperMap.OverlayAnalystService = OverlayAnalystService;
  28209. ;// CONCATENATED MODULE: ./src/common/iServer/OverlayGeoJobParameter.js
  28210. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28211. * This program are made available under the terms of the Apache License, Version 2.0
  28212. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28213. /**
  28214. * @class SuperMap.OverlayGeoJobParameter
  28215. * @category iServer ProcessingService OverlayAnalyst
  28216. * @classdesc 叠加分析任务参数类。
  28217. * @param {Object} options - 参数。
  28218. * @param {string} options.datasetName - 数据集名。
  28219. * @param {string} options.datasetOverlay - 叠加对象所在的数据集名称。
  28220. * @param {string} options.srcFields - 输入数据需要保留的字段。
  28221. * @param {string} [options.overlayFields] - 叠加数据需要保留的字段。对分析模式为 clip、update、erase 时,此参数无效。
  28222. * @param {string} [options.mode] - 叠加分析模式。
  28223. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  28224. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  28225. */
  28226. class OverlayGeoJobParameter {
  28227. constructor(options) {
  28228. if (!options) {
  28229. return;
  28230. }
  28231. /**
  28232. * @member {string} SuperMap.OverlayGeoJobParameter.prototype.datasetName
  28233. * @description 数据集名。
  28234. */
  28235. this.datasetName = "";
  28236. /**
  28237. * @member {string} SuperMap.OverlayGeoJobParameter.prototype.datasetOverlay
  28238. * @description 叠加对象所在的数据集名称。
  28239. */
  28240. this.datasetOverlay = "";
  28241. /**
  28242. * @member {string} [SuperMap.OverlayGeoJobParameter.prototype.mode]
  28243. * @description 叠加分析模式。
  28244. */
  28245. this.mode = "";
  28246. /**
  28247. * @member {string} SuperMap.OverlayGeoJobParameter.prototype.srcFields
  28248. * @description 输入数据需要保留的字段。
  28249. */
  28250. this.srcFields = "";
  28251. /**
  28252. * @member {string} SuperMap.OverlayGeoJobParameter.prototype.overlayFields
  28253. * @description 叠加数据需要保留的字段,对分析模式为 clip、update、erase 时,此参数无效。
  28254. */
  28255. this.overlayFields = "";
  28256. /**
  28257. * @member {SuperMap.OutputSetting} [SuperMap.OverlayGeoJobParameter.prototype.output]
  28258. * @description 输出参数设置类。
  28259. */
  28260. this.output = null;
  28261. /**
  28262. * @member {SuperMap.MappingParameters} [SuperMap.OverlayGeoJobParameter.prototype.mappingParameters]
  28263. * @description 分析后结果可视化的参数类。
  28264. */
  28265. this.mappingParameters = null;
  28266. Util.extend(this, options);
  28267. this.CLASS_NAME = "SuperMap.OverlayGeoJobParameter";
  28268. }
  28269. /**
  28270. * @function SuperMap.OverlayGeoJobParameter.destroy
  28271. * @override
  28272. */
  28273. destroy() {
  28274. this.datasetName = null;
  28275. this.datasetOverlay = null;
  28276. this.mode = null;
  28277. this.srcFields = null;
  28278. this.overlayFields = null;
  28279. if (this.output instanceof OutputSetting) {
  28280. this.output.destroy();
  28281. this.output = null;
  28282. }
  28283. if (this.mappingParameters instanceof MappingParameters) {
  28284. this.mappingParameters.destroy();
  28285. this.mappingParameters = null;
  28286. }
  28287. }
  28288. /**
  28289. * @function SuperMap.OverlayGeoJobParameter.toObject
  28290. * @param {Object} OverlayGeoJobParameter - 点聚合分析任务参数。
  28291. * @param {Object} tempObj - 目标对象。
  28292. * @description 生成点聚合分析任务对象。
  28293. */
  28294. static toObject(OverlayGeoJobParameter, tempObj) {
  28295. for (var name in OverlayGeoJobParameter) {
  28296. if (name == "datasetName") {
  28297. tempObj['input'] = tempObj['input'] || {};
  28298. tempObj['input'][name] = OverlayGeoJobParameter[name];
  28299. continue;
  28300. }
  28301. if (name === "output") {
  28302. tempObj['output'] = tempObj['output'] || {};
  28303. tempObj['output'] = OverlayGeoJobParameter[name];
  28304. continue;
  28305. }
  28306. tempObj['analyst'] = tempObj['analyst'] || {};
  28307. tempObj['analyst'][name] = OverlayGeoJobParameter[name];
  28308. if(name === 'mappingParameters'){
  28309. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  28310. tempObj['analyst']['mappingParameters'] = OverlayGeoJobParameter[name];
  28311. }
  28312. }
  28313. }
  28314. }
  28315. SuperMap.OverlayGeoJobParameter = OverlayGeoJobParameter;
  28316. ;// CONCATENATED MODULE: ./src/common/iServer/OverlayGeoJobsService.js
  28317. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28318. * This program are made available under the terms of the Apache License, Version 2.0
  28319. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28320. /**
  28321. * @class SuperMap.OverlayGeoJobsService
  28322. * @category iServer ProcessingService OverlayAnalyst
  28323. * @classdesc 叠加分析任务类。
  28324. * @param {string} url - 叠加分析任务地址。
  28325. * @param {Object} options - 参数。
  28326. * @param {SuperMap.Events} options.events - 处理所有事件的对象。
  28327. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  28328. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  28329. * @param {number} options.index - 服务访问地址在数组中的位置。
  28330. * @param {number} options.length - 服务访问地址数组长度。
  28331. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28332. * @param {Object} [options.headers] - 请求头。
  28333. */
  28334. class OverlayGeoJobsService extends ProcessingServiceBase {
  28335. constructor(url, options) {
  28336. super(url, options);
  28337. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/overlay');
  28338. this.CLASS_NAME = 'SuperMap.OverlayGeoJobsService';
  28339. }
  28340. /**
  28341. * @override
  28342. */
  28343. destroy() {
  28344. super.destroy();
  28345. }
  28346. /**
  28347. * @function SuperMap.OverlayGeoJobsService.prototype.getOverlayGeoJobs
  28348. * @description 获取叠加分析任务
  28349. */
  28350. getOverlayGeoJobs() {
  28351. super.getJobs(this.url);
  28352. }
  28353. /**
  28354. * @function SuperMap.OverlayGeoJobsService.prototype.getOverlayGeoJob
  28355. * @description 获取指定id的叠加分析任务
  28356. * @param {string} id - 指定要获取数据的id
  28357. */
  28358. getOverlayGeoJob(id) {
  28359. super.getJobs(Util.urlPathAppend(this.url, id));
  28360. }
  28361. /**
  28362. * @function SuperMap.OverlayGeoJobsService.prototype.addOverlayGeoJob
  28363. * @description 新建点叠加析服务
  28364. * @param {SuperMap.OverlayGeoJobParameter} params - 创建一个叠加分析的请求参数。
  28365. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  28366. */
  28367. addOverlayGeoJob(params, seconds) {
  28368. super.addJob(this.url, params, OverlayGeoJobParameter, seconds);
  28369. }
  28370. }
  28371. SuperMap.OverlayGeoJobsService = OverlayGeoJobsService;
  28372. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByBoundsParameters.js
  28373. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28374. * This program are made available under the terms of the Apache License, Version 2.0
  28375. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28376. /**
  28377. * @class SuperMap.QueryByBoundsParameters
  28378. * @category iServer Map QueryResults
  28379. * @classdesc Bounds 查询参数类。该类用于设置 Bounds 查询的相关参数。
  28380. * @extends {SuperMap.QueryParameters}
  28381. * @param {Object} options - 参数。
  28382. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} options.bounds - 指定的查询范围。
  28383. * @param {Array.<SuperMap.FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  28384. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  28385. * @param {Object} [options.prjCoordSys] -自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  28386. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  28387. * @param {SuperMap.GeometryType} [options.networkType=SuperMap.GeometryType.LINE] - 网络数据集对应的查询类型。
  28388. * @param {SuperMap.QueryOption} [options.queryOption=SuperMap.QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  28389. * @param {number} [options.startRecord=0] - 查询起始记录号。
  28390. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  28391. * @param {boolean} [options.returnCustomResult=false] - 仅供三维使用。
  28392. * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
  28393. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  28394. */
  28395. class QueryByBoundsParameters extends QueryParameters {
  28396. constructor(options) {
  28397. if (!options) {
  28398. return;
  28399. }
  28400. super(options);
  28401. /**
  28402. * @member {boolean} [SuperMap.QueryByBoundsParameters.prototype.returnContent=true]
  28403. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  28404. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  28405. * 为 false,则返回的是查询结果资源的 URI。
  28406. */
  28407. this.returnContent = true;
  28408. /**
  28409. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.QueryByBoundsParameters.prototype.bounds
  28410. * @description 指定的查询范围。
  28411. */
  28412. this.bounds = null;
  28413. Util.extend(this, options);
  28414. this.CLASS_NAME = "SuperMap.QueryByBoundsParameters";
  28415. }
  28416. /**
  28417. * @function SuperMap.QueryByBoundsParameters.prototype.destroy
  28418. * @description 释放资源,将引用资源的属性置空。
  28419. */
  28420. destroy() {
  28421. super.destroy();
  28422. var me = this;
  28423. me.returnContent = null;
  28424. if (me.bounds) {
  28425. me.bounds = null;
  28426. }
  28427. }
  28428. }
  28429. SuperMap.QueryByBoundsParameters = QueryByBoundsParameters;
  28430. ;// CONCATENATED MODULE: ./src/common/iServer/QueryService.js
  28431. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28432. * This program are made available under the terms of the Apache License, Version 2.0
  28433. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28434. /**
  28435. * @class SuperMap.QueryService
  28436. * @category iServer Map QueryResults
  28437. * @classdesc 查询服务基类。
  28438. * @extends {SuperMap.CommonServiceBase}
  28439. * @param {string} url - 服务地址。请求地图查询服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  28440. * @param {Object} options - 参数。
  28441. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  28442. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  28443. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  28444. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28445. * @param {Object} [options.headers] - 请求头。
  28446. * @example
  28447. * var myService = new SuperMap.QueryService(url, {
  28448. * eventListeners: {
  28449. * "processCompleted": queryCompleted,
  28450. * "processFailed": queryError
  28451. * }
  28452. * };
  28453. */
  28454. class QueryService extends CommonServiceBase {
  28455. /**
  28456. * @function SuperMap.QueryService.prototype.constructor
  28457. * @description 查询服务基类构造函数。
  28458. * @param {string} url - 服务地址。请求地图查询服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  28459. * @param {Object} options -参数。
  28460. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  28461. */
  28462. constructor(url, options) {
  28463. super(url, options);
  28464. /**
  28465. * @member {boolean} SuperMap.QueryService.prototype.returnContent
  28466. * @description 是否立即返回新创建资源的表述还是返回新资源的URI。
  28467. */
  28468. this.returnContent = false;
  28469. /**
  28470. * @member {string} SuperMap.QueryService.prototype.format
  28471. * @description 查询结果返回格式,目前支持iServerJSON 和GeoJSON两种格式。参数格式为"ISERVER","GEOJSON"。
  28472. */
  28473. this.format = DataFormat.GEOJSON;
  28474. this.returnFeatureWithFieldCaption = false;
  28475. if (options) {
  28476. Util.extend(this, options);
  28477. }
  28478. this.CLASS_NAME = "SuperMap.QueryService";
  28479. if (!this.url) {
  28480. return;
  28481. }
  28482. if (options && options.format) {
  28483. this.format = options.format.toUpperCase();
  28484. }
  28485. this.url = Util.urlPathAppend(this.url,'queryResults');
  28486. }
  28487. /**
  28488. * @function SuperMap.QueryService.prototype.destroy
  28489. * @description 释放资源,将引用资源的属性置空。
  28490. */
  28491. destroy() {
  28492. super.destroy();
  28493. var me = this;
  28494. me.returnContent = null;
  28495. me.format = null;
  28496. }
  28497. /**
  28498. * @function SuperMap.QueryService.prototype.processAsync
  28499. * @description 负责将客户端的查询参数传递到服务端。
  28500. * @param {SuperMap.QueryParameters} params - 查询参数。
  28501. */
  28502. processAsync(params) {
  28503. if (!(params instanceof QueryParameters)) {
  28504. return;
  28505. }
  28506. var me = this,
  28507. returnCustomResult = null,
  28508. jsonParameters = null;
  28509. me.returnContent = params.returnContent;
  28510. jsonParameters = me.getJsonParameters(params);
  28511. if (me.returnContent) {
  28512. me.url = Util.urlAppend(me.url, 'returnContent=' + me.returnContent);
  28513. } else {
  28514. //仅供三维使用 获取高亮图片的bounds
  28515. returnCustomResult = params.returnCustomResult;
  28516. if (returnCustomResult) {
  28517. me.url = Util.urlAppend(me.url, 'returnCustomResult=' + returnCustomResult);
  28518. }
  28519. }
  28520. me.returnFeatureWithFieldCaption = params.returnFeatureWithFieldCaption;
  28521. me.request({
  28522. method: "POST",
  28523. data: jsonParameters,
  28524. scope: me,
  28525. success: me.serviceProcessCompleted,
  28526. failure: me.serviceProcessFailed
  28527. });
  28528. }
  28529. /**
  28530. * @function SuperMap.QueryService.prototype.serviceProcessCompleted
  28531. * @description 查询完成,执行此方法。
  28532. * @param {Object} result - 服务器返回的结果对象。
  28533. */
  28534. serviceProcessCompleted(result) {
  28535. var me = this;
  28536. result = Util.transformResult(result);
  28537. var geoJSONFormat = new GeoJSON();
  28538. if (result && result.recordsets) {
  28539. for (var i = 0, recordsets = result.recordsets, len = recordsets.length; i < len; i++) {
  28540. if (recordsets[i].features) {
  28541. if (me.returnFeatureWithFieldCaption === true) {
  28542. recordsets[i].features.map((feature) => {
  28543. feature.fieldNames = recordsets[i].fieldCaptions;
  28544. return feature;
  28545. })
  28546. }
  28547. if (me.format === DataFormat.GEOJSON) {
  28548. recordsets[i].features = geoJSONFormat.toGeoJSON(recordsets[i].features);
  28549. }
  28550. }
  28551. }
  28552. }
  28553. me.events.triggerEvent("processCompleted", {
  28554. result: result
  28555. });
  28556. }
  28557. /**
  28558. * @function SuperMap.QueryService.prototype.getQueryParameters
  28559. * @description 将 JSON 对象表示的查询参数转化为 QueryParameters 对象。
  28560. * @param {Object} params - JSON 字符串表示的查询参数。
  28561. * @returns {SuperMap.QueryParameters} 返回转化后的 QueryParameters 对象。
  28562. */
  28563. getQueryParameters(params) {
  28564. return new QueryParameters({
  28565. customParams: params.customParams,
  28566. expectCount: params.expectCount,
  28567. networkType: params.networkType,
  28568. queryOption: params.queryOption,
  28569. queryParams: params.queryParams,
  28570. startRecord: params.startRecord,
  28571. prjCoordSys: params.prjCoordSys,
  28572. holdTime: params.holdTime
  28573. });
  28574. }
  28575. }
  28576. SuperMap.QueryService = QueryService;
  28577. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByBoundsService.js
  28578. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28579. * This program are made available under the terms of the Apache License, Version 2.0
  28580. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28581. /**
  28582. * @class SuperMap.QueryByBoundsService
  28583. * @category iServer Map QueryResults
  28584. * @classdesc Bounds 查询服务类。
  28585. * @augments {SuperMap.QueryService}
  28586. * @example
  28587. * (start end)
  28588. * var myQueryByBoundsService = new SuperMap.QueryByBoundsService(url, {
  28589. * eventListeners: {
  28590. * "processCompleted": queryCompleted,
  28591. * "processFailed": queryError
  28592. * }
  28593. * });
  28594. * function queryCompleted(object){//todo};
  28595. * function queryError(object){//todo};
  28596. * (end)
  28597. * @param {string} url - 服务的访问地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  28598. * @param {Object} options - 参数。<br>
  28599. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。<br>
  28600. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  28601. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  28602. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28603. * @param {Object} [options.headers] - 请求头。
  28604. */
  28605. class QueryByBoundsService extends QueryService {
  28606. constructor(url, options) {
  28607. super(url, options);
  28608. this.CLASS_NAME = "SuperMap.QueryByBoundsService";
  28609. }
  28610. /**
  28611. * @override
  28612. */
  28613. destroy() {
  28614. super.destroy();
  28615. }
  28616. /**
  28617. * @function SuperMap.QueryByBoundsService.prototype.getJsonParameters
  28618. * @description 将查询参数转化为 JSON 字符串。
  28619. * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds 等)。
  28620. * @param {SuperMap.QueryByBoundsParameters} params - Bounds 查询参数。
  28621. * @returns {Object} 转化后的 JSON 字符串。
  28622. */
  28623. getJsonParameters(params) {
  28624. if (!(params instanceof QueryByBoundsParameters)) {
  28625. return null;
  28626. }
  28627. var me = this,
  28628. jsonParameters = "",
  28629. qp = null,
  28630. bounds = params.bounds;
  28631. qp = me.getQueryParameters(params);
  28632. jsonParameters += "'queryMode':'BoundsQuery','queryParameters':";
  28633. jsonParameters += Util.toJSON(qp);
  28634. jsonParameters += ",'bounds': {'rightTop':{'y':" + bounds.top + ",'x':" +
  28635. bounds.right + "},'leftBottom':{'y':" + bounds.bottom + ",'x':" + bounds.left + "}}";
  28636. jsonParameters = "{" + jsonParameters + "}";
  28637. return jsonParameters;
  28638. }
  28639. }
  28640. SuperMap.QueryByBoundsService = QueryByBoundsService;
  28641. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByDistanceParameters.js
  28642. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28643. * This program are made available under the terms of the Apache License, Version 2.0
  28644. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28645. /**
  28646. * @class SuperMap.QueryByDistanceParameters
  28647. * @category iServer Map QueryResults
  28648. * @classdesc Distance 查询参数类。
  28649. * 该类用于设置 Distance 查询的相关参数。
  28650. * @extends {SuperMap.QueryParameters}
  28651. * @param {Object} options - 参数。
  28652. * @param {Object} options.geometry - 用于查询的几何对象。
  28653. * @param {Array.<SuperMap.FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  28654. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  28655. * @param {Object} [options.prjCoordSys] -自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  28656. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  28657. * @param {SuperMap.GeometryType} [options.networkType=SuperMap.GeometryType.LINE] - 网络数据集对应的查询类型。
  28658. * @param {SuperMap.QueryOption} [options.queryOption=SuperMap.QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  28659. * @param {number} [options.startRecord=0] - 查询起始记录号。
  28660. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  28661. * @param {boolean} [options.returnCustomResult=false] -仅供三维使用。
  28662. * @param {number} [options.distance=0] - 查询距离。
  28663. * @param {boolean} [options.isNearest=false] - 是否为最近距离查询。
  28664. * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
  28665. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  28666. */
  28667. class QueryByDistanceParameters extends QueryParameters {
  28668. constructor(options) {
  28669. if (!options) {
  28670. return;
  28671. }
  28672. super(options);
  28673. /**
  28674. * @member {number} [SuperMap.QueryByDistanceParameters.prototype.distance=0]
  28675. * @description 查询距离,单位与所查询图层对应的数据集单位相同。
  28676. * 当查找最近地物时,该属性无效。
  28677. */
  28678. this.distance = 0;
  28679. /**
  28680. * @member SuperMap.QueryByDistanceParameters.prototype.geometry
  28681. * @description 用于查询的地理对象。<br>
  28682. * 点类型可以是:{@link SuperMap.Geometry.Point}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}。<br>
  28683. * 线类型可以是:{@link SuperMap.Geometry.LineString}|{@link SuperMap.Geometry.LinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}。<br>
  28684. * 面类型可以是:{@link SuperMap.Geometry.Polygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}。
  28685. */
  28686. this.geometry = null;
  28687. /**
  28688. * @member {boolean} [SuperMap.QueryByDistanceParameters.prototype.isNearest=false]
  28689. * @description 是否为最近距离查询。<br>
  28690. * 建议该属性与 expectCount(继承自 {@link SuperMap.QueryParameters})属性联合使用。
  28691. * 当该属性为 true 时,即表示查找最近地物,如果查询结果数大于期望返回的结果记录数(expectCount),
  28692. * 则查找结果为查询总记录中距离中心最近的 expectCount 个地物。
  28693. * 当该属性为不为 true 时,如果查询结果数大于期望返回的结果记录数(expectCount),
  28694. * 则查找结果为从查询总记录中随机抽取的 expectCount 个地物。
  28695. * 目前查询结果不支持按远近距离排序。
  28696. */
  28697. this.isNearest = null;
  28698. /**
  28699. * @member {boolean} [SuperMap.QueryByDistanceParameters.prototype.returnContent=true]
  28700. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  28701. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  28702. * 为 false,则返回的是查询结果资源的 URI。
  28703. */
  28704. this.returnContent = true;
  28705. Util.extend(this, options);
  28706. this.CLASS_NAME = "SuperMap.QueryByDistanceParameters";
  28707. }
  28708. /**
  28709. * @function SuperMap.QueryByDistanceParameters.prototype.destroy
  28710. * @description 释放资源,将引用资源的属性置空。
  28711. */
  28712. destroy() {
  28713. super.destroy();
  28714. var me = this;
  28715. me.returnContent = null;
  28716. me.distance = null;
  28717. me.isNearest = null;
  28718. if (me.geometry) {
  28719. me.geometry.destroy();
  28720. me.geometry = null;
  28721. }
  28722. }
  28723. }
  28724. SuperMap.QueryByDistanceParameters = QueryByDistanceParameters;
  28725. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByDistanceService.js
  28726. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28727. * This program are made available under the terms of the Apache License, Version 2.0
  28728. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28729. /**
  28730. * @class SuperMap.QueryByDistanceService
  28731. * @category iServer Map QueryResults
  28732. * @classdesc Distance查询服务类。
  28733. * @extends {SuperMap.QueryService}
  28734. * @example
  28735. * var myQueryByDistService = new SuperMap.QueryByDistanceService(url, {
  28736. * eventListeners: {
  28737. * "processCompleted": queryCompleted,
  28738. * "processFailed": queryError
  28739. * }
  28740. * });
  28741. * function queryCompleted(object){//todo};
  28742. * function queryError(object){//todo};
  28743. * @param {string} url - 服务的访问地址。如访问World Map服务,只需将url设为:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  28744. * @param {Object} options - 参数。
  28745. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  28746. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  28747. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  28748. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28749. * @param {Object} [options.headers] - 请求头。
  28750. */
  28751. class QueryByDistanceService extends QueryService {
  28752. constructor(url, options) {
  28753. super(url, options);
  28754. this.CLASS_NAME = "SuperMap.QueryByDistanceService";
  28755. }
  28756. /**
  28757. * @override
  28758. */
  28759. destroy() {
  28760. super.destroy();
  28761. }
  28762. /**
  28763. * @function SuperMap.QueryByDistanceService.prototype.getJsonParameters
  28764. * @description 将查询参数转化为 JSON 字符串。
  28765. * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds等)。
  28766. * @param {SuperMap.QueryByDistanceParameters} params - Distance 查询参数类。
  28767. * @returns {Object} 转化后的 JSON 字符串。
  28768. */
  28769. getJsonParameters(params) {
  28770. if (!(params instanceof QueryByDistanceParameters)) {
  28771. return;
  28772. }
  28773. var me = this,
  28774. jsonParameters = "",
  28775. qp = me.getQueryParameters(params);
  28776. var sg = ServerGeometry.fromGeometry(params.geometry);
  28777. jsonParameters += params.isNearest ? "'queryMode':'FindNearest','queryParameters':" : "'queryMode':'DistanceQuery','queryParameters':";
  28778. jsonParameters += Util.toJSON(qp);
  28779. jsonParameters += ",'geometry':" + Util.toJSON(sg) + ",'distance':" + params.distance;
  28780. jsonParameters = "{" + jsonParameters + "}";
  28781. return jsonParameters;
  28782. }
  28783. }
  28784. SuperMap.QueryByDistanceService = QueryByDistanceService;
  28785. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByGeometryParameters.js
  28786. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28787. * This program are made available under the terms of the Apache License, Version 2.0
  28788. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28789. /**
  28790. * @class SuperMap.QueryByGeometryParameters
  28791. * @category iServer Map QueryResults
  28792. * @classdesc Geometry 查询参数类。
  28793. * 该类用于设置 Geometry查询的相关参数。
  28794. * @extends {SuperMap.QueryParameters}
  28795. * @param {Object} options - 参数。
  28796. * @param {Array.<SuperMap.FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  28797. * @param {Object} options.geometry - 用于查询的几何对象。
  28798. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  28799. * @param {SuperMap.QueryOption} [options.queryOption=SuperMap.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  28800. * @param {Object} [options.prjCoordSys] -自定义参数,供SuperMap Online提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  28801. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  28802. * @param {SuperMap.GeometryType} [options.networkType=SuperMap.GeometryType.LINE] - 网络数据集对应的查询类型。
  28803. * @param {boolean} [options.returnCustomResult=false] -仅供三维使用。
  28804. * @param {number} [options.startRecord=0] - 查询起始记录号。
  28805. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  28806. * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
  28807. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  28808. * @param {SuperMap.SpatialQueryMode} [spatialQueryMode=SuperMap.SpatialQueryMode.INTERSECT] - 空间查询模式。
  28809. */
  28810. class QueryByGeometryParameters extends QueryParameters {
  28811. constructor(options) {
  28812. if (!options) {
  28813. return;
  28814. }
  28815. super(options);
  28816. /**
  28817. * @member {boolean} [SuperMap.QueryByGeometryParameters.prototype.returnContent=true]
  28818. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。<br>
  28819. * 如果为 true,则直接返回新创建资源,即查询结果的表述。<br>
  28820. * 为 false,则返回的是查询结果资源的 URI。
  28821. */
  28822. this.returnContent = true;
  28823. /**
  28824. * @member {Object} SuperMap.QueryByGeometryParameters.prototype.geometry
  28825. * @description 用于查询的几何对象。<br>
  28826. * 点类型可以是:{@link SuperMap.Geometry.Point}|{@link L.Marker}|{@link L.CircleMarker}|{@link L.Circle}|{@link L.GeoJSON}|{@link ol.geom.Point}|{@link ol.format.GeoJSON}。<br>
  28827. * 线类型可以是:{@link SuperMap.Geometry.LineString}|{@link SuperMap.Geometry.LinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}。<br>
  28828. * 面类型可以是:{@link SuperMap.Geometry.Polygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}。
  28829. */
  28830. this.geometry = null;
  28831. /**
  28832. * @member {SuperMap.SpatialQueryMode} [SuperMap.QueryByGeometryParameters.prototype.spatialQueryMode=SuperMap.SpatialQueryMode.INTERSECT]
  28833. * @description 空间查询模式。
  28834. */
  28835. this.spatialQueryMode = SpatialQueryMode.INTERSECT;
  28836. Util.extend(this, options);
  28837. this.CLASS_NAME = "SuperMap.QueryByGeometryParameters";
  28838. }
  28839. /**
  28840. * @function SuperMap.QueryByGeometryParameters.prototype.destroy
  28841. * @description 释放资源,将引用资源的属性置空。
  28842. */
  28843. destroy() {
  28844. super.destroy();
  28845. var me = this;
  28846. me.returnContent = null;
  28847. me.geometry = null;
  28848. me.spatialQueryMode = null;
  28849. }
  28850. }
  28851. SuperMap.QueryByGeometryParameters = QueryByGeometryParameters;
  28852. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByGeometryService.js
  28853. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28854. * This program are made available under the terms of the Apache License, Version 2.0
  28855. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28856. /**
  28857. * @class SuperMap.QueryByGeometryService
  28858. * @category iServer Map QueryResults
  28859. * @classdesc Geometry查询服务类。
  28860. * @extends {SuperMap.QueryService}
  28861. * @example
  28862. * var myQueryByGeometryService = new SuperMap.QueryByGeometryService(url, {
  28863. * eventListeners: {
  28864. * "processCompleted": queryCompleted,
  28865. * "processFailed": queryError
  28866. * }
  28867. * });
  28868. * function queryCompleted(object){//todo};
  28869. * function queryError(object){//todo};
  28870. * @param {string} url - 服务的访问地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  28871. * @param {Object} options - 参数。
  28872. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  28873. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  28874. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  28875. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28876. * @param {Object} [options.headers] - 请求头。
  28877. */
  28878. class QueryByGeometryService extends QueryService {
  28879. /**
  28880. * @function SuperMap.QueryByGeometryService.prototype.constructor
  28881. * @description Geometry 查询服务类构造函数。
  28882. * @param {string} url - 服务的访问地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  28883. * @param {Object} options - 参数。
  28884. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  28885. */
  28886. constructor(url, options) {
  28887. super(url, options);
  28888. this.CLASS_NAME = "SuperMap.QueryByGeometryService";
  28889. }
  28890. /**
  28891. * @override
  28892. */
  28893. destroy() {
  28894. super.destroy();
  28895. }
  28896. /**
  28897. * @function SuperMap.QueryByGeometryService.prototype.getJsonParameters
  28898. * @description 将查询参数转化为 JSON 字符串。
  28899. * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds等)。
  28900. * @param {SuperMap.QueryByGeometryParameters} params - Geometry 查询参数类。
  28901. * @returns {Object} 转化后的 JSON 字符串。
  28902. */
  28903. getJsonParameters(params) {
  28904. if (!(params instanceof QueryByGeometryParameters)) {
  28905. return;
  28906. }
  28907. var me = this,
  28908. jsonParameters = "",
  28909. qp = null,
  28910. geometry = params.geometry,
  28911. sg = ServerGeometry.fromGeometry(geometry);
  28912. qp = me.getQueryParameters(params);
  28913. jsonParameters += "'queryMode':'SpatialQuery','queryParameters':";
  28914. jsonParameters += Util.toJSON(qp) + ",'geometry':" + Util.toJSON(sg)
  28915. + ",'spatialQueryMode':" + Util.toJSON(params.spatialQueryMode);
  28916. jsonParameters = "{" + jsonParameters + "}";
  28917. return jsonParameters;
  28918. }
  28919. }
  28920. SuperMap.QueryByGeometryService = QueryByGeometryService;
  28921. ;// CONCATENATED MODULE: ./src/common/iServer/QueryBySQLParameters.js
  28922. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28923. * This program are made available under the terms of the Apache License, Version 2.0
  28924. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28925. /**
  28926. * @class SuperMap.QueryBySQLParameters
  28927. * @category iServer Map QueryResults
  28928. * @classdesc SQL 查询参数类。
  28929. * 该类用于设置 SQL 查询的相关参数。
  28930. * @extends {SuperMap.QueryParameters}
  28931. * @param {Object} options - 参数。
  28932. * @param {Array.<SuperMap.FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  28933. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  28934. * @param {Object} [options.prjCoordSys] - 自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  28935. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  28936. * @param {SuperMap.GeometryType} [options.networkType=SuperMap.GeometryType.LINE] - 网络数据集对应的查询类型。
  28937. * @param {SuperMap.QueryOption} [options.queryOption=SuperMap.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  28938. * @param {number} [options.startRecord=0] - 查询起始记录号。
  28939. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  28940. * @param {boolean} [options.returnCustomResult=false] - 仅供三维使用。
  28941. * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
  28942. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  28943. */
  28944. class QueryBySQLParameters extends QueryParameters {
  28945. constructor(options) {
  28946. if (!options) {
  28947. return;
  28948. }
  28949. super(options);
  28950. /**
  28951. * @member {boolean} [SuperMap.QueryBySQLParameters.prototype.returnContent=true]
  28952. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  28953. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  28954. * 为 false,则返回的是查询结果资源的 URI。
  28955. */
  28956. this.returnContent = true;
  28957. Util.extend(this, options);
  28958. this.CLASS_NAME = "SuperMap.QueryBySQLParameters";
  28959. }
  28960. /**
  28961. * @function SuperMap.QueryBySQLParameters.prototype.destroy
  28962. * @description 释放资源,将引用资源的属性置空。
  28963. */
  28964. destroy() {
  28965. super.destroy();
  28966. var me = this;
  28967. me.returnContent = null;
  28968. }
  28969. }
  28970. SuperMap.QueryBySQLParameters = QueryBySQLParameters;
  28971. ;// CONCATENATED MODULE: ./src/common/iServer/QueryBySQLService.js
  28972. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28973. * This program are made available under the terms of the Apache License, Version 2.0
  28974. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28975. /**
  28976. * @class SuperMap.QueryBySQLService
  28977. * @category iServer Map QueryResults
  28978. * @classdesc SQL 查询服务类。在一个或多个指定的图层上查询符合 SQL 条件的空间地物信息。
  28979. * @extends {SuperMap.QueryService}
  28980. * @example
  28981. * var queryParam = new SuperMap.FilterParameter({
  28982. * name: "Countries@World.1",
  28983. * attributeFilter: "Pop_1994>1000000000 and SmArea>900"
  28984. * });
  28985. * var queryBySQLParams = new SuperMap.QueryBySQLParameters({
  28986. * queryParams: [queryParam]
  28987. * });
  28988. * var myQueryBySQLService = new SuperMap.QueryBySQLService(url, {eventListeners: {
  28989. * "processCompleted": queryCompleted,
  28990. * "processFailed": queryError
  28991. * }
  28992. * });
  28993. * queryBySQLService.processAsync(queryBySQLParams);
  28994. * function queryCompleted(object){//todo};
  28995. * function queryError(object){//todo};
  28996. * @param {string} url - 服务的访问地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  28997. * @param {Object} options - 参数。
  28998. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  28999. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  29000. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  29001. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  29002. * @param {Object} [options.headers] - 请求头。
  29003. */
  29004. class QueryBySQLService extends QueryService {
  29005. /**
  29006. * @function SuperMap.QueryBySQLService.prototype.constructor
  29007. * @description SQL 查询服务类构造函数。
  29008. * @param {string} url - 服务的访问地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  29009. * @param {Object} options - 参数。
  29010. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  29011. */
  29012. constructor(url, options) {
  29013. super(url, options);
  29014. this.CLASS_NAME = "SuperMap.QueryBySQLService";
  29015. }
  29016. /**
  29017. * @override
  29018. */
  29019. destroy() {
  29020. super.destroy();
  29021. }
  29022. /**
  29023. * @function SuperMap.QueryBySQLService.prototype.getJsonParameters
  29024. * @description 将查询参数转化为 JSON 字符串。
  29025. * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds等)。
  29026. * @param {SuperMap.QueryBySQLParameters} params - SQL 查询参数类。
  29027. * @returns {Object} 转化后的 JSON 字符串。
  29028. */
  29029. getJsonParameters(params) {
  29030. if (!(params instanceof QueryBySQLParameters)) {
  29031. return;
  29032. }
  29033. var me = this,
  29034. jsonParameters = "",
  29035. qp = null;
  29036. qp = me.getQueryParameters(params);
  29037. jsonParameters += "'queryMode':'SqlQuery','queryParameters':";
  29038. jsonParameters += Util.toJSON(qp);
  29039. jsonParameters = "{" + jsonParameters + "}";
  29040. return jsonParameters;
  29041. }
  29042. }
  29043. SuperMap.QueryBySQLService = QueryBySQLService;
  29044. ;// CONCATENATED MODULE: ./src/common/iServer/RouteCalculateMeasureParameters.js
  29045. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29046. * This program are made available under the terms of the Apache License, Version 2.0
  29047. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29048. /**
  29049. * @class SuperMap.RouteCalculateMeasureParameters
  29050. * @category iServer SpatialAnalyst RouteCalculateMeasure
  29051. * @classdesc 基于路由对象计算指定点 M 值操作的参数类。通过该类提供参数信息。
  29052. * @param {Object} options - 参数。
  29053. * @param {(SuperMap.Route|L.Polyline|ol.geom.LineString)} options.sourceRoute - 路由对象。该对象可以是用户自己生成或在数据源中查询得到的符合标准的路由对象。
  29054. * @param {(SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point)} options.point - 二维地理坐标点对象,包含 x,y 坐标值属性的对象。
  29055. * @param {float} [options.tolerance] - 容限值。
  29056. * @param {boolean} [options.isIgnoreGap=false] - 是否忽略子对象之间的距离。
  29057. */
  29058. class RouteCalculateMeasureParameters {
  29059. constructor(options) {
  29060. if (!options) {
  29061. return this;
  29062. }
  29063. /**
  29064. * @member {(SuperMap.Route|L.Polyline|ol.geom.LineString)} SuperMap.RouteCalculateMeasureParameters.prototype.sourceRoute
  29065. * @description 路由对象。该对象可以是用户自己生成或在数据源中查询得到的符合标准的路由对象。
  29066. */
  29067. this.sourceRoute = null;
  29068. /**
  29069. * @member {(SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point)} SuperMap.RouteCalculateMeasureParameters.prototype.point
  29070. * @description 二维地理坐标点对象,包含 x,y 坐标值属性的对象。
  29071. */
  29072. this.point = null;
  29073. /**
  29074. * @member {float} [SuperMap.RouteCalculateMeasureParameters.prototype.tolerance]
  29075. * @description 容限值。
  29076. */
  29077. this.tolerance = null;
  29078. /**
  29079. * @member {boolean} [SuperMap.RouteCalculateMeasureParameters.prototype.isIgnoreGap=false]
  29080. * @description 是否忽略子对象之间的距离。
  29081. */
  29082. this.isIgnoreGap = false;
  29083. Util.extend(this, options);
  29084. this.CLASS_NAME = "SuperMap.RouteCalculateMeasureParameters";
  29085. }
  29086. /**
  29087. * @function SuperMap.RouteCalculateMeasureParameters.prototype.destroy
  29088. * @description 释放资源,将引用资源的属性置空。
  29089. */
  29090. destroy() {
  29091. var me = this;
  29092. me.sourceRoute = null;
  29093. me.point = null;
  29094. if (me.tolerance) {
  29095. me.tolerance = null;
  29096. }
  29097. if (me.isIgnoreGap) {
  29098. me.isIgnoreGap = false;
  29099. }
  29100. }
  29101. }
  29102. SuperMap.RouteCalculateMeasureParameters = RouteCalculateMeasureParameters;
  29103. ;// CONCATENATED MODULE: ./src/common/iServer/RouteCalculateMeasureService.js
  29104. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29105. * This program are made available under the terms of the Apache License, Version 2.0
  29106. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29107. /**
  29108. * @class SuperMap.RouteCalculateMeasureService
  29109. * @category iServer SpatialAnalyst RouteCalculateMeasure
  29110. * @classdesc 基于路由对象计算指定点 M 值操作的服务类。
  29111. * 该类负责将客户设置的计算指定点的 M 值参数传递给服务端,并接收服务端返回的
  29112. * 指定点的 M 值。通过该类支持的事件的监听函数参数获取。
  29113. * @extends {SuperMap.SpatialAnalystBase}
  29114. * @param {string} url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst
  29115. * @param {Object} options - 参数。
  29116. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  29117. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  29118. * @param {Object} [options.headers] - 请求头。
  29119. * @example 实例化该类如下例所示:
  29120. * (start code)
  29121. * var parameters = new SuperMap.RouteCalculateMeasureParameters({
  29122. * "sourceRoute":{
  29123. * "type":"LINEM",
  29124. * "parts":[4],
  29125. * "points":[
  29126. * {
  29127. * "measure":0,
  29128. * "y":-6674.466867067764,
  29129. * "x":3817.3527876130133
  29130. * },
  29131. * {
  29132. * "measure":199.57954019411724,
  29133. * "y":-6670.830929417594,
  29134. * "x":3617.806369901496
  29135. * },
  29136. * {
  29137. * "measure":609.3656478634477,
  29138. * "y":-6877.837541432356,
  29139. * "x":3264.1498746678444
  29140. * },
  29141. * {
  29142. * "measure":936.0174126282958,
  29143. * "y":-7038.687780615184,
  29144. * "x":2979.846206068903
  29145. * }
  29146. * ]
  29147. * },
  29148. * "tolerance":1,
  29149. * "point":{
  29150. * "x":3330.7754269417,
  29151. * "y":-6838.8394457216
  29152. * },
  29153. * "isIgnoreGap":false
  29154. * });
  29155. *
  29156. * var routeCalculateMeasureService = new SuperMap.RouteCalculateMeasureService(spatialAnalystURL, {
  29157. * eventListeners:{
  29158. * processCompleted:calculateCompleted,
  29159. * processFailed:calculateFailded
  29160. * }
  29161. * );
  29162. * routeCalculateMeasureService.processAsync(parameters);
  29163. *
  29164. * //执行
  29165. * function calculateCompleted(){todo}
  29166. * function calculateFailded(){todo}
  29167. * (end)
  29168. *
  29169. */
  29170. class RouteCalculateMeasureService extends SpatialAnalystBase {
  29171. constructor(url, options) {
  29172. super(url, options);
  29173. this.CLASS_NAME = "SuperMap.RouteCalculateMeasureService";
  29174. }
  29175. /**
  29176. * @override
  29177. */
  29178. destroy() {
  29179. super.destroy();
  29180. }
  29181. /**
  29182. * @function SuperMap.RouteCalculateMeasureService.prototype.processAsync
  29183. * @description 负责将客户端的基于路由对象计算指定点 M 值操作的参数传递到服务端。
  29184. * @param {SuperMap.RouteCalculateMeasureParameters} params - 基于路由对象计算指定点 M 值操作的参数类。
  29185. */
  29186. processAsync(params) {
  29187. if (!(params instanceof RouteCalculateMeasureParameters)) {
  29188. return;
  29189. }
  29190. var me = this, jsonParameters;
  29191. jsonParameters = me.getJsonParameters(params);
  29192. me.request({
  29193. method: "POST",
  29194. data: jsonParameters,
  29195. scope: me,
  29196. success: me.serviceProcessCompleted,
  29197. failure: me.serviceProcessFailed
  29198. });
  29199. }
  29200. /**
  29201. * @function SuperMap.RouteCalculateMeasureService.prototype.getJsonParameters
  29202. * @description 将参数转化为 JSON 字符串。
  29203. * @param {SuperMap.RouteCalculateMeasureParameters} params - 基于路由对象计算指定点 M 值操作的参数类。
  29204. * @returns {Object} 转化后的 JSON 字符串。
  29205. */
  29206. getJsonParameters(params) {
  29207. var jsonParameters, jsonStr = "geometry/calculatemeasure", me = this;
  29208. me.url = Util.urlPathAppend(me.url, jsonStr);
  29209. me.url = Util.urlAppend(me.url, 'returnContent=true');
  29210. jsonParameters = Util.toJSON(params);
  29211. return jsonParameters;
  29212. }
  29213. }
  29214. SuperMap.RouteCalculateMeasureService = RouteCalculateMeasureService;
  29215. ;// CONCATENATED MODULE: ./src/common/iServer/RouteLocatorParameters.js
  29216. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29217. * This program are made available under the terms of the Apache License, Version 2.0
  29218. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29219. /**
  29220. * @class SuperMap.RouteLocatorParameters
  29221. * @category iServer SpatialAnalyst RouteLocator
  29222. * @classdesc 路由对象定位空间对象的参数类。
  29223. * 参数有两种方式,分别为 Geometry 和 Dataset 两种,前者需要指定 sourceRoute 对象作为参数,后者需要 dataset,routeIDField,routeID 三个参数
  29224. * 如果用户两种参数均设置,优先选择 Dataset 方式。
  29225. * @param {Object} options - 参数。
  29226. * @param {(SuperMap.Route|L.Polyline|ol.geom.LineString)} options.sourceRoute - 路由对象。
  29227. * @param {float} options.measure - 定位点的 M 值。只当路由对象定位点时有意义。
  29228. * @param {string} [options.type] - 类型:点 or 线。
  29229. * @param {float} [options.offset=0] - 定位点偏移量。只当路由对象定位点时有意义。
  29230. * @param {boolean} [options.isIgnoreGap=false] - 是否忽略子对象之间的距离。即不忽略子对象之间的距离。
  29231. * @param {float} [options.startMeasure] - 定位线的起始 M 值。只当路由对象定位线时有意义。
  29232. * @param {float} [options.endMeasure] - 定位线的终止 M 值。只当路由对象定位线时有意义。
  29233. */
  29234. class RouteLocatorParameters {
  29235. constructor(options) {
  29236. if (!options) {
  29237. return this;
  29238. }
  29239. /**
  29240. * @member {(SuperMap.Route|L.Polyline|ol.geom.LineString)} SuperMap.RouteLocatorParameters.prototype.sourceRoute
  29241. * @description 路由对象。
  29242. */
  29243. this.sourceRoute = null;
  29244. /**
  29245. * @member {string} SuperMap.RouteLocatorParameters.prototype.dataset
  29246. * @description 要用来做缓冲区分析的数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示。
  29247. */
  29248. this.dataset = null;
  29249. /**
  29250. * @member {string} SuperMap.RouteLocatorParameters.prototype.routeIDField
  29251. * @description 路由对象所在的字段名称。
  29252. *
  29253. */
  29254. this.routeIDField = null;
  29255. /**
  29256. * @member {number} SuperMap.RouteLocatorParameters.prototype.routeID
  29257. * @description 路由对象标识。
  29258. *
  29259. */
  29260. this.routeID = null;
  29261. /**
  29262. * @member {string} [SuperMap.RouteLocatorParameters.prototype.type]
  29263. * @description 类型:点 or 线。
  29264. * 可选值为:
  29265. * LINE :根据起始 M 值及终止 M 值定位线对象。
  29266. * POINT : 根据 M 值定位点对象。
  29267. */
  29268. this.type = null;
  29269. /**
  29270. * @member {float} SuperMap.RouteLocatorParameters.prototype.measure
  29271. * @description 定位点的 M 值。只当路由对象定位点时有意义。
  29272. */
  29273. this.measure = null;
  29274. /**
  29275. * @member {float} [SuperMap.RouteLocatorParameters.prototype.offset=0]
  29276. * @description 定位点偏移量。只当路由对象定位点时有意义。
  29277. */
  29278. this.offset = 0;
  29279. /**
  29280. * @member {boolean} [SuperMap.RouteLocatorParameters.prototype.isIgnoreGap=false]
  29281. * @description 是否忽略子对象之间的距离。
  29282. */
  29283. this.isIgnoreGap = false;
  29284. /**
  29285. * @member {float} [SuperMap.RouteLocatorParameters.prototype.startMeasure]
  29286. * @description 定位线的起始 M 值。只当路由对象定位线时有意义。
  29287. */
  29288. this.startMeasure = null;
  29289. /**
  29290. * @member {float} [SuperMap.RouteLocatorParameters.prototype.endMeasure]
  29291. * @description 定位线的终止 M 值。只当路由对象定位线时有意义。
  29292. */
  29293. this.endMeasure = null;
  29294. var routeFromClient = options.sourceRoute;
  29295. var routeHandle = {};
  29296. if (routeFromClient && routeFromClient instanceof Geometry && routeFromClient.components) {
  29297. routeHandle.type = routeFromClient.type;
  29298. routeHandle.parts = routeFromClient.parts;
  29299. var parts = [];
  29300. for (var i = 0, len = routeFromClient.components.length; i < len; i++) {
  29301. parts = parts.concat(routeFromClient.components[i].components);
  29302. }
  29303. routeHandle.points = parts;
  29304. options.sourceRoute = routeHandle;
  29305. }
  29306. Util.extend(this, options);
  29307. this.CLASS_NAME = "SuperMap.RouteLocatorParameters";
  29308. }
  29309. /**
  29310. * @function SuperMap.RouteLocatorParameters.prototype.destroy
  29311. * @description 释放资源,将引用资源的属性置空。
  29312. */
  29313. destroy() {
  29314. var me = this;
  29315. me.sourceRoute = null;
  29316. me.type = null;
  29317. me.measure = null;
  29318. me.offset = 0;
  29319. me.isIgnoreGap = false;
  29320. me.startMeasure = null;
  29321. me.endMeasure = null;
  29322. me.dataset = null;
  29323. me.routeID = null;
  29324. me.routeIDField = null;
  29325. }
  29326. }
  29327. SuperMap.RouteLocatorParameters = RouteLocatorParameters;
  29328. ;// CONCATENATED MODULE: ./src/common/iServer/RouteLocatorService.js
  29329. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29330. * This program are made available under the terms of the Apache License, Version 2.0
  29331. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29332. /**
  29333. * @class SuperMap.RouteLocatorService
  29334. * @category iServer SpatialAnalyst RouteLocator
  29335. * @classdesc 路由对象定位空间对象的服务类。
  29336. * @extends {SuperMap.SpatialAnalystBase}
  29337. * @param {string} url -服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  29338. * @param {Object} options - 参数。</br>
  29339. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  29340. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  29341. * @param {Object} [options.headers] - 请求头。
  29342. * @example 实例化该类如下例所示:
  29343. * (start code)
  29344. * var routeLocatorParameters_point = new SuperMap.RouteLocatorParameters({
  29345. * "sourceRoute":{
  29346. * "type":"LINEM",
  29347. * "parts":[4],
  29348. * "points":[
  29349. * {
  29350. * "measure":0,
  29351. * "y":-6674.466867067764,
  29352. * "x":3817.3527876130133
  29353. * },
  29354. * {
  29355. * "measure":199.57954019411724,
  29356. * "y":-6670.830929417594,
  29357. * "x":3617.806369901496
  29358. * },
  29359. * {
  29360. * "measure":609.3656478634477,
  29361. * "y":-6877.837541432356,
  29362. * "x":3264.1498746678444
  29363. * },
  29364. * {
  29365. * "measure":936.0174126282958,
  29366. * "y":-7038.687780615184,
  29367. * "x":2979.846206068903
  29368. * }
  29369. * ]
  29370. * },
  29371. * "type":"POINT",
  29372. * "measure":10,
  29373. * "offset":3,
  29374. * "isIgnoreGap":true
  29375. * });
  29376. * var routeLocatorService = new SuperMap.RouteLocatorService(spatialAnalystURL, {
  29377. * eventListeners:{
  29378. * processCompleted:routeLocatorCompleted,
  29379. * processFailed:routeLocatorFailded
  29380. * }
  29381. * );
  29382. * routeLocatorService.processAsync(routeLocatorParameters_point);
  29383. *
  29384. * //执行
  29385. * function routeLocatorCompleted(){todo}
  29386. * function routeLocatorFailded(){todo}
  29387. * (end)
  29388. *
  29389. */
  29390. class RouteLocatorService extends SpatialAnalystBase {
  29391. constructor(url, options) {
  29392. super(url, options);
  29393. this.CLASS_NAME = "SuperMap.RouteLocatorService";
  29394. }
  29395. /**
  29396. * @override
  29397. */
  29398. destroy() {
  29399. super.destroy();
  29400. }
  29401. /**
  29402. * @function SuperMap.RouteLocatorService.prototype.processAsync
  29403. * @description 负责将客户端的基于路由对象计算指定点 M 值操作的参数传递到服务端。
  29404. * @param {SuperMap.RouteLocatorParameters} params - 路由对象定位空间对象的参数类。
  29405. */
  29406. processAsync(params) {
  29407. if (!(params instanceof RouteLocatorParameters)) {
  29408. return;
  29409. }
  29410. var me = this, jsonParameters;
  29411. jsonParameters = me.getJsonParameters(params);
  29412. me.request({
  29413. method: "POST",
  29414. data: jsonParameters,
  29415. scope: me,
  29416. success: me.serviceProcessCompleted,
  29417. failure: me.serviceProcessFailed
  29418. });
  29419. }
  29420. /**
  29421. * @function SuperMap.RouteLocatorService.prototype.processAsync
  29422. * @description 将参数转化为 JSON 字符串。
  29423. * @param {SuperMap.RouteLocatorParameters} params - 路由对象定位空间对象的参数类。
  29424. * @returns {Object} 转化后的JSON字符串。
  29425. */
  29426. getJsonParameters(params) {
  29427. var jsonParameters, jsonStr = "geometry/routelocator", me = this;
  29428. if (params.dataset) {
  29429. jsonStr = "datasets/" + params.dataset + "/linearreferencing/routelocator";
  29430. params.sourceRoute = null;
  29431. }
  29432. me.url = Util.urlPathAppend(me.url, jsonStr);
  29433. me.url = Util.urlAppend(me.url, 'returnContent=true');
  29434. jsonParameters = Util.toJSON(params);
  29435. return jsonParameters;
  29436. }
  29437. }
  29438. SuperMap.RouteLocatorService = RouteLocatorService;
  29439. ;// CONCATENATED MODULE: ./src/common/iServer/ServerFeature.js
  29440. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29441. * This program are made available under the terms of the Apache License, Version 2.0
  29442. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29443. /**
  29444. * @class SuperMap.ServerFeature
  29445. * @category iServer
  29446. * @classdesc 服务端矢量要素类。该类描述了服务端返回的矢量要素的相关信息,包括字段和几何信息。
  29447. * @param {Object} options - 参数。
  29448. * @param {SuperMap.ServerGeometry} geometry - 矢量要素的几何信息。
  29449. * @param {Array.<string>} [options.fieldNames] - 矢量要素的属性字段名集合。
  29450. * @param {Array.<string>} [options.fieldValues] - 矢量要素的属性字段值集合。
  29451. */
  29452. class ServerFeature {
  29453. constructor(options) {
  29454. /**
  29455. * @member {Array.<string>} [SuperMap.ServerFeature.prototype.fieldNames]
  29456. * @description 矢量要素的属性字段名集合。
  29457. */
  29458. this.fieldNames = null;
  29459. /**
  29460. * @member {Array.<string>} [SuperMap.ServerFeature.prototype.fieldValues]
  29461. * @description 矢量要素的属性字段值集合。
  29462. */
  29463. this.fieldValues = null;
  29464. /**
  29465. * @member {SuperMap.ServerGeometry} SuperMap.ServerFeature.prototype.geometry
  29466. * @description 矢量要素的几何信息。
  29467. */
  29468. this.geometry = null;
  29469. if (options) {
  29470. Util.extend(this, options);
  29471. }
  29472. this.CLASS_NAME = "SuperMap.ServerFeature";
  29473. }
  29474. /**
  29475. * @function SuperMap.ServerFeature.prototype.destroy
  29476. * @description 释放资源,将引用资源的属性置空。
  29477. */
  29478. destroy() {
  29479. var me = this;
  29480. me.fieldNames = null;
  29481. me.fieldValues = null;
  29482. if (me.geometry) {
  29483. me.geometry.destroy();
  29484. me.geometry = null;
  29485. }
  29486. }
  29487. /**
  29488. * @function SuperMap.ServerFeature.prototype.toFeature
  29489. * @description 将服务端矢量要素 ServerFeature 转换为客户端矢量要素 Feature。
  29490. * @returns {SuperMap.Vector} 转换后的客户端矢量要素。
  29491. */
  29492. toFeature() {
  29493. var names, values, geo,
  29494. attr = {},
  29495. me = this,
  29496. feature;
  29497. names = me.fieldNames;
  29498. values = me.fieldValues;
  29499. for (var i in names) {
  29500. attr[names[i]] = values[i];
  29501. }
  29502. if (me.geometry) {
  29503. geo = me.geometry.toGeometry();
  29504. }
  29505. feature = new Vector(geo, attr);
  29506. if (me.geometry && me.geometry.id) {
  29507. feature.fid = me.geometry.id;
  29508. }
  29509. return feature;
  29510. }
  29511. /**
  29512. * @function SuperMap.ServerFeature.prototype.fromJson
  29513. * @description 将 JSON 对象表示服务端矢量要素转换为 ServerFeature。
  29514. * @param {Object} jsonObject - 要转换的 JSON 对象。
  29515. * @returns {SuperMap.ServerFeature} 转化后的 ServerFeature 对象。
  29516. */
  29517. static fromJson(jsonObject) {
  29518. var geo = null;
  29519. if (!jsonObject) {
  29520. return;
  29521. }
  29522. geo = jsonObject.geometry;
  29523. if (geo) {
  29524. geo = ServerGeometry.fromJson(geo);
  29525. }
  29526. return new ServerFeature({
  29527. fieldNames: jsonObject.fieldNames,
  29528. fieldValues: jsonObject.fieldValues,
  29529. geometry: geo
  29530. });
  29531. }
  29532. }
  29533. SuperMap.ServerFeature = ServerFeature;
  29534. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayerInfoParameters.js
  29535. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29536. * This program are made available under the terms of the Apache License, Version 2.0
  29537. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29538. /**
  29539. * @class SuperMap.SetLayerInfoParameters
  29540. * @category iServer Map TempLayersSet
  29541. * @classdesc 设置图层信息参数类.
  29542. * @param {Object} options - 参数。
  29543. * @param {string} options.resourceID - 临时图层的资源 ID。
  29544. * @param {string} options.tempLayerName - 临时图层下的子图层名。
  29545. * @param {string} options.layerInfo - 要更新的图层信息。
  29546. */
  29547. class SetLayerInfoParameters {
  29548. constructor(options) {
  29549. options = options || {};
  29550. /**
  29551. * @member {string} SuperMap.SetLayerInfoParameters.prototype.resourceID
  29552. * @description 临时图层的资源 ID。
  29553. */
  29554. this.resourceID = null;
  29555. /**
  29556. * @member {string} SuperMap.SetLayerInfoParameters.prototype.tempLayerName
  29557. * @description 临时图层下子图层(或者其子图层)名,如:Countries@World.3@@World。
  29558. */
  29559. this.tempLayerName = null;
  29560. /**
  29561. * @member {Object} SuperMap.SetLayerInfoParameters.prototype.layerInfo
  29562. * @description 要更新的图层信息(包含修改和未修改的所有字段)。该参数可以通过图层信息服务获取,然后对返回值中 subLayers.layers[i] 图层信息属性进行修改。
  29563. */
  29564. this.layerInfo = null;
  29565. Util.extend(this, options);
  29566. this.CLASS_NAME = "SuperMap.SetLayerInfoParameters";
  29567. }
  29568. /**
  29569. * @function SuperMap.SetLayerInfoParameters.prototype.destroy
  29570. * @description 释放资源,将引用资源的属性置空。
  29571. */
  29572. destroy() {
  29573. var me = this;
  29574. me.resourceID = null;
  29575. me.tempLayerName = null;
  29576. me.layerInfo = null;
  29577. }
  29578. }
  29579. SuperMap.SetLayerInfoParameters = SetLayerInfoParameters;
  29580. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayerInfoService.js
  29581. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29582. * This program are made available under the terms of the Apache License, Version 2.0
  29583. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29584. /**
  29585. * @class SuperMap.SetLayerInfoService
  29586. * @category iServer Map TempLayersSet
  29587. * @classdesc 设置图层信息服务类。可以实现临时图层中子图层的修改
  29588. * 该类负责将图层设置参数传递到服务端,并获取服务端返回的结果信息。
  29589. * @extends {SuperMap.CommonServiceBase}
  29590. * @param {string} url - 与客户端交互的地图服务地址。请求地图服务,URL 应为:
  29591. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名}/tempLayersSet/{tempLayerID}/Rivers@World@@World";
  29592. * @param {Object} options - 参数。
  29593. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  29594. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  29595. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  29596. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  29597. * @param {Object} [options.headers] - 请求头。
  29598. */
  29599. class SetLayerInfoService extends CommonServiceBase {
  29600. constructor(url, options) {
  29601. super(url, options);
  29602. if (options) {
  29603. Util.extend(this, options);
  29604. }
  29605. this.CLASS_NAME = "SuperMap.SetLayerInfoService";
  29606. }
  29607. /**
  29608. * @override
  29609. */
  29610. destroy() {
  29611. super.destroy();
  29612. Util.reset(this);
  29613. }
  29614. /**
  29615. * @function SuperMap.SetLayerInfoService.prototype.processAsync
  29616. * @description 负责将客户端的更新参数传递到服务端。
  29617. * @param {Object} params - 修改后的图层资源信息。
  29618. * 该参数可以使用获取图层信息服务<{@link SuperMap.GetLayersInfoService}>返回图层信息,解析结果result.subLayers.layers[i],然后对其属性进行修改来获取。
  29619. */
  29620. processAsync(params) {
  29621. if (!params) {
  29622. return;
  29623. }
  29624. var me = this;
  29625. var jsonParamsStr = Util.toJSON(params);
  29626. me.request({
  29627. method: "PUT",
  29628. data: jsonParamsStr,
  29629. scope: me,
  29630. success: me.serviceProcessCompleted,
  29631. failure: me.serviceProcessFailed
  29632. });
  29633. }
  29634. }
  29635. SuperMap.SetLayerInfoService = SetLayerInfoService;
  29636. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayersInfoParameters.js
  29637. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29638. * This program are made available under the terms of the Apache License, Version 2.0
  29639. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29640. /**
  29641. * @class SuperMap.SetLayersInfoParameters
  29642. * @category iServer Map TempLayersSet
  29643. * @classdesc 设置图层信息参数类。
  29644. * @param {Object} options - 参数。
  29645. * @param {boolean} [options.isTempLayers=false] - 是否是临时图层。
  29646. * @param {string} options.resourceID - 临时图层资源 ID。
  29647. * @param {string} options.layersInfo - 要更新的图层信息。
  29648. */
  29649. class SetLayersInfoParameters {
  29650. constructor(options) {
  29651. options = options || {};
  29652. /**
  29653. * @member {boolean} [SuperMap.SetLayersInfoParameters.prototype.isTempLayers=false]
  29654. * @description 是否是临时图层。
  29655. */
  29656. this.isTempLayers = null;
  29657. /**
  29658. * @member {string} SuperMap.SetLayersInfoParameters.prototype.resourceID
  29659. * @description 临时图层资源 ID,
  29660. */
  29661. this.resourceID = null;
  29662. /**
  29663. * @member {Object} SuperMap.SetLayersInfoParameters.prototype.layersInfo
  29664. * @description 要更新的图层信息(包含修改和未修改的所有字段)。该参数可以通过图层信息服务获取,然后对返回值中 subLayers.layers[i] 图层信息属性进行修改。
  29665. */
  29666. this.layersInfo = null;
  29667. Util.extend(this, options);
  29668. this.CLASS_NAME = "SuperMap.SetLayersInfoParameters";
  29669. }
  29670. /**
  29671. * @function SuperMap.SetLayersInfoParameters.prototype.destroy
  29672. * @description 释放资源,将引用资源的属性置空。
  29673. */
  29674. destroy() {
  29675. var me = this;
  29676. me.isTempLayers = null;
  29677. me.resourceID = null;
  29678. me.layersInfo = null;
  29679. }
  29680. }
  29681. SuperMap.SetLayersInfoParameters = SetLayersInfoParameters;
  29682. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayersInfoService.js
  29683. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29684. * This program are made available under the terms of the Apache License, Version 2.0
  29685. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29686. /**
  29687. * @class SuperMap.SetLayersInfoService
  29688. * @category iServer Map TempLayersSet
  29689. * @classdesc 设置图层信息服务类。可以实现创建新的临时图层和对现有临时图层的修改,
  29690. * 当 isTempLayers 为 false的时候执行创建临时图层。当 isTempLayers 为 ture 并且临时图层资源 resourceID 被设置有效时执行对临时图层的编辑。
  29691. * 该类负责将图层设置参数传递到服务端,并获取服务端返回的结果信息。
  29692. * @extends {SuperMap.CommonServiceBase}
  29693. * @param url - {string} 与客户端交互的地图服务地址。请求地图服务,URL 应为:
  29694. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  29695. * @param {Object} options - 参数。
  29696. * @param {string} options.resourceID - 图层资源ID,临时图层的资源ID标记。
  29697. * @param {boolean} options.isTempLayers - 当前url对应的图层是否是临时图层。
  29698. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  29699. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  29700. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  29701. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  29702. * @param {Object} [options.headers] - 请求头。
  29703. */
  29704. class SetLayersInfoService extends CommonServiceBase {
  29705. constructor(url, options) {
  29706. super(url, options);
  29707. /**
  29708. * @member {string} SuperMap.SetLayersInfoService.prototype.resourceID
  29709. * @description 图层资源ID,临时图层的资源ID标记。
  29710. */
  29711. this.resourceID = null;
  29712. /**
  29713. * @function {boolean} SuperMap.SetLayersInfoService.prototype.isTempLayers
  29714. * @description 当前url对应的图层是否是临时图层。
  29715. */
  29716. this.isTempLayers = false;
  29717. if (options) {
  29718. SuperMap.Util.extend(this, options);
  29719. }
  29720. this.CLASS_NAME = "SuperMap.SetLayersInfoService";
  29721. }
  29722. /**
  29723. * @override
  29724. */
  29725. destroy() {
  29726. super.destroy();
  29727. Util.reset(this);
  29728. }
  29729. /**
  29730. * @function SuperMap.SetLayersInfoService.prototype.processAsync
  29731. * @description 负责将客户端的更新参数传递到服务端。
  29732. * @param {Object} params - 修改后的图层资源信息。该参数可以使用获取图层信息服务 <{@link SuperMap.GetLayersInfoService}>返回图层信息,然后对其属性进行修改来获取。
  29733. */
  29734. processAsync(params) {
  29735. if (!params) {
  29736. return;
  29737. }
  29738. var jsonParams,
  29739. subLayers = [],
  29740. me = this,
  29741. method = "";
  29742. //创建临时图层和设置修改临时图层信息对应不同的资源URL
  29743. if (me.isTempLayers) {
  29744. me.url = Util.urlPathAppend(me.url, "tempLayersSet/" + me.resourceID);
  29745. method = "PUT";
  29746. } else {
  29747. me.url = Util.urlPathAppend(me.url, "tempLayersSet");
  29748. method = "POST";
  29749. }
  29750. if (!params.subLayers) {
  29751. params.subLayers = {layers: []}
  29752. }
  29753. if (!params.subLayers.layers) {
  29754. params.subLayers.layers = [];
  29755. }
  29756. var layers = params.subLayers.layers,
  29757. len = layers.length;
  29758. for (let i in layers) {
  29759. if (layers[i].ugcLayerType === "GRID") {
  29760. var colorDictionary = {};
  29761. var colorDics = layers[i].colorDictionarys;
  29762. for (var j in colorDics) {
  29763. var key = colorDics[j].elevation;
  29764. colorDictionary[key] = colorDics[j].color;
  29765. }
  29766. }
  29767. layers[i].colorDictionary = colorDictionary;
  29768. delete layers[i].colorDictionarys;
  29769. }
  29770. for (let i = 0; i < len; i++) {
  29771. if (layers[i].toJsonObject) {
  29772. //将图层信息转换成服务端能识别的简单json对象
  29773. subLayers.push(layers[i].toJsonObject());
  29774. } else {
  29775. subLayers.push(layers[i]);
  29776. }
  29777. }
  29778. jsonParams = Util.extend(jsonParams, params);
  29779. jsonParams.subLayers = {"layers": subLayers};
  29780. jsonParams.object = null;
  29781. var jsonParamsStr = Util.toJSON([jsonParams]);
  29782. me.request({
  29783. method: method,
  29784. data: jsonParamsStr,
  29785. scope: me,
  29786. success: me.serviceProcessCompleted,
  29787. failure: me.serviceProcessFailed
  29788. });
  29789. }
  29790. }
  29791. SuperMap.SetLayersInfoService = SetLayersInfoService;
  29792. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayerStatusParameters.js
  29793. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29794. * This program are made available under the terms of the Apache License, Version 2.0
  29795. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29796. /**
  29797. * @class SuperMap.SetLayerStatusParameters
  29798. * @category iServer Map TempLayersSet
  29799. * @classdesc 子图层显示控制参数类,该类存储了各子图层是否可见的状态。
  29800. * 注意在 SuperMap iClient 系列产品中所说的图层与 SuperMap Deskpro 的地图对应,子图层与 SuperMap Deskpro 的图层对应。
  29801. * @param {Object} options - 参数。
  29802. * @param {Array.<SuperMap.LayerStatus>} options.layerStatusList - 获取或设置图层可见状态({@link SuperMap.LayerStatus})集合,
  29803. * 集合中的每个 {@link SuperMap.LayerStatus} 对象代表一个子图层的可视状态。
  29804. * @param {number} [options.holdTime=15] - 获取或设置资源在服务端保存的时间。
  29805. * @param {string} [options.resourceID] - 获取或设置资源服务 ID。
  29806. */
  29807. class SetLayerStatusParameters {
  29808. constructor(options) {
  29809. /**
  29810. * @member {Array.<SuperMap.LayerStatus>} SuperMap.SetLayerStatusParameters.prototype.layerStatusList
  29811. * @description 获取或设置图层可见状态({@link SuperMap.LayerStatus})集合,集合中的每个 {@link SuperMap.LayerStatus} 对象代表一个子图层的可视状态。
  29812. */
  29813. this.layerStatusList = [];
  29814. /**
  29815. * @member {number} [SuperMap.SetLayerStatusParameters.prototype.holdTime=15]
  29816. * @description 获取或设置资源在服务端保存的时间。单位为分钟。
  29817. */
  29818. this.holdTime = 15;
  29819. /**
  29820. * @member {string} SuperMap.SetLayerStatusParameters.prototype.resourceID
  29821. * @description 获取或设置资源服务ID。如果设置该参数则会在指定的 TempLayer 进行图层的显示控制;
  29822. * 如果不设置该参数,则会首先创建一个 TempLayer ,然后在新创建的 TempLayer 进行图层的显示控制。
  29823. */
  29824. this.resourceID = null;
  29825. if (options) {
  29826. Util.extend(this, options);
  29827. }
  29828. }
  29829. /**
  29830. * @function SuperMap.SetLayerStatusParameters.prototype.destroy
  29831. * @description 释放资源,将引用资源的属性置空。
  29832. */
  29833. destroy() {
  29834. var me = this;
  29835. me.layerStatusList = null;
  29836. me.holdTime = null;
  29837. me.resourceID = null;
  29838. }
  29839. /**
  29840. * @function SuperMap.SetLayerStatusParameters.prototype.toJSON
  29841. * @description 生成 JSON。
  29842. * @returns {Object} 对应的 JSON 对象。
  29843. */
  29844. toJSON() {
  29845. var json = '{';
  29846. json += '"layers":[';
  29847. var v = [];
  29848. for (var i = 0, len = this.layerStatusList.length; i < len; i++) {
  29849. v.push(this.layerStatusList[i].toJSON());
  29850. }
  29851. json += v;
  29852. json += ']';
  29853. json += '}';
  29854. return json;
  29855. }
  29856. }
  29857. SuperMap.SetLayerStatusParameters = SetLayerStatusParameters;
  29858. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayerStatusService.js
  29859. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29860. * This program are made available under the terms of the Apache License, Version 2.0
  29861. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29862. /**
  29863. * @class SuperMap.SetLayerStatusService
  29864. * @category iServer Map TempLayersSet
  29865. * @classdesc 子图层显示控制服务类。该类负责将子图层显示控制参数传递到服务端,并获取服务端返回的图层显示状态。
  29866. * 用户获取服务端返回的各子图层显示状态有两种方式:
  29867. * 一种是通过监听 SetLayerEvent.PROCESS_COMPLETE 事件;
  29868. * 一种是使用 AsyncResponder 类实现异步处理。
  29869. * @extends {SuperMap.CommonServiceBase}
  29870. * @param {string} url - 地图服务访问地址。请求地图服务,URL 应为:
  29871. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  29872. * @param {Object} options - 参数。
  29873. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  29874. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  29875. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  29876. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  29877. * @param {Object} [options.headers] - 请求头。
  29878. */
  29879. class SetLayerStatusService extends CommonServiceBase {
  29880. constructor(url, options) {
  29881. super(url, options);
  29882. this.lastparams = null;
  29883. this.mapUrl = url;
  29884. if (options) {
  29885. Util.extend(this, options);
  29886. }
  29887. this.CLASS_NAME = "SuperMap.SetLayerStatusService";
  29888. }
  29889. /**
  29890. * @override
  29891. */
  29892. destroy() {
  29893. super.destroy();
  29894. Util.reset(this);
  29895. }
  29896. /**
  29897. * @function SuperMap.SetLayerStatusService.prototype.processAsync
  29898. * @description 负责将客户端的更新参数传递到服务端。
  29899. * @param {Object} params - 修改后的图层资源信息。该参数可以使用获取图层信息服务{@link SuperMap.SetLayerStatusParameters}
  29900. * 返回图层信息,然后对其属性进行修改来获取。
  29901. */
  29902. processAsync(params) {
  29903. if (!(params instanceof SetLayerStatusParameters)) {
  29904. return;
  29905. }
  29906. var me = this,
  29907. method = "POST";
  29908. me.url = me.mapUrl;
  29909. if (params.resourceID == null) {
  29910. me.url = Util.urlPathAppend(me.url, 'tempLayersSet');
  29911. me.lastparams = params;
  29912. me.request({
  29913. method: method,
  29914. scope: me,
  29915. success: me.createTempLayerComplete,
  29916. failure: me.serviceProcessFailed
  29917. });
  29918. } else {
  29919. me.url = Util.urlPathAppend(me.url, "tempLayersSet/" + params.resourceID);
  29920. me.url = Util.urlAppend(me.url, "elementRemain=true&reference=" + params.resourceID + "&holdTime=" + params.holdTime.toString());
  29921. var jsonParameters = '[{';
  29922. jsonParameters += '"type":"UGC",';
  29923. if (params.layerStatusList != null && params.layerStatusList.length > 0) {
  29924. jsonParameters += '"subLayers":' + params.toJSON();
  29925. }
  29926. jsonParameters += ',"visible":' + true + ',';
  29927. jsonParameters += '"name":"' + this.getMapName(this.mapUrl) + '"';
  29928. jsonParameters += '}]';
  29929. me.request({
  29930. method: "PUT",
  29931. data: jsonParameters,
  29932. scope: me,
  29933. success: me.serviceProcessCompleted,
  29934. failure: me.serviceProcessFailed
  29935. });
  29936. }
  29937. }
  29938. /**
  29939. * @function SuperMap.SetLayerStatusService.prototype.createTempLayerComplete
  29940. * @description 设置完成,执行此方法。
  29941. * @param {Object} result - 服务器返回的结果对象,记录设置操作是否成功。
  29942. */
  29943. createTempLayerComplete(result) {
  29944. var me = this;
  29945. result = Util.transformResult(result);
  29946. if (result.succeed) {
  29947. me.lastparams.resourceID = result.newResourceID;
  29948. }
  29949. me.processAsync(me.lastparams);
  29950. }
  29951. /**
  29952. * @function SuperMap.SetLayerStatusService.prototype.getMapName
  29953. * @description 获取地图名称。
  29954. * @param {Object} url - 服务地址。
  29955. */
  29956. getMapName(url) {
  29957. var mapUrl = url;
  29958. if (mapUrl.charAt(mapUrl.length - 1) === "/") {
  29959. mapUrl = mapUrl.substr(0, mapUrl.length - 1);
  29960. }
  29961. var index = mapUrl.lastIndexOf("/");
  29962. var mapName = mapUrl.substring(index + 1, mapUrl.length);
  29963. return mapName;
  29964. }
  29965. /**
  29966. * @function SuperMap.SetLayerStatusService.prototype.setLayerCompleted
  29967. * @description 设置完成,执行此方法。
  29968. * @param {Object} result - 服务器返回的结果对象,记录设置操作是否成功。
  29969. */
  29970. serviceProcessCompleted(result) {
  29971. var me = this;
  29972. result = Util.transformResult(result);
  29973. if (result != null && me.lastparams != null) {
  29974. result.newResourceID = me.lastparams.resourceID;
  29975. }
  29976. me.events.triggerEvent("processCompleted", {result: result});
  29977. }
  29978. }
  29979. SuperMap.SetLayerStatusService = SetLayerStatusService;
  29980. ;// CONCATENATED MODULE: ./src/common/iServer/SingleObjectQueryJobsParameter.js
  29981. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29982. * This program are made available under the terms of the Apache License, Version 2.0
  29983. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29984. /**
  29985. * @class SuperMap.SingleObjectQueryJobsParameter
  29986. * @category iServer ProcessingService Query
  29987. * @classdesc 单对象空间查询分析任务参数类。
  29988. * @param {Object} options - 参数。
  29989. * @param {string} options.datasetName - 数据集名。
  29990. * @param {string} options.datasetQuery - 查询对象所在的数据集名称。
  29991. * @param {SuperMap.SpatialQueryMode} [options.mode=SuperMap.SpatialQueryMode.CONTAIN] - 空间查询模式。
  29992. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  29993. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  29994. */
  29995. class SingleObjectQueryJobsParameter {
  29996. constructor(options) {
  29997. if (!options) {
  29998. return;
  29999. }
  30000. /**
  30001. * @member {string} SuperMap.SingleObjectQueryJobsParameter.prototype.datasetName
  30002. * @description 数据集名。
  30003. */
  30004. this.datasetName = "";
  30005. /**
  30006. * @member {string} SuperMap.SingleObjectQueryJobsParameter.prototype.datasetQuery
  30007. * @description 查询对象所在的数据集名称。
  30008. */
  30009. this.datasetQuery = "";
  30010. /**
  30011. * @member {string} SuperMap.SingleObjectQueryJobsParameter.prototype.geometryQuery
  30012. * @description 查询对象所在的几何对象。
  30013. */
  30014. this.geometryQuery = "";
  30015. /**
  30016. * @member {SuperMap.SpatialQueryMode} [SuperMap.SingleObjectQueryJobsParameter.prototype.mode=SuperMap.SpatialQueryMode.CONTAIN]
  30017. * @description 空间查询模式 。
  30018. */
  30019. this.mode = SpatialQueryMode.CONTAIN;
  30020. /**
  30021. * @member {SuperMap.OutputSetting} [SuperMap.SingleObjectQueryJobsParameter.prototype.output]
  30022. * @description 输出参数设置类。
  30023. */
  30024. this.output = null;
  30025. /**
  30026. * @member {SuperMap.MappingParameters} [SuperMap.SingleObjectQueryJobsParameter.prototype.mappingParameters]
  30027. * @description 分析后结果可视化的参数类。
  30028. */
  30029. this.mappingParameters = null;
  30030. Util.extend(this, options);
  30031. this.CLASS_NAME = "SuperMap.SingleObjectQueryJobsParameter";
  30032. }
  30033. /**
  30034. * @function SuperMap.SingleObjectQueryJobsParameter.prototype.destroy
  30035. * @description 释放资源,将引用资源的属性置空。
  30036. */
  30037. destroy() {
  30038. this.datasetName = null;
  30039. this.datasetQuery = null;
  30040. this.geometryQuery = null;
  30041. this.mode = null;
  30042. if (this.output instanceof OutputSetting) {
  30043. this.output.destroy();
  30044. this.output = null;
  30045. }
  30046. if (this.mappingParameters instanceof MappingParameters){
  30047. this.mappingParameters.destroy();
  30048. this.mappingParameters = null;
  30049. }
  30050. }
  30051. /**
  30052. * @function SuperMap.SingleObjectQueryJobsParameter.toObject
  30053. * @param {Object} singleObjectQueryJobsParameter - 单对象空间查询分析任务参数。
  30054. * @param {Object} tempObj - 目标对象。
  30055. * @description 生成单对象空间查询分析任务对象。
  30056. */
  30057. static toObject(singleObjectQueryJobsParameter, tempObj) {
  30058. for (var name in singleObjectQueryJobsParameter) {
  30059. if (name === "datasetName") {
  30060. tempObj['input'] = tempObj['input'] || {};
  30061. tempObj['input'][name] = singleObjectQueryJobsParameter[name];
  30062. continue;
  30063. }
  30064. if (name === "output"){
  30065. tempObj['output'] = tempObj['output'] || {};
  30066. tempObj['output'] = singleObjectQueryJobsParameter[name];
  30067. continue;
  30068. }
  30069. tempObj['analyst'] = tempObj['analyst'] || {};
  30070. tempObj['analyst'][name] = singleObjectQueryJobsParameter[name];
  30071. if(name === 'mappingParameters'){
  30072. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  30073. tempObj['analyst']['mappingParameters'] = singleObjectQueryJobsParameter[name];
  30074. }
  30075. }
  30076. }
  30077. }
  30078. SuperMap.SingleObjectQueryJobsParameter = SingleObjectQueryJobsParameter;
  30079. ;// CONCATENATED MODULE: ./src/common/iServer/SingleObjectQueryJobsService.js
  30080. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30081. * This program are made available under the terms of the Apache License, Version 2.0
  30082. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30083. /**
  30084. * @class SuperMap.SingleObjectQueryJobsService
  30085. * @category iServer ProcessingService Query
  30086. * @classdesc 单对象查询分析服务类
  30087. * @extends {SuperMap.ProcessingServiceBase}
  30088. * @param {string} url - 单对象空间查询分析服务地址。
  30089. * @param {Object} options - 参数。
  30090. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30091. * @param {Object} [options.headers] - 请求头。
  30092. */
  30093. class SingleObjectQueryJobsService extends ProcessingServiceBase {
  30094. constructor(url, options) {
  30095. super(url, options);
  30096. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/query');
  30097. this.CLASS_NAME = 'SuperMap.SingleObjectQueryJobsService';
  30098. }
  30099. /**
  30100. *@override
  30101. */
  30102. destroy() {
  30103. super.destroy();
  30104. }
  30105. /**
  30106. * @function SuperMap.SingleObjectQueryJobsService.protitype.getQueryJobs
  30107. * @description 获取单对象空间查询分析所有任务
  30108. */
  30109. getQueryJobs() {
  30110. super.getJobs(this.url);
  30111. }
  30112. /**
  30113. * @function SuperMap.KernelDensityJobsService.protitype.getQueryJob
  30114. * @description 获取指定id的单对象空间查询分析服务
  30115. * @param {string} id - 指定要获取数据的id
  30116. */
  30117. getQueryJob(id) {
  30118. super.getJobs(Util.urlPathAppend(this.url, id));
  30119. }
  30120. /**
  30121. * @function SuperMap.SingleObjectQueryJobsService.protitype.addQueryJob
  30122. * @description 新建单对象空间查询分析服务
  30123. * @param {SuperMap.SingleObjectQueryJobsParameter} params - 创建一个空间分析的请求参数。
  30124. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  30125. */
  30126. addQueryJob(params, seconds) {
  30127. super.addJob(this.url, params, SingleObjectQueryJobsParameter, seconds);
  30128. }
  30129. }
  30130. SuperMap.SingleObjectQueryJobsService = SingleObjectQueryJobsService;
  30131. ;// CONCATENATED MODULE: ./src/common/iServer/StopQueryParameters.js
  30132. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30133. * This program are made available under the terms of the Apache License, Version 2.0
  30134. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30135. /**
  30136. * @class SuperMap.StopQueryParameters
  30137. * @category iServer TrafficTransferAnalyst TransferStops
  30138. * @classdesc 站点查询参数类。
  30139. * @param {Object} options - 参数。
  30140. * @param {string} options.keyWord - 站点名称关键字。
  30141. * @param {boolean} [options.returnPosition=false] - 是否返回站点坐标信息。
  30142. */
  30143. class StopQueryParameters {
  30144. constructor(options) {
  30145. options = options || {};
  30146. /**
  30147. * @member {string} SuperMap.StopQueryParameters.prototype.keyWord
  30148. * @description 站点名称关键字。
  30149. */
  30150. this.keyWord = null;
  30151. /**
  30152. * @member {boolean} [SuperMap.StopQueryParameters.prototype.returnPosition=false]
  30153. * @description 是否返回站点坐标信息。
  30154. */
  30155. this.returnPosition = false;
  30156. Util.extend(this, options);
  30157. this.CLASS_NAME = "SuperMap.StopQueryParameters";
  30158. }
  30159. /**
  30160. * @function SuperMap.StopQueryParameters.prototype.destroy
  30161. * @description 释放资源,将引用资源的属性置空。
  30162. */
  30163. destroy() {
  30164. Util.reset(this);
  30165. }
  30166. }
  30167. SuperMap.StopQueryParameters = StopQueryParameters;
  30168. ;// CONCATENATED MODULE: ./src/common/iServer/StopQueryService.js
  30169. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30170. * This program are made available under the terms of the Apache License, Version 2.0
  30171. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30172. /**
  30173. * @class SuperMap.StopQueryService
  30174. * @category iServer TrafficTransferAnalyst TransferStops
  30175. * @classdesc 站点查询服务类。
  30176. * 返回结果通过该类支持的事件的监听函数参数获取
  30177. * @extends {SuperMap.CommonServiceBase}
  30178. * @param {string} url - 与客户端交互的站点查询服务地址。
  30179. * 例如:</br>"http://localhost:8090/iserver/services/traffictransferanalyst-sample/restjsr/traffictransferanalyst/Traffic-Changchun"。
  30180. * @param {Object} options - 参数。</br>
  30181. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  30182. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30183. * @param {Object} [options.headers] - 请求头。
  30184. * @example 例如:
  30185. * (start code)
  30186. * var myService = new SuperMap.StopQueryService(url, {eventListeners: {
  30187. * "processCompleted": StopQueryCompleted,
  30188. * "processFailed": StopQueryError
  30189. * }
  30190. * };
  30191. * (end)
  30192. *
  30193. *
  30194. */
  30195. class StopQueryService extends CommonServiceBase {
  30196. constructor(url, options) {
  30197. super(url, options);
  30198. options = options || {};
  30199. Util.extend(this, options);
  30200. this.CLASS_NAME = "SuperMap.StopQueryService";
  30201. }
  30202. /**
  30203. *@override
  30204. */
  30205. destroy() {
  30206. super.destroy();
  30207. Util.reset(this);
  30208. }
  30209. /**
  30210. * @function SuperMap.StopQueryService.prototype.processAsync
  30211. * @description 负责将客户端的更新参数传递到服务端。
  30212. * @param {SuperMap.StopQueryParameters} params - 交通换乘参数。
  30213. */
  30214. processAsync(params) {
  30215. if (!(params instanceof StopQueryParameters)) {
  30216. return;
  30217. }
  30218. var me = this;
  30219. me.url = Util.urlPathAppend(me.url, 'stops/keyword/' + params.keyWord);
  30220. me.request({
  30221. method: "GET",
  30222. params: {returnPosition: params.returnPosition},
  30223. scope: me,
  30224. success: me.serviceProcessCompleted,
  30225. failure: me.serviceProcessFailed
  30226. });
  30227. }
  30228. }
  30229. SuperMap.StopQueryService = StopQueryService;
  30230. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryAttributesJobsParameter.js
  30231. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30232. * This program are made available under the terms of the Apache License, Version 2.0
  30233. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30234. /**
  30235. * @class SuperMap.SummaryAttributesJobsParameter
  30236. * @category iServer ProcessingService SummaryAttributes
  30237. * @classdesc 属性汇总分析任务参数类
  30238. * @param {Object} options - 参数。
  30239. * @param {string} options.datasetName - 数据集名。
  30240. * @param {string} options.groupField - 分组字段。
  30241. * @param {string} options.attributeField - 属性字段。
  30242. * @param {string} options.statisticModes - 统计模式。
  30243. * @param {SuperMap.OutputSetting} [options.output] -输出参数设置。
  30244. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  30245. */
  30246. class SummaryAttributesJobsParameter {
  30247. constructor(options) {
  30248. if (!options) {
  30249. return;
  30250. }
  30251. /**
  30252. * @member {string} SuperMap.SummaryAttributesJobsParameter.prototype.datasetName
  30253. * @description 汇总数据集名称。
  30254. */
  30255. this.datasetName = "";
  30256. /**
  30257. * @member {string} SuperMap.SummaryAttributesJobsParameter.prototype.groupField
  30258. * @description 分组字段。
  30259. */
  30260. this.groupField = "";
  30261. /**
  30262. * @member {string} SuperMap.SummaryAttributesJobsParameter.prototype.attributeField
  30263. * @description 属性字段。
  30264. */
  30265. this.attributeField = "";
  30266. /**
  30267. * @member {string} SuperMap.SummaryAttributesJobsParameter.prototype.statisticModes
  30268. * @description 属性汇总统计模式。
  30269. */
  30270. this.statisticModes = "";
  30271. /**
  30272. * @member {SuperMap.OutputSetting} SuperMap.SummaryAttributesJobsParameter.prototype.output
  30273. * @description 输出参数设置类。
  30274. */
  30275. this.output = null;
  30276. /**
  30277. * @member {SuperMap.MappingParameters} [SuperMap.SummaryAttributesJobsParameter.prototype.mappingParameters]
  30278. * @description 分析后结果可视化的参数类。
  30279. */
  30280. this.mappingParameters = null;
  30281. Util.extend(this, options);
  30282. this.CLASS_NAME = "SuperMap.SummaryAttributesJobsParameter";
  30283. }
  30284. /**
  30285. * @function SuperMap.SummaryAttributesJobsParameter.destroy
  30286. * @override
  30287. */
  30288. destroy() {
  30289. this.datasetName = null;
  30290. this.groupField = null;
  30291. this.attributeField = null;
  30292. this.statisticModes = null;
  30293. if (this.output instanceof OutputSetting) {
  30294. this.output.destroy();
  30295. this.output = null;
  30296. }
  30297. if (this.mappingParameters instanceof MappingParameters){
  30298. this.mappingParameters.destroy();
  30299. this.mappingParameters = null;
  30300. }
  30301. }
  30302. /**
  30303. * @function SuperMap.SummaryAttributesJobsParameter.toObject
  30304. * @param {Object} SummaryAttributesJobsParameter - 属性汇总任务参数。
  30305. * @param {Object} tempObj - 目标对象。
  30306. * @description 生成属性汇总分析任务对象。
  30307. */
  30308. static toObject(SummaryAttributesJobsParameter, tempObj) {
  30309. for (var name in SummaryAttributesJobsParameter) {
  30310. if (name === "datasetName") {
  30311. tempObj['input'] = tempObj['input'] || {};
  30312. tempObj['input'][name] = SummaryAttributesJobsParameter[name];
  30313. continue;
  30314. }
  30315. if (name === "output") {
  30316. tempObj['output'] = tempObj['output'] || {};
  30317. tempObj['output'] = SummaryAttributesJobsParameter[name];
  30318. continue;
  30319. }
  30320. tempObj['analyst'] = tempObj['analyst'] || {};
  30321. tempObj['analyst'][name] = SummaryAttributesJobsParameter[name];
  30322. if(name === 'mappingParameters'){
  30323. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  30324. tempObj['analyst']['mappingParameters'] = SummaryAttributesJobsParameter[name];
  30325. }
  30326. }
  30327. }
  30328. }
  30329. SuperMap.SummaryAttributesJobsParameter = SummaryAttributesJobsParameter;
  30330. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryAttributesJobsService.js
  30331. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30332. * This program are made available under the terms of the Apache License, Version 2.0
  30333. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30334. /**
  30335. * @class SuperMap.SummaryAttributesJobsService
  30336. * @category iServer ProcessingService SummaryAttributes
  30337. * @classdesc 属性汇总分析服务类
  30338. * @extends {SuperMap.ProcessingServiceBase}
  30339. * @param {string} url - 汇总统计分析服务地址。
  30340. * @param {Object} options - 参数。
  30341. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30342. * @param {Object} [options.headers] - 请求头。
  30343. */
  30344. class SummaryAttributesJobsService extends ProcessingServiceBase {
  30345. constructor(url, options) {
  30346. super(url, options);
  30347. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/summaryattributes');
  30348. this.CLASS_NAME = "SuperMap.SummaryAttributesJobsService";
  30349. }
  30350. /**
  30351. *@override
  30352. */
  30353. destroy() {
  30354. super.destroy();
  30355. }
  30356. /**
  30357. * @function SuperMap.SummaryAttributesJobsService.protitype.getSummaryAttributesJobs
  30358. * @description 获取属性汇总分析所有任务
  30359. */
  30360. getSummaryAttributesJobs (){
  30361. super.getJobs(this.url);
  30362. }
  30363. /**
  30364. * @function SuperMap.SummaryAttributesJobsService.protitype.getSummaryAttributesJob
  30365. * @description 获取指定id的属性汇总分析服务
  30366. * @param {string} id - 指定要获取数据的id
  30367. */
  30368. getSummaryAttributesJob(id) {
  30369. super.getJobs(Util.urlPathAppend(this.url, id));
  30370. }
  30371. /**
  30372. * @function SuperMap.SummaryAttributesJobsService.protitype.addSummaryAttributesJob
  30373. * @description 新建属性汇总分析服务
  30374. * @param {SuperMap.SummaryAttributesJobsParameter} params - 创建一个空间分析的请求参数。
  30375. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  30376. */
  30377. addSummaryAttributesJob(params, seconds) {
  30378. super.addJob(this.url, params, SummaryAttributesJobsParameter, seconds);
  30379. }
  30380. }
  30381. SuperMap.SummaryAttributesJobsService = SummaryAttributesJobsService;
  30382. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryMeshJobParameter.js
  30383. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30384. * This program are made available under the terms of the Apache License, Version 2.0
  30385. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30386. /**
  30387. * @class SuperMap.SummaryMeshJobParameter
  30388. * @category iServer ProcessingService AggregatePoints
  30389. * @classdesc 点聚合分析任务参数类。
  30390. * @param {Object} options - 参数。
  30391. * @param {string} options.datasetName - 数据集名。
  30392. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} [options.query] - 分析范围(默认为全图范围)。
  30393. * @param {number} options.fields - 权重索引。
  30394. * @param {number} [options.resolution=100] - 分辨率。
  30395. * @param {SuperMap.StatisticAnalystMode} [options.statisticModes=SuperMap.StatisticAnalystMode.AVERAGE] - 分析模式。
  30396. * @param {number} [options.meshType=0] - 分析类型。
  30397. * @param {SuperMap.SummaryType} [options.type=SuperMap.SummaryType.SUMMARYMESH] - 聚合类型。
  30398. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  30399. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  30400. */
  30401. class SummaryMeshJobParameter {
  30402. constructor(options) {
  30403. if (!options) {
  30404. return;
  30405. }
  30406. /**
  30407. * @member {string} SuperMap.SummaryMeshJobParameter.prototype.datasetName
  30408. * @description 数据集名。
  30409. */
  30410. this.datasetName = "";
  30411. /**
  30412. * @member {string} SuperMap.SummaryMeshJobParameter.prototype.regionDataset
  30413. * @description 聚合面数据集(聚合类型为多边形聚合时使用的参数)。
  30414. */
  30415. this.regionDataset = "";
  30416. /**
  30417. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.SummaryMeshJobParameter.prototype.query
  30418. * @description 分析范围(聚合类型为网格面聚合时使用的参数)。
  30419. */
  30420. this.query = "";
  30421. /**
  30422. * @member {number} [SuperMap.SummaryMeshJobParameter.prototype.resolution=100]
  30423. * @description 分辨率(聚合类型为网格面聚合时使用的参数)。
  30424. */
  30425. this.resolution = 100;
  30426. /**
  30427. * @member {number} [SuperMap.SummaryMeshJobParameter.prototype.meshType=0]
  30428. * @description 网格面类型(聚合类型为网格面聚合时使用的参数),取值:0 或 1。
  30429. */
  30430. this.meshType = 0;
  30431. /**
  30432. * @member {SuperMap.StatisticAnalystMode} [SuperMap.SummaryMeshJobParameter.prototype.statisticModes=SuperMap.StatisticAnalystMode.AVERAGE]
  30433. * @description 统计模式。
  30434. */
  30435. this.statisticModes = StatisticAnalystMode.AVERAGE;
  30436. /**
  30437. * @member {number} SuperMap.SummaryMeshJobParameter.prototype.fields
  30438. * @description 权重字段。
  30439. */
  30440. this.fields = "";
  30441. /**
  30442. * @member {SuperMap.SummaryType} [SuperMap.SummaryMeshJobParameter.prototype.type=SuperMap.SummaryType.SUMMARYMESH]
  30443. * @description 聚合类型。
  30444. */
  30445. this.type = SummaryType.SUMMARYMESH;
  30446. /**
  30447. * @member {SuperMap.OutputSetting} [SuperMap.SummaryMeshJobParameter.prototype.output]
  30448. * @description 输出参数设置类。
  30449. */
  30450. this.output = null;
  30451. /**
  30452. * @member {SuperMap.MappingParameters} [SuperMap.SummaryMeshJobParameter.prototype.mappingParameters]
  30453. * @description 分析后结果可视化的参数类。
  30454. */
  30455. this.mappingParameters = null;
  30456. Util.extend(this, options);
  30457. this.CLASS_NAME = "SuperMap.SummaryMeshJobParameter";
  30458. }
  30459. /**
  30460. * @function SuperMap.SummaryMeshJobParameter.destroy
  30461. * @override
  30462. */
  30463. destroy() {
  30464. this.datasetName = null;
  30465. this.query = null;
  30466. this.resolution = null;
  30467. this.statisticModes = null;
  30468. this.meshType = null;
  30469. this.fields = null;
  30470. this.regionDataset = null;
  30471. this.type = null;
  30472. if (this.output instanceof OutputSetting) {
  30473. this.output.destroy();
  30474. this.output = null;
  30475. }
  30476. if (this.mappingParameters instanceof MappingParameters){
  30477. this.mappingParameters.destroy();
  30478. this.mappingParameters = null;
  30479. }
  30480. }
  30481. /**
  30482. * @function SuperMap.SummaryMeshJobParameter.toObject
  30483. * @param {Object} summaryMeshJobParameter - 点聚合分析任务参数。
  30484. * @param {Object} tempObj - 目标对象。
  30485. * @description 生成点聚合分析任务对象。
  30486. */
  30487. static toObject(summaryMeshJobParameter, tempObj) {
  30488. for (var name in summaryMeshJobParameter) {
  30489. if (name === "datasetName") {
  30490. tempObj['input'] = tempObj['input'] || {};
  30491. tempObj['input'][name] = summaryMeshJobParameter[name];
  30492. continue;
  30493. }
  30494. if (name === "type") {
  30495. tempObj['type'] = summaryMeshJobParameter[name];
  30496. continue;
  30497. }
  30498. if (name === "output") {
  30499. tempObj['output'] = tempObj['output'] || {};
  30500. tempObj['output'] = summaryMeshJobParameter[name];
  30501. continue;
  30502. }
  30503. if (summaryMeshJobParameter.type === 'SUMMARYMESH' && name !== 'regionDataset' || summaryMeshJobParameter.type === 'SUMMARYREGION' && !contains(['meshType', 'resolution', 'query'], name)) {
  30504. tempObj['analyst'] = tempObj['analyst'] || {};
  30505. if (name === 'query' && summaryMeshJobParameter[name]) {
  30506. tempObj['analyst'][name] = summaryMeshJobParameter[name].toBBOX();
  30507. } else {
  30508. tempObj['analyst'][name] = summaryMeshJobParameter[name];
  30509. }
  30510. if(name === 'mappingParameters'){
  30511. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  30512. tempObj['analyst']['mappingParameters'] = summaryMeshJobParameter[name];
  30513. }
  30514. }
  30515. }
  30516. function contains(arr, obj) {
  30517. var i = arr.length;
  30518. while (i--) {
  30519. if (arr[i] === obj) {
  30520. return true;
  30521. }
  30522. }
  30523. return false;
  30524. }
  30525. }
  30526. }
  30527. SuperMap.SummaryMeshJobParameter = SummaryMeshJobParameter;
  30528. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryMeshJobsService.js
  30529. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30530. * This program are made available under the terms of the Apache License, Version 2.0
  30531. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30532. /**
  30533. * @class SuperMap.SummaryMeshJobsService
  30534. * @category iServer ProcessingService AggregatePoints
  30535. * @classdesc 点聚合分析任务类。
  30536. * @param {string} url -点聚合分析任务地址。
  30537. * @param {Object} options - 参数。
  30538. * @param {SuperMap.Events} options.events - 处理所有事件的对象。<br>
  30539. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  30540. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  30541. * @param {number} options.index - 服务访问地址在数组中的位置。<br>
  30542. * @param {number} options.length - 服务访问地址数组长度。
  30543. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30544. * @param {Object} [options.headers] - 请求头。
  30545. */
  30546. class SummaryMeshJobsService extends ProcessingServiceBase {
  30547. constructor(url, options) {
  30548. super(url, options);
  30549. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/aggregatepoints');
  30550. this.CLASS_NAME = 'SuperMap.SummaryMeshJobsService';
  30551. }
  30552. /**
  30553. * @override
  30554. */
  30555. destroy() {
  30556. super.destroy();
  30557. }
  30558. /**
  30559. * @function SuperMap.SummaryMeshJobsService.prototype.getSummaryMeshJobs
  30560. * @description 获取点聚合分析任务
  30561. */
  30562. getSummaryMeshJobs() {
  30563. super.getJobs(this.url);
  30564. }
  30565. /**
  30566. * @function SuperMap.SummaryMeshJobsService.prototype.getSummaryMeshJob
  30567. * @description 获取指定ip的点聚合分析任务
  30568. * @param {string} id - 指定要获取数据的id
  30569. */
  30570. getSummaryMeshJob(id) {
  30571. super.getJobs(Util.urlPathAppend(this.url, id));
  30572. }
  30573. /**
  30574. * @function SuperMap.SummaryMeshJobsService.prototype.addSummaryMeshJob
  30575. * @description 新建点聚合分析服务
  30576. * @param {SuperMap.SummaryMeshJobParameter} params - 创建一个空间分析的请求参数。
  30577. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  30578. */
  30579. addSummaryMeshJob(params, seconds) {
  30580. super.addJob(this.url, params, SummaryMeshJobParameter, seconds);
  30581. }
  30582. }
  30583. SuperMap.SummaryMeshJobsService = SummaryMeshJobsService;
  30584. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryRegionJobParameter.js
  30585. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30586. * This program are made available under the terms of the Apache License, Version 2.0
  30587. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30588. /**
  30589. * @class SuperMap.SummaryRegionJobParameter
  30590. * @category iServer ProcessingService SummaryRegion
  30591. * @classdesc 区域汇总分析任务参数类。
  30592. * @param {Object} options - 参数。
  30593. * @param {string} options.datasetName - 数据集名。
  30594. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} [options.query] - 分析范围(默认为全图范围)。
  30595. * @param {string} [options.standardFields] - 标准属性字段名称。
  30596. * @param {string} [options.weightedFields] - 权重字段名称。
  30597. * @param {SuperMap.StatisticAnalystMode} [options.standardStatisticModes] - 标准属性字段的统计模式。standardSummaryFields 为 true 时必填。
  30598. * @param {SuperMap.StatisticAnalystMode} [options.weightedStatisticModes] - 权重字段的统计模式。weightedSummaryFields 为 true 时必填。
  30599. * @param {boolean} [options.sumShape=true] - 是否统计长度或面积。
  30600. * @param {boolean} [options.standardSummaryFields=false] - 是否以标准属字段统计。
  30601. * @param {boolean} [options.weightedSummaryFields=false] - 是否以权重字段统计。
  30602. * @param {number} [options.resolution=100] - 网格大小。
  30603. * @param {number} [options.meshType=0] - 网格面汇总类型。
  30604. * @param {SuperMap.AnalystSizeUnit} [options.meshSizeUnit=SuperMap.AnalystSizeUnit.METER] - 网格大小单位。
  30605. * @param {SuperMap.SummaryType} [options.type=SuperMap.SummaryType.SUMMARYMESH] - 汇总类型。
  30606. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  30607. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  30608. */
  30609. class SummaryRegionJobParameter {
  30610. constructor(options) {
  30611. if (!options) {
  30612. return;
  30613. }
  30614. /**
  30615. * @member {string} SuperMap.SummaryRegionJobParameter.prototype.datasetName
  30616. * @description 数据集名。
  30617. */
  30618. this.datasetName = "";
  30619. /**
  30620. * @member {string} SuperMap.SummaryRegionJobParameter.prototype.regionDataset
  30621. * @description 汇总数据源(多边形汇总时用到的参数)。
  30622. */
  30623. this.regionDataset = "";
  30624. /**
  30625. * @member {boolean} [SuperMap.SummaryRegionJobParameter.prototype.sumShape=true]
  30626. * @description 是否统计长度或面积。
  30627. */
  30628. this.sumShape = true;
  30629. /**
  30630. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.SummaryRegionJobParameter.prototype.query
  30631. * @description 分析范围。
  30632. */
  30633. this.query = "";
  30634. /**
  30635. * @member {boolean} [SuperMap.SummaryRegionJobParameter.prototype.standardSummaryFields=false]
  30636. * @description 是否以标准属字段统计。
  30637. */
  30638. this.standardSummaryFields = false;
  30639. /**
  30640. * @member {string} SuperMap.SummaryRegionJobParameter.prototype.standardFields
  30641. * @description 标准属性字段名称。仅支持系统字段以外的整形、长整形、浮点型的字段的名称。standardSummaryFields 为 true 时必填。
  30642. */
  30643. this.standardFields = "";
  30644. /**
  30645. * @member {SuperMap.StatisticAnalystMode} SuperMap.SummaryRegionJobParameter.prototype.standardStatisticModes
  30646. * @description 标准属性字段的统计模式。standardSummaryFields 为 true 时必填。
  30647. */
  30648. this.standardStatisticModes = "";
  30649. /**
  30650. * @member {boolean} [SuperMap.SummaryRegionJobParameter.prototype.weightedSummaryFields=false]
  30651. * @description 是否以权重字段统计。
  30652. */
  30653. this.weightedSummaryFields = false;
  30654. /**
  30655. * @member {string} SuperMap.SummaryRegionJobParameter.prototype.weightedFields
  30656. * @description 权重字段名称。仅支持系统字段以外的整形、长整形、浮点型的字段的名称。weightedSummaryFields 为 true 时必填。
  30657. */
  30658. this.weightedFields = "";
  30659. /**
  30660. * @member {SuperMap.StatisticAnalystMode} SuperMap.SummaryRegionJobParameter.prototype.weightedStatisticModes
  30661. * @description 以权重字段统计的统计模式。权重字段的统计模式。weightedSummaryFields 为 true 时必填。
  30662. */
  30663. this.weightedStatisticModes = "";
  30664. /**
  30665. * @member {number} [SuperMap.SummaryRegionJobParameter.prototype.meshType=0]
  30666. * @description 网格面汇总类型。
  30667. */
  30668. this.meshType = 0;
  30669. /**
  30670. * @member {number} [SuperMap.SummaryRegionJobParameter.prototype.resolution=100]
  30671. * @description 网格大小。
  30672. */
  30673. this.resolution = 100;
  30674. /**
  30675. * @member {SuperMap.AnalystSizeUnit} [SuperMap.SummaryRegionJobParameter.prototype.meshSizeUnit=SuperMap.AnalystSizeUnit.METER]
  30676. * @description 网格大小单位。
  30677. */
  30678. this.meshSizeUnit = AnalystSizeUnit.METER;
  30679. /**
  30680. * @member {SuperMap.SummaryType} [SuperMap.SummaryRegionJobParameter.prototype.type=SuperMap.SummaryType.SUMMARYMESH]
  30681. * @description 汇总类型。
  30682. */
  30683. this.type = SummaryType.SUMMARYMESH;
  30684. /**
  30685. * @member {SuperMap.OutputSetting} SuperMap.SummaryRegionJobParameter.prototype.output
  30686. * @description 输出参数设置类
  30687. */
  30688. this.output = null;
  30689. /**
  30690. * @member {SuperMap.MappingParameters} [SuperMap.SummaryRegionJobParameter.prototype.mappingParameters]
  30691. * @description 分析后结果可视化的参数类。
  30692. */
  30693. this.mappingParameters = null;
  30694. Util.extend(this, options);
  30695. this.CLASS_NAME = "SuperMap.SummaryRegionJobParameter";
  30696. }
  30697. /**
  30698. * @function SuperMap.SummaryRegionJobParameter.prototype.destroy
  30699. * @description 释放资源,将引用资源的属性置空。
  30700. */
  30701. destroy() {
  30702. this.datasetName = null;
  30703. this.sumShape = null;
  30704. this.regionDataset = null;
  30705. this.query = null;
  30706. this.standardSummaryFields = null;
  30707. this.standardFields = null;
  30708. this.standardStatisticModes = null;
  30709. this.weightedSummaryFields = null;
  30710. this.weightedFields = null;
  30711. this.weightedStatisticModes = null;
  30712. this.meshType = null;
  30713. this.resolution = null;
  30714. this.meshSizeUnit = null;
  30715. this.type = null;
  30716. if (this.output instanceof OutputSetting) {
  30717. this.output.destroy();
  30718. this.output = null;
  30719. }
  30720. if (this.mappingParameters instanceof MappingParameters){
  30721. this.mappingParameters.destroy();
  30722. this.mappingParameters = null;
  30723. }
  30724. }
  30725. /**
  30726. * @function SuperMap.SummaryRegionJobParameter.toObject
  30727. * @param {Object} summaryRegionJobParameter - 矢量裁剪分析任务参数。
  30728. * @param {Object} tempObj - 目标对象。
  30729. * @description 生成区域汇总分析服务对象。
  30730. */
  30731. static toObject(summaryRegionJobParameter, tempObj) {
  30732. for (var name in summaryRegionJobParameter) {
  30733. if (name === "datasetName") {
  30734. tempObj['input'] = tempObj['input'] || {};
  30735. tempObj['input'][name] = summaryRegionJobParameter[name];
  30736. continue;
  30737. }
  30738. if (name === "type") {
  30739. tempObj['type'] = summaryRegionJobParameter[name];
  30740. continue;
  30741. }
  30742. if (name === "type") {
  30743. tempObj['type'] = summaryRegionJobParameter[name];
  30744. continue;
  30745. }
  30746. if (name === "output") {
  30747. tempObj['output'] = tempObj['output'] || {};
  30748. tempObj['output'] = summaryRegionJobParameter[name];
  30749. continue;
  30750. }
  30751. if (summaryRegionJobParameter.type === "SUMMARYREGION" || summaryRegionJobParameter.type === "SUMMARYMESH" && name !== "regionDataset") {
  30752. tempObj['analyst'] = tempObj['analyst'] || {};
  30753. if (name === 'query' && summaryRegionJobParameter[name]) {
  30754. tempObj['analyst'][name] = summaryRegionJobParameter[name].toBBOX();
  30755. } else {
  30756. tempObj['analyst'][name] = summaryRegionJobParameter[name];
  30757. }
  30758. if(name === 'mappingParameters'){
  30759. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  30760. tempObj['analyst']['mappingParameters'] = summaryRegionJobParameter[name];
  30761. }
  30762. }
  30763. }
  30764. }
  30765. }
  30766. SuperMap.SummaryRegionJobParameter = SummaryRegionJobParameter;
  30767. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryRegionJobsService.js
  30768. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30769. * This program are made available under the terms of the Apache License, Version 2.0
  30770. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30771. /**
  30772. * @class SuperMap.SummaryRegionJobsService
  30773. * @category iServer ProcessingService SummaryRegion
  30774. * @classdesc 区域汇总分析服务类
  30775. * @extends {SuperMap.ProcessingServiceBase}
  30776. * @param {string} url - 区域汇总分析服务地址。
  30777. * @param {Object} options - 参数。
  30778. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30779. * @param {Object} [options.headers] - 请求头。
  30780. */
  30781. class SummaryRegionJobsService extends ProcessingServiceBase {
  30782. constructor(url, options) {
  30783. super(url, options);
  30784. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/summaryregion');
  30785. this.CLASS_NAME = 'SuperMap.SummaryRegionJobsService';
  30786. }
  30787. /**
  30788. *@override
  30789. */
  30790. destroy() {
  30791. super.destroy();
  30792. }
  30793. /**
  30794. * @function SuperMap.SummaryRegionJobsService.prototype.getSummaryRegionJobs
  30795. * @description 获取区域汇总分析任务集合。
  30796. */
  30797. getSummaryRegionJobs() {
  30798. super.getJobs(this.url);
  30799. }
  30800. /**
  30801. * @function SuperMap.SummaryRegionJobsService.prototype.getSummaryRegionJob
  30802. * @description 获取指定id的区域汇总分析任务。
  30803. * @param {string} id -要获取区域汇总分析任务的id
  30804. */
  30805. getSummaryRegionJob(id) {
  30806. super.getJobs(Util.urlPathAppend(this.url, id));
  30807. }
  30808. /**
  30809. * @function SuperMap.SummaryRegionJobsService.prototype.addSummaryRegionJob
  30810. * @description 新建区域汇总任务。
  30811. * @param {SuperMap.SummaryRegionJobParameter} params - 创建一个区域汇总任务的请求参数。
  30812. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  30813. */
  30814. addSummaryRegionJob(params, seconds) {
  30815. super.addJob(this.url, params, SummaryRegionJobParameter, seconds);
  30816. }
  30817. }
  30818. SuperMap.SummaryRegionJobsService = SummaryRegionJobsService;
  30819. ;// CONCATENATED MODULE: ./src/common/iServer/SupplyCenter.js
  30820. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30821. * This program are made available under the terms of the Apache License, Version 2.0
  30822. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30823. /**
  30824. * @class SuperMap.SupplyCenter
  30825. * @category iServer NetworkAnalyst Location
  30826. * @classdesc 资源供给中心类。在资源分配和选址分区分析两个功能中使用。
  30827. * @param {Object} options - 参数。
  30828. * @param {number} options.maxWeight - 资源供给中心的最大耗费值。
  30829. * @param {number} options.nodeID - 资源供给中心点的结点 ID 号。资源供给中心必须是结点。
  30830. * @param {number} options.resourceValue - 资源供给中心能提供的最大服务量或商品数量。
  30831. * @param {SuperMap.SupplyCenterType} [options.type] - 资源供给中心点的类型常量。
  30832. */
  30833. class SupplyCenter {
  30834. constructor(options) {
  30835. /**
  30836. * @member {number} SuperMap.SupplyCenter.prototype.maxWeight
  30837. * @description 资源供给中心的最大耗费值。中心点最大阻值设置越小,表示中心点所提供的资源可影响范围越大。
  30838. * 最大阻力值是用来限制需求点到中心点的花费。
  30839. * 如果需求点(弧段或结点)到此中心的花费大于最大阻力值,则该需求点不属于该资源供给中心提供资源的范围。
  30840. */
  30841. this.maxWeight = null;
  30842. /**
  30843. * @member {number} SuperMap.SupplyCenter.prototype.nodeID
  30844. * @description 资源供给中心点的结点 ID 号,资源供给中心必须是结点。
  30845. */
  30846. this.nodeID = null;
  30847. /**
  30848. * @member {number} SuperMap.SupplyCenter.prototype.resourceValue
  30849. * @description 资源供给中心能提供的最大服务量或商品数量。例如资源中心为学校,资源中心资源量表示该学校能够接纳多少学生。
  30850. */
  30851. this.resourceValue = null;
  30852. /**
  30853. * @member {SuperMap.SupplyCenterType} [SuperMap.SupplyCenter.prototype.type]
  30854. * @description 资源供给中心点的类型常量。资源供给中心点的类型包括非中心,固定中心和可选中心。
  30855. * 固定中心用于资源分配分析;固定中心和可选中心用于选址分析;非中心在两种网络分析时都不予考虑。
  30856. */
  30857. this.type = null;
  30858. if (options) {
  30859. Util.extend(this, options);
  30860. }
  30861. this.CLASS_NAME = "SuperMap.SupplyCenter";
  30862. }
  30863. /**
  30864. * @function SuperMap.SupplyCenter.prototype.destroy
  30865. * @description 释放资源,将引用资源的属性置空。
  30866. */
  30867. destroy() {
  30868. var me = this;
  30869. me.maxWeight = null;
  30870. me.nodeID = null;
  30871. me.resourceValue = null;
  30872. me.type = null;
  30873. }
  30874. /**
  30875. * @function SuperMap.SupplyCenter.fromJson
  30876. * @description 将服务端 JSON 对象转换成当前客户端对象。
  30877. * @param {Object} jsonObject - 要转换的 JSON 对象。
  30878. * @returns {SuperMap.SupplyCenter} SupplyCenter 对象。
  30879. */
  30880. static fromJson(jsonObject) {
  30881. if (!jsonObject) {
  30882. return;
  30883. }
  30884. return new SupplyCenter({
  30885. maxWeight: jsonObject.maxWeight,
  30886. nodeID: jsonObject.nodeID,
  30887. resourceValue: jsonObject.resourceValue,
  30888. type: jsonObject.type
  30889. });
  30890. }
  30891. }
  30892. SuperMap.SupplyCenter = SupplyCenter;
  30893. ;// CONCATENATED MODULE: ./src/common/iServer/SurfaceAnalystService.js
  30894. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30895. * This program are made available under the terms of the Apache License, Version 2.0
  30896. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30897. /**
  30898. * @class SuperMap.SurfaceAnalystService
  30899. * @category iServer SpatialAnalyst SurfaceAnalyst
  30900. * @classdesc 表面分析服务类。
  30901. * 该类负责将客户设置的表面分析服务参数传递给服务端,并接收服务端返回的表面分析服务分析结果数据。
  30902. * 表面分析结果通过该类支持的事件的监听函数参数获取
  30903. * @param {string} url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst
  30904. * @param {Object} options - 参数。</br>
  30905. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  30906. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30907. * @param {Object} [options.headers] - 请求头。
  30908. * @extends {SuperMap.SpatialAnalystBase}
  30909. * @example 例如:
  30910. * (start code)
  30911. * var mySurfaceAnalystService = new SuperMap.SurfaceAnalystService(url, {
  30912. * eventListeners: {
  30913. * "processCompleted": surfaceAnalysCompleted,
  30914. * "processFailed": surfaceAnalysFailed
  30915. * }
  30916. * });
  30917. * (end)
  30918. *
  30919. */
  30920. class SurfaceAnalystService extends SpatialAnalystBase {
  30921. constructor(url, options) {
  30922. super(url, options);
  30923. this.CLASS_NAME = "SuperMap.SurfaceAnalystService";
  30924. }
  30925. /**
  30926. * @function SuperMap.SurfaceAnalystService.prototype.destroy
  30927. * @description 释放资源,将引用的资源属性置空。
  30928. */
  30929. destroy() {
  30930. super.destroy();
  30931. }
  30932. /**
  30933. * @function SuperMap.SurfaceAnalystService.prototype.processAsync
  30934. * @description 负责将客户端的表面分析服务参数传递到服务端。
  30935. * @param {SuperMap.SurfaceAnalystParameters} params - 表面分析提取操作参数类。
  30936. */
  30937. processAsync(params) {
  30938. if (!(params instanceof SurfaceAnalystParameters)) {
  30939. return;
  30940. }
  30941. var me = this, jsonParameters;
  30942. jsonParameters = me.getJsonParameters(params);
  30943. me.request({
  30944. method: "POST",
  30945. data: jsonParameters,
  30946. scope: me,
  30947. success: me.serviceProcessCompleted,
  30948. failure: me.serviceProcessFailed
  30949. });
  30950. }
  30951. /**
  30952. * @function SuperMap.SurfaceAnalystService.prototype.getJsonParameters
  30953. * @description 将参数转化为 JSON 字符串。
  30954. * @param {SuperMap.SurfaceAnalystParameters} params - 表面分析提取操作参数类。
  30955. * @returns {Object} 转化后的JSON字符串。
  30956. */
  30957. getJsonParameters(params) {
  30958. var jsonParameters = '';
  30959. var parameterObject = {};
  30960. var me = this;
  30961. if (params instanceof DatasetSurfaceAnalystParameters) {
  30962. me.url = Util.urlPathAppend(
  30963. me.url,
  30964. 'datasets/' + params.dataset + '/' + params.surfaceAnalystMethod.toLowerCase()
  30965. );
  30966. DatasetSurfaceAnalystParameters.toObject(params, parameterObject);
  30967. jsonParameters = Util.toJSON(parameterObject);
  30968. } else if (params instanceof GeometrySurfaceAnalystParameters) {
  30969. me.url = Util.urlPathAppend(me.url, 'geometry/' + params.surfaceAnalystMethod.toLowerCase());
  30970. jsonParameters = Util.toJSON(params);
  30971. } else {
  30972. return;
  30973. }
  30974. me.url = Util.urlAppend(me.url, 'returnContent=true');
  30975. return jsonParameters;
  30976. }
  30977. }
  30978. SuperMap.SurfaceAnalystService = SurfaceAnalystService;
  30979. ;// CONCATENATED MODULE: ./src/common/iServer/TerrainCurvatureCalculationParameters.js
  30980. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30981. * This program are made available under the terms of the Apache License, Version 2.0
  30982. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30983. /**
  30984. * @class SuperMap.TerrainCurvatureCalculationParameters
  30985. * @category iServer SpatialAnalyst TerrainCalculation
  30986. * @classdesc 地形曲率计算参数类。
  30987. * @param {Object} options - 参数。
  30988. * @param {string} options.dataset - 要用来做地形曲率计算数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示,例如:JingjinTerrain@Jingjin。
  30989. * @param {string} options.averageCurvatureName - 结果数据集:平均曲率数据集的名称。
  30990. * @param {string} options.profileCurvatureName - 结果数据集:剖面曲率数据集的名称。
  30991. * @param {string} options.planCurvatureName - 结果数据集:平面曲率数据集的名称。
  30992. * @param {number} [options.zFactor=1.0] - 指定的高程缩放系数。1.0 表示不缩放。
  30993. * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  30994. */
  30995. class TerrainCurvatureCalculationParameters {
  30996. constructor(options) {
  30997. if (!options) {
  30998. return;
  30999. }
  31000. /**
  31001. * @member {string} SuperMap.TerrainCurvatureCalculationParameters.prototype.dataset
  31002. * @description 要用来做地形曲率计算数据源中数据集的名称。
  31003. * 该名称用形如"数据集名称@数据源别名"形式来表示,例如:JingjinTerrain@Jingjin。
  31004. * 注:地形曲率计算必须为栅格数据集。
  31005. */
  31006. this.dataset = null;
  31007. /**
  31008. * @member {number} [SuperMap.TerrainCurvatureCalculationParameters.prototype.zFactor=1.0]
  31009. * @description 指定的高程缩放系数。1.0 表示不缩放。
  31010. * 该值是指在 DEM 栅格数据中,栅格值( Z 坐标,即高程值)相对于 X 和 Y 坐标的单位变换系数。
  31011. * 通常有 X,Y,Z 都参加的计算中,需要将高程值乘以一个高程缩放系数,使得三者单位一致。
  31012. * 例如,X、Y 方向上的单位是米,而 Z 方向的单位是英尺,由于 1 英尺等于 0.3048 米,则需要指定缩放系数为 0.3048。
  31013. */
  31014. this.zFactor = 1.0;
  31015. /**
  31016. * @member {string} SuperMap.TerrainCurvatureCalculationParameters.prototype.averageCurvatureName
  31017. * @description 结果数据集:平均曲率数据集的名称。
  31018. */
  31019. this.averageCurvatureName = null;
  31020. /**
  31021. * @member {string} SuperMap.TerrainCurvatureCalculationParameters.prototype.profileCurvatureName
  31022. * @description 结果数据集:剖面曲率数据集的名称。
  31023. */
  31024. this.profileCurvatureName = "";
  31025. /**
  31026. * @member {string} SuperMap.TerrainCurvatureCalculationParameters.prototype.planCurvatureName
  31027. * @description 结果数据集:平面曲率数据集的名称。
  31028. */
  31029. this.planCurvatureName = "";
  31030. /**
  31031. * @member {boolean} [SuperMap.TerrainCurvatureCalculationParameters.prototype.deleteExistResultDataset=false]
  31032. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  31033. */
  31034. this.deleteExistResultDataset = false;
  31035. Util.extend(this, options);
  31036. this.CLASS_NAME = "SuperMap.TerrainCurvatureCalculationParameters";
  31037. }
  31038. /**
  31039. * @function SuperMap.TerrainCurvatureCalculationParameters.prototype.destroy
  31040. * @description 释放资源,将引用资源的属性置空。
  31041. */
  31042. destroy() {
  31043. var me = this;
  31044. me.dataset = null;
  31045. me.zFactor = 1.0;
  31046. me.averageCurvatureName = null;
  31047. me.profileCurvatureName = null;
  31048. me.planCurvatureName = null;
  31049. me.deleteExistResultDataset = true;
  31050. }
  31051. /**
  31052. * @function SuperMap.TerrainCurvatureCalculationParameters.toObject
  31053. * @param {Object} derrainCurvatureCalculationParameters - 地形曲率计算参数。
  31054. * @param {Object} tempObj - 目标对象。
  31055. * @description 生成地形曲率计算对象。
  31056. */
  31057. static toObject(derrainCurvatureCalculationParameters, tempObj) {
  31058. for (var name in derrainCurvatureCalculationParameters) {
  31059. if (name !== "dataset") {
  31060. tempObj[name] = derrainCurvatureCalculationParameters[name];
  31061. }
  31062. }
  31063. }
  31064. }
  31065. SuperMap.TerrainCurvatureCalculationParameters = TerrainCurvatureCalculationParameters;
  31066. ;// CONCATENATED MODULE: ./src/common/iServer/TerrainCurvatureCalculationService.js
  31067. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31068. * This program are made available under the terms of the Apache License, Version 2.0
  31069. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31070. /**
  31071. * @class SuperMap.TerrainCurvatureCalculationService
  31072. * @category iServer SpatialAnalyst TerrainCalculation
  31073. * @classdesc 地形曲率计算服务类。
  31074. * @extends {SuperMap.SpatialAnalystBase}
  31075. * @param {Object} options - 参数。
  31076. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  31077. * @param {string} options.url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst 。
  31078. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31079. * @param {Object} [options.headers] - 请求头。
  31080. * @example 例如:
  31081. * (start code)
  31082. * var myTerrainCurvatureCalculationService = new SuperMap.TerrainCurvatureCalculationService(url);
  31083. * myTerrainCurvatureCalculationService.on({
  31084. * "processCompleted": processCompleted,
  31085. * "processFailed": processFailed
  31086. * }
  31087. * );
  31088. * (end)
  31089. *
  31090. */
  31091. class TerrainCurvatureCalculationService extends SpatialAnalystBase {
  31092. constructor(url, options) {
  31093. super(url, options);
  31094. this.CLASS_NAME = "SuperMap.TerrainCurvatureCalculationService";
  31095. }
  31096. /**
  31097. *@override
  31098. */
  31099. destroy() {
  31100. super.destroy();
  31101. }
  31102. /**
  31103. * @function SuperMap.TerrainCurvatureCalculationService.prototype.processAsync
  31104. * @description 负责将客户端的查询参数传递到服务端。
  31105. * @param {SuperMap.TerrainCurvatureCalculationParameters} parameter - 地形曲率计算参数类。
  31106. */
  31107. processAsync(parameter) {
  31108. var me = this;
  31109. var parameterObject = {};
  31110. if (parameter instanceof TerrainCurvatureCalculationParameters) {
  31111. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/terraincalculation/curvature');
  31112. }
  31113. TerrainCurvatureCalculationParameters.toObject(parameter, parameterObject);
  31114. var jsonParameters = SuperMap.Util.toJSON(parameterObject);
  31115. me.url = Util.urlAppend(me.url, 'returnContent=true');
  31116. me.request({
  31117. method: "POST",
  31118. data: jsonParameters,
  31119. scope: me,
  31120. success: me.serviceProcessCompleted,
  31121. failure: me.serviceProcessFailed
  31122. });
  31123. }
  31124. }
  31125. SuperMap.TerrainCurvatureCalculationService = TerrainCurvatureCalculationService;
  31126. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGridRangeItem.js
  31127. /* Copyright© 2000 - 2021 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 SuperMap.ThemeGridRangeItem
  31132. * @category iServer Map Theme
  31133. * @classdesc 栅格分段专题图子项类。
  31134. * @description 在栅格分段专题图中,将栅格值按照某种分段模式被分成多个范围段。
  31135. * 本类用来设置每个范围段的分段起始值、终止值、名称和颜色等。每个分段所表示的范围为 [Start,End)。
  31136. * @param {Object} options - 参数。
  31137. * @param {SuperMap.ServerColor} options.color - 栅格分段专题图中每一个分段专题图子项的对应的颜色。
  31138. * @param {string} [options.caption] - 栅格分段专题图子项的标题。
  31139. * @param {number} [options.end=0] - 栅格分段专题图子项的终止值。
  31140. * @param {number} [options.start=0] - 栅格分段专题图子项的起始值。
  31141. * @param {boolean} [options.visible=true] - 栅格分段专题图子项是否可见。
  31142. */
  31143. class ThemeGridRangeItem {
  31144. constructor(options) {
  31145. /**
  31146. * @member {string} [SuperMap.ThemeGridRangeItem.prototype.caption]
  31147. * @description 栅格分段专题图子项的标题。
  31148. */
  31149. this.caption = null;
  31150. /**
  31151. * @member {SuperMap.ServerColor} SuperMap.ThemeGridRangeItem.prototype.color
  31152. * @description 栅格分段专题图中每一个分段专题图子项的对应的颜色。
  31153. */
  31154. this.color = new ServerColor();
  31155. /**
  31156. * @member {number} [SuperMap.ThemeGridRangeItem.prototype.end=0]
  31157. * @description 栅格分段专题图子项的终止值,即该段专题值范围的最大值。
  31158. */
  31159. this.end = 0;
  31160. /**
  31161. * @member {number} [SuperMap.ThemeGridRangeItem.prototype.start=0]
  31162. * @description 栅格分段专题图子项的起始值,即该段专题值范围的最小值。
  31163. */
  31164. this.start = 0;
  31165. /**
  31166. * @member {boolean} [SuperMap.ThemeGridRangeItem.prototype.visible=true]
  31167. * @description 栅格分段专题图子项是否可见。
  31168. */
  31169. this.visible = true;
  31170. if (options) {
  31171. Util.extend(this, options);
  31172. }
  31173. this.CLASS_NAME = "SuperMap.ThemeGridRangeItem";
  31174. }
  31175. /**
  31176. * @function SuperMap.ThemeGridRangeItem.prototype.destroy
  31177. * @description 释放资源,将引用资源的属性置空。
  31178. */
  31179. destroy() {
  31180. var me = this;
  31181. me.caption = null;
  31182. me.end = null;
  31183. me.start = null;
  31184. //需要验证是够存在destroy方法
  31185. if (me.color) {
  31186. me.color.destroy();
  31187. me.color = null;
  31188. }
  31189. me.visible = null;
  31190. }
  31191. /**
  31192. * @function SuperMap.ThemeGridRangeItem.prototype.toServerJSONObject
  31193. * @description 转换成对应的 JSON 格式对象。
  31194. * @returns {Object} 对应的 JSON 格式对象。
  31195. */
  31196. toServerJSONObject() {
  31197. var obj = {};
  31198. obj = Util.copyAttributes(obj, this);
  31199. if (obj.color) {
  31200. if (obj.color.toServerJSONObject) {
  31201. obj.color = obj.color.toServerJSONObject();
  31202. }
  31203. }
  31204. return obj;
  31205. }
  31206. /**
  31207. * @function SuperMap.ThemeGridRangeItem.fromObj
  31208. * @description 从传入对象获取栅格分段专题图子项类。
  31209. * @param {Object} obj - 传入对象。
  31210. * @returns {SuperMap.ThemeGridRangeItem} ThemeGridRangeItem 对象。
  31211. */
  31212. static fromObj(obj) {
  31213. if (!obj) {
  31214. return;
  31215. }
  31216. var res = new ThemeGridRangeItem();
  31217. Util.copy(res, obj);
  31218. res.color = ServerColor.fromJson(obj.color);
  31219. return res;
  31220. }
  31221. }
  31222. SuperMap.ThemeGridRangeItem = ThemeGridRangeItem;
  31223. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGridRange.js
  31224. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31225. * This program are made available under the terms of the Apache License, Version 2.0
  31226. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31227. /**
  31228. * @class SuperMap.ThemeGridRange
  31229. * @category iServer Map Theme
  31230. * @classdesc 栅格分段专题图。
  31231. * @description 栅格分段专题图,是将所有单元格的值按照某种分段方式分成多个范围段,值在同一个范围段中的单元格使用相同的颜色进行显示。
  31232. * 栅格分段专题图一般用来反映连续分布现象的数量或程度特征。比如某年的全国降水量分布图,将各气象站点的观测值经过内插之后生成的栅格数据进行分段显示。
  31233. * 该类类似于分段专题图类,不同点在于分段专题图的操作对象是矢量数据,而栅格分段专题图的操作对象是栅格数据。
  31234. * @extends {SuperMap.Theme}
  31235. * @param {Object} options - 参数。
  31236. * @param {Array.<SuperMap.ThemeGridRangeItem>} options.items - 栅格分段专题图子项数组。
  31237. * @param {boolean} [options.reverseColor=false] - 是否对栅格分段专题图中分段的颜色风格进行反序显示。
  31238. * @param {SuperMap.RangeMode} [options.rangeMode=SuperMap.RangeMode.EQUALINTERVAL] - 分段专题图的分段模式。
  31239. * @param {number} [options.rangeParameter=0] - 分段参数。
  31240. * @param {SuperMap.ColorGradientType} [options.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED] - 渐变颜色枚举类。
  31241. */
  31242. class ThemeGridRange extends Theme {
  31243. constructor(options) {
  31244. super("GRIDRANGE", options);
  31245. /**
  31246. * @member {Array.<SuperMap.ThemeGridRangeItem>} SuperMap.ThemeGridRange.prototype.items
  31247. * @description 栅格分段专题图子项数组。<br>
  31248. * 在栅格分段专题图中,将栅格值按照某种分段模式被分成多个范围段。
  31249. * 本类用来设置每个栅格范围段的分段起始值、终止值、名称和颜色等。每个分段所表示的范围为 [Start,End)。
  31250. */
  31251. this.items = null;
  31252. /**
  31253. * @member {SuperMap.RangeMode} [SuperMap.ThemeGridRange.prototype.rangeMode=SuperMap.RangeMode.EQUALINTERVAL]
  31254. * @description 分段专题图的分段模式。<br>
  31255. * 在栅格分段专题图中,作为专题变量的字段或表达式的值按照某种分段方式被分成多个范围段。
  31256. * 目前 SuperMap 提供的分段方式包括:等距离分段法、平方根分段法、标准差分段法、对数分段法、等计数分段法和自定义距离法,
  31257. * 显然这些分段方法根据一定的距离进行分段,因而范围分段专题图所基于的专题变量必须为数值型。
  31258. */
  31259. this.rangeMode = RangeMode.EQUALINTERVAL;
  31260. /**
  31261. * @member {number} [SuperMap.ThemeGridRange.prototype.rangeParameter=0]
  31262. * @description 分段参数。<br>
  31263. * 当分段模式为等距离分段法,平方根分段,对数分段法,计数分段法其中一种模式时,该参数用于设置分段个数,必设;当分段模式为标准差分段法时,
  31264. * 该参数不起作用;当分段模式为自定义距离时,该参数用于设置自定义距离。
  31265. */
  31266. this.rangeParameter = 0;
  31267. /**
  31268. * @member {SuperMap.ColorGradientType} [SuperMap.ThemeGridRange.prototype.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED]
  31269. * @description 渐变颜色枚举类。
  31270. *
  31271. */
  31272. this.colorGradientType = ColorGradientType.YELLOW_RED;
  31273. /**
  31274. * @member {boolean} SuperMap.ThemeGridRange.prototype.reverseColor
  31275. * @description 是否对栅格分段专题图中分段的颜色风格进行反序显示。
  31276. */
  31277. this.reverseColor = false;
  31278. if (options) {
  31279. Util.extend(this, options);
  31280. }
  31281. this.CLASS_NAME = "SuperMap.ThemeGridRange";
  31282. }
  31283. /**
  31284. * @function SuperMap.ThemeGridRange.prototype.destroy
  31285. * @override
  31286. */
  31287. destroy() {
  31288. super.destroy();
  31289. var me = this;
  31290. if (me.items) {
  31291. if (me.items.length > 0) {
  31292. for (var item in me.items) {
  31293. me.items[item].destroy();
  31294. me.items[item] = null;
  31295. }
  31296. }
  31297. me.items = null;
  31298. }
  31299. me.reverseColor = null;
  31300. me.rangeMode = null;
  31301. me.rangeParameter = null;
  31302. me.colorGradientType = null;
  31303. }
  31304. /**
  31305. * @function SuperMap.ThemeGridRange.fromObj
  31306. * @description 从传入对象获取栅格分段专题图。
  31307. * @param {Object} obj - 传入对象。
  31308. * @returns {SuperMap.ThemeGridRange} ThemeGridRange 对象。
  31309. */
  31310. static fromObj(obj) {
  31311. if (!obj) {
  31312. return;
  31313. }
  31314. var res = new ThemeGridRange();
  31315. Util.copy(res, obj);
  31316. var itemsR = obj.items;
  31317. var len = itemsR ? itemsR.length : 0;
  31318. res.items = [];
  31319. for (var i = 0; i < len; i++) {
  31320. res.items.push(ThemeGridRangeItem.fromObj(itemsR[i]));
  31321. }
  31322. return res;
  31323. }
  31324. }
  31325. SuperMap.ThemeGridRange = ThemeGridRange;
  31326. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGridUniqueItem.js
  31327. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31328. * This program are made available under the terms of the Apache License, Version 2.0
  31329. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31330. /**
  31331. * @class SuperMap.ThemeGridUniqueItem
  31332. * @category iServer Map Theme
  31333. * @classdesc 栅格单值专题图子项类。
  31334. * 栅格单值专题图是将值相同的单元格归为一类,每一类是一个专题图子项。
  31335. * @param {Object} options - 参数。
  31336. * @param {string} [options.caption] - 栅格单值专题图子项的名称。
  31337. * @param {SuperMap.ServerColor} [options.color] - 栅格单值专题图子项的显示颜色。
  31338. * @param {number} options.unique - 栅格单值专题图子项的专题值,即单元格的值,值相同的单元格位于一个子项内。
  31339. * @param {boolean} [options.visible=true] - 栅格单值专题图子项是否可见。
  31340. */
  31341. class ThemeGridUniqueItem {
  31342. constructor(options) {
  31343. /**
  31344. * @member {string} [SuperMap.ThemeGridUniqueItem.prototype.caption]
  31345. * @description 栅格单值专题图子项的名称。
  31346. */
  31347. this.caption = null;
  31348. /**
  31349. * @member {SuperMap.ServerColor} [SuperMap.ThemeGridUniqueItem.prototype.color]
  31350. * @description 栅格单值专题图子项的显示颜色。
  31351. */
  31352. this.color = new ServerColor();
  31353. /**
  31354. * @member {number} SuperMap.ThemeGridUniqueItem.prototype.unique
  31355. * @description 栅格单值专题图子项的专题值,即单元格的值,值相同的单元格位于一个子项内。
  31356. */
  31357. this.unique = null;
  31358. /**
  31359. * @member {boolean} [SuperMap.ThemeGridUniqueItem.prototype.visible=true]
  31360. * @description 栅格单值专题图子项是否可见。
  31361. */
  31362. this.visible = true;
  31363. if (options) {
  31364. Util.extend(this, options);
  31365. }
  31366. this.CLASS_NAME = "SuperMap.ThemeGridUniqueItem";
  31367. }
  31368. /**
  31369. * @function SuperMap.ThemeGridUniqueItem.prototype.destroy
  31370. * @description 释放资源,将引用资源的属性置空。
  31371. */
  31372. destroy() {
  31373. var me = this;
  31374. me.caption = null;
  31375. me.unique = null;
  31376. if (me.color) {
  31377. me.color.destroy();
  31378. me.color = null;
  31379. }
  31380. me.visible = null;
  31381. }
  31382. /**
  31383. * @function SuperMap.ThemeGridUniqueItem.prototype.toServerJSONObject
  31384. * @description 转换成对应的 JSON 格式对象。
  31385. * @returns {Object} 对应的 JSON 格式对象。
  31386. */
  31387. toServerJSONObject() {
  31388. var obj = {};
  31389. obj = Util.copyAttributes(obj, this);
  31390. if (obj.color) {
  31391. if (obj.color.toServerJSONObject) {
  31392. obj.color = obj.color.toServerJSONObject();
  31393. }
  31394. }
  31395. return obj;
  31396. }
  31397. /**
  31398. * @function SuperMap.ThemeGridUniqueItem.fromObj
  31399. * @description 从传入对象获取栅格单值专题图子项类。
  31400. * @param {Object} obj - 传入对象。
  31401. * @returns {SuperMap.ThemeGridUniqueItem} ThemeGridUniqueItem 对象。
  31402. */
  31403. static fromObj(obj) {
  31404. var res = new ThemeGridUniqueItem();
  31405. Util.copy(res, obj);
  31406. res.color = ServerColor.fromJson(obj.color);
  31407. return res;
  31408. }
  31409. }
  31410. SuperMap.ThemeGridUniqueItem = ThemeGridUniqueItem;
  31411. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGridUnique.js
  31412. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31413. * This program are made available under the terms of the Apache License, Version 2.0
  31414. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31415. /**
  31416. * @class SuperMap.ThemeGridUnique
  31417. * @category iServer Map Theme
  31418. * @classdesc 栅格单值专题图类。
  31419. * @description 栅格单值专题图,是将单元格值相同的归为一类,为每一类设定一种颜色,从而用来区分不同的类别。<br>
  31420. * 栅格单值专题图适用于离散栅格数据和部分连续栅格数据,对于单元格值各不相同的那些连续栅格数据,使用栅格单值专题图不具有任何意义。
  31421. * @extends {SuperMap.Theme}
  31422. * @param {Object} options - 参数。
  31423. * @param {Array.<SuperMap.ThemeGridUniqueItem>} options.items - 栅格单值专题图子项数组。
  31424. * @param {SuperMap.ServerColor} [options.defaultcolor] - 栅格单值专题图的默认颜色。
  31425. */
  31426. class ThemeGridUnique extends Theme {
  31427. constructor(options) {
  31428. super("GRIDUNIQUE", options);
  31429. /**
  31430. * @member {SuperMap.ServerColor} SuperMap.ThemeGridUnique.prototype.defaultcolor
  31431. * @description 栅格单值专题图的默认颜色。
  31432. * 对于那些未在格网单值专题图子项之列的要素使用该颜色显示。
  31433. */
  31434. this.defaultcolor = new ServerColor();
  31435. /**
  31436. * @member {Array.<SuperMap.ThemeGridUniqueItem>} SuperMap.ThemeGridUnique.prototype.items
  31437. * @description 栅格单值专题图子项数组。
  31438. * 栅格单值专题图将值相同的单元格归为一类,每一类是一个专题图子项。
  31439. */
  31440. this.items = null;
  31441. if (options) {
  31442. Util.extend(this, options);
  31443. }
  31444. this.CLASS_NAME = "SuperMap.ThemeGridUnique";
  31445. }
  31446. /**
  31447. * @function SuperMap.ThemeGridUnique.prototype.destroy
  31448. * @override
  31449. */
  31450. destroy() {
  31451. super.destroy();
  31452. var me = this;
  31453. if (me.items) {
  31454. if (me.items.length > 0) {
  31455. for (var item in me.items) {
  31456. me.items[item].destroy();
  31457. me.items[item] = null;
  31458. }
  31459. }
  31460. me.items = null;
  31461. }
  31462. if (me.defaultcolor) {
  31463. me.defaultcolor.destroy();
  31464. me.defaultcolor = null;
  31465. }
  31466. }
  31467. /**
  31468. * @function SuperMap.ThemeGridUnique.prototype.toServerJSONObject
  31469. * @description 转换成对应的 JSON 格式对象。
  31470. * @returns {Object} 对应的 JSON 格式对象
  31471. */
  31472. toServerJSONObject() {
  31473. var obj = {};
  31474. obj = Util.copyAttributes(obj, this);
  31475. if (obj.defaultcolor) {
  31476. if (obj.defaultcolor.toServerJSONObject) {
  31477. obj.defaultcolor = obj.defaultcolor.toServerJSONObject();
  31478. }
  31479. }
  31480. if (obj.items) {
  31481. var items = [],
  31482. len = obj.items.length;
  31483. for (var i = 0; i < len; i++) {
  31484. items.push(obj.items[i].toServerJSONObject());
  31485. }
  31486. obj.items = items;
  31487. }
  31488. return obj;
  31489. }
  31490. /**
  31491. * @function SuperMap.ThemeGridUnique.fromObj
  31492. * @description 从传入对象获取栅格单值专题图类。
  31493. * @param {Object} obj - 传入对象
  31494. * @returns {SuperMap.ThemeGridUnique} ThemeGridUnique 对象
  31495. */
  31496. static fromObj(obj) {
  31497. var res = new ThemeGridUnique();
  31498. var uItems = obj.items;
  31499. var len = uItems ? uItems.length : 0;
  31500. Util.extend(res, obj);
  31501. res.items = [];
  31502. res.defaultcolor = ServerColor.fromJson(obj.defaultcolor);
  31503. for (var i = 0; i < len; i++) {
  31504. res.items.push(ThemeGridUniqueItem.fromObj(uItems[i]));
  31505. }
  31506. return res;
  31507. }
  31508. }
  31509. SuperMap.ThemeGridUnique = ThemeGridUnique;
  31510. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelUniqueItem.js
  31511. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31512. * This program are made available under the terms of the Apache License, Version 2.0
  31513. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31514. /**
  31515. * @class SuperMap.ThemeLabelUniqueItem
  31516. * @category iServer Map Theme
  31517. * @classdesc 单值标签专题图的子项。
  31518. * @description 标签专题图用专题值对点、线、面等对象做标注,值得注意的是,单值标签专题图允许用户通过 uniqueExpression
  31519. * 字段指定用于单值的字段,同一值的标签具有相同的显示风格,其中每一个值就是一个专题图子项,
  31520. * 每一个子项都具有其名称、风格、指定的单值、X 方向偏移量和 Y 方向偏移量。
  31521. * @param {Object} options - 参数。
  31522. * @param {string} options.unique - 单值专题图子项的值,可以为数字、字符串等。
  31523. * @param {string} [options.caption] - 专题图子项的名称。
  31524. * @param {number} [options.offsetX=0] - 标签在 X 方向偏移量。
  31525. * @param {number} [options.offsetY=0] - 标签在 Y 方向偏移量。
  31526. * @param {boolean} [options.visible=true] - 标签专题图子项是否可见。
  31527. * @param {SuperMap.ServerTextStyle} [options.style] - 标签专题图子项文本的显示风格。
  31528. */
  31529. class ThemeLabelUniqueItem {
  31530. constructor(options) {
  31531. /**
  31532. * @member {string} [SuperMap.ThemeLabelUniqueItem.prototype.caption]
  31533. * @description 标签专题子项的标题。
  31534. */
  31535. this.caption = null;
  31536. /**
  31537. * @member {string} SuperMap.ThemeLabelUniqueItem.prototype.unique
  31538. * @description 单值专题图子项的值,可以为数字、字符串等。
  31539. */
  31540. this.unique = null;
  31541. /**
  31542. * @member {number} [SuperMap.ThemeLabelUniqueItem.prototype.offsetX=0]
  31543. * @description 标签在 X 方向偏移量。
  31544. */
  31545. this.offsetX = 0;
  31546. /**
  31547. * @member {number} [SuperMap.ThemeLabelUniqueItem.prototype.offsetY=0]
  31548. * @description 标签在 Y 方向偏移量。
  31549. */
  31550. this.offsetY = 0;
  31551. /**
  31552. * @member {boolean} [SuperMap.ThemeLabelUniqueItem.prototype.visible=true]
  31553. * @description 标签专题图子项是否可见。如果标签专题图子项可见,则为 true,否则为 false。
  31554. */
  31555. this.visible = true;
  31556. /**
  31557. * @member {SuperMap.ServerTextStyle} SuperMap.ThemeLabelUniqueItem.prototype.style
  31558. * @description 标签专题图子项文本的显示风格。各种风格的优先级从高到低为:<br>
  31559. * uniformMixedStyle(标签文本的复合风格),SuperMap.ThemeLabelUniqueItem.style(单值子项的文本风格),uniformStyle(统一文本风格)。
  31560. */
  31561. this.style = new ServerTextStyle();
  31562. if (options) {
  31563. Util.extend(this, options);
  31564. }
  31565. this.CLASS_NAME = "SuperMap.ThemeLabelUniqueItem";
  31566. }
  31567. /**
  31568. * @function SuperMap.ThemeLabelUniqueItem.prototype.destroy
  31569. * @description 释放资源,将引用资源的属性置空。
  31570. */
  31571. destroy() {
  31572. var me = this;
  31573. me.unique = null;
  31574. me.caption = null;
  31575. me.offsetX = null;
  31576. me.offsetY = null;
  31577. if (me.style) {
  31578. me.style.destroy();
  31579. me.style = null;
  31580. }
  31581. me.visible = null;
  31582. }
  31583. /**
  31584. * @function SuperMap.ThemeLabelUniqueItem.fromObj
  31585. * @description 从传入对象获取单值标签专题图的子项类。
  31586. * @param {Object} obj - 传入对象。
  31587. * @returns {SuperMap.ThemeLabelUniqueItem} ThemeLabelUniqueItem 对象。
  31588. */
  31589. static fromObj(obj) {
  31590. if (!obj) {
  31591. return;
  31592. }
  31593. var t = new ThemeLabelUniqueItem();
  31594. Util.copy(t, obj);
  31595. return t;
  31596. }
  31597. }
  31598. SuperMap.ThemeLabelUniqueItem = ThemeLabelUniqueItem;
  31599. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeParameters.js
  31600. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31601. * This program are made available under the terms of the Apache License, Version 2.0
  31602. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31603. /**
  31604. * @class SuperMap.ThemeParameters
  31605. * @category iServer Map Theme
  31606. * @classdesc 专题图参数类。
  31607. * 该类存储了制作专题所需的参数,包括数据源、数据集名称和专题图对象。
  31608. * @param {Object} options - 参数。
  31609. * @param {Array.<string>} options.datasetNames - 要制作专题图的数据集数组。
  31610. * @param {Array.<string>} options.dataSourceNames - 要制作专题图的数据集所在的数据源数组。
  31611. * @param {Array.<SuperMap.JoinItem>} [options.joinItems] - 专题图外部表的连接信息 JoinItem 数组。
  31612. * @param {Array.<SuperMap.Theme>} options.themes - 专题图对象列表。
  31613. * @param {Array.<string>} [options.displayFilters] - 专题图属性过滤条件。
  31614. * @param {Array.<string>} [options.displayOrderBys] - 专题图对象生成符号叠加次序排序字段。
  31615. * @param {Object} [options.fieldValuesDisplayFilter] - 图层要素的显示和隐藏的过滤属性,其带有三个属性,分别是:values、fieldName、fieldValuesDisplayMode。
  31616. */
  31617. class ThemeParameters {
  31618. constructor(options) {
  31619. /**
  31620. * @member {Array.<string>} SuperMap.ThemeParameters.prototype.datasetNames
  31621. * @description 要制作专题图的数据集数组。
  31622. */
  31623. this.datasetNames = null;
  31624. /**
  31625. * @member {Array.<string>} SuperMap.ThemeParameters.prototype.dataSourceNames
  31626. * @description 要制作专题图的数据集所在的数据源数组。
  31627. */
  31628. this.dataSourceNames = null;
  31629. /**
  31630. * @member {Array.<SuperMap.JoinItem>} [SuperMap.ThemeParameters.prototype.joinItems]
  31631. * @description 设置与外部表的连接信息 JoinItem 数组。
  31632. * 使用此属性可以制作与外部表连接的专题图。
  31633. */
  31634. this.joinItems = null;
  31635. /**
  31636. * @member {Array.<SuperMap.Theme>} SuperMap.ThemeParameters.prototype.themes
  31637. * @description 专题图对象列表。
  31638. * 该参数为实例化的各类专题图对象的集合。
  31639. */
  31640. this.themes = null;
  31641. /**
  31642. * @member {Array.<string>} [SuperMap.ThemeParameters.prototype.displayFilters]
  31643. * @description 专题图属性过滤条件。
  31644. */
  31645. this.displayFilters = null;
  31646. /**
  31647. * @member {Array.<string>} [SuperMap.ThemeParameters.prototype.displayOrderBys]
  31648. * @description 专题图对象生成符号叠加次序排序字段。
  31649. */
  31650. this.displayOrderBys = null;
  31651. /**
  31652. * @member {Object} [SuperMap.ThemeParameters.prototype.fieldValuesDisplayFilter]
  31653. * @property {Array.<number>} values - 需要过滤的值。
  31654. * @property {string} fieldName - 要过滤的字段名称只支持数字类型的字段。
  31655. * @property {string} fieldValuesDisplayMode - 目前为 DISPLAY/DISABLE。当为 DISPLAY 时,表示只显示以上设置的相应属性值的要素,否则表示不显示以上设置的相应属性值的要素。
  31656. */
  31657. this.fieldValuesDisplayFilter = null;
  31658. if (options) {
  31659. Util.extend(this, options);
  31660. }
  31661. this.CLASS_NAME = "SuperMap.ThemeParameters";
  31662. }
  31663. /**
  31664. * @function SuperMap.ThemeParameters.prototype.destroy
  31665. * @description 释放资源,将引用资源的属性置空。
  31666. */
  31667. destroy() {
  31668. var me = this;
  31669. me.datasetNames = null;
  31670. me.dataSourceNames = null;
  31671. if (me.joinItems) {
  31672. for (let i = 0, joinItems = me.joinItems, len = joinItems.length; i < len; i++) {
  31673. joinItems[i].destroy();
  31674. }
  31675. me.joinItems = null;
  31676. }
  31677. if (me.themes) {
  31678. for (let i = 0, themes = me.themes, len = themes.length; i < len; i++) {
  31679. themes[i].destroy();
  31680. }
  31681. me.themes = null;
  31682. }
  31683. }
  31684. }
  31685. SuperMap.ThemeParameters = ThemeParameters;
  31686. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeService.js
  31687. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31688. * This program are made available under the terms of the Apache License, Version 2.0
  31689. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31690. /**
  31691. * @class SuperMap.ThemeService
  31692. * @category iServer Map Theme
  31693. * @classdesc 专题图服务类。
  31694. * @extends {SuperMap.CommonServiceBase}
  31695. * @example
  31696. * var myThemeService = new SuperMap.ThemeService(url, {
  31697. * eventListeners: {
  31698. * "processCompleted": themeCompleted,
  31699. * "processFailed": themeFailed
  31700. * }
  31701. * });
  31702. * @param {string} url - 服务的访问地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 。
  31703. * @param {Object} options - 参数。
  31704. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  31705. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31706. * @param {Object} [options.headers] - 请求头。
  31707. */
  31708. class ThemeService extends CommonServiceBase {
  31709. constructor(url, options) {
  31710. super(url, options);
  31711. if (options) {
  31712. SuperMap.Util.extend(this, options);
  31713. }
  31714. this.url = Util.urlPathAppend(this.url, 'tempLayersSet');
  31715. this.CLASS_NAME = 'SuperMap.ThemeService';
  31716. }
  31717. /**
  31718. * @override
  31719. */
  31720. destroy() {
  31721. super.destroy();
  31722. }
  31723. /**
  31724. * @function SuperMap.ThemeService.prototype.processAsync
  31725. * @description 负责将客户端的专题图参数传递到服务端。
  31726. * @param {SuperMap.ThemeParameters} params - 专题图参数类。
  31727. */
  31728. processAsync(params) {
  31729. if (!(params instanceof ThemeParameters)) {
  31730. return;
  31731. }
  31732. var me = this,
  31733. jsonParameters = null;
  31734. jsonParameters = me.getJsonParameters(params);
  31735. me.request({
  31736. method: "POST",
  31737. data: jsonParameters,
  31738. scope: me,
  31739. success: me.serviceProcessCompleted,
  31740. failure: me.serviceProcessFailed
  31741. });
  31742. }
  31743. /**
  31744. * @function SuperMap.ThemeService.prototype.getJsonParameters
  31745. * @description 将专题图参数参数转化为 JSON 字符串。
  31746. * @param {SuperMap.ThemeParameters} parameter - 专题图参数类。
  31747. * @returns {Object} 转化后的JSON字符串。
  31748. */
  31749. getJsonParameters(parameter) {
  31750. var jsonParameters = "",
  31751. themeObj = null,
  31752. filters = null,
  31753. orderBys = null,
  31754. fieldValuesDisplayFilter;
  31755. jsonParameters += "[{'type': 'UGC','subLayers': {'layers': [";
  31756. for (var i = 0; i < parameter.themes.length; i++) {
  31757. themeObj = parameter.themes[i];
  31758. var jsonTheme = Util.toJSON(themeObj);
  31759. jsonTheme = jsonTheme.slice(0, -1);
  31760. jsonParameters += "{'theme': " + jsonTheme + "},'type': 'UGC','ugcLayerType': 'THEME',";
  31761. filters = parameter.displayFilters;
  31762. if (filters && filters.length > 0) {
  31763. if (filters.length === 1) {
  31764. jsonParameters += "'displayFilter':\"" + filters[0] + "\",";
  31765. } else {
  31766. jsonParameters += "'displayFilter':\"" + filters[i] + "\",";
  31767. }
  31768. }
  31769. orderBys = parameter.displayOrderBy;
  31770. if (orderBys && orderBys.length > 0) {
  31771. if (orderBys.length === 1) {
  31772. jsonParameters += "'displayOrderBy':'" + orderBys[0] + "',";
  31773. } else {
  31774. jsonParameters += "'displayOrderBy':'" + orderBys[i] + "',";
  31775. }
  31776. }
  31777. fieldValuesDisplayFilter = parameter.fieldValuesDisplayFilter;
  31778. if (fieldValuesDisplayFilter) {
  31779. jsonParameters += "'fieldValuesDisplayFilter':" + Util.toJSON(fieldValuesDisplayFilter) + ",";
  31780. }
  31781. if (parameter.joinItems && parameter.joinItems.length > 0 && parameter.joinItems[i]) {
  31782. jsonParameters += "'joinItems':[" + Util.toJSON(parameter.joinItems[i]) + "],";
  31783. }
  31784. if (parameter.datasetNames && parameter.dataSourceNames) {
  31785. var datasetID = parameter.datasetNames[i] ? i : (parameter.datasetNames.length - 1);
  31786. var dataSourceID = parameter.dataSourceNames[i] ? i : (parameter.dataSourceNames.length - 1);
  31787. jsonParameters += "'datasetInfo': {'name': '" + parameter.datasetNames[datasetID] +
  31788. "','dataSourceName': '" + parameter.dataSourceNames[dataSourceID] + "'}},";
  31789. } else {
  31790. jsonParameters += "},";
  31791. }
  31792. }
  31793. //去除多余的逗号
  31794. if (parameter.themes && parameter.themes.length > 0) {
  31795. jsonParameters = jsonParameters.substring(0, jsonParameters.length - 1);
  31796. }
  31797. jsonParameters += "]},";
  31798. var urlArray = this.url.split("/");
  31799. var jsonMapName = urlArray[urlArray.length - 2];
  31800. jsonParameters += "'name': '" + jsonMapName + "'}]";
  31801. return jsonParameters;
  31802. }
  31803. }
  31804. SuperMap.ThemeService = ThemeService;
  31805. ;// CONCATENATED MODULE: ./src/common/iServer/ThiessenAnalystService.js
  31806. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31807. * This program are made available under the terms of the Apache License, Version 2.0
  31808. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31809. /**
  31810. * @class SuperMap.ThiessenAnalystService
  31811. * @category iServer SpatialAnalyst ThiessenPolygonAnalyst
  31812. * @classdesc
  31813. * 泰森多边形分析服务类
  31814. * 该类负责将客户设置的泰森多边形分析参数传递给服务端,并接收服务端返回的分析结果数据。
  31815. * 泰森多边形分析结果通过该类支持的事件的监听函数参数获取
  31816. * 泰森多边形分析的参数支持两种,当参数为 {SuperMap.DatasetThiessenAnalystParameters} 类型
  31817. * 时,执行数据集泰森多边形分析,当参数为 {SuperMap.GeometryThiessenAnalystParameters} 类型时,
  31818. * 执行几何对象泰森多边形分析。
  31819. * @param url - {string} 服务的访问地址。
  31820. * 如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  31821. * @param {Object} options - 参数。</br>
  31822. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  31823. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31824. * @param {Object} [options.headers] - 请求头。
  31825. * @extends {SuperMap.SpatialAnalystBase}
  31826. * @example 例如:
  31827. * (start code)
  31828. * var myThiessenAnalystService = new SuperMap.ThiessenAnalystService(url, {
  31829. * eventListeners: {
  31830. * "processCompleted": bufferCompleted,
  31831. * "processFailed": bufferFailed
  31832. * }
  31833. * });
  31834. * (end)
  31835. *
  31836. */
  31837. class ThiessenAnalystService extends SpatialAnalystBase {
  31838. constructor(url, options) {
  31839. super(url, options);
  31840. /**
  31841. * @member {string} SuperMap.ThiessenAnalystService.prototype.mode
  31842. * @description 缓冲区分析类型
  31843. */
  31844. this.mode = null;
  31845. if (options) {
  31846. Util.extend(this, options);
  31847. }
  31848. this.CLASS_NAME = "SuperMap.ThiessenAnalystService";
  31849. }
  31850. /**
  31851. * @override
  31852. */
  31853. destroy() {
  31854. super.destroy();
  31855. this.mode = null;
  31856. }
  31857. /**
  31858. * @function SuperMap.ThiessenAnalystService.prototype.processAsync
  31859. * @description 负责将客户端的查询参数传递到服务端。
  31860. * @param {(SuperMap.DatasetThiessenAnalystParameters|GeometryThiessenAnalystParameters)} parameter - 泰森多边形分析参数基类。
  31861. */
  31862. processAsync(parameter) {
  31863. var parameterObject = {};
  31864. var me = this;
  31865. if (parameter instanceof DatasetThiessenAnalystParameters) {
  31866. me.mode = "datasets";
  31867. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/thiessenpolygon');
  31868. DatasetThiessenAnalystParameters.toObject(parameter, parameterObject);
  31869. } else if (parameter instanceof GeometryThiessenAnalystParameters) {
  31870. me.mode = "geometry";
  31871. me.url = Util.urlPathAppend(me.url, 'geometry/thiessenpolygon');
  31872. GeometryThiessenAnalystParameters.toObject(parameter, parameterObject);
  31873. }
  31874. var jsonParameters = Util.toJSON(parameterObject);
  31875. me.url = Util.urlAppend(me.url, 'returnContent=true');
  31876. me.request({
  31877. method: "POST",
  31878. data: jsonParameters,
  31879. scope: me,
  31880. success: me.serviceProcessCompleted,
  31881. failure: me.serviceProcessFailed
  31882. });
  31883. }
  31884. }
  31885. SuperMap.ThiessenAnalystService = ThiessenAnalystService;
  31886. ;// CONCATENATED MODULE: ./src/common/iServer/GeometryBatchAnalystService.js
  31887. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31888. * This program are made available under the terms of the Apache License, Version 2.0
  31889. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31890. /**
  31891. * @class SuperMap.GeometryBatchAnalystService
  31892. * @category iServer SpatialAnalyst BatchAnalyst
  31893. * @classdesc 批量空间分析服务类
  31894. * @description 该类负责将客户设置的叠加分析参数传递给服务端,并接收服务端返回的叠加分析结果数据。
  31895. * 叠加分析结果通过该类支持的事件的监听函数参数获取,参数类型为 {<SuperMap.REST.OverlayAnalystEventArgs>}; 获取的结果数据包括 originResult 、result 两种,
  31896. * 其中,originResult 为服务端返回的用 JSON 对象表示的量算结果数据,result 为服务端返回的量算结果数据。
  31897. * @extends {SuperMap.SpatialAnalystBase}
  31898. * @param {string} url - 服务的访问地址。如:http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  31899. * @param {Object} options - 参数。
  31900. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  31901. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31902. * @param {Object} [options.headers] - 请求头。
  31903. * @example
  31904. * var myOverlayAnalystService = new SuperMap.REST.GeometryBatchAnalystService(url, {
  31905. * eventListeners: {
  31906. * "processCompleted": OverlayCompleted,
  31907. * "processFailed": OverlayFailed
  31908. * }
  31909. * });
  31910. */
  31911. class GeometryBatchAnalystService extends SpatialAnalystBase {
  31912. constructor(url, options) {
  31913. super(url, options);
  31914. if (options) {
  31915. Util.extend(this, options);
  31916. }
  31917. this.CLASS_NAME = "SuperMap.GeometryBatchAnalystService";
  31918. }
  31919. /**
  31920. * @function SuperMap.GeometryBatchAnalystService.prototype.processAsync
  31921. * @description 负责将客户端的查询参数传递到服务端。
  31922. * @param {SuperMap.GeometryBatchOverlayAnalystParameters} parameter - 批量几何对象叠加分析参数类
  31923. *
  31924. */
  31925. processAsync(parameters) {
  31926. var me = this;
  31927. me.url = Util.urlPathAppend(me.url, 'geometry/batchanalyst');
  31928. me.url = Util.urlAppend(me.url, 'returnContent=true&ignoreAnalystParam=true');
  31929. var parameterObjects = me._processParams(parameters);
  31930. var jsonParameters = Util.toJSON(parameterObjects);
  31931. me.request({
  31932. method: "POST",
  31933. data: jsonParameters,
  31934. scope: me,
  31935. success: me.serviceProcessCompleted,
  31936. failure: me.serviceProcessFailed
  31937. });
  31938. }
  31939. _processParams(parameters) {
  31940. var me = this;
  31941. if (!Util.isArray(parameters)) {
  31942. return;
  31943. }
  31944. var processParams = [];
  31945. parameters.map(function (item) {
  31946. processParams.push(me._toJSON(item));
  31947. return item;
  31948. });
  31949. return processParams;
  31950. }
  31951. _toJSON(parameter) {
  31952. var tempObj = {};
  31953. if(parameter.analystName ==="buffer"){
  31954. tempObj.analystName = "buffer";
  31955. tempObj.param = {};
  31956. //几何对象的批量空间分析,
  31957. GeometryBufferAnalystParameters.toObject(parameter.param, tempObj.param);
  31958. }else if(parameter.analystName ==="overlay"){
  31959. tempObj.analystName = "overlay";
  31960. tempObj.param = {};
  31961. GeometryOverlayAnalystParameters.toObject(parameter.param, tempObj.param);
  31962. }else if(parameter.analystName ==="interpolationDensity"){
  31963. tempObj.analystName = "interpolationDensity";
  31964. tempObj.param = {};
  31965. InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
  31966. }else if(parameter.analystName ==="interpolationidw"){
  31967. tempObj.analystName = "interpolationidw";
  31968. tempObj.param = {};
  31969. InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
  31970. }else if(parameter.analystName ==="interpolationRBF"){
  31971. tempObj.analystName = "interpolationRBF";
  31972. tempObj.param = {};
  31973. InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
  31974. }else if(parameter.analystName ==="interpolationKriging"){
  31975. tempObj.analystName = "interpolationKriging";
  31976. tempObj.param = {};
  31977. InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
  31978. }else if(parameter.analystName ==="thiessenpolygon"){
  31979. tempObj.analystName = "thiessenpolygon";
  31980. tempObj.param = {};
  31981. GeometryThiessenAnalystParameters.toObject(parameter.param, tempObj.param);
  31982. }else {
  31983. //isoline; isoregion; calculatemeasure; routelocator 四种分析不需要再处理参数
  31984. return parameter;
  31985. }
  31986. return tempObj;
  31987. }
  31988. /**
  31989. * @override
  31990. */
  31991. destroy() {
  31992. super.destroy();
  31993. }
  31994. }
  31995. SuperMap.GeometryBatchAnalystService = GeometryBatchAnalystService;
  31996. ;// CONCATENATED MODULE: ./src/common/iServer/TilesetsService.js
  31997. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31998. * This program are made available under the terms of the Apache License, Version 2.0
  31999. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32000. /**
  32001. * @class SuperMap.TilesetsService
  32002. * @category iServer Map Tilesets
  32003. * @classdesc 切片列表信息查询服务类;即查询切片地图服务的切片列表,返回切片集名称、地图切片元数据信息、切片版本集信息。
  32004. * @extends {SuperMap.CommonServiceBase}
  32005. * @param {string} url - 地图服务地址。URL 应为:
  32006. * http://{服务器地址}:{服务端口号}/iserver/services/{服务名}/rest/maps/map;
  32007. * 例如: "http://localhost:8090/iserver/services/test/rest/maps/tianlocal"。
  32008. * @param {Object} options - 参数。
  32009. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  32010. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  32011. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  32012. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  32013. * @param {Object} [options.headers] - 请求头。
  32014. */
  32015. class TilesetsService extends CommonServiceBase {
  32016. constructor(url, options) {
  32017. super(url, options);
  32018. this.CLASS_NAME = "SuperMap.TilesetsService";
  32019. }
  32020. /**
  32021. * @override
  32022. */
  32023. destroy() {
  32024. super.destroy();
  32025. }
  32026. /**
  32027. * @function SuperMap.TilesetsService.prototype.processAsync
  32028. * @description 负责将客户端的查询参数传递到服务端。
  32029. */
  32030. processAsync() {
  32031. if (!this.url) {
  32032. return;
  32033. }
  32034. var me = this;
  32035. me.url = Util.urlPathAppend(me.url, 'tilesets');
  32036. me.request({
  32037. method: "GET",
  32038. scope: me,
  32039. success: me.serviceProcessCompleted,
  32040. failure: me.serviceProcessFailed
  32041. });
  32042. }
  32043. }
  32044. SuperMap.TilesetsService = TilesetsService;
  32045. ;// CONCATENATED MODULE: ./src/common/iServer/TopologyValidatorJobsParameter.js
  32046. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32047. * This program are made available under the terms of the Apache License, Version 2.0
  32048. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32049. /**
  32050. * @class SuperMap.TopologyValidatorJobsParameter
  32051. * @category iServer ProcessingService TopologyValidator
  32052. * @classdesc 拓扑检查分析任务参数类。
  32053. * @param {Object} options - 必填参数。
  32054. * @param {string} options.datasetName - 数据集名。
  32055. * @param {string} options.datasetTopology -检查对象所在的数据集名称。
  32056. * @param {SuperMap.TopologyValidatorRule} [options.rule=SuperMap.TopologyValidatorRule.REGIONNOOVERLAP] - 拓扑检查规则。
  32057. * @param {string} [options.tolerance] - 容限。
  32058. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  32059. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  32060. */
  32061. class TopologyValidatorJobsParameter {
  32062. constructor(options) {
  32063. if (!options) {
  32064. return;
  32065. }
  32066. /**
  32067. * @member {string} SuperMap.TopologyValidatorJobsParameter.prototype.datasetName
  32068. * @description 数据集名。
  32069. */
  32070. this.datasetName = "";
  32071. /**
  32072. * @member {string} SuperMap.TopologyValidatorJobsParameter.prototype.datasetTopology
  32073. * @description 拓扑检查对象所在的数据集名称。
  32074. */
  32075. this.datasetTopology = "";
  32076. /**
  32077. * @member {string} [SuperMap.TopologyValidatorJobsParameter.prototype.tolerance]
  32078. * @description 容限,指定的拓扑错误检查时使用的容限。
  32079. */
  32080. this.tolerance = "";
  32081. /**
  32082. * @member {SuperMap.TopologyValidatorRule} [SuperMap.TopologyValidatorJobsParameter.prototype.rule=SuperMap.TopologyValidatorRule.REGIONNOOVERLAP]
  32083. * @description 拓扑检查模式。
  32084. */
  32085. this.rule = TopologyValidatorRule.REGIONNOOVERLAP;
  32086. /**
  32087. * @member {SuperMap.OutputSetting} [SuperMap.TopologyValidatorJobsParameter.prototype.output]
  32088. * @description 输出参数设置类。
  32089. */
  32090. this.output = null;
  32091. /**
  32092. * @member {SuperMap.MappingParameters} [SuperMap.TopologyValidatorJobsParameter.prototype.mappingParameters]
  32093. * @description 分析后结果可视化的参数类。
  32094. */
  32095. this.mappingParameters = null;
  32096. Util.extend(this, options);
  32097. this.CLASS_NAME = "SuperMap.TopologyValidatorJobsParameter";
  32098. }
  32099. /**
  32100. * @function SuperMap.TopologyValidatorJobsParameter.prototype.destroy
  32101. * @description 释放资源,将引用资源的属性置空。
  32102. */
  32103. destroy() {
  32104. this.datasetName = null;
  32105. this.datasetTopology = null;
  32106. this.tolerance = null;
  32107. this.rule = null;
  32108. if (this.output instanceof OutputSetting) {
  32109. this.output.destroy();
  32110. this.output = null;
  32111. }
  32112. if (this.mappingParameters instanceof MappingParameters) {
  32113. this.mappingParameters.destroy();
  32114. this.mappingParameters = null;
  32115. }
  32116. }
  32117. /**
  32118. * @function SuperMap.TopologyValidatorJobsParameter.toObject
  32119. * @param {Object} TopologyValidatorJobsParameter -拓扑检查分析任务参数。
  32120. * @param {Object} tempObj - 目标对象。
  32121. * @description 生成拓扑检查分析任务对象。
  32122. */
  32123. static toObject(TopologyValidatorJobsParameter, tempObj) {
  32124. for (var name in TopologyValidatorJobsParameter) {
  32125. if (name === "datasetName") {
  32126. tempObj['input'] = tempObj['input'] || {};
  32127. tempObj['input'][name] = TopologyValidatorJobsParameter[name];
  32128. continue;
  32129. }
  32130. if (name === "output") {
  32131. tempObj['output'] = tempObj['output'] || {};
  32132. tempObj['output'] = TopologyValidatorJobsParameter[name];
  32133. continue;
  32134. }
  32135. tempObj['analyst'] = tempObj['analyst'] || {};
  32136. tempObj['analyst'][name] = TopologyValidatorJobsParameter[name];
  32137. if(name === 'mappingParameters'){
  32138. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  32139. tempObj['analyst']['mappingParameters'] = TopologyValidatorJobsParameter[name];
  32140. }
  32141. }
  32142. }
  32143. }
  32144. SuperMap.TopologyValidatorJobsParameter = TopologyValidatorJobsParameter;
  32145. ;// CONCATENATED MODULE: ./src/common/iServer/TopologyValidatorJobsService.js
  32146. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32147. * This program are made available under the terms of the Apache License, Version 2.0
  32148. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32149. /**
  32150. * @class SuperMap.TopologyValidatorJobsService
  32151. * @category iServer ProcessingService TopologyValidator
  32152. * @classdesc 拓扑检查分析服务类
  32153. * @extends {SuperMap.ProcessingServiceBase}
  32154. * @param {string} url - 拓扑检查分析服务地址。
  32155. * @param {Object} options - 参数。
  32156. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  32157. * @param {Object} [options.headers] - 请求头。
  32158. */
  32159. class TopologyValidatorJobsService extends ProcessingServiceBase {
  32160. constructor(url, options) {
  32161. super(url, options);
  32162. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/topologyvalidator');
  32163. this.CLASS_NAME = "SuperMap.TopologyValidatorJobsService";
  32164. }
  32165. /**
  32166. *@override
  32167. */
  32168. destroy() {
  32169. super.destroy();
  32170. }
  32171. /**
  32172. * @function SuperMap.TopologyValidatorJobsService.protitype.getTopologyValidatorJobs
  32173. * @description 获取拓扑检查分析所有任务
  32174. */
  32175. getTopologyValidatorJobs() {
  32176. super.getJobs(this.url);
  32177. }
  32178. /**
  32179. * @function SuperMap.TopologyValidatorJobsService.protitype.getTopologyValidatorJob
  32180. * @description 获取指定id的拓扑检查分析服务
  32181. * @param {string} id - 指定要获取数据的id
  32182. */
  32183. getTopologyValidatorJob(id) {
  32184. super.getJobs( Util.urlPathAppend(this.url, id));
  32185. }
  32186. /**
  32187. * @function SuperMap.TopologyValidatorJobsService.protitype.addTopologyValidatorJob
  32188. * @description 新建拓扑检查分析服务
  32189. * @param {SuperMap.TopologyValidatorJobsParameter} params - 创建一个空间分析的请求参数。
  32190. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  32191. */
  32192. addTopologyValidatorJob(params, seconds) {
  32193. super.addJob(this.url, params, TopologyValidatorJobsParameter, seconds);
  32194. }
  32195. }
  32196. SuperMap.TopologyValidatorJobsService = TopologyValidatorJobsService;
  32197. ;// CONCATENATED MODULE: ./src/common/iServer/TransferLine.js
  32198. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32199. * This program are made available under the terms of the Apache License, Version 2.0
  32200. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32201. /**
  32202. * @class SuperMap.TransferLine
  32203. * @category iServer TrafficTransferAnalyst TransferPath
  32204. * @classdesc 换乘路线信息类。
  32205. * @param {Object} options - 参数。
  32206. * @param {number} options.lineID - 乘车路线 ID。
  32207. * @param {string} options.lineName - 乘车路线名称。
  32208. * @param {string} options.lineAliasName - 乘车路线别名。
  32209. * @param {number} options.startStopIndex - 上车站点在本公交路线中的索引。
  32210. * @param {string} options.startStopName - 上车站点名称。
  32211. * @param {string} options.startStopAliasName - 上车站点别名。
  32212. * @param {number} options.endStopIndex - 下车站点在本公交路线中的索引。
  32213. * @param {string} options.endStopName - 下车站点名称。
  32214. * @param {string} options.endStopAliasName - 下车站点别名。
  32215. */
  32216. class TransferLine {
  32217. constructor(options) {
  32218. options = options || {};
  32219. /**
  32220. * @member {number} SuperMap.TransferLine.prototype.lineID
  32221. * @description 乘车路线 ID。
  32222. */
  32223. this.lineID = null;
  32224. /**
  32225. * @member {string} SuperMap.TransferLine.prototype.lineName
  32226. * @description 乘车路线名称。
  32227. */
  32228. this.lineName = null;
  32229. /**
  32230. * @member {string} SuperMap.TransferLine.prototype.lineAliasName
  32231. * @description 乘车路线别名。
  32232. */
  32233. this.lineAliasName = null;
  32234. /**
  32235. * @member {number} SuperMap.TransferLine.prototype.startStopIndex
  32236. * @description 上车站点在本公交路线中的索引。
  32237. */
  32238. this.startStopIndex = null;
  32239. /**
  32240. * @member {string} SuperMap.TransferLine.prototype.startStopName
  32241. * @description 上车站点名称。
  32242. */
  32243. this.startStopName = null;
  32244. /**
  32245. * @member {string} SuperMap.TransferLine.prototype.startStopAliasName
  32246. * @description 上车站点别名。
  32247. */
  32248. this.startStopAliasName = null;
  32249. /**
  32250. * @member {number} SuperMap.TransferLine.prototype.endStopIndex
  32251. * @description 下车站点在本公交路线中的索引。
  32252. */
  32253. this.endStopIndex = null;
  32254. /**
  32255. * @member {string} SuperMap.TransferLine.prototype.endStopName
  32256. * @description 下车站点名称。
  32257. */
  32258. this.endStopName = null;
  32259. /**
  32260. * @member {string} SuperMap.TransferLine.prototype.endStopAliasName
  32261. * @description 下车站点别名。
  32262. */
  32263. this.endStopAliasName = null;
  32264. Util.extend(this, options);
  32265. this.CLASS_NAME = "SuperMap.TransferLine";
  32266. }
  32267. /**
  32268. * @function SuperMap.TransferLine.prototype.destroy
  32269. * @description 释放资源,将引用资源的属性置空。
  32270. */
  32271. destroy() {
  32272. Util.reset(this);
  32273. }
  32274. /**
  32275. * @function SuperMap.TransferLine.fromJson
  32276. * @description 将返回结果转化为 {@link SuperMap.TransferLine} 对象。
  32277. * @param {Object} jsonObject - 新的返回结果。
  32278. * @returns {SuperMap.TransferLine} 转化后的 {@link SuperMap.TransferLine} 对象。
  32279. */
  32280. static fromJson(jsonObject) {
  32281. if (!jsonObject) {
  32282. return;
  32283. }
  32284. return new TransferLine({
  32285. lineID: jsonObject['lineID'],
  32286. lineName: jsonObject['lineName'],
  32287. lineAliasName: jsonObject['lineAliasName'],
  32288. startStopIndex: jsonObject['startStopIndex'],
  32289. startStopName: jsonObject['startStopName'],
  32290. startStopAliasName: jsonObject['startStopAliasName'],
  32291. endStopIndex: jsonObject['endStopIndex'],
  32292. endStopName: jsonObject['endStopName'],
  32293. endStopAliasName: jsonObject['endStopAliasName']
  32294. });
  32295. }
  32296. }
  32297. SuperMap.TransferLine = TransferLine;
  32298. ;// CONCATENATED MODULE: ./src/common/iServer/TransferPathParameters.js
  32299. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32300. * This program are made available under the terms of the Apache License, Version 2.0
  32301. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32302. /**
  32303. * @class SuperMap.TransferPathParameters
  32304. * @category iServer TrafficTransferAnalyst TransferPaths
  32305. * @classdesc 交通换乘线路查询参数类。
  32306. * @param {Object} options - 参数。
  32307. * @param {Array.<SuperMap.TransferLine>} options.transferLines - 本换乘分段内可乘车的路线集合。
  32308. * @param {Array.<(string|SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point)>} options.points - 两种查询方式:按照公交站点的起止 ID 进行查询和按照起止点的坐标进行查询。
  32309. *
  32310. */
  32311. class TransferPathParameters {
  32312. constructor(options) {
  32313. options = options || {};
  32314. /**
  32315. * @member {Array.<SuperMap.TransferLine>} SuperMap.TransferPathParameters.prototype.transferLines
  32316. * @description 本换乘分段内可乘车的路线集合,通过交通换乘方案查询得到。
  32317. */
  32318. this.transferLines = null;
  32319. /**
  32320. * @member {Array.<(string|SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point)>} SuperMap.TransferPathParameters.prototype.points
  32321. * @description 两种查询方式:<br>
  32322. * 1. 按照公交站点的起止ID进行查询,则 points 参数的类型为 int[],形如:[起点ID、终点ID],公交站点的 ID 对应服务提供者配置中的站点 ID 字段;
  32323. * 2. 按照起止点的坐标进行查询,则 points 参数的类型为 Point2D[],形如:[{"x":44,"y":39},{"x":45,"y":40}]。
  32324. */
  32325. this.points = null;
  32326. Util.extend(this, options);
  32327. this.CLASS_NAME = "SuperMap.TransferPathParameters";
  32328. }
  32329. /**
  32330. * @function SuperMap.TransferPathParameters.prototype.destroy
  32331. * @description 释放资源,将引用资源的属性置空。
  32332. */
  32333. destroy() {
  32334. Util.reset(this);
  32335. }
  32336. /**
  32337. * @function SuperMap.TransferPathParameters.toJson
  32338. * @description 将 {@link SuperMap.TransferPathParameters} 对象参数转换为 JSON 字符串。
  32339. * @param {SuperMap.TransferPathParameters} params - 交通换乘参数。
  32340. * @returns {string} 转化后的 JSON 字符串。
  32341. */
  32342. static toJson(params) {
  32343. if (params) {
  32344. return Util.toJSON(params);
  32345. }
  32346. }
  32347. }
  32348. SuperMap.TransferPathParameters = TransferPathParameters;
  32349. ;// CONCATENATED MODULE: ./src/common/iServer/TransferPathService.js
  32350. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32351. * This program are made available under the terms of the Apache License, Version 2.0
  32352. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32353. /**
  32354. * @class SuperMap.TransferPathService
  32355. * @category iServer TrafficTransferAnalyst TransferPath
  32356. * @classdesc 交通换乘线路查询服务类,根据交通换乘分析结果(TransferSolutionResult),获取某一条乘车路线的详细信息。
  32357. * 返回结果通过该类支持的事件的监听函数参数获取
  32358. * @extends {SuperMap.CommonServiceBase}
  32359. * @example 例如:
  32360. * var myService = new SuperMap.TransferPathService(url, {eventListeners: {
  32361. * "processCompleted": TrafficTransferCompleted,
  32362. * "processFailed": TrafficTransferError
  32363. * }
  32364. * };
  32365. * @param {string} url - 与客户端交互的交通换乘线路查询服务地址。
  32366. * 例如:</br>"http://localhost:8090/iserver/services/traffictransferanalyst-sample/restjsr/traffictransferanalyst/Traffic-Changchun"。
  32367. * @param {Object} options - 参数。</br>
  32368. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  32369. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  32370. * @param {Object} [options.headers] - 请求头。
  32371. */
  32372. class TransferPathService extends CommonServiceBase {
  32373. constructor(url, options) {
  32374. super(url, options);
  32375. this.CLASS_NAME = "SuperMap.TransferPathService";
  32376. }
  32377. /**
  32378. * @override
  32379. */
  32380. destroy() {
  32381. super.destroy();
  32382. }
  32383. /**
  32384. * @function SuperMap.TransferPathService.prototype.processAsync
  32385. * @description 负责将客户端的更新参数传递到服务端。
  32386. * @param {SuperMap.TransferPathParameters} params - 交通换乘参数。
  32387. */
  32388. processAsync(params) {
  32389. if (!(params instanceof TransferPathParameters)) {
  32390. return;
  32391. }
  32392. var me = this,
  32393. method = "GET",
  32394. jsonParameters;
  32395. me.url = Util.urlPathAppend(me.url, 'path');
  32396. jsonParameters = {
  32397. points: Util.toJSON(params.points),
  32398. transferLines: Util.toJSON(params['transferLines'])
  32399. };
  32400. me.request({
  32401. method: method,
  32402. params: jsonParameters,
  32403. scope: me,
  32404. success: me.serviceProcessCompleted,
  32405. failure: me.serviceProcessFailed
  32406. });
  32407. }
  32408. }
  32409. SuperMap.TransferPathService = TransferPathService;
  32410. ;// CONCATENATED MODULE: ./src/common/iServer/TransferSolutionParameters.js
  32411. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32412. * This program are made available under the terms of the Apache License, Version 2.0
  32413. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32414. /**
  32415. * @class SuperMap.TransferSolutionParameters
  32416. * @category iServer TrafficTransferAnalyst TransferSolutions
  32417. * @classdesc 交通换乘方案查询参数类。
  32418. * @param {Object} options - 参数。
  32419. * @param {Array.<(SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point|number)>} options.points - 两种查询方式:按照公交站点的起止ID进行查询和按照起止点的坐标进行查询。
  32420. * @param {number} [options.solutionCount=6] - 乘车方案的数量。
  32421. * @param {SuperMap.TransferTactic} [options.transferTactic=SuperMap.TransferTactic.LESS_TIME] - 交通换乘策略类型,包括时间最短、距离最短、最少换乘、最少步行四种选择。
  32422. * @param {SuperMap.TransferPreference} [options.transferPreference=SuperMap.TransferPreference.NONE] - 乘车偏好枚举。
  32423. * @param {number} [options.walkingRatio=10] - 步行与公交的消耗权重比。
  32424. * @param {Array.<number>} [options.evadeLines] - 避让路线的 ID。
  32425. * @param {Array.<number>} [options.evadeStops] - 避让站点的 ID。
  32426. * @param {Array.<number>} [options.priorLines] - 优先路线的 ID。
  32427. * @param {Array.<number>} [options.priorStops] - 优先站点的 ID。
  32428. * @param {string} [options.travelTime] - 出行的时间。
  32429. */
  32430. class TransferSolutionParameters {
  32431. constructor(options) {
  32432. options = options || {};
  32433. /**
  32434. * @member {number} [SuperMap.TransferSolutionParameters.prototype.solutionCount=6]
  32435. * @description 乘车方案的数量。
  32436. */
  32437. this.solutionCount = 6;
  32438. /**
  32439. * @member {SuperMap.TransferPreference} [SuperMap.TransferSolutionParameters.prototype.transferPreference=SuperMap.TransferPreference.NONE]
  32440. * @description 乘车偏好枚举。
  32441. */
  32442. this.transferPreference = TransferPreference.NONE;
  32443. /**
  32444. * @member {SuperMap.TransferTactic} [SuperMap.TransferSolutionParameters.prototype.transferTactic=TransferTactic|SuperMap.TransferTactic.LESS_TIME]
  32445. * @description 交通换乘策略类型,包括时间最短、距离最短、最少换乘、最少步行四种选择。
  32446. */
  32447. this.transferTactic = TransferTactic.LESS_TIME;
  32448. /**
  32449. * @member {number} [SuperMap.TransferSolutionParameters.prototype.walkingRatio=10]
  32450. * @description 步行与公交的消耗权重比。此值越大,则步行因素对于方案选择的影响越大。例如:</br>
  32451. * 例如现在有两种换乘方案(在仅考虑消耗因素的情况下):</br>
  32452. * 方案1:坐车 10 公里,走路 1 公里;</br>
  32453. * 方案2:坐车 15 公里,走路 0.5 公里;</br>
  32454. * 1. 假设权重比为 15:</br>
  32455. * •方案 1 的总消耗为:10 + 1*15 = 25</br>
  32456. * •方案 2 的总消耗为:15 + 0.5*15 = 22.5</br>
  32457. * 此时方案 2 消耗更低。</br>
  32458. * 2. 假设权重比为2:</br>
  32459. * •方案 1 的总消耗为:10+1*2 = 12</br>
  32460. * •方案 2 的总消耗为:15+0.5*2 = 17</br>
  32461. * 此时方案 1 消耗更低。</br>
  32462. */
  32463. this.walkingRatio = null;
  32464. /**
  32465. * @member {Array.<(SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point|string)>} SuperMap.TransferSolutionParameters.prototype.points
  32466. * @description 两种查询方式:</br>
  32467. * 1. 按照公交站点的起止 ID 进行查询,则 points 参数的类型为 int[],形如:[起点 ID、终点 ID],公交站点的 ID 对应服务提供者配置中的站点 ID 字段;
  32468. * 2. 按照起止点的坐标进行查询,则 points 参数的类型为 Point2D[],形如:[{"x":44,"y":39},{"x":45,"y":40}]。
  32469. */
  32470. this.points = false;
  32471. /**
  32472. * @member {Array.<number>} [SuperMap.TransferSolutionParameters.prototype.evadeLinesnull]
  32473. * @description 避让路线 ID。
  32474. * */
  32475. this.evadeLines = null;
  32476. /**
  32477. * @member {Array.<number>} [SuperMap.TransferSolutionParameters.prototype.evadeStops=TransferLine]
  32478. * @description 避让站点 ID。
  32479. * */
  32480. this.evadeStops = null;
  32481. /**
  32482. * @member {Array.<number>} [SuperMap.TransferSolutionParameters.prototype.priorLines]
  32483. * @description 优先路线 ID。
  32484. * */
  32485. this.priorLines = null;
  32486. /**
  32487. * @member {Array.<number>} [SuperMap.TransferSolutionParameters.prototype.priorStops]
  32488. * @description 优先站点 ID。
  32489. * */
  32490. this.priorStops = null;
  32491. /**
  32492. * @member {string} SuperMap.TransferSolutionParameters.prototype.travelTime
  32493. * @description 出行的时间; 格式是:"小时:分钟",如:"08:30"。如果设置了该参数,在分析时,则会考虑线路的首末班车时间的限制,即在返回的结果中会提示公交的首末班发车时间。
  32494. */
  32495. this.travelTime = null;
  32496. Util.extend(this, options);
  32497. this.CLASS_NAME = "SuperMap.TransferSolutionParameters";
  32498. }
  32499. /**
  32500. * @function SuperMap.TransferSolutionParameters.prototype.destroy
  32501. * @description 释放资源,将引用资源的属性置空。
  32502. */
  32503. destroy() {
  32504. Util.reset(this);
  32505. }
  32506. /**
  32507. * @function SuperMap.TransferSolutionParameters.toJsonParameters
  32508. * @description 将 {@link SuperMap.TransferSolutionParameters} 对象参数转换为 JSON 字符串。
  32509. * @param {SuperMap.TransferSolutionParameters} params - 交通换乘参数。
  32510. * @returns {string} 转化后的 JSON 字符串。
  32511. */
  32512. static toJson(params) {
  32513. if (params) {
  32514. return Util.toJSON(params);
  32515. }
  32516. }
  32517. }
  32518. SuperMap.TransferSolutionParameters = TransferSolutionParameters;
  32519. ;// CONCATENATED MODULE: ./src/common/iServer/TransferSolutionService.js
  32520. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32521. * This program are made available under the terms of the Apache License, Version 2.0
  32522. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32523. /**
  32524. * @class SuperMap.TransferSolutionService
  32525. * @category iServer TrafficTransferAnalyst TransferSolutions
  32526. * @classdesc 交通换乘方案查询服务类。
  32527. * 返回结果通过该类支持的事件的监听函数参数获取。
  32528. * @param {string} url - 与客户端交互的交通换乘方案查询服务地址。
  32529. * 例如:</br>"http://localhost:8090/iserver/services/traffictransferanalyst-sample/restjsr/traffictransferanalyst/Traffic-Changchun"。
  32530. * @param {Object} options - 参数。</br>
  32531. * @param {Object} options.eventListeners - 需要被注册的监听器对象。</br>
  32532. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  32533. * @param {Object} [options.headers] - 请求头。
  32534. * @extends {SuperMap.CommonServiceBase}
  32535. * @example 例如:
  32536. * (start code)
  32537. * var myService = new SuperMap.TransferSolutionService(url, {eventListeners: {
  32538. * "processCompleted": trafficTransferCompleted,
  32539. * "processFailed": trafficTransferError
  32540. * }
  32541. * };
  32542. * (end)
  32543. *
  32544. */
  32545. class TransferSolutionService extends CommonServiceBase {
  32546. constructor(url, options) {
  32547. super(url, options);
  32548. this.CLASS_NAME = "SuperMap.TransferSolutionService";
  32549. }
  32550. /**
  32551. * @override
  32552. */
  32553. destroy() {
  32554. super.destroy();
  32555. }
  32556. /**
  32557. * @function SuperMap.TransferSolutionService.prototype.processAsync
  32558. * @description 负责将客户端的更新参数传递到服务端。
  32559. * @param {SuperMap.TransferSolutionParameters} params - 交通换乘参数。
  32560. */
  32561. processAsync(params) {
  32562. if (!(params instanceof TransferSolutionParameters)) {
  32563. return;
  32564. }
  32565. var me = this,
  32566. method = "GET",
  32567. jsonParameters;
  32568. me.url = Util.urlPathAppend(me.url, 'solutions');
  32569. jsonParameters = {
  32570. points: Util.toJSON(params.points),
  32571. walkingRatio: params['walkingRatio'],
  32572. transferTactic: params['transferTactic'],
  32573. solutionCount: params['solutionCount'],
  32574. transferPreference: params["transferPreference"]
  32575. };
  32576. if (params.evadeLines) {
  32577. jsonParameters["evadeLines"] = Util.toJSON(params.evadeLines);
  32578. }
  32579. if (params.evadeStops) {
  32580. jsonParameters["evadeStops"] = Util.toJSON(params.evadeStops);
  32581. }
  32582. if (params.priorLines) {
  32583. jsonParameters["priorLines"] = Util.toJSON(params.priorLines);
  32584. }
  32585. if (params.priorStops) {
  32586. jsonParameters["priorStops"] = Util.toJSON(params.priorStops);
  32587. }
  32588. if (params.travelTime) {
  32589. jsonParameters["travelTime"] = params.travelTime;
  32590. }
  32591. me.request({
  32592. method: method,
  32593. params: jsonParameters,
  32594. scope: me,
  32595. success: me.serviceProcessCompleted,
  32596. failure: me.serviceProcessFailed
  32597. });
  32598. }
  32599. }
  32600. SuperMap.TransferSolutionService = TransferSolutionService;
  32601. ;// CONCATENATED MODULE: ./src/common/iServer/UpdateEdgeWeightParameters.js
  32602. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32603. * This program are made available under the terms of the Apache License, Version 2.0
  32604. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32605. /**
  32606. * @class SuperMap.UpdateEdgeWeightParameters
  32607. * @category iServer NetworkAnalyst EdgeWeight
  32608. * @classdesc 边的耗费权重更新服务参数类。
  32609. * @param {Object} options - 参数。
  32610. * @param {string} options.edgeId - 所在边的 ID。
  32611. * @param {string} options.fromNodeId - 起始转向点的 ID。
  32612. * @param {string} options.toNodeId - 终止转向点的 ID。
  32613. * @param {string} options.weightField - 边的耗费字段。
  32614. * @param {string} options.edgeWeight - 耗费权重。
  32615. */
  32616. class UpdateEdgeWeightParameters {
  32617. constructor(options) {
  32618. if (!options) {
  32619. return;
  32620. }
  32621. /**
  32622. * @member {string} SuperMap.UpdateEdgeWeightParameters.prototype.edgeId
  32623. * @description 所在边的 ID。
  32624. */
  32625. this.edgeId = "";
  32626. /**
  32627. * @member {string} SuperMap.UpdateEdgeWeightParameters.prototype.fromNodeId
  32628. * @description 起始转向点的 ID。
  32629. */
  32630. this.fromNodeId = "";
  32631. /**
  32632. * @member {string} SuperMap.UpdateEdgeWeightParameters.prototype.toNodeId
  32633. * @description 终止转向点的 ID。
  32634. */
  32635. this.toNodeId = "";
  32636. /**
  32637. * @member {string} SuperMap.UpdateEdgeWeightParameters.prototype.weightField
  32638. * @description 边的耗费字段。
  32639. */
  32640. this.weightField = "";
  32641. /**
  32642. * @member {string} SuperMap.UpdateEdgeWeightParameters.prototype.edgeWeight
  32643. * @description 耗费权重。
  32644. */
  32645. this.edgeWeight = "";
  32646. Util.extend(this, options);
  32647. this.CLASS_NAME = "SuperMap.UpdateEdgeWeightParameters";
  32648. }
  32649. /**
  32650. * @function SuperMap.UpdateEdgeWeightParameters.prototype.destroy
  32651. * @description 释放资源,将引用资源的属性置空。
  32652. */
  32653. destroy() {
  32654. this.edgeId = null;
  32655. this.fromNodeId = null;
  32656. this.toNodeId = null;
  32657. this.weightField = null;
  32658. this.edgeWeight = null;
  32659. }
  32660. }
  32661. SuperMap.UpdateEdgeWeightParameters = UpdateEdgeWeightParameters;
  32662. ;// CONCATENATED MODULE: ./src/common/iServer/UpdateEdgeWeightService.js
  32663. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32664. * This program are made available under the terms of the Apache License, Version 2.0
  32665. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32666. /**
  32667. * @class SuperMap.UpdateEdgeWeightService
  32668. * @category iServer NetworkAnalyst EdgeWeight
  32669. * @classdesc 更新边的边的耗费权重服务
  32670. * @extends {SuperMap.NetworkAnalystServiceBase}
  32671. * @example
  32672. *(start code)
  32673. * var updateEdgeWeightService = new SuperMap.UpdateEdgeWeightService(url, {
  32674. * eventListeners: {
  32675. * "processCompleted": UpdateEdgeWeightCompleted, //参数为SuperMap.UpdateEdgeWeightEventArgs
  32676. * "processFailed": UpdateEdgeWeightError //参数为SuperMap.ServiceFailedEventArgs
  32677. * }
  32678. * });
  32679. * (end)
  32680. * @param {string} url - 服务的访问地址。如:http://localhost:8090/iserver/services/transportationanalyst-sample/rest/networkanalyst/RoadNet@Changchun 。
  32681. * @param {Object} options - 参数。
  32682. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  32683. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  32684. * @param {Object} [options.headers] - 请求头。
  32685. */
  32686. class UpdateEdgeWeightService extends NetworkAnalystServiceBase {
  32687. constructor(url, options) {
  32688. super(url, options);
  32689. this.CLASS_NAME = "SuperMap.UpdateEdgeWeightService";
  32690. }
  32691. /**
  32692. * @override
  32693. */
  32694. destroy() {
  32695. super.destroy();
  32696. }
  32697. /**
  32698. * @function SuperMap.UpdateEdgeWeightService.prototype.processAsync
  32699. * @description 开始异步执行边的边的耗费权重的更新
  32700. * @param {SuperMap.UpdateEdgeWeightParameters} params - 边的耗费权重更新服务参数类
  32701. * @example
  32702. * (code)
  32703. * var updateEdgeWeightParam=new SuperMapUpdateEdgeWeightParameters({
  32704. * edgeId:"20",
  32705. * fromNodeId:"26",
  32706. * toNodeId:"109",
  32707. * weightField:"time",
  32708. * edgeWeight:"25"
  32709. * });
  32710. * updateEdgeWeightService.processAsync(updateEdgeWeightParam);
  32711. * (end)
  32712. */
  32713. processAsync(params) {
  32714. if (!(params instanceof UpdateEdgeWeightParameters)) {
  32715. return;
  32716. }
  32717. var me = this;
  32718. var paramStr = me.parse(params);
  32719. me.url = Util.urlPathAppend(me.url, paramStr);
  32720. var data = params.edgeWeight ? params.edgeWeight : null;
  32721. me.request({
  32722. method: "PUT",
  32723. scope: me,
  32724. data: data,
  32725. success: me.serviceProcessCompleted,
  32726. failure: me.serviceProcessFailed
  32727. });
  32728. }
  32729. /**
  32730. * @function SuperMap.UpdateEdgeWeightService.prototype.parse
  32731. * @description 将更新服务参数解析为用‘/’做分隔的字符串
  32732. */
  32733. parse(params) {
  32734. if (!params) {
  32735. return;
  32736. }
  32737. var paramStr = "";
  32738. for (var attr in params) {
  32739. if (params[attr] === "" || params[attr] === "edgeWeight") {
  32740. continue;
  32741. }
  32742. switch (attr) {
  32743. case "edgeId":
  32744. paramStr += "/edgeweight/" + params[attr];
  32745. break;
  32746. case "fromNodeId":
  32747. paramStr += "/fromnode/" + params[attr];
  32748. break;
  32749. case "toNodeId":
  32750. paramStr += "/tonode/" + params[attr];
  32751. break;
  32752. case "weightField":
  32753. paramStr += "/weightfield/" + params[attr];
  32754. break;
  32755. default :
  32756. break;
  32757. }
  32758. }
  32759. return paramStr;
  32760. }
  32761. }
  32762. SuperMap.UpdateEdgeWeightService = UpdateEdgeWeightService;
  32763. ;// CONCATENATED MODULE: ./src/common/iServer/UpdateTurnNodeWeightParameters.js
  32764. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32765. * This program are made available under the terms of the Apache License, Version 2.0
  32766. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32767. /**
  32768. * @class SuperMap.UpdateTurnNodeWeightParameters
  32769. * @category iServer NetworkAnalyst TurnNodeWeight
  32770. * @classdesc 转向耗费权重更新服务参数类。
  32771. * @param {Object} options - 参数。
  32772. * @param {string} options.nodeId - 转向结点的 ID。
  32773. * @param {string} options.fromEdgeId - 起始边的 ID。
  32774. * @param {string} options.toEdgeId - 终止边的 ID。
  32775. * @param {string} options.weightField - 转向结点的耗费字段。
  32776. * @param {string} options.turnNodeWeight - 耗费权重。
  32777. */
  32778. class UpdateTurnNodeWeightParameters {
  32779. constructor(options) {
  32780. if (!options) {
  32781. return;
  32782. }
  32783. /**
  32784. * @member {string} SuperMap.UpdateTurnNodeWeightParameters.prototype.nodeId
  32785. * @description 转向结点的 ID。
  32786. */
  32787. this.nodeId = "";
  32788. /**
  32789. * @member {string} SuperMap.UpdateTurnNodeWeightParameters.prototype.fromEdgeId
  32790. * @description 起始边的 ID。
  32791. */
  32792. this.fromEdgeId = "";
  32793. /**
  32794. * @member {string} SuperMap.UpdateTurnNodeWeightParameters.prototype.toEdgeId
  32795. * @description 终止边的 ID。
  32796. */
  32797. this.toEdgeId = "";
  32798. /**
  32799. * @member {string} SuperMap.UpdateTurnNodeWeightParameters.prototype.weightField
  32800. * @description 转向结点的耗费字段。
  32801. */
  32802. this.weightField = "";
  32803. /**
  32804. * @member {string} SuperMap.UpdateTurnNodeWeightParameters.prototype.turnNodeWeight
  32805. * @description 耗费权重。
  32806. */
  32807. this.turnNodeWeight = "";
  32808. Util.extend(this, options);
  32809. this.CLASS_NAME = "SuperMap.UpdateTurnNodeWeightParameters";
  32810. }
  32811. /**
  32812. * @function SuperMap.UpdateTurnNodeWeightParameters.prototype.destroy
  32813. * @description 释放资源,将引用资源的属性置空。
  32814. */
  32815. destroy() {
  32816. this.nodeId = null;
  32817. this.fromEdgeId = null;
  32818. this.toEdgeId = null;
  32819. this.weightField = null;
  32820. this.turnNodeWeight = null;
  32821. }
  32822. }
  32823. SuperMap.UpdateTurnNodeWeightParameters = UpdateTurnNodeWeightParameters;
  32824. ;// CONCATENATED MODULE: ./src/common/iServer/UpdateTurnNodeWeightService.js
  32825. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32826. * This program are made available under the terms of the Apache License, Version 2.0
  32827. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32828. /**
  32829. * @class SuperMap.UpdateTurnNodeWeightService
  32830. * @category iServer NetworkAnalyst TurnNodeWeight
  32831. * @classdesc 转向耗费权重更新服务类
  32832. * @extends {SuperMap.NetworkAnalystServiceBase}
  32833. * @example
  32834. * var UpdateTurnNodeWeightService = new SuperMap.UpdateTurnNodeWeightService(url, {
  32835. * eventListeners: {
  32836. * "processCompleted": UpdateTurnNodeWeightCompleted, //参数为SuperMap.UpdateTurnNodeWeightEventArgs
  32837. * "processFailed": UpdateTurnNodeWeightError //参数为SuperMap.ServiceFailedEventArgs
  32838. * }
  32839. * });
  32840. * @param {string} url - 服务的访问地址。如:
  32841. * http://localhost:8090/iserver/services/transportationanalyst-sample/rest/networkanalyst/RoadNet@Changchun 。
  32842. * @param {Object} options - 参数。
  32843. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  32844. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  32845. * @param {Object} [options.headers] - 请求头。
  32846. */
  32847. class UpdateTurnNodeWeightService extends NetworkAnalystServiceBase {
  32848. constructor(url, options) {
  32849. super(url, options);
  32850. this.CLASS_NAME = "SuperMap.UpdateTurnNodeWeightService";
  32851. }
  32852. /**
  32853. * @override
  32854. */
  32855. destroy() {
  32856. super.destroy();
  32857. }
  32858. /**
  32859. * @function SuperMap.UpdateTurnNodeWeightService.prototype.processAsync
  32860. * @description 开始异步执行转向耗费权重的更新
  32861. * @param {SuperMap.UpdateTurnNodeWeightParameters} params - 转向耗费权重更新服务参数类
  32862. * @example
  32863. * (code)
  32864. * var updateTurnNodeWeightParam=new SuperMap.UpdateTurnNodeWeightParameters({
  32865. * nodeId:"106",
  32866. * fromEdgeId:"6508",
  32867. * toEdgeId:"6504",
  32868. * weightField:"TurnCost",
  32869. * turnNodeWeight:"50"
  32870. * });
  32871. * updateTurnNodeWeightService.processAsync(updateTurnNodeWeightParam);
  32872. * (end)
  32873. **/
  32874. processAsync(params) {
  32875. if (!(params instanceof UpdateTurnNodeWeightParameters)) {
  32876. return;
  32877. }
  32878. var me = this;
  32879. var paramStr = me.parse(params);
  32880. me.url = Util.urlPathAppend(me.url, paramStr);
  32881. var data = params.turnNodeWeight ? params.turnNodeWeight : null;
  32882. me.request({
  32883. method: "PUT",
  32884. scope: me,
  32885. data: data,
  32886. success: me.serviceProcessCompleted,
  32887. failure: me.serviceProcessFailed
  32888. });
  32889. }
  32890. /**
  32891. * @function SuperMap.UpdateTurnNodeWeightService.prototype.parse
  32892. * @description 将更新服务参数解析为用‘/’做分隔的字符串
  32893. */
  32894. parse(params) {
  32895. if (!params) {
  32896. return;
  32897. }
  32898. var paramStr = "";
  32899. for (var attr in params) {
  32900. if (params[attr] === "" || params[attr] === "turnNodeWeight") {
  32901. continue;
  32902. }
  32903. switch (attr) {
  32904. case "nodeId":
  32905. paramStr += "/turnnodeweight/" + params[attr];
  32906. break;
  32907. case "fromEdgeId":
  32908. paramStr += "/fromedge/" + params[attr];
  32909. break;
  32910. case "toEdgeId":
  32911. paramStr += "/toedge/" + params[attr];
  32912. break;
  32913. case "weightField":
  32914. paramStr += "/weightfield/" + params[attr];
  32915. break;
  32916. default :
  32917. break;
  32918. }
  32919. }
  32920. return paramStr;
  32921. }
  32922. }
  32923. SuperMap.UpdateTurnNodeWeightService = UpdateTurnNodeWeightService;
  32924. ;// CONCATENATED MODULE: ./src/common/iServer/VectorClipJobsParameter.js
  32925. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32926. * This program are made available under the terms of the Apache License, Version 2.0
  32927. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32928. /**
  32929. * @class SuperMap.VectorClipJobsParameter
  32930. * @category iServer ProcessingService VectorClip
  32931. * @classdesc 矢量裁剪分析任务参数类。
  32932. * @param {Object} options - 参数。
  32933. * @param {string} options.datasetName - 数据集名。
  32934. * @param {string} options.datasetOverlay - 裁剪对象数据集。
  32935. * @param {SuperMap.ClipAnalystMode} [options.mode=SuperMap.ClipAnalystMode.CLIP] - 裁剪分析模式。
  32936. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  32937. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  32938. */
  32939. class VectorClipJobsParameter {
  32940. constructor(options) {
  32941. options = options || {};
  32942. /**
  32943. * @member {string} SuperMap.VectorClipJobsParameter.prototype.datasetName
  32944. * @description 数据集名。
  32945. */
  32946. this.datasetName = "";
  32947. /**
  32948. * @member {string} SuperMap.VectorClipJobsParameter.prototype.datasetOverlay
  32949. * @description 裁剪对象数据集。
  32950. */
  32951. this.datasetVectorClip = "";
  32952. /**
  32953. * @member {string} SuperMap.VectorClipJobsParameter.prototype.geometryClip
  32954. * @description 裁剪几何对象。
  32955. */
  32956. this.geometryClip = "";
  32957. /**
  32958. * @member {SuperMap.ClipAnalystMode} [SuperMap.VectorClipJobsParameter.prototype.mode=ClipAnalystMode.CLIP]
  32959. * @description 裁剪分析模式 。
  32960. */
  32961. this.mode = ClipAnalystMode.CLIP;
  32962. /**
  32963. * @member {SuperMap.OutputSetting} SuperMap.VectorClipJobsParameter.prototype.output
  32964. * @description 输出参数设置类。
  32965. */
  32966. this.output = null;
  32967. /**
  32968. * @member {SuperMap.MappingParameters} [SuperMap.VectorClipJobsParameter.prototype.mappingParameters]
  32969. * @description 分析后结果可视化的参数类。
  32970. */
  32971. this.mappingParameters = null;
  32972. Util.extend(this, options);
  32973. this.CLASS_NAME = "SuperMap.VectorClipJobsParameter";
  32974. }
  32975. /**
  32976. * @function SuperMap.VectorClipJobsParameter.prototype.destroy
  32977. * @description 释放资源,将引用资源的属性置空。
  32978. */
  32979. destroy() {
  32980. this.datasetName = null;
  32981. this.datasetVectorClip = null;
  32982. this.geometryClip = null;
  32983. this.mode = 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 SuperMap.VectorClipJobsParameter.toObject
  32995. * @param {Object} vectorClipJobsParameter - 区域汇总分析服务参数。
  32996. * @param {Object} tempObj - 目标对象。
  32997. * @description 矢量裁剪分析任务对象。
  32998. */
  32999. static toObject(vectorClipJobsParameter, tempObj) {
  33000. for (var name in vectorClipJobsParameter) {
  33001. if (name === "datasetName") {
  33002. tempObj['input'] = tempObj['input'] || {};
  33003. tempObj['input'][name] = vectorClipJobsParameter[name];
  33004. continue;
  33005. }
  33006. if (name === "output"){
  33007. tempObj['output'] = tempObj['output'] || {};
  33008. tempObj['output'] = vectorClipJobsParameter[name];
  33009. continue;
  33010. }
  33011. tempObj['analyst'] = tempObj['analyst'] || {};
  33012. tempObj['analyst'][name] = vectorClipJobsParameter[name];
  33013. if(name === 'mappingParameters'){
  33014. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  33015. tempObj['analyst']['mappingParameters'] = vectorClipJobsParameter[name];
  33016. }
  33017. }
  33018. }
  33019. }
  33020. SuperMap.VectorClipJobsParameter = VectorClipJobsParameter;
  33021. ;// CONCATENATED MODULE: ./src/common/iServer/VectorClipJobsService.js
  33022. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33023. * This program are made available under the terms of the Apache License, Version 2.0
  33024. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33025. /**
  33026. * @class SuperMap.VectorClipJobsService
  33027. * @category iServer ProcessingService VectorClip
  33028. * @classdesc 矢量裁剪分析服务类
  33029. * @extends {SuperMap.ProcessingServiceBase}
  33030. * @param {string} url -矢量裁剪分析服务地址。
  33031. * @param {Object} options - 交互服务时所需可选参数。
  33032. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  33033. * @param {Object} [options.headers] - 请求头。
  33034. */
  33035. class VectorClipJobsService extends ProcessingServiceBase {
  33036. constructor(url, options) {
  33037. super(url, options);
  33038. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/vectorclip');
  33039. this.CLASS_NAME = 'SuperMap.VectorClipJobsService';
  33040. }
  33041. /**
  33042. *@override
  33043. */
  33044. destroy() {
  33045. super.destroy();
  33046. }
  33047. /**
  33048. * @function SuperMap.VectorClipJobsService.protitype.getVectorClipJobs
  33049. * @description 获取矢量裁剪分析所有任务
  33050. */
  33051. getVectorClipJobs() {
  33052. super.getJobs(this.url);
  33053. }
  33054. /**
  33055. * @function SuperMap.KernelDensityJobsService.protitype.getVectorClipJob
  33056. * @description 获取指定id的矢量裁剪分析服务
  33057. * @param {string} id - 指定要获取数据的id
  33058. */
  33059. getVectorClipJob(id) {
  33060. super.getJobs(Util.urlPathAppend(this.url, id));
  33061. }
  33062. /**
  33063. * @function SuperMap.VectorClipJobsService.protitype.addVectorClipJob
  33064. * @description 新建矢量裁剪分析服务
  33065. * @param {SuperMap.VectorClipJobsParameter} params - 创建一个空间分析的请求参数。
  33066. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  33067. */
  33068. addVectorClipJob(params, seconds) {
  33069. super.addJob(this.url, params, VectorClipJobsParameter, seconds);
  33070. }
  33071. }
  33072. SuperMap.VectorClipJobsService = VectorClipJobsService;
  33073. ;// CONCATENATED MODULE: ./src/common/iServer/RasterFunctionParameter.js
  33074. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33075. * This program are made available under the terms of the Apache License, Version 2.0
  33076. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33077. /**
  33078. * @class SuperMap.RasterFunctionParameter
  33079. * @category iServer Map
  33080. * @classdesc iServer 地图服务栅格分析参数基类
  33081. * @param {Object} options - 参数。
  33082. * @param {SuperMap.RasterFunctionType} options.type - 栅格分析方法。
  33083. */
  33084. class RasterFunctionParameter {
  33085. constructor(options) {
  33086. options = options || {};
  33087. /**
  33088. * @member {SuperMap.RasterFunctionType} [SuperMap.RasterFunctionParameter.prototype.type]
  33089. * @description 栅格分析方法。
  33090. */
  33091. this.type = null;
  33092. Util.extend(this, options);
  33093. this.CLASS_NAME = 'SuperMap.RasterFunctionParameter';
  33094. }
  33095. /**
  33096. * @function SuperMap.RasterFunctionParameter.prototype.destroy
  33097. * @description 释放资源,将资源的属性置空。
  33098. */
  33099. destroy() {
  33100. this.type = null;
  33101. }
  33102. }
  33103. SuperMap.RasterFunctionParameter = RasterFunctionParameter;
  33104. ;// CONCATENATED MODULE: ./src/common/iServer/NDVIParameter.js
  33105. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33106. * This program are made available under the terms of the Apache License, Version 2.0
  33107. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33108. /**
  33109. * @class SuperMap.NDVIParameter
  33110. * @category iServer Map
  33111. * @classdesc 归一化植被指数参数类
  33112. * @param {Object} options - 参数。
  33113. * @param {number} [options.redIndex=0] - 红光谱波段索引。
  33114. * @param {number} [options.nirIndex=1] - 近红外光谱波段索引。
  33115. * @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。仅单波段数据时设定。
  33116. * @extends {SuperMap.RasterFunctionParameter}
  33117. */
  33118. class NDVIParameter extends RasterFunctionParameter {
  33119. constructor(options) {
  33120. super(options);
  33121. /**
  33122. * @member {number} [SuperMap.NDVIParameter.prototype.redIndex=0]
  33123. * @description 红光谱波段索引。
  33124. */
  33125. this.redIndex = 0;
  33126. /**
  33127. * @member {number} [SuperMap.NDVIParameter.prototype.nirIndex=1]
  33128. * @description 近红外光谱波段索引。
  33129. */
  33130. this.nirIndex = 1;
  33131. /**
  33132. * @member {string} [SuperMap.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"]
  33133. * @description 颜色表。由栅格的中断值和颜色停止之间的映射组成的,如0.3->d9f0a3ff 指的是[0,0.3)显示d9f0a3ff。仅单波段数据时设定。
  33134. */
  33135. this.colorMap =
  33136. '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';
  33137. /**
  33138. * @member {SuperMap.RasterFunctionType} [SuperMap.RasterFunctionParameter.prototype.type]
  33139. * @description 栅格分析方法。
  33140. */
  33141. this.type = RasterFunctionType.NDVI;
  33142. Util.extend(this, options);
  33143. this.CLASS_NAME = 'SuperMap.NDVIParameter';
  33144. }
  33145. /**
  33146. * @function SuperMap.NDVIParameter.prototype.destroy
  33147. * @override
  33148. */
  33149. destroy() {
  33150. super.destroy();
  33151. this.redIndex = null;
  33152. this.nirIndex = null;
  33153. this.colorMap = null;
  33154. }
  33155. /**
  33156. * @function SuperMap.NDVIParameter.prototype.toJSON
  33157. * @description 将 NDVIParameter 对象转化为 JSON 字符串。
  33158. * @returns {string} 返回转换后的 JSON 字符串。
  33159. */
  33160. toJSON() {
  33161. return {
  33162. redIndex: this.redIndex,
  33163. nirIndex: this.nirIndex,
  33164. colorMap: this.colorMap,
  33165. type: this.type
  33166. };
  33167. }
  33168. }
  33169. SuperMap.NDVIParameter = NDVIParameter;
  33170. ;// CONCATENATED MODULE: ./src/common/iServer/HillshadeParameter.js
  33171. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33172. * This program are made available under the terms of the Apache License, Version 2.0
  33173. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33174. /**
  33175. * @class SuperMap.HillshadeParameter
  33176. * @category iServer Map
  33177. * @classdesc 阴影面分析参数类
  33178. * @param {Object} options - 参数。
  33179. * @param {number} [options.altitude=45] - 高于地平线的光源高度角。高度角由正度数表示,0 度代表地平线,而 90 度代表头顶正上方。
  33180. * @param {number} [options.azimuth=315] - 光源的方位角。方位角由0到360度之间的正度数表示,以北为基准方向按顺时针进行测量。
  33181. * @param {number} [options.zFactor=1] - 一个表面 z 单位中地面 x,y 单位的数量。z 单位与输入表面的 x,y 单位不同时,可使用 z 因子调整 z 单位的测量单位。计算最终输出表面时,将用 z 因子乘以输入表面的 z 值。
  33182. * z 单位与输入表面的 x,y 单位不同时,可使用 z 因子调整 z 单位的测量单位。计算最终输出表面时,将用 z 因子乘以输入表面的 z 值。
  33183. * 如果 x,y 单位和 z 单位采用相同的测量单位,则 z 因子为 1。这是默认设置。
  33184. * 如果 x,y 单位和 z 单位采用不同的测量单位,则必须将 z 因子设置为适当的因子,否则会得到错误的结果。例如,如果 z 单位是英尺而 x,y 单位是米,则应使用 z 因子 0.3048 将 z 单位从英尺转换为米(1 英尺 = 0.3048 米)。
  33185. * 如果输入栅格位于球面坐标系中(如十进制度球面坐标系),则生成的山体阴影可能看起来很独特。这是因为水平地面单位与高程 z 单位之间的测量值存在差异。由于经度的长度随着纬度而变化,因此需要为该纬度指定一个适当的 z 因子。如果 x,y 单位是十进制度而 Z 单位是米,特定纬度的一些合适的 Z 因子为:
  33186. * Latitude Z-factor
  33187. * 0 0.00000898
  33188. * 10 0.00000912
  33189. * 20 0.00000956
  33190. * 30 0.00001036
  33191. * 40 0.00001171
  33192. * 50 0.00001395
  33193. * 60 0.00001792
  33194. * 70 0.00002619
  33195. * 80 0.00005156
  33196. * @extends {SuperMap.RasterFunctionParameter}
  33197. */
  33198. class HillshadeParameter extends RasterFunctionParameter {
  33199. constructor(options) {
  33200. super(options);
  33201. /**
  33202. * @member {number} [SuperMap.HillshadeParameter.prototype.altitude = 45]
  33203. * @description 高于地平线的光源高度角。高度角由正度数表示,0 度代表地平线,而 90 度代表头顶正上方。
  33204. */
  33205. this.altitude = 45;
  33206. /**
  33207. * @member {number} [SuperMap.HillshadeParameter.prototype.azimuth = 315]
  33208. * @description 光源的方位角。方位角由0到360度之间的正度数表示,以北为基准方向按顺时针进行测量。
  33209. */
  33210. this.azimuth = 315;
  33211. /**
  33212. * @member {number} [SuperMap.HillshadeParameter.prototype.zFactor = 1]
  33213. * @description 一个表面 z 单位中地面 x,y 单位的数量。z 单位与输入表面的 x,y 单位不同时,可使用 z 因子调整 z 单位的测量单位。计算最终输出表面时,将用 z 因子乘以输入表面的 z 值。
  33214. */
  33215. this.zFactor = 1;
  33216. /**
  33217. * @member {SuperMap.RasterFunctionType} SuperMap.RasterFunctionParameter.prototype.type
  33218. * @description 栅格分析方法。
  33219. */
  33220. this.type = RasterFunctionType.HILLSHADE;
  33221. Util.extend(this, options);
  33222. this.CLASS_NAME = 'SuperMap.HillshadeParameter';
  33223. }
  33224. /**
  33225. * @function SuperMap.HillshadeParameter.prototype.destroy
  33226. * @override
  33227. */
  33228. destroy() {
  33229. super.destroy();
  33230. this.altitude = null;
  33231. this.azimuth = null;
  33232. this.zFactor = null;
  33233. }
  33234. /**
  33235. * @function SuperMap.HillshadeParameter.prototype.toJSON
  33236. * @description 将 HillshadeParameter 对象转化为 JSON 字符串。
  33237. * @returns {string} 返回转换后的 JSON 字符串。
  33238. */
  33239. toJSON() {
  33240. return {
  33241. altitude: this.altitude,
  33242. azimuth: this.azimuth,
  33243. zFactor: this.zFactor,
  33244. type: this.type
  33245. };
  33246. }
  33247. }
  33248. SuperMap.HillshadeParameter = HillshadeParameter;
  33249. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobCustomItems.js
  33250. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33251. * This program are made available under the terms of the Apache License, Version 2.0
  33252. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33253. /**
  33254. * @class SuperMap.WebPrintingJobCustomItems
  33255. * @classdesc Web 打印图例元素参数类。
  33256. * @version 10.1.0
  33257. * @category iServer WebPrintingJob
  33258. * @param {Object} option - 初始化参数。
  33259. * @param {string} option.name - 图例元素的名称。
  33260. * @param {string} [option.picAsUrl] - 图例元素 Base64 格式图片。
  33261. * @param {string} [option.picAsBase64] - 图例元素图片的获取地址。
  33262. */
  33263. class WebPrintingJobCustomItems {
  33264. constructor(option) {
  33265. /**
  33266. * @member {string} SuperMap.WebPrintingJobCustomItems.prototype.name
  33267. * @description 图例元素的名称。
  33268. */
  33269. this.name = null;
  33270. /**
  33271. * @member {string} [SuperMap.WebPrintingJobCustomItems.prototype.picAsUrl]
  33272. * @description 图例元素 Base64 格式图片。
  33273. */
  33274. this.picAsUrl = null;
  33275. /**
  33276. * @member {string} [SuperMap.WebPrintingJobCustomItems.prototype.picAsBase64]
  33277. * @description 图例元素图片的获取地址。
  33278. */
  33279. this.picAsBase64 = null;
  33280. this.CLASS_NAME = 'SuperMap.WebPrintingJobCustomItems';
  33281. Util.extend(this, option);
  33282. }
  33283. /**
  33284. * @function SuperMap.WebPrintingJobCustomItems.prototype.destroy
  33285. * @description 释放资源,将引用资源的属性置空。
  33286. */
  33287. destroy() {
  33288. var me = this;
  33289. me.name = null;
  33290. me.picAsUrl = null;
  33291. me.picAsBase64 = null;
  33292. }
  33293. /**
  33294. * @function SuperMap.WebPrintingJobCustomItems.prototype.toJSON
  33295. * @description 将 SuperMap.WebPrintingJobCustomItems 对象转化为 JSON 字符串。
  33296. * @returns {string} 返回转换后的 JSON 字符串。
  33297. */
  33298. toJSON() {
  33299. var params = {
  33300. name: this.name
  33301. };
  33302. if (this.title) {
  33303. params.title = this.title;
  33304. }
  33305. if (this.picAsUrl) {
  33306. params.picAsUrl = this.picAsUrl;
  33307. } else if (this.picAsBase64) {
  33308. params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
  33309. }
  33310. return Util.toJSON(params);
  33311. }
  33312. }
  33313. SuperMap.WebPrintingJobCustomItems = WebPrintingJobCustomItems;
  33314. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobImage.js
  33315. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33316. * This program are made available under the terms of the Apache License, Version 2.0
  33317. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33318. /**
  33319. * @class SuperMap.WebPrintingJobImage
  33320. * @classdesc 表达小地图的静态图片参数类。
  33321. * @version 10.1.0
  33322. * @category iServer WebPrintingJob
  33323. * @param {Object} option - 初始化参数。
  33324. * @param {string} [option.picAsUrl] - 小地图的图片 url 地址。
  33325. * @param {string} [option.picAsBase64] - 小地图的base64位图片信息。
  33326. */
  33327. class WebPrintingJobImage {
  33328. constructor(option) {
  33329. /**
  33330. * @member {string} [SuperMap.WebPrintingJobImage.prototype.picAsUrl]
  33331. * @description 小地图的图片 url 地址。
  33332. */
  33333. this.picAsUrl = null;
  33334. /**
  33335. * @member {string} [SuperMap.WebPrintingJobImage.prototype.picAsBase64]
  33336. * @description 小地图的base64位图片信息。
  33337. */
  33338. this.picAsBase64 = null;
  33339. this.CLASS_NAME = 'SuperMap.WebPrintingJobImage';
  33340. Util.extend(this, option);
  33341. }
  33342. /**
  33343. * @function SuperMap.WebPrintingJobImage.prototype.destroy
  33344. * @description 释放资源,将引用资源的属性置空。
  33345. */
  33346. destroy() {
  33347. this.picAsUrl = null;
  33348. this.picAsBase64 = null;
  33349. }
  33350. /**
  33351. * @function SuperMap.WebPrintingJobImage.prototype.toJSON
  33352. * @description 将 SuperMap.WebPrintingJobImage 对象转化为 JSON 字符串。
  33353. * @returns {string} 返回转换后的 JSON 字符串。
  33354. */
  33355. toJSON() {
  33356. var params = {};
  33357. if (this.picAsUrl) {
  33358. params.picAsUrl = this.picAsUrl;
  33359. }
  33360. if (this.picAsBase64) {
  33361. params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
  33362. }
  33363. return Util.toJSON(params);
  33364. }
  33365. }
  33366. SuperMap.WebPrintingJobImage = WebPrintingJobImage;
  33367. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLayers.js
  33368. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33369. * This program are made available under the terms of the Apache License, Version 2.0
  33370. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33371. /**
  33372. * @class SuperMap.WebPrintingJobLayers
  33373. * @classdesc 将图例添加到布局的业务图层参数类。
  33374. * @version 10.1.0
  33375. * @category iServer WebPrintingJob
  33376. * @param {Object} option - 初始化参数。
  33377. * @param {string} [option.name] - 表示图层 name 的字符串。此 name 必须唯一,并且必须与定义业务图层的 LegendOptions_layers 元素中的图层 name 匹配。
  33378. */
  33379. class WebPrintingJobLayers {
  33380. constructor(option) {
  33381. /**
  33382. * @member {string} SuperMap.WebPrintingJobLayers.prototype.name
  33383. * @description 图层 name。
  33384. */
  33385. this.name = null;
  33386. /**
  33387. * @member {string} SuperMap.WebPrintingJobLayers.prototype.layerType
  33388. * @description 图层 type。
  33389. */
  33390. this.layerType = null;
  33391. /**
  33392. * @member {string} SuperMap.WebPrintingJobLayers.prototype.url
  33393. * @description 图层 url。
  33394. */
  33395. this.url = null;
  33396. this.CLASS_NAME = 'SuperMap.WebPrintingJobLayers';
  33397. Util.extend(this, option);
  33398. }
  33399. /**
  33400. * @function SuperMap.WebPrintingJobLayers.prototype.destroy
  33401. * @description 释放资源,将引用资源的属性置空。
  33402. */
  33403. destroy() {
  33404. this.name = null;
  33405. this.layerType = null;
  33406. this.url = null;
  33407. }
  33408. }
  33409. SuperMap.WebPrintingJobLayers = WebPrintingJobLayers;
  33410. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLegendOptions.js
  33411. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33412. * This program are made available under the terms of the Apache License, Version 2.0
  33413. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33414. /**
  33415. * @class SuperMap.WebPrintingJobLegendOptions
  33416. * @classdesc Web 打印图例参数类。
  33417. * @version 10.1.0
  33418. * @category iServer WebPrintingJob
  33419. * @param {Object} option - 初始化参数。
  33420. * @param {string} [option.title] - 图例名称。
  33421. * @param {string} [option.picAsUrl] - 图例的图片 url 地址。
  33422. * @param {string} [option.picAsBase64] - 图例的 base64 位图片信息。
  33423. * @param {SuperMap.WebPrintingJobLayers} [option.layers] - 图例的布局业务图层参数类。
  33424. * @param {SuperMap.WebPrintingJobCustomItems} [option.customItems] - 自定义图例元素参数类。
  33425. */
  33426. class WebPrintingJobLegendOptions {
  33427. constructor(option) {
  33428. /**
  33429. * @member {string} SuperMap.WebPrintingJobLegendOptions.prototype.title
  33430. * @description 图例名称。
  33431. */
  33432. this.title = null;
  33433. /**
  33434. * @member {string} [SuperMap.WebPrintingJobLegendOptions.prototype.picAsUrl]
  33435. * @description 图例的图片 url 地址。
  33436. */
  33437. this.picAsUrl = null;
  33438. /**
  33439. * @member {string} [SuperMap.WebPrintingJobLegendOptions.prototype.picAsBase64]
  33440. * @description 图例的 base64 位图片信息。
  33441. */
  33442. this.picAsBase64 = null;
  33443. /**
  33444. * @member {SuperMap.WebPrintingJobLayers} [SuperMap.WebPrintingJobLegendOptions.prototype.layers]
  33445. * @description 图例的布局业务图层参数类。
  33446. */
  33447. this.layers = null;
  33448. /**
  33449. * @member {SuperMap.WebPrintingJobCustomItems} [SuperMap.WebPrintingJobLegendOptions.prototype.customItems]
  33450. * @description 自定义图例元素参数类。
  33451. */
  33452. this.customItems = null;
  33453. this.CLASS_NAME = 'SuperMap.WebPrintingJobLegendOptions';
  33454. Util.extend(this, option);
  33455. }
  33456. /**
  33457. * @function SuperMap.WebPrintingJobLegendOptions.prototype.destroy
  33458. * @description 释放资源,将引用资源的属性置空。
  33459. */
  33460. destroy() {
  33461. this.title = null;
  33462. this.picAsUrl = null;
  33463. this.picAsBase64 = null;
  33464. if (this.layers instanceof WebPrintingJobLayers) {
  33465. this.layers.destroy();
  33466. this.layers = null;
  33467. }
  33468. if (this.customItems instanceof WebPrintingJobCustomItems) {
  33469. this.customItems.destroy();
  33470. this.customItems = null;
  33471. }
  33472. }
  33473. /**
  33474. * @function SuperMap.WebPrintingJobLegendOptions.prototype.toJSON
  33475. * @description 将 SuperMap.WebPrintingJobLegendOptions 对象转化为 JSON 字符串。
  33476. * @returns {string} 返回转换后的 JSON 字符串。
  33477. */
  33478. toJSON() {
  33479. var params = {
  33480. title: this.title || ""
  33481. };
  33482. if (this.picAsUrl) {
  33483. params.picAsUrl = this.picAsUrl;
  33484. } else if (this.picAsBase64) {
  33485. params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
  33486. } else if (this.customItems) {
  33487. params.customItems = this.customItems;
  33488. }
  33489. return Util.toJSON(params);
  33490. }
  33491. }
  33492. SuperMap.WebPrintingJobLegendOptions = WebPrintingJobLegendOptions;
  33493. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLittleMapOptions.js
  33494. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33495. * This program are made available under the terms of the Apache License, Version 2.0
  33496. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33497. /**
  33498. * @class SuperMap.WebPrintingJobLittleMapOptions
  33499. * @classdesc Web 打印小地图参数类。
  33500. * @version 10.1.0
  33501. * @category iServer WebPrintingJob
  33502. * @param {Object} option - 初始化参数。
  33503. * @param {SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} option.center - 小地图的中心点。
  33504. * @param {number} [option.scale] - 小地图的比例尺。
  33505. * @param {Array.<string>} [option.layerNames] - 指定 WebMap中图层名称的列表,用于渲染小地图。
  33506. * @param {SuperMap.WebPrintingJobImage} [option.image] - 表达小地图的静态图类。
  33507. * @param {SuperMap.WebPrintingJobLayers} [option.layers] - 指定 WebMap 中的 layers 图层类。
  33508. */
  33509. class WebPrintingJobLittleMapOptions {
  33510. constructor(option) {
  33511. /**
  33512. * @member {Array.<(SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point)>} SuperMap.WebPrintingJobLittleMapOptions.prototype.center
  33513. * @description 小地图的中心点。
  33514. */
  33515. this.center = null;
  33516. /**
  33517. * @member {number} [SuperMap.WebPrintingJobLittleMapOptions.prototype.scale]
  33518. * @description 小地图的比例尺。
  33519. */
  33520. this.scale = null;
  33521. /**
  33522. * @member {Array.<string>} SuperMap.WebPrintingJobLittleMapOptions.prototype.layerNames
  33523. * @description 指定 WebMap中图层名称的列表,用于渲染小地图。
  33524. */
  33525. this.layerNames = null;
  33526. /**
  33527. * @member {SuperMap.WebPrintingJobImage} [SuperMap.WebPrintingJobLittleMapOptions.prototype.image]
  33528. * @description 表达小地图的静态图类。暂不支持
  33529. */
  33530. this.image = null;
  33531. /**
  33532. * @member {SuperMap.WebPrintingJobLayers} [SuperMap.WebPrintingJobLittleMapOptions.prototype.layers]
  33533. * @description 指定 WebMap 中的 layers 图层类。
  33534. */
  33535. this.layers = null;
  33536. this.CLASS_NAME = 'SuperMap.WebPrintingJobLittleMapOptions';
  33537. Util.extend(this, option);
  33538. }
  33539. /**
  33540. * @function SuperMap.WebPrintingJobLittleMapOptions.prototype.destroy
  33541. * @description 释放资源,将引用资源的属性置空。
  33542. */
  33543. destroy() {
  33544. this.center = null;
  33545. this.scale = null;
  33546. this.layerNames = null;
  33547. if (this.image instanceof WebPrintingJobImage) {
  33548. this.image.destroy();
  33549. this.image = null;
  33550. }
  33551. if (this.layers instanceof WebPrintingJobLayers) {
  33552. this.layers.destroy();
  33553. this.layers = null;
  33554. }
  33555. }
  33556. /**
  33557. * @function SuperMap.WebPrintingJobLittleMapOptions.prototype.toJSON
  33558. * @description 将 SuperMap.WebPrintingJobLittleMapOptions 对象转化为 JSON 字符串。
  33559. * @returns {string} 返回转换后的 JSON 字符串。
  33560. */
  33561. toJSON() {
  33562. var params = {
  33563. scale: this.scale,
  33564. center: this.center
  33565. };
  33566. if (this.layerNames) {
  33567. params.layerNames = this.layerNames;
  33568. } else if (this.layers) {
  33569. params.layers = this.layers;
  33570. }
  33571. if (this.image) {
  33572. params.image = this.image;
  33573. }
  33574. return Util.toJSON(params);
  33575. }
  33576. }
  33577. SuperMap.WebPrintingJobLittleMapOptions = WebPrintingJobLittleMapOptions;
  33578. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobNorthArrowOptions.js
  33579. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33580. * This program are made available under the terms of the Apache License, Version 2.0
  33581. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33582. /**
  33583. * @class SuperMap.WebPrintingJobNorthArrowOptions
  33584. * @classdesc Web 打印地图指北针参数类。
  33585. * @version 10.1.0
  33586. * @category iServer WebPrintingJob
  33587. * @param {Object} option - 初始化参数。
  33588. * @param {string} option.picAsUrl - 指北针的图片 url 地址。
  33589. * @param {string} [option.picAsBase64] - 指北针的base64位图片信息。
  33590. */
  33591. class WebPrintingJobNorthArrowOptions {
  33592. constructor(option) {
  33593. /**
  33594. * @member {string} SuperMap.WebPrintingJobNorthArrowOptions.prototype.picAsUrl
  33595. * @description 指北针的图片 url 地址。
  33596. */
  33597. this.picAsUrl = null;
  33598. /**
  33599. * @member {string} [SuperMap.WebPrintingJobNorthArrowOptions.prototype.picAsBase64]
  33600. * @description 指北针的base64位图片信息。
  33601. */
  33602. this.picAsBase64 = null;
  33603. this.CLASS_NAME = 'SuperMap.WebPrintingJobNorthArrowOptions';
  33604. Util.extend(this, option);
  33605. }
  33606. /**
  33607. * @function SuperMap.WebPrintingJobNorthArrowOptions.prototype.destroy
  33608. * @description 释放资源,将引用资源的属性置空。
  33609. */
  33610. destroy() {
  33611. this.picAsUrl = null;
  33612. this.picAsBase64 = null;
  33613. }
  33614. /**
  33615. * @function SuperMap.WebPrintingJobNorthArrowOptions.prototype.toJSON
  33616. * @description 将 SuperMap.WebPrintingJobNorthArrowOptions 对象转化为 JSON 字符串。
  33617. * @returns {string} 返回转换后的 JSON 字符串。
  33618. */
  33619. toJSON() {
  33620. var params = {};
  33621. if (this.picAsUrl) {
  33622. params.picAsUrl = this.picAsUrl;
  33623. } else if (this.picAsBase64) {
  33624. params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
  33625. }
  33626. return Util.toJSON(params);
  33627. }
  33628. }
  33629. SuperMap.WebPrintingJobNorthArrowOptions = WebPrintingJobNorthArrowOptions;
  33630. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobScaleBarOptions.js
  33631. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33632. * This program are made available under the terms of the Apache License, Version 2.0
  33633. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33634. /**
  33635. * @class SuperMap.WebPrintingJobScaleBarOptions
  33636. * @classdesc Web 打印比例尺参数类。
  33637. * @category iServer WebPrintingJob
  33638. * @version 10.1.0
  33639. * @param {Object} option - 初始化参数。
  33640. * @param {string} [option.scaleText] - 比例尺文本信息。例如:1:1000000
  33641. * @param {SuperMap.WebScaleOrientationType} [option.orientation] - 比例尺的方位样式。
  33642. * @param {SuperMap.WebScaleType} [option.type] - 比例尺的样式。
  33643. * @param {number} [option.intervals] - 比例尺条的段数。
  33644. * @param {SuperMap.WebScaleUnit} [option.unit] - 比例尺的单位制。
  33645. */
  33646. class WebPrintingJobScaleBarOptions {
  33647. constructor(option) {
  33648. /**
  33649. * @member {string} SuperMap.WebPrintingJobScaleBarOptions.prototype.scaleText
  33650. * @description 比例尺文本信息。
  33651. */
  33652. this.scaleText = null;
  33653. /**
  33654. * @member {SuperMap.WebScaleOrientationType} [SuperMap.WebPrintingJobScaleBarOptions.prototype.orientation]
  33655. * @description 比例尺的方位样式。
  33656. */
  33657. this.orientation = null;
  33658. /**
  33659. * @member {SuperMap.WebScaleType} [SuperMap.WebPrintingJobScaleBarOptions.prototype.type]
  33660. * @description 比例尺的样式。
  33661. */
  33662. this.type = null;
  33663. /**
  33664. * @member {object} [SuperMap.WebPrintingJobScaleBarOptions.prototype.intervals]
  33665. * @description 比例尺条的段数。
  33666. */
  33667. this.intervals = null;
  33668. /**
  33669. * @member {SuperMap.WebScaleUnit} [SuperMap.WebPrintingJobScaleBarOptions.prototype.unit]
  33670. * @description 比例尺的单位制。
  33671. */
  33672. this.unit = null;
  33673. this.CLASS_NAME = 'SuperMap.WebPrintingJobScaleBarOptions';
  33674. Util.extend(this, option);
  33675. }
  33676. /**
  33677. * @function SuperMap.WebPrintingJobScaleBarOptions.prototype.destroy
  33678. * @description 释放资源,将引用资源的属性置空。
  33679. */
  33680. destroy() {
  33681. this.scaleText = null;
  33682. this.orientation = null;
  33683. this.type = null;
  33684. this.intervals = null;
  33685. this.unit = null;
  33686. }
  33687. /**
  33688. * @function SuperMap.WebPrintingJobScaleBarOptions.prototype.toJSON
  33689. * @description 将 SuperMap.WebPrintingJobScaleBarOptions 对象转化为 JSON 字符串。
  33690. * @returns {string} 返回转换后的 JSON 字符串。
  33691. */
  33692. toJSON() {
  33693. var params = {
  33694. scaleText: this.scaleText || "",
  33695. type: this.type || "BAR",
  33696. intervals: this.intervals || "",
  33697. unit: this.unit || "METER"
  33698. };
  33699. if (this.orientation) {
  33700. params.orientation = this.orientation;
  33701. }
  33702. return Util.toJSON(params);
  33703. }
  33704. }
  33705. SuperMap.WebPrintingJobScaleBarOptions = WebPrintingJobScaleBarOptions;
  33706. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobContent.js
  33707. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33708. * This program are made available under the terms of the Apache License, Version 2.0
  33709. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33710. /**
  33711. * @class SuperMap.WebPrintingJobContent
  33712. * @classdesc Web 打印内容参数类。
  33713. * @version 10.1.0
  33714. * @category iServer WebPrintingJob
  33715. * @param {Object} option - 初始化参数。
  33716. * @param {string} option.type - Web 打印内容支持的类型。目前支持的类型:WEBMAP
  33717. * @param {string} [option.url] - 待打印的 SuperMap iPortal WebMap 的 url 地址。例如:http://supermapiportal:8190/iportal/web/maps/{mapid}/map.rjson
  33718. * @param {string} [option.token] - 如果待打印的是 SuperMap iPortal 用户私有的 WebMap,需要提供 SuperMap iPortal 用户的 token。
  33719. * @param {WebMapSummaryObject} [option.value] - 传递的是一个符合 SuperMap WebMap 规范的 WebMap 的 JSON 表达,也可以是一个完整的 SuperMap iPortal 数据上图制作的 WebMap 的 json 表达。如果已填了 url 参数,此参数可不传
  33720. */
  33721. class WebPrintingJobContent {
  33722. constructor(option) {
  33723. /**
  33724. * @member {string} SuperMap.WebPrintingJobContent.prototype.type
  33725. * @description Web 打印内容支持的类型。
  33726. */
  33727. this.type = null;
  33728. /**
  33729. * @member {string} [SuperMap.WebPrintingJobContent.prototype.url]
  33730. * @description 待打印的 SuperMap iPortal WebMap 的 url 地址。
  33731. */
  33732. this.url = null;
  33733. /**
  33734. * @member {string} [SuperMap.WebPrintingJobContent.prototype.token]
  33735. * @description 如果待打印的是 SuperMap iPortal 用户私有的 WebMap,需要提供 SuperMap iPortal 用户的 token。
  33736. */
  33737. this.token = null;
  33738. /**
  33739. * @member {WebMapSummaryObject} [SuperMap.WebPrintingJobContent.prototype.value]
  33740. * @description 传递的是一个符合 SuperMap WebMap 规范的 WebMap 的 JSON 表达,也可以是一个完整的 SuperMap iPortal 数据上图制作的 WebMap 的 json 表达。
  33741. */
  33742. this.value = null;
  33743. this.CLASS_NAME = 'SuperMap.WebPrintingJobContent';
  33744. Util.extend(this, option);
  33745. }
  33746. /**
  33747. * @function SuperMap.WebPrintingJobContent.prototype.destroy
  33748. * @description 释放资源,将引用资源的属性置空。
  33749. */
  33750. destroy() {
  33751. this.type = false || "WEBMAP";
  33752. this.url = null;
  33753. this.token = null;
  33754. this.value = null;
  33755. }
  33756. /**
  33757. * @function SuperMap.WebPrintingJobContent.prototype.toJSON
  33758. * @description 将 SuperMap.WebPrintingJobContent 对象转化为 JSON 字符串。
  33759. * @returns {string} 返回转换后的 JSON 字符串。
  33760. */
  33761. toJSON() {
  33762. var params = {
  33763. type: this.type
  33764. };
  33765. if (this.token) {
  33766. params.token = this.token;
  33767. }
  33768. if (this.url) {
  33769. params.url = this.url;
  33770. } else if (this.value) {
  33771. params.value = this.value;
  33772. }
  33773. return Util.toJSON(params);
  33774. }
  33775. }
  33776. SuperMap.WebPrintingJobContent = WebPrintingJobContent;
  33777. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLayoutOptions.js
  33778. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33779. * This program are made available under the terms of the Apache License, Version 2.0
  33780. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33781. /**
  33782. * @class SuperMap.WebPrintingJobLayoutOptions
  33783. * @classdesc Web 打印的布局参数类。
  33784. * @version 10.1.0
  33785. * @category iServer WebPrintingJob
  33786. * @param {Object} option - 初始化参数。
  33787. * @param {string} option.templateName - 布局模板的名称。
  33788. * @param {string} option.title - 地图主标题名称。
  33789. * @param {string} option.subTitle - 地图副标题名称。
  33790. * @param {string} option.author - 地图作者名称。
  33791. * @param {string} option.copyright - 地图版权信息。
  33792. * @param {SuperMap.WebPrintingJobLittleMapOptions} option.littleMapOptions - 小地图参数类。
  33793. * @param {SuperMap.WebPrintingJobLegendOptions} option.legendOptions - 图例参数类。
  33794. * @param {SuperMap.WebPrintingJobScaleBarOptions} [option.scaleBarOptions] - 地图比例尺参数类。
  33795. * @param {SuperMap.WebPrintingJobNorthArrowOptions} [option.northArrowOptions] - 地图指北针参数类。
  33796. */
  33797. class WebPrintingJobLayoutOptions {
  33798. constructor(option) {
  33799. /**
  33800. * @member {string} SuperMap.WebPrintingJobLayoutOptions.prototype.templateName
  33801. * @description 布局模板的名称。
  33802. */
  33803. this.templateName = null;
  33804. /**
  33805. * @member {string} SuperMap.WebPrintingJobLayoutOptions.prototype.title
  33806. * @description 地图主标题名称。
  33807. */
  33808. this.title = null;
  33809. /**
  33810. * @member {string} SuperMap.WebPrintingJobLayoutOptions.prototype.subTitle
  33811. * @description 地图副标题名称。
  33812. */
  33813. this.subTitle = null;
  33814. /**
  33815. * @member {string} SuperMap.WebPrintingJobLayoutOptions.prototype.author
  33816. * @description 地图作者名称。
  33817. */
  33818. this.author = null;
  33819. /**
  33820. * @member {string} SuperMap.WebPrintingJobLayoutOptions.prototype.copyright
  33821. * @description 地图版权信息。
  33822. */
  33823. this.copyright = null;
  33824. /**
  33825. * @member {SuperMap.WebPrintingJobScaleBarOptions} [SuperMap.WebPrintingJobLayoutOptions.prototype.scaleBarOptions]
  33826. * @description 地图比例尺参数类。
  33827. */
  33828. this.scaleBarOptions = null;
  33829. /**
  33830. * @member {SuperMap.WebPrintingJobNorthArrowOptions} [SuperMap.WebPrintingJobLayoutOptions.prototype.northArrowOptions]
  33831. * @description 地图指北针参数类。
  33832. */
  33833. this.northArrowOptions = null;
  33834. /**
  33835. * @member {SuperMap.WebPrintingJobLittleMapOptions} SuperMap.WebPrintingJobLayoutOptions.prototype.littleMapOptions
  33836. * @description 小地图参数类。
  33837. */
  33838. this.littleMapOptions = null;
  33839. /**
  33840. * @member {SuperMap.WebPrintingJobLegendOptions} SuperMap.WebPrintingJobLayoutOptions.prototype.legendOptions
  33841. * @description 图例参数类。
  33842. */
  33843. this.legendOptions = null;
  33844. this.CLASS_NAME = 'SuperMap.WebPrintingJobLayoutOptions';
  33845. Util.extend(this, option);
  33846. }
  33847. /**
  33848. * @function SuperMap.WebPrintingJobLayoutOptions.prototype.destroy
  33849. * @description 释放资源,将引用资源的属性置空。
  33850. */
  33851. destroy() {
  33852. this.templateName = null;
  33853. this.title = null;
  33854. this.subTitle = null;
  33855. this.author = null;
  33856. this.copyright = null;
  33857. if (this.scaleBarOptions instanceof WebPrintingJobScaleBarOptions) {
  33858. this.scaleBarOptions.destroy();
  33859. this.scaleBarOptions = null;
  33860. }
  33861. if (this.northArrowOptions instanceof WebPrintingJobNorthArrowOptions) {
  33862. this.northArrowOptions.destroy();
  33863. this.northArrowOptions = null;
  33864. }
  33865. if (this.littleMapOptions instanceof WebPrintingJobLittleMapOptions) {
  33866. this.littleMapOptions.destroy();
  33867. this.littleMapOptions = null;
  33868. }
  33869. if (this.legendOptions instanceof WebPrintingJobLegendOptions) {
  33870. this.legendOptions.destroy();
  33871. this.legendOptions = null;
  33872. }
  33873. }
  33874. /**
  33875. * @function SuperMap.WebPrintingJobLayoutOptions.prototype.toJSON
  33876. * @description 将 SuperMap.WebPrintingJobLayoutOptions 对象转化为 JSON 字符串。
  33877. * @returns {string} 返回转换后的 JSON 字符串。
  33878. */
  33879. toJSON() {
  33880. var params = {
  33881. templateName: this.templateName,
  33882. title: this.title,
  33883. subTitle: this.subTitle,
  33884. author: this.author,
  33885. copyright: this.copyright
  33886. };
  33887. if (this.scaleBarOptions) {
  33888. params.scaleBarOptions = this.scaleBarOptions;
  33889. }
  33890. if (this.northArrowOptions) {
  33891. params.northArrowOptions = this.northArrowOptions;
  33892. }
  33893. if (this.littleMapOptions) {
  33894. params.littleMapOptions = this.littleMapOptions;
  33895. }
  33896. if (this.legendOptions) {
  33897. params.legendOptions = this.legendOptions;
  33898. }
  33899. return Util.toJSON(params);
  33900. }
  33901. }
  33902. SuperMap.WebPrintingJobLayoutOptions = WebPrintingJobLayoutOptions;
  33903. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobExportOptions.js
  33904. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33905. * This program are made available under the terms of the Apache License, Version 2.0
  33906. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33907. /**
  33908. * @class SuperMap.WebPrintingJobExportOptions
  33909. * @classdesc Web 打印的输出参数类。
  33910. * @version 10.1.0
  33911. * @category iServer WebPrintingJob
  33912. * @param {Object} option - 初始化参数。
  33913. * @param {SuperMap.WebExportFormatType} option.format - Web 打印输出的格式,目前支持:PNG、PDF。
  33914. * @param {number} [option.dpi=96] - Web 打印输出的分辨率,单位为每英寸点数。默认值为 96 dpi。
  33915. * @param {number} [option.scale] - Web 打印输出的地图比例尺。
  33916. * @param {number} [option.rotation] - Web 打印输出的地图角度。
  33917. * @param {SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} [option.center] - Web 打印输出的地图中心点。
  33918. */
  33919. class WebPrintingJobExportOptions {
  33920. constructor(option) {
  33921. /**
  33922. * @member {SuperMap.WebExportFormatType} SuperMap.WebPrintingJobExportOptions.prototype.format
  33923. * @description Web 打印输出的格式。
  33924. */
  33925. this.format = null;
  33926. /**
  33927. * @member {number} [SuperMap.WebPrintingJobExportOptions.prototype.dpi=96]
  33928. * @description Web 打印输出的分辨率,单位为每英寸点数。
  33929. */
  33930. this.dpi = 96;
  33931. /**
  33932. * @member {number} [SuperMap.WebPrintingJobExportOptions.prototype.scale]
  33933. * @description Web 打印输出的地图比例尺。
  33934. */
  33935. this.scale = null;
  33936. /**
  33937. * @member {number} [SuperMap.WebPrintingJobExportOptions.prototype.rotation]
  33938. * @description Web 打印输出的地图角度。
  33939. */
  33940. this.rotation = null;
  33941. /**
  33942. * @member {Array.<(SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point)>} [SuperMap.WebPrintingJobExportOptions.prototype.center]
  33943. * @description Web 打印输出的地图中心点。
  33944. */
  33945. this.center = null;
  33946. this.CLASS_NAME = 'SuperMap.WebPrintingJobExportOptions';
  33947. Util.extend(this, option);
  33948. }
  33949. /**
  33950. * @function SuperMap.WebPrintingJobExportOptions.prototype.destroy
  33951. * @description 释放资源,将引用资源的属性置空。
  33952. */
  33953. destroy() {
  33954. this.format = null;
  33955. this.dpi = null;
  33956. this.scale = null;
  33957. this.rotation = null;
  33958. this.center = null;
  33959. this.outputSize = null;
  33960. }
  33961. /**
  33962. * @function SuperMap.WebPrintingJobExportOptions.prototype.toJSON
  33963. * @description 将 SuperMap.WebPrintingJobExportOptions 对象转化为 JSON 字符串。
  33964. * @returns {string} 返回转换后的 JSON 字符串。
  33965. */
  33966. toJSON() {
  33967. var params = {
  33968. format: this.format || "PDF",
  33969. dpi: this.dpi,
  33970. scale: this.scale,
  33971. center: this.center
  33972. };
  33973. if (this.rotation) {
  33974. params.rotation = this.rotation;
  33975. }
  33976. if (this.outputSize) {
  33977. params.outputSize = this.outputSize;
  33978. }
  33979. return Util.toJSON(params);
  33980. }
  33981. }
  33982. SuperMap.WebPrintingJobExportOptions = WebPrintingJobExportOptions;
  33983. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobParameters.js
  33984. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33985. * This program are made available under the terms of the Apache License, Version 2.0
  33986. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33987. /**
  33988. * @class SuperMap.WebPrintingJobParameters
  33989. * @category iServer WebPrintingJob
  33990. * @version 10.1.0
  33991. * @classdesc Web 打印参数类
  33992. * @param {Object} options - 初始化参数。
  33993. * @param {SuperMap.WebPrintingJobContent} options.content - Web 打印的内容类。
  33994. * @param {SuperMap.WebPrintingJobLayoutOptions} options.layoutOptions - Web 打印的布局类,包含各种布局元素的设置。
  33995. * @param {SuperMap.WebPrintingJobExportOptions} options.exportOptions - Web 打印的输出类,包含 DPI、页面大小等。
  33996. */
  33997. class WebPrintingJobParameters {
  33998. constructor(options) {
  33999. if (!options) {
  34000. return;
  34001. }
  34002. /**
  34003. * @member {SuperMap.WebPrintingJobContent} SuperMap.WebPrintingJobParameters.prototype.content
  34004. * @description Web 打印的内容类。
  34005. */
  34006. this.content = null;
  34007. /**
  34008. * @member {SuperMap.WebPrintingJobLayoutOptions} SuperMap.WebPrintingJobParameters.prototype.layoutOptions
  34009. * @description Web 打印的布局类,包含各种布局元素的设置。
  34010. */
  34011. this.layoutOptions = null;
  34012. /**
  34013. * @member {SuperMap.WebPrintingJobExportOptions} SuperMap.WebPrintingJobParameters.prototype.exportOptions
  34014. * @description Web 打印的输出类,包含 DPI、页面大小等。
  34015. */
  34016. this.exportOptions = null;
  34017. Util.extend(this, options);
  34018. this.CLASS_NAME = 'SuperMap.WebPrintingJobParameters';
  34019. }
  34020. /**
  34021. * @function SuperMap.WebPrintingJobParameters.prototype.destroy
  34022. * @description 释放资源,将引用资源的属性置空。
  34023. */
  34024. destroy() {
  34025. if (this.content instanceof WebPrintingJobContent) {
  34026. this.content.destroy();
  34027. this.content = null;
  34028. }
  34029. if (this.layoutOptions instanceof WebPrintingJobLayoutOptions) {
  34030. this.layoutOptions.destroy();
  34031. this.layoutOptions = null;
  34032. }
  34033. if (this.exportOptions instanceof WebPrintingJobExportOptions) {
  34034. this.exportOptions.destroy();
  34035. this.exportOptions = null;
  34036. }
  34037. }
  34038. }
  34039. SuperMap.WebPrintingJobParameters = WebPrintingJobParameters;
  34040. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingService.js
  34041. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  34042. * This program are made available under the terms of the Apache License, Version 2.0
  34043. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34044. /**
  34045. * @class SuperMap.WebPrintingService
  34046. * @category iServer WebPrintingJob
  34047. * @version 10.1.0
  34048. * @classdesc 打印地图服务基类。
  34049. * @extends {SuperMap.CommonServiceBase}
  34050. * @param {string} url - 资源根地址。请求打印地图服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/webprinting/rest/webprinting/v1。
  34051. * @param {Object} options - 参数。
  34052. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  34053. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  34054. * @param {Object} [options.headers] - 请求头。
  34055. */
  34056. class WebPrintingService extends CommonServiceBase {
  34057. /**
  34058. * @function SuperMap.WebPrintingService.prototype.constructor
  34059. * @description 打印地图服务基类。
  34060. * @param {string} url - 资源根地址。请求打印地图服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/webprinting/rest/webprinting/v1。
  34061. * @param {Object} options -参数。
  34062. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  34063. */
  34064. constructor(url, options) {
  34065. super(url, options);
  34066. if (options) {
  34067. Util.extend(this, options);
  34068. }
  34069. this.CLASS_NAME = 'SuperMap.WebPrintingService';
  34070. if (!this.url) {
  34071. return;
  34072. }
  34073. }
  34074. /**
  34075. * @function SuperMap.WebPrintingService.prototype.destroy
  34076. * @description 释放资源,将引用资源的属性置空。
  34077. */
  34078. destroy() {
  34079. super.destroy();
  34080. }
  34081. /**
  34082. * @function SuperMap.WebPrintingService.prototype.createWebPrintingJob
  34083. * @description 创建 Web 打印任务。
  34084. * @param {SuperMap.WebPrintingJobParameters} params - Web 打印的请求参数。
  34085. */
  34086. createWebPrintingJob(params) {
  34087. if (!params) {
  34088. return;
  34089. }
  34090. if (params.layoutOptions) {
  34091. if (params.layoutOptions.legendOptions) {
  34092. !params.layoutOptions.legendOptions.title && (params.layoutOptions.legendOptions.title = '');
  34093. params.layoutOptions.legendOptions.picAsBase64 =
  34094. params.layoutOptions.legendOptions.picAsBase64 &&
  34095. params.layoutOptions.legendOptions.picAsBase64.replace(/^data:.+;base64,/, '');
  34096. if (
  34097. params.layoutOptions.legendOptions.customItems &&
  34098. params.layoutOptions.legendOptions.customItems.hasOwnProperty('picAsBase64')
  34099. ) {
  34100. params.layoutOptions.legendOptions.customItems.picAsBase64 = params.layoutOptions.legendOptions.customItems.picAsBase64.replace(
  34101. /^data:.+;base64,/,
  34102. ''
  34103. );
  34104. }
  34105. }
  34106. }
  34107. var me = this;
  34108. me.request({
  34109. url: me._processUrl('jobs'),
  34110. method: 'POST',
  34111. data: Util.toJSON(params),
  34112. scope: me,
  34113. success: me.serviceProcessCompleted,
  34114. failure: me.serviceProcessFailed
  34115. });
  34116. }
  34117. /**
  34118. * @function SuperMap.WebPrintingService.prototype.getPrintingJob
  34119. * @description 获取 Web 打印输出文档任务。
  34120. * @param {String} jobId - Web 打印任务 ID
  34121. */
  34122. getPrintingJob(jobId) {
  34123. var me = this;
  34124. var url = me._processUrl(`jobs/${jobId}`);
  34125. me.request({
  34126. url,
  34127. method: 'GET',
  34128. scope: me,
  34129. success: function (result) {
  34130. me.rollingProcess(result, url);
  34131. },
  34132. failure: me.serviceProcessFailed
  34133. });
  34134. }
  34135. /**
  34136. * @function SuperMap.WebPrintingService.prototype.getPrintingJobResult
  34137. * @description 获取 Web 打印任务的输出文档。
  34138. * @param {String} jobId - Web 打印输入文档任务 ID。
  34139. */
  34140. getPrintingJobResult(jobId) {
  34141. var me = this;
  34142. me.request({
  34143. url: me._processUrl(`jobs/${jobId}/result`),
  34144. method: 'GET',
  34145. scope: me,
  34146. success: me.serviceProcessCompleted,
  34147. failure: me.serviceProcessFailed
  34148. });
  34149. }
  34150. /**
  34151. * @function SuperMap.WebPrintingService.prototype.getLayoutTemplates
  34152. * @description 查询 Web 打印服务所有可用的模板信息。
  34153. */
  34154. getLayoutTemplates() {
  34155. var me = this;
  34156. me.request({
  34157. url: me._processUrl('layouts'),
  34158. method: 'GET',
  34159. scope: me,
  34160. success: me.serviceProcessCompleted,
  34161. failure: me.serviceProcessFailed
  34162. });
  34163. }
  34164. /**
  34165. * @function SuperMap.WebPrintingService.prototype.rollingProcess
  34166. * @description 轮询查询 Web 打印任务。
  34167. * @param {Object} result - 服务器返回的结果对象。
  34168. */
  34169. rollingProcess(result, url) {
  34170. var me = this;
  34171. if (!result) {
  34172. return;
  34173. }
  34174. var id = setInterval(function () {
  34175. me.request({
  34176. url,
  34177. method: 'GET',
  34178. scope: me,
  34179. success: function (result) {
  34180. switch (result.status) {
  34181. case 'FINISHED':
  34182. clearInterval(id);
  34183. me.serviceProcessCompleted(result);
  34184. break;
  34185. case 'ERROR':
  34186. clearInterval(id);
  34187. me.serviceProcessFailed(result);
  34188. break;
  34189. case 'RUNNING':
  34190. me.events.triggerEvent('processRunning', result);
  34191. break;
  34192. }
  34193. },
  34194. failure: me.serviceProcessFailed
  34195. });
  34196. }, 1000);
  34197. }
  34198. _processUrl(appendContent) {
  34199. if (appendContent) {
  34200. return Util.urlPathAppend(this.url, appendContent);
  34201. }
  34202. return this.url;
  34203. }
  34204. }
  34205. SuperMap.WebPrintingService = WebPrintingService;
  34206. ;// CONCATENATED MODULE: ./src/common/iServer/index.js
  34207. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  34208. * This program are made available under the terms of the Apache License, Version 2.0
  34209. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34210. ;// CONCATENATED MODULE: ./src/common/online/OnlineResources.js
  34211. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  34212. * This program are made available under the terms of the Apache License, Version 2.0
  34213. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34214. /**
  34215. * @enum ServiceStatus
  34216. * @memberOf SuperMap
  34217. * @category iPortal/Online
  34218. * @description 服务发布状态。
  34219. */
  34220. var ServiceStatus = SuperMap.ServiceStatus = {
  34221. /** 不涉及,不可发布。 */
  34222. DOES_NOT_INVOLVE: "DOES_NOT_INVOLVE",
  34223. /** 发布失败。 */
  34224. PUBLISH_FAILED: "PUBLISH_FAILED",
  34225. /** 已发布。 */
  34226. PUBLISHED: "PUBLISHED",
  34227. /** 正在发布。 */
  34228. PUBLISHING: "PUBLISHING",
  34229. /** 未发布。 */
  34230. UNPUBLISHED: "UNPUBLISHED",
  34231. /** 取消服务失败。 */
  34232. UNPUBLISHED_FAILED: "UNPUBLISHED_FAILED"
  34233. };
  34234. /**
  34235. *
  34236. * @enum DataItemType
  34237. * @memberOf SuperMap
  34238. * @category iPortal/Online
  34239. * @description 数据项类型。
  34240. */
  34241. var OnlineResources_DataItemType = SuperMap.DataItemType = {
  34242. /** AUDIO */
  34243. AUDIO: "AUDIO",
  34244. /** COLOR */
  34245. COLOR: "COLOR",
  34246. /** COLORSCHEME */
  34247. COLORSCHEME: "COLORSCHEME",
  34248. /** CSV */
  34249. CSV: "CSV",
  34250. /** EXCEL */
  34251. EXCEL: "EXCEL",
  34252. /** FILLSYMBOL */
  34253. FILLSYMBOL: "FILLSYMBOL",
  34254. /** IMAGE */
  34255. IMAGE: "IMAGE",
  34256. /** LAYERTEMPLATE */
  34257. LAYERTEMPLATE: "LAYERTEMPLATE",
  34258. /** LAYOUTTEMPLATE */
  34259. LAYOUTTEMPLATE: "LAYOUTTEMPLATE",
  34260. /** LINESYMBOL */
  34261. LINESYMBOL: "LINESYMBOL",
  34262. /** MAPTEMPLATE */
  34263. MAPTEMPLATE: "MAPTEMPLATE",
  34264. /** MARKERSYMBOL */
  34265. MARKERSYMBOL: "MARKERSYMBOL",
  34266. /** MBTILES */
  34267. MBTILES: "MBTILES",
  34268. /** PHOTOS */
  34269. PHOTOS: "PHOTOS",
  34270. /** SHP */
  34271. SHP: "SHP",
  34272. /** SMTILES */
  34273. SMTILES: "SMTILES",
  34274. /** SVTILES */
  34275. SVTILES: "SVTILES",
  34276. /** THEMETEMPLATE */
  34277. THEMETEMPLATE: "THEMETEMPLATE",
  34278. /** TPK */
  34279. TPK: "TPK",
  34280. /** UDB */
  34281. UDB: "UDB",
  34282. /** UGCV5 */
  34283. UGCV5: "UGCV5",
  34284. /** UNKNOWN */
  34285. UNKNOWN: "UNKNOWN",
  34286. /** VIDEO */
  34287. VIDEO: "VIDEO",
  34288. /** WORKENVIRONMENT */
  34289. WORKENVIRONMENT: "WORKENVIRONMENT",
  34290. /** WORKSPACE */
  34291. WORKSPACE: "WORKSPACE"
  34292. };
  34293. /**
  34294. * @enum DataItemOrderBy
  34295. * @memberOf SuperMap
  34296. * @category iPortal/Online
  34297. * @description 数据排序字段。
  34298. */
  34299. var DataItemOrderBy = SuperMap.DataItemOrderBy = {
  34300. /** FILENAME */
  34301. FILENAME: "FILENAME",
  34302. /** ID */
  34303. ID: "ID",
  34304. /** LASTMODIFIEDTIME */
  34305. LASTMODIFIEDTIME: "LASTMODIFIEDTIME",
  34306. /** NICKNAME */
  34307. NICKNAME: "NICKNAME",
  34308. /** SERVICESTATUS */
  34309. SERVICESTATUS: "SERVICESTATUS",
  34310. /** SIZE */
  34311. SIZE: "SIZE",
  34312. /** STATUS */
  34313. STATUS: "STATUS",
  34314. /** TYPE */
  34315. TYPE: "TYPE",
  34316. /** UPDATETIME */
  34317. UPDATETIME: "UPDATETIME",
  34318. /** USERNAME */
  34319. USERNAME: "USERNAME"
  34320. };
  34321. /**
  34322. * @enum FilterField
  34323. * @memberOf SuperMap
  34324. * @category iPortal/Online
  34325. * @description 关键字查询时的过滤字段。
  34326. */
  34327. var FilterField = SuperMap.FilterField = {
  34328. /** LINKPAGE */
  34329. LINKPAGE: "LINKPAGE",
  34330. /** LINKPAGE */
  34331. MAPTITLE: "MAPTITLE",
  34332. /** LINKPAGE */
  34333. NICKNAME: "NICKNAME",
  34334. /** LINKPAGE */
  34335. RESTITLE: "RESTITLE",
  34336. /** LINKPAGE */
  34337. USERNAME: "USERNAME"
  34338. };
  34339. ;// CONCATENATED MODULE: ./src/common/online/OnlineServiceBase.js
  34340. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  34341. * This program are made available under the terms of the Apache License, Version 2.0
  34342. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34343. // import {SecurityManager} from '../security/SecurityManager';
  34344. /**
  34345. * @class SuperMap.OnlineServiceBase
  34346. * @classdesc Online 服务基类(使用 key 作为权限限制的类需要实现此类)。
  34347. * @category iPortal/Online
  34348. * @param {Object} options - 服务参数。
  34349. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  34350. * @param {Object} [options.headers] - 请求头。
  34351. */
  34352. class OnlineServiceBase {
  34353. constructor(options) {
  34354. options = options || {};
  34355. Util.extend(this, options);
  34356. this.serverType = ServerType.ONLINE;
  34357. this.CLASS_NAME = "SuperMap.OnlineServiceBase";
  34358. }
  34359. /**
  34360. * @function SuperMap.OnlineServiceBase.prototype.request
  34361. * @description 请求 online 服务
  34362. * @param {string} [method='GET'] - 请求方式, 'GET', 'PUT', 'POST', 'DELETE'。
  34363. * @param {string} url - 服务地址。
  34364. * @param {Object} param - URL 查询参数。
  34365. * @param {Object} [requestOptions] - http 请求参数, 比如请求头,超时时间等。
  34366. * @returns {Promise} 返回包含请求结果的 Promise 对象。
  34367. */
  34368. request(method, url, param, requestOptions = {}) {
  34369. url = this.createCredentialUrl(url);
  34370. requestOptions['crossOrigin'] = this.options.crossOrigin;
  34371. requestOptions['headers'] = this.options.headers;
  34372. return FetchRequest.commit(method, url, param, requestOptions).then(function(response) {
  34373. return response.json();
  34374. });
  34375. }
  34376. /**
  34377. * @function SuperMap.OnlineServiceBase.prototype.createCredentialUrl
  34378. * @description 追加授权信息。
  34379. * @param {string} url - 对接的 online 服务地址。
  34380. */
  34381. createCredentialUrl(url) {
  34382. var newUrl = url,
  34383. key = this.getCredential();
  34384. if (key) {
  34385. var paramStr = "key=" + key;
  34386. var endStr = newUrl.substring(newUrl.length - 1, newUrl.length);
  34387. if (newUrl.indexOf("?") > -1 && endStr === "?") {
  34388. newUrl += paramStr;
  34389. } else if (newUrl.indexOf("?") > -1 && endStr !== "?") {
  34390. newUrl += "&" + paramStr;
  34391. } else {
  34392. newUrl += "?" + paramStr;
  34393. }
  34394. }
  34395. return newUrl;
  34396. }
  34397. //其子类需要重写该方法,修改其中获取key的字段
  34398. //存储key可能是服务id字段,可能是url,或者是WebAPI类型
  34399. getCredential() {
  34400. //return SecurityManager.getKey(this.id);
  34401. //或
  34402. //return SecurityManager.getKey(this.serviceUrl);
  34403. }
  34404. }
  34405. SuperMap.OnlineServiceBase = OnlineServiceBase;
  34406. ;// CONCATENATED MODULE: ./src/common/online/OnlineData.js
  34407. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  34408. * This program are made available under the terms of the Apache License, Version 2.0
  34409. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34410. /**
  34411. * @class SuperMap.OnlineData
  34412. * @classdesc Online myData 服务。
  34413. * @category iPortal/Online
  34414. * @param {string} serviceRootUrl - 服务根地址。
  34415. * @param {Object} options - 服务相关参数。
  34416. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  34417. * @param {Object} [options.headers] - 请求头。
  34418. */
  34419. class OnlineData extends OnlineServiceBase {
  34420. //TODO 目前并没有对接服务支持的所有操作,日后需要补充完整
  34421. constructor(serviceRootUrl, options) {
  34422. super(serviceRootUrl);
  34423. options = options || {};
  34424. //MD5
  34425. this.MD5 = null;
  34426. //文件类型。
  34427. this.type = null;
  34428. //数据上传者名称。
  34429. this.userName = null;
  34430. //文件名称。
  34431. this.fileName = null;
  34432. //文件大小,单位为 B 。
  34433. this.size = null;
  34434. //服务发布状态。
  34435. this.serviceStatus = null;
  34436. //服务 id 。
  34437. this.serviceId = null;
  34438. //数据项 id 。
  34439. this.id = null;
  34440. //最后修改时间。
  34441. this.lastModfiedTime = null;
  34442. //文件状态。
  34443. this.status = null;
  34444. //数据文件存储 id 。
  34445. this.storageId = null;
  34446. //数据的发布信息。
  34447. this.publishInfo = null;
  34448. //数据的权限信息。
  34449. this.authorizeSetting = null;
  34450. //用户的昵称。
  34451. this.nickname = null;
  34452. //数据的标签。
  34453. this.tags = [];
  34454. //数据的描述信息。
  34455. this.description = null;
  34456. //数据发布的服务信息集合。
  34457. this.dataItemServices = null;
  34458. //数据坐标类型。
  34459. this.coordType = null;
  34460. //数据审核信息
  34461. this.dataCheckResult = null;
  34462. //数据元数据信息
  34463. this.dataMetaInfo = null;
  34464. //数据的缩略图路径。
  34465. this.thumbnail = null;
  34466. Util.extend(this, options);
  34467. if (this.id) {
  34468. this.serviceUrl = serviceRootUrl + "/" + this.id;
  34469. }
  34470. this.CLASS_NAME = "SuperMap.OnlineData";
  34471. }
  34472. /**
  34473. * @function SuperMap.OnlineData.prototype.load
  34474. * @description 通过 URL 请求获取该服务完整信息。
  34475. * @returns {Promise} 返回不包含请求结果的 Promise 对象,请求返回结果自动填充到该类属性中。
  34476. */
  34477. load() {
  34478. if (!this.serviceUrl) {
  34479. return;
  34480. }
  34481. var me = this;
  34482. return me.request("GET", this.serviceUrl).then(function (result) {
  34483. Util.extend(me, result);
  34484. });
  34485. }
  34486. /**
  34487. * @function SuperMap.OnlineData.prototype.getPublishedServices
  34488. * @description 获取数据发布的所有服务。
  34489. * @returns {Object} 数据发布的所有服务。
  34490. */
  34491. getPublishedServices() {
  34492. return this.dataItemServices;
  34493. }
  34494. /**
  34495. * @function SuperMap.OnlineData.prototype.getAuthorizeSetting
  34496. * @description 获取数据的权限信息。
  34497. * @returns {Object} 权限信息。
  34498. */
  34499. getAuthorizeSetting() {
  34500. return this.authorizeSetting;
  34501. }
  34502. }
  34503. SuperMap.OnlineData = OnlineData;
  34504. ;// CONCATENATED MODULE: ./src/common/online/Online.js
  34505. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  34506. * This program are made available under the terms of the Apache License, Version 2.0
  34507. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34508. /**
  34509. * @class SuperMap.Online
  34510. * @classdesc 对接 SuperMap Online 所有基础服务。
  34511. * @category iPortal/Online
  34512. * @example
  34513. * var online=new SuperMap.Online();
  34514. * var services = online.queryDatas(param);
  34515. * service.then(function(services){
  34516. * var service= services[0];
  34517. * service.updateDataInfo();
  34518. * })
  34519. */
  34520. class Online {
  34521. //TODO 目前并没有对接Online的所有操作,需要补充完整
  34522. //所有查询返回的是一个Promise,在外部使用的时候通过Promise的then方法获取异步结果
  34523. constructor() {
  34524. this.rootUrl = "https://www.supermapol.com";
  34525. this.webUrl = this.rootUrl + "/web";
  34526. var mContentUrl = this.webUrl + "/mycontent";
  34527. this.mDatasUrl = mContentUrl + "/datas";
  34528. this.CLASS_NAME = "SuperMap.Online";
  34529. }
  34530. /**
  34531. * @function SuperMap.Online.prototype.load
  34532. * @description 加载 online,验证 online 是否可用。
  34533. * @returns {Promise} 返回包含网络请求结果的 Promise 对象。
  34534. */
  34535. load() {
  34536. return FetchRequest.get(this.rootUrl).then(function (response) {
  34537. return response;
  34538. });
  34539. }
  34540. /**
  34541. * @function SuperMap.Online.prototype.login
  34542. * @description 登录Online
  34543. */
  34544. login() {
  34545. SecurityManager.loginOnline(this.rootUrl, true);
  34546. }
  34547. /**
  34548. * @function SuperMap.Online.prototype.queryDatas
  34549. * @description 查询 Online “我的内容” 下 “我的数据” 服务(需要登录状态获取),并返回可操作的服务对象。
  34550. * @param {SuperMap.OnlineQueryDatasParameter} parameter - myDatas 服务资源查询参数。
  34551. * @returns {Promise} 返回包含所有数据服务信息的 Promise 对象。
  34552. */
  34553. queryDatas(parameter) {
  34554. var me = this, url = me.mDatasUrl;
  34555. if (parameter) {
  34556. parameter = parameter.toJSON();
  34557. }
  34558. return FetchRequest.get(url, parameter).then(function (json) {
  34559. if (!json || !json.content || json.content.length < 1) {
  34560. return;
  34561. }
  34562. var services = [], contents = json.content, len = contents.length;
  34563. for (var i = 0; i < len; i++) {
  34564. var content = contents[i];
  34565. var service = new OnlineData(me.mDatasUrl, content);
  34566. services.push(service);
  34567. }
  34568. return services;
  34569. });
  34570. }
  34571. }
  34572. SuperMap.Online = Online;
  34573. ;// CONCATENATED MODULE: ./src/common/online/OnlineQueryDatasParameter.js
  34574. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  34575. * This program are made available under the terms of the Apache License, Version 2.0
  34576. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34577. /**
  34578. * @class SuperMap.OnlineQueryDatasParameter
  34579. * @classdesc myDatas 服务资源查询参数。
  34580. * @category iPortal/Online
  34581. * @param {Object} options - 查询参数。
  34582. */
  34583. class OnlineQueryDatasParameter {
  34584. constructor(options) {
  34585. options = options || {};
  34586. /**
  34587. * @member {Array.<string>} SuperMap.OnlineQueryDatasParameter.prototype.userNames
  34588. * @description 数据作者名。可以根据数据作者名查询,默认查询全部。
  34589. */
  34590. this.userNames = null;
  34591. /**
  34592. * @member {Array.<Object>} SuperMap.OnlineQueryDatasParameter.prototype.types
  34593. * @description 数据类型。
  34594. */
  34595. this.types = null;
  34596. /**
  34597. * @member {string} SuperMap.OnlineQueryDatasParameter.prototype.fileName
  34598. * @description 文件名称。
  34599. */
  34600. this.fileName = null;
  34601. /**
  34602. * @member {string} SuperMap.OnlineQueryDatasParameter.prototype.serviceStatuses
  34603. * @description 服务发布状态。
  34604. */
  34605. this.serviceStatuses = null;
  34606. /**
  34607. * @member {string} SuperMap.OnlineQueryDatasParameter.prototype.serviceId
  34608. * @description 服务 ID。
  34609. */
  34610. this.serviceId = null;
  34611. /**
  34612. * @member {Array.<integer>} SuperMap.OnlineQueryDatasParameter.prototype.ids
  34613. * @description 由数据项 ID 组成的整型数组。
  34614. */
  34615. this.ids = null;
  34616. /**
  34617. * @member {Array.<string>} SuperMap.OnlineQueryDatasParameter.prototype.keywords
  34618. * @description 关键字。
  34619. */
  34620. this.keywords = null;
  34621. /**
  34622. * @member {string} SuperMap.OnlineQueryDatasParameter.prototype.orderBy
  34623. * @description 排序字段。
  34624. */
  34625. this.orderBy = null;
  34626. /**
  34627. * @member {Array.<string>} SuperMap.OnlineQueryDatasParameter.prototype.tags
  34628. * @description 数据的标签。
  34629. */
  34630. this.tags = null;
  34631. /**
  34632. * @member {Array.<string>} SuperMap.OnlineQueryDatasParameter.prototype.filterFields
  34633. * @description 用于关键字查询时的过滤字段。
  34634. */
  34635. this.filterFields = null;
  34636. Util.extend(this, options)
  34637. this.CLASS_NAME = "SuperMap.OnlineQueryDatasParameter";
  34638. }
  34639. /**
  34640. * @function SuperMap.OnlineQueryDatasParameter.prototype.toJSON
  34641. * @description 返回对应的 JSON 对象。
  34642. * @returns {Object} 对应的 JSON 对象。
  34643. */
  34644. toJSON() {
  34645. var me = this;
  34646. var jsonObj = {
  34647. "types": me.types,
  34648. "fileName": me.fileName,
  34649. "serviceStatuses": me.serviceStatuses,
  34650. "serviceId": me.serviceId,
  34651. "ids": me.ids,
  34652. "keywords": me.keywords,
  34653. "orderBy": me.orderBy,
  34654. "tags": me.tags,
  34655. "filterFields": me.filterFields
  34656. };
  34657. for (var key in jsonObj) {
  34658. if (jsonObj[key] == null) {
  34659. delete jsonObj[key]
  34660. }
  34661. }
  34662. return jsonObj;
  34663. }
  34664. }
  34665. SuperMap.OnlineQueryDatasParameter = OnlineQueryDatasParameter;
  34666. ;// CONCATENATED MODULE: ./src/common/online/index.js
  34667. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  34668. * This program are made available under the terms of the Apache License, Version 2.0
  34669. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34670. ;// CONCATENATED MODULE: ./src/common/security/KeyServiceParameter.js
  34671. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  34672. * This program are made available under the terms of the Apache License, Version 2.0
  34673. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34674. /**
  34675. * @class SuperMap.KeyServiceParameter
  34676. * @classdesc key申请参数
  34677. * @category Security
  34678. * @param {Object} options - 参数。
  34679. * @param {string} options.name - 申请服务名称。
  34680. * @param {number} options.serviceIds - 服务 ID。
  34681. * @param {SuperMap.ClientType} [options.clientType=SuperMap.ClientType.SERVER] - 服务端类型。
  34682. * @param {number} options.limitation - 有效期
  34683. */
  34684. class KeyServiceParameter {
  34685. constructor(options) {
  34686. this.name = null;
  34687. this.serviceIds = null;
  34688. this.clientType = ClientType.SERVER;
  34689. this.limitation = null;
  34690. Util.extend(this, options);
  34691. this.CLASS_NAME = "SuperMap.KeyServiceParameter";
  34692. }
  34693. /**
  34694. * @function SuperMap.KeyServiceParameter.prototype.toJSON
  34695. * @description 转换成 JSON 对象
  34696. * @returns {Object} 参数的 JSON 对象
  34697. */
  34698. toJSON() {
  34699. return {
  34700. name: this.name,
  34701. serviceIds: this.serviceIds,
  34702. clientType: this.clientType,
  34703. limitation: this.limitation
  34704. }
  34705. }
  34706. }
  34707. SuperMap.KeyServiceParameter = KeyServiceParameter;
  34708. ;// CONCATENATED MODULE: ./src/common/security/ServerInfo.js
  34709. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  34710. * This program are made available under the terms of the Apache License, Version 2.0
  34711. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34712. /**
  34713. * @class SuperMap.ServerInfo
  34714. * @classdesc 服务器信息(安全相关),包含服务器类型,服务地址,token服务地址等
  34715. * @category Security
  34716. * @param {string} type - 服务器类型
  34717. * @param {Object} options - 服务器信息相关可选参数。
  34718. * @param {string} options.server - 服务器地址,如:http://supermapiserver:8090/iserver
  34719. * @param {string} [options.tokenServiceUrl] - 如:http://supermapiserver:8090/iserver/services/security/tokens.json
  34720. * @param {string} [options.keyServiceUrl] - 如:http://supermapiserver:8092/web/mycontent/keys/register.json
  34721. */
  34722. class ServerInfo {
  34723. constructor(type, options) {
  34724. /**
  34725. * @member {SuperMap.ServerType} SuperMap.ServerInfo.prototype.type
  34726. * @description 服务器类型
  34727. */
  34728. this.type = type;
  34729. /**
  34730. * @member {string} SuperMap.ServerInfo.prototype.server
  34731. * @description 服务器地址
  34732. */
  34733. this.server = null;
  34734. /**
  34735. * @member {string} [SuperMap.ServerInfo.prototype.tokenServiceUrl]
  34736. * @description 如:http://supermapiserver:8090/iserver/services/security/tokens.json
  34737. */
  34738. this.tokenServiceUrl = null;
  34739. /**
  34740. * @member {string} [SuperMap.ServerInfo.prototype.keyServiceUrl]
  34741. * @description 如:http://supermapiserver:8092/web/mycontent/keys/register.json
  34742. */
  34743. this.keyServiceUrl = null;
  34744. Util.extend(this, options);
  34745. this.CLASS_NAME = "SuperMap.ServerInfo";
  34746. this.type = this.type || ServerType.ISERVER;
  34747. if (!this.server) {
  34748. console.error('server url require is not undefined')
  34749. }
  34750. // var patten = /http:\/\/([^\/]+)/i;
  34751. //this.server = this.server.match(patten)[0];
  34752. var tokenServiceSuffix = "/services/security/tokens";
  34753. if (this.type === ServerType.ISERVER && this.server.indexOf("iserver") < 0) {
  34754. tokenServiceSuffix = "/iserver" + tokenServiceSuffix;
  34755. }
  34756. if (!this.tokenServiceUrl) {
  34757. this.tokenServiceUrl = Util.urlPathAppend(this.server, tokenServiceSuffix);
  34758. }
  34759. if (!this.keyServiceUrl) {
  34760. if (this.type === ServerType.IPORTAL) {
  34761. this.keyServiceUrl = Util.urlPathAppend(this.server, "/web/mycontent/keys/register");
  34762. } else if (this.type === ServerType.ONLINE) {
  34763. this.keyServiceUrl = Util.urlPathAppend(this.server, "/web/mycontent/keys");
  34764. }
  34765. }
  34766. }
  34767. }
  34768. SuperMap.ServerInfo = ServerInfo;
  34769. ;// CONCATENATED MODULE: ./src/common/security/TokenServiceParameter.js
  34770. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  34771. * This program are made available under the terms of the Apache License, Version 2.0
  34772. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34773. /**
  34774. * @class SuperMap.TokenServiceParameter
  34775. * @classdesc token 申请参数。
  34776. * @category Security
  34777. * @param {Object} options - token 申请参数。
  34778. * @param {string} options.username - 用户名。
  34779. * @param {string} options.password - 密码。
  34780. * @param {SuperMap.ClientType} [options.clientType='SuperMap.ClientType.NONE'] - token 申请的客户端标识类型。
  34781. * @param {string} [options.ip] - clientType=IP 时,必选。
  34782. * @param {string} [options.referer] -clientType=Referer 时,必选。如果按照指定 URL 的方式申请令牌,则设置相应的 URL。
  34783. * @param {number} [options.expiration=60] - 申请令牌的有效期,从发布令牌的时间开始计算,单位为分钟。
  34784. *
  34785. *
  34786. */
  34787. class TokenServiceParameter {
  34788. constructor(options) {
  34789. /**
  34790. * @member {string} SuperMap.TokenServiceParameter.prototype.userName
  34791. * @description 用户名。
  34792. */
  34793. this.userName = null;
  34794. /**
  34795. * @member {string} SuperMap.TokenServiceParameter.prototype.password
  34796. * @description 密码。
  34797. */
  34798. this.password = null;
  34799. /**
  34800. * @member {SuperMap.ClientType} SuperMap.TokenServiceParameter.prototype.clientType
  34801. * @description token 申请的客户端标识类型。
  34802. */
  34803. this.clientType = ClientType.NONE;
  34804. /**
  34805. * @member {string} [SuperMap.TokenServiceParameter.prototype.ip]
  34806. * @description clientType=IP 时,必选。
  34807. */
  34808. this.ip = null;
  34809. /**
  34810. * @member {string} [SuperMap.TokenServiceParameter.prototype.referer]
  34811. * @description clientType=Referer 时,必选。如果按照指定 URL 的方式申请令牌,则设置相应的 URL。
  34812. */
  34813. this.referer = null;
  34814. /**
  34815. * @member {number} SuperMap.TokenServiceParameter.prototype.expiration
  34816. * @description 申请令牌的有效期,从发布令牌的时间开始计算,单位为分钟。
  34817. */
  34818. this.expiration = 60;
  34819. Util.extend(this, options);
  34820. this.CLASS_NAME = "SuperMap.TokenServiceParameter";
  34821. }
  34822. /**
  34823. * @function SuperMap.TokenServiceParameter.prototype.toJSON
  34824. * @description 将所有信息转成 JSON 字符串
  34825. * @returns {string} 参数的 JSON 字符串
  34826. */
  34827. toJSON() {
  34828. return {
  34829. userName: this.userName,
  34830. password: this.password,
  34831. clientType: this.clientType,
  34832. ip: this.ip,
  34833. referer: this.referer,
  34834. expiration: this.expiration
  34835. }
  34836. }
  34837. }
  34838. SuperMap.TokenServiceParameter = TokenServiceParameter;
  34839. ;// CONCATENATED MODULE: ./src/common/security/index.js
  34840. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  34841. * This program are made available under the terms of the Apache License, Version 2.0
  34842. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34843. ;// CONCATENATED MODULE: external "function(){try{return elasticsearch}catch(e){return {}}}()"
  34844. const external_function_try_return_elasticsearch_catch_e_return_namespaceObject = function(){try{return elasticsearch}catch(e){return {}}}();
  34845. var external_function_try_return_elasticsearch_catch_e_return_default = /*#__PURE__*/__webpack_require__.n(external_function_try_return_elasticsearch_catch_e_return_namespaceObject);
  34846. ;// CONCATENATED MODULE: ./src/common/thirdparty/elasticsearch/ElasticSearch.js
  34847. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  34848. * This program are made available under the terms of the Apache License, Version 2.0
  34849. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34850. /**
  34851. * @class SuperMap.ElasticSearch
  34852. * @classdesc ElasticSearch服务类。
  34853. * @category ElasticSearch
  34854. * @param {string} url - ElasticSearch服务地址。
  34855. * @param {Object} options - 参数。
  34856. * @param {function} [options.change] - 服务器返回数据后执行的函数。废弃,不建议使用。使用search或msearch方法。
  34857. * @param {boolean} [options.openGeoFence=false] - 是否开启地理围栏验证,默认为不开启。
  34858. * @param {function} [options.outOfGeoFence] - 数据超出地理围栏后执行的函数。
  34859. * @param {Object} [options.geoFence] - 地理围栏。
  34860. */
  34861. class ElasticSearch {
  34862. constructor(url, options) {
  34863. options = options || {};
  34864. /**
  34865. * @member {string} SuperMap.ElasticSearch.prototype.url
  34866. * @description ElasticSearch服务地址
  34867. */
  34868. this.url = url;
  34869. /**
  34870. * @member {Object} SuperMap.ElasticSearch.prototype.client
  34871. * @description client ES客户端
  34872. */
  34873. this.client = new (external_function_try_return_elasticsearch_catch_e_return_default()).Client({
  34874. host: this.url
  34875. });
  34876. /**
  34877. * @deprecated
  34878. * @member {function} [SuperMap.ElasticSearch.prototype.change]
  34879. * @description 服务器返回数据后执行的函数。废弃,不建议使用。使用search或msearch方法。
  34880. */
  34881. this.change = null;
  34882. /**
  34883. * @member {boolean} [SuperMap.ElasticSearch.prototype.openGeoFence=false]
  34884. * @description 是否开启地理围栏验证,默认为不开启。
  34885. */
  34886. this.openGeoFence = false;
  34887. /**
  34888. * @member {function} [SuperMap.ElasticSearch.prototype.outOfGeoFence]
  34889. * @description 数据超出地理围栏后执行的函数
  34890. */
  34891. this.outOfGeoFence = null;
  34892. /**
  34893. * @member {Object} [SuperMap.ElasticSearch.prototype.geoFence]
  34894. * @description 地理围栏
  34895. * @example {
  34896. * radius: 1000,//单位是m
  34897. * center: [104.40, 30.43],
  34898. * unit: 'meter|degree'
  34899. * }
  34900. */
  34901. this.geoFence = null;
  34902. /*
  34903. * Constant: EVENT_TYPES
  34904. * {Array.<String>}
  34905. * 此类支持的事件类型。
  34906. *
  34907. */
  34908. this.EVENT_TYPES = ['change', 'error', 'outOfGeoFence'];
  34909. /**
  34910. * @member {SuperMap.Events} SuperMap.ElasticSearch.prototype.events
  34911. * @description 事件
  34912. */
  34913. this.events = new Events(this, null, this.EVENT_TYPES);
  34914. /**
  34915. * @member {Object} SuperMap.ElasticSearch.prototype.eventListeners
  34916. * @description 听器对象,在构造函数中设置此参数(可选),对 MapService 支持的两个事件 processCompleted 、processFailed 进行监听,
  34917. * 相当于调用 SuperMap.Events.on(eventListeners)。
  34918. */
  34919. this.eventListeners = null;
  34920. Util.extend(this, options);
  34921. if (this.eventListeners instanceof Object) {
  34922. this.events.on(this.eventListeners);
  34923. }
  34924. }
  34925. /**
  34926. * @function SuperMap.ElasticSearch.prototype.setGeoFence
  34927. * @description 设置地理围栏,openGeoFence参数为true的时候,设置的地理围栏才生效。
  34928. * @param {SuperMap.Geometry} geoFence - 地理围栏。
  34929. */
  34930. setGeoFence(geoFence) {
  34931. this.geoFence = geoFence;
  34932. }
  34933. /**
  34934. * @function SuperMap.ElasticSearch.prototype.bulk
  34935. * @description 批量操作API,允许执行多个索引/删除操作。
  34936. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-bulk}</br>
  34937. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html}</br>
  34938. * @param {Object} params - 参数。
  34939. * @param {function} callback - 回调函数。
  34940. */
  34941. bulk(params, callback) {
  34942. return this.client.bulk(params, callback);
  34943. }
  34944. /**
  34945. * @function SuperMap.ElasticSearch.prototype.clearScroll
  34946. * @description 通过指定scroll参数进行查询来清除已经创建的scroll请求。
  34947. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-clearscroll}</br>
  34948. *更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html}</br>
  34949. * @param {Object} params - 参数。
  34950. * @param {function} callback - 回调函数。
  34951. */
  34952. clearScroll(params, callback) {
  34953. return this.client.clearScroll(params, callback);
  34954. }
  34955. /**
  34956. * @function SuperMap.ElasticSearch.prototype.count
  34957. * @description 获取集群、索引、类型或查询的文档个数。
  34958. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-count}</br>
  34959. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-count.html}</br>
  34960. * @param {Object} params - 参数。
  34961. * @param {function} callback - 回调函数。
  34962. */
  34963. count(params, callback) {
  34964. return this.client.count(params, callback);
  34965. }
  34966. /**
  34967. * @function SuperMap.ElasticSearch.prototype.count
  34968. * @description 在特定索引中添加一个类型化的JSON文档,使其可搜索。如果具有相同index,type且id已经存在的文档将发生错误。</br>
  34969. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-create}
  34970. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html}
  34971. * @param {Object} params - 参数。
  34972. * @param {function} callback - 回调函数。
  34973. */
  34974. create(params, callback) {
  34975. return this.client.create(params, callback);
  34976. }
  34977. /**
  34978. * @function SuperMap.ElasticSearch.prototype.delete
  34979. * @description 根据其ID从特定索引中删除键入的JSON文档。
  34980. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-delete}</br>
  34981. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html}</br>
  34982. * @param {Object} params - 参数。
  34983. * @param {function} callback - 回调函数。
  34984. */
  34985. delete(params, callback) {
  34986. return this.client.delete(params, callback);
  34987. }
  34988. /**
  34989. * @function SuperMap.ElasticSearch.prototype.delete
  34990. * @description 根据其ID从特定索引中删除键入的JSON文档。
  34991. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletebyquery}</br>
  34992. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html}</br>
  34993. * @param {Object} params - 参数。
  34994. * @param {function} callback - 回调函数。
  34995. */
  34996. deleteByQuery(params, callback) {
  34997. return this.client.deleteByQuery(params, callback);
  34998. }
  34999. /**
  35000. * @function SuperMap.ElasticSearch.prototype.delete
  35001. * @description 根据其ID删除脚本。</br>
  35002. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletescript}</br>
  35003. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
  35004. * @param {Object} params - 参数。
  35005. * @param {function} callback - 回调函数。
  35006. */
  35007. deleteScript(params, callback) {
  35008. return this.client.deleteScript(params, callback);
  35009. }
  35010. /**
  35011. * @function SuperMap.ElasticSearch.prototype.deleteTemplate
  35012. * @description 根据其ID删除模板。</br>
  35013. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletetemplate}</br>
  35014. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  35015. * @param {Object} params - 参数。
  35016. * @param {function} callback - 回调函数。
  35017. */
  35018. deleteTemplate(params, callback) {
  35019. return this.client.deleteTemplate(params, callback);
  35020. }
  35021. /**
  35022. * @function SuperMap.ElasticSearch.prototype.exists
  35023. * @description 检查给定文档是否存在。</br>
  35024. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-exists}</br>
  35025. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  35026. * @param {Object} params - 参数。
  35027. * @param {function} callback - 回调函数。
  35028. */
  35029. exists(params, callback) {
  35030. return this.client.exists(params, callback);
  35031. }
  35032. /**
  35033. * @function SuperMap.ElasticSearch.prototype.existsSource
  35034. * @description 检查资源是否存在。</br>
  35035. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-existssource}</br>
  35036. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  35037. * @param {Object} params - 参数。
  35038. * @param {function} callback - 回调函数。
  35039. */
  35040. existsSource(params, callback) {
  35041. return this.client.existsSource(params, callback);
  35042. }
  35043. /**
  35044. * @function SuperMap.ElasticSearch.prototype.explain
  35045. * @description 提供与特定查询相关的特定文档分数的详细信息。它还会告诉您文档是否与指定的查询匹配。</br>
  35046. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-explain}</br>
  35047. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html}</br>
  35048. * @param {Object} params - 参数。
  35049. * @param {function} callback - 回调函数。
  35050. */
  35051. explain(params, callback) {
  35052. return this.client.explain(params, callback);
  35053. }
  35054. /**
  35055. * @function SuperMap.ElasticSearch.prototype.fieldCaps
  35056. * @description 允许检索多个索引之间的字段的功能。(实验性API,可能会在未来版本中删除)</br>
  35057. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-fieldcaps}</br>
  35058. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-field-caps.html}</br>
  35059. * @param {Object} params - 参数。
  35060. * @param {function} callback - 回调函数。
  35061. */
  35062. fieldCaps(params, callback) {
  35063. return this.client.fieldCaps(params, callback);
  35064. }
  35065. /**
  35066. * @function SuperMap.ElasticSearch.prototype.get
  35067. * @description 从索引获取一个基于其id的类型的JSON文档。</br>
  35068. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-get}</br>
  35069. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  35070. * @param {Object} params - 参数。
  35071. * @param {function} callback - 回调函数。
  35072. */
  35073. get(params, callback) {
  35074. return this.client.get(params, callback);
  35075. }
  35076. /**
  35077. * @function SuperMap.ElasticSearch.prototype.getScript
  35078. * @description 获取脚本。</br>
  35079. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-getscript}</br>
  35080. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
  35081. * @param {Object} params - 参数。
  35082. * @param {function} callback - 回调函数。
  35083. */
  35084. getScript(params, callback) {
  35085. return this.client.getScript(params, callback);
  35086. }
  35087. /**
  35088. * @function SuperMap.ElasticSearch.prototype.getSource
  35089. * @description 通过索引,类型和ID获取文档的源。</br>
  35090. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-getsource}</br>
  35091. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  35092. * @param {Object} params - 参数。
  35093. * @param {function} callback - 回调函数。
  35094. */
  35095. getSource(params, callback) {
  35096. return this.client.getSource(params, callback);
  35097. }
  35098. /**
  35099. * @function SuperMap.ElasticSearch.prototype.getTemplate
  35100. * @description 获取模板。</br>
  35101. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-gettemplate}</br>
  35102. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  35103. * @param {Object} params - 参数。
  35104. * @param {function} callback - 回调函数。
  35105. */
  35106. getTemplate(params, callback) {
  35107. return this.client.getTemplate(params, callback);
  35108. }
  35109. /**
  35110. * @function SuperMap.ElasticSearch.prototype.index
  35111. * @description 在索引中存储一个键入的JSON文档,使其可搜索。</br>
  35112. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-index}</br>
  35113. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html}</br>
  35114. * @param {Object} params - 参数。
  35115. * @param {function} callback - 回调函数。
  35116. */
  35117. index(params, callback) {
  35118. return this.client.index(params, callback);
  35119. }
  35120. /**
  35121. * @function SuperMap.ElasticSearch.prototype.info
  35122. * @description 从当前集群获取基本信息。</br>
  35123. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-info}</br>
  35124. * 更多信息参考 {@link https://www.elastic.co/guide/index.html}</br>
  35125. * @param {Object} params - 参数。
  35126. * @param {function} callback - 回调函数。
  35127. */
  35128. info(params, callback) {
  35129. return this.client.info(params, callback);
  35130. }
  35131. /**
  35132. * @function SuperMap.ElasticSearch.prototype.mget
  35133. * @description 根据索引,类型(可选)和ids来获取多个文档。mget所需的主体可以采用两种形式:文档位置数组或文档ID数组。</br>
  35134. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-mget}</br>
  35135. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html}</br>
  35136. * @param {Object} params - 参数。
  35137. * @param {function} callback - 回调函数。
  35138. */
  35139. mget(params, callback) {
  35140. return this.client.mget(params, callback);
  35141. }
  35142. /**
  35143. * @function SuperMap.ElasticSearch.prototype.msearch
  35144. * @description 在同一请求中执行多个搜索请求。</br>
  35145. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-msearch}</br>
  35146. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html}</br>
  35147. * @param {Object} params - 参数。
  35148. * @param {function} callback - 请求返回的回调函数。也可以使用then表达式获取返回结果。
  35149. * 回调参数:error,response。结果存储在response.responses中
  35150. */
  35151. msearch(params, callback) {
  35152. let me = this;
  35153. return me.client.msearch(params)
  35154. .then(function (resp) {
  35155. me._update(resp.responses, callback);
  35156. return resp;
  35157. }, function (err) {
  35158. callback(err);
  35159. me.events.triggerEvent('error', {error: err});
  35160. return err;
  35161. });
  35162. }
  35163. /**
  35164. * @function SuperMap.ElasticSearch.prototype.msearchTemplate
  35165. * @description 在同一请求中执行多个搜索模板请求。</br>
  35166. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-msearchtemplate}</br>
  35167. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  35168. * @param {Object} params - 参数。
  35169. * @param {function} callback - 回调函数。
  35170. */
  35171. msearchTemplate(params, callback) {
  35172. return this.client.msearchTemplate(params, callback);
  35173. }
  35174. /**
  35175. * @function SuperMap.ElasticSearch.prototype.mtermvectors
  35176. * @description 多termvectors API允许一次获得多个termvectors。</br>
  35177. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-mtermvectors}</br>
  35178. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-termvectors.html}</br>
  35179. * @param {Object} params - 参数。
  35180. * @param {function} callback - 回调函数。
  35181. */
  35182. mtermvectors(params, callback) {
  35183. return this.client.mtermvectors(params, callback);
  35184. }
  35185. /**
  35186. * @function SuperMap.ElasticSearch.prototype.ping
  35187. * @description 测试连接。</br>
  35188. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-ping}</br>
  35189. * 更多信息参考 {@link https://www.elastic.co/guide/index.html}</br>
  35190. * @param {Object} params - 参数。
  35191. * @param {function} callback - 回调函数。
  35192. */
  35193. ping(params, callback) {
  35194. return this.client.ping(params, callback);
  35195. }
  35196. /**
  35197. * @function SuperMap.ElasticSearch.prototype.putScript
  35198. * @description 添加脚本。</br>
  35199. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-putscript}</br>
  35200. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
  35201. * @param {Object} params - 参数。
  35202. * @param {function} callback - 回调函数。
  35203. */
  35204. putScript(params, callback) {
  35205. return this.client.putScript(params, callback);
  35206. }
  35207. /**
  35208. * @function SuperMap.ElasticSearch.prototype.putTemplate
  35209. * @description 添加模板。</br>
  35210. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-puttemplate}</br>
  35211. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  35212. * @param {Object} params - 参数。
  35213. * @param {function} callback - 回调函数。
  35214. */
  35215. putTemplate(params, callback) {
  35216. return this.client.putTemplate(params, callback);
  35217. }
  35218. /**
  35219. * @function SuperMap.ElasticSearch.prototype.reindex
  35220. * @description 重新索引。</br>
  35221. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-reindex}</br>
  35222. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html}</br>
  35223. * @param {Object} params - 参数。
  35224. * @param {function} callback - 回调函数。
  35225. */
  35226. reindex(params, callback) {
  35227. return this.client.reindex(params, callback);
  35228. }
  35229. /**
  35230. * @function SuperMap.ElasticSearch.prototype.reindexRessrottle
  35231. * @description 重新索引。</br>
  35232. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-reindexrethrottle}</br>
  35233. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html}</br>
  35234. * @param {Object} params - 参数。
  35235. * @param {function} callback - 回调函数。
  35236. */
  35237. reindexRessrottle(params, callback) {
  35238. return this.client.reindexRessrottle(params, callback);
  35239. }
  35240. /**
  35241. * @function SuperMap.ElasticSearch.prototype.renderSearchTemplate
  35242. * @description 搜索模板。</br>
  35243. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-rendersearchtemplate}</br>
  35244. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  35245. * @param {Object} params - 参数。
  35246. * @param {function} callback - 回调函数。
  35247. */
  35248. renderSearchTemplate(params, callback) {
  35249. return this.client.renderSearchTemplate(params, callback);
  35250. }
  35251. /**
  35252. * @function SuperMap.ElasticSearch.prototype.scroll
  35253. * @description 在search()调用中指定滚动参数之后,滚动搜索请求(检索下一组结果)。</br>
  35254. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-scroll}</br>
  35255. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html}</br>
  35256. * @param {Object} params - 参数。
  35257. * @param {function} callback - 回调函数。
  35258. */
  35259. scroll(params, callback) {
  35260. return this.client.scroll(params, callback);
  35261. }
  35262. /**
  35263. * @function SuperMap.ElasticSearch.prototype.search
  35264. * @description 在search()调用中指定滚动参数之后,滚动搜索请求(检索下一组结果)。
  35265. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-search}</br>
  35266. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html}</br>
  35267. * @param {Object} params - 参数。
  35268. * @param {function} callback - 请求返回的回调函数。也可以使用then表达式获取返回结果。
  35269. * 回调参数:error,response,结果存储在response.responses中
  35270. */
  35271. search(params, callback) {
  35272. let me = this;
  35273. return me.client.search(params)
  35274. .then(function (resp) {
  35275. me._update(resp.responses, callback);
  35276. return resp;
  35277. }, function (err) {
  35278. callback(err);
  35279. me.events.triggerEvent('error', {error: err});
  35280. return err;
  35281. });
  35282. }
  35283. /**
  35284. * @function SuperMap.ElasticSearch.prototype.searchShards
  35285. * @description 返回要执行搜索请求的索引和分片。
  35286. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-searchshards}</br>
  35287. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-shards.html}</br>
  35288. * @param {Object} params - 参数。
  35289. * @param {function} callback - 回调函数。
  35290. */
  35291. searchShards(params, callback) {
  35292. return this.client.searchShards(params, callback);
  35293. }
  35294. /**
  35295. * @function SuperMap.ElasticSearch.prototype.searchTemplate
  35296. * @description 搜索模板。
  35297. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-searchtemplate}</br>
  35298. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html}</br>
  35299. * @param {Object} params - 参数。
  35300. * @param {function} callback - 回调函数。
  35301. */
  35302. searchTemplate(params, callback) {
  35303. return this.client.searchTemplate(params, callback);
  35304. }
  35305. /**
  35306. * @function SuperMap.ElasticSearch.prototype.suggest
  35307. * @description 该建议功能通过使用特定的建议者,基于所提供的文本来建议类似的术语。
  35308. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-suggest}</br>
  35309. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html}</br>
  35310. * @param {Object} params - 参数。
  35311. * @param {function} callback - 回调函数。
  35312. */
  35313. suggest(params, callback) {
  35314. return this.client.suggest(params, callback);
  35315. }
  35316. /**
  35317. * @function SuperMap.ElasticSearch.prototype.termvectors
  35318. * @description 返回有关特定文档字段中的术语的信息和统计信息。
  35319. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-termvectors}</br>
  35320. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-termvectors.html}</br>
  35321. * @param {Object} params - 参数。
  35322. * @param {function} callback - 回调函数。
  35323. */
  35324. termvectors(params, callback) {
  35325. return this.client.termvectors(params, callback);
  35326. }
  35327. /**
  35328. * @function SuperMap.ElasticSearch.prototype.update
  35329. * @description 更新文档的部分。
  35330. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-update}</br>
  35331. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html}</br>
  35332. * @param {Object} params - 参数。
  35333. * @param {function} callback - 回调函数。
  35334. */
  35335. update(params, callback) {
  35336. return this.client.update(params, callback);
  35337. }
  35338. /**
  35339. * @function SuperMap.ElasticSearch.prototype.update
  35340. * @description 通过查询API来更新文档。
  35341. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-updatebyquery}</br>
  35342. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html}</br>
  35343. * @param {Object} params - 参数。
  35344. * @param {function} callback - 回调函数。
  35345. */
  35346. updateByQuery(params, callback) {
  35347. return this.client.updateByQuery(params, callback);
  35348. }
  35349. _update(data, callback) {
  35350. let me = this;
  35351. if (!data) {
  35352. return;
  35353. }
  35354. me.data = data;
  35355. if (me.openGeoFence && me.geoFence) {
  35356. me._validateDatas(data);
  35357. }
  35358. me.events.triggerEvent('change', {data: me.data});
  35359. //change方法已废弃,不建议使用。建议使用search方法的第二个参数传入请求成功的回调
  35360. if (me.change) {
  35361. me.change && me.change(data);
  35362. } else {
  35363. //加responses是为了保持跟原来es自身的数据结构一致
  35364. callback && callback(undefined, {responses: data});
  35365. }
  35366. }
  35367. _validateDatas(datas) {
  35368. if (!datas) {
  35369. return;
  35370. }
  35371. if (!(datas instanceof Array)) {
  35372. datas = [datas];
  35373. }
  35374. var i, len = datas.length;
  35375. for (i = 0; i < len; i++) {
  35376. this._validateData(datas[i]);
  35377. }
  35378. }
  35379. _validateData(data) {
  35380. let me = this;
  35381. data.hits.hits.map(function (source) {
  35382. let content = source._source;
  35383. let meterUnit = me._getMeterPerMapUnit(me.geoFence.unit);
  35384. let geoFenceCX = me.geoFence.center[0] * meterUnit;
  35385. let geoFenceCY = me.geoFence.center[1] * meterUnit;
  35386. let contentX = content.x * meterUnit;
  35387. let contentY = content.y * meterUnit;
  35388. let distance = me._distance(contentX, contentY, geoFenceCX, geoFenceCY);
  35389. let radius = me.geoFence.radius;
  35390. if (distance > radius) {
  35391. me.outOfGeoFence && me.outOfGeoFence(data);
  35392. me.events.triggerEvent('outOfGeoFence', {data: data});
  35393. }
  35394. return source;
  35395. });
  35396. }
  35397. _distance(x1, y1, x2, y2) {
  35398. return Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  35399. }
  35400. _getMeterPerMapUnit(mapUnit) {
  35401. let earchRadiusInMeters = 6378137;
  35402. let meterPerMapUnit;
  35403. if (mapUnit === 'meter') {
  35404. meterPerMapUnit = 1;
  35405. } else if (mapUnit === 'degree') {
  35406. // 每度表示多少米。
  35407. meterPerMapUnit = Math.PI * 2 * earchRadiusInMeters / 360;
  35408. }
  35409. return meterPerMapUnit;
  35410. }
  35411. }
  35412. SuperMap.ElasticSearch = ElasticSearch;
  35413. ;// CONCATENATED MODULE: ./src/common/thirdparty/elasticsearch/index.js
  35414. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  35415. * This program are made available under the terms of the Apache License, Version 2.0
  35416. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35417. ;// CONCATENATED MODULE: ./src/common/thirdparty/index.js
  35418. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  35419. * This program are made available under the terms of the Apache License, Version 2.0
  35420. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35421. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Util.js
  35422. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  35423. * This program are made available under the terms of the Apache License, Version 2.0
  35424. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35425. /**
  35426. * @private
  35427. * @class SuperMap.LevelRenderer.Tool.Util
  35428. * @category Visualization Theme
  35429. * LevelRenderer 基础工具类
  35430. *
  35431. */
  35432. class Util_Util {
  35433. /**
  35434. * @function SuperMap.LevelRenderer.Tool.Util.constructor
  35435. * @description 构造函数。
  35436. *
  35437. */
  35438. constructor() {
  35439. /**
  35440. * @member {Object} SuperMap.LevelRenderer.Tool.Util.prototype.BUILTIN_OBJECT
  35441. * @description 用于处理merge时无法遍历Date等对象的问题
  35442. */
  35443. this.BUILTIN_OBJECT = {
  35444. '[object Function]': 1,
  35445. '[object RegExp]': 1,
  35446. '[object Date]': 1,
  35447. '[object Error]': 1,
  35448. '[object CanvasGradient]': 1
  35449. };
  35450. /**
  35451. * @member {Object} SuperMap.LevelRenderer.Tool.Util.prototype._ctx
  35452. */
  35453. this._ctx = null;
  35454. /**
  35455. * Property: _canvas
  35456. * {Object}
  35457. */
  35458. this._canvas = null;
  35459. /**
  35460. * Property: _pixelCtx
  35461. * {Object}
  35462. */
  35463. this._pixelCtx = null;
  35464. /**
  35465. * Property: _width
  35466. * {Object}
  35467. */
  35468. this._width = null;
  35469. /**
  35470. * Property: _height
  35471. * {Object}
  35472. */
  35473. this._height = null;
  35474. /**
  35475. * Property: _offsetX
  35476. * {Object}
  35477. */
  35478. this._offsetX = 0;
  35479. /**
  35480. * Property: _offsetY
  35481. * {Object}
  35482. */
  35483. this._offsetY = 0;
  35484. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Util";
  35485. }
  35486. /**
  35487. * @function SuperMap.LevelRenderer.Tool.Util.prototype.clone
  35488. * @description 对一个object进行深度拷贝。
  35489. *
  35490. * @param {Object} source - 需要进行拷贝的对象。
  35491. * @return {Object} 拷贝后的新对象。
  35492. */
  35493. clone(source) {
  35494. var BUILTIN_OBJECT = this.BUILTIN_OBJECT;
  35495. if (typeof source == 'object' && source !== null) {
  35496. var result = source;
  35497. if (source instanceof Array) {
  35498. result = [];
  35499. for (var i = 0, len = source.length; i < len; i++) {
  35500. result[i] = this.clone(source[i]);
  35501. }
  35502. } else if (!BUILTIN_OBJECT[Object.prototype.toString.call(source)]) {
  35503. result = {};
  35504. for (var key in source) {
  35505. if (source.hasOwnProperty(key)) {
  35506. result[key] = this.clone(source[key]);
  35507. }
  35508. }
  35509. }
  35510. return result;
  35511. }
  35512. return source;
  35513. }
  35514. /**
  35515. * @function SuperMap.LevelRenderer.Tool.Util.prototype.mergeItem
  35516. * @description 合并源对象的单个属性到目标对象。
  35517. *
  35518. * @param {Object} target - 目标对象。
  35519. * @param {Object} source - 源对象。
  35520. * @param {string} key - 键。
  35521. * @param {boolean} overwrite - 是否覆盖。
  35522. * @return {Object} 目标对象
  35523. */
  35524. mergeItem(target, source, key, overwrite) {
  35525. var BUILTIN_OBJECT = this.BUILTIN_OBJECT;
  35526. if (source.hasOwnProperty(key)) {
  35527. if (typeof target[key] == 'object'
  35528. && !BUILTIN_OBJECT[Object.prototype.toString.call(target[key])]
  35529. ) {
  35530. // 如果需要递归覆盖,就递归调用merge
  35531. this.merge(
  35532. target[key],
  35533. source[key],
  35534. overwrite
  35535. );
  35536. } else if (overwrite || !(key in target)) {
  35537. // 否则只处理overwrite为true,或者在目标对象中没有此属性的情况
  35538. target[key] = source[key];
  35539. }
  35540. }
  35541. }
  35542. /**
  35543. * @function SuperMap.LevelRenderer.Tool.Util.prototype.merge
  35544. * @description 合并源对象的属性到目标对象。
  35545. *
  35546. * @param {Object} target - 目标对象。
  35547. * @param {Object} source - 源对象。
  35548. * @param {boolean} overwrite - 是否覆盖。
  35549. * @return {Object} 目标对象。
  35550. */
  35551. merge(target, source, overwrite) {
  35552. for (var i in source) {
  35553. this.mergeItem(target, source, i, overwrite);
  35554. }
  35555. return target;
  35556. }
  35557. /**
  35558. * @function SuperMap.LevelRenderer.Tool.Util.prototype.getContext
  35559. * @description 获取 Canvas 上下文。
  35560. * @return {Object} 上下文。
  35561. */
  35562. getContext() {
  35563. if (!this._ctx) {
  35564. this._ctx = document.createElement('canvas').getContext('2d');
  35565. }
  35566. return this._ctx;
  35567. }
  35568. /**
  35569. * @function SuperMap.LevelRenderer.Tool.Util.prototype.getPixelContext
  35570. * @description 获取像素拾取专用的上下文。
  35571. * @return {Object} 像素拾取专用的上下文。
  35572. */
  35573. getPixelContext() {
  35574. if (!this._pixelCtx) {
  35575. this._canvas = document.createElement('canvas');
  35576. this._width = this._canvas.width;
  35577. this._height = this._canvas.height;
  35578. this._pixelCtx = this._canvas.getContext('2d');
  35579. }
  35580. return this._pixelCtx;
  35581. }
  35582. /**
  35583. * @function SuperMap.LevelRenderer.Tool.Util.prototype.adjustCanvasSize
  35584. * @description 如果坐标处在_canvas外部,改变_canvas的大小,修改canvas的大小 需要重新设置translate
  35585. *
  35586. * @param {number} x - 横坐标。
  35587. * @param {number} y - 纵坐标。
  35588. *
  35589. */
  35590. adjustCanvasSize(x, y) {
  35591. var _canvas = this._canvas;
  35592. var _pixelCtx = this._pixelCtx;
  35593. var _width = this._width;
  35594. var _height = this._height;
  35595. var _offsetX = this._offsetX;
  35596. var _offsetY = this._offsetY;
  35597. // 每次加的长度
  35598. var _v = 100;
  35599. var _flag;
  35600. if (x + _offsetX > _width) {
  35601. _width = x + _offsetX + _v;
  35602. _canvas.width = _width;
  35603. _flag = true;
  35604. }
  35605. if (y + _offsetY > _height) {
  35606. _height = y + _offsetY + _v;
  35607. _canvas.height = _height;
  35608. _flag = true;
  35609. }
  35610. if (x < -_offsetX) {
  35611. _offsetX = Math.ceil(-x / _v) * _v;
  35612. _width += _offsetX;
  35613. _canvas.width = _width;
  35614. _flag = true;
  35615. }
  35616. if (y < -_offsetY) {
  35617. _offsetY = Math.ceil(-y / _v) * _v;
  35618. _height += _offsetY;
  35619. _canvas.height = _height;
  35620. _flag = true;
  35621. }
  35622. if (_flag) {
  35623. _pixelCtx.translate(_offsetX, _offsetY);
  35624. }
  35625. }
  35626. /**
  35627. * @function SuperMap.LevelRenderer.Tool.Util.prototype.getPixelOffset
  35628. * @description 获取像素canvas的偏移量。
  35629. * @return {Object} 偏移量。
  35630. */
  35631. getPixelOffset() {
  35632. return {
  35633. x: this._offsetX,
  35634. y: this._offsetY
  35635. };
  35636. }
  35637. /**
  35638. * @function SuperMap.LevelRenderer.Tool.Util.prototype.indexOf
  35639. * @description 查询数组中元素的index
  35640. * @return {Object} 偏移量。
  35641. */
  35642. indexOf(array, value) {
  35643. if (array.indexOf) {
  35644. return array.indexOf(value);
  35645. }
  35646. for (var i = 0, len = array.length; i < len; i++) {
  35647. if (array[i] === value) {
  35648. return i;
  35649. }
  35650. }
  35651. return -1;
  35652. }
  35653. /**
  35654. * @function SuperMap.LevelRenderer.Tool.Util.prototype.inherits
  35655. * @description 构造类继承关系
  35656. *
  35657. * @param {Function} clazz - 源类。
  35658. * @param {Function} baseClazz - 基类。
  35659. * @return {Object} 偏移量。
  35660. */
  35661. inherits(clazz, baseClazz) {
  35662. var clazzPrototype = clazz.prototype;
  35663. function F() {
  35664. }
  35665. F.prototype = baseClazz.prototype;
  35666. clazz.prototype = new F();
  35667. for (var prop in clazzPrototype) {
  35668. clazz.prototype[prop] = clazzPrototype[prop];
  35669. }
  35670. clazz.constructor = clazz;
  35671. }
  35672. }
  35673. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Color.js
  35674. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  35675. * This program are made available under the terms of the Apache License, Version 2.0
  35676. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35677. /**
  35678. * @class SuperMap.LevelRenderer.Tool.Color
  35679. * @category Visualization Theme
  35680. * @classdesc LevelRenderer 工具-颜色辅助类
  35681. * @private
  35682. */
  35683. class Color {
  35684. constructor() {
  35685. /**
  35686. * @member {SuperMap.LevelRenderer.Tool.Util} SuperMap.LevelRenderer.Tool.Color.prototype.util
  35687. * @description LevelRenderer 基础工具对象。
  35688. */
  35689. this.util = new Util_Util();
  35690. /**
  35691. * @member {Object} SuperMap.LevelRenderer.Tool.Color.prototype._ctx
  35692. * @description _ctx。
  35693. */
  35694. this._ctx = null;
  35695. /**
  35696. * @member {Array} SuperMap.LevelRenderer.Tool.Color.prototype.palette
  35697. * @description 默认色板。色板是一个包含图表默认颜色系列的数组,当色板中所有颜色被使用过后,又将从新回到色板中的第一个颜色。
  35698. */
  35699. this.palette = [
  35700. '#ff9277', ' #dddd00', ' #ffc877', ' #bbe3ff', ' #d5ffbb',
  35701. '#bbbbff', ' #ddb000', ' #b0dd00', ' #e2bbff', ' #ffbbe3',
  35702. '#ff7777', ' #ff9900', ' #83dd00', ' #77e3ff', ' #778fff',
  35703. '#c877ff', ' #ff77ab', ' #ff6600', ' #aa8800', ' #77c7ff',
  35704. '#ad77ff', ' #ff77ff', ' #dd0083', ' #777700', ' #00aa00',
  35705. '#0088aa', ' #8400dd', ' #aa0088', ' #dd0000', ' #772e00'
  35706. ];
  35707. /**
  35708. * @member {Array} SuperMap.LevelRenderer.Tool.Color.prototype._palette
  35709. * @description 复位色板,用于复位 palette
  35710. */
  35711. this._palette = this.palette;
  35712. /**
  35713. * @member {string} SuperMap.LevelRenderer.Tool.Color.prototype.highlightColor
  35714. * @description 高亮色
  35715. */
  35716. this.highlightColor = 'rgba(0,0,255,1)';
  35717. /**
  35718. * @member {string} SuperMap.LevelRenderer.Tool.Color.prototype._highlightColor
  35719. * @description 复位高亮色
  35720. */
  35721. this._highlightColor = this.highlightColor;
  35722. /**
  35723. * @member {string} SuperMap.LevelRenderer.Tool.Color.prototype.colorRegExp
  35724. * @description 颜色格式,正则表达式。
  35725. */
  35726. 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;
  35727. /**
  35728. * @member {string} SuperMap.LevelRenderer.Tool.Color.prototype._nameColors
  35729. * @description 颜色名。
  35730. */
  35731. this._nameColors = {
  35732. aliceblue: '#f0f8ff',
  35733. antiquewhite: '#faebd7',
  35734. aqua: '#0ff',
  35735. aquamarine: '#7fffd4',
  35736. azure: '#f0ffff',
  35737. beige: '#f5f5dc',
  35738. bisque: '#ffe4c4',
  35739. black: '#000',
  35740. blanchedalmond: '#ffebcd',
  35741. blue: '#00f',
  35742. blueviolet: '#8a2be2',
  35743. brown: '#a52a2a',
  35744. burlywood: '#deb887',
  35745. cadetblue: '#5f9ea0',
  35746. chartreuse: '#7fff00',
  35747. chocolate: '#d2691e',
  35748. coral: '#ff7f50',
  35749. cornflowerblue: '#6495ed',
  35750. cornsilk: '#fff8dc',
  35751. crimson: '#dc143c',
  35752. cyan: '#0ff',
  35753. darkblue: '#00008b',
  35754. darkcyan: '#008b8b',
  35755. darkgoldenrod: '#b8860b',
  35756. darkgray: '#a9a9a9',
  35757. darkgrey: '#a9a9a9',
  35758. darkgreen: '#006400',
  35759. darkkhaki: '#bdb76b',
  35760. darkmagenta: '#8b008b',
  35761. darkolivegreen: '#556b2f',
  35762. darkorange: '#ff8c00',
  35763. darkorchid: '#9932cc',
  35764. darkred: '#8b0000',
  35765. darksalmon: '#e9967a',
  35766. darkseagreen: '#8fbc8f',
  35767. darkslateblue: '#483d8b',
  35768. darkslategray: '#2f4f4f',
  35769. darkslategrey: '#2f4f4f',
  35770. darkturquoise: '#00ced1',
  35771. darkviolet: '#9400d3',
  35772. deeppink: '#ff1493',
  35773. deepskyblue: '#00bfff',
  35774. dimgray: '#696969',
  35775. dimgrey: '#696969',
  35776. dodgerblue: '#1e90ff',
  35777. firebrick: '#b22222',
  35778. floralwhite: '#fffaf0',
  35779. forestgreen: '#228b22',
  35780. fuchsia: '#f0f',
  35781. gainsboro: '#dcdcdc',
  35782. ghostwhite: '#f8f8ff',
  35783. gold: '#ffd700',
  35784. goldenrod: '#daa520',
  35785. gray: '#808080',
  35786. grey: '#808080',
  35787. green: '#008000',
  35788. greenyellow: '#adff2f',
  35789. honeydew: '#f0fff0',
  35790. hotpink: '#ff69b4',
  35791. indianred: '#cd5c5c',
  35792. indigo: '#4b0082',
  35793. ivory: '#fffff0',
  35794. khaki: '#f0e68c',
  35795. lavender: '#e6e6fa',
  35796. lavenderblush: '#fff0f5',
  35797. lawngreen: '#7cfc00',
  35798. lemonchiffon: '#fffacd',
  35799. lightblue: '#add8e6',
  35800. lightcoral: '#f08080',
  35801. lightcyan: '#e0ffff',
  35802. lightgoldenrodyellow: '#fafad2',
  35803. lightgray: '#d3d3d3',
  35804. lightgrey: '#d3d3d3',
  35805. lightgreen: '#90ee90',
  35806. lightpink: '#ffb6c1',
  35807. lightsalmon: '#ffa07a',
  35808. lightseagreen: '#20b2aa',
  35809. lightskyblue: '#87cefa',
  35810. lightslategray: '#789',
  35811. lightslategrey: '#789',
  35812. lightsteelblue: '#b0c4de',
  35813. lightyellow: '#ffffe0',
  35814. lime: '#0f0',
  35815. limegreen: '#32cd32',
  35816. linen: '#faf0e6',
  35817. magenta: '#f0f',
  35818. maroon: '#800000',
  35819. mediumaquamarine: '#66cdaa',
  35820. mediumblue: '#0000cd',
  35821. mediumorchid: '#ba55d3',
  35822. mediumpurple: '#9370d8',
  35823. mediumseagreen: '#3cb371',
  35824. mediumslateblue: '#7b68ee',
  35825. mediumspringgreen: '#00fa9a',
  35826. mediumturquoise: '#48d1cc',
  35827. mediumvioletred: '#c71585',
  35828. midnightblue: '#191970',
  35829. mintcream: '#f5fffa',
  35830. mistyrose: '#ffe4e1',
  35831. moccasin: '#ffe4b5',
  35832. navajowhite: '#ffdead',
  35833. navy: '#000080',
  35834. oldlace: '#fdf5e6',
  35835. olive: '#808000',
  35836. olivedrab: '#6b8e23',
  35837. orange: '#ffa500',
  35838. orangered: '#ff4500',
  35839. orchid: '#da70d6',
  35840. palegoldenrod: '#eee8aa',
  35841. palegreen: '#98fb98',
  35842. paleturquoise: '#afeeee',
  35843. palevioletred: '#d87093',
  35844. papayawhip: '#ffefd5',
  35845. peachpuff: '#ffdab9',
  35846. peru: '#cd853f',
  35847. pink: '#ffc0cb',
  35848. plum: '#dda0dd',
  35849. powderblue: '#b0e0e6',
  35850. purple: '#800080',
  35851. red: '#f00',
  35852. rosybrown: '#bc8f8f',
  35853. royalblue: '#4169e1',
  35854. saddlebrown: '#8b4513',
  35855. salmon: '#fa8072',
  35856. sandybrown: '#f4a460',
  35857. seagreen: '#2e8b57',
  35858. seashell: '#fff5ee',
  35859. sienna: '#a0522d',
  35860. silver: '#c0c0c0',
  35861. skyblue: '#87ceeb',
  35862. slateblue: '#6a5acd',
  35863. slategray: '#708090',
  35864. slategrey: '#708090',
  35865. snow: '#fffafa',
  35866. springgreen: '#00ff7f',
  35867. steelblue: '#4682b4',
  35868. tan: '#d2b48c',
  35869. teal: '#008080',
  35870. thistle: '#d8bfd8',
  35871. tomato: '#ff6347',
  35872. turquoise: '#40e0d0',
  35873. violet: '#ee82ee',
  35874. wheat: '#f5deb3',
  35875. white: '#fff',
  35876. whitesmoke: '#f5f5f5',
  35877. yellow: '#ff0',
  35878. yellowgreen: '#9acd32'
  35879. };
  35880. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Color";
  35881. }
  35882. /**
  35883. * @function SuperMap.LevelRenderer.Tool.Color.prototype.customPalette
  35884. * @description 自定义调色板。
  35885. * @param {Array} userPalete - 颜色板。
  35886. */
  35887. customPalette(userPalete) {
  35888. this.palette = userPalete;
  35889. }
  35890. /**
  35891. * @function SuperMap.LevelRenderer.Tool.Color.prototype.resetPalette
  35892. * @description 复位默认色板。
  35893. */
  35894. resetPalette() {
  35895. this.palette = this._palette;
  35896. }
  35897. /**
  35898. * @function SuperMap.LevelRenderer.Tool.Color.prototype.getColor
  35899. * @description 获取色板颜色。
  35900. * @param {number} idx - 色板位置。
  35901. * @param {Array} userPalete - 色板。
  35902. * @returns {string} 颜色值。
  35903. */
  35904. getColor(idx, userPalete) {
  35905. idx = idx | 0;
  35906. userPalete = userPalete || this.palette;
  35907. return userPalete[idx % userPalete.length];
  35908. }
  35909. /**
  35910. * @function SuperMap.LevelRenderer.Tool.Color.prototype.customHighlight
  35911. * @description 自定义默认高亮颜色。
  35912. * @param {string} userHighlightColor - 自定义高亮色。
  35913. */
  35914. customHighlight(userHighlightColor) {
  35915. this.highlightColor = userHighlightColor;
  35916. }
  35917. /**
  35918. * @function SuperMap.LevelRenderer.Tool.Color.prototype.resetHighlight
  35919. * @description 重置默认高亮颜色。将当前的高亮色作为默认高亮颜色
  35920. */
  35921. resetHighlight() {
  35922. this.highlightColor = this._highlightColor;
  35923. }
  35924. /**
  35925. * @function SuperMap.LevelRenderer.Tool.Color.prototype.getHighlightColor
  35926. * @description 获取默认高亮颜色
  35927. * @returns {string} 颜色值。
  35928. */
  35929. getHighlightColor() {
  35930. return this.highlightColor;
  35931. }
  35932. /**
  35933. * @function SuperMap.LevelRenderer.Tool.Color.prototype.getRadialGradient
  35934. * @description 径向渐变。
  35935. * @param {number} x0 - 渐变起点横坐标。
  35936. * @param {number} y0 - 渐变起点纵坐标。
  35937. * @param {number} r0 - 半径
  35938. * @param {number} x1 - 渐变终点横坐标。
  35939. * @param {number} y1 - 渐变终点纵坐标。
  35940. * @param {number} r1 - 半径
  35941. * @param {Array} colorList - 颜色列表。
  35942. * @returns {CanvasGradient} Cavans 渐变颜色。
  35943. */
  35944. getRadialGradient(x0, y0, r0, x1, y1, r1, colorList) {
  35945. var util = this.util;
  35946. if (!this._ctx) {
  35947. this._ctx = util.getContext();
  35948. }
  35949. var gradient = this._ctx.createRadialGradient(x0, y0, r0, x1, y1, r1);
  35950. for (var i = 0, l = colorList.length; i < l; i++) {
  35951. gradient.addColorStop(colorList[i][0], colorList[i][1]);
  35952. }
  35953. gradient.__nonRecursion = true;
  35954. return gradient;
  35955. }
  35956. /**
  35957. * @function SuperMap.LevelRenderer.Tool.Color.prototype.getLinearGradient
  35958. * @description 线性渐变。
  35959. * @param {number} x0 - 渐变起点横坐标。
  35960. * @param {number} y0 - 渐变起点纵坐标。
  35961. * @param {number} x1 - 渐变终点横坐标。
  35962. * @param {number} y1 - 渐变终点纵坐标。
  35963. * @param {Array} colorList - 颜色列表。
  35964. * @returns {CanvasGradient} Cavans 渐变颜色。
  35965. */
  35966. getLinearGradient(x0, y0, x1, y1, colorList) {
  35967. var util = this.util;
  35968. if (!this._ctx) {
  35969. this._ctx = util.getContext();
  35970. }
  35971. var gradient = this._ctx.createLinearGradient(x0, y0, x1, y1);
  35972. for (var i = 0, l = colorList.length; i < l; i++) {
  35973. gradient.addColorStop(colorList[i][0], colorList[i][1]);
  35974. }
  35975. gradient.__nonRecursion = true;
  35976. return gradient;
  35977. }
  35978. /**
  35979. * @function SuperMap.LevelRenderer.Tool.Color.prototype.getStepColors
  35980. * @description 获取两种颜色之间渐变颜色数组。
  35981. * @param {Object} start - 起始颜色对象。
  35982. * @param {Object} end - 结束颜色对象。
  35983. * @param {number} step - 渐变级数。
  35984. * @returns {Array} 颜色数组。
  35985. */
  35986. getStepColors(start, end, step) {
  35987. start = this.toRGBA(start);
  35988. end = this.toRGBA(end);
  35989. start = this.getData(start);
  35990. end = this.getData(end);
  35991. var colors = [];
  35992. var stepR = (end[0] - start[0]) / step;
  35993. var stepG = (end[1] - start[1]) / step;
  35994. var stepB = (end[2] - start[2]) / step;
  35995. var stepA = (end[3] - start[3]) / step;
  35996. // 生成颜色集合
  35997. // fix by linfeng 颜色堆积
  35998. for (var i = 0, r = start[0], g = start[1], b = start[2], a = start[3]; i < step; i++) {
  35999. colors[i] = this.toColor([
  36000. this.adjust(Math.floor(r), [0, 255]),
  36001. this.adjust(Math.floor(g), [0, 255]),
  36002. this.adjust(Math.floor(b), [0, 255]),
  36003. a.toFixed(4) - 0
  36004. ], 'rgba');
  36005. r += stepR;
  36006. g += stepG;
  36007. b += stepB;
  36008. a += stepA;
  36009. }
  36010. r = end[0];
  36011. g = end[1];
  36012. b = end[2];
  36013. a = end[3];
  36014. colors[i] = this.toColor([r, g, b, a], 'rgba');
  36015. return colors;
  36016. }
  36017. /**
  36018. * @function SuperMap.LevelRenderer.Tool.Color.prototype.getGradientColors
  36019. * @description 获取指定级数的渐变颜色数组。
  36020. * @param {Array.<string>} colors - 颜色数组。
  36021. * @param {number} [step=20] - 渐变级数。
  36022. * @returns {Array.<string>} 颜色数组。
  36023. */
  36024. getGradientColors(colors, step) {
  36025. var ret = [];
  36026. var len = colors.length;
  36027. if (step === undefined) {
  36028. step = 20;
  36029. }
  36030. if (len === 1) {
  36031. ret = this.getStepColors(colors[0], colors[0], step);
  36032. } else if (len > 1) {
  36033. for (var i = 0, n = len - 1; i < n; i++) {
  36034. var steps = this.getStepColors(colors[i], colors[i + 1], step);
  36035. if (i < n - 1) {
  36036. steps.pop();
  36037. }
  36038. ret = ret.concat(steps);
  36039. }
  36040. }
  36041. return ret;
  36042. }
  36043. /**
  36044. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toColor
  36045. * @description 颜色值数组转为指定格式颜色。
  36046. * @param {Array} data - 颜色值数组。
  36047. * @param {string} format - 格式,默认'rgb'
  36048. * @returns {string} 颜色。
  36049. */
  36050. toColor(data, format) {
  36051. format = format || 'rgb';
  36052. if (data && (data.length === 3 || data.length === 4)) {
  36053. data = this.map(data,
  36054. function (c) {
  36055. return c > 1 ? Math.ceil(c) : c;
  36056. }
  36057. );
  36058. if (format.indexOf('hex') > -1) {
  36059. return '#' + ((1 << 24) + (data[0] << 16) + (data[1] << 8) + (+data[2])).toString(16).slice(1);
  36060. } else if (format.indexOf('hs') > -1) {
  36061. var sx = this.map(data.slice(1, 3),
  36062. function (c) {
  36063. return c + '%';
  36064. }
  36065. );
  36066. data[1] = sx[0];
  36067. data[2] = sx[1];
  36068. }
  36069. if (format.indexOf('a') > -1) {
  36070. if (data.length === 3) {
  36071. data.push(1);
  36072. }
  36073. data[3] = this.adjust(data[3], [0, 1]);
  36074. return format + '(' + data.slice(0, 4).join(',') + ')';
  36075. }
  36076. return format + '(' + data.slice(0, 3).join(',') + ')';
  36077. }
  36078. }
  36079. /**
  36080. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toArray
  36081. * @description 颜色字符串转换为rgba数组。
  36082. * @param {string} color - 颜色。
  36083. * @returns {Array.<number>} 颜色值数组。
  36084. */
  36085. toArray(color) {
  36086. color = this.trim(color);
  36087. if (color.indexOf('rgba') < 0) {
  36088. color = this.toRGBA(color);
  36089. }
  36090. var data = [];
  36091. var i = 0;
  36092. color.replace(/[\d.]+/g, function (n) {
  36093. if (i < 3) {
  36094. n = n | 0;
  36095. } else {
  36096. // Alpha
  36097. n = +n;
  36098. }
  36099. data[i++] = n;
  36100. });
  36101. return data;
  36102. }
  36103. /**
  36104. * @function SuperMap.LevelRenderer.Tool.Color.prototype.convert
  36105. * @description 颜色格式转化。
  36106. * @param {Array} data - 颜色值数组。
  36107. * @param {string} format - 格式,默认'rgb'
  36108. * @returns {string} 颜色。
  36109. */
  36110. convert(color, format) {
  36111. if (!this.isCalculableColor(color)) {
  36112. return color;
  36113. }
  36114. var data = this.getData(color);
  36115. var alpha = data[3];
  36116. if (typeof alpha === 'undefined') {
  36117. alpha = 1;
  36118. }
  36119. if (color.indexOf('hsb') > -1) {
  36120. data = this._HSV_2_RGB(data);
  36121. } else if (color.indexOf('hsl') > -1) {
  36122. data = this._HSL_2_RGB(data);
  36123. }
  36124. if (format.indexOf('hsb') > -1 || format.indexOf('hsv') > -1) {
  36125. data = this._RGB_2_HSB(data);
  36126. } else if (format.indexOf('hsl') > -1) {
  36127. data = this._RGB_2_HSL(data);
  36128. }
  36129. data[3] = alpha;
  36130. return this.toColor(data, format);
  36131. }
  36132. /**
  36133. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toRGBA
  36134. * @description 转换为rgba格式的颜色。
  36135. * @param {string} color - 颜色。
  36136. * @returns {string} 颜色。
  36137. */
  36138. toRGBA(color) {
  36139. return this.convert(color, 'rgba');
  36140. }
  36141. /**
  36142. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toRGB
  36143. * @description 转换为rgb数字格式的颜色。
  36144. * @param {string} color - 颜色。
  36145. * @returns {string} 颜色。
  36146. */
  36147. toRGB(color) {
  36148. return this.convert(color, 'rgb');
  36149. }
  36150. /**
  36151. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toHex
  36152. * @description 转换为16进制颜色。
  36153. * @param {string} color - 颜色。
  36154. * @returns {string} 16进制颜色,#rrggbb格式
  36155. */
  36156. toHex(color) {
  36157. return this.convert(color, 'hex');
  36158. }
  36159. /**
  36160. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toHSVA
  36161. * @description 转换为HSV颜色。
  36162. * @param {string} color - 颜色。
  36163. * @returns {string} HSVA颜色,hsva(h,s,v,a)
  36164. */
  36165. toHSVA(color) {
  36166. return this.convert(color, 'hsva');
  36167. }
  36168. /**
  36169. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toHSV
  36170. * @description 转换为HSV颜色。
  36171. * @param {string} color - 颜色。
  36172. * @returns {string} HSV颜色,hsv(h,s,v)
  36173. */
  36174. toHSV(color) {
  36175. return this.convert(color, 'hsv');
  36176. }
  36177. /**
  36178. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toHSBA
  36179. * @description 转换为HSBA颜色。
  36180. * @param {string} color - 颜色。
  36181. * @returns {string} HSBA颜色,hsba(h,s,b,a)
  36182. */
  36183. toHSBA(color) {
  36184. return this.convert(color, 'hsba');
  36185. }
  36186. /**
  36187. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toHSB
  36188. * @description 转换为HSB颜色。
  36189. * @param {string} color - 颜色。
  36190. * @returns {string} HSB颜色,hsb(h,s,b)
  36191. */
  36192. toHSB(color) {
  36193. return this.convert(color, 'hsb');
  36194. }
  36195. /**
  36196. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toHSLA
  36197. * @description 转换为HSLA颜色。
  36198. * @param {string} color - 颜色。
  36199. * @returns {string} HSLA颜色,hsla(h,s,l,a)
  36200. */
  36201. toHSLA(color) {
  36202. return this.convert(color, 'hsla');
  36203. }
  36204. /**
  36205. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toHSL
  36206. * @description 转换为HSL颜色。
  36207. * @param {string} color - 颜色。
  36208. * @returns {string} HSL颜色,hsl(h,s,l)
  36209. */
  36210. toHSL(color) {
  36211. return this.convert(color, 'hsl');
  36212. }
  36213. /**
  36214. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toName
  36215. * @description 转换颜色名。
  36216. * @param {string} color - 颜色。
  36217. * @returns {string} 颜色名
  36218. */
  36219. toName(color) {
  36220. for (var key in this._nameColors) {
  36221. if (this.toHex(this._nameColors[key]) === this.toHex(color)) {
  36222. return key;
  36223. }
  36224. }
  36225. return null;
  36226. }
  36227. /**
  36228. * @function SuperMap.LevelRenderer.Tool.Color.prototype.trim
  36229. * @description 移除颜色中多余空格。
  36230. * @param {string} color - 颜色。
  36231. * @returns {string} 无空格颜色
  36232. */
  36233. trim(color) {
  36234. return String(color).replace(/\s+/g, '');
  36235. }
  36236. /**
  36237. * @function SuperMap.LevelRenderer.Tool.Color.prototype.normalize
  36238. * @description 颜色规范化。
  36239. * @param {string} color - 颜色。
  36240. * @returns {string} 规范化后的颜色
  36241. */
  36242. normalize(color) {
  36243. // 颜色名
  36244. if (this._nameColors[color]) {
  36245. color = this._nameColors[color];
  36246. }
  36247. // 去掉空格
  36248. color = this.trim(color);
  36249. // hsv与hsb等价
  36250. color = color.replace(/hsv/i, 'hsb');
  36251. // rgb转为rrggbb
  36252. if (/^#[\da-f]{3}$/i.test(color)) {
  36253. color = parseInt(color.slice(1), 16);
  36254. var r = (color & 0xf00) << 8;
  36255. var g = (color & 0xf0) << 4;
  36256. var b = color & 0xf;
  36257. color = '#' + ((1 << 24) + (r << 4) + r + (g << 4) + g + (b << 4) + b).toString(16).slice(1);
  36258. }
  36259. // 或者使用以下正则替换,不过 chrome 下性能相对差点
  36260. // color = color.replace(/^#([\da-f])([\da-f])([\da-f])$/i, '#$1$1$2$2$3$3');
  36261. return color;
  36262. }
  36263. /**
  36264. * @function SuperMap.LevelRenderer.Tool.Color.prototype.lift
  36265. * @description 颜色加深或减淡,当level>0加深,当level<0减淡。
  36266. * @param {string} color - 颜色。
  36267. * @param {number} level - 升降程度,取值区间[-1,1]。
  36268. * @returns {string} 加深或减淡后颜色值
  36269. */
  36270. lift(color, level) {
  36271. if (!this.isCalculableColor(color)) {
  36272. return color;
  36273. }
  36274. var direct = level > 0 ? 1 : -1;
  36275. if (typeof level === 'undefined') {
  36276. level = 0;
  36277. }
  36278. level = Math.abs(level) > 1 ? 1 : Math.abs(level);
  36279. color = this.toRGB(color);
  36280. var data = this.getData(color);
  36281. for (var i = 0; i < 3; i++) {
  36282. if (direct === 1) {
  36283. data[i] = data[i] * (1 - level) | 0;
  36284. } else {
  36285. data[i] = ((255 - data[i]) * level + data[i]) | 0;
  36286. }
  36287. }
  36288. return 'rgb(' + data.join(',') + ')';
  36289. }
  36290. /**
  36291. * @function SuperMap.LevelRenderer.Tool.Color.prototype.reverse
  36292. * @description 颜色翻转。[255-r,255-g,255-b,1-a]
  36293. * @param {string} color - 颜色。
  36294. * @returns {string} 翻转颜色
  36295. */
  36296. reverse(color) {
  36297. if (!this.isCalculableColor(color)) {
  36298. return color;
  36299. }
  36300. var data = this.getData(this.toRGBA(color));
  36301. data = this.map(data,
  36302. function (c) {
  36303. return 255 - c;
  36304. }
  36305. );
  36306. return this.toColor(data, 'rgb');
  36307. }
  36308. /**
  36309. * @function SuperMap.LevelRenderer.Tool.Color.prototype.mix
  36310. * @description 简单两种颜色混合
  36311. * @param {string} color1 - 第一种颜色。
  36312. * @param {string} color2 - 第二种颜色。
  36313. * @param {number} weight - 混合权重[0-1]。
  36314. * @returns {string} 结果色。rgb(r,g,b)或rgba(r,g,b,a)
  36315. */
  36316. mix(color1, color2, weight) {
  36317. if (!this.isCalculableColor(color1) || !this.isCalculableColor(color2)) {
  36318. return color1;
  36319. }
  36320. if (typeof weight === 'undefined') {
  36321. weight = 0.5;
  36322. }
  36323. weight = 1 - this.adjust(weight, [0, 1]);
  36324. var w = weight * 2 - 1;
  36325. var data1 = this.getData(this.toRGBA(color1));
  36326. var data2 = this.getData(this.toRGBA(color2));
  36327. var d = data1[3] - data2[3];
  36328. var weight1 = (((w * d === -1) ? w : (w + d) / (1 + w * d)) + 1) / 2;
  36329. var weight2 = 1 - weight1;
  36330. var data = [];
  36331. for (var i = 0; i < 3; i++) {
  36332. data[i] = data1[i] * weight1 + data2[i] * weight2;
  36333. }
  36334. var alpha = data1[3] * weight + data2[3] * (1 - weight);
  36335. alpha = Math.max(0, Math.min(1, alpha));
  36336. if (data1[3] === 1 && data2[3] === 1) {// 不考虑透明度
  36337. return this.toColor(data, 'rgb');
  36338. }
  36339. data[3] = alpha;
  36340. return this.toColor(data, 'rgba');
  36341. }
  36342. /**
  36343. * @function SuperMap.LevelRenderer.Tool.Color.prototype.random
  36344. * @description 随机颜色
  36345. * @returns {string} 颜色值,#rrggbb格式
  36346. */
  36347. random() {
  36348. return '#' + Math.random().toString(16).slice(2, 8);
  36349. }
  36350. /**
  36351. * @function SuperMap.LevelRenderer.Tool.Color.prototype.getData
  36352. * @description 获取颜色值数组,返回值范围。
  36353. * RGB 范围[0-255]
  36354. * HSL/HSV/HSB 范围[0-1]
  36355. * A透明度范围[0-1]
  36356. * 支持格式:
  36357. * #rgb
  36358. * #rrggbb
  36359. * rgb(r,g,b)
  36360. * rgb(r%,g%,b%)
  36361. * rgba(r,g,b,a)
  36362. * hsb(h,s,b) // hsv与hsb等价
  36363. * hsb(h%,s%,b%)
  36364. * hsba(h,s,b,a)
  36365. * hsl(h,s,l)
  36366. * hsl(h%,s%,l%)
  36367. * hsla(h,s,l,a)
  36368. * @param {string} color - 颜色。
  36369. * @returns {Array.<number>} 颜色值数组或null
  36370. */
  36371. getData(color) {
  36372. color = this.normalize(color);
  36373. var r = color.match(this.colorRegExp);
  36374. if (r === null) {
  36375. throw new Error('The color format error'); // 颜色格式错误
  36376. }
  36377. var d;
  36378. var a;
  36379. var data = [];
  36380. var rgb;
  36381. if (r[2]) {
  36382. // #rrggbb
  36383. d = r[2].replace('#', '').split('');
  36384. rgb = [d[0] + d[1], d[2] + d[3], d[4] + d[5]];
  36385. data = this.map(rgb,
  36386. function (c) {
  36387. return Color.prototype.adjust.call(this, parseInt(c, 16), [0, 255]);
  36388. }
  36389. );
  36390. } else if (r[4]) {
  36391. // rgb rgba
  36392. var rgba = (r[4]).split(',');
  36393. a = rgba[3];
  36394. rgb = rgba.slice(0, 3);
  36395. data = this.map(
  36396. rgb,
  36397. function (c) {
  36398. c = Math.floor(
  36399. c.indexOf('%') > 0 ? parseInt(c, 0) * 2.55 : c
  36400. );
  36401. return Color.prototype.adjust.call(this, c, [0, 255]);
  36402. }
  36403. );
  36404. if (typeof a !== 'undefined') {
  36405. data.push(this.adjust(parseFloat(a), [0, 1]));
  36406. }
  36407. } else if (r[5] || r[6]) {
  36408. // hsb hsba hsl hsla
  36409. var hsxa = (r[5] || r[6]).split(',');
  36410. var h = parseInt(hsxa[0], 0) / 360;
  36411. var s = hsxa[1];
  36412. var x = hsxa[2];
  36413. a = hsxa[3];
  36414. data = this.map([s, x],
  36415. function (c) {
  36416. return Color.prototype.adjust.call(this, parseFloat(c) / 100, [0, 1]);
  36417. }
  36418. );
  36419. data.unshift(h);
  36420. if (typeof a !== 'undefined') {
  36421. data.push(this.adjust(parseFloat(a), [0, 1]));
  36422. }
  36423. }
  36424. return data;
  36425. }
  36426. /**
  36427. * @function SuperMap.LevelRenderer.Tool.Color.prototype.alpha
  36428. * @description 设置颜色透明度
  36429. * @param {string} color - 颜色。
  36430. * @param {number} a - 透明度,区间[0,1]。
  36431. * @returns {string} rgba颜色值
  36432. */
  36433. alpha(color, a) {
  36434. if (!this.isCalculableColor(color)) {
  36435. return color;
  36436. }
  36437. if (a === null) {
  36438. a = 1;
  36439. }
  36440. var data = this.getData(this.toRGBA(color));
  36441. data[3] = this.adjust(Number(a).toFixed(4), [0, 1]);
  36442. return this.toColor(data, 'rgba');
  36443. }
  36444. /**
  36445. * @function SuperMap.LevelRenderer.Tool.Color.prototype.map
  36446. * @description 数组映射
  36447. * @param {Array} array - 数组。
  36448. * @param {function} fun - 函数。
  36449. * @returns {string} 数组映射结果
  36450. */
  36451. map(array, fun) {
  36452. if (typeof fun !== 'function') {
  36453. throw new TypeError();
  36454. }
  36455. var len = array ? array.length : 0;
  36456. for (var i = 0; i < len; i++) {
  36457. array[i] = fun(array[i]);
  36458. }
  36459. return array;
  36460. }
  36461. /**
  36462. * @function SuperMap.LevelRenderer.Tool.Color.prototype.adjust
  36463. * @description 调整值区间
  36464. * @param {Array.<number>} value - 数组。
  36465. * @param {Array.<number>} region - 区间。
  36466. * @returns {number} 调整后的值
  36467. */
  36468. adjust(value, region) {
  36469. // < to <= & > to >=
  36470. // modify by linzhifeng 2014-05-25 because -0 == 0
  36471. if (value <= region[0]) {
  36472. value = region[0];
  36473. } else if (value >= region[1]) {
  36474. value = region[1];
  36475. }
  36476. return value;
  36477. }
  36478. /**
  36479. * @function SuperMap.LevelRenderer.Tool.Color.prototype.isCalculableColor
  36480. * @description 判断是否是可计算的颜色
  36481. * @param {string} color - 颜色。
  36482. * @returns {boolean} 是否是可计算的颜色
  36483. */
  36484. isCalculableColor(color) {
  36485. return color instanceof Array || typeof color === 'string';
  36486. }
  36487. /**
  36488. * @function SuperMap.LevelRenderer.Tool.Color.prototype._HSV_2_RGB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  36489. */
  36490. _HSV_2_RGB(data) {
  36491. var H = data[0];
  36492. var S = data[1];
  36493. var V = data[2];
  36494. // HSV from 0 to 1
  36495. var R;
  36496. var G;
  36497. var B;
  36498. if (S === 0) {
  36499. R = V * 255;
  36500. G = V * 255;
  36501. B = V * 255;
  36502. } else {
  36503. var h = H * 6;
  36504. if (h === 6) {
  36505. h = 0;
  36506. }
  36507. var i = h | 0;
  36508. var v1 = V * (1 - S);
  36509. var v2 = V * (1 - S * (h - i));
  36510. var v3 = V * (1 - S * (1 - (h - i)));
  36511. var r = 0;
  36512. var g = 0;
  36513. var b = 0;
  36514. if (i === 0) {
  36515. r = V;
  36516. g = v3;
  36517. b = v1;
  36518. } else if (i === 1) {
  36519. r = v2;
  36520. g = V;
  36521. b = v1;
  36522. } else if (i === 2) {
  36523. r = v1;
  36524. g = V;
  36525. b = v3;
  36526. } else if (i === 3) {
  36527. r = v1;
  36528. g = v2;
  36529. b = V;
  36530. } else if (i === 4) {
  36531. r = v3;
  36532. g = v1;
  36533. b = V;
  36534. } else {
  36535. r = V;
  36536. g = v1;
  36537. b = v2;
  36538. }
  36539. // RGB results from 0 to 255
  36540. R = r * 255;
  36541. G = g * 255;
  36542. B = b * 255;
  36543. }
  36544. return [R, G, B];
  36545. }
  36546. /**
  36547. * @function SuperMap.LevelRenderer.Tool.Color.prototype._HSL_2_RGB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  36548. */
  36549. _HSL_2_RGB(data) {
  36550. var H = data[0];
  36551. var S = data[1];
  36552. var L = data[2];
  36553. // HSL from 0 to 1
  36554. var R;
  36555. var G;
  36556. var B;
  36557. if (S === 0) {
  36558. R = L * 255;
  36559. G = L * 255;
  36560. B = L * 255;
  36561. } else {
  36562. var v2;
  36563. if (L < 0.5) {
  36564. v2 = L * (1 + S);
  36565. } else {
  36566. v2 = (L + S) - (S * L);
  36567. }
  36568. var v1 = 2 * L - v2;
  36569. R = 255 * this._HUE_2_RGB(v1, v2, H + (1 / 3));
  36570. G = 255 * this._HUE_2_RGB(v1, v2, H);
  36571. B = 255 * this._HUE_2_RGB(v1, v2, H - (1 / 3));
  36572. }
  36573. return [R, G, B];
  36574. }
  36575. /**
  36576. * @function SuperMap.LevelRenderer.Tool.Color.prototype._HUE_2_RGB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  36577. */
  36578. _HUE_2_RGB(v1, v2, vH) {
  36579. if (vH < 0) {
  36580. vH += 1;
  36581. }
  36582. if (vH > 1) {
  36583. vH -= 1;
  36584. }
  36585. if ((6 * vH) < 1) {
  36586. return (v1 + (v2 - v1) * 6 * vH);
  36587. }
  36588. if ((2 * vH) < 1) {
  36589. return (v2);
  36590. }
  36591. if ((3 * vH) < 2) {
  36592. return (v1 + (v2 - v1) * ((2 / 3) - vH) * 6);
  36593. }
  36594. return v1;
  36595. }
  36596. /**
  36597. * @function SuperMap.LevelRenderer.Tool.Color.prototype._RGB_2_HSB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  36598. */
  36599. _RGB_2_HSB(data) {
  36600. // RGB from 0 to 255
  36601. var R = (data[0] / 255);
  36602. var G = (data[1] / 255);
  36603. var B = (data[2] / 255);
  36604. var vMin = Math.min(R, G, B); // Min. value of RGB
  36605. var vMax = Math.max(R, G, B); // Max. value of RGB
  36606. var delta = vMax - vMin; // Delta RGB value
  36607. var V = vMax;
  36608. var H;
  36609. var S;
  36610. // HSV results from 0 to 1
  36611. if (delta === 0) {
  36612. H = 0;
  36613. S = 0;
  36614. } else {
  36615. S = delta / vMax;
  36616. var deltaR = (((vMax - R) / 6) + (delta / 2)) / delta;
  36617. var deltaG = (((vMax - G) / 6) + (delta / 2)) / delta;
  36618. var deltaB = (((vMax - B) / 6) + (delta / 2)) / delta;
  36619. if (R === vMax) {
  36620. H = deltaB - deltaG;
  36621. } else if (G === vMax) {
  36622. H = (1 / 3) + deltaR - deltaB;
  36623. } else if (B === vMax) {
  36624. H = (2 / 3) + deltaG - deltaR;
  36625. }
  36626. if (H < 0) {
  36627. H += 1;
  36628. }
  36629. if (H > 1) {
  36630. H -= 1;
  36631. }
  36632. }
  36633. H = H * 360;
  36634. S = S * 100;
  36635. V = V * 100;
  36636. return [H, S, V];
  36637. }
  36638. /**
  36639. * @function SuperMap.LevelRenderer.Tool.Color.prototype._RGB_2_HSL。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  36640. */
  36641. _RGB_2_HSL(data) {
  36642. // RGB from 0 to 255
  36643. var R = (data[0] / 255);
  36644. var G = (data[1] / 255);
  36645. var B = (data[2] / 255);
  36646. var vMin = Math.min(R, G, B); // Min. value of RGB
  36647. var vMax = Math.max(R, G, B); // Max. value of RGB
  36648. var delta = vMax - vMin; // Delta RGB value
  36649. var L = (vMax + vMin) / 2;
  36650. var H;
  36651. var S;
  36652. // HSL results from 0 to 1
  36653. if (delta === 0) {
  36654. H = 0;
  36655. S = 0;
  36656. } else {
  36657. if (L < 0.5) {
  36658. S = delta / (vMax + vMin);
  36659. } else {
  36660. S = delta / (2 - vMax - vMin);
  36661. }
  36662. var deltaR = (((vMax - R) / 6) + (delta / 2)) / delta;
  36663. var deltaG = (((vMax - G) / 6) + (delta / 2)) / delta;
  36664. var deltaB = (((vMax - B) / 6) + (delta / 2)) / delta;
  36665. if (R === vMax) {
  36666. H = deltaB - deltaG;
  36667. } else if (G === vMax) {
  36668. H = (1 / 3) + deltaR - deltaB;
  36669. } else if (B === vMax) {
  36670. H = (2 / 3) + deltaG - deltaR;
  36671. }
  36672. if (H < 0) {
  36673. H += 1;
  36674. }
  36675. if (H > 1) {
  36676. H -= 1;
  36677. }
  36678. }
  36679. H = H * 360;
  36680. S = S * 100;
  36681. L = L * 100;
  36682. return [H, S, L];
  36683. }
  36684. }
  36685. ;// CONCATENATED MODULE: ./src/common/util/ColorsPickerUtil.js
  36686. var ColorRender = new Color();
  36687. // let "http://www.qzu.zj.cn": "#bd10e0"
  36688. // "www.qzct.net": "#7ed321" = new SuperMap.LevelRenderer.Tool.Color();
  36689. /**
  36690. * Created by yzy on 2016/11/9.
  36691. * 色带选择器工具类 用于1、创建canvas对象,2、从几种颜色中获取一定数量的渐变色
  36692. *
  36693. */
  36694. class ColorsPickerUtil {
  36695. /**
  36696. * 创建DOM canvas
  36697. * @param height canvas 高度
  36698. * @param width canvas 宽度
  36699. *
  36700. */
  36701. static createCanvas (height, width){
  36702. var canvas = document.createElement("canvas");
  36703. canvas.height = height;
  36704. canvas.width = width;
  36705. return canvas.getContext("2d");
  36706. }
  36707. /**
  36708. * 线性渐变。
  36709. * Parameters:
  36710. * x0 - {Number} 渐变起点。
  36711. * y0 - {Number}
  36712. * x1 - {Number} 渐变终点。
  36713. * y1 - {Number}
  36714. * colorList - {Array} 颜色列表。
  36715. *
  36716. * Returns:
  36717. * {CanvasGradient} Cavans 渐变颜色。
  36718. */
  36719. static getLinearGradient (x0, y0, x1, y1, colorList){
  36720. if (!this._ctx) {
  36721. this._ctx = this.getContext();
  36722. }
  36723. var gradient = this._ctx.createLinearGradient(x0, y0, x1, y1);
  36724. var leng = colorList.length;
  36725. var add = 1/(leng -1);
  36726. var offset = 0;
  36727. for (var i = 0; i < leng; i++) {
  36728. gradient.addColorStop(offset, colorList[i]);
  36729. offset += add;
  36730. }
  36731. gradient.__nonRecursion = true;
  36732. return gradient;
  36733. }
  36734. /**
  36735. * 获取 Cavans 上下文
  36736. *
  36737. * Returns:
  36738. * {Object} Cavans 上下文。
  36739. */
  36740. static getContext () {
  36741. if (!this._ctx) {
  36742. this._ctx = document.createElement('canvas').getContext('2d');
  36743. }
  36744. return this._ctx;
  36745. }
  36746. /**
  36747. * 获取两种颜色之间渐变颜色数组。
  36748. *
  36749. * Parameters:
  36750. * start - {color} 起始颜色。
  36751. * end - {color} 结束颜色。
  36752. * step - {Number} 渐变级数。
  36753. * colorList - {Array} 颜色列表。
  36754. *
  36755. * Returns:
  36756. * {Array} 颜色数组。
  36757. */
  36758. static getStepColors (start, end, step){
  36759. start = ColorRender.toRGBA(start);
  36760. end = ColorRender.toRGBA(end);
  36761. start = ColorRender.getData(start);
  36762. end = ColorRender.getData(end);
  36763. var colors = [];
  36764. var stepR = (end[0] - start[0]) / step;
  36765. var stepG = (end[1] - start[1]) / step;
  36766. var stepB = (end[2] - start[2]) / step;
  36767. var stepA = (end[3] - start[3]) / step;
  36768. // 生成颜色集合
  36769. // fix by linfeng 颜色堆积
  36770. for (var i = 0, r = start[0], g = start[1], b = start[2], a = start[3]; i < step; i++) {
  36771. colors[i] = ColorRender.toColor([
  36772. ColorRender.adjust(Math.floor(r), [ 0, 255 ]),
  36773. ColorRender.adjust(Math.floor(g), [ 0, 255 ]),
  36774. ColorRender.adjust(Math.floor(b), [ 0, 255 ]),
  36775. a.toFixed(4) - 0
  36776. ],'hex');
  36777. r += stepR;
  36778. g += stepG;
  36779. b += stepB;
  36780. a += stepA;
  36781. }
  36782. r = end[0];
  36783. g = end[1];
  36784. b = end[2];
  36785. a = end[3];
  36786. colors[i] = ColorRender.toColor([r, g, b, a], 'hex');
  36787. return colors;
  36788. }
  36789. /**
  36790. * APIMethod: getGradientColors
  36791. * 获取指定级数的渐变颜色数组。
  36792. *
  36793. * Parameters:
  36794. * colors - {Array{String}} 颜色组。
  36795. * total - {Number} 颜色总数。
  36796. * total - {String} 专题类型
  36797. *
  36798. * Returns:
  36799. * {Array{String}} 颜色数组。
  36800. */
  36801. static getGradientColors (colors, total, themeType){
  36802. var ret = [], step;
  36803. var i, n, len = colors.length;
  36804. if (total === undefined) {
  36805. return;
  36806. }
  36807. if(len >= total){
  36808. if(themeType === 'RANGE'){
  36809. for(i = 0; i<total; i++){
  36810. ret.push(colors[i]);
  36811. }
  36812. }else {
  36813. //1/2前后取色
  36814. for(i = 0; i<total; i++){
  36815. let ii = Math.floor(i/2);
  36816. if(i%2 === 0){
  36817. ret.push(colors[ii]);
  36818. }else {
  36819. let index = colors.length -1 - ii;
  36820. ret.push(colors[index]);
  36821. }
  36822. }
  36823. }
  36824. } else {
  36825. step = Math.ceil(total/(len-1));
  36826. for (i = 0, n = len - 1; i < n; i++) {
  36827. var steps = this.getStepColors(colors[i], colors[i + 1], step);
  36828. if (i < n - 1) {
  36829. steps.pop();
  36830. }
  36831. ret = ret.concat(steps);
  36832. }
  36833. //删除多余元素
  36834. var nouse = ret.length - total;
  36835. for(var j = 0, index = 0; j< nouse; j++){
  36836. ret.splice(index+2,1);
  36837. }
  36838. }
  36839. return ret;
  36840. }
  36841. }
  36842. SuperMap.ColorsPickerUtil = ColorsPickerUtil;
  36843. ;// CONCATENATED MODULE: ./src/common/util/ArrayStatistic.js
  36844. class ArrayStatistic {
  36845. // geostatsInstance: null,
  36846. /**
  36847. * 初始化插件实例
  36848. */
  36849. static newInstance() {
  36850. // if(!this.geostatsInstance) {
  36851. // // this.geostatsInstance = new geostats();
  36852. // // }
  36853. // window.dataList = [];
  36854. if(!this.geostatsInstance) {
  36855. this.geostatsInstance = new window.geostats();
  36856. }
  36857. return this.geostatsInstance;
  36858. }
  36859. /**
  36860. * 设置需要被处理的数组
  36861. *
  36862. * @param array
  36863. */
  36864. static getInstance(array) {
  36865. let instance = this.newInstance();
  36866. instance.setSerie(array);
  36867. return instance;
  36868. }
  36869. /**
  36870. * 获取数组统计的值
  36871. *
  36872. * @param array 需要统计的数组
  36873. * @param type 统计方法
  36874. */
  36875. static getArrayStatistic(array, type){
  36876. if(!array.length) {
  36877. return 0;
  36878. }
  36879. if(type === "Sum" || type === "求和"){
  36880. return this.getSum(array);
  36881. } else if(type === "Maximum" || type === "最大值"){
  36882. return this.getMax(array);
  36883. } else if(type === "Minimum" || type === "最小值"){
  36884. return this.getMin(array);
  36885. } else if(type === "Average" || type === "平均值"){
  36886. return this.getMean(array);
  36887. } else if(type === "Median" || type === "中位数"){
  36888. return this.getMedian(array);
  36889. } else if(type === "times" || type === "计数"){
  36890. return this.getTimes(array);
  36891. }
  36892. }
  36893. /**
  36894. * 获取数组分段后的数值
  36895. *
  36896. * @param array 需要分段的数组
  36897. * @param type 分段方法
  36898. * @param segNum 分段个数
  36899. */
  36900. static getArraySegments(array, type, segNum) {
  36901. if(type === "offset") {
  36902. return this.getEqInterval(array, segNum);
  36903. } else if(type === "jenks") {
  36904. return this.getJenks(array, segNum);
  36905. } else if(type === "square") {
  36906. // 数据都必须 >= 0
  36907. let minValue = this.getMin(array);
  36908. if(minValue >= 0){
  36909. return this.getSqrtInterval(array, segNum);
  36910. }else {
  36911. //console.log('数据都必须 >= 0');
  36912. // Util.showMessage(Language.hasNegValue + Language.noSupportRange, 'ERROR');
  36913. return false;
  36914. }
  36915. } else if(type === "logarithm") {
  36916. // 数据都必须 > 0
  36917. let minValue = this.getMin(array);
  36918. if(minValue > 0){
  36919. return this.getGeometricProgression(array, segNum);
  36920. }else {
  36921. //console.log('数据都必须 > 0');
  36922. // Util.showMessage(Language.hasZeroNegValue + Language.noSupportRange, 'ERROR');
  36923. return false;
  36924. }
  36925. }
  36926. }
  36927. /**
  36928. * 求和
  36929. * @param array
  36930. * @returns {number}
  36931. */
  36932. static getSum(array){
  36933. return this.getInstance(array).sum();
  36934. }
  36935. /**
  36936. * 最小值
  36937. * @param array
  36938. * @returns {*}
  36939. */
  36940. static getMax(array){
  36941. return this.getInstance(array).max();
  36942. }
  36943. /**
  36944. * 最大值
  36945. * @param array
  36946. * @returns {*}
  36947. */
  36948. static getMin(array){
  36949. return this.getInstance(array).min();
  36950. }
  36951. /**
  36952. * 求平均
  36953. * @param array
  36954. * @returns {number}
  36955. */
  36956. static getMean(array){
  36957. return this.getInstance(array).mean();
  36958. }
  36959. /**
  36960. * 求中位数
  36961. *
  36962. * @param array
  36963. * @returns {number}
  36964. */
  36965. static getMedian(array) {
  36966. return this.getInstance(array).median();
  36967. }
  36968. /**
  36969. * 计数
  36970. *
  36971. * @param array
  36972. * @returns {number}
  36973. */
  36974. static getTimes(array) {
  36975. return array.length;
  36976. }
  36977. /**
  36978. * 等距分段法
  36979. *
  36980. * @param array
  36981. * @param segNum
  36982. */
  36983. static getEqInterval(array, segNum) {
  36984. return this.getInstance(array).getClassEqInterval(segNum);
  36985. }
  36986. /**
  36987. * 自然断裂法
  36988. *
  36989. * @param array
  36990. * @param segNum
  36991. */
  36992. static getJenks(array, segNum) {
  36993. return this.getInstance(array).getClassJenks(segNum);
  36994. }
  36995. /**
  36996. * 平方根分段法
  36997. *
  36998. * @param array
  36999. * @param segNum
  37000. */
  37001. static getSqrtInterval(array, segNum) {
  37002. array = array.map(function(value) {
  37003. return Math.sqrt(value);
  37004. });
  37005. let breaks = this.getInstance(array).getClassEqInterval(segNum);
  37006. return (
  37007. breaks.map(function(value) {
  37008. return value * value;
  37009. })
  37010. )
  37011. }
  37012. /**
  37013. * 对数分段法
  37014. *
  37015. * @param array
  37016. * @param segNum
  37017. */
  37018. static getGeometricProgression(array, segNum) {
  37019. return this.getInstance(array).getClassGeometricProgression(segNum);
  37020. }
  37021. }
  37022. SuperMap.ArrayStatistic = ArrayStatistic;
  37023. ;// CONCATENATED MODULE: ./src/common/util/MapCalculateUtil.js
  37024. var getMeterPerMapUnit = function(mapUnit) {
  37025. var earchRadiusInMeters = 6378137;
  37026. var meterPerMapUnit;
  37027. if (mapUnit === Unit.METER) {
  37028. meterPerMapUnit = 1;
  37029. } else if (mapUnit === Unit.DEGREE) {
  37030. // 每度表示多少米。
  37031. meterPerMapUnit = (Math.PI * 2 * earchRadiusInMeters) / 360;
  37032. } else if (mapUnit === Unit.KILOMETER) {
  37033. meterPerMapUnit = 1.0e-3;
  37034. } else if (mapUnit === Unit.INCH) {
  37035. meterPerMapUnit = 1 / 2.5399999918e-2;
  37036. } else if (mapUnit === Unit.FOOT) {
  37037. meterPerMapUnit = 0.3048;
  37038. } else {
  37039. return meterPerMapUnit;
  37040. }
  37041. return meterPerMapUnit;
  37042. };
  37043. function getWrapNum(x, includeMax = true, includeMin = true, range = [-180, 180]) {
  37044. var max = range[1],
  37045. min = range[0],
  37046. d = max - min;
  37047. if (x === max && includeMax) {
  37048. return x;
  37049. }
  37050. if (x === min && includeMin) {
  37051. return x;
  37052. }
  37053. var tmp = (((x - min) % d) + d) % d;
  37054. if (tmp === 0 && includeMax) {
  37055. return max;
  37056. }
  37057. return ((((x - min) % d) + d) % d) + min;
  37058. }
  37059. function conversionDegree(degrees) {
  37060. const degree = parseInt(degrees);
  37061. let fraction = parseInt((degrees - degree) * 60);
  37062. let second = parseInt(((degrees - degree) * 60 - fraction) * 60);
  37063. fraction = parseInt(fraction / 10) === 0 ? `0${fraction}` : fraction;
  37064. second = parseInt(second / 10) === 0 ? `0${second}` : second;
  37065. return `${degree}°${fraction}'${second}`;
  37066. }
  37067. ;// CONCATENATED MODULE: ./src/common/util/index.js
  37068. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  37069. * This program are made available under the terms of the Apache License, Version 2.0
  37070. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37071. // EXTERNAL MODULE: ./node_modules/lodash.topairs/index.js
  37072. var lodash_topairs = __webpack_require__(52);
  37073. var lodash_topairs_default = /*#__PURE__*/__webpack_require__.n(lodash_topairs);
  37074. ;// CONCATENATED MODULE: ./src/common/style/CartoCSS.js
  37075. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  37076. * This program are made available under the terms of the Apache License, Version 2.0
  37077. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37078. /**
  37079. * @class SuperMap.CartoCSS
  37080. * @classdesc CartoCSS 解析类,其主要功能为将 CartoCSS 字符串解析为 CartoCSS 的 shader 属性风格对象。
  37081. * @category BaseTypes Style
  37082. * @param {string} cartoStr - CartoCSS 样式表字符串
  37083. * @example
  37084. * var cartocss = "@provinceLineColor:#ddd;
  37085. * #China_Provinces_L___China400{
  37086. * line-dasharray:10,10;
  37087. * line-color:@provinceLineColor;
  37088. * line-width:1;
  37089. * }";
  37090. * new SuperMap.CartoCSS(cartocss);
  37091. */
  37092. /*eslint no-useless-escape: "off"*/
  37093. class CartoCSS {
  37094. constructor(cartoStr) {
  37095. this.env = null;
  37096. /**
  37097. * @member SuperMap.CartoCSS.prototype.parser
  37098. * @description 解析器
  37099. */
  37100. this.parser = null;
  37101. /**
  37102. * @member SuperMap.CartoCSS.prototype.ruleSet
  37103. * @description CartoCSS 规则对象
  37104. */
  37105. this.ruleSet = null;
  37106. /**
  37107. * @member SuperMap.CartoCSS.prototype.cartoStr
  37108. * @description CartoCSS 样式表字符串
  37109. */
  37110. this.cartoStr = "";
  37111. /**
  37112. * @member SuperMap.CartoCSS.prototype.shaders
  37113. * @description Carto 着色器集
  37114. */
  37115. this.shaders = null;
  37116. if (typeof cartoStr === "string") {
  37117. this.cartoStr = cartoStr;
  37118. this.env = {
  37119. frames: [],
  37120. errors: [],
  37121. error: function (obj) {
  37122. this.errors.push(obj);
  37123. }
  37124. };
  37125. this.parser = this.getParser(this.env);
  37126. this.parse(cartoStr);
  37127. this.shaders = this.toShaders();
  37128. }
  37129. }
  37130. /**
  37131. * @function SuperMap.CartoCSS.prototype.getParser
  37132. * @description 获取 CartoCSS 解析器
  37133. */
  37134. getParser(env) {
  37135. var input, // LeSS input string
  37136. i, // current index in `input`
  37137. j, // current chunk
  37138. temp, // temporarily holds a chunk's state, for backtracking
  37139. memo, // temporarily holds `i`, when backtracking
  37140. furthest, // furthest index the parser has gone to
  37141. chunks, // chunkified input
  37142. current, // index of current chunk, in `input`
  37143. parser;
  37144. var that = this;
  37145. // This function is called after all files
  37146. // have been imported through `@import`.
  37147. var finish = function () {//NOSONAR
  37148. //所有文件导入完成之后调用
  37149. };
  37150. function save() {
  37151. temp = chunks[j];
  37152. memo = i;
  37153. current = i;
  37154. }
  37155. function restore() {
  37156. chunks[j] = temp;
  37157. i = memo;
  37158. current = i;
  37159. }
  37160. function sync() {
  37161. if (i > current) {
  37162. chunks[j] = chunks[j].slice(i - current);
  37163. current = i;
  37164. }
  37165. }
  37166. //
  37167. // Parse from a token, regexp or string, and move forward if match
  37168. //
  37169. function _match(tok) {
  37170. var match, length, c, endIndex;
  37171. // Non-terminal
  37172. if (tok instanceof Function) {
  37173. return tok.call(parser.parsers);
  37174. // Terminal
  37175. // Either match a single character in the input,
  37176. // or match a regexp in the current chunk (chunk[j]).
  37177. } else if (typeof(tok) === 'string') {
  37178. match = input.charAt(i) === tok ? tok : null;
  37179. length = 1;
  37180. sync();
  37181. } else {
  37182. sync();
  37183. match = tok.exec(chunks[j]);
  37184. if (match) {
  37185. length = match[0].length;
  37186. } else {
  37187. return null;
  37188. }
  37189. }
  37190. // The match is confirmed, add the match length to `i`,
  37191. // and consume any extra white-space characters (' ' || '\n')
  37192. // which come after that. The reason for this is that LeSS's
  37193. // grammar is mostly white-space insensitive.
  37194. if (match) {
  37195. var mem = i += length;
  37196. endIndex = i + chunks[j].length - length;
  37197. while (i < endIndex) {
  37198. c = input.charCodeAt(i);
  37199. if (!(c === 32 || c === 10 || c === 9)) {
  37200. break;
  37201. }
  37202. i++;
  37203. }
  37204. chunks[j] = chunks[j].slice(length + (i - mem));
  37205. current = i;
  37206. if (chunks[j].length === 0 && j < chunks.length - 1) {
  37207. j++;
  37208. }
  37209. if (typeof(match) === 'string') {
  37210. return match;
  37211. } else {
  37212. return match.length === 1 ? match[0] : match;
  37213. }
  37214. }
  37215. }
  37216. // Same as _match(), but don't change the state of the parser,
  37217. // just return the match.
  37218. function peek(tok) {
  37219. if (typeof(tok) === 'string') {
  37220. return input.charAt(i) === tok;
  37221. } else {
  37222. return !!tok.test(chunks[j]);
  37223. }
  37224. }
  37225. // Make an error object from a passed set of properties.
  37226. // Accepted properties:
  37227. // - `message`: Text of the error message.
  37228. // - `filename`: Filename where the error occurred.
  37229. // - `index`: Char. index where the error occurred.
  37230. function makeError(err) {
  37231. var einput;
  37232. var defautls = {
  37233. index: furthest,
  37234. filename: env.filename,
  37235. message: 'Parse error.',
  37236. line: 0,
  37237. column: -1
  37238. };
  37239. for (var prop in defautls) {
  37240. if (err[prop] === 0) {
  37241. err[prop] = defautls[prop];
  37242. }
  37243. }
  37244. if (err.filename && that.env.inputs && that.env.inputs[err.filename]) {
  37245. einput = that.env.inputs[err.filename];
  37246. } else {
  37247. einput = input;
  37248. }
  37249. err.line = (einput.slice(0, err.index).match(/\n/g) || '').length + 1;
  37250. for (var n = err.index; n >= 0 && einput.charAt(n) !== '\n'; n--) {
  37251. err.column++;
  37252. }
  37253. return new Error([err.filename, err.line, err.column, err.message].join(";"));
  37254. }
  37255. this.env = env = env || {};
  37256. this.env.filename = this.env.filename || null;
  37257. this.env.inputs = this.env.inputs || {};
  37258. // The Parser
  37259. parser = {
  37260. // Parse an input string into an abstract syntax tree.
  37261. // Throws an error on parse errors.
  37262. parse: function (str) {
  37263. var root, error = null;
  37264. i = j = current = furthest = 0;
  37265. chunks = [];
  37266. input = str.replace(/\r\n/g, '\n');
  37267. if (env.filename) {
  37268. that.env.inputs[env.filename] = input;
  37269. }
  37270. // Split the input into chunks.
  37271. chunks = (function (chunks) {
  37272. var j = 0,
  37273. skip = /(?:@\{[\w-]+\}|[^"'`\{\}\/\(\)\\])+/g,
  37274. comment = /\/\*(?:[^*]|\*+[^\/*])*\*+\/|\/\/.*/g,
  37275. string = /"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'|`((?:[^`]|\\.)*)`/g,
  37276. level = 0,
  37277. match,
  37278. chunk = chunks[0],
  37279. inParam;
  37280. for (var i = 0, c, cc; i < input.length;) {
  37281. skip.lastIndex = i;
  37282. if (match = skip.exec(input)) {
  37283. if (match.index === i) {
  37284. i += match[0].length;
  37285. chunk.push(match[0]);
  37286. }
  37287. }
  37288. c = input.charAt(i);
  37289. comment.lastIndex = string.lastIndex = i;
  37290. if (match = string.exec(input)) {
  37291. if (match.index === i) {
  37292. i += match[0].length;
  37293. chunk.push(match[0]);
  37294. continue;
  37295. }
  37296. }
  37297. if (!inParam && c === '/') {
  37298. cc = input.charAt(i + 1);
  37299. if (cc === '/' || cc === '*') {
  37300. if (match = comment.exec(input)) {
  37301. if (match.index === i) {
  37302. i += match[0].length;
  37303. chunk.push(match[0]);
  37304. continue;
  37305. }
  37306. }
  37307. }
  37308. }
  37309. switch (c) {
  37310. case '{'://NOSONAR
  37311. if (!inParam) {
  37312. level++;
  37313. chunk.push(c);
  37314. break;
  37315. }
  37316. case '}'://NOSONAR
  37317. if (!inParam) {
  37318. level--;
  37319. chunk.push(c);
  37320. chunks[++j] = chunk = [];
  37321. break;
  37322. }
  37323. case '('://NOSONAR
  37324. if (!inParam) {
  37325. inParam = true;
  37326. chunk.push(c);
  37327. break;
  37328. }
  37329. case ')'://NOSONAR
  37330. if (inParam) {
  37331. inParam = false;
  37332. chunk.push(c);
  37333. break;
  37334. }
  37335. default:
  37336. chunk.push(c);
  37337. break;
  37338. }
  37339. i++;
  37340. }
  37341. if (level !== 0) {
  37342. error = {
  37343. index: i - 1,
  37344. type: 'Parse',
  37345. message: (level > 0) ? "missing closing `}`" : "missing opening `{`"
  37346. };
  37347. }
  37348. return chunks.map(function (c) {
  37349. return c.join('');
  37350. });
  37351. })([[]]);
  37352. if (error) {
  37353. throw makeError(error);
  37354. }
  37355. // Sort rules by specificity: this function expects selectors to be
  37356. // split already.
  37357. //
  37358. // Written to be used as a .sort(Function);
  37359. // argument.
  37360. //
  37361. // [1, 0, 0, 467] > [0, 0, 1, 520]
  37362. var specificitySort = function (a, b) {
  37363. var as = a.specificity;
  37364. var bs = b.specificity;
  37365. if (as[0] != bs[0]) {return bs[0] - as[0];}
  37366. if (as[1] != bs[1]) {return bs[1] - as[1];}
  37367. if (as[2] != bs[2]) {return bs[2] - as[2];}
  37368. return bs[3] - as[3];
  37369. };
  37370. // Start with the primary rule.
  37371. // The whole syntax tree is held under a Ruleset node,
  37372. // with the `root` property set to true, so no `{}` are
  37373. // output.
  37374. root = new SuperMap.CartoCSS.Tree.Ruleset([], _match(this.parsers.primary));
  37375. root.root = true;
  37376. // Get an array of Ruleset objects, flattened
  37377. // and sorted according to specificitySort
  37378. root.toList = (function () {
  37379. return function (env) {
  37380. env.error = function (e) {
  37381. if (!env.errors) {env.errors = new Error('');}
  37382. if (env.errors.message) {
  37383. env.errors.message += '\n' + makeError(e).message;
  37384. } else {
  37385. env.errors.message = makeError(e).message;
  37386. }
  37387. };
  37388. env.frames = env.frames || [];
  37389. // call populates Invalid-caused errors
  37390. var definitions = this.flatten([], [], env);
  37391. definitions.sort(specificitySort);
  37392. return definitions;
  37393. };
  37394. })();
  37395. return root;
  37396. },
  37397. // Here in, the parsing rules/functions
  37398. //
  37399. // The basic structure of the syntax tree generated is as follows:
  37400. //
  37401. // Ruleset -> Rule -> Value -> Expression -> Entity
  37402. //
  37403. // In general, most rules will try to parse a token with the `_match()` function, and if the return
  37404. // value is truly, will return a new node, of the relevant type. Sometimes, we need to check
  37405. // first, before parsing, that's when we use `peek()`.
  37406. parsers: {
  37407. // The `primary` rule is the *entry* and *exit* point of the parser.
  37408. // The rules here can appear at any level of the parse tree.
  37409. //
  37410. // The recursive nature of the grammar is an interplay between the `block`
  37411. // rule, which represents `{ ... }`, the `ruleset` rule, and this `primary` rule,
  37412. // as represented by this simplified grammar:
  37413. //
  37414. // primary → (ruleset | rule)+
  37415. // ruleset → selector+ block
  37416. // block → '{' primary '}'
  37417. //
  37418. // Only at one point is the primary rule not called from the
  37419. // block rule: at the root level.
  37420. primary: function () {
  37421. var node, root = [];
  37422. while ((node = _match(this.rule) || _match(this.ruleset) ||
  37423. _match(this.comment)) ||
  37424. _match(/^[\s\n]+/) || (node = _match(this.invalid))) {
  37425. if (node) {root.push(node);}
  37426. }
  37427. return root;
  37428. },
  37429. invalid: function () {
  37430. var chunk = _match(/^[^;\n]*[;\n]/);
  37431. // To fail gracefully, match everything until a semicolon or linebreak.
  37432. if (chunk) {
  37433. return new SuperMap.CartoCSS.Tree.Invalid(chunk, memo);
  37434. }
  37435. },
  37436. // We create a Comment node for CSS comments `/* */`,
  37437. // but keep the LeSS comments `//` silent, by just skipping
  37438. // over them.
  37439. comment: function () {
  37440. var comment;
  37441. if (input.charAt(i) !== '/') {return;}
  37442. if (input.charAt(i + 1) === '/') {
  37443. return new SuperMap.CartoCSS.Tree.Comment(_match(/^\/\/.*/), true);
  37444. } else if (comment = _match(/^\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/)) {
  37445. return new SuperMap.CartoCSS.Tree.Comment(comment);
  37446. }
  37447. },
  37448. // Entities are tokens which can be found inside an Expression
  37449. entities: {
  37450. // A string, which supports escaping " and ' "milky way" 'he\'s the one!'
  37451. quoted: function () {
  37452. if (input.charAt(i) !== '"' && input.charAt(i) !== "'") {return;}
  37453. var str = _match(/^"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/);
  37454. if (str) {
  37455. return new SuperMap.CartoCSS.Tree.Quoted(str[1] || str[2]);
  37456. }
  37457. },
  37458. // A reference to a Mapnik field, like [NAME]
  37459. // Behind the scenes, this has the same representation, but Carto
  37460. // needs to be careful to warn when unsupported operations are used.
  37461. field: function () {
  37462. var l = '[', r = ']';
  37463. if (!_match(l)) {return;}
  37464. var field_name = _match(/(^[^\]]+)/);
  37465. if (!_match(r)) {return;}
  37466. if (field_name) {return new SuperMap.CartoCSS.Tree.Field(field_name[1]);}
  37467. },
  37468. // This is a comparison operator
  37469. comparison: function () {
  37470. var str = _match(/^=~|=|!=|<=|>=|<|>/);
  37471. if (str) {
  37472. return str;
  37473. }
  37474. },
  37475. // A catch-all word, such as: hard-light
  37476. // These can start with either a letter or a dash (-),
  37477. // and then contain numbers, underscores, and letters.
  37478. keyword: function () {
  37479. var k = _match(/^[A-Za-z\u4e00-\u9fa5-]+[A-Za-z-0-9\u4e00-\u9fa5_]*/);
  37480. if (k) {
  37481. return new SuperMap.CartoCSS.Tree.Keyword(k);
  37482. }
  37483. },
  37484. // A function call like rgb(255, 0, 255)
  37485. // The arguments are parsed with the `entities.arguments` parser.
  37486. call: function () {
  37487. var name, args;
  37488. if (!(name = /^([\w\-]+|%)\(/.exec(chunks[j]))) {return;}
  37489. name = name[1];
  37490. if (name === 'url') {
  37491. // url() is handled by the url parser instead
  37492. return null;
  37493. } else {
  37494. i += name.length;
  37495. }
  37496. var l = '(', r = ')';
  37497. _match(l); // Parse the '(' and consume whitespace.
  37498. args = _match(this.entities['arguments']);
  37499. if (!_match(r)) {return;}
  37500. if (name) {
  37501. return new SuperMap.CartoCSS.Tree.Call(name, args, i);
  37502. }
  37503. },
  37504. // Arguments are comma-separated expressions
  37505. 'arguments': function () {
  37506. var args = [], arg;
  37507. while (arg = _match(this.expression)) {
  37508. args.push(arg);
  37509. var q = ',';
  37510. if (!_match(q)) {
  37511. break;
  37512. }
  37513. }
  37514. return args;
  37515. },
  37516. literal: function () {
  37517. return _match(this.entities.dimension) ||
  37518. _match(this.entities.keywordcolor) ||
  37519. _match(this.entities.hexcolor) ||
  37520. _match(this.entities.quoted);
  37521. },
  37522. // Parse url() tokens
  37523. //
  37524. // We use a specific rule for urls, because they don't really behave like
  37525. // standard function calls. The difference is that the argument doesn't have
  37526. // to be enclosed within a string, so it can't be parsed as an Expression.
  37527. url: function () {
  37528. var value;
  37529. if (input.charAt(i) !== 'u' || !_match(/^url\(/)) {return;}
  37530. value = _match(this.entities.quoted) || _match(this.entities.variable) ||
  37531. _match(/^[\-\w%@_match\/.&=:;#+?~]+/) || '';
  37532. var r = ')';
  37533. if (!_match(r)) {
  37534. return new SuperMap.CartoCSS.Tree.Invalid(value, memo, 'Missing closing ) in URL.');
  37535. } else {
  37536. return new SuperMap.CartoCSS.Tree.URL((typeof value.value !== 'undefined' ||
  37537. value instanceof SuperMap.CartoCSS.Tree.Variable) ?
  37538. value : new SuperMap.CartoCSS.Tree.Quoted(value));
  37539. }
  37540. },
  37541. // A Variable entity, such as `@fink`, in
  37542. //
  37543. // width: @fink + 2px
  37544. //
  37545. // We use a different parser for variable definitions,
  37546. // see `parsers.variable`.
  37547. variable: function () {
  37548. var name, index = i;
  37549. if (input.charAt(i) === '@' && (name = _match(/^@[\w-]+/))) {
  37550. return new SuperMap.CartoCSS.Tree.Variable(name, index, env.filename);
  37551. }
  37552. },
  37553. hexcolor: function () {
  37554. var rgb;
  37555. if (input.charAt(i) === '#' && (rgb = _match(/^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})/))) {
  37556. return new SuperMap.CartoCSS.Tree.Color(rgb[1]);
  37557. }
  37558. },
  37559. keywordcolor: function () {
  37560. var rgb = chunks[j].match(/^[a-z]+/);
  37561. if (rgb && rgb[0] in SuperMap.CartoCSS.Tree.Reference.data.colors) {
  37562. return new SuperMap.CartoCSS.Tree.Color(SuperMap.CartoCSS.Tree.Reference.data.colors[_match(/^[a-z]+/)]);
  37563. }
  37564. },
  37565. // A Dimension, that is, a number and a unit. The only
  37566. // unit that has an effect is %
  37567. dimension: function () {
  37568. var c = input.charCodeAt(i);
  37569. if ((c > 57 || c < 45) || c === 47) {return;}
  37570. var value = _match(/^(-?\d*\.?\d+(?:[eE][-+]?\d+)?)(\%|\w+)?/);
  37571. if (value) {
  37572. return new SuperMap.CartoCSS.Tree.Dimension(value[1], value[2], memo);
  37573. }
  37574. }
  37575. },
  37576. // The variable part of a variable definition.
  37577. // Used in the `rule` parser. Like @fink:
  37578. variable: function () {
  37579. var name;
  37580. if (input.charAt(i) === '@' && (name = _match(/^(@[\w-]+)\s*:/))) {
  37581. return name[1];
  37582. }
  37583. },
  37584. // Entities are the smallest recognized token,
  37585. // and can be found inside a rule's value.
  37586. entity: function () {
  37587. var property1 = _match(this.entities.call) || _match(this.entities.literal);
  37588. var property2 = _match(this.entities.field) || _match(this.entities.variable);
  37589. var property3 = _match(this.entities.url) || _match(this.entities.keyword);
  37590. return property1 || property2 || property3;
  37591. },
  37592. // A Rule terminator. Note that we use `peek()` to check for '}',
  37593. // because the `block` rule will be expecting it, but we still need to make sure
  37594. // it's there, if ';' was ommitted.
  37595. end: function () {
  37596. var q = ';';
  37597. return _match(q) || peek('}');
  37598. },
  37599. // Elements are the building blocks for Selectors. They consist of
  37600. // an element name, such as a tag a class, or `*`.
  37601. //增加对中文的支持,[\u4e00-\u9fa5]
  37602. element: function () {
  37603. var e = _match(/^(?:[.#][\w\u4e00-\u9fa5\-]+|\*|Map)/);
  37604. if (e) {return new SuperMap.CartoCSS.Tree.Element(e);}
  37605. },
  37606. // Attachments allow adding multiple lines, polygons etc. to an
  37607. // object. There can only be one attachment per selector.
  37608. attachment: function () {
  37609. var s = _match(/^::([\w\-]+(?:\/[\w\-]+)*)/);
  37610. if (s) {return s[1];}
  37611. },
  37612. // Selectors are made out of one or more Elements, see above.
  37613. selector: function () {
  37614. var a, attachment,
  37615. e, elements = [],
  37616. f, filters = new SuperMap.CartoCSS.Tree.Filterset(),
  37617. z, zooms = [],
  37618. segments = 0, conditions = 0;
  37619. while (
  37620. (e = _match(this.element)) ||
  37621. (z = _match(this.zoom)) ||
  37622. (f = _match(this.filter)) ||
  37623. (a = _match(this.attachment))
  37624. ) {
  37625. segments++;
  37626. if (e) {
  37627. elements.push(e);
  37628. } else if (z) {
  37629. zooms.push(z);
  37630. conditions++;
  37631. } else if (f) {
  37632. var err = filters.add(f);
  37633. if (err) {
  37634. throw makeError({
  37635. message: err,
  37636. index: i - 1
  37637. });
  37638. }
  37639. conditions++;
  37640. } else if (attachment) {
  37641. throw makeError({
  37642. message: 'Encountered second attachment name.',
  37643. index: i - 1
  37644. });
  37645. } else {
  37646. attachment = a;
  37647. }
  37648. var c = input.charAt(i);
  37649. if (c === '{' || c === '}' || c === ';' || c === ',') {
  37650. break;
  37651. }
  37652. }
  37653. if (segments) {
  37654. return new SuperMap.CartoCSS.Tree.Selector(filters, zooms, elements, attachment, conditions, memo);
  37655. }
  37656. },
  37657. filter: function () {
  37658. save();
  37659. var key, op, val, l = '[', r = ']';
  37660. if (!_match(l)) {return;}
  37661. if (key = _match(/^[a-zA-Z0-9\-_]+/) ||
  37662. _match(this.entities.quoted) ||
  37663. _match(this.entities.variable) ||
  37664. _match(this.entities.keyword) ||
  37665. _match(this.entities.field)) {
  37666. if (key instanceof SuperMap.CartoCSS.Tree.Quoted) {
  37667. key = new SuperMap.CartoCSS.Tree.Field(key.toString());
  37668. }
  37669. if ((op = _match(this.entities.comparison)) &&
  37670. (val = _match(this.entities.quoted) ||
  37671. _match(this.entities.variable) ||
  37672. _match(this.entities.dimension) ||
  37673. _match(this.entities.keyword) ||
  37674. _match(this.entities.field))) {
  37675. if (!_match(r)) {
  37676. throw makeError({
  37677. message: 'Missing closing ] of filter.',
  37678. index: memo - 1
  37679. });
  37680. }
  37681. if (!key.is) {key = new SuperMap.CartoCSS.Tree.Field(key);}
  37682. return new SuperMap.CartoCSS.Tree.Filter(key, op, val, memo, env.filename);
  37683. }
  37684. }
  37685. },
  37686. zoom: function () {
  37687. save();
  37688. var op, val, r = ']';
  37689. if (_match(/^\[\s*zoom/g) &&
  37690. (op = _match(this.entities.comparison)) &&
  37691. (val = _match(this.entities.variable) || _match(this.entities.dimension)) && _match(r)) {
  37692. return new SuperMap.CartoCSS.Tree.Zoom(op, val, memo);
  37693. } else {
  37694. // backtrack
  37695. restore();
  37696. }
  37697. },
  37698. // The `block` rule is used by `ruleset`
  37699. // It's a wrapper around the `primary` rule, with added `{}`.
  37700. block: function () {
  37701. var content, l = '{', r = '}';
  37702. if (_match(l) && (content = _match(this.primary)) && _match(r)) {
  37703. return content;
  37704. }
  37705. },
  37706. // div, .class, body > p {...}
  37707. ruleset: function () {
  37708. var selectors = [], s, rules, q = ',';
  37709. save();
  37710. while (s = _match(this.selector)) {
  37711. selectors.push(s);
  37712. while (_match(this.comment)) {//NOSONAR
  37713. }
  37714. if (!_match(q)) {
  37715. break;
  37716. }
  37717. while (_match(this.comment)) {//NOSONAR
  37718. }
  37719. }
  37720. if (s) {
  37721. while (_match(this.comment)) {//NOSONAR
  37722. }
  37723. }
  37724. if (selectors.length > 0 && (rules = _match(this.block))) {
  37725. if (selectors.length === 1 &&
  37726. selectors[0].elements.length &&
  37727. selectors[0].elements[0].value === 'Map') {
  37728. var rs = new SuperMap.CartoCSS.Tree.Ruleset(selectors, rules);
  37729. rs.isMap = true;
  37730. return rs;
  37731. }
  37732. return new SuperMap.CartoCSS.Tree.Ruleset(selectors, rules);
  37733. } else {
  37734. // Backtrack
  37735. restore();
  37736. }
  37737. },
  37738. rule: function () {
  37739. var name, value, c = input.charAt(i);
  37740. save();
  37741. if (c === '.' || c === '#') {
  37742. return;
  37743. }
  37744. if (name = _match(this.variable) || _match(this.property)) {
  37745. value = _match(this.value);
  37746. if (value && _match(this.end)) {
  37747. return new SuperMap.CartoCSS.Tree.Rule(name, value, memo, env.filename);
  37748. } else {
  37749. furthest = i;
  37750. restore();
  37751. }
  37752. }
  37753. },
  37754. font: function () {
  37755. var value = [], expression = [], e, q = ',';
  37756. while (e = _match(this.entity)) {
  37757. expression.push(e);
  37758. }
  37759. value.push(new SuperMap.CartoCSS.Tree.Expression(expression));
  37760. if (_match(q)) {
  37761. while (e = _match(this.expression)) {
  37762. value.push(e);
  37763. if (!_match(q)) {
  37764. break;
  37765. }
  37766. }
  37767. }
  37768. return new SuperMap.CartoCSS.Tree.Value(value);
  37769. },
  37770. // A Value is a comma-delimited list of Expressions
  37771. // In a Rule, a Value represents everything after the `:`,
  37772. // and before the `;`.
  37773. value: function () {
  37774. var e, expressions = [], q = ',';
  37775. while (e = _match(this.expression)) {
  37776. expressions.push(e);
  37777. if (!_match(q)) {
  37778. break;
  37779. }
  37780. }
  37781. if (expressions.length > 1) {
  37782. return new SuperMap.CartoCSS.Tree.Value(expressions.map(function (e) {
  37783. return e.value[0];
  37784. }));
  37785. } else if (expressions.length === 1) {
  37786. return new SuperMap.CartoCSS.Tree.Value(expressions);
  37787. }
  37788. },
  37789. // A sub-expression, contained by parenthensis
  37790. sub: function () {
  37791. var e, l = '(', r = ")";
  37792. if (_match(l) && (e = _match(this.expression)) && _match(r)) {
  37793. return e;
  37794. }
  37795. },
  37796. // This is a misnomer because it actually handles multiplication
  37797. // and division.
  37798. multiplication: function () {
  37799. var m, a, op, operation, q = '/';
  37800. if (m = _match(this.operand)) {
  37801. while ((op = (_match(q) || _match('*') || _match('%'))) && (a = _match(this.operand))) {
  37802. operation = new SuperMap.CartoCSS.Tree.Operation(op, [operation || m, a], memo);
  37803. }
  37804. return operation || m;
  37805. }
  37806. },
  37807. addition: function () {
  37808. var m, a, op, operation, plus = '+';
  37809. if (m = _match(this.multiplication)) {
  37810. while ((op = _match(/^[-+]\s+/) || (input.charAt(i - 1) != ' ' && (_match(plus) || _match('-')))) &&
  37811. (a = _match(this.multiplication))) {
  37812. operation = new SuperMap.CartoCSS.Tree.Operation(op, [operation || m, a], memo);
  37813. }
  37814. return operation || m;
  37815. }
  37816. },
  37817. // An operand is anything that can be part of an operation,
  37818. // such as a Color, or a Variable
  37819. operand: function () {
  37820. return _match(this.sub) || _match(this.entity);
  37821. },
  37822. // Expressions either represent mathematical operations,
  37823. // or white-space delimited Entities. @var * 2
  37824. expression: function () {
  37825. var e, entities = [];
  37826. while (e = _match(this.addition) || _match(this.entity)) {
  37827. entities.push(e);
  37828. }
  37829. if (entities.length > 0) {
  37830. return new SuperMap.CartoCSS.Tree.Expression(entities);
  37831. }
  37832. },
  37833. property: function () {
  37834. var name = _match(/^(([a-z][-a-z_0-9]*\/)?\*?-?[-a-z_0-9]+)\s*:/);
  37835. if (name) {return name[1];}
  37836. }
  37837. }
  37838. };
  37839. return parser;
  37840. }
  37841. /**
  37842. * @function SuperMap.CartoCSS.prototype.parse
  37843. * @description 利用CartoCSS解析器里面的parse方法,将CartoCSS样式表字符串转化为CartoCSS规则集
  37844. * @returns {Object} CartoCSS规则集
  37845. */
  37846. parse(str) {
  37847. var parser = this.parser;
  37848. var ruleSet = this.ruleSet = parser.parse(str);
  37849. return ruleSet;
  37850. }
  37851. /**
  37852. * @function SuperMap.CartoCSS.prototype.toShaders
  37853. * @description 将CartoCSS规则集转化为着色器
  37854. * @returns {Array} CartoCSS着色器集
  37855. */
  37856. toShaders() {
  37857. if (this.ruleSet) {
  37858. var ruleset = this.ruleSet;
  37859. if (ruleset) {
  37860. var defs = ruleset.toList(this.env);
  37861. defs.reverse();
  37862. var shaders = {};
  37863. var keys = [];
  37864. this._toShaders(shaders,keys,defs);
  37865. var ordered_shaders = [];
  37866. var done = {};
  37867. for (var i = 0, len0 = defs.length; i < len0; ++i) {
  37868. var def = defs[i];
  37869. var k = def.attachment;
  37870. var shader = shaders[keys[i]];
  37871. var shaderArray = [];
  37872. if (!done[k]) {
  37873. var j = 0;
  37874. for (var prop in shader) {
  37875. if (prop !== 'zoom' && prop !== 'frames' && prop !== "attachment" && prop != "elements") {
  37876. //对layer-index作特殊处理以实现图层的控制
  37877. if (prop === "layer-index") {
  37878. /*var getLayerIndex = Function("attributes", "zoom", "var _value = null;" + shader[prop].join('\n') + "; return _value; ");*/
  37879. var getLayerIndex = function (attributes, zoom) {//NOSONAR
  37880. var _value = null;
  37881. shader[prop].join('\n');
  37882. return _value;
  37883. };
  37884. var layerIndex = getLayerIndex();
  37885. Object.defineProperty(shaderArray, "layerIndex", {
  37886. configurable: true,
  37887. enumerable: false,
  37888. value: layerIndex
  37889. });
  37890. } else {
  37891. shaderArray[j++] = function (ops, shaderArray) {//NOSONAR
  37892. if (!Array.isArray(ops)) {
  37893. return ops;
  37894. }
  37895. var body = ops.join('\n');
  37896. var myKeyword = 'attributes["FEATUREID"]&&attributes["FEATUREID"]';
  37897. var index = body.indexOf(myKeyword);
  37898. if (index >= 0) {
  37899. //对featureID作一些特殊处理,以将featureID提取出来
  37900. if (!shaderArray.featureFilter) {
  37901. var featureFilterStart = index + myKeyword.length;
  37902. var featureFilterEnd = body.indexOf(")", featureFilterStart + 1);
  37903. var featureFilterStr = "featureId&&(featureId" + body.substring(featureFilterStart, featureFilterEnd) + ")";
  37904. /*var featureFilter = Function("featureId", "if(" + featureFilterStr + "){return true;}return false;");*/
  37905. var featureFilter = function (featureId) {
  37906. if (featureFilterStr) {
  37907. return true;
  37908. }
  37909. return false;
  37910. }
  37911. Object.defineProperty(shaderArray, "featureFilter", {
  37912. configurable: true,
  37913. enumerable: false,
  37914. value: featureFilter
  37915. });
  37916. }
  37917. return {
  37918. "property": prop,
  37919. "getValue": Function("attributes", "zoom", "seftFilter", "var _value = null; var isExcute=typeof seftFilter=='function'?sefgFilter():seftFilter;if(isExcute){" + body + ";} return _value; ")//NOSONAR
  37920. };
  37921. } else {
  37922. return {
  37923. "property": prop,
  37924. "getValue": Function("attributes", "zoom", "var _value = null;" + body + "; return _value; ")//NOSONAR
  37925. };
  37926. }
  37927. }(shader[prop], shaderArray);
  37928. }
  37929. }
  37930. }
  37931. Object.defineProperty(shaderArray, "attachment", {
  37932. configurable: true,
  37933. enumerable: false,
  37934. value: k
  37935. });
  37936. Object.defineProperty(shaderArray, "elements", {
  37937. configurable: true,
  37938. enumerable: false,
  37939. value: def.elements
  37940. });
  37941. ordered_shaders.push(shaderArray);
  37942. done[keys[i]] = true;
  37943. }
  37944. Object.defineProperty(shaderArray, "zoom", {
  37945. configurable: true,
  37946. enumerable: false,
  37947. value: def.zoom
  37948. });
  37949. //shader.frames.push(def.frame_offset);
  37950. }
  37951. return ordered_shaders;
  37952. }
  37953. }
  37954. return null;
  37955. }
  37956. _toShaders(shaders, keys,defs) {
  37957. for (let i = 0, len0 = defs.length; i < len0; ++i) {
  37958. let def = defs[i];
  37959. let element_str = [];
  37960. for (let j = 0, len1 = def.elements.length; j < len1; j++) {
  37961. element_str.push(def.elements[j]);
  37962. }
  37963. let filters = def.filters.filters;
  37964. let filterStr = [];
  37965. for (let attr in filters) {
  37966. filterStr.push(filters[attr].id);
  37967. }
  37968. let key = element_str.join("/") + "::" + def.attachment + "_" + filterStr.join("_");
  37969. keys.push(key);
  37970. let shader = shaders[key] = (shaders[key] || {});
  37971. //shader.frames = [];
  37972. shader.zoom = SuperMap.CartoCSS.Tree.Zoom.all;
  37973. let props = def.toJS(this.env);
  37974. for (let v in props) {
  37975. (shader[v] = (shader[v] || [])).push(props[v].join('\n'))
  37976. }
  37977. }
  37978. }
  37979. /**
  37980. * @function SuperMap.CartoCSS.prototype.getShaders
  37981. * @description 获取CartoCSS着色器
  37982. * @returns {Array} 着色器集
  37983. * @example
  37984. * //shaders的结构大概如下:
  37985. * var shaders=[
  37986. * {
  37987. * attachment:"one",
  37988. * elements:[],
  37989. * zoom:23,
  37990. * length:2,
  37991. * 0:{property:"line-color",value:function(attribute,zoom){var _value=null;if(zoom){_value="#123456"}return _vlaue;}},
  37992. * 1:{preoperty:"line-width",value:function(attribute,zoom){var _value=null;if(zoom){_value=3}return _vlaue;}}
  37993. * },
  37994. * {
  37995. * attachment:"two",
  37996. * elements:[],
  37997. * zoom:23,
  37998. * length:2,
  37999. * 0:{property:"polygon-color",value:function(attribute,zoom){var _value=null;if(zoom){_value="#123456"}return _vlaue;}},
  38000. * 1:{property:"line-width",value:function(attribute,zoom){var _value=null;if(zoom){_value=3}return _vlaue;}}
  38001. * }
  38002. * ];
  38003. */
  38004. getShaders() {
  38005. return this.shaders;
  38006. }
  38007. /**
  38008. * @function SuperMap.CartoCSS.prototype.destroy
  38009. * @description CartoCSS解析对象的析构函数,用于销毁CartoCSS解析对象
  38010. */
  38011. destroy() {
  38012. this.cartoStr = null;
  38013. this.env = null;
  38014. this.ruleSet = null;
  38015. this.parser = null;
  38016. this.shaders = null;
  38017. }
  38018. }
  38019. SuperMap._mapnik_reference_latest = {
  38020. "version": "2.1.1",
  38021. "style": {
  38022. "filter-mode": {
  38023. "type": [
  38024. "all",
  38025. "first"
  38026. ],
  38027. "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)",
  38028. "default-value": "all",
  38029. "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."
  38030. },
  38031. "image-filters": {
  38032. "css": "image-filters",
  38033. "default-value": "none",
  38034. "default-meaning": "no filters",
  38035. "type": "functions",
  38036. "functions": [
  38037. ["agg-stack-blur", 2],
  38038. ["emboss", 0],
  38039. ["blur", 0],
  38040. ["gray", 0],
  38041. ["sobel", 0],
  38042. ["edge-detect", 0],
  38043. ["x-gradient", 0],
  38044. ["y-gradient", 0],
  38045. ["invert", 0],
  38046. ["sharpen", 0]
  38047. ],
  38048. "doc": "A list of image filters."
  38049. },
  38050. "comp-op": {
  38051. "css": "comp-op",
  38052. "default-value": "src-over",
  38053. "default-meaning": "add the current layer on top of other layers",
  38054. "doc": "Composite operation. This defines how this layer should behave relative to layers atop or below it.",
  38055. "type": ["clear",
  38056. "src",
  38057. "dst",
  38058. "src-over",
  38059. "dst-over",
  38060. "src-in",
  38061. "dst-in",
  38062. "src-out",
  38063. "dst-out",
  38064. "src-atop",
  38065. "dst-atop",
  38066. "xor",
  38067. "plus",
  38068. "minus",
  38069. "multiply",
  38070. "screen",
  38071. "overlay",
  38072. "darken",
  38073. "lighten",
  38074. "color-dodge",
  38075. "color-burn",
  38076. "hard-light",
  38077. "soft-light",
  38078. "difference",
  38079. "exclusion",
  38080. "contrast",
  38081. "invert",
  38082. "invert-rgb",
  38083. "grain-merge",
  38084. "grain-extract",
  38085. "hue",
  38086. "saturation",
  38087. "color",
  38088. "value"
  38089. ]
  38090. },
  38091. "opacity": {
  38092. "css": "opacity",
  38093. "type": "float",
  38094. "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)",
  38095. "default-value": 1,
  38096. "default-meaning": "no separate buffer will be used and no alpha will be applied to the style after rendering"
  38097. }
  38098. },
  38099. "layer": {
  38100. "name": {
  38101. "default-value": "",
  38102. "type": "string",
  38103. "required": true,
  38104. "default-meaning": "No layer name has been provided",
  38105. "doc": "The name of a layer. Can be anything you wish and is not strictly validated, but ideally unique in the map"
  38106. },
  38107. "srs": {
  38108. "default-value": "",
  38109. "type": "string",
  38110. "default-meaning": "No srs value is provided and the value will be inherited from the Map's srs",
  38111. "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'"
  38112. },
  38113. "status": {
  38114. "default-value": true,
  38115. "type": "boolean",
  38116. "default-meaning": "This layer will be marked as active and available for processing",
  38117. "doc": "A property that can be set to false to disable this layer from being processed"
  38118. },
  38119. "minzoom": {
  38120. "default-value": "0",
  38121. "type": "float",
  38122. "default-meaning": "The layer will be visible at the minimum possible scale",
  38123. "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"
  38124. },
  38125. "maxzoom": {
  38126. "default-value": "1.79769e+308",
  38127. "type": "float",
  38128. "default-meaning": "The layer will be visible at the maximum possible scale",
  38129. "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"
  38130. },
  38131. "queryable": {
  38132. "default-value": false,
  38133. "type": "boolean",
  38134. "default-meaning": "The layer will not be available for the direct querying of data values",
  38135. "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"
  38136. },
  38137. "clear-label-cache": {
  38138. "default-value": false,
  38139. "type": "boolean",
  38140. "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",
  38141. "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"
  38142. },
  38143. "group-by": {
  38144. "default-value": "",
  38145. "type": "string",
  38146. "default-meaning": "No special layer grouping will be used during rendering",
  38147. "doc": "https://github.com/mapnik/mapnik/wiki/Grouped-rendering"
  38148. },
  38149. "buffer-size": {
  38150. "default-value": "0",
  38151. "type": "float",
  38152. "default-meaning": "No buffer will be used",
  38153. "doc": "Extra tolerance around the Layer extent (in pixels) used to when querying and (potentially) clipping the layer data during rendering"
  38154. },
  38155. "maximum-extent": {
  38156. "default-value": "none",
  38157. "type": "bbox",
  38158. "default-meaning": "No clipping extent will be used",
  38159. "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."
  38160. }
  38161. },
  38162. "symbolizers": {
  38163. "*": {
  38164. "image-filters": {
  38165. "css": "image-filters",
  38166. "default-value": "none",
  38167. "default-meaning": "no filters",
  38168. "type": "functions",
  38169. "functions": [
  38170. ["agg-stack-blur", 2],
  38171. ["emboss", 0],
  38172. ["blur", 0],
  38173. ["gray", 0],
  38174. ["sobel", 0],
  38175. ["edge-detect", 0],
  38176. ["x-gradient", 0],
  38177. ["y-gradient", 0],
  38178. ["invert", 0],
  38179. ["sharpen", 0]
  38180. ],
  38181. "doc": "A list of image filters."
  38182. },
  38183. "comp-op": {
  38184. "css": "comp-op",
  38185. "default-value": "src-over",
  38186. "default-meaning": "add the current layer on top of other layers",
  38187. "doc": "Composite operation. This defines how this layer should behave relative to layers atop or below it.",
  38188. "type": ["clear",
  38189. "src",
  38190. "dst",
  38191. "src-over",
  38192. "dst-over",
  38193. "src-in",
  38194. "dst-in",
  38195. "src-out",
  38196. "dst-out",
  38197. "src-atop",
  38198. "dst-atop",
  38199. "xor",
  38200. "plus",
  38201. "minus",
  38202. "multiply",
  38203. "screen",
  38204. "overlay",
  38205. "darken",
  38206. "lighten",
  38207. "color-dodge",
  38208. "color-burn",
  38209. "hard-light",
  38210. "soft-light",
  38211. "difference",
  38212. "exclusion",
  38213. "contrast",
  38214. "invert",
  38215. "invert-rgb",
  38216. "grain-merge",
  38217. "grain-extract",
  38218. "hue",
  38219. "saturation",
  38220. "color",
  38221. "value"
  38222. ]
  38223. },
  38224. "opacity": {
  38225. "css": "opacity",
  38226. "type": "float",
  38227. "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)",
  38228. "default-value": 1,
  38229. "default-meaning": "no separate buffer will be used and no alpha will be applied to the style after rendering"
  38230. }
  38231. },
  38232. "map": {
  38233. "background-color": {
  38234. "css": "background-color",
  38235. "default-value": "none",
  38236. "default-meaning": "transparent",
  38237. "type": "color",
  38238. "doc": "Map Background color"
  38239. },
  38240. "background-image": {
  38241. "css": "background-image",
  38242. "type": "uri",
  38243. "default-value": "",
  38244. "default-meaning": "transparent",
  38245. "doc": "An image that is repeated below all features on a map as a background.",
  38246. "description": "Map Background image"
  38247. },
  38248. "srs": {
  38249. "css": "srs",
  38250. "type": "string",
  38251. "default-value": "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs",
  38252. "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",
  38253. "doc": "Map spatial reference (proj4 string)"
  38254. },
  38255. "buffer-size": {
  38256. "css": "buffer-size",
  38257. "default-value": "0",
  38258. "type": "float",
  38259. "default-meaning": "No buffer will be used",
  38260. "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\"."
  38261. },
  38262. "maximum-extent": {
  38263. "css": "",
  38264. "default-value": "none",
  38265. "type": "bbox",
  38266. "default-meaning": "No clipping extent will be used",
  38267. "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."
  38268. },
  38269. "base": {
  38270. "css": "base",
  38271. "default-value": "",
  38272. "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.",
  38273. "type": "string",
  38274. "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."
  38275. },
  38276. "paths-from-xml": {
  38277. "css": "",
  38278. "default-value": true,
  38279. "default-meaning": "Paths read from XML will be interpreted from the location of the XML",
  38280. "type": "boolean",
  38281. "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()"
  38282. },
  38283. "minimum-version": {
  38284. "css": "",
  38285. "default-value": "none",
  38286. "default-meaning": "Mapnik version will not be detected and no error will be thrown about compatibility",
  38287. "type": "string",
  38288. "doc": "The minumum Mapnik version (e.g. 0.7.2) needed to use certain functionality in the stylesheet"
  38289. },
  38290. "font-directory": {
  38291. "css": "font-directory",
  38292. "type": "uri",
  38293. "default-value": "none",
  38294. "default-meaning": "No map-specific fonts will be registered",
  38295. "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)."
  38296. }
  38297. },
  38298. "polygon": {
  38299. "fill": {
  38300. "css": "polygon-fill",
  38301. "type": "color",
  38302. "default-value": "rgba(128,128,128,1)",
  38303. "default-meaning": "gray and fully opaque (alpha = 1), same as rgb(128,128,128)",
  38304. "doc": "Fill color to assign to a polygon"
  38305. },
  38306. "fill-opacity": {
  38307. "css": "polygon-opacity",
  38308. "type": "float",
  38309. "doc": "The opacity of the polygon",
  38310. "default-value": 1,
  38311. "default-meaning": "opaque"
  38312. },
  38313. "gamma": {
  38314. "css": "polygon-gamma",
  38315. "type": "float",
  38316. "default-value": 1,
  38317. "default-meaning": "fully antialiased",
  38318. "range": "0-1",
  38319. "doc": "Level of antialiasing of polygon edges"
  38320. },
  38321. "gamma-method": {
  38322. "css": "polygon-gamma-method",
  38323. "type": [
  38324. "power",
  38325. "linear",
  38326. "none",
  38327. "threshold",
  38328. "multiply"
  38329. ],
  38330. "default-value": "power",
  38331. "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",
  38332. "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"
  38333. },
  38334. "clip": {
  38335. "css": "polygon-clip",
  38336. "type": "boolean",
  38337. "default-value": true,
  38338. "default-meaning": "geometry will be clipped to map bounds before rendering",
  38339. "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."
  38340. },
  38341. "smooth": {
  38342. "css": "polygon-smooth",
  38343. "type": "float",
  38344. "default-value": 0,
  38345. "default-meaning": "no smoothing",
  38346. "range": "0-1",
  38347. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  38348. },
  38349. "geometry-transform": {
  38350. "css": "polygon-geometry-transform",
  38351. "type": "functions",
  38352. "default-value": "none",
  38353. "default-meaning": "geometry will not be transformed",
  38354. "doc": "Allows transformation functions to be applied to the geometry.",
  38355. "functions": [
  38356. ["matrix", 6],
  38357. ["translate", 2],
  38358. ["scale", 2],
  38359. ["rotate", 3],
  38360. ["skewX", 1],
  38361. ["skewY", 1]
  38362. ]
  38363. },
  38364. "comp-op": {
  38365. "css": "polygon-comp-op",
  38366. "default-value": "src-over",
  38367. "default-meaning": "add the current symbolizer on top of other symbolizer",
  38368. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  38369. "type": ["clear",
  38370. "src",
  38371. "dst",
  38372. "src-over",
  38373. "dst-over",
  38374. "src-in",
  38375. "dst-in",
  38376. "src-out",
  38377. "dst-out",
  38378. "src-atop",
  38379. "dst-atop",
  38380. "xor",
  38381. "plus",
  38382. "minus",
  38383. "multiply",
  38384. "screen",
  38385. "overlay",
  38386. "darken",
  38387. "lighten",
  38388. "color-dodge",
  38389. "color-burn",
  38390. "hard-light",
  38391. "soft-light",
  38392. "difference",
  38393. "exclusion",
  38394. "contrast",
  38395. "invert",
  38396. "invert-rgb",
  38397. "grain-merge",
  38398. "grain-extract",
  38399. "hue",
  38400. "saturation",
  38401. "color",
  38402. "value"
  38403. ]
  38404. }
  38405. },
  38406. "line": {
  38407. "stroke": {
  38408. "css": "line-color",
  38409. "default-value": "rgba(0,0,0,1)",
  38410. "type": "color",
  38411. "default-meaning": "black and fully opaque (alpha = 1), same as rgb(0,0,0)",
  38412. "doc": "The color of a drawn line"
  38413. },
  38414. "stroke-width": {
  38415. "css": "line-width",
  38416. "default-value": 1,
  38417. "type": "float",
  38418. "doc": "The width of a line in pixels"
  38419. },
  38420. "stroke-opacity": {
  38421. "css": "line-opacity",
  38422. "default-value": 1,
  38423. "type": "float",
  38424. "default-meaning": "opaque",
  38425. "doc": "The opacity of a line"
  38426. },
  38427. "stroke-linejoin": {
  38428. "css": "line-join",
  38429. "default-value": "miter",
  38430. "type": [
  38431. "miter",
  38432. "round",
  38433. "bevel"
  38434. ],
  38435. "doc": "The behavior of lines when joining"
  38436. },
  38437. "stroke-linecap": {
  38438. "css": "line-cap",
  38439. "default-value": "butt",
  38440. "type": [
  38441. "butt",
  38442. "round",
  38443. "square"
  38444. ],
  38445. "doc": "The display of line endings"
  38446. },
  38447. "stroke-gamma": {
  38448. "css": "line-gamma",
  38449. "type": "float",
  38450. "default-value": 1,
  38451. "default-meaning": "fully antialiased",
  38452. "range": "0-1",
  38453. "doc": "Level of antialiasing of stroke line"
  38454. },
  38455. "stroke-gamma-method": {
  38456. "css": "line-gamma-method",
  38457. "type": [
  38458. "power",
  38459. "linear",
  38460. "none",
  38461. "threshold",
  38462. "multiply"
  38463. ],
  38464. "default-value": "power",
  38465. "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",
  38466. "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"
  38467. },
  38468. "stroke-dasharray": {
  38469. "css": "line-dasharray",
  38470. "type": "numbers",
  38471. "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.",
  38472. "default-value": "none",
  38473. "default-meaning": "solid line"
  38474. },
  38475. "stroke-dashoffset": {
  38476. "css": "line-dash-offset",
  38477. "type": "numbers",
  38478. "doc": "valid parameter but not currently used in renderers (only exists for experimental svg support in Mapnik which is not yet enabled)",
  38479. "default-value": "none",
  38480. "default-meaning": "solid line"
  38481. },
  38482. "stroke-miterlimit": {
  38483. "css": "line-miterlimit",
  38484. "type": "float",
  38485. "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.",
  38486. "default-value": 4.0,
  38487. "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 )'"
  38488. },
  38489. "clip": {
  38490. "css": "line-clip",
  38491. "type": "boolean",
  38492. "default-value": true,
  38493. "default-meaning": "geometry will be clipped to map bounds before rendering",
  38494. "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."
  38495. },
  38496. "smooth": {
  38497. "css": "line-smooth",
  38498. "type": "float",
  38499. "default-value": 0,
  38500. "default-meaning": "no smoothing",
  38501. "range": "0-1",
  38502. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  38503. },
  38504. "offset": {
  38505. "css": "line-offset",
  38506. "type": "float",
  38507. "default-value": 0,
  38508. "default-meaning": "no offset",
  38509. "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)."
  38510. },
  38511. "rasterizer": {
  38512. "css": "line-rasterizer",
  38513. "type": [
  38514. "full",
  38515. "fast"
  38516. ],
  38517. "default-value": "full",
  38518. "doc": "Exposes an alternate AGG rendering method that sacrifices some accuracy for speed."
  38519. },
  38520. "geometry-transform": {
  38521. "css": "line-geometry-transform",
  38522. "type": "functions",
  38523. "default-value": "none",
  38524. "default-meaning": "geometry will not be transformed",
  38525. "doc": "Allows transformation functions to be applied to the geometry.",
  38526. "functions": [
  38527. ["matrix", 6],
  38528. ["translate", 2],
  38529. ["scale", 2],
  38530. ["rotate", 3],
  38531. ["skewX", 1],
  38532. ["skewY", 1]
  38533. ]
  38534. },
  38535. "comp-op": {
  38536. "css": "line-comp-op",
  38537. "default-value": "src-over",
  38538. "default-meaning": "add the current symbolizer on top of other symbolizer",
  38539. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  38540. "type": ["clear",
  38541. "src",
  38542. "dst",
  38543. "src-over",
  38544. "dst-over",
  38545. "src-in",
  38546. "dst-in",
  38547. "src-out",
  38548. "dst-out",
  38549. "src-atop",
  38550. "dst-atop",
  38551. "xor",
  38552. "plus",
  38553. "minus",
  38554. "multiply",
  38555. "screen",
  38556. "overlay",
  38557. "darken",
  38558. "lighten",
  38559. "color-dodge",
  38560. "color-burn",
  38561. "hard-light",
  38562. "soft-light",
  38563. "difference",
  38564. "exclusion",
  38565. "contrast",
  38566. "invert",
  38567. "invert-rgb",
  38568. "grain-merge",
  38569. "grain-extract",
  38570. "hue",
  38571. "saturation",
  38572. "color",
  38573. "value"
  38574. ]
  38575. }
  38576. },
  38577. "markers": {
  38578. "file": {
  38579. "css": "marker-file",
  38580. "doc": "An SVG file that this marker shows at each placement. If no file is given, the marker will show an ellipse.",
  38581. "default-value": "",
  38582. "default-meaning": "An ellipse or circle, if width equals height",
  38583. "type": "uri"
  38584. },
  38585. "opacity": {
  38586. "css": "marker-opacity",
  38587. "doc": "The overall opacity of the marker, if set, overrides both the opacity of both the fill and stroke",
  38588. "default-value": 1,
  38589. "default-meaning": "The stroke-opacity and fill-opacity will be used",
  38590. "type": "float"
  38591. },
  38592. "fill-opacity": {
  38593. "css": "marker-fill-opacity",
  38594. "doc": "The fill opacity of the marker",
  38595. "default-value": 1,
  38596. "default-meaning": "opaque",
  38597. "type": "float"
  38598. },
  38599. "stroke": {
  38600. "css": "marker-line-color",
  38601. "doc": "The color of the stroke around a marker shape.",
  38602. "default-value": "black",
  38603. "type": "color"
  38604. },
  38605. "stroke-width": {
  38606. "css": "marker-line-width",
  38607. "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.",
  38608. "type": "float"
  38609. },
  38610. "stroke-opacity": {
  38611. "css": "marker-line-opacity",
  38612. "default-value": 1,
  38613. "default-meaning": "opaque",
  38614. "doc": "The opacity of a line",
  38615. "type": "float"
  38616. },
  38617. "placement": {
  38618. "css": "marker-placement",
  38619. "type": [
  38620. "point",
  38621. "line",
  38622. "interior"
  38623. ],
  38624. "default-value": "point",
  38625. "default-meaning": "Place markers at the center point (centroid) of the geometry",
  38626. "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"
  38627. },
  38628. "multi-policy": {
  38629. "css": "marker-multi-policy",
  38630. "type": [
  38631. "each",
  38632. "whole",
  38633. "largest"
  38634. ],
  38635. "default-value": "each",
  38636. "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",
  38637. "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)."
  38638. },
  38639. "marker-type": {
  38640. "css": "marker-type",
  38641. "type": [
  38642. "arrow",
  38643. "ellipse"
  38644. ],
  38645. "default-value": "ellipse",
  38646. "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)"
  38647. },
  38648. "width": {
  38649. "css": "marker-width",
  38650. "default-value": 10,
  38651. "doc": "The width of the marker, if using one of the default types.",
  38652. "type": "expression"
  38653. },
  38654. "height": {
  38655. "css": "marker-height",
  38656. "default-value": 10,
  38657. "doc": "The height of the marker, if using one of the default types.",
  38658. "type": "expression"
  38659. },
  38660. "fill": {
  38661. "css": "marker-fill",
  38662. "default-value": "blue",
  38663. "doc": "The color of the area of the marker.",
  38664. "type": "color"
  38665. },
  38666. "allow-overlap": {
  38667. "css": "marker-allow-overlap",
  38668. "type": "boolean",
  38669. "default-value": false,
  38670. "doc": "Control whether overlapping markers are shown or hidden.",
  38671. "default-meaning": "Do not allow makers to overlap with each other - overlapping markers will not be shown."
  38672. },
  38673. "ignore-placement": {
  38674. "css": "marker-ignore-placement",
  38675. "type": "boolean",
  38676. "default-value": false,
  38677. "default-meaning": "do not store the bbox of this geometry in the collision detector cache",
  38678. "doc": "value to control whether the placement of the feature will prevent the placement of other features"
  38679. },
  38680. "spacing": {
  38681. "css": "marker-spacing",
  38682. "doc": "Space between repeated labels",
  38683. "default-value": 100,
  38684. "type": "float"
  38685. },
  38686. "max-error": {
  38687. "css": "marker-max-error",
  38688. "type": "float",
  38689. "default-value": 0.2,
  38690. "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."
  38691. },
  38692. "transform": {
  38693. "css": "marker-transform",
  38694. "type": "functions",
  38695. "functions": [
  38696. ["matrix", 6],
  38697. ["translate", 2],
  38698. ["scale", 2],
  38699. ["rotate", 3],
  38700. ["skewX", 1],
  38701. ["skewY", 1]
  38702. ],
  38703. "default-value": "",
  38704. "default-meaning": "No transformation",
  38705. "doc": "SVG transformation definition"
  38706. },
  38707. "clip": {
  38708. "css": "marker-clip",
  38709. "type": "boolean",
  38710. "default-value": true,
  38711. "default-meaning": "geometry will be clipped to map bounds before rendering",
  38712. "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."
  38713. },
  38714. "smooth": {
  38715. "css": "marker-smooth",
  38716. "type": "float",
  38717. "default-value": 0,
  38718. "default-meaning": "no smoothing",
  38719. "range": "0-1",
  38720. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  38721. },
  38722. "geometry-transform": {
  38723. "css": "marker-geometry-transform",
  38724. "type": "functions",
  38725. "default-value": "none",
  38726. "default-meaning": "geometry will not be transformed",
  38727. "doc": "Allows transformation functions to be applied to the geometry.",
  38728. "functions": [
  38729. ["matrix", 6],
  38730. ["translate", 2],
  38731. ["scale", 2],
  38732. ["rotate", 3],
  38733. ["skewX", 1],
  38734. ["skewY", 1]
  38735. ]
  38736. },
  38737. "comp-op": {
  38738. "css": "marker-comp-op",
  38739. "default-value": "src-over",
  38740. "default-meaning": "add the current symbolizer on top of other symbolizer",
  38741. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  38742. "type": ["clear",
  38743. "src",
  38744. "dst",
  38745. "src-over",
  38746. "dst-over",
  38747. "src-in",
  38748. "dst-in",
  38749. "src-out",
  38750. "dst-out",
  38751. "src-atop",
  38752. "dst-atop",
  38753. "xor",
  38754. "plus",
  38755. "minus",
  38756. "multiply",
  38757. "screen",
  38758. "overlay",
  38759. "darken",
  38760. "lighten",
  38761. "color-dodge",
  38762. "color-burn",
  38763. "hard-light",
  38764. "soft-light",
  38765. "difference",
  38766. "exclusion",
  38767. "contrast",
  38768. "invert",
  38769. "invert-rgb",
  38770. "grain-merge",
  38771. "grain-extract",
  38772. "hue",
  38773. "saturation",
  38774. "color",
  38775. "value"
  38776. ]
  38777. }
  38778. },
  38779. "shield": {
  38780. "name": {
  38781. "css": "shield-name",
  38782. "type": "expression",
  38783. "serialization": "content",
  38784. "doc": "Value to use for a shield\"s text label. Data columns are specified using brackets like [column_name]"
  38785. },
  38786. "file": {
  38787. "css": "shield-file",
  38788. "required": true,
  38789. "type": "uri",
  38790. "default-value": "none",
  38791. "doc": "Image file to render behind the shield text"
  38792. },
  38793. "face-name": {
  38794. "css": "shield-face-name",
  38795. "type": "string",
  38796. "validate": "font",
  38797. "doc": "Font name and style to use for the shield text",
  38798. "default-value": "",
  38799. "required": true
  38800. },
  38801. "unlock-image": {
  38802. "css": "shield-unlock-image",
  38803. "type": "boolean",
  38804. "doc": "This parameter should be set to true if you are trying to position text beside rather than on top of the shield image",
  38805. "default-value": false,
  38806. "default-meaning": "text alignment relative to the shield image uses the center of the image as the anchor for text positioning."
  38807. },
  38808. "size": {
  38809. "css": "shield-size",
  38810. "type": "float",
  38811. "doc": "The size of the shield text in pixels"
  38812. },
  38813. "fill": {
  38814. "css": "shield-fill",
  38815. "type": "color",
  38816. "doc": "The color of the shield text"
  38817. },
  38818. "placement": {
  38819. "css": "shield-placement",
  38820. "type": [
  38821. "point",
  38822. "line",
  38823. "vertex",
  38824. "interior"
  38825. ],
  38826. "default-value": "point",
  38827. "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."
  38828. },
  38829. "avoid-edges": {
  38830. "css": "shield-avoid-edges",
  38831. "doc": "Tell positioning algorithm to avoid labeling near intersection edges.",
  38832. "type": "boolean",
  38833. "default-value": false
  38834. },
  38835. "allow-overlap": {
  38836. "css": "shield-allow-overlap",
  38837. "type": "boolean",
  38838. "default-value": false,
  38839. "doc": "Control whether overlapping shields are shown or hidden.",
  38840. "default-meaning": "Do not allow shields to overlap with other map elements already placed."
  38841. },
  38842. "minimum-distance": {
  38843. "css": "shield-min-distance",
  38844. "type": "float",
  38845. "default-value": 0,
  38846. "doc": "Minimum distance to the next shield symbol, not necessarily the same shield."
  38847. },
  38848. "spacing": {
  38849. "css": "shield-spacing",
  38850. "type": "float",
  38851. "default-value": 0,
  38852. "doc": "The spacing between repeated occurrences of the same shield on a line"
  38853. },
  38854. "minimum-padding": {
  38855. "css": "shield-min-padding",
  38856. "default-value": 0,
  38857. "doc": "Determines the minimum amount of padding that a shield gets relative to other shields",
  38858. "type": "float"
  38859. },
  38860. "wrap-width": {
  38861. "css": "shield-wrap-width",
  38862. "type": "unsigned",
  38863. "default-value": 0,
  38864. "doc": "Length of a chunk of text in characters before wrapping text"
  38865. },
  38866. "wrap-before": {
  38867. "css": "shield-wrap-before",
  38868. "type": "boolean",
  38869. "default-value": false,
  38870. "doc": "Wrap text before wrap-width is reached. If false, wrapped lines will be a bit longer than wrap-width."
  38871. },
  38872. "wrap-character": {
  38873. "css": "shield-wrap-character",
  38874. "type": "string",
  38875. "default-value": " ",
  38876. "doc": "Use this character instead of a space to wrap long names."
  38877. },
  38878. "halo-fill": {
  38879. "css": "shield-halo-fill",
  38880. "type": "color",
  38881. "default-value": "#FFFFFF",
  38882. "default-meaning": "white",
  38883. "doc": "Specifies the color of the halo around the text."
  38884. },
  38885. "halo-radius": {
  38886. "css": "shield-halo-radius",
  38887. "doc": "Specify the radius of the halo in pixels",
  38888. "default-value": 0,
  38889. "default-meaning": "no halo",
  38890. "type": "float"
  38891. },
  38892. "character-spacing": {
  38893. "css": "shield-character-spacing",
  38894. "type": "unsigned",
  38895. "default-value": 0,
  38896. "doc": "Horizontal spacing between characters (in pixels). Currently works for point placement only, not line placement."
  38897. },
  38898. "line-spacing": {
  38899. "css": "shield-line-spacing",
  38900. "doc": "Vertical spacing between lines of multiline labels (in pixels)",
  38901. "type": "unsigned"
  38902. },
  38903. "dx": {
  38904. "css": "shield-text-dx",
  38905. "type": "float",
  38906. "doc": "Displace text within shield by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right",
  38907. "default-value": 0
  38908. },
  38909. "dy": {
  38910. "css": "shield-text-dy",
  38911. "type": "float",
  38912. "doc": "Displace text within shield by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down",
  38913. "default-value": 0
  38914. },
  38915. "shield-dx": {
  38916. "css": "shield-dx",
  38917. "type": "float",
  38918. "doc": "Displace shield by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right",
  38919. "default-value": 0
  38920. },
  38921. "shield-dy": {
  38922. "css": "shield-dy",
  38923. "type": "float",
  38924. "doc": "Displace shield by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down",
  38925. "default-value": 0
  38926. },
  38927. "opacity": {
  38928. "css": "shield-opacity",
  38929. "type": "float",
  38930. "doc": "(Default 1.0) - opacity of the image used for the shield",
  38931. "default-value": 1
  38932. },
  38933. "text-opacity": {
  38934. "css": "shield-text-opacity",
  38935. "type": "float",
  38936. "doc": "(Default 1.0) - opacity of the text placed on top of the shield",
  38937. "default-value": 1
  38938. },
  38939. "horizontal-alignment": {
  38940. "css": "shield-horizontal-alignment",
  38941. "type": [
  38942. "left",
  38943. "middle",
  38944. "right",
  38945. "auto"
  38946. ],
  38947. "doc": "The shield's horizontal alignment from its centerpoint",
  38948. "default-value": "auto"
  38949. },
  38950. "vertical-alignment": {
  38951. "css": "shield-vertical-alignment",
  38952. "type": [
  38953. "top",
  38954. "middle",
  38955. "bottom",
  38956. "auto"
  38957. ],
  38958. "doc": "The shield's vertical alignment from its centerpoint",
  38959. "default-value": "middle"
  38960. },
  38961. "text-transform": {
  38962. "css": "shield-text-transform",
  38963. "type": [
  38964. "none",
  38965. "uppercase",
  38966. "lowercase",
  38967. "capitalize"
  38968. ],
  38969. "doc": "Transform the case of the characters",
  38970. "default-value": "none"
  38971. },
  38972. "justify-alignment": {
  38973. "css": "shield-justify-alignment",
  38974. "type": [
  38975. "left",
  38976. "center",
  38977. "right",
  38978. "auto"
  38979. ],
  38980. "doc": "Define how text in a shield's label is justified",
  38981. "default-value": "auto"
  38982. },
  38983. "clip": {
  38984. "css": "shield-clip",
  38985. "type": "boolean",
  38986. "default-value": true,
  38987. "default-meaning": "geometry will be clipped to map bounds before rendering",
  38988. "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."
  38989. },
  38990. "comp-op": {
  38991. "css": "shield-comp-op",
  38992. "default-value": "src-over",
  38993. "default-meaning": "add the current symbolizer on top of other symbolizer",
  38994. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  38995. "type": ["clear",
  38996. "src",
  38997. "dst",
  38998. "src-over",
  38999. "dst-over",
  39000. "src-in",
  39001. "dst-in",
  39002. "src-out",
  39003. "dst-out",
  39004. "src-atop",
  39005. "dst-atop",
  39006. "xor",
  39007. "plus",
  39008. "minus",
  39009. "multiply",
  39010. "screen",
  39011. "overlay",
  39012. "darken",
  39013. "lighten",
  39014. "color-dodge",
  39015. "color-burn",
  39016. "hard-light",
  39017. "soft-light",
  39018. "difference",
  39019. "exclusion",
  39020. "contrast",
  39021. "invert",
  39022. "invert-rgb",
  39023. "grain-merge",
  39024. "grain-extract",
  39025. "hue",
  39026. "saturation",
  39027. "color",
  39028. "value"
  39029. ]
  39030. }
  39031. },
  39032. "line-pattern": {
  39033. "file": {
  39034. "css": "line-pattern-file",
  39035. "type": "uri",
  39036. "default-value": "none",
  39037. "required": true,
  39038. "doc": "An image file to be repeated and warped along a line"
  39039. },
  39040. "clip": {
  39041. "css": "line-pattern-clip",
  39042. "type": "boolean",
  39043. "default-value": true,
  39044. "default-meaning": "geometry will be clipped to map bounds before rendering",
  39045. "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."
  39046. },
  39047. "smooth": {
  39048. "css": "line-pattern-smooth",
  39049. "type": "float",
  39050. "default-value": 0,
  39051. "default-meaning": "no smoothing",
  39052. "range": "0-1",
  39053. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  39054. },
  39055. "geometry-transform": {
  39056. "css": "line-pattern-geometry-transform",
  39057. "type": "functions",
  39058. "default-value": "none",
  39059. "default-meaning": "geometry will not be transformed",
  39060. "doc": "Allows transformation functions to be applied to the geometry.",
  39061. "functions": [
  39062. ["matrix", 6],
  39063. ["translate", 2],
  39064. ["scale", 2],
  39065. ["rotate", 3],
  39066. ["skewX", 1],
  39067. ["skewY", 1]
  39068. ]
  39069. },
  39070. "comp-op": {
  39071. "css": "line-pattern-comp-op",
  39072. "default-value": "src-over",
  39073. "default-meaning": "add the current symbolizer on top of other symbolizer",
  39074. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  39075. "type": ["clear",
  39076. "src",
  39077. "dst",
  39078. "src-over",
  39079. "dst-over",
  39080. "src-in",
  39081. "dst-in",
  39082. "src-out",
  39083. "dst-out",
  39084. "src-atop",
  39085. "dst-atop",
  39086. "xor",
  39087. "plus",
  39088. "minus",
  39089. "multiply",
  39090. "screen",
  39091. "overlay",
  39092. "darken",
  39093. "lighten",
  39094. "color-dodge",
  39095. "color-burn",
  39096. "hard-light",
  39097. "soft-light",
  39098. "difference",
  39099. "exclusion",
  39100. "contrast",
  39101. "invert",
  39102. "invert-rgb",
  39103. "grain-merge",
  39104. "grain-extract",
  39105. "hue",
  39106. "saturation",
  39107. "color",
  39108. "value"
  39109. ]
  39110. }
  39111. },
  39112. "polygon-pattern": {
  39113. "file": {
  39114. "css": "polygon-pattern-file",
  39115. "type": "uri",
  39116. "default-value": "none",
  39117. "required": true,
  39118. "doc": "Image to use as a repeated pattern fill within a polygon"
  39119. },
  39120. "alignment": {
  39121. "css": "polygon-pattern-alignment",
  39122. "type": [
  39123. "local",
  39124. "global"
  39125. ],
  39126. "default-value": "local",
  39127. "doc": "Specify whether to align pattern fills to the layer or to the map."
  39128. },
  39129. "gamma": {
  39130. "css": "polygon-pattern-gamma",
  39131. "type": "float",
  39132. "default-value": 1,
  39133. "default-meaning": "fully antialiased",
  39134. "range": "0-1",
  39135. "doc": "Level of antialiasing of polygon pattern edges"
  39136. },
  39137. "opacity": {
  39138. "css": "polygon-pattern-opacity",
  39139. "type": "float",
  39140. "doc": "(Default 1.0) - Apply an opacity level to the image used for the pattern",
  39141. "default-value": 1,
  39142. "default-meaning": "The image is rendered without modifications"
  39143. },
  39144. "clip": {
  39145. "css": "polygon-pattern-clip",
  39146. "type": "boolean",
  39147. "default-value": true,
  39148. "default-meaning": "geometry will be clipped to map bounds before rendering",
  39149. "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."
  39150. },
  39151. "smooth": {
  39152. "css": "polygon-pattern-smooth",
  39153. "type": "float",
  39154. "default-value": 0,
  39155. "default-meaning": "no smoothing",
  39156. "range": "0-1",
  39157. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  39158. },
  39159. "geometry-transform": {
  39160. "css": "polygon-pattern-geometry-transform",
  39161. "type": "functions",
  39162. "default-value": "none",
  39163. "default-meaning": "geometry will not be transformed",
  39164. "doc": "Allows transformation functions to be applied to the geometry.",
  39165. "functions": [
  39166. ["matrix", 6],
  39167. ["translate", 2],
  39168. ["scale", 2],
  39169. ["rotate", 3],
  39170. ["skewX", 1],
  39171. ["skewY", 1]
  39172. ]
  39173. },
  39174. "comp-op": {
  39175. "css": "polygon-pattern-comp-op",
  39176. "default-value": "src-over",
  39177. "default-meaning": "add the current symbolizer on top of other symbolizer",
  39178. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  39179. "type": ["clear",
  39180. "src",
  39181. "dst",
  39182. "src-over",
  39183. "dst-over",
  39184. "src-in",
  39185. "dst-in",
  39186. "src-out",
  39187. "dst-out",
  39188. "src-atop",
  39189. "dst-atop",
  39190. "xor",
  39191. "plus",
  39192. "minus",
  39193. "multiply",
  39194. "screen",
  39195. "overlay",
  39196. "darken",
  39197. "lighten",
  39198. "color-dodge",
  39199. "color-burn",
  39200. "hard-light",
  39201. "soft-light",
  39202. "difference",
  39203. "exclusion",
  39204. "contrast",
  39205. "invert",
  39206. "invert-rgb",
  39207. "grain-merge",
  39208. "grain-extract",
  39209. "hue",
  39210. "saturation",
  39211. "color",
  39212. "value"
  39213. ]
  39214. }
  39215. },
  39216. "raster": {
  39217. "opacity": {
  39218. "css": "raster-opacity",
  39219. "default-value": 1,
  39220. "default-meaning": "opaque",
  39221. "type": "float",
  39222. "doc": "The opacity of the raster symbolizer on top of other symbolizers."
  39223. },
  39224. "filter-factor": {
  39225. "css": "raster-filter-factor",
  39226. "default-value": -1,
  39227. "default-meaning": "Allow the datasource to choose appropriate downscaling.",
  39228. "type": "float",
  39229. "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."
  39230. },
  39231. "scaling": {
  39232. "css": "raster-scaling",
  39233. "type": [
  39234. "near",
  39235. "fast",
  39236. "bilinear",
  39237. "bilinear8",
  39238. "bicubic",
  39239. "spline16",
  39240. "spline36",
  39241. "hanning",
  39242. "hamming",
  39243. "hermite",
  39244. "kaiser",
  39245. "quadric",
  39246. "catrom",
  39247. "gaussian",
  39248. "bessel",
  39249. "mitchell",
  39250. "sinc",
  39251. "lanczos",
  39252. "blackman"
  39253. ],
  39254. "default-value": "near",
  39255. "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."
  39256. },
  39257. "mesh-size": {
  39258. "css": "raster-mesh-size",
  39259. "default-value": 16,
  39260. "default-meaning": "Reprojection mesh will be 1/16 of the resolution of the source image",
  39261. "type": "unsigned",
  39262. "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."
  39263. },
  39264. "comp-op": {
  39265. "css": "raster-comp-op",
  39266. "default-value": "src-over",
  39267. "default-meaning": "add the current symbolizer on top of other symbolizer",
  39268. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  39269. "type": ["clear",
  39270. "src",
  39271. "dst",
  39272. "src-over",
  39273. "dst-over",
  39274. "src-in",
  39275. "dst-in",
  39276. "src-out",
  39277. "dst-out",
  39278. "src-atop",
  39279. "dst-atop",
  39280. "xor",
  39281. "plus",
  39282. "minus",
  39283. "multiply",
  39284. "screen",
  39285. "overlay",
  39286. "darken",
  39287. "lighten",
  39288. "color-dodge",
  39289. "color-burn",
  39290. "hard-light",
  39291. "soft-light",
  39292. "difference",
  39293. "exclusion",
  39294. "contrast",
  39295. "invert",
  39296. "invert-rgb",
  39297. "grain-merge",
  39298. "grain-extract",
  39299. "hue",
  39300. "saturation",
  39301. "color",
  39302. "value"
  39303. ]
  39304. }
  39305. },
  39306. "point": {
  39307. "file": {
  39308. "css": "point-file",
  39309. "type": "uri",
  39310. "required": false,
  39311. "default-value": "none",
  39312. "doc": "Image file to represent a point"
  39313. },
  39314. "allow-overlap": {
  39315. "css": "point-allow-overlap",
  39316. "type": "boolean",
  39317. "default-value": false,
  39318. "doc": "Control whether overlapping points are shown or hidden.",
  39319. "default-meaning": "Do not allow points to overlap with each other - overlapping markers will not be shown."
  39320. },
  39321. "ignore-placement": {
  39322. "css": "point-ignore-placement",
  39323. "type": "boolean",
  39324. "default-value": false,
  39325. "default-meaning": "do not store the bbox of this geometry in the collision detector cache",
  39326. "doc": "value to control whether the placement of the feature will prevent the placement of other features"
  39327. },
  39328. "opacity": {
  39329. "css": "point-opacity",
  39330. "type": "float",
  39331. "default-value": 1.0,
  39332. "default-meaning": "Fully opaque",
  39333. "doc": "A value from 0 to 1 to control the opacity of the point"
  39334. },
  39335. "placement": {
  39336. "css": "point-placement",
  39337. "type": [
  39338. "centroid",
  39339. "interior"
  39340. ],
  39341. "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.",
  39342. "default-value": "centroid"
  39343. },
  39344. "transform": {
  39345. "css": "point-transform",
  39346. "type": "functions",
  39347. "functions": [
  39348. ["matrix", 6],
  39349. ["translate", 2],
  39350. ["scale", 2],
  39351. ["rotate", 3],
  39352. ["skewX", 1],
  39353. ["skewY", 1]
  39354. ],
  39355. "default-value": "",
  39356. "default-meaning": "No transformation",
  39357. "doc": "SVG transformation definition"
  39358. },
  39359. "comp-op": {
  39360. "css": "point-comp-op",
  39361. "default-value": "src-over",
  39362. "default-meaning": "add the current symbolizer on top of other symbolizer",
  39363. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  39364. "type": ["clear",
  39365. "src",
  39366. "dst",
  39367. "src-over",
  39368. "dst-over",
  39369. "src-in",
  39370. "dst-in",
  39371. "src-out",
  39372. "dst-out",
  39373. "src-atop",
  39374. "dst-atop",
  39375. "xor",
  39376. "plus",
  39377. "minus",
  39378. "multiply",
  39379. "screen",
  39380. "overlay",
  39381. "darken",
  39382. "lighten",
  39383. "color-dodge",
  39384. "color-burn",
  39385. "hard-light",
  39386. "soft-light",
  39387. "difference",
  39388. "exclusion",
  39389. "contrast",
  39390. "invert",
  39391. "invert-rgb",
  39392. "grain-merge",
  39393. "grain-extract",
  39394. "hue",
  39395. "saturation",
  39396. "color",
  39397. "value"
  39398. ]
  39399. }
  39400. },
  39401. "text": {
  39402. "name": {
  39403. "css": "text-name",
  39404. "type": "expression",
  39405. "required": true,
  39406. "default-value": "",
  39407. "serialization": "content",
  39408. "doc": "Value to use for a text label. Data columns are specified using brackets like [column_name]"
  39409. },
  39410. "face-name": {
  39411. "css": "text-face-name",
  39412. "type": "string",
  39413. "validate": "font",
  39414. "doc": "Font name and style to render a label in",
  39415. "required": true
  39416. },
  39417. "size": {
  39418. "css": "text-size",
  39419. "type": "float",
  39420. "default-value": 10,
  39421. "doc": "Text size in pixels"
  39422. },
  39423. "text-ratio": {
  39424. "css": "text-ratio",
  39425. "doc": "Define the amount of text (of the total) present on successive lines when wrapping occurs",
  39426. "default-value": 0,
  39427. "type": "unsigned"
  39428. },
  39429. "wrap-width": {
  39430. "css": "text-wrap-width",
  39431. "doc": "Length of a chunk of text in characters before wrapping text",
  39432. "default-value": 0,
  39433. "type": "unsigned"
  39434. },
  39435. "wrap-before": {
  39436. "css": "text-wrap-before",
  39437. "type": "boolean",
  39438. "default-value": false,
  39439. "doc": "Wrap text before wrap-width is reached. If false, wrapped lines will be a bit longer than wrap-width."
  39440. },
  39441. "wrap-character": {
  39442. "css": "text-wrap-character",
  39443. "type": "string",
  39444. "default-value": " ",
  39445. "doc": "Use this character instead of a space to wrap long text."
  39446. },
  39447. "spacing": {
  39448. "css": "text-spacing",
  39449. "type": "unsigned",
  39450. "doc": "Distance between repeated text labels on a line (aka. label-spacing)"
  39451. },
  39452. "character-spacing": {
  39453. "css": "text-character-spacing",
  39454. "type": "float",
  39455. "default-value": 0,
  39456. "doc": "Horizontal spacing adjustment between characters in pixels"
  39457. },
  39458. "line-spacing": {
  39459. "css": "text-line-spacing",
  39460. "default-value": 0,
  39461. "type": "unsigned",
  39462. "doc": "Vertical spacing adjustment between lines in pixels"
  39463. },
  39464. "label-position-tolerance": {
  39465. "css": "text-label-position-tolerance",
  39466. "default-value": 0,
  39467. "type": "unsigned",
  39468. "doc": "Allows the label to be displaced from its ideal position by a number of pixels (only works with placement:line)"
  39469. },
  39470. "max-char-angle-delta": {
  39471. "css": "text-max-char-angle-delta",
  39472. "type": "float",
  39473. "default-value": "22.5",
  39474. "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."
  39475. },
  39476. "fill": {
  39477. "css": "text-fill",
  39478. "doc": "Specifies the color for the text",
  39479. "default-value": "#000000",
  39480. "type": "color"
  39481. },
  39482. "opacity": {
  39483. "css": "text-opacity",
  39484. "doc": "A number from 0 to 1 specifying the opacity for the text",
  39485. "default-value": 1.0,
  39486. "default-meaning": "Fully opaque",
  39487. "type": "float"
  39488. },
  39489. "halo-fill": {
  39490. "css": "text-halo-fill",
  39491. "type": "color",
  39492. "default-value": "#FFFFFF",
  39493. "default-meaning": "white",
  39494. "doc": "Specifies the color of the halo around the text."
  39495. },
  39496. "halo-radius": {
  39497. "css": "text-halo-radius",
  39498. "doc": "Specify the radius of the halo in pixels",
  39499. "default-value": 0,
  39500. "default-meaning": "no halo",
  39501. "type": "float"
  39502. },
  39503. "dx": {
  39504. "css": "text-dx",
  39505. "type": "float",
  39506. "doc": "Displace text by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right",
  39507. "default-value": 0
  39508. },
  39509. "dy": {
  39510. "css": "text-dy",
  39511. "type": "float",
  39512. "doc": "Displace text by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down",
  39513. "default-value": 0
  39514. },
  39515. "vertical-alignment": {
  39516. "css": "text-vertical-alignment",
  39517. "type": [
  39518. "top",
  39519. "middle",
  39520. "bottom",
  39521. "auto"
  39522. ],
  39523. "doc": "Position of label relative to point position.",
  39524. "default-value": "auto",
  39525. "default-meaning": "Default affected by value of dy; \"bottom\" for dy>0, \"top\" for dy<0."
  39526. },
  39527. "avoid-edges": {
  39528. "css": "text-avoid-edges",
  39529. "doc": "Tell positioning algorithm to avoid labeling near intersection edges.",
  39530. "default-value": false,
  39531. "type": "boolean"
  39532. },
  39533. "minimum-distance": {
  39534. "css": "text-min-distance",
  39535. "doc": "Minimum permitted distance to the next text symbolizer.",
  39536. "type": "float"
  39537. },
  39538. "minimum-padding": {
  39539. "css": "text-min-padding",
  39540. "doc": "Determines the minimum amount of padding that a text symbolizer gets relative to other text",
  39541. "type": "float"
  39542. },
  39543. "minimum-path-length": {
  39544. "css": "text-min-path-length",
  39545. "type": "float",
  39546. "default-value": 0,
  39547. "default-meaning": "place labels on all paths",
  39548. "doc": "Place labels only on paths longer than this value."
  39549. },
  39550. "allow-overlap": {
  39551. "css": "text-allow-overlap",
  39552. "type": "boolean",
  39553. "default-value": false,
  39554. "doc": "Control whether overlapping text is shown or hidden.",
  39555. "default-meaning": "Do not allow text to overlap with other text - overlapping markers will not be shown."
  39556. },
  39557. "orientation": {
  39558. "css": "text-orientation",
  39559. "type": "expression",
  39560. "doc": "Rotate the text."
  39561. },
  39562. "placement": {
  39563. "css": "text-placement",
  39564. "type": [
  39565. "point",
  39566. "line",
  39567. "vertex",
  39568. "interior"
  39569. ],
  39570. "default-value": "point",
  39571. "doc": "Control the style of placement of a point versus the geometry it is attached to."
  39572. },
  39573. "placement-type": {
  39574. "css": "text-placement-type",
  39575. "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.",
  39576. "type": [
  39577. "dummy",
  39578. "simple"
  39579. ],
  39580. "default-value": "dummy"
  39581. },
  39582. "placements": {
  39583. "css": "text-placements",
  39584. "type": "string",
  39585. "default-value": "",
  39586. "doc": "If \"placement-type\" is set to \"simple\", use this \"POSITIONS,[SIZES]\" string. An example is `text-placements: \"E,NE,SE,W,NW,SW\";` "
  39587. },
  39588. "text-transform": {
  39589. "css": "text-transform",
  39590. "type": [
  39591. "none",
  39592. "uppercase",
  39593. "lowercase",
  39594. "capitalize"
  39595. ],
  39596. "doc": "Transform the case of the characters",
  39597. "default-value": "none"
  39598. },
  39599. "horizontal-alignment": {
  39600. "css": "text-horizontal-alignment",
  39601. "type": [
  39602. "left",
  39603. "middle",
  39604. "right",
  39605. "auto"
  39606. ],
  39607. "doc": "The text's horizontal alignment from its centerpoint",
  39608. "default-value": "auto"
  39609. },
  39610. "justify-alignment": {
  39611. "css": "text-align",
  39612. "type": [
  39613. "left",
  39614. "right",
  39615. "center",
  39616. "auto"
  39617. ],
  39618. "doc": "Define how text is justified",
  39619. "default-value": "auto",
  39620. "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"
  39621. },
  39622. "clip": {
  39623. "css": "text-clip",
  39624. "type": "boolean",
  39625. "default-value": true,
  39626. "default-meaning": "geometry will be clipped to map bounds before rendering",
  39627. "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."
  39628. },
  39629. "comp-op": {
  39630. "css": "text-comp-op",
  39631. "default-value": "src-over",
  39632. "default-meaning": "add the current symbolizer on top of other symbolizer",
  39633. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  39634. "type": ["clear",
  39635. "src",
  39636. "dst",
  39637. "src-over",
  39638. "dst-over",
  39639. "src-in",
  39640. "dst-in",
  39641. "src-out",
  39642. "dst-out",
  39643. "src-atop",
  39644. "dst-atop",
  39645. "xor",
  39646. "plus",
  39647. "minus",
  39648. "multiply",
  39649. "screen",
  39650. "overlay",
  39651. "darken",
  39652. "lighten",
  39653. "color-dodge",
  39654. "color-burn",
  39655. "hard-light",
  39656. "soft-light",
  39657. "difference",
  39658. "exclusion",
  39659. "contrast",
  39660. "invert",
  39661. "invert-rgb",
  39662. "grain-merge",
  39663. "grain-extract",
  39664. "hue",
  39665. "saturation",
  39666. "color",
  39667. "value"
  39668. ]
  39669. }
  39670. },
  39671. "building": {
  39672. "fill": {
  39673. "css": "building-fill",
  39674. "default-value": "#FFFFFF",
  39675. "doc": "The color of the buildings walls.",
  39676. "type": "color"
  39677. },
  39678. "fill-opacity": {
  39679. "css": "building-fill-opacity",
  39680. "type": "float",
  39681. "doc": "The opacity of the building as a whole, including all walls.",
  39682. "default-value": 1
  39683. },
  39684. "height": {
  39685. "css": "building-height",
  39686. "doc": "The height of the building in pixels.",
  39687. "type": "expression",
  39688. "default-value": "0"
  39689. }
  39690. }
  39691. },
  39692. "colors": {
  39693. "aliceblue": [240, 248, 255],
  39694. "antiquewhite": [250, 235, 215],
  39695. "aqua": [0, 255, 255],
  39696. "aquamarine": [127, 255, 212],
  39697. "azure": [240, 255, 255],
  39698. "beige": [245, 245, 220],
  39699. "bisque": [255, 228, 196],
  39700. "black": [0, 0, 0],
  39701. "blanchedalmond": [255, 235, 205],
  39702. "blue": [0, 0, 255],
  39703. "blueviolet": [138, 43, 226],
  39704. "brown": [165, 42, 42],
  39705. "burlywood": [222, 184, 135],
  39706. "cadetblue": [95, 158, 160],
  39707. "chartreuse": [127, 255, 0],
  39708. "chocolate": [210, 105, 30],
  39709. "coral": [255, 127, 80],
  39710. "cornflowerblue": [100, 149, 237],
  39711. "cornsilk": [255, 248, 220],
  39712. "crimson": [220, 20, 60],
  39713. "cyan": [0, 255, 255],
  39714. "darkblue": [0, 0, 139],
  39715. "darkcyan": [0, 139, 139],
  39716. "darkgoldenrod": [184, 134, 11],
  39717. "darkgray": [169, 169, 169],
  39718. "darkgreen": [0, 100, 0],
  39719. "darkgrey": [169, 169, 169],
  39720. "darkkhaki": [189, 183, 107],
  39721. "darkmagenta": [139, 0, 139],
  39722. "darkolivegreen": [85, 107, 47],
  39723. "darkorange": [255, 140, 0],
  39724. "darkorchid": [153, 50, 204],
  39725. "darkred": [139, 0, 0],
  39726. "darksalmon": [233, 150, 122],
  39727. "darkseagreen": [143, 188, 143],
  39728. "darkslateblue": [72, 61, 139],
  39729. "darkslategrey": [47, 79, 79],
  39730. "darkturquoise": [0, 206, 209],
  39731. "darkviolet": [148, 0, 211],
  39732. "deeppink": [255, 20, 147],
  39733. "deepskyblue": [0, 191, 255],
  39734. "dimgray": [105, 105, 105],
  39735. "dimgrey": [105, 105, 105],
  39736. "dodgerblue": [30, 144, 255],
  39737. "firebrick": [178, 34, 34],
  39738. "floralwhite": [255, 250, 240],
  39739. "forestgreen": [34, 139, 34],
  39740. "fuchsia": [255, 0, 255],
  39741. "gainsboro": [220, 220, 220],
  39742. "ghostwhite": [248, 248, 255],
  39743. "gold": [255, 215, 0],
  39744. "goldenrod": [218, 165, 32],
  39745. "gray": [128, 128, 128],
  39746. "grey": [128, 128, 128],
  39747. "green": [0, 128, 0],
  39748. "greenyellow": [173, 255, 47],
  39749. "honeydew": [240, 255, 240],
  39750. "hotpink": [255, 105, 180],
  39751. "indianred": [205, 92, 92],
  39752. "indigo": [75, 0, 130],
  39753. "ivory": [255, 255, 240],
  39754. "khaki": [240, 230, 140],
  39755. "lavender": [230, 230, 250],
  39756. "lavenderblush": [255, 240, 245],
  39757. "lawngreen": [124, 252, 0],
  39758. "lemonchiffon": [255, 250, 205],
  39759. "lightblue": [173, 216, 230],
  39760. "lightcoral": [240, 128, 128],
  39761. "lightcyan": [224, 255, 255],
  39762. "lightgoldenrodyellow": [250, 250, 210],
  39763. "lightgray": [211, 211, 211],
  39764. "lightgreen": [144, 238, 144],
  39765. "lightgrey": [211, 211, 211],
  39766. "lightpink": [255, 182, 193],
  39767. "lightsalmon": [255, 160, 122],
  39768. "lightseagreen": [32, 178, 170],
  39769. "lightskyblue": [135, 206, 250],
  39770. "lightslategray": [119, 136, 153],
  39771. "lightslategrey": [119, 136, 153],
  39772. "lightsteelblue": [176, 196, 222],
  39773. "lightyellow": [255, 255, 224],
  39774. "lime": [0, 255, 0],
  39775. "limegreen": [50, 205, 50],
  39776. "linen": [250, 240, 230],
  39777. "magenta": [255, 0, 255],
  39778. "maroon": [128, 0, 0],
  39779. "mediumaquamarine": [102, 205, 170],
  39780. "mediumblue": [0, 0, 205],
  39781. "mediumorchid": [186, 85, 211],
  39782. "mediumpurple": [147, 112, 219],
  39783. "mediumseagreen": [60, 179, 113],
  39784. "mediumslateblue": [123, 104, 238],
  39785. "mediumspringgreen": [0, 250, 154],
  39786. "mediumturquoise": [72, 209, 204],
  39787. "mediumvioletred": [199, 21, 133],
  39788. "midnightblue": [25, 25, 112],
  39789. "mintcream": [245, 255, 250],
  39790. "mistyrose": [255, 228, 225],
  39791. "moccasin": [255, 228, 181],
  39792. "navajowhite": [255, 222, 173],
  39793. "navy": [0, 0, 128],
  39794. "oldlace": [253, 245, 230],
  39795. "olive": [128, 128, 0],
  39796. "olivedrab": [107, 142, 35],
  39797. "orange": [255, 165, 0],
  39798. "orangered": [255, 69, 0],
  39799. "orchid": [218, 112, 214],
  39800. "palegoldenrod": [238, 232, 170],
  39801. "palegreen": [152, 251, 152],
  39802. "paleturquoise": [175, 238, 238],
  39803. "palevioletred": [219, 112, 147],
  39804. "papayawhip": [255, 239, 213],
  39805. "peachpuff": [255, 218, 185],
  39806. "peru": [205, 133, 63],
  39807. "pink": [255, 192, 203],
  39808. "plum": [221, 160, 221],
  39809. "powderblue": [176, 224, 230],
  39810. "purple": [128, 0, 128],
  39811. "red": [255, 0, 0],
  39812. "rosybrown": [188, 143, 143],
  39813. "royalblue": [65, 105, 225],
  39814. "saddlebrown": [139, 69, 19],
  39815. "salmon": [250, 128, 114],
  39816. "sandybrown": [244, 164, 96],
  39817. "seagreen": [46, 139, 87],
  39818. "seashell": [255, 245, 238],
  39819. "sienna": [160, 82, 45],
  39820. "silver": [192, 192, 192],
  39821. "skyblue": [135, 206, 235],
  39822. "slateblue": [106, 90, 205],
  39823. "slategray": [112, 128, 144],
  39824. "slategrey": [112, 128, 144],
  39825. "snow": [255, 250, 250],
  39826. "springgreen": [0, 255, 127],
  39827. "steelblue": [70, 130, 180],
  39828. "tan": [210, 180, 140],
  39829. "teal": [0, 128, 128],
  39830. "thistle": [216, 191, 216],
  39831. "tomato": [255, 99, 71],
  39832. "turquoise": [64, 224, 208],
  39833. "violet": [238, 130, 238],
  39834. "wheat": [245, 222, 179],
  39835. "white": [255, 255, 255],
  39836. "whitesmoke": [245, 245, 245],
  39837. "yellow": [255, 255, 0],
  39838. "yellowgreen": [154, 205, 50],
  39839. "transparent": [0, 0, 0, 0]
  39840. },
  39841. "filter": {
  39842. "value": [
  39843. "true",
  39844. "false",
  39845. "null",
  39846. "point",
  39847. "linestring",
  39848. "polygon",
  39849. "collection"
  39850. ]
  39851. }
  39852. };
  39853. CartoCSS['mapnik_reference'] = {
  39854. version: {
  39855. latest: SuperMap._mapnik_reference_latest,
  39856. '2.1.1': SuperMap._mapnik_reference_latest
  39857. }
  39858. };
  39859. SuperMap.CartoCSS = CartoCSS;
  39860. SuperMap.CartoCSS.Tree = {};
  39861. SuperMap.CartoCSS.Tree.operate = function(op, a, b) {
  39862. switch (op) {
  39863. case '+': return a + b;
  39864. case '-': return a - b;
  39865. case '*': return a * b;
  39866. case '%': return a % b;
  39867. case '/': return a / b;
  39868. }
  39869. };
  39870. SuperMap.CartoCSS.Tree.functions = {
  39871. rgb: function (r, g, b) {
  39872. return this.rgba(r, g, b, 1.0);
  39873. },
  39874. rgba: function (r, g, b, a) {
  39875. var me = this;
  39876. var rgb = [r, g, b].map(function (c) {
  39877. return me.number(c);
  39878. });
  39879. a = me.number(a);
  39880. if (rgb.some(isNaN) || isNaN(a)) {return null;}
  39881. return new SuperMap.CartoCSS.Tree.Color(rgb, a);
  39882. },
  39883. // Only require val
  39884. stop: function (val) {
  39885. var color, mode;
  39886. if (arguments.length > 1) {color = arguments[1];}
  39887. if (arguments.length > 2) {mode = arguments[2];}
  39888. return {
  39889. is: 'tag',
  39890. val: val,
  39891. color: color,
  39892. mode: mode,
  39893. toString(env) {
  39894. return '\n\t<stop value="' + val.ev(env) + '"' +
  39895. (color ? ' color="' + color.ev(env) + '" ' : '') +
  39896. (mode ? ' mode="' + mode.ev(env) + '" ' : '') +
  39897. '/>';
  39898. }
  39899. };
  39900. },
  39901. hsl: function (h, s, l) {
  39902. return this.hsla(h, s, l, 1.0);
  39903. },
  39904. hsla: function (h, s, l, a) {
  39905. h = (this.number(h) % 360) / 360;
  39906. s = this.number(s);
  39907. l = this.number(l);
  39908. a = this.number(a);
  39909. if ([h, s, l, a].some(isNaN)) {return null;}
  39910. var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s,
  39911. m1 = l * 2 - m2;
  39912. return this.rgba(hue(h + 1 / 3) * 255,
  39913. hue(h) * 255,
  39914. hue(h - 1 / 3) * 255,
  39915. a);
  39916. function hue(h) {
  39917. h = h < 0 ? h + 1 : (h > 1 ? h - 1 : h);
  39918. 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;}
  39919. }
  39920. },
  39921. hue: function (color) {
  39922. if (!('toHSL' in color)) {return null;}
  39923. return new SuperMap.CartoCSS.Tree.Dimension(Math.round(color.toHSL().h));
  39924. },
  39925. saturation: function (color) {
  39926. if (!('toHSL' in color)) {return null;}
  39927. return new SuperMap.CartoCSS.Tree.Dimension(Math.round(color.toHSL().s * 100), '%');
  39928. },
  39929. lightness: function (color) {
  39930. if (!('toHSL' in color)) {return null;}
  39931. return new SuperMap.CartoCSS.Tree.Dimension(Math.round(color.toHSL().l * 100), '%');
  39932. },
  39933. alpha: function (color) {
  39934. if (!('toHSL' in color)) {return null;}
  39935. return new SuperMap.CartoCSS.Tree.Dimension(color.toHSL().a);
  39936. },
  39937. saturate: function (color, amount) {
  39938. if (!('toHSL' in color)) {return null;}
  39939. var hsl = color.toHSL();
  39940. hsl.s += amount.value / 100;
  39941. hsl.s = this.clamp(hsl.s);
  39942. return this.hsla_simple(hsl);
  39943. },
  39944. desaturate: function (color, amount) {
  39945. if (!('toHSL' in color)) {return null;}
  39946. var hsl = color.toHSL();
  39947. hsl.s -= amount.value / 100;
  39948. hsl.s = this.clamp(hsl.s);
  39949. return this.hsla_simple(hsl);
  39950. },
  39951. lighten: function (color, amount) {
  39952. if (!('toHSL' in color)) {return null;}
  39953. var hsl = color.toHSL();
  39954. hsl.l += amount.value / 100;
  39955. hsl.l = this.clamp(hsl.l);
  39956. return this.hsla_simple(hsl);
  39957. },
  39958. darken: function (color, amount) {
  39959. if (!('toHSL' in color)) {return null;}
  39960. var hsl = color.toHSL();
  39961. hsl.l -= amount.value / 100;
  39962. hsl.l = this.clamp(hsl.l);
  39963. return this.hsla_simple(hsl);
  39964. },
  39965. fadein: function (color, amount) {
  39966. if (!('toHSL' in color)) {return null;}
  39967. var hsl = color.toHSL();
  39968. hsl.a += amount.value / 100;
  39969. hsl.a = this.clamp(hsl.a);
  39970. return this.hsla_simple(hsl);
  39971. },
  39972. fadeout: function (color, amount) {
  39973. if (!('toHSL' in color)) {return null;}
  39974. var hsl = color.toHSL();
  39975. hsl.a -= amount.value / 100;
  39976. hsl.a = this.clamp(hsl.a);
  39977. return this.hsla_simple(hsl);
  39978. },
  39979. spin: function (color, amount) {
  39980. if (!('toHSL' in color)) {return null;}
  39981. var hsl = color.toHSL();
  39982. var hue = (hsl.h + amount.value) % 360;
  39983. hsl.h = hue < 0 ? 360 + hue : hue;
  39984. return this.hsla_simple(hsl);
  39985. },
  39986. replace: function (entity, a, b) {
  39987. if (entity.is === 'field') {
  39988. return entity.toString + '.replace(' + a.toString() + ', ' + b.toString() + ')';
  39989. } else {
  39990. return entity.replace(a, b);
  39991. }
  39992. },
  39993. //
  39994. // Copyright (c) 2006-2009 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein
  39995. // http://sass-lang.com
  39996. //
  39997. mix: function (color1, color2, weight) {
  39998. var p = weight.value / 100.0;
  39999. var w = p * 2 - 1;
  40000. var a = color1.toHSL().a - color2.toHSL().a;
  40001. var w1 = (((w * a == -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0;
  40002. var w2 = 1 - w1;
  40003. var rgb = [color1.rgb[0] * w1 + color2.rgb[0] * w2,
  40004. color1.rgb[1] * w1 + color2.rgb[1] * w2,
  40005. color1.rgb[2] * w1 + color2.rgb[2] * w2];
  40006. var alpha = color1.alpha * p + color2.alpha * (1 - p);
  40007. return new SuperMap.CartoCSS.Tree.Color(rgb, alpha);
  40008. },
  40009. greyscale: function (color) {
  40010. return this.desaturate(color, new SuperMap.CartoCSS.Tree.Dimension(100));
  40011. },
  40012. '%': function (quoted /* arg, arg, ...*/) {
  40013. var args = Array.prototype.slice.call(arguments, 1),
  40014. str = quoted.value;
  40015. for (var i = 0; i < args.length; i++) {
  40016. str = str.replace(/%s/, args[i].value)
  40017. .replace(/%[da]/, args[i].toString());
  40018. }
  40019. str = str.replace(/%%/g, '%');
  40020. return new SuperMap.CartoCSS.Tree.Quoted(str);
  40021. },
  40022. hsla_simple: function (h) {
  40023. return this.hsla(h.h, h.s, h.l, h.a);
  40024. },
  40025. number: function (n) {
  40026. if (n instanceof SuperMap.CartoCSS.Tree.Dimension) {
  40027. return parseFloat(n.unit === '%' ? n.value / 100 : n.value);
  40028. } else if (typeof(n) === 'number') {
  40029. return n;
  40030. } else {
  40031. return NaN;
  40032. }
  40033. },
  40034. clamp: function (val) {
  40035. return Math.min(1, Math.max(0, val));
  40036. }
  40037. };
  40038. SuperMap.CartoCSS.Tree.Call = class Call {
  40039. constructor(name, args, index) {
  40040. this.is = 'call';
  40041. this.name = name;
  40042. this.args = args;
  40043. this.index = index;
  40044. }
  40045. // When evuating a function call,
  40046. // we either find the function in `tree.functions` [1],
  40047. // in which case we call it, passing the evaluated arguments,
  40048. // or we simply print it out as it appeared originally [2].
  40049. // The *functions.js* file contains the built-in functions.
  40050. // The reason why we evaluate the arguments, is in the case where
  40051. // we try to pass a variable to a function, like: `saturate(@color)`.
  40052. // The function should receive the value, not the variable.
  40053. 'ev'(env) {
  40054. var args = this.args.map(function (a) {
  40055. return a.ev(env);
  40056. });
  40057. for (var i = 0; i < args.length; i++) {
  40058. if (args[i].is === 'undefined') {
  40059. return {
  40060. is: 'undefined',
  40061. value: 'undefined'
  40062. };
  40063. }
  40064. }
  40065. if (this.name in SuperMap.CartoCSS.Tree.functions) {
  40066. if (SuperMap.CartoCSS.Tree.functions[this.name].length <= args.length) {
  40067. var val = SuperMap.CartoCSS.Tree.functions[this.name].apply(SuperMap.CartoCSS.Tree.functions, args);
  40068. if (val === null) {
  40069. env.error({
  40070. message: 'incorrect arguments given to ' + this.name + '()',
  40071. index: this.index,
  40072. type: 'runtime',
  40073. filename: this.filename
  40074. });
  40075. return {is: 'undefined', value: 'undefined'};
  40076. }
  40077. return val;
  40078. } else {
  40079. env.error({
  40080. message: 'incorrect number of arguments for ' + this.name +
  40081. '(). ' + SuperMap.CartoCSS.Tree.functions[this.name].length + ' expected.',
  40082. index: this.index,
  40083. type: 'runtime',
  40084. filename: this.filename
  40085. });
  40086. return {
  40087. is: 'undefined',
  40088. value: 'undefined'
  40089. };
  40090. }
  40091. } else {
  40092. var fn = SuperMap.CartoCSS.Tree.Reference.mapnikFunctions[this.name];
  40093. if (fn === undefined) {
  40094. var functions = lodash_topairs_default()(SuperMap.CartoCSS.Tree.Reference.mapnikFunctions);
  40095. // cheap closest, needs improvement.
  40096. var name = this.name;
  40097. var mean = functions.map(function (f) {
  40098. return [f[0], SuperMap.CartoCSS.Tree.Reference.editDistance(name, f[0]), f[1]];
  40099. }).sort(function (a, b) {
  40100. return a[1] - b[1];
  40101. });
  40102. env.error({
  40103. message: 'unknown function ' + this.name + '(), did you mean ' +
  40104. mean[0][0] + '(' + mean[0][2] + ')',
  40105. index: this.index,
  40106. type: 'runtime',
  40107. filename: this.filename
  40108. });
  40109. return {
  40110. is: 'undefined',
  40111. value: 'undefined'
  40112. };
  40113. }
  40114. if (fn !== args.length &&
  40115. // support variable-arg functions like `colorize-alpha`
  40116. fn !== -1) {
  40117. env.error({
  40118. message: 'function ' + this.name + '() takes ' +
  40119. fn + ' arguments and was given ' + args.length,
  40120. index: this.index,
  40121. type: 'runtime',
  40122. filename: this.filename
  40123. });
  40124. return {
  40125. is: 'undefined',
  40126. value: 'undefined'
  40127. };
  40128. } else {
  40129. // Save the evaluated versions of arguments
  40130. this.args = args;
  40131. return this;
  40132. }
  40133. }
  40134. }
  40135. toString(env, format) {
  40136. if (this.args.length) {
  40137. return this.name + '(' + this.args.join(',') + ')';
  40138. } else {
  40139. return this.name;
  40140. }
  40141. }
  40142. };
  40143. SuperMap.CartoCSS.Tree.Color = class Color {
  40144. constructor(rgb, a) {
  40145. this.is = 'color';
  40146. // The end goal here, is to parse the arguments
  40147. // into an integer triplet, such as `128, 255, 0`
  40148. //
  40149. // This facilitates operations and conversions.
  40150. if (Array.isArray(rgb)) {
  40151. this.rgb = rgb.slice(0, 3);
  40152. } else if (rgb.length == 6) {
  40153. this.rgb = rgb.match(/.{2}/g).map(function (c) {
  40154. return parseInt(c, 16);
  40155. });
  40156. } else {
  40157. this.rgb = rgb.split('').map(function (c) {
  40158. return parseInt(c + c, 16);
  40159. });
  40160. }
  40161. if (typeof(a) === 'number') {
  40162. this.alpha = a;
  40163. } else if (rgb.length === 4) {
  40164. this.alpha = rgb[3];
  40165. } else {
  40166. this.alpha = 1;
  40167. }
  40168. }
  40169. 'ev'() {
  40170. return this;
  40171. }
  40172. // If we have some transparency, the only way to represent it
  40173. // is via `rgba`. Otherwise, we use the hex representation,
  40174. // which has better compatibility with older browsers.
  40175. // Values are capped between `0` and `255`, rounded and zero-padded.
  40176. toString() {
  40177. /* if (this.alpha < 1.0) {*/
  40178. return 'rgba(' + this.rgb.map(function (c) {
  40179. return Math.round(c);
  40180. }).concat(this.alpha).join(', ') + ')';
  40181. /*} else {
  40182. return '#' + this.rgb.map(function(i) {
  40183. i = Math.round(i);
  40184. i = (i > 255 ? 255 : (i < 0 ? 0 : i)).toString(16);
  40185. return i.length === 1 ? '0' + i : i;
  40186. }).join('');
  40187. }*/
  40188. }
  40189. // Operations have to be done per-channel, if not,
  40190. // channels will spill onto each other. Once we have
  40191. // our result, in the form of an integer triplet,
  40192. // we create a new Color node to hold the result.
  40193. operate(env, op, other) {
  40194. var result = [];
  40195. if (!(other instanceof SuperMap.CartoCSS.Tree.Color)) {
  40196. other = other.toColor();
  40197. }
  40198. for (var c = 0; c < 3; c++) {
  40199. result[c] = SuperMap.CartoCSS.Tree.operate(op, this.rgb[c], other.rgb[c]);
  40200. }
  40201. return new SuperMap.CartoCSS.Tree.Color(result);
  40202. }
  40203. toHSL() {
  40204. var r = this.rgb[0] / 255,
  40205. g = this.rgb[1] / 255,
  40206. b = this.rgb[2] / 255,
  40207. a = this.alpha;
  40208. var max = Math.max(r, g, b), min = Math.min(r, g, b);
  40209. var h, s, l = (max + min) / 2, d = max - min;
  40210. if (max === min) {
  40211. h = s = 0;
  40212. } else {
  40213. s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
  40214. switch (max) {
  40215. case r:
  40216. h = (g - b) / d + (g < b ? 6 : 0);
  40217. break;
  40218. case g:
  40219. h = (b - r) / d + 2;
  40220. break;
  40221. case b:
  40222. h = (r - g) / d + 4;
  40223. break;
  40224. default:
  40225. break;
  40226. }
  40227. h /= 6;
  40228. }
  40229. return {h: h * 360, s: s, l: l, a: a};
  40230. }
  40231. };
  40232. SuperMap.CartoCSS.Tree.Comment = class Comment {
  40233. constructor(value, silent) {
  40234. this.value = value;
  40235. this.silent = !!silent;
  40236. }
  40237. toString(env) {
  40238. return '<!--' + this.value + '-->';
  40239. }
  40240. 'ev'() {
  40241. return this;
  40242. }
  40243. };
  40244. SuperMap.CartoCSS.Tree.Definition = class Definition {
  40245. constructor(selector, rules) {
  40246. this.elements = selector.elements;
  40247. //assert.ok(selector.filters instanceof SuperMap.CartoCSS.Tree.Filterset);
  40248. this.rules = rules;
  40249. this.ruleIndex = {};
  40250. for (var i = 0; i < this.rules.length; i++) {
  40251. if ('zoom' in this.rules[i]) {this.rules[i] = this.rules[i].clone();}
  40252. this.rules[i].zoom = selector.zoom;
  40253. this.ruleIndex[this.rules[i].updateID()] = true;
  40254. }
  40255. this.filters = selector.filters;
  40256. this.zoom = selector.zoom;
  40257. this.attachment = selector.attachment || '__default__';
  40258. this.specificity = selector.specificity();
  40259. }
  40260. toString() {
  40261. var str = this.filters.toString();
  40262. for (var i = 0; i < this.rules.length; i++) {
  40263. str += '\n ' + this.rules[i];
  40264. }
  40265. return str;
  40266. }
  40267. toJS(env) {
  40268. var shaderAttrs = {};
  40269. // merge conditions from filters with zoom condition of the
  40270. // definition
  40271. var zoom = this.zoom;
  40272. //var frame_offset = this.frame_offset;
  40273. var _if = this.filters.toJS(env);
  40274. var filters = [zoom];
  40275. if (_if) {filters.push(_if);}
  40276. //if(frame_offset) filters.push('ctx["frame-offset"] === ' + frame_offset);
  40277. _if = filters.join(" && ");
  40278. function eachRule(rule) {
  40279. if (rule instanceof SuperMap.CartoCSS.Tree.Rule) {
  40280. shaderAttrs[rule.name] = shaderAttrs[rule.name] || [];
  40281. if (_if) {
  40282. shaderAttrs[rule.name].push(
  40283. "if(" + _if + "){" + rule.value.toJS(env) + "}"
  40284. );
  40285. } else {
  40286. shaderAttrs[rule.name].push(rule.value.toJS(env));
  40287. }
  40288. } else {
  40289. if (rule instanceof SuperMap.CartoCSS.Tree.Ruleset) {
  40290. var sh = rule.toJS(env);
  40291. for (var v in sh) {
  40292. shaderAttrs[v] = shaderAttrs[v] || [];
  40293. for (var attr in sh[v]) {
  40294. shaderAttrs[v].push(sh[v][attr]);
  40295. }
  40296. }
  40297. }
  40298. }
  40299. }
  40300. for (var id in this.rules) {
  40301. eachRule(this.rules[id]);
  40302. }
  40303. return shaderAttrs;
  40304. }
  40305. };
  40306. SuperMap.CartoCSS.Tree.Dimension = class Dimension {
  40307. constructor(value, unit, index) {
  40308. this.is = 'float';
  40309. this.physical_units = ['m', 'cm', 'in', 'mm', 'pt', 'pc'];
  40310. this.screen_units = ['px', '%'];
  40311. this.all_units = ['m', 'cm', 'in', 'mm', 'pt', 'pc', 'px', '%'];
  40312. this.densities = {
  40313. m: 0.0254,
  40314. mm: 25.4,
  40315. cm: 2.54,
  40316. pt: 72,
  40317. pc: 6
  40318. };
  40319. this.value = parseFloat(value);
  40320. this.unit = unit || null;
  40321. this.index = index;
  40322. }
  40323. ev(env) {
  40324. if (this.unit && this.all_units.indexOf(this.unit)<0) {
  40325. env.error({
  40326. message: "Invalid unit: '" + this.unit + "'",
  40327. index: this.index
  40328. });
  40329. return {is: 'undefined', value: 'undefined'};
  40330. }
  40331. // normalize units which are not px or %
  40332. if (this.unit && this.physical_units.indexOf(this.unit)>=0) {
  40333. if (!env.ppi) {
  40334. env.error({
  40335. message: "ppi is not set, so metric units can't be used",
  40336. index: this.index
  40337. });
  40338. return {is: 'undefined', value: 'undefined'};
  40339. }
  40340. // convert all units to inch
  40341. // convert inch to px using ppi
  40342. this.value = (this.value / this.densities[this.unit]) * env.ppi;
  40343. this.unit = 'px';
  40344. }
  40345. return this;
  40346. }
  40347. toColor() {
  40348. return new SuperMap.CartoCSS.Tree.Color([this.value, this.value, this.value]);
  40349. }
  40350. round() {
  40351. this.value = Math.round(this.value);
  40352. return this;
  40353. }
  40354. toString() {
  40355. return this.value.toString();
  40356. }
  40357. operate(env, op, other) {
  40358. if (this.unit === '%' && other.unit !== '%') {
  40359. env.error({
  40360. message: 'If two operands differ, the first must not be %',
  40361. index: this.index
  40362. });
  40363. return {
  40364. is: 'undefined',
  40365. value: 'undefined'
  40366. };
  40367. }
  40368. if (this.unit !== '%' && other.unit === '%') {
  40369. if (op === '*' || op === '/' || op === '%') {
  40370. env.error({
  40371. message: 'Percent values can only be added or subtracted from other values',
  40372. index: this.index
  40373. });
  40374. return {
  40375. is: 'undefined',
  40376. value: 'undefined'
  40377. };
  40378. }
  40379. return new SuperMap.CartoCSS.Tree.Dimension(SuperMap.CartoCSS.Tree.operate(op,
  40380. this.value, this.value * other.value * 0.01),
  40381. this.unit);
  40382. }
  40383. //here the operands are either the same (% or undefined or px), or one is undefined and the other is px
  40384. return new SuperMap.CartoCSS.Tree.Dimension(SuperMap.CartoCSS.Tree.operate(op, this.value, other.value),
  40385. this.unit || other.unit);
  40386. }
  40387. };
  40388. SuperMap.CartoCSS.Tree.Element = class Element {
  40389. constructor(value) {
  40390. this.value = value.trim();
  40391. if (this.value[0] === '#') {
  40392. this.type = 'id';
  40393. this.clean = this.value.replace(/^#/, '');
  40394. }
  40395. if (this.value[0] === '.') {
  40396. this.type = 'class';
  40397. this.clean = this.value.replace(/^\./, '');
  40398. }
  40399. if (this.value.indexOf('*') !== -1) {
  40400. this.type = 'wildcard';
  40401. }
  40402. }
  40403. specificity() {
  40404. return [
  40405. (this.type === 'id') ? 1 : 0, // a
  40406. (this.type === 'class') ? 1 : 0 // b
  40407. ];
  40408. }
  40409. toString() {
  40410. return this.value;
  40411. }
  40412. };
  40413. SuperMap.CartoCSS.Tree.Expression = class Expression {
  40414. constructor(value) {
  40415. this.is = 'expression';
  40416. this.value = value;
  40417. }
  40418. ev(env) {
  40419. if (this.value.length > 1) {
  40420. return new SuperMap.CartoCSS.Tree.Expression(this.value.map(function (e) {
  40421. return e.ev(env);
  40422. }));
  40423. } else {
  40424. return this.value[0].ev(env);
  40425. }
  40426. }
  40427. toString(env) {
  40428. return this.value.map(function (e) {
  40429. return e.toString(env);
  40430. }).join(' ');
  40431. }
  40432. };
  40433. SuperMap.CartoCSS.Tree.Field = class Field {
  40434. constructor(content) {
  40435. this.is = 'field';
  40436. this.value = content || '';
  40437. }
  40438. toString() {
  40439. return '["' + this.value.toUpperCase() + '"]';
  40440. }
  40441. 'ev'() {
  40442. return this;
  40443. }
  40444. };
  40445. SuperMap.CartoCSS.Tree.Filter = class Filter {
  40446. constructor(key, op, val, index, filename) {
  40447. this.ops = {
  40448. '<': [' &lt; ', 'numeric'],
  40449. '>': [' &gt; ', 'numeric'],
  40450. '=': [' = ', 'both'],
  40451. '!=': [' != ', 'both'],
  40452. '<=': [' &lt;= ', 'numeric'],
  40453. '>=': [' &gt;= ', 'numeric'],
  40454. '=~': ['.match(', 'string', ')']
  40455. };
  40456. this.key = key;
  40457. this.op = op;
  40458. this.val = val;
  40459. this.index = index;
  40460. this.filename = filename;
  40461. this.id = this.key + this.op + this.val;
  40462. }
  40463. ev(env) {
  40464. this.key = this.key.ev(env);
  40465. this.val = this.val.ev(env);
  40466. return this;
  40467. }
  40468. toString() {
  40469. return '[' + this.id + ']';
  40470. }
  40471. };
  40472. SuperMap.CartoCSS.Tree.Filterset = class Filterset {
  40473. constructor() {
  40474. this.filters = {};
  40475. }
  40476. toJS(env) {
  40477. function eachFilter(filter) {
  40478. var op = filter.op;
  40479. if (op === "=") {
  40480. op = "==";
  40481. }
  40482. var val = filter.val;
  40483. if (filter._val !== undefined) {
  40484. val = filter._val.toString(true);
  40485. }
  40486. //对scale进行特殊处理,将值转换成数值
  40487. if (filter.key && filter.key.value === 'scale') {
  40488. val = +val;
  40489. } else if (typeof val === 'string' || typeof val === 'object') {
  40490. val = "'" + val + "'";
  40491. }
  40492. var attrs = "attributes";
  40493. return attrs + "&&" + attrs + filter.key + "&&" + attrs + filter.key + " " + op + val;
  40494. }
  40495. var results = [];
  40496. for (var id in this.filters) {
  40497. results.push(eachFilter(this.filters[id]));
  40498. }
  40499. return results.join(' && ');
  40500. }
  40501. toString() {
  40502. var arr = [];
  40503. for (var id in this.filters) {arr.push(this.filters[id].id);}
  40504. return arr.sort().join('\t');
  40505. }
  40506. ev(env) {
  40507. for (var i in this.filters) {
  40508. this.filters[i].ev(env);
  40509. }
  40510. return this;
  40511. }
  40512. clone() {
  40513. var clone = new SuperMap.CartoCSS.Tree.Filterset();
  40514. for (var id in this.filters) {
  40515. clone.filters[id] = this.filters[id];
  40516. }
  40517. return clone;
  40518. }
  40519. cloneWith(other) {
  40520. var additions = [];
  40521. for (var id in other.filters) {
  40522. var status = this.addable(other.filters[id]);
  40523. // status is true, false or null. if it's null we don't fail this
  40524. // clone nor do we add the filter.
  40525. if (status === false) {
  40526. return false;
  40527. }
  40528. if (status === true) {
  40529. // Adding the filter will override another value.
  40530. additions.push(other.filters[id]);
  40531. }
  40532. }
  40533. // Adding the other filters doesn't make this filterset invalid, but it
  40534. // doesn't add anything to it either.
  40535. if (!additions.length) {
  40536. return null;
  40537. }
  40538. // We can successfully add all filters. Now clone the filterset and add the
  40539. // new rules.
  40540. var clone = new SuperMap.CartoCSS.Tree.Filterset();
  40541. // We can add the rules that are already present without going through the
  40542. // add function as a Filterset is always in it's simplest canonical form.
  40543. for (id in this.filters) {
  40544. clone.filters[id] = this.filters[id];
  40545. }
  40546. // Only add new filters that actually change the filter.
  40547. while (id = additions.shift()) {
  40548. clone.add(id);
  40549. }
  40550. return clone;
  40551. }
  40552. addable(filter) {
  40553. var key = filter.key.toString(),
  40554. value = filter.val.toString();
  40555. if (value.match(/^[0-9]+(\.[0-9]*)?_match/)) {value = parseFloat(value);}
  40556. switch (filter.op) {
  40557. case '=':
  40558. // if there is already foo= and we're adding foo=
  40559. if (this.filters[key + '='] !== undefined) {
  40560. if (this.filters[key + '='].val.toString() != value) {
  40561. return false;
  40562. } else {
  40563. return null;
  40564. }
  40565. }
  40566. if (this.filters[key + '!=' + value] !== undefined) {return false;}
  40567. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return false;}
  40568. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return false;}
  40569. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return false;}
  40570. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return false;}
  40571. return true;
  40572. case '=~':
  40573. return true;
  40574. case '!=':
  40575. if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val === value) ? false : null;}
  40576. if (this.filters[key + '!=' + value] !== undefined) {return null;}
  40577. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return null;}
  40578. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return null;}
  40579. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return null;}
  40580. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return null;}
  40581. return true;
  40582. case '>':
  40583. if (key + '=' in this.filters) {
  40584. if (this.filters[key + '='].val <= value) {
  40585. return false;
  40586. } else {
  40587. return null;
  40588. }
  40589. }
  40590. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return false;}
  40591. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val <= value) {return false;}
  40592. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return null;}
  40593. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return null;}
  40594. return true;
  40595. case '>=':
  40596. if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val < value) ? false : null;}
  40597. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return false;}
  40598. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return false;}
  40599. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return null;}
  40600. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val >= value) {return null;}
  40601. return true;
  40602. case '<':
  40603. if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val >= value) ? false : null;}
  40604. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return false;}
  40605. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val >= value) {return false;}
  40606. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return null;}
  40607. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return null;}
  40608. return true;
  40609. case '<=':
  40610. if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val > value) ? false : null;}
  40611. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return false;}
  40612. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return false;}
  40613. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return null;}
  40614. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val <= value) {return null;}
  40615. return true;
  40616. default:
  40617. break;
  40618. }
  40619. }
  40620. conflict(filter) {
  40621. var key = filter.key.toString(),
  40622. value = filter.val.toString();
  40623. if (!isNaN(parseFloat(value))) {value = parseFloat(value);}
  40624. // if (a=b) && (a=c)
  40625. // if (a=b) && (a!=b)
  40626. // or (a!=b) && (a=b)
  40627. if ((filter.op === '=' && this.filters[key + '='] !== undefined &&
  40628. value != this.filters[key + '='].val.toString()) ||
  40629. (filter.op === '!=' && this.filters[key + '='] !== undefined &&
  40630. value == this.filters[key + '='].val.toString()) ||
  40631. (filter.op === '=' && this.filters[key + '!='] !== undefined &&
  40632. value === this.filters[key + '!='].val.toString())) {
  40633. return filter.toString() + ' added to ' + this.toString() + ' produces an invalid filter';
  40634. }
  40635. return false;
  40636. }
  40637. add(filter, env) {
  40638. var key = filter.key.toString(),
  40639. op = filter.op,
  40640. conflict = this.conflict(filter),
  40641. numval;
  40642. if (conflict) {return conflict;}
  40643. if (op === '=') {
  40644. for (var i in this.filters) {
  40645. if (this.filters[i].key === key) {delete this.filters[i];}
  40646. }
  40647. this.filters[key + '='] = filter;
  40648. } else if (op === '!=') {
  40649. this.filters[key + '!=' + filter.val] = filter;
  40650. } else if (op === '=~') {
  40651. this.filters[key + '=~' + filter.val] = filter;
  40652. } else if (op === '>') {
  40653. // If there are other filters that are also >
  40654. // but are less than this one, they don't matter, so
  40655. // remove them.
  40656. for (var j in this.filters) {
  40657. if (this.filters[j].key === key && this.filters[j].val <= filter.val) {
  40658. delete this.filters[j];
  40659. }
  40660. }
  40661. this.filters[key + '>'] = filter;
  40662. } else if (op === '>=') {
  40663. for (var k in this.filters) {
  40664. numval = (+this.filters[k].val.toString());
  40665. if (this.filters[k].key === key && numval < filter.val) {
  40666. delete this.filters[k];
  40667. }
  40668. }
  40669. if (this.filters[key + '!=' + filter.val] !== undefined) {
  40670. delete this.filters[key + '!=' + filter.val];
  40671. filter.op = '>';
  40672. this.filters[key + '>'] = filter;
  40673. } else {
  40674. this.filters[key + '>='] = filter;
  40675. }
  40676. } else if (op === '<') {
  40677. for (var l in this.filters) {
  40678. numval = (+this.filters[l].val.toString());
  40679. if (this.filters[l].key === key && numval >= filter.val) {
  40680. delete this.filters[l];
  40681. }
  40682. }
  40683. this.filters[key + '<'] = filter;
  40684. } else if (op === '<=') {
  40685. for (var m in this.filters) {
  40686. numval = (+this.filters[m].val.toString());
  40687. if (this.filters[m].key === key && numval > filter.val) {
  40688. delete this.filters[m];
  40689. }
  40690. }
  40691. if (this.filters[key + '!=' + filter.val] !== undefined) {
  40692. delete this.filters[key + '!=' + filter.val];
  40693. filter.op = '<';
  40694. this.filters[key + '<'] = filter;
  40695. } else {
  40696. this.filters[key + '<='] = filter;
  40697. }
  40698. }
  40699. }
  40700. };
  40701. SuperMap.CartoCSS.Tree.Fontset = class Fontset {
  40702. constructor(env, fonts) {
  40703. this.fonts = fonts;
  40704. this.name = 'fontset-' + env.effects.length;
  40705. }
  40706. };
  40707. SuperMap.CartoCSS.Tree.Invalid = class Invalid {
  40708. constructor(chunk, index, message) {
  40709. this.is = 'invalid';
  40710. this.chunk = chunk;
  40711. this.index = index;
  40712. this.type = 'syntax';
  40713. this.message = message || "Invalid code: " + this.chunk;
  40714. }
  40715. ev(env) {
  40716. env.error({
  40717. chunk: this.chunk,
  40718. index: this.index,
  40719. type: 'syntax',
  40720. message: this.message || "Invalid code: " + this.chunk
  40721. });
  40722. return {
  40723. is: 'undefined'
  40724. };
  40725. }
  40726. };
  40727. SuperMap.CartoCSS.Tree.Keyword = class Keyword {
  40728. ev() {
  40729. return this;
  40730. }
  40731. constructor(value) {
  40732. this.value = value;
  40733. var special = {
  40734. 'transparent': 'color',
  40735. 'true': 'boolean',
  40736. 'false': 'boolean'
  40737. };
  40738. this.is = special[value] ? special[value] : 'keyword';
  40739. }
  40740. toString() {
  40741. return this.value;
  40742. }
  40743. };
  40744. /*Layer:class Invalid ),*/
  40745. SuperMap.CartoCSS.Tree.Literal = class Literal {
  40746. constructor(content) {
  40747. this.value = content || '';
  40748. this.is = 'field';
  40749. }
  40750. toString() {
  40751. return this.value;
  40752. }
  40753. 'ev'() {
  40754. return this;
  40755. }
  40756. };
  40757. SuperMap.CartoCSS.Tree.Operation = class Operation {
  40758. constructor(op, operands, index) {
  40759. this.is = 'operation';
  40760. this.op = op.trim();
  40761. this.operands = operands;
  40762. this.index = index;
  40763. }
  40764. ev(env) {
  40765. var a = this.operands[0].ev(env),
  40766. b = this.operands[1].ev(env),
  40767. temp;
  40768. if (a.is === 'undefined' || b.is === 'undefined') {
  40769. return {
  40770. is: 'undefined',
  40771. value: 'undefined'
  40772. };
  40773. }
  40774. if (a instanceof SuperMap.CartoCSS.Tree.Dimension && b instanceof SuperMap.CartoCSS.Tree.Color) {
  40775. if (this.op === '*' || this.op === '+') {
  40776. temp = b;
  40777. b = a;
  40778. a = temp;
  40779. } else {
  40780. env.error({
  40781. name: "OperationError",
  40782. message: "Can't substract or divide a color from a number",
  40783. index: this.index
  40784. });
  40785. }
  40786. }
  40787. // Only concatenate plain strings, because this is easily
  40788. // pre-processed
  40789. if (a instanceof SuperMap.CartoCSS.Tree.Quoted && b instanceof SuperMap.CartoCSS.Tree.Quoted && this.op !== '+') {
  40790. env.error({
  40791. message: "Can't subtract, divide, or multiply strings.",
  40792. index: this.index,
  40793. type: 'runtime',
  40794. filename: this.filename
  40795. });
  40796. return {
  40797. is: 'undefined',
  40798. value: 'undefined'
  40799. };
  40800. }
  40801. // Fields, literals, dimensions, and quoted strings can be combined.
  40802. if (a instanceof SuperMap.CartoCSS.Tree.Field || b instanceof SuperMap.CartoCSS.Tree.Field ||
  40803. a instanceof SuperMap.CartoCSS.Tree.Literal || b instanceof SuperMap.CartoCSS.Tree.Literal) {
  40804. if (a.is === 'color' || b.is === 'color') {
  40805. env.error({
  40806. message: "Can't subtract, divide, or multiply colors in expressions.",
  40807. index: this.index,
  40808. type: 'runtime',
  40809. filename: this.filename
  40810. });
  40811. return {
  40812. is: 'undefined',
  40813. value: 'undefined'
  40814. };
  40815. } else {
  40816. return new SuperMap.CartoCSS.Tree.Literal(a.ev(env).toString(true) + this.op + b.ev(env).toString(true));
  40817. }
  40818. }
  40819. if (a.operate === undefined) {
  40820. env.error({
  40821. message: 'Cannot do math with type ' + a.is + '.',
  40822. index: this.index,
  40823. type: 'runtime',
  40824. filename: this.filename
  40825. });
  40826. return {
  40827. is: 'undefined',
  40828. value: 'undefined'
  40829. };
  40830. }
  40831. return a.operate(env, this.op, b);
  40832. }
  40833. };
  40834. SuperMap.CartoCSS.Tree.Quoted = class Quoted {
  40835. constructor(content) {
  40836. this.is = 'string';
  40837. this.value = content || '';
  40838. }
  40839. toString(quotes) {
  40840. var escapedValue = this.value
  40841. .replace(/&/g, '&amp;')
  40842. var xmlvalue = escapedValue
  40843. .replace(/\'/g, '\\\'')
  40844. .replace(/\"/g, '&quot;')
  40845. .replace(/</g, '&lt;')
  40846. .replace(/\>/g, '&gt;');
  40847. return (quotes === true) ? "'" + xmlvalue + "'" : escapedValue;
  40848. }
  40849. ev() {
  40850. return this;
  40851. }
  40852. operate(env, op, other) {
  40853. return new SuperMap.CartoCSS.Tree.Quoted(SuperMap.CartoCSS.Tree.operate(op, this.toString(), other.toString(this.contains_field)));
  40854. }
  40855. };
  40856. SuperMap.CartoCSS.Tree.Reference = {
  40857. _validateValue: {
  40858. 'font': function (env, value) {
  40859. if (env.validation_data && env.validation_data.fonts) {
  40860. return env.validation_data.fonts.indexOf(value) != -1;
  40861. } else {
  40862. return true;
  40863. }
  40864. }
  40865. },
  40866. setData: function (data) {
  40867. this.data = data;
  40868. this.selector_cache = generateSelectorCache(data);
  40869. this.mapnikFunctions = generateMapnikFunctions(data);
  40870. this.required_cache = generateRequiredProperties(data);
  40871. function generateSelectorCache(data) {
  40872. var index = {};
  40873. for (var i in data.symbolizers) {
  40874. for (var j in data.symbolizers[i]) {
  40875. if (data.symbolizers[i][j].hasOwnProperty('css')) {
  40876. index[data.symbolizers[i][j].css] = [data.symbolizers[i][j], i, j];
  40877. }
  40878. }
  40879. }
  40880. return index;
  40881. }
  40882. function generateMapnikFunctions(data) {
  40883. var functions = {};
  40884. for (var i in data.symbolizers) {
  40885. for (var j in data.symbolizers[i]) {
  40886. if (data.symbolizers[i][j].type === 'functions') {
  40887. for (var k = 0; k < data.symbolizers[i][j].functions.length; k++) {
  40888. var fn = data.symbolizers[i][j].functions[k];
  40889. functions[fn[0]] = fn[1];
  40890. }
  40891. }
  40892. }
  40893. }
  40894. return functions;
  40895. }
  40896. function generateRequiredProperties(data) {
  40897. var cache = {};
  40898. for (var symbolizer_name in data.symbolizers) {
  40899. cache[symbolizer_name] = [];
  40900. for (var j in data.symbolizers[symbolizer_name]) {
  40901. if (data.symbolizers[symbolizer_name][j].required) {
  40902. cache[symbolizer_name].push(data.symbolizers[symbolizer_name][j].css);
  40903. }
  40904. }
  40905. }
  40906. return cache;
  40907. }
  40908. },
  40909. setVersion: function (version) {
  40910. if (SuperMap.CartoCSS.mapnik_reference.version.hasOwnProperty(version)) {
  40911. this.setData(SuperMap.CartoCSS.mapnik_reference.version[version]);
  40912. return true;
  40913. }
  40914. return false;
  40915. },
  40916. selectorData: function (selector, i) {
  40917. if (this.selector_cache && this.selector_cache[selector]) {return this.selector_cache[selector][i];}
  40918. },
  40919. validSelector: function (selector) {
  40920. return !!this.selector_cache[selector];
  40921. },
  40922. selectorName: function (selector) {
  40923. return this.selectorData(selector, 2);
  40924. },
  40925. selector: function (selector) {
  40926. return this.selectorData(selector, 0);
  40927. },
  40928. symbolizer: function (selector) {
  40929. return this.selectorData(selector, 1);
  40930. },
  40931. requiredProperties: function (symbolizer_name, rules) {
  40932. var req = this.required_cache[symbolizer_name];
  40933. for (var i in req) {
  40934. if (!(req[i] in rules)) {
  40935. return 'Property ' + req[i] + ' required for defining ' +
  40936. symbolizer_name + ' styles.';
  40937. }
  40938. }
  40939. },
  40940. isFont: function (selector) {
  40941. return this.selector(selector).validate === 'font';
  40942. },
  40943. editDistance: function (a, b) {
  40944. if (a.length === 0) {return b.length;}
  40945. if (b.length === 0) {return a.length;}
  40946. var matrix = [];
  40947. for (var i = 0; i <= b.length; i++) {
  40948. matrix[i] = [i];
  40949. }
  40950. for (var j = 0; j <= a.length; j++) {
  40951. matrix[0][j] = j;
  40952. }
  40953. for (i = 1; i <= b.length; i++) {
  40954. for (j = 1; j <= a.length; j++) {
  40955. if (b.charAt(i - 1) === a.charAt(j - 1)) {
  40956. matrix[i][j] = matrix[i - 1][j - 1];
  40957. } else {
  40958. matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // substitution
  40959. Math.min(matrix[i][j - 1] + 1, // insertion
  40960. matrix[i - 1][j] + 1)); // deletion
  40961. }
  40962. }
  40963. }
  40964. return matrix[b.length][a.length];
  40965. },
  40966. validValue: function (env, selector, value) {
  40967. function validateFunctions(value, selector) {
  40968. if (value.value[0].is === 'string') {return true;}
  40969. for (var i in value.value) {
  40970. for (var j in value.value[i].value) {
  40971. if (value.value[i].value[j].is !== 'call') {return false;}
  40972. var f = find(this.selector(selector).functions, function (x) {//NOSONAR
  40973. return x[0] === value.value[i].value[j].name;
  40974. });
  40975. if (!(f && f[1] === -1)) {
  40976. // This filter is unknown or given an incorrect number of arguments
  40977. if (!f || f[1] !== value.value[i].value[j].args.length) {return false;}
  40978. }
  40979. }
  40980. }
  40981. return true;
  40982. }
  40983. function validateKeyword(value, selector) {
  40984. if (typeof this.selector(selector).type === 'object') {
  40985. return this.selector(selector).type
  40986. .indexOf(value.value[0].value) !== -1;
  40987. } else {
  40988. // allow unquoted keywords as strings
  40989. return this.selector(selector).type === 'string';
  40990. }
  40991. }
  40992. var i;
  40993. if (!this.selector(selector)) {
  40994. return false;
  40995. } else if (value.value[0].is === 'keyword') {
  40996. return validateKeyword(value, selector);
  40997. } else if (value.value[0].is === 'undefined') {
  40998. // caught earlier in the chain - ignore here so that
  40999. // error is not overridden
  41000. return true;
  41001. } else if (this.selector(selector).type === 'numbers') {
  41002. for (i in value.value) {
  41003. if (value.value[i].is !== 'float') {
  41004. return false;
  41005. }
  41006. }
  41007. return true;
  41008. } else if (this.selector(selector).type === 'tags') {
  41009. if (!value.value) {return false;}
  41010. if (!value.value[0].value) {
  41011. return value.value[0].is === 'tag';
  41012. }
  41013. for (i = 0; i < value.value[0].value.length; i++) {
  41014. if (value.value[0].value[i].is !== 'tag') {return false;}
  41015. }
  41016. return true;
  41017. } else if (this.selector(selector).type == 'functions') {
  41018. // For backwards compatibility, you can specify a string for `functions`-compatible
  41019. // values, though they will not be validated.
  41020. return validateFunctions(value, selector);
  41021. } else if (this.selector(selector).type === 'expression') {
  41022. return true;
  41023. } else if (this.selector(selector).type === 'unsigned') {
  41024. if (value.value[0].is === 'float') {
  41025. value.value[0].round();
  41026. return true;
  41027. } else {
  41028. return false;
  41029. }
  41030. } else {
  41031. if (this.selector(selector).validate) {
  41032. var valid = false;
  41033. for (i = 0; i < value.value.length; i++) {
  41034. if (this.selector(selector).type === value.value[i].is &&
  41035. this._validateValue[this.selector(selector).validate](env, value.value[i].value)) {
  41036. return true;
  41037. }
  41038. }
  41039. return valid;
  41040. } else {
  41041. return this.selector(selector).type === value.value[0].is;
  41042. }
  41043. }
  41044. }
  41045. };
  41046. SuperMap.CartoCSS.Tree.Reference.setVersion("latest");
  41047. SuperMap.CartoCSS.Tree.Rule = class Rule {
  41048. constructor(name, value, index, filename) {
  41049. this.is = 'rule';
  41050. var parts = name.split('/');
  41051. this.name = parts.pop();
  41052. this.instance = parts.length ? parts[0] : '__default__';
  41053. this.value = (value instanceof SuperMap.CartoCSS.Tree.Value) ?
  41054. value : new SuperMap.CartoCSS.Tree.Value([value]);
  41055. this.index = index;
  41056. this.symbolizer = SuperMap.CartoCSS.Tree.Reference.symbolizer(this.name);
  41057. this.filename = filename;
  41058. this.variable = (name.charAt(0) === '@');
  41059. }
  41060. clone() {
  41061. var clone = Object.create(SuperMap.CartoCSS.Tree.Rule.prototype);
  41062. clone.name = this.name;
  41063. clone.value = this.value;
  41064. clone.index = this.index;
  41065. clone.instance = this.instance;
  41066. clone.symbolizer = this.symbolizer;
  41067. clone.filename = this.filename;
  41068. clone.variable = this.variable;
  41069. return clone;
  41070. }
  41071. updateID() {
  41072. return this.id = this.zoom + '#' + this.instance + '#' + this.name;
  41073. }
  41074. toString() {
  41075. return '[' + SuperMap.CartoCSS.Tree.Zoom.toString(this.zoom) + '] ' + this.name + ': ' + this.value;
  41076. }
  41077. ev(context) {
  41078. return new SuperMap.CartoCSS.Tree.Rule(this.name,
  41079. this.value.ev(context),
  41080. this.index,
  41081. this.filename);
  41082. }
  41083. };
  41084. SuperMap.CartoCSS.Tree.Ruleset = class Ruleset {
  41085. constructor(selectors, rules) {
  41086. this.is = 'ruleset';
  41087. this.selectors = selectors;
  41088. this.rules = rules;
  41089. // static cache of find() function
  41090. this._lookups = {};
  41091. }
  41092. ev(env) {
  41093. var i,
  41094. rule,
  41095. ruleset = new SuperMap.CartoCSS.Tree.Ruleset(this.selectors, this.rules.slice(0));
  41096. ruleset.root = this.root;
  41097. // push the current ruleset to the frames stack
  41098. env.frames.unshift(ruleset);
  41099. // Evaluate everything else
  41100. for (i = 0, rule; i < ruleset.rules.length; i++) {
  41101. rule = ruleset.rules[i];
  41102. ruleset.rules[i] = rule.ev ? rule.ev(env) : rule;
  41103. }
  41104. // Pop the stack
  41105. env.frames.shift();
  41106. return ruleset;
  41107. }
  41108. match(args) {
  41109. return !args || args.length === 0;
  41110. }
  41111. variables() {
  41112. if (this._variables) {
  41113. return this._variables;
  41114. } else {
  41115. return this._variables = this.rules.reduce(function (hash, r) {
  41116. if (r instanceof SuperMap.CartoCSS.Tree.Rule && r.variable === true) {
  41117. hash[r.name] = r;
  41118. }
  41119. return hash;
  41120. }, {});
  41121. }
  41122. }
  41123. variable(name) {
  41124. return this.variables()[name];
  41125. }
  41126. rulesets() {
  41127. if (this._rulesets) {
  41128. return this._rulesets;
  41129. } else {
  41130. return this._rulesets = this.rules.filter(function (r) {
  41131. return (r instanceof SuperMap.CartoCSS.Tree.Ruleset);
  41132. });
  41133. }
  41134. }
  41135. find(selector, self) {
  41136. self = self || this;
  41137. var rules = [], match,
  41138. key = selector.toString();
  41139. if (key in this._lookups) {
  41140. return this._lookups[key];
  41141. }
  41142. this.rulesets().forEach(function (rule) {
  41143. if (rule !== self) {
  41144. for (var j = 0; j < rule.selectors.length; j++) {
  41145. match = selector.match(rule.selectors[j]);
  41146. if (match) {
  41147. if (selector.elements.length > 1) {
  41148. Array.prototype.push.apply(rules, rule.find(
  41149. new SuperMap.CartoCSS.Tree.Selector(null, null, selector.elements.slice(1)), self));
  41150. } else {
  41151. rules.push(rule);
  41152. }
  41153. break;
  41154. }
  41155. }
  41156. }
  41157. });
  41158. return this._lookups[key] = rules;
  41159. }
  41160. // Zooms can use variables. This replaces SuperMap.CartoCSS.Tree.Zoom objects on selectors
  41161. // with simple bit-arrays that we can compare easily.
  41162. evZooms(env) {
  41163. for (var i = 0; i < this.selectors.length; i++) {
  41164. var zval = SuperMap.CartoCSS.Tree.Zoom.all;
  41165. for (var z = 0; z < this.selectors[i].zoom.length; z++) {
  41166. zval = this.selectors[i].zoom[z].ev(env).zoom;
  41167. }
  41168. this.selectors[i].zoom = zval;
  41169. }
  41170. }
  41171. flatten(result, parents, env) {
  41172. var selectors = [], i, j;
  41173. if (this.selectors.length === 0) {
  41174. env.frames = env.frames.concat(this.rules);
  41175. }
  41176. // evaluate zoom variables on this object.
  41177. this.evZooms(env);
  41178. for (i = 0; i < this.selectors.length; i++) {
  41179. var child = this.selectors[i];
  41180. if (!child.filters) {
  41181. // This is an invalid filterset.
  41182. continue;
  41183. }
  41184. if (parents.length) {
  41185. for (j = 0; j < parents.length; j++) {
  41186. var parent = parents[j];
  41187. var mergedFilters = parent.filters.cloneWith(child.filters);
  41188. if (mergedFilters === null) {
  41189. // Filters could be added, but they didn't change the
  41190. // filters. This means that we only have to clone when
  41191. // the zoom levels or the attachment is different too.
  41192. if (parent.zoom === child.zoom &&
  41193. parent.attachment === child.attachment &&
  41194. parent.elements.join() === child.elements.join()) {
  41195. selectors.push(parent);
  41196. continue;
  41197. } else {
  41198. mergedFilters = parent.filters;
  41199. }
  41200. } else if (!mergedFilters) {
  41201. // The merged filters are invalid, that means we don't
  41202. // have to clone.
  41203. continue;
  41204. }
  41205. var clone = Object.create(SuperMap.CartoCSS.Tree.Selector.prototype);
  41206. clone.filters = mergedFilters;
  41207. clone.zoom = child.zoom;
  41208. clone.elements = parent.elements.concat(child.elements);
  41209. if (parent.attachment && child.attachment) {
  41210. clone.attachment = parent.attachment + '/' + child.attachment;
  41211. } else {clone.attachment = child.attachment || parent.attachment;}
  41212. clone.conditions = parent.conditions + child.conditions;
  41213. clone.index = child.index;
  41214. selectors.push(clone);
  41215. }
  41216. } else {
  41217. selectors.push(child);
  41218. }
  41219. }
  41220. var rules = [];
  41221. for (i = 0; i < this.rules.length; i++) {
  41222. var rule = this.rules[i];
  41223. // Recursively flatten any nested rulesets
  41224. if (rule instanceof SuperMap.CartoCSS.Tree.Ruleset) {
  41225. rule.flatten(result, selectors, env);
  41226. } else if (rule instanceof SuperMap.CartoCSS.Tree.Rule) {
  41227. rules.push(rule);
  41228. } else if (rule instanceof SuperMap.CartoCSS.Tree.Invalid) {
  41229. env.error(rule);
  41230. }
  41231. }
  41232. var index = rules.length ? rules[0].index : false;
  41233. for (i = 0; i < selectors.length; i++) {
  41234. // For specificity sort, use the position of the first rule to allow
  41235. // defining attachments that are under current element as a descendant
  41236. // selector.
  41237. if (index !== false) {
  41238. selectors[i].index = index;
  41239. }
  41240. result.push(new SuperMap.CartoCSS.Tree.Definition(selectors[i], rules.slice()));
  41241. }
  41242. return result;
  41243. }
  41244. };
  41245. SuperMap.CartoCSS.Tree.Selector = class Selector {
  41246. constructor(filters, zoom, elements, attachment, conditions, index) {
  41247. this.elements = elements || [];
  41248. this.attachment = attachment;
  41249. this.filters = filters || {};
  41250. this.zoom = typeof zoom !== 'undefined' ? zoom : SuperMap.CartoCSS.Tree.Zoom.all;
  41251. this.conditions = conditions;
  41252. this.index = index;
  41253. }
  41254. specificity() {
  41255. return this.elements.reduce(function (memo, e) {
  41256. var spec = e.specificity();
  41257. memo[0] += spec[0];
  41258. memo[1] += spec[1];
  41259. return memo;
  41260. }, [0, 0, this.conditions, this.index]);
  41261. }
  41262. };
  41263. /*style:class Invalid ),*/
  41264. SuperMap.CartoCSS.Tree.URL = class URL {
  41265. constructor(val, paths) {
  41266. this.is = 'uri';
  41267. this.value = val;
  41268. this.paths = paths;
  41269. }
  41270. toString() {
  41271. return this.value.toString();
  41272. }
  41273. ev(ctx) {
  41274. return new SuperMap.CartoCSS.Tree.URL(this.value.ev(ctx), this.paths);
  41275. }
  41276. };
  41277. SuperMap.CartoCSS.Tree.Value = class Value {
  41278. constructor(value) {
  41279. this.is = 'value';
  41280. this.value = value;
  41281. }
  41282. ev(env) {
  41283. if (this.value.length === 1) {
  41284. return this.value[0].ev(env);
  41285. } else {
  41286. return new SuperMap.CartoCSS.Tree.Value(this.value.map(function (v) {
  41287. return v.ev(env);
  41288. }));
  41289. }
  41290. }
  41291. toJS(env) {
  41292. //var v = this.value[0].value[0];
  41293. var val = this.ev(env);
  41294. var v = val.toString();
  41295. if (val.is === "color" || val.is === 'uri' || val.is === 'string' || val.is === 'keyword') {
  41296. v = "'" + v + "'";
  41297. } else if (val.is === 'field') {
  41298. // replace [varuable] by ctx['variable']
  41299. v = v.replace(/\[(.*)\]/g, "attributes['\_match1']")
  41300. } else if (val.value && typeof val.value === "object") {
  41301. v = "[" + v + "]";
  41302. }
  41303. return "_value = " + v + ";";
  41304. }
  41305. toString(env, selector, sep, format) {
  41306. return this.value.map(function (e) {
  41307. return e.toString(env, format);
  41308. }).join(sep || ', ');
  41309. }
  41310. clone() {
  41311. var obj = Object.create(SuperMap.CartoCSS.Tree.Value.prototype);
  41312. if (Array.isArray(obj)) {obj.value = this.value.slice();} else {obj.value = this.value;}
  41313. obj.is = this.is;
  41314. return obj;
  41315. }
  41316. };
  41317. SuperMap.CartoCSS.Tree.Variable = class Variable {
  41318. constructor(name, index, filename) {
  41319. this.is = 'variable';
  41320. this.name = name;
  41321. this.index = index;
  41322. this.filename = filename;
  41323. }
  41324. toString() {
  41325. return this.name;
  41326. }
  41327. ev(env) {
  41328. if (this._css) {return this._css;}
  41329. var thisframe = env.frames.filter(function (f) {
  41330. return f.name === this.name;
  41331. }.bind(this));
  41332. if (thisframe.length) {
  41333. return thisframe[0].value.ev(env);
  41334. } else {
  41335. env.error({
  41336. message: 'variable ' + this.name + ' is undefined',
  41337. index: this.index,
  41338. type: 'runtime',
  41339. filename: this.filename
  41340. });
  41341. return {
  41342. is: 'undefined',
  41343. value: 'undefined'
  41344. };
  41345. }
  41346. }
  41347. };
  41348. SuperMap.CartoCSS.Tree.Zoom = class Zoom {
  41349. constructor(op, value, index) {
  41350. this.op = op;
  41351. this.value = value;
  41352. this.index = index;
  41353. }
  41354. setZoom(zoom) {
  41355. this.zoom = zoom;
  41356. return this;
  41357. }
  41358. ev(env) {
  41359. var value = parseInt(this.value.ev(env).toString(), 10);
  41360. if (value > SuperMap.CartoCSS.Tree.Zoom.maxZoom || value < 0) {
  41361. env.error({
  41362. message: 'Only zoom levels between 0 and ' +
  41363. SuperMap.CartoCSS.Tree.Zoom.maxZoom + ' supported.',
  41364. index: this.index
  41365. });
  41366. }
  41367. switch (this.op) {
  41368. case '=':
  41369. this.zoom = "zoom && zoom === " + value;
  41370. return this;
  41371. case '>':
  41372. this.zoom = "zoom && zoom > " + value;
  41373. break;
  41374. case '>=':
  41375. this.zoom = "zoom && zoom >= " + value;
  41376. break;
  41377. case '<':
  41378. this.zoom = "zoom && zoom < " + value;
  41379. break;
  41380. case '<=':
  41381. this.zoom = "zoom && zoom <= " + value;
  41382. break;
  41383. default:
  41384. return this;
  41385. break;
  41386. }
  41387. /*
  41388. for (var i = 0; i <= SuperMap.CartoCSS.Tree.Zoom.maxZoom; i++) {
  41389. if (i >= start && i <= end) {
  41390. zoom |= (1 << i);
  41391. }
  41392. }
  41393. this.zoom = zoom;
  41394. this.zoom=value+this.op+"zoom";*/
  41395. return this;
  41396. }
  41397. toString() {
  41398. var str = '';
  41399. for (var i = 0; i <= SuperMap.CartoCSS.Tree.Zoom.maxZoom; i++) {
  41400. str += (this.zoom & (1 << i)) ? 'X' : '.';
  41401. }
  41402. return str;
  41403. }
  41404. };
  41405. // Covers all zoomlevels from 0 to 22
  41406. SuperMap.CartoCSS.Tree.Zoom.all = 23;
  41407. SuperMap.CartoCSS.Tree.Zoom.maxZoom = 22;
  41408. SuperMap.CartoCSS.Tree.Zoom.ranges = {
  41409. 0: 1000000000,
  41410. 1: 500000000,
  41411. 2: 200000000,
  41412. 3: 100000000,
  41413. 4: 50000000,
  41414. 5: 25000000,
  41415. 6: 12500000,
  41416. 7: 6500000,
  41417. 8: 3000000,
  41418. 9: 1500000,
  41419. 10: 750000,
  41420. 11: 400000,
  41421. 12: 200000,
  41422. 13: 100000,
  41423. 14: 50000,
  41424. 15: 25000,
  41425. 16: 12500,
  41426. 17: 5000,
  41427. 18: 2500,
  41428. 19: 1500,
  41429. 20: 750,
  41430. 21: 500,
  41431. 22: 250,
  41432. 23: 100
  41433. };
  41434. ;// CONCATENATED MODULE: ./src/common/style/ThemeStyle.js
  41435. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  41436. * This program are made available under the terms of the Apache License, Version 2.0
  41437. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41438. /**
  41439. * @class SuperMap.ThemeStyle
  41440. * @classdesc 客户端专题图风格类。
  41441. * @category Visualization Theme
  41442. * @param {Object} options - 可选参数。
  41443. * @param {boolean} [options.fill=true] - 是否填充,不需要填充则设置为 false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
  41444. * @param {string} [options.fillColor='#000000'] - 十六进制填充颜色。
  41445. * @param {number} [options.fillOpacity=1] - 填充不透明度。取值范围[0, 1]。
  41446. * @param {boolean} [options.stroke=false] - 是否描边,不需要描边则设置为false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
  41447. * @param {string} [options.strokeColor='#000000'] - 十六进制描边颜色。
  41448. * @param {number} [options.strokeOpacity=1] - 描边的不透明度。取值范围[0, 1]。
  41449. * @param {number} [options.strokeWidth=1] - 线宽度/描边宽度。
  41450. * @param {string} [options.strokeLinecap='butt'] - 线帽样式。strokeLinecap 有三种类型 “butt", "round", "square"。
  41451. * @param {string} [options.strokeLineJoin='iter'] - 线段连接样式。strokeLineJoin 有三种类型 “miter", "round", "bevel"。
  41452. * @param {string} [options.strokeDashstyle='solid'] - 虚线类型。strokeDashstyle 有八种类型 “dot",“dash",“dashdot",“longdash",“longdashdot",“solid", "dashed", "dotted"。solid 表示实线。
  41453. * @param {number} [options.pointRadius=6] - 点半径,单位为像素。
  41454. * @param {number} [options.shadowBlur=0] - 阴影模糊度,(大于 0 有效;)。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
  41455. * @param {string} [options.shadowColor='#000000'] - 阴影颜色。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
  41456. * @param {number} [options.shadowOffsetX=0] - 阴影 X 方向偏移值。
  41457. * @param {number} [options.shadowOffsetY=0] - 阴影 Y 方向偏移值。
  41458. * @param {string} options.label - 专题要素附加文本标签内容。
  41459. * @param {string} [options.fontColor] - 附加文本字体颜色。
  41460. * @param {number} [options.fontSize=12] - 附加文本字体大小,单位是像素。
  41461. * @param {string} [options.fontStyle='normal'] - 附加文本字体样式。可设值:"normal", "italic", "oblique"。
  41462. * @param {string} [options.fontVariant='normal'] - 附加文本字体变体。可设值:"normal", "small-caps"。
  41463. * @param {string} [options.fontWeight='normal'] - 附加文本字体粗细。可设值:"normal", "bold", "bolder", "lighter"。
  41464. * @param {string} [options.fontFamily='arial,sans-serif'] - 附加文本字体系列。fontFamily 值是字体族名称或/及类族名称的一个优先表,每个值逗号分割,
  41465. * 浏览器会使用它可识别的第一个可以使用具体的字体名称("times"、"courier"、"arial")或字体系列名称
  41466. * ("serif"、"sans-serif"、"cursive"、"fantasy"、"monospace")。
  41467. * @param {string} [options.labelPosition='top'] - 附加文本位置, 可以是 'inside', 'left', 'right', 'top', 'bottom'。
  41468. * @param {string} [options.labelAlign='center'] - 附加文本水平对齐。可以是 'left', 'right', 'center'。
  41469. * @param {string} [options.labelBaseline='middle'] - 附加文本垂直对齐。 可以是 'top', 'bottom', 'middle' 。
  41470. * @param {number} [options.labelXOffset=0] - 附加文本在x轴方向的偏移量。
  41471. * @param {number} [options.labelYOffset=0] - 附加文本在y轴方向的偏移量。
  41472. */
  41473. class ThemeStyle {
  41474. constructor(options) {
  41475. options = options || {};
  41476. /**
  41477. * @member {boolean} [SuperMap.ThemeStyle.prototype.fill=true]
  41478. * @description 是否填充,不需要填充则设置为 false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
  41479. */
  41480. this.fill = true;
  41481. /**
  41482. * @member {string} [SuperMap.ThemeStyle.prototype.fillColor="#000000"]
  41483. * @description 十六进制填充颜色。
  41484. */
  41485. this.fillColor = "#000000";
  41486. /**
  41487. * @member {number} [SuperMap.ThemeStyle.prototype.fillOpacity=1]
  41488. * @description 填充不透明度。取值范围[0, 1]。
  41489. */
  41490. this.fillOpacity = 1;
  41491. /**
  41492. * @member {boolean} [SuperMap.ThemeStyle.prototype.stroke=false]
  41493. * @description 是否描边,不需要描边则设置为false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
  41494. */
  41495. this.stroke = false;
  41496. /**
  41497. * @member {string} [SuperMap.ThemeStyle.prototype.strokeColor="#000000"]
  41498. * @description 十六进制描边颜色。
  41499. */
  41500. this.strokeColor = "#000000";
  41501. /**
  41502. * @member {number} [SuperMap.ThemeStyle.prototype.strokeOpacity=1]
  41503. * @description 描边的不透明度。取值范围[0, 1]。
  41504. */
  41505. this.strokeOpacity = 1;
  41506. /**
  41507. * @member {number} [SuperMap.ThemeStyle.prototype.strokeWidth=1]
  41508. * @description 线宽度/描边宽度。
  41509. */
  41510. this.strokeWidth = 1;
  41511. /**
  41512. * @member {string} [SuperMap.ThemeStyle.prototype.strokeLinecap="butt"]
  41513. * @description 线帽样式;strokeLinecap 有三种类型 “butt", "round", "square" 。
  41514. */
  41515. this.strokeLinecap = "butt";
  41516. /**
  41517. * @member {string} [SuperMap.ThemeStyle.prototype.strokeLineJoin="miter"]
  41518. * @description 线段连接样式;strokeLineJoin 有三种类型 “miter", "round", "bevel"。
  41519. */
  41520. this.strokeLineJoin = "miter";
  41521. /**
  41522. * @member {string} [SuperMap.ThemeStyle.prototype.strokeDashstyle="solid"]
  41523. * @description 虚线类型; strokeDashstyle 有八种类型 “dot",“dash",“dashdot",“longdash",“longdashdot",“solid", "dashed", "dotted";
  41524. * solid 表示实线。
  41525. */
  41526. this.strokeDashstyle = "solid";
  41527. /**
  41528. * @member {number} [SuperMap.ThemeStyle.prototype.pointRadius=6]
  41529. * @description 点半径。单位为像素。
  41530. */
  41531. this.pointRadius = 6;
  41532. /**
  41533. * @member {number} [SuperMap.ThemeStyle.prototype.shadowBlur=0]
  41534. * @description 阴影模糊度,(大于 0 有效)。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
  41535. */
  41536. this.shadowBlur = 0;
  41537. /**
  41538. * @member {string} [SuperMap.ThemeStyle.prototype.shadowColor='#000000']
  41539. * @description 阴影颜色。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
  41540. */
  41541. this.shadowColor = "#000000";
  41542. /**
  41543. * @member {number} [SuperMap.ThemeStyle.prototype.shadowOffsetX=0]
  41544. * @description 阴影 X 方向偏移值。
  41545. */
  41546. this.shadowOffsetX = 0;
  41547. /**
  41548. * @member {number} SuperMap.ThemeStyle.prototype.shadowOffsetY
  41549. * @description Y 方向偏移值。
  41550. */
  41551. this.shadowOffsetY = 0;
  41552. /**
  41553. * @member {string} [SuperMap.ThemeStyle.prototype.label]
  41554. * @description 专题要素附加文本标签内容。
  41555. */
  41556. this.label = "";
  41557. /**
  41558. * @member {boolean} [SuperMap.ThemeStyle.prototype.labelRect=false]
  41559. * @description 是否显示文本标签矩形背景。
  41560. */
  41561. this.labelRect = false;
  41562. /**
  41563. * @member {string} [SuperMap.ThemeStyle.prototype.fontColor]
  41564. * @description 附加文本字体颜色。
  41565. */
  41566. this.fontColor = "";
  41567. /**
  41568. * @member {number} [SuperMap.ThemeStyle.prototype.fontSize=12]
  41569. * @description 附加文本字体大小,单位是像素。
  41570. */
  41571. this.fontSize = 12;
  41572. /**
  41573. * @member {string} [SuperMap.ThemeStyle.prototype.fontStyle="normal"]
  41574. * @description 附加文本字体样式。可设值:"normal", "italic", "oblique"。
  41575. */
  41576. this.fontStyle = "normal";
  41577. /**
  41578. * @member {string} [SuperMap.ThemeStyle.prototype.fontVariant="normal"]
  41579. * @description 附加文本字体变体。可设值:"normal", "small-caps"。
  41580. */
  41581. this.fontVariant = "normal";
  41582. /**
  41583. * @member {string} [SuperMap.ThemeStyle.prototype.fontWeight="normal"]
  41584. * @description 附加文本字体粗细。可设值:"normal", "bold", "bolder", "lighter"。
  41585. */
  41586. this.fontWeight = "normal";
  41587. /**
  41588. * @member {string} [SuperMap.ThemeStyle.prototype.fontFamily="arial,sans-serif"]
  41589. * @description 附加文本字体系列。fontFamily 值是字体族名称或/及类族名称的一个优先表,每个值逗号分割,浏览器会使用它可识别的第一个
  41590. * 可以使用具体的字体名称("times"、"courier"、"arial")或字体系列名称("serif"、"sans-serif"、"cursive"、"fantasy"、"monospace")。
  41591. */
  41592. this.fontFamily = "arial,sans-serif";
  41593. /**
  41594. * @member {string} [SuperMap.ThemeStyle.prototype.labelPosition='top']
  41595. * @description 附加文本位置, 可以是 'inside', 'left', 'right', 'top', 'bottom'。
  41596. */
  41597. this.labelPosition = "top";
  41598. /**
  41599. * @member {string} [SuperMap.ThemeStyle.prototype.labelAlign='center']
  41600. * @description 附加文本水平对齐。可以是 'left', 'right', 'center'。
  41601. */
  41602. this.labelAlign = "center";
  41603. /**
  41604. * @member {string} [SuperMap.ThemeStyle.prototype.labelBaseline='middle']
  41605. * @description 附加文本垂直对齐。 可以是 'top', 'bottom', 'middle'。
  41606. */
  41607. this.labelBaseline = "middle";
  41608. /**
  41609. * @member {number} [SuperMap.ThemeStyle.prototype.labelXOffset=0]
  41610. * @description 附加文本在 X 轴方向的偏移量。
  41611. */
  41612. this.labelXOffset = 0;
  41613. /**
  41614. * @member {number} [SuperMap.ThemeStyle.prototype.labelYOffset=0]
  41615. * @description 附加文本在 Y 轴方向的偏移量。
  41616. */
  41617. this.labelYOffset = 0;
  41618. Util.extend(this, options);
  41619. }
  41620. }
  41621. SuperMap.ThemeStyle = ThemeStyle;
  41622. ;// CONCATENATED MODULE: ./src/common/style/index.js
  41623. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  41624. * This program are made available under the terms of the Apache License, Version 2.0
  41625. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41626. ;// CONCATENATED MODULE: ./src/common/overlay/feature/ShapeParameters.js
  41627. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  41628. * This program are made available under the terms of the Apache License, Version 2.0
  41629. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41630. /**
  41631. * @class SuperMap.Feature.ShapeParameters
  41632. * @category Visualization Theme
  41633. * @classdesc 图形参数基类,此类不可实例化
  41634. */
  41635. class ShapeParameters {
  41636. /**
  41637. * @function SuperMap.Feature.ShapeParameters.prototype.constructor
  41638. * @description 图形参数对象。
  41639. * @returns {SuperMap.Feature.ShapeParameters} 图形参数对象。
  41640. */
  41641. constructor() {
  41642. /**
  41643. * @member {Array} [SuperMap.Feature.ShapeParameters.prototype.refOriginalPosition=[0,0]]
  41644. * @description 图形参考原点位置,图形的参考中心位置。
  41645. * refOriginalPosition 是长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  41646. * refOriginalPosition 表示图形的参考中心,通常情况下,图形是使用 canvas 的原点位置作为位置参考,
  41647. * 但 refOriginalPosition 可以改变图形的参考位置,例如: refOriginalPosition = [80, 80],
  41648. * 图形圆的 style.x = 20, style.y = 20,那么圆在 canvas 中的实际位置是 [100, 100]。
  41649. * 图形(Shape) 的所有位置相关属性都是以 refOriginalPosition 为参考中心,
  41650. * 也就是说图形的所有位置信息在 canvas 中都是以 refOriginalPosition 为参考的相对位置,只有
  41651. * refOriginalPosition 的值为 [0, 0] 时,图形的位置信息才是 canvas 绝对位置。
  41652. * 图形的位置信息通常有:style.pointList,style.x,style.y。
  41653. */
  41654. this.refOriginalPosition = [0, 0];
  41655. /**
  41656. * @member {string} SuperMap.Feature.ShapeParameters.prototype.refDataID
  41657. * @description 图形所关联数据的 ID(<{@link SuperMap.Feature.Vector}> 的 id)。
  41658. */
  41659. this.refDataID = null;
  41660. /**
  41661. * @member {boolean} SuperMap.Feature.ShapeParameters.prototype.isHoverByRefDataID
  41662. * @description 是否根据 refDataID 进行高亮。用于同时高亮所有 refDataID 相同的图形。
  41663. */
  41664. this.isHoverByRefDataID = false;
  41665. /**
  41666. * @member {string} SuperMap.Feature.ShapeParameters.prototype.refDataHoverGroup
  41667. * @description 高亮图形组的组名。此属性在 refDataID 有效且 isHoverByRefDataID 为 true 时生效。
  41668. * 一旦设置此属性,且属性值有效,只有关联同一个数据的图形且此属性相同的图形才会高亮。
  41669. */
  41670. this.refDataHoverGroup = null;
  41671. /**
  41672. * @member {Object} SuperMap.Feature.ShapeParameters.prototype.dataInfo
  41673. * @description 图形携带的附加数据。
  41674. */
  41675. this.dataInfo = null;
  41676. /**
  41677. * @member {boolean} SuperMap.Feature.ShapeParameters.prototype.clickable
  41678. * @description 是否可点击。
  41679. */
  41680. this.clickable = true;
  41681. /**
  41682. * @member {boolean} SuperMap.Feature.ShapeParameters.prototype.hoverable
  41683. * @description 是否可点击。
  41684. */
  41685. this.hoverable = true;
  41686. /**
  41687. * @member {Object} SuperMap.Feature.ShapeParameters.prototype.style
  41688. * @description 图形样式对象,可设样式属性在子类中确定。
  41689. */
  41690. this.style = null;
  41691. /**
  41692. * @member {Object} SuperMap.Feature.ShapeParameters.prototype.highlightStyle
  41693. * @description 高亮样式对象,可设样式属性与 style 的可设样式属性相同。
  41694. */
  41695. this.highlightStyle = {};
  41696. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters";
  41697. }
  41698. /**
  41699. * @function SuperMap.Feature.ShapeParameters.prototype.destroy
  41700. * @description 销毁对象。
  41701. */
  41702. destroy() {
  41703. this.refOriginalPosition = null;
  41704. this.refDataID = null;
  41705. this.isHoverByRefDataID = null;
  41706. this.refDataHoverGroup = null;
  41707. this.dataInfo = null;
  41708. this.clickable = null;
  41709. this.hoverable = null;
  41710. this.style = null;
  41711. this.highlightStyle = null;
  41712. }
  41713. }
  41714. SuperMap.Feature = SuperMap.Feature || {};
  41715. SuperMap.Feature.ShapeParameters = ShapeParameters;
  41716. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Point.js
  41717. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  41718. * This program are made available under the terms of the Apache License, Version 2.0
  41719. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41720. /**
  41721. * @class SuperMap.Feature.ShapeParameters.Point
  41722. * @category Visualization Theme
  41723. * @classdesc 点参数对象。
  41724. * @extends {SuperMap.Feature.ShapeParameters}
  41725. */
  41726. class Point_Point extends ShapeParameters {
  41727. /**
  41728. * @function SuperMap.Feature.ShapeParameters.Point.prototype.constructor
  41729. * @description 创建一个图形点参数对象。
  41730. * @param {number} x - 点 x 坐标,必设参数。
  41731. * @param {number} y - 点 y 坐标,必设参数。
  41732. * @returns {SuperMap.Feature.ShapeParameters.Point} 标签参数对象。
  41733. */
  41734. constructor(x, y) {
  41735. super(x, y);
  41736. /**
  41737. * @member {number} SuperMap.Feature.ShapeParameters.Point.prototype.x
  41738. * @description 点 x 坐标。
  41739. */
  41740. this.x = !isNaN(x) ? x : 0;
  41741. /**
  41742. * @member {number} SuperMap.Feature.ShapeParameters.Point.prototype.y
  41743. * @description 点 y 坐标。
  41744. */
  41745. this.y = !isNaN(y) ? y : 0;
  41746. /**
  41747. * @member {number} SuperMap.Feature.ShapeParameters.Point.prototype.r
  41748. * @description 点的半径。
  41749. */
  41750. this.r = 6;
  41751. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Point";
  41752. }
  41753. /**
  41754. * @function SuperMap.Feature.ShapeParameters.Point.prototype.destroy
  41755. * @description 销毁对象。
  41756. */
  41757. destroy() {
  41758. this.x = null;
  41759. this.y = null;
  41760. this.r = null;
  41761. super.destroy();
  41762. }
  41763. }
  41764. /**
  41765. * @typedef {Object} SuperMap.Feature.ShapeParameters.Point.style
  41766. * @property {number} pointRadius - 点的半径,默认值:6。
  41767. * @property {boolean} fill - 是否填充,不需要填充则设置为false,默认值为 true。此属性与 stroke 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  41768. * @property {string} fillColor - 十六进制填充颜色。默认值为 "#000000"。
  41769. * @property {number} fillOpacity - 填充不透明度。取值范围[0, 1],默认值 1。
  41770. * @property {boolean} stroke - 是否描边,不需要描边则设置为 false,默认值为 false。此属性与 fill 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  41771. * @property {string} strokeColor - 十六进制描边颜色。
  41772. * @property {number} strokeWidth - 描边宽度,默认值 1。
  41773. * @property {number} strokeOpacity - 描边的不透明度。取值范围[0, 1],默认值 1。
  41774. * @property {number} shadowBlur - 阴影模糊度,(大于 0 有效; 默认值 0)。
  41775. * @property {string} shadowColor - 阴影颜色; 默认值 '#000000'。
  41776. * @property {number} shadowOffsetX - 阴影 X 方向偏移值; 默认值 0。
  41777. * @property {number} shadowOffsetY - 阴影 Y 方向偏移值; 默认值 0。
  41778. */
  41779. SuperMap.Feature = SuperMap.Feature || {};
  41780. SuperMap.Feature.ShapeParameters.Point = Point_Point;
  41781. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Line.js
  41782. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  41783. * This program are made available under the terms of the Apache License, Version 2.0
  41784. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41785. /**
  41786. * @class SuperMap.Feature.ShapeParameters.Line
  41787. * @category Visualization Theme
  41788. * @classdesc 线参数对象。
  41789. * @extends {SuperMap.Feature.ShapeParameters}
  41790. */
  41791. class Line_Line extends ShapeParameters {
  41792. /**
  41793. * @function SuperMap.Feature.ShapeParameters.Line.prototype.constructor
  41794. * @description 创建一个图形线参数对象。
  41795. * @param {Array} pointList - 线要素节点数组,二维数组,必设参数。
  41796. * @returns {SuperMap.Feature.ShapeParameters.Line} 圆形参数对象。
  41797. */
  41798. constructor(pointList) {
  41799. super(pointList);
  41800. /**
  41801. * @member {Array} SuperMap.Feature.ShapeParameters.Line.prototype.pointList
  41802. * @description 线要素节点数组,二维数组。
  41803. * 数组形如:
  41804. * (start code)
  41805. * [
  41806. * [10, 20], //节点
  41807. * [30, 40],
  41808. * [25, 30] //最后一个节点和第一个节点不必相同,绘制时自动封闭
  41809. * ]
  41810. * (end)
  41811. */
  41812. this.pointList = pointList;
  41813. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Line";
  41814. }
  41815. /**
  41816. * @function SuperMap.Feature.ShapeParameters.Line.prototype.destroy
  41817. * @description 销毁对象。
  41818. */
  41819. destroy() {
  41820. this.pointList = null;
  41821. super.destroy();
  41822. }
  41823. }
  41824. /**
  41825. * @typedef {Object} SuperMap.Feature.ShapeParameters.Line.style
  41826. * @property {string} strokeColor - 十六进制线颜色。
  41827. * @property {number} strokeWidth - 线宽度,默认值 1。
  41828. * @property {string} strokeLinecap - 线帽样式;strokeLinecap 有三种类型 :“butt", "round", "square"; 默认为"butt"。
  41829. * @property {string} strokeLineJoin - 线段连接样式;strokeLineJoin 有三种类型: “miter", "round", "bevel"; 默认为"miter"。
  41830. * @property {string} strokeDashstyle - 虚线类型; strokeDashstyle 有八种类型 :“dot",“dash",“dashdot",“longdash",“longdashdot",“solid", "dashed", "dotted"; 默认值 "solid"。solid 表示实线。
  41831. * @property {number} strokeOpacity - 线的不透明度。取值范围[0, 1],默认值 1。
  41832. * @property {number} shadowBlur - 阴影模糊度,(大于 0 有效; 默认值 0)。
  41833. * @property {string} shadowColor - 阴影颜色; 默认值 '#000000'。
  41834. * @property {number} shadowOffsetX - 阴影 X 方向偏移值; 默认值 0。
  41835. * @property {number} shadowOffsetY - 阴影 Y 方向偏移值; 默认值 0。
  41836. */
  41837. SuperMap.Feature = SuperMap.Feature || {};
  41838. SuperMap.Feature.ShapeParameters.Line = Line_Line;
  41839. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Polygon.js
  41840. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  41841. * This program are made available under the terms of the Apache License, Version 2.0
  41842. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41843. /**
  41844. * @class SuperMap.Feature.ShapeParameters.Polygon
  41845. * @category Visualization Theme
  41846. * @classdesc 面参数对象。
  41847. * @extends {SuperMap.Feature.ShapeParameters}
  41848. */
  41849. class Polygon_Polygon extends ShapeParameters {
  41850. /**
  41851. * @function SuperMap.Feature.ShapeParameters.Polygon.prototype.constructor
  41852. * @description 创建一个图形面参数对象。
  41853. * @param {Array} pointList - 横坐标,必设参数。
  41854. * @returns {SuperMap.Feature.ShapeParameters.Polygon} 标签参数对象。
  41855. */
  41856. constructor(pointList) {
  41857. super(pointList);
  41858. /**
  41859. * @member {Array} SuperMap.Feature.ShapeParameters.Polygon.prototype.pointList
  41860. * @description 面要素节点数组,二维数组。
  41861. * 数组形如:
  41862. * (start code)
  41863. * [
  41864. * [10, 20], //节点
  41865. * [30, 40],
  41866. * [25, 30] //最后一个节点和第一个节点不必相同,绘制时自动封闭
  41867. * ]
  41868. * (end)
  41869. */
  41870. this.pointList = pointList;
  41871. /**
  41872. * @member {Array} SuperMap.Feature.ShapeParameters.Polygon.prototype.holePolygonPointLists
  41873. * @description 岛洞面多边形顶点数组(三维数组)
  41874. */
  41875. this.holePolygonPointLists = null;
  41876. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Polygon";
  41877. }
  41878. /**
  41879. * @function SuperMap.Feature.ShapeParameters.Polygon.prototype.destroy
  41880. * @description 销毁对象。
  41881. */
  41882. destroy() {
  41883. this.pointList = null;
  41884. this.holePolygonPointLists = null;
  41885. super.destroy();
  41886. }
  41887. }
  41888. /**
  41889. * @typedef {Object} SuperMap.Feature.ShapeParameters.Polygon.style
  41890. * @property {boolean} fill - 是否填充,不需要填充则设置为false,默认值为 true。此属性与 stroke 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  41891. * @property {string} fillColor - 十六进制填充颜色。默认值为 "#000000"。
  41892. * @property {number} fillOpacity - 填充不透明度。取值范围[0, 1],默认值 1。
  41893. * @property {boolean} stroke - 是否描边,不需要描边则设置为 false,默认值为 false。此属性与 fill 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  41894. * @property {string} strokeColor - 十六进制描边颜色。
  41895. * @property {number} strokeWidth - 描边宽度,默认值 1。
  41896. * @property {number} strokeOpacity - 描边的不透明度。取值范围[0, 1],默认值 1。
  41897. * @property {string} strokeLinecap - 线帽样式;strokeLinecap 有三种类型 :“butt", "round", "square"; 默认为"butt"。
  41898. * @property {string} strokeLineJoin - 线段连接样式;strokeLineJoin 有三种类型: “miter", "round", "bevel"; 默认为"miter"。
  41899. * @property {string} strokeDashstyle - 虚线类型; strokeDashstyle 有八种类型 :“dot",“dash",“dashdot",“longdash",“longdashdot",“solid", "dashed", "dotted"; 默认值 "solid"。solid 表示实线。
  41900. * @property {number} shadowBlur - 阴影模糊度,(大于 0 有效; 默认值 0)。
  41901. * @property {string} shadowColor - 阴影颜色; 默认值 '#000000'。
  41902. * @property {number} shadowOffsetX - 阴影 X 方向偏移值; 默认值 0。
  41903. * @property {number} shadowOffsetY - 阴影 Y 方向偏移值; 默认值 0。
  41904. */
  41905. SuperMap.Feature = SuperMap.Feature || {};
  41906. SuperMap.Feature.ShapeParameters.Polygon = Polygon_Polygon;
  41907. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Rectangle.js
  41908. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  41909. * This program are made available under the terms of the Apache License, Version 2.0
  41910. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41911. /**
  41912. * @class SuperMap.Feature.ShapeParameters.Rectangle
  41913. * @category Visualization Theme
  41914. * @classdesc 矩形参数对象。
  41915. * @extends {SuperMap.Feature.ShapeParameters}
  41916. */
  41917. class Rectangle_Rectangle extends ShapeParameters {
  41918. /**
  41919. * @function SuperMap.Feature.ShapeParameters.Rectangle.prototype.constructor
  41920. * @description 创建一个图形矩形参数对象。
  41921. * @param {number} x - 矩形 x 坐标,必设参数。
  41922. * @param {number} y - 矩形 y 坐标,必设参数。
  41923. * @param {number} width - 矩形 width 坐标,必设参数。
  41924. * @param {number} height - 矩形 height 坐标,必设参数。
  41925. * @returns {SuperMap.Feature.ShapeParameters.Rectangle} 图形矩形参数对象。
  41926. */
  41927. constructor(x, y, width, height) {
  41928. super(x, y, width, height);
  41929. /**
  41930. * @member {number} SuperMap.Feature.ShapeParameters.Rectangle.prototype.x
  41931. * @description 左上角 x 坐标。
  41932. */
  41933. this.x = !isNaN(x) ? x : 0;
  41934. /**
  41935. * @member {number} SuperMap.Feature.ShapeParameters.Rectangle.prototype.y
  41936. * @description 左上角 y 坐标。
  41937. */
  41938. this.y = !isNaN(x) ? y : 0;
  41939. /**
  41940. * @member {number} SuperMap.Feature.ShapeParameters.Rectangle.prototype.width
  41941. * @description 宽度。
  41942. */
  41943. this.width = !isNaN(width) ? width : 0;
  41944. /**
  41945. * @member {number} SuperMap.Feature.ShapeParameters.Rectangle.prototype.height
  41946. * @description 高度。
  41947. */
  41948. this.height = !isNaN(height) ? height : 0;
  41949. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Rectangle";
  41950. }
  41951. /**
  41952. * @function SuperMap.Feature.ShapeParameters.Rectangle.prototype.destroy
  41953. * @description 销毁对象。
  41954. */
  41955. destroy() {
  41956. this.x = null;
  41957. this.y = null;
  41958. this.width = null;
  41959. this.height = null;
  41960. super.destroy();
  41961. }
  41962. }
  41963. /**
  41964. * @typedef {Object} SuperMap.Feature.ShapeParameters.Rectangle.style
  41965. * @property {boolean} fill - 是否填充,不需要填充则设置为false,默认值为 true。此属性与 stroke 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  41966. * @property {string} fillColor - 十六进制填充颜色。默认值为 "#000000"。
  41967. * @property {number} fillOpacity - 填充不透明度。取值范围[0, 1],默认值 1。
  41968. * @property {boolean} stroke - 是否描边,不需要描边则设置为 false,默认值为 false。此属性与 fill 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  41969. * @property {string} strokeColor - 十六进制描边颜色。
  41970. * @property {number} strokeWidth - 描边宽度,默认值 1。
  41971. * @property {number} strokeOpacity - 描边的不透明度。取值范围[0, 1],默认值 1。
  41972. * @property {string} strokeLinecap - 线帽样式;strokeLinecap 有三种类型 :“butt", "round", "square"; 默认为"butt"。
  41973. * @property {string} strokeLineJoin - 线段连接样式;strokeLineJoin 有三种类型: “miter", "round", "bevel"; 默认为"miter"。
  41974. * @property {string} strokeDashstyle - 虚线类型; strokeDashstyle 有八种类型 :“dot",“dash",“dashdot",“longdash",“longdashdot",“solid", "dashed", "dotted"; 默认值 "solid"。solid 表示实线。
  41975. * @property {number} shadowBlur - 阴影模糊度,(大于 0 有效; 默认值 0)。
  41976. * @property {string} shadowColor - 阴影颜色; 默认值 '#000000'。
  41977. * @property {number} shadowOffsetX - 阴影 X 方向偏移值; 默认值 0。
  41978. * @property {number} shadowOffsetY - 阴影 Y 方向偏移值; 默认值 0。
  41979. */
  41980. SuperMap.Feature = SuperMap.Feature || {};
  41981. SuperMap.Feature.ShapeParameters.Rectangle = Rectangle_Rectangle;
  41982. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Sector.js
  41983. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  41984. * This program are made available under the terms of the Apache License, Version 2.0
  41985. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  41986. /**
  41987. * @class SuperMap.Feature.ShapeParameters.Sector
  41988. * @category Visualization Theme
  41989. * @classdesc 扇形参数对象。
  41990. * @extends {SuperMap.Feature.ShapeParameters}
  41991. */
  41992. class Sector extends ShapeParameters {
  41993. /**
  41994. * @function SuperMap.Feature.ShapeParameters.Sector.prototype.constructor
  41995. * @description 创建一个扇形参数对象。
  41996. * @param {number} x - 圆心 x 坐标,必设参数。
  41997. * @param {number} y - 圆心 y 坐标,必设参数。
  41998. * @param {number} r - 外圆半径,必设参数。
  41999. * @param {number} startAngle - 起始角度,必设参数。取值范围[0, 360)。
  42000. * @param {number} endAngle - 结束角度,必设参数。取值范围(0, 360]。
  42001. * @param {number} [r0=0] - 内圆半径,指定后将出现内弧,同时扇边长度为'r - r0'。取值范围[0, r)。
  42002. * @returns {SuperMap.Feature.ShapeParameters.Sector} 扇形参数对象。
  42003. */
  42004. constructor(x, y, r, startAngle, endAngle, r0, clockWise) {
  42005. super(x, y, r, startAngle, endAngle, r0, clockWise);
  42006. /**
  42007. * @member {number} SuperMap.Feature.ShapeParameters.Sector.prototype.x
  42008. * @description 圆心 x 坐标。
  42009. */
  42010. this.x = !isNaN(x) ? x : 0;
  42011. /**
  42012. * @member {number} SuperMap.Feature.ShapeParameters.Sector.prototype.Y
  42013. * @description 圆心 Y 坐标。
  42014. */
  42015. this.y = !isNaN(y) ? y : 0;
  42016. /**
  42017. * @member {number} SuperMap.Feature.ShapeParameters.Sector.prototype.r
  42018. * @description 外圆半径。
  42019. */
  42020. this.r = !isNaN(r) ? r : 0;
  42021. /**
  42022. * @member {number} SuperMap.Feature.ShapeParameters.Sector.prototype.startAngle
  42023. * @description 起始角度。取值范围[0, 360),默认值:null。
  42024. */
  42025. this.startAngle = !isNaN(startAngle) ? startAngle : 0;
  42026. /**
  42027. * @member {number} SuperMap.Feature.ShapeParameters.Sector.prototype.endAngle
  42028. * @description 结束角度。取值范围(0, 360],默认值:null。
  42029. */
  42030. this.endAngle = !isNaN(endAngle) ? endAngle : 0;
  42031. /**
  42032. * @member {number} [SuperMap.Feature.ShapeParameters.Sector.prototype.r0=0]
  42033. * @description 内圆半径,指定后将出现内弧,同时扇边长度为 r 减 r0。取值范围[0, r)。
  42034. */
  42035. this.r0 = !isNaN(r0) ? r0 : 0;
  42036. /**
  42037. * @member {number} [SuperMap.Feature.ShapeParameters.Sector.prototype.clockWise=false]
  42038. * @description 是否是顺时针。默认值:false。
  42039. */
  42040. this.clockWise = clockWise;
  42041. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Sector";
  42042. }
  42043. /**
  42044. * @function SuperMap.Feature.ShapeParameters.Sector.prototype.destroy
  42045. * @description 销毁对象。
  42046. */
  42047. destroy() {
  42048. this.x = null;
  42049. this.y = null;
  42050. this.r = null;
  42051. this.startAngle = null;
  42052. this.endAngle = null;
  42053. this.r0 = null;
  42054. this.clockWise = null;
  42055. super.destroy();
  42056. }
  42057. }
  42058. /**
  42059. * @typedef {Object} SuperMap.Feature.ShapeParameters.Sector.style
  42060. * @property {boolean} fill - 是否填充,不需要填充则设置为false,默认值为 true。此属性与 stroke 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  42061. * @property {string} fillColor - 十六进制填充颜色。默认值为 "#000000"。
  42062. * @property {number} fillOpacity - 填充不透明度。取值范围[0, 1],默认值 1。
  42063. * @property {boolean} stroke - 是否描边,不需要描边则设置为 false,默认值为 false。此属性与 fill 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  42064. * @property {string} strokeColor - 十六进制描边颜色。
  42065. * @property {number} strokeWidth - 描边宽度,默认值 1。
  42066. * @property {number} strokeOpacity - 描边的不透明度。取值范围[0, 1],默认值 1。
  42067. * @property {number} shadowBlur - 阴影模糊度,(大于 0 有效; 默认值 0)。
  42068. * @property {string} shadowColor - 阴影颜色; 默认值 '#000000'。
  42069. * @property {number} shadowOffsetX - 阴影 X 方向偏移值; 默认值 0。
  42070. * @property {number} shadowOffsetY - 阴影 Y 方向偏移值; 默认值 0。
  42071. */
  42072. SuperMap.Feature = SuperMap.Feature || {};
  42073. SuperMap.Feature.ShapeParameters.Sector = Sector;
  42074. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Label.js
  42075. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  42076. * This program are made available under the terms of the Apache License, Version 2.0
  42077. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42078. /**
  42079. * @class SuperMap.Feature.ShapeParameters.Label
  42080. * @category Visualization Theme
  42081. * @classdesc 标签参数对象。
  42082. * @extent {SuperMap.Feature.ShapeParameters}
  42083. */
  42084. class Label extends ShapeParameters {
  42085. /**
  42086. * @function SuperMap.Feature.ShapeParameters.Label.prototype.constructor
  42087. * @description 创建一个标签参数对象。
  42088. * @param {number} x - 横坐标,必设参数。
  42089. * @param {number} y - 纵坐标,必设参数。
  42090. * @param {string} text - 图形中的附加文本,必设参数。
  42091. * @returns {SuperMap.Feature.ShapeParameters.Label} 标签参数对象。
  42092. */
  42093. constructor(x, y, text) {
  42094. super(x, y, text);
  42095. /**
  42096. * @member {number} SuperMap.Feature.ShapeParameters.Label.prototype.x
  42097. * @description 标签 x 坐标。
  42098. */
  42099. this.x = x;
  42100. /**
  42101. * @member {number} SuperMap.Feature.ShapeParameters.Label.prototype.y
  42102. * @description 标签 y 坐标。
  42103. */
  42104. this.y = y;
  42105. /**
  42106. * @member {number} SuperMap.Feature.ShapeParameters.Label.prototype.text
  42107. * @description 标签的文本内容。
  42108. */
  42109. this.text = text;
  42110. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Label";
  42111. }
  42112. /**
  42113. * @function SuperMap.Feature.ShapeParameters.Label.prototype.destroy
  42114. * @description 销毁对象。
  42115. */
  42116. destroy() {
  42117. this.x = null;
  42118. this.y = null;
  42119. this.text = null;
  42120. super.destroy();
  42121. }
  42122. }
  42123. /**
  42124. * @typedef {Object} SuperMap.Feature.ShapeParameters.Label.style
  42125. * @property {boolean} fill - 是否填充,不需要填充则设置为 false,默认值为 true。此属性与 stroke 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  42126. * @property {string} fillColor - 十六进制填充颜色。默认值为 "#000000"。
  42127. * @property {number} fillOpacity - 填充不透明度。取值范围[0, 1],默认值 1。
  42128. * @property {boolean} stroke - 是否描边,不需要描边则设置为false,默认值为 false。此属性与 fill 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  42129. * @property {string} strokeColor - 十六进制描边颜色。
  42130. * @property {number} strokeOpacity - 描边的不透明度。取值范围[0, 1],默认值 1。
  42131. * @property {number} strokeWidth -描边宽度,默认值 1。
  42132. * @property {number} maxWidth - 最大宽度限制。默认值:null。
  42133. * @property {number} fontSize - 标签文本字体大小。默认值 12,单位是像素。
  42134. * @property {string} fontStyle - 标签文本字体样式。可设值:"normal", "italic", "oblique"; 默认值:"normal" 。
  42135. * @property {string} fontVariant - 标签文本字体变体。可设值:"normal", "small-caps"; 默认值:"normal" 。
  42136. * @property {string} fontWeight - 标签文本字体粗细。可设值:"normal", "bold", "bolder", "lighter"; 默认值:"normal" 。
  42137. * @property {string} fontFamily - 标签文本字体系列。fontFamily 值是字体族名称或/及类族名称的一个优先表,每个值逗号分割,浏览器会使用它可识别的第一个值。
  42138. * 可以使用具体的字体名称("times"、"courier"、"arial")或字体系列名称("serif"、"sans-serif"、"cursive"、"fantasy"、"monospace")。默认值:"arial,sans-serif".
  42139. * @property {string} labelBaseline - 标签文本垂直对齐, 可以是 'top', 'bottom', 'middle',默认值 'middle'。
  42140. * @property {string} labelAlign - 标签文本水平对齐。可以是 'left', 'right', 'center'; 默认值 'center'。
  42141. * @property {number} shadowBlur - 阴影模糊度,大于 0 有效。默认值:0。
  42142. * @property {number} shadowColor - 阴影颜色。默认值:"#000000'"。
  42143. * @property {number} shadowOffsetX - 阴影横向偏移。默认值:0。
  42144. * @property {number} shadowOffsetY - 阴影纵向偏移。默认值:0。
  42145. */
  42146. SuperMap.Feature = SuperMap.Feature || {};
  42147. SuperMap.Feature.ShapeParameters.Label = Label;
  42148. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Image.js
  42149. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  42150. * This program are made available under the terms of the Apache License, Version 2.0
  42151. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42152. /**
  42153. * @class SuperMap.Feature.ShapeParameters.Image
  42154. * @category Visualization Theme
  42155. * @classdesc 图片参数对象。
  42156. * @extends {SuperMap.Feature.ShapeParameters}
  42157. */
  42158. class Image_Image extends ShapeParameters {
  42159. /**
  42160. * @function SuperMap.Feature.ShapeParameters.Image.prototype.constructor
  42161. * @description 创建一个图片参数对象。
  42162. * @param {number} x - 左上角横坐标,必设参数。
  42163. * @param {number} y - 左上角纵坐标,必设参数。
  42164. * @param {(string|Object)} image - 图片地址或Cavans对象,必设参数。
  42165. * @param {number} width - 绘制到画布上的宽度,默认为图片高度。
  42166. * @param {number} height - 绘制到画布上的高度,默认为图片高度。
  42167. * @param {number} sx - 从图片中裁剪的左上角横坐标。
  42168. * @param {number} sy - 从图片中裁剪的左上角纵坐标。
  42169. * @param {number} sWidth - 从图片中裁剪的宽度,默认为图片高度。
  42170. * @param {number} sHeight - 绘制到画布上的高度,默认为图片高度。
  42171. * @returns {SuperMap.Feature.ShapeParameters.Image} 圆形参数对象。
  42172. */
  42173. constructor(x, y, image, width, height, sx, sy, sWidth, sHeight) {
  42174. super(x, y, image, width, height, sx, sy, sWidth, sHeight);
  42175. /**
  42176. * @member {number} SuperMap.Feature.ShapeParameters.Image.prototype.x
  42177. * @description 左上角横坐标,必设参数。
  42178. */
  42179. this.x = x;
  42180. /**
  42181. * @member {number} SuperMap.Feature.ShapeParameters.Image.prototype.y
  42182. * @description 左上角纵坐标,必设参数。
  42183. */
  42184. this.y = y;
  42185. /**
  42186. * @member {(string|Object)} SuperMap.Feature.ShapeParameters.Image.prototype.image
  42187. * @description 图片地址。
  42188. */
  42189. this.image = image;
  42190. /**
  42191. * @member {number} SuperMap.Feature.ShapeParameters.Image.prototype.width
  42192. * @description 绘制到画布上的宽度,默认为图片高度。
  42193. */
  42194. this.width = width;
  42195. /**
  42196. * @member {number} SuperMap.Feature.ShapeParameters.Image.prototype.height
  42197. * @description 绘制到画布上的高度,默认为图片高度。
  42198. */
  42199. this.height = height;
  42200. /**
  42201. * @member {number} SuperMap.Feature.ShapeParameters.Image.prototype.sx
  42202. * @description 从图片中裁剪的左上角横坐标。
  42203. */
  42204. this.sx = sx;
  42205. /**
  42206. * @member {number} SuperMap.Feature.ShapeParameters.Image.prototype.sy
  42207. * @description 从图片中裁剪的左上角纵坐标。
  42208. */
  42209. this.sy = sy;
  42210. /**
  42211. * @member {number} SuperMap.Feature.ShapeParameters.Image.prototype.sWidth
  42212. * @description 从图片中裁剪的宽度,默认为图片高度。
  42213. */
  42214. this.sWidth = sWidth;
  42215. /**
  42216. * @member {number} SuperMap.Feature.ShapeParameters.Image.prototype.sHeight
  42217. * @description 绘制到画布上的高度,默认为图片高度。
  42218. */
  42219. this.sHeight = sHeight;
  42220. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Image";
  42221. }
  42222. /**
  42223. * @function SuperMap.Feature.ShapeParameters.Image.prototype.destroy
  42224. * @description 销毁对象。
  42225. */
  42226. destroy() {
  42227. this.x = null;
  42228. this.y = null;
  42229. this.image = null;
  42230. this.width = null;
  42231. this.height = null;
  42232. this.sx = null;
  42233. this.sy = null;
  42234. this.sWidth = null;
  42235. this.sHeight = null;
  42236. super.destroy();
  42237. }
  42238. }
  42239. SuperMap.Feature = SuperMap.Feature || {};
  42240. SuperMap.Feature.ShapeParameters.Image = Image_Image;
  42241. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Circle.js
  42242. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  42243. * This program are made available under the terms of the Apache License, Version 2.0
  42244. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42245. /**
  42246. * @class SuperMap.Feature.ShapeParameters.Circle
  42247. * @classdesc 圆形参数对象。
  42248. * @category Visualization Theme
  42249. * @extends {SuperMap.Feature.ShapeParameters}
  42250. */
  42251. class Circle_Circle extends ShapeParameters {
  42252. /**
  42253. * @function SuperMap.Feature.ShapeParameters.Circle.prototype.constructor
  42254. * @description 创建一个圆形参数对象。
  42255. * @param {number} x - 圆心 x 坐标,必设参数。
  42256. * @param {number} y - 圆心 y 坐标,必设参数。
  42257. * @param {number} r - 圆半径,必设参数。
  42258. * @returns {SuperMap.Feature.ShapeParameters.Circle} 圆形参数对象。
  42259. */
  42260. constructor(x, y, r) {
  42261. super(x, y, r);
  42262. /**
  42263. * @member {number} SuperMap.Feature.ShapeParameters.Circle.prototype.x
  42264. * @description 圆心 x 坐标。
  42265. */
  42266. this.x = !isNaN(x) ? x : 0;
  42267. /**
  42268. * @member {number} SuperMap.Feature.ShapeParameters.Circle.prototype.y
  42269. * @description 圆心 y 坐标。
  42270. */
  42271. this.y = !isNaN(y) ? y : 0;
  42272. /**
  42273. * @member {number} SuperMap.Feature.ShapeParameters.Circle.prototype.r
  42274. * @description 圆半径。
  42275. */
  42276. this.r = !isNaN(r) ? r : 0;
  42277. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Circle";
  42278. }
  42279. /**
  42280. * @function SuperMap.Feature.ShapeParameters.Circle.prototype.destroy
  42281. * @description 销毁对象。
  42282. */
  42283. destroy() {
  42284. this.x = null;
  42285. this.y = null;
  42286. this.r = null;
  42287. super.destroy();
  42288. }
  42289. }
  42290. SuperMap.Feature = SuperMap.Feature || {};
  42291. SuperMap.Feature.ShapeParameters.Circle = Circle_Circle;
  42292. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Eventful.js
  42293. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  42294. * This program are made available under the terms of the Apache License, Version 2.0
  42295. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42296. /**
  42297. * @class SuperMap.LevelRenderer.Eventful
  42298. * @category Visualization Theme
  42299. * @classdesc 事件分发器超类,所有支持事件处理的类均是此类的子类。
  42300. * 此类不可实例化。
  42301. * @private
  42302. */
  42303. class Eventful {
  42304. /**
  42305. * @function SuperMap.LevelRenderer.Eventful.prototype.constructor
  42306. * @description 构造函数。对象可以通过 onxxxx 绑定事件。
  42307. * 支持的事件:
  42308. * Symbolizer properties:
  42309. * onclick - {function} 默认值:null。
  42310. * onmouseover - {function} 默认值:null。
  42311. * onmouseout - {function} 默认值:null。
  42312. * onmousemove - {function} 默认值:null。
  42313. * onmousewheel - {function} 默认值:null。
  42314. * onmousedown - {function} 默认值:null。
  42315. * onmouseup - {function} 默认值:null。
  42316. * ondragstart - {function} 默认值:null。
  42317. * ondragend - {function} 默认值:null。
  42318. * ondragenter - {function} 默认值:null。
  42319. * ondragleave - {function} 默认值:null。
  42320. * ondragover - {function} 默认值:null。
  42321. * ondrop - {function} 默认值:null。
  42322. */
  42323. constructor() {
  42324. /**
  42325. * @member {Object} SuperMap.LevelRenderer.Eventful.prototype._handlers
  42326. * @description 事件处理对象(事件分发器)。
  42327. */
  42328. this._handlers = {};
  42329. this.CLASS_NAME = "SuperMap.LevelRenderer.Eventful";
  42330. }
  42331. /**
  42332. * @function {Object} SuperMap.LevelRenderer.Eventful.prototype.destroy
  42333. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  42334. */
  42335. destroy() {
  42336. this._handlers = null;
  42337. }
  42338. /**
  42339. * @function SuperMap.LevelRenderer.Eventful.prototype.one
  42340. * @description 单次触发绑定,dispatch后销毁。
  42341. * @param {string} event - 事件名。
  42342. * @param {boolean} handler - 响应函数。
  42343. * @param {Object} context - context。
  42344. * @returns {SuperMap.LevelRenderer.Eventful} this
  42345. */
  42346. one(event, handler, context) {
  42347. var _h = this._handlers;
  42348. if (!handler || !event) {
  42349. return this;
  42350. }
  42351. if (!_h[event]) {
  42352. _h[event] = [];
  42353. }
  42354. _h[event].push({
  42355. h: handler,
  42356. one: true,
  42357. ctx: context || this
  42358. });
  42359. return this;
  42360. }
  42361. /**
  42362. * @function SuperMap.LevelRenderer.Eventful.prototype.bind
  42363. * @description 绑定事件。
  42364. * @param {string} event - 事件名。
  42365. * @param {boolean} handler - 响应函数。
  42366. * @param {Object} context - context。
  42367. * @returns {SuperMap.LevelRenderer.Eventful} this
  42368. */
  42369. bind(event, handler, context) {
  42370. var _h = this._handlers;
  42371. if (!handler || !event) {
  42372. return this;
  42373. }
  42374. if (!_h[event]) {
  42375. _h[event] = [];
  42376. }
  42377. _h[event].push({
  42378. h: handler,
  42379. one: false,
  42380. ctx: context || this
  42381. });
  42382. return this;
  42383. }
  42384. /**
  42385. * @function SuperMap.LevelRenderer.Eventful.prototype.unbind
  42386. * @description 解绑事件。
  42387. * @param {string} event - 事件名。
  42388. * @param {boolean} handler - 响应函数。
  42389. * @returns {SuperMap.LevelRenderer.Eventful} this
  42390. */
  42391. unbind(event, handler) {
  42392. var _h = this._handlers;
  42393. if (!event) {
  42394. this._handlers = {};
  42395. return this;
  42396. }
  42397. if (handler) {
  42398. if (_h[event]) {
  42399. var newList = [];
  42400. for (var i = 0, l = _h[event].length; i < l; i++) {
  42401. if (_h[event][i]['h'] != handler) {
  42402. newList.push(_h[event][i]);
  42403. }
  42404. }
  42405. _h[event] = newList;
  42406. }
  42407. if (_h[event] && _h[event].length === 0) {
  42408. delete _h[event];
  42409. }
  42410. } else {
  42411. delete _h[event];
  42412. }
  42413. return this;
  42414. }
  42415. /**
  42416. * @function SuperMap.LevelRenderer.Eventful.prototype.dispatch
  42417. * @description 事件分发。
  42418. * @param {string} type - 事件类型。
  42419. * @returns {SuperMap.LevelRenderer.Eventful} this
  42420. */
  42421. dispatch(type) {
  42422. if (this._handlers[type]) {
  42423. var args = arguments;
  42424. var argLen = args.length;
  42425. if (argLen > 3) {
  42426. args = Array.prototype.slice.call(args, 1);
  42427. }
  42428. var _h = this._handlers[type];
  42429. var len = _h.length;
  42430. for (var i = 0; i < len;) {
  42431. // Optimize advise from backbone
  42432. switch (argLen) {
  42433. case 1:
  42434. _h[i]['h'].call(_h[i]['ctx']);
  42435. break;
  42436. case 2:
  42437. _h[i]['h'].call(_h[i]['ctx'], args[1]);
  42438. break;
  42439. case 3:
  42440. _h[i]['h'].call(_h[i]['ctx'], args[1], args[2]);
  42441. break;
  42442. default:
  42443. // have more than 2 given arguments
  42444. _h[i]['h'].apply(_h[i]['ctx'], args);
  42445. break;
  42446. }
  42447. if (_h[i]['one']) {
  42448. _h.splice(i, 1);
  42449. len--;
  42450. } else {
  42451. i++;
  42452. }
  42453. }
  42454. }
  42455. return this;
  42456. }
  42457. /**
  42458. * @function SuperMap.LevelRenderer.Eventful.prototype.dispatchWithContext
  42459. * @description 带有context的事件分发,最后一个参数是事件回调的 context。
  42460. * @param {string} type - 事件类型。
  42461. * @returns {SuperMap.LevelRenderer.Eventful} this
  42462. */
  42463. dispatchWithContext(type) {
  42464. if (this._handlers[type]) {
  42465. var args = arguments;
  42466. var argLen = args.length;
  42467. if (argLen > 4) {
  42468. args = Array.prototype.slice.call(args, 1, args.length - 1);
  42469. }
  42470. var ctx = args[args.length - 1];
  42471. var _h = this._handlers[type];
  42472. var len = _h.length;
  42473. for (var i = 0; i < len;) {
  42474. // Optimize advise from backbone
  42475. switch (argLen) {
  42476. case 1:
  42477. _h[i]['h'].call(ctx);
  42478. break;
  42479. case 2:
  42480. _h[i]['h'].call(ctx, args[1]);
  42481. break;
  42482. case 3:
  42483. _h[i]['h'].call(ctx, args[1], args[2]);
  42484. break;
  42485. default:
  42486. // have more than 2 given arguments
  42487. _h[i]['h'].apply(ctx, args);
  42488. break;
  42489. }
  42490. if (_h[i]['one']) {
  42491. _h.splice(i, 1);
  42492. len--;
  42493. } else {
  42494. i++;
  42495. }
  42496. }
  42497. }
  42498. return this;
  42499. }
  42500. }
  42501. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Vector.js
  42502. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  42503. * This program are made available under the terms of the Apache License, Version 2.0
  42504. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42505. /**
  42506. * @private
  42507. * @class SuperMap.LevelRenderer.Tool.Vector
  42508. * @category Visualization Theme
  42509. * @classdesc LevelRenderer 二维向量类
  42510. *
  42511. */
  42512. class levelRenderer_Vector_Vector {
  42513. /**
  42514. * @function SuperMap.LevelRenderer.Tool.Vector.constructor
  42515. * @description 构造函数
  42516. */
  42517. constructor() {
  42518. this.ArrayCtor = typeof Float32Array === 'undefined'
  42519. ? Array
  42520. : Float32Array;
  42521. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Vector";
  42522. }
  42523. /**
  42524. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.create
  42525. * @description 创建一个向量。
  42526. *
  42527. * @param {number} x - x坐标
  42528. * @param {number} y - Y坐标
  42529. * @return {Vector2} 向量。
  42530. */
  42531. create(x, y) {
  42532. var ArrayCtor = this.ArrayCtor;
  42533. var out = new ArrayCtor(2);
  42534. out[0] = x || 0;
  42535. out[1] = y || 0;
  42536. return out;
  42537. }
  42538. /**
  42539. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.copy
  42540. * @description 复制一个向量。
  42541. *
  42542. * @param {Vector2} out - 基础向量。
  42543. * @param {Vector2} v - 向量。
  42544. * @return {Vector2} 克隆向量。
  42545. */
  42546. copy(out, v) {
  42547. out[0] = v[0];
  42548. out[1] = v[1];
  42549. return out;
  42550. }
  42551. /**
  42552. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.set
  42553. * @description 设置向量的两个项。
  42554. *
  42555. * @param {Vector2} out - 基础向量。
  42556. * @param {number} a - 项 a。
  42557. * @param {number} b - 项 b。
  42558. * @return {Vector2} 结果。
  42559. */
  42560. set(out, a, b) {
  42561. out[0] = a;
  42562. out[1] = b;
  42563. return out;
  42564. }
  42565. /**
  42566. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.add
  42567. * @description 向量相加。
  42568. *
  42569. * @param {Vector2} out - 基础向量。
  42570. * @param {Vector2} v1 - 向量 v1。
  42571. * @param {Vector2} v2 - 向量 v2。
  42572. * @return {Vector2} 结果。
  42573. */
  42574. add(out, v1, v2) {
  42575. out[0] = v1[0] + v2[0];
  42576. out[1] = v1[1] + v2[1];
  42577. return out;
  42578. }
  42579. /**
  42580. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.scaleAndAdd
  42581. * @description 向量缩放后相加。
  42582. * @param {Vector2} out - 基础向量。
  42583. * @param {Vector2} v1 - 向量 v1。
  42584. * @param {Vector2} v2 - 向量 v2(缩放向量)。
  42585. * @param {number} a - 缩放参数。
  42586. * @return {Vector2} 结果。
  42587. */
  42588. scaleAndAdd(out, v1, v2, a) {
  42589. out[0] = v1[0] + v2[0] * a;
  42590. out[1] = v1[1] + v2[1] * a;
  42591. return out;
  42592. }
  42593. /**
  42594. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.sub
  42595. * @description 向量相减。
  42596. * @param {Vector2} out - 基础向量。
  42597. * @param {Vector2} v1 - 向量 v1。
  42598. * @param {Vector2} v2 - 向量 v2。
  42599. * @return {Vector2} 结果。
  42600. */
  42601. sub(out, v1, v2) {
  42602. out[0] = v1[0] - v2[0];
  42603. out[1] = v1[1] - v2[1];
  42604. return out;
  42605. }
  42606. /**
  42607. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.len
  42608. * @description 向量长度。
  42609. * @param {Vector2} v - 向量。
  42610. * @return {number} 向量长度。
  42611. */
  42612. len(v) {
  42613. return Math.sqrt(this.lenSquare(v));
  42614. }
  42615. /**
  42616. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.lenSquare
  42617. * @description 向量长度平方。
  42618. * @param {Vector2} v - 向量。
  42619. * @return {number} 向量长度平方。
  42620. */
  42621. lenSquare(v) {
  42622. return v[0] * v[0] + v[1] * v[1];
  42623. }
  42624. /**
  42625. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.mul
  42626. * @description 向量乘法。
  42627. * @param {Vector2} out - 基础向量。
  42628. * @param {Vector2} v1 - 向量 v1。
  42629. * @param {Vector2} v2 - 向量 v2。
  42630. * @return {Vector2} 结果。
  42631. */
  42632. mul(out, v1, v2) {
  42633. out[0] = v1[0] * v2[0];
  42634. out[1] = v1[1] * v2[1];
  42635. return out;
  42636. }
  42637. /**
  42638. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.div
  42639. * @description 向量除法。
  42640. *
  42641. * @param {Vector2} out - 基础向量。
  42642. * @param {Vector2} v1 - 向量 v1。
  42643. * @param {Vector2} v2 - 向量 v2。
  42644. * @return {Vector2} 结果。
  42645. */
  42646. div(out, v1, v2) {
  42647. out[0] = v1[0] / v2[0];
  42648. out[1] = v1[1] / v2[1];
  42649. return out;
  42650. }
  42651. /**
  42652. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.dot
  42653. * @description 向量点乘。
  42654. *
  42655. * @param {Vector2} v1 - 向量 v1。
  42656. * @param {Vector2} v2 - 向量 v2。
  42657. * @return {number} 向量点乘。
  42658. */
  42659. dot(v1, v2) {
  42660. return v1[0] * v2[0] + v1[1] * v2[1];
  42661. }
  42662. /**
  42663. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.scale
  42664. * @description 向量缩放。
  42665. *
  42666. * @param {Vector2} out - 基础向量。
  42667. * @param {Vector2} v - 向量v。
  42668. * @param {number} s -缩放参数。
  42669. * @return {Vector2} 结果。
  42670. */
  42671. scale(out, v, s) {
  42672. out[0] = v[0] * s;
  42673. out[1] = v[1] * s;
  42674. return out;
  42675. }
  42676. /**
  42677. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.normalize
  42678. * @description 向量归一化。
  42679. *
  42680. * @param {Vector2} out - 基础向量。
  42681. * @param {Vector2} v - 向量 v。
  42682. * @return {Vector2} 结果。
  42683. */
  42684. normalize(out, v) {
  42685. var d = this.len(v);
  42686. if (d === 0) {
  42687. out[0] = 0;
  42688. out[1] = 0;
  42689. } else {
  42690. out[0] = v[0] / d;
  42691. out[1] = v[1] / d;
  42692. }
  42693. return out;
  42694. }
  42695. /**
  42696. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.distance
  42697. * @description 计算向量间距离。
  42698. *
  42699. * @param {Vector2} v1 - 向量 v1。
  42700. * @param {Vector2} v2 - 向量 v2。
  42701. * @return {number} 向量间距离。
  42702. */
  42703. distance(v1, v2) {
  42704. return Math.sqrt(
  42705. (v1[0] - v2[0]) * (v1[0] - v2[0])
  42706. + (v1[1] - v2[1]) * (v1[1] - v2[1])
  42707. );
  42708. }
  42709. /**
  42710. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.distanceSquare
  42711. * @description 向量距离平方。
  42712. *
  42713. * @param {Vector2} v1 - 向量 v1。
  42714. * @param {Vector2} v2 - 向量 v2。
  42715. * @return {number} 向量距离平方。
  42716. */
  42717. distanceSquare(v1, v2) {
  42718. return (v1[0] - v2[0]) * (v1[0] - v2[0])
  42719. + (v1[1] - v2[1]) * (v1[1] - v2[1]);
  42720. }
  42721. /**
  42722. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.negate
  42723. * @description 求负向量。
  42724. *
  42725. * @param {Vector2} out - 基础向量。
  42726. * @param {Vector2} v - 向量 v。
  42727. * @return {Vector2} 负向量。
  42728. */
  42729. negate(out, v) {
  42730. out[0] = -v[0];
  42731. out[1] = -v[1];
  42732. return out;
  42733. }
  42734. /**
  42735. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.lerp
  42736. * @description 两点之间线性插值。
  42737. *
  42738. * @param {Vector2} out - 基础向量。
  42739. * @param {Vector2} v1 - 向量 v1。
  42740. * @param {Vector2} v2 - 向量 v2。
  42741. * @param {number} t
  42742. * @return {Vector2} 结果。
  42743. */
  42744. lerp(out, v1, v2, t) {
  42745. out[0] = v1[0] + t * (v2[0] - v1[0]);
  42746. out[1] = v1[1] + t * (v2[1] - v1[1]);
  42747. return out;
  42748. }
  42749. /**
  42750. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.applyTransform
  42751. * @description 矩阵左乘向量。
  42752. *
  42753. * @param {Vector2} out - 基础向量。
  42754. * @param {Vector2} v1 - 向量 v1。
  42755. * @param {Vector2} v2 - 向量 v2。
  42756. * @return {Vector2} 结果。
  42757. */
  42758. applyTransform(out, v, m) {
  42759. var x = v[0];
  42760. var y = v[1];
  42761. out[0] = m[0] * x + m[2] * y + m[4];
  42762. out[1] = m[1] * x + m[3] * y + m[5];
  42763. return out;
  42764. }
  42765. /**
  42766. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.min
  42767. * @description 求两个向量最小值。
  42768. * @param {Vector2} out - 基础向量。
  42769. * @param {Vector2} v1 - 向量 v1。
  42770. * @param {Vector2} v2 - 向量 v2。
  42771. * @return {Vector2} 结果。
  42772. */
  42773. min(out, v1, v2) {
  42774. out[0] = Math.min(v1[0], v2[0]);
  42775. out[1] = Math.min(v1[1], v2[1]);
  42776. return out;
  42777. }
  42778. /**
  42779. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.max
  42780. * @description 求两个向量最大值。
  42781. *
  42782. * @param {Vector2} out - 基础向量。
  42783. * @param {Vector2} v1 - 向量 v1。
  42784. * @param {Vector2} v2 - 向量 v2。
  42785. * @return {Vector2} 结果。
  42786. */
  42787. max(out, v1, v2) {
  42788. out[0] = Math.max(v1[0], v2[0]);
  42789. out[1] = Math.max(v1[1], v2[1]);
  42790. return out;
  42791. }
  42792. /**
  42793. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.length
  42794. * @description 向量长度。
  42795. *
  42796. * @param {Vector2} v - 向量。
  42797. * @return {number} 向量长度。
  42798. */
  42799. length(v) {
  42800. return this.len(v);
  42801. }
  42802. /**
  42803. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.lengthSquare
  42804. * @description 向量长度平方。
  42805. *
  42806. * @param {Vector2} v - 向量。
  42807. * @return {number} 向量长度平方。
  42808. */
  42809. lengthSquare(v) {
  42810. return this.lenSquare(v);
  42811. }
  42812. /**
  42813. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.dist
  42814. * @description 计算向量间距离。
  42815. *
  42816. * @param {Vector2} v1 - 向量 v1。
  42817. * @param {Vector2} v2 - 向量 v2。
  42818. * @return {number} 向量间距离。
  42819. */
  42820. dist(v1, v2) {
  42821. return this.distance(v1, v2);
  42822. }
  42823. /**
  42824. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.distSquare
  42825. * @description 向量距离平方。
  42826. *
  42827. * @param {Vector2} v1 - 向量 v1。
  42828. * @param {Vector2} v2 - 向量 v2。
  42829. * @return {number} 向量距离平方
  42830. */
  42831. distSquare(v1, v2) {
  42832. return this.distanceSquare(v1, v2);
  42833. }
  42834. }
  42835. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Curve.js
  42836. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  42837. * This program are made available under the terms of the Apache License, Version 2.0
  42838. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42839. /**
  42840. * @class SuperMap.LevelRenderer.Tool.Curve
  42841. * @category Visualization Theme
  42842. * @classdesc LevelRenderer 工具-曲线
  42843. * @private
  42844. */
  42845. class Curve_Curve {
  42846. /**
  42847. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.constructor
  42848. * @description 构造函数。
  42849. */
  42850. constructor() {
  42851. /**
  42852. * @member {SuperMap.LevelRenderer.Tool.Vector} SuperMap.LevelRenderer.Tool.Curve.prototype.vector
  42853. * @description 矢量工具。
  42854. */
  42855. this.vector = new levelRenderer_Vector_Vector();
  42856. /**
  42857. * @member {number} SuperMap.LevelRenderer.Tool.Curve.prototype.EPSILON
  42858. * @description e。
  42859. */
  42860. this.EPSILON = 1e-4;
  42861. /**
  42862. * @member {number} SuperMap.LevelRenderer.Tool.Curve.prototype.THREE_SQRT
  42863. * @description 3 的平方根。
  42864. */
  42865. this.THREE_SQRT = Math.sqrt(3);
  42866. /**
  42867. * @member {number} SuperMap.LevelRenderer.Tool.Curve.prototype.ONE_THIRD
  42868. * @description 1/3。
  42869. */
  42870. this.ONE_THIRD = 1 / 3;
  42871. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Curve";
  42872. }
  42873. /*
  42874. * Method: evalCubicCoeff
  42875. *
  42876. * Parameters:
  42877. * a - {number} 值。
  42878. * b - {number} 值。
  42879. * c - {number} 值。
  42880. * d - {number} 值。
  42881. * t - {number} 值。
  42882. *
  42883. * Returns:
  42884. * {number}
  42885. */
  42886. /*
  42887. evalCubicCoeff: function(a, b, c, d, t){
  42888. return ((a * t + b) * t + c) * t + d;
  42889. },
  42890. */
  42891. /**
  42892. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.isAroundZero
  42893. * @description 判断一个值是否趋于0,判断参考值:1e-4。
  42894. * @param {number} val - 值。
  42895. * @returns {boolean} 值是否趋于0。
  42896. */
  42897. isAroundZero(val) {
  42898. return val > -this.EPSILON && val < this.EPSILON;
  42899. }
  42900. /**
  42901. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.isNotAroundZero
  42902. * @description 判断一个值是否不趋于0,判断参考值:1e-4。
  42903. * @param {number} val - 值。
  42904. * @returns {boolean} 值是否不趋于0。
  42905. */
  42906. isNotAroundZero(val) {
  42907. return val > this.EPSILON || val < -this.EPSILON;
  42908. }
  42909. /**
  42910. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.cubicAt
  42911. * @description 计算三次贝塞尔值
  42912. * @param {number} p0 - 点p0。
  42913. * @param {number} p1 - 点p1。
  42914. * @param {number} p2 - 点p2。
  42915. * @param {number} p3 - 点p3。
  42916. * @param {number} t - t值。
  42917. * @returns {number} 三次贝塞尔值。
  42918. */
  42919. cubicAt(p0, p1, p2, p3, t) {
  42920. var onet = 1 - t;
  42921. return onet * onet * (onet * p0 + 3 * t * p1)
  42922. + t * t * (t * p3 + 3 * onet * p2);
  42923. }
  42924. /**
  42925. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.cubicDerivativeAt
  42926. * @description 计算三次贝塞尔导数值
  42927. * @param {number} p0 - 点p0。
  42928. * @param {number} p1 - 点p1。
  42929. * @param {number} p2 - 点p2。
  42930. * @param {number} p3 - 点p3。
  42931. * @param {number} t - t值。
  42932. * @returns {number} 三次贝塞尔导数值。
  42933. */
  42934. cubicDerivativeAt(p0, p1, p2, p3, t) {
  42935. var onet = 1 - t;
  42936. return 3 * (
  42937. ((p1 - p0) * onet + 2 * (p2 - p1) * t) * onet
  42938. + (p3 - p2) * t * t
  42939. );
  42940. }
  42941. /**
  42942. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.cubicRootAt
  42943. * @description 计算三次贝塞尔方程根,使用盛金公式
  42944. * @param {number} p0 - 点p0。
  42945. * @param {number} p1 - 点p1。
  42946. * @param {number} p2 - 点p2。
  42947. * @param {number} p3 - 点p3。
  42948. * @param {number} val - 值。
  42949. * @param {Array.<number>} roots - 有效根数目。
  42950. * @returns {number} 有效根。
  42951. */
  42952. cubicRootAt(p0, p1, p2, p3, val, roots) {
  42953. // Evaluate roots of cubic functions
  42954. var a = p3 + 3 * (p1 - p2) - p0;
  42955. var b = 3 * (p2 - p1 * 2 + p0);
  42956. var c = 3 * (p1 - p0);
  42957. var d = p0 - val;
  42958. var A = b * b - 3 * a * c;
  42959. var B = b * c - 9 * a * d;
  42960. var C = c * c - 3 * b * d;
  42961. var n = 0;
  42962. if (this.isAroundZero(A) && this.isAroundZero(B)) {
  42963. if (this.isAroundZero(b)) {
  42964. roots[0] = 0;
  42965. } else {
  42966. let t1 = -c / b; //t1, t2, t3, b is not zero
  42967. if (t1 >= 0 && t1 <= 1) {
  42968. roots[n++] = t1;
  42969. }
  42970. }
  42971. } else {
  42972. var disc = B * B - 4 * A * C;
  42973. if (this.isAroundZero(disc)) {
  42974. var K = B / A;
  42975. let t1 = -b / a + K; // t1, a is not zero
  42976. let t2 = -K / 2; // t2, t3
  42977. if (t1 >= 0 && t1 <= 1) {
  42978. roots[n++] = t1;
  42979. }
  42980. if (t2 >= 0 && t2 <= 1) {
  42981. roots[n++] = t2;
  42982. }
  42983. } else if (disc > 0) {
  42984. let discSqrt = Math.sqrt(disc);
  42985. let Y1 = A * b + 1.5 * a * (-B + discSqrt);
  42986. let Y2 = A * b + 1.5 * a * (-B - discSqrt);
  42987. if (Y1 < 0) {
  42988. Y1 = -Math.pow(-Y1, this.ONE_THIRD);
  42989. } else {
  42990. Y1 = Math.pow(Y1, this.ONE_THIRD);
  42991. }
  42992. if (Y2 < 0) {
  42993. Y2 = -Math.pow(-Y2, this.ONE_THIRD);
  42994. } else {
  42995. Y2 = Math.pow(Y2, this.ONE_THIRD);
  42996. }
  42997. let t1 = (-b - (Y1 + Y2)) / (3 * a);
  42998. if (t1 >= 0 && t1 <= 1) {
  42999. roots[n++] = t1;
  43000. }
  43001. } else {
  43002. var T = (2 * A * b - 3 * a * B) / (2 * Math.sqrt(A * A * A));
  43003. var theta = Math.acos(T) / 3;
  43004. var ASqrt = Math.sqrt(A);
  43005. var tmp = Math.cos(theta);
  43006. let t1 = (-b - 2 * ASqrt * tmp) / (3 * a);
  43007. let t2 = (-b + ASqrt * (tmp + this.THREE_SQRT * Math.sin(theta))) / (3 * a);
  43008. let t3 = (-b + ASqrt * (tmp - this.THREE_SQRT * Math.sin(theta))) / (3 * a);
  43009. if (t1 >= 0 && t1 <= 1) {
  43010. roots[n++] = t1;
  43011. }
  43012. if (t2 >= 0 && t2 <= 1) {
  43013. roots[n++] = t2;
  43014. }
  43015. if (t3 >= 0 && t3 <= 1) {
  43016. roots[n++] = t3;
  43017. }
  43018. }
  43019. }
  43020. return n;
  43021. }
  43022. /**
  43023. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.cubicRootAt
  43024. * @description 计算三次贝塞尔方程极限值的位置
  43025. * @param {number} p0 - 点p0。
  43026. * @param {number} p1 - 点p1。
  43027. * @param {number} p2 - 点p2。
  43028. * @param {number} p3 - 点p3。
  43029. * @param {Array.<number>} extrema - 值。
  43030. * @returns {number} 有效数目。
  43031. */
  43032. cubicExtrema(p0, p1, p2, p3, extrema) {
  43033. var b = 6 * p2 - 12 * p1 + 6 * p0;
  43034. var a = 9 * p1 + 3 * p3 - 3 * p0 - 9 * p2;
  43035. var c = 3 * p1 - 3 * p0;
  43036. var n = 0;
  43037. if (this.isAroundZero(a)) {
  43038. if (this.isNotAroundZero(b)) {
  43039. let t1 = -c / b;
  43040. if (t1 >= 0 && t1 <= 1) {
  43041. extrema[n++] = t1;
  43042. }
  43043. }
  43044. } else {
  43045. var disc = b * b - 4 * a * c;
  43046. if (this.isAroundZero(disc)) {
  43047. extrema[0] = -b / (2 * a);
  43048. } else if (disc > 0) {
  43049. let discSqrt = Math.sqrt(disc);
  43050. let t1 = (-b + discSqrt) / (2 * a);
  43051. let t2 = (-b - discSqrt) / (2 * a);
  43052. if (t1 >= 0 && t1 <= 1) {
  43053. extrema[n++] = t1;
  43054. }
  43055. if (t2 >= 0 && t2 <= 1) {
  43056. extrema[n++] = t2;
  43057. }
  43058. }
  43059. }
  43060. return n;
  43061. }
  43062. /**
  43063. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.cubicSubdivide
  43064. * @description 细分三次贝塞尔曲线
  43065. * @param {number} p0 - 点p0。
  43066. * @param {number} p1 - 点p1。
  43067. * @param {number} p2 - 点p2。
  43068. * @param {number} p3 - 点p3。
  43069. * @param {number} t - t值。
  43070. * @param {Array.<number>} out - 投射点。
  43071. * @returns {number} 投射点。
  43072. */
  43073. cubicSubdivide(p0, p1, p2, p3, t, out) {
  43074. var p01 = (p1 - p0) * t + p0;
  43075. var p12 = (p2 - p1) * t + p1;
  43076. var p23 = (p3 - p2) * t + p2;
  43077. var p012 = (p12 - p01) * t + p01;
  43078. var p123 = (p23 - p12) * t + p12;
  43079. var p0123 = (p123 - p012) * t + p012;
  43080. // Seg0
  43081. out[0] = p0;
  43082. out[1] = p01;
  43083. out[2] = p012;
  43084. out[3] = p0123;
  43085. // Seg1
  43086. out[4] = p0123;
  43087. out[5] = p123;
  43088. out[6] = p23;
  43089. out[7] = p3;
  43090. }
  43091. /**
  43092. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.cubicProjectPoint
  43093. * @description 投射点到三次贝塞尔曲线上,返回投射距离。投射点有可能会有一个或者多个,这里只返回其中距离最短的一个。
  43094. * @param {number} x0 - 点p0横坐标。
  43095. * @param {number} y0 - 点p0纵坐标。
  43096. * @param {number} x1 - 点p1横坐标。
  43097. * @param {number} y1 - 点p1纵坐标。
  43098. * @param {number} x2 - 点p2横坐标。
  43099. * @param {number} y2 - 点p2纵坐标。
  43100. * @param {number} x3 - 点p3横坐标。
  43101. * @param {number} y3 - 点p3纵坐标。
  43102. * @param {number} x - 点p横坐标。
  43103. * @param {number} y - 点p纵坐标。
  43104. * @param {Array.<number>} out - 投射点。
  43105. * @returns {number} 投射点。
  43106. */
  43107. cubicProjectPoint(x0, y0, x1, y1, x2, y2, x3, y3, x, y, out) {
  43108. // 临时变量
  43109. var _v0 = this.vector.create();
  43110. var _v1 = this.vector.create();
  43111. var _v2 = this.vector.create();
  43112. // var _v3 = vector.create();
  43113. // http://pomax.github.io/bezierinfo/#projections
  43114. var t;
  43115. var interval = 0.005;
  43116. var d = Infinity;
  43117. _v0[0] = x;
  43118. _v0[1] = y;
  43119. // 先粗略估计一下可能的最小距离的 t 值
  43120. // PENDING
  43121. for (let _t = 0; _t < 1; _t += 0.05) {
  43122. _v1[0] = this.cubicAt(x0, x1, x2, x3, _t);
  43123. _v1[1] = this.cubicAt(y0, y1, y2, y3, _t);
  43124. let d1 = this.vector.distSquare(_v0, _v1);
  43125. if (d1 < d) {
  43126. t = _t;
  43127. d = d1;
  43128. }
  43129. }
  43130. d = Infinity;
  43131. // At most 32 iteration
  43132. for (let i = 0; i < 32; i++) {
  43133. if (interval < this.EPSILON) {
  43134. break;
  43135. }
  43136. let prev = t - interval;
  43137. let next = t + interval;
  43138. // t - interval
  43139. _v1[0] = this.cubicAt(x0, x1, x2, x3, prev);
  43140. _v1[1] = this.cubicAt(y0, y1, y2, y3, prev);
  43141. let d1 = this.vector.distSquare(_v1, _v0);
  43142. if (prev >= 0 && d1 < d) {
  43143. t = prev;
  43144. d = d1;
  43145. } else {
  43146. // t + interval
  43147. _v2[0] = this.cubicAt(x0, x1, x2, x3, next);
  43148. _v2[1] = this.cubicAt(y0, y1, y2, y3, next);
  43149. let d2 = this.vector.distSquare(_v2, _v0);
  43150. if (next <= 1 && d2 < d) {
  43151. t = next;
  43152. d = d2;
  43153. } else {
  43154. interval *= 0.5;
  43155. }
  43156. }
  43157. }
  43158. // t
  43159. if (out) {
  43160. out[0] = this.cubicAt(x0, x1, x2, x3, t);
  43161. out[1] = this.cubicAt(y0, y1, y2, y3, t);
  43162. }
  43163. // console.log(interval, i);
  43164. return Math.sqrt(d);
  43165. }
  43166. /**
  43167. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.quadraticAt
  43168. * @description 计算二次方贝塞尔值。
  43169. * @param {number} p0 - 点p0。
  43170. * @param {number} p1 - 点p1。
  43171. * @param {number} p2 - 点p2。
  43172. * @param {number} t - t值。
  43173. * @returns {number} 二次方贝塞尔值。
  43174. */
  43175. quadraticAt(p0, p1, p2, t) {
  43176. var onet = 1 - t;
  43177. return onet * (onet * p0 + 2 * t * p1) + t * t * p2;
  43178. }
  43179. /**
  43180. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.quadraticAt
  43181. * @description 计算二次方贝塞尔导数值。
  43182. * @param {number} p0 - 点p0。
  43183. * @param {number} p1 - 点p1。
  43184. * @param {number} p2 - 点p2。
  43185. * @param {number} t - t值。
  43186. * @returns {number} 二次方贝塞尔导数值。
  43187. */
  43188. quadraticDerivativeAt(p0, p1, p2, t) {
  43189. return 2 * ((1 - t) * (p1 - p0) + t * (p2 - p1));
  43190. }
  43191. /**
  43192. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.quadraticRootAt
  43193. * @description 计算二次方贝塞尔方程根
  43194. * @param {number} p0 - 点p0。
  43195. * @param {number} p1 - 点p1。
  43196. * @param {number} p2 - 点p2。
  43197. * @param {number} val - 值。
  43198. * @param {Array.<number>} roots - 有效根数目。
  43199. * @returns {number} 有效根数目。
  43200. */
  43201. quadraticRootAt(p0, p1, p2, val, roots) {
  43202. var a = p0 - 2 * p1 + p2;
  43203. var b = 2 * (p1 - p0);
  43204. var c = p0 - val;
  43205. var n = 0;
  43206. if (this.isAroundZero(a)) {
  43207. if (this.isNotAroundZero(b)) {
  43208. var t1 = -c / b;
  43209. if (t1 >= 0 && t1 <= 1) {
  43210. roots[n++] = t1;
  43211. }
  43212. }
  43213. } else {
  43214. var disc = b * b - 4 * a * c;
  43215. if (this.isAroundZero(disc)) {
  43216. let t1 = -b / (2 * a);
  43217. if (t1 >= 0 && t1 <= 1) {
  43218. roots[n++] = t1;
  43219. }
  43220. } else if (disc > 0) {
  43221. let discSqrt = Math.sqrt(disc);
  43222. let t1 = (-b + discSqrt) / (2 * a);
  43223. let t2 = (-b - discSqrt) / (2 * a);
  43224. if (t1 >= 0 && t1 <= 1) {
  43225. roots[n++] = t1;
  43226. }
  43227. if (t2 >= 0 && t2 <= 1) {
  43228. roots[n++] = t2;
  43229. }
  43230. }
  43231. }
  43232. return n;
  43233. }
  43234. /**
  43235. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.quadraticExtremum
  43236. * @description 计算二次贝塞尔方程极限值
  43237. * @param {number} p0 - 点p0。
  43238. * @param {number} p1 - 点p1。
  43239. * @param {number} p2 - 点p2。
  43240. * @returns {number} 二次贝塞尔方程极限值。
  43241. */
  43242. quadraticExtremum(p0, p1, p2) {
  43243. var divider = p0 + p2 - 2 * p1;
  43244. if (divider === 0) {
  43245. // p1 is center of p0 and p2
  43246. return 0.5;
  43247. } else {
  43248. return (p0 - p1) / divider;
  43249. }
  43250. }
  43251. /**
  43252. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.quadraticProjectPoint
  43253. * @description 投射点到二次贝塞尔曲线上,返回投射距离。投射点有可能会有一个或者多个,这里只返回其中距离最短的一个。
  43254. * @param {number} x0 - 点p0横坐标。
  43255. * @param {number} y0 - 点p0纵坐标。
  43256. * @param {number} x1 - 点p1横坐标。
  43257. * @param {number} y1 - 点p1纵坐标。
  43258. * @param {number} x2 - 点p2横坐标。
  43259. * @param {number} y2 - 点p2纵坐标。
  43260. * @param {number} x - 点p横坐标。
  43261. * @param {number} y - 点p纵坐标。
  43262. * @param {Array.<number>} out - 投射点。
  43263. * @returns {number} 投射距离。
  43264. */
  43265. quadraticProjectPoint(x0, y0, x1, y1, x2, y2, x, y, out) {
  43266. // 临时变量
  43267. var _v0 = this.vector.create();
  43268. var _v1 = this.vector.create();
  43269. var _v2 = this.vector.create();
  43270. // http://pomax.github.io/bezierinfo/#projections
  43271. var t;
  43272. var interval = 0.005;
  43273. var d = Infinity;
  43274. _v0[0] = x;
  43275. _v0[1] = y;
  43276. // 先粗略估计一下可能的最小距离的 t 值
  43277. // PENDING
  43278. for (let _t = 0; _t < 1; _t += 0.05) {
  43279. _v1[0] = this.quadraticAt(x0, x1, x2, _t);
  43280. _v1[1] = this.quadraticAt(y0, y1, y2, _t);
  43281. let d1 = this.vector.distSquare(_v0, _v1);
  43282. if (d1 < d) {
  43283. t = _t;
  43284. d = d1;
  43285. }
  43286. }
  43287. d = Infinity;
  43288. // At most 32 iteration
  43289. for (let i = 0; i < 32; i++) {
  43290. if (interval < this.EPSILON) {
  43291. break;
  43292. }
  43293. let prev = t - interval;
  43294. let next = t + interval;
  43295. // t - interval
  43296. _v1[0] = this.quadraticAt(x0, x1, x2, prev);
  43297. _v1[1] = this.quadraticAt(y0, y1, y2, prev);
  43298. let d1 = this.vector.distSquare(_v1, _v0);
  43299. if (prev >= 0 && d1 < d) {
  43300. t = prev;
  43301. d = d1;
  43302. } else {
  43303. // t + interval
  43304. _v2[0] = this.quadraticAt(x0, x1, x2, next);
  43305. _v2[1] = this.quadraticAt(y0, y1, y2, next);
  43306. let d2 = this.vector.distSquare(_v2, _v0);
  43307. if (next <= 1 && d2 < d) {
  43308. t = next;
  43309. d = d2;
  43310. } else {
  43311. interval *= 0.5;
  43312. }
  43313. }
  43314. }
  43315. // t
  43316. if (out) {
  43317. out[0] = this.quadraticAt(x0, x1, x2, t);
  43318. out[1] = this.quadraticAt(y0, y1, y2, t);
  43319. }
  43320. // console.log(interval, i);
  43321. return Math.sqrt(d);
  43322. }
  43323. }
  43324. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Area.js
  43325. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  43326. * This program are made available under the terms of the Apache License, Version 2.0
  43327. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43328. /**
  43329. * @class SuperMap.LevelRenderer.Tool.Area
  43330. * @category Visualization Theme
  43331. * @classdesc LevelRenderer 工具-图形范围判断
  43332. * @private
  43333. */
  43334. class Area {
  43335. /**
  43336. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.constructor
  43337. * @description 构造函数。
  43338. */
  43339. constructor() {
  43340. /**
  43341. * @member {SuperMap.LevelRenderer.Tool.Util} SuperMap.LevelRenderer.Tool.Areal.prototype.util
  43342. * @description 基础工具对象。
  43343. */
  43344. this.util = new Util_Util();
  43345. /**
  43346. * @member {SuperMap.LevelRenderer.Tool.Curve} SuperMap.LevelRenderer.Tool.Areal.prototype.curve
  43347. * @description 曲线工具对象
  43348. */
  43349. this.curve = new Curve_Curve();
  43350. /**
  43351. * @member {Object} SuperMap.LevelRenderer.Tool.Areal.prototype._ctx
  43352. * @description Cavans2D 渲染上下文
  43353. */
  43354. this._ctx = null;
  43355. /**
  43356. * @member {Object} SuperMap.LevelRenderer.Tool.Areal.prototype._textWidthCache
  43357. * @description 文本宽度缓存
  43358. */
  43359. this._textWidthCache = {};
  43360. /**
  43361. * @member {Object} SuperMap.LevelRenderer.Tool.Areal.prototype._textHeightCache
  43362. * @description 文本高度缓存
  43363. */
  43364. this._textHeightCache = {};
  43365. /**
  43366. * @member {number} SuperMap.LevelRenderer.Tool.Areal.prototype._textWidthCacheCounter
  43367. * @description 文本宽度缓存数量
  43368. */
  43369. this._textWidthCacheCounter = 0;
  43370. /**
  43371. * @member {number} SuperMap.LevelRenderer.Tool.Areal.prototype._textHeightCacheCounter
  43372. * @description 文本高度缓存数量
  43373. */
  43374. this._textHeightCacheCounter = 0;
  43375. /**
  43376. * @member {number} SuperMap.LevelRenderer.Tool.Areal.prototype.TEXT_CACHE_MAX
  43377. * @description 文本最大缓存数量
  43378. */
  43379. this.TEXT_CACHE_MAX = 5000;
  43380. /**
  43381. * @member {number} SuperMap.LevelRenderer.Tool.Areal.prototype.PI2
  43382. * @description 2*PI 的值
  43383. */
  43384. this.PI2 = Math.PI * 2;
  43385. /**
  43386. * @member {Array} SuperMap.LevelRenderer.Tool.Areal.prototype.roots
  43387. * @description 临时数组
  43388. */
  43389. this.roots = [-1, -1, -1];
  43390. /**
  43391. * @member {Array} SuperMap.LevelRenderer.Tool.Areal.prototype.extrema
  43392. * @description 临时数组
  43393. */
  43394. this.extrema = [-1, -1];
  43395. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Area";
  43396. }
  43397. /**
  43398. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.normalizeRadian
  43399. * @description 弧度标准化函数。
  43400. * @param {number} angle - 弧度值。
  43401. * @returns {number} 标准化后的弧度值。
  43402. */
  43403. normalizeRadian(angle) {
  43404. angle %= this.PI2;
  43405. if (angle < 0) {
  43406. angle += this.PI2;
  43407. }
  43408. return angle;
  43409. }
  43410. /**
  43411. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInside
  43412. * @description 包含判断。
  43413. * @param {Object} shape - 图形。
  43414. * @param {number} area - 目标区域。
  43415. * @param {number} x - 横坐标。
  43416. * @param {number} y - 纵坐标。
  43417. * @returns {boolean} 图形是否包含鼠标位置。
  43418. */
  43419. isInside(shape, area, x, y) {
  43420. if (!area || !shape) {
  43421. // 无参数或不支持类型
  43422. return false;
  43423. }
  43424. var zoneType = shape.type;
  43425. this._ctx = this._ctx || this.util.getContext();
  43426. // 未实现或不可用时则数学运算,主要是line,brokenLine,ring
  43427. var _mathReturn = this._mathMethod(shape, area, x, y);
  43428. if (typeof _mathReturn != 'undefined') {
  43429. return _mathReturn;
  43430. }
  43431. if (shape.buildPath && this._ctx.isPointInPath) {
  43432. return this._buildPathMethod(shape, this._ctx, area, x, y);
  43433. }
  43434. // 上面的方法都行不通时
  43435. switch (zoneType) {
  43436. case 'ellipse': // Todo,不精确
  43437. case 'smicellipse': // Todo,不精确
  43438. return true;
  43439. // 旋轮曲线 不准确
  43440. case 'trochoid':
  43441. var _r = area.location == 'out'
  43442. ? area.r1 + area.r2 + area.d
  43443. : area.r1 - area.r2 + area.d;
  43444. return this.isInsideCircle(area, x, y, _r);
  43445. // 玫瑰线 不准确
  43446. case 'rose' :
  43447. return this.isInsideCircle(area, x, y, area.maxr);
  43448. // 路径,椭圆,曲线等-----------------13
  43449. default:
  43450. return false; // Todo,暂不支持
  43451. }
  43452. }
  43453. /**
  43454. * @function SuperMap.LevelRenderer.Tool.Areal.prototype._mathMethod
  43455. * @description 包含判断。用数学方法判断,三个方法中最快,但是支持的shape少。
  43456. * @param {Object} shape - 图形。
  43457. * @param {number} area - 目标区域。
  43458. * @param {number} x - 横坐标。
  43459. * @param {number} y - 纵坐标。
  43460. * @returns {boolean} 图形是否包含鼠标位置,true表示坐标处在图形中。
  43461. */
  43462. _mathMethod(shape, area, x, y) {
  43463. var zoneType = shape.type;
  43464. // 在矩形内则部分图形需要进一步判断
  43465. switch (zoneType) {
  43466. // 贝塞尔曲线
  43467. case 'bezier-curve':
  43468. if (typeof(area.cpX2) === 'undefined') {
  43469. return this.isInsideQuadraticStroke(
  43470. area.xStart, area.yStart,
  43471. area.cpX1, area.cpY1,
  43472. area.xEnd, area.yEnd,
  43473. area.lineWidth, x, y
  43474. );
  43475. }
  43476. return this.isInsideCubicStroke(
  43477. area.xStart, area.yStart,
  43478. area.cpX1, area.cpY1,
  43479. area.cpX2, area.cpY2,
  43480. area.xEnd, area.yEnd,
  43481. area.lineWidth, x, y
  43482. );
  43483. // 线
  43484. case 'line':
  43485. return this.isInsideLine(
  43486. area.xStart, area.yStart,
  43487. area.xEnd, area.yEnd,
  43488. area.lineWidth, x, y
  43489. );
  43490. // 折线
  43491. case 'broken-line':
  43492. return this.isInsideBrokenLine(
  43493. area.pointList, area.lineWidth, x, y
  43494. );
  43495. // 扩展折线
  43496. case 'smicbroken-line': {
  43497. // SMIC-修改 - start
  43498. let icX = x;
  43499. let icY = y;
  43500. if (shape.refOriginalPosition) {
  43501. icX = x - shape.refOriginalPosition[0];
  43502. icY = y - shape.refOriginalPosition[1];
  43503. }
  43504. return this.isInsideBrokenLine(
  43505. area.pointList, area.lineWidth, icX, icY
  43506. );
  43507. }
  43508. //初始代码:
  43509. // return isInsideBrokenLine(
  43510. // area.pointList, area.lineWidth, x, y
  43511. // );
  43512. // SMIC-修改 - end
  43513. // 圆环
  43514. case 'ring':
  43515. return this.isInsideRing(
  43516. area.x, area.y, area.r0, area.r, x, y
  43517. );
  43518. case 'smicring': {
  43519. let areaX = area.x;
  43520. let areaY = area.y;
  43521. if (shape.refOriginalPosition) {
  43522. areaX = area.x + shape.refOriginalPosition[0];
  43523. areaY = area.y + shape.refOriginalPosition[1];
  43524. }
  43525. return this.isInsideRing(
  43526. areaX, areaY, area.r0, area.r, x, y
  43527. );
  43528. }
  43529. // 圆形
  43530. case 'circle':
  43531. return this.isInsideCircle(
  43532. area.x, area.y, area.r, x, y
  43533. );
  43534. // 扩展-点
  43535. case 'smicpoint': {
  43536. // SMIC-修改 - start
  43537. let icX = x;
  43538. let icY = y;
  43539. if (shape.refOriginalPosition) {
  43540. icX = x - shape.refOriginalPosition[0];
  43541. icY = y - shape.refOriginalPosition[1];
  43542. }
  43543. return this.isInsideCircle(
  43544. area.x, area.y, area.r, icX, icY
  43545. );
  43546. }
  43547. //初始代码:
  43548. // 无
  43549. // SMIC-修改 - end
  43550. // 扇形
  43551. case 'sector': {
  43552. let startAngle = area.startAngle * Math.PI / 180;
  43553. let endAngle = area.endAngle * Math.PI / 180;
  43554. if (!area.clockWise) {
  43555. startAngle = -startAngle;
  43556. endAngle = -endAngle;
  43557. }
  43558. return this.isInsideSector(
  43559. area.x, area.y, area.r0, area.r,
  43560. startAngle, endAngle,
  43561. !area.clockWise,
  43562. x, y
  43563. );
  43564. }
  43565. //初始代码:
  43566. // 无
  43567. // SMIC-增加 - end
  43568. // 扇形
  43569. case 'smicsector': {
  43570. let startAngle = area.startAngle * Math.PI / 180;
  43571. let endAngle = area.endAngle * Math.PI / 180;
  43572. if (!area.clockWise) {
  43573. startAngle = -startAngle;
  43574. endAngle = -endAngle;
  43575. }
  43576. let areaX = area.x;
  43577. let areaY = area.y;
  43578. if (shape.refOriginalPosition) {
  43579. areaX = area.x + shape.refOriginalPosition[0];
  43580. areaY = area.y + shape.refOriginalPosition[1];
  43581. }
  43582. return this.isInsideSector(
  43583. areaX, areaY, area.r0, area.r,
  43584. startAngle, endAngle,
  43585. !area.clockWise,
  43586. x, y
  43587. );
  43588. }
  43589. // 多边形
  43590. case 'path':
  43591. return this.isInsidePath(
  43592. area.pathArray, Math.max(area.lineWidth, 5),
  43593. area.brushType, x, y
  43594. );
  43595. case 'polygon':
  43596. case 'star':
  43597. case 'smicstar':
  43598. case 'isogon':
  43599. case 'smicisogon':
  43600. return this.isInsidePolygon(area.pointList, x, y);
  43601. // 扩展多边形
  43602. case 'smicpolygon': {
  43603. // SMIC-修改 - start
  43604. let icX = x;
  43605. let icY = y;
  43606. if (shape.refOriginalPosition) {
  43607. icX = x - shape.refOriginalPosition[0];
  43608. icY = y - shape.refOriginalPosition[1];
  43609. }
  43610. //岛洞面
  43611. if (shape.holePolygonPointLists && shape.holePolygonPointLists.length > 0) {
  43612. var isOnBase = this.isInsidePolygon(area.pointList, icX, icY);
  43613. // 遍历岛洞子面
  43614. var holePLS = shape.holePolygonPointLists;
  43615. var isOnHole = false;
  43616. for (var i = 0, holePLSen = holePLS.length; i < holePLSen; i++) {
  43617. var holePL = holePLS[i];
  43618. var isOnSubHole = this.isInsidePolygon(holePL, icX, icY);
  43619. if (isOnSubHole === true) {
  43620. isOnHole = true;
  43621. }
  43622. }
  43623. // 捕获判断
  43624. return isOnBase === true && isOnHole === false;
  43625. } else {
  43626. return this.isInsidePolygon(area.pointList, icX, icY);
  43627. }
  43628. }
  43629. // 初始代码:
  43630. // 无
  43631. // SMIC-修改 - end
  43632. // 文本
  43633. case 'text':
  43634. var rect = area.__rect || shape.getRect(area);
  43635. return this.isInsideRect(
  43636. rect.x, rect.y, rect.width, rect.height, x, y
  43637. );
  43638. // 扩展文本
  43639. case 'smictext':
  43640. //用文本背景矩形判断
  43641. var textBg = shape.getTextBackground(area);
  43642. return this.isInsidePolygon(textBg, x, y);
  43643. //初始代码:
  43644. // 无
  43645. // SMIC-修改 - end
  43646. // 矩形
  43647. case 'rectangle':
  43648. case 'image':
  43649. // 图片
  43650. return this.isInsideRect(
  43651. area.x, area.y, area.width, area.height, x, y
  43652. );
  43653. case 'smicimage': {
  43654. let areaX = area.x;
  43655. let areaY = area.y;
  43656. if (shape.refOriginalPosition) {
  43657. areaX = area.x + shape.refOriginalPosition[0];
  43658. areaY = area.y + shape.refOriginalPosition[1];
  43659. }
  43660. return this.isInsideRect(
  43661. areaX, areaY, area.width, area.height, x, y
  43662. );
  43663. }
  43664. //// 扩展矩形
  43665. //case 'smicpolygon':
  43666. // // SMIC-修改 - start
  43667. // var icX = x;
  43668. // var icY = y;
  43669. // if(shape.refOriginalPosition) {
  43670. // icX = x - shape.refOriginalPosition[0];
  43671. // icY = y - shape.refOriginalPosition[1];
  43672. // }
  43673. // return this.isInsideRect(
  43674. // area.x, area.y, area.width, area.height, icX, icY
  43675. // );
  43676. //初始代码:
  43677. // 无
  43678. // SMIC-修改 - end
  43679. }
  43680. }
  43681. /**
  43682. * @function SuperMap.LevelRenderer.Tool.Areal.prototype._buildPathMethod
  43683. * @description 包含判断。通过buildPath方法来判断,三个方法中较快,但是不支持线条类型的 shape。
  43684. * @param {Object} shape - 图形。
  43685. * @param {Object} context - 上下文。
  43686. * @param {number} area - 目标区域。
  43687. * @param {number} x - 横坐标。
  43688. * @param {number} y - 纵坐标。
  43689. * @returns {boolean} 图形是否包含鼠标位置,true表示坐标处在图形中。
  43690. */
  43691. _buildPathMethod(shape, context, area, x, y) {
  43692. // 图形类实现路径创建了则用类的path
  43693. context.beginPath();
  43694. shape.buildPath(context, area);
  43695. context.closePath();
  43696. return context.isPointInPath(x, y);
  43697. }
  43698. /**
  43699. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isOutside
  43700. * @description 图形是否不包含鼠标位置。
  43701. * @param {Object} shape - 图形。
  43702. * @param {number} area - 目标区域。
  43703. * @param {number} x - 横坐标。
  43704. * @param {number} y - 纵坐标。
  43705. * @returns {boolean} 图形是否不包含鼠标位置, true表示坐标处在图形外。
  43706. */
  43707. isOutside(shape, area, x, y) {
  43708. return !this.isInside(shape, area, x, y);
  43709. }
  43710. /**
  43711. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideLine
  43712. * @description 线段包含判断。
  43713. * @param {number} x0 - 线起始点横坐标。
  43714. * @param {number} y0 - 线起始点纵坐标。
  43715. * @param {number} x1 - 线终点横坐标。
  43716. * @param {number} y1 - 线终点纵坐标。
  43717. * @param {number} lineWidth - 线宽。
  43718. * @param {number} x - 鼠标位置横坐标。
  43719. * @param {number} y - 鼠标位置纵坐标。
  43720. * @returns {boolean} 图形是否包含鼠标位置,true表示坐标处在图形内。
  43721. */
  43722. isInsideLine(x0, y0, x1, y1, lineWidth, x, y) {
  43723. if (lineWidth === 0) {
  43724. return false;
  43725. }
  43726. var _l = Math.max(lineWidth, 5);
  43727. var _a = 0;
  43728. var _b = 0;
  43729. // Quick reject
  43730. if (
  43731. (y > y0 + _l && y > y1 + _l)
  43732. || (y < y0 - _l && y < y1 - _l)
  43733. || (x > x0 + _l && x > x1 + _l)
  43734. || (x < x0 - _l && x < x1 - _l)
  43735. ) {
  43736. return false;
  43737. }
  43738. if (x0 !== x1) {
  43739. _a = (y0 - y1) / (x0 - x1);
  43740. _b = (x0 * y1 - x1 * y0) / (x0 - x1);
  43741. } else {
  43742. return Math.abs(x - x0) <= _l / 2;
  43743. }
  43744. var tmp = _a * x - y + _b;
  43745. var _s = tmp * tmp / (_a * _a + 1);
  43746. return _s <= _l / 2 * _l / 2;
  43747. }
  43748. /**
  43749. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideCubicStroke
  43750. * @description 三次贝塞尔曲线描边包含判断。
  43751. * @param {number} x0 - 点1横坐标。
  43752. * @param {number} y0 - 点1纵坐标。
  43753. * @param {number} x1 - 点2横坐标。
  43754. * @param {number} y1 - 点2纵坐标。
  43755. * @param {number} x2 - 点3纵坐标。
  43756. * @param {number} y2 - 点3纵坐标。
  43757. * @param {number} lineWidth - 线宽。
  43758. * @param {number} x - 鼠标位置横坐标。
  43759. * @param {number} y - 鼠标位置纵坐标。
  43760. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  43761. */
  43762. isInsideCubicStroke(x0, y0, x1, y1, x2, y2, x3, y3, lineWidth, x, y) {
  43763. if (lineWidth === 0) {
  43764. return false;
  43765. }
  43766. var _l = Math.max(lineWidth, 5);
  43767. // Quick reject
  43768. if (
  43769. (y > y0 + _l && y > y1 + _l && y > y2 + _l && y > y3 + _l)
  43770. || (y < y0 - _l && y < y1 - _l && y < y2 - _l && y < y3 - _l)
  43771. || (x > x0 + _l && x > x1 + _l && x > x2 + _l && x > x3 + _l)
  43772. || (x < x0 - _l && x < x1 - _l && x < x2 - _l && x < x3 - _l)
  43773. ) {
  43774. return false;
  43775. }
  43776. var d = this.curve.cubicProjectPoint(
  43777. x0, y0, x1, y1, x2, y2, x3, y3,
  43778. x, y, null
  43779. );
  43780. return d <= _l / 2;
  43781. }
  43782. /**
  43783. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideQuadraticStroke
  43784. * @description 二次贝塞尔曲线描边包含判断。
  43785. * @param {number} x0 - 点1横坐标。
  43786. * @param {number} y0 - 点1纵坐标。
  43787. * @param {number} x1 - 点2横坐标。
  43788. * @param {number} y1 - 点2纵坐标。
  43789. * @param {number} x2 - 点3纵坐标。
  43790. * @param {number} y2 - 点3纵坐标。
  43791. * @param {number} lineWidth - 线宽。
  43792. * @param {number} x - 鼠标位置横坐标。
  43793. * @param {number} y - 鼠标位置纵坐标。
  43794. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  43795. */
  43796. isInsideQuadraticStroke(x0, y0, x1, y1, x2, y2, lineWidth, x, y) {
  43797. if (lineWidth === 0) {
  43798. return false;
  43799. }
  43800. var _l = Math.max(lineWidth, 5);
  43801. // Quick reject
  43802. if (
  43803. (y > y0 + _l && y > y1 + _l && y > y2 + _l)
  43804. || (y < y0 - _l && y < y1 - _l && y < y2 - _l)
  43805. || (x > x0 + _l && x > x1 + _l && x > x2 + _l)
  43806. || (x < x0 - _l && x < x1 - _l && x < x2 - _l)
  43807. ) {
  43808. return false;
  43809. }
  43810. var d = this.curve.quadraticProjectPoint(
  43811. x0, y0, x1, y1, x2, y2,
  43812. x, y, null
  43813. );
  43814. return d <= _l / 2;
  43815. }
  43816. /**
  43817. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideArcStroke
  43818. * @description 圆弧描边包含判断。
  43819. * @param {number} cx - 圆心横坐标。
  43820. * @param {number} cy - 圆心纵坐标。
  43821. * @param {number} r - 圆半径。
  43822. * @param {number} startAngle - 起始角度。
  43823. * @param {number} endAngle - 终止角度。
  43824. * @param {number} anticlockwise - 顺时针还是逆时针。
  43825. * @param {number} lineWidth - 线宽。
  43826. * @param {number} x - 鼠标位置横坐标。
  43827. * @param {number} y - 鼠标位置纵坐标。
  43828. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  43829. */
  43830. isInsideArcStroke(cx, cy, r, startAngle, endAngle, anticlockwise, lineWidth, x, y) {
  43831. var PI2 = this.PI2;
  43832. if (lineWidth === 0) {
  43833. return false;
  43834. }
  43835. var _l = Math.max(lineWidth, 5);
  43836. x -= cx;
  43837. y -= cy;
  43838. var d = Math.sqrt(x * x + y * y);
  43839. if ((d - _l > r) || (d + _l < r)) {
  43840. return false;
  43841. }
  43842. if (Math.abs(startAngle - endAngle) >= PI2) {
  43843. // Is a circle
  43844. return true;
  43845. }
  43846. if (anticlockwise) {
  43847. var tmp = startAngle;
  43848. startAngle = this.normalizeRadian(endAngle);
  43849. endAngle = this.normalizeRadian(tmp);
  43850. } else {
  43851. startAngle = this.normalizeRadian(startAngle);
  43852. endAngle = this.normalizeRadian(endAngle);
  43853. }
  43854. if (startAngle > endAngle) {
  43855. endAngle += PI2;
  43856. }
  43857. var angle = Math.atan2(y, x);
  43858. if (angle < 0) {
  43859. angle += PI2;
  43860. }
  43861. return (angle >= startAngle && angle <= endAngle)
  43862. || (angle + PI2 >= startAngle && angle + PI2 <= endAngle);
  43863. }
  43864. /**
  43865. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideBrokenLine
  43866. * @description 图形 BrokenLine 是否包含鼠标位置, true表示坐标处在图形内。
  43867. * @param {Array} points - 曲线点对象。
  43868. * @param {number} lineWidth - 线宽。
  43869. * @param {number} x - 鼠标位置横坐标。
  43870. * @param {number} y - 鼠标位置纵坐标。
  43871. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  43872. */
  43873. isInsideBrokenLine(points, lineWidth, x, y) {
  43874. var _lineWidth = Math.max(lineWidth, 10);
  43875. for (var i = 0, l = points.length - 1; i < l; i++) {
  43876. var x0 = points[i][0];
  43877. var y0 = points[i][1];
  43878. var x1 = points[i + 1][0];
  43879. var y1 = points[i + 1][1];
  43880. if (this.isInsideLine(x0, y0, x1, y1, _lineWidth, x, y)) {
  43881. return true;
  43882. }
  43883. }
  43884. return false;
  43885. }
  43886. /**
  43887. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideRing
  43888. * @description 图形 Ring 是否包含鼠标位置, true表示坐标处在图形内。
  43889. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  43890. */
  43891. isInsideRing(cx, cy, r0, r, x, y) {
  43892. var d = (x - cx) * (x - cx) + (y - cy) * (y - cy);
  43893. return (d < r * r) && (d > r0 * r0);
  43894. }
  43895. /**
  43896. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideRect
  43897. * @description 图形 Rect 是否包含鼠标位置, true表示坐标处在图形内。
  43898. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  43899. */
  43900. isInsideRect(x0, y0, width, height, x, y) {
  43901. return x >= x0 && x <= (x0 + width) && y >= y0 && y <= (y0 + height);
  43902. }
  43903. /**
  43904. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideCircle
  43905. * @description 图形 Circle 是否包含鼠标位置, true表示坐标处在图形内。
  43906. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  43907. */
  43908. isInsideCircle(x0, y0, r, x, y) {
  43909. return (x - x0) * (x - x0) + (y - y0) * (y - y0) < r * r;
  43910. }
  43911. /**
  43912. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideSector
  43913. * @description 图形 Sector 是否包含鼠标位置, true表示坐标处在图形内。
  43914. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  43915. */
  43916. isInsideSector(cx, cy, r0, r, startAngle, endAngle, anticlockwise, x, y) {
  43917. return this.isInsideArcStroke(cx, cy, (r0 + r) / 2, startAngle, endAngle, anticlockwise, r - r0, x, y);
  43918. }
  43919. /**
  43920. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsidePolygon
  43921. * @description 图形 Polygon 是否包含鼠标位置, true表示坐标处在图形内。与 canvas 一样采用 non-zero winding rule
  43922. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  43923. */
  43924. isInsidePolygon(points, x, y) {
  43925. var N = points.length;
  43926. var w = 0;
  43927. for (var i = 0, j = N - 1; i < N; i++) {
  43928. var x0 = points[j][0];
  43929. var y0 = points[j][1];
  43930. var x1 = points[i][0];
  43931. var y1 = points[i][1];
  43932. w += this.windingLine(x0, y0, x1, y1, x, y);
  43933. j = i;
  43934. }
  43935. return w !== 0;
  43936. }
  43937. /**
  43938. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.windingLine
  43939. */
  43940. windingLine(x0, y0, x1, y1, x, y) {
  43941. if ((y > y0 && y > y1) || (y < y0 && y < y1)) {
  43942. return 0;
  43943. }
  43944. if (y1 == y0) {
  43945. return 0;
  43946. }
  43947. var dir = y1 < y0 ? 1 : -1;
  43948. var t = (y - y0) / (y1 - y0);
  43949. var x_ = t * (x1 - x0) + x0;
  43950. return x_ > x ? dir : 0;
  43951. }
  43952. /**
  43953. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.swapExtrema
  43954. */
  43955. swapExtrema() {
  43956. var tmp = this.extrema[0];
  43957. this.extrema[0] = this.extrema[1];
  43958. this.extrema[1] = tmp;
  43959. }
  43960. /**
  43961. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.windingCubic
  43962. */
  43963. windingCubic(x0, y0, x1, y1, x2, y2, x3, y3, x, y) {
  43964. var curve = this.curve;
  43965. var roots = this.roots;
  43966. var extrema = this.extrema;
  43967. // Quick reject
  43968. if (
  43969. (y > y0 && y > y1 && y > y2 && y > y3)
  43970. || (y < y0 && y < y1 && y < y2 && y < y3)
  43971. ) {
  43972. return 0;
  43973. }
  43974. var nRoots = curve.cubicRootAt(y0, y1, y2, y3, y, roots);
  43975. if (nRoots === 0) {
  43976. return 0;
  43977. } else {
  43978. var w = 0;
  43979. var nExtrema = -1;
  43980. var y0_, y1_;
  43981. for (var i = 0; i < nRoots; i++) {
  43982. var t = roots[i];
  43983. var x_ = curve.cubicAt(x0, x1, x2, x3, t);
  43984. if (x_ < x) { // Quick reject
  43985. continue;
  43986. }
  43987. if (nExtrema < 0) {
  43988. nExtrema = curve.cubicExtrema(y0, y1, y2, y3, extrema);
  43989. if (extrema[1] < extrema[0] && nExtrema > 1) {
  43990. this.swapExtrema();
  43991. }
  43992. y0_ = curve.cubicAt(y0, y1, y2, y3, extrema[0]);
  43993. if (nExtrema > 1) {
  43994. y1_ = curve.cubicAt(y0, y1, y2, y3, extrema[1]);
  43995. }
  43996. }
  43997. if (nExtrema == 2) {
  43998. // 分成三段单调函数
  43999. if (t < extrema[0]) {
  44000. w += y0_ < y0 ? 1 : -1;
  44001. } else if (t < extrema[1]) {
  44002. w += y1_ < y0_ ? 1 : -1;
  44003. } else {
  44004. w += y3 < y1_ ? 1 : -1;
  44005. }
  44006. } else {
  44007. // 分成两段单调函数
  44008. if (t < extrema[0]) {
  44009. w += y0_ < y0 ? 1 : -1;
  44010. } else {
  44011. w += y3 < y0_ ? 1 : -1;
  44012. }
  44013. }
  44014. }
  44015. return w;
  44016. }
  44017. }
  44018. /**
  44019. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.windingQuadratic
  44020. */
  44021. windingQuadratic(x0, y0, x1, y1, x2, y2, x, y) {
  44022. var curve = this.curve;
  44023. var roots = this.roots;
  44024. // Quick reject
  44025. if (
  44026. (y > y0 && y > y1 && y > y2)
  44027. || (y < y0 && y < y1 && y < y2)
  44028. ) {
  44029. return 0;
  44030. }
  44031. var nRoots = curve.quadraticRootAt(y0, y1, y2, y, roots);
  44032. if (nRoots === 0) {
  44033. return 0;
  44034. } else {
  44035. var t = curve.quadraticExtremum(y0, y1, y2);
  44036. if (t >= 0 && t <= 1) {
  44037. var w = 0;
  44038. var y_ = curve.quadraticAt(y0, y1, y2, t);
  44039. for (let i = 0; i < nRoots; i++) {
  44040. let x_ = curve.quadraticAt(x0, x1, x2, roots[i]);
  44041. if (x_ > x) {
  44042. continue;
  44043. }
  44044. if (roots[i] < t) {
  44045. w += y_ < y0 ? 1 : -1;
  44046. } else {
  44047. w += y2 < y_ ? 1 : -1;
  44048. }
  44049. }
  44050. return w;
  44051. } else {
  44052. let x_ = curve.quadraticAt(x0, x1, x2, roots[0]);
  44053. if (x_ > x) {
  44054. return 0;
  44055. }
  44056. return y2 < y0 ? 1 : -1;
  44057. }
  44058. }
  44059. }
  44060. /**
  44061. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.windingArc
  44062. * // TODO Arc 旋转
  44063. */
  44064. windingArc(cx, cy, r, startAngle, endAngle, anticlockwise, x, y) {
  44065. var roots = this.roots;
  44066. var PI2 = this.PI2;
  44067. y -= cy;
  44068. if (y > r || y < -r) {
  44069. return 0;
  44070. }
  44071. let tmp = Math.sqrt(r * r - y * y);
  44072. roots[0] = -tmp;
  44073. roots[1] = tmp;
  44074. if (Math.abs(startAngle - endAngle) >= PI2) {
  44075. // Is a circle
  44076. startAngle = 0;
  44077. endAngle = PI2;
  44078. var dir = anticlockwise ? 1 : -1;
  44079. if (x >= roots[0] + cx && x <= roots[1] + cx) {
  44080. return dir;
  44081. } else {
  44082. return 0;
  44083. }
  44084. }
  44085. if (anticlockwise) {
  44086. let tmp = startAngle;
  44087. startAngle = this.normalizeRadian(endAngle);
  44088. endAngle = this.normalizeRadian(tmp);
  44089. } else {
  44090. startAngle = this.normalizeRadian(startAngle);
  44091. endAngle = this.normalizeRadian(endAngle);
  44092. }
  44093. if (startAngle > endAngle) {
  44094. endAngle += PI2;
  44095. }
  44096. var w = 0;
  44097. for (let i = 0; i < 2; i++) {
  44098. var x_ = roots[i];
  44099. if (x_ + cx > x) {
  44100. let angle = Math.atan2(y, x_);
  44101. let dir = anticlockwise ? 1 : -1;
  44102. if (angle < 0) {
  44103. angle = PI2 + angle;
  44104. }
  44105. if (
  44106. (angle >= startAngle && angle <= endAngle)
  44107. || (angle + PI2 >= startAngle && angle + PI2 <= endAngle)
  44108. ) {
  44109. if (angle > Math.PI / 2 && angle < Math.PI * 1.5) {
  44110. dir = -dir;
  44111. }
  44112. w += dir;
  44113. }
  44114. }
  44115. }
  44116. return w;
  44117. }
  44118. /**
  44119. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsidePath
  44120. * @description 与 canvas 一样采用 non-zero winding rule
  44121. */
  44122. isInsidePath(pathArray, lineWidth, brushType, x, y) {
  44123. var w = 0;
  44124. var xi = 0;
  44125. var yi = 0;
  44126. var x0 = 0;
  44127. var y0 = 0;
  44128. var beginSubpath = true;
  44129. var firstCmd = true;
  44130. brushType = brushType || 'fill';
  44131. var hasStroke = brushType === 'stroke' || brushType === 'both';
  44132. var hasFill = brushType === 'fill' || brushType === 'both';
  44133. // var roots = [-1, -1, -1];
  44134. for (var i = 0; i < pathArray.length; i++) {
  44135. var seg = pathArray[i];
  44136. var p = seg.points;
  44137. // Begin a new subpath
  44138. if (beginSubpath || seg.command === 'M') {
  44139. if (i > 0) {
  44140. // Close previous subpath
  44141. if (hasFill) {
  44142. w += this.windingLine(xi, yi, x0, y0, x, y);
  44143. }
  44144. if (w !== 0) {
  44145. return true;
  44146. }
  44147. }
  44148. x0 = p[p.length - 2];
  44149. y0 = p[p.length - 1];
  44150. beginSubpath = false;
  44151. if (firstCmd && seg.command !== 'A') {
  44152. // 如果第一个命令不是M, 是lineTo, bezierCurveTo
  44153. // 等绘制命令的话,是会从该绘制的起点开始算的
  44154. // Arc 会在之后做单独处理所以这里忽略
  44155. firstCmd = false;
  44156. xi = x0;
  44157. yi = y0;
  44158. }
  44159. }
  44160. switch (seg.command) {
  44161. case 'M':
  44162. xi = p[0];
  44163. yi = p[1];
  44164. break;
  44165. case 'L':
  44166. if (hasStroke) {
  44167. if (this.isInsideLine(
  44168. xi, yi, p[0], p[1], lineWidth, x, y
  44169. )) {
  44170. return true;
  44171. }
  44172. }
  44173. if (hasFill) {
  44174. w += this.windingLine(xi, yi, p[0], p[1], x, y);
  44175. }
  44176. xi = p[0];
  44177. yi = p[1];
  44178. break;
  44179. case 'C':
  44180. if (hasStroke) {
  44181. if (this.isInsideCubicStroke(
  44182. xi, yi, p[0], p[1], p[2], p[3], p[4], p[5],
  44183. lineWidth, x, y
  44184. )) {
  44185. return true;
  44186. }
  44187. }
  44188. if (hasFill) {
  44189. w += this.windingCubic(
  44190. xi, yi, p[0], p[1], p[2], p[3], p[4], p[5], x, y
  44191. );
  44192. }
  44193. xi = p[4];
  44194. yi = p[5];
  44195. break;
  44196. case 'Q':
  44197. if (hasStroke) {
  44198. if (this.isInsideQuadraticStroke(
  44199. xi, yi, p[0], p[1], p[2], p[3],
  44200. lineWidth, x, y
  44201. )) {
  44202. return true;
  44203. }
  44204. }
  44205. if (hasFill) {
  44206. w += this.windingQuadratic(
  44207. xi, yi, p[0], p[1], p[2], p[3], x, y
  44208. );
  44209. }
  44210. xi = p[2];
  44211. yi = p[3];
  44212. break;
  44213. case 'A':
  44214. // TODO Arc 旋转
  44215. // TODO Arc 判断的开销比较大
  44216. var cx = p[0];
  44217. var cy = p[1];
  44218. var rx = p[2];
  44219. var ry = p[3];
  44220. var theta = p[4];
  44221. var dTheta = p[5];
  44222. var x1 = Math.cos(theta) * rx + cx;
  44223. var y1 = Math.sin(theta) * ry + cy;
  44224. // 不是直接使用 arc 命令
  44225. if (!firstCmd) {
  44226. w += this.windingLine(xi, yi, x1, y1);
  44227. } else {
  44228. firstCmd = false;
  44229. // 第一个命令起点还未定义
  44230. x0 = x1;
  44231. y0 = y1;
  44232. }
  44233. // zr 使用scale来模拟椭圆, 这里也对x做一定的缩放
  44234. var _x = (x - cx) * ry / rx + cx;
  44235. if (hasStroke) {
  44236. if (this.isInsideArcStroke(
  44237. cx, cy, ry, theta, theta + dTheta, 1 - p[7],
  44238. lineWidth, _x, y
  44239. )) {
  44240. return true;
  44241. }
  44242. }
  44243. if (hasFill) {
  44244. w += this.windingArc(
  44245. cx, cy, ry, theta, theta + dTheta, 1 - p[7],
  44246. _x, y
  44247. );
  44248. }
  44249. xi = Math.cos(theta + dTheta) * rx + cx;
  44250. yi = Math.sin(theta + dTheta) * ry + cy;
  44251. break;
  44252. case 'z':
  44253. if (hasStroke) {
  44254. if (this.isInsideLine(
  44255. xi, yi, x0, y0, lineWidth, x, y
  44256. )) {
  44257. return true;
  44258. }
  44259. }
  44260. beginSubpath = true;
  44261. break;
  44262. }
  44263. }
  44264. if (hasFill) {
  44265. w += this.windingLine(xi, yi, x0, y0, x, y);
  44266. }
  44267. return w !== 0;
  44268. }
  44269. /**
  44270. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.getTextWidth
  44271. * @description 测算多行文本宽度
  44272. */
  44273. getTextWidth(text, textFont) {
  44274. var key = text + ':' + textFont;
  44275. if (this._textWidthCache[key]) {
  44276. return this._textWidthCache[key];
  44277. }
  44278. this._ctx = this._ctx || this.util.getContext();
  44279. this._ctx.save();
  44280. if (textFont) {
  44281. this._ctx.font = textFont;
  44282. }
  44283. text = (text + '').split('\n');
  44284. var width = 0;
  44285. for (var i = 0, l = text.length; i < l; i++) {
  44286. width = Math.max(
  44287. this._ctx.measureText(text[i]).width,
  44288. width
  44289. );
  44290. }
  44291. this._ctx.restore();
  44292. this._textWidthCache[key] = width;
  44293. if (++this._textWidthCacheCounter > this.TEXT_CACHE_MAX) {
  44294. // 内存释放
  44295. this._textWidthCacheCounter = 0;
  44296. this._textWidthCache = {};
  44297. }
  44298. return width;
  44299. }
  44300. /**
  44301. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.getTextHeight
  44302. * @description 测算多行文本高度
  44303. */
  44304. getTextHeight(text, textFont) {
  44305. var key = text + ':' + textFont;
  44306. if (this._textHeightCache[key]) {
  44307. return this._textHeightCache[key];
  44308. }
  44309. this._ctx = this._ctx || this.util.getContext();
  44310. this._ctx.save();
  44311. if (textFont) {
  44312. this._ctx.font = textFont;
  44313. }
  44314. text = (text + '').split('\n');
  44315. // 比较粗暴
  44316. //var height = (this._ctx.measureText('国').width + 2) * text.length; //打包不支持中文,替换掉
  44317. var height = (this._ctx.measureText('ZH').width + 2) * text.length;
  44318. this._ctx.restore();
  44319. this._textHeightCache[key] = height;
  44320. if (++this._textHeightCacheCounter > this.TEXT_CACHE_MAX) {
  44321. // 内存释放
  44322. this._textHeightCacheCounter = 0;
  44323. this._textHeightCache = {};
  44324. }
  44325. return height;
  44326. }
  44327. }
  44328. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/ComputeBoundingBox.js
  44329. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  44330. * This program are made available under the terms of the Apache License, Version 2.0
  44331. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44332. /**
  44333. * @class SuperMap.LevelRenderer.Tool.ComputeBoundingBox
  44334. * @category Visualization Theme
  44335. * @classdesc LevelRenderer 工具-图形 Bounds 计算
  44336. * @private
  44337. */
  44338. class ComputeBoundingBox {
  44339. /**
  44340. * @function SuperMap.LevelRenderer.Tool.ComputeBoundingBox.prototype.constructor
  44341. * @description 构造函数。
  44342. */
  44343. constructor() {
  44344. if (arguments.length === 3) {
  44345. this.computeBoundingBox(arguments);
  44346. }
  44347. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.ComputeBoundingBox";
  44348. }
  44349. /**
  44350. * @function SuperMap.LevelRenderer.Tool.ComputeBoundingBox.prototype.computeBoundingBox
  44351. * @description 从顶点数组中计算出最小包围盒,写入'min'和'max'中。
  44352. * @param {Array.<Object>} points - 顶点数组。
  44353. * @param {Array} min - 最小
  44354. * @param {Array} max - 最大
  44355. */
  44356. computeBoundingBox(points, min, max) {
  44357. if (points.length === 0) {
  44358. return;
  44359. }
  44360. var left = points[0][0];
  44361. var right = points[0][0];
  44362. var top = points[0][1];
  44363. var bottom = points[0][1];
  44364. for (var i = 1; i < points.length; i++) {
  44365. var p = points[i];
  44366. if (p[0] < left) {
  44367. left = p[0];
  44368. }
  44369. if (p[0] > right) {
  44370. right = p[0];
  44371. }
  44372. if (p[1] < top) {
  44373. top = p[1];
  44374. }
  44375. if (p[1] > bottom) {
  44376. bottom = p[1];
  44377. }
  44378. }
  44379. min[0] = left;
  44380. min[1] = top;
  44381. max[0] = right;
  44382. max[1] = bottom;
  44383. }
  44384. /**
  44385. * @function SuperMap.LevelRenderer.Tool.ComputeBoundingBox.prototype.cubeBezier
  44386. * @description 从三阶贝塞尔曲线(p0, p1, p2, p3)中计算出最小包围盒,写入'min'和'max'中。原:computeCubeBezierBoundingBox。
  44387. * @param {Array.<number>} p0 - 三阶贝塞尔曲线p0点
  44388. * @param {Array.<number>} p1 - 三阶贝塞尔曲线p1点
  44389. * @param {Array.<number>} p2 - 三阶贝塞尔曲线p2点
  44390. * @param {Array.<number>} p3 - 三阶贝塞尔曲线p3点
  44391. * @param {Array.<number>} min - 最小
  44392. * @param {Array.<number>} max - 最大
  44393. */
  44394. cubeBezier(p0, p1, p2, p3, min, max) {
  44395. var curve = new Curve_Curve();
  44396. var xDim = [];
  44397. curve.cubicExtrema(p0[0], p1[0], p2[0], p3[0], xDim);
  44398. for (let i = 0; i < xDim.length; i++) {
  44399. xDim[i] = curve.cubicAt(p0[0], p1[0], p2[0], p3[0], xDim[i]);
  44400. }
  44401. var yDim = [];
  44402. curve.cubicExtrema(p0[1], p1[1], p2[1], p3[1], yDim);
  44403. for (let i = 0; i < yDim.length; i++) {
  44404. yDim[i] = curve.cubicAt(p0[1], p1[1], p2[1], p3[1], yDim[i]);
  44405. }
  44406. xDim.push(p0[0], p3[0]);
  44407. yDim.push(p0[1], p3[1]);
  44408. var left = Math.min.apply(null, xDim);
  44409. var right = Math.max.apply(null, xDim);
  44410. var top = Math.min.apply(null, yDim);
  44411. var bottom = Math.max.apply(null, yDim);
  44412. min[0] = left;
  44413. min[1] = top;
  44414. max[0] = right;
  44415. max[1] = bottom;
  44416. }
  44417. /**
  44418. * @function SuperMap.LevelRenderer.Tool.ComputeBoundingBox.prototype.quadraticBezier
  44419. * @description 从二阶贝塞尔曲线(p0, p1, p2)中计算出最小包围盒,写入'min'和'max'中。原:computeQuadraticBezierBoundingBox。
  44420. * @param {Array.<number>} p0 - 二阶贝塞尔曲线p0点
  44421. * @param {Array.<number>} p1 - 二阶贝塞尔曲线p1点
  44422. * @param {Array.<number>} p2 - 二阶贝塞尔曲线p2点
  44423. * @param {Array.<number>} min - 最小
  44424. * @param {Array.<number>} max - 最大
  44425. */
  44426. quadraticBezier(p0, p1, p2, min, max) {
  44427. var curve = new Curve_Curve();
  44428. // Find extremities, where derivative in x dim or y dim is zero
  44429. var t1 = curve.quadraticExtremum(p0[0], p1[0], p2[0]);
  44430. var t2 = curve.quadraticExtremum(p0[1], p1[1], p2[1]);
  44431. t1 = Math.max(Math.min(t1, 1), 0);
  44432. t2 = Math.max(Math.min(t2, 1), 0);
  44433. var ct1 = 1 - t1;
  44434. var ct2 = 1 - t2;
  44435. var x1 = ct1 * ct1 * p0[0]
  44436. + 2 * ct1 * t1 * p1[0]
  44437. + t1 * t1 * p2[0];
  44438. var y1 = ct1 * ct1 * p0[1]
  44439. + 2 * ct1 * t1 * p1[1]
  44440. + t1 * t1 * p2[1];
  44441. var x2 = ct2 * ct2 * p0[0]
  44442. + 2 * ct2 * t2 * p1[0]
  44443. + t2 * t2 * p2[0];
  44444. var y2 = ct2 * ct2 * p0[1]
  44445. + 2 * ct2 * t2 * p1[1]
  44446. + t2 * t2 * p2[1];
  44447. min[0] = Math.min(p0[0], p2[0], x1, x2);
  44448. min[1] = Math.min(p0[1], p2[1], y1, y2);
  44449. max[0] = Math.max(p0[0], p2[0], x1, x2);
  44450. max[1] = Math.max(p0[1], p2[1], y1, y2);
  44451. }
  44452. /**
  44453. * @function SuperMap.LevelRenderer.Tool.ComputeBoundingBox.prototype.arc
  44454. * @description 从圆弧中计算出最小包围盒,写入'min'和'max'中。原:computeArcBoundingBox。
  44455. * @param {number} x - 圆弧中心点 x
  44456. * @param {number} y - 圆弧中心点 y
  44457. * @param {number} r - 圆弧半径
  44458. * @param {number} startAngle - 圆弧开始角度
  44459. * @param {number} endAngle - 圆弧结束角度
  44460. * @param {number} anticlockwise - 是否是顺时针
  44461. * @param {number} min - 最小
  44462. * @param {number} max - 最大
  44463. */
  44464. arc(x, y, r, startAngle, endAngle, anticlockwise, min, max) {
  44465. var vec2 = new levelRenderer_Vector_Vector();
  44466. var start = vec2.create();
  44467. var end = vec2.create();
  44468. var extremity = vec2.create();
  44469. start[0] = Math.cos(startAngle) * r + x;
  44470. start[1] = Math.sin(startAngle) * r + y;
  44471. end[0] = Math.cos(endAngle) * r + x;
  44472. end[1] = Math.sin(endAngle) * r + y;
  44473. vec2.min(min, start, end);
  44474. vec2.max(max, start, end);
  44475. // Thresh to [0, Math.PI * 2]
  44476. startAngle = startAngle % (Math.PI * 2);
  44477. if (startAngle < 0) {
  44478. startAngle = startAngle + Math.PI * 2;
  44479. }
  44480. endAngle = endAngle % (Math.PI * 2);
  44481. if (endAngle < 0) {
  44482. endAngle = endAngle + Math.PI * 2;
  44483. }
  44484. if (startAngle > endAngle && !anticlockwise) {
  44485. endAngle += Math.PI * 2;
  44486. } else if (startAngle < endAngle && anticlockwise) {
  44487. startAngle += Math.PI * 2;
  44488. }
  44489. if (anticlockwise) {
  44490. var tmp = endAngle;
  44491. endAngle = startAngle;
  44492. startAngle = tmp;
  44493. }
  44494. // var number = 0;
  44495. // var step = (anticlockwise ? -Math.PI : Math.PI) / 2;
  44496. for (var angle = 0; angle < endAngle; angle += Math.PI / 2) {
  44497. if (angle > startAngle) {
  44498. extremity[0] = Math.cos(angle) * r + x;
  44499. extremity[1] = Math.sin(angle) * r + y;
  44500. vec2.min(min, extremity, min);
  44501. vec2.max(max, extremity, max);
  44502. }
  44503. }
  44504. }
  44505. }
  44506. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Env.js
  44507. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  44508. * This program are made available under the terms of the Apache License, Version 2.0
  44509. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44510. /**
  44511. * @class SuperMap.LevelRenderer.Tool.Env
  44512. * @category Visualization Theme
  44513. * @classdesc 环境识别
  44514. * @private
  44515. */
  44516. class Env {
  44517. constructor() {
  44518. // Zepto.js
  44519. // (c) 2010-2013 Thomas Fuchs
  44520. // Zepto.js may be freely distributed under the MIT license.
  44521. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Env";
  44522. var me = this;
  44523. function detect(ua) {
  44524. var os = me.os = {};
  44525. var browser = me.browser = {};
  44526. var webkit = ua.match(/Web[kK]it[\/]{0,1}([\d.]+)/);
  44527. var android = ua.match(/(Android);?[\s\/]+([\d.]+)?/);
  44528. var ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
  44529. var ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
  44530. var iphone = !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/);
  44531. var webos = ua.match(/(webOS|hpwOS)[\s\/]([\d.]+)/);
  44532. var touchpad = webos && ua.match(/TouchPad/);
  44533. var kindle = ua.match(/Kindle\/([\d.]+)/);
  44534. var silk = ua.match(/Silk\/([\d._]+)/);
  44535. var blackberry = ua.match(/(BlackBerry).*Version\/([\d.]+)/);
  44536. var bb10 = ua.match(/(BB10).*Version\/([\d.]+)/);
  44537. var rimtabletos = ua.match(/(RIM\sTablet\sOS)\s([\d.]+)/);
  44538. var playbook = ua.match(/PlayBook/);
  44539. var chrome = ua.match(/Chrome\/([\d.]+)/) || ua.match(/CriOS\/([\d.]+)/);
  44540. var firefox = ua.match(/Firefox\/([\d.]+)/);
  44541. var ie = ua.match(/MSIE ([\d.]+)/);
  44542. var safari = webkit && ua.match(/Mobile\//) && !chrome;
  44543. var webview = ua.match(/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/) && !chrome;
  44544. // Todo: clean this up with a better OS/browser seperation:
  44545. // - discern (more) between multiple browsers on android
  44546. // - decide if kindle fire in silk mode is android or not
  44547. // - Firefox on Android doesn't specify the Android version
  44548. // - possibly devide in os, device and browser hashes
  44549. /*eslint-disable*/
  44550. if (browser.webkit = !!webkit) {
  44551. browser.version = webkit[1];
  44552. }
  44553. if (android) {
  44554. os.android = true;
  44555. os.version = android[2];
  44556. }
  44557. if (iphone && !ipod) {
  44558. os.ios = os.iphone = true;
  44559. os.version = iphone[2].replace(/_/g, '.');
  44560. }
  44561. if (ipad) {
  44562. os.ios = os.ipad = true;
  44563. os.version = ipad[2].replace(/_/g, '.');
  44564. }
  44565. if (ipod) {
  44566. os.ios = os.ipod = true;
  44567. os.version = ipod[3] ? ipod[3].replace(/_/g, '.') : null;
  44568. }
  44569. if (webos) {
  44570. os.webos = true;
  44571. os.version = webos[2];
  44572. }
  44573. if (touchpad) {
  44574. os.touchpad = true;
  44575. }
  44576. if (blackberry) {
  44577. os.blackberry = true;
  44578. os.version = blackberry[2];
  44579. }
  44580. if (bb10) {
  44581. os.bb10 = true;
  44582. os.version = bb10[2];
  44583. }
  44584. if (rimtabletos) {
  44585. os.rimtabletos = true;
  44586. os.version = rimtabletos[2];
  44587. }
  44588. if (playbook) {
  44589. browser.playbook = true;
  44590. }
  44591. if (kindle) {
  44592. os.kindle = true;
  44593. os.version = kindle[1];
  44594. }
  44595. if (silk) {
  44596. browser.silk = true;
  44597. browser.version = silk[1];
  44598. }
  44599. if (!silk && os.android && ua.match(/Kindle Fire/)) {
  44600. browser.silk = true;
  44601. }
  44602. if (chrome) {
  44603. browser.chrome = true;
  44604. browser.version = chrome[1];
  44605. }
  44606. if (firefox) {
  44607. browser.firefox = true;
  44608. browser.version = firefox[1];
  44609. }
  44610. if (ie) {
  44611. browser.ie = true;
  44612. browser.version = ie[1];
  44613. }
  44614. if (safari && (ua.match(/Safari/) || !!os.ios)) {
  44615. browser.safari = true;
  44616. }
  44617. if (webview) {
  44618. browser.webview = true;
  44619. }
  44620. if (ie) {
  44621. browser.ie = true;
  44622. browser.version = ie[1];
  44623. }
  44624. os.tablet = !!(ipad || playbook || (android && !ua.match(/Mobile/)) ||
  44625. (firefox && ua.match(/Tablet/)) || (ie && !ua.match(/Phone/) && ua.match(/Touch/)));
  44626. os.phone = !!(!os.tablet && !os.ipod && (android || iphone || webos || blackberry || bb10 ||
  44627. (chrome && ua.match(/Android/)) || (chrome && ua.match(/CriOS\/([\d.]+)/)) ||
  44628. (firefox && ua.match(/Mobile/)) || (ie && ua.match(/Touch/))));
  44629. return {
  44630. browser: browser,
  44631. os: os,
  44632. // 原生canvas支持
  44633. canvasSupported: document.createElement('canvas').getContext ? true : false
  44634. };
  44635. }
  44636. return detect(navigator.userAgent);
  44637. }
  44638. destory() {
  44639. return true;
  44640. }
  44641. }
  44642. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Event.js
  44643. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  44644. * This program are made available under the terms of the Apache License, Version 2.0
  44645. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44646. /**
  44647. * @class SuperMap.LevelRenderer.Tool.Event
  44648. * @category Visualization Theme
  44649. * @classdesc LevelRenderer 工具-事件辅助类
  44650. * @private
  44651. */
  44652. class Event_Event {
  44653. /**
  44654. * @function SuperMap.LevelRenderer.Tool.Event.prototype.constructor
  44655. * @description 构造函数。
  44656. */
  44657. constructor() {
  44658. /**
  44659. * @member {function} SuperMap.LevelRenderer.Tool.Event.prototype.stop
  44660. * @description 停止冒泡和阻止默认行为
  44661. */
  44662. this.stop = typeof window.addEventListener === 'function'
  44663. ? function (e) {
  44664. e.preventDefault();
  44665. e.stopPropagation();
  44666. e.cancelBubble = true;
  44667. }
  44668. : function (e) {
  44669. e.returnValue = false;
  44670. e.cancelBubble = true;
  44671. };
  44672. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Event";
  44673. }
  44674. /**
  44675. * @function SuperMap.LevelRenderer.Tool.Event.prototype.getX
  44676. * @description 提取鼠标(手指)x坐标。
  44677. * @param {Event} e - 事件。
  44678. * @returns {number} 鼠标(手指)x坐标。
  44679. */
  44680. getX(e) {
  44681. return typeof e.zrenderX != 'undefined' && e.zrenderX
  44682. || typeof e.offsetX != 'undefined' && e.offsetX
  44683. || typeof e.layerX != 'undefined' && e.layerX
  44684. || typeof e.clientX != 'undefined' && e.clientX;
  44685. }
  44686. /**
  44687. * @function SuperMap.LevelRenderer.Tool.Event.prototype.getY
  44688. * @description 提取鼠标(手指)y坐标。
  44689. * @param {Event} e - 事件。
  44690. * @returns {number} 鼠标(手指)y坐标。
  44691. */
  44692. getY(e) {
  44693. return typeof e.zrenderY != 'undefined' && e.zrenderY
  44694. || typeof e.offsetY != 'undefined' && e.offsetY
  44695. || typeof e.layerY != 'undefined' && e.layerY
  44696. || typeof e.clientY != 'undefined' && e.clientY;
  44697. }
  44698. /**
  44699. * @function SuperMap.LevelRenderer.Tool.Event.prototype.getDelta
  44700. * @description 提取鼠标滚轮变化。
  44701. * @param {Event} e - 事件。
  44702. * @returns {number} 滚轮变化,正值说明滚轮是向上滚动,如果是负值说明滚轮是向下滚动。
  44703. */
  44704. getDelta(e) {
  44705. return typeof e.zrenderDelta != 'undefined' && e.zrenderDelta
  44706. || typeof e.wheelDelta != 'undefined' && e.wheelDelta
  44707. || typeof e.detail != 'undefined' && -e.detail;
  44708. }
  44709. }
  44710. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Http.js
  44711. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  44712. * This program are made available under the terms of the Apache License, Version 2.0
  44713. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44714. /**
  44715. * @private
  44716. * @class SuperMap.LevelRenderer.Tool.Http
  44717. * @category Visualization Theme
  44718. * @classdesc LevelRenderer 工具-Http
  44719. */
  44720. class Http {
  44721. /**
  44722. * @function SuperMap.LevelRenderer.Tool.Http.constructor
  44723. * @description 构造函数。
  44724. */
  44725. constructor() {
  44726. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Http"
  44727. }
  44728. /**
  44729. * @function SuperMap.LevelRenderer.Tool.Http.prototype.get
  44730. * @description get请求。
  44731. * @param {(string|IHTTPGetOption)} url - 请求url
  44732. * @param {function} onsuccess - 请求成功函数
  44733. * @param {function} onerror - 请求失败函数
  44734. * @param {Object} opts - 额外参数
  44735. * @returns {number} cos值
  44736. */
  44737. get(url, onsuccess, onerror) {
  44738. if (typeof(url) === 'object') {
  44739. var obj = url;
  44740. url = obj.url;
  44741. onsuccess = obj.onsuccess;
  44742. onerror = obj.onerror;
  44743. }
  44744. var xhr = window.XMLHttpRequest
  44745. ? new XMLHttpRequest()
  44746. : new window.ActiveXObject('Microsoft.XMLHTTP');
  44747. xhr.open('GET', url, true);
  44748. xhr.onreadystatechange = function () {
  44749. if (xhr.readyState == 4) {
  44750. if (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) {
  44751. onsuccess && onsuccess(xhr.responseText);
  44752. } else {
  44753. onerror && onerror();
  44754. }
  44755. xhr.onreadystatechange = new Function();
  44756. xhr = null;
  44757. }
  44758. };
  44759. xhr.send(null);
  44760. }
  44761. }
  44762. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Config.js
  44763. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  44764. * This program are made available under the terms of the Apache License, Version 2.0
  44765. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44766. class Config {
  44767. }
  44768. /**
  44769. * @enum EVENT
  44770. * @description 事件
  44771. * @type {Object}
  44772. * @private
  44773. */
  44774. Config.EVENT = {
  44775. //窗口大小变化
  44776. RESIZE: 'resize',
  44777. //鼠标按钮被(手指)按下,事件对象是:目标图形元素或空
  44778. CLICK: 'click',
  44779. //双击事件
  44780. DBLCLICK: 'dblclick',
  44781. //鼠标滚轮变化,事件对象是:目标图形元素或空
  44782. MOUSEWHEEL: 'mousewheel',
  44783. //鼠标(手指)被移动,事件对象是:目标图形元素或空
  44784. MOUSEMOVE: 'mousemove',
  44785. //鼠标移到某图形元素之上,事件对象是:目标图形元素
  44786. MOUSEOVER: 'mouseover',
  44787. //鼠标从某图形元素移开,事件对象是:目标图形元素
  44788. MOUSEOUT: 'mouseout',
  44789. //鼠标按钮(手指)被按下,事件对象是:目标图形元素或空
  44790. MOUSEDOWN: 'mousedown',
  44791. //鼠标按键(手指)被松开,事件对象是:目标图形元素或空
  44792. MOUSEUP: 'mouseup',
  44793. //全局离开,MOUSEOUT触发比较频繁,一次离开优化绑定
  44794. GLOBALOUT: 'globalout',
  44795. // 一次成功元素拖拽的行为事件过程是:
  44796. // dragstart > dragenter > dragover [> dragleave] > drop > dragend
  44797. //开始拖拽时触发,事件对象是:被拖拽图形元素
  44798. DRAGSTART: 'dragstart',
  44799. //拖拽完毕时触发(在drop之后触发),事件对象是:被拖拽图形元素
  44800. DRAGEND: 'dragend',
  44801. //拖拽图形元素进入目标图形元素时触发,事件对象是:目标图形元素
  44802. DRAGENTER: 'dragenter',
  44803. //拖拽图形元素在目标图形元素上移动时触发,事件对象是:目标图形元素
  44804. DRAGOVER: 'dragover',
  44805. //拖拽图形元素离开目标图形元素时触发,事件对象是:目标图形元素
  44806. DRAGLEAVE: 'dragleave',
  44807. //拖拽图形元素放在目标图形元素内时触发,事件对象是:目标图形元素
  44808. DROP: 'drop',
  44809. //touch end - start < delay is click
  44810. touchClickDelay: 300
  44811. };
  44812. /**
  44813. * @enum catchBrushException
  44814. * @description 是否异常捕获
  44815. * @type {boolean}
  44816. * @private
  44817. */
  44818. Config.catchBrushException = false;
  44819. /**
  44820. * @enum debugMode
  44821. * @description debug 日志选项:catchBrushException 为 true 下有效。
  44822. * 0 : 不生成debug数据,发布用
  44823. * 1 : 异常抛出,调试用
  44824. * 2 : 控制台输出,调试用
  44825. * @type {boolean}
  44826. * @private
  44827. */
  44828. Config.debugMode = 0;
  44829. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Log.js
  44830. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  44831. * This program are made available under the terms of the Apache License, Version 2.0
  44832. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44833. /**
  44834. * @private
  44835. * @class SuperMap.LevelRenderer.Tool.Log
  44836. * @category Visualization Theme
  44837. * @classdesc LevelRenderer 工具-日志
  44838. */
  44839. class Log {
  44840. /**
  44841. * @function SuperMap.LevelRenderer.Tool.Log.constructor
  44842. * @description 构造函数。
  44843. */
  44844. constructor() {
  44845. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Log";
  44846. return function () {
  44847. if (Config.debugMode === 0) {
  44848. return;
  44849. } else if (Config.debugMode == 1) {
  44850. for (let k in arguments) {
  44851. throw new Error(arguments[k]);
  44852. }
  44853. } else if (Config.debugMode > 1) {
  44854. for (let k in arguments) {
  44855. console.log(arguments[k]);
  44856. }
  44857. }
  44858. };
  44859. /* for debug
  44860. return function(mes) {
  44861. document.getElementById('wrong-message').innerHTML =
  44862. mes + ' ' + (new Date() - 0)
  44863. + '<br/>'
  44864. + document.getElementById('wrong-message').innerHTML;
  44865. };
  44866. */
  44867. }
  44868. destory() {
  44869. return true;
  44870. }
  44871. }
  44872. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Math.js
  44873. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  44874. * This program are made available under the terms of the Apache License, Version 2.0
  44875. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44876. /**
  44877. * @private
  44878. * @class SuperMap.LevelRenderer.Tool.Math
  44879. * @category Visualization Theme
  44880. * @classdesc LevelRenderer 工具-数学辅助类
  44881. */
  44882. class MathTool {
  44883. /**
  44884. * @function SuperMap.LevelRenderer.Tool.Math.constructor
  44885. * @description 构造函数。
  44886. */
  44887. constructor() {
  44888. /**
  44889. * @member {number} SuperMap.LevelRenderer.Tool.Math._radians
  44890. * @description 角度与弧度转化参数
  44891. */
  44892. this._radians = window.Math.PI / 180;
  44893. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Math";
  44894. }
  44895. /**
  44896. * @function SuperMap.LevelRenderer.Tool.Math.prototype.sin
  44897. * @description 正弦函数。
  44898. * @param {number} angle - 弧度(角度)参数。
  44899. * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
  44900. * @returns {number} sin 值。
  44901. */
  44902. sin(angle, isDegrees) {
  44903. return window.Math.sin(isDegrees ? angle * this._radians : angle);
  44904. }
  44905. /**
  44906. * @function SuperMap.LevelRenderer.Tool.Math.prototype.cos
  44907. * @description 余弦函数。
  44908. * @param {number} angle - 弧度(角度)参数。
  44909. * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
  44910. * @returns {number} cos 值。
  44911. */
  44912. cos(angle, isDegrees) {
  44913. return window.Math.cos(isDegrees ? angle * this._radians : angle);
  44914. }
  44915. /**
  44916. * @function SuperMap.LevelRenderer.Tool.Math.prototype.degreeToRadian
  44917. * @description 角度转弧度。
  44918. * @param {number} angle - 弧度(角度)参数。
  44919. * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
  44920. * @returns {number} 弧度值。
  44921. */
  44922. degreeToRadian(angle) {
  44923. return angle * this._radians;
  44924. }
  44925. /**
  44926. * @function SuperMap.LevelRenderer.Tool.Math.prototype.radianToDegree
  44927. * @description 弧度转角度。
  44928. * @param {number} angle - 弧度(角度)参数。
  44929. * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
  44930. * @returns {number} 角度。
  44931. */
  44932. radianToDegree(angle) {
  44933. return angle / this._radians;
  44934. }
  44935. }
  44936. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Matrix.js
  44937. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  44938. * This program are made available under the terms of the Apache License, Version 2.0
  44939. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44940. /**
  44941. * @private
  44942. * @class SuperMap.LevelRenderer.Tool.Matrix
  44943. * @category Visualization Theme
  44944. * @classdesc LevelRenderer 工具-3x2矩阵操作类
  44945. */
  44946. class Matrix {
  44947. /**
  44948. * @function SuperMap.LevelRenderer.Tool.Matrix.constructor
  44949. * @description 构造函数。
  44950. */
  44951. constructor() {
  44952. /**
  44953. * @member {Object} SuperMap.LevelRenderer.Tool.Matrix.prototype.ArrayCtor
  44954. * @description 数组类型控制
  44955. */
  44956. this.ArrayCtor = typeof Float32Array === 'undefined'
  44957. ? Array
  44958. : Float32Array;
  44959. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Matrix";
  44960. }
  44961. /**
  44962. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.create
  44963. * @description 创建一个单位矩阵。
  44964. * @returns {(Float32Array|Array.<number>)} 单位矩阵。
  44965. */
  44966. create() {
  44967. var ArrayCtor = this.ArrayCtor;
  44968. var out = new ArrayCtor(6);
  44969. this.identity(out);
  44970. return out;
  44971. }
  44972. /**
  44973. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.identity
  44974. * @description 设置矩阵为单位矩阵。
  44975. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  44976. * @returns {(Float32Array|Array.<number>)} 单位矩阵。
  44977. */
  44978. identity(out) {
  44979. out[0] = 1;
  44980. out[1] = 0;
  44981. out[2] = 0;
  44982. out[3] = 1;
  44983. out[4] = 0;
  44984. out[5] = 0;
  44985. return out;
  44986. }
  44987. /**
  44988. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.copy
  44989. * @description 复制矩阵。
  44990. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  44991. * @returns {(Float32Array|Array.<number>)} 克隆矩阵。
  44992. */
  44993. copy(out, m) {
  44994. out[0] = m[0];
  44995. out[1] = m[1];
  44996. out[2] = m[2];
  44997. out[3] = m[3];
  44998. out[4] = m[4];
  44999. out[5] = m[5];
  45000. return out;
  45001. }
  45002. /**
  45003. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.mul
  45004. * @description 矩阵相乘。
  45005. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  45006. * @param {(Float32Array|Array.<number>)} m1 - 矩阵m1。
  45007. * @param {(Float32Array|Array.<number>)} m2- 矩阵m2。
  45008. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  45009. */
  45010. mul(out, m1, m2) {
  45011. out[0] = m1[0] * m2[0] + m1[2] * m2[1];
  45012. out[1] = m1[1] * m2[0] + m1[3] * m2[1];
  45013. out[2] = m1[0] * m2[2] + m1[2] * m2[3];
  45014. out[3] = m1[1] * m2[2] + m1[3] * m2[3];
  45015. out[4] = m1[0] * m2[4] + m1[2] * m2[5] + m1[4];
  45016. out[5] = m1[1] * m2[4] + m1[3] * m2[5] + m1[5];
  45017. return out;
  45018. }
  45019. /**
  45020. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.mul
  45021. * @description 平移变换。
  45022. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  45023. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  45024. * @param {(Float32Array|Array.<number>)} v- 平移参数。
  45025. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  45026. */
  45027. translate(out, a, v) {
  45028. out[0] = a[0];
  45029. out[1] = a[1];
  45030. out[2] = a[2];
  45031. out[3] = a[3];
  45032. out[4] = a[4] + v[0];
  45033. out[5] = a[5] + v[1];
  45034. return out;
  45035. }
  45036. /**
  45037. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.rotate
  45038. * @description 平移变换。
  45039. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  45040. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  45041. * @param {(Float32Array|Array.<number>)} rad - 旋转参数。
  45042. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  45043. */
  45044. rotate(out, a, rad) {
  45045. var aa = a[0];
  45046. var ac = a[2];
  45047. var atx = a[4];
  45048. var ab = a[1];
  45049. var ad = a[3];
  45050. var aty = a[5];
  45051. var st = Math.sin(rad);
  45052. var ct = Math.cos(rad);
  45053. out[0] = aa * ct + ab * st;
  45054. out[1] = -aa * st + ab * ct;
  45055. out[2] = ac * ct + ad * st;
  45056. out[3] = -ac * st + ct * ad;
  45057. out[4] = ct * atx + st * aty;
  45058. out[5] = ct * aty - st * atx;
  45059. return out;
  45060. }
  45061. /**
  45062. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.scale
  45063. * @description 缩放变换。
  45064. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  45065. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  45066. * @param {(Float32Array|Array.<number>)} v - 缩放参数。
  45067. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  45068. */
  45069. scale(out, a, v) {
  45070. var vx = v[0];
  45071. var vy = v[1];
  45072. out[0] = a[0] * vx;
  45073. out[1] = a[1] * vy;
  45074. out[2] = a[2] * vx;
  45075. out[3] = a[3] * vy;
  45076. out[4] = a[4] * vx;
  45077. out[5] = a[5] * vy;
  45078. return out;
  45079. }
  45080. /**
  45081. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.invert
  45082. * @description 求逆矩阵。
  45083. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  45084. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  45085. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  45086. */
  45087. invert(out, a) {
  45088. var aa = a[0];
  45089. var ac = a[2];
  45090. var atx = a[4];
  45091. var ab = a[1];
  45092. var ad = a[3];
  45093. var aty = a[5];
  45094. var det = aa * ad - ab * ac;
  45095. if (!det) {
  45096. return null;
  45097. }
  45098. det = 1.0 / det;
  45099. out[0] = ad * det;
  45100. out[1] = -ab * det;
  45101. out[2] = -ac * det;
  45102. out[3] = aa * det;
  45103. out[4] = (ac * aty - ad * atx) * det;
  45104. out[5] = (ab * atx - aa * aty) * det;
  45105. return out;
  45106. }
  45107. /**
  45108. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.mulVector
  45109. * @description 矩阵左乘向量。
  45110. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  45111. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  45112. * @param {(Float32Array|Array.<number>)} v - 缩放参数。
  45113. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  45114. */
  45115. mulVector(out, a, v) {
  45116. var aa = a[0];
  45117. var ac = a[2];
  45118. var atx = a[4];
  45119. var ab = a[1];
  45120. var ad = a[3];
  45121. var aty = a[5];
  45122. out[0] = v[0] * aa + v[1] * ac + atx;
  45123. out[1] = v[0] * ab + v[1] * ad + aty;
  45124. return out;
  45125. }
  45126. }
  45127. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SUtil.js
  45128. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  45129. * This program are made available under the terms of the Apache License, Version 2.0
  45130. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45131. class SUtil_SUtil {
  45132. /**
  45133. * @function SuperMap.LevelRenderer.SUtil.SUtil_smoothBezier
  45134. * @description 贝塞尔平滑曲线。
  45135. * @private
  45136. * @param {Array} points - 线段顶点数组。
  45137. * @param {number} smooth - 平滑等级, 0-1。
  45138. * @param {boolean} isLoop - isLoop。
  45139. * @param {Array} constraint - 将计算出来的控制点约束在一个包围盒内,比如 [[0, 0], [100, 100]], 这个包围盒会与整个折线的包围盒做一个并集用来约束控制点。
  45140. * @param {Array} [originalPosition=[0, 0]] - 参考原点。
  45141. * @return {Array} 生成的平滑节点数组。
  45142. */
  45143. static SUtil_smoothBezier(points, smooth, isLoop, constraint, originalPosition) {
  45144. if (!originalPosition || originalPosition !== 2) {
  45145. originalPosition = [0, 0];
  45146. }
  45147. var __OP = originalPosition;
  45148. var cps = [];
  45149. var v = [];
  45150. var v1 = [];
  45151. var v2 = [];
  45152. var hasConstraint = !!constraint;
  45153. var min, max;
  45154. if (hasConstraint) {
  45155. min = [Infinity, Infinity];
  45156. max = [-Infinity, -Infinity];
  45157. let len = points.length;
  45158. for (let i = 0; i < len; i++) {
  45159. SUtil_SUtil.Util_vector.min(min, min, [points[i][0] + __OP[0], points[i][1] + __OP[1]]);
  45160. SUtil_SUtil.Util_vector.max(max, max, [points[i][0] + __OP[0], points[i][1] + __OP[1]]);
  45161. }
  45162. // 与指定的包围盒做并集
  45163. SUtil_SUtil.Util_vector.min(min, min, constraint[0]);
  45164. SUtil_SUtil.Util_vector.max(max, max, constraint[1]);
  45165. }
  45166. let len = points.length;
  45167. for (let i = 0; i < len; i++) {
  45168. let point = [points[i][0] + __OP[0], points[i][1] + __OP[1]];
  45169. let prevPoint;
  45170. let nextPoint;
  45171. if (isLoop) {
  45172. prevPoint = [points[i ? i - 1 : len - 1][0] + __OP[0], points[i ? i - 1 : len - 1][1] + __OP[1]];
  45173. nextPoint = [points[(i + 1) % len][0] + __OP[0], points[(i + 1) % len][1] + __OP[1]];
  45174. } else {
  45175. if (i === 0 || i === len - 1) {
  45176. cps.push([points[i][0] + __OP[0], points[i][1] + __OP[1]]);
  45177. continue;
  45178. } else {
  45179. prevPoint = [points[i - 1][0] + __OP[0], points[i - 1][1] + __OP[1]];
  45180. nextPoint = [points[i + 1][0] + __OP[0], points[i + 1][1] + __OP[1]];
  45181. }
  45182. }
  45183. SUtil_SUtil.Util_vector.sub(v, nextPoint, prevPoint);
  45184. // use degree to scale the handle length
  45185. SUtil_SUtil.Util_vector.scale(v, v, smooth);
  45186. let d0 = SUtil_SUtil.Util_vector.distance(point, prevPoint);
  45187. let d1 = SUtil_SUtil.Util_vector.distance(point, nextPoint);
  45188. let sum = d0 + d1;
  45189. if (sum !== 0) {
  45190. d0 /= sum;
  45191. d1 /= sum;
  45192. }
  45193. SUtil_SUtil.Util_vector.scale(v1, v, -d0);
  45194. SUtil_SUtil.Util_vector.scale(v2, v, d1);
  45195. let cp0 = SUtil_SUtil.Util_vector.add([], point, v1);
  45196. let cp1 = SUtil_SUtil.Util_vector.add([], point, v2);
  45197. if (hasConstraint) {
  45198. SUtil_SUtil.Util_vector.max(cp0, cp0, min);
  45199. SUtil_SUtil.Util_vector.min(cp0, cp0, max);
  45200. SUtil_SUtil.Util_vector.max(cp1, cp1, min);
  45201. SUtil_SUtil.Util_vector.min(cp1, cp1, max);
  45202. }
  45203. cps.push(cp0);
  45204. cps.push(cp1);
  45205. }
  45206. if (isLoop) {
  45207. cps.push(cps.shift());
  45208. }
  45209. return cps;
  45210. }
  45211. /**
  45212. * @function SuperMap.LevelRenderer.SUtil.SUtil_smoothSpline
  45213. * @description 插值折线。
  45214. * @private
  45215. * @param {Array} points - 线段顶点数组。
  45216. * @param {boolean} isLoop - isLoop。
  45217. * @param {Array} constraint - 将计算出来的控制点约束在一个包围盒内,比如 [[0, 0], [100, 100]], 这个包围盒会与整个折线的包围盒做一个并集用来约束控制点。
  45218. * @param {Array} originalPosition - 参考原点。默认值:[0, 0]。
  45219. * @return {Array} 生成的平滑节点数组。
  45220. */
  45221. static SUtil_smoothSpline(points, isLoop, constraint, originalPosition) {
  45222. if (!originalPosition || originalPosition !== 2) {
  45223. originalPosition = [0, 0];
  45224. }
  45225. var __OP = originalPosition;
  45226. var len = points.length;
  45227. var ret = [];
  45228. var distance = 0;
  45229. for (let i = 1; i < len; i++) {
  45230. 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]]);
  45231. }
  45232. var segs = distance / 5;
  45233. segs = segs < len ? len : segs;
  45234. for (let i = 0; i < segs; i++) {
  45235. let pos = i / (segs - 1) * (isLoop ? len : len - 1);
  45236. let idx = Math.floor(pos);
  45237. let w = pos - idx;
  45238. let p0;
  45239. let p1 = [points[idx % len][0] + __OP[0], points[idx % len][1] + __OP[1]];
  45240. let p2;
  45241. let p3;
  45242. if (!isLoop) {
  45243. p0 = [points[idx === 0 ? idx : idx - 1][0] + __OP[0], points[idx === 0 ? idx : idx - 1][1] + __OP[1]];
  45244. p2 = [points[idx > len - 2 ? len - 1 : idx + 1][0] + __OP[0], points[idx > len - 2 ? len - 1 : idx + 1][1] + __OP[1]];
  45245. p3 = [points[idx > len - 3 ? len - 1 : idx + 2][0] + __OP[0], points[idx > len - 3 ? len - 1 : idx + 2][1] + __OP[1]];
  45246. } else {
  45247. p0 = [points[(idx - 1 + len) % len][0] + __OP[0], points[(idx - 1 + len) % len][1] + __OP[1]];
  45248. p2 = [points[(idx + 1) % len][0] + __OP[0], points[(idx + 1) % len][1] + __OP[1]];
  45249. p3 = [points[(idx + 2) % len][0] + __OP[0], points[(idx + 2) % len][1] + __OP[1]];
  45250. }
  45251. let w2 = w * w;
  45252. let w3 = w * w2;
  45253. ret.push([
  45254. interpolate(p0[0], p1[0], p2[0], p3[0], w, w2, w3),
  45255. interpolate(p0[1], p1[1], p2[1], p3[1], w, w2, w3)
  45256. ]);
  45257. }
  45258. return ret;
  45259. // inner Function
  45260. function interpolate(p0, p1, p2, p3, t, t2, t3) {
  45261. var v0 = (p2 - p0) * 0.5;
  45262. var v1 = (p3 - p1) * 0.5;
  45263. return (2 * (p1 - p2) + v0 + v1) * t3
  45264. + (-3 * (p1 - p2) - 2 * v0 - v1) * t2
  45265. + v0 * t + p1;
  45266. }
  45267. }
  45268. /**
  45269. * @function SuperMap.LevelRenderer.SUtil.SUtil_dashedLineTo
  45270. * @description 虚线 lineTo。
  45271. */
  45272. static SUtil_dashedLineTo(ctx, x1, y1, x2, y2, dashLength, customDashPattern) {
  45273. // http://msdn.microsoft.com/en-us/library/ie/dn265063(v=vs.85).aspx
  45274. var dashPattern = [5, 5];
  45275. dashLength = typeof dashLength != 'number'
  45276. ? 5
  45277. : dashLength;
  45278. if (ctx.setLineDash) {
  45279. dashPattern[0] = dashLength;
  45280. dashPattern[1] = dashLength;
  45281. if (customDashPattern && (customDashPattern instanceof Array)) {
  45282. ctx.setLineDash(customDashPattern);
  45283. } else {
  45284. ctx.setLineDash(dashPattern);
  45285. }
  45286. // ctx.setLineDash(dashPattern);
  45287. ctx.moveTo(x1, y1);
  45288. ctx.lineTo(x2, y2);
  45289. return;
  45290. }
  45291. var dx = x2 - x1;
  45292. var dy = y2 - y1;
  45293. var numDashes = Math.floor(
  45294. Math.sqrt(dx * dx + dy * dy) / dashLength
  45295. );
  45296. dx = dx / numDashes;
  45297. dy = dy / numDashes;
  45298. var flag = true;
  45299. for (var i = 0; i < numDashes; ++i) {
  45300. if (flag) {
  45301. ctx.moveTo(x1, y1);
  45302. } else {
  45303. ctx.lineTo(x1, y1);
  45304. }
  45305. flag = !flag;
  45306. x1 += dx;
  45307. y1 += dy;
  45308. }
  45309. ctx.lineTo(x2, y2);
  45310. }
  45311. }
  45312. // 把所有工具对象放到全局静态变量上,以便直接调用工具方法,
  45313. // 避免使用工具时频繁的创建工具对象带来的性能消耗。
  45314. SUtil_SUtil.Util_area = new Area();
  45315. SUtil_SUtil.Util_color = new Color();
  45316. SUtil_SUtil.Util_computeBoundingBox = new ComputeBoundingBox();
  45317. SUtil_SUtil.Util_curve = new Curve_Curve();
  45318. SUtil_SUtil.Util_env = new Env();
  45319. SUtil_SUtil.Util_event = new Event_Event();
  45320. SUtil_SUtil.Util_http = new Http();
  45321. SUtil_SUtil.Util_log = new Log();
  45322. SUtil_SUtil.Util_math = new MathTool();
  45323. SUtil_SUtil.Util_matrix = new Matrix();
  45324. SUtil_SUtil.Util = new Util_Util();
  45325. SUtil_SUtil.Util_vector = new levelRenderer_Vector_Vector();
  45326. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Transformable.js
  45327. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  45328. * This program are made available under the terms of the Apache License, Version 2.0
  45329. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45330. /**
  45331. * @private
  45332. * @class SuperMap.LevelRenderer.Transformable
  45333. * @category Visualization Theme
  45334. * @classdesc 可变换超类,所有支持 Canvas Transform 变换操作的类均是此类的子类。此类不可实例化。
  45335. */
  45336. class Transformable {
  45337. /**
  45338. * @function SuperMap.LevelRenderer.Transformable.constructor
  45339. * @description 构造函数。
  45340. */
  45341. constructor() {
  45342. /**
  45343. * @member {Array.<number>} SuperMap.LevelRenderer.Transformable.prototype.position
  45344. * @description 平移, 默认值:[0, 0]。
  45345. */
  45346. this.position = [0, 0];
  45347. /**
  45348. * @member {Array.<number>} SuperMap.LevelRenderer.Transformable.prototype.rotation
  45349. * @description 旋转,可以通过数组二三项指定旋转的原点, 默认值:[0, 0, 0]。
  45350. */
  45351. this.rotation = [0, 0, 0];
  45352. /**
  45353. * @member {Array.<number>} SuperMap.LevelRenderer.Transformable.prototype.scale
  45354. * @description 缩放,可以通过数组三四项指定缩放的原点, 默认值:[1, 1, 0, 0]。
  45355. */
  45356. this.scale = [1, 1, 0, 0];
  45357. /**
  45358. * @member {boolean} SuperMap.LevelRenderer.Transformable.prototype.needLocalTransform
  45359. * @description 是否变换。默认值:false。
  45360. */
  45361. this.needLocalTransform = false;
  45362. /**
  45363. * @member {boolean} SuperMap.LevelRenderer.Transformable.prototype.needTransform
  45364. * @description 是否有坐标变换。默认值:false。
  45365. */
  45366. this.needTransform = false;
  45367. this.CLASS_NAME = "SuperMap.LevelRenderer.Transformable";
  45368. /**
  45369. * @function SuperMap.LevelRenderer.Transformable.prototype.lookAt
  45370. * @description 设置图形的朝向。
  45371. */
  45372. this.lookAt = (function () {
  45373. var v = SUtil_SUtil.Util_vector.create();
  45374. // {Array.<Number>|Float32Array} target
  45375. return function (target) {
  45376. if (!this.transform) {
  45377. this.transform = SUtil_SUtil.Util_matrix.create();
  45378. }
  45379. var m = this.transform;
  45380. SUtil_SUtil.Util_vector.sub(v, target, this.position);
  45381. if (isAroundZero(v[0]) && isAroundZero(v[1])) {
  45382. return;
  45383. }
  45384. SUtil_SUtil.Util_vector.normalize(v, v);
  45385. // Y Axis
  45386. // TODO Scale origin ?
  45387. m[2] = v[0] * this.scale[1];
  45388. m[3] = v[1] * this.scale[1];
  45389. // X Axis
  45390. m[0] = v[1] * this.scale[0];
  45391. m[1] = -v[0] * this.scale[0];
  45392. // Position
  45393. m[4] = this.position[0];
  45394. m[5] = this.position[1];
  45395. this.decomposeTransform();
  45396. function isAroundZero(val) {
  45397. var EPSILON = 5e-5;
  45398. return val > -EPSILON && val < EPSILON;
  45399. }
  45400. };
  45401. })();
  45402. }
  45403. /**
  45404. * @function SuperMap.LevelRenderer.Transformable.prototype.destroy
  45405. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  45406. */
  45407. destroy() {
  45408. this.position = null;
  45409. this.rotation = null;
  45410. this.scale = null;
  45411. this.needLocalTransform = null;
  45412. this.needTransform = null;
  45413. }
  45414. /**
  45415. * @function SuperMap.LevelRenderer.Transformable.prototype.updateNeedTransform
  45416. * @description 更新 needLocalTransform
  45417. */
  45418. updateNeedTransform() {
  45419. this.needLocalTransform = isNotAroundZero(this.rotation[0])
  45420. || isNotAroundZero(this.position[0])
  45421. || isNotAroundZero(this.position[1])
  45422. || isNotAroundZero(this.scale[0] - 1)
  45423. || isNotAroundZero(this.scale[1] - 1);
  45424. function isNotAroundZero(val) {
  45425. var EPSILON = 5e-5;
  45426. return val > EPSILON || val < -EPSILON;
  45427. }
  45428. }
  45429. /**
  45430. * @function SuperMap.LevelRenderer.Transformable.prototype.updateTransform
  45431. * @description 判断是否需要有坐标变换,更新 needTransform 属性。如果有坐标变换, 则从 position, rotation, scale 以及父节点的 transform 计算出自身的 transform 矩阵
  45432. */
  45433. updateTransform() {
  45434. this.updateNeedTransform();
  45435. if (this.parent) {
  45436. this.needTransform = this.needLocalTransform || this.parent.needTransform;
  45437. } else {
  45438. this.needTransform = this.needLocalTransform;
  45439. }
  45440. if (!this.needTransform) {
  45441. return;
  45442. }
  45443. var origin = [0, 0];
  45444. var m = this.transform || SUtil_SUtil.Util_matrix.create();
  45445. SUtil_SUtil.Util_matrix.identity(m);
  45446. if (this.needLocalTransform) {
  45447. if (
  45448. isNotAroundZero(this.scale[0])
  45449. || isNotAroundZero(this.scale[1])
  45450. ) {
  45451. origin[0] = -this.scale[2] || 0;
  45452. origin[1] = -this.scale[3] || 0;
  45453. let haveOrigin = isNotAroundZero(origin[0])
  45454. || isNotAroundZero(origin[1]);
  45455. if (haveOrigin) {
  45456. SUtil_SUtil.Util_matrix.translate(
  45457. m, m, origin
  45458. );
  45459. }
  45460. SUtil_SUtil.Util_matrix.scale(m, m, this.scale);
  45461. if (haveOrigin) {
  45462. origin[0] = -origin[0];
  45463. origin[1] = -origin[1];
  45464. SUtil_SUtil.Util_matrix.translate(
  45465. m, m, origin
  45466. );
  45467. }
  45468. }
  45469. if (this.rotation instanceof Array) {
  45470. if (this.rotation[0] !== 0) {
  45471. origin[0] = -this.rotation[1] || 0;
  45472. origin[1] = -this.rotation[2] || 0;
  45473. let haveOrigin = isNotAroundZero(origin[0])
  45474. || isNotAroundZero(origin[1]);
  45475. if (haveOrigin) {
  45476. SUtil_SUtil.Util_matrix.translate(
  45477. m, m, origin
  45478. );
  45479. }
  45480. SUtil_SUtil.Util_matrix.rotate(m, m, this.rotation[0]);
  45481. if (haveOrigin) {
  45482. origin[0] = -origin[0];
  45483. origin[1] = -origin[1];
  45484. SUtil_SUtil.Util_matrix.translate(
  45485. m, m, origin
  45486. );
  45487. }
  45488. }
  45489. } else {
  45490. if (this.rotation !== 0) {
  45491. SUtil_SUtil.Util_matrix.rotate(m, m, this.rotation);
  45492. }
  45493. }
  45494. if (
  45495. isNotAroundZero(this.position[0]) || isNotAroundZero(this.position[1])
  45496. ) {
  45497. SUtil_SUtil.Util_matrix.translate(m, m, this.position);
  45498. }
  45499. }
  45500. // 保存这个变换矩阵
  45501. this.transform = m;
  45502. // 应用父节点变换
  45503. if (this.parent && this.parent.needTransform) {
  45504. if (this.needLocalTransform) {
  45505. SUtil_SUtil.Util_matrix.mul(this.transform, this.parent.transform, this.transform);
  45506. } else {
  45507. SUtil_SUtil.Util_matrix.copy(this.transform, this.parent.transform);
  45508. }
  45509. }
  45510. function isNotAroundZero(val) {
  45511. var EPSILON = 5e-5;
  45512. return val > EPSILON || val < -EPSILON;
  45513. }
  45514. }
  45515. /**
  45516. * @function SuperMap.LevelRenderer.Transformable.prototype.setTransform
  45517. * @description 将自己的 transform 应用到 context 上。
  45518. *
  45519. * @param {Context2D} ctx - Context2D 上下文。
  45520. */
  45521. setTransform(ctx) {
  45522. if (this.needTransform) {
  45523. var m = this.transform;
  45524. ctx.transform(
  45525. m[0], m[1],
  45526. m[2], m[3],
  45527. m[4], m[5]
  45528. );
  45529. }
  45530. }
  45531. /**
  45532. * @function SuperMap.LevelRenderer.Transformable.prototype.decomposeTransform
  45533. * @description 分解`transform`矩阵到`position`, `rotation`, `scale` 。
  45534. */
  45535. decomposeTransform() {
  45536. if (!this.transform) {
  45537. return;
  45538. }
  45539. var m = this.transform;
  45540. var sx = m[0] * m[0] + m[1] * m[1];
  45541. var position = this.position;
  45542. var scale = this.scale;
  45543. var rotation = this.rotation;
  45544. if (isNotAroundZero(sx - 1)) {
  45545. sx = Math.sqrt(sx);
  45546. }
  45547. var sy = m[2] * m[2] + m[3] * m[3];
  45548. if (isNotAroundZero(sy - 1)) {
  45549. sy = Math.sqrt(sy);
  45550. }
  45551. position[0] = m[4];
  45552. position[1] = m[5];
  45553. scale[0] = sx;
  45554. scale[1] = sy;
  45555. scale[2] = scale[3] = 0;
  45556. rotation[0] = Math.atan2(-m[1] / sy, m[0] / sx);
  45557. rotation[1] = rotation[2] = 0;
  45558. function isNotAroundZero(val) {
  45559. var EPSILON = 5e-5;
  45560. return val > EPSILON || val < -EPSILON;
  45561. }
  45562. }
  45563. }
  45564. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Shape.js
  45565. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  45566. * This program are made available under the terms of the Apache License, Version 2.0
  45567. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45568. /**
  45569. * @private
  45570. * @class SuperMap.LevelRenderer.Shape
  45571. * @category Visualization Theme
  45572. * @classdesc 图形(shape)基类。
  45573. * @extends SuperMap.LevelRenderer.Eventful
  45574. * @extends SuperMap.LevelRenderer.Transformable
  45575. */
  45576. class Shape_Shape extends SuperMap.mixin(Eventful, Transformable) {
  45577. /**
  45578. * @function SuperMap.LevelRenderer.Shape.constructor
  45579. * @description 构造函数。
  45580. *
  45581. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  45582. *
  45583. */
  45584. constructor(options) {
  45585. super(options);
  45586. options = options || {};
  45587. /**
  45588. * @member {string} SuperMap.LevelRenderer.Shape.prototype.id
  45589. * @description 唯一标识。
  45590. */
  45591. this.id = null;
  45592. /**
  45593. * @member {Object} SuperMap.LevelRenderer.Shape.prototype.style
  45594. * @description 基础绘制样式。
  45595. * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  45596. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  45597. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  45598. * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  45599. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  45600. * @param {number} style.opacity - 绘制透明度。默认值:1。
  45601. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  45602. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  45603. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  45604. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  45605. * @param {string} style.text - 图形中的附加文本。默认值:""。
  45606. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  45607. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  45608. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  45609. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  45610. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  45611. *
  45612. */
  45613. this.style = {};
  45614. /**
  45615. * @member {Object} SuperMap.LevelRenderer.Shape.prototype.style.__rect
  45616. * @description 包围图形的最小矩形盒子。
  45617. *
  45618. * @param {number} x - 左上角顶点x轴坐标。
  45619. * @param {number} y - 左上角顶点y轴坐标。
  45620. * @param {number} width - 包围盒矩形宽度。
  45621. * @param {number} height - 包围盒矩形高度。
  45622. */
  45623. /**
  45624. * @member {Object} SuperMap.LevelRenderer.Shape.prototype.highlightStyle
  45625. * @description 高亮样式。
  45626. *
  45627. * @param {string} highlightStyle.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  45628. * @param {string} highlightStyle.color - 填充颜色。默认值:"#000000'"。
  45629. * @param {string} highlightStyle.strokeColor - 描边颜色。默认值:"#000000'"。
  45630. * @param {string} highlightStyle.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  45631. * @param {number} highlightStyle.lineWidth - 描边宽度。默认值:1。
  45632. * @param {number} highlightStyle.opacity - 绘制透明度。默认值:1。
  45633. * @param {number} highlightStyle.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  45634. * @param {number} highlightStyle.shadowColor - 阴影颜色。默认值:"#000000'"。
  45635. * @param {number} highlightStyle.shadowOffsetX - 阴影横向偏移。默认值:0。
  45636. * @param {number} highlightStyle.shadowOffsetY - 阴影纵向偏移。默认值:0。
  45637. * @param {string} highlightStyle.text - 图形中的附加文本。默认值:""。
  45638. * @param {string} highlightStyle.textColor - 文本颜色。默认值:"#000000'"。
  45639. * @param {string} highlightStyle.textFont - 附加文本样式。示例:'bold 18px verdana'。
  45640. * @param {string} highlightStyle.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  45641. * @param {string} highlightStyle.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  45642. * @param {string} highlightStyle.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  45643. */
  45644. this.highlightStyle = null;
  45645. /**
  45646. * @member {Object} SuperMap.LevelRenderer.Shape.prototype.parent
  45647. * @description 父节点,只读属性。<SuperMap.LevelRenderer.Group>
  45648. */
  45649. this.parent = null;
  45650. /**
  45651. * @member {boolean} SuperMap.LevelRenderer.Shape.prototype.__dirty
  45652. * @description {boolean}
  45653. */
  45654. this.__dirty = true;
  45655. /**
  45656. * @member {Array} SuperMap.LevelRenderer.Shape.prototype.__clipShapes
  45657. * @description {Array}
  45658. *
  45659. */
  45660. this.__clipShapes = [];
  45661. /**
  45662. * @member {boolean} SuperMap.LevelRenderer.Shape.prototype.invisible
  45663. * @description 图形是否可见,为 true 时不绘制图形,但是仍能触发鼠标事件。默认值:false。
  45664. */
  45665. this.invisible = false;
  45666. /**
  45667. * @member {boolean} SuperMap.LevelRenderer.Shape.prototype.ignore
  45668. * @description 图形是否忽略,为 true 时忽略图形的绘制以及事件触发。默认值:false。
  45669. */
  45670. this.ignore = false;
  45671. /**
  45672. * @member {boolean} SuperMap.LevelRenderer.Shape.prototype.zlevel
  45673. * @description z 层 level,决定绘画在哪层 canvas 中。默认值:0。
  45674. */
  45675. this.zlevel = 0;
  45676. /**
  45677. * @member {boolean} SuperMap.LevelRenderer.Shape.prototype.draggable
  45678. * @description 是否可拖拽。默认值:false。
  45679. */
  45680. this.draggable = false;
  45681. /**
  45682. * @member {boolean} SuperMap.LevelRenderer.Shape.prototype.clickable
  45683. * @description 是否可点击。默认值:false。
  45684. */
  45685. this.clickable = false;
  45686. /**
  45687. * @member {boolean} SuperMap.LevelRenderer.Shape.prototype.hoverable
  45688. * @description 是否可以 hover。默认值:true。
  45689. */
  45690. this.hoverable = true;
  45691. /**
  45692. * @member {number} SuperMap.LevelRenderer.Shape.prototype.z
  45693. * @description z值,跟zlevel一样影响shape绘制的前后顺序,z值大的shape会覆盖在z值小的上面,但是并不会创建新的canvas,所以优先级低于zlevel,而且频繁改动的开销比zlevel小很多。默认值:0。
  45694. */
  45695. this.z = 0;
  45696. //地理扩展
  45697. /**
  45698. * @member {Array} SuperMap.LevelRenderer.Shape.prototype.refOriginalPosition
  45699. * @description 图形参考原点位置,图形的参考中心位置。
  45700. * refOriginalPosition 是长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  45701. *
  45702. * refOriginalPosition 表示图形的参考中心,通常情况下,图形是使用 canvas 的原点位置作为位置参考,
  45703. * 但 refOriginalPosition 可以改变图形的参考位置,例如: refOriginalPosition = [80, 80],
  45704. * 图形圆的 style.x = 20, style.y = 20,那么圆在 canvas 中的实际位置是 [100, 100]。
  45705. *
  45706. * 图形(Shape) 的所有位置相关属性都是以 refOriginalPosition 为参考中心,
  45707. * 也就是说图形的所有位置信息在 canvas 中都是以 refOriginalPosition 为参考的相对位置,只有
  45708. * refOriginalPosition 的值为 [0, 0] 时,形的位置信息才是 canvas 绝对位置。
  45709. *
  45710. * 图形的位置信息通常有:style.pointList,style.x,style.y。
  45711. *
  45712. * refOriginalPosition。默认值是: [0, 0]。
  45713. */
  45714. this.refOriginalPosition = [0, 0];
  45715. /**
  45716. * @member {string} SuperMap.LevelRenderer.Shape.prototype.refDataID
  45717. * @description 图形所关联数据的 ID。
  45718. *
  45719. */
  45720. this.refDataID = null;
  45721. /**
  45722. * @member {boolean} SuperMap.LevelRenderer.Shape.prototype.isHoverByRefDataID
  45723. * @description 是否根据 refDataID 进行高亮。用于同时高亮所有 refDataID 相同的图形。
  45724. *
  45725. */
  45726. this.isHoverByRefDataID = false;
  45727. /**
  45728. * @member {string} SuperMap.LevelRenderer.Shape.prototype.refDataHoverGroup
  45729. * @description 高亮图形组的组名。此属性在 refDataID 有效且 isHoverByRefDataID 为 true 时生效。
  45730. * 一旦设置此属性,且属性值有效,只有关联同一个数据的图形且此属性相同的图形才会高亮。
  45731. *
  45732. */
  45733. this.refDataHoverGroup = null;
  45734. /**
  45735. * @member {Object} SuperMap.LevelRenderer.Shape.prototype.dataInfo
  45736. * @description 图形的数据信息。
  45737. *
  45738. */
  45739. this.dataInfo = null;
  45740. Util.extend(this, options);
  45741. this.id = this.id || Util.createUniqueID("smShape_");
  45742. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape";
  45743. /**
  45744. * @function SuperMap.LevelRenderer.Shape.prototype.getTansform
  45745. * @description 变换鼠标位置到 shape 的局部坐标空间
  45746. *
  45747. */
  45748. this.getTansform = (function () {
  45749. var invTransform = [];
  45750. return function (x, y) {
  45751. var originPos = [x, y];
  45752. // 对鼠标的坐标也做相同的变换
  45753. if (this.needTransform && this.transform) {
  45754. SUtil_SUtil.Util_matrix.invert(invTransform, this.transform);
  45755. SUtil_SUtil.Util_matrix.mulVector(originPos, invTransform, [x, y, 1]);
  45756. if (x == originPos[0] && y == originPos[1]) {
  45757. // 避免外部修改导致的 needTransform 不准确
  45758. this.updateNeedTransform();
  45759. }
  45760. }
  45761. return originPos;
  45762. };
  45763. })();
  45764. }
  45765. /**
  45766. * @function SuperMap.LevelRenderer.Shape.prototype.destroy
  45767. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  45768. */
  45769. destroy() {
  45770. this.id = null;
  45771. this.style = null;
  45772. this.highlightStyle = null;
  45773. this.parent = null;
  45774. this.__dirty = null;
  45775. this.__clipShapes = null;
  45776. this.invisible = null;
  45777. this.ignore = null;
  45778. this.zlevel = null;
  45779. this.draggable = null;
  45780. this.clickable = null;
  45781. this.hoverable = null;
  45782. this.z = null;
  45783. this.refOriginalPosition = null;
  45784. this.refDataID = null;
  45785. this.refDataHoverGroup = null;
  45786. this.isHoverByRefDataID = null;
  45787. this.dataInfo = null;
  45788. super.destroy();
  45789. }
  45790. /**
  45791. * @function SuperMap.LevelRenderer.Shape.prototype.brush
  45792. * @description 绘制图形。
  45793. *
  45794. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  45795. * @param {boolean} isHighlight - 是否使用高亮属性。
  45796. * @param {Function} updateCallback - 需要异步加载资源的 shape 可以通过这个 callback(e),让painter更新视图,base.brush 没用,需要的话重载 brush。
  45797. */
  45798. brush(ctx, isHighlight) {
  45799. var style = this.beforeBrush(ctx, isHighlight);
  45800. ctx.beginPath();
  45801. this.buildPath(ctx, style);
  45802. switch (style.brushType) {
  45803. /* jshint ignore:start */
  45804. case 'both':
  45805. this.setCtxGlobalAlpha(ctx, "fill", style);
  45806. ctx.fill();
  45807. if (style.lineWidth > 0) {
  45808. this.setCtxGlobalAlpha(ctx, "stroke", style);
  45809. ctx.stroke();
  45810. }
  45811. this.setCtxGlobalAlpha(ctx, "reset", style);
  45812. break;
  45813. case 'stroke':
  45814. this.setCtxGlobalAlpha(ctx, "stroke", style);
  45815. style.lineWidth > 0 && ctx.stroke();
  45816. this.setCtxGlobalAlpha(ctx, "reset", style);
  45817. break;
  45818. /* jshint ignore:end */
  45819. default:
  45820. this.setCtxGlobalAlpha(ctx, "fill", style);
  45821. ctx.fill();
  45822. this.setCtxGlobalAlpha(ctx, "reset", style);
  45823. break;
  45824. }
  45825. this.drawText(ctx, style, this.style);
  45826. this.afterBrush(ctx);
  45827. }
  45828. /**
  45829. * @function SuperMap.LevelRenderer.Shape.prototype.beforeBrush
  45830. * @description 具体绘制操作前的一些公共操作。
  45831. *
  45832. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  45833. * @param {boolean} isHighlight - 是否使用高亮属性。
  45834. * @return {Object} 处理后的样式。
  45835. */
  45836. beforeBrush(ctx, isHighlight) {
  45837. var style = this.style;
  45838. if (this.brushTypeOnly) {
  45839. style.brushType = this.brushTypeOnly;
  45840. }
  45841. if (isHighlight) {
  45842. // 根据style扩展默认高亮样式
  45843. style = this.getHighlightStyle(
  45844. style,
  45845. this.highlightStyle || {},
  45846. this.brushTypeOnly
  45847. );
  45848. }
  45849. if (this.brushTypeOnly == 'stroke') {
  45850. style.strokeColor = style.strokeColor || style.color;
  45851. }
  45852. ctx.save();
  45853. this.doClip(ctx);
  45854. this.setContext(ctx, style);
  45855. // 设置transform
  45856. this.setTransform(ctx);
  45857. return style;
  45858. }
  45859. /**
  45860. * @function SuperMap.LevelRenderer.Shape.prototype.afterBrush
  45861. * @description 绘制后的处理。
  45862. *
  45863. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  45864. *
  45865. */
  45866. afterBrush(ctx) {
  45867. ctx.restore();
  45868. }
  45869. /**
  45870. * @function SuperMap.LevelRenderer.Shape.prototype.setContext
  45871. * @description 设置 fillStyle, strokeStyle, shadow 等通用绘制样式。
  45872. *
  45873. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  45874. * @param {Object} style - 样式。
  45875. *
  45876. */
  45877. setContext(ctx, style) {
  45878. var STYLE_CTX_MAP = [
  45879. ['color', 'fillStyle'],
  45880. ['strokeColor', 'strokeStyle'],
  45881. ['opacity', 'globalAlpha'],
  45882. ['lineCap', 'lineCap'],
  45883. ['lineJoin', 'lineJoin'],
  45884. ['miterLimit', 'miterLimit'],
  45885. ['lineWidth', 'lineWidth'],
  45886. ['shadowBlur', 'shadowBlur'],
  45887. ['shadowColor', 'shadowColor'],
  45888. ['shadowOffsetX', 'shadowOffsetX'],
  45889. ['shadowOffsetY', 'shadowOffsetY']
  45890. ];
  45891. for (var i = 0, len = STYLE_CTX_MAP.length; i < len; i++) {
  45892. var styleProp = STYLE_CTX_MAP[i][0];
  45893. var styleValue = style[styleProp];
  45894. var ctxProp = STYLE_CTX_MAP[i][1];
  45895. if (typeof styleValue != 'undefined') {
  45896. ctx[ctxProp] = styleValue;
  45897. }
  45898. }
  45899. }
  45900. /**
  45901. * @function SuperMap.LevelRenderer.Shape.prototype.doClip
  45902. *
  45903. */
  45904. doClip(ctx) {
  45905. var clipShapeInvTransform = SUtil_SUtil.Util_matrix.create();
  45906. if (this.__clipShapes) {
  45907. for (var i = 0; i < this.__clipShapes.length; i++) {
  45908. var clipShape = this.__clipShapes[i];
  45909. if (clipShape.needTransform) {
  45910. let m = clipShape.transform;
  45911. SUtil_SUtil.Util_matrix.invert(clipShapeInvTransform, m);
  45912. ctx.transform(
  45913. m[0], m[1],
  45914. m[2], m[3],
  45915. m[4], m[5]
  45916. );
  45917. }
  45918. ctx.beginPath();
  45919. clipShape.buildPath(ctx, clipShape.style);
  45920. ctx.clip();
  45921. // Transform back
  45922. if (clipShape.needTransform) {
  45923. let m = clipShapeInvTransform;
  45924. ctx.transform(
  45925. m[0], m[1],
  45926. m[2], m[3],
  45927. m[4], m[5]
  45928. );
  45929. }
  45930. }
  45931. }
  45932. }
  45933. /**
  45934. * @function SuperMap.LevelRenderer.Shape.prototype.getHighlightStyle
  45935. * @description 根据默认样式扩展高亮样式
  45936. *
  45937. * @param {Object} style - 样式。
  45938. * @param {Object} highlightStyle - 高亮样式。
  45939. * @param {string} brushTypeOnly - brushTypeOnly。
  45940. *
  45941. */
  45942. getHighlightStyle(style, highlightStyle, brushTypeOnly) {
  45943. var newStyle = {};
  45944. for (let k in style) {
  45945. newStyle[k] = style[k];
  45946. }
  45947. var highlightColor = SUtil_SUtil.Util_color.getHighlightColor();
  45948. // 根据highlightStyle扩展
  45949. if (style.brushType != 'stroke') {
  45950. // 带填充则用高亮色加粗边线
  45951. newStyle.strokeColor = highlightColor;
  45952. // SMIC-方法修改 - start
  45953. newStyle.lineWidth = (style.lineWidth || 1);
  45954. // 原始代码
  45955. // newStyle.lineWidth = (style.lineWidth || 1)
  45956. // + this.getHighlightZoom();
  45957. // 修改代码1
  45958. // if(!style.lineType || style.lineType === "solid"){
  45959. // newStyle.lineWidth = (style.lineWidth || 1)
  45960. // + this.getHighlightZoom();
  45961. // }
  45962. // else{
  45963. // newStyle.lineWidth = (style.lineWidth || 1);
  45964. // }
  45965. // SMIC-方法修改 - end
  45966. newStyle.brushType = 'both';
  45967. } else {
  45968. if (brushTypeOnly != 'stroke') {
  45969. // 描边型的则用原色加工高亮
  45970. newStyle.strokeColor = highlightColor;
  45971. // SMIC-方法修改 - start
  45972. newStyle.lineWidth = (style.lineWidth || 1);
  45973. // 原始代码
  45974. // newStyle.lineWidth = (style.lineWidth || 1)
  45975. // + this.getHighlightZoom();
  45976. // 修改代码1
  45977. // if(!style.lineType || style.lineType === "solid"){
  45978. // newStyle.lineWidth = (style.lineWidth || 1)
  45979. // + this.getHighlightZoom();
  45980. // }
  45981. // else{
  45982. // newStyle.lineWidth = (style.lineWidth || 1);
  45983. // }
  45984. // SMIC-方法修改 - end
  45985. } else {
  45986. // 线型的则用原色加工高亮
  45987. newStyle.strokeColor = highlightStyle.strokeColor
  45988. || SUtil_SUtil.Util_color.mix(
  45989. style.strokeColor,
  45990. SUtil_SUtil.Util_color.toRGB(highlightColor)
  45991. );
  45992. }
  45993. }
  45994. // 可自定义覆盖默认值
  45995. for (let k in highlightStyle) {
  45996. if (typeof highlightStyle[k] != 'undefined') {
  45997. newStyle[k] = highlightStyle[k];
  45998. }
  45999. }
  46000. return newStyle;
  46001. }
  46002. /**
  46003. * @function SuperMap.LevelRenderer.Shape.prototype.getHighlightZoom
  46004. * @description 高亮放大效果参数,当前统一设置为6,如有需要差异设置,通过 this.type 判断实例类型
  46005. *
  46006. */
  46007. getHighlightZoom() {
  46008. return this.type != 'text' ? 6 : 2;
  46009. }
  46010. /**
  46011. * @function SuperMap.LevelRenderer.Shape.prototype.drift
  46012. * @description 移动位置
  46013. *
  46014. * @param {Object} dx - 横坐标变化。
  46015. * @param {Object} dy - 纵坐标变化。
  46016. *
  46017. */
  46018. drift(dx, dy) {
  46019. this.position[0] += dx;
  46020. this.position[1] += dy;
  46021. }
  46022. /**
  46023. * @function SuperMap.LevelRenderer.Shape.prototype.buildPath
  46024. * @description 构建绘制的Path。子类必须重新实现此方法。
  46025. *
  46026. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  46027. * @param {Object} style - 样式。
  46028. */
  46029. buildPath(ctx, style) { // eslint-disable-line no-unused-vars
  46030. SUtil_SUtil.Util_log('buildPath not implemented in ' + this.type);
  46031. }
  46032. /**
  46033. * @function SuperMap.LevelRenderer.Shape.prototype.getRect
  46034. * @description 计算返回包围盒矩形。子类必须重新实现此方法。
  46035. *
  46036. * @param {Object} style - 样式。
  46037. */
  46038. getRect(style) { // eslint-disable-line no-unused-vars
  46039. SUtil_SUtil.Util_log('getRect not implemented in ' + this.type);
  46040. }
  46041. /**
  46042. * @function SuperMap.LevelRenderer.Shape.prototype.isCover
  46043. * @description 判断鼠标位置是否在图形内。
  46044. *
  46045. * @param {number} x - x。
  46046. * @param {number} y - y。
  46047. */
  46048. isCover(x, y) {
  46049. var originPos = this.getTansform(x, y);
  46050. x = originPos[0];
  46051. y = originPos[1];
  46052. // 快速预判并保留判断矩形
  46053. var rect = this.style.__rect;
  46054. if (!rect) {
  46055. rect = this.style.__rect = this.getRect(this.style);
  46056. }
  46057. if (x >= rect.x
  46058. && x <= (rect.x + rect.width)
  46059. && y >= rect.y
  46060. && y <= (rect.y + rect.height)
  46061. ) {
  46062. // 矩形内
  46063. return SUtil_SUtil.Util_area.isInside(this, this.style, x, y);
  46064. }
  46065. return false;
  46066. }
  46067. /**
  46068. * @function SuperMap.LevelRenderer.Shape.prototype.drawText
  46069. * @description 绘制附加文本。
  46070. *
  46071. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  46072. * @param {string} style - 样式。
  46073. * @param {string} normalStyle - normalStyle 默认样式,用于定位文字显示。
  46074. */
  46075. drawText(ctx, style, normalStyle) {
  46076. if (typeof(style.text) == 'undefined' || style.text === false) {
  46077. return;
  46078. }
  46079. // 字体颜色策略
  46080. var textColor = style.textColor || style.color || style.strokeColor;
  46081. ctx.fillStyle = textColor;
  46082. // 文本与图形间空白间隙
  46083. var dd = 10;
  46084. var al; // 文本水平对齐
  46085. var bl; // 文本垂直对齐
  46086. var tx; // 文本横坐标
  46087. var ty; // 文本纵坐标
  46088. var textPosition = style.textPosition // 用户定义
  46089. || this.textPosition // shape默认
  46090. || 'top'; // 全局默认
  46091. // Smic 方法修改 -start
  46092. var __OP = [];
  46093. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46094. __OP = [0, 0];
  46095. } else {
  46096. __OP = this.refOriginalPosition;
  46097. }
  46098. //原代码:
  46099. // Smic 方法修改 -end
  46100. switch (textPosition) {
  46101. case 'inside':
  46102. case 'top':
  46103. case 'bottom':
  46104. case 'left':
  46105. case 'right':
  46106. if (this.getRect) {
  46107. var rect = (normalStyle || style).__rect
  46108. || this.getRect(normalStyle || style);
  46109. switch (textPosition) {
  46110. case 'inside':
  46111. tx = rect.x + rect.width / 2;
  46112. ty = rect.y + rect.height / 2;
  46113. al = 'center';
  46114. bl = 'middle';
  46115. if (style.brushType != 'stroke'
  46116. && textColor == style.color
  46117. ) {
  46118. ctx.fillStyle = '#fff';
  46119. }
  46120. break;
  46121. case 'left':
  46122. tx = rect.x - dd;
  46123. ty = rect.y + rect.height / 2;
  46124. al = 'end';
  46125. bl = 'middle';
  46126. break;
  46127. case 'right':
  46128. tx = rect.x + rect.width + dd;
  46129. ty = rect.y + rect.height / 2;
  46130. al = 'start';
  46131. bl = 'middle';
  46132. break;
  46133. case 'top':
  46134. tx = rect.x + rect.width / 2;
  46135. ty = rect.y - dd;
  46136. al = 'center';
  46137. bl = 'bottom';
  46138. break;
  46139. case 'bottom':
  46140. tx = rect.x + rect.width / 2;
  46141. ty = rect.y + rect.height + dd;
  46142. al = 'center';
  46143. bl = 'top';
  46144. break;
  46145. }
  46146. }
  46147. break;
  46148. case 'start':
  46149. case 'end':
  46150. var xStart = 0;
  46151. var xEnd = 0;
  46152. var yStart = 0;
  46153. var yEnd = 0;
  46154. if (typeof style.pointList != 'undefined') {
  46155. var pointList = style.pointList;
  46156. if (pointList.length < 2) {
  46157. // 少于2个点就不画了~
  46158. return;
  46159. }
  46160. var length = pointList.length;
  46161. switch (textPosition) {
  46162. // Smic 方法修改 -start
  46163. case 'start':
  46164. xStart = pointList[0][0] + __OP[0];
  46165. xEnd = pointList[1][0] + __OP[0];
  46166. yStart = pointList[0][1] + __OP[1];
  46167. yEnd = pointList[1][1] + __OP[1];
  46168. break;
  46169. case 'end':
  46170. xStart = pointList[length - 2][0] + __OP[0];
  46171. xEnd = pointList[length - 1][0] + __OP[0];
  46172. yStart = pointList[length - 2][1] + __OP[1];
  46173. yEnd = pointList[length - 1][1] + __OP[1];
  46174. break;
  46175. //原代码:
  46176. /*
  46177. case 'start':
  46178. xStart = pointList[0][0];
  46179. xEnd = pointList[1][0];
  46180. yStart = pointList[0][1];
  46181. yEnd = pointList[1][1];
  46182. break;
  46183. case 'end':
  46184. xStart = pointList[length - 2][0];
  46185. xEnd = pointList[length - 1][0];
  46186. yStart = pointList[length - 2][1];
  46187. yEnd = pointList[length - 1][1];
  46188. break;
  46189. */
  46190. // Smic 方法修改 -end
  46191. }
  46192. } else {
  46193. // Smic 方法修改 -start
  46194. xStart = (style.xStart + __OP[0]) || 0;
  46195. xEnd = (style.xEnd + __OP[0]) || 0;
  46196. yStart = (style.yStart + __OP[1]) || 0;
  46197. yEnd = (style.yEnd + __OP[1]) || 0;
  46198. //原代码:
  46199. /*
  46200. xStart = style.xStart || 0;
  46201. xEnd = style.xEnd || 0;
  46202. yStart = style.yStart || 0;
  46203. yEnd = style.yEnd || 0;
  46204. */
  46205. // Smic 方法修改 -end
  46206. }
  46207. switch (textPosition) {
  46208. case 'start':
  46209. al = xStart < xEnd ? 'end' : 'start';
  46210. bl = yStart < yEnd ? 'bottom' : 'top';
  46211. tx = xStart;
  46212. ty = yStart;
  46213. break;
  46214. case 'end':
  46215. al = xStart < xEnd ? 'start' : 'end';
  46216. bl = yStart < yEnd ? 'top' : 'bottom';
  46217. tx = xEnd;
  46218. ty = yEnd;
  46219. break;
  46220. }
  46221. dd -= 4;
  46222. if (xStart && xEnd && xStart != xEnd) {
  46223. tx -= (al == 'end' ? dd : -dd);
  46224. } else {
  46225. al = 'center';
  46226. }
  46227. if (yStart != yEnd) {
  46228. ty -= (bl == 'bottom' ? dd : -dd);
  46229. } else {
  46230. bl = 'middle';
  46231. }
  46232. break;
  46233. case 'specific':
  46234. tx = style.textX || 0;
  46235. ty = style.textY || 0;
  46236. al = 'start';
  46237. bl = 'middle';
  46238. break;
  46239. }
  46240. // Smic 方法修改 -start
  46241. if (style.labelXOffset && !isNaN(style.labelXOffset)) {
  46242. tx += style.labelXOffset;
  46243. }
  46244. if (style.labelYOffset && !isNaN(style.labelYOffset)) {
  46245. ty += style.labelYOffset;
  46246. }
  46247. //原代码:
  46248. // Smic 方法修改 -end
  46249. if (tx != null && ty != null) {
  46250. Shape_Shape._fillText(
  46251. ctx,
  46252. style.text,
  46253. tx, ty,
  46254. style.textFont,
  46255. style.textAlign || al,
  46256. style.textBaseline || bl
  46257. );
  46258. }
  46259. }
  46260. /**
  46261. * @function SuperMap.LevelRenderer.Shape.prototype.modSelf
  46262. * @description 图形发生改变
  46263. */
  46264. modSelf() {
  46265. this.__dirty = true;
  46266. if (this.style) {
  46267. this.style.__rect = null;
  46268. }
  46269. if (this.highlightStyle) {
  46270. this.highlightStyle.__rect = null;
  46271. }
  46272. }
  46273. /**
  46274. * @function SuperMap.LevelRenderer.Shape.prototype.isSilent
  46275. * @description 图形是否会触发事件,通过 bind 绑定的事件
  46276. */
  46277. isSilent() {
  46278. return !(
  46279. this.hoverable || this.draggable || this.clickable
  46280. || this.onmousemove || this.onmouseover || this.onmouseout
  46281. || this.onmousedown || this.onmouseup || this.onclick
  46282. || this.ondragenter || this.ondragover || this.ondragleave
  46283. || this.ondrop
  46284. );
  46285. }
  46286. /**
  46287. * @function SuperMap.LevelRenderer.Shape.prototype.setCtxGlobalAlpha
  46288. * @description 设置 Cavans 上下文全局透明度
  46289. *
  46290. * @param {Object} _ctx - Cavans 上下文
  46291. * @param {string} type - one of 'stroke', 'fill', or 'reset'
  46292. * @param {Object} style - Symbolizer hash
  46293. */
  46294. setCtxGlobalAlpha(_ctx, type, style) {
  46295. if (type === "fill") {
  46296. _ctx.globalAlpha = typeof(style["fillOpacity"]) === "undefined" ? (typeof(style["opacity"]) === "undefined" ? 1 : style['opacity']) : style['fillOpacity'];
  46297. } else if (type === "stroke") {
  46298. _ctx.globalAlpha = typeof(style["strokeOpacity"]) === "undefined" ? (typeof(style["opacity"]) === "undefined" ? 1 : style['opacity']) : style['strokeOpacity'];
  46299. } else {
  46300. _ctx.globalAlpha = typeof(style["opacity"]) === "undefined" ? 1 : style['opacity'];
  46301. }
  46302. }
  46303. /**
  46304. * @function SuperMap.LevelRenderer.Shape.prototype._fillText
  46305. * @description 填充文本
  46306. */
  46307. static _fillText(ctx, text, x, y, textFont, textAlign, textBaseline) {
  46308. if (textFont) {
  46309. ctx.font = textFont;
  46310. }
  46311. ctx.textAlign = textAlign;
  46312. ctx.textBaseline = textBaseline;
  46313. var rect = Shape_Shape._getTextRect(
  46314. text, x, y, textFont, textAlign, textBaseline
  46315. );
  46316. text = (text + '').split('\n');
  46317. var lineHeight = SUtil_SUtil.Util_area.getTextHeight('ZH', textFont);
  46318. switch (textBaseline) {
  46319. case 'top':
  46320. y = rect.y;
  46321. break;
  46322. case 'bottom':
  46323. y = rect.y + lineHeight;
  46324. break;
  46325. default:
  46326. y = rect.y + lineHeight / 2;
  46327. }
  46328. for (var i = 0, l = text.length; i < l; i++) {
  46329. ctx.fillText(text[i], x, y);
  46330. y += lineHeight;
  46331. }
  46332. }
  46333. /**
  46334. * @function SuperMap.LevelRenderer.Shape._getTextRect
  46335. * @description 返回矩形区域,用于局部刷新和文字定位
  46336. *
  46337. * @param {string} text - text。
  46338. * @param {number} x - x。
  46339. * @param {number} y - y。
  46340. * @param {string} textFont - textFont。
  46341. * @param {string} textAlign - textAlign。
  46342. * @param {string} textBaseline - textBaseline。
  46343. * @return {Object} 矩形区域。
  46344. */
  46345. static _getTextRect(text, x, y, textFont, textAlign, textBaseline) {
  46346. var width = SUtil_SUtil.Util_area.getTextWidth(text, textFont);
  46347. var lineHeight = SUtil_SUtil.Util_area.getTextHeight('ZH', textFont);
  46348. text = (text + '').split('\n');
  46349. switch (textAlign) {
  46350. case 'end':
  46351. case 'right':
  46352. x -= width;
  46353. break;
  46354. case 'center':
  46355. x -= (width / 2);
  46356. break;
  46357. }
  46358. switch (textBaseline) {
  46359. case 'top':
  46360. break;
  46361. case 'bottom':
  46362. y -= lineHeight * text.length;
  46363. break;
  46364. default:
  46365. y -= lineHeight * text.length / 2;
  46366. }
  46367. return {
  46368. x: x,
  46369. y: y,
  46370. width: width,
  46371. height: lineHeight * text.length
  46372. };
  46373. }
  46374. }
  46375. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicPoint.js
  46376. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  46377. * This program are made available under the terms of the Apache License, Version 2.0
  46378. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46379. /**
  46380. * @private
  46381. * @class SuperMap.LevelRenderer.Shape.SmicPoint
  46382. * @category Visualization Theme
  46383. * @classdesc 点。
  46384. * @extends SuperMap.LevelRenderer.Shape
  46385. * @example
  46386. * var shape = new SuperMap.LevelRenderer.Shape.SmicPoint({
  46387. * style: {
  46388. * x: 100,
  46389. * y: 100,
  46390. * r: 40,
  46391. * brushType: 'both',
  46392. * color: 'blue',
  46393. * strokeColor: 'red',
  46394. * lineWidth: 3,
  46395. * text: 'point'
  46396. * }
  46397. * });
  46398. * levelRenderer.addShape(shape);
  46399. *
  46400. *
  46401. */
  46402. class SmicPoint extends Shape_Shape {
  46403. /**
  46404. * @member {Object} SuperMap.LevelRenderer.Shape.SmicPoint.prototype.style
  46405. * @description 绘制样式。
  46406. *
  46407. * @param {number} style.x - 圆心x坐标,必设参数。
  46408. * @param {number} style.y - 圆心y坐标,必设参数。
  46409. * @param {number} style.r - 半径,必设参数。
  46410. * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  46411. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  46412. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  46413. * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  46414. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  46415. * @param {number} style.opacity - 绘制透明度。默认值:1。
  46416. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  46417. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  46418. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  46419. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  46420. * @param {string} style.text - 图形中的附加文本。默认值:""。
  46421. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  46422. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  46423. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  46424. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  46425. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  46426. */
  46427. //打开接口 style
  46428. /**
  46429. * @function SuperMap.LevelRenderer.Shape.SmicPoint.constructor
  46430. * @description 构造函数。
  46431. *
  46432. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  46433. *
  46434. */
  46435. constructor(options) {
  46436. super(options);
  46437. /**
  46438. * @member {string} SuperMap.LevelRenderer.Shape.SmicPoint.prototype.type
  46439. * @description 图形类型。
  46440. */
  46441. this.type = 'smicpoint';
  46442. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46443. this.refOriginalPosition = [0, 0];
  46444. }
  46445. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicPoint";
  46446. }
  46447. /**
  46448. * @function cdestroy
  46449. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  46450. */
  46451. destroy() {
  46452. this.type = null;
  46453. super.destroy();
  46454. }
  46455. /**
  46456. * @function SuperMap.LevelRenderer.Shape.SmicPoint.prototype.buildPath
  46457. * @description 创建点触。
  46458. *
  46459. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  46460. * @param {Object} style - style。
  46461. *
  46462. */
  46463. buildPath(ctx, style) {
  46464. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46465. this.refOriginalPosition = [0, 0];
  46466. }
  46467. var __OP = this.refOriginalPosition;
  46468. ctx.arc(style.x + __OP[0], style.y + __OP[1], style.r, 0, Math.PI * 2, true);
  46469. return;
  46470. }
  46471. /**
  46472. * @function SuperMap.LevelRenderer.Shape.SmicPoint.prototype.getRect
  46473. * @description 计算返回点的包围盒矩形。该包围盒是直接从四个控制点计算,并非最小包围盒。
  46474. *
  46475. * @param {Object} style - style
  46476. * @return {Object} 边框对象。包含属性:x,y,width,height。
  46477. */
  46478. getRect(style) {
  46479. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46480. this.refOriginalPosition = [0, 0];
  46481. }
  46482. var __OP = this.refOriginalPosition;
  46483. if (style.__rect) {
  46484. return style.__rect;
  46485. }
  46486. var lineWidth;
  46487. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  46488. lineWidth = style.lineWidth || 1;
  46489. } else {
  46490. lineWidth = 0;
  46491. }
  46492. style.__rect = {
  46493. x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
  46494. y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
  46495. width: style.r * 2 + lineWidth,
  46496. height: style.r * 2 + lineWidth
  46497. };
  46498. return style.__rect;
  46499. }
  46500. }
  46501. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicText.js
  46502. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  46503. * This program are made available under the terms of the Apache License, Version 2.0
  46504. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46505. /**
  46506. * @private
  46507. * @class SuperMap.LevelRenderer.Shape.SmicText
  46508. * @category Visualization Theme
  46509. * @extends {SuperMap.LevelRenderer.Shape}
  46510. * @example
  46511. * var shape = new SuperMap.LevelRenderer.Shape.SmicText({
  46512. * style: {
  46513. * text: 'Label',
  46514. * x: 100,
  46515. * y: 100,
  46516. * textFont: '14px Arial'
  46517. * }
  46518. * });
  46519. * levelRenderer.addShape(shape);
  46520. *
  46521. */
  46522. class SmicText extends Shape_Shape {
  46523. /**
  46524. * @member {Object} SuperMap.LevelRenderer.Shape.SmicText.prototype.style
  46525. * @description 绘制样式。
  46526. *
  46527. * @param {number} style.x - 横坐标,必设参数。
  46528. * @param {number} style.y - 纵坐标,必设参数。
  46529. * @param {string} style.text - 图形中的附加文本。默认值:""。
  46530. * @param {number} style.maxWidth - 最大宽度限制。默认值:null。
  46531. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  46532. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  46533. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  46534. * @param {string} style.brushType -画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  46535. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  46536. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  46537. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  46538. * @param {number} style.opacity - 绘制透明度。默认值:1。
  46539. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  46540. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  46541. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  46542. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  46543. */
  46544. //打开接口 style
  46545. /**
  46546. * @function SuperMap.LevelRenderer.Shape.SmicText.constructor
  46547. * @description 构造函数。
  46548. *
  46549. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  46550. *
  46551. */
  46552. constructor(options) {
  46553. super(options);
  46554. /**
  46555. * @member {string} SuperMap.LevelRenderer.Shape.SmicText.prototype.type
  46556. * @description 图形类型.
  46557. */
  46558. this.type = 'smictext';
  46559. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46560. this.refOriginalPosition = [0, 0];
  46561. }
  46562. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicText";
  46563. }
  46564. /**
  46565. * @function SuperMap.LevelRenderer.Shape.SmicText.prototype.destroy
  46566. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  46567. */
  46568. destroy() {
  46569. this.type = null;
  46570. super.destroy();
  46571. }
  46572. /**
  46573. * @function SuperMap.LevelRenderer.Shape.SmicText.prototype.brush
  46574. * @description 笔触。
  46575. *
  46576. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  46577. * @param {boolean} isHighlight - 是否使用高亮属性。
  46578. *
  46579. */
  46580. brush(ctx, isHighlight) {
  46581. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46582. this.refOriginalPosition = [0, 0];
  46583. }
  46584. var __OP = this.refOriginalPosition;
  46585. var style = this.style;
  46586. if (isHighlight) {
  46587. // 根据style扩展默认高亮样式
  46588. style = this.getHighlightStyle(
  46589. style, this.highlightStyle || {}
  46590. );
  46591. }
  46592. if (typeof(style.text) == 'undefined' || style.text === false) {
  46593. return;
  46594. }
  46595. ctx.save();
  46596. this.doClip(ctx);
  46597. this.setContext(ctx, style);
  46598. // 设置transform
  46599. this.setTransform(ctx);
  46600. if (style.textFont) {
  46601. ctx.font = style.textFont;
  46602. }
  46603. ctx.textAlign = style.textAlign || 'start';
  46604. ctx.textBaseline = style.textBaseline || 'middle';
  46605. var text = (style.text + '').split('\n');
  46606. var lineHeight = SUtil_SUtil.Util_area.getTextHeight('ZH', style.textFont);
  46607. var rect = this.getRectNoRotation(style);
  46608. // var x = style.x;
  46609. var x = style.x + __OP[0];
  46610. var y;
  46611. if (style.textBaseline == 'top') {
  46612. y = rect.y;
  46613. } else if (style.textBaseline == 'bottom') {
  46614. y = rect.y + lineHeight;
  46615. } else {
  46616. y = rect.y + lineHeight / 2;
  46617. }
  46618. var ox = style.x + __OP[0];
  46619. var oy = style.y + __OP[1];
  46620. //文本绘制
  46621. for (var i = 0, l = text.length; i < l; i++) {
  46622. //是否渲染矩形背景及颜色
  46623. if (style.labelRect) {
  46624. //+4,-2是为了让文字距边框左右边缘有点间隔
  46625. ctx.fillRect(rect.x - 2, rect.y, rect.width + 4, rect.height);
  46626. ctx.fillStyle = style.strokeColor;
  46627. ctx.strokeRect(rect.x - 2, rect.y, rect.width + 4, rect.height);
  46628. ctx.fillStyle = style.textColor;
  46629. }
  46630. switch (style.brushType) {
  46631. case 'stroke':
  46632. this.setCtxGlobalAlpha(ctx, "stroke", style);
  46633. if (style.textRotation && style.textRotation !== 0) {
  46634. ctx.save();
  46635. ctx.translate(ox, oy);
  46636. ctx.rotate(style.textRotation * Math.PI / 180);
  46637. if (style.textBaseline == 'top') {
  46638. if (style.maxWidth) {
  46639. ctx.strokeText(text[i], 0, lineHeight * i, style.maxWidth);
  46640. } else {
  46641. ctx.strokeText(text[i], 0, lineHeight * i);
  46642. }
  46643. } else if (style.textBaseline == 'bottom') {
  46644. if (style.maxWidth) {
  46645. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
  46646. } else {
  46647. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height);
  46648. }
  46649. } else {
  46650. if (style.maxWidth) {
  46651. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
  46652. } else {
  46653. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
  46654. }
  46655. }
  46656. ctx.restore();
  46657. } else {
  46658. if (style.maxWidth) {
  46659. ctx.strokeText(text[i], x, y, style.maxWidth);
  46660. } else {
  46661. ctx.strokeText(text[i], x, y);
  46662. }
  46663. }
  46664. this.setCtxGlobalAlpha(ctx, "reset", style);
  46665. break;
  46666. case 'both':
  46667. if (style.textRotation && style.textRotation !== 0) {
  46668. ctx.save();
  46669. ctx.translate(ox, oy);
  46670. ctx.rotate(style.textRotation * Math.PI / 180);
  46671. if (style.textBaseline == 'top') {
  46672. if (style.maxWidth) {
  46673. this.setCtxGlobalAlpha(ctx, "fill", style);
  46674. ctx.fillText(text[i], 0, lineHeight * i, style.maxWidth);
  46675. this.setCtxGlobalAlpha(ctx, "reset", style);
  46676. this.setCtxGlobalAlpha(ctx, "stroke", style);
  46677. ctx.strokeText(text[i], 0, lineHeight * i, style.maxWidth);
  46678. this.setCtxGlobalAlpha(ctx, "reset", style);
  46679. } else {
  46680. this.setCtxGlobalAlpha(ctx, "fill", style);
  46681. ctx.fillText(text[i], 0, lineHeight * i);
  46682. this.setCtxGlobalAlpha(ctx, "reset", style);
  46683. this.setCtxGlobalAlpha(ctx, "stroke", style);
  46684. ctx.strokeText(text[i], 0, lineHeight * i);
  46685. this.setCtxGlobalAlpha(ctx, "reset", style);
  46686. }
  46687. } else if (style.textBaseline == 'bottom') {
  46688. if (style.maxWidth) {
  46689. this.setCtxGlobalAlpha(ctx, "fill", style);
  46690. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
  46691. this.setCtxGlobalAlpha(ctx, "reset", style);
  46692. this.setCtxGlobalAlpha(ctx, "stroke", style);
  46693. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
  46694. this.setCtxGlobalAlpha(ctx, "reset", style);
  46695. } else {
  46696. this.setCtxGlobalAlpha(ctx, "fill", style);
  46697. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height);
  46698. this.setCtxGlobalAlpha(ctx, "reset", style);
  46699. this.setCtxGlobalAlpha(ctx, "stroke", style);
  46700. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height);
  46701. this.setCtxGlobalAlpha(ctx, "reset", style);
  46702. }
  46703. } else {
  46704. if (style.maxWidth) {
  46705. this.setCtxGlobalAlpha(ctx, "fill", style);
  46706. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
  46707. this.setCtxGlobalAlpha(ctx, "reset", style);
  46708. this.setCtxGlobalAlpha(ctx, "stroke", style);
  46709. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
  46710. this.setCtxGlobalAlpha(ctx, "reset", style);
  46711. } else {
  46712. this.setCtxGlobalAlpha(ctx, "fill", style);
  46713. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
  46714. this.setCtxGlobalAlpha(ctx, "reset", style);
  46715. this.setCtxGlobalAlpha(ctx, "stroke", style);
  46716. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
  46717. this.setCtxGlobalAlpha(ctx, "reset", style);
  46718. }
  46719. }
  46720. ctx.restore();
  46721. } else {
  46722. if (style.maxWidth) {
  46723. this.setCtxGlobalAlpha(ctx, "fill", style);
  46724. ctx.fillText(text[i], x, y, style.maxWidth);
  46725. this.setCtxGlobalAlpha(ctx, "reset", style);
  46726. this.setCtxGlobalAlpha(ctx, "stroke", style);
  46727. ctx.strokeText(text[i], x, y, style.maxWidth);
  46728. this.setCtxGlobalAlpha(ctx, "reset", style);
  46729. } else {
  46730. this.setCtxGlobalAlpha(ctx, "fill", style);
  46731. ctx.fillText(text[i], x, y);
  46732. this.setCtxGlobalAlpha(ctx, "reset", style);
  46733. this.setCtxGlobalAlpha(ctx, "stroke", style);
  46734. ctx.strokeText(text[i], x, y);
  46735. this.setCtxGlobalAlpha(ctx, "reset", style);
  46736. }
  46737. }
  46738. break;
  46739. default:
  46740. //fill or others
  46741. this.setCtxGlobalAlpha(ctx, "fill", style);
  46742. if (style.textRotation && style.textRotation !== 0) {
  46743. ctx.save();
  46744. ctx.translate(ox, oy);
  46745. ctx.rotate(style.textRotation * Math.PI / 180);
  46746. if (style.textBaseline == 'top') {
  46747. if (style.maxWidth) {
  46748. ctx.fillText(text[i], 0, lineHeight * i, style.maxWidth);
  46749. } else {
  46750. ctx.fillText(text[i], 0, lineHeight * i);
  46751. }
  46752. } else if (style.textBaseline == 'bottom') {
  46753. if (style.maxWidth) {
  46754. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
  46755. } else {
  46756. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height);
  46757. }
  46758. } else {
  46759. if (style.maxWidth) {
  46760. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
  46761. } else {
  46762. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
  46763. }
  46764. }
  46765. ctx.restore();
  46766. } else {
  46767. if (style.maxWidth) {
  46768. ctx.fillText(text[i], x, y, style.maxWidth);
  46769. } else {
  46770. ctx.fillText(text[i], x, y);
  46771. }
  46772. }
  46773. this.setCtxGlobalAlpha(ctx, "reset", style);
  46774. }
  46775. y += lineHeight;
  46776. }
  46777. ctx.restore();
  46778. return;
  46779. }
  46780. /**
  46781. * @function SuperMap.LevelRenderer.Shape.SmicText.prototype.getRect
  46782. * @description 返回文字包围盒矩形
  46783. */
  46784. getRect(style) {
  46785. if (style.__rect) {
  46786. return style.__rect;
  46787. }
  46788. var left, top, right, bottom
  46789. var tbg = this.getTextBackground(style, true);
  46790. for (var i = 0, len = tbg.length; i < len; i++) {
  46791. var poi = tbg[i];
  46792. //用第一个点初始化
  46793. if (i == 0) {
  46794. left = poi[0];
  46795. right = poi[0];
  46796. top = poi[1];
  46797. bottom = poi[1];
  46798. } else {
  46799. if (poi[0] < left) {
  46800. left = poi[0]
  46801. }
  46802. if (poi[0] > right) {
  46803. right = poi[0]
  46804. }
  46805. if (poi[1] < top) {
  46806. top = poi[1]
  46807. }
  46808. if (poi[1] > bottom) {
  46809. bottom = poi[1]
  46810. }
  46811. }
  46812. }
  46813. style.__rect = {
  46814. x: left,
  46815. y: top,
  46816. width: right - left,
  46817. height: bottom - top
  46818. };
  46819. return style.__rect;
  46820. }
  46821. /**
  46822. * @function SuperMap.LevelRenderer.Shape.SmicText.prototype.getRectNoRotation
  46823. * @description 返回忽略旋转和maxWidth时文字包围盒矩形
  46824. */
  46825. getRectNoRotation(style) {
  46826. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46827. this.refOriginalPosition = [0, 0];
  46828. }
  46829. var __OP = this.refOriginalPosition;
  46830. var lineHeight = SUtil_SUtil.Util_area.getTextHeight('ZH', style.textFont);
  46831. var width = SUtil_SUtil.Util_area.getTextWidth(style.text, style.textFont);
  46832. var height = SUtil_SUtil.Util_area.getTextHeight(style.text, style.textFont);
  46833. //处理文字位置,注:文本的绘制是由此 rect 决定
  46834. var textX = style.x + __OP[0]; // 默认start == left
  46835. if (style.textAlign == 'end' || style.textAlign == 'right') {
  46836. textX -= width;
  46837. } else if (style.textAlign == 'center') {
  46838. textX -= (width / 2);
  46839. }
  46840. var textY;
  46841. if (style.textBaseline == 'top') {
  46842. // textY = style.y;
  46843. textY = style.y + __OP[1];
  46844. } else if (style.textBaseline == 'bottom') {
  46845. textY = (style.y + __OP[1]) - height;
  46846. } else {
  46847. // middle
  46848. textY = (style.y + __OP[1]) - height / 2;
  46849. }
  46850. var isWidthChangeByMaxWidth = false;
  46851. var widthBeforeChangeByMaxWidth;
  46852. //处理 maxWidth
  46853. if (style.maxWidth) {
  46854. var maxWidth = parseInt(style.maxWidth);
  46855. if (maxWidth < width) {
  46856. widthBeforeChangeByMaxWidth = width;
  46857. isWidthChangeByMaxWidth = true;
  46858. width = maxWidth;
  46859. }
  46860. textX = style.x + __OP[0];
  46861. if (style.textAlign == 'end' || style.textAlign == 'right') {
  46862. textX -= width;
  46863. } else if (style.textAlign == 'center') {
  46864. textX -= (width / 2);
  46865. }
  46866. }
  46867. //处理斜体字
  46868. if (style.textFont) {
  46869. var textFont = style.textFont;
  46870. var textFontStr = textFont.toLowerCase()
  46871. if (textFontStr.indexOf("italic") > -1) {
  46872. if (isWidthChangeByMaxWidth === true) {
  46873. width += (lineHeight / 3) * (width / widthBeforeChangeByMaxWidth);
  46874. } else {
  46875. width += lineHeight / 3;
  46876. }
  46877. }
  46878. }
  46879. var rect = {
  46880. x: textX,
  46881. y: textY,
  46882. width: width,
  46883. height: height
  46884. };
  46885. return rect;
  46886. }
  46887. /**
  46888. * @function SuperMap.LevelRenderer.Shape.SmicText.prototype.getTextBackground
  46889. * @description 获取文本背景框范围
  46890. *
  46891. * @param {Object} style - 样式。
  46892. * @param {boolean} redo - 是否强制重新计算 textBackground。
  46893. */
  46894. getTextBackground(style, redo) {
  46895. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46896. this.refOriginalPosition = [0, 0];
  46897. }
  46898. var __OP = this.refOriginalPosition;
  46899. if ((!redo) && style.__textBackground) {
  46900. return style.__textBackground;
  46901. }
  46902. //不旋转时矩形框
  46903. var rect = this.getRectNoRotation(style);
  46904. //旋转中心点
  46905. var ox = style.x + __OP[0];
  46906. var oy = style.y + __OP[1];
  46907. //背景框
  46908. var background = [];
  46909. if (style.textRotation && style.textRotation !== 0) {
  46910. let textRotation = style.textRotation;
  46911. let ltPoi = this.getRotatedLocation(rect.x, rect.y, ox, oy, textRotation);
  46912. let rtPoi = this.getRotatedLocation(rect.x + rect.width, rect.y, ox, oy, textRotation);
  46913. let rbPoi = this.getRotatedLocation(rect.x + rect.width, rect.y + rect.height, ox, oy, textRotation);
  46914. let lbPoi = this.getRotatedLocation(rect.x, rect.y + rect.height, ox, oy, textRotation);
  46915. background.push(ltPoi);
  46916. background.push(rtPoi);
  46917. background.push(rbPoi);
  46918. background.push(lbPoi);
  46919. } else {
  46920. let ltPoi = [rect.x, rect.y];
  46921. let rtPoi = [rect.x + rect.width, rect.y];
  46922. let rbPoi = [rect.x + rect.width, rect.y + rect.height];
  46923. let lbPoi = [rect.x, rect.y + rect.height];
  46924. background.push(ltPoi);
  46925. background.push(rtPoi);
  46926. background.push(rbPoi);
  46927. background.push(lbPoi);
  46928. }
  46929. style.__textBackground = background;
  46930. return style.__textBackground;
  46931. }
  46932. /**
  46933. * @function SuperMap.LevelRenderer.Shape.SmicText.prototype.getRotatedLocation
  46934. * @description 获取一个点绕旋转中心顺时针旋转后的位置。(此方法用于屏幕坐标)
  46935. *
  46936. * @param {number} x - 旋转点横坐标。
  46937. * @param {number} y - 旋转点纵坐标。
  46938. * @param {number} rx - 旋转中心点横坐标。
  46939. * @param {number} ry - 旋转中心点纵坐标。
  46940. * @param {number} angle - 旋转角度(度)。
  46941. * @return {Array} 旋转后的坐标位置,长度为 2 的一维数组,数组第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  46942. */
  46943. getRotatedLocation(x, y, rx, ry, angle) {
  46944. var loc = new Array(), x0, y0;
  46945. y = -y;
  46946. ry = -ry;
  46947. angle = -angle;//顺时针旋转
  46948. x0 = (x - rx) * Math.cos((angle / 180) * Math.PI) - (y - ry) * Math.sin((angle / 180) * Math.PI) + rx;
  46949. y0 = (x - rx) * Math.sin((angle / 180) * Math.PI) + (y - ry) * Math.cos((angle / 180) * Math.PI) + ry;
  46950. loc[0] = x0;
  46951. loc[1] = -y0;
  46952. return loc;
  46953. }
  46954. }
  46955. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicCircle.js
  46956. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  46957. * This program are made available under the terms of the Apache License, Version 2.0
  46958. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46959. /**
  46960. * @private
  46961. * @class SuperMap.LevelRenderer.Shape.SmicCircle
  46962. * @category Visualization Theme
  46963. * @classdesc 圆形
  46964. * @extends SuperMap.LevelRenderer.Shape
  46965. * @example
  46966. * var shape = new SuperMap.LevelRenderer.Shape.SmicCircle({
  46967. * style: {
  46968. * x: 100,
  46969. * y: 100,
  46970. * r: 60,
  46971. * brushType: "both",
  46972. * color: "blue",
  46973. * strokeColor: "red",
  46974. * lineWidth: 3,
  46975. * text: "Circle"
  46976. * }
  46977. * });
  46978. * levelRenderer.addShape(shape);
  46979. *
  46980. *
  46981. */
  46982. class SmicCircle extends Shape_Shape {
  46983. /**
  46984. * @member {Object} SuperMap.LevelRenderer.Shape.SmicCircle.prototype.style
  46985. * @description 绘制样式。
  46986. *
  46987. * @param {number} x - 圆心x坐标,必设参数
  46988. * @param {number} y - 圆心y坐标,必设参数
  46989. * @param {number} r - 半径,必设参数
  46990. * @param {string} brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  46991. * @param {string} color - 填充颜色,默认值"#000000"
  46992. * @param {string} strokeColor - 描边颜色,默认值为'#000000'
  46993. * @param {string} lineCape — 线帽样式,可以是 butt, round, square,默认是butt
  46994. * @param {number} lineWidth - 描边宽度、默认是1
  46995. * @param {number} opacity - 绘制透明度、默认是1,不透明
  46996. * @param {number} shadowBlur - 阴影模糊度,大于0有效,默认是0
  46997. * @param {string} shadowColor - 阴影颜色,默认是'#000000'
  46998. * @param {number} shadowOffsetX - 阴影横向偏移,默认是0
  46999. * @param {number} shadowOffsetY - 阴影纵向偏移,默认是0
  47000. * @param {string} text - 图形中的附加文本,默认是0
  47001. * @param {string} textColor - 文本颜色,默认是'#000000'
  47002. * @param {string} textFont - 附加文本样式,eg:'bold 18px verdana'
  47003. * @param {string} textPosition - 附加文本位置, 可以是 inside, left, right, top, bottom
  47004. * @param {string} textAlign - 默认根据textPosition自动设置,附加文本水平对齐。可以是start, end, left, right, center
  47005. * @param {string} textBaseline 默认根据textPosition自动设置,附加文本垂直对齐。可以是top, bottom, middle, alphabetic, hanging, ideographic
  47006. */
  47007. //打开接口 style
  47008. /**
  47009. * @function SuperMap.LevelRenderer.Shape.SmicCircle.constructor
  47010. * @description 构造函数。
  47011. *
  47012. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  47013. *
  47014. */
  47015. constructor(options) {
  47016. super(options);
  47017. /**
  47018. * @member {string} SuperMap.LevelRenderer.Shape.SmicCircle.prototype.type
  47019. * @description 图形类型。
  47020. */
  47021. this.type = 'smiccircle';
  47022. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47023. this.refOriginalPosition = [0, 0];
  47024. }
  47025. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicCircle";
  47026. }
  47027. /**
  47028. * @function SuperMap.LevelRenderer.Shape.SmicCircle.prototype.destroy
  47029. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  47030. */
  47031. destroy() {
  47032. this.type = null;
  47033. super.destroy();
  47034. }
  47035. /**
  47036. * @function SuperMap.LevelRenderer.Shape.SmicCircle.prototype.buildPath
  47037. * @description 创建图形路径。
  47038. *
  47039. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  47040. * @param {Object} style - style。
  47041. *
  47042. */
  47043. buildPath(ctx, style) {
  47044. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47045. this.refOriginalPosition = [0, 0];
  47046. }
  47047. var __OP = this.refOriginalPosition;
  47048. var x = style.x + __OP[0]; // 圆心x
  47049. var y = style.y + __OP[1]; // 圆心y
  47050. ctx.moveTo(x + style.r, y);
  47051. ctx.arc(x, y, style.r, 0, Math.PI * 2, true);
  47052. return true;
  47053. }
  47054. /**
  47055. * @function SuperMap.LevelRenderer.Shape.SmicCircle.prototype.getRect
  47056. * @description 返回圆形包围盒矩形
  47057. *
  47058. * @param {Object} style - style
  47059. * @return {Object} 边框对象。包含属性:x,y,width,height。
  47060. *
  47061. */
  47062. getRect(style) {
  47063. if (style.__rect) {
  47064. return style.__rect;
  47065. }
  47066. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47067. this.refOriginalPosition = [0, 0];
  47068. }
  47069. var __OP = this.refOriginalPosition;
  47070. var x = style.x + __OP[0]; // 圆心x
  47071. var y = style.y + __OP[1]; // 圆心y
  47072. var r = style.r; // 圆r
  47073. var lineWidth;
  47074. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  47075. lineWidth = style.lineWidth || 1;
  47076. } else {
  47077. lineWidth = 0;
  47078. }
  47079. style.__rect = {
  47080. x: Math.round(x - r - lineWidth / 2),
  47081. y: Math.round(y - r - lineWidth / 2),
  47082. width: r * 2 + lineWidth,
  47083. height: r * 2 + lineWidth
  47084. };
  47085. return style.__rect;
  47086. }
  47087. }
  47088. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicPolygon.js
  47089. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  47090. * This program are made available under the terms of the Apache License, Version 2.0
  47091. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47092. /**
  47093. * @private
  47094. * @class SuperMap.LevelRenderer.Shape.SmicPolygon
  47095. * @category Visualization Theme
  47096. * @classdesc 多边形。
  47097. * @extends SuperMap.LevelRenderer.Shape
  47098. * @example
  47099. * var shape = new SuperMap.LevelRenderer.Shape.SmicPolygon({
  47100. * style: {
  47101. * // 100x100 的正方形
  47102. * pointList: [[0, 0], [100, 0], [100, 100], [0, 100]],
  47103. * color: 'blue'
  47104. * }
  47105. * });
  47106. * levelRenderer.addShape(shape);
  47107. *
  47108. */
  47109. class SmicPolygon extends Shape_Shape {
  47110. /**
  47111. * @member {Object} SuperMap.LevelRenderer.Shape.SmicPolygon.prototype.style
  47112. * @description 绘制样式。
  47113. *
  47114. * @param {Array} pointList - 节点数组,二维数组。默认值:null,必设参数。其形式如下:
  47115. * (code)
  47116. * (start code)
  47117. * [
  47118. * [10, 20], //单个节点
  47119. * [30, 40],
  47120. * [25, 30]
  47121. * ]
  47122. * (end)
  47123. * @param {string} style.smooth - 是否做平滑插值, 平滑算法可以选择 "bezier", "spline"。默认值:"";
  47124. * @param {number} style.smoothConstraint - 平滑约束。
  47125. * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  47126. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  47127. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  47128. * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  47129. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  47130. * @param {number} style.opacity - 绘制透明度。默认值:1。
  47131. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  47132. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  47133. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  47134. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  47135. * @param {string} style.text - 图形中的附加文本。默认值:""。
  47136. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  47137. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  47138. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  47139. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  47140. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  47141. */
  47142. //打开接口 style
  47143. /**
  47144. * @function SuperMap.LevelRenderer.Shape.SmicPolygon.constructor
  47145. * @description 构造函数。
  47146. *
  47147. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  47148. *
  47149. */
  47150. constructor(options) {
  47151. super(options);
  47152. /**
  47153. * @member {string} SuperMap.LevelRenderer.Shape.SmicPolygon.prototype.type
  47154. * @description 图形类型.
  47155. */
  47156. this.type = 'smicpolygon';
  47157. /**
  47158. * @member {Array} SuperMap.LevelRenderer.Shape.SmicPolygon.prototype._holePolygonPointList
  47159. * @description 岛洞面多边形顶点数组(三维数组)
  47160. *
  47161. */
  47162. this.holePolygonPointLists = null;
  47163. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47164. this.refOriginalPosition = [0, 0];
  47165. }
  47166. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicPolygon";
  47167. }
  47168. /**
  47169. * @function SuperMap.LevelRenderer.Shape.SmicPolygon.prototype.destroy
  47170. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  47171. */
  47172. destroy() {
  47173. this.type = null;
  47174. this.holePolygonPointLists = null;
  47175. super.destroy();
  47176. }
  47177. /**
  47178. * @function SuperMap.LevelRenderer.Shape.SmicPolygon.prototype.brush
  47179. * @description 笔触。
  47180. *
  47181. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  47182. * @param {boolean} isHighlight - 是否使用高亮属性。
  47183. *
  47184. */
  47185. brush(ctx, isHighlight) {
  47186. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47187. this.refOriginalPosition = [0, 0];
  47188. }
  47189. var style = this.style;
  47190. if (isHighlight) {
  47191. // 根据style扩展默认高亮样式
  47192. style = this.getHighlightStyle(
  47193. style,
  47194. this.highlightStyle || {}
  47195. );
  47196. }
  47197. ctx.save();
  47198. this.setContext(ctx, style);
  47199. // 设置 transform
  47200. this.setTransform(ctx);
  47201. // 先 fill 再stroke
  47202. var hasPath = false;
  47203. if (style.brushType == 'fill' || style.brushType == 'both' || typeof style.brushType == 'undefined') { // 默认为fill
  47204. ctx.beginPath();
  47205. if (style.lineType == 'dashed'
  47206. || style.lineType == 'dotted'
  47207. || style.lineType == 'dot'
  47208. || style.lineType == 'dash'
  47209. || style.lineType == 'dashdot'
  47210. || style.lineType == 'longdash'
  47211. || style.lineType == 'longdashdot'
  47212. ) {
  47213. // 特殊处理,虚线围不成path,实线再build一次
  47214. this.buildPath(ctx, {
  47215. lineType: 'solid',
  47216. lineWidth: style.lineWidth,
  47217. pointList: style.pointList
  47218. }
  47219. );
  47220. } else {
  47221. this.buildPath(ctx, style);
  47222. hasPath = true; // 这个path能用
  47223. }
  47224. ctx.closePath();
  47225. this.setCtxGlobalAlpha(ctx, "fill", style);
  47226. ctx.fill();
  47227. this.setCtxGlobalAlpha(ctx, "reset", style);
  47228. }
  47229. if (style.lineWidth > 0 && (style.brushType == 'stroke' || style.brushType == 'both')) {
  47230. if (!hasPath) {
  47231. ctx.beginPath();
  47232. this.buildPath(ctx, style);
  47233. }
  47234. this.setCtxGlobalAlpha(ctx, "stroke", style);
  47235. ctx.stroke();
  47236. this.setCtxGlobalAlpha(ctx, "reset", style);
  47237. }
  47238. this.drawText(ctx, style, this.style);
  47239. //岛洞
  47240. var hpStyle = Util.cloneObject(style);
  47241. if (hpStyle.pointList) {
  47242. if (this.holePolygonPointLists && this.holePolygonPointLists.length > 0) {
  47243. var holePLS = this.holePolygonPointLists;
  47244. var holePLSen = holePLS.length;
  47245. for (var i = 0; i < holePLSen; i++) {
  47246. var holePL = holePLS[i];
  47247. //岛洞面
  47248. hpStyle.pointList = holePL;
  47249. ctx.globalCompositeOperation = "destination-out";
  47250. // 先 fill 再stroke
  47251. hasPath = false;
  47252. if (hpStyle.brushType == 'fill' || hpStyle.brushType == 'both' || typeof hpStyle.brushType == 'undefined') { // 默认为fill
  47253. ctx.beginPath();
  47254. if (hpStyle.lineType == 'dashed'
  47255. || hpStyle.lineType == 'dotted'
  47256. || hpStyle.lineType == 'dot'
  47257. || hpStyle.lineType == 'dash'
  47258. || hpStyle.lineType == 'dashdot'
  47259. || hpStyle.lineType == 'longdash'
  47260. || hpStyle.lineType == 'longdashdot'
  47261. ) {
  47262. // 特殊处理,虚线围不成path,实线再build一次
  47263. this.buildPath(ctx, {
  47264. lineType: 'solid',
  47265. lineWidth: hpStyle.lineWidth,
  47266. pointList: hpStyle.pointList
  47267. }
  47268. );
  47269. } else {
  47270. this.buildPath(ctx, hpStyle);
  47271. hasPath = true; // 这个path能用
  47272. }
  47273. ctx.closePath();
  47274. this.setCtxGlobalAlpha(ctx, "fill", hpStyle);
  47275. ctx.fill();
  47276. this.setCtxGlobalAlpha(ctx, "reset", hpStyle);
  47277. }
  47278. if (hpStyle.lineWidth > 0 && (hpStyle.brushType == 'stroke' || hpStyle.brushType == 'both')) {
  47279. if (!hasPath) {
  47280. ctx.beginPath();
  47281. this.buildPath(ctx, hpStyle);
  47282. }
  47283. //如果描边,先回复 globalCompositeOperation 默认值再描边。
  47284. ctx.globalCompositeOperation = "source-over";
  47285. this.setCtxGlobalAlpha(ctx, "stroke", hpStyle);
  47286. ctx.stroke();
  47287. this.setCtxGlobalAlpha(ctx, "reset", hpStyle);
  47288. } else {
  47289. ctx.globalCompositeOperation = "source-over";
  47290. }
  47291. }
  47292. }
  47293. }
  47294. ctx.restore();
  47295. return;
  47296. }
  47297. /**
  47298. * @function SuperMap.LevelRenderer.Shape.SmicPolygon.prototype.buildPath
  47299. * @description 创建多边形路径。
  47300. *
  47301. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  47302. * @param {Object} style - style。
  47303. *
  47304. */
  47305. buildPath(ctx, style) {
  47306. if (style.showShadow) {
  47307. ctx.shadowBlur = style.shadowBlur;
  47308. ctx.shadowColor = style.shadowColor;
  47309. ctx.shadowOffsetX = style.shadowOffsetX;
  47310. ctx.shadowOffsetY = style.shadowOffsetY;
  47311. }
  47312. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47313. this.refOriginalPosition = [0, 0];
  47314. }
  47315. var __OP = this.refOriginalPosition;
  47316. // 虽然能重用 brokenLine,但底层图形基于性能考虑,重复代码减少调用吧
  47317. var pointList = style.pointList;
  47318. if (pointList.length < 2) {
  47319. // 少于2个点就不画了~
  47320. return;
  47321. }
  47322. if (style.smooth && style.smooth !== 'spline') {
  47323. var controlPoints = SUtil_SUtil.SUtil_smoothBezier(pointList, style.smooth, true, style.smoothConstraint, __OP);
  47324. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  47325. var cp1;
  47326. var cp2;
  47327. var p;
  47328. var len = pointList.length;
  47329. for (var i = 0; i < len; i++) {
  47330. cp1 = controlPoints[i * 2];
  47331. cp2 = controlPoints[i * 2 + 1];
  47332. p = [pointList[(i + 1) % len][0] + __OP[0], pointList[(i + 1) % len][1] + __OP[1]];
  47333. ctx.bezierCurveTo(
  47334. cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]
  47335. );
  47336. }
  47337. } else {
  47338. if (style.smooth === 'spline') {
  47339. pointList = SUtil_SUtil.SUtil_smoothSpline(pointList, true, null, __OP);
  47340. }
  47341. if (!style.lineType || style.lineType == 'solid') {
  47342. // 默认为实线
  47343. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  47344. for (let i = 1; i < pointList.length; i++) {
  47345. ctx.lineTo(pointList[i][0] + __OP[0], pointList[i][1] + __OP[1]);
  47346. }
  47347. ctx.lineTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  47348. } else if (style.lineType === 'dashed'
  47349. || style.lineType === 'dotted'
  47350. || style.lineType === 'dot'
  47351. || style.lineType === 'dash'
  47352. || style.lineType === 'longdash'
  47353. ) {
  47354. // SMIC-方法修改 - start
  47355. let dashLengthForStyle = style._dashLength || (style.lineWidth || 1) * (style.lineType == 'dashed' ? 5 : 1);
  47356. style._dashLength = dashLengthForStyle;
  47357. let dashLength = (style.lineWidth || 1);
  47358. let pattern1 = dashLength;
  47359. let pattern2 = dashLength;
  47360. //dashed
  47361. if (style.lineType === 'dashed') {
  47362. pattern1 *= 5;
  47363. pattern2 *= 5;
  47364. if (style.lineCap && style.lineCap !== "butt") {
  47365. pattern1 -= dashLength;
  47366. pattern2 += dashLength;
  47367. }
  47368. }
  47369. //dotted
  47370. if (style.lineType === 'dotted') {
  47371. if (style.lineCap && style.lineCap !== "butt") {
  47372. pattern1 = 1;
  47373. pattern2 += dashLength;
  47374. }
  47375. }
  47376. //dot
  47377. if (style.lineType === 'dot') {
  47378. pattern2 *= 4;
  47379. if (style.lineCap && style.lineCap !== "butt") {
  47380. pattern1 = 1;
  47381. pattern2 += dashLength;
  47382. }
  47383. }
  47384. //dash
  47385. if (style.lineType === 'dash') {
  47386. pattern1 *= 4;
  47387. pattern2 *= 4;
  47388. if (style.lineCap && style.lineCap !== "butt") {
  47389. pattern1 -= dashLength;
  47390. pattern2 += dashLength;
  47391. }
  47392. }
  47393. //longdash
  47394. if (style.lineType === 'longdash') {
  47395. pattern1 *= 8;
  47396. pattern2 *= 4;
  47397. if (style.lineCap && style.lineCap !== "butt") {
  47398. pattern1 -= dashLength;
  47399. pattern2 += dashLength;
  47400. }
  47401. }
  47402. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  47403. for (let i = 1; i < pointList.length; i++) {
  47404. SUtil_SUtil.SUtil_dashedLineTo(
  47405. ctx,
  47406. pointList[i - 1][0] + __OP[0],
  47407. pointList[i - 1][1] + __OP[1],
  47408. pointList[i][0] + __OP[0],
  47409. pointList[i][1] + __OP[1],
  47410. dashLength,
  47411. [pattern1, pattern2]
  47412. );
  47413. }
  47414. SUtil_SUtil.SUtil_dashedLineTo(
  47415. ctx,
  47416. pointList[pointList.length - 1][0] + __OP[0],
  47417. pointList[pointList.length - 1][1] + __OP[1],
  47418. pointList[0][0] + __OP[0],
  47419. pointList[0][1] + __OP[1],
  47420. dashLength,
  47421. [pattern1, pattern2]
  47422. );
  47423. } else if (style.lineType === 'dashdot'
  47424. || style.lineType === 'longdashdot'
  47425. ) {
  47426. let dashLengthForStyle = style._dashLength || (style.lineWidth || 1) * (style.lineType == 'dashed' ? 5 : 1);
  47427. style._dashLength = dashLengthForStyle;
  47428. let dashLength = (style.lineWidth || 1);
  47429. let pattern1 = dashLength;
  47430. let pattern2 = dashLength;
  47431. let pattern3 = dashLength;
  47432. let pattern4 = dashLength;
  47433. //dashdot
  47434. if (style.lineType === 'dashdot') {
  47435. pattern1 *= 4;
  47436. pattern2 *= 4;
  47437. pattern4 *= 4;
  47438. if (style.lineCap && style.lineCap !== "butt") {
  47439. pattern1 -= dashLength;
  47440. pattern2 += dashLength;
  47441. pattern3 = 1;
  47442. pattern4 += dashLength;
  47443. }
  47444. }
  47445. //longdashdot
  47446. if (style.lineType === 'longdashdot') {
  47447. pattern1 *= 8;
  47448. pattern2 *= 4;
  47449. pattern4 *= 4;
  47450. if (style.lineCap && style.lineCap !== "butt") {
  47451. pattern1 -= dashLength;
  47452. pattern2 += dashLength;
  47453. pattern3 = 1;
  47454. pattern4 += dashLength;
  47455. }
  47456. }
  47457. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  47458. for (let i = 1; i < pointList.length; i++) {
  47459. SUtil_SUtil.SUtil_dashedLineTo(
  47460. ctx,
  47461. pointList[i - 1][0] + __OP[0],
  47462. pointList[i - 1][1] + __OP[1],
  47463. pointList[i][0] + __OP[0],
  47464. pointList[i][1] + __OP[1],
  47465. dashLength,
  47466. [pattern1, pattern2, pattern3, pattern4]
  47467. );
  47468. }
  47469. SUtil_SUtil.SUtil_dashedLineTo(
  47470. ctx,
  47471. pointList[pointList.length - 1][0] + __OP[0],
  47472. pointList[pointList.length - 1][1] + __OP[1],
  47473. pointList[0][0] + __OP[0],
  47474. pointList[0][1] + __OP[1],
  47475. dashLength,
  47476. [pattern1, pattern2, pattern3, pattern4]
  47477. );
  47478. }
  47479. }
  47480. return;
  47481. }
  47482. /**
  47483. * @function SuperMap.LevelRenderer.Shape.SmicPolygon.prototype.getRect
  47484. * @description 计算返回多边形包围盒矩阵。该包围盒是直接从四个控制点计算,并非最小包围盒。
  47485. *
  47486. * @param {Object} style - style
  47487. * @return {Object} 边框对象。包含属性:x,y,width,height。
  47488. *
  47489. */
  47490. getRect(style, refOriginalPosition) {
  47491. var __OP;
  47492. if (!refOriginalPosition) {
  47493. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47494. this.refOriginalPosition = [0, 0];
  47495. }
  47496. __OP = this.refOriginalPosition;
  47497. } else {
  47498. __OP = refOriginalPosition;
  47499. }
  47500. if (style.__rect) {
  47501. return style.__rect;
  47502. }
  47503. var minX = Number.MAX_VALUE;
  47504. var maxX = Number.MIN_VALUE;
  47505. var minY = Number.MAX_VALUE;
  47506. var maxY = Number.MIN_VALUE;
  47507. var pointList = style.pointList;
  47508. for (var i = 0, l = pointList.length; i < l; i++) {
  47509. if (pointList[i][0] + __OP[0] < minX) {
  47510. minX = pointList[i][0] + __OP[0];
  47511. }
  47512. if (pointList[i][0] + __OP[0] > maxX) {
  47513. maxX = pointList[i][0] + __OP[0];
  47514. }
  47515. if (pointList[i][1] + __OP[1] < minY) {
  47516. minY = pointList[i][1] + __OP[1];
  47517. }
  47518. if (pointList[i][1] + __OP[1] > maxY) {
  47519. maxY = pointList[i][1] + __OP[1];
  47520. }
  47521. }
  47522. var lineWidth;
  47523. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  47524. lineWidth = style.lineWidth || 1;
  47525. } else {
  47526. lineWidth = 0;
  47527. }
  47528. style.__rect = {
  47529. x: Math.round(minX - lineWidth / 2),
  47530. y: Math.round(minY - lineWidth / 2),
  47531. width: maxX - minX + lineWidth,
  47532. height: maxY - minY + lineWidth
  47533. };
  47534. return style.__rect;
  47535. }
  47536. }
  47537. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicBrokenLine.js
  47538. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  47539. * This program are made available under the terms of the Apache License, Version 2.0
  47540. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47541. /**
  47542. * @private
  47543. * @class SuperMap.LevelRenderer.Shape.SmicBrokenLine
  47544. * @category Visualization Theme
  47545. * @classdesc 折线(ic)。
  47546. * @extends SuperMap.LevelRenderer.Shape
  47547. * @example
  47548. * var shape = new SuperMap.LevelRenderer.Shape.SmicBrokenLine({
  47549. * style: {
  47550. * pointList: [[0, 0], [100, 100], [100, 0]],
  47551. * smooth: 'bezier',
  47552. * strokeColor: 'purple'
  47553. * }
  47554. * });
  47555. * levelRenderer.addShape(shape);
  47556. *
  47557. *
  47558. */
  47559. class SmicBrokenLine extends Shape_Shape {
  47560. /**
  47561. * @member {Object} SuperMap.LevelRenderer.Shape.SmicBrokenLine.prototype.style
  47562. * @description 绘制样式。
  47563. *
  47564. * @param {Array} pointList - 节点数组,二维数组。默认值:null,必设参数。其形式如下:
  47565. * (code)
  47566. * (start code)
  47567. * [
  47568. * [10, 20], //单个节点
  47569. * [30, 40],
  47570. * [25, 30]
  47571. * ]
  47572. * (end)
  47573. * @param {string} smooth - 是否做平滑插值, 平滑算法可以选择 "bezier", "spline"。默认值:"";
  47574. * @param {number} smoothConstraint - 平滑约束。
  47575. * @param {string} strokeColor - 描边颜色。默认值:"#000000'"。
  47576. * @param {string} lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  47577. * @param {number} lineWidth - 描边宽度。默认值:1。
  47578. * @param {number} opacity - 绘制透明度。默认值:1。
  47579. * @param {number} shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  47580. * @param {number} shadowColor - 阴影颜色。默认值:"#000000'"。
  47581. * @param {number} shadowOffsetX - 阴影横向偏移。默认值:0。
  47582. * @param {number} shadowOffsetY - 阴影纵向偏移。默认值:0。
  47583. * @param {string} text - 图形中的附加文本。默认值:""。
  47584. * @param {string} textColor - 文本颜色。默认值:"#000000'"。
  47585. * @param {string} textFont - 附加文本样式。示例:'bold 18px verdana'。
  47586. * @param {string} textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  47587. * @param {string} textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  47588. * @param {string} textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  47589. */
  47590. //打开接口 style
  47591. /**
  47592. * @function SuperMap.LevelRenderer.Shape.SmicBrokenLine.constructor
  47593. * @description 构造函数。
  47594. *
  47595. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  47596. *
  47597. */
  47598. constructor(options) {
  47599. super(options);
  47600. /**
  47601. * @member {string} SuperMap.LevelRenderer.Shape.SmicBrokenLine.prototype.brushTypeOnly
  47602. * @description 线条只能描边。
  47603. */
  47604. this.brushTypeOnly = 'stroke';
  47605. /**
  47606. * @member {string} SuperMap.LevelRenderer.Shape.SmicBrokenLine.prototype.textPosition
  47607. * @description 文本位置。
  47608. */
  47609. this.textPosition = 'end';
  47610. /**
  47611. * @member {string} SuperMap.LevelRenderer.Shape.SmicBrokenLine.prototype.type
  47612. * @description 图形类型.
  47613. */
  47614. this.type = 'smicbroken-line';
  47615. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47616. this.refOriginalPosition = [0, 0];
  47617. }
  47618. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicBrokenLine";
  47619. }
  47620. /**
  47621. * @function SuperMap.LevelRenderer.Shape.SmicBrokenLine.prototype.destroy
  47622. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  47623. */
  47624. destroy() {
  47625. this.brushTypeOnly = null;
  47626. this.textPosition = null;
  47627. this.type = null;
  47628. super.destroy();
  47629. }
  47630. /**
  47631. * @function SuperMap.LevelRenderer.Shape.SmicBrokenLine.prototype.buildPath
  47632. * @description 创建折线路径。
  47633. *
  47634. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  47635. * @param {Object} style - style。
  47636. *
  47637. */
  47638. buildPath(ctx, style) {
  47639. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47640. this.refOriginalPosition = [0, 0];
  47641. }
  47642. var __OP = this.refOriginalPosition;
  47643. var pointList = style.pointList;
  47644. if (pointList.length < 2) {
  47645. // 少于2个点就不画了~
  47646. return;
  47647. }
  47648. var len = Math.min(style.pointList.length, Math.round(style.pointListLength || style.pointList.length));
  47649. if (style.smooth && style.smooth !== 'spline') {
  47650. var controlPoints = SUtil_SUtil.SUtil_smoothBezier(pointList, style.smooth, false, style.smoothConstraint, __OP);
  47651. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  47652. var cp1;
  47653. var cp2;
  47654. var p;
  47655. for (let i = 0; i < len - 1; i++) {
  47656. cp1 = controlPoints[i * 2];
  47657. cp2 = controlPoints[i * 2 + 1];
  47658. p = [pointList[i + 1][0] + __OP[0], pointList[i + 1][1] + __OP[1]];
  47659. ctx.bezierCurveTo(
  47660. cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]
  47661. );
  47662. }
  47663. } else {
  47664. if (style.smooth === 'spline') {
  47665. pointList = SUtil_SUtil.SUtil_smoothSpline(pointList, null, null, __OP);
  47666. len = pointList.length;
  47667. }
  47668. if (!style.lineType || style.lineType === 'solid') {
  47669. // 默认为实线
  47670. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  47671. for (let i = 1; i < len; i++) {
  47672. ctx.lineTo(pointList[i][0] + __OP[0], pointList[i][1] + __OP[1]);
  47673. }
  47674. } else if (style.lineType === 'dashed'
  47675. || style.lineType === 'dotted'
  47676. || style.lineType === 'dot'
  47677. || style.lineType === 'dash'
  47678. || style.lineType === 'longdash'
  47679. ) {
  47680. let dashLength = (style.lineWidth || 1);
  47681. let pattern1 = dashLength;
  47682. let pattern2 = dashLength;
  47683. //dashed
  47684. if (style.lineType === 'dashed') {
  47685. pattern1 *= 5;
  47686. pattern2 *= 5;
  47687. if (style.lineCap && style.lineCap !== "butt") {
  47688. pattern1 -= dashLength;
  47689. pattern2 += dashLength;
  47690. }
  47691. }
  47692. //dotted
  47693. if (style.lineType === 'dotted') {
  47694. if (style.lineCap && style.lineCap !== "butt") {
  47695. pattern1 = 1;
  47696. pattern2 += dashLength;
  47697. }
  47698. }
  47699. //dot
  47700. if (style.lineType === 'dot') {
  47701. pattern2 *= 4;
  47702. if (style.lineCap && style.lineCap !== "butt") {
  47703. pattern1 = 1;
  47704. pattern2 += dashLength;
  47705. }
  47706. }
  47707. //dash
  47708. if (style.lineType === 'dash') {
  47709. pattern1 *= 4;
  47710. pattern2 *= 4;
  47711. if (style.lineCap && style.lineCap !== "butt") {
  47712. pattern1 -= dashLength;
  47713. pattern2 += dashLength;
  47714. }
  47715. }
  47716. //longdash
  47717. if (style.lineType === 'longdash') {
  47718. pattern1 *= 8;
  47719. pattern2 *= 4;
  47720. if (style.lineCap && style.lineCap !== "butt") {
  47721. pattern1 -= dashLength;
  47722. pattern2 += dashLength;
  47723. }
  47724. }
  47725. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  47726. for (var i = 1; i < len; i++) {
  47727. SUtil_SUtil.SUtil_dashedLineTo(
  47728. ctx,
  47729. pointList[i - 1][0] + __OP[0], pointList[i - 1][1] + __OP[1],
  47730. pointList[i][0] + __OP[0], pointList[i][1] + __OP[1],
  47731. dashLength,
  47732. [pattern1, pattern2]
  47733. );
  47734. }
  47735. } else if (style.lineType === 'dashdot'
  47736. || style.lineType === 'longdashdot'
  47737. ) {
  47738. let dashLength = (style.lineWidth || 1);
  47739. let pattern1 = dashLength;
  47740. let pattern2 = dashLength;
  47741. let pattern3 = dashLength;
  47742. let pattern4 = dashLength;
  47743. //dashdot
  47744. if (style.lineType === 'dashdot') {
  47745. pattern1 *= 4;
  47746. pattern2 *= 4;
  47747. pattern4 *= 4;
  47748. if (style.lineCap && style.lineCap !== "butt") {
  47749. pattern1 -= dashLength;
  47750. pattern2 += dashLength;
  47751. pattern3 = 1;
  47752. pattern4 += dashLength;
  47753. }
  47754. }
  47755. //longdashdot
  47756. if (style.lineType === 'longdashdot') {
  47757. pattern1 *= 8;
  47758. pattern2 *= 4;
  47759. pattern4 *= 4;
  47760. if (style.lineCap && style.lineCap !== "butt") {
  47761. pattern1 -= dashLength;
  47762. pattern2 += dashLength;
  47763. pattern3 = 1;
  47764. pattern4 += dashLength;
  47765. }
  47766. }
  47767. dashLength = (style.lineWidth || 1)
  47768. * (style.lineType === 'dashed' ? 5 : 1);
  47769. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  47770. for (let i = 1; i < len; i++) {
  47771. SUtil_SUtil.SUtil_dashedLineTo(
  47772. ctx,
  47773. pointList[i - 1][0] + __OP[0], pointList[i - 1][1] + __OP[1],
  47774. pointList[i][0] + __OP[0], pointList[i][1] + __OP[1],
  47775. dashLength,
  47776. [pattern1, pattern2, pattern3, pattern4]
  47777. );
  47778. }
  47779. }
  47780. }
  47781. return;
  47782. }
  47783. /**
  47784. * @function SuperMap.LevelRenderer.Shape.SmicBrokenLine.prototype.getRect
  47785. * @description 计算返回折线包围盒矩形。该包围盒是直接从四个控制点计算,并非最小包围盒。
  47786. *
  47787. * @param {Object} style - style
  47788. * @return {Object} 边框对象。包含属性:x,y,width,height。
  47789. */
  47790. getRect(style) {
  47791. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47792. this.refOriginalPosition = [0, 0];
  47793. }
  47794. var __OP = this.refOriginalPosition;
  47795. return SmicPolygon.prototype.getRect.apply(this, [style, __OP]);
  47796. }
  47797. }
  47798. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicImage.js
  47799. /* Copyright© 2000 - 2021 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. * @private
  47804. * @class SuperMap.LevelRenderer.Shape.SmicImage
  47805. * @category Visualization Theme
  47806. * @classdesc 图片绘制。
  47807. * @extends SuperMap.LevelRenderer.Shape
  47808. * @example
  47809. * var shape = new SuperMap.LevelRenderer.Shape.SmicImage({
  47810. * style: {
  47811. * image: 'test.jpg',
  47812. * x: 100,
  47813. * y: 100
  47814. * }
  47815. * });
  47816. * levelRenderer.addShape(shape);
  47817. *
  47818. *
  47819. */
  47820. class SmicImage extends Shape_Shape {
  47821. /**
  47822. * @member {Object} SuperMap.LevelRenderer.Shape.SmicImage.prototype.style
  47823. * @description 绘制样式。
  47824. *
  47825. * @param {number} style.x - 左上角横坐标,必设参数。
  47826. * @param {number} style.y - 左上角纵坐标,必设参数。
  47827. * @param {(string/Cavans)} style.image - 图片地址或cavans对象,必设参数。
  47828. * @param {number} style.width - 绘制到画布上的宽度,默认为图片高度。
  47829. * @param {number} style.height - 绘制到画布上的高度,默认为图片高度。
  47830. * @param {number} style.sx - 从图片中裁剪的左上角横坐标。
  47831. * @param {number} style.sy - 从图片中裁剪的左上角纵坐标。
  47832. * @param {number} style.sWidth - 从图片中裁剪的宽度,默认为图片高度。
  47833. * @param {number} style.sHeight - 绘制到画布上的高度,默认为图片高度。
  47834. * @param {number} style.opacity - 绘制透明度。默认值:1。
  47835. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  47836. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  47837. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  47838. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  47839. * @param {string} style.text - 图形中的附加文本。默认值:""。
  47840. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  47841. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  47842. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  47843. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  47844. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  47845. */
  47846. //打开接口 style
  47847. /**
  47848. * @function SuperMap.LevelRenderer.Shape.SmicImage.constructor
  47849. * @description 构造函数。
  47850. *
  47851. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  47852. *
  47853. */
  47854. constructor(options) {
  47855. super(options);
  47856. /**
  47857. * @member {string} SuperMap.LevelRenderer.Shape.SmicImage.prototype.type
  47858. * @description 图形类型。
  47859. */
  47860. this.type = 'smicimage';
  47861. /**
  47862. * @member {string} SuperMap.LevelRenderer.Shape.SmicImage.prototype._imageCache
  47863. * @description 图片缓存。
  47864. */
  47865. this._imageCache = {};
  47866. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47867. this.refOriginalPosition = [0, 0];
  47868. }
  47869. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicImage";
  47870. }
  47871. /**
  47872. * @function SuperMap.LevelRenderer.Shape.SmicImage.prototype.destroy
  47873. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  47874. */
  47875. destroy() {
  47876. this.type = null;
  47877. this._imageCache = null;
  47878. super.destroy();
  47879. }
  47880. /**
  47881. * @function SuperMap.LevelRenderer.Shape.SmicImage.prototype.buildPath
  47882. * @description 创建图片。
  47883. *
  47884. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  47885. * @param {Object} style - style。
  47886. *
  47887. */
  47888. brush(ctx, isHighlight, refresh) {
  47889. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47890. this.refOriginalPosition = [0, 0];
  47891. }
  47892. var __OP = this.refOriginalPosition;
  47893. var style = this.style || {};
  47894. if (isHighlight) {
  47895. // 根据style扩展默认高亮样式
  47896. style = this.getHighlightStyle(
  47897. style, this.highlightStyle || {}
  47898. );
  47899. }
  47900. var image = style.image;
  47901. var me = this;
  47902. if (typeof(image) === 'string') {
  47903. var src = image;
  47904. if (this._imageCache[src]) {
  47905. image = this._imageCache[src];
  47906. } else {
  47907. image = new Image();
  47908. image.onload = function () {
  47909. image.onload = null;
  47910. clearTimeout(SmicImage._refreshTimeout);
  47911. SmicImage._needsRefresh.push(me);
  47912. // 防止因为缓存短时间内触发多次onload事件
  47913. SmicImage._refreshTimeout = setTimeout(function () {
  47914. refresh && refresh(SmicImage._needsRefresh);
  47915. // 清空 needsRefresh
  47916. SmicImage._needsRefresh = [];
  47917. }, 10);
  47918. };
  47919. image.src = src;
  47920. this._imageCache[src] = image;
  47921. }
  47922. }
  47923. if (image) {
  47924. // 图片已经加载完成
  47925. if (image.nodeName.toUpperCase() == 'IMG') {
  47926. if (window.ActiveXObject) {
  47927. if (image.readyState != 'complete') {
  47928. return;
  47929. }
  47930. } else {
  47931. if (!image.complete) {
  47932. return;
  47933. }
  47934. }
  47935. }
  47936. // Else is canvas
  47937. var width = style.width || image.width;
  47938. var height = style.height || image.height;
  47939. var x = style.x + __OP[0];
  47940. var y = style.y + __OP[1];
  47941. // 图片加载失败
  47942. if (!image.width || !image.height) {
  47943. return;
  47944. }
  47945. ctx.save();
  47946. this.doClip(ctx);
  47947. this.setContext(ctx, style);
  47948. // 设置transform
  47949. this.setTransform(ctx);
  47950. if (style.sWidth && style.sHeight) {
  47951. let sx = (style.sx + __OP[0]) || 0;
  47952. let sy = (style.sy + __OP[1]) || 0;
  47953. ctx.drawImage(
  47954. image,
  47955. sx, sy, style.sWidth, style.sHeight,
  47956. x, y, width, height
  47957. );
  47958. } else if (style.sx && style.sy) {
  47959. let sx = style.sx + __OP[0];
  47960. let sy = style.sy + __OP[1];
  47961. var sWidth = width - sx;
  47962. var sHeight = height - sy;
  47963. ctx.drawImage(
  47964. image,
  47965. sx, sy, sWidth, sHeight,
  47966. x, y, width, height
  47967. );
  47968. } else {
  47969. ctx.drawImage(image, x, y, width, height);
  47970. }
  47971. // 如果没设置宽和高的话自动根据图片宽高设置
  47972. if (!style.width) {
  47973. style.width = width;
  47974. }
  47975. if (!style.height) {
  47976. style.height = height;
  47977. }
  47978. if (!this.style.width) {
  47979. this.style.width = width;
  47980. }
  47981. if (!this.style.height) {
  47982. this.style.height = height;
  47983. }
  47984. this.drawText(ctx, style, this.style);
  47985. ctx.restore();
  47986. }
  47987. }
  47988. /**
  47989. * @function SuperMap.LevelRenderer.Shape.SmicImage.prototype.getRect
  47990. * @description 计算返回图片的包围盒矩形。
  47991. *
  47992. * @param {Object} style - style
  47993. * @return {Object} 边框对象。包含属性:x,y,width,height。
  47994. */
  47995. getRect(style) {
  47996. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47997. this.refOriginalPosition = [0, 0];
  47998. }
  47999. var __OP = this.refOriginalPosition;
  48000. return {
  48001. x: style.x + __OP[0],
  48002. y: style.y + __OP[1],
  48003. width: style.width,
  48004. height: style.height
  48005. };
  48006. }
  48007. /**
  48008. * @function SuperMap.LevelRenderer.Shape.SmicImage.prototype.clearCache
  48009. * @description 清除图片缓存。
  48010. *
  48011. * @param {Object} style - style
  48012. * @return {Object} 边框对象。包含属性:x,y,width,height。
  48013. *
  48014. */
  48015. clearCache() {
  48016. this._imageCache = {};
  48017. }
  48018. }
  48019. SmicImage._needsRefresh = [];
  48020. SmicImage._refreshTimeout = null;
  48021. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicRectangle.js
  48022. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  48023. * This program are made available under the terms of the Apache License, Version 2.0
  48024. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48025. /**
  48026. * @private
  48027. * @class SuperMap.LevelRenderer.Shape.SmicRectangle
  48028. * @category Visualization Theme
  48029. * @classdesc 矩形。
  48030. * @extends SuperMap.LevelRenderer.Shape
  48031. * @example
  48032. * var shape = new SuperMap.LevelRenderer.Shape.SmicRectangle({
  48033. * style: {
  48034. * x: 0,
  48035. * y: 0,
  48036. * width: 100,
  48037. * height: 100,
  48038. * radius: 20
  48039. * }
  48040. * });
  48041. * levelRenderer.addShape(shape);
  48042. *
  48043. */
  48044. class SmicRectangle extends Shape_Shape {
  48045. /**
  48046. * @member {Object} SuperMap.LevelRenderer.Shape.SmicRectangle.prototype.style
  48047. * @description 绘制样式。
  48048. *
  48049. * @param {number} style.x - 左上角 x 坐标,必设参数。
  48050. * @param {number} style.y - 左上角 y 坐标,必设参数。
  48051. * @param {number} style.width - 宽度,必设参数。
  48052. * @param {number} style.height - 高度,必设参数。
  48053. * @param {Array} style.radius - 矩形圆角,可以用数组分别指定四个角的圆角,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4 则 radius为 [r1、r2、r3、r4 ]。
  48054. * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  48055. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  48056. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  48057. * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  48058. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  48059. * @param {number} style.opacity - 绘制透明度。默认值:1。
  48060. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  48061. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  48062. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  48063. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  48064. * @param {string} style.text - 图形中的附加文本。默认值:""。
  48065. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  48066. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  48067. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  48068. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  48069. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  48070. */
  48071. //打开接口 style
  48072. /**
  48073. * @function SuperMap.LevelRenderer.Shape.SmicRectangle.constructor
  48074. * @description 构造函数。
  48075. *
  48076. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  48077. *
  48078. */
  48079. constructor(options) {
  48080. super(options);
  48081. /**
  48082. * @member {string} SuperMap.LevelRenderer.Shape.SmicRectangle.prototype.type
  48083. * @description 图形类型.
  48084. */
  48085. this.type = 'smicrectangle';
  48086. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  48087. this.refOriginalPosition = [0, 0];
  48088. }
  48089. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicRectangle";
  48090. }
  48091. /**
  48092. * @function SuperMap.LevelRenderer.Shape.SmicRectangle.prototype.destroy
  48093. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  48094. */
  48095. destroy() {
  48096. this.type = null;
  48097. super.destroy();
  48098. }
  48099. /**
  48100. * APIMethod: _buildRadiusPath
  48101. * 创建矩形的圆角路径。
  48102. *
  48103. * Parameters:
  48104. * ctx - {CanvasRenderingContext2D} Context2D 上下文。
  48105. * style - {Object} style。
  48106. *
  48107. */
  48108. _buildRadiusPath(ctx, style) {
  48109. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  48110. this.refOriginalPosition = [0, 0];
  48111. }
  48112. var __OP = this.refOriginalPosition;
  48113. // 左上、右上、右下、左下角的半径依次为r1、r2、r3、r4
  48114. // r缩写为1 相当于 [1, 1, 1, 1]
  48115. // r缩写为[1] 相当于 [1, 1, 1, 1]
  48116. // r缩写为[1, 2] 相当于 [1, 2, 1, 2]
  48117. // r缩写为[1, 2, 3] 相当于 [1, 2, 3, 2]
  48118. var x = style.x + __OP[0];
  48119. var y = style.y + __OP[1];
  48120. var width = style.width;
  48121. var height = style.height;
  48122. var r = style.radius;
  48123. var r1;
  48124. var r2;
  48125. var r3;
  48126. var r4;
  48127. if (typeof r === 'number') {
  48128. r1 = r2 = r3 = r4 = r;
  48129. } else if (r instanceof Array) {
  48130. if (r.length === 1) {
  48131. r1 = r2 = r3 = r4 = r[0];
  48132. } else if (r.length === 2) {
  48133. r1 = r3 = r[0];
  48134. r2 = r4 = r[1];
  48135. } else if (r.length === 3) {
  48136. r1 = r[0];
  48137. r2 = r4 = r[1];
  48138. r3 = r[2];
  48139. } else {
  48140. r1 = r[0];
  48141. r2 = r[1];
  48142. r3 = r[2];
  48143. r4 = r[3];
  48144. }
  48145. } else {
  48146. r1 = r2 = r3 = r4 = 0;
  48147. }
  48148. var total;
  48149. if (r1 + r2 > width) {
  48150. total = r1 + r2;
  48151. r1 *= width / total;
  48152. r2 *= width / total;
  48153. }
  48154. if (r3 + r4 > width) {
  48155. total = r3 + r4;
  48156. r3 *= width / total;
  48157. r4 *= width / total;
  48158. }
  48159. if (r2 + r3 > height) {
  48160. total = r2 + r3;
  48161. r2 *= height / total;
  48162. r3 *= height / total;
  48163. }
  48164. if (r1 + r4 > height) {
  48165. total = r1 + r4;
  48166. r1 *= height / total;
  48167. r4 *= height / total;
  48168. }
  48169. ctx.moveTo(x + r1, y);
  48170. ctx.lineTo(x + width - r2, y);
  48171. r2 !== 0 && ctx.quadraticCurveTo(
  48172. x + width, y, x + width, y + r2
  48173. );
  48174. ctx.lineTo(x + width, y + height - r3);
  48175. r3 !== 0 && ctx.quadraticCurveTo(
  48176. x + width, y + height, x + width - r3, y + height
  48177. );
  48178. ctx.lineTo(x + r4, y + height);
  48179. r4 !== 0 && ctx.quadraticCurveTo(
  48180. x, y + height, x, y + height - r4
  48181. );
  48182. ctx.lineTo(x, y + r1);
  48183. r1 !== 0 && ctx.quadraticCurveTo(x, y, x + r1, y);
  48184. }
  48185. /**
  48186. * @function SuperMap.LevelRenderer.Shape.SmicRectangle.prototype.buildPath
  48187. * @description 创建矩形路径。
  48188. *
  48189. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  48190. * @param {Object} style - style。
  48191. *
  48192. */
  48193. buildPath(ctx, style) {
  48194. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  48195. this.refOriginalPosition = [0, 0];
  48196. }
  48197. var __OP = this.refOriginalPosition;
  48198. if (!style.radius) {
  48199. ctx.moveTo(style.x + __OP[0], style.y + __OP[1]);
  48200. ctx.lineTo((style.x + __OP[0]) + style.width, (style.y + __OP[1]));
  48201. ctx.lineTo((style.x + __OP[0]) + style.width, (style.y + __OP[1]) + style.height);
  48202. ctx.lineTo((style.x + __OP[0]), (style.y + __OP[1]) + style.height);
  48203. ctx.lineTo(style.x + __OP[0], style.y + __OP[1]);
  48204. // ctx.rect(style.x, style.y, style.width, style.height);
  48205. } else {
  48206. this._buildRadiusPath(ctx, style);
  48207. }
  48208. ctx.closePath();
  48209. return;
  48210. }
  48211. /**
  48212. * @function SuperMap.LevelRenderer.Shape.SmicRectangle.prototype.getRect
  48213. * @description 计算返回矩形包围盒矩阵。该包围盒是直接从四个控制点计算,并非最小包围盒。
  48214. *
  48215. * @param {Object} style - style
  48216. * @return {Object} 边框对象。包含属性:x,y,width,height。
  48217. */
  48218. getRect(style) {
  48219. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  48220. this.refOriginalPosition = [0, 0];
  48221. }
  48222. var __OP = this.refOriginalPosition;
  48223. if (style.__rect) {
  48224. return style.__rect;
  48225. }
  48226. var lineWidth;
  48227. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  48228. lineWidth = style.lineWidth || 1;
  48229. } else {
  48230. lineWidth = 0;
  48231. }
  48232. style.__rect = {
  48233. x: Math.round((style.x + __OP[0]) - lineWidth / 2),
  48234. y: Math.round((style.y + __OP[1]) - lineWidth / 2),
  48235. width: style.width + lineWidth,
  48236. height: style.height + lineWidth
  48237. };
  48238. return style.__rect;
  48239. }
  48240. }
  48241. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicSector.js
  48242. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  48243. * This program are made available under the terms of the Apache License, Version 2.0
  48244. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48245. /**
  48246. * @private
  48247. * @class SuperMap.LevelRenderer.Shape.SmicSector
  48248. * @category Visualization Theme
  48249. * @classdesc 扇形。
  48250. * @extends SuperMap.LevelRenderer.Shape
  48251. * @example
  48252. * var shape = new SuperMap.LevelRenderer.Shape.SmicSector({
  48253. * style: {
  48254. * x: 100,
  48255. * y: 100,
  48256. * r: 60,
  48257. * r0: 30,
  48258. * startAngle: 0,
  48259. * endEngle: 180
  48260. * }
  48261. * });
  48262. * levelRenderer.addShape(shape);
  48263. *
  48264. *
  48265. */
  48266. class SmicSector extends Shape_Shape {
  48267. /**
  48268. * @member {Object} SuperMap.LevelRenderer.Shape.SmicSector.prototype.style
  48269. * @description 绘制样式。
  48270. *
  48271. * @param {number} style.x - 圆心 x 坐标,必设参数。
  48272. * @param {number} style.y - 圆心 y 坐标,必设参数。
  48273. * @param {number} style.r - 外圆半径,必设参数。
  48274. * @param {number} style.r0 - 内圆半径,指定后将出现内弧,同时扇边长度为`r - r0`。取值范围[0, r),默认值:0。
  48275. * @param {number} style.startAngle - 起始角度,必设参数。取值范围[0, 360)。
  48276. * @param {number} style.endAngle - 结束角度,必设参数。取值范围(0, 360。
  48277. * @param {boolean} style.clockWise - 是否是顺时针。默认值:false。
  48278. * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  48279. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  48280. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  48281. * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  48282. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  48283. * @param {number} style.opacity - 绘制透明度。默认值:1。
  48284. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  48285. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  48286. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  48287. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  48288. * @param {string} style.text - 图形中的附加文本。默认值:""。
  48289. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  48290. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  48291. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  48292. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  48293. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  48294. */
  48295. //打开接口 style
  48296. /**
  48297. * @function SuperMap.LevelRenderer.Shape.SmicSector.constructor
  48298. * @description 构造函数。
  48299. *
  48300. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  48301. *
  48302. */
  48303. constructor(options) {
  48304. super(options);
  48305. /**
  48306. * @member {string} SuperMap.LevelRenderer.Shape.SmicSector.protptype.type
  48307. * @description 图形类型。
  48308. */
  48309. this.type = 'smicsector';
  48310. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  48311. this.refOriginalPosition = [0, 0];
  48312. }
  48313. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicSector";
  48314. }
  48315. /**
  48316. * @function SuperMap.LevelRenderer.Shape.SmicSector.prototype.destroy
  48317. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  48318. */
  48319. destroy() {
  48320. this.type = null;
  48321. super.destroy();
  48322. }
  48323. /**
  48324. * @function SuperMap.LevelRenderer.Shape.SmicSector.prototype.buildPath
  48325. * @description 创建扇形路径。
  48326. *
  48327. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  48328. * @param {Object} style - style。
  48329. *
  48330. */
  48331. buildPath(ctx, style) {
  48332. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  48333. this.refOriginalPosition = [0, 0];
  48334. }
  48335. var __OP = this.refOriginalPosition;
  48336. var x = style.x + __OP[0]; // 圆心x
  48337. var y = style.y + __OP[1]; // 圆心y
  48338. var r0 = style.r0 || 0; // 形内半径[0,r)
  48339. var r = style.r; // 扇形外半径(0,r]
  48340. var startAngle = style.startAngle; // 起始角度[0,360)
  48341. var endAngle = style.endAngle; // 结束角度(0,360]
  48342. var clockWise = style.clockWise || false;
  48343. startAngle = SUtil_SUtil.Util_math.degreeToRadian(startAngle);
  48344. endAngle = SUtil_SUtil.Util_math.degreeToRadian(endAngle);
  48345. if (!clockWise) {
  48346. // 扇形默认是逆时针方向,Y轴向上
  48347. // 这个跟arc的标准不一样,为了兼容echarts
  48348. startAngle = -startAngle;
  48349. endAngle = -endAngle;
  48350. }
  48351. var unitX = SUtil_SUtil.Util_math.cos(startAngle);
  48352. var unitY = SUtil_SUtil.Util_math.sin(startAngle);
  48353. ctx.moveTo(
  48354. unitX * r0 + x,
  48355. unitY * r0 + y
  48356. );
  48357. ctx.lineTo(
  48358. unitX * r + x,
  48359. unitY * r + y
  48360. );
  48361. ctx.arc(x, y, r, startAngle, endAngle, !clockWise);
  48362. ctx.lineTo(
  48363. SUtil_SUtil.Util_math.cos(endAngle) * r0 + x,
  48364. SUtil_SUtil.Util_math.sin(endAngle) * r0 + y
  48365. );
  48366. if (r0 !== 0) {
  48367. ctx.arc(x, y, r0, endAngle, startAngle, clockWise);
  48368. }
  48369. ctx.closePath();
  48370. return;
  48371. }
  48372. /**
  48373. * @function SuperMap.LevelRenderer.Shape.SmicSector.prototype.getRect
  48374. * @description 返回扇形包围盒矩形
  48375. *
  48376. * @param {Object} style - style
  48377. * @return {Object} 边框对象。包含属性:x,y,width,height。
  48378. *
  48379. */
  48380. getRect(style) {
  48381. if (style.__rect) {
  48382. return style.__rect;
  48383. }
  48384. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  48385. this.refOriginalPosition = [0, 0];
  48386. }
  48387. var __OP = this.refOriginalPosition;
  48388. var min0 = SUtil_SUtil.Util_vector.create();
  48389. var min1 = SUtil_SUtil.Util_vector.create();
  48390. var max0 = SUtil_SUtil.Util_vector.create();
  48391. var max1 = SUtil_SUtil.Util_vector.create();
  48392. var x = style.x + __OP[0]; // 圆心x
  48393. var y = style.y + __OP[1]; // 圆心y
  48394. var r0 = style.r0 || 0; // 形内半径[0,r)
  48395. var r = style.r; // 扇形外半径(0,r]
  48396. var startAngle = SUtil_SUtil.Util_math.degreeToRadian(style.startAngle);
  48397. var endAngle = SUtil_SUtil.Util_math.degreeToRadian(style.endAngle);
  48398. var clockWise = style.clockWise;
  48399. if (!clockWise) {
  48400. startAngle = -startAngle;
  48401. endAngle = -endAngle;
  48402. }
  48403. if (r0 > 1) {
  48404. SUtil_SUtil.Util_computeBoundingBox.arc(
  48405. x, y, r0, startAngle, endAngle, !clockWise, min0, max0
  48406. );
  48407. } else {
  48408. min0[0] = max0[0] = x;
  48409. min0[1] = max0[1] = y;
  48410. }
  48411. SUtil_SUtil.Util_computeBoundingBox.arc(
  48412. x, y, r, startAngle, endAngle, !clockWise, min1, max1
  48413. );
  48414. SUtil_SUtil.Util_vector.min(min0, min0, min1);
  48415. SUtil_SUtil.Util_vector.max(max0, max0, max1);
  48416. style.__rect = {
  48417. x: min0[0],
  48418. y: min0[1],
  48419. width: max0[0] - min0[0],
  48420. height: max0[1] - min0[1]
  48421. };
  48422. return style.__rect;
  48423. }
  48424. }
  48425. ;// CONCATENATED MODULE: ./src/common/overlay/feature/ShapeFactory.js
  48426. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  48427. * This program are made available under the terms of the Apache License, Version 2.0
  48428. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48429. /**
  48430. * @class SuperMap.Feature.ShapeFactory
  48431. * @category Visualization Theme
  48432. * @classdesc 图形工厂类。
  48433. * 目前支持创建的图形有:<br>
  48434. * 用于统计专题图:<br>
  48435. * 点 - 参数对象 <{@link SuperMap.Feature.ShapeParameters.Point}> <br>
  48436. * 线 - 参数对象 <{@link SuperMap.Feature.ShapeParameters.Line}> <br>
  48437. * 面 - 参数对象 <{@link SuperMap.Feature.ShapeParameters.Polygon}> <br>
  48438. * 矩形 - 参数对象 <{@link SuperMap.Feature.ShapeParameters.Rectangle}> <br>
  48439. * 扇形 - 参数对象 <{@link SuperMap.Feature.ShapeParameters.Sector}> <br>
  48440. * 标签 - 参数对象 <{@link SuperMap.Feature.ShapeParameters.Label}> <br>
  48441. * 图片 - 参数对象 <{@link SuperMap.Feature.ShapeParameters.Image}> <br>
  48442. * 用于符号专题图:<br>
  48443. * 圆形 - 参数对象:<{@link SuperMap.Feature.ShapeParameters.Cilcle}>
  48444. */
  48445. class ShapeFactory {
  48446. /**
  48447. * @function SuperMap.Feature.ShapeFactory.prototype.constructor
  48448. * @description 构建图形工厂对象。
  48449. * @param {Object} shapeParameters - 图形参数对象,<{@link SuperMap.Feature.ShapeParameters}> 子类对象,可选参数。
  48450. * @returns {SuperMap.Feature.ShapeFactory} 返回图形工厂类对象。
  48451. */
  48452. constructor(shapeParameters) {
  48453. /**
  48454. * @member {Object} SuperMap.Feature.ShapeParameters.prototype.shapeParameters
  48455. * @description 图形参数对象,<{@link SuperMap.Feature.ShapeParameters}> 子类对象。必设参数,默认值 null。
  48456. */
  48457. this.shapeParameters = shapeParameters;
  48458. this.CLASS_NAME = "SuperMap.Feature.ShapeFactory";
  48459. }
  48460. /**
  48461. * @function SuperMap.Feature.ShapeParameters.prototype.destroy
  48462. * @description 销毁图形工厂类对象。
  48463. */
  48464. destroy() {
  48465. this.shapeParameters = null;
  48466. }
  48467. /**
  48468. * @function SuperMap.Feature.ShapeParameters.prototype.createShape
  48469. * @description 创建一个图形。具体图形由 shapeParameters 决定。
  48470. * @param {Object} shapeParameters - 图形参数对象,<{@link SuperMap.Feature.ShapeParameters}> 子类对象。
  48471. * 此参数可选,如果使用此参数(不为 null),shapeParameters 属性值将被修改为参数的值,然后再使用 shapeParameters 属性值创建图形;
  48472. * 如果不使用此参数,createShape 方法将直接使用 shapeParameters 属性创建图形。
  48473. * @returns {Object} 图形对象(或 null - 图形创建失败)。
  48474. */
  48475. createShape(shapeParameters) {
  48476. if (shapeParameters) {
  48477. this.shapeParameters = shapeParameters;
  48478. }
  48479. if (!this.shapeParameters) {
  48480. return null;
  48481. }
  48482. var sps = this.shapeParameters;
  48483. if (sps instanceof Point_Point) { // 点
  48484. //设置style
  48485. let style = new Object();
  48486. style["x"] = sps.x;
  48487. style["y"] = sps.y;
  48488. style["r"] = sps.r;
  48489. style = Util.copyAttributesWithClip(style, sps.style, ['x', 'y']);
  48490. //创建图形
  48491. let shape = new SmicPoint();
  48492. shape.style = ShapeFactory.transformStyle(style);
  48493. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  48494. Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'style', 'highlightStyle']);
  48495. return shape;
  48496. } else if (sps instanceof Line_Line) { // 线
  48497. //检查参数 pointList 是否存在
  48498. if (!sps.pointList) {
  48499. return null;
  48500. }
  48501. // 设置style
  48502. let style = new Object();
  48503. style["pointList"] = sps.pointList;
  48504. style = Util.copyAttributesWithClip(style, sps.style, ['pointList']);
  48505. // 创建图形
  48506. let shape = new SmicBrokenLine();
  48507. shape.style = ShapeFactory.transformStyle(style);
  48508. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  48509. Util.copyAttributesWithClip(shape, sps, ['pointList', 'style', 'highlightStyle']);
  48510. return shape;
  48511. } else if (sps instanceof Polygon_Polygon) { // 面
  48512. //检查参数 pointList 是否存在
  48513. if (!sps.pointList) {
  48514. return null;
  48515. }
  48516. //设置style
  48517. let style = new Object();
  48518. style["pointList"] = sps.pointList;
  48519. style = Util.copyAttributesWithClip(style, sps.style, ['pointList']);
  48520. //创建图形
  48521. let shape = new SmicPolygon();
  48522. shape.style = ShapeFactory.transformStyle(style);
  48523. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  48524. Util.copyAttributesWithClip(shape, sps, ['pointList', 'style', "highlightStyle"]);
  48525. return shape;
  48526. } else if (sps instanceof Rectangle_Rectangle) { // 矩形
  48527. //检查参数 pointList 是否存在
  48528. if (!sps.x && !sps.y & !sps.width & !sps.height) {
  48529. return null;
  48530. }
  48531. //设置style
  48532. let style = new Object();
  48533. style["x"] = sps.x;
  48534. style["y"] = sps.y;
  48535. style["width"] = sps.width;
  48536. style["height"] = sps.height;
  48537. style = Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'width', 'height']);
  48538. //创建图形
  48539. let shape = new SmicRectangle();
  48540. shape.style = ShapeFactory.transformStyle(style);
  48541. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  48542. Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'width', 'height', 'style', 'highlightStyle']);
  48543. return shape;
  48544. } else if (sps instanceof Sector) { // 扇形
  48545. //设置style
  48546. let style = new Object();
  48547. style["x"] = sps.x;
  48548. style["y"] = sps.y;
  48549. style["r"] = sps.r;
  48550. style["startAngle"] = sps.startAngle;
  48551. style["endAngle"] = sps.endAngle;
  48552. if (sps["r0"]) {
  48553. style["r0"] = sps.r0
  48554. }
  48555. if (sps["clockWise"]) {
  48556. style["clockWise"] = sps.clockWise
  48557. }
  48558. style = Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'r', 'startAngle', 'endAngle', 'r0', 'endAngle']);
  48559. //创建图形
  48560. let shape = new SmicSector();
  48561. shape.style = ShapeFactory.transformStyle(style);
  48562. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  48563. Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'r', 'startAngle', 'endAngle', 'r0', 'endAngle', 'style', 'highlightStyle']);
  48564. return shape;
  48565. } else if (sps instanceof Label) { // 标签
  48566. //设置style
  48567. let style = new Object();
  48568. style["x"] = sps.x;
  48569. style["y"] = sps.y;
  48570. style["text"] = sps.text;
  48571. style = Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'text']);
  48572. //创建图形
  48573. let shape = new SmicText();
  48574. shape.style = ShapeFactory.transformStyle(style);
  48575. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  48576. Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'text', 'style', 'highlightStyle']);
  48577. return shape;
  48578. } else if (sps instanceof Image_Image) { // 图片
  48579. //设置style
  48580. let style = new Object();
  48581. style["x"] = sps.x;
  48582. style["y"] = sps.y;
  48583. if (sps["image"]) {
  48584. style["image"] = sps.image;
  48585. }
  48586. if (sps["width"]) {
  48587. style["width"] = sps.width;
  48588. }
  48589. if (sps["height"]) {
  48590. style["height"] = sps.height;
  48591. }
  48592. if (sps["sx"]) {
  48593. style["sx"] = sps.sx;
  48594. }
  48595. if (sps["sy"]) {
  48596. style["sy"] = sps.sy;
  48597. }
  48598. if (sps["sWidth"]) {
  48599. style["sWidth"] = sps.sWidth
  48600. }
  48601. if (sps["sHeight"]) {
  48602. style["sHeight"] = sps.sHeight
  48603. }
  48604. style = Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'image', 'width', 'height', 'sx', 'sy', 'sWidth', 'sHeight']);
  48605. //创建图形
  48606. let shape = new SmicImage();
  48607. shape.style = ShapeFactory.transformStyle(style);
  48608. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  48609. Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'image', 'width', 'height', 'style', 'highlightStyle']);
  48610. return shape;
  48611. } else if (sps instanceof Circle_Circle) { //圆形 用于符号专题图
  48612. //设置stytle
  48613. let style = new Object();
  48614. style["x"] = sps.x;
  48615. style["r"] = sps.r;
  48616. style["y"] = sps.y;
  48617. style = Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'r']);
  48618. //创建图形
  48619. let shape = new SmicCircle();
  48620. shape.style = ShapeFactory.transformStyle(style);
  48621. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  48622. Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'r', 'style', 'highlightStyle', 'lineWidth', 'text', 'textPosition']);
  48623. return shape;
  48624. }
  48625. return null
  48626. }
  48627. /**
  48628. * @function SuperMap.Feature.ShapeParameters.prototype.transformStyle
  48629. * @description 将用户 feature.style (类 Svg style 标准) 的样式,转换为 levelRenderer 的样式标准(类 CSS-Canvas 样式)
  48630. * @param {Object} style - 用户 style。
  48631. * @returns {Object} 符合 levelRenderer 的 style。
  48632. */
  48633. static transformStyle(style) {
  48634. var newStyle = {};
  48635. //字体 ["font-style", "font-variant", "font-weight", "font-size / line-height", "font-family"];
  48636. var fontStr = ["normal", "normal", "normal", "12", "arial,sans-serif"];
  48637. //画笔类型 ["fill", "stroke"];
  48638. var brushType = [true, false];
  48639. for (var ss in style) {
  48640. switch (ss) {
  48641. case "fill":
  48642. brushType[0] = style[ss];
  48643. break;
  48644. case "fillColor":
  48645. newStyle["color"] = style[ss];
  48646. break;
  48647. case "stroke":
  48648. brushType[1] = style[ss];
  48649. break;
  48650. case "strokeWidth":
  48651. newStyle["lineWidth"] = style[ss];
  48652. break;
  48653. case "strokeLinecap":
  48654. newStyle["lineCap"] = style[ss];
  48655. break;
  48656. case "strokeLineJoin":
  48657. newStyle["lineJoin"] = style[ss];
  48658. break;
  48659. case "strokeDashstyle":
  48660. newStyle["lineType"] = style[ss];
  48661. break;
  48662. case "pointRadius":
  48663. newStyle["r"] = style[ss];
  48664. break;
  48665. case "label":
  48666. newStyle["text"] = style[ss];
  48667. break;
  48668. case "labelRect":
  48669. newStyle["labelRect"] = style[ss];
  48670. break;
  48671. case "fontColor":
  48672. newStyle["textColor"] = style[ss];
  48673. break;
  48674. case "fontStyle":
  48675. fontStr[0] = style[ss];
  48676. break;
  48677. case "fontVariant":
  48678. fontStr[1] = style[ss];
  48679. break;
  48680. case "fontWeight":
  48681. fontStr[2] = style[ss];
  48682. break;
  48683. case "fontSize":
  48684. var unit = "";
  48685. if (style[ss] && style[ss].toString().indexOf("px") < 0) {
  48686. unit = "px";
  48687. }
  48688. fontStr[3] = style[ss] + unit;
  48689. break;
  48690. case "fontFamily":
  48691. fontStr[4] = style[ss];
  48692. break;
  48693. case "fontOpacity":
  48694. newStyle["opacity"] = style[ss];
  48695. break;
  48696. case "labelPosition":
  48697. newStyle["textPosition"] = style[ss];
  48698. break;
  48699. case "labelAlign":
  48700. newStyle["textAlign"] = style[ss];
  48701. break;
  48702. case "labelBaseline":
  48703. newStyle["textBaseline"] = style[ss];
  48704. break;
  48705. case "labelRotation":
  48706. newStyle["textRotation"] = style[ss];
  48707. break;
  48708. default:
  48709. newStyle[ss] = style[ss];
  48710. break;
  48711. }
  48712. }
  48713. //拼接字体字符串
  48714. newStyle["textFont"] = fontStr.join(" ");
  48715. //画笔类型
  48716. if (brushType[0] === true && brushType[1] === false) {
  48717. newStyle["brushType"] = "fill";
  48718. } else if (brushType[0] === false && brushType[1] === true) {
  48719. newStyle["brushType"] = "stroke";
  48720. } else if (brushType[0] === true && brushType[1] === true) {
  48721. newStyle["brushType"] = "both";
  48722. } else {
  48723. newStyle["brushType"] = "fill";
  48724. }
  48725. //默认线宽 1
  48726. if (newStyle["lineWidth"] == null) {
  48727. newStyle["lineWidth"] = 1;
  48728. }
  48729. return newStyle;
  48730. }
  48731. /**
  48732. * @function SuperMap.Feature.ShapeParameters.prototype.Background
  48733. * @description 创建一个矩形背景框图形对象。
  48734. * @param {SuperMap.Feature.ShapeFactory} shapeFactory - 图形工厂对象,必设参数。
  48735. * @param {Array.<number>} box - 框区域,长度为 4 的一维数组,像素坐标,[left, bottom, right, top],必设参数。
  48736. * @param {Object} setting - 图表配置参数,必设参数。本函数中图形配置对象 setting 可设属性:
  48737. * @param {Object} setting.backgroundStyle - 背景样式,此样式对象对象可设属性:<SuperMap.Feature.ShapeParameters.Rectangle#style>。
  48738. * @param {Array} [setting.backgroundRadius=[0,0,0,0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4,则 backgroundRadius 为 [r1、r2、r3、r4 ]。
  48739. * @returns {Object} 背景框图形,一个可视化图形(矩形)对象。
  48740. */
  48741. static Background(shapeFactory, box, setting) {
  48742. var sets = setting ? setting : {};
  48743. // 背景框图形参数对象
  48744. var bgSP = new Rectangle_Rectangle(box[0], box[3], Math.abs(box[2] - box[0]), Math.abs(box[3] - box[1]));
  48745. // 默认样式
  48746. bgSP.style = {
  48747. fillColor: "#f3f3f3"
  48748. };
  48749. // 设置用户 style
  48750. if (sets.backgroundStyle) {
  48751. Util.copyAttributesWithClip(bgSP.style, sets.backgroundStyle);
  48752. }
  48753. // 设置背景框圆角参数
  48754. if (sets.backgroundRadius) {
  48755. bgSP.style["radius"] = sets.backgroundRadius;
  48756. }
  48757. // 禁止背景框响应事件
  48758. bgSP.clickable = false;
  48759. bgSP.hoverable = false;
  48760. return shapeFactory.createShape(bgSP);
  48761. }
  48762. /**
  48763. * @function SuperMap.Feature.ShapeParameters.prototype.GraphAxis
  48764. * @description 创建一个统计图表坐标轴图形对象组。
  48765. * @param {SuperMap.Feature.ShapeFactory} shapeFactory - 图形工厂对象,必设参数。
  48766. * @param {Array.<number>} dataViewBox - 统计图表模型的数据视图框,长度为 4 的一维数组,像素坐标,[left, bottom, right, top],必设参数。
  48767. * @param {Object} setting - 图表配置参数,必设参数。
  48768. * @param {Object} setting.axisStyle - 坐标轴样式,此样式对象对象可设属性:<SuperMap.Feature.ShapeParameters.Line#style>。
  48769. * @param {boolean} [setting.axisUseArrow=false] - 坐标轴是否使用箭头。
  48770. * @param {number} [setting.axisYTick=0] - y 轴刻度数量,0表示不使用箭头。
  48771. * @param {Array.<string>} setting.axisYLabels - y 轴上的标签组内容,标签顺序沿着数据视图框左面条边自上而下,等距排布。例如:["1000", "750", "500", "250", "0"]。
  48772. * @param {Object} setting.axisYLabelsStyle - y 轴上的标签组样式,此样式对象对象可设属性:<SuperMap.Feature.ShapeParameters.Label#style>。
  48773. * @param {Array.<number>} [setting.axisYLabelsOffset=[0,0]] - y 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 y 轴标签组横向上的偏移量,向左为正,默认值:0;数组第二项表示 y 轴标签组纵向上的偏移量,向下为正,默认值:0。
  48774. * @param {Array.<string>} setting.axisXLabels - x 轴上的标签组内容,标签顺序沿着数据视图框下面条边自左向右排布,例如:["92年", "95年", "99年"]。
  48775. * 标签排布规则:当标签数量与 xShapeInfo 中的属性 xPositions 数量相同(即标签个数与数据个数相等时), 按照 xPositions 提供的位置在水平方向上排布标签,否则沿数据视图框下面条边等距排布标签。
  48776. * @param {Object} setting.axisXLabelsStyle - x 轴上的标签组样式,此样式对象对象可设属性:<SuperMap.Feature.ShapeParameters.Label#style>。
  48777. * @param {Array.<number>} [setting.axisXLabelsOffset=[0,0]] - x 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 x 轴标签组横向上的偏移量,向左为正,默认值:0;数组第二项表示 x 轴标签组纵向上的偏移量,向下为正,默认值:0。
  48778. * @param {boolean} setting.useXReferenceLine - 是否使用水平参考线,如果为 true,在 axisYTick 大于 0 时有效,水平参考线是 y 轴刻度在数据视图框里的延伸。
  48779. * @param {Object} setting.xReferenceLineStyle - 水平参考线样式,此样式对象对象可设属性:<SuperMap.Feature.ShapeParameters.Line#style>。
  48780. * @param {number} [setting.axis3DParameter=0] - 3D 坐标轴参数,此属性值在大于等于 15 时有效。
  48781. * @param {Object} xShapeInfo - X 方向上的图形信息对象,包含两个属性。
  48782. * @param {Array.<number>} xShapeInfo.xPositions - 图形在 x 轴方向上的像素坐标值,是一个一维数组,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  48783. * @param {number} xShapeInfo.width - 图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  48784. * @returns {Array.<Object>} 统计图表坐标轴图形对象数组。
  48785. */
  48786. static GraphAxis(shapeFactory, dataViewBox, setting, xShapeInfo) {
  48787. var dvb = dataViewBox;
  48788. var sets = setting ? setting : {};
  48789. // 参考线图形对象组
  48790. var refLines = [];
  48791. //坐标轴箭头对象组
  48792. var arrows = [];
  48793. // 是否使用参水平考线,默认不使用
  48794. var isAddRefLine = sets.useXReferenceLine ? sets.useXReferenceLine : false;
  48795. // y 轴上的刻度
  48796. var axisytick = (sets.axisYTick && !isNaN(sets.axisYTick)) ? sets.axisYTick : 0;
  48797. // 坐标轴节点数组
  48798. var pois = [];
  48799. //z 轴箭头数组
  48800. var zArrowPois = [];
  48801. // x,y 轴主干节点数组
  48802. var xMainPois = [];
  48803. if (axisytick == 0) {
  48804. xMainPois.push([dvb[0], dvb[3] - 5]);
  48805. xMainPois.push([dvb[0], dvb[1]]);
  48806. // 3D 坐标轴 第三象限平分线
  48807. if (sets.axis3DParameter && !isNaN(sets.axis3DParameter) && sets.axis3DParameter >= 15) {
  48808. let axis3DParameter = parseInt(sets.axis3DParameter);
  48809. let axis3DPoi = [dvb[0] - axis3DParameter, dvb[1] + axis3DParameter];
  48810. // 添加 3D 轴节点
  48811. if (sets.axisUseArrow) { // 添加 3D 轴箭头节点坐标
  48812. //箭头坐标
  48813. zArrowPois.push([axis3DPoi[0] + 1.5, axis3DPoi[1] - 7.5]);
  48814. zArrowPois.push([axis3DPoi[0] - 1, axis3DPoi[1] + 1]);
  48815. zArrowPois.push([axis3DPoi[0] + 7.5, axis3DPoi[1] - 1.5]);
  48816. //3D轴
  48817. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  48818. } else {
  48819. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  48820. }
  48821. xMainPois.push([dvb[0], dvb[1]]);
  48822. }
  48823. xMainPois.push([dvb[2] + 5, dvb[1]]);
  48824. } else {
  48825. // 单位刻度长度
  48826. var unitTick = Math.abs(dvb[1] - dvb[3]) / axisytick;
  48827. // 刻度 y 坐标
  48828. var thckY = dvb[3];
  48829. xMainPois.push([dvb[0], thckY - 5]);
  48830. for (var i = 0; i < axisytick; i++) {
  48831. xMainPois.push([dvb[0], thckY]);
  48832. xMainPois.push([dvb[0] - 5, thckY]);
  48833. xMainPois.push([dvb[0], thckY]);
  48834. // 参考线
  48835. if (isAddRefLine) {
  48836. // 参考线参数对象
  48837. var refLineSP = new Line_Line([
  48838. [dvb[0], thckY],
  48839. [dvb[2], thckY]
  48840. ]);
  48841. // 参考线默认样式对象
  48842. refLineSP.style = {
  48843. strokeColor: "#cfcfcf",
  48844. strokeLinecap: "butt",
  48845. strokeLineJoin: "round",
  48846. strokeWidth: 1
  48847. };
  48848. // 禁止事件
  48849. refLineSP.clickable = false;
  48850. refLineSP.hoverable = false;
  48851. // 用户style
  48852. if (sets.xReferenceLineStyle) {
  48853. Util.copyAttributesWithClip(refLineSP.style, sets.xReferenceLineStyle);
  48854. }
  48855. // 生成参考线图形对象
  48856. refLines.push(shapeFactory.createShape(refLineSP))
  48857. }
  48858. // y 刻度增量
  48859. thckY += unitTick;
  48860. }
  48861. xMainPois.push([dvb[0], dvb[1]]);
  48862. // 3D 坐标轴 第三象限平分线
  48863. if (sets.axis3DParameter && !isNaN(sets.axis3DParameter) && sets.axis3DParameter >= 15) {
  48864. let axis3DParameter = parseInt(sets.axis3DParameter);
  48865. let axis3DPoi = [dvb[0] - axis3DParameter, dvb[1] + axis3DParameter];
  48866. /*
  48867. // 箭头计算过程
  48868. var axis3DPoiRef = [axis3DPoi[0] + 7, axis3DPoi[1] - 7]; // 7 是 10 为斜边 cos(45度)时邻边的值
  48869. var axis3DPoiLT = [axis3DPoiRef[0] - 4, axis3DPoiRef[1] - 4];
  48870. var axis3DPoiRB = [axis3DPoiRef[0] + 4, axis3DPoiRef[1] + 4];
  48871. if(sets.axisUseArrow){
  48872. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  48873. xMainPois.push([axis3DPoiLT[0], axis3DPoiLT[1]]);
  48874. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  48875. xMainPois.push([axis3DPoiRB[0], axis3DPoiRB[1]]);
  48876. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  48877. }
  48878. else{
  48879. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  48880. }
  48881. */
  48882. // 添加 3D 轴节点
  48883. if (sets.axisUseArrow) { // 添加 3D 轴和箭头坐标
  48884. //箭头坐标
  48885. zArrowPois.push([axis3DPoi[0] + 1.5, axis3DPoi[1] - 7.5]);
  48886. zArrowPois.push([axis3DPoi[0] - 1, axis3DPoi[1] + 1]);
  48887. zArrowPois.push([axis3DPoi[0] + 7.5, axis3DPoi[1] - 1.5]);
  48888. //3D轴
  48889. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  48890. } else {
  48891. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  48892. }
  48893. xMainPois.push([dvb[0], dvb[1]]);
  48894. }
  48895. xMainPois.push([dvb[2] + 5, dvb[1]]);
  48896. }
  48897. // 坐标轴箭头
  48898. if (sets.axisUseArrow) {
  48899. // x 轴箭头节点数组
  48900. var xArrowPois = [
  48901. [dvb[2] + 5, dvb[1] + 4],
  48902. [dvb[2] + 13, dvb[1]],
  48903. [dvb[2] + 5, dvb[1] - 4]
  48904. ];
  48905. // y 轴箭头节点数组
  48906. var yArrowPois = [
  48907. [dvb[0] - 4, dvb[3] - 5],
  48908. [dvb[0], dvb[3] - 13],
  48909. [dvb[0] + 4, dvb[3] - 5]
  48910. ];
  48911. //x轴箭头
  48912. var xSP = new Polygon_Polygon(xArrowPois);
  48913. xSP.style = {fillColor: "#008acd"};
  48914. Util.copyAttributesWithClip(xSP.style, sets.axisStyle);
  48915. arrows.push(shapeFactory.createShape(xSP));
  48916. //y轴箭头
  48917. var ySP = new Polygon_Polygon(yArrowPois);
  48918. ySP.style = {fillColor: "#008acd"};
  48919. Util.copyAttributesWithClip(ySP.style, sets.axisStyle);
  48920. arrows.push(shapeFactory.createShape(ySP));
  48921. // z轴箭头 坐标轴箭头是否要使用
  48922. if (sets.axis3DParameter && !isNaN(sets.axis3DParameter) && sets.axis3DParameter >= 15) {
  48923. var zSP = new Polygon_Polygon(zArrowPois);
  48924. zSP.style = {fillColor: "#008acd"};
  48925. Util.copyAttributesWithClip(zSP.style, sets.axisStyle);
  48926. arrows.push(shapeFactory.createShape(zSP));
  48927. }
  48928. }
  48929. //不带箭头的坐标轴
  48930. pois = xMainPois;
  48931. // 坐标轴参数对象
  48932. var axisSP = new Line_Line(pois);
  48933. // 坐标轴默认style
  48934. axisSP.style = {
  48935. strokeLinecap: "butt",
  48936. strokeLineJoin: "round",
  48937. strokeColor: "#008acd",
  48938. strokeWidth: 1
  48939. };
  48940. // 用户 style
  48941. if (sets.axisStyle) {
  48942. Util.copyAttributesWithClip(axisSP.style, sets.axisStyle);
  48943. }
  48944. // 禁止事件
  48945. axisSP.clickable = false;
  48946. axisSP.hoverable = false;
  48947. // 创建坐标轴图形对象
  48948. var axisMain = [shapeFactory.createShape(axisSP)];
  48949. // Y 轴标签
  48950. var yLabels = [];
  48951. if (sets.axisYLabels && sets.axisYLabels.length && sets.axisYLabels.length > 0) {
  48952. var axisYLabels = sets.axisYLabels;
  48953. let len = axisYLabels.length;
  48954. // 标签偏移量
  48955. var ylOffset = [0, 0];
  48956. if (sets.axisYLabelsOffset && sets.axisYLabelsOffset.length) {
  48957. ylOffset = sets.axisYLabelsOffset;
  48958. }
  48959. if (len == 1) {
  48960. // 标签参数对象
  48961. let labelYSP = new Label(dvb[0] - 5 + ylOffset[0], dvb[3] + ylOffset[1], axisYLabels[0]);
  48962. labelYSP.style = {
  48963. labelAlign: "right"
  48964. };
  48965. // 用户 style
  48966. if (sets.axisYLabelsStyle) {
  48967. Util.copyAttributesWithClip(labelYSP.style, sets.axisYLabelsStyle);
  48968. }
  48969. // 禁止事件
  48970. labelYSP.clickable = false;
  48971. labelYSP.hoverable = false;
  48972. // 制作标签
  48973. yLabels.push(shapeFactory.createShape(labelYSP));
  48974. } else {
  48975. var labelY = dvb[3];
  48976. // y 轴标签单位距离
  48977. var yUnit = Math.abs(dvb[1] - dvb[3]) / (len - 1);
  48978. for (var j = 0; j < len; j++) {
  48979. // 标签参数对象
  48980. let labelYSP = new Label(dvb[0] - 5 + ylOffset[0], labelY + ylOffset[1], axisYLabels[j]);
  48981. labelYSP.style = {
  48982. labelAlign: "right"
  48983. };
  48984. // 用户 style
  48985. if (sets.axisYLabelsStyle) {
  48986. Util.copyAttributesWithClip(labelYSP.style, sets.axisYLabelsStyle);
  48987. }
  48988. // 禁止事件
  48989. labelYSP.clickable = false;
  48990. labelYSP.hoverable = false;
  48991. // 制作标签
  48992. yLabels.push(shapeFactory.createShape(labelYSP));
  48993. // y 轴标签 y 方向增量
  48994. labelY += yUnit;
  48995. }
  48996. }
  48997. }
  48998. // X 轴标签
  48999. var xLabels = [];
  49000. if (sets.axisXLabels && sets.axisXLabels.length && sets.axisXLabels.length > 0) {
  49001. let axisXLabels = sets.axisXLabels;
  49002. let len = axisXLabels.length;
  49003. // 标签偏移量
  49004. let xlOffset = [0, 0];
  49005. if (sets.axisXLabelsOffset && sets.axisXLabelsOffset.length) {
  49006. xlOffset = sets.axisXLabelsOffset;
  49007. }
  49008. // 标签个数与数据字段个数相等等时,标签在 x 轴均匀排列
  49009. if (xShapeInfo && xShapeInfo.xPositions && xShapeInfo.xPositions.length && xShapeInfo.xPositions.length == len) {
  49010. let xsCenter = xShapeInfo.xPositions;
  49011. for (let K = 0; K < len; K++) {
  49012. // 标签参数对象
  49013. let labelXSP = new Label(xsCenter[K] + xlOffset[0], dvb[1] + xlOffset[1], axisXLabels[K]);
  49014. // 默认 style
  49015. labelXSP.style = {
  49016. labelAlign: "center",
  49017. labelBaseline: "top"
  49018. };
  49019. // 用户 style
  49020. if (sets.axisXLabelsStyle) {
  49021. Util.copyAttributesWithClip(labelXSP.style, sets.axisXLabelsStyle);
  49022. }
  49023. // 禁止事件
  49024. labelXSP.clickable = false;
  49025. labelXSP.hoverable = false;
  49026. // 创建标签对象
  49027. xLabels.push(shapeFactory.createShape(labelXSP));
  49028. }
  49029. } else {
  49030. if (len == 1) {
  49031. // 标签参数对象
  49032. let labelXSP = new Label(dvb[0] - 5 + xlOffset[0], dvb[1] + xlOffset[0], axisXLabels[0]);
  49033. // 默认 style
  49034. labelXSP.style = {
  49035. labelAlign: "center",
  49036. labelBaseline: "top"
  49037. };
  49038. // 用户 style
  49039. if (sets.axisXLabelsStyle) {
  49040. Util.copyAttributesWithClip(labelXSP.style, sets.axisXLabelsStyle);
  49041. }
  49042. // 禁止事件
  49043. labelXSP.clickable = false;
  49044. labelXSP.hoverable = false;
  49045. // 创建标签对象
  49046. xLabels.push(shapeFactory.createShape(labelXSP));
  49047. } else {
  49048. let labelX = dvb[0];
  49049. // x 轴标签单位距离
  49050. let xUnit = Math.abs(dvb[2] - dvb[0]) / (len - 1);
  49051. for (let m = 0; m < len; m++) {
  49052. // 标签参数对象
  49053. let labelXSP = new Label(labelX + xlOffset[0], dvb[1] + xlOffset[1], axisXLabels[m]);
  49054. // 默认 style
  49055. labelXSP.style = {
  49056. labelAlign: "center",
  49057. labelBaseline: "top"
  49058. };
  49059. // 用户 style
  49060. if (sets.axisXLabelsStyle) {
  49061. Util.copyAttributesWithClip(labelXSP.style, sets.axisXLabelsStyle);
  49062. }
  49063. // 禁止事件
  49064. labelXSP.clickable = false;
  49065. labelXSP.hoverable = false;
  49066. // 创建标签对象
  49067. xLabels.push(shapeFactory.createShape(labelXSP));
  49068. // x 轴标签 x 方向增量
  49069. labelX += xUnit;
  49070. }
  49071. }
  49072. }
  49073. }
  49074. // 组装并返回构成坐标轴的图形
  49075. return ((refLines.concat(axisMain)).concat(yLabels)).concat(xLabels).concat(arrows);
  49076. }
  49077. /**
  49078. * @function SuperMap.Feature.ShapeParameters.prototype.ShapeStyleTool
  49079. * @description 一个图形 style 处理工具。此工具将指定的默认 style,通用 style,按 styleGroup 取得的 style 和按数据值 value 范围取得的 style 进行合并,得到图形最终的 style。
  49080. * @param {Object} defaultStyle - 默认style,此样式对象可设属性根据图形类型参考 <{@link SuperMap.Feature.ShapeParameters}> 子类对象的 style 属性。
  49081. * @param {Object} style - 图形对象基础 style,此参数控制图形的基础样式,可设属性根据图形类型参考 <{@link SuperMap.Feature.ShapeParameters}> 子类对象的 style 属性。优先级低于 styleGroup,styleByCodomain。
  49082. * @param {Array.<Object>} styleGroup - 一个 style 数组,优先级低于 styleByCodomain,高于 style。此数组每个元素是样式对象,
  49083. * 其可设属性根据图形类型参考 <{@link SuperMap.Feature.ShapeParameters}> 子类对象的 style 属性。通过 index 参数从 styleGroup 中取 style。
  49084. * @param {Array.<Object>} styleByCodomain - 按数据(参数 value)所在值域范围控制数据的可视化对象样式。
  49085. * (start code)
  49086. * // styleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  49087. * // start: 值域值下限(包含);
  49088. * // end: 值域值上限(不包含);
  49089. * // style: 数据可视化图形的 style,其可设属性根据图形类型参考 <SuperMap.Feature.ShapeParameters> 子类对象的 style 属性。。
  49090. * // dataStyleByCodomain 数组形如:
  49091. * [
  49092. * {
  49093. * start:0,
  49094. * end:250,
  49095. * style:{
  49096. * fillColor:"#00CD00"
  49097. * }
  49098. * },
  49099. * {
  49100. * start:250,
  49101. * end:500,
  49102. * style:{
  49103. * fillColor:"#00EE00"
  49104. * }
  49105. * },
  49106. * {
  49107. * start:500,
  49108. * end:750,
  49109. * style:{
  49110. * fillColor:"#00FF7F"
  49111. * }
  49112. * },
  49113. * {
  49114. * start:750,
  49115. * end:1500,
  49116. * style:{
  49117. * fillColor:"#00FF00"
  49118. * }
  49119. * }
  49120. * ]
  49121. * (end)
  49122. * @param {number} index - styleGroup 的索引值,用于取出 styleGroup 指定的 style。
  49123. * @param {number} value - 数据值,用于取出 styleByCodomain 指定的 style。
  49124. * @returns {Object} 合并后的样式 (style) 对象。
  49125. */
  49126. static ShapeStyleTool(defaultStyle, style, styleGroup, styleByCodomain, index, value) {
  49127. // 用 defaultStyle 初始化 style 对象
  49128. var finalStyle = defaultStyle ? defaultStyle : {};
  49129. // 基础 style
  49130. if (style) {
  49131. Util.copyAttributesWithClip(finalStyle, style);
  49132. }
  49133. // 按索引赋 style
  49134. if (styleGroup && styleGroup.length && typeof(index) !== "undefined" && !isNaN(index) && index >= 0) {
  49135. if (styleGroup[index]) {
  49136. Util.copyAttributesWithClip(finalStyle, styleGroup[index]);
  49137. }
  49138. }
  49139. // 按值域赋 style
  49140. if (styleByCodomain && styleByCodomain.length && typeof(value) !== "undefined") {
  49141. var dsc = styleByCodomain;
  49142. var dscLen = dsc.length;
  49143. var v = parseFloat(value);
  49144. for (var i = 0; i < dscLen; i++) {
  49145. if (dsc[i].start <= v && v < dsc[i].end) {
  49146. Util.copyAttributesWithClip(finalStyle, dsc[i].style);
  49147. break;
  49148. }
  49149. }
  49150. }
  49151. return finalStyle;
  49152. }
  49153. }
  49154. SuperMap.Feature = SuperMap.Feature || {};
  49155. SuperMap.Feature.ShapeFactory = ShapeFactory;
  49156. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Theme.js
  49157. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  49158. * This program are made available under the terms of the Apache License, Version 2.0
  49159. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49160. /**
  49161. * @class SuperMap.Feature.Theme
  49162. * @category Visualization Theme
  49163. * @classdesc 专题要素基类,此类不可实例化。
  49164. */
  49165. class Theme_Theme {
  49166. /**
  49167. * @function SuperMap.Feature.Theme.prototype.constructor
  49168. * @description 构造函数。
  49169. * @param {Object} data - 用户数据,用于生成可视化 shape,必设参数。
  49170. * @param {SuperMap.Layer.Theme} layer - 此专题要素所在图层,必设参数。
  49171. * @returns {SuperMap.Feature.Theme} 返回一个专题要素。
  49172. */
  49173. constructor(data, layer) {
  49174. if (!data) {
  49175. return;
  49176. }
  49177. // layer 必须已经添加到地图, 且已初始化渲染器
  49178. if (!layer || !layer.map || !layer.renderer) {
  49179. return;
  49180. }
  49181. /**
  49182. * @member {string} SuperMap.Feature.Theme.prototype.id
  49183. * @description 专题要素唯一标识。
  49184. */
  49185. this.id = Util.createUniqueID(this.CLASS_NAME + "_");
  49186. /**
  49187. * @member {SuperMap.LonLat} SuperMap.Feature.Theme.prototype.lonlat
  49188. * @description 专题要素地理参考位置。子类中必须根据用户数据(或地理位置参数)对其赋值。
  49189. */
  49190. this.lonlat = null;
  49191. /**
  49192. * @member {Array} SuperMap.Feature.Theme.prototype.location
  49193. * @description 专题要素像素参考位置。通常由地理参考位置决定。长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  49194. */
  49195. this.location = [];
  49196. /**
  49197. * @readonly
  49198. * @member {Object} SuperMap.Feature.Theme.prototype.data
  49199. * @description 用户数据,用于生成可视化 shape,可在子类中规定数据格式或类型,如:<SuperMap.Feature.Vector>。
  49200. */
  49201. this.data = data;
  49202. /**
  49203. * @readonly
  49204. * @member {Array} SuperMap.Feature.Theme.prototype.shapes
  49205. * @description 构成此专题要素的可视化图形对象数组,数组顺序控制渲染。
  49206. */
  49207. this.shapes = [];
  49208. /**
  49209. * @readonly
  49210. * @member {SuperMap.Layer.Theme} SuperMap.Feature.Theme.prototype.layer
  49211. * @description 此专题要素所在专题图层。
  49212. */
  49213. this.layer = layer;
  49214. this.CLASS_NAME = "SuperMap.Feature.Theme";
  49215. }
  49216. /**
  49217. * @function SuperMap.Feature.Theme.prototype.destroy
  49218. * @description 销毁专题要素。
  49219. */
  49220. destroy() {
  49221. this.data = null;
  49222. this.id = null;
  49223. this.lonlat = null;
  49224. this.location = null;
  49225. this.shapes = null;
  49226. this.layer = null;
  49227. }
  49228. /**
  49229. * @function SuperMap.Feature.Theme.prototype.getLocalXY
  49230. * @description 地理坐标转为像素坐标。
  49231. * @param {(SuperMap.Geometry.Point|SuperMap.Geometry.GeoText|SuperMap.LonLat)} coordinate - 地理坐标点。
  49232. * @returns {Array} 长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  49233. */
  49234. getLocalXY(coordinate) {
  49235. var resolution = this.layer.map.getResolution();
  49236. var extent = this.layer.map.getExtent();
  49237. if (coordinate instanceof Point || coordinate instanceof GeoText) {
  49238. let x = (coordinate.x / resolution + (-extent.left / resolution));
  49239. let y = ((extent.top / resolution) - coordinate.y / resolution);
  49240. return [x, y];
  49241. } else if (coordinate instanceof LonLat) {
  49242. let x = (coordinate.lon / resolution + (-extent.left / resolution));
  49243. let y = ((extent.top / resolution) - coordinate.lat / resolution);
  49244. return [x, y];
  49245. } else {
  49246. return null;
  49247. }
  49248. }
  49249. }
  49250. SuperMap.Feature = SuperMap.Feature || {};
  49251. SuperMap.Feature.Theme = Theme_Theme;
  49252. ;// CONCATENATED MODULE: ./src/common/overlay/Graph.js
  49253. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  49254. * This program are made available under the terms of the Apache License, Version 2.0
  49255. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49256. /**
  49257. * @class SuperMap.Feature.Theme.Graph
  49258. * @classdesc 统计专题要素基类。
  49259. * @category Visualization Theme
  49260. * @description 此类定义了统计专题要素基础模型,具体的图表模型通过继承此类,在子类中实现 assembleShapes 方法。
  49261. * 统计专题要素模型采用了可视化图形大小自适应策略,用较少的参数控制着图表诸多图形,图表配置对象 <SuperMap.Feature.Theme.Graph.setting> 的基础属性只有 7 个,
  49262. * 它们控制着图表结构、值域范围、数据小数位等基础图表形态。构成图表的图形必须在图表结构里自适应大小。
  49263. * 此类不可实例化,此类的可实例化子类必须实现 assembleShapes() 方法。
  49264. * @extends SuperMap.Feature.Theme
  49265. * @param {SuperMap.Feature.Vector} data - 用户数据。
  49266. * @param {SuperMap.Layer.Theme} layer - 此专题要素所在图层。
  49267. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  49268. * @param {Object} setting - 图表配置对象。
  49269. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  49270. */
  49271. class Graph extends Theme_Theme {
  49272. constructor(data, layer, fields, setting, lonlat, options) {
  49273. super(data, layer, fields, setting, lonlat, options);
  49274. /**
  49275. * @member {SuperMap.Feature.ShapeFactory} SuperMap.Feature.Theme.Graph.prototype.shapeFactory
  49276. * @description 内置的图形工厂对象,调用其 createShape 方法创建图形。
  49277. */
  49278. this.shapeFactory = new ShapeFactory();
  49279. /**
  49280. * @member {Object} SuperMap.Feature.Theme.Graph.prototype.shapeParameters
  49281. * @description 当前图形参数对象,<SuperMap.Feature.ShapeParameters> 的子类对象。
  49282. */
  49283. this.shapeParameters = null;
  49284. /**
  49285. * @member {boolean} [SuperMap.Feature.Theme.Graph.prototype.RelativeCoordinate]
  49286. * @description 图形是否已经计算了相对坐标。
  49287. */
  49288. this.RelativeCoordinate = false;
  49289. /**
  49290. * @member {Object} SuperMap.Feature.Theme.Graph.prototype.setting
  49291. * @description 图表配置对象,该对象控制着图表的可视化显示。
  49292. * @param {number} width - 专题要素(图表)宽度。
  49293. * @param {number} height - 专题要素(图表)高度。
  49294. * @param {Array.<number>} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  49295. * @param {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  49296. * @param {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  49297. * @param {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox
  49298. * (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  49299. * @param {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。
  49300. * 如果不设置此参数,在取数据值时不对数据做小数位处理。
  49301. *
  49302. */
  49303. this.setting = null;
  49304. /**
  49305. * @readonly
  49306. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.origonPoint
  49307. * @description 专题要素(图表)原点,图表左上角点像素坐标,是长度为 2 的一维数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  49308. */
  49309. this.origonPoint = null;
  49310. /**
  49311. * @readonly
  49312. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.chartBox
  49313. * @description 专题要素(图表)区域,即图表框,长度为 4 的一维数组,数组的 4 个元素依次表示图表框左端 x 坐标值、
  49314. * 下端 y坐标值、 右端 x坐标值、 上端 y 坐标值;[left, bottom, right, top]。
  49315. */
  49316. this.chartBox = null;
  49317. /**
  49318. * @readonly
  49319. * @member {SuperMap.Bounds} SuperMap.Feature.Theme.Graph.prototype.chartBounds
  49320. * @description 图表 Bounds 随着 lonlat、XOffset、YOffset 更新,注意 chartBounds 是图表像素范围,不是地理范围。
  49321. */
  49322. this.chartBounds = null;
  49323. /**
  49324. * @readonly
  49325. * @member {number} SuperMap.Feature.Theme.Graph.prototype.width
  49326. * @description 专题要素(图表)宽度 。
  49327. */
  49328. this.width = null;
  49329. /**
  49330. * @readonly
  49331. * @member {number} SuperMap.Feature.Theme.Graph.prototype.height
  49332. * @description 专题要素(图表)高度 。
  49333. */
  49334. this.height = null;
  49335. /**
  49336. * @readonly
  49337. * @member {number} SuperMap.Feature.Theme.Graph.prototype.XOffset
  49338. * @description 专题要素(图表)在 X 方向上的偏移值,单位像素。
  49339. */
  49340. this.XOffset = 0;
  49341. /**
  49342. * @readonly
  49343. * @member {number} SuperMap.Feature.Theme.Graph.prototype.YOffset
  49344. * @description 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  49345. */
  49346. this.YOffset = 0;
  49347. /**
  49348. * @readonly
  49349. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.DVBParameter
  49350. * @description 数据视图框参数,长度为 4 的一维数组(数组元素值 >= 0),[leftOffset, bottomOffset, rightOffset, topOffset],chartBox 内偏距值。
  49351. * 此属性用于指定数据视图框 dataViewBox 的范围。
  49352. */
  49353. this.DVBParameter = null;
  49354. /**
  49355. * @readonly
  49356. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.dataViewBox
  49357. * @description 数据视图框,长度为 4 的一维数组,[left, bottom, right, top]。
  49358. * dataViewBox 是统计专题要素最核心的内容,它负责解释数据在一个像素区域里的数据可视化含义,
  49359. * 这种含义用可视化图形表达出来,这些表示数据的图形和一些辅助图形组合在一起构成统计专题图表。
  49360. */
  49361. this.dataViewBox = null;
  49362. /**
  49363. * @readonly
  49364. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.DVBCodomain
  49365. * @description 数据视图框的内允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  49366. * dataViewBox 中允许的数据范围,对数据溢出值域范围情况的处理需要在 assembleShapes 中进行。
  49367. */
  49368. this.DVBCodomain = null;
  49369. /**
  49370. * @readonly
  49371. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.DVBCenterPoint
  49372. * @description 数据视图框中心点,长度为 2 的一维数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  49373. */
  49374. this.DVBCenterPoint = null;
  49375. /**
  49376. * @readonly
  49377. * @member {string} SuperMap.Feature.Theme.Graph.prototype.DVBUnitValue
  49378. * @description 单位值。在 assembleShapes() 中初始化其具体意义,例如:饼图的 DVBUnitValue 可以定义为"360/数据总和",
  49379. * 折线图的 DVBUnitValue 可以定义为 "DVBCodomain/DVBHeight"。
  49380. */
  49381. this.DVBUnitValue = null;
  49382. /**
  49383. * @readonly
  49384. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.DVBOrigonPoint
  49385. * @description 数据视图框原点,数据视图框左上角点,长度为 2 的一维数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  49386. */
  49387. this.DVBOrigonPoint = null;
  49388. /**
  49389. * @readonly
  49390. * @member {number} SuperMap.Feature.Theme.Graph.prototype.DVBWidth
  49391. * @description 数据视图框宽度。
  49392. */
  49393. this.DVBWidth = null;
  49394. /**
  49395. * @readonly
  49396. * @member {number} SuperMap.Feature.Theme.Graph.prototype.DVBHeight
  49397. * @description 数据视图框高度。
  49398. */
  49399. this.DVBHeight = null;
  49400. /**
  49401. * @readonly
  49402. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.origonPointOffset
  49403. * @description 数据视图框原点相对于图表框的原点偏移量,长度为 2 的一维数组,第一个元素表示 x 偏移量,第二个元素表示 y 偏移量。
  49404. */
  49405. this.origonPointOffset = null;
  49406. /**
  49407. * @readonly
  49408. * @member {Array.<string>} SuperMap.Feature.Theme.Graph.prototype.fields
  49409. * @description 数据{SuperMap.Feature.Vector}属性字段。
  49410. */
  49411. this.fields = fields || [];
  49412. /**
  49413. * @readonly
  49414. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.dataValues
  49415. * @description 图表展示的数据值,通过 fields 从数据 feature 属性中获得。
  49416. */
  49417. this.dataValues = null;
  49418. // 图表位置
  49419. if (lonlat) {
  49420. this.lonlat = lonlat;
  49421. } else {
  49422. // 默认使用 bounds 中心
  49423. this.lonlat = this.data.geometry.getBounds().getCenterLonLat();
  49424. }
  49425. // 配置项检测与赋值
  49426. if (setting && setting.width && setting.height && setting.codomain) {
  49427. this.setting = setting;
  49428. }
  49429. this.CLASS_NAME = "SuperMap.Feature.Theme.Graph";
  49430. }
  49431. /**
  49432. * @function SuperMap.Feature.Theme.Graph.prototype.destroy
  49433. * @description 销毁专题要素。
  49434. */
  49435. destroy() {
  49436. this.shapeFactory = null;
  49437. this.shapeParameters = null;
  49438. this.width = null;
  49439. this.height = null;
  49440. this.origonPoint = null;
  49441. this.chartBox = null;
  49442. this.dataViewBox = null;
  49443. this.chartBounds = null;
  49444. this.DVBParameter = null;
  49445. this.DVBOrigonPoint = null;
  49446. this.DVBCenterPoint = null;
  49447. this.DVBWidth = null;
  49448. this.DVBHeight = null;
  49449. this.DVBCodomain = null;
  49450. this.DVBUnitValue = null;
  49451. this.origonPointOffset = null;
  49452. this.XOffset = null;
  49453. this.YOffset = null;
  49454. this.fields = null;
  49455. this.dataValues = null;
  49456. this.setting = null;
  49457. super.destroy();
  49458. }
  49459. /**
  49460. * @function SuperMap.Feature.Theme.Graph.prototype.initBaseParameter
  49461. * @description 初始化专题要素(图表)基础参数。在调用此方法前,此类的图表模型相关属性都是不可用的 ,此方法在 assembleShapes 函数中调用。
  49462. * 调用此函数关系到 setting 对象的以下属性。
  49463. * @param {number} width - 专题要素(图表)宽度。
  49464. * @param {number} height - 专题要素(图表)高度。
  49465. * @param {Array.<number>} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  49466. * @param {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  49467. * @param {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  49468. * @param {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox。
  49469. * (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  49470. * @param {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  49471. * @returns {boolean} 初始化参数是否成功。
  49472. */
  49473. initBaseParameter() {
  49474. // 参数初始化是否成功
  49475. var isSuccess = true;
  49476. // setting 属性是否已成功赋值
  49477. if (!this.setting) {
  49478. return false;
  49479. }
  49480. var sets = this.setting;
  49481. // 检测 setting 的必设参数
  49482. if (!(sets.width && sets.height && sets.codomain)) {
  49483. return false;
  49484. }
  49485. // 数据
  49486. var decimalNumber = (typeof(sets.decimalNumber) !== "undefined" && !isNaN(sets.decimalNumber)) ? sets.decimalNumber : -1;
  49487. var dataEffective = Theme_Theme.getDataValues(this.data, this.fields, decimalNumber);
  49488. this.dataValues = dataEffective ? dataEffective : [];
  49489. // 基础参数 width, height, codomain
  49490. this.width = parseFloat(sets.width);
  49491. this.height = parseFloat(sets.height);
  49492. this.DVBCodomain = sets.codomain;
  49493. // 图表偏移
  49494. // if(sets.XOffset) {this.XOffset = sets.XOffset};
  49495. // if(sets.YOffset) {this.YOffset = sets.YOffset};
  49496. this.XOffset = sets.XOffset ? sets.XOffset : 0;
  49497. this.YOffset = sets.YOffset ? sets.YOffset : 0;
  49498. // 其他默认值
  49499. this.origonPoint = [];
  49500. this.chartBox = [];
  49501. this.dataViewBox = [];
  49502. this.DVBParameter = sets.dataViewBoxParameter ? sets.dataViewBoxParameter : [0, 0, 0, 0];
  49503. this.DVBOrigonPoint = [];
  49504. this.DVBCenterPoint = [];
  49505. this.origonPointOffset = [];
  49506. // 图表位置
  49507. this.resetLocation();
  49508. // 专题要素宽度 w
  49509. var w = this.width;
  49510. // 专题要素高度 h
  49511. var h = this.height;
  49512. // 专题要素像素位置 loc
  49513. var loc = this.location;
  49514. // 专题要素像素位置 loc
  49515. this.origonPoint = [loc[0] - w / 2, loc[1] - h / 2];
  49516. // 专题要素原点(左上角)
  49517. var op = this.origonPoint;
  49518. // 图表框([left, bottom, right, top])
  49519. this.chartBox = [op[0], op[1] + h, op[0] + w, op[1]];
  49520. // 图表框
  49521. var cb = this.chartBox;
  49522. // 数据视图框参数,它是图表框各方向对应的内偏距
  49523. var dbbP = this.DVBParameter;
  49524. // 数据视图框 ([left, bottom, right, top])
  49525. this.dataViewBox = [cb[0] + dbbP[0], cb[1] - dbbP[1], cb[2] - dbbP[2], cb[3] + dbbP[3]];
  49526. // 数据视图框
  49527. var dvb = this.dataViewBox;
  49528. //检查数据视图框是否合法
  49529. if (dvb[0] >= dvb[2] || dvb[1] <= dvb[3]) {
  49530. return false;
  49531. }
  49532. // 数据视图框原点
  49533. this.DVBOrigonPoint = [dvb[0], dvb[3]];
  49534. // 数据视图框宽度
  49535. this.DVBWidth = Math.abs(dvb[2] - dvb[0]);
  49536. // 数据视图框高度
  49537. this.DVBHeight = Math.abs(dvb[1] - dvb[3]);
  49538. // 数据视图框中心点
  49539. this.DVBCenterPoint = [this.DVBOrigonPoint[0] + this.DVBWidth / 2, this.DVBOrigonPoint[1] + this.DVBHeight / 2]
  49540. // 数据视图框原点与图表框的原点偏移量
  49541. this.origonPointOffset = [this.DVBOrigonPoint[0] - op[0], this.DVBOrigonPoint[1] - op[1]];
  49542. return isSuccess;
  49543. }
  49544. /**
  49545. * @function SuperMap.Feature.Theme.Graph.prototype.resetLocation
  49546. * @description 根据地理位置 lonlat 重置专题要素(图表)位置。
  49547. * @param {SuperMap.LonLat} lonlat - 专题要素新的像素中心位置。
  49548. * @returns {Array.<number>} - 新专题要素像素参考位置。长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  49549. */
  49550. resetLocation(lonlat) {
  49551. if (lonlat) {
  49552. this.lonlat = lonlat;
  49553. }
  49554. // 获取地理位置对应的像素坐标 newLocalLX
  49555. var newLocalLX = this.getLocalXY(this.lonlat);
  49556. // 处理偏移量 XOffset, YOffset
  49557. newLocalLX[0] += this.XOffset;
  49558. newLocalLX[1] += this.YOffset;
  49559. // 将图形位置赋予 location 属性(注意 location 属性表示的是专题要素中心位置)
  49560. this.location = newLocalLX;
  49561. // 更新图表像素 Bounds
  49562. var w = this.width;
  49563. var h = this.height;
  49564. var loc = this.location;
  49565. this.chartBounds = new Bounds(loc[0] - w / 2, loc[1] + h / 2, loc[0] + w / 2, loc[1] - h / 2);
  49566. //重新计算当前渐变色
  49567. this.resetLinearGradient();
  49568. return loc;
  49569. }
  49570. /**
  49571. * @function SuperMap.Feature.Theme.Graph.prototype.resetLinearGradient
  49572. * @description resetLocation 中调用 图表的相对坐标存在的时候,重新计算渐变的颜色(目前用于二维柱状图渐变色 所以子类实现此方法)。
  49573. */
  49574. resetLinearGradient() {
  49575. //子类实现此方法
  49576. }
  49577. /**
  49578. * @function SuperMap.Feature.Theme.Graph.prototype.shapesConvertToRelativeCoordinate
  49579. * @description 将(构成图表)图形的节点转为相对坐标表示,此函数必须且只能在 assembleShapes() 结束时调用。
  49580. */
  49581. shapesConvertToRelativeCoordinate() {
  49582. var shapes = this.shapes;
  49583. var shapeROP = this.location;
  49584. for (var i = 0, len = shapes.length; i < len; i++) {
  49585. shapes[i].refOriginalPosition = shapeROP;
  49586. var style = shapes[i].style;
  49587. for (var sty in style) {
  49588. switch (sty) {
  49589. case "pointList":
  49590. var pl = style[sty];
  49591. for (var j = 0, len2 = pl.length; j < len2; j++) {
  49592. pl[j][0] -= shapeROP[0];
  49593. pl[j][1] -= shapeROP[1];
  49594. }
  49595. break;
  49596. case "x":
  49597. style[sty] -= shapeROP[0];
  49598. break;
  49599. case "y":
  49600. style[sty] -= shapeROP[1];
  49601. break;
  49602. default:
  49603. break;
  49604. }
  49605. }
  49606. }
  49607. this.RelativeCoordinate = true;
  49608. }
  49609. /**
  49610. * @function SuperMap.Feature.Theme.Graph.prototype.assembleShapes
  49611. * @description 图形装配函数。抽象方法,可视化子类必须实现此方法。<br>
  49612. * 重写此方法的步骤:<br>
  49613. * 1. 图表的某些特殊配置项(setting)处理,例如多数图表模型需要重新指定 dataViewBoxParameter 的默认值。<br>
  49614. * 2. 调用 initBaseParameter() 方法初始化模型属性值,此步骤必须执行,只有当 initBaseParameter 返回 true 时才可以允许进行后续步骤。<br>
  49615. * 3. 计算图形参数,制作图形,图形组合。在组装图表过程中,应该特别注意数据视图框单位值的定义、数据值溢出值域范围的处理和图形大小自适应。<br>
  49616. * 4. 调用 shapesConvertToRelativeCoordinate() 方法,将图形的坐标值转为相对坐标,此步骤必须执行。
  49617. * @example
  49618. * //子类实现 assembleShapes() 接口的步骤示例:
  49619. * assembleShapes: function(){
  49620. * // 第一步:图表的某些特殊配置项(setting)处理,例如多数图表模型需要重新指定 dataViewBoxParameter 的默认值。此步骤是非必须过程。
  49621. *
  49622. * // 图表配置对象
  49623. * var sets = this.setting;
  49624. * // 默认数据视图框,这里展示在使用坐标轴和不使用坐标轴情况下对数据视图框参数赋予不同的默认值
  49625. * if(!sets.dataViewBoxParameter){
  49626. * if(typeof(sets.useAxis) === "undefined" || sets.useAxis){
  49627. * sets.dataViewBoxParameter = [45, 15, 15, 15];
  49628. * }
  49629. * else{
  49630. * sets.dataViewBoxParameter = [5, 5, 5, 5];
  49631. * }
  49632. * }
  49633. *
  49634. * // 第二步:初始化图表模型基本参数,只有在图表模型基本参数初始化成功时才可模型相关属性,如 this.dataViewBox、 this.DVBCodomain等。此步骤是必须过程。
  49635. * if(!this.initBaseParameter()) return;
  49636. *
  49637. * // 第三步:用图形组装图表,在组装图表过程中,应该特别注意数据视图框单位值的定义、数据值溢出值域范围的处理和图形大小自适应。
  49638. * // 定义图表数据视图框中单位值的含义,下面行代码表示将数据视图框单位值定义为数据视图框高度上每像素代表的数据值
  49639. * this.DVBUnitValue = (this.codomain[1] - this.codomain[0])/this.DVBHeight;
  49640. * var uv = this.DVBUnitValue;
  49641. *
  49642. * // 图形参数计算代码......
  49643. *
  49644. * // 关于图形装配,实际上就是利用图形工程对象 this.shapeFactory 的 createShape() 方法通过图形参数对象创建可视化的图形对象,并把这些图形对象按序添加到模型的图形库(his.shapes)中。下面的代码演示创建一个面图形参数对象,并允许通过图形配置对象设置图形的 style 和 highlightStyle,
  49645. * var barParams = new SuperMap.Feature.ShapeParameters.Polygon(poiLists);
  49646. * barParams.style = sets.barStyle? sets.barStyle:{fillColor: "lightblue"};
  49647. * barParams.highlightStyle = sets.barHoverStyle? sets.barHoverStyle:{fillColor: "blue"};
  49648. * // 图形携带数据ID信息
  49649. * barParams.refDataID = this.data.id;
  49650. * // 创建图形并添加到图表图形数组中
  49651. * this.shapes.push(this.shapeFactory.createShape(barParams));
  49652. *
  49653. * // 第四步:调用 shapesConvertToRelativeCoordinate() 方法,将图形库(his.shapes)中的图形转为由相对坐标表示的图形,客户端统计专题图模块从结构上要求可视化图形使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数。此步骤是必须过程。
  49654. * this.shapesConvertToRelativeCoordinate();
  49655. * },
  49656. */
  49657. assembleShapes() {
  49658. //子类必须实现此方法
  49659. }
  49660. /**
  49661. * @function SuperMap.Feature.Theme.Graph.prototype.getLocalXY
  49662. * @description 地理坐标转为像素坐标。
  49663. * @param {SuperMap.Lonlat} lonlat - 带转换的地理坐标。
  49664. * @returns 屏幕像素坐标。
  49665. */
  49666. getLocalXY(lonlat) {
  49667. return this.layer.getLocalXY(lonlat);
  49668. }
  49669. }
  49670. /**
  49671. * @function SuperMap.Feature.Theme.getDataValues
  49672. * @description 根据字段名数组获取指定数据(feature)的属性值数组。属性值类型必须为 Number。
  49673. * @param {SuperMap.Feature.Vector} data - 数据。
  49674. * @param {Array.<string>} [fields] - 字段名数组。
  49675. * @param {number} [decimalNumber] - 小数位处理参数,对获取到的属性数据值进行小数位处理。
  49676. * @returns {Array.<string>} 字段名数组对应的属性数据值数组。
  49677. */
  49678. Theme_Theme.getDataValues = function (data, fields, decimalNumber) {
  49679. if (!data.attributes) {
  49680. return false;
  49681. }
  49682. var fieldsValue = [];
  49683. var attrs = data.attributes;
  49684. for (var i = 0; i < fields.length; i++) {
  49685. for (var field in attrs) {
  49686. if (field !== fields[i]) {
  49687. continue
  49688. }
  49689. // 数字转换判断
  49690. try {
  49691. if (!isNaN(decimalNumber) && decimalNumber >= 0) {
  49692. fieldsValue.push(parseFloat(attrs[field].toString()).toFixed(decimalNumber));
  49693. } else {
  49694. fieldsValue.push(parseFloat(attrs[field].toString()));
  49695. }
  49696. } catch (e) {
  49697. throw new Error("not a number")
  49698. }
  49699. }
  49700. }
  49701. if (fieldsValue.length === fields.length) {
  49702. return fieldsValue;
  49703. } else {
  49704. return false;
  49705. }
  49706. };
  49707. SuperMap.Feature.Theme.Graph = Graph;
  49708. ;// CONCATENATED MODULE: ./src/common/overlay/Bar.js
  49709. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  49710. * This program are made available under the terms of the Apache License, Version 2.0
  49711. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49712. /**
  49713. * @class SuperMap.Feature.Theme.Bar
  49714. * @classdesc 柱状图 。
  49715. * @category Visualization Theme
  49716. * @example
  49717. * // barStyleByCodomain参数用法如下:
  49718. * // barStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  49719. * // start: 值域值下限(包含);
  49720. * // end: 值域值上限(不包含);
  49721. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <SuperMap.Feature.ShapeParameters.Polygon.style> 。
  49722. * // barStyleByCodomain 数组形如:
  49723. * [
  49724. * {
  49725. * start:0,
  49726. * end:250,
  49727. * style:{
  49728. * fillColor:"#00CD00"
  49729. * }
  49730. * },
  49731. * {
  49732. * start:250,
  49733. * end:500,
  49734. * style:{
  49735. * fillColor:"#00EE00"
  49736. * }
  49737. * },
  49738. * {
  49739. * start:500,
  49740. * end:750,
  49741. * style:{
  49742. * fillColor:"#00FF7F"
  49743. * }
  49744. * },
  49745. * {
  49746. * start:750,
  49747. * end:1500,
  49748. * style:{
  49749. * fillColor:"#00FF00"
  49750. * }
  49751. * }
  49752. * ]
  49753. * @extends SuperMap.Feature.Theme.Graph
  49754. * @param {SuperMap.Feature.Vector} data - 用户数据。
  49755. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  49756. * @param {Array.<string>} fields - data 属性中的参与此图表生成的属性字段名称。
  49757. * @param {SuperMap.Feature.Theme.Bar.setting} setting - 图表配置对象。
  49758. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  49759. */
  49760. class Bar extends Graph {
  49761. constructor(data, layer, fields, setting, lonlat) {
  49762. super(data, layer, fields, setting, lonlat);
  49763. this.CLASS_NAME = "SuperMap.Feature.Theme.Bar";
  49764. }
  49765. /**
  49766. * @function SuperMap.Feature.Theme.Bar.prototype.destroy
  49767. * @override
  49768. */
  49769. destroy() {
  49770. super.destroy();
  49771. }
  49772. /**
  49773. * @function SuperMap.Feature.Theme.Bar.prototype.assembleShapes
  49774. * @description 图表图形装配函数。
  49775. */
  49776. assembleShapes() {
  49777. //默认渐变颜色数组
  49778. var deafaultColors = [["#00FF00", "#00CD00"], ["#00CCFF", "#5E87A2"], ["#00FF66", "#669985"], ["#CCFF00", "#94A25E"], ["#FF9900", "#A2945E"]];
  49779. //默认阴影
  49780. var deafaultShawdow = {
  49781. showShadow: true,
  49782. shadowBlur: 8,
  49783. shadowColor: "rgba(100,100,100,0.8)",
  49784. shadowOffsetX: 2,
  49785. shadowOffsetY: 2
  49786. };
  49787. // 图表配置对象
  49788. var sets = this.setting;
  49789. if (!sets.barLinearGradient) {
  49790. sets.barLinearGradient = deafaultColors;
  49791. }
  49792. // 默认数据视图框
  49793. if (!sets.dataViewBoxParameter) {
  49794. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  49795. sets.dataViewBoxParameter = [45, 15, 15, 15];
  49796. } else {
  49797. sets.dataViewBoxParameter = [5, 5, 5, 5];
  49798. }
  49799. }
  49800. // 重要步骤:初始化参数
  49801. if (!this.initBaseParameter()) {
  49802. return;
  49803. }
  49804. // 值域
  49805. var codomain = this.DVBCodomain;
  49806. // 重要步骤:定义图表 Bar 数据视图框中单位值的含义
  49807. this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
  49808. // 数据视图域
  49809. var dvb = this.dataViewBox;
  49810. // 用户数据值
  49811. var fv = this.dataValues;
  49812. if (fv.length < 1) {
  49813. return;
  49814. } // 没有数据
  49815. // 数据溢出值域范围处理
  49816. for (let i = 0, fvLen = fv.length; i < fvLen; i++) {
  49817. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  49818. return;
  49819. }
  49820. }
  49821. // 获取 x 轴上的图形信息
  49822. var xShapeInfo = this.calculateXShapeInfo();
  49823. if (!xShapeInfo) {
  49824. return;
  49825. }
  49826. // 每个柱条 x 位置
  49827. var xsLoc = xShapeInfo.xPositions;
  49828. // 柱条宽度
  49829. var xsWdith = xShapeInfo.width;
  49830. // 背景框,默认启用
  49831. if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
  49832. // 将背景框图形添加到模型的 shapes 数组,注意添加顺序,后添加的图形在先添加的图形之上。
  49833. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  49834. }
  49835. // 坐标轴, 默认启用
  49836. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  49837. // 添加坐标轴图形数组
  49838. this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
  49839. }
  49840. for (var i = 0; i < fv.length; i++) {
  49841. // 计算柱条 top 边的 y 轴坐标值
  49842. var yPx = dvb[1] - (fv[i] - codomain[0]) / this.DVBUnitValue;
  49843. // 柱条节点数组
  49844. var poiLists = [
  49845. [xsLoc[i] - xsWdith / 2, dvb[1] - 1],
  49846. [xsLoc[i] + xsWdith / 2, dvb[1] - 1],
  49847. [xsLoc[i] + xsWdith / 2, yPx],
  49848. [xsLoc[i] - xsWdith / 2, yPx]
  49849. ];
  49850. // 柱条参数对象(一个面参数对象)
  49851. var barParams = new Polygon_Polygon(poiLists);
  49852. // 柱条 阴影 style
  49853. if (typeof(sets.showShadow) === "undefined" || sets.showShadow) {
  49854. if (sets.barShadowStyle) {
  49855. var sss = sets.barShadowStyle;
  49856. if (sss.shadowBlur) {
  49857. deafaultShawdow.shadowBlur = sss.shadowBlur;
  49858. }
  49859. if (sss.shadowColor) {
  49860. deafaultShawdow.shadowColor = sss.shadowColor;
  49861. }
  49862. if (sss.shadowOffsetX) {
  49863. deafaultShawdow.shadowOffsetX = sss.shadowOffsetX;
  49864. }
  49865. if (sss.shadowOffsetY) {
  49866. deafaultShawdow.shadowOffsetY = sss.shadowOffsetY;
  49867. }
  49868. }
  49869. barParams.style = {};
  49870. Util.copyAttributesWithClip(barParams.style, deafaultShawdow);
  49871. }
  49872. // 图形携带的数据信息
  49873. barParams.refDataID = this.data.id;
  49874. barParams.dataInfo = {
  49875. field: this.fields[i],
  49876. value: fv[i]
  49877. };
  49878. // 柱条 hover click
  49879. if (typeof(sets.barHoverAble) !== "undefined") {
  49880. barParams.hoverable = sets.barHoverAble;
  49881. }
  49882. if (typeof(sets.barClickAble) !== "undefined") {
  49883. barParams.clickable = sets.barClickAble;
  49884. }
  49885. // 创建柱条并添加到图表图形数组中
  49886. this.shapes.push(this.shapeFactory.createShape(barParams));
  49887. }
  49888. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  49889. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  49890. this.shapesConvertToRelativeCoordinate();
  49891. }
  49892. /**
  49893. * @function SuperMap.Feature.Theme.Bar.prototype.calculateXShapeInfo
  49894. * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
  49895. * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
  49896. * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  49897. * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  49898. * 本函数中图形配置对象 setting 可设属性:
  49899. * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
  49900. * 长度为 3 的数组,第一元素表示第一个图形左端与数据视图框左端的空白间距,第二个元素表示图形间空白间距,
  49901. * 第三个元素表示最后一个图形右端与数据视图框右端端的空白间距 。
  49902. * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:
  49903. * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  49904. * width - {number} 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  49905. *
  49906. */
  49907. calculateXShapeInfo() {
  49908. var dvb = this.dataViewBox; // 数据视图框
  49909. var sets = this.setting; // 图表配置对象
  49910. var fvc = this.dataValues.length; // 数组值个数
  49911. if (fvc < 1) {
  49912. return null;
  49913. }
  49914. var xBlank; // x 轴空白间隔参数
  49915. var xShapePositions = []; // x 轴上图形的位置
  49916. var xShapeWidth = 0; // x 轴上图形宽度(自适应)
  49917. var dvbWidth = this.DVBWidth; // 数据视图框宽度
  49918. // x 轴空白间隔参数处理
  49919. if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 3) {
  49920. xBlank = sets.xShapeBlank;
  49921. var xsLen = dvbWidth - (xBlank[0] + xBlank[2] + (fvc - 1) * xBlank[1]);
  49922. if (xsLen <= fvc) {
  49923. return null;
  49924. }
  49925. xShapeWidth = xsLen / fvc
  49926. } else {
  49927. // 默认使用等距离空白间隔,空白间隔为图形宽度
  49928. xShapeWidth = dvbWidth / (2 * fvc + 1);
  49929. xBlank = [xShapeWidth, xShapeWidth, xShapeWidth];
  49930. }
  49931. // 图形 x 轴上的位置计算
  49932. var xOffset = 0
  49933. for (var i = 0; i < fvc; i++) {
  49934. if (i == 0) {
  49935. xOffset = xBlank[0] + xShapeWidth / 2;
  49936. } else {
  49937. xOffset += (xShapeWidth + xBlank[1]);
  49938. }
  49939. xShapePositions.push(dvb[0] + xOffset);
  49940. }
  49941. return {
  49942. "xPositions": xShapePositions,
  49943. "width": xShapeWidth
  49944. };
  49945. }
  49946. /**
  49947. * @function SuperMap.Feature.Theme.Bar.prototype.resetLinearGradient
  49948. * @description 图表的相对坐标存在的时候,重新计算渐变的颜色(目前用于二维柱状图 所以子类实现此方法)。
  49949. */
  49950. resetLinearGradient() {
  49951. if (this.RelativeCoordinate) {
  49952. var shpelength = this.shapes.length;
  49953. var barLinearGradient = this.setting.barLinearGradient;
  49954. var index = -1;
  49955. for (var i = 0; i < shpelength; i++) {
  49956. var shape = this.shapes[i];
  49957. if (shape.CLASS_NAME === "SuperMap.LevelRenderer.Shape.SmicPolygon") {
  49958. var style = shape.style;
  49959. //计算出当前的绝对 x y
  49960. var x1 = this.location[0] + style.pointList[0][0];
  49961. var x2 = this.location[0] + style.pointList[1][0];
  49962. //渐变颜色
  49963. index++;
  49964. //以防定义的颜色数组不够用
  49965. if (index >= barLinearGradient.length) {
  49966. index = index % barLinearGradient.length;
  49967. }
  49968. var color1 = barLinearGradient[index][0];
  49969. var color2 = barLinearGradient[index][1];
  49970. //颜色
  49971. var zcolor = new Color();
  49972. var linearGradient = zcolor.getLinearGradient(x1, 0, x2, 0,
  49973. [[0, color1], [1, color2]]);
  49974. //赋值
  49975. shape.style.color = linearGradient;
  49976. }
  49977. }
  49978. }
  49979. }
  49980. }
  49981. /**
  49982. * @typedef {Object} SuperMap.Feature.Theme.Bar.setting
  49983. * @property {number} width - 专题要素(图表)宽度。
  49984. * @property {number} height - 专题要素(图表)高度。
  49985. * @property {Array.<number>} codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  49986. * @property {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  49987. * @property {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  49988. * @property {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)
  49989. * 在左、下,右,上四个方向上的内偏距值。当使用坐标轴时 dataViewBoxParameter 的默认值为:[45, 15, 15, 15];
  49990. * 不使用坐标轴时 dataViewBoxParameter 的默认值为:[5, 5, 5, 5]。
  49991. * @property {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  49992. * @property {boolean} [useBackground=true] - 是否使用图表背景框。
  49993. * @property {SuperMap.Feature.ShapeParameters.Rectangle.style} [backgroundStyle] - 背景样式。
  49994. * @property {Array.<number>} [backgroundRadius=[0, 0, 0, 0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4 ,
  49995. * 则 backgroundRadius 为 [r1、r2、r3、r4]。
  49996. * @property {Array.<number>} xShapeBlank - 水平方向上的图形空白间隔参数。长度为 3 的数组,第一元素表示第一个图形左端与数据视图框左端的空白间距,第二个元素表示图形间空白间距,
  49997. * 第三个元素表示最后一个图形右端与数据视图框右端端的空白间距 。
  49998. * @property {boolean} [showShadow=true] - 阴影开关。
  49999. * @property {Object} [barShadowStyle] - 阴影样式,如:{shadowBlur : 8, shadowOffsetX: 2 , shadowOffsetY : 2,shadowColor : "rgba(100,100,100,0.8)"}
  50000. * @property {Array.<string>} [barLinearGradient] - 按字段设置柱条样式[渐变开始颜色,渐变终止颜色] 与 themeLayer.themeFields 中的字段一一对应),
  50001. * 如:[["#00FF00","#00CD00"],["#00CCFF","#5E87A2"],["#00FF66","#669985"],["#CCFF00","#94A25E"],["#FF9900","#A2945E"]]
  50002. * @property {boolean} [useAxis=true] - 是否使用坐标轴。</br>
  50003. * @property {SuperMap.Feature.ShapeParameters.Line.style} [axisStyle] - 坐标轴样式。
  50004. * @property {boolean} [axisUseArrow=false] - 坐标轴是否使用箭头。
  50005. * @property {number} [axisYTick=0] - y 轴刻度数量。
  50006. * @property {Array.<string>} [axisYLabels] - y 轴上的标签组内容,标签顺序沿着数据视图框左面条边自上而下,等距排布。例如:["1000", "750", "500", "250", "0"]。
  50007. * @property {SuperMap.Feature.ShapeParameters.Label.style} [axisYLabelsStyle] - y 轴上的标签组样式。
  50008. * @property {Array.<number>} [axisYLabelsOffset=[0,0]] - y 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 y 轴标签组横向上的偏移量,向左为正;数组第二项表示 y 轴标签组纵向上的偏移量,向下为正。
  50009. * @property {Array.<string>} [axisXLabels] - x 轴上的标签组内容,标签顺序沿着数据视图框下面条边自左向右排布,例如:["92年", "95年", "99年"]。标签排布规则:当标签数量与 xShapeInfo 中的属性 xShapeCenter 数量相同(即标签个数与数据个数相等时), 按照 xShapeCenter 提供的位置排布标签,否则沿数据视图框下面条边等距排布标签。
  50010. * @property {SuperMap.Feature.ShapeParameters.Label.style} [axisXLabelsStyle] - x 轴上的标签组样式。
  50011. * @property {Array.<number>} [axisXLabelsOffset=[0,0]] - x 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 x 轴标签组横向上的偏移量,向左为正;数组第二项表示 x 轴标签组纵向上的偏移量,向下为正。
  50012. * @property {boolean} [useXReferenceLine] - 是否使用水平参考线,如果为 true,在 axisYTick 大于 0 时有效,水平参考线是 y 轴刻度在数据视图框里的延伸。
  50013. * @property {SuperMap.Feature.ShapeParameters.Line.style} xReferenceLineStyle - 水平参考线样式。
  50014. * @property {Object} barStyle - 柱状图柱条基础 style,此参数控制柱条基础样式,优先级低于 barStyleByFields 和 barStyleByCodomain。
  50015. * @property {Array.<SuperMap.Feature.ShapeParameters.Polygon.style>} barStyleByFields - 按专题字段 themeFields(<SuperMap.Layer.Graph.themeFields|L.supermap.graphThemeLayer.themeFields|ol.source.Graph.themeFields|mapboxgl.supermap.GraphThemeLayer.themeFields>)为柱条赋 style,此参数按字段控制柱条样式,优先级低于 barStyleByCodomain,高于 barStyle。此数组中的元素是样式对象。此参数中的 style 与 themeFields 中的字段一一对应 。例如: themeFields(<SuperMap.Layer.Graph.themeFields>) 为 ["POP_1992", "POP_1995", "POP_1999"],barStyleByFields 为[style1, style2, style3],则在图表中,字段 POP_1992 对应的柱条使用 style1,字段 POP_1995 对应的柱条使用 style2 ,字段 POP_1999 对应的柱条使用 style3。
  50016. * @property {Array.<SuperMap.Feature.ShapeParameters.Polygon.style>} barStyleByCodomain - 按柱条代表的数据值所在值域范围控制柱条样式,优先级高于 barStyle 和 barStyleByFields。
  50017. * @property {Object} [barHoverStyle] - 柱条 hover 状态时的样式,barHoverAble 为 true 时有效。
  50018. * @property {Object} [barHoverAble] - 是否允许柱条使用 hover 状态,默认允许。同时设置 barHoverAble 和 barClickAble 为 false,可以直接屏蔽柱条对专题图层事件的响应。
  50019. * @property {Object} [barClickAble] - 是否允许柱条被点击,默认允许。同时设置 barHoverAble 和 barClickAble 为 false,可以直接屏蔽柱条对专题图层事件的响应。
  50020. */
  50021. SuperMap.Feature.Theme.Bar = Bar;
  50022. ;// CONCATENATED MODULE: ./src/common/overlay/Bar3D.js
  50023. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  50024. * This program are made available under the terms of the Apache License, Version 2.0
  50025. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50026. /**
  50027. * @class SuperMap.Feature.Theme.Bar3D
  50028. * @classdesc 三维柱状图 。
  50029. * @category Visualization Theme
  50030. * @extends SuperMap.Feature.Theme.Graph
  50031. * @param {SuperMap.Feature.Vector} data - 用户数据。
  50032. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  50033. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  50034. * @param {SuperMap.Feature.Theme.Bar3D.setting} setting - 图表配置对象。
  50035. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置,默认为 data 指代的地理要素 Bounds 中心。
  50036. *
  50037. *
  50038. * @example
  50039. * // barFaceStyleByCodomain 用法示例如下:
  50040. * // barFaceStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  50041. * // start: 值域值下限(包含);
  50042. * // end: 值域值上限(不包含);
  50043. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <SuperMap.Feature.ShapeParameters.Polygon.style> 。
  50044. * // barFaceStyleByCodomain 数组形如:
  50045. * [
  50046. * {
  50047. * start:0,
  50048. * end:250,
  50049. * style:{
  50050. * fillColor:"#00CD00"
  50051. * }
  50052. * },
  50053. * {
  50054. * start:250,
  50055. * end:500,
  50056. * style:{
  50057. * fillColor:"#00EE00"
  50058. * }
  50059. * },
  50060. * {
  50061. * start:500,
  50062. * end:750,
  50063. * style:{
  50064. * fillColor:"#00FF7F"
  50065. * }
  50066. * },
  50067. * {
  50068. * start:750,
  50069. * end:1500,
  50070. * style:{
  50071. * fillColor:"#00FF00"
  50072. * }
  50073. * }
  50074. * ]
  50075. *
  50076. * @example
  50077. * // barSideStyleByCodomain 用法示例如下:
  50078. * // barSideStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  50079. * // start: 值域值下限(包含);
  50080. * // end: 值域值上限(不包含);
  50081. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <SuperMap.Feature.ShapeParameters.Polygon.style> 。
  50082. * // barSideStyleByCodomain 数组形如:
  50083. * [
  50084. * {
  50085. * start:0,
  50086. * end:250,
  50087. * style:{
  50088. * fillColor:"#00CD00"
  50089. * }
  50090. * },
  50091. * {
  50092. * start:250,
  50093. * end:500,
  50094. * style:{
  50095. * fillColor:"#00EE00"
  50096. * }
  50097. * },
  50098. * {
  50099. * start:500,
  50100. * end:750,
  50101. * style:{
  50102. * fillColor:"#00FF7F"
  50103. * }
  50104. * },
  50105. * {
  50106. * start:750,
  50107. * end:1500,
  50108. * style:{
  50109. * fillColor:"#00FF00"
  50110. * }
  50111. * }
  50112. * ]
  50113. *
  50114. * @example
  50115. * // barTopStyleByCodomain 用法示例如下:
  50116. * // barTopStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  50117. * // start: 值域值下限(包含);
  50118. * // end: 值域值上限(不包含);
  50119. * // style: 数据可视化图形的 style,这个样式对象的可设属性:<SuperMap.Feature.ShapeParameters.Polygon.style> 。
  50120. * // barTopStyleByCodomain 数组形如:
  50121. * [
  50122. * {
  50123. * start:0,
  50124. * end:250,
  50125. * style:{
  50126. * fillColor:"#00CD00"
  50127. * }
  50128. * },
  50129. * {
  50130. * start:250,
  50131. * end:500,
  50132. * style:{
  50133. * fillColor:"#00EE00"
  50134. * }
  50135. * },
  50136. * {
  50137. * start:500,
  50138. * end:750,
  50139. * style:{
  50140. * fillColor:"#00FF7F"
  50141. * }
  50142. * },
  50143. * {
  50144. * start:750,
  50145. * end:1500,
  50146. * style:{
  50147. * fillColor:"#00FF00"
  50148. * }
  50149. * }
  50150. * ]
  50151. */
  50152. class Bar3D extends Graph {
  50153. constructor(data, layer, fields, setting, lonlat) {
  50154. super(data, layer, fields, setting, lonlat);
  50155. this.CLASS_NAME = "SuperMap.Feature.Theme.Bar3D";
  50156. }
  50157. /**
  50158. * @function SuperMap.Feature.Theme.Bar3D.prototype.destroy
  50159. * @override
  50160. */
  50161. destroy() {
  50162. super.destroy();
  50163. }
  50164. /**
  50165. * @function SuperMap.Feature.Theme.Bar3D.prototype.assembleShapes
  50166. * @description 图形装配实现(扩展接口)。
  50167. */
  50168. assembleShapes() {
  50169. // 图表配置对象
  50170. var sets = this.setting;
  50171. // 默认数据视图框
  50172. if (!sets.dataViewBoxParameter) {
  50173. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  50174. sets.dataViewBoxParameter = [45, 25, 20, 20];
  50175. } else {
  50176. sets.dataViewBoxParameter = [5, 5, 5, 5];
  50177. }
  50178. }
  50179. // 3d 柱图的坐标轴默认使用坐标轴箭头
  50180. sets.axisUseArrow = (typeof(sets.axisUseArrow) !== "undefined") ? sets.axisUseArrow : true;
  50181. sets.axisXLabelsOffset = (typeof(sets.axisXLabelsOffset) !== "undefined") ? sets.axisXLabelsOffset : [-10, 10];
  50182. // 重要步骤:初始化参数
  50183. if (!this.initBaseParameter()) {
  50184. return;
  50185. }
  50186. // 值域
  50187. var codomain = this.DVBCodomain;
  50188. // 重要步骤:定义图表 Bar 数据视图框中单位值的含义
  50189. this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
  50190. // 数据视图域
  50191. var dvb = this.dataViewBox;
  50192. // 用户数据值
  50193. var fv = this.dataValues;
  50194. if (fv.length < 1) {
  50195. return;
  50196. } // 没有数据
  50197. // 数据溢出值域范围处理
  50198. for (let i = 0, fvLen = fv.length; i < fvLen; i++) {
  50199. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  50200. return;
  50201. }
  50202. }
  50203. // 获取 x 轴上的图形信息
  50204. var xShapeInfo = this.calculateXShapeInfo();
  50205. if (!xShapeInfo) {
  50206. return;
  50207. }
  50208. // 每个柱条 x 位置
  50209. var xsLoc = xShapeInfo.xPositions;
  50210. // 柱条宽度
  50211. var xsWdith = xShapeInfo.width;
  50212. // 坐标轴, 默认启用
  50213. if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
  50214. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  50215. }
  50216. // 坐标轴
  50217. if (!sets.axis3DParameter || isNaN(sets.axis3DParameter) || sets.axis3DParameter < 15) {
  50218. sets.axis3DParameter = 20;
  50219. }
  50220. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  50221. this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
  50222. }
  50223. // 3d 偏移量, 默认值 10;
  50224. var offset3d = (sets.bar3DParameter && !isNaN(sets.bar3DParameter)) ? sets.bar3DParameter : 10;
  50225. for (let i = 0; i < fv.length; i++) {
  50226. // 无 3d 偏移量时的柱面顶部 y 坐标
  50227. var yPx = dvb[1] - (fv[i] - codomain[0]) / this.DVBUnitValue;
  50228. // 无 3d 偏移量时的柱面的左、右端 x 坐标
  50229. var iPoiL = xsLoc[i] - xsWdith / 2;
  50230. var iPoiR = xsLoc[i] + xsWdith / 2;
  50231. // 3d 柱顶面节点
  50232. var bar3DTopPois = [
  50233. [iPoiL, yPx],
  50234. [iPoiR, yPx],
  50235. [iPoiR - offset3d, yPx + offset3d],
  50236. [iPoiL - offset3d, yPx + offset3d]
  50237. ];
  50238. // 3d 柱侧面节点
  50239. var bar3DSidePois = [
  50240. [iPoiR, yPx],
  50241. [iPoiR - offset3d, yPx + offset3d],
  50242. [iPoiR - offset3d, dvb[1] + offset3d],
  50243. [iPoiR, dvb[1]]
  50244. ];
  50245. // 3d 柱正面节点
  50246. var bar3DFacePois = [
  50247. [iPoiL - offset3d, dvb[1] + offset3d],
  50248. [iPoiR - offset3d, dvb[1] + offset3d],
  50249. [iPoiR - offset3d, yPx + offset3d],
  50250. [iPoiL - offset3d, yPx + offset3d]
  50251. ];
  50252. if (offset3d <= 0) { // offset3d <= 0 时正面不偏移
  50253. bar3DFacePois = [
  50254. [iPoiL, dvb[1]],
  50255. [iPoiR, dvb[1]],
  50256. [iPoiR, yPx],
  50257. [iPoiL, yPx]
  50258. ];
  50259. }
  50260. // 新建 3d 柱面顶面、侧面、正面图形参数对象
  50261. var polyTopSP = new Polygon_Polygon(bar3DTopPois);
  50262. var polySideSP = new Polygon_Polygon(bar3DSidePois);
  50263. var polyFaceSP = new Polygon_Polygon(bar3DFacePois);
  50264. // 侧面、正面图形 style 默认值
  50265. sets.barSideStyle = sets.barSideStyle ? sets.barSideStyle : sets.barFaceStyle;
  50266. sets.barSideStyleByFields = sets.barSideStyleByFields ? sets.barSideStyleByFields : sets.barFaceStyleByFields;
  50267. sets.barSideStyleByCodomain = sets.barSideStyleByCodomain ? sets.barSideStyleByCodomain : sets.barFaceStyleByCodomain;
  50268. sets.barTopStyle = sets.barTopStyle ? sets.barTopStyle : sets.barFaceStyle;
  50269. sets.barTopStyleByFields = sets.barTopStyleByFields ? sets.barTopStyleByFields : sets.barFaceStyleByFields;
  50270. sets.barTopStyleByCodomain = sets.barTopStyleByCodomain ? sets.barTopStyleByCodomain : sets.barFaceStyleByCodomain;
  50271. // 顶面、侧面、正面图形 style
  50272. polyFaceSP.style = ShapeFactory.ShapeStyleTool({
  50273. stroke: true,
  50274. strokeColor: "#ffffff",
  50275. fillColor: "#ee9900"
  50276. },
  50277. sets.barFaceStyle, sets.barFaceStyleByFields, sets.barFaceStyleByCodomain, i, fv[i]);
  50278. polySideSP.style = ShapeFactory.ShapeStyleTool({
  50279. stroke: true,
  50280. strokeColor: "#ffffff",
  50281. fillColor: "#ee9900"
  50282. },
  50283. sets.barSideStyle, sets.barSideStyleByFields, sets.barSideStyleByCodomain, i, fv[i]);
  50284. polyTopSP.style = ShapeFactory.ShapeStyleTool({
  50285. stroke: true,
  50286. strokeColor: "#ffffff",
  50287. fillColor: "#ee9900"
  50288. },
  50289. sets.barTopStyle, sets.barTopStyleByFields, sets.barTopStyleByCodomain, i, fv[i]);
  50290. // 3d 柱条高亮样式
  50291. sets.barSideHoverStyle = sets.barSideHoverStyle ? sets.barSideHoverStyle : sets.barFaceHoverStyle;
  50292. sets.barTopHoverStyle = sets.barTopHoverStyle ? sets.barTopHoverStyle : sets.barFaceHoverStyle;
  50293. polyFaceSP.highlightStyle = ShapeFactory.ShapeStyleTool({stroke: true}, sets.barFaceHoverStyle);
  50294. polySideSP.highlightStyle = ShapeFactory.ShapeStyleTool({stroke: true}, sets.barSideHoverStyle);
  50295. polyTopSP.highlightStyle = ShapeFactory.ShapeStyleTool({stroke: true}, sets.barTopHoverStyle);
  50296. // 图形携带的数据 id 信息 & 高亮模式
  50297. polyTopSP.refDataID = polySideSP.refDataID = polyFaceSP.refDataID = this.data.id;
  50298. // hover 模式(组合)
  50299. polyTopSP.isHoverByRefDataID = polySideSP.isHoverByRefDataID = polyFaceSP.isHoverByRefDataID = true;
  50300. // 高亮组(当鼠标 hover 到组内任何一个图形,整个组的图形都会高亮。refDataHoverGroup 在 isHoverByRefDataID 为 true 时有效)
  50301. polyTopSP.refDataHoverGroup = polySideSP.refDataHoverGroup = polyFaceSP.refDataHoverGroup = Util.createUniqueID("lr_shg");
  50302. // 图形携带的数据信息
  50303. polyTopSP.dataInfo = polySideSP.dataInfo = polyFaceSP.dataInfo = {
  50304. field: this.fields[i],
  50305. value: fv[i]
  50306. };
  50307. // 3d 柱条顶面、侧面、正面图形 hover click 设置
  50308. if (typeof(sets.barHoverAble) !== "undefined") {
  50309. polyTopSP.hoverable = polySideSP.hoverable = polyFaceSP.hoverable = sets.barHoverAble;
  50310. }
  50311. if (typeof(sets.barClickAble) !== "undefined") {
  50312. polyTopSP.clickable = polySideSP.clickable = polyFaceSP.clickable = sets.barClickAble;
  50313. }
  50314. // 创建3d 柱条的顶面、侧面、正面图形并添加到图表的图形列表数组
  50315. this.shapes.push(this.shapeFactory.createShape(polySideSP));
  50316. this.shapes.push(this.shapeFactory.createShape(polyTopSP));
  50317. this.shapes.push(this.shapeFactory.createShape(polyFaceSP));
  50318. }
  50319. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  50320. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  50321. this.shapesConvertToRelativeCoordinate();
  50322. }
  50323. /**
  50324. * @function SuperMap.Feature.Theme.Bar3D.prototype.calculateXShapeInfo
  50325. * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
  50326. * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
  50327. * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  50328. * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  50329. * 本函数中图形配置对象 setting 可设属性:
  50330. * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
  50331. * 长度为 3 的数组,第一元素表示第一个图形左端与数据视图框左端的空白间距,第二个元素表示图形间空白间距,
  50332. * 第三个元素表示最后一个图形右端与数据视图框右端端的空白间距 。
  50333. * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:
  50334. * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  50335. * width - {number} 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  50336. */
  50337. calculateXShapeInfo() {
  50338. var dvb = this.dataViewBox; // 数据视图框
  50339. var sets = this.setting; // 图表配置对象
  50340. var fvc = this.dataValues.length; // 数组值个数
  50341. if (fvc < 1) {
  50342. return null;
  50343. }
  50344. var xBlank; // x 轴空白间隔参数
  50345. var xShapePositions = []; // x 轴上图形的位置
  50346. var xShapeWidth = 0; // x 轴上图形宽度(自适应)
  50347. var dvbWidth = this.DVBWidth; // 数据视图框宽度
  50348. // x 轴空白间隔参数处理
  50349. if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 3) {
  50350. xBlank = sets.xShapeBlank;
  50351. var xsLen = dvbWidth - (xBlank[0] + xBlank[2] + (fvc - 1) * xBlank[1])
  50352. if (xsLen <= fvc) {
  50353. return null;
  50354. }
  50355. xShapeWidth = xsLen / fvc
  50356. } else {
  50357. // 默认使用等距离空白间隔,空白间隔为图形宽度
  50358. xShapeWidth = dvbWidth / (2 * fvc + 1);
  50359. xBlank = [xShapeWidth, xShapeWidth, xShapeWidth];
  50360. }
  50361. // 图形 x 轴上的位置计算
  50362. var xOffset = 0
  50363. for (var i = 0; i < fvc; i++) {
  50364. if (i == 0) {
  50365. xOffset = xBlank[0] + xShapeWidth / 2;
  50366. } else {
  50367. xOffset += (xShapeWidth + xBlank[1]);
  50368. }
  50369. xShapePositions.push(dvb[0] + xOffset);
  50370. }
  50371. return {
  50372. "xPositions": xShapePositions,
  50373. "width": xShapeWidth
  50374. };
  50375. }
  50376. }
  50377. /**
  50378. * @typedef {Object} SuperMap.Feature.Theme.Bar3D.setting
  50379. * @property {number} width - 专题要素(图表)宽度。
  50380. * @property {number} height - 专题要素(图表)高度。
  50381. * @property {Array.<number>} codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  50382. * @property {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  50383. * @property {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  50384. * @property {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。当使用坐标轴时 dataViewBoxParameter 的默认值为:[45, 25, 20, 20];不使用坐标轴时 dataViewBoxParameter 的默认值为:[5, 5, 5, 5]。
  50385. * @property {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  50386. * @property {boolean} [useBackground=true] - 是否使用图表背景框。
  50387. * @property {SuperMap.Feature.ShapeParameters.Rectangle.style} [backgroundStyle] - 背景样式。
  50388. * @property {Array.<number>} [backgroundRadius=[0, 0, 0, 0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4 ,则 backgroundRadius 为 [r1、r2、r3、r4 ]。
  50389. * @property {Array.<number>} [xShapeBlank] - 水平方向上的图形空白间隔参数。长度为 3 的数组,第一元素表示第一个图形左端与数据视图框左端的空白间距,第二个元素表示图形间空白间距,第三个元素表示最后一个图形右端与数据视图框右端端的空白间距 。
  50390. * @property {number} [bar3DParameter=10] - 3D 柱状参数,3d柱形正面相对于背面向 x 轴和 y 轴负方向偏移的绝对值。
  50391. * @property {boolean} [useAxis=true] - 是否使用坐标轴。
  50392. * @property {SuperMap.Feature.ShapeParameters.Line.style} [axisStyle] - 坐标轴样式。
  50393. * @property {boolean} [axisUseArrow=true] -坐标轴是否使用箭头。
  50394. * @property {number} [axisYTick=0] - y 轴刻度数量。
  50395. * @property {Array.<string>} [axisYLabels] - y 轴上的标签组内容,标签顺序沿着数据视图框左面条边自上而下,等距排布。例如:["1000", "750", "500", "250", "0"]。
  50396. * @property {SuperMap.Feature.ShapeParameters.Label.style} [axisYLabelsStyle] - y 轴上的标签组样式。
  50397. * @property {Array.<number>} [axisYLabelsOffset=0] - y 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 y 轴标签组横向上的偏移量,向左为正,默认值:0;数组第二项表示 y 轴标签组纵向上的偏移量,向下为正。
  50398. * @property {Array.<string>} [axisXLabels] - x 轴上的标签组内容,标签顺序沿着数据视图框下面条边自左向右排布,例如:["92年", "95年", "99年"]。标签排布规则:当标签数量与 xShapeInfo 中的属性 xShapeCenter 数量相同(即标签个数与数据个数相等时), 按照 xShapeCenter 提供的位置排布标签,否则沿数据视图框下面条边等距排布标签。
  50399. * @property {SuperMap.Feature.ShapeParameters.Label.style} axisXLabelsStyle - x 轴上的标签组样式。
  50400. * @property {Array.<number>} axisXLabelsOffset - x 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 x 轴标签组横向上的偏移量,向左为正,默认值:-10;数组第二项表示 x 轴标签组纵向上的偏移量,向下为正,默认值:10。
  50401. * @property {boolean} [useXReferenceLine] - 是否使用水平参考线,如果为 true,在 axisYTick 大于 0 时有效,水平参考线是 y 轴刻度在数据视图框里的延伸。
  50402. * @property {SuperMap.Feature.ShapeParameters.Line.style} [xReferenceLineStyle] - 水平参考线样式。
  50403. * @property {number} [axis3DParameter=20] - 3D 坐标轴参数,此属性值在大于等于 15 时有效。
  50404. * @property {SuperMap.Feature.ShapeParameters.Polygon.style} barFaceStyle - 3d 柱状图柱条正面基础 style,此参数控制柱条正面基础样式,优先级低于 barFaceStyleByFields 和 barFaceStyleByCodomain。
  50405. * @property {Array.<SuperMap.Feature.ShapeParameters.Polygon.style>} [barFaceStyleByFields] - 按专题字段 themeFields(<SuperMap.Layer.Graph.themeFields>)为柱条正面赋 style,此参数按字段控制柱条正面样式,优先级低于 barFaceStyleByCodomain,高于 barFaceStyle。此数组中的元素是样式对象。此参数中的 style 与 themeFields 中的字段一一对应 。例如: themeFields(<SuperMap.Layer.Graph.themeFields>) 为 ["POP_1992", "POP_1995", "POP_1999"],barFaceStyleByFields 为[style1, style2, style3],则在图表中,字段 POP_1992 对应的柱条正面使用 style1,字段 POP_1995 对应的柱条正面使用 style2 ,字段 POP_1999 对应的柱条正面使用 style3。
  50406. * @property {Array.<Object>} [barFaceStyleByCodomain] - 按柱条正面代表的数据值所在值域范围控制柱条正面样式,优先级高于 barFaceStyle 和 barFaceStyleByFields。
  50407. * @property {SuperMap.Feature.ShapeParameters.Polygon.style} [barSideStyle=barFaceStyle] - 3d 柱状图柱条侧面基础 style,此参数控制柱条侧面基础样式,优先级低于 barSideStyleByFields 和 barSideStyleByCodomain。
  50408. * @property {Array.<SuperMap.Feature.ShapeParameters.Polygon.style>} [barSideStyleByFields] - 按专题字段 themeFields(<SuperMap.Layer.Graph.themeFields>)为柱条侧面赋style,此数按字段控制柱条侧面样式,优先级低于 barSideStyleByCodomain,高于 barSideStyle。此数组中的元素是样式对象。此参数中的 style 与 themeFields 中的字段一一对应 。例如: themeFields(<SuperMap.Layer.Graph.themeFields>) 为 ["POP_1992", "POP_1995", "POP_1999"],barSideStyleByFields 为[style1, style2, style3],则在图表中,字段 POP_1992 对应的柱条侧面使用 style1,字段 POP_1995对应的柱条侧面使用style2,字段POP_1999对应的柱条侧面使用style3。默认值:barFaceStyleByFields。
  50409. * @property {Array.<Object>} [barSideStyleByCodomain=barFaceStyleByCodomain] - 按柱条侧面代表的数据值所在值域范围控制柱条侧面样式,优先级高于 barSideStyle 和 barSideStyleByFields。
  50410. * @property {Object} [barFaceHoverStyle] - 3d 柱条正面 hover 状态时的样式,barHoverAble 为 true 时有效。
  50411. * @property {Object} [barSideHoverStyle=barFaceHoverStyle] - 3d 柱条侧面 hover 状态时的样式,barHoverAble 为 true 时有效。
  50412. * @property {Object} [barTopHoverStyle=barFaceHoverStyle] - 3d 柱条顶面 hover 状态时的样式,barHoverAble 为 true 时有效。
  50413. * @property {boolean} [barHoverAble=true] - 是否允许柱条使用 hover 状态。同时设置 barHoverAble 和 barClickAble 为 false,可以直接屏蔽柱条对专题图层事件的响应。
  50414. * @property {boolean} [barClickAble=true] - 是否允许柱条被点击。同时设置 barHoverAble 和 barClickAble 为 false,可以直接屏蔽柱条对专题图层事件的响应。
  50415. * @property {SuperMap.Feature.ShapeParameters.Polygon.style} [barTopStyle=barFaceStyle] - 3d 柱状图柱条顶面基础 style,此参数控制柱条顶面基础样式,优先级低于 barTopStyleByFields 和 barTopStyleByCodomain。
  50416. * @property {Array.<SuperMap.Feature.ShapeParameters.Polygon.style>} [barTopStyleByFields=barFaceStyleByFields] - 按专题字段 themeFields(<SuperMap.Layer.Graph.themeFields>)为柱条顶面赋 style,此参数按字段控制柱条顶面样式,优先级低于 barTopStyleByCodomain,高于 barTopStyle。此数组中的元素是样式对象。此参数中的 style 与 themeFields 中的字段一一对应 。例如: themeFields(<SuperMap.Layer.Graph.themeFields>) 为 ["POP_1992", "POP_1995", "POP_1999"],barTopStyleByFields 为[style1, style2, style3],则在图表中,字段 POP_1992 对应的柱条顶面使用 style1,字段 POP_1995 对应的柱条顶面使用 style2 ,字段 POP_1999 对应的柱条顶面使用 style3。
  50417. * @property {Array.<Object>} [barTopStyleByCodomain=barFaceStyleByCodomain] - 按柱条顶面代表的数据值所在值域范围控制柱条顶面样式,优先级高于 barTopStyle 和 barTopStyleByFields。
  50418. */
  50419. SuperMap.Feature.Theme.Bar3D = Bar3D;
  50420. ;// CONCATENATED MODULE: ./src/common/overlay/RankSymbol.js
  50421. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  50422. * This program are made available under the terms of the Apache License, Version 2.0
  50423. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50424. /**
  50425. * @class SuperMap.Feature.Theme.RankSymbol
  50426. * @classdesc 符号专题要素基类。
  50427. * @category Visualization Theme
  50428. * @description 此类定义了符号专题要素基础模型,具体的图表模型通过继承此类,在子类中实现 assembleShapes 方法。
  50429. * 符号专题要素模型采用了可视化图形大小自适应策略,用较少的参数控制着图表诸多图形,图表配置对象 <SuperMap.Feature.Theme.RankSymbol.setting> 的基础属性只有 5 个,
  50430. * 它们控制着图表结构、值域范围、数据小数位等基础图表形态。构成图表的图形必须在图表结构里自适应大小。
  50431. * 此类不可实例化,此类的可实例化子类必须实现 assembleShapes() 方法。
  50432. * @param {SuperMap.Feature.Vector} data - 用户数据。
  50433. * @param {SuperMap.Layer.RankSymbol} layer - 此专题要素所在图层。
  50434. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  50435. * @param {Object} setting - 图表配置对象。
  50436. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  50437. *
  50438. * @extends SuperMap.Feature.Theme.Graph
  50439. *
  50440. */
  50441. class RankSymbol extends Graph {
  50442. constructor(data, layer, fields, setting, lonlat, options) {
  50443. super(data, layer, fields, setting, lonlat, options);
  50444. /**
  50445. * @member SuperMap.Feature.Theme.RankSymbol.prototype.setting -{Object}
  50446. * @description 符号配置对象,该对象控制着图表的可视化显示。
  50447. * 下面是此配置对象的 5 个基础可设属性:<br>
  50448. * @param {Array.<number>} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  50449. * @param {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  50450. * @param {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  50451. * @param {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  50452. * @param {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  50453. * 除了以上 5 个基础属性,此对象的可设属性在不同子类中有较大差异,不同子类中对同一属性的解释也可能不同。
  50454. * 请在此类的子类中查看 setting 对象的可设属性和属性含义。
  50455. */
  50456. this.setting = null;
  50457. // 配置项检测与赋值
  50458. if (setting && setting.codomain) {
  50459. this.setting = setting;
  50460. this.DVBCodomain = this.setting.codomain;
  50461. }
  50462. this.CLASS_NAME = "SuperMap.Feature.Theme.RankSymbol";
  50463. }
  50464. /**
  50465. * @function SuperMap.Feature.Theme.RankSymbol.prototype.destroy
  50466. * @description 销毁专题要素。
  50467. */
  50468. destroy() {
  50469. this.setting = null;
  50470. super.destroy();
  50471. }
  50472. /**
  50473. * @function SuperMap.Feature.Theme.RankSymbol.prototype.initBaseParameter
  50474. * @description 初始化专题要素(图形)基础参数。
  50475. * 在调用此方法前,此类的图表模型相关属性都是不可用的 ,此方法在 assembleShapes 函数中调用。
  50476. * 调用此函数关系到 setting 对象的以下属性。
  50477. * @param {Array.<number>} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  50478. * @param {number} [XOffset] - 专题要素(图形)在 X 方向上的偏移值,单位像素。
  50479. * @param {number} [YOffset] - 专题要素(图形)在 Y 方向上的偏移值,单位像素。
  50480. * @param {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图形框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  50481. * @param {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  50482. * @returns {boolean} 初始化参数是否成功。
  50483. */
  50484. initBaseParameter() {
  50485. // 参数初始化是否成功
  50486. var isSuccess = true;
  50487. // setting 属性是否已成功赋值
  50488. if (!this.setting) {
  50489. return false;
  50490. }
  50491. var sets = this.setting;
  50492. // 图表偏移
  50493. if (sets.XOffset) {
  50494. this.XOffset = sets.XOffset;
  50495. }
  50496. if (sets.YOffset) {
  50497. this.YOffset = sets.YOffset;
  50498. }
  50499. this.XOffset = sets.XOffset ? sets.XOffset : 0;
  50500. this.YOffset = sets.YOffset ? sets.YOffset : 0;
  50501. // 其他默认值
  50502. this.origonPoint = [];
  50503. this.chartBox = [];
  50504. this.dataViewBox = [];
  50505. this.DVBParameter = sets.dataViewBoxParameter ? sets.dataViewBoxParameter : [0, 0, 0, 0];
  50506. this.DVBOrigonPoint = [];
  50507. this.DVBCenterPoint = [];
  50508. this.origonPointOffset = [];
  50509. // 图表位置
  50510. this.resetLocation();
  50511. // 专题要素宽度 w
  50512. var w = this.width;
  50513. // 专题要素高度 h
  50514. var h = this.height;
  50515. // 专题要素像素位置 loc
  50516. var loc = this.location;
  50517. // 专题要素像素位置 loc
  50518. this.origonPoint = [loc[0] - w / 2, loc[1] - h / 2];
  50519. // 专题要素原点(左上角)
  50520. var op = this.origonPoint;
  50521. // 图表框([left, bottom, right, top])
  50522. this.chartBox = [op[0], op[1] + h, op[0] + w, op[1]];
  50523. // 图表框
  50524. var cb = this.chartBox;
  50525. // 数据视图框参数,它是图表框各方向对应的内偏距
  50526. var dbbP = this.DVBParameter;
  50527. // 数据视图框 ([left, bottom, right, top])
  50528. this.dataViewBox = [cb[0] + dbbP[0], cb[1] - dbbP[1], cb[2] - dbbP[2], cb[3] + dbbP[3]];
  50529. // 数据视图框
  50530. var dvb = this.dataViewBox;
  50531. //检查数据视图框是否合法
  50532. if (dvb[0] >= dvb[2] || dvb[1] <= dvb[3]) {
  50533. return false;
  50534. }
  50535. // 数据视图框原点
  50536. this.DVBOrigonPoint = [dvb[0], dvb[3]];
  50537. // 数据视图框宽度
  50538. this.DVBWidth = Math.abs(dvb[2] - dvb[0]);
  50539. // 数据视图框高度
  50540. this.DVBHeight = Math.abs(dvb[1] - dvb[3]);
  50541. // 数据视图框中心点
  50542. this.DVBCenterPoint = [this.DVBOrigonPoint[0] + this.DVBWidth / 2, this.DVBOrigonPoint[1] + this.DVBHeight / 2];
  50543. // 数据视图框原点与图表框的原点偏移量
  50544. this.origonPointOffset = [this.DVBOrigonPoint[0] - op[0], this.DVBOrigonPoint[1] - op[1]];
  50545. return isSuccess;
  50546. }
  50547. }
  50548. SuperMap.Feature.Theme.RankSymbol = RankSymbol;
  50549. ;// CONCATENATED MODULE: ./src/common/overlay/Circle.js
  50550. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  50551. * This program are made available under the terms of the Apache License, Version 2.0
  50552. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50553. /**
  50554. * @class SuperMap.Feature.Theme.Circle
  50555. * @classdesc 圆类。
  50556. * @category Visualization Theme
  50557. * @extends SuperMap.Feature.Theme.RankSymbol
  50558. * @param {SuperMap.Feature.Vector} data - 用户数据。
  50559. * @param {SuperMap.Layer.RankSymbol} layer - 此专题要素所在图层。
  50560. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  50561. * @param {SuperMap.Feature.Theme.Circle.setting} setting - 图表配置对象。
  50562. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置,默认为 data 指代的地理要素 Bounds 中心。
  50563. */
  50564. class Circle extends RankSymbol {
  50565. constructor(data, layer, fields, setting, lonlat) {
  50566. super(data, layer, fields, setting, lonlat);
  50567. this.CLASS_NAME = "SuperMap.Feature.Theme.Circle";
  50568. }
  50569. /**
  50570. * @function SuperMap.Feature.Theme.Circle.prototype.destroy
  50571. * @override
  50572. */
  50573. destroy() {
  50574. super.destroy();
  50575. }
  50576. /**
  50577. * @function SuperMap.Feature.Theme.Circle.prototype.assembleShapes
  50578. * @description 装配图形(扩展接口)。
  50579. */
  50580. assembleShapes() {
  50581. //默认填充颜色
  50582. var defaultFillColor = "#ff9277";
  50583. // setting 属性是否已成功赋值
  50584. if (!this.setting) {
  50585. return false;
  50586. }
  50587. var sets = this.setting;
  50588. // 检测 setting 的必设参数
  50589. if (!(sets.codomain)) {
  50590. return false;
  50591. }
  50592. // 数据
  50593. var decimalNumber = (typeof(sets.decimalNumber) !== "undefined" && !isNaN(sets.decimalNumber)) ? sets.decimalNumber : -1;
  50594. var dataEffective = Theme_Theme.getDataValues(this.data, this.fields, decimalNumber);
  50595. this.dataValues = dataEffective ? dataEffective : [];
  50596. // 数据值数组
  50597. var fv = this.dataValues;
  50598. //if(fv.length != 1) return; // 没有数据 或者数据不唯一
  50599. //if(fv[0] < 0) return; //数据为负值
  50600. //用户应该定义最大 最小半径 默认最大半径MaxR:100 最小半径MinR:0;
  50601. if (!sets.maxR) {
  50602. sets.maxR = 100;
  50603. }
  50604. if (!sets.minR) {
  50605. sets.minR = 0;
  50606. }
  50607. // 值域范围
  50608. var codomain = this.DVBCodomain;
  50609. // 重要步骤:定义Circle数据视图框中单位值的含义,单位值:1所代表的长度
  50610. // 用户定义了值域范围
  50611. if (codomain && codomain[1] - codomain[0] > 0) {
  50612. this.DVBUnitValue = sets.maxR / (codomain[1] - codomain[0]);
  50613. } else {
  50614. //this.DVBUnitValue = sets.maxR / maxValue;
  50615. this.DVBUnitValue = sets.maxR;
  50616. }
  50617. var uv = this.DVBUnitValue;
  50618. //圆半径
  50619. var r = fv[0] * uv + sets.minR;
  50620. this.width = 2 * r;
  50621. this.height = 2 * r;
  50622. // 重要步骤:初始化参数
  50623. if (!this.initBaseParameter()) {
  50624. return;
  50625. }
  50626. //假如用户设置了值域范围 没有在值域范围直接返回
  50627. if (codomain) {
  50628. if (fv[0] < codomain[0] || fv[0] > codomain[1]) {
  50629. return;
  50630. }
  50631. }
  50632. var dvbCenter = this.DVBCenterPoint; // 数据视图框中心作为圆心
  50633. //圆形对象参数
  50634. var circleSP = new Circle_Circle(dvbCenter[0], dvbCenter[1], r);
  50635. //circleSP.sytle 初始化
  50636. circleSP.style = ShapeFactory.ShapeStyleTool(null, sets.circleStyle, null, null, 0);
  50637. //图形的填充颜色
  50638. if (typeof (sets.fillColor) !== "undefined") {
  50639. //用户自定义
  50640. circleSP.style.fillColor = sets.fillColor;
  50641. } else {
  50642. //当前默认
  50643. circleSP.style.fillColor = defaultFillColor;
  50644. }
  50645. //圆形 Hover样式
  50646. circleSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.circleHoverStyle);
  50647. //圆形 Hover 与 click 设置
  50648. if (typeof(sets.circleHoverAble) !== "undefined") {
  50649. circleSP.hoverable = sets.circleHoverAble;
  50650. }
  50651. if (typeof(sets.circleClickAble) !== "undefined") {
  50652. circleSP.clickable = sets.circleClickAble;
  50653. }
  50654. //图形携带的数据信息
  50655. circleSP.refDataID = this.data.id;
  50656. circleSP.dataInfo = {
  50657. field: this.fields[0],
  50658. r: r,
  50659. value: fv[0]
  50660. };
  50661. // 创建扇形并把此扇形添加到图表图形数组
  50662. this.shapes.push(this.shapeFactory.createShape(circleSP));
  50663. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  50664. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  50665. this.shapesConvertToRelativeCoordinate();
  50666. }
  50667. }
  50668. /**
  50669. * @typedef {Object} SuperMap.Feature.Theme.Circle.setting
  50670. * @property {Array.<number>} codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  50671. * @property {number} [maxR] - 圆形的最大半径。
  50672. * @property {number} [minR] - 圆形的最小半径。
  50673. * @property {string} [fillColor] - 圆形的填充色,如:fillColor: "#FFB980"。
  50674. * @property {Object} [circleStyle] - 圆形的基础 style,此参数控制圆形基础样式,优先级低于 circleStyleByFields 和 circleStyleByCodomain。
  50675. * @property {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  50676. * @property {Object} [circleHoverStyle] - 圆形 hover 状态时的样式,circleHoverAble 为 true 时有效。
  50677. * @property {boolean} [circleHoverAble=true] - 是否允许圆形使用 hover 状态。同时设置 circleHoverAble 和 circleClickAble 为 false,可以直接屏蔽图形对专题图层事件的响应。
  50678. * @property {boolean} [circleClickAble=true] - 是否允许圆形被点击。同时设置 circleHoverAble 和 circleClickAble 为 false,可以直接屏蔽图形对专题图层事件的响应。
  50679. *
  50680. */
  50681. SuperMap.Feature.Theme.Circle = Circle;
  50682. ;// CONCATENATED MODULE: ./src/common/overlay/Line.js
  50683. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  50684. * This program are made available under the terms of the Apache License, Version 2.0
  50685. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50686. /**
  50687. * @class SuperMap.Feature.Theme.Line
  50688. * @classdesc 折线图。
  50689. * @category Visualization Theme
  50690. * @example
  50691. * // pointStyleByCodomain 参数用法示例
  50692. * // pointStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  50693. * // start: 值域值下限(包含);
  50694. * // end: 值域值上限(不包含);
  50695. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <SuperMap.Feature.ShapeParameters.Point.style> 。
  50696. * // pointStyleByCodomain 数组形如:
  50697. * [
  50698. * {
  50699. * start:0,
  50700. * end:250,
  50701. * style:{
  50702. * fillColor:"#00CD00"
  50703. * }
  50704. * },
  50705. * {
  50706. * start:250,
  50707. * end:500,
  50708. * style:{
  50709. * fillColor:"#00EE00"
  50710. * }
  50711. * },
  50712. * {
  50713. * start:500,
  50714. * end:750,
  50715. * style:{
  50716. * fillColor:"#00FF7F"
  50717. * }
  50718. * },
  50719. * {
  50720. * start:750,
  50721. * end:1500,
  50722. * style:{
  50723. * fillColor:"#00FF00"
  50724. * }
  50725. * }
  50726. * ]
  50727. *
  50728. * @extends SuperMap.Feature.Theme.Graph
  50729. * @param {SuperMap.Feature.Vector} data - 用户数据。
  50730. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  50731. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  50732. * @param {SuperMap.Feature.Theme.Line.setting} setting - 图表配置对象。
  50733. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  50734. */
  50735. class Line extends Graph {
  50736. constructor(data, layer, fields, setting, lonlat, options) {
  50737. super(data, layer, fields, setting, lonlat, options);
  50738. this.CLASS_NAME = "SuperMap.Feature.Theme.Line";
  50739. }
  50740. /**
  50741. * @function SuperMap.Feature.Theme.Line.prototype.destroy
  50742. * @override
  50743. */
  50744. destroy() {
  50745. super.destroy();
  50746. }
  50747. /**
  50748. * @function SuperMap.Feature.Theme.Line.prototype.assembleShapes
  50749. * @description 装配图形(扩展接口)。
  50750. */
  50751. assembleShapes() {
  50752. // 图表配置对象
  50753. var sets = this.setting;
  50754. // 默认数据视图框
  50755. if (!sets.dataViewBoxParameter) {
  50756. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  50757. sets.dataViewBoxParameter = [45, 15, 15, 15];
  50758. } else {
  50759. sets.dataViewBoxParameter = [5, 5, 5, 5];
  50760. }
  50761. }
  50762. // 重要步骤:初始化参数
  50763. if (!this.initBaseParameter()) {
  50764. return;
  50765. }
  50766. var dvb = this.dataViewBox;
  50767. // 值域
  50768. var codomain = this.DVBCodomain;
  50769. // 重要步骤:定义图表 Bar 数据视图框中单位值的含义
  50770. this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
  50771. var uv = this.DVBUnitValue;
  50772. // 数据值数组
  50773. var fv = this.dataValues;
  50774. if (fv.length < 1) {
  50775. return;
  50776. } // 没有数据
  50777. // 获取 x 轴上的图形信息
  50778. var xShapeInfo = this.calculateXShapeInfo();
  50779. if (!xShapeInfo) {
  50780. return;
  50781. }
  50782. // 折线每个节点的 x 位置
  50783. var xsLoc = xShapeInfo.xPositions;
  50784. // 背景框,默认启用
  50785. if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
  50786. // 将背景框图形添加到模型的 shapes 数组,注意添加顺序,后添加的图形在先添加的图形之上。
  50787. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  50788. }
  50789. // 折线图必须使用坐标轴
  50790. this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
  50791. // var isDataEffective = true;
  50792. var xPx; // 折线节点 x 坐标
  50793. var yPx; // 折线节点 y 坐标
  50794. var poiLists = []; // 折线节点数组
  50795. var shapePois = []; // 折线节点图形数组
  50796. for (var i = 0, len = fv.length; i < len; i++) {
  50797. // 数据溢出值域检查
  50798. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  50799. // isDataEffective = false;
  50800. return null;
  50801. }
  50802. xPx = xsLoc[i];
  50803. yPx = dvb[1] - (fv[i] - codomain[0]) / uv;
  50804. // 折线节点参数对象
  50805. var poiSP = new Point_Point(xPx, yPx);
  50806. // 折线节点 style
  50807. poiSP.style = ShapeFactory.ShapeStyleTool({fillColor: "#ee9900"}, sets.pointStyle, sets.pointStyleByFields, sets.pointStyleByCodomain, i, fv[i]);
  50808. // 折线节点 hover 样式
  50809. poiSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.pointHoverStyle);
  50810. // 折线节点 hover click
  50811. if (typeof(sets.pointHoverAble) !== "undefined") {
  50812. poiSP.hoverable = sets.pointHoverAble;
  50813. }
  50814. if (typeof(sets.pointClickAble) !== "undefined") {
  50815. poiSP.clickable = sets.pointClickAble;
  50816. }
  50817. // 图形携带的数据信息
  50818. poiSP.refDataID = this.data.id;
  50819. poiSP.dataInfo = {
  50820. field: this.fields[i],
  50821. value: fv[i]
  50822. };
  50823. // 创建图形并把此图形添加到折线节点图形数组
  50824. shapePois.push(this.shapeFactory.createShape(poiSP));
  50825. // 添加折线节点到折线节点数组
  50826. var poi = [xPx, yPx];
  50827. poiLists.push(poi);
  50828. }
  50829. // 折线参数对象
  50830. var lineSP = new Line_Line(poiLists);
  50831. lineSP.style = ShapeFactory.ShapeStyleTool({strokeColor: "#ee9900"}, sets.lineStyle);
  50832. // 禁止事件响应
  50833. lineSP.clickable = false;
  50834. lineSP.hoverable = false;
  50835. var shapeLine = this.shapeFactory.createShape(lineSP);
  50836. this.shapes.push(shapeLine);
  50837. // 添加节点到图表图形数组
  50838. this.shapes = this.shapes.concat(shapePois);
  50839. // // 数据范围检测未通过,清空图形
  50840. // if (isDataEffective === false) {
  50841. // this.shapes = [];
  50842. // }
  50843. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  50844. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  50845. this.shapesConvertToRelativeCoordinate();
  50846. }
  50847. /**
  50848. * @function SuperMap.Feature.Theme.Line.prototype.calculateXShapeInfo
  50849. * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
  50850. * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
  50851. * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  50852. * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  50853. * 本函数中图形配置对象 setting 可设属性:<br>
  50854. * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
  50855. * 长度为 2 的数组,第一元素表示第折线左端点与数据视图框左端的空白间距,第二个元素表示折线右端点右端与数据视图框右端端的空白间距 。
  50856. * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:<br>
  50857. * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。<br>
  50858. * width - {number} 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  50859. */
  50860. calculateXShapeInfo() {
  50861. var dvb = this.dataViewBox; // 数据视图框
  50862. var sets = this.setting; // 图表配置对象
  50863. var fvc = this.dataValues.length; // 数组值个数
  50864. if (fvc < 1) {
  50865. return null;
  50866. }
  50867. var xBlank; // x 轴空白间隔参数
  50868. var xShapePositions = []; // x 轴上图形的位置
  50869. var xShapeWidth = 0; // x 轴上图形宽度(自适应)
  50870. var dvbWidth = this.DVBWidth; // 数据视图框宽度
  50871. var unitOffset = 0; // 单位偏移量
  50872. // x 轴空白间隔参数处理
  50873. if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 2) {
  50874. xBlank = sets.xShapeBlank;
  50875. var xsLen = dvbWidth - (xBlank[0] + xBlank[1]);
  50876. if (xsLen <= fvc) {
  50877. return null;
  50878. }
  50879. unitOffset = xsLen / (fvc - 1);
  50880. } else {
  50881. // 默认使用等距离空白间隔,空白间隔为图形宽度
  50882. unitOffset = dvbWidth / (fvc + 1);
  50883. xBlank = [unitOffset, unitOffset, unitOffset];
  50884. }
  50885. // 图形 x 轴上的位置计算
  50886. var xOffset = 0
  50887. for (var i = 0; i < fvc; i++) {
  50888. if (i == 0) {
  50889. xOffset = xBlank[0];
  50890. } else {
  50891. xOffset += unitOffset;
  50892. }
  50893. xShapePositions.push(dvb[0] + xOffset);
  50894. }
  50895. return {
  50896. "xPositions": xShapePositions,
  50897. "width": xShapeWidth
  50898. };
  50899. }
  50900. }
  50901. /**
  50902. * @typedef {Object} SuperMap.Feature.Theme.Line.setting
  50903. * @property {number} width - 专题要素(图表)宽度。
  50904. * @property {number} height - 专题要素(图表)高度。
  50905. * @property {Array.<number>} codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  50906. * @property {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  50907. * @property {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  50908. * @property {Array.<number>} [dataViewBoxParameter] - {Array.<number>} 数据视图框 dataViewBox 参数,
  50909. * 它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  50910. * 当使用坐标轴时 dataViewBoxParameter 的默认值为:[45, 15, 15, 15];不使用坐标轴时 dataViewBoxParameter 的默认值为:[5, 5, 5, 5]。
  50911. * @property {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  50912. * @property {boolean} [useBackground] - 是否使用图表背景框。
  50913. * @property {SuperMap.Feature.ShapeParameters.Rectangle.style} backgroundStyle - 背景样式。
  50914. * @property {Array.<number>} [backgroundRadius=[0, 0, 0, 0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4 ,
  50915. * 则 backgroundRadius 为 [r1、r2、r3、r4 ]。
  50916. * @property {Array.<number>} xShapeBlank - 水平方向上的图形空白间隔参数。长度为 2 的数组,第一元素表示折线左端点与数据视图框左端的空白间距,
  50917. * 第二个元素表示折线右端点右端与数据视图框右端端的空白间距。
  50918. * @property {SuperMap.Feature.ShapeParameters.Line.style} [axisStyle] - 坐标轴样式。
  50919. * @property {boolean} [axisUseArrow=false] - 坐标轴是否使用箭头。
  50920. * @property {number} [axisYTick=0] - y 轴刻度数量。
  50921. * @property {Array.<string>} [axisYLabels] - y 轴上的标签组内容,标签顺序沿着数据视图框左面条边自上而下,等距排布。例如:["1000", "750", "500", "250", "0"]。
  50922. * @property {SuperMap.Feature.ShapeParameters.Label.style} [axisYLabelsStyle] - y 轴上的标签组样式。
  50923. * @property {Array.<number>} [axisYLabelsOffset=0] - y 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 y 轴标签组横向上的偏移量,向左为正。
  50924. * 数组第二项表示 y 轴标签组纵向上的偏移量,向下为正。
  50925. * @property {Array.<string>} [axisXLabels] - x 轴上的标签组内容,标签顺序沿着数据视图框下面条边自左向右排布,例如:["92年", "95年", "99年"]。
  50926. * 标签排布规则:当标签数量与 xShapeInfo 中的属性 xShapeCenter 数量相同(即标签个数与数据个数相等时), 按照 xShapeCenter 提供的位置排布标签,
  50927. * 否则沿数据视图框下面条边等距排布标签。
  50928. * @property {SuperMap.Feature.ShapeParameters.Label.style} [axisXLabelsStyle] - x 轴上的标签组样式。
  50929. * @property {Array.<number>} [axisXLabelsOffset=0] - x 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 x 轴标签组横向上的偏移量,向左为正;
  50930. * 数组第二项表示 x 轴标签组纵向上的偏移量,向下为正;
  50931. * @property {boolean} [useXReferenceLine=true] - 是否使用水平参考线,如果为 true,在 axisYTick 大于 0 时有效,水平参考线是 y 轴刻度在数据视图框里的延伸。
  50932. * @property {SuperMap.Feature.ShapeParameters.Line.style} ]xReferenceLineStyle] - 水平参考线样式。
  50933. * @property {SuperMap.Feature.ShapeParameters.Line.style} [lineStyle] - 折线图中折线 style。
  50934. * @property {SuperMap.Feature.ShapeParameters.Point.style} [pointStyle] - 折线图中折线节点基础 style,此参数控制折线节点基础样式,优先级低于 pointStyleByFields 和 pointStyleByCodomain。
  50935. * @property {SuperMap.Feature.ShapeParameters.Point.style} [pointStyleByFields] - 按专题字段 themeFields(<SuperMap.Layer.Graph.themeFields>)为折线节点赋 style,此参数按字段控制折线节点样式,
  50936. * 优先级低于 pointStyleByCodomain,高于 pointStyle。此数组中的元素是样式对象。
  50937. * 此参数中的 style 与 themeFields 中的字段一一对应 。例如: themeFields(<SuperMap.Layer.Graph.themeFields|L.supermap.graphThemeLayer.themeFields|ol.source.Graph.themeFields|mapboxgl.supermap.GraphThemeLayer.themeFields>) 为 ["POP_1992", "POP_1995", "POP_1999"],
  50938. * pointStyleByFields 为[style1, style2, style3],则在图表中,字段 POP_1992 对应的折线节点使用 style1,字段 POP_1995 对应的折线节点使用 style2 ,字段 POP_1999 对应的折线节点使用 style3。
  50939. * @property {Array.<Object>} pointStyleByCodomain - 按折线节点代表的数据值所在值域范围控制折线节点样式,优先级高于 pointStyle 和 pointStyleByFields。
  50940. * @property {Object} [pointHoverStyle=true] - 折线节点 hover 状态时的样式,pointHoverAble 为 true 时有效。
  50941. * @property {boolean} [pointHoverAble=true] - 是否允许折线节点使用 hover 状态。同时设置 pointHoverAble 和 pointClickAble 为 false,可以直接屏蔽折线节点对专题图层事件的响应。
  50942. * @property {boolean} [pointClickAble=true] - 是否允许折线节点被点击。同时设置 pointHoverAble 和 pointClickAble 为 false,可以直接屏蔽折线节点对专题图层事件的响应。
  50943. */
  50944. SuperMap.Feature.Theme.Line = Line;
  50945. ;// CONCATENATED MODULE: ./src/common/overlay/Pie.js
  50946. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  50947. * This program are made available under the terms of the Apache License, Version 2.0
  50948. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50949. /**
  50950. * @class SuperMap.Feature.Theme.Pie
  50951. * @classdesc 饼图。
  50952. * @category Visualization Theme
  50953. * @param {SuperMap.Feature.Vector} data - 用户数据。
  50954. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  50955. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  50956. * @param {SuperMap.Feature.Theme.Point.setting} setting - 图表配置对象。
  50957. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  50958. * @extends SuperMap.Feature.Theme.Graph
  50959. * @example
  50960. * // sectorStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  50961. * // start: 值域值下限(包含);
  50962. * // end: 值域值上限(不包含);
  50963. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <SuperMap.Feature.ShapeParameters.Sector.style> 。
  50964. * // sectorStyleByCodomain 数组形如:
  50965. * [
  50966. * {
  50967. * start:0,
  50968. * end:250,
  50969. * style:{
  50970. * fillColor:"#00CD00"
  50971. * }
  50972. * },
  50973. * {
  50974. * start:250,
  50975. * end:500,
  50976. * style:{
  50977. * fillColor:"#00EE00"
  50978. * }
  50979. * },
  50980. * {
  50981. * start:500,
  50982. * end:750,
  50983. * style:{
  50984. * fillColor:"#00FF7F"
  50985. * }
  50986. * },
  50987. * {
  50988. * start:750,
  50989. * end:1500,
  50990. * style:{
  50991. * fillColor:"#00FF00"
  50992. * }
  50993. * }
  50994. * ]
  50995. * @extends {SuperMap.Feature.Theme.Graph}
  50996. */
  50997. class Pie extends Graph {
  50998. constructor(data, layer, fields, setting, lonlat) {
  50999. super(data, layer, fields, setting, lonlat);
  51000. this.CLASS_NAME = "SuperMap.Feature.Theme.Pie";
  51001. }
  51002. /**
  51003. * @function SuperMap.Feature.Theme.Pie.prototype.destroy
  51004. * @description 销毁此专题要素。调用 destroy 后此对象所以属性置为 null。
  51005. */
  51006. destroy() {
  51007. super.destroy();
  51008. }
  51009. /**
  51010. * @function SuperMap.Feature.Theme.Pie.prototype.assembleShapes
  51011. * @description 装配图形(扩展接口)。
  51012. */
  51013. assembleShapes() {
  51014. // 图表配置对象
  51015. var sets = this.setting;
  51016. // 一个默认 style 组
  51017. var defaultStyleGroup = [
  51018. {fillColor: "#ff9277"}, {fillColor: "#dddd00"}, {fillColor: "#ffc877"}, {fillColor: "#bbe3ff"}, {fillColor: "#d5ffbb"},
  51019. {fillColor: "#bbbbff"}, {fillColor: "#ddb000"}, {fillColor: "#b0dd00"}, {fillColor: "#e2bbff"}, {fillColor: "#ffbbe3"},
  51020. {fillColor: "#ff7777"}, {fillColor: "#ff9900"}, {fillColor: "#83dd00"}, {fillColor: "#77e3ff"}, {fillColor: "#778fff"},
  51021. {fillColor: "#c877ff"}, {fillColor: "#ff77ab"}, {fillColor: "#ff6600"}, {fillColor: "#aa8800"}, {fillColor: "#77c7ff"},
  51022. {fillColor: "#ad77ff"}, {fillColor: "#ff77ff"}, {fillColor: "#dd0083"}, {fillColor: "#777700"}, {fillColor: "#00aa00"},
  51023. {fillColor: "#0088aa"}, {fillColor: "#8400dd"}, {fillColor: "#aa0088"}, {fillColor: "#dd0000"}, {fillColor: "#772e00"}
  51024. ];
  51025. // 重要步骤:初始化参数
  51026. if (!this.initBaseParameter()) {
  51027. return;
  51028. }
  51029. // 背景框,默认不启用
  51030. if (sets.useBackground) {
  51031. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  51032. }
  51033. // 数据值数组
  51034. var fv = this.dataValues;
  51035. if (fv.length < 1) {
  51036. return;
  51037. } // 没有数据
  51038. // 值域范围
  51039. var codomain = this.DVBCodomain;
  51040. // 值域范围检测
  51041. for (let i = 0; i < fv.length; i++) {
  51042. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  51043. return;
  51044. }
  51045. }
  51046. // 值的绝对值总和
  51047. var valueSum = 0;
  51048. for (let i = 0; i < fv.length; i++) {
  51049. valueSum += Math.abs(fv[i]);
  51050. }
  51051. // 重要步骤:定义图表 Pie 数据视图框中单位值的含义,单位值:每度代表的数值
  51052. this.DVBUnitValue = 360 / valueSum;
  51053. var uv = this.DVBUnitValue;
  51054. var dvbCenter = this.DVBCenterPoint; // 数据视图框中心作为扇心
  51055. var startAngle = 0; // 扇形起始边角度
  51056. var endAngle = 0; // 扇形终止边角度
  51057. var startAngleTmp = startAngle; // 扇形临时起始边角度
  51058. // 扇形(自适应)半径
  51059. var r = this.DVBHeight < this.DVBWidth ? this.DVBHeight / 2 : this.DVBWidth / 2;
  51060. for (var i = 0; i < fv.length; i++) {
  51061. var fvi = Math.abs(fv[i]);
  51062. //计算终止角
  51063. if (i === 0) {
  51064. endAngle = startAngle + fvi * uv;
  51065. } else if (i === fvi.length - 1) {
  51066. endAngle = startAngleTmp;
  51067. } else {
  51068. endAngle = startAngle + fvi * uv;
  51069. }
  51070. //矫正误差计算
  51071. if ((endAngle - startAngle) >= 360) {
  51072. endAngle = 359.9999999;
  51073. }
  51074. // 扇形参数对象
  51075. var sectorSP = new Sector(dvbCenter[0], dvbCenter[1], r, startAngle, endAngle);
  51076. // 扇形样式
  51077. if (typeof(sets.sectorStyleByFields) === "undefined") {
  51078. // 使用默认 style 组
  51079. var colorIndex = i % defaultStyleGroup.length;
  51080. sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, defaultStyleGroup, null, colorIndex);
  51081. } else {
  51082. sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, sets.sectorStyleByFields, sets.sectorStyleByCodomain, i, fv[i]);
  51083. }
  51084. // 扇形 hover 样式
  51085. sectorSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.sectorHoverStyle);
  51086. // 扇形 hover 与 click 设置
  51087. if (typeof(sets.sectorHoverAble) !== "undefined") {
  51088. sectorSP.hoverable = sets.sectorHoverAble;
  51089. }
  51090. if (typeof(sets.sectorClickAble) !== "undefined") {
  51091. sectorSP.clickable = sets.sectorClickAble;
  51092. }
  51093. // 图形携带的数据信息
  51094. sectorSP.refDataID = this.data.id;
  51095. sectorSP.dataInfo = {
  51096. field: this.fields[i],
  51097. value: fv[i]
  51098. };
  51099. // 创建扇形并把此扇形添加到图表图形数组
  51100. this.shapes.push(this.shapeFactory.createShape(sectorSP));
  51101. // 把上一次的结束角度作为下一次的起始角度
  51102. startAngle = endAngle;
  51103. }
  51104. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  51105. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  51106. this.shapesConvertToRelativeCoordinate();
  51107. }
  51108. }
  51109. /**
  51110. * @typedef {Object} SuperMap.Feature.Theme.Pie.setting
  51111. * @property {number} width - 专题要素(图表)宽度。
  51112. * @property {number} height - 专题要素(图表)高度。
  51113. * @property {Array.<number>} codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  51114. * @property {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  51115. * @property {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  51116. * @property {Array.<number>} [dataViewBoxParameter=[0, 0, 0, 0]] - 数据视图框 dataViewBox 参数,
  51117. * 它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  51118. * @property {Array.<number>} decimalNumber - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  51119. * @property {boolean} [useBackground=false] - 是否使用图表背景框。
  51120. * @property {SuperMap.Feature.ShapeParameters.Rectangle.style} backgroundStyle - 背景样式。
  51121. * @property {Array.<number>} [backgroundRadius=[0, 0, 0, 0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4 ,则 backgroundRadius 为 [r1、r2、r3、r4 ]。
  51122. * @property {SuperMap.Feature.ShapeParameters.Sector.style} sectorStyle - 饼图中扇形的基础 style,此参数控制饼图扇形基础样式,优先级低于 sectorStyleByFields 和 sectorStyleByCodomain。
  51123. * @property {Array.<SuperMap.Feature.ShapeParameters.Sector.style>} sectorStyleByFields - 按专题字段 themeFields(<SuperMap.Layer.Graph.themeFields>)为饼图扇形赋 style,此参数按字段控制饼图扇形样式,优先级低于 sectorStyleByCodomain,高于 sectorStyle。此参数中的 style 与 themeFields 中的字段一一对应 。例如: themeFields(<SuperMap.Layer.Graph.themeFields>) 为 ["POP_1992", "POP_1995", "POP_1999"],
  51124. * sectorStyleByFields 为[style1, style2, style3],则在图表中,字段 POP_1992 对应的饼图扇形使用 style1,字段 POP_1995 对应的饼图扇形使用 style2 ,字段 POP_1999 对应的饼图扇形使用 style3。
  51125. * @property {Array.<Object>} sectorStyleByCodomain - 按饼图扇形代表的数据值所在值域范围控制饼图扇形样式,优先级高于 sectorStyle 和 sectorStyleByFields。
  51126. * @property {Object} [sectorHoverStyle] 饼图扇形 hover 状态时的样式,sectorHoverAble 为 true 时有效。
  51127. * @property {boolean} [sectorHoverAble=true] 是否允许饼图扇形使用 hover 状态。同时设置 sectorHoverAble 和 sectorClickAble 为 false,可以直接屏蔽饼图扇形对专题图层事件的响应。
  51128. * @property {boolean} [sectorClickAble=true] 是否允许饼图扇形被点击。同时设置 sectorHoverAble 和 sectorClickAble 为 false,可以直接屏蔽饼图扇形对专题图层事件的响应。
  51129. */
  51130. SuperMap.Feature.Theme.Pie = Pie;
  51131. ;// CONCATENATED MODULE: ./src/common/overlay/Point.js
  51132. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  51133. * This program are made available under the terms of the Apache License, Version 2.0
  51134. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51135. /**
  51136. * @class SuperMap.Feature.Theme.Point
  51137. * @classdesc 点状图。
  51138. * @category Visualization Theme
  51139. * @param {SuperMap.Feature.Vector} data - 用户数据。
  51140. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  51141. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  51142. * @param {SuperMap.Feature.Theme.Point.setting} setting - 图表配置对象。
  51143. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  51144. * @example
  51145. * // pointStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  51146. * // start: 值域值下限(包含);
  51147. * // end: 值域值上限(不包含);
  51148. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <SuperMap.Feature.ShapeParameters.Point.style> 。
  51149. * // pointStyleByCodomain 数组形如:
  51150. * [
  51151. * {
  51152. * start:0,
  51153. * end:250,
  51154. * style:{
  51155. * fillColor:"#00CD00"
  51156. * }
  51157. * },
  51158. * {
  51159. * start:250,
  51160. * end:500,
  51161. * style:{
  51162. * fillColor:"#00EE00"
  51163. * }
  51164. * },
  51165. * {
  51166. * start:500,
  51167. * end:750,
  51168. * style:{
  51169. * fillColor:"#00FF7F"
  51170. * }
  51171. * },
  51172. * {
  51173. * start:750,
  51174. * end:1500,
  51175. * style:{
  51176. * fillColor:"#00FF00"
  51177. * }
  51178. * }
  51179. * ]
  51180. *@extends {SuperMap.Feature.Theme.Graph}
  51181. */
  51182. class overlay_Point_Point extends Graph {
  51183. constructor(data, layer, fields, setting, lonlat, options) {
  51184. super(data, layer, fields, setting, lonlat, options);
  51185. this.CLASS_NAME = "SuperMap.Feature.Theme.Point";
  51186. }
  51187. /**
  51188. * @function SuperMap.Feature.Theme.Point.prototype.destroy
  51189. * @description 销毁此专题要素。调用 destroy 后此对象所以属性置为 null。
  51190. */
  51191. destroy() {
  51192. super.destroy();
  51193. }
  51194. /**
  51195. * @function SuperMap.Feature.Theme.prototype.Point.assembleShapes
  51196. * @description 装配图形(扩展接口)。
  51197. */
  51198. assembleShapes() {
  51199. // 图表配置对象
  51200. var sets = this.setting;
  51201. // 默认数据视图框
  51202. if (!sets.dataViewBoxParameter) {
  51203. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  51204. sets.dataViewBoxParameter = [45, 15, 15, 15];
  51205. } else {
  51206. sets.dataViewBoxParameter = [5, 5, 5, 5];
  51207. }
  51208. }
  51209. // 重要步骤:初始化参数
  51210. if (!this.initBaseParameter()) {
  51211. return;
  51212. }
  51213. var dvb = this.dataViewBox;
  51214. // 值域
  51215. var codomain = this.DVBCodomain;
  51216. // 重要步骤:定义图表 Bar 数据视图框中单位值的含义
  51217. this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
  51218. var uv = this.DVBUnitValue;
  51219. var fv = this.dataValues;
  51220. // 获取 x 轴上的图形信息
  51221. var xShapeInfo = this.calculateXShapeInfo();
  51222. if (!xShapeInfo) {
  51223. return;
  51224. }
  51225. // 折线每个节点的 x 位置
  51226. var xsLoc = xShapeInfo.xPositions;
  51227. // 背景框,默认启用
  51228. if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
  51229. // 将背景框图形添加到模型的 shapes 数组,注意添加顺序,后添加的图形在先添加的图形之上。
  51230. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  51231. }
  51232. // 点状图必须使用坐标轴
  51233. this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
  51234. var xPx; // 图形点 x 坐标
  51235. var yPx; // 图形点 y 坐标
  51236. for (var i = 0, len = fv.length; i < len; i++) {
  51237. // 数据溢出值域检查
  51238. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  51239. //isDataEffective = false;
  51240. return null;
  51241. }
  51242. xPx = xsLoc[i];
  51243. yPx = dvb[1] - (fv[i] - codomain[0]) / uv;
  51244. // 图形点参数对象
  51245. var poiSP = new Point_Point(xPx, yPx);
  51246. // 图形点 style
  51247. poiSP.style = ShapeFactory.ShapeStyleTool({fillColor: "#ee9900"}, sets.pointStyle, sets.pointStyleByFields, sets.pointStyleByCodomain, i, fv[i]);
  51248. // 图形点 hover 样式
  51249. poiSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.pointHoverStyle);
  51250. // 图形点 hover click
  51251. if (typeof(sets.pointHoverAble) !== "undefined") {
  51252. poiSP.hoverable = sets.pointHoverAble;
  51253. }
  51254. if (typeof(sets.pointClickAble) !== "undefined") {
  51255. poiSP.clickable = sets.pointClickAble;
  51256. }
  51257. // 图形携带的数据信息
  51258. poiSP.refDataID = this.data.id;
  51259. poiSP.dataInfo = {
  51260. field: this.fields[i],
  51261. value: fv[i]
  51262. };
  51263. // 创建图形点并把此图形添加到图表图形数组
  51264. this.shapes.push(this.shapeFactory.createShape(poiSP));
  51265. }
  51266. // 数据范围检测未通过,清空图形
  51267. // if (isDataEffective === false) {
  51268. // this.shapes = [];
  51269. // }
  51270. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  51271. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  51272. this.shapesConvertToRelativeCoordinate();
  51273. }
  51274. /**
  51275. * @function SuperMap.Feature.Theme.Point.prototype.calculateXShapeInfo
  51276. * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
  51277. * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
  51278. * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  51279. * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  51280. * 本函数中图形配置对象 setting 可设属性:<br>
  51281. * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
  51282. * 长度为 2 的数组,第一元素表示第折线左端点与数据视图框左端的空白间距,第二个元素表示折线右端点右端与数据视图框右端端的空白间距 。
  51283. * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:<br>
  51284. * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  51285. * width - {number}表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  51286. */
  51287. calculateXShapeInfo() {
  51288. var dvb = this.dataViewBox; // 数据视图框
  51289. var sets = this.setting; // 图表配置对象
  51290. var fvc = this.dataValues.length; // 数组值个数
  51291. if (fvc < 1) {
  51292. return null;
  51293. }
  51294. var xBlank; // x 轴空白间隔参数
  51295. var xShapePositions = []; // x 轴上图形的位置
  51296. var xShapeWidth = 0; // x 轴上图形宽度(自适应)
  51297. var dvbWidth = this.DVBWidth; // 数据视图框宽度
  51298. var unitOffset = 0; // 单位偏移量
  51299. // x 轴空白间隔参数处理
  51300. if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 2) {
  51301. xBlank = sets.xShapeBlank;
  51302. var xsLen = dvbWidth - (xBlank[0] + xBlank[1]);
  51303. if (xsLen <= fvc) {
  51304. return null;
  51305. }
  51306. unitOffset = xsLen / (fvc - 1);
  51307. } else {
  51308. // 默认使用等距离空白间隔,空白间隔为图形宽度
  51309. unitOffset = dvbWidth / (fvc + 1);
  51310. xBlank = [unitOffset, unitOffset, unitOffset];
  51311. }
  51312. // 图形 x 轴上的位置计算
  51313. var xOffset = 0
  51314. for (var i = 0; i < fvc; i++) {
  51315. if (i == 0) {
  51316. xOffset = xBlank[0];
  51317. } else {
  51318. xOffset += unitOffset;
  51319. }
  51320. xShapePositions.push(dvb[0] + xOffset);
  51321. }
  51322. return {
  51323. "xPositions": xShapePositions,
  51324. "width": xShapeWidth
  51325. };
  51326. }
  51327. }
  51328. /**
  51329. * @typedef {Object} SuperMap.Feature.Theme.Point.setting
  51330. * @property {number} width - 专题要素(图表)宽度。
  51331. * @property {number} height - 专题要素(图表)高度。
  51332. * @property {Array.<number>} codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  51333. * @property {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  51334. * @property {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  51335. * @property {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,
  51336. * 它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  51337. * 当使用坐标轴时 dataViewBoxParameter 的默认值为:[45, 15, 15, 15];不使用坐标轴时 dataViewBoxParameter 的默认值为:[5, 5, 5, 5]。
  51338. * @property {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  51339. * @property {boolean} [useBackground] - 是否使用图表背景框。
  51340. * @property {SuperMap.Feature.ShapeParameters.Rectangle.style} backgroundStyle - 背景样式。
  51341. * @property {Array.<number>} [backgroundRadius=[0, 0, 0, 0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4 ,
  51342. * 则 backgroundRadius 为 [r1、r2、r3、r4 ]。
  51343. * @property {Array.<number>} xShapeBlank - 水平方向上的图形空白间隔参数。
  51344. * 长度为 2 的数组,第一个元素表示第一个(沿 x 轴方向)图形点与数据视图框左端的空白间距,第二个元素表示最后一个(沿 x 轴方向)图形点与数据视图框右端端的空白间距 。
  51345. * @property {Object} axisStyle - 坐标轴样式。
  51346. * @property {boolean} [axisUseArrow=false] - 坐标轴是否使用箭头。
  51347. * @property {number} [axisYTick=0] - y 轴刻度数量。
  51348. * @property {Array.<string>} [axisYLabels] - y 轴上的标签组内容,标签顺序沿着数据视图框左面条边自上而下,等距排布。例如:["1000", "750", "500", "250", "0"]。
  51349. * @property {SuperMap.Feature.ShapeParameters.Label.style} [axisYLabelsStyle] - y 轴上的标签组样式。
  51350. * @property {Array.<number>} [axisYLabelsOffset=0] - y 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 y 轴标签组横向上的偏移量,向左为正;
  51351. * 数组第二项表示 y 轴标签组纵向上的偏移量,向下为正。
  51352. * @property {Array.<string>} [axisXLabels] - x 轴上的标签组内容,标签顺序沿着数据视图框下面条边自左向右排布,例如:["92年", "95年", "99年"]。
  51353. * 标签排布规则:当标签数量与 xShapeInfo 中的属性 xShapeCenter 数量相同(即标签个数与数据个数相等时), 按照 xShapeCenter 提供的位置排布标签,
  51354. * 否则沿数据视图框下面条边等距排布标签。
  51355. * @property {SuperMap.Feature.ShapeParameters.Label.style} [axisXLabelsStyle] - x 轴上的标签组样式。
  51356. * @property {Array.<number>} [axisXLabelsOffset=0] - x 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 x 轴标签组横向上的偏移量,向左为正,
  51357. * 数组第二项表示 x 轴标签组纵向上的偏移量,向下为正。
  51358. * @property {boolean} [useXReferenceLine=true] - 是否使用水平参考线,如果为 true,在 axisYTick 大于 0 时有效,水平参考线是 y 轴刻度在数据视图框里的延伸。
  51359. * @property {SuperMap.Feature.ShapeParameters.Line.style} [xReferenceLineStyle] - 水平参考线样式。
  51360. * @property {SuperMap.Feature.ShapeParameters.Point.style} [pointStyle] - 点状图中图形点基础 style,此参数控制图形点基础样式,优先级低于 pointStyleByFields 和 pointStyleByCodomain。
  51361. * @property {Array.<SuperMap.Feature.ShapeParameters.Point.style>} [pointStyleByFields] - 按专题字段 themeFields(<SuperMap.Layer.Graph.themeFields>)为图形点赋 style,此参数按字段控制图形点样式,
  51362. * 优先级低于 pointStyleByCodomain,高于 pointStyle。此数组中的元素是样式对象。
  51363. * 此参数中的 style 与 themeFields 中的字段一一对应 。例如: themeFields(<SuperMap.Layer.Graph.themeFields>) 为 ["POP_1992", "POP_1995", "POP_1999"],
  51364. * pointStyleByFields 为[style1, style2, style3],则在图表中,字段 POP_1992 对应的图形点使用 style1,字段 POP_1995 对应的图形点使用 style2 ,字段 POP_1999 对应的图形点使用 style3。
  51365. * @property {Array.<Object>} pointStyleByCodomain - 按图形点代表的数据值所在值域范围控制图形点样式,优先级高于 pointStyle 和 pointStyleByFields。
  51366. * @property {Object} [pointHoverStyle] - 图形点 hover 状态时的样式,pointHoverAble 为 true 时有效。
  51367. * @property {Object} [pointHoverAble=true] - 是否允许图形点使用 hover 状态。同时设置 pointHoverAble 和 pointClickAble 为 false,可以直接屏蔽图形点对专题图层事件的响应。
  51368. * @property {Object} [pointClickAble=true] - 是否允许图形点被点击。同时设置 pointHoverAble 和 pointClickAble 为 false,可以直接屏蔽图形点对专题图层事件的响应。
  51369. */
  51370. SuperMap.Feature.Theme.Point = overlay_Point_Point;
  51371. ;// CONCATENATED MODULE: ./src/common/overlay/Ring.js
  51372. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  51373. * This program are made available under the terms of the Apache License, Version 2.0
  51374. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51375. /**
  51376. * @class SuperMap.Feature.Theme.Ring
  51377. * @classdesc 环状图。
  51378. * @category Visualization Theme
  51379. * @description 基于路由对象计算指定点 M 值操作的参数类。通过该类提供参数信息。
  51380. * @param {SuperMap.Feature.Vector} data - 用户数据。
  51381. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  51382. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  51383. * @param {SuperMap.Feature.Theme.Ring.setting} setting - 图表配置对象。
  51384. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  51385. * @example
  51386. * // sectorStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  51387. * // start: 值域值下限(包含);
  51388. * // end: 值域值上限(不包含);
  51389. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <SuperMap.Feature.ShapeParameters.Sector.style> 。
  51390. * // sectorStyleByCodomain 数组形如:
  51391. * [
  51392. * {
  51393. * start:0,
  51394. * end:250,
  51395. * style:{
  51396. * fillColor:"#00CD00"
  51397. * }
  51398. * },
  51399. * {
  51400. * start:250,
  51401. * end:500,
  51402. * style:{
  51403. * fillColor:"#00EE00"
  51404. * }
  51405. * },
  51406. * {
  51407. * start:500,
  51408. * end:750,
  51409. * style:{
  51410. * fillColor:"#00FF7F"
  51411. * }
  51412. * },
  51413. * {
  51414. * start:750,
  51415. * end:1500,
  51416. * style:{
  51417. * fillColor:"#00FF00"
  51418. * }
  51419. * }
  51420. * ]
  51421. * @param {Object} [sectorHoverStyle=true] - 环状图扇形 hover 状态时的样式,sectorHoverAble 为 true 时有效。
  51422. * @param {boolean} [sectorHoverAble=true] - 是否允许环状图扇形使用 hover 状态。同时设置 sectorHoverAble 和 sectorClickAble 为 false,可以直接屏蔽环状图扇形对专题图层事件的响应。
  51423. * @param {boolean} [sectorClickAble=true] - 是否允许环状图扇形被点击。同时设置 sectorHoverAble 和 sectorClickAble 为 false,可以直接屏蔽环状图扇形对专题图层事件的响应。
  51424. *
  51425. * @extends {SuperMap.Feature.Theme.Graph}
  51426. */
  51427. class Ring extends Graph {
  51428. constructor(data, layer, fields, setting, lonlat) {
  51429. super(data, layer, fields, setting, lonlat);
  51430. this.CLASS_NAME = "SuperMap.Feature.Theme.Ring";
  51431. }
  51432. /**
  51433. * @function SuperMap.Feature.Theme.Ring.prototype.destroy
  51434. * @description 销毁此专题要素。调用 destroy 后此对象所以属性置为 null。
  51435. */
  51436. destroy() {
  51437. super.destroy();
  51438. }
  51439. /**
  51440. * @function SuperMap.Feature.Theme.Ring.prototype.assembleShapes
  51441. * @description 装配图形(扩展接口)。
  51442. */
  51443. assembleShapes() {
  51444. // 重要步骤:初始化参数
  51445. if (!this.initBaseParameter()) {
  51446. return;
  51447. }
  51448. // 一个默认 style 组
  51449. var defaultStyleGroup = [
  51450. {fillColor: "#ff9277"}, {fillColor: "#dddd00"}, {fillColor: "#ffc877"}, {fillColor: "#bbe3ff"}, {fillColor: "#d5ffbb"},
  51451. {fillColor: "#bbbbff"}, {fillColor: "#ddb000"}, {fillColor: "#b0dd00"}, {fillColor: "#e2bbff"}, {fillColor: "#ffbbe3"},
  51452. {fillColor: "#ff7777"}, {fillColor: "#ff9900"}, {fillColor: "#83dd00"}, {fillColor: "#77e3ff"}, {fillColor: "#778fff"},
  51453. {fillColor: "#c877ff"}, {fillColor: "#ff77ab"}, {fillColor: "#ff6600"}, {fillColor: "#aa8800"}, {fillColor: "#77c7ff"},
  51454. {fillColor: "#ad77ff"}, {fillColor: "#ff77ff"}, {fillColor: "#dd0083"}, {fillColor: "#777700"}, {fillColor: "#00aa00"},
  51455. {fillColor: "#0088aa"}, {fillColor: "#8400dd"}, {fillColor: "#aa0088"}, {fillColor: "#dd0000"}, {fillColor: "#772e00"}
  51456. ];
  51457. // 图表配置对象
  51458. var sets = this.setting;
  51459. // 背景框,默认不启用
  51460. if (sets.useBackground) {
  51461. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  51462. }
  51463. // 数据值数组
  51464. var fv = this.dataValues;
  51465. if (fv.length < 1) {
  51466. return;
  51467. } // 没有数据
  51468. // 值域范围
  51469. var codomain = this.DVBCodomain;
  51470. // 值域范围检测
  51471. for (let i = 0; i < fv.length; i++) {
  51472. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  51473. return;
  51474. }
  51475. }
  51476. // 值的绝对值总和
  51477. var valueSum = 0;
  51478. for (let i = 0; i < fv.length; i++) {
  51479. valueSum += Math.abs(fv[i]);
  51480. }
  51481. // 重要步骤:定义图表 Ring 数据视图框中单位值的含义,单位值:每度代表的数值
  51482. this.DVBUnitValue = 360 / valueSum;
  51483. var uv = this.DVBUnitValue;
  51484. var dvbCenter = this.DVBCenterPoint; // 数据视图框中心作为扇心
  51485. var startAngle = 0; // 扇形起始边角度
  51486. var endAngle = 0; // 扇形终止边角度
  51487. var startAngleTmp = startAngle; // 扇形临时起始边角度
  51488. // 扇形外环(自适应)半径
  51489. var r = this.DVBHeight < this.DVBWidth ? this.DVBHeight / 2 : this.DVBWidth / 2;
  51490. // 扇形内环(自适应)半径
  51491. var isInRange = sets.innerRingRadius >= 0 && sets.innerRingRadius < r;
  51492. var r0 = (
  51493. typeof(sets.innerRingRadius) !== "undefined"
  51494. && !isNaN(sets.innerRingRadius)
  51495. && isInRange
  51496. ) ? sets.innerRingRadius : 0;
  51497. for (var i = 0; i < fv.length; i++) {
  51498. var fvi = Math.abs(fv[i]);
  51499. // 计算结束角度
  51500. if (i === 0) {
  51501. endAngle = startAngle + fvi * uv;
  51502. } else if (i === fvi.length - 1) {
  51503. endAngle = startAngleTmp;
  51504. } else {
  51505. endAngle = startAngle + fvi * uv;
  51506. }
  51507. // 扇形参数对象
  51508. var sectorSP = new Sector(dvbCenter[0], dvbCenter[1], r, startAngle, endAngle, r0);
  51509. // 扇形样式
  51510. if (typeof(sets.sectorStyleByFields) === "undefined") {
  51511. // 使用默认 style 组
  51512. var colorIndex = i % defaultStyleGroup.length;
  51513. sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, defaultStyleGroup, null, colorIndex);
  51514. } else {
  51515. sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, sets.sectorStyleByFields, sets.sectorStyleByCodomain, i, fv[i]);
  51516. }
  51517. // 扇形 hover 样式
  51518. sectorSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.sectorHoverStyle);
  51519. // 扇形 hover 与 click 设置
  51520. if (typeof(sets.sectorHoverAble) !== "undefined") {
  51521. sectorSP.hoverable = sets.sectorHoverAble;
  51522. }
  51523. if (typeof(sets.sectorClickAble) !== "undefined") {
  51524. sectorSP.clickable = sets.sectorClickAble;
  51525. }
  51526. // 图形携带的数据信息
  51527. sectorSP.refDataID = this.data.id;
  51528. sectorSP.dataInfo = {
  51529. field: this.fields[i],
  51530. value: fv[i]
  51531. };
  51532. // 创建扇形并把此扇形添加到图表图形数组
  51533. this.shapes.push(this.shapeFactory.createShape(sectorSP));
  51534. // 把上一次的结束角度作为下一次的起始角度
  51535. startAngle = endAngle;
  51536. }
  51537. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  51538. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  51539. this.shapesConvertToRelativeCoordinate();
  51540. }
  51541. }
  51542. /**
  51543. * @typedef {Object} SuperMap.Feature.Theme.Ring.setting
  51544. * @property {number} width - 专题要素(图表)宽度。
  51545. * @property {number} height - 专题要素(图表)高度。
  51546. * @property {Array.<number>} codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  51547. * @property {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  51548. * @property {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  51549. * @property {Array.<number>} [dataViewBoxParameter=[0, 0, 0, 0]] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  51550. * @property {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  51551. * @property {boolean} [useBackground=false] - 是否使用图表背景框。
  51552. * @property {SuperMap.Feature.ShapeParameters.Rectangle.style} [backgroundStyle] - 背景样式,此样式对象对象可设属性。
  51553. * @property {Array.<number>} [backgroundRadius=[0, 0, 0, 0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4 ,则 backgroundRadius 为 [r1、r2、r3、r4 ]。
  51554. * @property {number} [innerRingRadius=0] - 环状图内环半径,取值范围大于 0,小于外环半径(外环半径:数据视图框长和宽中较小值的二分之一)。
  51555. * @property {SuperMap.Feature.ShapeParameters.Sector.style} [sectorStyle] - 环状图中扇形的基础 style,此参数控制环状图扇形基础样式,优先级低于 sectorStyleByFields 和 sectorStyleByCodomain。
  51556. * @property {Array.<SuperMap.Feature.ShapeParameters.Sector.style>} [sectorStyleByFields] - 按专题字段 themeFields({@link SuperMap.Layer.Graph.themeFields}|{@link L.supermap.graphThemeLayer.themeFields}|{@link ol.source.Graph.themeFields}|{@link mapboxgl.supermap.GraphThemeLayer.themeFields})为环状图扇形赋 style,此参数按字段控制环状图扇形样式,优先级低于 sectorStyleByCodomain,高于 sectorStyle。此数组中的元素是样式对象。此参数中的 style 与 themeFields 中的字段一一对应 。例如: themeFields(<SuperMap.Layer.Graph.themeFields>) 为 ["POP_1992", "POP_1995", "POP_1999"],sectorStyleByFields 为[style1, style2, style3],则在图表中,字段 POP_1992 对应的环状图扇形使用 style1,字段 POP_1995 对应的环状图扇形使用 style2 ,字段 POP_1999 对应的环状图扇形使用 style3。
  51557. * @property {Array.<SuperMap.Feature.ShapeParameters.Sector.style>} [sectorStyleByCodomain] - 按环状图扇形代表的数据值所在值域范围控制环状图扇形样式,优先级高于 sectorStyle 和 sectorStyleByFields。
  51558. */
  51559. SuperMap.Feature.Theme.Ring = Ring;
  51560. ;// CONCATENATED MODULE: ./src/common/overlay/ThemeVector.js
  51561. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  51562. * This program are made available under the terms of the Apache License, Version 2.0
  51563. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51564. /**
  51565. * @class SuperMap.Feature.Theme.Vector
  51566. * @classdesc 矢量专题要素类。
  51567. * @category Visualization Theme
  51568. * @extends SuperMap.Feature.Theme
  51569. * @param {SuperMap.Feature.Vector} data - 用户数据,的类型为矢量数据 feature。
  51570. * @param {SuperMap.Layer} layer - 此专题要素所在图层。
  51571. * @param {Object} style - 样式。
  51572. * @param {Object} options - 创建专题要素时的可选参数。
  51573. * @param {number} [options.nodesClipPixel=2] - 节点抽稀像素距离, 单位:像素。
  51574. * @param {boolean} [options.isHoverAble=true] - 图形是否可 hover。
  51575. * @param {boolean} [options.isMultiHover=true] - 是否使用多图形高亮,isHoverAble 为 true 时生效。
  51576. * @param {boolean} [options.isClickAble=true] - 图形是否可点击。
  51577. * @param {Object} [options.highlightStyle] - 高亮样式。
  51578. */
  51579. class ThemeVector extends Theme_Theme {
  51580. constructor(data, layer, style, options, shapeOptions) {
  51581. super(data, layer);
  51582. //数据的 geometry 属性必须存在且类型是 SuperMap.Geometry 或其子类的类型
  51583. if (!data.geometry) {
  51584. return;
  51585. }
  51586. if (!(data.geometry instanceof Geometry)) {
  51587. return;
  51588. }
  51589. /**
  51590. * @member {SuperMap.Bounds} [SuperMap.Feature.Theme.Vector.prototype.dataBounds]
  51591. * @description 用户数据的(feature.geometry)地理范围。
  51592. */
  51593. this.dataBounds = data.geometry.getBounds();
  51594. /**
  51595. * @member {number} [SuperMap.Feature.Theme.Vector.prototype.nodesClipPixel=2]
  51596. * @description 节点抽稀像素距离。
  51597. */
  51598. this.nodesClipPixel = 2;
  51599. /**
  51600. * @member {boolean} [SuperMap.Feature.Theme.Vector.prototype.isHoverAble=true]
  51601. * @description 图形是否可 hover。
  51602. */
  51603. this.isHoverAble = true;
  51604. /**
  51605. * @member {boolean} [SuperMap.Feature.Theme.Vector.prototype.isMultiHover=true]
  51606. * @description 是否使用多图形高亮,isHoverAble 为 true 时生效。
  51607. */
  51608. this.isMultiHover = true;
  51609. /**
  51610. * @member {boolean} [SuperMap.Feature.Theme.Vector.prototype.isClickAble=true]
  51611. * @description 图形是否可点击。
  51612. */
  51613. this.isClickAble = true;
  51614. /**
  51615. * @member {Object} [SuperMap.Feature.Theme.Vector.prototype.highlightStyle]
  51616. * @description 高亮样式。
  51617. */
  51618. this.highlightStyle = null;
  51619. /**
  51620. * @member {Object} [SuperMap.Feature.Theme.Vector.prototype.shapeOptions]
  51621. * @description 添加到渲染器前修改 shape 的一些属性,非特殊情况通常不允许这么做。
  51622. */
  51623. this.shapeOptions = {};
  51624. /**
  51625. * @member {Object} [SuperMap.Feature.Theme.Vector.prototype.style]
  51626. * @description 可视化图形的 style。在子类中规定其对象结构和默认属性值。
  51627. */
  51628. this.style = style || {};
  51629. this.CLASS_NAME = "SuperMap.Feature.Theme.Vector";
  51630. this.style = style ? style : {};
  51631. if (options) {
  51632. Util.copyAttributesWithClip(this, options, ["shapeOptions", "dataBounds"])
  51633. }
  51634. if (shapeOptions) {
  51635. Util.copyAttributesWithClip(this.shapeOptions, shapeOptions);
  51636. }
  51637. //设置基础参数 dataBounds、lonlat、location
  51638. var geometry = data.geometry;
  51639. this.lonlat = this.dataBounds.getCenterLonLat();
  51640. this.location = this.getLocalXY(this.lonlat);
  51641. //将地理要素转为专题要素
  51642. if (geometry instanceof LinearRing) {
  51643. this.lineToTF(geometry);
  51644. } else if (geometry instanceof LineString) {
  51645. this.lineToTF(geometry);
  51646. } else if (geometry instanceof Curve) {
  51647. //独立几何体
  51648. } else if (geometry instanceof MultiPoint) {
  51649. this.multiPointToTF(geometry);
  51650. } else if (geometry instanceof MultiLineString) {
  51651. this.multiLineStringToTF(geometry);
  51652. } else if (geometry instanceof MultiPolygon) {
  51653. this.multiPolygonToTF(geometry);
  51654. } else if (geometry instanceof Polygon) {
  51655. this.polygonToTF(geometry);
  51656. } else if (geometry instanceof Collection) {
  51657. //独立几何体
  51658. } else if (geometry instanceof Point) {
  51659. this.pointToTF(geometry);
  51660. } else if (geometry instanceof Rectangle) {
  51661. this.rectangleToTF(geometry);
  51662. } else if (geometry instanceof GeoText) {
  51663. this.geoTextToTF(geometry);
  51664. }
  51665. }
  51666. /**
  51667. * @function SuperMap.Feature.Theme.Vector.prototype.destroy
  51668. * @override
  51669. */
  51670. destroy() {
  51671. this.style = null;
  51672. this.dataBounds = null;
  51673. this.nodesClipPixel = null;
  51674. this.isHoverAble = null;
  51675. this.isMultiHover = null;
  51676. this.isClickAble = null;
  51677. this.highlightStyle = null;
  51678. this.shapeOptions = null;
  51679. super.destroy();
  51680. }
  51681. /**
  51682. * @function SuperMap.Feature.Theme.Vector.prototype.lineToTF
  51683. * @description 转换线和线环要素。
  51684. * @param {SuperMap.Geometry} geometry - 用户数据几何地理信息,这里必须是 LineString 或 LineRing。
  51685. */
  51686. lineToTF(geometry) {
  51687. var components = geometry.components;
  51688. //节点像素坐标
  51689. var localLX = [];
  51690. //参考位置,参考中心为
  51691. var refLocal = [];
  51692. var location = this.location;
  51693. var pointList = [];
  51694. //节点抽稀距离
  51695. var nCPx = this.nodesClipPixel;
  51696. for (var i = 0; i < components.length; i++) {
  51697. var components_i = components[i];
  51698. refLocal = [];
  51699. localLX = this.getLocalXY(components_i);
  51700. refLocal[0] = localLX[0] - location[0];
  51701. refLocal[1] = localLX[1] - location[1];
  51702. //抽稀 - 2 px
  51703. if (pointList.length > 0) {
  51704. var lastLocalXY = pointList[pointList.length - 1];
  51705. if ((Math.abs(lastLocalXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastLocalXY[1] - refLocal[1]) <= nCPx)) {
  51706. continue;
  51707. }
  51708. }
  51709. //使用参考点
  51710. pointList.push(refLocal);
  51711. }
  51712. if (pointList.length < 2) {
  51713. return null;
  51714. }
  51715. //赋 style
  51716. var style = new Object();
  51717. style = Util.copyAttributesWithClip(style, this.style, ['pointList']);
  51718. style.pointList = pointList;
  51719. //创建图形
  51720. var shape = new SmicBrokenLine({
  51721. style: style,
  51722. clickable: this.isClickAble,
  51723. hoverable: this.isHoverAble
  51724. });
  51725. //设置高亮样式
  51726. if (this.highlightStyle) {
  51727. shape.highlightStyle = this.highlightStyle;
  51728. }
  51729. //设置参考中心,指定图形位置
  51730. shape.refOriginalPosition = this.location;
  51731. //储存数据 id 属性,用于事件
  51732. shape.refDataID = this.data.id;
  51733. //储存数据 id 属性,用于事件-多图形同时高亮
  51734. shape.isHoverByRefDataID = this.isMultiHover;
  51735. //添加到渲染器前修改 shape 的一些属性,非特殊情况通常不允许这么做
  51736. if (this.shapeOptions) {
  51737. Util.copyAttributesWithClip(shape, this.shapeOptions);
  51738. }
  51739. this.shapes.push(shape);
  51740. }
  51741. /**
  51742. * @function SuperMap.Feature.Theme.Vector.prototype.multiPointToTF
  51743. * @description 转多点要素。
  51744. * @param {SuperMap.Geometry} geometry - 用户数据几何地理信息,这里必须是 MultiPoint。
  51745. */
  51746. multiPointToTF(geometry) {
  51747. /* //-- 不抽稀
  51748. var components = geometry.components;
  51749. for(var i = 0; i < components.length; i++){
  51750. var components_i = components[i];
  51751. this.pointToTF(components_i);
  51752. }
  51753. */
  51754. var components = geometry.components;
  51755. //节点像素坐标
  51756. var localLX = [];
  51757. //参考位置,参考中心为
  51758. var refLocal = [];
  51759. var location = this.location;
  51760. var pointList = [];
  51761. //节点抽稀距离
  51762. var nCPx = this.nodesClipPixel;
  51763. for (var i = 0; i < components.length; i++) {
  51764. var components_i = components[i];
  51765. refLocal = [];
  51766. localLX = this.getLocalXY(components_i);
  51767. refLocal[0] = localLX[0] - location[0];
  51768. refLocal[1] = localLX[1] - location[1];
  51769. //抽稀
  51770. if (pointList.length > 0) {
  51771. var lastLocalXY = pointList[pointList.length - 1];
  51772. if ((Math.abs(lastLocalXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastLocalXY[1] - refLocal[1]) <= nCPx)) {
  51773. continue;
  51774. }
  51775. }
  51776. //使用参考点
  51777. pointList.push(refLocal);
  51778. //赋 style
  51779. var style = new Object();
  51780. style.r = 6; //防止漏设此参数,默认 6 像素
  51781. style = Util.copyAttributesWithClip(style, this.style);
  51782. style.x = refLocal[0];
  51783. style.y = refLocal[1];
  51784. //创建图形
  51785. var shape = new SmicPoint({
  51786. style: style,
  51787. clickable: this.isClickAble,
  51788. hoverable: this.isHoverAble
  51789. });
  51790. //设置高亮样式
  51791. if (this.highlightStyle) {
  51792. shape.highlightStyle = this.highlightStyle;
  51793. }
  51794. //设置参考中心,指定图形位置
  51795. shape.refOriginalPosition = location;
  51796. //储存数据 id 属性,用于事件
  51797. shape.refDataID = this.data.id;
  51798. //储存数据 id 属性,用于事件-多图形同时高亮
  51799. shape.isHoverByRefDataID = this.isMultiHover;
  51800. //修改一些 shape 可选属性,通常不需要这么做
  51801. if (this.shapeOptions) {
  51802. Util.copyAttributesWithClip(shape, this.shapeOptions);
  51803. }
  51804. this.shapes.push(shape);
  51805. }
  51806. }
  51807. /**
  51808. * @function SuperMap.Feature.Theme.Vector.prototype.multiLineStringToTF
  51809. * @description 转换多线要素。
  51810. * @param {SuperMap.Geometry} geometry - 用户数据几何地理信息,这里必须是 MultiLineString。
  51811. */
  51812. multiLineStringToTF(geometry) {
  51813. var components = geometry.components;
  51814. for (var i = 0; i < components.length; i++) {
  51815. var components_i = components[i];
  51816. this.lineToTF(components_i);
  51817. }
  51818. }
  51819. /**
  51820. * @function SuperMap.Feature.Theme.Vector.prototype.multiPolygonToTF
  51821. * @description 转换多面要素。
  51822. * @param {SuperMap.Geometry} geometry - 用户数据几何地理信息,这里必须是 MultiPolygon。
  51823. */
  51824. multiPolygonToTF(geometry) {
  51825. var components = geometry.components;
  51826. for (var i = 0; i < components.length; i++) {
  51827. var components_i = components[i];
  51828. this.polygonToTF(components_i);
  51829. }
  51830. }
  51831. /**
  51832. * @function SuperMap.Feature.Theme.Vector.prototype.pointToTF
  51833. * @description 转换点要素。
  51834. * @param {SuperMap.Geometry} geometry - 用户数据几何地理信息,这里必须是 Point。
  51835. */
  51836. pointToTF(geometry) {
  51837. //参考位置,参考中心为
  51838. var location = this.location;
  51839. //geometry 像素坐标
  51840. var localLX = this.getLocalXY(geometry);
  51841. //赋 style
  51842. var style = new Object();
  51843. style.r = 6; //防止漏设此参数,默认 6 像素
  51844. style = Util.copyAttributesWithClip(style, this.style);
  51845. style.x = localLX[0] - location[0];
  51846. style.y = localLX[1] - location[1];
  51847. //创建图形
  51848. var shape = new SmicPoint({
  51849. style: style,
  51850. clickable: this.isClickAble,
  51851. hoverable: this.isHoverAble
  51852. });
  51853. //设置高亮样式
  51854. if (this.highlightStyle) {
  51855. shape.highlightStyle = this.highlightStyle;
  51856. }
  51857. //设置参考中心,指定图形位置
  51858. shape.refOriginalPosition = location;
  51859. //储存数据 id 属性,用于事件
  51860. shape.refDataID = this.data.id;
  51861. //储存数据 id 属性,用于事件-多图形同时高亮
  51862. shape.isHoverByRefDataID = this.isMultiHover;
  51863. //修改一些 shape 可选属性,通常不需要这么做
  51864. if (this.shapeOptions) {
  51865. Util.copyAttributesWithClip(shape, this.shapeOptions);
  51866. }
  51867. this.shapes.push(shape);
  51868. }
  51869. /**
  51870. * @function SuperMap.Feature.Theme.Vector.prototype.polygonToThemeFeature
  51871. * @description 转换面要素。
  51872. * @param {SuperMap.Geometry} geometry - 用户数据几何地理信息,这里必须是 Polygon。
  51873. */
  51874. polygonToTF(geometry) {
  51875. var components = geometry.components;
  51876. //节点像素坐标
  51877. var localLX = [];
  51878. //参考位置,参考中心为
  51879. var refLocal = [];
  51880. var location = this.location;
  51881. var pointList = [];
  51882. //岛洞
  51883. var holePolygonPointList = [];
  51884. var holePolygonPointLists = [];
  51885. //节点抽稀距离
  51886. var nCPx = this.nodesClipPixel;
  51887. for (var i = 0; i < components.length; i++) {
  51888. var components_i = components[i].components;
  51889. if (i === 0) {
  51890. // 第一个 component 正常绘制
  51891. pointList = [];
  51892. for (var j = 0; j < components_i.length; j++) {
  51893. refLocal = [];
  51894. localLX = this.getLocalXY(components_i[j]);
  51895. refLocal[0] = localLX[0] - location[0];
  51896. refLocal[1] = localLX[1] - location[1];
  51897. //抽稀 - 2 px
  51898. if (pointList.length > 0) {
  51899. var lastLocalXY = pointList[pointList.length - 1];
  51900. if ((Math.abs(lastLocalXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastLocalXY[1] - refLocal[1]) <= nCPx)) {
  51901. continue;
  51902. }
  51903. }
  51904. //使用参考点
  51905. pointList.push(refLocal);
  51906. }
  51907. } else {
  51908. // 其它 component 作为岛洞
  51909. holePolygonPointList = [];
  51910. for (var k = 0; k < components_i.length; k++) {
  51911. refLocal = [];
  51912. localLX = this.getLocalXY(components_i[k]);
  51913. refLocal[0] = localLX[0] - location[0];
  51914. refLocal[1] = localLX[1] - location[1];
  51915. //抽稀 - 2 px
  51916. if (holePolygonPointList.length > 0) {
  51917. var lastXY = holePolygonPointList[holePolygonPointList.length - 1];
  51918. if ((Math.abs(lastXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastXY[1] - refLocal[1]) <= nCPx)) {
  51919. continue;
  51920. }
  51921. }
  51922. //使用参考点
  51923. holePolygonPointList.push(refLocal);
  51924. }
  51925. }
  51926. if (holePolygonPointList.length < 2) {
  51927. continue;
  51928. }
  51929. holePolygonPointLists.push(holePolygonPointList);
  51930. }
  51931. if (pointList.length < 2) {
  51932. return;
  51933. }
  51934. //赋 style
  51935. var style = {};
  51936. style = Util.copyAttributesWithClip(style, this.style, ['pointList']);
  51937. style.pointList = pointList;
  51938. //创建图形
  51939. var shape = new SmicPolygon({
  51940. style: style,
  51941. clickable: this.isClickAble,
  51942. hoverable: this.isHoverAble
  51943. });
  51944. //设置高亮样式
  51945. if (this.highlightStyle) {
  51946. shape.highlightStyle = this.highlightStyle;
  51947. }
  51948. //设置参考中心,指定图形位置
  51949. shape.refOriginalPosition = this.location;
  51950. //储存数据 id 属性,用于事件
  51951. shape.refDataID = this.data.id;
  51952. //储存数据 id 属性,用于事件-多图形同时高亮
  51953. shape.isHoverByRefDataID = this.isMultiHover;
  51954. //岛洞面
  51955. if (holePolygonPointLists.length > 0) {
  51956. shape.holePolygonPointLists = holePolygonPointLists;
  51957. }
  51958. //修改一些 shape 可选属性,通常不需要这么做
  51959. if (this.shapeOptions) {
  51960. Util.copyAttributesWithClip(shape, this.shapeOptions);
  51961. }
  51962. this.shapes.push(shape);
  51963. }
  51964. /**
  51965. * @function SuperMap.Feature.Theme.Vector.prototype.rectangleToTF
  51966. * @description 转换矩形要素。
  51967. * @param {SuperMap.Geometry} geometry - 用户数据几何地理信息,这里必须是 Rectangle。
  51968. */
  51969. rectangleToTF(geometry) {
  51970. //参考位置,参考中心为
  51971. var location = this.location;
  51972. var ll = new LonLat(geometry.x, geometry.y);
  51973. //地图分辨率
  51974. var res = this.layer.map.getResolution();
  51975. //geometry 像素坐标
  51976. var localLX = this.getLocalXY(ll);
  51977. //赋 style
  51978. var style = new Object();
  51979. style.r = 6; //防止漏设此参数,默认 6 像素
  51980. style = Util.copyAttributesWithClip(style, this.style);
  51981. style.x = localLX[0] - location[0];
  51982. // SuperMap.Geometry.Rectangle 使用左下角定位, SmicRectangle 使用左上角定位,需要转换
  51983. style.y = (localLX[1] - location[1]) - 2 * geometry.width / res;
  51984. style.width = geometry.width / res;
  51985. style.height = geometry.height / res;
  51986. //创建图形
  51987. var shape = new SmicRectangle({
  51988. style: style,
  51989. clickable: this.isClickAble,
  51990. hoverable: this.isHoverAble
  51991. });
  51992. //设置高亮样式
  51993. if (this.highlightStyle) {
  51994. shape.highlightStyle = this.highlightStyle;
  51995. }
  51996. //设置参考中心,指定图形位置
  51997. shape.refOriginalPosition = location;
  51998. //储存数据 id 属性,用于事件
  51999. shape.refDataID = this.data.id;
  52000. //储存数据 id 属性,用于事件-多图形同时高亮
  52001. shape.isHoverByRefDataID = this.isMultiHover;
  52002. //修改一些 shape 可选属性,通常不需要这么做
  52003. if (this.shapeOptions) {
  52004. Util.copyAttributesWithClip(shape, this.shapeOptions);
  52005. }
  52006. this.shapes.push(shape);
  52007. }
  52008. /**
  52009. * @function SuperMap.Feature.Theme.Vector.prototype.geoTextToTF
  52010. * @description 转换文本要素。
  52011. * @param {SuperMap.Geometry} geometry - 用户数据几何地理信息,这里必须是 GeoText。
  52012. */
  52013. geoTextToTF(geometry) {
  52014. //参考位置,参考中心为
  52015. var location = this.location;
  52016. //geometry 像素坐标
  52017. var localLX = this.getLocalXY(geometry);
  52018. //赋 style
  52019. var style = new Object();
  52020. style.r = 6; //防止漏设此参数,默认 6 像素
  52021. style = Util.copyAttributesWithClip(style, this.style, ["x", "y", "text"]);
  52022. style.x = localLX[0] - location[0];
  52023. style.y = localLX[1] - location[1];
  52024. style.text = geometry.text;
  52025. //创建图形
  52026. var shape = new SmicText({
  52027. style: style,
  52028. clickable: this.isClickAble,
  52029. hoverable: this.isHoverAble
  52030. });
  52031. //设置高亮样式
  52032. if (this.highlightStyle) {
  52033. shape.highlightStyle = this.highlightStyle;
  52034. }
  52035. //设置参考中心,指定图形位置
  52036. shape.refOriginalPosition = location;
  52037. //储存数据 id 属性,用于事件
  52038. shape.refDataID = this.data.id;
  52039. //储存数据 id 属性,用于事件-多图形同时高亮
  52040. shape.isHoverByRefDataID = this.isMultiHover;
  52041. //修改一些 shape 可选属性,通常不需要这么做
  52042. if (this.shapeOptions) {
  52043. Util.copyAttributesWithClip(shape, this.shapeOptions);
  52044. }
  52045. this.shapes.push(shape);
  52046. }
  52047. /**
  52048. * @function SuperMap.Feature.Theme.Vector.prototype.updateAndAddShapes
  52049. * @description 修改位置,针对地图平移操作,地图漫游操作后调用此函数。
  52050. */
  52051. updateAndAddShapes() {
  52052. var newLocalLX = this.getLocalXY(this.lonlat);
  52053. this.location = newLocalLX;
  52054. var render = this.layer.renderer;
  52055. for (var i = 0, len = this.shapes.length; i < len; i++) {
  52056. var shape = this.shapes[i];
  52057. //设置参考中心,指定图形位置
  52058. shape.refOriginalPosition = newLocalLX;
  52059. render.addShape(shape);
  52060. }
  52061. }
  52062. /**
  52063. * @function SuperMap.Feature.Theme.Vector.prototype.getShapesCount
  52064. * @description 获得专题要素中可视化图形的数量。
  52065. * @returns {number} 可视化图形的数量。
  52066. */
  52067. getShapesCount() {
  52068. return this.shapes.length;
  52069. }
  52070. /**
  52071. * @function SuperMap.Feature.Theme.Vector.prototype.getLocalXY
  52072. * @description 地理坐标转为像素坐标。
  52073. * @param {SuperMap.LonLat} lonlat - 专题要素地理位置。
  52074. */
  52075. getLocalXY(lonlat) {
  52076. return this.layer.getLocalXY(lonlat);
  52077. }
  52078. }
  52079. SuperMap.Feature.Theme.ThemeVector = ThemeVector;
  52080. ;// CONCATENATED MODULE: ./src/common/overlay/feature/index.js
  52081. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  52082. * This program are made available under the terms of the Apache License, Version 2.0
  52083. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52084. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Group.js
  52085. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  52086. * This program are made available under the terms of the Apache License, Version 2.0
  52087. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52088. /**
  52089. * @class SuperMap.LevelRenderer.Group
  52090. * @category Visualization Theme
  52091. * @private
  52092. * @classdesc Group 是一个容器,可以插入子节点,Group 的变换也会被应用到子节点上。
  52093. * @extends {SuperMap.LevelRenderer.Transformable}
  52094. * (code)
  52095. * var g = new SuperMap.LevelRenderer.Group();
  52096. * var Circle = new SuperMap.LevelRenderer.Shape.Circle();
  52097. * g.position[0] = 100;
  52098. * g.position[1] = 100;
  52099. * g.addChild(new Circle({
  52100. * style: {
  52101. * x: 100,
  52102. * y: 100,
  52103. * r: 20,
  52104. * brushType: 'fill'
  52105. * }
  52106. * }));
  52107. * LR.addGroup(g);
  52108. * (end)
  52109. */
  52110. class Group extends SuperMap.mixin(Eventful, Transformable) {
  52111. /**
  52112. * @function SuperMap.LevelRenderer.Group.prototype.constructor
  52113. * @description 构造函数。
  52114. * @param {Array} options - Group 的配置(options)项,可以是 Group 的自有属性,也可以是自定义的属性。
  52115. */
  52116. constructor(options) {
  52117. super(options)
  52118. options = options || {};
  52119. /**
  52120. * @member {string} SuperMap.LevelRenderer.Group.prototype.id
  52121. * @description Group 的唯一标识。
  52122. */
  52123. this.id = null;
  52124. /**
  52125. * @readonly
  52126. * @member {string} [SuperMap.LevelRenderer.Group.prototype.type='group']
  52127. * @description 类型。
  52128. */
  52129. this.type = 'group';
  52130. //http://www.w3.org/TR/2dcontext/#clipping-region
  52131. /**
  52132. * @member {string} SuperMap.LevelRenderer.Group.prototype.clipShape
  52133. * @description 用于裁剪的图形(shape),所有 Group 内的图形在绘制时都会被这个图形裁剪,该图形会继承 Group 的变换。
  52134. */
  52135. this.clipShape = null;
  52136. /**
  52137. * @member {Array} SuperMap.LevelRenderer.Group.prototype._children
  52138. * @description _children。
  52139. */
  52140. this._children = [];
  52141. /**
  52142. * @member {Array} SuperMap.LevelRenderer.Group.prototype._storage
  52143. * @description _storage。
  52144. */
  52145. this._storage = null;
  52146. /**
  52147. * @member {boolean} [SuperMap.LevelRenderer.Group.prototype.__dirty=true]
  52148. * @description __dirty。
  52149. */
  52150. this.__dirty = true;
  52151. /**
  52152. * @member {boolean} [SuperMap.LevelRenderer.Group.prototype.ignore=false]
  52153. * @description 是否忽略该 Group 及其所有子节点。
  52154. */
  52155. this.ignore = false;
  52156. Util.extend(this, options);
  52157. this.id = this.id || Util.createUniqueID("smShapeGroup_");
  52158. this.CLASS_NAME = "SuperMap.LevelRenderer.Group";
  52159. }
  52160. /**
  52161. * @function SuperMap.LevelRenderer.Group.prototype.destroy
  52162. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  52163. */
  52164. destroy() {
  52165. this.id = null;
  52166. this.type = null;
  52167. this.clipShape = null;
  52168. this._children = null;
  52169. this._storage = null;
  52170. this.__dirty = null;
  52171. this.ignore = null;
  52172. super.destroy();
  52173. }
  52174. /**
  52175. * @function SuperMap.LevelRenderer.Group.prototype.children
  52176. * @description 复制并返回一份新的包含所有儿子节点的数组。
  52177. * @returns {Array.<SuperMap.LevelRenderer.Shape>} 图形数组。
  52178. */
  52179. children() {
  52180. return this._children.slice();
  52181. }
  52182. /**
  52183. * @function SuperMap.LevelRenderer.Group.prototype.childAt
  52184. * @description 获取指定 index 的儿子节点
  52185. * @param {number} idx - 节点索引。
  52186. * @returns {SuperMap.LevelRenderer.Shape} 图形。
  52187. */
  52188. childAt(idx) {
  52189. return this._children[idx];
  52190. }
  52191. /**
  52192. * @function SuperMap.LevelRenderer.Group.prototype.addChild
  52193. * @description 添加子节点,可以是 Shape 或者 Group。
  52194. * @param {(SuperMap.LevelRenderer.Shape|SuperMap.LevelRenderer.Group)} child - 节点图形。
  52195. */
  52196. // TODO Type Check
  52197. addChild(child) {
  52198. if (child == this) {
  52199. return;
  52200. }
  52201. if (child.parent == this) {
  52202. return;
  52203. }
  52204. if (child.parent) {
  52205. child.parent.removeChild(child);
  52206. }
  52207. this._children.push(child);
  52208. child.parent = this;
  52209. if (this._storage && this._storage !== child._storage) {
  52210. this._storage.addToMap(child);
  52211. if (child instanceof Group) {
  52212. child.addChildrenToStorage(this._storage);
  52213. }
  52214. }
  52215. }
  52216. /**
  52217. * @function SuperMap.LevelRenderer.Group.prototype.removeChild
  52218. * @description 移除子节点。
  52219. * @param {SuperMap.LevelRenderer.Shape} child - 需要移除的子节点图形。
  52220. */
  52221. removeChild(child) {
  52222. var idx = Util.indexOf(this._children, child);
  52223. this._children.splice(idx, 1);
  52224. child.parent = null;
  52225. if (this._storage) {
  52226. this._storage.delFromMap(child.id);
  52227. if (child instanceof Group) {
  52228. child.delChildrenFromStorage(this._storage);
  52229. }
  52230. }
  52231. }
  52232. /**
  52233. * @function SuperMap.LevelRenderer.Group.prototype.eachChild
  52234. * @description 遍历所有子节点。
  52235. * @param {function} cb - 回调函数。
  52236. * @param {Object} context - 上下文。
  52237. */
  52238. eachChild(cb, context) {
  52239. var haveContext = !!context;
  52240. for (var i = 0; i < this._children.length; i++) {
  52241. var child = this._children[i];
  52242. if (haveContext) {
  52243. cb.call(context, child);
  52244. } else {
  52245. cb(child);
  52246. }
  52247. }
  52248. }
  52249. /**
  52250. * @function SuperMap.LevelRenderer.Group.prototype.traverse
  52251. * @description 深度优先遍历所有子孙节点。
  52252. * @param {function} cb - 回调函数。
  52253. * @param {Object} context - 上下文。
  52254. */
  52255. traverse(cb, context) {
  52256. var haveContext = !!context;
  52257. for (var i = 0; i < this._children.length; i++) {
  52258. var child = this._children[i];
  52259. if (haveContext) {
  52260. cb.call(context, child);
  52261. } else {
  52262. cb(child);
  52263. }
  52264. if (child.type === 'group') {
  52265. child.traverse(cb, context);
  52266. }
  52267. }
  52268. }
  52269. /**
  52270. * @function SuperMap.LevelRenderer.Group.prototype.addChildrenToStorage
  52271. * @description 把子图形添加到仓库。
  52272. * @param {SuperMap.LevelRenderer.Storage} storage - 图形仓库。
  52273. */
  52274. addChildrenToStorage(storage) {
  52275. for (var i = 0; i < this._children.length; i++) {
  52276. var child = this._children[i];
  52277. storage.addToMap(child);
  52278. if (child.type === 'group') {
  52279. child.addChildrenToStorage(storage);
  52280. }
  52281. }
  52282. }
  52283. /**
  52284. * @function SuperMap.LevelRenderer.Group.prototype.delChildrenFromStorage
  52285. * @description 从仓库把子图形删除。
  52286. * @param {SuperMap.LevelRenderer.Storage} storage - 图形仓库。
  52287. */
  52288. delChildrenFromStorage(storage) {
  52289. for (var i = 0; i < this._children.length; i++) {
  52290. var child = this._children[i];
  52291. storage.delFromMap(child.id);
  52292. if (child.type === 'group') {
  52293. child.delChildrenFromStorage(storage);
  52294. }
  52295. }
  52296. }
  52297. /**
  52298. * @function SuperMap.LevelRenderer.Group.prototype.modSelf
  52299. * @description 是否修改。
  52300. */
  52301. modSelf() {
  52302. this.__dirty = true;
  52303. }
  52304. }
  52305. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Storage.js
  52306. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  52307. * This program are made available under the terms of the Apache License, Version 2.0
  52308. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52309. /**
  52310. * @private
  52311. * @class SuperMap.LevelRenderer.Storage
  52312. * @category Visualization Theme
  52313. * @classdesc 内容(图像)仓库 (M) 。
  52314. */
  52315. class Storage {
  52316. /**
  52317. * @function SuperMap.LevelRenderer.Storage.constructor
  52318. * @description 构造函数。
  52319. */
  52320. constructor() {
  52321. /**
  52322. * @member {Object} SuperMap.LevelRenderer.Storage.prototype._elements
  52323. * @description 所有常规形状,id 索引的 map。
  52324. */
  52325. this._elements = {};
  52326. /**
  52327. * @member {Array} SuperMap.LevelRenderer.Storage.prototype._hoverElements
  52328. * @description 高亮层形状,不稳定,动态增删,数组位置也是 z 轴方向,靠前显示在下方。
  52329. *
  52330. */
  52331. this._hoverElements = [];
  52332. /**
  52333. * @member {Array} SuperMap.LevelRenderer.Storage.prototype._roots
  52334. * @description _roots。
  52335. *
  52336. */
  52337. this._roots = [];
  52338. /**
  52339. * @member {Array} SuperMap.LevelRenderer.Storage.prototype._shapeList
  52340. * @description _shapeList。
  52341. *
  52342. */
  52343. this._shapeList = [];
  52344. /**
  52345. * @member {number} SuperMap.LevelRenderer.Storage.prototype._shapeListOffset
  52346. * @description _shapeListOffset。默认值:0。
  52347. *
  52348. */
  52349. this._shapeListOffset = 0;
  52350. this.CLASS_NAME = "SuperMap.LevelRenderer.Storage";
  52351. }
  52352. /**
  52353. * @function SuperMap.LevelRenderer.Storage.prototype.destroy
  52354. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  52355. */
  52356. destroy() {
  52357. this.dispose();
  52358. this._shapeList = null;
  52359. this._shapeListOffset = null;
  52360. }
  52361. /**
  52362. * @function SuperMap.LevelRenderer.Storage.prototype.iterShape
  52363. * @description 遍历迭代器。
  52364. *
  52365. * @param {Function} fun - 迭代回调函数,return true终止迭代。
  52366. * @param {Object} option - 迭代参数,缺省为仅降序遍历普通层图形。
  52367. * @param {boolean} [hover=true] - 是否是高亮层图形。
  52368. * @param {string} [normal='down'] - 是否是普通层图形,迭代时是否指定及z轴顺序。可设值:'down' ,'up'。
  52369. * @param {boolean} [update=false] - 是否在迭代前更新形状列表。
  52370. * @return {SuperMap.LevelRenderer.Storage} this。
  52371. */
  52372. iterShape(fun, option) {
  52373. if (!option) {
  52374. var defaultIterateOption = {
  52375. hover: false,
  52376. normal: 'down',
  52377. update: false
  52378. };
  52379. option = defaultIterateOption;
  52380. }
  52381. if (option.hover) {
  52382. // 高亮层数据遍历
  52383. for (var i = 0, l = this._hoverElements.length; i < l; i++) {
  52384. var el = this._hoverElements[i];
  52385. el.updateTransform();
  52386. if (fun(el)) {
  52387. return this;
  52388. }
  52389. }
  52390. }
  52391. if (option.update) {
  52392. this.updateShapeList();
  52393. }
  52394. // 遍历: 'down' | 'up'
  52395. switch (option.normal) {
  52396. case 'down':
  52397. {
  52398. // 降序遍历,高层优先
  52399. let l = this._shapeList.length;
  52400. while (l--) {
  52401. if (fun(this._shapeList[l])) {
  52402. return this;
  52403. }
  52404. }
  52405. break;
  52406. }
  52407. // case 'up':
  52408. default:
  52409. {
  52410. // 升序遍历,底层优先
  52411. for (let i = 0, l = this._shapeList.length; i < l; i++) {
  52412. if (fun(this._shapeList[i])) {
  52413. return this;
  52414. }
  52415. }
  52416. break;
  52417. }
  52418. }
  52419. return this;
  52420. }
  52421. /**
  52422. * @function SuperMap.LevelRenderer.Storage.prototype.getHoverShapes
  52423. * @param {boolean} [update=false] - 是否在返回前更新图形的变换。
  52424. * @return {Array.<SuperMap.LevelRenderer.Shape>} 图形数组。
  52425. */
  52426. getHoverShapes(update) {
  52427. // hoverConnect
  52428. var hoverElements = [], len = this._hoverElements.length;
  52429. for (let i = 0; i < len; i++) {
  52430. hoverElements.push(this._hoverElements[i]);
  52431. var target = this._hoverElements[i].hoverConnect;
  52432. if (target) {
  52433. var shape;
  52434. target = target instanceof Array ? target : [target];
  52435. for (var j = 0, k = target.length; j < k; j++) {
  52436. shape = target[j].id ? target[j] : this.get(target[j]);
  52437. if (shape) {
  52438. hoverElements.push(shape);
  52439. }
  52440. }
  52441. }
  52442. }
  52443. hoverElements.sort(Storage.shapeCompareFunc);
  52444. if (update) {
  52445. for (let i = 0, l = hoverElements.length; i < l; i++) {
  52446. hoverElements[i].updateTransform();
  52447. }
  52448. }
  52449. return hoverElements;
  52450. }
  52451. /**
  52452. * @function SuperMap.LevelRenderer.Storage.prototype.getShapeList
  52453. * @description 返回所有图形的绘制队列。
  52454. *
  52455. * @param {boolean} [update=false] - 是否在返回前更新该数组。 详见:<SuperMap.LevelRenderer.Shape> updateShapeList。
  52456. * @return {SuperMap.LevelRenderer.Shape} 图形。
  52457. */
  52458. getShapeList(update) {
  52459. if (update) {
  52460. this.updateShapeList();
  52461. }
  52462. return this._shapeList;
  52463. }
  52464. /**
  52465. * @function SuperMap.LevelRenderer.Storage.prototype.updateShapeList
  52466. * @description 更新图形的绘制队列。每次绘制前都会调用,该方法会先深度优先遍历整个树,更新所有Group和Shape的变换并且把所有可见的Shape保存到数组中,最后根据绘制的优先级(zlevel > z > 插入顺序)排序得到绘制队列。
  52467. */
  52468. updateShapeList() {
  52469. this._shapeListOffset = 0;
  52470. var rootsLen = this._roots.length;
  52471. for (let i = 0; i < rootsLen; i++) {
  52472. let root = this._roots[i];
  52473. this._updateAndAddShape(root);
  52474. }
  52475. this._shapeList.length = this._shapeListOffset;
  52476. var shapeListLen = this._shapeList.length;
  52477. for (let i = 0; i < shapeListLen; i++) {
  52478. this._shapeList[i].__renderidx = i;
  52479. }
  52480. this._shapeList.sort(Storage.shapeCompareFunc);
  52481. }
  52482. /**
  52483. * @function SuperMap.LevelRenderer.Storage.prototype._updateAndAddShape
  52484. * @description 更新并添加图形。
  52485. *
  52486. */
  52487. _updateAndAddShape(el, clipShapes) {
  52488. if (el.ignore) {
  52489. return;
  52490. }
  52491. el.updateTransform();
  52492. if (el.type == 'group') {
  52493. if (el.clipShape) {
  52494. // clipShape 的变换是基于 group 的变换
  52495. el.clipShape.parent = el;
  52496. el.clipShape.updateTransform();
  52497. // PENDING 效率影响
  52498. if (clipShapes) {
  52499. clipShapes = clipShapes.slice();
  52500. clipShapes.push(el.clipShape);
  52501. } else {
  52502. clipShapes = [el.clipShape];
  52503. }
  52504. }
  52505. for (var i = 0; i < el._children.length; i++) {
  52506. var child = el._children[i];
  52507. // Force to mark as dirty if group is dirty
  52508. child.__dirty = el.__dirty || child.__dirty;
  52509. this._updateAndAddShape(child, clipShapes);
  52510. }
  52511. // Mark group clean here
  52512. el.__dirty = false;
  52513. } else {
  52514. el.__clipShapes = clipShapes;
  52515. this._shapeList[this._shapeListOffset++] = el;
  52516. }
  52517. }
  52518. /**
  52519. * @function SuperMap.LevelRenderer.Storage.prototype.mod
  52520. * @description 修改图形(Shape)或者组(Group)。
  52521. *
  52522. * @param {string} elId - 唯一标识。
  52523. * @param {Object} params - 参数。
  52524. * @return {SuperMap.LevelRenderer.Storage} this。
  52525. */
  52526. mod(elId, params) {
  52527. var el = this._elements[elId];
  52528. if (el) {
  52529. el.modSelf();
  52530. if (params) {
  52531. // 如果第二个参数直接使用 shape
  52532. // parent, _storage, __startClip 三个属性会有循环引用
  52533. // 主要为了向 1.x 版本兼容,2.x 版本不建议使用第二个参数
  52534. if (params.parent || params._storage || params.__startClip) {
  52535. var target = {};
  52536. for (var name in params) {
  52537. if (
  52538. name == 'parent'
  52539. || name == '_storage'
  52540. || name == '__startClip'
  52541. ) {
  52542. continue;
  52543. }
  52544. if (params.hasOwnProperty(name)) {
  52545. target[name] = params[name];
  52546. }
  52547. }
  52548. new Util_Util().merge(el, target, true);
  52549. } else {
  52550. new Util_Util().merge(el, params, true);
  52551. }
  52552. }
  52553. }
  52554. return this;
  52555. }
  52556. /**
  52557. * @function SuperMap.LevelRenderer.Storage.prototype.drift
  52558. * @description 移动指定的图形(Shape)的位置。
  52559. * @param {string} shapeId - 唯一标识。
  52560. * @param {number} dx
  52561. * @param {number} dy
  52562. * @return {SuperMap.LevelRenderer.Storage} this。
  52563. */
  52564. drift(shapeId, dx, dy) {
  52565. var shape = this._elements[shapeId];
  52566. if (shape) {
  52567. shape.needTransform = true;
  52568. if (shape.draggable === 'horizontal') {
  52569. dy = 0;
  52570. } else if (shape.draggable === 'vertical') {
  52571. dx = 0;
  52572. }
  52573. if (!shape.ondrift // ondrift
  52574. // 有onbrush并且调用执行返回false或undefined则继续
  52575. || (shape.ondrift && !shape.ondrift(dx, dy))
  52576. ) {
  52577. shape.drift(dx, dy);
  52578. }
  52579. }
  52580. return this;
  52581. }
  52582. /**
  52583. * @function SuperMap.LevelRenderer.Storage.prototype.addHover
  52584. * @description 添加高亮层数据。
  52585. * @param {SuperMap.LevelRenderer.Shape} shape - 图形。
  52586. * @return {SuperMap.LevelRenderer.Storage} this。
  52587. */
  52588. addHover(shape) {
  52589. shape.updateNeedTransform();
  52590. this._hoverElements.push(shape);
  52591. return this;
  52592. }
  52593. /**
  52594. * @function SuperMap.LevelRenderer.Storage.prototype.delHover
  52595. * @description 清空高亮层数据。
  52596. * @return {SuperMap.LevelRenderer.Storage} this。
  52597. */
  52598. delHover() {
  52599. this._hoverElements = [];
  52600. return this;
  52601. }
  52602. /**
  52603. * @function SuperMap.LevelRenderer.Storage.prototype.hasHoverShape
  52604. * @description 是否有图形在高亮层里。
  52605. * @return {boolean} 是否有图形在高亮层里。
  52606. */
  52607. hasHoverShape() {
  52608. return this._hoverElements.length > 0;
  52609. }
  52610. /**
  52611. * @function SuperMap.LevelRenderer.Storage.prototype.addRoot
  52612. * @description 添加图形(Shape)或者组(Group)到根节点。
  52613. *
  52614. * @param {(SuperMap.LevelRenderer.Shape/SuperMap.LevelRenderer.Group)} el - 图形。
  52615. *
  52616. */
  52617. addRoot(el) {
  52618. if (el instanceof Group) {
  52619. el.addChildrenToStorage(this);
  52620. }
  52621. this.addToMap(el);
  52622. this._roots.push(el);
  52623. }
  52624. /**
  52625. * @function SuperMap.LevelRenderer.Storage.prototype.delRoot
  52626. * @description 删除指定的图形(Shape)或者组(Group)。
  52627. *
  52628. * @param {Array.<string>} elId - 删除图形(Shape)或者组(Group)的 id 数组。如果为空清空整个Storage。
  52629. *
  52630. */
  52631. delRoot(elId) {
  52632. if (typeof(elId) == 'undefined') {
  52633. // 不指定elId清空
  52634. for (var i = 0; i < this._roots.length; i++) {
  52635. var root = this._roots[i];
  52636. if (root instanceof Group) {
  52637. root.delChildrenFromStorage(this);
  52638. }
  52639. }
  52640. this._elements = {};
  52641. this._hoverElements = [];
  52642. this._roots = [];
  52643. return;
  52644. }
  52645. if (elId instanceof Array) {
  52646. var elIdLen = elId.length;
  52647. for (let i = 0; i < elIdLen; i++) {
  52648. this.delRoot(elId[i]);
  52649. }
  52650. return;
  52651. }
  52652. var el;
  52653. if (typeof(elId) == 'string') {
  52654. el = this._elements[elId];
  52655. } else {
  52656. el = elId;
  52657. }
  52658. var idx = new Util_Util().indexOf(this._roots, el);
  52659. if (idx >= 0) {
  52660. this.delFromMap(el.id);
  52661. this._roots.splice(idx, 1);
  52662. if (el instanceof Group) {
  52663. el.delChildrenFromStorage(this);
  52664. }
  52665. }
  52666. }
  52667. /**
  52668. * @function SuperMap.LevelRenderer.Storage.prototype.addToMap
  52669. * @description 添加图形到 map。
  52670. *
  52671. * @param {SuperMap.LevelRenderer.Shape} el - 图形。
  52672. * @return {SuperMap.LevelRenderer.Storage} this。
  52673. */
  52674. addToMap(el) {
  52675. if (el instanceof Group) {
  52676. el._storage = this;
  52677. }
  52678. el.modSelf();
  52679. this._elements[el.id] = el;
  52680. return this;
  52681. }
  52682. /**
  52683. * @function SuperMap.LevelRenderer.Storage.prototype.get
  52684. * @description 获取指定图形。
  52685. *
  52686. * @param {string} elId - 图形 id。
  52687. * @return {SuperMap.LevelRenderer.Shape} 图形。
  52688. */
  52689. get(elId) {
  52690. return this._elements[elId];
  52691. }
  52692. /**
  52693. * @function SuperMap.LevelRenderer.Storage.prototype.delFromMap
  52694. * @description 从 map 中删除指定图形。
  52695. *
  52696. * @param {string} elId - 图形id。
  52697. * @return {SuperMap.LevelRenderer.Storage} this。
  52698. */
  52699. delFromMap(elId) {
  52700. var el = this._elements[elId];
  52701. if (el) {
  52702. delete this._elements[elId];
  52703. if (el instanceof Group) {
  52704. el._storage = null;
  52705. }
  52706. }
  52707. return this;
  52708. }
  52709. /**
  52710. * @function SuperMap.LevelRenderer.Storage.prototype.dispose
  52711. * @description 清空并且释放 Storage。
  52712. */
  52713. dispose() {
  52714. this._elements = null;
  52715. // this._renderList = null;
  52716. this._roots = null;
  52717. this._hoverElements = null;
  52718. }
  52719. static shapeCompareFunc(a, b) {
  52720. if (a.zlevel == b.zlevel) {
  52721. if (a.z == b.z) {
  52722. return a.__renderidx - b.__renderidx;
  52723. }
  52724. return a.z - b.z;
  52725. }
  52726. return a.zlevel - b.zlevel;
  52727. }
  52728. }
  52729. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Painter.js
  52730. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  52731. * This program are made available under the terms of the Apache License, Version 2.0
  52732. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52733. /**
  52734. * @private
  52735. * @class SuperMap.LevelRenderer.Painter
  52736. * @category Visualization Theme
  52737. * @classdesc Painter 绘图模块。
  52738. */
  52739. class Painter {
  52740. /**
  52741. * @function SuperMap.LevelRenderer.Painter.constructor
  52742. * @description 构造函数。
  52743. *
  52744. * @param {HTMLElement} root - 绘图区域(DIV)。
  52745. * @param {SuperMap.LevelRenderer.Storage} storage - Storage 实例。
  52746. *
  52747. */
  52748. constructor(root, storage) {
  52749. /**
  52750. * @member {HTMLElement} SuperMap.LevelRenderer.Painter.prototype.root
  52751. * @description 绘图容器。
  52752. *
  52753. */
  52754. this.root = root;
  52755. /**
  52756. * @member {Array} SuperMap.LevelRenderer.Painter.prototype.storage
  52757. * @description 图形仓库。
  52758. *
  52759. */
  52760. this.storage = storage;
  52761. /**
  52762. * @member {HTMLElement} SuperMap.LevelRenderer.Painter.prototype._domRoot
  52763. * @description 容器根 dom 对象。
  52764. *
  52765. */
  52766. this._domRoot = null;
  52767. /**
  52768. * @member {Object} SuperMap.LevelRenderer.Painter.prototype._layers
  52769. * @description 绘制层对象。
  52770. *
  52771. */
  52772. this._layers = {};
  52773. /**
  52774. * @member {Array} SuperMap.LevelRenderer.Painter.prototype._zlevelList
  52775. * @description 层列表。
  52776. *
  52777. */
  52778. this._zlevelList = [];
  52779. /**
  52780. * @member {Object} SuperMap.LevelRenderer.Painter.prototype._layerConfig
  52781. * @description 绘制层配置对象。
  52782. *
  52783. */
  52784. this._layerConfig = {};
  52785. /**
  52786. * @member {Object} SuperMap.LevelRenderer.Painter.prototype._bgDom
  52787. * @description 背景层 Canvas (Dom)。
  52788. *
  52789. */
  52790. this._bgDom = null;
  52791. /**
  52792. * @member {Function} SuperMap.LevelRenderer.Painter.prototype.shapeToImage
  52793. * @description 形状转图像函数。
  52794. *
  52795. */
  52796. this.shapeToImage = null;
  52797. // retina 屏幕优化
  52798. Painter.devicePixelRatio = Math.max((window.devicePixelRatio || 1), 1);
  52799. this.CLASS_NAME = "SuperMap.LevelRenderer.Painter";
  52800. this.root.innerHTML = '';
  52801. this._width = this._getWidth(); // 宽,缓存记录
  52802. this._height = this._getHeight(); // 高,缓存记录
  52803. var domRoot = document.createElement('div');
  52804. this._domRoot = domRoot;
  52805. // domRoot.onselectstart = returnFalse; // 避免页面选中的尴尬
  52806. domRoot.style.position = 'relative';
  52807. domRoot.style.overflow = 'hidden';
  52808. domRoot.style.width = this._width + 'px';
  52809. domRoot.style.height = this._height + 'px';
  52810. this.root.appendChild(domRoot);
  52811. this.shapeToImage = this._createShapeToImageProcessor();
  52812. // 创建各层canvas
  52813. // 背景
  52814. //this._bgDom = Painter.createDom('bg', 'div', this);
  52815. this._bgDom = Painter.createDom(Util.createUniqueID("SuperMap.Theme_background_"), 'div', this);
  52816. domRoot.appendChild(this._bgDom);
  52817. this._bgDom.onselectstart = returnFalse;
  52818. this._bgDom.style['-webkit-user-select'] = 'none';
  52819. this._bgDom.style['user-select'] = 'none';
  52820. this._bgDom.style['-webkit-touch-callout'] = 'none';
  52821. // 高亮
  52822. //var hoverLayer = new PaintLayer('_hoverLayer_', this);
  52823. var hoverLayer = new PaintLayer(Util.createUniqueID("_highLightLayer_"), this);
  52824. this._layers['hover'] = hoverLayer;
  52825. domRoot.appendChild(hoverLayer.dom);
  52826. hoverLayer.initContext();
  52827. hoverLayer.dom.onselectstart = returnFalse;
  52828. hoverLayer.dom.style['-webkit-user-select'] = 'none';
  52829. hoverLayer.dom.style['user-select'] = 'none';
  52830. hoverLayer.dom.style['-webkit-touch-callout'] = 'none';
  52831. var me = this;
  52832. this.updatePainter = function (shapeList, callback) {
  52833. me.refreshShapes(shapeList, callback);
  52834. };
  52835. // 返回false的方法,用于避免页面被选中
  52836. function returnFalse() {
  52837. return false;
  52838. }
  52839. /* eslint-disable */
  52840. // 什么都不干的空方法
  52841. function doNothing() { //NOSONAR
  52842. }
  52843. /* eslint-enable */
  52844. }
  52845. /**
  52846. * @function SuperMap.LevelRenderer.Painter.prototype.destroy
  52847. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  52848. */
  52849. destroy() {
  52850. this.dispose();
  52851. this._zlevelList = null;
  52852. this._layerConfig = null;
  52853. this._bgDom = null;
  52854. this.shapeToImage = null;
  52855. }
  52856. /**
  52857. * @function SuperMap.LevelRenderer.Painter.prototype.render
  52858. * @description 渲染。首次绘图,创建各种 dom 和 context。
  52859. *
  52860. * @param {Function} callback - 绘画结束后的回调函数。
  52861. * @return {SuperMap.LevelRenderer.Painter} this。
  52862. */
  52863. render(callback) {
  52864. // TODO
  52865. this.refresh(callback, true);
  52866. return this;
  52867. }
  52868. /**
  52869. * @function SuperMap.LevelRenderer.Painter.prototype.refresh
  52870. * @description 刷新。
  52871. *
  52872. * @param {Function} callback - 刷新结束后的回调函数。
  52873. * @param {boolean} paintAll - 强制绘制所有 shape。
  52874. * @return {SuperMap.LevelRenderer.Painter} this。
  52875. */
  52876. refresh(callback, paintAll) {
  52877. var list = this.storage.getShapeList(true);
  52878. this._paintList(list, paintAll);
  52879. if (typeof callback == 'function') {
  52880. callback();
  52881. }
  52882. return this;
  52883. }
  52884. /**
  52885. * Method: _paintList
  52886. * 按列表绘制图形。
  52887. */
  52888. _paintList(list, paintAll) {
  52889. if (typeof(paintAll) == 'undefined') {
  52890. paintAll = false;
  52891. }
  52892. this._updateLayerStatus(list);
  52893. var currentLayer;
  52894. var currentZLevel;
  52895. var ctx;
  52896. for (var id in this._layers) {
  52897. if (id !== 'hover') {
  52898. this._layers[id].unusedCount++;
  52899. this._layers[id].updateTransform();
  52900. }
  52901. }
  52902. var invTransform = [];
  52903. for (var i = 0, l = list.length; i < l; i++) {
  52904. var shape = list[i];
  52905. if (currentZLevel !== shape.zlevel) {
  52906. if (currentLayer && currentLayer.needTransform) {
  52907. ctx.restore();
  52908. }
  52909. currentLayer = this.getLayer(shape.zlevel);
  52910. ctx = currentLayer.ctx;
  52911. currentZLevel = shape.zlevel;
  52912. // Reset the count
  52913. currentLayer.unusedCount = 0;
  52914. if (currentLayer.dirty || paintAll) {
  52915. currentLayer.clear();
  52916. }
  52917. if (currentLayer.needTransform) {
  52918. ctx.save();
  52919. currentLayer.setTransform(ctx);
  52920. }
  52921. }
  52922. // Start group clipping
  52923. if (ctx && shape.__startClip) {
  52924. var clipShape = shape.__startClip;
  52925. ctx.save();
  52926. // Set transform
  52927. if (clipShape.needTransform) {
  52928. let m = clipShape.transform;
  52929. SUtil_SUtil.Util_matrix.invert(invTransform, m);
  52930. ctx.transform(
  52931. m[0], m[1],
  52932. m[2], m[3],
  52933. m[4], m[5]
  52934. );
  52935. }
  52936. ctx.beginPath();
  52937. clipShape.buildPath(ctx, clipShape.style);
  52938. ctx.clip();
  52939. // Transform back
  52940. if (clipShape.needTransform) {
  52941. let m = invTransform;
  52942. ctx.transform(
  52943. m[0], m[1],
  52944. m[2], m[3],
  52945. m[4], m[5]
  52946. );
  52947. }
  52948. }
  52949. if (((currentLayer && currentLayer.dirty) || paintAll) && !shape.invisible) {
  52950. if (
  52951. !shape.onbrush
  52952. || (shape.onbrush && !shape.onbrush(ctx, false))
  52953. ) {
  52954. if (Config.catchBrushException) {
  52955. try {
  52956. shape.brush(ctx, false, this.updatePainter);
  52957. } catch (error) {
  52958. SUtil_SUtil.Util_log(
  52959. error,
  52960. 'brush error of ' + shape.type,
  52961. shape
  52962. );
  52963. }
  52964. } else {
  52965. shape.brush(ctx, false, this.updatePainter);
  52966. }
  52967. }
  52968. }
  52969. // Stop group clipping
  52970. if (ctx && shape.__stopClip) {
  52971. ctx.restore();
  52972. }
  52973. shape.__dirty = false;
  52974. }
  52975. if (ctx && currentLayer && currentLayer.needTransform) {
  52976. ctx.restore();
  52977. }
  52978. for (let id in this._layers) {
  52979. if (id !== 'hover') {
  52980. var layer = this._layers[id];
  52981. layer.dirty = false;
  52982. // 删除过期的层
  52983. // PENDING
  52984. // if (layer.unusedCount >= 500) {
  52985. // this.delLayer(id);
  52986. // }
  52987. if (layer.unusedCount == 1) {
  52988. layer.clear();
  52989. }
  52990. }
  52991. }
  52992. }
  52993. /**
  52994. * @function SuperMap.LevelRenderer.Painter.prototype.getLayer
  52995. * @description 获取 zlevel 所在层,如果不存在则会创建一个新的层。
  52996. *
  52997. * @param {number} zlevel - zlevel。
  52998. * @return {SuperMap.LevelRenderer.Painter} this。
  52999. */
  53000. getLayer(zlevel) {
  53001. // Change draw layer
  53002. var currentLayer = this._layers[zlevel];
  53003. if (!currentLayer) {
  53004. var len = this._zlevelList.length;
  53005. var prevLayer = null;
  53006. var i = -1;
  53007. if (len > 0 && zlevel > this._zlevelList[0]) {
  53008. for (i = 0; i < len - 1; i++) {
  53009. if (
  53010. this._zlevelList[i] < zlevel
  53011. && this._zlevelList[i + 1] > zlevel
  53012. ) {
  53013. break;
  53014. }
  53015. }
  53016. prevLayer = this._layers[this._zlevelList[i]];
  53017. }
  53018. this._zlevelList.splice(i + 1, 0, zlevel);
  53019. // Create a new layer
  53020. //currentLayer = new PaintLayer(zlevel, this);
  53021. currentLayer = new PaintLayer(Util.createUniqueID("_levelLayer_" + zlevel), this);
  53022. var prevDom = prevLayer ? prevLayer.dom : this._bgDom;
  53023. if (prevDom.nextSibling) {
  53024. prevDom.parentNode.insertBefore(
  53025. currentLayer.dom,
  53026. prevDom.nextSibling
  53027. );
  53028. } else {
  53029. prevDom.parentNode.appendChild(
  53030. currentLayer.dom
  53031. );
  53032. }
  53033. currentLayer.initContext();
  53034. this._layers[zlevel] = currentLayer;
  53035. if (this._layerConfig[zlevel]) {
  53036. new Util_Util().merge(currentLayer, this._layerConfig[zlevel], true);
  53037. }
  53038. currentLayer.updateTransform();
  53039. }
  53040. return currentLayer;
  53041. }
  53042. /**
  53043. * @function SuperMap.LevelRenderer.Painter.prototype.getLayers
  53044. * @description 获取所有已创建的层。
  53045. * @return {Array.<Painter.Layer>} 已创建的层
  53046. */
  53047. getLayers() {
  53048. return this._layers;
  53049. }
  53050. /**
  53051. * Method: _updateLayerStatus
  53052. * 更新绘制层状态。
  53053. */
  53054. _updateLayerStatus(list) {
  53055. var layers = this._layers;
  53056. var elCounts = {};
  53057. for (let z in layers) {
  53058. if (z !== 'hover') {
  53059. elCounts[z] = layers[z].elCount;
  53060. layers[z].elCount = 0;
  53061. }
  53062. }
  53063. for (let i = 0; i < list.length; i++) {
  53064. var shape = list[i];
  53065. var zlevel = shape.zlevel;
  53066. var layer = layers[zlevel];
  53067. if (layer) {
  53068. layer.elCount++;
  53069. // 已经被标记为需要刷新
  53070. if (layer.dirty) {
  53071. continue;
  53072. }
  53073. layer.dirty = shape.__dirty;
  53074. }
  53075. }
  53076. // 层中的元素数量有发生变化
  53077. for (let z in layers) {
  53078. if (z !== 'hover') {
  53079. if (elCounts[z] !== layers[z].elCount) {
  53080. layers[z].dirty = true;
  53081. }
  53082. }
  53083. }
  53084. }
  53085. /**
  53086. * @function SuperMap.LevelRenderer.Painter.prototype.refreshShapes
  53087. * @description 更新的图形元素列表。
  53088. *
  53089. * @param {number} shapeList - 需要更新的图形元素列表。
  53090. * @param {number} callback - 视图更新后回调函数。
  53091. * @return {SuperMap.LevelRenderer.Painter} this。
  53092. */
  53093. refreshShapes(shapeList, callback) {
  53094. for (var i = 0, l = shapeList.length; i < l; i++) {
  53095. var shape = shapeList[i];
  53096. this.storage.mod(shape.id);
  53097. }
  53098. this.refresh(callback);
  53099. return this;
  53100. }
  53101. /**
  53102. * @function SuperMap.LevelRenderer.Painter.prototype.clear
  53103. * @description 清除 hover 层外所有内容。
  53104. * @return {SuperMap.LevelRenderer.Painter} this。
  53105. */
  53106. clear() {
  53107. for (var k in this._layers) {
  53108. if (k == 'hover') {
  53109. continue;
  53110. }
  53111. this._layers[k].clear();
  53112. }
  53113. return this;
  53114. }
  53115. /**
  53116. * @function SuperMap.LevelRenderer.Painter.prototype.modLayer
  53117. * @description 修改指定 zlevel 的绘制参数。
  53118. *
  53119. * @param {string} zlevel - zlevel。
  53120. * @param {Object} config - 配置对象。
  53121. * @param {string} [config.clearColor=0] - 每次清空画布的颜色。
  53122. * @param {boolean} [config.motionBlur=false] - 是否开启动态模糊。
  53123. * @param {number} [config.lastFrameAlpha=0.7] - 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显。默认值:0.7。
  53124. * @param {Array.<number>} config.position - 层的平移。
  53125. * @param {Array.<number>} config.rotation - 层的旋转。
  53126. * @param {Array.<number>} config.scale - 层的缩放。
  53127. * @param {boolean} config.zoomable - 层是否支持鼠标缩放操作。默认值:false。
  53128. * @param {boolean} config.panable - 层是否支持鼠标平移操作。默认值:false。
  53129. *
  53130. */
  53131. modLayer(zlevel, config) {
  53132. if (config) {
  53133. if (!this._layerConfig[zlevel]) {
  53134. this._layerConfig[zlevel] = config;
  53135. } else {
  53136. new Util_Util().merge(this._layerConfig[zlevel], config, true);
  53137. }
  53138. var layer = this._layers[zlevel];
  53139. if (layer) {
  53140. new Util_Util().merge(layer, this._layerConfig[zlevel], true);
  53141. }
  53142. }
  53143. }
  53144. /**
  53145. * @function SuperMap.LevelRenderer.Painter.prototype.delLayer
  53146. * @description 删除指定层。
  53147. *
  53148. * @param {string} zlevel - 层所在的 zlevel。
  53149. */
  53150. delLayer(zlevel) {
  53151. var layer = this._layers[zlevel];
  53152. if (!layer) {
  53153. return;
  53154. }
  53155. // Save config
  53156. this.modLayer(zlevel, {
  53157. position: layer.position,
  53158. rotation: layer.rotation,
  53159. scale: layer.scale
  53160. });
  53161. layer.dom.parentNode.removeChild(layer.dom);
  53162. delete this._layers[zlevel];
  53163. this._zlevelList.splice(new Util_Util().indexOf(this._zlevelList, zlevel), 1);
  53164. }
  53165. /**
  53166. * @function SuperMap.LevelRenderer.Painter.prototype.refreshHover
  53167. * @description 刷新 hover 层。
  53168. * @return {SuperMap.LevelRenderer.Painter} this。
  53169. */
  53170. refreshHover() {
  53171. this.clearHover();
  53172. var list = this.storage.getHoverShapes(true);
  53173. for (var i = 0, l = list.length; i < l; i++) {
  53174. this._brushHover(list[i]);
  53175. }
  53176. this.storage.delHover();
  53177. return this;
  53178. }
  53179. /**
  53180. * @function SuperMap.LevelRenderer.Painter.prototype.clearHover
  53181. * @description 清除 hover 层所有内容。
  53182. * @return {SuperMap.LevelRenderer.Painter} this。
  53183. */
  53184. clearHover() {
  53185. var hover = this._layers.hover;
  53186. hover && hover.clear();
  53187. return this;
  53188. }
  53189. /**
  53190. * @function SuperMap.LevelRenderer.Painter.prototype.resize
  53191. * @description 区域大小变化后重绘。
  53192. * @return {SuperMap.LevelRenderer.Painter} this。
  53193. */
  53194. resize() {
  53195. var domRoot = this._domRoot;
  53196. domRoot.style.display = 'none';
  53197. var width = this._getWidth();
  53198. var height = this._getHeight();
  53199. domRoot.style.display = '';
  53200. // 优化没有实际改变的resize
  53201. if (this._width != width || height != this._height) {
  53202. this._width = width;
  53203. this._height = height;
  53204. domRoot.style.width = width + 'px';
  53205. domRoot.style.height = height + 'px';
  53206. for (var id in this._layers) {
  53207. this._layers[id].resize(width, height);
  53208. }
  53209. this.refresh(null, true);
  53210. }
  53211. return this;
  53212. }
  53213. /**
  53214. * @function SuperMap.LevelRenderer.Painter.prototype.clearLayer
  53215. * @description 清除指定的一个层。
  53216. * @param {number} zLevel - 层。
  53217. */
  53218. clearLayer(zLevel) {
  53219. var layer = this._layers[zLevel];
  53220. if (layer) {
  53221. layer.clear();
  53222. }
  53223. }
  53224. /**
  53225. * @function SuperMap.LevelRenderer.Painter.prototype.dispose
  53226. * @description 释放。
  53227. *
  53228. */
  53229. dispose() {
  53230. this.root.innerHTML = '';
  53231. this.root = null;
  53232. this.storage = null;
  53233. this._domRoot = null;
  53234. this._layers = null;
  53235. }
  53236. /**
  53237. * @function SuperMap.LevelRenderer.Painter.prototype.getDomHover
  53238. * @description 获取 Hover 层的 Dom。
  53239. */
  53240. getDomHover() {
  53241. return this._layers.hover.dom;
  53242. }
  53243. /**
  53244. * @function SuperMap.LevelRenderer.Painter.prototype.toDataURL
  53245. * @description 图像导出。
  53246. * @param {string} type - 图片类型。
  53247. * @param {string} backgroundColor - 背景色。默认值:'#fff'。
  53248. * @param {Object} args
  53249. * @return {string} 图片的Base64 url。
  53250. */
  53251. toDataURL(type, backgroundColor, args) {
  53252. //var imageDom = Painter.createDom('image', 'canvas', this);
  53253. var imageDom = Painter.createDom(Util.createUniqueID("SuperMap.Theme.image_"), 'canvas', this);
  53254. this._bgDom.appendChild(imageDom);
  53255. var ctx = imageDom.getContext('2d');
  53256. Painter.devicePixelRatio != 1
  53257. && ctx.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  53258. ctx.fillStyle = backgroundColor || '#fff';
  53259. ctx.rect(
  53260. 0, 0,
  53261. this._width * Painter.devicePixelRatio,
  53262. this._height * Painter.devicePixelRatio
  53263. );
  53264. ctx.fill();
  53265. var self = this;
  53266. // 升序遍历,shape上的zlevel指定绘画图层的z轴层叠
  53267. this.storage.iterShape(
  53268. function (shape) {
  53269. if (!shape.invisible) {
  53270. if (!shape.onbrush // 没有onbrush
  53271. // 有onbrush并且调用执行返回false或undefined则继续粉刷
  53272. || (shape.onbrush && !shape.onbrush(ctx, false))
  53273. ) {
  53274. if (Config.catchBrushException) {
  53275. try {
  53276. shape.brush(ctx, false, self.updatePainter);
  53277. } catch (error) {
  53278. SUtil_SUtil.Util_log(
  53279. error,
  53280. 'brush error of ' + shape.type,
  53281. shape
  53282. );
  53283. }
  53284. } else {
  53285. shape.brush(ctx, false, self.updatePainter);
  53286. }
  53287. }
  53288. }
  53289. },
  53290. {normal: 'up', update: true}
  53291. );
  53292. var image = imageDom.toDataURL(type, args);
  53293. ctx = null;
  53294. this._bgDom.removeChild(imageDom);
  53295. return image;
  53296. }
  53297. /**
  53298. * @function SuperMap.LevelRenderer.Painter.prototype.getWidth
  53299. * @description 获取绘图区域宽度。
  53300. * @return {number} 绘图区域宽度。
  53301. */
  53302. getWidth() {
  53303. return this._width;
  53304. }
  53305. /**
  53306. * @function SuperMap.LevelRenderer.Painter.prototype.getHeight
  53307. * @description 获取绘图区域高度。
  53308. * @return {number} 绘图区域高度。
  53309. */
  53310. getHeight() {
  53311. return this._height;
  53312. }
  53313. /**
  53314. * Method: _getWidth
  53315. *
  53316. */
  53317. _getWidth() {
  53318. var root = this.root;
  53319. var stl = root.currentStyle
  53320. || document.defaultView.getComputedStyle(root);
  53321. return ((root.clientWidth || parseInt(stl.width, 10))
  53322. - parseInt(stl.paddingLeft, 10) // 请原谅我这比较粗暴
  53323. - parseInt(stl.paddingRight, 10)).toFixed(0) - 0;
  53324. }
  53325. /**
  53326. * Method: _getHeight
  53327. *
  53328. */
  53329. _getHeight() {
  53330. var root = this.root;
  53331. var stl = root.currentStyle
  53332. || document.defaultView.getComputedStyle(root);
  53333. return ((root.clientHeight || parseInt(stl.height, 10))
  53334. - parseInt(stl.paddingTop, 10) // 请原谅我这比较粗暴
  53335. - parseInt(stl.paddingBottom, 10)).toFixed(0) - 0;
  53336. }
  53337. /**
  53338. * Method: _brushHover
  53339. *
  53340. */
  53341. _brushHover(shape) {
  53342. var ctx = this._layers.hover.ctx;
  53343. if (!shape.onbrush // 没有onbrush
  53344. // 有onbrush并且调用执行返回false或undefined则继续粉刷
  53345. || (shape.onbrush && !shape.onbrush(ctx, true))
  53346. ) {
  53347. var layer = this.getLayer(shape.zlevel);
  53348. if (layer.needTransform) {
  53349. ctx.save();
  53350. layer.setTransform(ctx);
  53351. }
  53352. // Retina 优化
  53353. if (Config.catchBrushException) {
  53354. try {
  53355. shape.brush(ctx, true, this.updatePainter);
  53356. } catch (error) {
  53357. SUtil_SUtil.Util_log(
  53358. error, 'hoverBrush error of ' + shape.type, shape
  53359. );
  53360. }
  53361. } else {
  53362. shape.brush(ctx, true, this.updatePainter);
  53363. }
  53364. if (layer.needTransform) {
  53365. ctx.restore();
  53366. }
  53367. }
  53368. }
  53369. /**
  53370. * Method: _shapeToImage
  53371. *
  53372. */
  53373. _shapeToImage(id, shape, width, height, devicePixelRatio) {
  53374. var canvas = document.createElement('canvas');
  53375. var ctx = canvas.getContext('2d');
  53376. var _devicePixelRatio = devicePixelRatio || window.devicePixelRatio || 1;
  53377. canvas.style.width = width + 'px';
  53378. canvas.style.height = height + 'px';
  53379. canvas.setAttribute('width', width * _devicePixelRatio);
  53380. canvas.setAttribute('height', height * _devicePixelRatio);
  53381. ctx.clearRect(0, 0, width * _devicePixelRatio, height * _devicePixelRatio);
  53382. var shapeTransform = {
  53383. position: shape.position,
  53384. rotation: shape.rotation,
  53385. scale: shape.scale
  53386. };
  53387. shape.position = [0, 0, 0];
  53388. shape.rotation = 0;
  53389. shape.scale = [1, 1];
  53390. if (shape) {
  53391. shape.brush(ctx, false);
  53392. }
  53393. var imgShape = new SmicImage({
  53394. id: id,
  53395. style: {
  53396. x: 0,
  53397. y: 0,
  53398. image: canvas
  53399. }
  53400. });
  53401. if (shapeTransform.position != null) {
  53402. imgShape.position = shape.position = shapeTransform.position;
  53403. }
  53404. if (shapeTransform.rotation != null) {
  53405. imgShape.rotation = shape.rotation = shapeTransform.rotation;
  53406. }
  53407. if (shapeTransform.scale != null) {
  53408. imgShape.scale = shape.scale = shapeTransform.scale;
  53409. }
  53410. return imgShape;
  53411. }
  53412. /**
  53413. * Method: _createShapeToImageProcessor
  53414. *
  53415. */
  53416. _createShapeToImageProcessor() {
  53417. var me = this;
  53418. return function (id, e, width, height) {
  53419. return me._shapeToImage(
  53420. id, e, width, height, Painter.devicePixelRatio
  53421. );
  53422. };
  53423. }
  53424. // SMIC-方法扩展 - start
  53425. /**
  53426. * @function SuperMap.LevelRenderer.Painter.prototype.updateHoverLayer
  53427. * @description 更新设置显示高亮图层。
  53428. * @param {Array} shapes - 图形数组。
  53429. */
  53430. updateHoverLayer(shapes) {
  53431. if (!(shapes instanceof Array)) {
  53432. return this;
  53433. }
  53434. //清除高亮
  53435. this.clearHover();
  53436. this.storage.delHover();
  53437. for (var i = 0; i < shapes.length; i++) {
  53438. this.storage.addHover(shapes[i]);
  53439. this._brushHover(shapes[i]);
  53440. }
  53441. }
  53442. /**
  53443. * @function SuperMap.LevelRenderer.Painter.prototype.createDom
  53444. * @description 创建 Dom。
  53445. *
  53446. * @param {string} id - Dom id
  53447. * @param {string} type - Dom type
  53448. * @param {SuperMap.LevelRenderer.Painter} painter - Painter 实例。
  53449. * @return {Object} Dom
  53450. */
  53451. static createDom(id, type, painter) {
  53452. var newDom = document.createElement(type);
  53453. var width = painter._width;
  53454. var height = painter._height;
  53455. // 没append呢,请原谅我这样写,清晰~
  53456. newDom.style.position = 'absolute';
  53457. newDom.style.left = 0;
  53458. newDom.style.top = 0;
  53459. newDom.style.width = width + 'px';
  53460. newDom.style.height = height + 'px';
  53461. newDom.setAttribute('width', width * Painter.devicePixelRatio);
  53462. newDom.setAttribute('height', height * Painter.devicePixelRatio);
  53463. // id不作为索引用,避免可能造成的重名,定义为私有属性
  53464. //newDom.setAttribute('data-zr-dom-id', id);
  53465. newDom.setAttribute('id', id);
  53466. return newDom;
  53467. }
  53468. }
  53469. /**
  53470. * @private
  53471. * @class Painter.Layer
  53472. * @classdesc 绘制层类。
  53473. * @extends SuperMap.LevelRenderer.Transformable
  53474. */
  53475. class PaintLayer extends Transformable {
  53476. /**
  53477. * @function Painter.Layer.constructor
  53478. * @description 构造函数。
  53479. *
  53480. * @param {string} id - id。
  53481. * @param {SuperMap.LevelRenderer.Painter} painter - Painter 实例。
  53482. *
  53483. */
  53484. constructor(id, painter) {
  53485. super(id, painter);
  53486. /**
  53487. * @member {Object} Painter.Layer.prototype.dom
  53488. * @description dom。
  53489. */
  53490. this.dom = null;
  53491. /**
  53492. * @member {Object} Painter.Layer.prototype.domBack
  53493. * @description domBack。
  53494. */
  53495. this.domBack = null;
  53496. /**
  53497. * @member {Object} Painter.Layer.prototype.ctxBack
  53498. * @description ctxBack。
  53499. */
  53500. this.ctxBack = null;
  53501. /**
  53502. * @member {SuperMap.LevelRenderer.Painter} Painter.Layer.prototype.painter
  53503. * @description painter。
  53504. */
  53505. this.painter = painter;
  53506. /**
  53507. * @member {number} Painter.Layer.prototype.unusedCount
  53508. * @description unusedCount。
  53509. */
  53510. this.unusedCount = 0;
  53511. /**
  53512. * @member {Object} Painter.Layer.prototype.config
  53513. * @description config。
  53514. */
  53515. this.config = null;
  53516. /**
  53517. * @member {boolean} Painter.Layer.prototype.dirty
  53518. * @description dirty。
  53519. */
  53520. this.dirty = true;
  53521. /**
  53522. * @member {number} Painter.Layer.prototype.elCount
  53523. * @description elCount。
  53524. */
  53525. this.elCount = 0;
  53526. // Configs
  53527. /**
  53528. * @member {string} Painter.Layer.prototype.clearColor
  53529. * @description 每次清空画布的颜色。默认值:0;
  53530. */
  53531. this.clearColor = 0;
  53532. /**
  53533. * @member {boolean} Painter.Layer.prototype.motionBlur
  53534. * @description 是否开启动态模糊。默认值:false;
  53535. */
  53536. this.motionBlur = false;
  53537. /**
  53538. * @member {number} Painter.Layer.prototype.lastFrameAlpha
  53539. * @description 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显
  53540. */
  53541. this.lastFrameAlpha = 0.7;
  53542. /**
  53543. * @member {boolean} Painter.Layer.prototype.zoomable
  53544. * @description 层是否支持鼠标平移操作。默认值:false;
  53545. */
  53546. this.zoomable = false;
  53547. /**
  53548. * @member {boolean} Painter.Layer.prototype.panable
  53549. * @description 层是否支持鼠标缩放操作。默认值:false;
  53550. */
  53551. this.panable = false;
  53552. /**
  53553. * @member {number} Painter.Layer.prototype.maxZoom
  53554. * @description maxZoom。默认值:Infinity。
  53555. */
  53556. this.maxZoom = Infinity;
  53557. /**
  53558. * @member {number} Painter.Layer.prototype.minZoom
  53559. * @description minZoom。默认值:0。
  53560. */
  53561. this.minZoom = 0;
  53562. /**
  53563. * @member {number} Painter.Layer.prototype.ctx
  53564. * @description Canvas 上下文。
  53565. */
  53566. this.ctx = null;
  53567. this.dom = Painter.createDom(Util.createUniqueID("SuperMap.Theme" + id), 'canvas', painter);
  53568. this.dom.onselectstart = returnFalse; // 避免页面选中的尴尬
  53569. this.dom.style['-webkit-user-select'] = 'none';
  53570. this.dom.style['user-select'] = 'none';
  53571. this.dom.style['-webkit-touch-callout'] = 'none';
  53572. // Function
  53573. // 返回false的方法,用于避免页面被选中
  53574. function returnFalse() {
  53575. return false;
  53576. }
  53577. this.CLASS_NAME = "SuperMap.LevelRenderer.Painter.Layer";
  53578. }
  53579. /**
  53580. * @function Painter.Layer.prototype.destroy
  53581. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  53582. */
  53583. destroy() {
  53584. this.dom = null;
  53585. this.domBack = null;
  53586. this.ctxBack = null;
  53587. this.painter = null;
  53588. this.unusedCount = null;
  53589. this.config = null;
  53590. this.dirty = null;
  53591. this.elCount = null;
  53592. this.clearColor = null;
  53593. this.motionBlur = null;
  53594. this.lastFrameAlpha = null;
  53595. this.zoomable = null;
  53596. this.panable = null;
  53597. this.maxZoom = null;
  53598. this.minZoom = null;
  53599. this.ctx = null;
  53600. Transformable.destroy.apply(this, arguments);
  53601. }
  53602. /**
  53603. * @function Painter.Layer.prototype.initContext
  53604. * @description 初始化 Canvan 2D 上下文。
  53605. */
  53606. initContext() {
  53607. this.ctx = this.dom.getContext('2d');
  53608. if (Painter.devicePixelRatio != 1) {
  53609. this.ctx.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  53610. }
  53611. }
  53612. /**
  53613. * @function Painter.Layer.prototype.createBackBuffer
  53614. * @description 创建备份缓冲。
  53615. */
  53616. createBackBuffer() {
  53617. this.domBack = Painter.createDom(Util.createUniqueID("SuperMap.Theme.back-" + this.id), 'canvas', this.painter);
  53618. this.ctxBack = this.domBack.getContext('2d');
  53619. if (Painter.devicePixelRatio != 1) {
  53620. this.ctxBack.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  53621. }
  53622. }
  53623. /**
  53624. * @function Painter.Layer.prototype.resize
  53625. * @description 改变大小。
  53626. *
  53627. * @param {number} width - 宽。
  53628. * @param {number} height - 高。
  53629. */
  53630. resize(width, height) {
  53631. this.dom.style.width = width + 'px';
  53632. this.dom.style.height = height + 'px';
  53633. this.dom.setAttribute('width', width * Painter.devicePixelRatio);
  53634. this.dom.setAttribute('height', height * Painter.devicePixelRatio);
  53635. if (Painter.devicePixelRatio != 1) {
  53636. this.ctx.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  53637. }
  53638. if (this.domBack) {
  53639. this.domBack.setAttribute('width', width * Painter.devicePixelRatio);
  53640. this.domBack.setAttribute('height', height * Painter.devicePixelRatio);
  53641. if (Painter.devicePixelRatio != 1) {
  53642. this.ctxBack.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  53643. }
  53644. }
  53645. }
  53646. /**
  53647. * @function Painter.Layer.prototype.clear
  53648. * @description 清空该层画布。
  53649. */
  53650. clear() {
  53651. var dom = this.dom;
  53652. var ctx = this.ctx;
  53653. var width = dom.width;
  53654. var height = dom.height;
  53655. var haveClearColor = this.clearColor;
  53656. var haveMotionBLur = this.motionBlur;
  53657. var lastFrameAlpha = this.lastFrameAlpha;
  53658. if (haveMotionBLur) {
  53659. if (!this.domBack) {
  53660. this.createBackBuffer();
  53661. }
  53662. this.ctxBack.globalCompositeOperation = 'copy';
  53663. this.ctxBack.drawImage(
  53664. dom, 0, 0,
  53665. width / Painter.devicePixelRatio,
  53666. height / Painter.devicePixelRatio
  53667. );
  53668. }
  53669. if (haveClearColor) {
  53670. ctx.save();
  53671. ctx.fillStyle = this.config.clearColor;
  53672. ctx.fillRect(
  53673. 0, 0,
  53674. width / Painter.devicePixelRatio,
  53675. height / Painter.devicePixelRatio
  53676. );
  53677. ctx.restore();
  53678. } else {
  53679. ctx.clearRect(
  53680. 0, 0,
  53681. width / Painter.devicePixelRatio,
  53682. height / Painter.devicePixelRatio
  53683. );
  53684. }
  53685. if (haveMotionBLur) {
  53686. var domBack = this.domBack;
  53687. ctx.save();
  53688. ctx.globalAlpha = lastFrameAlpha;
  53689. ctx.drawImage(
  53690. domBack, 0, 0,
  53691. width / Painter.devicePixelRatio,
  53692. height / Painter.devicePixelRatio
  53693. );
  53694. ctx.restore();
  53695. }
  53696. }
  53697. }
  53698. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Handler.js
  53699. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  53700. * This program are made available under the terms of the Apache License, Version 2.0
  53701. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53702. /**
  53703. * @private
  53704. * @class SuperMap.LevelRenderer.Handler
  53705. * @category Visualization Theme
  53706. * @classdesc Handler控制模块。
  53707. * @extends {SuperMap.LevelRenderer.Eventful}
  53708. */
  53709. class Handler extends Eventful {
  53710. /**
  53711. * @function SuperMap.LevelRenderer.Handler.constructor
  53712. * @description 构造函数。
  53713. * @param {HTMLElement} root - 绘图区域。
  53714. * @param {SuperMap.LevelRenderer.Storage} storage - Storage 实例。
  53715. * @param {SuperMap.LevelRenderer.Painter} painter - Painter 实例。
  53716. */
  53717. constructor(root, storage, painter) {
  53718. super(root, storage, painter);
  53719. /**
  53720. * @member {HTMLElement} SuperMap.LevelRenderer.Handler.prototype.root
  53721. * @description 绘图区域
  53722. */
  53723. this.root = root;
  53724. /**
  53725. * @member {SuperMap.LevelRenderer.Storage} SuperMap.LevelRenderer.Handler.prototype.storage
  53726. * @description Storage 实例
  53727. */
  53728. this.storage = storage;
  53729. /**
  53730. * @member {SuperMap.LevelRenderer.Painter} SuperMap.LevelRenderer.Handler.prototype.Painter
  53731. * @description Painter 实例
  53732. */
  53733. this.painter = painter;
  53734. /**
  53735. * @member {number} [SuperMap.LevelRenderer.Handler.prototype._lastX=0]
  53736. * @description 上一次鼠标位置x坐标值
  53737. */
  53738. this._lastX = 0;
  53739. /**
  53740. * @member {number} [SuperMap.LevelRenderer.Handler.prototype._lastY=0]
  53741. * @description 上一次鼠标位置y坐标值
  53742. */
  53743. this._lastY = 0;
  53744. /**
  53745. * @member {number} [SuperMap.LevelRenderer.Handler.prototype._mouseX=0]
  53746. * @description 当前鼠标位置x坐标值
  53747. */
  53748. this._mouseX = 0;
  53749. /**
  53750. * @member {number} [SuperMap.LevelRenderer.Handler.prototype._mouseY=0]
  53751. * @description 当前鼠标位置y坐标值
  53752. */
  53753. this._mouseY = 0;
  53754. /**
  53755. * @member {Function} SuperMap.LevelRenderer.Handler.prototype._findHover
  53756. * @description 查找 Hover 图形
  53757. */
  53758. this._findHover = null;
  53759. /**
  53760. * @member {Object} SuperMap.LevelRenderer.Handler.prototype._domHover
  53761. * @description 高亮 DOM
  53762. */
  53763. this._domHover = null;
  53764. // 各种事件标识的私有变量
  53765. // this._hasfound = false; // 是否找到 hover 图形元素
  53766. // this._lastHover = null; // 最后一个 hover 图形元素
  53767. // this._mouseDownTarget = null;
  53768. // this._draggingTarget = null; // 当前被拖拽的图形元素
  53769. // this._isMouseDown = false;
  53770. // this._isDragging = false;
  53771. // this._lastMouseDownMoment;
  53772. // this._lastTouchMoment;
  53773. // this._lastDownButton;
  53774. this._findHover = bind3Arg(findHover, this);
  53775. this._domHover = painter.getDomHover();
  53776. this.CLASS_NAME = "SuperMap.LevelRenderer.Handler";
  53777. var domHandlers = {
  53778. /**
  53779. * Method: resize
  53780. * 窗口大小改变响应函数。
  53781. *
  53782. * Parameters:
  53783. * event - {Event} event。
  53784. *
  53785. */
  53786. resize: function (event) {
  53787. event = event || window.event;
  53788. this._lastHover = null;
  53789. this._isMouseDown = 0;
  53790. // 分发SuperMap.LevelRenderer.Config.EVENT.RESIZE事件,global
  53791. this.dispatch(Config.EVENT.RESIZE, event);
  53792. },
  53793. /**
  53794. * Method: click
  53795. * 点击响应函数。
  53796. *
  53797. * Parameters:
  53798. * event - {Event} event。
  53799. *
  53800. */
  53801. click: function (event) {
  53802. event = this._zrenderEventFixed(event);
  53803. // 分发SuperMap.LevelRenderer.Config.EVENT.CLICK事件
  53804. var _lastHover = this._lastHover;
  53805. if ((_lastHover && _lastHover.clickable)
  53806. || !_lastHover
  53807. ) {
  53808. // 判断没有发生拖拽才触发click事件
  53809. if (this._clickThreshold < 10) {
  53810. this._dispatchAgency(_lastHover, Config.EVENT.CLICK, event);
  53811. }
  53812. }
  53813. this._mousemoveHandler(event);
  53814. },
  53815. /**
  53816. * Method: dblclick
  53817. * 双击响应函数。
  53818. *
  53819. * Parameters:
  53820. * event - {Event} event。
  53821. *
  53822. */
  53823. dblclick: function (event) {
  53824. event = event || window.event;
  53825. event = this._zrenderEventFixed(event);
  53826. // 分发SuperMap.LevelRenderer.Config.EVENT.DBLCLICK事件
  53827. var _lastHover = this._lastHover;
  53828. if ((_lastHover && _lastHover.clickable)
  53829. || !_lastHover
  53830. ) {
  53831. // 判断没有发生拖拽才触发dblclick事件
  53832. if (this._clickThreshold < 5) {
  53833. this._dispatchAgency(_lastHover, Config.EVENT.DBLCLICK, event);
  53834. }
  53835. }
  53836. this._mousemoveHandler(event);
  53837. },
  53838. /**
  53839. * Method: mousewheel
  53840. * 鼠标滚轮响应函数。
  53841. *
  53842. * Parameters:
  53843. * event - {Event} event。
  53844. *
  53845. */
  53846. mousewheel: function (event) {
  53847. event = this._zrenderEventFixed(event);
  53848. // http://www.sitepoint.com/html5-javascript-mouse-wheel/
  53849. // https://developer.mozilla.org/en-US/docs/DOM/DOM_event_reference/mousewheel
  53850. var delta = event.wheelDelta // Webkit
  53851. || -event.detail; // Firefox
  53852. var scale = delta > 0 ? 1.1 : 1 / 1.1;
  53853. var layers = this.painter.getLayers();
  53854. var needsRefresh = false;
  53855. for (var z in layers) {
  53856. if (z !== 'hover') {
  53857. var layer = layers[z];
  53858. var pos = layer.position;
  53859. if (layer.zoomable) {
  53860. layer.__zoom = layer.__zoom || 1;
  53861. var newZoom = layer.__zoom;
  53862. newZoom *= scale;
  53863. newZoom = Math.max(
  53864. Math.min(layer.maxZoom, newZoom),
  53865. layer.minZoom
  53866. );
  53867. scale = newZoom / layer.__zoom;
  53868. layer.__zoom = newZoom;
  53869. // Keep the mouse center when scaling
  53870. pos[0] -= (this._mouseX - pos[0]) * (scale - 1);
  53871. pos[1] -= (this._mouseY - pos[1]) * (scale - 1);
  53872. layer.scale[0] *= scale;
  53873. layer.scale[1] *= scale;
  53874. layer.dirty = true;
  53875. needsRefresh = true;
  53876. }
  53877. }
  53878. }
  53879. if (needsRefresh) {
  53880. this.painter.refresh();
  53881. }
  53882. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEWHEEL事件
  53883. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEWHEEL, event);
  53884. this._mousemoveHandler(event);
  53885. },
  53886. /**
  53887. * Method: mousemove
  53888. * 鼠标(手指)移动响应函数。
  53889. *
  53890. * Parameters:
  53891. * event - {Event} event。
  53892. *
  53893. */
  53894. mousemove: function (event) {
  53895. // 拖拽不触发click事件
  53896. this._clickThreshold++;
  53897. event = this._zrenderEventFixed(event);
  53898. this._lastX = this._mouseX;
  53899. this._lastY = this._mouseY;
  53900. this._mouseX = SUtil_SUtil.Util_event.getX(event);
  53901. this._mouseY = SUtil_SUtil.Util_event.getY(event);
  53902. var dx = this._mouseX - this._lastX;
  53903. var dy = this._mouseY - this._lastY;
  53904. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGSTART事件
  53905. // 避免手抖点击误认为拖拽
  53906. // if (this._mouseX - this._lastX > 1 || this._mouseY - this._lastY > 1) {
  53907. this._processDragStart(event);
  53908. // }
  53909. this._hasfound = 0;
  53910. this._event = event;
  53911. this._iterateAndFindHover();
  53912. // 找到的在迭代函数里做了处理,没找到得在迭代完后处理
  53913. if (!this._hasfound) {
  53914. // 过滤首次拖拽产生的mouseout和dragLeave
  53915. if (!this._draggingTarget
  53916. || (this._lastHover && this._lastHover != this._draggingTarget)
  53917. ) {
  53918. // 可能出现SuperMap.LevelRenderer.Config.EVENT.MOUSEOUT事件
  53919. this._processOutShape(event);
  53920. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGLEAVE事件
  53921. this._processDragLeave(event);
  53922. }
  53923. this._lastHover = null;
  53924. this.storage.delHover();
  53925. this.painter.clearHover();
  53926. }
  53927. // set cursor for root element
  53928. var cursor = '';
  53929. // 如果存在拖拽中元素,被拖拽的图形元素最后addHover
  53930. if (this._draggingTarget) {
  53931. this.storage.drift(this._draggingTarget.id, dx, dy);
  53932. this._draggingTarget.modSelf();
  53933. this.storage.addHover(this._draggingTarget);
  53934. } else if (this._isMouseDown) {
  53935. // Layer dragging
  53936. var layers = this.painter.getLayers();
  53937. var needsRefresh = false;
  53938. for (var z in layers) {
  53939. if (z !== 'hover') {
  53940. var layer = layers[z];
  53941. if (layer.panable) {
  53942. // PENDING
  53943. cursor = 'move';
  53944. // Keep the mouse center when scaling
  53945. layer.position[0] += dx;
  53946. layer.position[1] += dy;
  53947. needsRefresh = true;
  53948. layer.dirty = true;
  53949. }
  53950. }
  53951. }
  53952. if (needsRefresh) {
  53953. this.painter.refresh();
  53954. }
  53955. }
  53956. if (this._draggingTarget || (this._hasfound && this._lastHover.draggable)) {
  53957. cursor = 'move';
  53958. } else if (this._hasfound && this._lastHover.clickable) {
  53959. cursor = 'pointer';
  53960. }
  53961. this.root.style.cursor = cursor;
  53962. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEMOVE事件
  53963. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEMOVE, event);
  53964. if (this._draggingTarget || this._hasfound || this.storage.hasHoverShape()) {
  53965. this.painter.refreshHover();
  53966. }
  53967. },
  53968. /**
  53969. * Method: mouseout
  53970. * 鼠标(手指)离开响应函数。
  53971. *
  53972. * Parameters:
  53973. * event - {Event} event。
  53974. *
  53975. */
  53976. mouseout: function (event) {
  53977. event = this._zrenderEventFixed(event);
  53978. var element = event.toElement || event.relatedTarget;
  53979. if (element != this.root) {
  53980. while (element && element.nodeType != 9) {
  53981. // 忽略包含在root中的dom引起的mouseOut
  53982. if (element == this.root) {
  53983. this._mousemoveHandler(event);
  53984. return;
  53985. }
  53986. element = element.parentNode;
  53987. }
  53988. }
  53989. event.zrenderX = this._lastX;
  53990. event.zrenderY = this._lastY;
  53991. this.root.style.cursor = '';
  53992. this._isMouseDown = 0;
  53993. this._processOutShape(event);
  53994. this._processDrop(event);
  53995. this._processDragEnd(event);
  53996. this.painter.refreshHover();
  53997. this.dispatch(Config.EVENT.GLOBALOUT, event);
  53998. },
  53999. /**
  54000. * Method: mousedown
  54001. * 鼠标(手指)按下响应函数。
  54002. *
  54003. * Parameters:
  54004. * event - {Event} event。
  54005. *
  54006. */
  54007. mousedown: function (event) {
  54008. // 重置 clickThreshold
  54009. this._clickThreshold = 0;
  54010. if (this._lastDownButton == 2) {
  54011. this._lastDownButton = event.button;
  54012. this._mouseDownTarget = null;
  54013. // 仅作为关闭右键菜单使用
  54014. return;
  54015. }
  54016. this._lastMouseDownMoment = new Date();
  54017. event = this._zrenderEventFixed(event);
  54018. this._isMouseDown = 1;
  54019. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEDOWN事件
  54020. this._mouseDownTarget = this._lastHover;
  54021. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEDOWN, event);
  54022. this._lastDownButton = event.button;
  54023. },
  54024. /**
  54025. * Method: mouseup
  54026. * 鼠标(手指)抬起响应函数。
  54027. *
  54028. * Parameters:
  54029. * event - {Event} event。
  54030. *
  54031. */
  54032. mouseup: function (event) {
  54033. event = this._zrenderEventFixed(event);
  54034. this.root.style.cursor = '';
  54035. this._isMouseDown = 0;
  54036. this._mouseDownTarget = null;
  54037. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEUP事件
  54038. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEUP, event);
  54039. this._processDrop(event);
  54040. this._processDragEnd(event);
  54041. },
  54042. /**
  54043. * Method: touchstart
  54044. * Touch 开始响应函数。
  54045. *
  54046. * Parameters:
  54047. * event - {Event} event。
  54048. *
  54049. */
  54050. touchstart: function (event) {
  54051. // SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
  54052. event = this._zrenderEventFixed(event, true);
  54053. this._lastTouchMoment = new Date();
  54054. // 平板补充一次findHover
  54055. this._mobildFindFixed(event);
  54056. this._mousedownHandler(event);
  54057. },
  54058. /**
  54059. * Method: touchmove
  54060. * Touch 移动响应函数。
  54061. *
  54062. * Parameters:
  54063. * event - {Event} event。
  54064. *
  54065. */
  54066. touchmove: function (event) {
  54067. event = this._zrenderEventFixed(event, true);
  54068. this._mousemoveHandler(event);
  54069. if (this._isDragging) {
  54070. SUtil_SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
  54071. }
  54072. },
  54073. /**
  54074. * Method: touchend
  54075. * Touch 结束响应函数。
  54076. *
  54077. * Parameters:
  54078. * event - {Event} event。
  54079. *
  54080. */
  54081. touchend: function (event) {
  54082. // SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
  54083. event = this._zrenderEventFixed(event, true);
  54084. this._mouseupHandler(event);
  54085. var now = new Date();
  54086. if (now - this._lastTouchMoment < Config.EVENT.touchClickDelay) {
  54087. this._mobildFindFixed(event);
  54088. this._clickHandler(event);
  54089. if (now - this._lastClickMoment < Config.EVENT.touchClickDelay / 2) {
  54090. this._dblclickHandler(event);
  54091. if (this._lastHover && this._lastHover.clickable) {
  54092. SUtil_SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
  54093. }
  54094. }
  54095. this._lastClickMoment = now;
  54096. }
  54097. this.painter.clearHover();
  54098. }
  54099. };
  54100. initDomHandler(this);
  54101. // 初始化,事件绑定,支持的所有事件都由如下原生事件计算得来
  54102. if (window.addEventListener) {
  54103. window.addEventListener('resize', this._resizeHandler);
  54104. if (SUtil_SUtil.Util_env.os.tablet || SUtil_SUtil.Util_env.os.phone) {
  54105. // mobile支持
  54106. root.addEventListener('touchstart', this._touchstartHandler);
  54107. root.addEventListener('touchmove', this._touchmoveHandler);
  54108. root.addEventListener('touchend', this._touchendHandler);
  54109. } else {
  54110. // mobile的click/move/up/down自己模拟
  54111. root.addEventListener('click', this._clickHandler);
  54112. root.addEventListener('dblclick', this._dblclickHandler);
  54113. root.addEventListener('mousewheel', this._mousewheelHandler);
  54114. root.addEventListener('mousemove', this._mousemoveHandler);
  54115. root.addEventListener('mousedown', this._mousedownHandler);
  54116. root.addEventListener('mouseup', this._mouseupHandler);
  54117. }
  54118. root.addEventListener('DOMMouseScroll', this._mousewheelHandler);
  54119. root.addEventListener('mouseout', this._mouseoutHandler);
  54120. } else {
  54121. window.attachEvent('onresize', this._resizeHandler);
  54122. root.attachEvent('onclick', this._clickHandler);
  54123. //root.attachEvent('ondblclick ', this._dblclickHandler);
  54124. root.ondblclick = this._dblclickHandler;
  54125. root.attachEvent('onmousewheel', this._mousewheelHandler);
  54126. root.attachEvent('onmousemove', this._mousemoveHandler);
  54127. root.attachEvent('onmouseout', this._mouseoutHandler);
  54128. root.attachEvent('onmousedown', this._mousedownHandler);
  54129. root.attachEvent('onmouseup', this._mouseupHandler);
  54130. }
  54131. // 辅助函数 start
  54132. /**
  54133. * Method: bind1Arg
  54134. * bind 一个参数的 function。
  54135. *
  54136. * Parameters:
  54137. * handler - {Function} 要 bind 的 function。
  54138. * context - {Object} 运行时 this 环境。
  54139. *
  54140. * Returns:
  54141. * {Function}
  54142. */
  54143. function bind1Arg(handler, context) {
  54144. return function (e) {
  54145. return handler.call(context, e);
  54146. };
  54147. }
  54148. /*
  54149. // bind 两个参数的 function
  54150. function bind2Arg(handler, context) {
  54151. return function (arg1, arg2) {
  54152. return handler.call(context, arg1, arg2);
  54153. };
  54154. }
  54155. */
  54156. // bind 三个参数的 function
  54157. function bind3Arg(handler, context) {
  54158. return function (arg1, arg2, arg3) {
  54159. return handler.call(context, arg1, arg2, arg3);
  54160. };
  54161. }
  54162. /**
  54163. * Method: initDomHandler
  54164. * 为控制类实例初始化 dom 事件处理函数。
  54165. *
  54166. * Parameters:
  54167. * instance - {<SuperMap.LevelRenderer.Handler>} 控制类实例 。
  54168. *
  54169. * Returns:
  54170. * {Function}
  54171. */
  54172. function initDomHandler(instance) {
  54173. var domHandlerNames = [
  54174. 'resize', 'click', 'dblclick',
  54175. 'mousewheel', 'mousemove', 'mouseout', 'mouseup', 'mousedown',
  54176. 'touchstart', 'touchend', 'touchmove'
  54177. ];
  54178. var len = domHandlerNames.length;
  54179. while (len--) {
  54180. var name = domHandlerNames[len];
  54181. instance['_' + name + 'Handler'] = bind1Arg(domHandlers[name], instance);
  54182. }
  54183. }
  54184. /**
  54185. * Method: findHover
  54186. * 迭代函数,查找 hover 到的图形元素并即时做些事件分发。
  54187. *
  54188. * Parameters:
  54189. * shape - {Object} 图形。
  54190. * x - {number} 鼠标 x。
  54191. * y - {number} 鼠标 y。
  54192. *
  54193. * Returns:
  54194. * {boolean} 是否找到图形。
  54195. *
  54196. */
  54197. function findHover(shape, x, y) {
  54198. var me = this;
  54199. if (
  54200. (me._draggingTarget && me._draggingTarget.id == shape.id) // 迭代到当前拖拽的图形上
  54201. || shape.isSilent() // 打酱油的路过,啥都不响应的shape~
  54202. ) {
  54203. return false;
  54204. }
  54205. var event = me._event;
  54206. if (shape.isCover(x, y)) {
  54207. if (shape.hoverable) {
  54208. // SMIC-修改 - start
  54209. if (shape.isHoverByRefDataID && shape.isHoverByRefDataID === true) {
  54210. if (shape.refDataID) {
  54211. var fid = shape.refDataID;
  54212. //me.painter.clearHover();
  54213. //me.storage.delHover();
  54214. var hoverGroup = null;
  54215. if (shape.refDataHoverGroup) {
  54216. hoverGroup = shape.refDataHoverGroup;
  54217. }
  54218. //查找同一个用户数据 feature 的所有图形
  54219. var shapeList = me.storage._shapeList;
  54220. for (var i = 0, len = shapeList.length; i < len; i++) {
  54221. var si = shapeList[i];
  54222. if (si.refDataID && fid === si.refDataID) {
  54223. if (hoverGroup) {
  54224. if (si.refDataHoverGroup && hoverGroup === si.refDataHoverGroup) {
  54225. me.storage.addHover(si);
  54226. }
  54227. } else {
  54228. me.storage.addHover(si);
  54229. }
  54230. }
  54231. }
  54232. }
  54233. } else {
  54234. me.storage.addHover(shape);
  54235. }
  54236. //初始代码:
  54237. // me.storage.addHover(shape);
  54238. // SMIC-修改 - end
  54239. }
  54240. // 查找是否在 clipShape 中
  54241. var p = shape.parent;
  54242. while (p) {
  54243. if (p.clipShape && !p.clipShape.isCover(me._mouseX, me._mouseY)) {
  54244. // 已经被祖先 clip 掉了
  54245. return false;
  54246. }
  54247. p = p.parent;
  54248. }
  54249. if (me._lastHover != shape) {
  54250. me._processOutShape(event);
  54251. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGLEAVE事件
  54252. me._processDragLeave(event);
  54253. me._lastHover = shape;
  54254. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGENTER事件
  54255. me._processDragEnter(event);
  54256. }
  54257. me._processOverShape(event);
  54258. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGOVER
  54259. me._processDragOver(event);
  54260. me._hasfound = 1;
  54261. return true; // 找到则中断迭代查找
  54262. }
  54263. return false;
  54264. }
  54265. // 辅助函数 end
  54266. }
  54267. /**
  54268. * @function SuperMap.LevelRenderer.Handler.prototype.destroy
  54269. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为null。
  54270. */
  54271. destroy() {
  54272. this.dispose();
  54273. this._lastX = null;
  54274. this._lastY = null;
  54275. this._mouseX = null;
  54276. this._mouseY = null;
  54277. this._findHover = null;
  54278. Eventful.prototype.destroy.apply(this, arguments);
  54279. }
  54280. /**
  54281. * @function SuperMap.LevelRenderer.Handler.prototype.on
  54282. * @description 自定义事件绑定。
  54283. * @param {string} eventName - 事件名称,resize、hover、drag等。
  54284. * @param {function} handler - 响应函数。
  54285. * @returns {SuperMap.LevelRenderer.Handler} this。
  54286. */
  54287. on(eventName, handler) {
  54288. this.bind(eventName, handler);
  54289. return this;
  54290. }
  54291. /**
  54292. * @function SuperMap.LevelRenderer.Handler.prototype.un
  54293. * @description 自定义事件解除绑定。
  54294. * @param {string} eventName - 事件名称,resize、hover、drag等。
  54295. * @param {function} handler - 响应函数。
  54296. * @returns {SuperMap.LevelRenderer.Handler} this。
  54297. */
  54298. un(eventName, handler) {
  54299. this.unbind(eventName, handler);
  54300. return this;
  54301. }
  54302. /**
  54303. * @function SuperMap.LevelRenderer.Handler.prototype.trigger
  54304. * @description 事件触发。
  54305. * @param {string} eventName - 事件名称,resize、hover、drag等。
  54306. * @param {event} eventArgs - dom事件对象。
  54307. */
  54308. trigger(eventName, eventArgs) {
  54309. var EVENT = Config.EVENT;
  54310. switch (eventName) {
  54311. case EVENT.RESIZE:
  54312. case EVENT.CLICK:
  54313. case EVENT.DBLCLICK:
  54314. case EVENT.MOUSEWHEEL:
  54315. case EVENT.MOUSEMOVE:
  54316. case EVENT.MOUSEDOWN:
  54317. case EVENT.MOUSEUP:
  54318. case EVENT.MOUSEOUT:
  54319. this['_' + eventName + 'Handler'](eventArgs);
  54320. break;
  54321. }
  54322. }
  54323. /**
  54324. * @function SuperMap.LevelRenderer.Handler.prototype.dispose
  54325. * @description 释放,解绑所有事件。
  54326. */
  54327. dispose() {
  54328. var root = this.root;
  54329. if (window.removeEventListener) {
  54330. window.removeEventListener('resize', this._resizeHandler);
  54331. if (SUtil_SUtil.Util_env.os.tablet || SUtil_SUtil.Util_env.os.phone) {
  54332. // mobile支持
  54333. root.removeEventListener('touchstart', this._touchstartHandler);
  54334. root.removeEventListener('touchmove', this._touchmoveHandler);
  54335. root.removeEventListener('touchend', this._touchendHandler);
  54336. } else {
  54337. // mobile的click自己模拟
  54338. root.removeEventListener('click', this._clickHandler);
  54339. root.removeEventListener('dblclick', this._dblclickHandler);
  54340. root.removeEventListener('mousewheel', this._mousewheelHandler);
  54341. root.removeEventListener('mousemove', this._mousemoveHandler);
  54342. root.removeEventListener('mousedown', this._mousedownHandler);
  54343. root.removeEventListener('mouseup', this._mouseupHandler);
  54344. }
  54345. root.removeEventListener('DOMMouseScroll', this._mousewheelHandler);
  54346. root.removeEventListener('mouseout', this._mouseoutHandler);
  54347. } else {
  54348. window.detachEvent('onresize', this._resizeHandler);
  54349. root.detachEvent('onclick', this._clickHandler);
  54350. root.detachEvent('dblclick', this._dblclickHandler);
  54351. root.detachEvent('onmousewheel', this._mousewheelHandler);
  54352. root.detachEvent('onmousemove', this._mousemoveHandler);
  54353. root.detachEvent('onmouseout', this._mouseoutHandler);
  54354. root.detachEvent('onmousedown', this._mousedownHandler);
  54355. root.detachEvent('onmouseup', this._mouseupHandler);
  54356. }
  54357. this.root = null;
  54358. this._domHover = null;
  54359. this.storage = null;
  54360. this.painter = null;
  54361. this.un();
  54362. }
  54363. /**
  54364. * Method: _processDragStart
  54365. * 拖拽开始。
  54366. *
  54367. * Parameters:
  54368. * event - {Object} 事件对象。
  54369. *
  54370. */
  54371. _processDragStart(event) {
  54372. var _lastHover = this._lastHover;
  54373. if (this._isMouseDown
  54374. && _lastHover
  54375. && _lastHover.draggable
  54376. && !this._draggingTarget
  54377. && this._mouseDownTarget == _lastHover
  54378. ) {
  54379. // 拖拽点击生效时长阀门,某些场景需要降低拖拽敏感度
  54380. if (_lastHover.dragEnableTime &&
  54381. new Date() - this._lastMouseDownMoment < _lastHover.dragEnableTime
  54382. ) {
  54383. return;
  54384. }
  54385. var _draggingTarget = _lastHover;
  54386. this._draggingTarget = _draggingTarget;
  54387. this._isDragging = 1;
  54388. _draggingTarget.invisible = true;
  54389. this.storage.mod(_draggingTarget.id);
  54390. // 分发 Config.EVENT.DRAGSTART事件
  54391. this._dispatchAgency(
  54392. _draggingTarget,
  54393. Config.EVENT.DRAGSTART,
  54394. event
  54395. );
  54396. this.painter.refresh();
  54397. }
  54398. }
  54399. /**
  54400. * Method: _processDragEnter
  54401. * 拖拽进入目标元素。
  54402. *
  54403. * Parameters:
  54404. * event - {Object} 事件对象。
  54405. *
  54406. */
  54407. _processDragEnter(event) {
  54408. if (this._draggingTarget) {
  54409. // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGENTER事件
  54410. this._dispatchAgency(
  54411. this._lastHover,
  54412. Config.EVENT.DRAGENTER,
  54413. event,
  54414. this._draggingTarget
  54415. );
  54416. }
  54417. }
  54418. /**
  54419. * Method: _processDragOver
  54420. * 拖拽在目标元素上移动。
  54421. *
  54422. * Parameters:
  54423. * event - {Object} 事件对象。
  54424. *
  54425. */
  54426. _processDragOver(event) {
  54427. if (this._draggingTarget) {
  54428. // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGOVER事件
  54429. this._dispatchAgency(
  54430. this._lastHover,
  54431. Config.EVENT.DRAGOVER,
  54432. event,
  54433. this._draggingTarget
  54434. );
  54435. }
  54436. }
  54437. /**
  54438. * Method: _processDragLeave
  54439. * 拖拽离开目标元素。
  54440. *
  54441. * Parameters:
  54442. * event - {Object} 事件对象。
  54443. *
  54444. */
  54445. _processDragLeave(event) {
  54446. if (this._draggingTarget) {
  54447. // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGLEAVE事件
  54448. this._dispatchAgency(
  54449. this._lastHover,
  54450. Config.EVENT.DRAGLEAVE,
  54451. event,
  54452. this._draggingTarget
  54453. );
  54454. }
  54455. }
  54456. /**
  54457. * Method: _processDrop
  54458. * 拖拽在目标元素上完成。
  54459. *
  54460. * Parameters:
  54461. * event - {Object} 事件对象。
  54462. *
  54463. */
  54464. _processDrop(event) {
  54465. if (this._draggingTarget) {
  54466. this._draggingTarget.invisible = false;
  54467. this.storage.mod(this._draggingTarget.id);
  54468. this.painter.refresh();
  54469. // 分发SuperMap.LevelRenderer.Config.EVENT.DROP事件
  54470. this._dispatchAgency(
  54471. this._lastHover,
  54472. Config.EVENT.DROP,
  54473. event,
  54474. this._draggingTarget
  54475. );
  54476. }
  54477. }
  54478. /**
  54479. * Method: _processDragEnd
  54480. * 拖拽结束。
  54481. *
  54482. * Parameters:
  54483. * event - {Object} 事件对象。
  54484. *
  54485. */
  54486. _processDragEnd(event) {
  54487. if (this._draggingTarget) {
  54488. // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGEND事件
  54489. this._dispatchAgency(
  54490. this._draggingTarget,
  54491. Config.EVENT.DRAGEND,
  54492. event
  54493. );
  54494. this._lastHover = null;
  54495. }
  54496. this._isDragging = 0;
  54497. this._draggingTarget = null;
  54498. }
  54499. /**
  54500. * Method: _processOverShape
  54501. * 鼠标在某个图形元素上移动。
  54502. *
  54503. * Parameters:
  54504. * event - {Object} 事件对象。
  54505. *
  54506. */
  54507. _processOverShape(event) {
  54508. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEOVER事件
  54509. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEOVER, event);
  54510. }
  54511. /**
  54512. * Method: _processOutShape
  54513. * 鼠标离开某个图形元素。
  54514. *
  54515. * Parameters:
  54516. * event - {Object} 事件对象。
  54517. *
  54518. */
  54519. _processOutShape(event) {
  54520. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEOUT事件
  54521. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEOUT, event);
  54522. }
  54523. /**
  54524. * Method: _dispatchAgency
  54525. * 鼠标离开某个图形元素。
  54526. *
  54527. * Parameters:
  54528. * targetShape - {Object} 目标图形元素。
  54529. * eventName - {Object} 事件名称。
  54530. * event - {Object} 事件对象。
  54531. * draggedShape - {Object} 拖拽事件特有,当前被拖拽图形元素。
  54532. *
  54533. */
  54534. _dispatchAgency(targetShape, eventName, event, draggedShape) {
  54535. var eventHandler = 'on' + eventName;
  54536. var eventPacket = {
  54537. type: eventName,
  54538. event: event,
  54539. target: targetShape,
  54540. cancelBubble: false
  54541. };
  54542. var el = targetShape;
  54543. if (draggedShape) {
  54544. eventPacket.dragged = draggedShape;
  54545. }
  54546. while (el) {
  54547. el[eventHandler]
  54548. && (eventPacket.cancelBubble = el[eventHandler](eventPacket));
  54549. el.dispatch(eventName, eventPacket);
  54550. el = el.parent;
  54551. if (eventPacket.cancelBubble) {
  54552. break;
  54553. }
  54554. }
  54555. if (targetShape) {
  54556. // 冒泡到顶级 zrender 对象
  54557. if (!eventPacket.cancelBubble) {
  54558. this.dispatch(eventName, eventPacket);
  54559. }
  54560. } else if (!draggedShape) {
  54561. // 无hover目标,无拖拽对象,原生事件分发
  54562. this.dispatch(eventName, {
  54563. type: eventName,
  54564. event: event
  54565. });
  54566. }
  54567. }
  54568. /**
  54569. * Method: _iterateAndFindHover
  54570. * 迭代寻找 hover shape。
  54571. *
  54572. */
  54573. _iterateAndFindHover() {
  54574. var invTransform = SUtil_SUtil.Util_matrix.create();
  54575. var list = this.storage.getShapeList();
  54576. var currentZLevel;
  54577. var currentLayer;
  54578. var tmp = [0, 0];
  54579. for (var i = list.length - 1; i >= 0; i--) {
  54580. var shape = list[i];
  54581. if (currentZLevel !== shape.zlevel) {
  54582. currentLayer = this.painter.getLayer(shape.zlevel, currentLayer);
  54583. tmp[0] = this._mouseX;
  54584. tmp[1] = this._mouseY;
  54585. if (currentLayer.needTransform) {
  54586. SUtil_SUtil.Util_matrix.invert(invTransform, currentLayer.transform);
  54587. SUtil_SUtil.Util_vector.applyTransform(tmp, tmp, invTransform);
  54588. }
  54589. }
  54590. if (this._findHover(shape, tmp[0], tmp[1])) {
  54591. break;
  54592. }
  54593. }
  54594. }
  54595. /**
  54596. * Method: _mobildFindFixed
  54597. * touch 有指尖错觉,四向尝试,让touch上的点击更好触发事件。
  54598. *
  54599. * Parameters:
  54600. * event - {Object} 事件对象。
  54601. *
  54602. */
  54603. _mobildFindFixed(event) {
  54604. // touch指尖错觉的尝试偏移量配置
  54605. var MOBILE_TOUCH_OFFSETS = [
  54606. {x: 10},
  54607. {x: -20},
  54608. {x: 10, y: 10},
  54609. {y: -20}
  54610. ];
  54611. this._lastHover = null;
  54612. this._mouseX = event.zrenderX;
  54613. this._mouseY = event.zrenderY;
  54614. this._event = event;
  54615. this._iterateAndFindHover();
  54616. for (var i = 0; !this._lastHover && i < MOBILE_TOUCH_OFFSETS.length; i++) {
  54617. var offset = MOBILE_TOUCH_OFFSETS[i];
  54618. offset.x && (this._mouseX += offset.x);
  54619. offset.y && (this._mouseX += offset.y);
  54620. this._iterateAndFindHover();
  54621. }
  54622. if (this._lastHover) {
  54623. event.zrenderX = this._mouseX;
  54624. event.zrenderY = this._mouseY;
  54625. }
  54626. }
  54627. /**
  54628. * Method: _zrenderEventFixed
  54629. * 如果存在第三方嵌入的一些dom触发的事件,或touch事件,需要转换一下事件坐标 。
  54630. *
  54631. * Parameters:
  54632. * event - {Object} 事件。
  54633. * isTouch - {boolean} 是否触摸。
  54634. *
  54635. */
  54636. _zrenderEventFixed(event, isTouch) {
  54637. if (event.zrenderFixed) {
  54638. return event;
  54639. }
  54640. if (!isTouch) {
  54641. event = event || window.event;
  54642. // 进入对象优先~
  54643. var target = event.toElement
  54644. || event.relatedTarget
  54645. || event.srcElement
  54646. || event.target;
  54647. if (target && target != this._domHover) {
  54648. event.zrenderX = (typeof event.offsetX != 'undefined'
  54649. ? event.offsetX
  54650. : event.layerX)
  54651. + target.offsetLeft;
  54652. event.zrenderY = (typeof event.offsetY != 'undefined'
  54653. ? event.offsetY
  54654. : event.layerY)
  54655. + target.offsetTop;
  54656. }
  54657. } else {
  54658. var touch = event.type != 'touchend'
  54659. ? event.targetTouches[0]
  54660. : event.changedTouches[0];
  54661. if (touch) {
  54662. var rBounding = this.root.getBoundingClientRect();
  54663. // touch事件坐标是全屏的~
  54664. event.zrenderX = touch.clientX - rBounding.left;
  54665. event.zrenderY = touch.clientY - rBounding.top;
  54666. }
  54667. }
  54668. event.zrenderFixed = 1;
  54669. return event;
  54670. }
  54671. // SMIC-方法扩展 - start
  54672. /**
  54673. * @function SuperMap.LevelRenderer.Handler.prototype.getLastHoverOne
  54674. * @description 获取单个高亮图形
  54675. */
  54676. getLastHoverOne() {
  54677. if (this._lastHover) {
  54678. return this._lastHover;
  54679. }
  54680. return null;
  54681. }
  54682. // SMIC-方法扩展 - end
  54683. }
  54684. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Easing.js
  54685. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  54686. * This program are made available under the terms of the Apache License, Version 2.0
  54687. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  54688. /**
  54689. * @class SuperMap.LevelRenderer.Animation.easing
  54690. * @category Visualization Theme
  54691. * @classdesc 缓动
  54692. * @private
  54693. */
  54694. // 缓动代码来自 https://github.com/sole/tween.js/blob/master/src/Tween.js
  54695. // http://sole.github.io/tween.js/examples/03_graphs.html
  54696. class Easing {
  54697. /**
  54698. * @function SuperMap.LevelRenderer.Animation.easing.constructor
  54699. * @description 构造函数。
  54700. */
  54701. constructor() {
  54702. this.CLASS_NAME = "SuperMap.LevelRenderer.Animation.easing";
  54703. }
  54704. /**
  54705. * @function SuperMap.LevelRenderer.Animation.easing.destroy
  54706. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  54707. */
  54708. destroy() {
  54709. }
  54710. /**
  54711. * @function SuperMap.LevelRenderer.Animation.easing.Linear
  54712. * @description 线性缓动
  54713. * @param {number} k - 参数
  54714. * @return {number} 输入值
  54715. */
  54716. Linear(k) {
  54717. return k;
  54718. }
  54719. /**
  54720. * @function SuperMap.LevelRenderer.Animation.easing.QuadraticIn
  54721. * @description 二次方的缓动(t^2)
  54722. * @param {number} k - 参数
  54723. * @return {number} 二次方的缓动的值
  54724. */
  54725. QuadraticIn(k) {
  54726. return k * k;
  54727. }
  54728. /**
  54729. * @function SuperMap.LevelRenderer.Animation.easing.QuadraticOut
  54730. * @description 返回按二次方缓动退出的值
  54731. * @param {number} k - 参数
  54732. * @return {number} 按二次方缓动退出的值
  54733. */
  54734. QuadraticOut(k) {
  54735. return k * (2 - k);
  54736. }
  54737. /**
  54738. * @function SuperMap.LevelRenderer.Animation.easing.QuadraticInOut
  54739. * @description 返回按二次方缓动进入和退出的值
  54740. * @param {number} k - 参数
  54741. * @return {number} 按二次方缓动进入和退出的值
  54742. */
  54743. QuadraticInOut(k) {
  54744. if ((k *= 2) < 1) {
  54745. return 0.5 * k * k;
  54746. }
  54747. return -0.5 * (--k * (k - 2) - 1);
  54748. }
  54749. /**
  54750. * @function SuperMap.LevelRenderer.Animation.easing.CubicIn
  54751. * @description 三次方的缓动(t^3)
  54752. * @param {number} k - 参数
  54753. * @return {number} 按三次方缓动的值
  54754. */
  54755. CubicIn(k) {
  54756. return k * k * k;
  54757. }
  54758. /**
  54759. * @function SuperMap.LevelRenderer.Animation.easing.CubicOut
  54760. * @description 返回按三次方缓动退出的值
  54761. * @param {number} k - 参数
  54762. * @return {number} 按三次方缓动退出的值
  54763. */
  54764. CubicOut(k) {
  54765. return --k * k * k + 1;
  54766. }
  54767. /**
  54768. * @function SuperMap.LevelRenderer.Animation.easing.CubicInOut
  54769. * @description 返回按三次方缓动进入退出的值
  54770. * @param {number} k - 参数
  54771. * @return {number} 按三次方缓动进入退出的值
  54772. */
  54773. CubicInOut(k) {
  54774. if ((k *= 2) < 1) {
  54775. return 0.5 * k * k * k;
  54776. }
  54777. return 0.5 * ((k -= 2) * k * k + 2);
  54778. }
  54779. /**
  54780. * @function SuperMap.LevelRenderer.Animation.easing.QuarticIn
  54781. * @description 返回按四次方缓动进入的值
  54782. * @param {number} k - 参数
  54783. * @return {number} 按四次方缓动进入的值
  54784. */
  54785. QuarticIn(k) {
  54786. return k * k * k * k;
  54787. }
  54788. /**
  54789. * @function SuperMap.LevelRenderer.Animation.easing.QuarticOut
  54790. * @description 返回按四次方缓动退出的值
  54791. * @param {number} k - 参数
  54792. * @return {number} 按四次方缓动退出的值
  54793. */
  54794. QuarticOut(k) {
  54795. return 1 - (--k * k * k * k);
  54796. }
  54797. /**
  54798. * @function SuperMap.LevelRenderer.Animation.easing.QuarticInOut
  54799. * @description 返回按四次方缓动进入退出的值
  54800. * @param {number} k - 参数
  54801. * @return {number} 按四次方缓动进入退出的值
  54802. */
  54803. QuarticInOut(k) {
  54804. if ((k *= 2) < 1) {
  54805. return 0.5 * k * k * k * k;
  54806. }
  54807. return -0.5 * ((k -= 2) * k * k * k - 2);
  54808. }
  54809. // 五次方的缓动(t^5)
  54810. /**
  54811. * @function SuperMap.LevelRenderer.Animation.easing.QuinticIn
  54812. * @description 返回按五次方缓动的值
  54813. * @param {number} k - 参数
  54814. * @return {number} 按五次方缓动的值
  54815. */
  54816. QuinticIn(k) {
  54817. return k * k * k * k * k;
  54818. }
  54819. /**
  54820. * @function SuperMap.LevelRenderer.Animation.easing.QuinticOut
  54821. * @description 返回按五次方缓动退出的值
  54822. * @param {number} k - 参数
  54823. * @return {number} 按五次方缓动退出的值
  54824. */
  54825. QuinticOut(k) {
  54826. return --k * k * k * k * k + 1;
  54827. }
  54828. /**
  54829. * @function SuperMap.LevelRenderer.Animation.easing.QuinticInOut
  54830. * @description 返回按五次方缓动进入退出的值
  54831. * @param {number} k - 参数
  54832. * @return {number} 按五次方缓动进入退出的值
  54833. */
  54834. QuinticInOut(k) {
  54835. if ((k *= 2) < 1) {
  54836. return 0.5 * k * k * k * k * k;
  54837. }
  54838. return 0.5 * ((k -= 2) * k * k * k * k + 2);
  54839. }
  54840. // 正弦曲线的缓动(sin(t))
  54841. /**
  54842. * @function SuperMap.LevelRenderer.Animation.easing.SinusoidalIn
  54843. * @description 返回按正弦曲线的缓动进入的值
  54844. * @param {number} k - 参数
  54845. * @return {number} 按正弦曲线的缓动进入的值
  54846. */
  54847. SinusoidalIn(k) {
  54848. return 1 - Math.cos(k * Math.PI / 2);
  54849. }
  54850. /**
  54851. * @function SuperMap.LevelRenderer.Animation.easing.SinusoidalOut
  54852. * @description 返回按正弦曲线的缓动退出的值
  54853. * @param {number} k - 参数
  54854. * @return {number} 按正弦曲线的缓动退出的值
  54855. */
  54856. SinusoidalOut(k) {
  54857. return Math.sin(k * Math.PI / 2);
  54858. }
  54859. /**
  54860. * @function SuperMap.LevelRenderer.Animation.easing.SinusoidalInOut
  54861. * @description 返回按正弦曲线的缓动进入退出的值
  54862. * @param {number} k - 参数
  54863. * @return {number} 按正弦曲线的缓动进入退出的值
  54864. */
  54865. SinusoidalInOut(k) {
  54866. return 0.5 * (1 - Math.cos(Math.PI * k));
  54867. }
  54868. // 指数曲线的缓动(2^t)
  54869. /**
  54870. * @function SuperMap.LevelRenderer.Animation.easing.ExponentialIn
  54871. * @description 返回按指数曲线的缓动进入的值
  54872. * @param {number} k - 参数
  54873. * @return {number} 按指数曲线的缓动进入的值
  54874. */
  54875. ExponentialIn(k) {
  54876. return k === 0 ? 0 : Math.pow(1024, k - 1);
  54877. }
  54878. /**
  54879. * @function SuperMap.LevelRenderer.Animation.easing.ExponentialOut
  54880. * @description 返回按指数曲线的缓动退出的值
  54881. * @param {number} k - 参数
  54882. * @return {number} 按指数曲线的缓动退出的值
  54883. */
  54884. ExponentialOut(k) {
  54885. return k === 1 ? 1 : 1 - Math.pow(2, -10 * k);
  54886. }
  54887. /**
  54888. * @function SuperMap.LevelRenderer.Animation.easing.ExponentialInOut
  54889. * @description 返回按指数曲线的缓动进入退出的值
  54890. * @param {number} k - 参数
  54891. * @return {number} 按指数曲线的缓动进入退出的值
  54892. */
  54893. ExponentialInOut(k) {
  54894. if (k === 0) {
  54895. return 0;
  54896. }
  54897. if (k === 1) {
  54898. return 1;
  54899. }
  54900. if ((k *= 2) < 1) {
  54901. return 0.5 * Math.pow(1024, k - 1);
  54902. }
  54903. return 0.5 * (-Math.pow(2, -10 * (k - 1)) + 2);
  54904. }
  54905. // 圆形曲线的缓动(sqrt(1-t^2))
  54906. /**
  54907. * @function SuperMap.LevelRenderer.Animation.easing.CircularIn
  54908. * @description 返回按圆形曲线的缓动进入的值
  54909. * @param {number} k - 参数
  54910. * @return {number} 按圆形曲线的缓动进入的值
  54911. */
  54912. CircularIn(k) {
  54913. return 1 - Math.sqrt(1 - k * k);
  54914. }
  54915. /**
  54916. * @function SuperMap.LevelRenderer.Animation.easing.CircularOut
  54917. * @description 返回按圆形曲线的缓动退出的值
  54918. * @param {number} k - 参数
  54919. * @return {number} 按圆形曲线的缓动退出的值
  54920. */
  54921. CircularOut(k) {
  54922. return Math.sqrt(1 - (--k * k));
  54923. }
  54924. /**
  54925. * @function SuperMap.LevelRenderer.Animation.easing.CircularInOut
  54926. * @description 返回按圆形曲线的缓动进入退出的值
  54927. * @param {number} k - 参数
  54928. * @return {number} 按圆形曲线的缓动进入退出的值
  54929. */
  54930. CircularInOut(k) {
  54931. if ((k *= 2) < 1) {
  54932. return -0.5 * (Math.sqrt(1 - k * k) - 1);
  54933. }
  54934. return 0.5 * (Math.sqrt(1 - (k -= 2) * k) + 1);
  54935. }
  54936. // 创建类似于弹簧在停止前来回振荡的动画
  54937. /**
  54938. * @function SuperMap.LevelRenderer.Animation.easing.ElasticIn
  54939. * @description 返回按类似于弹簧在停止前来回振荡的动画的缓动进入的值
  54940. * @param {number} k - 参数
  54941. * @return {number} 按类似于弹簧在停止前来回振荡的动画的缓动进入的值
  54942. */
  54943. ElasticIn(k) {
  54944. var s;
  54945. var a = 0.1;
  54946. var p = 0.4;
  54947. if (k === 0) {
  54948. return 0;
  54949. }
  54950. if (k === 1) {
  54951. return 1;
  54952. }
  54953. if (a < 1) {
  54954. a = 1;
  54955. s = p / 4;
  54956. } else {
  54957. s = p * Math.asin(1 / a) / (2 * Math.PI);
  54958. }
  54959. return -(a * Math.pow(2, 10 * (k -= 1)) *
  54960. Math.sin((k - s) * (2 * Math.PI) / p));
  54961. }
  54962. /**
  54963. * @function SuperMap.LevelRenderer.Animation.easing.ElasticOut
  54964. * @description 返回按类似于弹簧在停止前来回振荡的动画的缓动退出的值
  54965. * @param {number} k - 参数
  54966. * @return {number} 按类似于弹簧在停止前来回振荡的动画的缓动退出的值
  54967. */
  54968. ElasticOut(k) {
  54969. var s;
  54970. var a = 0.1;
  54971. var p = 0.4;
  54972. if (k === 0) {
  54973. return 0;
  54974. }
  54975. if (k === 1) {
  54976. return 1;
  54977. }
  54978. if (a < 1) {
  54979. a = 1;
  54980. s = p / 4;
  54981. } else {
  54982. s = p * Math.asin(1 / a) / (2 * Math.PI);
  54983. }
  54984. return (a * Math.pow(2, -10 * k) *
  54985. Math.sin((k - s) * (2 * Math.PI) / p) + 1);
  54986. }
  54987. /**
  54988. * @function SuperMap.LevelRenderer.Animation.easing.ElasticInOut
  54989. * @description 返回按类似于弹簧在停止前来回振荡的动画的缓动进入退出的值
  54990. * @param {number} k - 参数
  54991. * @return {number} 按类似于弹簧在停止前来回振荡的动画的缓动进入退出的值
  54992. */
  54993. ElasticInOut(k) {
  54994. var s;
  54995. var a = 0.1;
  54996. var p = 0.4;
  54997. if (k === 0) {
  54998. return 0;
  54999. }
  55000. if (k === 1) {
  55001. return 1;
  55002. }
  55003. if (a < 1) {
  55004. a = 1;
  55005. s = p / 4;
  55006. } else {
  55007. s = p * Math.asin(1 / a) / (2 * Math.PI);
  55008. }
  55009. if ((k *= 2) < 1) {
  55010. return -0.5 * (a * Math.pow(2, 10 * (k -= 1))
  55011. * Math.sin((k - s) * (2 * Math.PI) / p));
  55012. }
  55013. return a * Math.pow(2, -10 * (k -= 1))
  55014. * Math.sin((k - s) * (2 * Math.PI) / p) * 0.5 + 1;
  55015. }
  55016. // 在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动
  55017. /**
  55018. * @function SuperMap.LevelRenderer.Animation.easing.BackIn
  55019. * @description 返回按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入的值
  55020. * @param {number} k - 参数
  55021. * @return {number} 按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入的值
  55022. */
  55023. BackIn(k) {
  55024. var s = 1.70158;
  55025. return k * k * ((s + 1) * k - s);
  55026. }
  55027. /**
  55028. * @function SuperMap.LevelRenderer.Animation.easing.BackOut
  55029. * @description 返回按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动退出的值
  55030. * @param {number} k - 参数
  55031. * @return {number} 按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动退出的值
  55032. */
  55033. BackOut(k) {
  55034. var s = 1.70158;
  55035. return --k * k * ((s + 1) * k + s) + 1;
  55036. }
  55037. /**
  55038. * @function SuperMap.LevelRenderer.Animation.easing.BackInOut
  55039. * @description 返回按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入退出的值
  55040. * @param {number} k - 参数
  55041. * @return {number} 按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入退出的值
  55042. */
  55043. BackInOut(k) {
  55044. var s = 1.70158 * 1.525;
  55045. if ((k *= 2) < 1) {
  55046. return 0.5 * (k * k * ((s + 1) * k - s));
  55047. }
  55048. return 0.5 * ((k -= 2) * k * ((s + 1) * k + s) + 2);
  55049. }
  55050. // 创建弹跳效果
  55051. /**
  55052. * @function SuperMap.LevelRenderer.Animation.easing.BounceIn
  55053. * @description 返回按弹跳效果的缓动进入的值
  55054. * @param {number} k - 参数
  55055. * @return {number} 按弹跳效果的缓动进入的值
  55056. */
  55057. BounceIn(k) {
  55058. return 1 - this.BounceOut(1 - k);
  55059. }
  55060. /**
  55061. * @function SuperMap.LevelRenderer.Animation.easing.BounceOut
  55062. * @description 返回按弹跳效果的缓动退出的值
  55063. * @param {number} k - 参数
  55064. * @return {number} 按弹跳效果的缓动退出的值
  55065. */
  55066. BounceOut(k) {
  55067. if (k < (1 / 2.75)) {
  55068. return 7.5625 * k * k;
  55069. } else if (k < (2 / 2.75)) {
  55070. return 7.5625 * (k -= (1.5 / 2.75)) * k + 0.75;
  55071. } else if (k < (2.5 / 2.75)) {
  55072. return 7.5625 * (k -= (2.25 / 2.75)) * k + 0.9375;
  55073. } else {
  55074. return 7.5625 * (k -= (2.625 / 2.75)) * k + 0.984375;
  55075. }
  55076. }
  55077. /**
  55078. * @function SuperMap.LevelRenderer.Animation.easing.BounceInOut
  55079. * @description 返回按弹跳效果的缓动进入退出的值
  55080. * @param {number} k - 参数
  55081. * @return {number} 按弹跳效果的缓动进入退出的值
  55082. */
  55083. BounceInOut(k) {
  55084. if (k < 0.5) {
  55085. return this.BounceIn(k * 2) * 0.5;
  55086. }
  55087. return this.BounceOut(k * 2 - 1) * 0.5 + 0.5;
  55088. }
  55089. }
  55090. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Clip.js
  55091. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  55092. * This program are made available under the terms of the Apache License, Version 2.0
  55093. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55094. /**
  55095. * @class SuperMap.LevelRenderer.Animation.Clip
  55096. * @category Visualization Theme
  55097. * @classdec 动画片段
  55098. * @private
  55099. */
  55100. class Clip {
  55101. /**
  55102. * @function SuperMap.LevelRenderer.Animation.Clip.prototype.constructor
  55103. * @description 构造函数。
  55104. * @param {Object} options - 参数。
  55105. * @param {Object} options.target - 动画对象,可以是数组,如果是数组的话会批量分发 onframe 等事件。
  55106. * @param {number} [options.life=1000] - 动画时长。
  55107. * @param {number} [options.delay=0] - 动画延迟时间。
  55108. * @param {boolean} [options.loop=true] - 是否循环。
  55109. * @param {number} [options.gap=0] - 循环的间隔时间。
  55110. * @param {Object} options.onframe - 帧。
  55111. * @param {boolean} options.easing - 是否消除。
  55112. * @param {boolean} options.ondestroy - 是否销毁。
  55113. * @param {boolean} options.onrestart - 是否重播。
  55114. */
  55115. constructor(options) {
  55116. this._targetPool = options.target || {};
  55117. if (!(this._targetPool instanceof Array)) {
  55118. this._targetPool = [this._targetPool];
  55119. }
  55120. // 生命周期
  55121. this._life = options.life || 1000;
  55122. // 延时
  55123. this._delay = options.delay || 0;
  55124. // 开始时间
  55125. this._startTime = new Date().getTime() + this._delay;// 单位毫秒
  55126. // 结束时间
  55127. this._endTime = this._startTime + this._life * 1000;
  55128. // 是否循环
  55129. this.loop = typeof options.loop == 'undefined'
  55130. ? false : options.loop;
  55131. this.gap = options.gap || 0;
  55132. this.easing = options.easing || 'Linear';
  55133. this.onframe = options.onframe;
  55134. this.ondestroy = options.ondestroy;
  55135. this.onrestart = options.onrestart;
  55136. this.CLASS_NAME = "SuperMap.LevelRenderer.Animation.Clip";
  55137. }
  55138. /**
  55139. * @function SuperMap.LevelRenderer.Animation.Clip.prototype.destroy
  55140. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  55141. */
  55142. destroy() {
  55143. }
  55144. step(time) {
  55145. var easing = new Easing();
  55146. var percent = (time - this._startTime) / this._life;
  55147. // 还没开始
  55148. if (percent < 0) {
  55149. return;
  55150. }
  55151. percent = Math.min(percent, 1);
  55152. var easingFunc = typeof this.easing == 'string'
  55153. ? easing[this.easing]
  55154. : this.easing;
  55155. var schedule = typeof easingFunc === 'function'
  55156. ? easingFunc(percent)
  55157. : percent;
  55158. this.fire('frame', schedule);
  55159. // 结束
  55160. if (percent == 1) {
  55161. if (this.loop) {
  55162. this.restart();
  55163. // 重新开始周期
  55164. // 抛出而不是直接调用事件直到 stage.update 后再统一调用这些事件
  55165. return 'restart';
  55166. }
  55167. // 动画完成将这个控制器标识为待删除
  55168. // 在Animation.update中进行批量删除
  55169. this._needsRemove = true;
  55170. return 'destroy';
  55171. }
  55172. return null;
  55173. }
  55174. restart() {
  55175. var time = new Date().getTime();
  55176. var remainder = (time - this._startTime) % this._life;
  55177. this._startTime = new Date().getTime() - remainder + this.gap;
  55178. }
  55179. fire(eventType, arg) {
  55180. for (var i = 0, len = this._targetPool.length; i < len; i++) {
  55181. if (this['on' + eventType]) {
  55182. this['on' + eventType](this._targetPool[i], arg);
  55183. }
  55184. }
  55185. }
  55186. }
  55187. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Animation.js
  55188. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  55189. * This program are made available under the terms of the Apache License, Version 2.0
  55190. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55191. /**
  55192. * @class SuperMap.LevelRenderer.Animation
  55193. * @classdesc 动画主类, 调度和管理所有动画控制器
  55194. * @category Visualization Theme
  55195. * @extends {SuperMap.LevelRenderer.Eventful}
  55196. * @private
  55197. */
  55198. class Animation extends Eventful {
  55199. /**
  55200. * @function SuperMap.LevelRenderer.Animation.prototype.constructor
  55201. * @description 构造函数。
  55202. * @param {Object} options - 动画参数。
  55203. * @param {Object} options.onframe - onframe。
  55204. * @param {Object} options.stage - stage。
  55205. * (start code)
  55206. * var animation = new SuperMap.LevelRenderer.Animation();
  55207. * var obj = {
  55208. * x: 100,
  55209. * y: 100
  55210. * };
  55211. * animation.animate(node.position)
  55212. * .when(1000, {
  55213. * x: 500,
  55214. * y: 500
  55215. * })
  55216. * .when(2000, {
  55217. * x: 100,
  55218. * y: 100
  55219. * })
  55220. * .start('spline');
  55221. * (end)
  55222. */
  55223. constructor(options) {
  55224. super(options);
  55225. options = options || {};
  55226. /**
  55227. * @member {Object} SuperMap.LevelRenderer.Animation.prototype.stage
  55228. * @description stage。
  55229. */
  55230. this.stage = {};
  55231. /**
  55232. * @member {Object} SuperMap.LevelRenderer.Animation.prototype.onframe
  55233. * @description onframe。
  55234. */
  55235. this.onframe = function () {
  55236. };
  55237. /**
  55238. * @member {Array} SuperMap.LevelRenderer.Animation.prototype._clips
  55239. * @description _clips。
  55240. */
  55241. this._clips = [];
  55242. /**
  55243. * @member {boolean} SuperMap.LevelRenderer.Animation.prototype._running
  55244. * @description _running。
  55245. */
  55246. this._running = false;
  55247. /**
  55248. * @member {number} SuperMap.LevelRenderer.Animation.prototype._time
  55249. * @description _time。
  55250. */
  55251. this._time = 0;
  55252. Util.extend(this, options);
  55253. this.CLASS_NAME = "SuperMap.LevelRenderer.Animation";
  55254. }
  55255. /**
  55256. * @function SuperMap.LevelRenderer.Animation.prototype.add
  55257. * @description 添加动画片段。
  55258. * @param {SuperMap.LevelRenderer.Animation.Clip} clip - 动画片段。
  55259. */
  55260. add(clip) {
  55261. this._clips.push(clip);
  55262. }
  55263. /**
  55264. * @function SuperMap.LevelRenderer.Animation.prototype.remove
  55265. * @description 删除动画片段。
  55266. * @param {SuperMap.LevelRenderer.Animation.Clip} clip - 动画片段。
  55267. */
  55268. remove(clip) {
  55269. var idx = new Util_Util().indexOf(this._clips, clip);
  55270. if (idx >= 0) {
  55271. this._clips.splice(idx, 1);
  55272. }
  55273. }
  55274. /**
  55275. * @function SuperMap.LevelRenderer.Animation.prototype.update
  55276. * @description 更新动画片段。
  55277. */
  55278. _update() {
  55279. var time = new Date().getTime();
  55280. var delta = time - this._time;
  55281. var clips = this._clips;
  55282. var len = clips.length;
  55283. var deferredEvents = [];
  55284. var deferredClips = [];
  55285. for (let i = 0; i < len; i++) {
  55286. var clip = clips[i];
  55287. var e = clip.step(time);
  55288. // Throw out the events need to be called after
  55289. // stage.update, like destroy
  55290. if (e) {
  55291. deferredEvents.push(e);
  55292. deferredClips.push(clip);
  55293. }
  55294. }
  55295. if (this.stage.update) {
  55296. this.stage.update();
  55297. }
  55298. // Remove the finished clip
  55299. for (let i = 0; i < len;) {
  55300. if (clips[i]._needsRemove) {
  55301. clips[i] = clips[len - 1];
  55302. clips.pop();
  55303. len--;
  55304. } else {
  55305. i++;
  55306. }
  55307. }
  55308. len = deferredEvents.length;
  55309. for (let i = 0; i < len; i++) {
  55310. deferredClips[i].fire(deferredEvents[i]);
  55311. }
  55312. this._time = time;
  55313. this.onframe(delta);
  55314. this.dispatch('frame', delta);
  55315. }
  55316. /**
  55317. * @function SuperMap.LevelRenderer.Animation.prototype.start
  55318. * @description 开始运行动画。
  55319. */
  55320. start() {
  55321. var requestAnimationFrame = window.requestAnimationFrame
  55322. || window.msRequestAnimationFrame
  55323. || window.mozRequestAnimationFrame
  55324. || window.webkitRequestAnimationFrame
  55325. || function (func) {
  55326. setTimeout(func, 16);
  55327. };
  55328. var self = this;
  55329. this._running = true;
  55330. function step() {
  55331. if (self._running) {
  55332. self._update();
  55333. requestAnimationFrame(step);
  55334. }
  55335. }
  55336. this._time = new Date().getTime();
  55337. requestAnimationFrame(step);
  55338. }
  55339. /**
  55340. * @function SuperMap.LevelRenderer.Animation.prototype.stop
  55341. * @description 停止运行动画。
  55342. */
  55343. stop() {
  55344. this._running = false;
  55345. }
  55346. /**
  55347. * @function SuperMap.LevelRenderer.Animation.prototype.clear
  55348. * @description 清除所有动画片段。
  55349. */
  55350. clear() {
  55351. this._clips = [];
  55352. }
  55353. /**
  55354. * @function SuperMap.LevelRenderer.Animation.prototype.animate
  55355. * @description 对一个目标创建一个animator对象,可以指定目标中的属性使用动画。
  55356. * @param {Object} target - 目标对象。
  55357. * @param {Object} options - 动画参数选项。
  55358. * @param {boolean} [options.loop=false] - 是否循环播放动画。
  55359. * @param {function} [options.getter] - 如果指定getter函数,会通过getter函数取属性值。
  55360. * @param {function} [options.setter] - 如果指定setter函数,会通过setter函数设置属性值。
  55361. * @returns {SuperMap.LevelRenderer.Animation.Animator} Animator。
  55362. */
  55363. animate(target, options) {
  55364. options = options || {};
  55365. var deferred = new Animator(
  55366. target,
  55367. options.loop,
  55368. options.getter,
  55369. options.setter
  55370. );
  55371. deferred.animation = this;
  55372. return deferred;
  55373. }
  55374. static _interpolateNumber(p0, p1, percent) {
  55375. return (p1 - p0) * percent + p0;
  55376. }
  55377. static _interpolateArray(p0, p1, percent, out, arrDim) {
  55378. var len = p0.length;
  55379. if (arrDim == 1) {
  55380. for (let i = 0; i < len; i++) {
  55381. out[i] = Animation._interpolateNumber(p0[i], p1[i], percent);
  55382. }
  55383. } else {
  55384. var len2 = p0[0].length;
  55385. for (let i = 0; i < len; i++) {
  55386. for (let j = 0; j < len2; j++) {
  55387. out[i][j] = Animation._interpolateNumber(
  55388. p0[i][j], p1[i][j], percent
  55389. );
  55390. }
  55391. }
  55392. }
  55393. }
  55394. static _isArrayLike(data) {
  55395. switch (typeof data) {
  55396. case 'undefined':
  55397. case 'string':
  55398. return false;
  55399. }
  55400. return typeof data.length !== 'undefined';
  55401. }
  55402. static _catmullRomInterpolateArray(p0, p1, p2, p3, t, t2, t3, out, arrDim) {
  55403. var len = p0.length;
  55404. if (arrDim == 1) {
  55405. for (let i = 0; i < len; i++) {
  55406. out[i] = Animation._catmullRomInterpolate(
  55407. p0[i], p1[i], p2[i], p3[i], t, t2, t3
  55408. );
  55409. }
  55410. } else {
  55411. var len2 = p0[0].length;
  55412. for (let i = 0; i < len; i++) {
  55413. for (var j = 0; j < len2; j++) {
  55414. out[i][j] = Animation._catmullRomInterpolate(
  55415. p0[i][j], p1[i][j], p2[i][j], p3[i][j],
  55416. t, t2, t3
  55417. );
  55418. }
  55419. }
  55420. }
  55421. }
  55422. static _catmullRomInterpolate(p0, p1, p2, p3, t, t2, t3) {
  55423. var v0 = (p2 - p0) * 0.5;
  55424. var v1 = (p3 - p1) * 0.5;
  55425. return (2 * (p1 - p2) + v0 + v1) * t3
  55426. + (-3 * (p1 - p2) - 2 * v0 - v1) * t2
  55427. + v0 * t + p1;
  55428. }
  55429. static _cloneValue(value) {
  55430. var arraySlice = Array.prototype.slice;
  55431. if (Animation._isArrayLike(value)) {
  55432. var len = value.length;
  55433. if (Animation._isArrayLike(value[0])) {
  55434. var ret = [];
  55435. for (var i = 0; i < len; i++) {
  55436. ret.push(arraySlice.call(value[i]));
  55437. }
  55438. return ret;
  55439. } else {
  55440. return arraySlice.call(value);
  55441. }
  55442. } else {
  55443. return value;
  55444. }
  55445. }
  55446. static rgba2String(rgba) {
  55447. rgba[0] = Math.floor(rgba[0]);
  55448. rgba[1] = Math.floor(rgba[1]);
  55449. rgba[2] = Math.floor(rgba[2]);
  55450. return 'rgba(' + rgba.join(',') + ')';
  55451. }
  55452. }
  55453. /**
  55454. * @class SuperMap.LevelRenderer.Animation.Animator
  55455. */
  55456. class Animator {
  55457. /**
  55458. * @function SuperMap.LevelRenderer.Animation.Animator.prototype.animate
  55459. * @description 构造函数
  55460. * @param {Object} target - 目标对象。
  55461. * @param {Object} options - 动画参数选项。
  55462. * @param {boolean} [loop=false] - 是否循环播放动画。
  55463. * @param {function} [getterl] - 如果指定getter函数,会通过getter函数取属性值。
  55464. * @param {function} [setter] - 如果指定setter函数,会通过setter函数设置属性值。
  55465. */
  55466. constructor(target, loop, getter, setter) {
  55467. /**
  55468. * @member {Object} SuperMap.LevelRenderer.Animation.Animator.prototype._tracks
  55469. * @description _tracks。
  55470. */
  55471. this._tracks = {};
  55472. /**
  55473. * @member {Object} SuperMap.LevelRenderer.Animation.Animator.prototype._target
  55474. * @description _target。
  55475. */
  55476. this._target = target;
  55477. /**
  55478. * @member {boolean} SuperMap.LevelRenderer.Animation.Animator.prototype._loop
  55479. * @description _loop。
  55480. */
  55481. this._loop = loop || false;
  55482. /**
  55483. * @member {function} SuperMap.LevelRenderer.Animation.Animator.prototype._getter
  55484. * @description _getter。
  55485. */
  55486. this._getter = getter || _defaultGetter;
  55487. /**
  55488. * @member {function} SuperMap.LevelRenderer.Animation.Animator.prototype._setter
  55489. * @description _setter。
  55490. */
  55491. this._setter = setter || _defaultSetter;
  55492. /**
  55493. * @member {number} SuperMap.LevelRenderer.Animation.Animator.prototype._clipCount
  55494. * @description _clipCount。
  55495. */
  55496. this._clipCount = 0;
  55497. /**
  55498. * @member {number} SuperMap.LevelRenderer.Animation.Animator.prototype._delay
  55499. * @description _delay。
  55500. */
  55501. this._delay = 0;
  55502. /**
  55503. * @member {Array} SuperMap.LevelRenderer.Animation.Animator.prototype._doneList
  55504. * @description _doneList。
  55505. */
  55506. this._doneList = [];
  55507. /**
  55508. * @member {Array} SuperMap.LevelRenderer.Animation.Animator.prototype._onframeList
  55509. * @description _onframeList。
  55510. */
  55511. this._onframeList = [];
  55512. /**
  55513. * @member {Array} SuperMap.LevelRenderer.Animation.Animator.prototype._clipList
  55514. * @description _clipList。
  55515. */
  55516. this._clipList = [];
  55517. this.CLASS_NAME = "SuperMap.LevelRenderer.Animation.Animator";
  55518. //Function
  55519. function _defaultGetter(target, key) {
  55520. return target[key];
  55521. }
  55522. function _defaultSetter(target, key, value) {
  55523. target[key] = value;
  55524. }
  55525. }
  55526. /**
  55527. * @function SuperMap.LevelRenderer.Animation.Animator.prototype.when
  55528. * @description 设置动画关键帧
  55529. * @param {number} time - 关键帧时间,单位是ms
  55530. * @param {Object} props - 关键帧的属性值,key-value表示
  55531. * @returns {SuperMap.LevelRenderer.Animation.Animator} Animator
  55532. */
  55533. when(time /* ms */, props) {
  55534. for (var propName in props) {
  55535. if (!this._tracks[propName]) {
  55536. this._tracks[propName] = [];
  55537. // If time is 0
  55538. // Then props is given initialize value
  55539. // Else
  55540. // Initialize value from current prop value
  55541. if (time !== 0) {
  55542. this._tracks[propName].push({
  55543. time: 0,
  55544. value: Animation._cloneValue(
  55545. this._getter(this._target, propName)
  55546. )
  55547. });
  55548. }
  55549. }
  55550. this._tracks[propName].push({
  55551. time: parseInt(time, 10),
  55552. value: props[propName]
  55553. });
  55554. }
  55555. return this;
  55556. }
  55557. /**
  55558. * @function SuperMap.LevelRenderer.Animation.Animator.prototype.during
  55559. * @description 添加动画每一帧的回调函数
  55560. * @param {RequestCallback} callback - 回调函数
  55561. * @returns {SuperMap.LevelRenderer.Animation.Animator} Animator
  55562. */
  55563. during(callback) {
  55564. this._onframeList.push(callback);
  55565. return this;
  55566. }
  55567. /**
  55568. * @function SuperMap.LevelRenderer.Animation.Animator.prototype.start
  55569. * @description 开始执行动画
  55570. * @param {(string|function)} easing - 动画缓动函数。详见:<{@link SuperMap.LevelRenderer.Animation.easing}>。
  55571. * @returns {SuperMap.LevelRenderer.Animation.Animator} Animator
  55572. */
  55573. start(easing) {
  55574. var self = this;
  55575. var setter = this._setter;
  55576. var getter = this._getter;
  55577. var onFrameListLen = self._onframeList.length;
  55578. var useSpline = easing === 'spline';
  55579. var ondestroy = function () {
  55580. self._clipCount--;
  55581. if (self._clipCount === 0) {
  55582. // Clear all tracks
  55583. self._tracks = {};
  55584. var len = self._doneList.length;
  55585. for (var i = 0; i < len; i++) {
  55586. self._doneList[i].call(self);
  55587. }
  55588. }
  55589. };
  55590. var createTrackClip = function (keyframes, propName) {
  55591. var trackLen = keyframes.length;
  55592. if (!trackLen) {
  55593. return;
  55594. }
  55595. // Guess data type
  55596. var firstVal = keyframes[0].value;
  55597. var isValueArray = Animation._isArrayLike(firstVal);
  55598. var isValueColor = false;
  55599. // For vertices morphing
  55600. var arrDim = (
  55601. isValueArray
  55602. && Animation._isArrayLike(firstVal[0])
  55603. )
  55604. ? 2 : 1;
  55605. // Sort keyframe as ascending
  55606. keyframes.sort(function (a, b) {
  55607. return a.time - b.time;
  55608. });
  55609. var trackMaxTime = keyframes[trackLen - 1].time;
  55610. // Percents of each keyframe
  55611. var kfPercents = [];
  55612. // Value of each keyframe
  55613. var kfValues = [];
  55614. for (let i = 0; i < trackLen; i++) {
  55615. kfPercents.push(keyframes[i].time / trackMaxTime);
  55616. // Assume value is a color when it is a string
  55617. var value = keyframes[i].value;
  55618. if (typeof(value) == 'string') {
  55619. value = SUtil_SUtil.Util_color.toArray(value);
  55620. if (value.length === 0) { // Invalid color
  55621. value[0] = value[1] = value[2] = 0;
  55622. value[3] = 1;
  55623. }
  55624. isValueColor = true;
  55625. }
  55626. kfValues.push(value);
  55627. }
  55628. // Cache the key of last frame to speed up when
  55629. // animation playback is sequency
  55630. var cacheKey = 0;
  55631. var cachePercent = 0;
  55632. var start;
  55633. var i;
  55634. var w;
  55635. var p0;
  55636. var p1;
  55637. var p2;
  55638. var p3;
  55639. if (isValueColor) {
  55640. var rgba = [0, 0, 0, 0];
  55641. }
  55642. var onframe = function (target, percent) {
  55643. // Find the range keyframes
  55644. // kf1-----kf2---------current--------kf3
  55645. // find kf2 and kf3 and do interpolation
  55646. if (percent < cachePercent) {
  55647. // Start from next key
  55648. start = Math.min(cacheKey + 1, trackLen - 1);
  55649. for (i = start; i >= 0; i--) {
  55650. if (kfPercents[i] <= percent) {
  55651. break;
  55652. }
  55653. }
  55654. i = Math.min(i, trackLen - 2);
  55655. } else {
  55656. for (i = cacheKey; i < trackLen; i++) {
  55657. if (kfPercents[i] > percent) {
  55658. break;
  55659. }
  55660. }
  55661. i = Math.min(i - 1, trackLen - 2);
  55662. }
  55663. cacheKey = i;
  55664. cachePercent = percent;
  55665. var range = (kfPercents[i + 1] - kfPercents[i]);
  55666. if (range === 0) {
  55667. return;
  55668. } else {
  55669. w = (percent - kfPercents[i]) / range;
  55670. }
  55671. if (useSpline) {
  55672. p1 = kfValues[i];
  55673. p0 = kfValues[i === 0 ? i : i - 1];
  55674. p2 = kfValues[i > trackLen - 2 ? trackLen - 1 : i + 1];
  55675. p3 = kfValues[i > trackLen - 3 ? trackLen - 1 : i + 2];
  55676. if (isValueArray) {
  55677. Animation._catmullRomInterpolateArray(
  55678. p0, p1, p2, p3, w, w * w, w * w * w,
  55679. getter(target, propName),
  55680. arrDim
  55681. );
  55682. } else {
  55683. let value;
  55684. if (isValueColor) {
  55685. // value = SuperMap.LevelRenderer.Animation._catmullRomInterpolateArray(
  55686. // p0, p1, p2, p3, w, w * w, w * w * w,
  55687. // rgba, 1
  55688. // );
  55689. value = Animation.rgba2String(rgba);
  55690. } else {
  55691. value = Animation._catmullRomInterpolate(
  55692. p0, p1, p2, p3, w, w * w, w * w * w
  55693. );
  55694. }
  55695. setter(
  55696. target,
  55697. propName,
  55698. value
  55699. );
  55700. }
  55701. } else {
  55702. if (isValueArray) {
  55703. Animation._interpolateArray(
  55704. kfValues[i], kfValues[i + 1], w,
  55705. getter(target, propName),
  55706. arrDim
  55707. );
  55708. } else {
  55709. let value;
  55710. if (isValueColor) {
  55711. Animation._interpolateArray(
  55712. kfValues[i], kfValues[i + 1], w,
  55713. rgba, 1
  55714. );
  55715. value = Animation.rgba2String(rgba);
  55716. } else {
  55717. value = Animation._interpolateNumber(kfValues[i], kfValues[i + 1], w);
  55718. }
  55719. setter(
  55720. target,
  55721. propName,
  55722. value
  55723. );
  55724. }
  55725. }
  55726. for (i = 0; i < onFrameListLen; i++) {
  55727. self._onframeList[i](target, percent);
  55728. }
  55729. };
  55730. var clip = new Clip({
  55731. target: self._target,
  55732. life: trackMaxTime,
  55733. loop: self._loop,
  55734. delay: self._delay,
  55735. onframe: onframe,
  55736. ondestroy: ondestroy
  55737. });
  55738. if (easing && easing !== 'spline') {
  55739. clip.easing = easing;
  55740. }
  55741. self._clipList.push(clip);
  55742. self._clipCount++;
  55743. self.animation.add(clip);
  55744. };
  55745. for (var propName in this._tracks) {
  55746. createTrackClip(this._tracks[propName], propName);
  55747. }
  55748. return this;
  55749. }
  55750. /**
  55751. * @function SuperMap.LevelRenderer.Animation.Animator.prototype.stop
  55752. * @description 停止动画
  55753. */
  55754. stop() {
  55755. for (var i = 0; i < this._clipList.length; i++) {
  55756. var clip = this._clipList[i];
  55757. this.animation.remove(clip);
  55758. }
  55759. this._clipList = [];
  55760. }
  55761. /**
  55762. * @function SuperMap.LevelRenderer.Animation.Animator.prototype.delay
  55763. * @description 设置动画延迟开始的时间
  55764. * @param {number} time - 时间,单位ms
  55765. * @returns {SuperMap.LevelRenderer.Animation.Animator} Animator
  55766. */
  55767. delay(time) {
  55768. this._delay = time;
  55769. return this;
  55770. }
  55771. /**
  55772. * @function SuperMap.LevelRenderer.Animation.Animator.prototype.done
  55773. * @description 添加动画结束的回调
  55774. * @param {function} cb - Function
  55775. * @returns {SuperMap.LevelRenderer.Animation.Animator} Animator
  55776. */
  55777. done(cb) {
  55778. if (cb) {
  55779. this._doneList.push(cb);
  55780. }
  55781. return this;
  55782. }
  55783. }
  55784. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Render.js
  55785. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  55786. * This program are made available under the terms of the Apache License, Version 2.0
  55787. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55788. /**
  55789. * @private
  55790. * @class SuperMap.LevelRenderer.Render
  55791. * @category Visualization Theme
  55792. * @classdesc Render 接口类,对外可用的所有接口都在这里。内部使用非 get 接口统一返回 this 对象,支持链式调用。
  55793. */
  55794. class Render {
  55795. /**
  55796. * @function SuperMap.LevelRenderer.Render.constructor
  55797. * @description 构造函数。
  55798. *
  55799. * @param {string} id - 唯一标识。
  55800. * @param {HTMLElement} dom - Dom 对象。
  55801. */
  55802. constructor(id, dom) {
  55803. /**
  55804. * @member {string} SuperMap.LevelRenderer.Render.prototype.id
  55805. * @description 唯一标识。
  55806. */
  55807. this.id = id;
  55808. /**
  55809. * @member {SuperMap.LevelRenderer.Storage} SuperMap.LevelRenderer.Render.prototype.storage
  55810. * @description 图形仓库对象。
  55811. */
  55812. this.storage = new Storage();
  55813. /**
  55814. * @member {SuperMap.LevelRenderer.Painter} SuperMap.LevelRenderer.Render.prototype.painter
  55815. * @description 绘制器对象。
  55816. *
  55817. */
  55818. this.painter = new Painter(dom, this.storage);
  55819. /**
  55820. * @member {SuperMap.LevelRenderer.Handler} SuperMap.LevelRenderer.Render.prototype.handler
  55821. * @description 事件处理对象。
  55822. *
  55823. */
  55824. this.handler = new Handler(dom, this.storage, this.painter);
  55825. /**
  55826. * @member {Array} SuperMap.LevelRenderer.Render.prototype.animatingElements
  55827. * @description 动画控制数组。
  55828. *
  55829. */
  55830. this.animatingElements = [];
  55831. /**
  55832. * @member {SuperMap.LevelRenderer.animation.Animation} SuperMap.LevelRenderer.Render.prototype.animation
  55833. * @description 动画对象。
  55834. *
  55835. */
  55836. this.animation = new Animation({
  55837. stage: {
  55838. update: Render.getFrameCallback(this)
  55839. }
  55840. });
  55841. /**
  55842. * @member {boolean} SuperMap.LevelRenderer.Render.prototype._needsRefreshNextFrame
  55843. * @description 是否需要刷新下一帧。
  55844. *
  55845. */
  55846. this._needsRefreshNextFrame = false;
  55847. this.animation.start();
  55848. this.CLASS_NAME = "SuperMap.LevelRenderer.Render";
  55849. }
  55850. /**
  55851. * @function SuperMap.LevelRenderer.Render.prototype.destory
  55852. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  55853. */
  55854. destroy() {
  55855. this.id = null;
  55856. this.storage = null;
  55857. this.painter = null;
  55858. this.handler = null;
  55859. this.animatingElements = null;
  55860. this.animation = null;
  55861. this._needsRefreshNextFrame = null;
  55862. }
  55863. /**
  55864. * @function SuperMap.LevelRenderer.Render.prototype.getId
  55865. * @description 获取实例唯一标识。
  55866. * @return {string} 实例唯一标识。
  55867. */
  55868. getId() {
  55869. return this.id;
  55870. }
  55871. /**
  55872. * @function SuperMap.LevelRenderer.Render.prototype.addShape
  55873. * @description 添加图形形状到根节点。
  55874. *
  55875. * @param {SuperMap.LevelRenderer.Shape} shape - 图形对象,可用属性全集,详见各 shape。
  55876. * @return {SuperMap.LevelRenderer.Render} this。
  55877. */
  55878. addShape(shape) {
  55879. this.storage.addRoot(shape);
  55880. return this;
  55881. }
  55882. /**
  55883. * @function SuperMap.LevelRenderer.Render.prototype.addGroup
  55884. * @description 添加组到根节点。
  55885. *
  55886. * (code)
  55887. * //添加组到根节点例子
  55888. * var render = new SuperMap.LevelRenderer.Render("Render",document.getElementById('lRendertest'));
  55889. * render.clear();
  55890. * var g = new SuperMap.LevelRenderer.Group();
  55891. * g.addChild(new SuperMap.LevelRenderer.Shape.Circle({
  55892. * style: {
  55893. * x: 100,
  55894. * y: 100,
  55895. * r: 20,
  55896. * brushType: 'fill'
  55897. * }
  55898. * }));
  55899. * render.addGroup(g);
  55900. * render.render();
  55901. * (end)
  55902. *
  55903. * @param {SuperMap.LevelRenderer.Group} group - 组对象。
  55904. * @return {SuperMap.LevelRenderer.Render} this。
  55905. */
  55906. addGroup(group) {
  55907. this.storage.addRoot(group);
  55908. return this;
  55909. }
  55910. /**
  55911. * @function SuperMap.LevelRenderer.Render.prototype.delShape
  55912. * @description 从根节点删除图形形状。
  55913. *
  55914. * @param {string} shapeId - 图形对象唯一标识。
  55915. * @return {SuperMap.LevelRenderer.Render} this。
  55916. */
  55917. delShape(shapeId) {
  55918. this.storage.delRoot(shapeId);
  55919. return this;
  55920. }
  55921. /**
  55922. * @function SuperMap.LevelRenderer.Render.prototype.delGroup
  55923. * @description 从根节点删除组。
  55924. *
  55925. * @param {string} groupId - 组对象唯一标识。
  55926. * @return {SuperMap.LevelRenderer.Render} this。
  55927. */
  55928. delGroup(groupId) {
  55929. this.storage.delRoot(groupId);
  55930. return this;
  55931. }
  55932. /**
  55933. * @function SuperMap.LevelRenderer.Render.prototype.modShape
  55934. * @description 修改图形形状。
  55935. *
  55936. * @param {string} shapeId - 图形对象唯一标识。
  55937. * @param {SuperMap.LevelRenderer.Shape} shape - 图形对象。
  55938. * @return {SuperMap.LevelRenderer.Render} this。
  55939. */
  55940. modShape(shapeId, shape) {
  55941. this.storage.mod(shapeId, shape);
  55942. return this;
  55943. }
  55944. /**
  55945. * @function SuperMap.LevelRenderer.Render.prototype.modGroup
  55946. * @description 修改组。
  55947. *
  55948. * @param {string} groupId - 组对象唯一标识。
  55949. * @param {SuperMap.LevelRenderer.Group} group - 组对象。
  55950. * @return {SuperMap.LevelRenderer.Render} this。
  55951. */
  55952. modGroup(groupId, group) {
  55953. this.storage.mod(groupId, group);
  55954. return this;
  55955. }
  55956. /**
  55957. * @function SuperMap.LevelRenderer.Render.prototype.modLayer
  55958. * @description 修改指定 zlevel 的绘制配置项。
  55959. *
  55960. * @param {string} zLevel - 组对象唯一标识。
  55961. * @param {Object} config - 配置对象。
  55962. * @param {string} clearColor - 每次清空画布的颜色。默认值:0。
  55963. * @param {noolean} motionBlur - 是否开启动态模糊。默认值:false。
  55964. * @param {number} lastFrameAlpha - 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显。默认值:0.7。
  55965. * @param {Array.<number>} position - 层的平移。
  55966. * @param {Array.<number>} rotation - 层的旋转。
  55967. * @param {Array.<number>} scale - 层的缩放。
  55968. * @param {boolean} zoomable - 层是否支持鼠标缩放操作。默认值:false。
  55969. * @param {boolean} panable - 层是否支持鼠标平移操作。默认值:false。
  55970. * @return {SuperMap.LevelRenderer.Render} this。
  55971. */
  55972. modLayer(zLevel, config) {
  55973. this.painter.modLayer(zLevel, config);
  55974. return this;
  55975. }
  55976. /**
  55977. * @function SuperMap.LevelRenderer.Render.prototype.addHoverShape
  55978. * @description 添加额外高亮层显示,仅提供添加方法,每次刷新后高亮层图形均被清空。
  55979. *
  55980. * @param {SuperMap.LevelRenderer.Shape} shape - 图形对象。
  55981. * @return {SuperMap.LevelRenderer.Render} this。
  55982. */
  55983. addHoverShape(shape) {
  55984. this.storage.addHover(shape);
  55985. return this;
  55986. }
  55987. /**
  55988. * @function SuperMap.LevelRenderer.Render.prototype.render
  55989. * @description 渲染。
  55990. *
  55991. * @callback {Function} callback - 渲染结束后回调函数。
  55992. * @return {SuperMap.LevelRenderer.Render} this。
  55993. */
  55994. render(callback) {
  55995. this.painter.render(callback);
  55996. this._needsRefreshNextFrame = false;
  55997. return this;
  55998. }
  55999. /**
  56000. * @function SuperMap.LevelRenderer.Render.prototype.refresh
  56001. * @description 视图更新。
  56002. *
  56003. * @callback {Function} callback - 视图更新后回调函数。
  56004. * @return {SuperMap.LevelRenderer.Render} this。
  56005. */
  56006. refresh(callback) {
  56007. this.painter.refresh(callback);
  56008. this._needsRefreshNextFrame = false;
  56009. return this;
  56010. }
  56011. /**
  56012. * @function SuperMap.LevelRenderer.Render.prototype.refreshNextFrame
  56013. * @description 标记视图在浏览器下一帧需要绘制。
  56014. * @return {SuperMap.LevelRenderer.Render} this。
  56015. */
  56016. refreshNextFrame() {
  56017. this._needsRefreshNextFrame = true;
  56018. return this;
  56019. }
  56020. /**
  56021. * @function SuperMap.LevelRenderer.Render.prototype.refreshHover
  56022. * @description 绘制(视图更新)高亮层。
  56023. * @callback {Function} callback - 视图更新后回调函数。
  56024. * @return {SuperMap.LevelRenderer.Render} this。
  56025. */
  56026. refreshHover(callback) {
  56027. this.painter.refreshHover(callback);
  56028. return this;
  56029. }
  56030. /**
  56031. * @function SuperMap.LevelRenderer.Render.prototype.refreshShapes
  56032. * @description 视图更新。
  56033. *
  56034. * @param {Array.<SuperMap.LevelRenderer.Shape>} shapeList - 需要更新的图形列表。
  56035. * @callback {Function} callback - 视图更新后回调函数。
  56036. * @return {SuperMap.LevelRenderer.Render} this。
  56037. */
  56038. refreshShapes(shapeList, callback) {
  56039. this.painter.refreshShapes(shapeList, callback);
  56040. return this;
  56041. }
  56042. /**
  56043. * @function SuperMap.LevelRenderer.Render.prototype.resize
  56044. * @description 调整视图大小。
  56045. * @return {SuperMap.LevelRenderer.Render} this。
  56046. */
  56047. resize() {
  56048. this.painter.resize();
  56049. return this;
  56050. }
  56051. /**
  56052. * @function SuperMap.LevelRenderer.Render.prototype.animate
  56053. * @description 动画。
  56054. *
  56055. * @example
  56056. * zr.animate(circle.id, 'style', false)
  56057. * .when(1000, {x: 10} )
  56058. * .done(function(){ // Animation done })
  56059. * .start()
  56060. *
  56061. *
  56062. * @param {Array.<(SuperMap.LevelRenderer.Shape/SuperMap.LevelRenderer.Group)>} el - 动画对象。
  56063. * @param {string} path - 需要添加动画的属性获取路径,可以通过 a.b.c 来获取深层的属性。若传入对象为<SuperMap.LevelRenderer.Group>,path需为空字符串。
  56064. * @param {Function} loop - 动画是否循环。
  56065. * @return {SuperMap.LevelRenderer.animation.Animator} Animator。
  56066. */
  56067. animate(el, path, loop) {
  56068. if (typeof(el) === 'string') {
  56069. el = this.storage.get(el);
  56070. }
  56071. if (el) {
  56072. var target;
  56073. if (path) {
  56074. var pathSplitted = path.split('.');
  56075. var prop = el;
  56076. for (var i = 0, l = pathSplitted.length; i < l; i++) {
  56077. if (!prop) {
  56078. continue;
  56079. }
  56080. prop = prop[pathSplitted[i]];
  56081. }
  56082. if (prop) {
  56083. target = prop;
  56084. }
  56085. } else {
  56086. target = el;
  56087. }
  56088. if (!target) {
  56089. SUtil_SUtil.Util_log(
  56090. 'Property "'
  56091. + path
  56092. + '" is not existed in element '
  56093. + el.id
  56094. );
  56095. return;
  56096. }
  56097. var animatingElements = this.animatingElements;
  56098. if (typeof el.__aniCount === 'undefined') {
  56099. // 正在进行的动画记数
  56100. el.__aniCount = 0;
  56101. }
  56102. if (el.__aniCount === 0) {
  56103. animatingElements.push(el);
  56104. }
  56105. el.__aniCount++;
  56106. return this.animation.animate(target, {loop: loop})
  56107. .done(function () {
  56108. el.__aniCount--;
  56109. if (el.__aniCount === 0) {
  56110. // 从animatingElements里移除
  56111. var idx = new Util_Util().indexOf(animatingElements, el);
  56112. animatingElements.splice(idx, 1);
  56113. }
  56114. });
  56115. } else {
  56116. SUtil_SUtil.Util_log('Element not existed');
  56117. }
  56118. }
  56119. /**
  56120. * @function SuperMap.LevelRenderer.Render.prototype.clearAnimation
  56121. * @description 停止所有动画。
  56122. *
  56123. */
  56124. clearAnimation() {
  56125. this.animation.clear();
  56126. }
  56127. /**
  56128. * @function SuperMap.LevelRenderer.Render.prototype.getWidth
  56129. * @description 获取视图宽度。
  56130. * @return {number} 视图宽度。
  56131. */
  56132. getWidth() {
  56133. return this.painter.getWidth();
  56134. }
  56135. /**
  56136. * @function SuperMap.LevelRenderer.Render.prototype.getHeight
  56137. * @description 获取视图高度。
  56138. * @return {number} 视图高度。
  56139. */
  56140. getHeight() {
  56141. return this.painter.getHeight();
  56142. }
  56143. /**
  56144. * @function SuperMap.LevelRenderer.Render.prototype.toDataURL
  56145. * @description 图像导出。
  56146. *
  56147. * @param {string} type - 类型。
  56148. * @param {string} backgroundColor - 背景色,默认值:"#FFFFFF"。
  56149. * @param {string} args - 参数。
  56150. * @return {string} 图片的 Base64 url。
  56151. */
  56152. toDataURL(type, backgroundColor, args) {
  56153. return this.painter.toDataURL(type, backgroundColor, args);
  56154. }
  56155. /**
  56156. * @function SuperMap.LevelRenderer.Render.prototype.shapeToImage
  56157. * @description 将常规 shape 转成 image shape。
  56158. *
  56159. * @param {SuperMap.LevelRenderer.Shape} e - 图形。
  56160. * @param {number} width - 宽度。
  56161. * @param {number} height - 高度。
  56162. * @return {Object} image shape。
  56163. */
  56164. shapeToImage(e, width, height) {
  56165. var id = Util.createUniqueID("SuperMap.LevelRenderer.ToImage_");
  56166. return this.painter.shapeToImage(id, e, width, height);
  56167. }
  56168. /**
  56169. * @function SuperMap.LevelRenderer.Render.prototype.on
  56170. * @description 事件绑定。
  56171. *
  56172. * @param {string} eventName - 事件名称。
  56173. * @param {Function} eventHandler - 响应函数。
  56174. * @return {SuperMap.LevelRenderer.Render} this。
  56175. */
  56176. on(eventName, eventHandler) {
  56177. this.handler.on(eventName, eventHandler);
  56178. return this;
  56179. }
  56180. /**
  56181. * @function SuperMap.LevelRenderer.Render.prototype.un
  56182. * @description 事件解绑定,参数为空则解绑所有自定义事件。
  56183. *
  56184. * @param {string} eventName - 事件名称。
  56185. * @param {Function} eventHandler - 响应函数。
  56186. * @return {SuperMap.LevelRenderer.Render} this。
  56187. */
  56188. un(eventName, eventHandler) {
  56189. this.handler.un(eventName, eventHandler);
  56190. return this;
  56191. }
  56192. /**
  56193. * @function SuperMap.LevelRenderer.Render.prototype.trigger
  56194. * @description 事件触发。
  56195. *
  56196. * @param {string} eventName - 事件名称,resize,hover,drag,etc。
  56197. * @param {event} event - event dom事件对象。
  56198. * @return {SuperMap.LevelRenderer.Render} this。
  56199. */
  56200. trigger(eventName, event) {
  56201. this.handler.trigger(eventName, event);
  56202. this.handler.dispatch(eventName, event);
  56203. return this;
  56204. }
  56205. /**
  56206. * @function SuperMap.LevelRenderer.Render.prototype.clear
  56207. * @description 清除当前 Render 下所有类图的数据和显示,clear 后 MVC 和已绑定事件均还存在在,Render 可用。
  56208. * @return {SuperMap.LevelRenderer.Render} this。
  56209. */
  56210. clear() {
  56211. this.storage.delRoot();
  56212. this.painter.clear();
  56213. return this;
  56214. }
  56215. /**
  56216. * @function SuperMap.LevelRenderer.Render.prototype.dispose
  56217. * @description 释放当前 Render 实例(删除包括 dom,数据、显示和事件绑定),dispose后 Render 不可用。
  56218. */
  56219. dispose() {
  56220. this.animation.stop();
  56221. this.clear();
  56222. this.storage.dispose();
  56223. this.painter.dispose();
  56224. this.handler.dispose();
  56225. this.animation = null;
  56226. this.animatingElements = null;
  56227. this.storage = null;
  56228. this.painter = null;
  56229. this.handler = null;
  56230. // 释放后告诉全局删除对自己的索引,没想到啥好方法
  56231. // zrender.delInstance(this.id);
  56232. }
  56233. // SMIC-方法扩展 - start
  56234. /**
  56235. * @function SuperMap.LevelRenderer.Render.prototype.updateHoverShapes
  56236. * @description 更新设置显示高亮图层。
  56237. *
  56238. * @param {Array.<SuperMap.LevelRenderer.Shape>} shapes - 图形数组。
  56239. * @return {SuperMap.LevelRenderer.Render} this。
  56240. */
  56241. updateHoverShapes(shapes) {
  56242. this.painter.updateHoverLayer(shapes);
  56243. return this;
  56244. }
  56245. /**
  56246. * @function SuperMap.LevelRenderer.Render.prototype.getAllShapes
  56247. * @description 获取所有图形。
  56248. * @return {Array.<SuperMap.LevelRenderer.Shape>} 图形数组。
  56249. */
  56250. getAllShapes() {
  56251. return this.storage._shapeList;
  56252. }
  56253. /**
  56254. * @function SuperMap.LevelRenderer.Render.prototype.clearAll
  56255. * @description 清除高亮和图形图层。
  56256. * @return {SuperMap.LevelRenderer.Render} this。
  56257. */
  56258. clearAll() {
  56259. this.clear();
  56260. this.painter.clearHover();
  56261. return this;
  56262. }
  56263. /**
  56264. * @function SuperMap.LevelRenderer.Render.prototype.getHoverOne
  56265. * @description 获取单个高亮图形,当前鼠标对应。
  56266. * @return {SuperMap.LevelRenderer.Shape} 高亮图形。
  56267. */
  56268. getHoverOne() {
  56269. return this.handler.getLastHoverOne();
  56270. }
  56271. static getFrameCallback(renderInstance) {
  56272. return function () {
  56273. var animatingElements = renderInstance.animatingElements;
  56274. //animatingElements instanceof Array 临时解决 destory 报错
  56275. if (animatingElements instanceof Array) {
  56276. for (var i = 0, l = animatingElements.length; i < l; i++) {
  56277. renderInstance.storage.mod(animatingElements[i].id);
  56278. }
  56279. if (animatingElements.length || renderInstance._needsRefreshNextFrame) {
  56280. renderInstance.refresh();
  56281. }
  56282. }
  56283. };
  56284. }
  56285. // SMIC-方法扩展 - end
  56286. }
  56287. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/LevelRenderer.js
  56288. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  56289. * This program are made available under the terms of the Apache License, Version 2.0
  56290. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56291. /**
  56292. * @class SuperMap.LevelRenderer
  56293. * @category Visualization Theme
  56294. * @classdesc LevelRenderer 渲染器
  56295. * @private
  56296. */
  56297. class LevelRenderer {
  56298. /**
  56299. * @function SuperMap.LevelRenderer.constructor
  56300. * @description 构造函数。
  56301. * @example
  56302. * //在渲染器上加上图形
  56303. * var levelRenderer = new SuperMap.LevelRenderer();
  56304. * var zr = levelRenderer.init(document.getElementById('lRendertest'));
  56305. * zr.clear();
  56306. * zr.addShape(new SuperMap.LevelRenderer.Shape.Circle({
  56307. * style:{
  56308. * x : 100,
  56309. * y : 100,
  56310. * r : 50,
  56311. * brushType: 'fill'
  56312. * }
  56313. * }));
  56314. * zr.render();
  56315. */
  56316. constructor() {
  56317. /**
  56318. * @member {Object} SuperMap.LevelRenderer.prototype._instances
  56319. * @description LevelRenderer 实例 map 索引
  56320. */
  56321. LevelRenderer._instances = {};
  56322. // 工具
  56323. LevelRenderer.Tool = {};
  56324. /**
  56325. * @member {string} SuperMap.LevelRenderer.prototype.version
  56326. * @description 版本。zRender(Baidu)的版本号
  56327. * 记录当前 LevelRenderer 是在 zRender 的那个版本上构建而来。
  56328. * 在每次完整评判和实施由 zRender(Baidu)升级带来的 LevelRenderer 升级后修改。
  56329. */
  56330. this.version = '2.0.4';
  56331. this.CLASS_NAME = "SuperMap.LevelRenderer";
  56332. }
  56333. /**
  56334. * @function SuperMap.LevelRenderer.prototype.destroy
  56335. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为null。
  56336. */
  56337. destroy() {
  56338. this.dispose();
  56339. this.version = null;
  56340. }
  56341. /**
  56342. * @function SuperMap.LevelRenderer.prototype.init
  56343. * @description 创建 LevelRenderer 实例。
  56344. * @param {HTMLElement} dom - 绘图容器。
  56345. * @returns {SuperMap.LevelRenderer} LevelRenderer 实例。
  56346. */
  56347. init(dom) {
  56348. var zr = new Render(Util.createUniqueID("LRenderer_"), dom);
  56349. LevelRenderer._instances[zr.id] = zr;
  56350. return zr;
  56351. }
  56352. /**
  56353. * @function SuperMap.LevelRenderer.prototype.dispose
  56354. * @description LevelRenderer 实例销毁。
  56355. * 可以通过 zrender.dispose(zr) 销毁指定 SuperMap.LevelRenderer.Render 实例。
  56356. * 也可以通过 zr.dispose() 直接销毁
  56357. * @param {SuperMap.LevelRenderer.Render} zr - ZRender对象,不传此参数则销毁全部。
  56358. * @returns {SuperMap.LevelRenderer} this。
  56359. */
  56360. dispose(zr) {
  56361. if (zr) {
  56362. zr.dispose();
  56363. this.delInstance(zr.id);
  56364. } else {
  56365. for (var key in LevelRenderer._instances) {
  56366. LevelRenderer._instances[key].dispose();
  56367. }
  56368. LevelRenderer._instances = {};
  56369. }
  56370. return this;
  56371. }
  56372. /**
  56373. * @function SuperMap.LevelRenderer.prototype.getInstance
  56374. * @description 获取 SuperMap.LevelRenderer.Render 实例。
  56375. * @param {string} id - ZRender对象索引。
  56376. * @returns {SuperMap.LevelRenderer.Render} SuperMap.LevelRenderer.Render 实例。
  56377. */
  56378. getInstance(id) {
  56379. return LevelRenderer._instances[id];
  56380. }
  56381. /**
  56382. * @function SuperMap.LevelRenderer.prototype.delInstance
  56383. * @description 删除 zrender 实例,SuperMap.LevelRenderer.Render 实例 dispose 时会调用,删除后 getInstance 则返回 undefined
  56384. * @param {string} id - ZRender对象索引。
  56385. * @param {string} id - SuperMap.LevelRenderer.Render 对象索引。
  56386. * @returns {SuperMap.LevelRenderer} this。
  56387. */
  56388. delInstance(id) {
  56389. delete LevelRenderer._instances[id];
  56390. return this;
  56391. }
  56392. }
  56393. SuperMap.LevelRenderer = LevelRenderer;
  56394. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicEllipse.js
  56395. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  56396. * This program are made available under the terms of the Apache License, Version 2.0
  56397. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56398. /**
  56399. * @private
  56400. * @class SuperMap.LevelRenderer.Shape.SmicEllipse
  56401. * @category Visualization Theme
  56402. * @classdesc 椭圆。
  56403. * @extends SuperMap.LevelRenderer.Shape
  56404. * @example
  56405. * var shape = new SuperMap.LevelRenderer.Shape.SmicEllipse({
  56406. * style: {
  56407. * x: 100,
  56408. * y: 100,
  56409. * a: 40,
  56410. * b: 20,
  56411. * brushType: 'both',
  56412. * color: 'blue',
  56413. * strokeColor: 'red',
  56414. * lineWidth: 3,
  56415. * text: 'SmicEllipse'
  56416. * }
  56417. * });
  56418. * levelRenderer.addShape(shape);
  56419. *
  56420. *
  56421. */
  56422. class SmicEllipse extends (/* unused pure expression or super */ null && (Shape)) {
  56423. /**
  56424. * @member {Object} SuperMap.LevelRenderer.Shape.SmicEllipse.style
  56425. * @description 绘制样式。
  56426. *
  56427. * @param {number} style.x - 圆心 x 坐标,必设参数。
  56428. * @param {number} style.y - 圆心 y 坐标,必设参数。
  56429. * @param {number} style.a - 横轴半径,必设参数。
  56430. * @param {number} style.b - 纵轴半径,必设参数。
  56431. * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  56432. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  56433. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  56434. * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  56435. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  56436. * @param {number} style.opacity - 绘制透明度。默认值:1。
  56437. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  56438. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  56439. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  56440. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  56441. * @param {string} style.text - 图形中的附加文本。默认值:""。
  56442. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  56443. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  56444. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  56445. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  56446. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  56447. */
  56448. //打开接口 style
  56449. /**
  56450. * @function SuperMap.LevelRenderer.Shape.SmicEllipse.constructor
  56451. * @description 构造函数。
  56452. *
  56453. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  56454. *
  56455. */
  56456. constructor(options) {
  56457. super(options);
  56458. /**
  56459. * @member {string} SuperMap.LevelRenderer.Shape.SmicEllipse.prototype.type
  56460. * @description 图形类型。
  56461. */
  56462. this.type = 'smicellipse';
  56463. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  56464. this.refOriginalPosition = [0, 0];
  56465. }
  56466. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicEllipse";
  56467. }
  56468. /**
  56469. * @function SuperMap.LevelRenderer.Shape.SmicEllipse.prototype.destroy
  56470. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  56471. */
  56472. destroy() {
  56473. this.type = null;
  56474. super.destroy();
  56475. }
  56476. /**
  56477. * @function SuperMap.LevelRenderer.Shape.SmicEllipse.prototype.buildPath
  56478. * @description 构建椭圆的 Path。
  56479. *
  56480. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  56481. * @param {Object} style - style。
  56482. *
  56483. */
  56484. buildPath(ctx, style) {
  56485. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  56486. this.refOriginalPosition = [0, 0];
  56487. }
  56488. var __OP = this.refOriginalPosition;
  56489. var k = 0.5522848;
  56490. var x = style.x + __OP[0];
  56491. var y = style.y + __OP[1];
  56492. var a = style.a;
  56493. var b = style.b;
  56494. var ox = a * k; // 水平控制点偏移量
  56495. var oy = b * k; // 垂直控制点偏移量
  56496. // 从椭圆的左端点开始顺时针绘制四条三次贝塞尔曲线
  56497. ctx.moveTo(x - a, y);
  56498. ctx.bezierCurveTo(x - a, y - oy, x - ox, y - b, x, y - b);
  56499. ctx.bezierCurveTo(x + ox, y - b, x + a, y - oy, x + a, y);
  56500. ctx.bezierCurveTo(x + a, y + oy, x + ox, y + b, x, y + b);
  56501. ctx.bezierCurveTo(x - ox, y + b, x - a, y + oy, x - a, y);
  56502. ctx.closePath();
  56503. }
  56504. /**
  56505. * @function SuperMap.LevelRenderer.Shape.SmicEllipse.prototype.getRect
  56506. * @description 计算返回椭圆包围盒矩形
  56507. *
  56508. * @param {Object} style - style
  56509. * @return {Object} 边框对象。包含属性:x,y,width,height。
  56510. *
  56511. */
  56512. getRect(style) {
  56513. if (style.__rect) {
  56514. return style.__rect;
  56515. }
  56516. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  56517. this.refOriginalPosition = [0, 0];
  56518. }
  56519. var __OP = this.refOriginalPosition;
  56520. var lineWidth;
  56521. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  56522. lineWidth = style.lineWidth || 1;
  56523. } else {
  56524. lineWidth = 0;
  56525. }
  56526. style.__rect = {
  56527. x: Math.round((style.x + __OP[0]) - style.a - lineWidth / 2),
  56528. y: Math.round((style.x + __OP[1]) - style.b - lineWidth / 2),
  56529. width: style.a * 2 + lineWidth,
  56530. height: style.b * 2 + lineWidth
  56531. };
  56532. return style.__rect;
  56533. }
  56534. }
  56535. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicIsogon.js
  56536. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  56537. * This program are made available under the terms of the Apache License, Version 2.0
  56538. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56539. /**
  56540. * @private
  56541. * @class SuperMap.LevelRenderer.Shape.SmicIsogon
  56542. * @category Visualization Theme
  56543. * @classdesc 正多边形。
  56544. * @extends SuperMap.LevelRenderer.Shape
  56545. */
  56546. class SmicIsogon extends (/* unused pure expression or super */ null && (Shape)) {
  56547. /**
  56548. * @member {Object} SuperMap.LevelRenderer.Shape.SmicIsogon.prototype.style
  56549. * @description 绘制样式。
  56550. *
  56551. * @param {number} x - 正 n 边形外接圆心 x 坐标,必设参数。
  56552. * @param {number} y - 正 n 边形外接圆心 y 坐标,必设参数。
  56553. * @param {number} r - 正n边形外接圆半径,必设参数。
  56554. * @param {number} n - 指明正几边形,必设参数(n>=3)。
  56555. * @param {string} brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  56556. * @param {string} color - 填充颜色。默认值:"#000000'"。
  56557. * @param {string} strokeColor - 描边颜色。默认值:"#000000'"。
  56558. * @param {string} lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  56559. * @param {number} lineWidth - 描边宽度。默认值:1。
  56560. * @param {number} opacity - 绘制透明度。默认值:1。
  56561. * @param {number} shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  56562. * @param {number} shadowColor - 阴影颜色。默认值:"#000000'"。
  56563. * @param {number} shadowOffsetX - 阴影横向偏移。默认值:0。
  56564. * @param {number} shadowOffsetY - 阴影纵向偏移。默认值:0。
  56565. * @param {string} text - 图形中的附加文本。默认值:""。
  56566. * @param {string} textColor -文本颜色。默认值:"#000000'"。
  56567. * @param {string} textFont - 附加文本样式。示例:'bold 18px verdana'。
  56568. * @param {string} textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  56569. * @param {string} textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  56570. * @param {string} textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  56571. */
  56572. //打开接口 style
  56573. /**
  56574. * @function SuperMap.LevelRenderer.Shape.SmicIsogon.constructor
  56575. * @description 构造函数。
  56576. *
  56577. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  56578. *
  56579. */
  56580. constructor(options) {
  56581. super(options);
  56582. /**
  56583. * @member {string} SuperMap.LevelRenderer.Shape.SmicIsogon.prototype.type
  56584. * @description 图形类型。
  56585. */
  56586. this.type = 'smicisogon';
  56587. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  56588. this.refOriginalPosition = [0, 0];
  56589. }
  56590. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicIsogon";
  56591. }
  56592. /**
  56593. * @function SuperMap.LevelRenderer.Shape.SmicIsogon.prototype.destroy
  56594. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  56595. */
  56596. destroy() {
  56597. this.type = null;
  56598. super.destroy();
  56599. }
  56600. /**
  56601. * @function SuperMap.LevelRenderer.Shape.SmicIsogon.prototype.buildPath
  56602. * @description 创建n角星(n>=3)路径。
  56603. *
  56604. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  56605. * @param {Object} style - style。
  56606. *
  56607. */
  56608. buildPath(ctx, style) {
  56609. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  56610. this.refOriginalPosition = [0, 0];
  56611. }
  56612. var __OP = this.refOriginalPosition;
  56613. var sin = SUtil.Util_math.sin;
  56614. var cos = SUtil.Util_math.cos;
  56615. var PI = Math.PI;
  56616. var n = style.n;
  56617. if (!n || n < 2) {
  56618. return;
  56619. }
  56620. var x = style.x + __OP[0];
  56621. var y = style.y + __OP[1];
  56622. var r = style.r;
  56623. var dStep = 2 * PI / n;
  56624. var deg = -PI / 2;
  56625. var xStart = x + r * cos(deg);
  56626. var yStart = y + r * sin(deg);
  56627. deg += dStep;
  56628. // 记录边界点,用于判断insight
  56629. var pointList = style.pointList = [];
  56630. pointList.push([xStart, yStart]);
  56631. for (let i = 0, end = n - 1; i < end; i++) {
  56632. pointList.push([x + r * cos(deg), y + r * sin(deg)]);
  56633. deg += dStep;
  56634. }
  56635. pointList.push([xStart, yStart]);
  56636. // 绘制
  56637. ctx.moveTo(pointList[0][0], pointList[0][1]);
  56638. for (let i = 0; i < pointList.length; i++) {
  56639. ctx.lineTo(pointList[i][0], pointList[i][1]);
  56640. }
  56641. ctx.closePath();
  56642. return;
  56643. }
  56644. /**
  56645. * @function SuperMap.LevelRenderer.Shape.SmicIsogon.prototype.getRect
  56646. * @description 计算返回正多边形的包围盒矩形。
  56647. *
  56648. * @param {Object} style - style
  56649. * @return {Object} 边框对象。包含属性:x,y,width,height。
  56650. */
  56651. getRect(style) {
  56652. if (style.__rect) {
  56653. return style.__rect;
  56654. }
  56655. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  56656. this.refOriginalPosition = [0, 0];
  56657. }
  56658. var __OP = this.refOriginalPosition;
  56659. var lineWidth;
  56660. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  56661. lineWidth = style.lineWidth || 1;
  56662. } else {
  56663. lineWidth = 0;
  56664. }
  56665. style.__rect = {
  56666. x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
  56667. y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
  56668. width: style.r * 2 + lineWidth,
  56669. height: style.r * 2 + lineWidth
  56670. };
  56671. return style.__rect;
  56672. }
  56673. }
  56674. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicRing.js
  56675. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  56676. * This program are made available under the terms of the Apache License, Version 2.0
  56677. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56678. /**
  56679. * @private
  56680. * @class SuperMap.LevelRenderer.Shape.SmicRing
  56681. * @category Visualization Theme
  56682. * @classdesc 圆环。
  56683. * @extends SuperMap.LevelRenderer.Shape
  56684. * @example
  56685. * var shape = new SuperMap.LevelRenderer.Shape.SmicRing({
  56686. * style: {
  56687. * x: 100,
  56688. * y: 100,
  56689. * r0: 30,
  56690. * r: 50
  56691. * }
  56692. * });
  56693. * levelRenderer.addShape(shape);
  56694. *
  56695. */
  56696. class SmicRing extends (/* unused pure expression or super */ null && (Shape)) {
  56697. /**
  56698. * @member {Object} SuperMap.LevelRenderer.Shape.SmicRing.prototype.style
  56699. * @description 绘制样式。
  56700. *
  56701. * @param {number} x - 圆心 x 坐标,必设参数。
  56702. * @param {number} y - 圆心 y 坐标,必设参数。
  56703. * @param {number} r - 外圆半径,必设参数。
  56704. * @param {number} r0 - 内圆半径,必设参数。
  56705. * @param {string} brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  56706. * @param {string} color - 填充颜色。默认值:"#000000'"。
  56707. * @param {string} strokeColor - 描边颜色。默认值:"#000000'"。
  56708. * @param {string} lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  56709. * @param {number} lineWidth -描边宽度。默认值:1。
  56710. * @param {number} opacity - 绘制透明度。默认值:1。
  56711. * @param {number} shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  56712. * @param {number} shadowColor - 阴影颜色。默认值:"#000000'"。
  56713. * @param {number} shadowOffsetX - 阴影横向偏移。默认值:0。
  56714. * @param {number} shadowOffsetY - 阴影纵向偏移。默认值:0。
  56715. * @param {string} text -图形中的附加文本。默认值:""。
  56716. * @param {string} textColor - 文本颜色。默认值:"#000000'"。
  56717. * @param {string} textFont - 附加文本样式。示例:'bold 18px verdana'。
  56718. * @param {string} textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  56719. * @param {string} textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  56720. * @param {string} textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  56721. */
  56722. //打开接口 style
  56723. /**
  56724. * @function SuperMap.LevelRenderer.Shape.SmicRing.constructor
  56725. * @description 构造函数。
  56726. *
  56727. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  56728. */
  56729. constructor(options) {
  56730. super(options);
  56731. /**
  56732. * @member {string} SuperMap.LevelRenderer.Shape.SmicRing.prototype.type
  56733. * @description 图形类型。
  56734. */
  56735. this.type = 'smicring';
  56736. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  56737. this.refOriginalPosition = [0, 0];
  56738. }
  56739. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicRing";
  56740. }
  56741. /**
  56742. * @function SuperMap.LevelRenderer.Shape.SmicRing.prototype.destroy
  56743. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  56744. */
  56745. destroy() {
  56746. this.type = null;
  56747. super.destroy();
  56748. }
  56749. /**
  56750. * @function SuperMap.LevelRenderer.Shape.SmicRing.prototype.buildPath
  56751. * @description 创建圆环路径。
  56752. *
  56753. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  56754. * @param {Object} style - style。
  56755. *
  56756. */
  56757. buildPath(ctx, style) {
  56758. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  56759. this.refOriginalPosition = [0, 0];
  56760. }
  56761. var __OP = this.refOriginalPosition;
  56762. // 非零环绕填充优化
  56763. ctx.arc(style.x + __OP[0], style.y + __OP[1], style.r, 0, Math.PI * 2, false);
  56764. ctx.moveTo((style.x + __OP[0]) + style.r0, style.y + __OP[1]);
  56765. ctx.arc(style.x + __OP[0], style.y + __OP[1], style.r0, 0, Math.PI * 2, true);
  56766. return;
  56767. }
  56768. /**
  56769. * @function SuperMap.LevelRenderer.Shape.SmicRing.prototype.getRect
  56770. * @description 计算返回圆环包围盒矩阵
  56771. *
  56772. * @param {Object} style - style
  56773. * @return {Object} 边框对象。包含属性:x,y,width,height。
  56774. */
  56775. getRect(style) {
  56776. if (style.__rect) {
  56777. return style.__rect;
  56778. }
  56779. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  56780. this.refOriginalPosition = [0, 0];
  56781. }
  56782. var __OP = this.refOriginalPosition;
  56783. var lineWidth;
  56784. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  56785. lineWidth = style.lineWidth || 1;
  56786. } else {
  56787. lineWidth = 0;
  56788. }
  56789. style.__rect = {
  56790. x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
  56791. y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
  56792. width: style.r * 2 + lineWidth,
  56793. height: style.r * 2 + lineWidth
  56794. };
  56795. return style.__rect;
  56796. }
  56797. }
  56798. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicStar.js
  56799. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  56800. * This program are made available under the terms of the Apache License, Version 2.0
  56801. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56802. /**
  56803. * @private
  56804. * @class SuperMap.LevelRenderer.Shape.SmicStar
  56805. * @category Visualization Theme
  56806. * @classdesc n 角星(n>3)。
  56807. * @extends SuperMap.LevelRenderer.Shape
  56808. * @example
  56809. * var shape = new SuperMap.LevelRenderer.Shape.SmicStar({
  56810. * style: {
  56811. * x: 200,
  56812. * y: 100,
  56813. * r: 150,
  56814. * n: 5,
  56815. * text: '五角星'
  56816. * }
  56817. * });
  56818. * levelRenderer.addShape(shape);
  56819. *
  56820. *
  56821. */
  56822. class SmicStar extends (/* unused pure expression or super */ null && (Shape)) {
  56823. /**
  56824. * @member {Object} SuperMap.LevelRenderer.Shape.SmicStar.prototype.style
  56825. * @description 绘制样式。
  56826. *
  56827. * @param {number} style.x - n 角星外接圆心 x 坐标,必设参数。
  56828. * @param {number} style.y - n 角星外接圆心 y 坐标,必设参数。
  56829. * @param {number} style.r - n 角星外接圆半径,必设参数。
  56830. * @param {number} style.r0 - n 角星内部顶点(凹点)的外接圆半径。如果不指定此参数,则自动计算:取相隔外部顶点连线的交点作内部顶点。
  56831. * @param {number} style.n -指明几角星,必设参数。
  56832. * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  56833. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  56834. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  56835. * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  56836. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  56837. * @param {number} style.opacity - 绘制透明度。默认值:1。
  56838. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  56839. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  56840. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  56841. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  56842. * @param {string} style.text - 图形中的附加文本。默认值:""。
  56843. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  56844. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  56845. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  56846. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  56847. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  56848. */
  56849. //打开接口 style
  56850. /**
  56851. * @function SuperMap.LevelRenderer.Shape.SmicStar.constructor
  56852. * @description 构造函数。
  56853. *
  56854. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  56855. *
  56856. */
  56857. constructor(options) {
  56858. super(options);
  56859. /**
  56860. * @member {string} SuperMap.LevelRenderer.Shape.SmicStar.prototype.type
  56861. * @description 图形类型。
  56862. */
  56863. this.type = 'smicstar';
  56864. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  56865. this.refOriginalPosition = [0, 0];
  56866. }
  56867. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicStar";
  56868. }
  56869. /**
  56870. * @function SuperMap.LevelRenderer.Shape.SmicStar.prototype.destroy
  56871. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  56872. */
  56873. destroy() {
  56874. this.type = null;
  56875. super.destroy();
  56876. }
  56877. /**
  56878. * @function SuperMap.LevelRenderer.Shape.SmicStar.prototype.buildPath
  56879. * @description 创建n 角星(n>3)路径。
  56880. *
  56881. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  56882. * @param {Object} style - style。
  56883. *
  56884. */
  56885. buildPath(ctx, style) {
  56886. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  56887. this.refOriginalPosition = [0, 0];
  56888. }
  56889. var __OP = this.refOriginalPosition;
  56890. var n = style.n;
  56891. if (!n || n < 2) {
  56892. return;
  56893. }
  56894. var sin = SUtil.Util_math.sin;
  56895. var cos = SUtil.Util_math.cos;
  56896. var PI = Math.PI;
  56897. var x = style.x + __OP[0];
  56898. var y = style.y + __OP[1];
  56899. var r = style.r;
  56900. var r0 = style.r0;
  56901. // 如果未指定内部顶点外接圆半径,则自动计算
  56902. if (r0 == null) {
  56903. r0 = n > 4
  56904. // 相隔的外部顶点的连线的交点,
  56905. // 被取为内部交点,以此计算r0
  56906. ? r * cos(2 * PI / n) / cos(PI / n)
  56907. // 二三四角星的特殊处理
  56908. : r / 3;
  56909. }
  56910. var dStep = PI / n;
  56911. var deg = -PI / 2;
  56912. var xStart = x + r * cos(deg);
  56913. var yStart = y + r * sin(deg);
  56914. deg += dStep;
  56915. // 记录边界点,用于判断inside
  56916. var pointList = style.pointList = [];
  56917. pointList.push([xStart, yStart]);
  56918. for (var i = 0, end = n * 2 - 1, ri; i < end; i++) {
  56919. ri = i % 2 === 0 ? r0 : r;
  56920. pointList.push([x + ri * cos(deg), y + ri * sin(deg)]);
  56921. deg += dStep;
  56922. }
  56923. pointList.push([xStart, yStart]);
  56924. // 绘制
  56925. ctx.moveTo(pointList[0][0], pointList[0][1]);
  56926. for (let i = 0; i < pointList.length; i++) {
  56927. ctx.lineTo(pointList[i][0], pointList[i][1]);
  56928. }
  56929. ctx.closePath();
  56930. return;
  56931. }
  56932. /**
  56933. * @function SuperMap.LevelRenderer.Shape.SmicStar.prototype.getRect
  56934. * @description 返回 n 角星包围盒矩形。
  56935. *
  56936. * @param {Object} style - style
  56937. * @return {Object} 边框对象。包含属性:x,y,width,height。
  56938. */
  56939. getRect(style) {
  56940. if (style.__rect) {
  56941. return style.__rect;
  56942. }
  56943. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  56944. this.refOriginalPosition = [0, 0];
  56945. }
  56946. var __OP = this.refOriginalPosition;
  56947. var lineWidth;
  56948. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  56949. lineWidth = style.lineWidth || 1;
  56950. } else {
  56951. lineWidth = 0;
  56952. }
  56953. style.__rect = {
  56954. x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
  56955. y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
  56956. width: style.r * 2 + lineWidth,
  56957. height: style.r * 2 + lineWidth
  56958. };
  56959. return style.__rect;
  56960. }
  56961. }
  56962. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/index.js
  56963. /* Copyright© 2000 - 2021 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. ;// CONCATENATED MODULE: ./src/common/overlay/index.js
  56967. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  56968. * This program are made available under the terms of the Apache License, Version 2.0
  56969. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56970. ;// CONCATENATED MODULE: ./src/common/components/CommonTypes.js
  56971. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  56972. * This program are made available under the terms of the Apache License, Version 2.0
  56973. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56974. /**
  56975. * 该文件用于存储一些公用常量
  56976. *
  56977. */
  56978. const FileTypes = {
  56979. EXCEL: "EXCEL",
  56980. CSV: "CSV",
  56981. ISERVER: "ISERVER",
  56982. GEOJSON: "GEOJSON",
  56983. JSON: 'JSON'
  56984. };
  56985. const FileConfig = {
  56986. fileMaxSize: 10 * 1024 * 1024
  56987. };
  56988. ;// CONCATENATED MODULE: ./src/common/components/openfile/FileModel.js
  56989. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  56990. * This program are made available under the terms of the Apache License, Version 2.0
  56991. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56992. /**
  56993. * @class SuperMap.FileModel
  56994. * @description 文件数据组件数据模型,用于存储一些文件数据或状态,todo 结构待完善
  56995. * @category Components OpenFile
  56996. * @private
  56997. */
  56998. class FileModel {
  56999. constructor(options) {
  57000. this.FileTypes = FileTypes;
  57001. this.FileConfig = FileConfig;
  57002. this.loadFileObject = options && options.loadFileObject ? options.loadFileObject : [];
  57003. }
  57004. /**
  57005. * @function SuperMap.FileModel.prototype.set
  57006. * @description 设置属性值
  57007. * @param {string} key - 属性名称
  57008. * @param {string|Object} value - 属性值
  57009. */
  57010. set(key, value) {
  57011. this[key] = value;
  57012. }
  57013. /**
  57014. * @function SuperMap.FileModel.prototype.get
  57015. * @description 获取数据值
  57016. * @param {string} key - 属性名称
  57017. * @returns {string|Object} value - 返回属性值
  57018. */
  57019. get(key) {
  57020. return this[key];
  57021. }
  57022. }
  57023. ;// CONCATENATED MODULE: ./src/common/components/messagebox/MessageBox.js
  57024. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  57025. * This program are made available under the terms of the Apache License, Version 2.0
  57026. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57027. /**
  57028. * @class SuperMap.Components.MessageBox
  57029. * @version 9.1.1
  57030. * @classdesc 组件信息提示框。
  57031. * @category Components Common
  57032. */
  57033. class MessageBox {
  57034. constructor() {
  57035. this._initView();
  57036. }
  57037. _initView() {
  57038. //原生js形式
  57039. const messageBoxContainer = document.createElement("div");
  57040. messageBoxContainer.hidden = true;
  57041. messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-orange");
  57042. //图标
  57043. const iconContainer = document.createElement("div");
  57044. iconContainer.setAttribute("class", "icon");
  57045. this.icon = document.createElement("span");
  57046. this.icon.setAttribute("class", "supermapol-icons-message-warning");
  57047. iconContainer.appendChild(this.icon);
  57048. messageBoxContainer.appendChild(iconContainer);
  57049. //内容:
  57050. const messageBox = document.createElement("div");
  57051. messageBox.setAttribute("class", "component-messagebox");
  57052. messageBox.innerHTML = "";
  57053. messageBoxContainer.appendChild(messageBox);
  57054. this.messageBox = messageBox;
  57055. //关闭按钮
  57056. const cancelContainer = document.createElement("div");
  57057. cancelContainer.setAttribute("class", "component-messagebox__cancelbtncontainer");
  57058. const cancelBtn = document.createElement("button");
  57059. cancelBtn.setAttribute("class", "component-messagebox__cancelBtn");
  57060. cancelBtn.innerHTML = "x";
  57061. cancelBtn.onclick = this.closeView.bind(this);
  57062. cancelContainer.appendChild(cancelBtn);
  57063. messageBoxContainer.appendChild(cancelContainer);
  57064. this.messageBoxContainer = messageBoxContainer;
  57065. document.body.appendChild(this.messageBoxContainer);
  57066. }
  57067. /**
  57068. * @function SuperMap.Components.MessageBox.prototype.closeView
  57069. * @description 关闭提示框。
  57070. */
  57071. closeView() {
  57072. this.messageBoxContainer.hidden = true;
  57073. }
  57074. /**
  57075. * @function SuperMap.Components.MessageBox.prototype.showView
  57076. * @description 显示提示框。
  57077. * @param {string} message - 提示框显示内容。
  57078. * @param {string}[type="warring"] 提示框类型,如 "warring", "failure", "success"。
  57079. */
  57080. showView(message, type = 'warring') {
  57081. //设置提示框的样式:
  57082. if (type === "success") {
  57083. this.icon.setAttribute("class", "supermapol-icons-message-success");
  57084. this.messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-green");
  57085. } else if (type === "failure") {
  57086. this.icon.setAttribute("class", "supermapol-icons-message-failure");
  57087. this.messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-red");
  57088. } else if (type === "warring") {
  57089. this.icon.setAttribute("class", "supermapol-icons-message-warning");
  57090. this.messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-orange");
  57091. }
  57092. this.messageBox.innerHTML = message;
  57093. this.messageBoxContainer.hidden = false;
  57094. }
  57095. }
  57096. SuperMap.Components.MessageBox = MessageBox;
  57097. ;// CONCATENATED MODULE: external "function(){try{return echarts}catch(e){return {}}}()"
  57098. const external_function_try_return_echarts_catch_e_return_namespaceObject = function(){try{return echarts}catch(e){return {}}}();
  57099. var external_function_try_return_echarts_catch_e_return_default = /*#__PURE__*/__webpack_require__.n(external_function_try_return_echarts_catch_e_return_namespaceObject);
  57100. ;// CONCATENATED MODULE: ./src/common/lang/Lang.js
  57101. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  57102. * This program are made available under the terms of the Apache License, Version 2.0
  57103. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57104. /**
  57105. * @name Lang
  57106. * @memberOf SuperMap
  57107. * @namespace
  57108. * @category BaseTypes
  57109. * @description 国际化的命名空间,包含多种语言和方法库来设置和获取当前的语言。
  57110. */
  57111. let Lang = {
  57112. /**
  57113. * @member {string} SuperMap.Lang.code
  57114. * @description 当前所使用的语言类型。
  57115. */
  57116. code: null,
  57117. /**
  57118. * @member {string} [SuperMap.Lang.defaultCode='en-US']
  57119. * @description 默认使用的语言类型。
  57120. */
  57121. defaultCode: "en-US",
  57122. /**
  57123. * @function SuperMap.Lang.getCode
  57124. * @description 获取当前的语言代码。
  57125. * @returns {string} 当前的语言代码。
  57126. */
  57127. getCode: function () {
  57128. if (!SuperMap.Lang.code) {
  57129. SuperMap.Lang.setCode();
  57130. }
  57131. return SuperMap.Lang.code;
  57132. },
  57133. /**
  57134. * @function SuperMap.Lang.setCode
  57135. * @description 设置语言代码。
  57136. * @param {string} code - 此参数遵循IETF规范。
  57137. */
  57138. setCode: function () {
  57139. var lang = this.getLanguageFromCookie();
  57140. if (lang) {
  57141. SuperMap.Lang.code = lang;
  57142. return;
  57143. }
  57144. lang = SuperMap.Lang.defaultCode;
  57145. if (navigator.appName === 'Netscape') {
  57146. lang = navigator.language;
  57147. } else {
  57148. lang = navigator.browserLanguage;
  57149. }
  57150. if (lang.indexOf('zh') === 0) {
  57151. lang = 'zh-CN';
  57152. }
  57153. if (lang.indexOf('en') === 0) {
  57154. lang = 'en-US';
  57155. }
  57156. SuperMap.Lang.code = lang;
  57157. },
  57158. /**
  57159. * @function SuperMap.Lang.getLanguageFromCookie
  57160. * @description 从 cookie 中获取语言类型。
  57161. */
  57162. getLanguageFromCookie() {
  57163. var name = 'language=';
  57164. var ca = document.cookie.split(';');
  57165. for (var i = 0; i < ca.length; i++) {
  57166. var c = ca[i];
  57167. while (c.charAt(0) === ' ') {
  57168. c = c.substring(1)
  57169. }
  57170. if (c.indexOf(name) !== -1) {
  57171. return c.substring(name.length, c.length)
  57172. }
  57173. }
  57174. return "";
  57175. },
  57176. /**
  57177. * @function SuperMap.Lang.i18n
  57178. * @description 从当前语言字符串的字典查找 key。
  57179. * @param {string} key - 字典中 i18n 字符串值的关键字。
  57180. * @returns {string} 国际化的字符串。
  57181. */
  57182. i18n: function (key) {
  57183. var dictionary = SuperMap.Lang[SuperMap.Lang.getCode()];
  57184. var message = dictionary && dictionary[key];
  57185. if (!message) {
  57186. // Message not found, fall back to message key
  57187. message = key;
  57188. }
  57189. return message;
  57190. }
  57191. };
  57192. SuperMap.Lang = Lang;
  57193. SuperMap.i18n = SuperMap.Lang.i18n;
  57194. ;// CONCATENATED MODULE: external "function(){try{return XLSX}catch(e){return {}}}()"
  57195. const external_function_try_return_XLSX_catch_e_return_namespaceObject = function(){try{return XLSX}catch(e){return {}}}();
  57196. var external_function_try_return_XLSX_catch_e_return_default = /*#__PURE__*/__webpack_require__.n(external_function_try_return_XLSX_catch_e_return_namespaceObject);
  57197. ;// CONCATENATED MODULE: ./src/common/components/util/FileReaderUtil.js
  57198. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  57199. * This program are made available under the terms of the Apache License, Version 2.0
  57200. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57201. /**
  57202. * @class SuperMap.Components.FileReaderUtil
  57203. * @classdesc 组件读取文件工具类。
  57204. * @version 9.1.1
  57205. * @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(*, *=))}}
  57206. */
  57207. let FileReaderUtil = {
  57208. rABS: typeof FileReader !== 'undefined' && FileReader.prototype && FileReader.prototype.readAsBinaryString,
  57209. rABF: typeof FileReader !== 'undefined' && FileReader.prototype && FileReader.prototype.readAsArrayBuffer,
  57210. rAT: typeof FileReader !== 'undefined' && FileReader.prototype && FileReader.prototype.readAsText,
  57211. /**
  57212. * @function SuperMap.Components.FileReaderUtil.prototype.readFile
  57213. * @description 读取文件
  57214. * @param {string} fileType - 当前读取的文件类型
  57215. *
  57216. * @param {Object} file - 读取回来的文件内容对象
  57217. * @param {function} success - 读取文件成功回调函数
  57218. * @param {function} failed - 读取文件失败回调函数
  57219. * @param {Object} context - 回调重定向对象
  57220. */
  57221. readFile(fileType, file, success, failed, context) {
  57222. if (FileTypes.JSON === fileType || FileTypes.GEOJSON === fileType) {
  57223. this.readTextFile(file, success, failed, context)
  57224. } else if (FileTypes.EXCEL === fileType || FileTypes.CSV === fileType) {
  57225. this.readXLSXFile(file, success, failed, context)
  57226. }
  57227. },
  57228. /**
  57229. * 读取文本文件
  57230. * @param file
  57231. * @param success
  57232. * @param failed
  57233. * @param {Object} context - 回调重定向对象
  57234. */
  57235. readTextFile(file, success, failed, context) {
  57236. let reader = new FileReader();
  57237. reader.onloadend = function (evt) {
  57238. success && success.call(context, evt.target.result);
  57239. };
  57240. reader.onerror = function (error) {
  57241. failed && failed.call(context, error)
  57242. };
  57243. this.rAT ? reader.readAsText(file.file, 'utf-8') : reader.readAsBinaryString(file.file);
  57244. },
  57245. /**
  57246. * 读取excel或csv文件
  57247. * @param file
  57248. * @param success
  57249. * @param failed
  57250. * @param {Object} context - 回调重定向对象
  57251. */
  57252. readXLSXFile(file, success, failed, context) {
  57253. let reader = new FileReader();
  57254. reader.onloadend = function (evt) {
  57255. let xLSXData = new Uint8Array(evt.target.result);
  57256. let workbook = external_function_try_return_XLSX_catch_e_return_default().read(xLSXData, {type: "array"});
  57257. try {
  57258. if (workbook && workbook.SheetNames && workbook.SheetNames.length > 0) {
  57259. //暂时只读取第一个sheets的内容
  57260. let sheetName = workbook.SheetNames[0];
  57261. let xLSXCSVString = external_function_try_return_XLSX_catch_e_return_default().utils.sheet_to_csv(workbook.Sheets[sheetName]);
  57262. success && success.call(context, xLSXCSVString);
  57263. }
  57264. } catch (error) {
  57265. failed && failed.call(context, error);
  57266. }
  57267. };
  57268. reader.onerror = function (error) {
  57269. failed && failed.call(context, error)
  57270. };
  57271. this.rABF && reader.readAsArrayBuffer(file.file);
  57272. },
  57273. /**
  57274. * @function SuperMap.Components.FileReaderUtil.prototype.processDataToGeoJson
  57275. * @description 将读取回来得数据统一处理为 GeoJSON 格式
  57276. * @param {string} type - 文件类型
  57277. * @param {Object} data - 读取返回的数据对象
  57278. * @param {function} success - 数据处理成功的回调
  57279. * @param {function} failed - 数据处理失败的回调
  57280. * @param {Object} context - 回调重定向对象
  57281. * @returns {GeoJSONObject} 返回标准 GeoJSON 规范格式数据
  57282. * @private
  57283. */
  57284. processDataToGeoJson(type, data, success, failed, context) {
  57285. let geojson = null;
  57286. if (type === "EXCEL" || type === "CSV") {
  57287. geojson = this.processExcelDataToGeoJson(data);
  57288. success && success.call(context, geojson);
  57289. } else if (type === 'JSON' || type === 'GEOJSON') {
  57290. let result = data;
  57291. //geojson、json未知,通过类容来判断
  57292. if ((typeof result) === "string") {
  57293. result = JSON.parse(result);
  57294. }
  57295. if (result.type === 'ISERVER') {
  57296. geojson = result.data.recordsets[0].features;
  57297. } else if (result.type === 'FeatureCollection') {
  57298. //geojson
  57299. geojson = result;
  57300. } else {
  57301. //不支持数据
  57302. failed && failed.call(context, Lang.i18n('msg_dataInWrongGeoJSONFormat'));
  57303. }
  57304. success && success.call(context, geojson);
  57305. } else {
  57306. failed && failed.call(context, Lang.i18n('msg_dataInWrongFormat'));
  57307. }
  57308. },
  57309. /**
  57310. * @function SuperMap.Components.FileReaderUtil.prototype.processExcelDataToGeoJson
  57311. * @description 表格文件数据处理
  57312. * @param {Object} data - 读取的表格文件数据
  57313. * @returns {GeoJSONObject} 返回标准 GeoJSON 规范格式数据
  57314. * @private
  57315. */
  57316. processExcelDataToGeoJson(data) {
  57317. //处理为对象格式转化
  57318. let dataContent = this.string2Csv(data);
  57319. let fieldCaptions = dataContent.colTitles;
  57320. //位置属性处理
  57321. let xfieldIndex = -1,
  57322. yfieldIndex = -1;
  57323. for (let i = 0, len = fieldCaptions.length; i < len; i++) {
  57324. if (this.isXField(fieldCaptions[i])) {
  57325. xfieldIndex = i;
  57326. }
  57327. if (this.isYField(fieldCaptions[i])) {
  57328. yfieldIndex = i;
  57329. }
  57330. }
  57331. // feature 构建后期支持坐标系 4326/3857
  57332. let features = [];
  57333. for (let i = 0, len = dataContent.rows.length; i < len; i++) {
  57334. let row = dataContent.rows[i];
  57335. //if (featureFrom === "LonLat") {
  57336. let x = Number(row[xfieldIndex]),
  57337. y = Number(row[yfieldIndex]);
  57338. //属性信息
  57339. let attributes = {};
  57340. for (let index in dataContent.colTitles) {
  57341. let key = dataContent.colTitles[index];
  57342. attributes[key] = dataContent.rows[i][index];
  57343. }
  57344. //目前csv 只支持处理点,所以先生成点类型的 geojson
  57345. let feature = {
  57346. "type": "Feature",
  57347. "geometry": {
  57348. "type": "Point",
  57349. "coordinates": [x, y]
  57350. },
  57351. "properties": attributes
  57352. };
  57353. features.push(feature);
  57354. }
  57355. return features;
  57356. },
  57357. /**
  57358. * 判断是否地理X坐标
  57359. * @param data
  57360. */
  57361. isXField(data) {
  57362. var lowerdata = data.toLowerCase();
  57363. return (lowerdata === "x" || lowerdata === "smx" ||
  57364. lowerdata === "jd" || lowerdata === "经度" || lowerdata === "东经" || lowerdata === "longitude" ||
  57365. lowerdata === "lot" || lowerdata === "lon" || lowerdata === "lng" || lowerdata === "x坐标");
  57366. },
  57367. /**
  57368. * 判断是否地理Y坐标
  57369. * @param data
  57370. */
  57371. isYField(data) {
  57372. var lowerdata = data.toLowerCase();
  57373. return (lowerdata === "y" || lowerdata === "smy" ||
  57374. lowerdata === "wd" || lowerdata === "纬度" || lowerdata === "北纬" ||
  57375. lowerdata === "latitude" || lowerdata === "lat" || lowerdata === "y坐标");
  57376. },
  57377. /**
  57378. * 字符串转为dataEditor 支持的csv格式数据
  57379. * @param string
  57380. * @param withoutTitle
  57381. */
  57382. string2Csv(string, withoutTitle) {
  57383. // let rows = string.split('\r\n');
  57384. let rows = string.split('\n');
  57385. let result = {};
  57386. if (!withoutTitle) {
  57387. result["colTitles"] = rows[0].split(',');
  57388. } else {
  57389. result["colTitles"] = [];
  57390. }
  57391. result['rows'] = [];
  57392. for (let i = (withoutTitle) ? 0 : 1; i < rows.length; i++) {
  57393. rows[i] && result['rows'].push(rows[i].split(','));
  57394. }
  57395. return result;
  57396. }
  57397. };
  57398. SuperMap.Components.FileReaderUtil = FileReaderUtil;
  57399. ;// CONCATENATED MODULE: ./src/common/components/chart/ChartModel.js
  57400. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  57401. * This program are made available under the terms of the Apache License, Version 2.0
  57402. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57403. /**
  57404. * @class SuperMap.Components.ChartModel
  57405. * @classdesc 图表组件数据模型
  57406. * @private
  57407. * @param {Object} datasets - 数据来源。
  57408. * @category Components Chart
  57409. * @fires SuperMap.Components.ChartModel#getdatafailed
  57410. */
  57411. class ChartModel {
  57412. constructor(datasets) {
  57413. this.datasets = datasets;
  57414. this.EVENT_TYPES = ['getdatafailed'];
  57415. this.events = new Events(this, null, this.EVENT_TYPES);
  57416. }
  57417. /**
  57418. * @private
  57419. * @function SuperMap.Components.ChartModel.prototype.getDatasetInfo
  57420. * @description 获得数据集数据。
  57421. * @param {string} datasetUrl - 数据集资源地址。
  57422. */
  57423. getDatasetInfo(success) {
  57424. let datasetUrl = this.datasets.url;
  57425. let me = this;
  57426. FetchRequest.get(datasetUrl)
  57427. .then(function (response) {
  57428. return response.json();
  57429. })
  57430. .then(function (results) {
  57431. if (results.datasetInfo) {
  57432. let datasetInfo = results.datasetInfo;
  57433. me.datasetsInfo = {
  57434. dataSourceName: datasetInfo.dataSourceName,
  57435. datasetName: datasetInfo.name,
  57436. mapName: results.name
  57437. };
  57438. success({
  57439. result: me.datasetsInfo
  57440. });
  57441. }
  57442. })
  57443. .catch(function (error) {
  57444. console.log(error);
  57445. me._fireFailedEvent(error);
  57446. });
  57447. }
  57448. /**
  57449. * @private
  57450. * @function SuperMap.Components.ChartModel.prototype.getDataFeatures
  57451. * @description 请求数据集的数据信息
  57452. * @param {Object} results - 数据集信息。
  57453. * @param {function} success - 成功回调函数。
  57454. */
  57455. getDataFeatures(results, success) {
  57456. let datasetsInfo = results.result;
  57457. let getFeatureParam, getFeatureBySQLParams, getFeatureBySQLService;
  57458. let params = {
  57459. name: datasetsInfo.datasetName + '@' + datasetsInfo.dataSourceName
  57460. };
  57461. Object.assign(params, this.datasets.queryInfo);
  57462. getFeatureParam = new SuperMap.FilterParameter(params);
  57463. getFeatureBySQLParams = new SuperMap.GetFeaturesBySQLParameters({
  57464. queryParameter: getFeatureParam,
  57465. datasetNames: [datasetsInfo.dataSourceName + ':' + datasetsInfo.datasetName],
  57466. fromIndex: 0,
  57467. toIndex: 100000
  57468. });
  57469. getFeatureBySQLService = new SuperMap.GetFeaturesBySQLService(datasetsInfo.dataUrl, {
  57470. eventListeners: {
  57471. processCompleted: success,
  57472. processFailed: function () {}
  57473. }
  57474. });
  57475. getFeatureBySQLService.processAsync(getFeatureBySQLParams);
  57476. }
  57477. /**
  57478. * @private
  57479. * @function SuperMap.Components.ChartModel.prototype.getLayerFeatures
  57480. * @description 请求图层要素的数据信息
  57481. * @param {Object} results - 数据集信息。
  57482. * @param {Callbacks} success - 成功回调函数。
  57483. */
  57484. getLayerFeatures(results, success) {
  57485. let datasetsInfo = results.result;
  57486. let queryParam, queryBySQLParams, queryBySQLService;
  57487. let params = {
  57488. name: datasetsInfo.mapName
  57489. };
  57490. Object.assign(params, this.datasets.queryInfo);
  57491. queryParam = new SuperMap.FilterParameter(params);
  57492. queryBySQLParams = new SuperMap.QueryBySQLParameters({
  57493. queryParams: [queryParam],
  57494. expectCount: 100000
  57495. });
  57496. queryBySQLService = new SuperMap.QueryBySQLService(datasetsInfo.dataUrl, {
  57497. eventListeners: {
  57498. processCompleted: success,
  57499. processFailed: function () {}
  57500. }
  57501. });
  57502. queryBySQLService.processAsync(queryBySQLParams);
  57503. }
  57504. /**
  57505. * @private
  57506. * @function SuperMap.Components.ChartModel.prototype.getDataInfoByIptl
  57507. * @description 用dataId获取iportal的数据。
  57508. * @param {Callbacks} success - getdatachart。
  57509. *
  57510. */
  57511. getDataInfoByIptl(success) {
  57512. // success是chart的回调
  57513. this.getServiceInfo(this.datasets.url, success);
  57514. }
  57515. /**
  57516. * @private
  57517. * @function SuperMap.Components.ChartModel.prototype.getServiceInfo
  57518. * @description 用iportal获取dataItemServices。
  57519. * @param {String} url
  57520. * @param {Callbacks} success - getdatachart。
  57521. * */
  57522. getServiceInfo(url, success) {
  57523. let me = this;
  57524. FetchRequest.get(url, null, {
  57525. withCredentials: this.datasets.withCredentials
  57526. })
  57527. .then((response) => {
  57528. return response.json();
  57529. })
  57530. .then((data) => {
  57531. if (data.succeed === false) {
  57532. //请求失败
  57533. me._fireFailedEvent(data);
  57534. return;
  57535. }
  57536. // 是否有rest服务
  57537. if (data.dataItemServices && data.dataItemServices.length > 0) {
  57538. let dataItemServices = data.dataItemServices,
  57539. resultData;
  57540. dataItemServices.forEach((item) => {
  57541. // 如果有restdata并且发布成功,就请求restdata服务
  57542. // 如果有restmap并且发布成功,就请求restmap服务
  57543. // 其他情况就请求iportal/content.json
  57544. if (item.serviceType === 'RESTDATA' && item.serviceStatus === 'PUBLISHED') {
  57545. resultData = item;
  57546. } else if (item.serviceType === 'RESTMAP' && item.serviceStatus === 'PUBLISHED') {
  57547. resultData = item;
  57548. } else {
  57549. me.getDatafromContent(url, success);
  57550. return;
  57551. }
  57552. });
  57553. // 如果有服务,获取数据源和数据集, 然后请求rest服务
  57554. resultData && me.getDatafromRest(resultData.serviceType, resultData.address, success);
  57555. } else {
  57556. me.getDatafromContent(url, success);
  57557. return;
  57558. }
  57559. })
  57560. .catch((error) => {
  57561. console.log(error);
  57562. me._fireFailedEvent(error);
  57563. });
  57564. }
  57565. /**
  57566. * @private
  57567. * @function SuperMap.Components.ChartModel.prototype.getDatafromURL
  57568. * @description 用iportal获取数据。(通过固定的url来请求,但是不能请求工作空间的数据)
  57569. * @param {String} url
  57570. * @param {Callbacks} success - getdatachart。
  57571. */
  57572. getDatafromContent(url, success) {
  57573. // 成功回调传入的results
  57574. let results = {
  57575. result: {}
  57576. },
  57577. me = this;
  57578. url += '/content.json?pageSize=9999999&currentPage=1';
  57579. // 获取图层数据
  57580. FetchRequest.get(url, null, {
  57581. withCredentials: this.datasets.withCredentials
  57582. })
  57583. .then((response) => {
  57584. return response.json();
  57585. })
  57586. .then((data) => {
  57587. if (data.succeed === false) {
  57588. //请求失败
  57589. me._fireFailedEvent(data);
  57590. return;
  57591. }
  57592. if (data.type) {
  57593. if (data.type === 'JSON' || data.type === 'GEOJSON') {
  57594. // 将字符串转换成json
  57595. data.content = JSON.parse(data.content.trim());
  57596. // 如果是json文件 data.content = {type:'fco', features},格式不固定
  57597. if (!data.content.features) {
  57598. //json格式解析失败
  57599. console.log(Lang.i18n('msg_jsonResolveFiled'));
  57600. return;
  57601. }
  57602. let features = this._formatGeoJSON(data.content);
  57603. results.result.features = {
  57604. type: data.content.type,
  57605. features
  57606. };
  57607. } else if (data.type === 'EXCEL' || data.type === 'CSV') {
  57608. let features = this._excelData2Feature(data.content);
  57609. results.result.features = {
  57610. type: 'FeatureCollection',
  57611. features
  57612. };
  57613. }
  57614. success(results, 'content');
  57615. }
  57616. }, this)
  57617. .catch((error) => {
  57618. console.log(error);
  57619. me._fireFailedEvent(error);
  57620. });
  57621. }
  57622. /**
  57623. * @private
  57624. * @function SuperMap.Components.ChartModel.prototype._getDataSource
  57625. * @description 获取数据源名和数据集名。
  57626. * @param {string} serviceType 服务类型
  57627. * @param {string} address 地址
  57628. * @param {Callbacks} success - getdatachart。
  57629. * @return{array} [数据源名:数据集名]
  57630. * @return{string} 图层名
  57631. */
  57632. getDatafromRest(serviceType, address, success) {
  57633. let me = this,
  57634. withCredentials = this.datasets.withCredentials;
  57635. if (serviceType === 'RESTDATA') {
  57636. let url = `${address}/data/datasources`,
  57637. sourceName,
  57638. datasetName;
  57639. // 请求获取数据源名
  57640. FetchRequest.get(url, null, {
  57641. withCredentials
  57642. })
  57643. .then((response) => {
  57644. return response.json();
  57645. })
  57646. .then((data) => {
  57647. sourceName = data.datasourceNames[0];
  57648. url = `${address}/data/datasources/${sourceName}/datasets`;
  57649. // 请求获取数据集名
  57650. FetchRequest.get(url, null, {
  57651. withCredentials
  57652. })
  57653. .then((response) => {
  57654. return response.json();
  57655. })
  57656. .then((data) => {
  57657. datasetName = data.datasetNames[0];
  57658. // 请求restdata服务
  57659. me.getDatafromRestData(`${address}/data`, [sourceName + ':' + datasetName], success);
  57660. return [sourceName + ':' + datasetName];
  57661. })
  57662. .catch(function (error) {
  57663. me._fireFailedEvent(error);
  57664. });
  57665. })
  57666. .catch(function (error) {
  57667. me._fireFailedEvent(error);
  57668. });
  57669. } else {
  57670. // 如果是地图服务
  57671. let url = `${address}/maps`,
  57672. mapName,
  57673. layerName,
  57674. path;
  57675. // 请求获取地图名
  57676. FetchRequest.get(url, null, {
  57677. withCredentials
  57678. })
  57679. .then((response) => {
  57680. return response.json();
  57681. })
  57682. .then((data) => {
  57683. mapName = data[0].name;
  57684. path = data[0].path;
  57685. url = url = `${address}/maps/${mapName}/layers`;
  57686. // 请求获取图层名
  57687. FetchRequest.get(url, null, {
  57688. withCredentials
  57689. })
  57690. .then((response) => {
  57691. return response.json();
  57692. })
  57693. .then((data) => {
  57694. layerName = data[0].subLayers.layers[0].caption;
  57695. // 请求restmap服务
  57696. me.getDatafromRestMap(layerName, path, success);
  57697. return layerName;
  57698. })
  57699. .catch(function (error) {
  57700. me._fireFailedEvent(error);
  57701. });
  57702. })
  57703. .catch(function (error) {
  57704. me._fireFailedEvent(error);
  57705. });
  57706. }
  57707. }
  57708. /**
  57709. * @private
  57710. * @function SuperMap.Components.ChartModel.prototype.getDatafromRestData
  57711. * @description 请求restdata服务
  57712. * @param {String} url
  57713. * @param {Array<string>} dataSource [数据源名:数据集名]
  57714. * @param {Callbacks} success - getdatachart。
  57715. */
  57716. getDatafromRestData(url, dataSource, success) {
  57717. let me = this;
  57718. this.datasets.queryInfo.attributeFilter = this.datasets.queryInfo.attributeFilter || 'SmID>0';
  57719. this._getFeatureBySQL(
  57720. url,
  57721. dataSource,
  57722. this.datasets.queryInfo,
  57723. (results) => {
  57724. // 此时的features已经处理成geojson了
  57725. success(results, 'RESTDATA');
  57726. },
  57727. (error) => {
  57728. console.log(error);
  57729. me._fireFailedEvent(error);
  57730. }
  57731. );
  57732. }
  57733. /**
  57734. * @private
  57735. * @function SuperMap.Components.ChartModel.prototype.getDatafromRestMap
  57736. * @description 请求restmap服务
  57737. * @param {String} dataSource layerName
  57738. * @param {String} path - map服务地址。
  57739. * @param {Callbacks} success - getdatachart。
  57740. */
  57741. getDatafromRestMap(dataSource, path, success) {
  57742. let me = this;
  57743. this.datasets.queryInfo.attributeFilter = this.datasets.queryInfo.attributeFilter || 'smid=1';
  57744. this._queryFeatureBySQL(
  57745. path,
  57746. dataSource,
  57747. this.datasets.queryInfo,
  57748. null,
  57749. null,
  57750. (results) => {
  57751. // let features = result.result.recordsets[0].features;
  57752. success(results, 'RESTMAP');
  57753. },
  57754. (error) => {
  57755. console.log(error);
  57756. me._fireFailedEvent(error);
  57757. }
  57758. );
  57759. }
  57760. /**
  57761. * @private
  57762. * @function SuperMap.Components.ChartModel.prototype._getFeatureBySQL
  57763. * @description 通过 sql 方式查询数据。
  57764. */
  57765. _getFeatureBySQL(url, datasetNames, queryInfo, processCompleted, processFaild) {
  57766. let getFeatureParam, getFeatureBySQLService, getFeatureBySQLParams;
  57767. let params = {
  57768. name: datasetNames.join().replace(':', '@')
  57769. };
  57770. Object.assign(params, queryInfo);
  57771. getFeatureParam = new FilterParameter(params);
  57772. getFeatureBySQLParams = new GetFeaturesBySQLParameters({
  57773. queryParameter: getFeatureParam,
  57774. datasetNames: datasetNames,
  57775. fromIndex: 0,
  57776. toIndex: 100000,
  57777. returnContent: true
  57778. });
  57779. let options = {
  57780. eventListeners: {
  57781. processCompleted: (getFeaturesEventArgs) => {
  57782. processCompleted && processCompleted(getFeaturesEventArgs);
  57783. },
  57784. processFailed: (e) => {
  57785. processFaild && processFaild(e);
  57786. }
  57787. }
  57788. };
  57789. getFeatureBySQLService = new GetFeaturesBySQLService(url, options);
  57790. getFeatureBySQLService.processAsync(getFeatureBySQLParams);
  57791. }
  57792. /**
  57793. * @private
  57794. * @function SuperMap.Components.ChartModel.prototype._queryFeatureBySQL
  57795. * @description 通过 sql 方式查询数据。
  57796. */
  57797. _queryFeatureBySQL(
  57798. url,
  57799. layerName,
  57800. queryInfo,
  57801. fields,
  57802. epsgCode,
  57803. processCompleted,
  57804. processFaild,
  57805. startRecord,
  57806. recordLength,
  57807. onlyAttribute
  57808. ) {
  57809. var queryParam, queryBySQLParams;
  57810. var filterParams = {
  57811. name: layerName
  57812. };
  57813. Object.assign(filterParams, queryInfo);
  57814. queryParam = new FilterParameter(filterParams);
  57815. if (fields) {
  57816. queryParam.fields = fields;
  57817. }
  57818. var params = {
  57819. queryParams: [queryParam]
  57820. };
  57821. if (onlyAttribute) {
  57822. params.queryOption = QueryOption.ATTRIBUTE;
  57823. }
  57824. startRecord && (params.startRecord = startRecord);
  57825. recordLength && (params.expectCount = recordLength);
  57826. if (epsgCode) {
  57827. params.prjCoordSys = {
  57828. epsgCode: epsgCode
  57829. };
  57830. }
  57831. queryBySQLParams = new QueryBySQLParameters(params);
  57832. this._queryBySQL(url, queryBySQLParams, (data) => {
  57833. data.type === 'processCompleted' ? processCompleted(data) : processFaild(data);
  57834. });
  57835. }
  57836. /**
  57837. * @function SuperMap.Components.ChartModel.prototype._queryBySQL
  57838. * @description SQL 查询服务。
  57839. * @param {SuperMap.QueryBySQLParameters} params - SQL 查询相关参数类。
  57840. * @param {RequestCallback} callback - 回调函数。
  57841. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  57842. */
  57843. _queryBySQL(url, params, callback, resultFormat) {
  57844. var me = this;
  57845. var queryBySQLService = new QueryBySQLService(url, {
  57846. eventListeners: {
  57847. scope: me,
  57848. processCompleted: callback,
  57849. processFailed: callback
  57850. },
  57851. format: me._processFormat(resultFormat)
  57852. });
  57853. queryBySQLService.processAsync(params);
  57854. }
  57855. /**
  57856. * @function SuperMap.Components.ChartModel.prototype._processFormat
  57857. * @description 将数据转换成geojson。
  57858. * @param {object} resultFormat - 返回结果集。
  57859. * @return {object} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  57860. */
  57861. _processFormat(resultFormat) {
  57862. return resultFormat ? resultFormat : DataFormat.GEOJSON;
  57863. }
  57864. /**
  57865. * @private
  57866. * @function SuperMap.Components.ChartModel.prototype._formatGeoJSON
  57867. * @description 格式 GeoJSON。
  57868. * @param {GeoJSON} data - GeoJSON 数据。
  57869. */
  57870. _formatGeoJSON(data) {
  57871. let features = data.features;
  57872. features.forEach((row, index) => {
  57873. row.properties['index'] = index;
  57874. });
  57875. return features;
  57876. }
  57877. /**
  57878. * @private
  57879. * @description 将 csv 和 xls 文件内容转换成 geojson
  57880. * @function SuperMap.Components.ChartModel.prototype._excelData2Feature
  57881. * @param content 文件内容
  57882. * @param layerInfo 图层信息
  57883. * @returns {Array} feature的数组集合
  57884. */
  57885. _excelData2Feature(dataContent) {
  57886. let fieldCaptions = dataContent.colTitles;
  57887. //位置属性处理
  57888. let xfieldIndex = -1,
  57889. yfieldIndex = -1;
  57890. for (let i = 0, len = fieldCaptions.length; i < len; i++) {
  57891. if (FileReaderUtil.isXField(fieldCaptions[i])) {
  57892. xfieldIndex = i;
  57893. }
  57894. if (FileReaderUtil.isYField(fieldCaptions[i])) {
  57895. yfieldIndex = i;
  57896. }
  57897. }
  57898. // feature 构建后期支持坐标系 4326/3857
  57899. let features = [];
  57900. for (let i = 0, len = dataContent.rows.length; i < len; i++) {
  57901. let row = dataContent.rows[i];
  57902. let x = Number(row[xfieldIndex]),
  57903. y = Number(row[yfieldIndex]);
  57904. //属性信息
  57905. let attributes = {};
  57906. for (let index in dataContent.colTitles) {
  57907. let key = dataContent.colTitles[index];
  57908. attributes[key] = dataContent.rows[i][index];
  57909. }
  57910. attributes['index'] = i + '';
  57911. //目前csv 只支持处理点,所以先生成点类型的 geojson
  57912. let feature = {
  57913. type: 'Feature',
  57914. geometry: {
  57915. type: 'Point',
  57916. coordinates: [x, y]
  57917. },
  57918. properties: attributes
  57919. };
  57920. features.push(feature);
  57921. }
  57922. return features;
  57923. }
  57924. /**
  57925. * @private
  57926. * @description 请求数据失败的事件
  57927. * @function SuperMap.Components.ChartModel.prototype._fireFailedEvent
  57928. * @param {object} error 错误信息
  57929. */
  57930. _fireFailedEvent(error) {
  57931. let errorData = error
  57932. ? {
  57933. error,
  57934. message: Lang.i18n('msg_getdatafailed')
  57935. }
  57936. : {
  57937. message: Lang.i18n('msg_getdatafailed')
  57938. };
  57939. /**
  57940. * @event SuperMap.Components.Chart#getdatafailed
  57941. * @description 监听到获取数据失败事件后触发
  57942. * @property {Object} error - 事件对象。
  57943. */
  57944. this.events.triggerEvent('getdatafailed', errorData);
  57945. }
  57946. }
  57947. ;// CONCATENATED MODULE: ./src/common/components/chart/ChartViewModel.js
  57948. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  57949. * This program are made available under the terms of the Apache License, Version 2.0
  57950. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57951. /**
  57952. * @class SuperMap.Components.ChartViewModel
  57953. * @classdesc 图表组件功能类
  57954. * @category Components Chart
  57955. * @version 10.0.0
  57956. * @param {Object} options - 可选参数。
  57957. * @param {string} options.type - 图表类型。
  57958. * @param {SuperMap.Components.Chart.Datasets} options.datasets - 数据来源。
  57959. * @param {Array.<Object>} options.chartOptions - 图表可选参数。
  57960. * @param {Array.<Object>} options.chartOptions.xAxis - 图表X轴。
  57961. * @param {string} options.chartOptions.xAxis.field - 图表X轴字段名。
  57962. * @param {string} options.chartOptions.xAxis.name - 图表X轴名称。
  57963. * @param {Array.<Object>} options.chartOptions.yAxis - 图表Y轴。
  57964. * @param {string} options.chartOptions.yAxis.field - 图表Y轴字段名。
  57965. * @param {string} options.chartOptions.yAxis.name - 图表Y轴名称。
  57966. * @fires SuperMap.Components.ChartViewModel#getdatafailed
  57967. */
  57968. class ChartViewModel {
  57969. constructor(options) {
  57970. this.datasets = options.datasets;
  57971. this.xField = [];
  57972. this.yField = [];
  57973. this.grid = {
  57974. top: "50px",
  57975. bottom: "50px",
  57976. left: "50px",
  57977. right: "60px"
  57978. };
  57979. this.chartType = options.type || "bar";
  57980. this._initXYField(options.chartOptions);
  57981. this.EVENT_TYPES = ["getdatafailed"];
  57982. this.events = new Events(this, null, this.EVENT_TYPES);
  57983. }
  57984. /**
  57985. * @function SuperMap.Components.ChartViewModel.prototype._initXYField
  57986. * @description 初始化XY字段。
  57987. * @private
  57988. * @param {Object} chartOptions - options里的图表参数
  57989. */
  57990. _initXYField(chartOptions) {
  57991. let me = this;
  57992. if (chartOptions && chartOptions.length > 0) {
  57993. chartOptions.forEach(function (option) {
  57994. if (option.xAxis) {
  57995. me.xField.push({
  57996. field: option.xAxis.field,
  57997. name: option.xAxis.name
  57998. });
  57999. }
  58000. if (option.yAxis) {
  58001. me.yField.push({
  58002. field: option.yAxis.field,
  58003. name: option.yAxis.name
  58004. });
  58005. }
  58006. });
  58007. }
  58008. }
  58009. /**
  58010. * @function SuperMap.Components.ChartViewModel.prototype.getDatasetInfo
  58011. * @description 获得数据集数据。
  58012. * @param {function} success - 成功回调函数
  58013. */
  58014. getDatasetInfo(success) {
  58015. this.createChart = success;
  58016. if (this.datasets && this._checkUrl(this.datasets.url)) {
  58017. this.chartModel = new ChartModel(this.datasets);
  58018. if(this.datasets.type === 'iServer'){
  58019. this.chartModel.getDatasetInfo(this._getDatasetInfoSuccess.bind(this));
  58020. }else if(this.datasets.type === 'iPortal'){
  58021. this.chartModel.getDataInfoByIptl(this._getDataInfoSuccess.bind(this));
  58022. }
  58023. /**
  58024. * @event SuperMap.Components.ChartViewModel#getdatafailed
  58025. * @description 监听到获取数据失败事件后触发
  58026. * @property {Object} error - 事件对象。
  58027. */
  58028. this.chartModel.events.on({"getdatafailed": (error) => {
  58029. this.events.triggerEvent("getdatafailed", error)
  58030. }});
  58031. }
  58032. }
  58033. /**
  58034. * @function SuperMap.Components.ChartViewModel.prototype._getDatasetInfoSuccess
  58035. * @description 成功回调函数。
  58036. * @private
  58037. * @param {Object} results - 数据集信息
  58038. */
  58039. _getDatasetInfoSuccess(results) {
  58040. let datasetUrl = this.datasets.url;
  58041. //判断服务为地图服务 或者 数据服务
  58042. let restIndex = datasetUrl.indexOf("rest");
  58043. if (restIndex > 0) {
  58044. let index = datasetUrl.indexOf("/", restIndex + 5);
  58045. let type = datasetUrl.substring(restIndex + 5, index);
  58046. let dataUrl = datasetUrl.substring(0, restIndex + 4) + "/data";
  58047. if (type === "maps") {
  58048. let mapIndex = datasetUrl.indexOf("/", index + 1);
  58049. let mapName = datasetUrl.substring(index + 1, mapIndex);
  58050. dataUrl = datasetUrl.substring(0, restIndex + 4) + "/maps/" + mapName;
  58051. results.result.dataUrl = dataUrl;
  58052. this._getLayerFeatures(results);
  58053. } else if (type === "data") {
  58054. results.result.dataUrl = dataUrl;
  58055. this._getDataFeatures(results);
  58056. }
  58057. }
  58058. }
  58059. /**
  58060. * @function SuperMap.Components.ChartViewModel.prototype._getDataInfoSuccess
  58061. * @description 请求iportal数据成功之后的回调
  58062. * @private
  58063. */
  58064. _getDataInfoSuccess(results, type) {
  58065. let me = this;
  58066. if(type === 'RESTMAP'){
  58067. me._getChartDatasFromLayer(results);
  58068. }else{
  58069. me._getChartDatas(results);
  58070. }
  58071. }
  58072. /**
  58073. * @function SuperMap.Components.ChartViewModel.prototype._getDataFeatures
  58074. * @description 请求数据集的数据信息
  58075. * @private
  58076. * @param {Object} results - 数据集信息
  58077. */
  58078. _getDataFeatures(results) {
  58079. this.chartModel.getDataFeatures(results, this._getChartDatas.bind(this));
  58080. }
  58081. /**
  58082. * @function SuperMap.Components.ChartViewModel.prototype._getLayerFeatures
  58083. * @description 请求图层的数据信息
  58084. * @private
  58085. * @param {Object} results - 数据集信息
  58086. */
  58087. _getLayerFeatures(results) {
  58088. this.chartModel.getLayerFeatures(results, this._getChartDatasFromLayer.bind(this));
  58089. }
  58090. /**
  58091. * @function SuperMap.Components.ChartViewModel.prototype._getChartDatas
  58092. * @description 将请求回来的数据转换为图表所需的数据格式
  58093. * @private
  58094. * @param {Object} results - 数据要素信息
  58095. */
  58096. _getChartDatas(results) {
  58097. if (results) {
  58098. // 数据来自restdata---results.result.features
  58099. this.features = results.result.features;
  58100. let features = this.features.features;
  58101. let data = {};
  58102. if (features.length) {
  58103. let feature = features[0];
  58104. let attrFields = [],
  58105. itemTypes = [];
  58106. for (let attr in feature.properties) {
  58107. attrFields.push(attr);
  58108. itemTypes.push(this._getDataType(feature.properties[attr]));
  58109. }
  58110. data = {
  58111. features,
  58112. fieldCaptions: attrFields,
  58113. fieldTypes: itemTypes,
  58114. fieldValues: []
  58115. }
  58116. for (let m in itemTypes) {
  58117. let fieldValue = [];
  58118. for (let j in features) {
  58119. let feature = features[j];
  58120. let caption = data.fieldCaptions[m];
  58121. let value = feature.properties[caption];
  58122. fieldValue.push(value);
  58123. }
  58124. data.fieldValues.push(fieldValue);
  58125. }
  58126. this.createChart(data);
  58127. }
  58128. }
  58129. }
  58130. /**
  58131. * @function SuperMap.Components.ChartViewModel.prototype._getChartDatasFromLayer
  58132. * @description 将请求回来的数据转换为图表所需的数据格式
  58133. * @private
  58134. * @param {Object} results - 图层数据要素信息
  58135. */
  58136. _getChartDatasFromLayer(results) {
  58137. if (results.result.recordsets) {
  58138. let recordsets = results.result.recordsets[0];
  58139. let features = recordsets.features.features;
  58140. this.features = recordsets.features;
  58141. let data = {};
  58142. if (features.length) {
  58143. data = {
  58144. features: recordsets.features,
  58145. fieldCaptions: recordsets.fieldCaptions,
  58146. fieldTypes: recordsets.fieldTypes,
  58147. fieldValues: []
  58148. }
  58149. for (let m in data.fieldCaptions) {
  58150. let fieldValue = [];
  58151. for (let j in features) {
  58152. let feature = features[j];
  58153. let caption = data.fieldCaptions[m];
  58154. let value = feature.properties[caption];
  58155. fieldValue.push(value);
  58156. }
  58157. data.fieldValues.push(fieldValue);
  58158. }
  58159. this.createChart(data);
  58160. }
  58161. }
  58162. }
  58163. /**
  58164. * @function SuperMap.Components.ChartViewModel.prototype._createChartOptions
  58165. * @description 创建图表所需参数
  58166. * @private
  58167. * @param {Object} data - 图表数据
  58168. */
  58169. _createChartOptions(data) {
  58170. this.calculatedData = this._createChartDatas(data);
  58171. return this.updateChartOptions(this.chartType);
  58172. }
  58173. /**
  58174. * @function SuperMap.Components.ChartViewModel.prototype.changeType
  58175. * @description 改变图表类型
  58176. * @param {string} type - 图表类型
  58177. */
  58178. changeType(type) {
  58179. if (type !== this.chartType) {
  58180. this.chartType = type;
  58181. return this.updateChartOptions(this.chartType);
  58182. }
  58183. }
  58184. /**
  58185. * @function SuperMap.Components.ChartViewModel.prototype.updateData
  58186. * @description 改变图表类型
  58187. * @param {SuperMap.Components.Chart.Datasets} datasets - 数据来源
  58188. * @param {function} success 成功回调函数
  58189. */
  58190. updateData(datasets, chartOption, success) {
  58191. this.updateChart = success;
  58192. this.xField = [];
  58193. this.yField = [];
  58194. this._initXYField(chartOption);
  58195. // type的设置默认值
  58196. datasets.type = datasets.type || 'iServer';
  58197. // withCredentials的设置默认值
  58198. datasets.withCredentials = datasets.withCredentials || false;
  58199. this.datasets = datasets;
  58200. this.getDatasetInfo(this._updateDataSuccess.bind(this));
  58201. }
  58202. /**
  58203. * @function SuperMap.Components.ChartViewModel.prototype._updateDataSuccess
  58204. * @description 改变图表类型
  58205. * @private
  58206. * @param {Object} data - 图表数据
  58207. */
  58208. _updateDataSuccess(data) {
  58209. let options = this._createChartOptions(data);
  58210. this.updateChart(options);
  58211. }
  58212. /**
  58213. * @function SuperMap.Components.ChartViewModel.prototype.updateChartOptions
  58214. * @description 更新图表所需参数
  58215. * @param {string} type - 图表类型
  58216. * @param {Object} style - 图表样式
  58217. */
  58218. updateChartOptions(type, style) {
  58219. if (this.calculatedData) {
  58220. let grid = this.grid;
  58221. let series = this._createChartSeries(this.calculatedData, type);
  58222. let datas = [];
  58223. for (let i in this.calculatedData.XData) {
  58224. datas.push({
  58225. value: this.calculatedData.XData[i].fieldsData
  58226. });
  58227. }
  58228. let xAxis = {
  58229. type: "category",
  58230. name: this.xField[0].name || "X",
  58231. data: datas,
  58232. nameTextStyle: {
  58233. color: '#fff',
  58234. fontSize: 14
  58235. },
  58236. splitLine: {
  58237. show: false
  58238. },
  58239. axisLine: {
  58240. lineStyle: {
  58241. color: '#eee'
  58242. }
  58243. }
  58244. }
  58245. let yAxis = {
  58246. type: "value",
  58247. name: this.yFieldName || "Y",
  58248. data: {},
  58249. nameTextStyle: {
  58250. color: '#fff',
  58251. fontSize: 14
  58252. },
  58253. splitLine: {
  58254. show: false
  58255. },
  58256. axisLine: {
  58257. lineStyle: {
  58258. color: '#eee'
  58259. }
  58260. }
  58261. }
  58262. let tooltip = {
  58263. formatter: '{b0}: {c0}'
  58264. };
  58265. let backgroundColor = '#404a59';
  58266. if (style) {
  58267. if (style.grid) {
  58268. grid = style.grid;
  58269. }
  58270. if (style.tooltip) {
  58271. tooltip = style.tooltip;
  58272. }
  58273. if (style.backgroundColor) {
  58274. backgroundColor = style.backgroundColor;
  58275. }
  58276. }
  58277. return {
  58278. backgroundColor: backgroundColor,
  58279. grid: grid,
  58280. series: series,
  58281. xAxis: xAxis,
  58282. yAxis: yAxis,
  58283. tooltip: tooltip
  58284. }
  58285. }
  58286. }
  58287. /**
  58288. * @function SuperMap.Components.ChartViewModel.prototype._createChartDatas
  58289. * @description 构建图表数据
  58290. * @private
  58291. * @param {Object} data - 源数据
  58292. */
  58293. _createChartDatas(data) {
  58294. let fieldIndex = 0, yfieldIndexs = [];
  58295. let fieldCaptions = data.fieldCaptions;
  58296. let me = this;
  58297. //X
  58298. fieldCaptions.forEach(function (field, index) {
  58299. if (me.xField[0] && field === me.xField[0].field) {
  58300. fieldIndex = index;
  58301. }
  58302. });
  58303. //Y
  58304. this.yFieldName = "";
  58305. this.yField.forEach(function (value, index) {
  58306. if (index !== 0) {
  58307. me.yFieldName = me.yFieldName + ",";
  58308. }
  58309. me.yFieldName = me.yFieldName + value.name;
  58310. fieldCaptions.forEach(function (field, index) {
  58311. if (field === value.field) {
  58312. yfieldIndexs.push(index);
  58313. }
  58314. });
  58315. })
  58316. let datas = this._getAttrData(data, fieldIndex);
  58317. let yDatas = [];
  58318. if (yfieldIndexs.length > 0) {
  58319. yfieldIndexs.forEach(function (yfieldIndex) {
  58320. let yData = [];
  58321. for (let i in data.fieldValues[yfieldIndex]) {
  58322. yData.push({
  58323. value: data.fieldValues[yfieldIndex][i]
  58324. });
  58325. }
  58326. yDatas.push(yData);
  58327. });
  58328. } else { //未指定Y字段时,y轴计数
  58329. let YData = [],
  58330. XData = [],
  58331. len = datas.length;
  58332. //计算X轴,Y轴数据,并去重
  58333. for (let i = 0; i < len; i++) {
  58334. let isSame = false;
  58335. for (let j = 0, leng = XData.length; j < leng; j++) {
  58336. if (datas[i].fieldsData === XData[j].fieldsData) {
  58337. YData[j].value++;
  58338. XData[j].recordIndexs.push(i);
  58339. isSame = true;
  58340. break;
  58341. }
  58342. }
  58343. if (!isSame) {
  58344. if (datas[i].fieldsData) {
  58345. XData.push({ fieldsData: datas[i].fieldsData, recordIndexs: [i] });
  58346. YData.push({ value: 1 });
  58347. }
  58348. }
  58349. }
  58350. datas = XData;
  58351. yDatas = [YData];
  58352. }
  58353. return {
  58354. XData: datas,
  58355. YData: yDatas
  58356. }
  58357. }
  58358. /**
  58359. * @function SuperMap.Components.ChartViewModel.prototype._getAttrData
  58360. * @description 选中字段数据
  58361. * @private
  58362. * @param {Object} datacontent - 图表数据
  58363. * @param {number} index - 字段索引
  58364. */
  58365. _getAttrData(datacontent, index) {
  58366. if (index === 0) {
  58367. this.xField = [{
  58368. field: datacontent.fieldCaptions[index],
  58369. name: datacontent.fieldCaptions[index]
  58370. }];
  58371. }
  58372. let fieldsDatas = [];
  58373. for (let i = 0, len = datacontent.fieldValues[index].length; i < len; i++) {
  58374. let value = datacontent.fieldValues[index][i];
  58375. fieldsDatas.push({
  58376. recordIndexs: i,
  58377. fieldsData: value
  58378. });
  58379. }
  58380. return fieldsDatas;
  58381. }
  58382. /**
  58383. * @function SuperMap.Components.ChartViewModel.prototype._createChartSeries
  58384. * @description 图表数据
  58385. * @private
  58386. * @param {Object} calculatedData - 图表数据
  58387. * @param {string} chartType - 图表类型
  58388. */
  58389. _createChartSeries(calculatedData, chartType) {
  58390. let series = [];
  58391. let yDatas = calculatedData.YData;
  58392. yDatas.forEach(function (yData) {
  58393. let value = 0;
  58394. let serieData = [];
  58395. for (let data of yData) {
  58396. value = data.value;
  58397. serieData.push({
  58398. value: value
  58399. });
  58400. }
  58401. let serie = {
  58402. type: chartType,
  58403. data: serieData,
  58404. name: "y"
  58405. };
  58406. series.push(serie);
  58407. });
  58408. return series;
  58409. }
  58410. /**
  58411. * @function SuperMap.Components.ChartViewModel.prototype._isDate
  58412. * @description 判断是否为日期
  58413. * @private
  58414. * @param {string} data - 字符串
  58415. */
  58416. _isDate(data) {
  58417. 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;
  58418. return reg.test(data);
  58419. }
  58420. /**
  58421. * @function SuperMap.Components.ChartViewModel.prototype._isNumber
  58422. * @description 判断是否为数值
  58423. * @private
  58424. * @param {string} data - 字符串
  58425. */
  58426. _isNumber(data) {
  58427. let mdata = Number(data);
  58428. if (mdata === 0) {
  58429. return true;
  58430. }
  58431. return !isNaN(mdata);
  58432. }
  58433. /**
  58434. * @function SuperMap.Components.ChartViewModel.prototype._getDataType
  58435. * @description 判断数据的类型
  58436. * @private
  58437. * @param {string} data - 字符串
  58438. */
  58439. _getDataType(data) {
  58440. if (data !== null && data !== undefined && data !== '') {
  58441. if (this._isDate(data)) {
  58442. return "DATE";
  58443. }
  58444. if (this._isNumber(data)) {
  58445. return "NUMBER";
  58446. }
  58447. }
  58448. return "STRING";
  58449. }
  58450. /**
  58451. * @function SuperMap.Components.ChartViewModel.prototype._checkUrl
  58452. * @description 检查url是否符合要求
  58453. * @private
  58454. * @param {string} url
  58455. */
  58456. _checkUrl(url) {
  58457. let match;
  58458. if (url === '' || !this._isMatchUrl(url)) {
  58459. match = false;
  58460. } else if (/^http[s]?:\/\/localhost/.test(url) || /^http[s]?:\/\/127.0.0.1/.test(url)) {
  58461. //不是实际域名
  58462. match = false;
  58463. } else {
  58464. match = true;
  58465. }
  58466. return match;
  58467. }
  58468. /**
  58469. * @function SuperMap.Components.ChartViewModel.prototype._isMatchUrl
  58470. * @description 判断输入的地址是否符合地址格式
  58471. * @private
  58472. * @param {string} str - url
  58473. */
  58474. _isMatchUrl(str) {
  58475. var reg = new RegExp('(https?|http|file|ftp)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]');
  58476. return reg.test(str);
  58477. }
  58478. /**
  58479. * @function SuperMap.Components.ChartViewModel.prototype.getStyle
  58480. * @description 获取图表样式。
  58481. */
  58482. getStyle() {
  58483. let style = {
  58484. grid: this.grid,
  58485. tooltip: this.tooltip,
  58486. backgroundColor: this.backgroundColor
  58487. }
  58488. return style;
  58489. }
  58490. /**
  58491. * @function SuperMap.Components.ChartViewModel.prototype.getFeatures
  58492. * @description 获取地图服务,数据服务请求返回的数据。
  58493. */
  58494. getFeatures() {
  58495. return this.features;
  58496. }
  58497. /**
  58498. * @function SuperMap.Components.ChartViewModel.prototype.setStyle
  58499. * @description 设置图表样式。
  58500. * @param {Object} style - 图表样式
  58501. */
  58502. setStyle(style) {
  58503. return this.updateChartOptions(this.chartType, style);
  58504. }
  58505. }
  58506. SuperMap.Components.ChartViewModel = ChartViewModel;
  58507. ;// CONCATENATED MODULE: ./src/common/components/chart/ChartView.js
  58508. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  58509. * This program are made available under the terms of the Apache License, Version 2.0
  58510. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58511. /**
  58512. * @class SuperMap.Components.Chart
  58513. * @classdesc 图表组件
  58514. * @version 9.1.2
  58515. * @param {string} domID - 图表dom元素ID。
  58516. * @param {Object} options - 可选参数。
  58517. * @param {string} options.type - 图表类型。
  58518. * @param {SuperMap.Components.Chart.Datasets} options.datasets - 数据来源
  58519. * @param {Array.<Object>} options.chartOptions - 图表可选参数。
  58520. * @param {Array.<Object>} options.chartOptions.xAxis - 图表X轴。
  58521. * @param {string} options.chartOptions.xAxis.field - 图表X轴字段名。
  58522. * @param {string} options.chartOptions.xAxis.name - 图表X轴名称。
  58523. * @param {Array.<Object>} options.chartOptions.yAxis - 图表Y轴。
  58524. * @param {string} options.chartOptions.yAxis.field - 图表Y轴字段名。
  58525. * @param {string} options.chartOptions.yAxis.name - 图表Y轴名称。
  58526. * @category Components Chart
  58527. */
  58528. /**
  58529. * @typedef {Object} SuperMap.Components.Chart.Datasets - 数据来源
  58530. * @property {string} [type = 'iServer'] - 服务类型 iServer, iPortal。
  58531. * @property {string} url - 服务url地址。
  58532. * @property {boolean} [withCredentials = false] - 设置请求是否带cookie
  58533. * @property {SuperMap.FilterParameter} queryInfo - 查询条件
  58534. */
  58535. class ChartView {
  58536. constructor(domID, options) {
  58537. this.domID = domID;
  58538. this.chartType = options.type || "bar";
  58539. // 设置options.datasets.type的默认值是iServer
  58540. options.datasets.type = options.datasets.type || 'iServer';
  58541. // 设置withCredentials的默认值为false
  58542. options.datasets.withCredentials = options.datasets.withCredentials || false;
  58543. this.viewModel = new ChartViewModel(options);
  58544. //添加控件。
  58545. this._fillDataToView();
  58546. }
  58547. /**
  58548. * @function SuperMap.Components.Chart.prototype.onAdd
  58549. * @description 创建图表之后成功回调
  58550. * @param {function} addChart - 回调函数
  58551. */
  58552. onAdd(addChart) {
  58553. this.addChart = addChart;
  58554. }
  58555. /**
  58556. * @function SuperMap.Components.Chart.prototype._fillDataToView
  58557. * @description 填充数据到 view。
  58558. * @private
  58559. */
  58560. _fillDataToView() {
  58561. let messageboxs = new MessageBox();
  58562. //iclient 绑定createChart事件成功回调
  58563. this.viewModel.getDatasetInfo(this._createChart.bind(this));
  58564. this.viewModel.events.on({
  58565. "getdatafailed": (error) => {
  58566. messageboxs.showView(error.message);
  58567. }
  58568. });
  58569. }
  58570. /**
  58571. * @function SuperMap.Components.Chart.prototype.getStyle
  58572. * @description 获取图表样式。
  58573. */
  58574. getStyle() {
  58575. return this.viewModel.getStyle()
  58576. }
  58577. /**
  58578. * @function SuperMap.Components.Chart.prototype.getFeatures
  58579. * @description 获取地图服务,数据服务请求返回的数据。
  58580. */
  58581. getFeatures() {
  58582. return this.viewModel.getFeatures();
  58583. }
  58584. /**
  58585. * @function SuperMap.Components.Chart.prototype.setStyle
  58586. * @description 设置图表样式。
  58587. * @param {Object} style - 图表样式 参考Echarts-options样式设置
  58588. */
  58589. setStyle(style) {
  58590. let newOptions = this.viewModel.setStyle(style);
  58591. this._updateChart(newOptions);
  58592. }
  58593. /**
  58594. * @function SuperMap.Components.Chart.prototype.changeType
  58595. * @description 改变图表类型
  58596. * @param {string} type - 图表类型
  58597. */
  58598. changeType(type) {
  58599. if (this.chartType !== type) {
  58600. this.chartType = type;
  58601. let newOptions = this.viewModel.changeType(type);
  58602. this._updateChart(newOptions);
  58603. }
  58604. }
  58605. /**
  58606. * @function SuperMap.Components.Chart.prototype.updateData
  58607. * @description 更新图表数据
  58608. * @param {SuperMap.Components.Chart.Datasets} datasets - 数据来源
  58609. * @param {Object} chartOption - X,Y轴信息
  58610. */
  58611. updateData(datasets, chartOption) {
  58612. let me = this;
  58613. this.viewModel.updateData(datasets, chartOption, function (options) {
  58614. me._updateChart(options);
  58615. if (me.addChart) {
  58616. me.addChart();
  58617. }
  58618. });
  58619. }
  58620. /**
  58621. * @function SuperMap.Components.Chart.prototype._createChart
  58622. * @description 创建图表
  58623. * @private
  58624. * @param {Object} data - 图表数据
  58625. */
  58626. _createChart(data) {
  58627. this.echart = external_function_try_return_echarts_catch_e_return_default().init(
  58628. document.getElementById(this.domID),
  58629. null, {
  58630. renderer: "canvas"
  58631. }
  58632. )
  58633. let options = this.viewModel._createChartOptions(data);
  58634. this.echart.setOption(options);
  58635. if (this.addChart) {
  58636. this.addChart();
  58637. }
  58638. }
  58639. /**
  58640. * @function SuperMap.Components.Chart.prototype._updateChart
  58641. * @description 更新图表
  58642. * @private
  58643. * @param {Object} options - 图表参数
  58644. */
  58645. _updateChart(options) {
  58646. if (this.echart) {
  58647. this.echart.clear();
  58648. this.echart.setOption(options);
  58649. }
  58650. }
  58651. }
  58652. SuperMap.Components.Chart = ChartView;
  58653. ;// CONCATENATED MODULE: ./src/common/components/templates/TemplateBase.js
  58654. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  58655. * This program are made available under the terms of the Apache License, Version 2.0
  58656. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58657. /**
  58658. * @class SuperMap.Components.TemplateBase
  58659. * @classdesc 组件公用组件父类,用于约束统一封装的公用组件结构。
  58660. * @version 9.1.1
  58661. * @param {Object} options - 组件配置参数。
  58662. * @param {string} options.id - 组件 dom 元素 id。
  58663. * @category Components Common
  58664. */
  58665. class TemplateBase {
  58666. constructor(options) {
  58667. options = options ? options : {};
  58668. /**
  58669. * @member {string} [SuperMap.Components.TemplateBase.prototype.id=null]
  58670. * @description 组件 dom 元素 id。
  58671. */
  58672. this.id = options.id ? options.id : null;
  58673. /**
  58674. * @member {Element} [SuperMap.Components.TemplateBase.prototype.rootContainer=null]
  58675. * @description 组件 dom 元素对象。
  58676. */
  58677. this.rootContainer = null;
  58678. }
  58679. /**
  58680. * @function SuperMap.Components.TemplateBase.prototype.getElement
  58681. * @description 获取当前组件元素对象。
  58682. * @return {Element}
  58683. */
  58684. getElement() {
  58685. //todo 其实感觉再这里给组件设置不太合理
  58686. if (this.id) {
  58687. this.rootContainer.id = this.id;
  58688. }
  58689. return this.rootContainer;
  58690. }
  58691. /**
  58692. * @function SuperMap.Components.TemplateBase.prototype._initView
  58693. * @private
  58694. * @description 初始化模板。
  58695. */
  58696. _initView() {
  58697. //子类实现此方法
  58698. }
  58699. /**
  58700. * @function SuperMap.Components.TemplateBase.prototype.showView
  58701. * @description 显示组件。
  58702. */
  58703. showView() {
  58704. this.rootContainer.hidden = false;
  58705. }
  58706. /**
  58707. * @function SuperMap.Components.TemplateBase.prototype.closeView
  58708. * @description 隐藏组件。
  58709. */
  58710. closeView() {
  58711. this.rootContainer.hidden = true;
  58712. }
  58713. }
  58714. SuperMap.Components.TemplateBase = TemplateBase;
  58715. ;// CONCATENATED MODULE: ./src/common/components/templates/CommonContainer.js
  58716. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  58717. * This program are made available under the terms of the Apache License, Version 2.0
  58718. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58719. /**
  58720. * @class SuperMap.Components.CommonContainer
  58721. * @classdesc 组件统一外框。
  58722. * @version 9.1.1
  58723. * @param {Object} options - 组件可选参数。
  58724. * @param {string} options.id - 组件 dom 元素 id。
  58725. * @param {string} options.title - 标题。
  58726. * @category Components Common
  58727. * @extends {SuperMap.Components.TemplateBase}
  58728. */
  58729. class CommonContainer extends TemplateBase {
  58730. constructor(options) {
  58731. super(options);
  58732. let title = options.title ? options.title : "";
  58733. this._initView(title);
  58734. }
  58735. /**
  58736. * @private
  58737. * @override
  58738. */
  58739. _initView(title) {
  58740. const container = document.createElement("div");
  58741. container.setAttribute("class", "component-container");
  58742. //title
  58743. const titleContainer = document.createElement("div");
  58744. titleContainer.setAttribute("class", "component-title");
  58745. const titleContent = document.createElement("div");
  58746. titleContent.innerHTML = title;
  58747. titleContainer.appendChild(titleContent);
  58748. container.appendChild(titleContainer);
  58749. //container
  58750. const componentContent = document.createElement("div");
  58751. componentContent.setAttribute("class", "component-content");
  58752. container.appendChild(componentContent);
  58753. this.content = componentContent;
  58754. this.rootContainer = container;
  58755. return container;
  58756. }
  58757. /**
  58758. * @function SuperMap.Components.CommonContainer.prototype.getContentElement
  58759. * @description 获取内容元素容器
  58760. */
  58761. getContentElement() {
  58762. return this.content;
  58763. }
  58764. /**
  58765. * @function SuperMap.Components.CommonContainer.prototype.appendContent
  58766. * @description 填充内容元素
  58767. */
  58768. appendContent(element) {
  58769. this.content.appendChild(element);
  58770. }
  58771. }
  58772. SuperMap.Components.CommonContainer = CommonContainer;
  58773. ;// CONCATENATED MODULE: ./src/common/components/templates/Select.js
  58774. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  58775. * This program are made available under the terms of the Apache License, Version 2.0
  58776. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58777. /**
  58778. * @class SuperMap.Components.Select
  58779. * @classdesc 组件统一的文字下拉框。
  58780. * @version 9.1.1
  58781. * @param {Array.<string|Array>} options - 需要创建的 Select 数据数组。
  58782. * @param {string} options.id - 组件 dom 元素 id。
  58783. * @param {string} [options.labelName] - label 名称。
  58784. * @param {Array.<string>} options.optionsArr - 需要创建的 option 数据数组。
  58785. * @param {Function} [options.optionsClickCb] - option 点击事件回调函数。
  58786. * @extends {SuperMap.Components.TemplateBase}
  58787. * @category Components Common
  58788. */
  58789. class Select extends TemplateBase {
  58790. constructor(options) {
  58791. super(options);
  58792. this._initView(options);
  58793. }
  58794. _initView(options) {
  58795. let selectTool = this._createElement('div', "component-selecttool");
  58796. if (options.labelName) {
  58797. let label = this._createElement('label', 'component-selecttool__lable--describe', selectTool);
  58798. label.innerHTML = options.labelName;
  58799. }
  58800. let chartSelect = this._createElement('div', 'component-selecttool--chart', selectTool);
  58801. chartSelect.setAttribute('tabindex', '1');
  58802. let selectName = this._createElement('div', "component-selecttool__name", chartSelect);
  58803. selectName.title = options.optionsArr[0];
  58804. selectName.innerHTML = options.optionsArr[0];
  58805. let chartTriangleBtn = this._createElement('div', 'component-selecttool__trianglebtn--chart', chartSelect);
  58806. let triangleBtn = this._createElement('div', 'component-triangle-down-img', chartTriangleBtn);
  58807. let selectContent = this._createElement('div', 'component-selecttool__content', chartSelect);
  58808. let scrollarea = this._createElement('div', 'component-selecttool__content--chart', selectContent);
  58809. let scrollareaContent = this._createElement('div', 'component-selecttool__scrollarea__content', scrollarea);
  58810. scrollareaContent.setAttribute('tabindex', '1');
  58811. this.createOptions(scrollareaContent, options.optionsArr);
  58812. this.optionClickEvent(scrollareaContent, selectName, options.optionsClickCb);
  58813. // 下拉框显示 & 隐藏事件
  58814. this._selectClickEvent(chartSelect, selectContent, triangleBtn);
  58815. this.rootContainer = selectTool;
  58816. }
  58817. /**
  58818. * @function SuperMap.Components.Select.prototype.createOptions
  58819. * @description 创建所属下拉框选项。
  58820. */
  58821. createOptions(container, optionsArr) {
  58822. for (let i in optionsArr) {
  58823. let option = this._createElement('div', 'component-selecttool__option', container);
  58824. option.title = optionsArr[i];
  58825. option.innerHTML = optionsArr[i];
  58826. }
  58827. }
  58828. /**
  58829. * @function SuperMap.Components.Select.prototype._selectClickEvent
  58830. * @description select 点击显示&隐藏事件。
  58831. * @private
  58832. */
  58833. _selectClickEvent(eventElement, contentElement, triangleBtn) {
  58834. eventElement.onclick = function (e) {
  58835. if (contentElement.style.display === "block") {
  58836. contentElement.style.display = "none";
  58837. triangleBtn.className = "component-triangle-down-img";
  58838. } else {
  58839. contentElement.style.display = "block";
  58840. triangleBtn.className = "triangle-up-img";
  58841. }
  58842. e.preventDefault();
  58843. e.stopPropagation();
  58844. };
  58845. eventElement.onmousedown = function (evt) {
  58846. //console.log('dropdownbox onmousedown '+evt.target.className);
  58847. if (evt.target !== this) {
  58848. this.focus();
  58849. evt.preventDefault();
  58850. evt.stopPropagation()
  58851. }
  58852. };
  58853. eventElement.onblur = function () {
  58854. contentElement.style.display = "none";
  58855. triangleBtn.className = "component-triangle-down-img";
  58856. }
  58857. }
  58858. /**
  58859. * @function Select.prototype._createElement
  58860. * @description 通用创建元素。
  58861. * @private
  58862. */
  58863. _createElement(tagName, className, parentEle) {
  58864. let ele = document.createElement(tagName || 'div');
  58865. className && (ele.className = className);
  58866. parentEle && parentEle.appendChild(ele);
  58867. return ele;
  58868. }
  58869. /**
  58870. * @function SuperMap.Components.Select.prototype.optionClickEvent
  58871. * @description 下拉框的 option 的点击事件。
  58872. */
  58873. optionClickEvent(optionEleArr, selectNameEle, optionsClickCb) {
  58874. for (let i = 0; i < optionEleArr.children.length; i++) {
  58875. let childEle = optionEleArr.children[i];
  58876. childEle.onclick = function () {
  58877. selectNameEle.innerHTML = childEle.innerHTML;
  58878. selectNameEle.title = childEle.title;
  58879. if (childEle.getAttribute('data-value')) {
  58880. selectNameEle.setAttribute('data-value', childEle.getAttribute('data-value'))
  58881. }
  58882. optionsClickCb && optionsClickCb(childEle);
  58883. }
  58884. }
  58885. }
  58886. }
  58887. SuperMap.Components.Select = Select;
  58888. ;// CONCATENATED MODULE: ./src/common/components/templates/DropDownBox.js
  58889. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  58890. * This program are made available under the terms of the Apache License, Version 2.0
  58891. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58892. /**
  58893. * @class SuperMap.Components.DropDownBox
  58894. * @classdesc 组件统一的图片下拉框。
  58895. * @version 9.1.1
  58896. * @param {Array.<Object>} optionsArr - 需要创建的 option 数据数组。
  58897. * @param {string} optionsArr.id - 组件 dom 元素 id。
  58898. * @param {string} optionsArr.title - 下拉框 title。
  58899. * @param {string} optionsArr.remark - 下拉框解释标记文本。
  58900. * @param {string} optionsArr.icon - 下拉框图标。
  58901. * @param {string} [optionsArr.dataValue] - 下拉框 attribute 名为 data-value 的值 。
  58902. * @param {string} [optionsArr.icon.className] - 下拉框图标类名。
  58903. * @param {string} [optionsArr.icon.background] - 下拉框图标背景 url。
  58904. * @category Components Common
  58905. * @extends {SuperMap.Components.TemplateBase}
  58906. */
  58907. class DropDownBox extends TemplateBase {
  58908. constructor(optionsArr) {
  58909. super(optionsArr);
  58910. this._initView(optionsArr);
  58911. }
  58912. /**
  58913. * @function SuperMap.Components.DropDownBox.prototype._initView
  58914. * @description 初始化下拉框。
  58915. * @private
  58916. * @override
  58917. */
  58918. _initView(optionsArr) {
  58919. let dropDownContainer = document.createElement('div');
  58920. dropDownContainer.className = 'component-dropdownbox--container';
  58921. let dropDownBox = document.createElement('div');
  58922. dropDownBox.setAttribute('tabindex', '1');
  58923. dropDownBox.className = "component-dropdownbox";
  58924. dropDownContainer.appendChild(dropDownBox);
  58925. let dropDownTopContainer = document.createElement('div');
  58926. dropDownBox.appendChild(dropDownTopContainer);
  58927. this._createDropDownOption(optionsArr[0], dropDownTopContainer);
  58928. let triangleBtnContainer = document.createElement('div');
  58929. triangleBtnContainer.className = 'component-dropdownbox__triangle-btn';
  58930. dropDownBox.appendChild(triangleBtnContainer);
  58931. let triangleBtn = document.createElement('div');
  58932. triangleBtn.className = 'component-triangle-down-img';
  58933. triangleBtnContainer.appendChild(triangleBtn);
  58934. let createDropDownBoxParam = {
  58935. "parentEle": dropDownBox,
  58936. "dropDownContent": ['component-dropdownbox__content component-dropdownbox__content--chart', 'dropDownContent'],
  58937. "scrollareaContent": 'component-selecttool__scrollarea__content',
  58938. "optionsArr": optionsArr,
  58939. "triangleBtn": triangleBtn,
  58940. "dropDownTopContainer": dropDownTopContainer
  58941. };
  58942. this._createDropDownBox(createDropDownBoxParam);
  58943. this.rootContainer = dropDownContainer;
  58944. }
  58945. /**
  58946. * @function SuperMap.Components.DropDownBox.prototype._createDropDownBox
  58947. * @description 创建下拉框。
  58948. * @private
  58949. */
  58950. _createDropDownBox(createDropDownBoxParam) {
  58951. let dropDownBox = createDropDownBoxParam.parentEle;
  58952. let dropDownTopContainer = createDropDownBoxParam.dropDownTopContainer;
  58953. let dropDownContent = document.createElement('div');
  58954. dropDownContent.className = createDropDownBoxParam.dropDownContent[0];
  58955. dropDownBox.appendChild(dropDownContent);
  58956. let scrollareaContent = document.createElement('div');
  58957. scrollareaContent.className = createDropDownBoxParam.scrollareaContent;
  58958. dropDownContent.appendChild(scrollareaContent);
  58959. let optionsArr = createDropDownBoxParam.optionsArr;
  58960. for (let i = 0; i < optionsArr.length; i++) {
  58961. this._createDropDownOption(optionsArr[i], scrollareaContent)
  58962. }
  58963. // 下拉框显示 & 隐藏事件
  58964. let triangleBtn = createDropDownBoxParam.triangleBtn;
  58965. this._dropDownClickEvent(dropDownBox, dropDownContent, triangleBtn);
  58966. this._eleOnblur(dropDownBox, dropDownContent, triangleBtn);
  58967. // 下拉框 options 点击事件
  58968. let scrollareaOptions = scrollareaContent.children;
  58969. for (let i = 0; i < scrollareaOptions.length; i++) {
  58970. scrollareaOptions[i].onclick = function () {
  58971. dropDownTopContainer.innerHTML = scrollareaOptions[i].outerHTML;
  58972. //evt.stopPropagation();
  58973. }
  58974. }
  58975. }
  58976. /**
  58977. * @function SuperMap.Components.DropDownBox.prototype._createDropDownOption
  58978. * @description 创建下拉框子元素。
  58979. * @private
  58980. */
  58981. _createDropDownOption(data, parentElement) {
  58982. let ele = document.createElement('div');
  58983. ele.className = 'component-dropdownbox__item';
  58984. let dataItem = data;
  58985. if (dataItem['dataValue']) {
  58986. ele.setAttribute('data-value', dataItem['dataValue']);
  58987. }
  58988. parentElement.appendChild(ele);
  58989. let imgContainer = document.createElement('div');
  58990. imgContainer.className = 'component-dropdownbox__item__img';
  58991. ele.appendChild(imgContainer);
  58992. let img = document.createElement('div');
  58993. if (dataItem.icon.className) {
  58994. img.className = dataItem.icon.className;
  58995. }
  58996. if (dataItem.icon.background) {
  58997. img.style.background = dataItem.icon.background;
  58998. }
  58999. imgContainer.appendChild(img);
  59000. let title = document.createElement('div');
  59001. title.className = 'component-dropdownbox__item__title';
  59002. title.title = dataItem.title;
  59003. title.innerHTML = dataItem.title;
  59004. ele.appendChild(title);
  59005. let remark = document.createElement('div');
  59006. remark.className = 'component-dropdownbox__item__remark';
  59007. remark.title = dataItem.remark;
  59008. remark.innerHTML = dataItem.remark;
  59009. ele.appendChild(remark);
  59010. }
  59011. /**
  59012. * @function SuperMap.Components.DropDownBox.prototype._dropDownClickEvent
  59013. * @description 下拉框点击事件。
  59014. * @private
  59015. */
  59016. _dropDownClickEvent(eventElement, contentElement, triangleBtn) {
  59017. eventElement.onclick = function (e) {
  59018. if (contentElement.style.display === "block") {
  59019. contentElement.style.display = "none";
  59020. triangleBtn.className = "component-triangle-down-img";
  59021. } else {
  59022. contentElement.style.display = "block";
  59023. triangleBtn.className = "triangle-up-img";
  59024. }
  59025. e.preventDefault();
  59026. e.stopPropagation()
  59027. };
  59028. eventElement.onmousedown = function (evt) {
  59029. //console.log('dropdownbox onmousedown '+evt.target.className);
  59030. if (evt.target !== this) {
  59031. this.focus();
  59032. evt.preventDefault();
  59033. evt.stopPropagation()
  59034. }
  59035. }
  59036. }
  59037. /**
  59038. * @function SuperMap.Components.DropDownBox.prototype._eleOnblur
  59039. * @description 下拉框失焦事件。
  59040. * @private
  59041. */
  59042. _eleOnblur(eventElement, contentElement, triangleBtn) {
  59043. eventElement.onblur = function () {
  59044. contentElement.style.display = "none";
  59045. triangleBtn.className = "component-triangle-down-img";
  59046. }
  59047. }
  59048. /**
  59049. * @function SuperMap.Components.DropDownBox.prototype._createElement
  59050. * @description 通用创建元素。
  59051. * @private
  59052. */
  59053. _createElement(tagName, className, parentEle) {
  59054. let ele = document.createElement(tagName || 'div');
  59055. className && (ele.className = className);
  59056. parentEle && parentEle.appendChild(ele);
  59057. return ele;
  59058. }
  59059. }
  59060. SuperMap.Components.DropDownBox = DropDownBox;
  59061. ;// CONCATENATED MODULE: ./src/common/components/templates/PopContainer.js
  59062. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  59063. * This program are made available under the terms of the Apache License, Version 2.0
  59064. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59065. /**
  59066. * @class SuperMap.Components.PopContainer
  59067. * @classdesc 弹框组件。
  59068. * @version 9.1.1
  59069. * @param {Object} options - 组件配置参数。
  59070. * @param {string} options.id - 组件 dom 元素 id。
  59071. * @param {string} options.title - 弹框组件名称。
  59072. * @extends {SuperMap.Components.TemplateBase}
  59073. * @category Components Common
  59074. */
  59075. class PopContainer extends TemplateBase {
  59076. constructor(options) {
  59077. options = options ? options : {};
  59078. super(options);
  59079. options.title = options.title ? options.title : "";
  59080. this._initView(options.title);
  59081. }
  59082. /**
  59083. * @private
  59084. * @override
  59085. */
  59086. _initView(titile) {
  59087. const container = document.createElement("div");
  59088. container.setAttribute("class", "component-popcontainer");
  59089. //header
  59090. const header = document.createElement("div");
  59091. header.setAttribute("class", "component-popcontainer__header");
  59092. const title = document.createElement("label");
  59093. title.setAttribute("class", "component-popcontainer__header__title");
  59094. title.innerHTML = titile;
  59095. header.appendChild(title);
  59096. const closeBtn = document.createElement("span");
  59097. closeBtn.setAttribute("class", "supermapol-icons-clear component-popcontainer__header__close");
  59098. closeBtn.onclick = this.closeView.bind(this);
  59099. container.appendChild(closeBtn);
  59100. container.appendChild(header);
  59101. //content
  59102. const content = document.createElement("div");
  59103. content.setAttribute("class", "component-popcontainer__content");
  59104. this.content = content;
  59105. container.appendChild(content);
  59106. this.rootContainer = container;
  59107. }
  59108. /**
  59109. * @function SuperMap.Components.PopContainer.prototype.appendContent
  59110. * @description 追加内容。
  59111. * @param {Element} dom - 内容元素。
  59112. */
  59113. appendContent(dom) {
  59114. this.content.appendChild(dom);
  59115. }
  59116. }
  59117. SuperMap.Components.PopContainer = PopContainer;
  59118. ;// CONCATENATED MODULE: ./src/common/components/templates/AttributesPopContainer.js
  59119. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  59120. * This program are made available under the terms of the Apache License, Version 2.0
  59121. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59122. /**
  59123. * @class SuperMap.Components.AttributesPopContainer
  59124. * @classdesc 属性弹框组件
  59125. * @version 9.1.1
  59126. * @param {Object} options - 组件配置参数。
  59127. * @param {string} options.id - 组件 dom 元素 id。
  59128. * @param {Object} options.title - 属性弹框组件名称。
  59129. * @param {Object} options.attributes - 组件需要显示的属性内容。
  59130. * @extends {SuperMap.Components.PopContainer}
  59131. * @category Components Common
  59132. */
  59133. class AttributesPopContainer extends PopContainer {
  59134. constructor(options) {
  59135. //默认为属性:
  59136. options.title = options.title ? options.title : "属性";
  59137. super(options);
  59138. this.rootContainer.firstChild.hidden = true;
  59139. options.attributes = options.attributes ? options.attributes : [];
  59140. this._createAttributesTable(options.attributes);
  59141. }
  59142. _createAttributesTable(attributes) {
  59143. const table = document.createElement("table");
  59144. table.setAttribute("class", "component-popcontainer__content__table");
  59145. const tbody = document.createElement("tbody");
  59146. let single = true;
  59147. for (let name in attributes) {
  59148. const tr = document.createElement("tr");
  59149. if (single) {
  59150. tr.setAttribute("class", "component-popcontainer__content__td--color");
  59151. }
  59152. const title = document.createElement("td");
  59153. const titleSpan = document.createElement("Span");
  59154. titleSpan.innerHTML = name;
  59155. title.appendChild(titleSpan);
  59156. const value = document.createElement("td");
  59157. value.innerHTML = attributes[name];
  59158. tr.appendChild(title);
  59159. tr.appendChild(value);
  59160. tbody.appendChild(tr);
  59161. single = !single;
  59162. }
  59163. table.appendChild(tbody);
  59164. this.appendContent(table);
  59165. }
  59166. }
  59167. SuperMap.Components.AttributesPopContainer = AttributesPopContainer;
  59168. ;// CONCATENATED MODULE: ./src/common/components/templates/IndexTabsPageContainer.js
  59169. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  59170. * This program are made available under the terms of the Apache License, Version 2.0
  59171. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59172. /**
  59173. * @class SuperMap.Components.IndexTabsPageContainer
  59174. * @description 标签索引组件。
  59175. * @version 9.1.1
  59176. * @param {Object} options - 可选参数。
  59177. * @param {string} options.id - 组件 dom 元素 id。
  59178. * @category Components Common
  59179. * @extends {SuperMap.Components.TemplateBase}
  59180. */
  59181. class IndexTabsPageContainer extends TemplateBase {
  59182. constructor(options) {
  59183. super(options);
  59184. this._initView();
  59185. }
  59186. /**
  59187. * @private
  59188. * @override
  59189. */
  59190. _initView() {
  59191. const container = document.createElement("div");
  59192. container.setAttribute("class", "component-tabpage");
  59193. const header = document.createElement("ul");
  59194. this.header = header;
  59195. const content = document.createElement("div");
  59196. content.setAttribute("class", "component-tabpage__content");
  59197. this.content = content;
  59198. container.appendChild(header);
  59199. container.appendChild(content);
  59200. this.rootContainer = container;
  59201. }
  59202. /**
  59203. * @function SuperMap.Components.IndexTabsPageContainer.prototype.setTabs
  59204. * @description 设置标签元素。
  59205. * @param {Array.<Element>} tabs
  59206. */
  59207. setTabs(tabs) {
  59208. this.removeAllTabs();
  59209. this.appendTabs(tabs);
  59210. }
  59211. /**
  59212. * @function SuperMap.Components.IndexTabsPageContainer.prototype.appendTabs
  59213. * @description 追加标签元素。
  59214. * @param {Array.<Element>} tabs
  59215. */
  59216. appendTabs(tabs) {
  59217. for (let i = 0; i < tabs.length; i++) {
  59218. let title = document.createElement("span");
  59219. title.index = i;
  59220. title.appendChild(document.createTextNode(tabs[i].title));
  59221. //绑定标签切换对应页面:
  59222. title.onclick = this._changeTabsPage.bind(this);
  59223. let content = tabs[i].content;
  59224. content.index = i;
  59225. content.hidden = true;
  59226. this.header.appendChild(title);
  59227. this.content.appendChild(content);
  59228. }
  59229. //todo 确认是否两个子元素的 index 相互对应
  59230. //默认显示第一个标签对象
  59231. this.header.firstChild.setAttribute("class", "on");
  59232. this.content.firstChild.hidden = false;
  59233. }
  59234. /**
  59235. * @function SuperMap.Components.IndexTabsPageContainer.prototype.removeTab
  59236. * @description 删除某个标签页面。
  59237. * @param {number} index - 标签索引号。
  59238. */
  59239. removeTab(index) {
  59240. this.header.removeChild(this.header.children[index]);
  59241. this.content.removeChild(this.content.children[index]);
  59242. }
  59243. /**
  59244. * @function SuperMap.Components.IndexTabsPageContainer.prototype.removeAllTabs
  59245. * @description 删除所有标签。
  59246. */
  59247. removeAllTabs() {
  59248. for (let i = this.header.children.length; i > 0; i--) {
  59249. this.header.removeChild(this.header.children[i]);
  59250. this.content.removeChild(this.content.children[i]);
  59251. }
  59252. }
  59253. _changeTabsPage(e) {
  59254. const index = e.target.index;
  59255. for (let i = 0; i < this.header.children.length; i++) {
  59256. this.header.children[i].setAttribute("class", "");
  59257. this.content.children[i].hidden = true;
  59258. if (i === index) {
  59259. this.header.children[i].setAttribute("class", "on");
  59260. this.content.children[i].hidden = false;
  59261. }
  59262. }
  59263. }
  59264. }
  59265. SuperMap.Components.IndexTabsPageContainer = IndexTabsPageContainer;
  59266. ;// CONCATENATED MODULE: ./src/common/components/templates/CityTabsPage.js
  59267. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  59268. * This program are made available under the terms of the Apache License, Version 2.0
  59269. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59270. /**
  59271. * @class SuperMap.Components.CityTabsPage
  59272. * @classdesc 城市地址匹配组件模板
  59273. * @version 9.1.1
  59274. * @param {Object} options - 组件配置参数。
  59275. * @param {string} options.id - 组件 dom 元素 id。
  59276. * @param {Object|Array.<string>} options.config - 城市名称配置列表,支持两种格式:{key1:{A:[],B:[]}, key2:{C:[],D:[]}} 或
  59277. * ["成都市","北京市"],用户可根据自己的项目需求进行配置
  59278. * @extends {SuperMap.Components.IndexTabsPageContainer}
  59279. * @category Components Common
  59280. */
  59281. class CityTabsPage extends IndexTabsPageContainer {
  59282. constructor(options) {
  59283. super(options);
  59284. //去掉默认的边框阴影样式:
  59285. this.rootContainer.classList.add("component-citytabpage--noneBoxShadow");
  59286. this.config = options.config;
  59287. //header,若 config为城市名称数组,则直接加载内容
  59288. if (Util.isArray(this.config)) {
  59289. this.header.hidden = true;
  59290. this._createCityItem("城市", this.config);
  59291. this.content.style.border = "none";
  59292. } else {
  59293. this._createTabs();
  59294. this.header.onclick = (e) => {
  59295. //关闭所有元素 是否有更简化的写法?
  59296. for (let i = 0; i < this.header.children.length; i++) {
  59297. this.header.children[i].setAttribute("class", "");
  59298. }
  59299. //打开点击内容元素
  59300. e.target.setAttribute("class", "on");
  59301. this._createCityContent(e.target.innerHTML);
  59302. };
  59303. }
  59304. }
  59305. /**
  59306. * @function SuperMap.Components.CityTabsPage.prototype._createTabs
  59307. * @description 创建 Tabs
  59308. * @private
  59309. */
  59310. _createTabs() {
  59311. //header
  59312. if (Util.isArray(this.config)) {
  59313. for (let i = 0; i < this.config.length; i++) {
  59314. let innerHTML = "";
  59315. for (const key in this.config[i]) {
  59316. innerHTML += key;
  59317. }
  59318. let li = document.createElement("li");
  59319. li.innerHTML = innerHTML;
  59320. this.header.appendChild(li);
  59321. }
  59322. } else {
  59323. for (const key in this.config) {
  59324. let li = document.createElement("li");
  59325. li.innerHTML = key;
  59326. this.header.appendChild(li);
  59327. }
  59328. }
  59329. this.header.firstChild.setAttribute("class", "on");
  59330. this._createCityContent(this.header.firstChild.innerHTML);
  59331. }
  59332. /**
  59333. * @function SuperMap.Components.CityTabsPage.prototype._createCityContent
  59334. * @description 创建列表容器
  59335. * @private
  59336. */
  59337. _createCityContent(keyName) {
  59338. //清除元素:
  59339. for (let i = this.content.children.length; i > 0; i--) {
  59340. this.content.removeChild(this.content.children[i - 1]);
  59341. }
  59342. //创建对应元素
  59343. const cities = this.config[keyName];
  59344. for (let key in cities) {
  59345. this._createCityItem(key, cities[key]);
  59346. }
  59347. }
  59348. /**
  59349. * @function SuperMap.Components.CityTabsPage.prototype._createCityContent
  59350. * @description 创建列表容器
  59351. * @private
  59352. */
  59353. _createCityItem(key, cities) {
  59354. const city = document.createElement("div");
  59355. const cityClass = document.createElement("div");
  59356. cityClass.setAttribute("class", "component-citytabpag__py-key");
  59357. cityClass.innerHTML = key;
  59358. city.appendChild(cityClass);
  59359. const cityContent = document.createElement("div");
  59360. cityContent.setAttribute("class", "component-citytabpag__content");
  59361. for (let i = 0; i < cities.length; i++) {
  59362. let span = document.createElement("span");
  59363. span.innerHTML = cities[i];
  59364. cityContent.appendChild(span);
  59365. }
  59366. //HOT 元素长度单独微调:
  59367. if (key === "HOT") {
  59368. cityContent.style.width = "428px";
  59369. }
  59370. city.appendChild(cityContent);
  59371. this.content.appendChild(city);
  59372. }
  59373. }
  59374. SuperMap.Components.CityTabsPage = CityTabsPage;
  59375. ;// CONCATENATED MODULE: ./src/common/components/templates/NavTabsPage.js
  59376. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  59377. * This program are made available under the terms of the Apache License, Version 2.0
  59378. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59379. /**
  59380. * @class SuperMap.Components.NavTabsPage
  59381. * @classdesc 标签页面组件。
  59382. * @version 9.1.1
  59383. * @param {Object} options - 组件配置参数。
  59384. * @param {string} optionsArr.id - 组件 dom 元素 id。
  59385. * @param {Array.<Object>} [options.tabs=[]] - 标签对象数组,形如:[{title: "",content: HTMLElement}],初始时,传入则创建页面。
  59386. * @extends {SuperMap.Components.TemplateBase}
  59387. * @category Components Common
  59388. */
  59389. // todo 思考拆分的控件应该以哪种方式使用
  59390. class NavTabsPage extends TemplateBase {
  59391. constructor(options) {
  59392. super(options);
  59393. this.navTabsTitle = null;
  59394. this.navTabsContent = null;
  59395. options.tabs = options.tabs ? options.tabs : [];
  59396. this._initView(options.tabs);
  59397. }
  59398. /**
  59399. * @override
  59400. * @private
  59401. */
  59402. _initView(tabs) {
  59403. const navTabsPage = document.createElement("div");
  59404. navTabsPage.setAttribute("class", "component-navtabspage");
  59405. //关闭按钮
  59406. const closeBtn = document.createElement("span");
  59407. closeBtn.setAttribute("class", "supermapol-icons-close");
  59408. closeBtn.onclick = this.closeView.bind(this);
  59409. navTabsPage.appendChild(closeBtn);
  59410. //标签
  59411. const navTabsTitle = document.createElement("div");
  59412. this.navTabsTitle = navTabsTitle;
  59413. navTabsTitle.setAttribute("class", "component-navtabspage__title");
  59414. navTabsPage.appendChild(navTabsTitle);
  59415. //内容
  59416. const navTabsContent = document.createElement("div");
  59417. this.navTabsContent = navTabsContent;
  59418. navTabsContent.setAttribute("class", "component-navtabspage__content");
  59419. navTabsPage.appendChild(navTabsContent);
  59420. //若 tabs 初始传入值,则
  59421. if (tabs.length > 0) {
  59422. this.appendTabs(tabs);
  59423. }
  59424. this.rootContainer = navTabsPage;
  59425. }
  59426. /**
  59427. * @function SuperMap.Components.NavTabsPage.prototype.setTabs
  59428. * @description 设置标签。
  59429. * @param {Array.<Object>} tabs - 标签对象数组,形如:[{title: "",content: {}}]。
  59430. */
  59431. setTabs(tabs) {
  59432. this.removeAllTabs();
  59433. this.appendTabs(tabs);
  59434. }
  59435. /**
  59436. * @function SuperMap.Components.NavTabsPage.prototype.appendTabs
  59437. * @description 添加标签页面。
  59438. * @param {Array.<Object>} tabs - 标签对象数组,形如:[{title: "",content: {}}]。
  59439. */
  59440. appendTabs(tabs) {
  59441. for (let i = 0; i < tabs.length; i++) {
  59442. let title = document.createElement("span");
  59443. title.index = i;
  59444. title.appendChild(document.createTextNode(tabs[i].title));
  59445. //绑定标签切换对应页面:
  59446. title.onclick = this._changeTabsPage.bind(this);
  59447. let content = tabs[i].content;
  59448. content.index = i;
  59449. content.hidden = true;
  59450. this.navTabsTitle.appendChild(title);
  59451. this.navTabsContent.appendChild(content);
  59452. }
  59453. //todo 确认是否两个子元素的 index 相互对应
  59454. //默认显示第一个标签对象
  59455. this.navTabsTitle.firstChild.setAttribute("class", "component-navtabspage__tabs--select");
  59456. this.navTabsContent.firstChild.hidden = false;
  59457. }
  59458. /**
  59459. * @function SuperMap.Components.NavTabsPage.prototype.removeTab
  59460. * @description 删除某个标签页面。
  59461. * @param {number} index - 标签索引号。
  59462. */
  59463. removeTab(index) {
  59464. this.navTabsTitle.removeChild(this.navTabsTitle.children[index]);
  59465. this.navTabsContent.removeChild(this.navTabsContent.children[index]);
  59466. }
  59467. /**
  59468. * @function SuperMap.Components.NavTabsPage.prototype.removeAllTabs
  59469. * @description 删除所有标签。
  59470. */
  59471. removeAllTabs() {
  59472. for (let i = this.navTabsTitle.children.length; i > 0; i--) {
  59473. this.navTabsTitle.removeChild(this.navTabsTitle.children[i]);
  59474. this.navTabsContent.removeChild(this.navTabsContent.children[i]);
  59475. }
  59476. }
  59477. _changeTabsPage(e) {
  59478. const index = e.target.index;
  59479. for (let i = 0; i < this.navTabsTitle.children.length; i++) {
  59480. this.navTabsTitle.children[i].setAttribute("class", "");
  59481. this.navTabsContent.children[i].hidden = true;
  59482. if (i === index) {
  59483. this.navTabsTitle.children[i].setAttribute("class", "component-navtabspage__tabs--select");
  59484. this.navTabsContent.children[i].hidden = false;
  59485. }
  59486. }
  59487. }
  59488. }
  59489. SuperMap.Components.NavTabsPage = NavTabsPage;
  59490. ;// CONCATENATED MODULE: ./src/common/components/templates/PaginationContainer.js
  59491. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  59492. * This program are made available under the terms of the Apache License, Version 2.0
  59493. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59494. /**
  59495. * @class SuperMap.Components.PaginationContainer
  59496. * @classdesc 分页组件模板。
  59497. * @version 9.1.1
  59498. * @param {Object} options - 组件配置参数。
  59499. * @param {string} optionsArr.id - 组件 dom 元素 id。
  59500. * @param {HTMLElement} options.contents - 页面填充的 DOM 元素对象。
  59501. * @param {number} options.pageCounts - 页数。
  59502. * @extends {SuperMap.Components.TemplateBase}
  59503. * @category Components Common
  59504. */
  59505. class PaginationContainer extends TemplateBase {
  59506. constructor(options) {
  59507. options = options ? options : {};
  59508. super(options);
  59509. this.currentPage = 0;
  59510. this.pageNumberLis = [];
  59511. this.currentPageNumberLis = [];
  59512. this.linkageEvent = null;
  59513. options.contents = options.contents ? options.contents : null;
  59514. options.pageCounts = options.pageCounts ? options.pageCounts : 0;
  59515. this._initView(options.contents, options.pageCounts);
  59516. }
  59517. /**
  59518. * @function SuperMap.Components.PaginationContainer.prototype.setLinkageEvent
  59519. * @description 设置页面联动方法。
  59520. * @param {function} linkageEvent - 联动方法,实现指定功能。
  59521. */
  59522. setLinkageEvent(linkageEvent) {
  59523. this.linkageEvent = linkageEvent;
  59524. }
  59525. /**
  59526. * @private
  59527. * @override
  59528. */
  59529. _initView(contents, pageCounts) {
  59530. const container = document.createElement("div");
  59531. container.setAttribute("class", "component-pagination");
  59532. //content
  59533. const content = document.createElement("div");
  59534. content.setAttribute("class", "component-pagination__content");
  59535. container.appendChild(content);
  59536. this.content = content;
  59537. //link
  59538. const link = document.createElement("ul");
  59539. link.setAttribute("class", "component-pagination__link");
  59540. link.onclick = this._changePageEvent.bind(this);
  59541. container.appendChild(link);
  59542. this._createLink(link);
  59543. this.link = link;
  59544. //填充内容:
  59545. if (contents) {
  59546. this.setContent(contents);
  59547. }
  59548. if (pageCounts !== 0) {
  59549. this.setPageLink(pageCounts);
  59550. }
  59551. this.rootContainer = container;
  59552. }
  59553. /**---------以下是页面相关操作 **/
  59554. /**
  59555. * @function SuperMap.Components.PaginationContainer.prototype.setContent
  59556. * @description 设置页面内容。
  59557. * @param {Element} element - 页面内容元素。
  59558. */
  59559. setContent(element) {
  59560. this.clearContent();
  59561. this.appendContent(element);
  59562. }
  59563. /**
  59564. * @function SuperMap.Components.PaginationContainer.prototype.appendContent
  59565. * @description 追加内容。
  59566. * @param {Element} element - 页面内容元素。
  59567. */
  59568. appendContent(element) {
  59569. this.content.appendChild(element);
  59570. }
  59571. /**
  59572. * @function SuperMap.Components.PaginationContainer.prototype.clearContent
  59573. * @description 清空内容元素。
  59574. */
  59575. clearContent() {
  59576. for (let i = this.content.children.length - 1; i >= 0; i--) {
  59577. this.content.removeChild(this.content.children[i]);
  59578. }
  59579. }
  59580. /** -----以下是页码相关的操作:**/
  59581. /**
  59582. * @function SuperMap.Components.PaginationContainer.prototype.setPageLink
  59583. * @description 设置页码数。
  59584. * @param {number} pageNumber - 页码数。
  59585. */
  59586. setPageLink(pageNumber) {
  59587. //清空当前页码
  59588. this.pageNumberLis = [];
  59589. this.currentPageNumberLis = [];
  59590. this.clearPageLink();
  59591. //创建页码
  59592. this._createPageLi(pageNumber);
  59593. //添加页码到页码列表
  59594. this._appendPageLink();
  59595. }
  59596. /**
  59597. * @description 创建页码。
  59598. * @param pageNumber
  59599. * @private
  59600. */
  59601. _createPageLi(pageNumber) {
  59602. for (let i = 0; i < pageNumber; i++) {
  59603. const pageLi = document.createElement("li");
  59604. pageLi.innerHTML = i + 1;
  59605. /*const liContent = document.createElement("span");
  59606. liContent.innerHTML = i + 1;*/
  59607. // pageLi.appendChild(liContent);
  59608. this.pageNumberLis.push(pageLi);
  59609. }
  59610. this.pageNumberLis[0].setAttribute("class", "active");
  59611. this.currentPage = 1;
  59612. if (pageNumber < 5) {
  59613. this.currentPageNumberLis = this.pageNumberLis;
  59614. } else {
  59615. for (let i = 0; i < 5; i++) {
  59616. this.currentPageNumberLis.push(this.pageNumberLis[i]);
  59617. }
  59618. }
  59619. }
  59620. /**
  59621. * @description 添加页码到页码列表。
  59622. * @private
  59623. */
  59624. _appendPageLink() {
  59625. //todo 如何插入中间
  59626. for (let i = 0; i < this.currentPageNumberLis.length; i++) {
  59627. this.link.insertBefore(this.currentPageNumberLis[i], this.link.childNodes[this.link.children.length - 2]);
  59628. }
  59629. for (let i = 0; i < this.currentPageNumberLis.length; i++) {
  59630. //清空 active 状态
  59631. this.currentPageNumberLis[i].setAttribute("class", "");
  59632. //给当前选中的 li 赋值 active 状态
  59633. if (Number(this.currentPageNumberLis[i].innerHTML) === this.currentPage) {
  59634. this.currentPageNumberLis[i].setAttribute("class", "active");
  59635. }
  59636. }
  59637. //根据 currentPage 改变按钮状态
  59638. this._changeDisableState();
  59639. if (this.linkageEvent) {
  59640. this.linkageEvent(this.currentPage);
  59641. }
  59642. }
  59643. /**
  59644. * @function SuperMap.Components.PaginationContainer.prototype.clearPageLink
  59645. * @description 清除页码列表。
  59646. */
  59647. clearPageLink() {
  59648. for (let i = this.link.children.length - 3; i > 1; i--) {
  59649. this.link.removeChild(this.link.children[i]);
  59650. }
  59651. }
  59652. /**
  59653. * @description 创建页码按钮。
  59654. * @param ul
  59655. * @private
  59656. */
  59657. _createLink(ul) {
  59658. for (let i = 0; i < 4; i++) {
  59659. const li = document.createElement("li");
  59660. li.setAttribute("class", "disable");
  59661. const liContent = document.createElement("span");
  59662. li.appendChild(liContent);
  59663. if (i === 0) {
  59664. liContent.id = "first";
  59665. liContent.setAttribute("class", "supermapol-icons-first");
  59666. } else if (i === 1) {
  59667. liContent.id = "prev";
  59668. liContent.setAttribute("class", "supermapol-icons-prev");
  59669. } else if (i === 2) {
  59670. liContent.id = "next";
  59671. liContent.setAttribute("class", "supermapol-icons-next");
  59672. } else if (i === 3) {
  59673. liContent.id = "last";
  59674. liContent.setAttribute("class", "supermapol-icons-last");
  59675. }
  59676. ul.appendChild(li);
  59677. }
  59678. }
  59679. /**
  59680. * @description 点击页码事件。
  59681. * @param e
  59682. * @private
  59683. */
  59684. _changePageEvent(e) {
  59685. //todo
  59686. const trigger = e.target;
  59687. //若列表禁用,点击无效
  59688. if (trigger.parentElement.classList[0] === "disable") {
  59689. return;
  59690. }
  59691. let targetLi;
  59692. if (trigger.id) {
  59693. targetLi = trigger.id;
  59694. } else if (Number(trigger.innerHTML)) {
  59695. targetLi = Number(trigger.innerHTML);
  59696. } else {
  59697. return;
  59698. }
  59699. //页码预处理:
  59700. this._prePageNum(targetLi);
  59701. //根据 currentPageNumberLis 创建页码列表
  59702. this.clearPageLink();
  59703. this._appendPageLink();
  59704. }
  59705. /**
  59706. * @description 根据 currentPage 改变按钮状态。
  59707. * @private
  59708. */
  59709. _changeDisableState() {
  59710. this.link.children[0].setAttribute("class", "");
  59711. this.link.children[1].setAttribute("class", "");
  59712. this.link.children[this.link.children.length - 1].setAttribute("class", "");
  59713. this.link.children[this.link.children.length - 2].setAttribute("class", "");
  59714. if (this.currentPage === 1) {
  59715. this.link.children[0].setAttribute("class", "disable");
  59716. this.link.children[1].setAttribute("class", "disable");
  59717. }
  59718. if (this.currentPage === this.pageNumberLis.length) {
  59719. this.link.children[this.link.children.length - 1].setAttribute("class", "disable");
  59720. this.link.children[this.link.children.length - 2].setAttribute("class", "disable");
  59721. }
  59722. }
  59723. /**
  59724. * @description 根据点击页码列表事件准备需展现的页码列表。
  59725. * @param {string|number} targetLi - 被点击的列表对象 id 或 被点击的页码值。
  59726. * @private
  59727. */
  59728. _prePageNum(targetLi) {
  59729. const currentPageNumberLis = [];
  59730. if (targetLi === "first") {
  59731. this.currentPage = 1;
  59732. } else if (targetLi === "last") {
  59733. this.currentPage = this.pageNumberLis.length;
  59734. } else if (targetLi === "prev") {
  59735. this.currentPage = this.currentPage - 1;
  59736. } else if (targetLi === "next") {
  59737. this.currentPage = this.currentPage + 1;
  59738. } else {
  59739. this.currentPage = targetLi;
  59740. }
  59741. if (this.pageNumberLis.length <= 5) {
  59742. for (let i = 0; i < this.pageNumberLis.length; i++) {
  59743. currentPageNumberLis.push(this.pageNumberLis[i]);
  59744. }
  59745. } else {
  59746. //当前点击前三,都取前五
  59747. if (this.currentPage <= 3) {
  59748. for (let i = 0; i < 5; i++) {
  59749. currentPageNumberLis.push(this.pageNumberLis[i]);
  59750. }
  59751. } else if (this.currentPage >= this.pageNumberLis.length - 3) {
  59752. //点击后三,都取后5
  59753. for (let i = this.pageNumberLis.length - 5; i < this.pageNumberLis.length; i++) {
  59754. currentPageNumberLis.push(this.pageNumberLis[i]);
  59755. }
  59756. } else {
  59757. //其他,取中间:
  59758. for (let i = this.currentPage - 3; i <= this.currentPage + 1; i++) {
  59759. currentPageNumberLis.push(this.pageNumberLis[i]);
  59760. }
  59761. }
  59762. }
  59763. if (currentPageNumberLis.length > 0) {
  59764. this.currentPageNumberLis = currentPageNumberLis;
  59765. }
  59766. }
  59767. }
  59768. SuperMap.Components.PaginationContainer = PaginationContainer;
  59769. ;// CONCATENATED MODULE: ./src/common/components/util/Util.js
  59770. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  59771. * This program are made available under the terms of the Apache License, Version 2.0
  59772. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59773. let ComponentsUtil = {
  59774. /**
  59775. * 获取上传文件类型
  59776. * @param fileName
  59777. */
  59778. getFileType(fileName) {
  59779. let regCSV = /^.*\.(?:csv)$/i;
  59780. let regExcel = /^.*\.(?:xls|xlsx)$/i; //文件名可以带空格
  59781. let regGeojson = /^.*\.(?:geojson|json)$/i;
  59782. if (regExcel.test(fileName)) { //校验不通过
  59783. return FileTypes.EXCEL;
  59784. } else if (regCSV.test(fileName)) {
  59785. return FileTypes.CSV;
  59786. } else if (regGeojson.test(fileName)) {
  59787. return FileTypes.GEOJSON;
  59788. }
  59789. return null;
  59790. }
  59791. };
  59792. ;// CONCATENATED MODULE: ./src/common/components/util/index.js
  59793. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  59794. * This program are made available under the terms of the Apache License, Version 2.0
  59795. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59796. ;// CONCATENATED MODULE: ./src/common/components/index.js
  59797. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  59798. * This program are made available under the terms of the Apache License, Version 2.0
  59799. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59800. //数据
  59801. //组件
  59802. //提示框组件
  59803. //图表组件
  59804. //公用模板:
  59805. //工具类
  59806. ;// CONCATENATED MODULE: ./src/common/lang/locales/en-US.js
  59807. 
  59808. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  59809. * This program are made available under the terms of the Apache License, Version 2.0
  59810. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59811. /**
  59812. * Namespace: SuperMap.Lang["en"]
  59813. * Dictionary for English. Keys for entries are used in calls to
  59814. * <SuperMap.Lang.translate>. Entry bodies are normal strings or
  59815. * strings formatted for use with <SuperMap.String.format> calls.
  59816. */
  59817. let en = {
  59818. 'title_dataFlowService': 'Data Flow Service',
  59819. 'title_distributedAnalysis': 'Distributed Analysis',
  59820. 'title_clientComputing': 'Client Computing',
  59821. 'title_dataServiceQuery': 'Data Service Query',
  59822. 'title_searchCity':'Search city',
  59823. 'title_searchLayer':' Search layer',
  59824. 'text_input_value_inputDataFlowUrl': 'Please enter the data stream service address such as: ws://{serviceRoot}/{dataFlowName}/dataflow/subscribe',
  59825. 'text_displayFeaturesInfo': 'Display feature information',
  59826. 'text_subscribe': 'subscribe',
  59827. 'text_cancelSubscribe': 'unsubscribe',
  59828. 'text_densityAnalysis': 'Density Analysis',
  59829. 'text_CalculateTheValuePerUnitArea': 'Calculate the value per unit area within the neighborhood shape',
  59830. 'text_option_selectDataset':'Please select a dataset',
  59831. 'text_label_dataset': 'Dataset',
  59832. 'text_option_simplePointDensityAnalysis': 'Simple point density analysis',
  59833. 'text_option_nuclearDensityAnalysis': 'Nuclear density analysis',
  59834. 'text_label_analyticalMethod': 'Analytical method',
  59835. 'text_option_quadrilateral': 'Quadrilateral',
  59836. 'text_option_hexagon': 'hexagon',
  59837. 'text_label_meshType': 'Mesh type',
  59838. 'text_option_notSet': 'Not set',
  59839. 'text_label_weightField': 'Weight field',
  59840. 'text_label_gridSizeInMeters': 'Grid size',
  59841. 'text_label_searchRadius': 'Search radius',
  59842. 'text_label_queryRange': 'Scope of analysis',
  59843. 'text_label_areaUnit': 'Area unit',
  59844. 'text_option_equidistantSegmentation': 'Equidistant segmentation',
  59845. 'text_option_logarithm': 'Logarithm',
  59846. 'text_option_equalCountingSegment': 'Equal counting segment',
  59847. 'text_option_squareRootSegmentation': 'Square root segmentation',
  59848. 'text_label_thematicMapSegmentationMode': 'Thematic map segmentation mode',
  59849. 'text_label_thematicMapSegmentationParameters': 'Thematic map segmentation parameters',
  59850. 'text_option_greenOrangePurpleGradient': 'Green orange purple gradient',
  59851. 'text_option_greenOrangeRedGradient': 'Green orange red gradient',
  59852. 'text_option_rainbowGradient': 'Rainbow gradient',
  59853. 'text_option_spectralGradient': 'Spectral gradient',
  59854. 'text_option_terrainGradient': 'Terrain gradient',
  59855. 'text_label_thematicMapColorGradientMode': 'Thematic map color gradient mode',
  59856. 'text_label_resultLayerName': 'Result layer name',
  59857. 'text_chooseFile': 'Open File',
  59858. 'text_isoline': 'Isoline',
  59859. 'text_extractDiscreteValue': 'Extract discrete value generation curve',
  59860. 'text_buffer': 'Buffer',
  59861. 'text_specifyTheDistance': 'Specify the distance to create the surrounding area',
  59862. 'text_label_analysisLayer': 'Analysis layer',
  59863. 'text_label_extractField': 'Extract field',
  59864. 'text_label_extractedValue': 'Extracted value',
  59865. 'text_label_distanceAttenuation': 'Distance attenuation',
  59866. 'text_label_gridSize': 'gridSize',
  59867. 'text_label_bufferRadius': 'Buffer radius',
  59868. 'text_label_defaultkilometers': 'Default 10 kilometers',
  59869. 'text_label_kilometer': 'kilometer',
  59870. 'text_label_unit': 'unit',
  59871. 'text_retainOriginal': 'Retain original object field',
  59872. 'text_mergeBuffer': 'Merge buffer',
  59873. 'text_label_color': 'Color',
  59874. 'text_label_buffer': '[Buffer]',
  59875. 'text_label_isolines': '[Isolines]',
  59876. 'text_label_queryRangeTips': 'The default is the full range of input data. Example: -74.050, 40.650, -73.850, 40.850',
  59877. 'text_label_queryModel': 'Query mode',
  59878. 'text_label_IDArrayOfFeatures': 'ID array of features',
  59879. 'text_label_maxFeatures': 'The maximum number of features that can be returned',
  59880. 'text_label_bufferDistance': 'Buffer distance',
  59881. 'text_label_queryRange1': 'Query range',
  59882. 'text_label_spatialQueryMode': 'Spatial query mode',
  59883. 'text_label_featureFilter': 'Feature filter',
  59884. 'text_label_geometricObject': 'Geometric object',
  59885. 'text_label_queryMode': 'Query mode',
  59886. 'text_label_searchTips': 'Search for city locations or layer features',
  59887. 'text_label_chooseSearchLayers': 'Select a query layer',
  59888. 'text_loadSearchCriteria': 'Load search criteria',
  59889. 'text_saveSearchCriteria': 'Save search criteria',
  59890. "btn_analyze": "Analyze",
  59891. "btn_analyzing": "Analyzing",
  59892. "btn_emptyTheAnalysisLayer": "Empty the analysis layer",
  59893. "btn_cancelAnalysis": "Cancel",
  59894. "btn_query": "Query",
  59895. "btn_querying": "Querying",
  59896. "btn_emptyTheRresultLayer": "Clear all result layers",
  59897. 'msg_dataReturnedIsEmpty.': 'The request is successful and the data returned by the query is empty.',
  59898. 'msg_dataFlowServiceHasBeenSubscribed': 'The data stream service has been subscribed to.',
  59899. 'msg_inputDataFlowUrlFirst': 'Please enter the data stream service address first.',
  59900. 'msg_datasetOrMethodUnsupport': 'This dataset does not support this analysis type. Please reselect the dataset.',
  59901. 'msg_selectDataset': 'Please select a data set!',
  59902. 'msg_setTheWeightField': 'Please set the weight field!',
  59903. 'msg_theFieldNotSupportAnalysis': 'The field you currently select does not support analysis!',
  59904. 'msg_resultIsEmpty': 'The result of the analysis is empty!',
  59905. 'msg_openFileFail': 'Failed to open file!',
  59906. 'msg_fileTypeUnsupported': 'File format is not supported!',
  59907. 'msg_fileSizeExceeded': 'File size exceeded! The file size should not exceed 10M!',
  59908. 'msg_dataInWrongGeoJSONFormat': 'Wrong data format! Non standard GEOJSON format data!',
  59909. 'msg_dataInWrongFormat': 'Wrong data format! Non standard EXCEL, CSV or GEOJSON format data!',
  59910. 'msg_searchKeywords': "Search keywords cannot be empty. Please enter your search criteria.",
  59911. 'msg_searchGeocodeField':"Did not match the address matching service data!",
  59912. 'msg_cityGeocodeField':"The address matching service of the current city is not configured.",
  59913. 'msg_getFeatureField':"No related vector features found!",
  59914. 'msg_dataflowservicesubscribed':'The data stream service has been subscribed to.',
  59915. 'msg_subscribesucceeded':'The data stream service subscription was successful.',
  59916. 'msg_crsunsupport':'Does not support the coordinate system of the current map',
  59917. 'msg_tilematrixsetunsupport':'Incoming TileMatrixSet is not supported',
  59918. 'msg_jsonResolveFiled': 'JSON format parsing failure!',
  59919. 'msg_requestContentFiled': 'Failed to request data through iportal!',
  59920. 'msg_getdatafailed': 'Failed to get data!'
  59921. };
  59922. SuperMap.Lang["en-US"] = en;
  59923. ;// CONCATENATED MODULE: ./src/common/lang/locales/zh-CN.js
  59924. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  59925. * This program are made available under the terms of the Apache License, Version 2.0
  59926. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59927. /**
  59928. * Namespace: SuperMap.Lang["zh-CN"]
  59929. * Dictionary for Simplified Chinese. Keys for entries are used in calls to
  59930. * <SuperMap.Lang.translate>. Entry bodies are normal strings or
  59931. * strings formatted for use with <SuperMap.String.format> calls.
  59932. */
  59933. let zh = {
  59934. 'title_dataFlowService': '数据流服务',
  59935. 'title_distributedAnalysis': '分布式分析',
  59936. 'title_clientComputing': '客户端计算',
  59937. 'title_dataServiceQuery': '数据服务查询',
  59938. 'title_searchCity':'搜索城市',
  59939. 'title_searchLayer':'搜索图层',
  59940. 'text_input_value_inputDataFlowUrl': '请输入数据流服务地址如:ws://{serviceRoot}/{dataFlowName}/dataflow/subscribe',
  59941. 'text_displayFeaturesInfo': '显示要素信息',
  59942. 'text_subscribe': '订阅',
  59943. 'text_cancelSubscribe': '取消订阅',
  59944. 'text_densityAnalysis': '密度分析',
  59945. 'text_CalculateTheValuePerUnitArea': '计算点指定邻域形状内的每单位面积量值',
  59946. 'text_option_selectDataset':'请选择数据集',
  59947. 'text_label_dataset': '数据集',
  59948. 'text_option_simplePointDensityAnalysis': '简单点密度分析',
  59949. 'text_option_nuclearDensityAnalysis': '核密度分析',
  59950. 'text_label_analyticalMethod': '分析方法',
  59951. 'text_option_quadrilateral': '四边形',
  59952. 'text_option_hexagon': '六边形',
  59953. 'text_label_meshType': '网格面类型',
  59954. 'text_option_notSet': '未设置',
  59955. 'text_label_weightField': '权重字段',
  59956. 'text_label_gridSizeInMeters': '网格大小',
  59957. 'text_label_searchRadius': '搜索半径',
  59958. 'text_label_queryRange': '分析范围',
  59959. 'text_label_areaUnit': '面积单位',
  59960. 'text_option_equidistantSegmentation': '等距离分段',
  59961. 'text_option_logarithm': '对数',
  59962. 'text_option_equalCountingSegment': '等计数分段',
  59963. 'text_option_squareRootSegmentation': '平方根分段',
  59964. 'text_label_thematicMapSegmentationMode': '专题图分段模式',
  59965. 'text_label_thematicMapSegmentationParameters': '专题图分段参数',
  59966. 'text_option_greenOrangePurpleGradient': '绿橙紫渐变',
  59967. 'text_option_greenOrangeRedGradient': '绿橙红渐变',
  59968. 'text_option_rainbowGradient': '彩虹渐变',
  59969. 'text_option_spectralGradient': '光谱渐变',
  59970. 'text_option_terrainGradient': '地形渐变',
  59971. 'text_label_thematicMapColorGradientMode': '专题图颜色渐变模式',
  59972. 'text_label_resultLayerName': '结果图层名称',
  59973. 'text_chooseFile': '选择文件',
  59974. 'text_isoline': '等值线',
  59975. 'text_extractDiscreteValue': '提取离散值生成曲线',
  59976. 'text_buffer': '缓冲区',
  59977. 'text_specifyTheDistance': '指定距离创建周边区域',
  59978. 'text_label_analysisLayer': '分析图层',
  59979. 'text_label_extractField': '提取字段',
  59980. 'text_label_extractedValue': '提取值',
  59981. 'text_label_distanceAttenuation': '距离衰减',
  59982. 'text_label_gridSize': '栅格大小',
  59983. 'text_label_bufferRadius': '缓冲半径',
  59984. 'text_label_defaultkilometers': '默认10千米',
  59985. 'text_option_kilometer': '千米',
  59986. 'text_label_unit': '单位',
  59987. 'text_retainOriginal': '保留原对象字段属性',
  59988. 'text_mergeBuffer': '合并缓冲区',
  59989. 'text_label_color': '颜色',
  59990. 'text_label_buffer': '[缓冲区]',
  59991. 'text_label_isolines': '[等值线]',
  59992. 'text_label_queryRangeTips': '默认为输入数据的全幅范围。范例:-74.050,40.650,-73.850,40.850',
  59993. 'text_label_IDArrayOfFeatures': '要素 ID 数组',
  59994. 'text_label_maxFeatures': '最多可返回的要素数量',
  59995. 'text_label_bufferDistance': '缓冲区距离',
  59996. 'text_label_queryRange1': '查询范围',
  59997. 'text_label_spatialQueryMode': '空间查询模式',
  59998. 'text_label_featureFilter': '要素过滤器',
  59999. 'text_label_geometricObject': '几何对象',
  60000. 'text_label_queryMode': '查询模式',
  60001. 'text_label_searchTips': '搜索城市地点或图层要素',
  60002. 'text_label_chooseSearchLayers': '选择查询图层',
  60003. 'text_loadSearchCriteria': '加载搜索条件',
  60004. 'text_saveSearchCriteria': '保存搜索条件',
  60005. "btn_analyze": "分析",
  60006. "btn_analyzing": "分析中",
  60007. "btn_emptyTheAnalysisLayer": "清空分析图层",
  60008. "btn_cancelAnalysis": "取消",
  60009. "btn_query": "查询",
  60010. "btn_querying": "查询中",
  60011. "btn_emptyTheRresultLayer": "清除所有结果图层",
  60012. 'msg_dataFlowServiceHasBeenSubscribed': '已订阅该数据流服务。',
  60013. 'msg_inputDataFlowUrlFirst': '请先输入数据流服务地址。',
  60014. 'msg_datasetOrMethodUnsupport': '该数据集不支持本分析类型,请重新选择数据集',
  60015. 'msg_selectDataset': '请选择数据集!',
  60016. 'msg_setTheWeightField': '请设置权重字段!',
  60017. 'msg_theFieldNotSupportAnalysis': '您当前选择的字段不支持分析!',
  60018. 'msg_resultIsEmpty': '分析的结果为空!',
  60019. 'msg_dataReturnedIsEmpty': '请求成功,查询返回的数据为空。',
  60020. 'msg_openFileFail': '打开文件失败!',
  60021. 'msg_fileTypeUnsupported': '不支持该文件格式!',
  60022. 'msg_fileSizeExceeded': '文件大小超限!文件大小不得超过 10M!',
  60023. 'msg_dataInWrongGeoJSONFormat': '数据格式错误!非标准的 GEOJSON 格式数据!',
  60024. 'msg_dataInWrongFormat': '数据格式错误!非标准的 EXCEL, CSV 或 GEOJSON 格式数据!',
  60025. 'msg_searchKeywords': "搜索关键字不能为空,请输入搜索条件。",
  60026. 'msg_searchGeocodeField':"未匹配到地址匹配服务数据!",
  60027. 'msg_cityGeocodeField':"未配置当前城市的地址匹配服务。",
  60028. 'msg_getFeatureField':"未查找到相关矢量要素!",
  60029. 'msg_dataflowservicesubscribed':'已订阅该数据流服务。',
  60030. 'msg_subscribesucceeded':'数据流服务订阅成功。',
  60031. 'msg_crsunsupport':'不支持当前地图的坐标系',
  60032. 'msg_tilematrixsetunsupport':'不支持传入的TileMatrixSet',
  60033. 'msg_jsonResolveFiled': 'json格式解析失败!',
  60034. 'msg_requestContentFiled': '通过iportal请求数据失败!',
  60035. 'msg_getdatafailed': '获取数据失败!'
  60036. };
  60037. SuperMap.Lang["zh-CN"] = zh;
  60038. ;// CONCATENATED MODULE: ./src/common/lang/index.js
  60039. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  60040. * This program are made available under the terms of the Apache License, Version 2.0
  60041. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60042. ;// CONCATENATED MODULE: ./src/common/index.js
  60043. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  60044. * This program are made available under the terms of the Apache License, Version 2.0
  60045. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60046. ;// CONCATENATED MODULE: external "L"
  60047. const external_L_namespaceObject = L;
  60048. var external_L_default = /*#__PURE__*/__webpack_require__.n(external_L_namespaceObject);
  60049. ;// CONCATENATED MODULE: ./src/leaflet/core/NonEarthCRS.js
  60050. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  60051. * This program are made available under the terms of the Apache License, Version 2.0
  60052. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60053. (external_L_default()).Projection = {};
  60054. /**
  60055. * @private
  60056. * @class L.Projection.NonProjection
  60057. * @classdesc 平面无投影对象。
  60058. * @category BaseTypes Projection
  60059. * @extends {L.Class}
  60060. * @param {L.bounds} bounds - 坐标范围
  60061. */
  60062. var NonProjection = external_L_default().Class.extend({
  60063. initialize: function (bounds) {
  60064. this.bounds = bounds;
  60065. },
  60066. project: function (latlng) {
  60067. return new (external_L_default()).Point(latlng.lng, latlng.lat);
  60068. },
  60069. unproject: function (point) {
  60070. return new (external_L_default()).LatLng(point.y, point.x);
  60071. }
  60072. });
  60073. var nonProjection = function (bounds) {
  60074. return new NonProjection(bounds);
  60075. };
  60076. /**
  60077. * @class L.CRS.NonEarthCRS
  60078. * @classdesc 平面无投影坐标类。
  60079. * @category BaseTypes Projection
  60080. * @extends {L.Class}
  60081. * @param {Object} options - 构建平面无投影坐标对象参数。
  60082. * @param {Object} options.origin - 原点。
  60083. * @param {L.bounds} options.bounds - 范围。
  60084. * @param {Array.<number>} [options.resolutions] - 分辨率。
  60085. */
  60086. var NonEarthCRS = external_L_default().Class.extend({
  60087. /**
  60088. * @member {Object} [L.CRS.NonEarthCRS.prototype.includes=L.CRS]
  60089. * @description 包含的坐标对象。
  60090. */
  60091. includes: (external_L_default()).CRS,
  60092. initialize: function (options) {
  60093. if (options.origin) {
  60094. this.transformation = new (external_L_default()).Transformation(1, -options.origin.x, -1, options.origin.y);
  60095. }
  60096. this.projection = external_L_default().Projection.NonProjection(options.bounds);
  60097. this.bounds = options.bounds;
  60098. this.origin = options.origin;
  60099. this.resolutions = options.resolutions;
  60100. },
  60101. /**
  60102. * @function L.CRS.NonEarthCRS.prototype.scale
  60103. * @description 通过缩放级别计算比例尺。
  60104. * @param {number} zoom - 缩放级别。
  60105. * @returns {number} 得到的比例尺。
  60106. */
  60107. scale: function (zoom) {
  60108. let defaultScale;
  60109. if (!this.resolutions || this.resolutions.length === 0) {
  60110. const width = Math.max(this.bounds.getSize().x, this.bounds.getSize().y);
  60111. defaultScale = 1.0 / (width / 256);
  60112. } else {
  60113. defaultScale = 1.0 / this.resolutions[0];
  60114. }
  60115. return defaultScale * Math.pow(2, zoom);
  60116. },
  60117. /**
  60118. * @function L.CRS.NonEarthCRS.prototype.zoom
  60119. * @description 通过比例尺计算范围。
  60120. * @param {number} scale - 比例尺。
  60121. * @returns {number} 返回空间范围值。
  60122. */
  60123. zoom: function (scale) {
  60124. let defaultScale;
  60125. if (!this.resolutions || this.resolutions.length === 0) {
  60126. const width = Math.max(this.bounds.getSize().x, this.bounds.getSize().y);
  60127. defaultScale = 1.0 / (width / 256);
  60128. } else {
  60129. defaultScale = 1.0 / this.resolutions[0];
  60130. }
  60131. return Math.log(scale / defaultScale) / Math.LN2;
  60132. },
  60133. /**
  60134. * @function L.CRS.NonEarthCRS.prototype.distance
  60135. * @description 通过两个坐标点计算之间的距离。
  60136. * @param {L.latLng} latlng1 - 坐标点1。
  60137. * @param {L.latLng} latlng2 - 坐标点2。
  60138. * @returns {number} 返回距离长度。
  60139. */
  60140. distance: function (latlng1, latlng2) {
  60141. var dx = latlng2.lng - latlng1.lng,
  60142. dy = latlng2.lat - latlng1.lat;
  60143. return Math.sqrt(dx * dx + dy * dy);
  60144. },
  60145. infinite: false
  60146. });
  60147. var nonEarthCRS = function (options) {
  60148. return new NonEarthCRS(options);
  60149. };
  60150. (external_L_default()).Projection.NonProjection = nonProjection;
  60151. (external_L_default()).CRS.NonEarthCRS = nonEarthCRS;
  60152. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/global.js
  60153. /* harmony default export */ function global(defs) {
  60154. defs('EPSG:4326', "+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees");
  60155. defs('EPSG:4269', "+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees");
  60156. defs('EPSG:3857', "+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs");
  60157. defs.WGS84 = defs['EPSG:4326'];
  60158. defs['EPSG:3785'] = defs['EPSG:3857']; // maintain backward compat, official code is 3857
  60159. defs.GOOGLE = defs['EPSG:3857'];
  60160. defs['EPSG:900913'] = defs['EPSG:3857'];
  60161. defs['EPSG:102113'] = defs['EPSG:3857'];
  60162. }
  60163. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/constants/values.js
  60164. var PJD_3PARAM = 1;
  60165. var PJD_7PARAM = 2;
  60166. var PJD_WGS84 = 4; // WGS84 or equivalent
  60167. var PJD_NODATUM = 5; // WGS84 or equivalent
  60168. var SEC_TO_RAD = 4.84813681109535993589914102357e-6;
  60169. var HALF_PI = Math.PI/2;
  60170. // ellipoid pj_set_ell.c
  60171. var SIXTH = 0.1666666666666666667;
  60172. /* 1/6 */
  60173. var RA4 = 0.04722222222222222222;
  60174. /* 17/360 */
  60175. var RA6 = 0.02215608465608465608;
  60176. var EPSLN = 1.0e-10;
  60177. // you'd think you could use Number.EPSILON above but that makes
  60178. // Mollweide get into an infinate loop.
  60179. var D2R = 0.01745329251994329577;
  60180. var R2D = 57.29577951308232088;
  60181. var FORTPI = Math.PI/4;
  60182. var TWO_PI = Math.PI * 2;
  60183. // SPI is slightly greater than Math.PI, so values that exceed the -180..180
  60184. // degree range by a tiny amount don't get wrapped. This prevents points that
  60185. // have drifted from their original location along the 180th meridian (due to
  60186. // floating point error) from changing their sign.
  60187. var SPI = 3.14159265359;
  60188. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/constants/PrimeMeridian.js
  60189. var PrimeMeridian_exports = {};
  60190. PrimeMeridian_exports.greenwich = 0.0; //"0dE",
  60191. PrimeMeridian_exports.lisbon = -9.131906111111; //"9d07'54.862\"W",
  60192. PrimeMeridian_exports.paris = 2.337229166667; //"2d20'14.025\"E",
  60193. PrimeMeridian_exports.bogota = -74.080916666667; //"74d04'51.3\"W",
  60194. PrimeMeridian_exports.madrid = -3.687938888889; //"3d41'16.58\"W",
  60195. PrimeMeridian_exports.rome = 12.452333333333; //"12d27'8.4\"E",
  60196. PrimeMeridian_exports.bern = 7.439583333333; //"7d26'22.5\"E",
  60197. PrimeMeridian_exports.jakarta = 106.807719444444; //"106d48'27.79\"E",
  60198. PrimeMeridian_exports.ferro = -17.666666666667; //"17d40'W",
  60199. PrimeMeridian_exports.brussels = 4.367975; //"4d22'4.71\"E",
  60200. PrimeMeridian_exports.stockholm = 18.058277777778; //"18d3'29.8\"E",
  60201. PrimeMeridian_exports.athens = 23.7163375; //"23d42'58.815\"E",
  60202. PrimeMeridian_exports.oslo = 10.722916666667; //"10d43'22.5\"E"
  60203. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/constants/units.js
  60204. /* harmony default export */ const units = ({
  60205. ft: {to_meter: 0.3048},
  60206. 'us-ft': {to_meter: 1200 / 3937}
  60207. });
  60208. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/match.js
  60209. var ignoredChar = /[\s_\-\/\(\)]/g;
  60210. function match(obj, key) {
  60211. if (obj[key]) {
  60212. return obj[key];
  60213. }
  60214. var keys = Object.keys(obj);
  60215. var lkey = key.toLowerCase().replace(ignoredChar, '');
  60216. var i = -1;
  60217. var testkey, processedKey;
  60218. while (++i < keys.length) {
  60219. testkey = keys[i];
  60220. processedKey = testkey.toLowerCase().replace(ignoredChar, '');
  60221. if (processedKey === lkey) {
  60222. return obj[testkey];
  60223. }
  60224. }
  60225. }
  60226. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projString.js
  60227. /* harmony default export */ function projString(defData) {
  60228. var self = {};
  60229. var paramObj = defData.split('+').map(function(v) {
  60230. return v.trim();
  60231. }).filter(function(a) {
  60232. return a;
  60233. }).reduce(function(p, a) {
  60234. var split = a.split('=');
  60235. split.push(true);
  60236. p[split[0].toLowerCase()] = split[1];
  60237. return p;
  60238. }, {});
  60239. var paramName, paramVal, paramOutname;
  60240. var params = {
  60241. proj: 'projName',
  60242. datum: 'datumCode',
  60243. rf: function(v) {
  60244. self.rf = parseFloat(v);
  60245. },
  60246. lat_0: function(v) {
  60247. self.lat0 = v * D2R;
  60248. },
  60249. lat_1: function(v) {
  60250. self.lat1 = v * D2R;
  60251. },
  60252. lat_2: function(v) {
  60253. self.lat2 = v * D2R;
  60254. },
  60255. lat_ts: function(v) {
  60256. self.lat_ts = v * D2R;
  60257. },
  60258. lon_0: function(v) {
  60259. self.long0 = v * D2R;
  60260. },
  60261. lon_1: function(v) {
  60262. self.long1 = v * D2R;
  60263. },
  60264. lon_2: function(v) {
  60265. self.long2 = v * D2R;
  60266. },
  60267. alpha: function(v) {
  60268. self.alpha = parseFloat(v) * D2R;
  60269. },
  60270. lonc: function(v) {
  60271. self.longc = v * D2R;
  60272. },
  60273. x_0: function(v) {
  60274. self.x0 = parseFloat(v);
  60275. },
  60276. y_0: function(v) {
  60277. self.y0 = parseFloat(v);
  60278. },
  60279. k_0: function(v) {
  60280. self.k0 = parseFloat(v);
  60281. },
  60282. k: function(v) {
  60283. self.k0 = parseFloat(v);
  60284. },
  60285. a: function(v) {
  60286. self.a = parseFloat(v);
  60287. },
  60288. b: function(v) {
  60289. self.b = parseFloat(v);
  60290. },
  60291. r_a: function() {
  60292. self.R_A = true;
  60293. },
  60294. zone: function(v) {
  60295. self.zone = parseInt(v, 10);
  60296. },
  60297. south: function() {
  60298. self.utmSouth = true;
  60299. },
  60300. towgs84: function(v) {
  60301. self.datum_params = v.split(",").map(function(a) {
  60302. return parseFloat(a);
  60303. });
  60304. },
  60305. to_meter: function(v) {
  60306. self.to_meter = parseFloat(v);
  60307. },
  60308. units: function(v) {
  60309. self.units = v;
  60310. var unit = match(units, v);
  60311. if (unit) {
  60312. self.to_meter = unit.to_meter;
  60313. }
  60314. },
  60315. from_greenwich: function(v) {
  60316. self.from_greenwich = v * D2R;
  60317. },
  60318. pm: function(v) {
  60319. var pm = match(PrimeMeridian_exports, v);
  60320. self.from_greenwich = (pm ? pm : parseFloat(v)) * D2R;
  60321. },
  60322. nadgrids: function(v) {
  60323. if (v === '@null') {
  60324. self.datumCode = 'none';
  60325. }
  60326. else {
  60327. self.nadgrids = v;
  60328. }
  60329. },
  60330. axis: function(v) {
  60331. var legalAxis = "ewnsud";
  60332. if (v.length === 3 && legalAxis.indexOf(v.substr(0, 1)) !== -1 && legalAxis.indexOf(v.substr(1, 1)) !== -1 && legalAxis.indexOf(v.substr(2, 1)) !== -1) {
  60333. self.axis = v;
  60334. }
  60335. }
  60336. };
  60337. for (paramName in paramObj) {
  60338. paramVal = paramObj[paramName];
  60339. if (paramName in params) {
  60340. paramOutname = params[paramName];
  60341. if (typeof paramOutname === 'function') {
  60342. paramOutname(paramVal);
  60343. }
  60344. else {
  60345. self[paramOutname] = paramVal;
  60346. }
  60347. }
  60348. else {
  60349. self[paramName] = paramVal;
  60350. }
  60351. }
  60352. if(typeof self.datumCode === 'string' && self.datumCode !== "WGS84"){
  60353. self.datumCode = self.datumCode.toLowerCase();
  60354. }
  60355. return self;
  60356. }
  60357. ;// CONCATENATED MODULE: ./node_modules/wkt-parser/parser.js
  60358. /* harmony default export */ const parser = (parseString);
  60359. var NEUTRAL = 1;
  60360. var KEYWORD = 2;
  60361. var NUMBER = 3;
  60362. var QUOTED = 4;
  60363. var AFTERQUOTE = 5;
  60364. var ENDED = -1;
  60365. var whitespace = /\s/;
  60366. var latin = /[A-Za-z]/;
  60367. var keyword = /[A-Za-z84]/;
  60368. var endThings = /[,\]]/;
  60369. var digets = /[\d\.E\-\+]/;
  60370. // const ignoredChar = /[\s_\-\/\(\)]/g;
  60371. function Parser(text) {
  60372. if (typeof text !== 'string') {
  60373. throw new Error('not a string');
  60374. }
  60375. this.text = text.trim();
  60376. this.level = 0;
  60377. this.place = 0;
  60378. this.root = null;
  60379. this.stack = [];
  60380. this.currentObject = null;
  60381. this.state = NEUTRAL;
  60382. }
  60383. Parser.prototype.readCharicter = function() {
  60384. var char = this.text[this.place++];
  60385. if (this.state !== QUOTED) {
  60386. while (whitespace.test(char)) {
  60387. if (this.place >= this.text.length) {
  60388. return;
  60389. }
  60390. char = this.text[this.place++];
  60391. }
  60392. }
  60393. switch (this.state) {
  60394. case NEUTRAL:
  60395. return this.neutral(char);
  60396. case KEYWORD:
  60397. return this.keyword(char)
  60398. case QUOTED:
  60399. return this.quoted(char);
  60400. case AFTERQUOTE:
  60401. return this.afterquote(char);
  60402. case NUMBER:
  60403. return this.number(char);
  60404. case ENDED:
  60405. return;
  60406. }
  60407. };
  60408. Parser.prototype.afterquote = function(char) {
  60409. if (char === '"') {
  60410. this.word += '"';
  60411. this.state = QUOTED;
  60412. return;
  60413. }
  60414. if (endThings.test(char)) {
  60415. this.word = this.word.trim();
  60416. this.afterItem(char);
  60417. return;
  60418. }
  60419. throw new Error('havn\'t handled "' +char + '" in afterquote yet, index ' + this.place);
  60420. };
  60421. Parser.prototype.afterItem = function(char) {
  60422. if (char === ',') {
  60423. if (this.word !== null) {
  60424. this.currentObject.push(this.word);
  60425. }
  60426. this.word = null;
  60427. this.state = NEUTRAL;
  60428. return;
  60429. }
  60430. if (char === ']') {
  60431. this.level--;
  60432. if (this.word !== null) {
  60433. this.currentObject.push(this.word);
  60434. this.word = null;
  60435. }
  60436. this.state = NEUTRAL;
  60437. this.currentObject = this.stack.pop();
  60438. if (!this.currentObject) {
  60439. this.state = ENDED;
  60440. }
  60441. return;
  60442. }
  60443. };
  60444. Parser.prototype.number = function(char) {
  60445. if (digets.test(char)) {
  60446. this.word += char;
  60447. return;
  60448. }
  60449. if (endThings.test(char)) {
  60450. this.word = parseFloat(this.word);
  60451. this.afterItem(char);
  60452. return;
  60453. }
  60454. throw new Error('havn\'t handled "' +char + '" in number yet, index ' + this.place);
  60455. };
  60456. Parser.prototype.quoted = function(char) {
  60457. if (char === '"') {
  60458. this.state = AFTERQUOTE;
  60459. return;
  60460. }
  60461. this.word += char;
  60462. return;
  60463. };
  60464. Parser.prototype.keyword = function(char) {
  60465. if (keyword.test(char)) {
  60466. this.word += char;
  60467. return;
  60468. }
  60469. if (char === '[') {
  60470. var newObjects = [];
  60471. newObjects.push(this.word);
  60472. this.level++;
  60473. if (this.root === null) {
  60474. this.root = newObjects;
  60475. } else {
  60476. this.currentObject.push(newObjects);
  60477. }
  60478. this.stack.push(this.currentObject);
  60479. this.currentObject = newObjects;
  60480. this.state = NEUTRAL;
  60481. return;
  60482. }
  60483. if (endThings.test(char)) {
  60484. this.afterItem(char);
  60485. return;
  60486. }
  60487. throw new Error('havn\'t handled "' +char + '" in keyword yet, index ' + this.place);
  60488. };
  60489. Parser.prototype.neutral = function(char) {
  60490. if (latin.test(char)) {
  60491. this.word = char;
  60492. this.state = KEYWORD;
  60493. return;
  60494. }
  60495. if (char === '"') {
  60496. this.word = '';
  60497. this.state = QUOTED;
  60498. return;
  60499. }
  60500. if (digets.test(char)) {
  60501. this.word = char;
  60502. this.state = NUMBER;
  60503. return;
  60504. }
  60505. if (endThings.test(char)) {
  60506. this.afterItem(char);
  60507. return;
  60508. }
  60509. throw new Error('havn\'t handled "' +char + '" in neutral yet, index ' + this.place);
  60510. };
  60511. Parser.prototype.output = function() {
  60512. while (this.place < this.text.length) {
  60513. this.readCharicter();
  60514. }
  60515. if (this.state === ENDED) {
  60516. return this.root;
  60517. }
  60518. throw new Error('unable to parse string "' +this.text + '". State is ' + this.state);
  60519. };
  60520. function parseString(txt) {
  60521. var parser = new Parser(txt);
  60522. return parser.output();
  60523. }
  60524. ;// CONCATENATED MODULE: ./node_modules/wkt-parser/process.js
  60525. function mapit(obj, key, value) {
  60526. if (Array.isArray(key)) {
  60527. value.unshift(key);
  60528. key = null;
  60529. }
  60530. var thing = key ? {} : obj;
  60531. var out = value.reduce(function(newObj, item) {
  60532. sExpr(item, newObj);
  60533. return newObj
  60534. }, thing);
  60535. if (key) {
  60536. obj[key] = out;
  60537. }
  60538. }
  60539. function sExpr(v, obj) {
  60540. if (!Array.isArray(v)) {
  60541. obj[v] = true;
  60542. return;
  60543. }
  60544. var key = v.shift();
  60545. if (key === 'PARAMETER') {
  60546. key = v.shift();
  60547. }
  60548. if (v.length === 1) {
  60549. if (Array.isArray(v[0])) {
  60550. obj[key] = {};
  60551. sExpr(v[0], obj[key]);
  60552. return;
  60553. }
  60554. obj[key] = v[0];
  60555. return;
  60556. }
  60557. if (!v.length) {
  60558. obj[key] = true;
  60559. return;
  60560. }
  60561. if (key === 'TOWGS84') {
  60562. obj[key] = v;
  60563. return;
  60564. }
  60565. if (key === 'AXIS') {
  60566. if (!(key in obj)) {
  60567. obj[key] = [];
  60568. }
  60569. obj[key].push(v);
  60570. return;
  60571. }
  60572. if (!Array.isArray(key)) {
  60573. obj[key] = {};
  60574. }
  60575. var i;
  60576. switch (key) {
  60577. case 'UNIT':
  60578. case 'PRIMEM':
  60579. case 'VERT_DATUM':
  60580. obj[key] = {
  60581. name: v[0].toLowerCase(),
  60582. convert: v[1]
  60583. };
  60584. if (v.length === 3) {
  60585. sExpr(v[2], obj[key]);
  60586. }
  60587. return;
  60588. case 'SPHEROID':
  60589. case 'ELLIPSOID':
  60590. obj[key] = {
  60591. name: v[0],
  60592. a: v[1],
  60593. rf: v[2]
  60594. };
  60595. if (v.length === 4) {
  60596. sExpr(v[3], obj[key]);
  60597. }
  60598. return;
  60599. case 'PROJECTEDCRS':
  60600. case 'PROJCRS':
  60601. case 'GEOGCS':
  60602. case 'GEOCCS':
  60603. case 'PROJCS':
  60604. case 'LOCAL_CS':
  60605. case 'GEODCRS':
  60606. case 'GEODETICCRS':
  60607. case 'GEODETICDATUM':
  60608. case 'EDATUM':
  60609. case 'ENGINEERINGDATUM':
  60610. case 'VERT_CS':
  60611. case 'VERTCRS':
  60612. case 'VERTICALCRS':
  60613. case 'COMPD_CS':
  60614. case 'COMPOUNDCRS':
  60615. case 'ENGINEERINGCRS':
  60616. case 'ENGCRS':
  60617. case 'FITTED_CS':
  60618. case 'LOCAL_DATUM':
  60619. case 'DATUM':
  60620. v[0] = ['name', v[0]];
  60621. mapit(obj, key, v);
  60622. return;
  60623. default:
  60624. i = -1;
  60625. while (++i < v.length) {
  60626. if (!Array.isArray(v[i])) {
  60627. return sExpr(v, obj[key]);
  60628. }
  60629. }
  60630. return mapit(obj, key, v);
  60631. }
  60632. }
  60633. ;// CONCATENATED MODULE: ./node_modules/wkt-parser/index.js
  60634. var wkt_parser_D2R = 0.01745329251994329577;
  60635. function rename(obj, params) {
  60636. var outName = params[0];
  60637. var inName = params[1];
  60638. if (!(outName in obj) && (inName in obj)) {
  60639. obj[outName] = obj[inName];
  60640. if (params.length === 3) {
  60641. obj[outName] = params[2](obj[outName]);
  60642. }
  60643. }
  60644. }
  60645. function d2r(input) {
  60646. return input * wkt_parser_D2R;
  60647. }
  60648. function cleanWKT(wkt) {
  60649. if (wkt.type === 'GEOGCS') {
  60650. wkt.projName = 'longlat';
  60651. } else if (wkt.type === 'LOCAL_CS') {
  60652. wkt.projName = 'identity';
  60653. wkt.local = true;
  60654. } else {
  60655. if (typeof wkt.PROJECTION === 'object') {
  60656. wkt.projName = Object.keys(wkt.PROJECTION)[0];
  60657. } else {
  60658. wkt.projName = wkt.PROJECTION;
  60659. }
  60660. }
  60661. if (wkt.AXIS) {
  60662. var axisOrder = '';
  60663. for (var i = 0, ii = wkt.AXIS.length; i < ii; ++i) {
  60664. var axis = wkt.AXIS[i];
  60665. var descriptor = axis[0].toLowerCase();
  60666. if (descriptor.indexOf('north') !== -1) {
  60667. axisOrder += 'n';
  60668. } else if (descriptor.indexOf('south') !== -1) {
  60669. axisOrder += 's';
  60670. } else if (descriptor.indexOf('east') !== -1) {
  60671. axisOrder += 'e';
  60672. } else if (descriptor.indexOf('west') !== -1) {
  60673. axisOrder += 'w';
  60674. }
  60675. }
  60676. if (axisOrder.length === 2) {
  60677. axisOrder += 'u';
  60678. }
  60679. if (axisOrder.length === 3) {
  60680. wkt.axis = axisOrder;
  60681. }
  60682. }
  60683. if (wkt.UNIT) {
  60684. wkt.units = wkt.UNIT.name.toLowerCase();
  60685. if (wkt.units === 'metre') {
  60686. wkt.units = 'meter';
  60687. }
  60688. if (wkt.UNIT.convert) {
  60689. if (wkt.type === 'GEOGCS') {
  60690. if (wkt.DATUM && wkt.DATUM.SPHEROID) {
  60691. wkt.to_meter = wkt.UNIT.convert*wkt.DATUM.SPHEROID.a;
  60692. }
  60693. } else {
  60694. wkt.to_meter = wkt.UNIT.convert;
  60695. }
  60696. }
  60697. }
  60698. var geogcs = wkt.GEOGCS;
  60699. if (wkt.type === 'GEOGCS') {
  60700. geogcs = wkt;
  60701. }
  60702. if (geogcs) {
  60703. //if(wkt.GEOGCS.PRIMEM&&wkt.GEOGCS.PRIMEM.convert){
  60704. // wkt.from_greenwich=wkt.GEOGCS.PRIMEM.convert*D2R;
  60705. //}
  60706. if (geogcs.DATUM) {
  60707. wkt.datumCode = geogcs.DATUM.name.toLowerCase();
  60708. } else {
  60709. wkt.datumCode = geogcs.name.toLowerCase();
  60710. }
  60711. if (wkt.datumCode.slice(0, 2) === 'd_') {
  60712. wkt.datumCode = wkt.datumCode.slice(2);
  60713. }
  60714. if (wkt.datumCode === 'new_zealand_geodetic_datum_1949' || wkt.datumCode === 'new_zealand_1949') {
  60715. wkt.datumCode = 'nzgd49';
  60716. }
  60717. if (wkt.datumCode === 'wgs_1984' || wkt.datumCode === 'world_geodetic_system_1984') {
  60718. if (wkt.PROJECTION === 'Mercator_Auxiliary_Sphere') {
  60719. wkt.sphere = true;
  60720. }
  60721. wkt.datumCode = 'wgs84';
  60722. }
  60723. if (wkt.datumCode.slice(-6) === '_ferro') {
  60724. wkt.datumCode = wkt.datumCode.slice(0, - 6);
  60725. }
  60726. if (wkt.datumCode.slice(-8) === '_jakarta') {
  60727. wkt.datumCode = wkt.datumCode.slice(0, - 8);
  60728. }
  60729. if (~wkt.datumCode.indexOf('belge')) {
  60730. wkt.datumCode = 'rnb72';
  60731. }
  60732. if (geogcs.DATUM && geogcs.DATUM.SPHEROID) {
  60733. wkt.ellps = geogcs.DATUM.SPHEROID.name.replace('_19', '').replace(/[Cc]larke\_18/, 'clrk');
  60734. if (wkt.ellps.toLowerCase().slice(0, 13) === 'international') {
  60735. wkt.ellps = 'intl';
  60736. }
  60737. wkt.a = geogcs.DATUM.SPHEROID.a;
  60738. wkt.rf = parseFloat(geogcs.DATUM.SPHEROID.rf, 10);
  60739. }
  60740. if (geogcs.DATUM && geogcs.DATUM.TOWGS84) {
  60741. wkt.datum_params = geogcs.DATUM.TOWGS84;
  60742. }
  60743. if (~wkt.datumCode.indexOf('osgb_1936')) {
  60744. wkt.datumCode = 'osgb36';
  60745. }
  60746. if (~wkt.datumCode.indexOf('osni_1952')) {
  60747. wkt.datumCode = 'osni52';
  60748. }
  60749. if (~wkt.datumCode.indexOf('tm65')
  60750. || ~wkt.datumCode.indexOf('geodetic_datum_of_1965')) {
  60751. wkt.datumCode = 'ire65';
  60752. }
  60753. if (wkt.datumCode === 'ch1903+') {
  60754. wkt.datumCode = 'ch1903';
  60755. }
  60756. if (~wkt.datumCode.indexOf('israel')) {
  60757. wkt.datumCode = 'isr93';
  60758. }
  60759. }
  60760. if (wkt.b && !isFinite(wkt.b)) {
  60761. wkt.b = wkt.a;
  60762. }
  60763. function toMeter(input) {
  60764. var ratio = wkt.to_meter || 1;
  60765. return input * ratio;
  60766. }
  60767. var renamer = function(a) {
  60768. return rename(wkt, a);
  60769. };
  60770. var list = [
  60771. ['standard_parallel_1', 'Standard_Parallel_1'],
  60772. ['standard_parallel_2', 'Standard_Parallel_2'],
  60773. ['false_easting', 'False_Easting'],
  60774. ['false_northing', 'False_Northing'],
  60775. ['central_meridian', 'Central_Meridian'],
  60776. ['latitude_of_origin', 'Latitude_Of_Origin'],
  60777. ['latitude_of_origin', 'Central_Parallel'],
  60778. ['scale_factor', 'Scale_Factor'],
  60779. ['k0', 'scale_factor'],
  60780. ['latitude_of_center', 'Latitude_Of_Center'],
  60781. ['latitude_of_center', 'Latitude_of_center'],
  60782. ['lat0', 'latitude_of_center', d2r],
  60783. ['longitude_of_center', 'Longitude_Of_Center'],
  60784. ['longitude_of_center', 'Longitude_of_center'],
  60785. ['longc', 'longitude_of_center', d2r],
  60786. ['x0', 'false_easting', toMeter],
  60787. ['y0', 'false_northing', toMeter],
  60788. ['long0', 'central_meridian', d2r],
  60789. ['lat0', 'latitude_of_origin', d2r],
  60790. ['lat0', 'standard_parallel_1', d2r],
  60791. ['lat1', 'standard_parallel_1', d2r],
  60792. ['lat2', 'standard_parallel_2', d2r],
  60793. ['azimuth', 'Azimuth'],
  60794. ['alpha', 'azimuth', d2r],
  60795. ['srsCode', 'name']
  60796. ];
  60797. list.forEach(renamer);
  60798. if (!wkt.long0 && wkt.longc && (wkt.projName === 'Albers_Conic_Equal_Area' || wkt.projName === 'Lambert_Azimuthal_Equal_Area')) {
  60799. wkt.long0 = wkt.longc;
  60800. }
  60801. if (!wkt.lat_ts && wkt.lat1 && (wkt.projName === 'Stereographic_South_Pole' || wkt.projName === 'Polar Stereographic (variant B)')) {
  60802. wkt.lat0 = d2r(wkt.lat1 > 0 ? 90 : -90);
  60803. wkt.lat_ts = wkt.lat1;
  60804. }
  60805. }
  60806. /* harmony default export */ function wkt_parser(wkt) {
  60807. var lisp = parser(wkt);
  60808. var type = lisp.shift();
  60809. var name = lisp.shift();
  60810. lisp.unshift(['name', name]);
  60811. lisp.unshift(['type', type]);
  60812. var obj = {};
  60813. sExpr(lisp, obj);
  60814. cleanWKT(obj);
  60815. return obj;
  60816. }
  60817. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/defs.js
  60818. function defs(name) {
  60819. /*global console*/
  60820. var that = this;
  60821. if (arguments.length === 2) {
  60822. var def = arguments[1];
  60823. if (typeof def === 'string') {
  60824. if (def.charAt(0) === '+') {
  60825. defs[name] = projString(arguments[1]);
  60826. }
  60827. else {
  60828. defs[name] = wkt_parser(arguments[1]);
  60829. }
  60830. } else {
  60831. defs[name] = def;
  60832. }
  60833. }
  60834. else if (arguments.length === 1) {
  60835. if (Array.isArray(name)) {
  60836. return name.map(function(v) {
  60837. if (Array.isArray(v)) {
  60838. defs.apply(that, v);
  60839. }
  60840. else {
  60841. defs(v);
  60842. }
  60843. });
  60844. }
  60845. else if (typeof name === 'string') {
  60846. if (name in defs) {
  60847. return defs[name];
  60848. }
  60849. }
  60850. else if ('EPSG' in name) {
  60851. defs['EPSG:' + name.EPSG] = name;
  60852. }
  60853. else if ('ESRI' in name) {
  60854. defs['ESRI:' + name.ESRI] = name;
  60855. }
  60856. else if ('IAU2000' in name) {
  60857. defs['IAU2000:' + name.IAU2000] = name;
  60858. }
  60859. else {
  60860. console.log(name);
  60861. }
  60862. return;
  60863. }
  60864. }
  60865. global(defs);
  60866. /* harmony default export */ const lib_defs = (defs);
  60867. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/parseCode.js
  60868. function testObj(code){
  60869. return typeof code === 'string';
  60870. }
  60871. function testDef(code){
  60872. return code in lib_defs;
  60873. }
  60874. var codeWords = ['PROJECTEDCRS', 'PROJCRS', 'GEOGCS','GEOCCS','PROJCS','LOCAL_CS', 'GEODCRS', 'GEODETICCRS', 'GEODETICDATUM', 'ENGCRS', 'ENGINEERINGCRS'];
  60875. function testWKT(code){
  60876. return codeWords.some(function (word) {
  60877. return code.indexOf(word) > -1;
  60878. });
  60879. }
  60880. var codes = ['3857', '900913', '3785', '102113'];
  60881. function checkMercator(item) {
  60882. var auth = match(item, 'authority');
  60883. if (!auth) {
  60884. return;
  60885. }
  60886. var code = match(auth, 'epsg');
  60887. return code && codes.indexOf(code) > -1;
  60888. }
  60889. function checkProjStr(item) {
  60890. var ext = match(item, 'extension');
  60891. if (!ext) {
  60892. return;
  60893. }
  60894. return match(ext, 'proj4');
  60895. }
  60896. function testProj(code){
  60897. return code[0] === '+';
  60898. }
  60899. function parse(code){
  60900. if (testObj(code)) {
  60901. //check to see if this is a WKT string
  60902. if (testDef(code)) {
  60903. return lib_defs[code];
  60904. }
  60905. if (testWKT(code)) {
  60906. var out = wkt_parser(code);
  60907. // test of spetial case, due to this being a very common and often malformed
  60908. if (checkMercator(out)) {
  60909. return lib_defs["EPSG:3857"];
  60910. }
  60911. var maybeProjStr = checkProjStr(out);
  60912. if (maybeProjStr) {
  60913. return projString(maybeProjStr);
  60914. }
  60915. return out;
  60916. }
  60917. if (testProj(code)) {
  60918. return projString(code);
  60919. }
  60920. }else{
  60921. return code;
  60922. }
  60923. }
  60924. /* harmony default export */ const parseCode = (parse);
  60925. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/extend.js
  60926. /* harmony default export */ function extend(destination, source) {
  60927. destination = destination || {};
  60928. var value, property;
  60929. if (!source) {
  60930. return destination;
  60931. }
  60932. for (property in source) {
  60933. value = source[property];
  60934. if (value !== undefined) {
  60935. destination[property] = value;
  60936. }
  60937. }
  60938. return destination;
  60939. }
  60940. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/msfnz.js
  60941. /* harmony default export */ function msfnz(eccent, sinphi, cosphi) {
  60942. var con = eccent * sinphi;
  60943. return cosphi / (Math.sqrt(1 - con * con));
  60944. }
  60945. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/sign.js
  60946. /* harmony default export */ function sign(x) {
  60947. return x<0 ? -1 : 1;
  60948. }
  60949. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/adjust_lon.js
  60950. /* harmony default export */ function adjust_lon(x) {
  60951. return (Math.abs(x) <= SPI) ? x : (x - (sign(x) * TWO_PI));
  60952. }
  60953. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/tsfnz.js
  60954. /* harmony default export */ function tsfnz(eccent, phi, sinphi) {
  60955. var con = eccent * sinphi;
  60956. var com = 0.5 * eccent;
  60957. con = Math.pow(((1 - con) / (1 + con)), com);
  60958. return (Math.tan(0.5 * (HALF_PI - phi)) / con);
  60959. }
  60960. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/phi2z.js
  60961. /* harmony default export */ function phi2z(eccent, ts) {
  60962. var eccnth = 0.5 * eccent;
  60963. var con, dphi;
  60964. var phi = HALF_PI - 2 * Math.atan(ts);
  60965. for (var i = 0; i <= 15; i++) {
  60966. con = eccent * Math.sin(phi);
  60967. dphi = HALF_PI - 2 * Math.atan(ts * (Math.pow(((1 - con) / (1 + con)), eccnth))) - phi;
  60968. phi += dphi;
  60969. if (Math.abs(dphi) <= 0.0000000001) {
  60970. return phi;
  60971. }
  60972. }
  60973. //console.log("phi2z has NoConvergence");
  60974. return -9999;
  60975. }
  60976. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/merc.js
  60977. function init() {
  60978. var con = this.b / this.a;
  60979. this.es = 1 - con * con;
  60980. if(!('x0' in this)){
  60981. this.x0 = 0;
  60982. }
  60983. if(!('y0' in this)){
  60984. this.y0 = 0;
  60985. }
  60986. this.e = Math.sqrt(this.es);
  60987. if (this.lat_ts) {
  60988. if (this.sphere) {
  60989. this.k0 = Math.cos(this.lat_ts);
  60990. }
  60991. else {
  60992. this.k0 = msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts));
  60993. }
  60994. }
  60995. else {
  60996. if (!this.k0) {
  60997. if (this.k) {
  60998. this.k0 = this.k;
  60999. }
  61000. else {
  61001. this.k0 = 1;
  61002. }
  61003. }
  61004. }
  61005. }
  61006. /* Mercator forward equations--mapping lat,long to x,y
  61007. --------------------------------------------------*/
  61008. function forward(p) {
  61009. var lon = p.x;
  61010. var lat = p.y;
  61011. // convert to radians
  61012. if (lat * R2D > 90 && lat * R2D < -90 && lon * R2D > 180 && lon * R2D < -180) {
  61013. return null;
  61014. }
  61015. var x, y;
  61016. if (Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN) {
  61017. return null;
  61018. }
  61019. else {
  61020. if (this.sphere) {
  61021. x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0);
  61022. y = this.y0 + this.a * this.k0 * Math.log(Math.tan(FORTPI + 0.5 * lat));
  61023. }
  61024. else {
  61025. var sinphi = Math.sin(lat);
  61026. var ts = tsfnz(this.e, lat, sinphi);
  61027. x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0);
  61028. y = this.y0 - this.a * this.k0 * Math.log(ts);
  61029. }
  61030. p.x = x;
  61031. p.y = y;
  61032. return p;
  61033. }
  61034. }
  61035. /* Mercator inverse equations--mapping x,y to lat/long
  61036. --------------------------------------------------*/
  61037. function inverse(p) {
  61038. var x = p.x - this.x0;
  61039. var y = p.y - this.y0;
  61040. var lon, lat;
  61041. if (this.sphere) {
  61042. lat = HALF_PI - 2 * Math.atan(Math.exp(-y / (this.a * this.k0)));
  61043. }
  61044. else {
  61045. var ts = Math.exp(-y / (this.a * this.k0));
  61046. lat = phi2z(this.e, ts);
  61047. if (lat === -9999) {
  61048. return null;
  61049. }
  61050. }
  61051. lon = adjust_lon(this.long0 + x / (this.a * this.k0));
  61052. p.x = lon;
  61053. p.y = lat;
  61054. return p;
  61055. }
  61056. var names = ["Mercator", "Popular Visualisation Pseudo Mercator", "Mercator_1SP", "Mercator_Auxiliary_Sphere", "merc"];
  61057. /* harmony default export */ const merc = ({
  61058. init: init,
  61059. forward: forward,
  61060. inverse: inverse,
  61061. names: names
  61062. });
  61063. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/longlat.js
  61064. function longlat_init() {
  61065. //no-op for longlat
  61066. }
  61067. function identity(pt) {
  61068. return pt;
  61069. }
  61070. var longlat_names = ["longlat", "identity"];
  61071. /* harmony default export */ const longlat = ({
  61072. init: longlat_init,
  61073. forward: identity,
  61074. inverse: identity,
  61075. names: longlat_names
  61076. });
  61077. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections.js
  61078. var projs = [merc, longlat];
  61079. var projections_names = {};
  61080. var projStore = [];
  61081. function add(proj, i) {
  61082. var len = projStore.length;
  61083. if (!proj.names) {
  61084. console.log(i);
  61085. return true;
  61086. }
  61087. projStore[len] = proj;
  61088. proj.names.forEach(function(n) {
  61089. projections_names[n.toLowerCase()] = len;
  61090. });
  61091. return this;
  61092. }
  61093. function get(name) {
  61094. if (!name) {
  61095. return false;
  61096. }
  61097. var n = name.toLowerCase();
  61098. if (typeof projections_names[n] !== 'undefined' && projStore[projections_names[n]]) {
  61099. return projStore[projections_names[n]];
  61100. }
  61101. }
  61102. function start() {
  61103. projs.forEach(add);
  61104. }
  61105. /* harmony default export */ const projections = ({
  61106. start: start,
  61107. add: add,
  61108. get: get
  61109. });
  61110. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/constants/Ellipsoid.js
  61111. var Ellipsoid_exports = {};
  61112. Ellipsoid_exports.MERIT = {
  61113. a: 6378137.0,
  61114. rf: 298.257,
  61115. ellipseName: "MERIT 1983"
  61116. };
  61117. Ellipsoid_exports.SGS85 = {
  61118. a: 6378136.0,
  61119. rf: 298.257,
  61120. ellipseName: "Soviet Geodetic System 85"
  61121. };
  61122. Ellipsoid_exports.GRS80 = {
  61123. a: 6378137.0,
  61124. rf: 298.257222101,
  61125. ellipseName: "GRS 1980(IUGG, 1980)"
  61126. };
  61127. Ellipsoid_exports.IAU76 = {
  61128. a: 6378140.0,
  61129. rf: 298.257,
  61130. ellipseName: "IAU 1976"
  61131. };
  61132. Ellipsoid_exports.airy = {
  61133. a: 6377563.396,
  61134. b: 6356256.910,
  61135. ellipseName: "Airy 1830"
  61136. };
  61137. Ellipsoid_exports.APL4 = {
  61138. a: 6378137,
  61139. rf: 298.25,
  61140. ellipseName: "Appl. Physics. 1965"
  61141. };
  61142. Ellipsoid_exports.NWL9D = {
  61143. a: 6378145.0,
  61144. rf: 298.25,
  61145. ellipseName: "Naval Weapons Lab., 1965"
  61146. };
  61147. Ellipsoid_exports.mod_airy = {
  61148. a: 6377340.189,
  61149. b: 6356034.446,
  61150. ellipseName: "Modified Airy"
  61151. };
  61152. Ellipsoid_exports.andrae = {
  61153. a: 6377104.43,
  61154. rf: 300.0,
  61155. ellipseName: "Andrae 1876 (Den., Iclnd.)"
  61156. };
  61157. Ellipsoid_exports.aust_SA = {
  61158. a: 6378160.0,
  61159. rf: 298.25,
  61160. ellipseName: "Australian Natl & S. Amer. 1969"
  61161. };
  61162. Ellipsoid_exports.GRS67 = {
  61163. a: 6378160.0,
  61164. rf: 298.2471674270,
  61165. ellipseName: "GRS 67(IUGG 1967)"
  61166. };
  61167. Ellipsoid_exports.bessel = {
  61168. a: 6377397.155,
  61169. rf: 299.1528128,
  61170. ellipseName: "Bessel 1841"
  61171. };
  61172. Ellipsoid_exports.bess_nam = {
  61173. a: 6377483.865,
  61174. rf: 299.1528128,
  61175. ellipseName: "Bessel 1841 (Namibia)"
  61176. };
  61177. Ellipsoid_exports.clrk66 = {
  61178. a: 6378206.4,
  61179. b: 6356583.8,
  61180. ellipseName: "Clarke 1866"
  61181. };
  61182. Ellipsoid_exports.clrk80 = {
  61183. a: 6378249.145,
  61184. rf: 293.4663,
  61185. ellipseName: "Clarke 1880 mod."
  61186. };
  61187. Ellipsoid_exports.clrk58 = {
  61188. a: 6378293.645208759,
  61189. rf: 294.2606763692654,
  61190. ellipseName: "Clarke 1858"
  61191. };
  61192. Ellipsoid_exports.CPM = {
  61193. a: 6375738.7,
  61194. rf: 334.29,
  61195. ellipseName: "Comm. des Poids et Mesures 1799"
  61196. };
  61197. Ellipsoid_exports.delmbr = {
  61198. a: 6376428.0,
  61199. rf: 311.5,
  61200. ellipseName: "Delambre 1810 (Belgium)"
  61201. };
  61202. Ellipsoid_exports.engelis = {
  61203. a: 6378136.05,
  61204. rf: 298.2566,
  61205. ellipseName: "Engelis 1985"
  61206. };
  61207. Ellipsoid_exports.evrst30 = {
  61208. a: 6377276.345,
  61209. rf: 300.8017,
  61210. ellipseName: "Everest 1830"
  61211. };
  61212. Ellipsoid_exports.evrst48 = {
  61213. a: 6377304.063,
  61214. rf: 300.8017,
  61215. ellipseName: "Everest 1948"
  61216. };
  61217. Ellipsoid_exports.evrst56 = {
  61218. a: 6377301.243,
  61219. rf: 300.8017,
  61220. ellipseName: "Everest 1956"
  61221. };
  61222. Ellipsoid_exports.evrst69 = {
  61223. a: 6377295.664,
  61224. rf: 300.8017,
  61225. ellipseName: "Everest 1969"
  61226. };
  61227. Ellipsoid_exports.evrstSS = {
  61228. a: 6377298.556,
  61229. rf: 300.8017,
  61230. ellipseName: "Everest (Sabah & Sarawak)"
  61231. };
  61232. Ellipsoid_exports.fschr60 = {
  61233. a: 6378166.0,
  61234. rf: 298.3,
  61235. ellipseName: "Fischer (Mercury Datum) 1960"
  61236. };
  61237. Ellipsoid_exports.fschr60m = {
  61238. a: 6378155.0,
  61239. rf: 298.3,
  61240. ellipseName: "Fischer 1960"
  61241. };
  61242. Ellipsoid_exports.fschr68 = {
  61243. a: 6378150.0,
  61244. rf: 298.3,
  61245. ellipseName: "Fischer 1968"
  61246. };
  61247. Ellipsoid_exports.helmert = {
  61248. a: 6378200.0,
  61249. rf: 298.3,
  61250. ellipseName: "Helmert 1906"
  61251. };
  61252. Ellipsoid_exports.hough = {
  61253. a: 6378270.0,
  61254. rf: 297.0,
  61255. ellipseName: "Hough"
  61256. };
  61257. Ellipsoid_exports.intl = {
  61258. a: 6378388.0,
  61259. rf: 297.0,
  61260. ellipseName: "International 1909 (Hayford)"
  61261. };
  61262. Ellipsoid_exports.kaula = {
  61263. a: 6378163.0,
  61264. rf: 298.24,
  61265. ellipseName: "Kaula 1961"
  61266. };
  61267. Ellipsoid_exports.lerch = {
  61268. a: 6378139.0,
  61269. rf: 298.257,
  61270. ellipseName: "Lerch 1979"
  61271. };
  61272. Ellipsoid_exports.mprts = {
  61273. a: 6397300.0,
  61274. rf: 191.0,
  61275. ellipseName: "Maupertius 1738"
  61276. };
  61277. Ellipsoid_exports.new_intl = {
  61278. a: 6378157.5,
  61279. b: 6356772.2,
  61280. ellipseName: "New International 1967"
  61281. };
  61282. Ellipsoid_exports.plessis = {
  61283. a: 6376523.0,
  61284. rf: 6355863.0,
  61285. ellipseName: "Plessis 1817 (France)"
  61286. };
  61287. Ellipsoid_exports.krass = {
  61288. a: 6378245.0,
  61289. rf: 298.3,
  61290. ellipseName: "Krassovsky, 1942"
  61291. };
  61292. Ellipsoid_exports.SEasia = {
  61293. a: 6378155.0,
  61294. b: 6356773.3205,
  61295. ellipseName: "Southeast Asia"
  61296. };
  61297. Ellipsoid_exports.walbeck = {
  61298. a: 6376896.0,
  61299. b: 6355834.8467,
  61300. ellipseName: "Walbeck"
  61301. };
  61302. Ellipsoid_exports.WGS60 = {
  61303. a: 6378165.0,
  61304. rf: 298.3,
  61305. ellipseName: "WGS 60"
  61306. };
  61307. Ellipsoid_exports.WGS66 = {
  61308. a: 6378145.0,
  61309. rf: 298.25,
  61310. ellipseName: "WGS 66"
  61311. };
  61312. Ellipsoid_exports.WGS7 = {
  61313. a: 6378135.0,
  61314. rf: 298.26,
  61315. ellipseName: "WGS 72"
  61316. };
  61317. var WGS84 = Ellipsoid_exports.WGS84 = {
  61318. a: 6378137.0,
  61319. rf: 298.257223563,
  61320. ellipseName: "WGS 84"
  61321. };
  61322. Ellipsoid_exports.sphere = {
  61323. a: 6370997.0,
  61324. b: 6370997.0,
  61325. ellipseName: "Normal Sphere (r=6370997)"
  61326. };
  61327. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/deriveConstants.js
  61328. function eccentricity(a, b, rf, R_A) {
  61329. var a2 = a * a; // used in geocentric
  61330. var b2 = b * b; // used in geocentric
  61331. var es = (a2 - b2) / a2; // e ^ 2
  61332. var e = 0;
  61333. if (R_A) {
  61334. a *= 1 - es * (SIXTH + es * (RA4 + es * RA6));
  61335. a2 = a * a;
  61336. es = 0;
  61337. } else {
  61338. e = Math.sqrt(es); // eccentricity
  61339. }
  61340. var ep2 = (a2 - b2) / b2; // used in geocentric
  61341. return {
  61342. es: es,
  61343. e: e,
  61344. ep2: ep2
  61345. };
  61346. }
  61347. function sphere(a, b, rf, ellps, sphere) {
  61348. if (!a) { // do we have an ellipsoid?
  61349. var ellipse = match(Ellipsoid_exports, ellps);
  61350. if (!ellipse) {
  61351. ellipse = WGS84;
  61352. }
  61353. a = ellipse.a;
  61354. b = ellipse.b;
  61355. rf = ellipse.rf;
  61356. }
  61357. if (rf && !b) {
  61358. b = (1.0 - 1.0 / rf) * a;
  61359. }
  61360. if (rf === 0 || Math.abs(a - b) < EPSLN) {
  61361. sphere = true;
  61362. b = a;
  61363. }
  61364. return {
  61365. a: a,
  61366. b: b,
  61367. rf: rf,
  61368. sphere: sphere
  61369. };
  61370. }
  61371. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/constants/Datum.js
  61372. var Datum_exports = {};
  61373. Datum_exports.wgs84 = {
  61374. towgs84: "0,0,0",
  61375. ellipse: "WGS84",
  61376. datumName: "WGS84"
  61377. };
  61378. Datum_exports.ch1903 = {
  61379. towgs84: "674.374,15.056,405.346",
  61380. ellipse: "bessel",
  61381. datumName: "swiss"
  61382. };
  61383. Datum_exports.ggrs87 = {
  61384. towgs84: "-199.87,74.79,246.62",
  61385. ellipse: "GRS80",
  61386. datumName: "Greek_Geodetic_Reference_System_1987"
  61387. };
  61388. Datum_exports.nad83 = {
  61389. towgs84: "0,0,0",
  61390. ellipse: "GRS80",
  61391. datumName: "North_American_Datum_1983"
  61392. };
  61393. Datum_exports.nad27 = {
  61394. nadgrids: "@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",
  61395. ellipse: "clrk66",
  61396. datumName: "North_American_Datum_1927"
  61397. };
  61398. Datum_exports.potsdam = {
  61399. towgs84: "606.0,23.0,413.0",
  61400. ellipse: "bessel",
  61401. datumName: "Potsdam Rauenberg 1950 DHDN"
  61402. };
  61403. Datum_exports.carthage = {
  61404. towgs84: "-263.0,6.0,431.0",
  61405. ellipse: "clark80",
  61406. datumName: "Carthage 1934 Tunisia"
  61407. };
  61408. Datum_exports.hermannskogel = {
  61409. towgs84: "653.0,-212.0,449.0",
  61410. ellipse: "bessel",
  61411. datumName: "Hermannskogel"
  61412. };
  61413. Datum_exports.osni52 = {
  61414. towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",
  61415. ellipse: "airy",
  61416. datumName: "Irish National"
  61417. };
  61418. Datum_exports.ire65 = {
  61419. towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",
  61420. ellipse: "mod_airy",
  61421. datumName: "Ireland 1965"
  61422. };
  61423. Datum_exports.rassadiran = {
  61424. towgs84: "-133.63,-157.5,-158.62",
  61425. ellipse: "intl",
  61426. datumName: "Rassadiran"
  61427. };
  61428. Datum_exports.nzgd49 = {
  61429. towgs84: "59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",
  61430. ellipse: "intl",
  61431. datumName: "New Zealand Geodetic Datum 1949"
  61432. };
  61433. Datum_exports.osgb36 = {
  61434. towgs84: "446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",
  61435. ellipse: "airy",
  61436. datumName: "Airy 1830"
  61437. };
  61438. Datum_exports.s_jtsk = {
  61439. towgs84: "589,76,480",
  61440. ellipse: 'bessel',
  61441. datumName: 'S-JTSK (Ferro)'
  61442. };
  61443. Datum_exports.beduaram = {
  61444. towgs84: '-106,-87,188',
  61445. ellipse: 'clrk80',
  61446. datumName: 'Beduaram'
  61447. };
  61448. Datum_exports.gunung_segara = {
  61449. towgs84: '-403,684,41',
  61450. ellipse: 'bessel',
  61451. datumName: 'Gunung Segara Jakarta'
  61452. };
  61453. Datum_exports.rnb72 = {
  61454. towgs84: "106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",
  61455. ellipse: "intl",
  61456. datumName: "Reseau National Belge 1972"
  61457. };
  61458. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/datum.js
  61459. function datum(datumCode, datum_params, a, b, es, ep2) {
  61460. var out = {};
  61461. if (datumCode === undefined || datumCode === 'none') {
  61462. out.datum_type = PJD_NODATUM;
  61463. } else {
  61464. out.datum_type = PJD_WGS84;
  61465. }
  61466. if (datum_params) {
  61467. out.datum_params = datum_params.map(parseFloat);
  61468. if (out.datum_params[0] !== 0 || out.datum_params[1] !== 0 || out.datum_params[2] !== 0) {
  61469. out.datum_type = PJD_3PARAM;
  61470. }
  61471. if (out.datum_params.length > 3) {
  61472. if (out.datum_params[3] !== 0 || out.datum_params[4] !== 0 || out.datum_params[5] !== 0 || out.datum_params[6] !== 0) {
  61473. out.datum_type = PJD_7PARAM;
  61474. out.datum_params[3] *= SEC_TO_RAD;
  61475. out.datum_params[4] *= SEC_TO_RAD;
  61476. out.datum_params[5] *= SEC_TO_RAD;
  61477. out.datum_params[6] = (out.datum_params[6] / 1000000.0) + 1.0;
  61478. }
  61479. }
  61480. }
  61481. out.a = a; //datum object also uses these values
  61482. out.b = b;
  61483. out.es = es;
  61484. out.ep2 = ep2;
  61485. return out;
  61486. }
  61487. /* harmony default export */ const lib_datum = (datum);
  61488. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/Proj.js
  61489. function Projection(srsCode,callback) {
  61490. if (!(this instanceof Projection)) {
  61491. return new Projection(srsCode);
  61492. }
  61493. callback = callback || function(error){
  61494. if(error){
  61495. throw error;
  61496. }
  61497. };
  61498. var json = parseCode(srsCode);
  61499. if(typeof json !== 'object'){
  61500. callback(srsCode);
  61501. return;
  61502. }
  61503. var ourProj = Projection.projections.get(json.projName);
  61504. if(!ourProj){
  61505. callback(srsCode);
  61506. return;
  61507. }
  61508. if (json.datumCode && json.datumCode !== 'none') {
  61509. var datumDef = match(Datum_exports, json.datumCode);
  61510. if (datumDef) {
  61511. json.datum_params = datumDef.towgs84 ? datumDef.towgs84.split(',') : null;
  61512. json.ellps = datumDef.ellipse;
  61513. json.datumName = datumDef.datumName ? datumDef.datumName : json.datumCode;
  61514. }
  61515. }
  61516. json.k0 = json.k0 || 1.0;
  61517. json.axis = json.axis || 'enu';
  61518. json.ellps = json.ellps || 'wgs84';
  61519. var sphere_ = sphere(json.a, json.b, json.rf, json.ellps, json.sphere);
  61520. var ecc = eccentricity(sphere_.a, sphere_.b, sphere_.rf, json.R_A);
  61521. var datumObj = json.datum || lib_datum(json.datumCode, json.datum_params, sphere_.a, sphere_.b, ecc.es, ecc.ep2);
  61522. extend(this, json); // transfer everything over from the projection because we don't know what we'll need
  61523. extend(this, ourProj); // transfer all the methods from the projection
  61524. // copy the 4 things over we calulated in deriveConstants.sphere
  61525. this.a = sphere_.a;
  61526. this.b = sphere_.b;
  61527. this.rf = sphere_.rf;
  61528. this.sphere = sphere_.sphere;
  61529. // copy the 3 things we calculated in deriveConstants.eccentricity
  61530. this.es = ecc.es;
  61531. this.e = ecc.e;
  61532. this.ep2 = ecc.ep2;
  61533. // add in the datum object
  61534. this.datum = datumObj;
  61535. // init the projection
  61536. this.init();
  61537. // legecy callback from back in the day when it went to spatialreference.org
  61538. callback(null, this);
  61539. }
  61540. Projection.projections = projections;
  61541. Projection.projections.start();
  61542. /* harmony default export */ const Proj = (Projection);
  61543. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/datumUtils.js
  61544. function compareDatums(source, dest) {
  61545. if (source.datum_type !== dest.datum_type) {
  61546. return false; // false, datums are not equal
  61547. } else if (source.a !== dest.a || Math.abs(source.es - dest.es) > 0.000000000050) {
  61548. // the tolerance for es is to ensure that GRS80 and WGS84
  61549. // are considered identical
  61550. return false;
  61551. } else if (source.datum_type === PJD_3PARAM) {
  61552. return (source.datum_params[0] === dest.datum_params[0] && source.datum_params[1] === dest.datum_params[1] && source.datum_params[2] === dest.datum_params[2]);
  61553. } else if (source.datum_type === PJD_7PARAM) {
  61554. return (source.datum_params[0] === dest.datum_params[0] && source.datum_params[1] === dest.datum_params[1] && source.datum_params[2] === dest.datum_params[2] && source.datum_params[3] === dest.datum_params[3] && source.datum_params[4] === dest.datum_params[4] && source.datum_params[5] === dest.datum_params[5] && source.datum_params[6] === dest.datum_params[6]);
  61555. } else {
  61556. return true; // datums are equal
  61557. }
  61558. } // cs_compare_datums()
  61559. /*
  61560. * The function Convert_Geodetic_To_Geocentric converts geodetic coordinates
  61561. * (latitude, longitude, and height) to geocentric coordinates (X, Y, Z),
  61562. * according to the current ellipsoid parameters.
  61563. *
  61564. * Latitude : Geodetic latitude in radians (input)
  61565. * Longitude : Geodetic longitude in radians (input)
  61566. * Height : Geodetic height, in meters (input)
  61567. * X : Calculated Geocentric X coordinate, in meters (output)
  61568. * Y : Calculated Geocentric Y coordinate, in meters (output)
  61569. * Z : Calculated Geocentric Z coordinate, in meters (output)
  61570. *
  61571. */
  61572. function geodeticToGeocentric(p, es, a) {
  61573. var Longitude = p.x;
  61574. var Latitude = p.y;
  61575. var Height = p.z ? p.z : 0; //Z value not always supplied
  61576. var Rn; /* Earth radius at location */
  61577. var Sin_Lat; /* Math.sin(Latitude) */
  61578. var Sin2_Lat; /* Square of Math.sin(Latitude) */
  61579. var Cos_Lat; /* Math.cos(Latitude) */
  61580. /*
  61581. ** Don't blow up if Latitude is just a little out of the value
  61582. ** range as it may just be a rounding issue. Also removed longitude
  61583. ** test, it should be wrapped by Math.cos() and Math.sin(). NFW for PROJ.4, Sep/2001.
  61584. */
  61585. if (Latitude < -HALF_PI && Latitude > -1.001 * HALF_PI) {
  61586. Latitude = -HALF_PI;
  61587. } else if (Latitude > HALF_PI && Latitude < 1.001 * HALF_PI) {
  61588. Latitude = HALF_PI;
  61589. } else if (Latitude < -HALF_PI) {
  61590. /* Latitude out of range */
  61591. //..reportError('geocent:lat out of range:' + Latitude);
  61592. return { x: -Infinity, y: -Infinity, z: p.z };
  61593. } else if (Latitude > HALF_PI) {
  61594. /* Latitude out of range */
  61595. return { x: Infinity, y: Infinity, z: p.z };
  61596. }
  61597. if (Longitude > Math.PI) {
  61598. Longitude -= (2 * Math.PI);
  61599. }
  61600. Sin_Lat = Math.sin(Latitude);
  61601. Cos_Lat = Math.cos(Latitude);
  61602. Sin2_Lat = Sin_Lat * Sin_Lat;
  61603. Rn = a / (Math.sqrt(1.0e0 - es * Sin2_Lat));
  61604. return {
  61605. x: (Rn + Height) * Cos_Lat * Math.cos(Longitude),
  61606. y: (Rn + Height) * Cos_Lat * Math.sin(Longitude),
  61607. z: ((Rn * (1 - es)) + Height) * Sin_Lat
  61608. };
  61609. } // cs_geodetic_to_geocentric()
  61610. function geocentricToGeodetic(p, es, a, b) {
  61611. /* local defintions and variables */
  61612. /* end-criterium of loop, accuracy of sin(Latitude) */
  61613. var genau = 1e-12;
  61614. var genau2 = (genau * genau);
  61615. var maxiter = 30;
  61616. var P; /* distance between semi-minor axis and location */
  61617. var RR; /* distance between center and location */
  61618. var CT; /* sin of geocentric latitude */
  61619. var ST; /* cos of geocentric latitude */
  61620. var RX;
  61621. var RK;
  61622. var RN; /* Earth radius at location */
  61623. var CPHI0; /* cos of start or old geodetic latitude in iterations */
  61624. var SPHI0; /* sin of start or old geodetic latitude in iterations */
  61625. var CPHI; /* cos of searched geodetic latitude */
  61626. var SPHI; /* sin of searched geodetic latitude */
  61627. var SDPHI; /* end-criterium: addition-theorem of sin(Latitude(iter)-Latitude(iter-1)) */
  61628. var iter; /* # of continous iteration, max. 30 is always enough (s.a.) */
  61629. var X = p.x;
  61630. var Y = p.y;
  61631. var Z = p.z ? p.z : 0.0; //Z value not always supplied
  61632. var Longitude;
  61633. var Latitude;
  61634. var Height;
  61635. P = Math.sqrt(X * X + Y * Y);
  61636. RR = Math.sqrt(X * X + Y * Y + Z * Z);
  61637. /* special cases for latitude and longitude */
  61638. if (P / a < genau) {
  61639. /* special case, if P=0. (X=0., Y=0.) */
  61640. Longitude = 0.0;
  61641. /* if (X,Y,Z)=(0.,0.,0.) then Height becomes semi-minor axis
  61642. * of ellipsoid (=center of mass), Latitude becomes PI/2 */
  61643. if (RR / a < genau) {
  61644. Latitude = HALF_PI;
  61645. Height = -b;
  61646. return {
  61647. x: p.x,
  61648. y: p.y,
  61649. z: p.z
  61650. };
  61651. }
  61652. } else {
  61653. /* ellipsoidal (geodetic) longitude
  61654. * interval: -PI < Longitude <= +PI */
  61655. Longitude = Math.atan2(Y, X);
  61656. }
  61657. /* --------------------------------------------------------------
  61658. * Following iterative algorithm was developped by
  61659. * "Institut for Erdmessung", University of Hannover, July 1988.
  61660. * Internet: www.ife.uni-hannover.de
  61661. * Iterative computation of CPHI,SPHI and Height.
  61662. * Iteration of CPHI and SPHI to 10**-12 radian resp.
  61663. * 2*10**-7 arcsec.
  61664. * --------------------------------------------------------------
  61665. */
  61666. CT = Z / RR;
  61667. ST = P / RR;
  61668. RX = 1.0 / Math.sqrt(1.0 - es * (2.0 - es) * ST * ST);
  61669. CPHI0 = ST * (1.0 - es) * RX;
  61670. SPHI0 = CT * RX;
  61671. iter = 0;
  61672. /* loop to find sin(Latitude) resp. Latitude
  61673. * until |sin(Latitude(iter)-Latitude(iter-1))| < genau */
  61674. do {
  61675. iter++;
  61676. RN = a / Math.sqrt(1.0 - es * SPHI0 * SPHI0);
  61677. /* ellipsoidal (geodetic) height */
  61678. Height = P * CPHI0 + Z * SPHI0 - RN * (1.0 - es * SPHI0 * SPHI0);
  61679. RK = es * RN / (RN + Height);
  61680. RX = 1.0 / Math.sqrt(1.0 - RK * (2.0 - RK) * ST * ST);
  61681. CPHI = ST * (1.0 - RK) * RX;
  61682. SPHI = CT * RX;
  61683. SDPHI = SPHI * CPHI0 - CPHI * SPHI0;
  61684. CPHI0 = CPHI;
  61685. SPHI0 = SPHI;
  61686. }
  61687. while (SDPHI * SDPHI > genau2 && iter < maxiter);
  61688. /* ellipsoidal (geodetic) latitude */
  61689. Latitude = Math.atan(SPHI / Math.abs(CPHI));
  61690. return {
  61691. x: Longitude,
  61692. y: Latitude,
  61693. z: Height
  61694. };
  61695. } // cs_geocentric_to_geodetic()
  61696. /****************************************************************/
  61697. // pj_geocentic_to_wgs84( p )
  61698. // p = point to transform in geocentric coordinates (x,y,z)
  61699. /** point object, nothing fancy, just allows values to be
  61700. passed back and forth by reference rather than by value.
  61701. Other point classes may be used as long as they have
  61702. x and y properties, which will get modified in the transform method.
  61703. */
  61704. function geocentricToWgs84(p, datum_type, datum_params) {
  61705. if (datum_type === PJD_3PARAM) {
  61706. // if( x[io] === HUGE_VAL )
  61707. // continue;
  61708. return {
  61709. x: p.x + datum_params[0],
  61710. y: p.y + datum_params[1],
  61711. z: p.z + datum_params[2],
  61712. };
  61713. } else if (datum_type === PJD_7PARAM) {
  61714. var Dx_BF = datum_params[0];
  61715. var Dy_BF = datum_params[1];
  61716. var Dz_BF = datum_params[2];
  61717. var Rx_BF = datum_params[3];
  61718. var Ry_BF = datum_params[4];
  61719. var Rz_BF = datum_params[5];
  61720. var M_BF = datum_params[6];
  61721. // if( x[io] === HUGE_VAL )
  61722. // continue;
  61723. return {
  61724. x: M_BF * (p.x - Rz_BF * p.y + Ry_BF * p.z) + Dx_BF,
  61725. y: M_BF * (Rz_BF * p.x + p.y - Rx_BF * p.z) + Dy_BF,
  61726. z: M_BF * (-Ry_BF * p.x + Rx_BF * p.y + p.z) + Dz_BF
  61727. };
  61728. }
  61729. } // cs_geocentric_to_wgs84
  61730. /****************************************************************/
  61731. // pj_geocentic_from_wgs84()
  61732. // coordinate system definition,
  61733. // point to transform in geocentric coordinates (x,y,z)
  61734. function geocentricFromWgs84(p, datum_type, datum_params) {
  61735. if (datum_type === PJD_3PARAM) {
  61736. //if( x[io] === HUGE_VAL )
  61737. // continue;
  61738. return {
  61739. x: p.x - datum_params[0],
  61740. y: p.y - datum_params[1],
  61741. z: p.z - datum_params[2],
  61742. };
  61743. } else if (datum_type === PJD_7PARAM) {
  61744. var Dx_BF = datum_params[0];
  61745. var Dy_BF = datum_params[1];
  61746. var Dz_BF = datum_params[2];
  61747. var Rx_BF = datum_params[3];
  61748. var Ry_BF = datum_params[4];
  61749. var Rz_BF = datum_params[5];
  61750. var M_BF = datum_params[6];
  61751. var x_tmp = (p.x - Dx_BF) / M_BF;
  61752. var y_tmp = (p.y - Dy_BF) / M_BF;
  61753. var z_tmp = (p.z - Dz_BF) / M_BF;
  61754. //if( x[io] === HUGE_VAL )
  61755. // continue;
  61756. return {
  61757. x: x_tmp + Rz_BF * y_tmp - Ry_BF * z_tmp,
  61758. y: -Rz_BF * x_tmp + y_tmp + Rx_BF * z_tmp,
  61759. z: Ry_BF * x_tmp - Rx_BF * y_tmp + z_tmp
  61760. };
  61761. } //cs_geocentric_from_wgs84()
  61762. }
  61763. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/datum_transform.js
  61764. function checkParams(type) {
  61765. return (type === PJD_3PARAM || type === PJD_7PARAM);
  61766. }
  61767. /* harmony default export */ function datum_transform(source, dest, point) {
  61768. // Short cut if the datums are identical.
  61769. if (compareDatums(source, dest)) {
  61770. return point; // in this case, zero is sucess,
  61771. // whereas cs_compare_datums returns 1 to indicate TRUE
  61772. // confusing, should fix this
  61773. }
  61774. // Explicitly skip datum transform by setting 'datum=none' as parameter for either source or dest
  61775. if (source.datum_type === PJD_NODATUM || dest.datum_type === PJD_NODATUM) {
  61776. return point;
  61777. }
  61778. // If this datum requires grid shifts, then apply it to geodetic coordinates.
  61779. // Do we need to go through geocentric coordinates?
  61780. if (source.es === dest.es && source.a === dest.a && !checkParams(source.datum_type) && !checkParams(dest.datum_type)) {
  61781. return point;
  61782. }
  61783. // Convert to geocentric coordinates.
  61784. point = geodeticToGeocentric(point, source.es, source.a);
  61785. // Convert between datums
  61786. if (checkParams(source.datum_type)) {
  61787. point = geocentricToWgs84(point, source.datum_type, source.datum_params);
  61788. }
  61789. if (checkParams(dest.datum_type)) {
  61790. point = geocentricFromWgs84(point, dest.datum_type, dest.datum_params);
  61791. }
  61792. return geocentricToGeodetic(point, dest.es, dest.a, dest.b);
  61793. }
  61794. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/adjust_axis.js
  61795. /* harmony default export */ function adjust_axis(crs, denorm, point) {
  61796. var xin = point.x,
  61797. yin = point.y,
  61798. zin = point.z || 0.0;
  61799. var v, t, i;
  61800. var out = {};
  61801. for (i = 0; i < 3; i++) {
  61802. if (denorm && i === 2 && point.z === undefined) {
  61803. continue;
  61804. }
  61805. if (i === 0) {
  61806. v = xin;
  61807. if ("ew".indexOf(crs.axis[i]) !== -1) {
  61808. t = 'x';
  61809. } else {
  61810. t = 'y';
  61811. }
  61812. }
  61813. else if (i === 1) {
  61814. v = yin;
  61815. if ("ns".indexOf(crs.axis[i]) !== -1) {
  61816. t = 'y';
  61817. } else {
  61818. t = 'x';
  61819. }
  61820. }
  61821. else {
  61822. v = zin;
  61823. t = 'z';
  61824. }
  61825. switch (crs.axis[i]) {
  61826. case 'e':
  61827. case 'w':
  61828. case 'n':
  61829. case 's':
  61830. out[t] = v;
  61831. break;
  61832. case 'u':
  61833. if (point[t] !== undefined) {
  61834. out.z = v;
  61835. }
  61836. break;
  61837. case 'd':
  61838. if (point[t] !== undefined) {
  61839. out.z = -v;
  61840. }
  61841. break;
  61842. default:
  61843. //console.log("ERROR: unknow axis ("+crs.axis[i]+") - check definition of "+crs.projName);
  61844. return null;
  61845. }
  61846. }
  61847. return out;
  61848. }
  61849. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/toPoint.js
  61850. /* harmony default export */ function toPoint(array){
  61851. var out = {
  61852. x: array[0],
  61853. y: array[1]
  61854. };
  61855. if (array.length>2) {
  61856. out.z = array[2];
  61857. }
  61858. if (array.length>3) {
  61859. out.m = array[3];
  61860. }
  61861. return out;
  61862. }
  61863. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/checkSanity.js
  61864. /* harmony default export */ function checkSanity(point) {
  61865. checkCoord(point.x);
  61866. checkCoord(point.y);
  61867. }
  61868. function checkCoord(num) {
  61869. if (typeof Number.isFinite === 'function') {
  61870. if (Number.isFinite(num)) {
  61871. return;
  61872. }
  61873. throw new TypeError('coordinates must be finite numbers');
  61874. }
  61875. if (typeof num !== 'number' || num !== num || !isFinite(num)) {
  61876. throw new TypeError('coordinates must be finite numbers');
  61877. }
  61878. }
  61879. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/transform.js
  61880. function checkNotWGS(source, dest) {
  61881. return ((source.datum.datum_type === PJD_3PARAM || source.datum.datum_type === PJD_7PARAM) && dest.datumCode !== 'WGS84') || ((dest.datum.datum_type === PJD_3PARAM || dest.datum.datum_type === PJD_7PARAM) && source.datumCode !== 'WGS84');
  61882. }
  61883. function transform(source, dest, point) {
  61884. var wgs84;
  61885. if (Array.isArray(point)) {
  61886. point = toPoint(point);
  61887. }
  61888. checkSanity(point);
  61889. // Workaround for datum shifts towgs84, if either source or destination projection is not wgs84
  61890. if (source.datum && dest.datum && checkNotWGS(source, dest)) {
  61891. wgs84 = new Proj('WGS84');
  61892. point = transform(source, wgs84, point);
  61893. source = wgs84;
  61894. }
  61895. // DGR, 2010/11/12
  61896. if (source.axis !== 'enu') {
  61897. point = adjust_axis(source, false, point);
  61898. }
  61899. // Transform source points to long/lat, if they aren't already.
  61900. if (source.projName === 'longlat') {
  61901. point = {
  61902. x: point.x * D2R,
  61903. y: point.y * D2R,
  61904. z: point.z || 0
  61905. };
  61906. } else {
  61907. if (source.to_meter) {
  61908. point = {
  61909. x: point.x * source.to_meter,
  61910. y: point.y * source.to_meter,
  61911. z: point.z || 0
  61912. };
  61913. }
  61914. point = source.inverse(point); // Convert Cartesian to longlat
  61915. if (!point) {
  61916. return;
  61917. }
  61918. }
  61919. // Adjust for the prime meridian if necessary
  61920. if (source.from_greenwich) {
  61921. point.x += source.from_greenwich;
  61922. }
  61923. // Convert datums if needed, and if possible.
  61924. point = datum_transform(source.datum, dest.datum, point);
  61925. // Adjust for the prime meridian if necessary
  61926. if (dest.from_greenwich) {
  61927. point = {
  61928. x: point.x - dest.from_greenwich,
  61929. y: point.y,
  61930. z: point.z || 0
  61931. };
  61932. }
  61933. if (dest.projName === 'longlat') {
  61934. // convert radians to decimal degrees
  61935. point = {
  61936. x: point.x * R2D,
  61937. y: point.y * R2D,
  61938. z: point.z || 0
  61939. };
  61940. } else { // else project
  61941. point = dest.forward(point);
  61942. if (dest.to_meter) {
  61943. point = {
  61944. x: point.x / dest.to_meter,
  61945. y: point.y / dest.to_meter,
  61946. z: point.z || 0
  61947. };
  61948. }
  61949. }
  61950. // DGR, 2010/11/12
  61951. if (dest.axis !== 'enu') {
  61952. return adjust_axis(dest, true, point);
  61953. }
  61954. return point;
  61955. }
  61956. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/core.js
  61957. var wgs84 = Proj('WGS84');
  61958. function transformer(from, to, coords) {
  61959. var transformedArray, out, keys;
  61960. if (Array.isArray(coords)) {
  61961. transformedArray = transform(from, to, coords) || {x: NaN, y: NaN};
  61962. if (coords.length > 2) {
  61963. if ((typeof from.name !== 'undefined' && from.name === 'geocent') || (typeof to.name !== 'undefined' && to.name === 'geocent')) {
  61964. if (typeof transformedArray.z === 'number') {
  61965. return [transformedArray.x, transformedArray.y, transformedArray.z].concat(coords.splice(3));
  61966. } else {
  61967. return [transformedArray.x, transformedArray.y, coords[2]].concat(coords.splice(3));
  61968. }
  61969. } else {
  61970. return [transformedArray.x, transformedArray.y].concat(coords.splice(2));
  61971. }
  61972. } else {
  61973. return [transformedArray.x, transformedArray.y];
  61974. }
  61975. } else {
  61976. out = transform(from, to, coords);
  61977. keys = Object.keys(coords);
  61978. if (keys.length === 2) {
  61979. return out;
  61980. }
  61981. keys.forEach(function (key) {
  61982. if ((typeof from.name !== 'undefined' && from.name === 'geocent') || (typeof to.name !== 'undefined' && to.name === 'geocent')) {
  61983. if (key === 'x' || key === 'y' || key === 'z') {
  61984. return;
  61985. }
  61986. } else {
  61987. if (key === 'x' || key === 'y') {
  61988. return;
  61989. }
  61990. }
  61991. out[key] = coords[key];
  61992. });
  61993. return out;
  61994. }
  61995. }
  61996. function checkProj(item) {
  61997. if (item instanceof Proj) {
  61998. return item;
  61999. }
  62000. if (item.oProj) {
  62001. return item.oProj;
  62002. }
  62003. return Proj(item);
  62004. }
  62005. function proj4(fromProj, toProj, coord) {
  62006. fromProj = checkProj(fromProj);
  62007. var single = false;
  62008. var obj;
  62009. if (typeof toProj === 'undefined') {
  62010. toProj = fromProj;
  62011. fromProj = wgs84;
  62012. single = true;
  62013. } else if (typeof toProj.x !== 'undefined' || Array.isArray(toProj)) {
  62014. coord = toProj;
  62015. toProj = fromProj;
  62016. fromProj = wgs84;
  62017. single = true;
  62018. }
  62019. toProj = checkProj(toProj);
  62020. if (coord) {
  62021. return transformer(fromProj, toProj, coord);
  62022. } else {
  62023. obj = {
  62024. forward: function (coords) {
  62025. return transformer(fromProj, toProj, coords);
  62026. },
  62027. inverse: function (coords) {
  62028. return transformer(toProj, fromProj, coords);
  62029. }
  62030. };
  62031. if (single) {
  62032. obj.oProj = toProj;
  62033. }
  62034. return obj;
  62035. }
  62036. }
  62037. /* harmony default export */ const core = (proj4);
  62038. ;// CONCATENATED MODULE: ./node_modules/mgrs/mgrs.js
  62039. /**
  62040. * UTM zones are grouped, and assigned to one of a group of 6
  62041. * sets.
  62042. *
  62043. * {int} @private
  62044. */
  62045. var NUM_100K_SETS = 6;
  62046. /**
  62047. * The column letters (for easting) of the lower left value, per
  62048. * set.
  62049. *
  62050. * {string} @private
  62051. */
  62052. var SET_ORIGIN_COLUMN_LETTERS = 'AJSAJS';
  62053. /**
  62054. * The row letters (for northing) of the lower left value, per
  62055. * set.
  62056. *
  62057. * {string} @private
  62058. */
  62059. var SET_ORIGIN_ROW_LETTERS = 'AFAFAF';
  62060. var A = 65; // A
  62061. var I = 73; // I
  62062. var O = 79; // O
  62063. var V = 86; // V
  62064. var Z = 90; // Z
  62065. /* harmony default export */ const mgrs = ({
  62066. forward: mgrs_forward,
  62067. inverse: mgrs_inverse,
  62068. toPoint: mgrs_toPoint
  62069. });
  62070. /**
  62071. * Conversion of lat/lon to MGRS.
  62072. *
  62073. * @param {object} ll Object literal with lat and lon properties on a
  62074. * WGS84 ellipsoid.
  62075. * @param {int} accuracy Accuracy in digits (5 for 1 m, 4 for 10 m, 3 for
  62076. * 100 m, 2 for 1000 m or 1 for 10000 m). Optional, default is 5.
  62077. * @return {string} the MGRS string for the given location and accuracy.
  62078. */
  62079. function mgrs_forward(ll, accuracy) {
  62080. accuracy = accuracy || 5; // default accuracy 1m
  62081. return encode(LLtoUTM({
  62082. lat: ll[1],
  62083. lon: ll[0]
  62084. }), accuracy);
  62085. };
  62086. /**
  62087. * Conversion of MGRS to lat/lon.
  62088. *
  62089. * @param {string} mgrs MGRS string.
  62090. * @return {array} An array with left (longitude), bottom (latitude), right
  62091. * (longitude) and top (latitude) values in WGS84, representing the
  62092. * bounding box for the provided MGRS reference.
  62093. */
  62094. function mgrs_inverse(mgrs) {
  62095. var bbox = UTMtoLL(decode(mgrs.toUpperCase()));
  62096. if (bbox.lat && bbox.lon) {
  62097. return [bbox.lon, bbox.lat, bbox.lon, bbox.lat];
  62098. }
  62099. return [bbox.left, bbox.bottom, bbox.right, bbox.top];
  62100. };
  62101. function mgrs_toPoint(mgrs) {
  62102. var bbox = UTMtoLL(decode(mgrs.toUpperCase()));
  62103. if (bbox.lat && bbox.lon) {
  62104. return [bbox.lon, bbox.lat];
  62105. }
  62106. return [(bbox.left + bbox.right) / 2, (bbox.top + bbox.bottom) / 2];
  62107. };
  62108. /**
  62109. * Conversion from degrees to radians.
  62110. *
  62111. * @private
  62112. * @param {number} deg the angle in degrees.
  62113. * @return {number} the angle in radians.
  62114. */
  62115. function degToRad(deg) {
  62116. return (deg * (Math.PI / 180.0));
  62117. }
  62118. /**
  62119. * Conversion from radians to degrees.
  62120. *
  62121. * @private
  62122. * @param {number} rad the angle in radians.
  62123. * @return {number} the angle in degrees.
  62124. */
  62125. function radToDeg(rad) {
  62126. return (180.0 * (rad / Math.PI));
  62127. }
  62128. /**
  62129. * Converts a set of Longitude and Latitude co-ordinates to UTM
  62130. * using the WGS84 ellipsoid.
  62131. *
  62132. * @private
  62133. * @param {object} ll Object literal with lat and lon properties
  62134. * representing the WGS84 coordinate to be converted.
  62135. * @return {object} Object literal containing the UTM value with easting,
  62136. * northing, zoneNumber and zoneLetter properties, and an optional
  62137. * accuracy property in digits. Returns null if the conversion failed.
  62138. */
  62139. function LLtoUTM(ll) {
  62140. var Lat = ll.lat;
  62141. var Long = ll.lon;
  62142. var a = 6378137.0; //ellip.radius;
  62143. var eccSquared = 0.00669438; //ellip.eccsq;
  62144. var k0 = 0.9996;
  62145. var LongOrigin;
  62146. var eccPrimeSquared;
  62147. var N, T, C, A, M;
  62148. var LatRad = degToRad(Lat);
  62149. var LongRad = degToRad(Long);
  62150. var LongOriginRad;
  62151. var ZoneNumber;
  62152. // (int)
  62153. ZoneNumber = Math.floor((Long + 180) / 6) + 1;
  62154. //Make sure the longitude 180.00 is in Zone 60
  62155. if (Long === 180) {
  62156. ZoneNumber = 60;
  62157. }
  62158. // Special zone for Norway
  62159. if (Lat >= 56.0 && Lat < 64.0 && Long >= 3.0 && Long < 12.0) {
  62160. ZoneNumber = 32;
  62161. }
  62162. // Special zones for Svalbard
  62163. if (Lat >= 72.0 && Lat < 84.0) {
  62164. if (Long >= 0.0 && Long < 9.0) {
  62165. ZoneNumber = 31;
  62166. }
  62167. else if (Long >= 9.0 && Long < 21.0) {
  62168. ZoneNumber = 33;
  62169. }
  62170. else if (Long >= 21.0 && Long < 33.0) {
  62171. ZoneNumber = 35;
  62172. }
  62173. else if (Long >= 33.0 && Long < 42.0) {
  62174. ZoneNumber = 37;
  62175. }
  62176. }
  62177. LongOrigin = (ZoneNumber - 1) * 6 - 180 + 3; //+3 puts origin
  62178. // in middle of
  62179. // zone
  62180. LongOriginRad = degToRad(LongOrigin);
  62181. eccPrimeSquared = (eccSquared) / (1 - eccSquared);
  62182. N = a / Math.sqrt(1 - eccSquared * Math.sin(LatRad) * Math.sin(LatRad));
  62183. T = Math.tan(LatRad) * Math.tan(LatRad);
  62184. C = eccPrimeSquared * Math.cos(LatRad) * Math.cos(LatRad);
  62185. A = Math.cos(LatRad) * (LongRad - LongOriginRad);
  62186. M = a * ((1 - eccSquared / 4 - 3 * eccSquared * eccSquared / 64 - 5 * eccSquared * eccSquared * eccSquared / 256) * LatRad - (3 * eccSquared / 8 + 3 * eccSquared * eccSquared / 32 + 45 * eccSquared * eccSquared * eccSquared / 1024) * Math.sin(2 * LatRad) + (15 * eccSquared * eccSquared / 256 + 45 * eccSquared * eccSquared * eccSquared / 1024) * Math.sin(4 * LatRad) - (35 * eccSquared * eccSquared * eccSquared / 3072) * Math.sin(6 * LatRad));
  62187. var UTMEasting = (k0 * N * (A + (1 - T + C) * A * A * A / 6.0 + (5 - 18 * T + T * T + 72 * C - 58 * eccPrimeSquared) * A * A * A * A * A / 120.0) + 500000.0);
  62188. var UTMNorthing = (k0 * (M + N * Math.tan(LatRad) * (A * A / 2 + (5 - T + 9 * C + 4 * C * C) * A * A * A * A / 24.0 + (61 - 58 * T + T * T + 600 * C - 330 * eccPrimeSquared) * A * A * A * A * A * A / 720.0)));
  62189. if (Lat < 0.0) {
  62190. UTMNorthing += 10000000.0; //10000000 meter offset for
  62191. // southern hemisphere
  62192. }
  62193. return {
  62194. northing: Math.round(UTMNorthing),
  62195. easting: Math.round(UTMEasting),
  62196. zoneNumber: ZoneNumber,
  62197. zoneLetter: getLetterDesignator(Lat)
  62198. };
  62199. }
  62200. /**
  62201. * Converts UTM coords to lat/long, using the WGS84 ellipsoid. This is a convenience
  62202. * class where the Zone can be specified as a single string eg."60N" which
  62203. * is then broken down into the ZoneNumber and ZoneLetter.
  62204. *
  62205. * @private
  62206. * @param {object} utm An object literal with northing, easting, zoneNumber
  62207. * and zoneLetter properties. If an optional accuracy property is
  62208. * provided (in meters), a bounding box will be returned instead of
  62209. * latitude and longitude.
  62210. * @return {object} An object literal containing either lat and lon values
  62211. * (if no accuracy was provided), or top, right, bottom and left values
  62212. * for the bounding box calculated according to the provided accuracy.
  62213. * Returns null if the conversion failed.
  62214. */
  62215. function UTMtoLL(utm) {
  62216. var UTMNorthing = utm.northing;
  62217. var UTMEasting = utm.easting;
  62218. var zoneLetter = utm.zoneLetter;
  62219. var zoneNumber = utm.zoneNumber;
  62220. // check the ZoneNummber is valid
  62221. if (zoneNumber < 0 || zoneNumber > 60) {
  62222. return null;
  62223. }
  62224. var k0 = 0.9996;
  62225. var a = 6378137.0; //ellip.radius;
  62226. var eccSquared = 0.00669438; //ellip.eccsq;
  62227. var eccPrimeSquared;
  62228. var e1 = (1 - Math.sqrt(1 - eccSquared)) / (1 + Math.sqrt(1 - eccSquared));
  62229. var N1, T1, C1, R1, D, M;
  62230. var LongOrigin;
  62231. var mu, phi1Rad;
  62232. // remove 500,000 meter offset for longitude
  62233. var x = UTMEasting - 500000.0;
  62234. var y = UTMNorthing;
  62235. // We must know somehow if we are in the Northern or Southern
  62236. // hemisphere, this is the only time we use the letter So even
  62237. // if the Zone letter isn't exactly correct it should indicate
  62238. // the hemisphere correctly
  62239. if (zoneLetter < 'N') {
  62240. y -= 10000000.0; // remove 10,000,000 meter offset used
  62241. // for southern hemisphere
  62242. }
  62243. // There are 60 zones with zone 1 being at West -180 to -174
  62244. LongOrigin = (zoneNumber - 1) * 6 - 180 + 3; // +3 puts origin
  62245. // in middle of
  62246. // zone
  62247. eccPrimeSquared = (eccSquared) / (1 - eccSquared);
  62248. M = y / k0;
  62249. mu = M / (a * (1 - eccSquared / 4 - 3 * eccSquared * eccSquared / 64 - 5 * eccSquared * eccSquared * eccSquared / 256));
  62250. phi1Rad = mu + (3 * e1 / 2 - 27 * e1 * e1 * e1 / 32) * Math.sin(2 * mu) + (21 * e1 * e1 / 16 - 55 * e1 * e1 * e1 * e1 / 32) * Math.sin(4 * mu) + (151 * e1 * e1 * e1 / 96) * Math.sin(6 * mu);
  62251. // double phi1 = ProjMath.radToDeg(phi1Rad);
  62252. N1 = a / Math.sqrt(1 - eccSquared * Math.sin(phi1Rad) * Math.sin(phi1Rad));
  62253. T1 = Math.tan(phi1Rad) * Math.tan(phi1Rad);
  62254. C1 = eccPrimeSquared * Math.cos(phi1Rad) * Math.cos(phi1Rad);
  62255. R1 = a * (1 - eccSquared) / Math.pow(1 - eccSquared * Math.sin(phi1Rad) * Math.sin(phi1Rad), 1.5);
  62256. D = x / (N1 * k0);
  62257. var lat = phi1Rad - (N1 * Math.tan(phi1Rad) / R1) * (D * D / 2 - (5 + 3 * T1 + 10 * C1 - 4 * C1 * C1 - 9 * eccPrimeSquared) * D * D * D * D / 24 + (61 + 90 * T1 + 298 * C1 + 45 * T1 * T1 - 252 * eccPrimeSquared - 3 * C1 * C1) * D * D * D * D * D * D / 720);
  62258. lat = radToDeg(lat);
  62259. var lon = (D - (1 + 2 * T1 + C1) * D * D * D / 6 + (5 - 2 * C1 + 28 * T1 - 3 * C1 * C1 + 8 * eccPrimeSquared + 24 * T1 * T1) * D * D * D * D * D / 120) / Math.cos(phi1Rad);
  62260. lon = LongOrigin + radToDeg(lon);
  62261. var result;
  62262. if (utm.accuracy) {
  62263. var topRight = UTMtoLL({
  62264. northing: utm.northing + utm.accuracy,
  62265. easting: utm.easting + utm.accuracy,
  62266. zoneLetter: utm.zoneLetter,
  62267. zoneNumber: utm.zoneNumber
  62268. });
  62269. result = {
  62270. top: topRight.lat,
  62271. right: topRight.lon,
  62272. bottom: lat,
  62273. left: lon
  62274. };
  62275. }
  62276. else {
  62277. result = {
  62278. lat: lat,
  62279. lon: lon
  62280. };
  62281. }
  62282. return result;
  62283. }
  62284. /**
  62285. * Calculates the MGRS letter designator for the given latitude.
  62286. *
  62287. * @private
  62288. * @param {number} lat The latitude in WGS84 to get the letter designator
  62289. * for.
  62290. * @return {char} The letter designator.
  62291. */
  62292. function getLetterDesignator(lat) {
  62293. //This is here as an error flag to show that the Latitude is
  62294. //outside MGRS limits
  62295. var LetterDesignator = 'Z';
  62296. if ((84 >= lat) && (lat >= 72)) {
  62297. LetterDesignator = 'X';
  62298. }
  62299. else if ((72 > lat) && (lat >= 64)) {
  62300. LetterDesignator = 'W';
  62301. }
  62302. else if ((64 > lat) && (lat >= 56)) {
  62303. LetterDesignator = 'V';
  62304. }
  62305. else if ((56 > lat) && (lat >= 48)) {
  62306. LetterDesignator = 'U';
  62307. }
  62308. else if ((48 > lat) && (lat >= 40)) {
  62309. LetterDesignator = 'T';
  62310. }
  62311. else if ((40 > lat) && (lat >= 32)) {
  62312. LetterDesignator = 'S';
  62313. }
  62314. else if ((32 > lat) && (lat >= 24)) {
  62315. LetterDesignator = 'R';
  62316. }
  62317. else if ((24 > lat) && (lat >= 16)) {
  62318. LetterDesignator = 'Q';
  62319. }
  62320. else if ((16 > lat) && (lat >= 8)) {
  62321. LetterDesignator = 'P';
  62322. }
  62323. else if ((8 > lat) && (lat >= 0)) {
  62324. LetterDesignator = 'N';
  62325. }
  62326. else if ((0 > lat) && (lat >= -8)) {
  62327. LetterDesignator = 'M';
  62328. }
  62329. else if ((-8 > lat) && (lat >= -16)) {
  62330. LetterDesignator = 'L';
  62331. }
  62332. else if ((-16 > lat) && (lat >= -24)) {
  62333. LetterDesignator = 'K';
  62334. }
  62335. else if ((-24 > lat) && (lat >= -32)) {
  62336. LetterDesignator = 'J';
  62337. }
  62338. else if ((-32 > lat) && (lat >= -40)) {
  62339. LetterDesignator = 'H';
  62340. }
  62341. else if ((-40 > lat) && (lat >= -48)) {
  62342. LetterDesignator = 'G';
  62343. }
  62344. else if ((-48 > lat) && (lat >= -56)) {
  62345. LetterDesignator = 'F';
  62346. }
  62347. else if ((-56 > lat) && (lat >= -64)) {
  62348. LetterDesignator = 'E';
  62349. }
  62350. else if ((-64 > lat) && (lat >= -72)) {
  62351. LetterDesignator = 'D';
  62352. }
  62353. else if ((-72 > lat) && (lat >= -80)) {
  62354. LetterDesignator = 'C';
  62355. }
  62356. return LetterDesignator;
  62357. }
  62358. /**
  62359. * Encodes a UTM location as MGRS string.
  62360. *
  62361. * @private
  62362. * @param {object} utm An object literal with easting, northing,
  62363. * zoneLetter, zoneNumber
  62364. * @param {number} accuracy Accuracy in digits (1-5).
  62365. * @return {string} MGRS string for the given UTM location.
  62366. */
  62367. function encode(utm, accuracy) {
  62368. // prepend with leading zeroes
  62369. var seasting = "00000" + utm.easting,
  62370. snorthing = "00000" + utm.northing;
  62371. return utm.zoneNumber + utm.zoneLetter + get100kID(utm.easting, utm.northing, utm.zoneNumber) + seasting.substr(seasting.length - 5, accuracy) + snorthing.substr(snorthing.length - 5, accuracy);
  62372. }
  62373. /**
  62374. * Get the two letter 100k designator for a given UTM easting,
  62375. * northing and zone number value.
  62376. *
  62377. * @private
  62378. * @param {number} easting
  62379. * @param {number} northing
  62380. * @param {number} zoneNumber
  62381. * @return the two letter 100k designator for the given UTM location.
  62382. */
  62383. function get100kID(easting, northing, zoneNumber) {
  62384. var setParm = get100kSetForZone(zoneNumber);
  62385. var setColumn = Math.floor(easting / 100000);
  62386. var setRow = Math.floor(northing / 100000) % 20;
  62387. return getLetter100kID(setColumn, setRow, setParm);
  62388. }
  62389. /**
  62390. * Given a UTM zone number, figure out the MGRS 100K set it is in.
  62391. *
  62392. * @private
  62393. * @param {number} i An UTM zone number.
  62394. * @return {number} the 100k set the UTM zone is in.
  62395. */
  62396. function get100kSetForZone(i) {
  62397. var setParm = i % NUM_100K_SETS;
  62398. if (setParm === 0) {
  62399. setParm = NUM_100K_SETS;
  62400. }
  62401. return setParm;
  62402. }
  62403. /**
  62404. * Get the two-letter MGRS 100k designator given information
  62405. * translated from the UTM northing, easting and zone number.
  62406. *
  62407. * @private
  62408. * @param {number} column the column index as it relates to the MGRS
  62409. * 100k set spreadsheet, created from the UTM easting.
  62410. * Values are 1-8.
  62411. * @param {number} row the row index as it relates to the MGRS 100k set
  62412. * spreadsheet, created from the UTM northing value. Values
  62413. * are from 0-19.
  62414. * @param {number} parm the set block, as it relates to the MGRS 100k set
  62415. * spreadsheet, created from the UTM zone. Values are from
  62416. * 1-60.
  62417. * @return two letter MGRS 100k code.
  62418. */
  62419. function getLetter100kID(column, row, parm) {
  62420. // colOrigin and rowOrigin are the letters at the origin of the set
  62421. var index = parm - 1;
  62422. var colOrigin = SET_ORIGIN_COLUMN_LETTERS.charCodeAt(index);
  62423. var rowOrigin = SET_ORIGIN_ROW_LETTERS.charCodeAt(index);
  62424. // colInt and rowInt are the letters to build to return
  62425. var colInt = colOrigin + column - 1;
  62426. var rowInt = rowOrigin + row;
  62427. var rollover = false;
  62428. if (colInt > Z) {
  62429. colInt = colInt - Z + A - 1;
  62430. rollover = true;
  62431. }
  62432. if (colInt === I || (colOrigin < I && colInt > I) || ((colInt > I || colOrigin < I) && rollover)) {
  62433. colInt++;
  62434. }
  62435. if (colInt === O || (colOrigin < O && colInt > O) || ((colInt > O || colOrigin < O) && rollover)) {
  62436. colInt++;
  62437. if (colInt === I) {
  62438. colInt++;
  62439. }
  62440. }
  62441. if (colInt > Z) {
  62442. colInt = colInt - Z + A - 1;
  62443. }
  62444. if (rowInt > V) {
  62445. rowInt = rowInt - V + A - 1;
  62446. rollover = true;
  62447. }
  62448. else {
  62449. rollover = false;
  62450. }
  62451. if (((rowInt === I) || ((rowOrigin < I) && (rowInt > I))) || (((rowInt > I) || (rowOrigin < I)) && rollover)) {
  62452. rowInt++;
  62453. }
  62454. if (((rowInt === O) || ((rowOrigin < O) && (rowInt > O))) || (((rowInt > O) || (rowOrigin < O)) && rollover)) {
  62455. rowInt++;
  62456. if (rowInt === I) {
  62457. rowInt++;
  62458. }
  62459. }
  62460. if (rowInt > V) {
  62461. rowInt = rowInt - V + A - 1;
  62462. }
  62463. var twoLetter = String.fromCharCode(colInt) + String.fromCharCode(rowInt);
  62464. return twoLetter;
  62465. }
  62466. /**
  62467. * Decode the UTM parameters from a MGRS string.
  62468. *
  62469. * @private
  62470. * @param {string} mgrsString an UPPERCASE coordinate string is expected.
  62471. * @return {object} An object literal with easting, northing, zoneLetter,
  62472. * zoneNumber and accuracy (in meters) properties.
  62473. */
  62474. function decode(mgrsString) {
  62475. if (mgrsString && mgrsString.length === 0) {
  62476. throw ("MGRSPoint coverting from nothing");
  62477. }
  62478. var length = mgrsString.length;
  62479. var hunK = null;
  62480. var sb = "";
  62481. var testChar;
  62482. var i = 0;
  62483. // get Zone number
  62484. while (!(/[A-Z]/).test(testChar = mgrsString.charAt(i))) {
  62485. if (i >= 2) {
  62486. throw ("MGRSPoint bad conversion from: " + mgrsString);
  62487. }
  62488. sb += testChar;
  62489. i++;
  62490. }
  62491. var zoneNumber = parseInt(sb, 10);
  62492. if (i === 0 || i + 3 > length) {
  62493. // A good MGRS string has to be 4-5 digits long,
  62494. // ##AAA/#AAA at least.
  62495. throw ("MGRSPoint bad conversion from: " + mgrsString);
  62496. }
  62497. var zoneLetter = mgrsString.charAt(i++);
  62498. // Should we check the zone letter here? Why not.
  62499. if (zoneLetter <= 'A' || zoneLetter === 'B' || zoneLetter === 'Y' || zoneLetter >= 'Z' || zoneLetter === 'I' || zoneLetter === 'O') {
  62500. throw ("MGRSPoint zone letter " + zoneLetter + " not handled: " + mgrsString);
  62501. }
  62502. hunK = mgrsString.substring(i, i += 2);
  62503. var set = get100kSetForZone(zoneNumber);
  62504. var east100k = getEastingFromChar(hunK.charAt(0), set);
  62505. var north100k = getNorthingFromChar(hunK.charAt(1), set);
  62506. // We have a bug where the northing may be 2000000 too low.
  62507. // How
  62508. // do we know when to roll over?
  62509. while (north100k < getMinNorthing(zoneLetter)) {
  62510. north100k += 2000000;
  62511. }
  62512. // calculate the char index for easting/northing separator
  62513. var remainder = length - i;
  62514. if (remainder % 2 !== 0) {
  62515. throw ("MGRSPoint has to have an even number \nof digits after the zone letter and two 100km letters - front \nhalf for easting meters, second half for \nnorthing meters" + mgrsString);
  62516. }
  62517. var sep = remainder / 2;
  62518. var sepEasting = 0.0;
  62519. var sepNorthing = 0.0;
  62520. var accuracyBonus, sepEastingString, sepNorthingString, easting, northing;
  62521. if (sep > 0) {
  62522. accuracyBonus = 100000.0 / Math.pow(10, sep);
  62523. sepEastingString = mgrsString.substring(i, i + sep);
  62524. sepEasting = parseFloat(sepEastingString) * accuracyBonus;
  62525. sepNorthingString = mgrsString.substring(i + sep);
  62526. sepNorthing = parseFloat(sepNorthingString) * accuracyBonus;
  62527. }
  62528. easting = sepEasting + east100k;
  62529. northing = sepNorthing + north100k;
  62530. return {
  62531. easting: easting,
  62532. northing: northing,
  62533. zoneLetter: zoneLetter,
  62534. zoneNumber: zoneNumber,
  62535. accuracy: accuracyBonus
  62536. };
  62537. }
  62538. /**
  62539. * Given the first letter from a two-letter MGRS 100k zone, and given the
  62540. * MGRS table set for the zone number, figure out the easting value that
  62541. * should be added to the other, secondary easting value.
  62542. *
  62543. * @private
  62544. * @param {char} e The first letter from a two-letter MGRS 100´k zone.
  62545. * @param {number} set The MGRS table set for the zone number.
  62546. * @return {number} The easting value for the given letter and set.
  62547. */
  62548. function getEastingFromChar(e, set) {
  62549. // colOrigin is the letter at the origin of the set for the
  62550. // column
  62551. var curCol = SET_ORIGIN_COLUMN_LETTERS.charCodeAt(set - 1);
  62552. var eastingValue = 100000.0;
  62553. var rewindMarker = false;
  62554. while (curCol !== e.charCodeAt(0)) {
  62555. curCol++;
  62556. if (curCol === I) {
  62557. curCol++;
  62558. }
  62559. if (curCol === O) {
  62560. curCol++;
  62561. }
  62562. if (curCol > Z) {
  62563. if (rewindMarker) {
  62564. throw ("Bad character: " + e);
  62565. }
  62566. curCol = A;
  62567. rewindMarker = true;
  62568. }
  62569. eastingValue += 100000.0;
  62570. }
  62571. return eastingValue;
  62572. }
  62573. /**
  62574. * Given the second letter from a two-letter MGRS 100k zone, and given the
  62575. * MGRS table set for the zone number, figure out the northing value that
  62576. * should be added to the other, secondary northing value. You have to
  62577. * remember that Northings are determined from the equator, and the vertical
  62578. * cycle of letters mean a 2000000 additional northing meters. This happens
  62579. * approx. every 18 degrees of latitude. This method does *NOT* count any
  62580. * additional northings. You have to figure out how many 2000000 meters need
  62581. * to be added for the zone letter of the MGRS coordinate.
  62582. *
  62583. * @private
  62584. * @param {char} n Second letter of the MGRS 100k zone
  62585. * @param {number} set The MGRS table set number, which is dependent on the
  62586. * UTM zone number.
  62587. * @return {number} The northing value for the given letter and set.
  62588. */
  62589. function getNorthingFromChar(n, set) {
  62590. if (n > 'V') {
  62591. throw ("MGRSPoint given invalid Northing " + n);
  62592. }
  62593. // rowOrigin is the letter at the origin of the set for the
  62594. // column
  62595. var curRow = SET_ORIGIN_ROW_LETTERS.charCodeAt(set - 1);
  62596. var northingValue = 0.0;
  62597. var rewindMarker = false;
  62598. while (curRow !== n.charCodeAt(0)) {
  62599. curRow++;
  62600. if (curRow === I) {
  62601. curRow++;
  62602. }
  62603. if (curRow === O) {
  62604. curRow++;
  62605. }
  62606. // fixing a bug making whole application hang in this loop
  62607. // when 'n' is a wrong character
  62608. if (curRow > V) {
  62609. if (rewindMarker) { // making sure that this loop ends
  62610. throw ("Bad character: " + n);
  62611. }
  62612. curRow = A;
  62613. rewindMarker = true;
  62614. }
  62615. northingValue += 100000.0;
  62616. }
  62617. return northingValue;
  62618. }
  62619. /**
  62620. * The function getMinNorthing returns the minimum northing value of a MGRS
  62621. * zone.
  62622. *
  62623. * Ported from Geotrans' c Lattitude_Band_Value structure table.
  62624. *
  62625. * @private
  62626. * @param {char} zoneLetter The MGRS zone to get the min northing for.
  62627. * @return {number}
  62628. */
  62629. function getMinNorthing(zoneLetter) {
  62630. var northing;
  62631. switch (zoneLetter) {
  62632. case 'C':
  62633. northing = 1100000.0;
  62634. break;
  62635. case 'D':
  62636. northing = 2000000.0;
  62637. break;
  62638. case 'E':
  62639. northing = 2800000.0;
  62640. break;
  62641. case 'F':
  62642. northing = 3700000.0;
  62643. break;
  62644. case 'G':
  62645. northing = 4600000.0;
  62646. break;
  62647. case 'H':
  62648. northing = 5500000.0;
  62649. break;
  62650. case 'J':
  62651. northing = 6400000.0;
  62652. break;
  62653. case 'K':
  62654. northing = 7300000.0;
  62655. break;
  62656. case 'L':
  62657. northing = 8200000.0;
  62658. break;
  62659. case 'M':
  62660. northing = 9100000.0;
  62661. break;
  62662. case 'N':
  62663. northing = 0.0;
  62664. break;
  62665. case 'P':
  62666. northing = 800000.0;
  62667. break;
  62668. case 'Q':
  62669. northing = 1700000.0;
  62670. break;
  62671. case 'R':
  62672. northing = 2600000.0;
  62673. break;
  62674. case 'S':
  62675. northing = 3500000.0;
  62676. break;
  62677. case 'T':
  62678. northing = 4400000.0;
  62679. break;
  62680. case 'U':
  62681. northing = 5300000.0;
  62682. break;
  62683. case 'V':
  62684. northing = 6200000.0;
  62685. break;
  62686. case 'W':
  62687. northing = 7000000.0;
  62688. break;
  62689. case 'X':
  62690. northing = 7900000.0;
  62691. break;
  62692. default:
  62693. northing = -1.0;
  62694. }
  62695. if (northing >= 0.0) {
  62696. return northing;
  62697. }
  62698. else {
  62699. throw ("Invalid zone letter: " + zoneLetter);
  62700. }
  62701. }
  62702. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/Point.js
  62703. function lib_Point_Point(x, y, z) {
  62704. if (!(this instanceof lib_Point_Point)) {
  62705. return new lib_Point_Point(x, y, z);
  62706. }
  62707. if (Array.isArray(x)) {
  62708. this.x = x[0];
  62709. this.y = x[1];
  62710. this.z = x[2] || 0.0;
  62711. } else if(typeof x === 'object') {
  62712. this.x = x.x;
  62713. this.y = x.y;
  62714. this.z = x.z || 0.0;
  62715. } else if (typeof x === 'string' && typeof y === 'undefined') {
  62716. var coords = x.split(',');
  62717. this.x = parseFloat(coords[0], 10);
  62718. this.y = parseFloat(coords[1], 10);
  62719. this.z = parseFloat(coords[2], 10) || 0.0;
  62720. } else {
  62721. this.x = x;
  62722. this.y = y;
  62723. this.z = z || 0.0;
  62724. }
  62725. console.warn('proj4.Point will be removed in version 3, use proj4.toPoint');
  62726. }
  62727. lib_Point_Point.fromMGRS = function(mgrsStr) {
  62728. return new lib_Point_Point(mgrs_toPoint(mgrsStr));
  62729. };
  62730. lib_Point_Point.prototype.toMGRS = function(accuracy) {
  62731. return mgrs_forward([this.x, this.y], accuracy);
  62732. };
  62733. /* harmony default export */ const lib_Point = (lib_Point_Point);
  62734. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/pj_enfn.js
  62735. var C00 = 1;
  62736. var C02 = 0.25;
  62737. var C04 = 0.046875;
  62738. var C06 = 0.01953125;
  62739. var C08 = 0.01068115234375;
  62740. var C22 = 0.75;
  62741. var C44 = 0.46875;
  62742. var C46 = 0.01302083333333333333;
  62743. var C48 = 0.00712076822916666666;
  62744. var C66 = 0.36458333333333333333;
  62745. var C68 = 0.00569661458333333333;
  62746. var C88 = 0.3076171875;
  62747. /* harmony default export */ function pj_enfn(es) {
  62748. var en = [];
  62749. en[0] = C00 - es * (C02 + es * (C04 + es * (C06 + es * C08)));
  62750. en[1] = es * (C22 - es * (C04 + es * (C06 + es * C08)));
  62751. var t = es * es;
  62752. en[2] = t * (C44 - es * (C46 + es * C48));
  62753. t *= es;
  62754. en[3] = t * (C66 - es * C68);
  62755. en[4] = t * es * C88;
  62756. return en;
  62757. }
  62758. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/pj_mlfn.js
  62759. /* harmony default export */ function pj_mlfn(phi, sphi, cphi, en) {
  62760. cphi *= sphi;
  62761. sphi *= sphi;
  62762. return (en[0] * phi - cphi * (en[1] + sphi * (en[2] + sphi * (en[3] + sphi * en[4]))));
  62763. }
  62764. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/pj_inv_mlfn.js
  62765. var MAX_ITER = 20;
  62766. /* harmony default export */ function pj_inv_mlfn(arg, es, en) {
  62767. var k = 1 / (1 - es);
  62768. var phi = arg;
  62769. for (var i = MAX_ITER; i; --i) { /* rarely goes over 2 iterations */
  62770. var s = Math.sin(phi);
  62771. var t = 1 - es * s * s;
  62772. //t = this.pj_mlfn(phi, s, Math.cos(phi), en) - arg;
  62773. //phi -= t * (t * Math.sqrt(t)) * k;
  62774. t = (pj_mlfn(phi, s, Math.cos(phi), en) - arg) * (t * Math.sqrt(t)) * k;
  62775. phi -= t;
  62776. if (Math.abs(t) < EPSLN) {
  62777. return phi;
  62778. }
  62779. }
  62780. //..reportError("cass:pj_inv_mlfn: Convergence error");
  62781. return phi;
  62782. }
  62783. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/tmerc.js
  62784. // Heavily based on this tmerc projection implementation
  62785. // https://github.com/mbloch/mapshaper-proj/blob/master/src/projections/tmerc.js
  62786. function tmerc_init() {
  62787. this.x0 = this.x0 !== undefined ? this.x0 : 0;
  62788. this.y0 = this.y0 !== undefined ? this.y0 : 0;
  62789. this.long0 = this.long0 !== undefined ? this.long0 : 0;
  62790. this.lat0 = this.lat0 !== undefined ? this.lat0 : 0;
  62791. if (this.es) {
  62792. this.en = pj_enfn(this.es);
  62793. this.ml0 = pj_mlfn(this.lat0, Math.sin(this.lat0), Math.cos(this.lat0), this.en);
  62794. }
  62795. }
  62796. /**
  62797. Transverse Mercator Forward - long/lat to x/y
  62798. long/lat in radians
  62799. */
  62800. function tmerc_forward(p) {
  62801. var lon = p.x;
  62802. var lat = p.y;
  62803. var delta_lon = adjust_lon(lon - this.long0);
  62804. var con;
  62805. var x, y;
  62806. var sin_phi = Math.sin(lat);
  62807. var cos_phi = Math.cos(lat);
  62808. if (!this.es) {
  62809. var b = cos_phi * Math.sin(delta_lon);
  62810. if ((Math.abs(Math.abs(b) - 1)) < EPSLN) {
  62811. return (93);
  62812. }
  62813. else {
  62814. x = 0.5 * this.a * this.k0 * Math.log((1 + b) / (1 - b)) + this.x0;
  62815. y = cos_phi * Math.cos(delta_lon) / Math.sqrt(1 - Math.pow(b, 2));
  62816. b = Math.abs(y);
  62817. if (b >= 1) {
  62818. if ((b - 1) > EPSLN) {
  62819. return (93);
  62820. }
  62821. else {
  62822. y = 0;
  62823. }
  62824. }
  62825. else {
  62826. y = Math.acos(y);
  62827. }
  62828. if (lat < 0) {
  62829. y = -y;
  62830. }
  62831. y = this.a * this.k0 * (y - this.lat0) + this.y0;
  62832. }
  62833. }
  62834. else {
  62835. var al = cos_phi * delta_lon;
  62836. var als = Math.pow(al, 2);
  62837. var c = this.ep2 * Math.pow(cos_phi, 2);
  62838. var cs = Math.pow(c, 2);
  62839. var tq = Math.abs(cos_phi) > EPSLN ? Math.tan(lat) : 0;
  62840. var t = Math.pow(tq, 2);
  62841. var ts = Math.pow(t, 2);
  62842. con = 1 - this.es * Math.pow(sin_phi, 2);
  62843. al = al / Math.sqrt(con);
  62844. var ml = pj_mlfn(lat, sin_phi, cos_phi, this.en);
  62845. x = this.a * (this.k0 * al * (1 +
  62846. als / 6 * (1 - t + c +
  62847. als / 20 * (5 - 18 * t + ts + 14 * c - 58 * t * c +
  62848. als / 42 * (61 + 179 * ts - ts * t - 479 * t))))) +
  62849. this.x0;
  62850. y = this.a * (this.k0 * (ml - this.ml0 +
  62851. sin_phi * delta_lon * al / 2 * (1 +
  62852. als / 12 * (5 - t + 9 * c + 4 * cs +
  62853. als / 30 * (61 + ts - 58 * t + 270 * c - 330 * t * c +
  62854. als / 56 * (1385 + 543 * ts - ts * t - 3111 * t)))))) +
  62855. this.y0;
  62856. }
  62857. p.x = x;
  62858. p.y = y;
  62859. return p;
  62860. }
  62861. /**
  62862. Transverse Mercator Inverse - x/y to long/lat
  62863. */
  62864. function tmerc_inverse(p) {
  62865. var con, phi;
  62866. var lat, lon;
  62867. var x = (p.x - this.x0) * (1 / this.a);
  62868. var y = (p.y - this.y0) * (1 / this.a);
  62869. if (!this.es) {
  62870. var f = Math.exp(x / this.k0);
  62871. var g = 0.5 * (f - 1 / f);
  62872. var temp = this.lat0 + y / this.k0;
  62873. var h = Math.cos(temp);
  62874. con = Math.sqrt((1 - Math.pow(h, 2)) / (1 + Math.pow(g, 2)));
  62875. lat = Math.asin(con);
  62876. if (y < 0) {
  62877. lat = -lat;
  62878. }
  62879. if ((g === 0) && (h === 0)) {
  62880. lon = 0;
  62881. }
  62882. else {
  62883. lon = adjust_lon(Math.atan2(g, h) + this.long0);
  62884. }
  62885. }
  62886. else { // ellipsoidal form
  62887. con = this.ml0 + y / this.k0;
  62888. phi = pj_inv_mlfn(con, this.es, this.en);
  62889. if (Math.abs(phi) < HALF_PI) {
  62890. var sin_phi = Math.sin(phi);
  62891. var cos_phi = Math.cos(phi);
  62892. var tan_phi = Math.abs(cos_phi) > EPSLN ? Math.tan(phi) : 0;
  62893. var c = this.ep2 * Math.pow(cos_phi, 2);
  62894. var cs = Math.pow(c, 2);
  62895. var t = Math.pow(tan_phi, 2);
  62896. var ts = Math.pow(t, 2);
  62897. con = 1 - this.es * Math.pow(sin_phi, 2);
  62898. var d = x * Math.sqrt(con) / this.k0;
  62899. var ds = Math.pow(d, 2);
  62900. con = con * tan_phi;
  62901. lat = phi - (con * ds / (1 - this.es)) * 0.5 * (1 -
  62902. ds / 12 * (5 + 3 * t - 9 * c * t + c - 4 * cs -
  62903. ds / 30 * (61 + 90 * t - 252 * c * t + 45 * ts + 46 * c -
  62904. ds / 56 * (1385 + 3633 * t + 4095 * ts + 1574 * ts * t))));
  62905. lon = adjust_lon(this.long0 + (d * (1 -
  62906. ds / 6 * (1 + 2 * t + c -
  62907. ds / 20 * (5 + 28 * t + 24 * ts + 8 * c * t + 6 * c -
  62908. ds / 42 * (61 + 662 * t + 1320 * ts + 720 * ts * t)))) / cos_phi));
  62909. }
  62910. else {
  62911. lat = HALF_PI * sign(y);
  62912. lon = 0;
  62913. }
  62914. }
  62915. p.x = lon;
  62916. p.y = lat;
  62917. return p;
  62918. }
  62919. var tmerc_names = ["Transverse_Mercator", "Transverse Mercator", "tmerc"];
  62920. /* harmony default export */ const tmerc = ({
  62921. init: tmerc_init,
  62922. forward: tmerc_forward,
  62923. inverse: tmerc_inverse,
  62924. names: tmerc_names
  62925. });
  62926. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/sinh.js
  62927. /* harmony default export */ function sinh(x) {
  62928. var r = Math.exp(x);
  62929. r = (r - 1 / r) / 2;
  62930. return r;
  62931. }
  62932. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/hypot.js
  62933. /* harmony default export */ function hypot(x, y) {
  62934. x = Math.abs(x);
  62935. y = Math.abs(y);
  62936. var a = Math.max(x, y);
  62937. var b = Math.min(x, y) / (a ? a : 1);
  62938. return a * Math.sqrt(1 + Math.pow(b, 2));
  62939. }
  62940. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/log1py.js
  62941. /* harmony default export */ function log1py(x) {
  62942. var y = 1 + x;
  62943. var z = y - 1;
  62944. return z === 0 ? x : x * Math.log(y) / z;
  62945. }
  62946. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/asinhy.js
  62947. /* harmony default export */ function asinhy(x) {
  62948. var y = Math.abs(x);
  62949. y = log1py(y * (1 + y / (hypot(1, y) + 1)));
  62950. return x < 0 ? -y : y;
  62951. }
  62952. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/gatg.js
  62953. /* harmony default export */ function gatg(pp, B) {
  62954. var cos_2B = 2 * Math.cos(2 * B);
  62955. var i = pp.length - 1;
  62956. var h1 = pp[i];
  62957. var h2 = 0;
  62958. var h;
  62959. while (--i >= 0) {
  62960. h = -h2 + cos_2B * h1 + pp[i];
  62961. h2 = h1;
  62962. h1 = h;
  62963. }
  62964. return (B + h * Math.sin(2 * B));
  62965. }
  62966. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/clens.js
  62967. /* harmony default export */ function clens(pp, arg_r) {
  62968. var r = 2 * Math.cos(arg_r);
  62969. var i = pp.length - 1;
  62970. var hr1 = pp[i];
  62971. var hr2 = 0;
  62972. var hr;
  62973. while (--i >= 0) {
  62974. hr = -hr2 + r * hr1 + pp[i];
  62975. hr2 = hr1;
  62976. hr1 = hr;
  62977. }
  62978. return Math.sin(arg_r) * hr;
  62979. }
  62980. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/cosh.js
  62981. /* harmony default export */ function cosh(x) {
  62982. var r = Math.exp(x);
  62983. r = (r + 1 / r) / 2;
  62984. return r;
  62985. }
  62986. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/clens_cmplx.js
  62987. /* harmony default export */ function clens_cmplx(pp, arg_r, arg_i) {
  62988. var sin_arg_r = Math.sin(arg_r);
  62989. var cos_arg_r = Math.cos(arg_r);
  62990. var sinh_arg_i = sinh(arg_i);
  62991. var cosh_arg_i = cosh(arg_i);
  62992. var r = 2 * cos_arg_r * cosh_arg_i;
  62993. var i = -2 * sin_arg_r * sinh_arg_i;
  62994. var j = pp.length - 1;
  62995. var hr = pp[j];
  62996. var hi1 = 0;
  62997. var hr1 = 0;
  62998. var hi = 0;
  62999. var hr2;
  63000. var hi2;
  63001. while (--j >= 0) {
  63002. hr2 = hr1;
  63003. hi2 = hi1;
  63004. hr1 = hr;
  63005. hi1 = hi;
  63006. hr = -hr2 + r * hr1 - i * hi1 + pp[j];
  63007. hi = -hi2 + i * hr1 + r * hi1;
  63008. }
  63009. r = sin_arg_r * cosh_arg_i;
  63010. i = cos_arg_r * sinh_arg_i;
  63011. return [r * hr - i * hi, r * hi + i * hr];
  63012. }
  63013. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/etmerc.js
  63014. // Heavily based on this etmerc projection implementation
  63015. // https://github.com/mbloch/mapshaper-proj/blob/master/src/projections/etmerc.js
  63016. function etmerc_init() {
  63017. if (this.es === undefined || this.es <= 0) {
  63018. throw new Error('incorrect elliptical usage');
  63019. }
  63020. this.x0 = this.x0 !== undefined ? this.x0 : 0;
  63021. this.y0 = this.y0 !== undefined ? this.y0 : 0;
  63022. this.long0 = this.long0 !== undefined ? this.long0 : 0;
  63023. this.lat0 = this.lat0 !== undefined ? this.lat0 : 0;
  63024. this.cgb = [];
  63025. this.cbg = [];
  63026. this.utg = [];
  63027. this.gtu = [];
  63028. var f = this.es / (1 + Math.sqrt(1 - this.es));
  63029. var n = f / (2 - f);
  63030. var np = n;
  63031. this.cgb[0] = n * (2 + n * (-2 / 3 + n * (-2 + n * (116 / 45 + n * (26 / 45 + n * (-2854 / 675 ))))));
  63032. this.cbg[0] = n * (-2 + n * ( 2 / 3 + n * ( 4 / 3 + n * (-82 / 45 + n * (32 / 45 + n * (4642 / 4725))))));
  63033. np = np * n;
  63034. this.cgb[1] = np * (7 / 3 + n * (-8 / 5 + n * (-227 / 45 + n * (2704 / 315 + n * (2323 / 945)))));
  63035. this.cbg[1] = np * (5 / 3 + n * (-16 / 15 + n * ( -13 / 9 + n * (904 / 315 + n * (-1522 / 945)))));
  63036. np = np * n;
  63037. this.cgb[2] = np * (56 / 15 + n * (-136 / 35 + n * (-1262 / 105 + n * (73814 / 2835))));
  63038. this.cbg[2] = np * (-26 / 15 + n * (34 / 21 + n * (8 / 5 + n * (-12686 / 2835))));
  63039. np = np * n;
  63040. this.cgb[3] = np * (4279 / 630 + n * (-332 / 35 + n * (-399572 / 14175)));
  63041. this.cbg[3] = np * (1237 / 630 + n * (-12 / 5 + n * ( -24832 / 14175)));
  63042. np = np * n;
  63043. this.cgb[4] = np * (4174 / 315 + n * (-144838 / 6237));
  63044. this.cbg[4] = np * (-734 / 315 + n * (109598 / 31185));
  63045. np = np * n;
  63046. this.cgb[5] = np * (601676 / 22275);
  63047. this.cbg[5] = np * (444337 / 155925);
  63048. np = Math.pow(n, 2);
  63049. this.Qn = this.k0 / (1 + n) * (1 + np * (1 / 4 + np * (1 / 64 + np / 256)));
  63050. this.utg[0] = n * (-0.5 + n * ( 2 / 3 + n * (-37 / 96 + n * ( 1 / 360 + n * (81 / 512 + n * (-96199 / 604800))))));
  63051. this.gtu[0] = n * (0.5 + n * (-2 / 3 + n * (5 / 16 + n * (41 / 180 + n * (-127 / 288 + n * (7891 / 37800))))));
  63052. this.utg[1] = np * (-1 / 48 + n * (-1 / 15 + n * (437 / 1440 + n * (-46 / 105 + n * (1118711 / 3870720)))));
  63053. this.gtu[1] = np * (13 / 48 + n * (-3 / 5 + n * (557 / 1440 + n * (281 / 630 + n * (-1983433 / 1935360)))));
  63054. np = np * n;
  63055. this.utg[2] = np * (-17 / 480 + n * (37 / 840 + n * (209 / 4480 + n * (-5569 / 90720 ))));
  63056. this.gtu[2] = np * (61 / 240 + n * (-103 / 140 + n * (15061 / 26880 + n * (167603 / 181440))));
  63057. np = np * n;
  63058. this.utg[3] = np * (-4397 / 161280 + n * (11 / 504 + n * (830251 / 7257600)));
  63059. this.gtu[3] = np * (49561 / 161280 + n * (-179 / 168 + n * (6601661 / 7257600)));
  63060. np = np * n;
  63061. this.utg[4] = np * (-4583 / 161280 + n * (108847 / 3991680));
  63062. this.gtu[4] = np * (34729 / 80640 + n * (-3418889 / 1995840));
  63063. np = np * n;
  63064. this.utg[5] = np * (-20648693 / 638668800);
  63065. this.gtu[5] = np * (212378941 / 319334400);
  63066. var Z = gatg(this.cbg, this.lat0);
  63067. this.Zb = -this.Qn * (Z + clens(this.gtu, 2 * Z));
  63068. }
  63069. function etmerc_forward(p) {
  63070. var Ce = adjust_lon(p.x - this.long0);
  63071. var Cn = p.y;
  63072. Cn = gatg(this.cbg, Cn);
  63073. var sin_Cn = Math.sin(Cn);
  63074. var cos_Cn = Math.cos(Cn);
  63075. var sin_Ce = Math.sin(Ce);
  63076. var cos_Ce = Math.cos(Ce);
  63077. Cn = Math.atan2(sin_Cn, cos_Ce * cos_Cn);
  63078. Ce = Math.atan2(sin_Ce * cos_Cn, hypot(sin_Cn, cos_Cn * cos_Ce));
  63079. Ce = asinhy(Math.tan(Ce));
  63080. var tmp = clens_cmplx(this.gtu, 2 * Cn, 2 * Ce);
  63081. Cn = Cn + tmp[0];
  63082. Ce = Ce + tmp[1];
  63083. var x;
  63084. var y;
  63085. if (Math.abs(Ce) <= 2.623395162778) {
  63086. x = this.a * (this.Qn * Ce) + this.x0;
  63087. y = this.a * (this.Qn * Cn + this.Zb) + this.y0;
  63088. }
  63089. else {
  63090. x = Infinity;
  63091. y = Infinity;
  63092. }
  63093. p.x = x;
  63094. p.y = y;
  63095. return p;
  63096. }
  63097. function etmerc_inverse(p) {
  63098. var Ce = (p.x - this.x0) * (1 / this.a);
  63099. var Cn = (p.y - this.y0) * (1 / this.a);
  63100. Cn = (Cn - this.Zb) / this.Qn;
  63101. Ce = Ce / this.Qn;
  63102. var lon;
  63103. var lat;
  63104. if (Math.abs(Ce) <= 2.623395162778) {
  63105. var tmp = clens_cmplx(this.utg, 2 * Cn, 2 * Ce);
  63106. Cn = Cn + tmp[0];
  63107. Ce = Ce + tmp[1];
  63108. Ce = Math.atan(sinh(Ce));
  63109. var sin_Cn = Math.sin(Cn);
  63110. var cos_Cn = Math.cos(Cn);
  63111. var sin_Ce = Math.sin(Ce);
  63112. var cos_Ce = Math.cos(Ce);
  63113. Cn = Math.atan2(sin_Cn * cos_Ce, hypot(sin_Ce, cos_Ce * cos_Cn));
  63114. Ce = Math.atan2(sin_Ce, cos_Ce * cos_Cn);
  63115. lon = adjust_lon(Ce + this.long0);
  63116. lat = gatg(this.cgb, Cn);
  63117. }
  63118. else {
  63119. lon = Infinity;
  63120. lat = Infinity;
  63121. }
  63122. p.x = lon;
  63123. p.y = lat;
  63124. return p;
  63125. }
  63126. var etmerc_names = ["Extended_Transverse_Mercator", "Extended Transverse Mercator", "etmerc"];
  63127. /* harmony default export */ const etmerc = ({
  63128. init: etmerc_init,
  63129. forward: etmerc_forward,
  63130. inverse: etmerc_inverse,
  63131. names: etmerc_names
  63132. });
  63133. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/adjust_zone.js
  63134. /* harmony default export */ function adjust_zone(zone, lon) {
  63135. if (zone === undefined) {
  63136. zone = Math.floor((adjust_lon(lon) + Math.PI) * 30 / Math.PI) + 1;
  63137. if (zone < 0) {
  63138. return 0;
  63139. } else if (zone > 60) {
  63140. return 60;
  63141. }
  63142. }
  63143. return zone;
  63144. }
  63145. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/utm.js
  63146. var dependsOn = 'etmerc';
  63147. function utm_init() {
  63148. var zone = adjust_zone(this.zone, this.long0);
  63149. if (zone === undefined) {
  63150. throw new Error('unknown utm zone');
  63151. }
  63152. this.lat0 = 0;
  63153. this.long0 = ((6 * Math.abs(zone)) - 183) * D2R;
  63154. this.x0 = 500000;
  63155. this.y0 = this.utmSouth ? 10000000 : 0;
  63156. this.k0 = 0.9996;
  63157. etmerc.init.apply(this);
  63158. this.forward = etmerc.forward;
  63159. this.inverse = etmerc.inverse;
  63160. }
  63161. var utm_names = ["Universal Transverse Mercator System", "utm"];
  63162. /* harmony default export */ const utm = ({
  63163. init: utm_init,
  63164. names: utm_names,
  63165. dependsOn: dependsOn
  63166. });
  63167. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/srat.js
  63168. /* harmony default export */ function srat(esinp, exp) {
  63169. return (Math.pow((1 - esinp) / (1 + esinp), exp));
  63170. }
  63171. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/gauss.js
  63172. var gauss_MAX_ITER = 20;
  63173. function gauss_init() {
  63174. var sphi = Math.sin(this.lat0);
  63175. var cphi = Math.cos(this.lat0);
  63176. cphi *= cphi;
  63177. this.rc = Math.sqrt(1 - this.es) / (1 - this.es * sphi * sphi);
  63178. this.C = Math.sqrt(1 + this.es * cphi * cphi / (1 - this.es));
  63179. this.phic0 = Math.asin(sphi / this.C);
  63180. this.ratexp = 0.5 * this.C * this.e;
  63181. this.K = Math.tan(0.5 * this.phic0 + FORTPI) / (Math.pow(Math.tan(0.5 * this.lat0 + FORTPI), this.C) * srat(this.e * sphi, this.ratexp));
  63182. }
  63183. function gauss_forward(p) {
  63184. var lon = p.x;
  63185. var lat = p.y;
  63186. p.y = 2 * Math.atan(this.K * Math.pow(Math.tan(0.5 * lat + FORTPI), this.C) * srat(this.e * Math.sin(lat), this.ratexp)) - HALF_PI;
  63187. p.x = this.C * lon;
  63188. return p;
  63189. }
  63190. function gauss_inverse(p) {
  63191. var DEL_TOL = 1e-14;
  63192. var lon = p.x / this.C;
  63193. var lat = p.y;
  63194. var num = Math.pow(Math.tan(0.5 * lat + FORTPI) / this.K, 1 / this.C);
  63195. for (var i = gauss_MAX_ITER; i > 0; --i) {
  63196. lat = 2 * Math.atan(num * srat(this.e * Math.sin(p.y), - 0.5 * this.e)) - HALF_PI;
  63197. if (Math.abs(lat - p.y) < DEL_TOL) {
  63198. break;
  63199. }
  63200. p.y = lat;
  63201. }
  63202. /* convergence failed */
  63203. if (!i) {
  63204. return null;
  63205. }
  63206. p.x = lon;
  63207. p.y = lat;
  63208. return p;
  63209. }
  63210. var gauss_names = ["gauss"];
  63211. /* harmony default export */ const gauss = ({
  63212. init: gauss_init,
  63213. forward: gauss_forward,
  63214. inverse: gauss_inverse,
  63215. names: gauss_names
  63216. });
  63217. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/sterea.js
  63218. function sterea_init() {
  63219. gauss.init.apply(this);
  63220. if (!this.rc) {
  63221. return;
  63222. }
  63223. this.sinc0 = Math.sin(this.phic0);
  63224. this.cosc0 = Math.cos(this.phic0);
  63225. this.R2 = 2 * this.rc;
  63226. if (!this.title) {
  63227. this.title = "Oblique Stereographic Alternative";
  63228. }
  63229. }
  63230. function sterea_forward(p) {
  63231. var sinc, cosc, cosl, k;
  63232. p.x = adjust_lon(p.x - this.long0);
  63233. gauss.forward.apply(this, [p]);
  63234. sinc = Math.sin(p.y);
  63235. cosc = Math.cos(p.y);
  63236. cosl = Math.cos(p.x);
  63237. k = this.k0 * this.R2 / (1 + this.sinc0 * sinc + this.cosc0 * cosc * cosl);
  63238. p.x = k * cosc * Math.sin(p.x);
  63239. p.y = k * (this.cosc0 * sinc - this.sinc0 * cosc * cosl);
  63240. p.x = this.a * p.x + this.x0;
  63241. p.y = this.a * p.y + this.y0;
  63242. return p;
  63243. }
  63244. function sterea_inverse(p) {
  63245. var sinc, cosc, lon, lat, rho;
  63246. p.x = (p.x - this.x0) / this.a;
  63247. p.y = (p.y - this.y0) / this.a;
  63248. p.x /= this.k0;
  63249. p.y /= this.k0;
  63250. if ((rho = Math.sqrt(p.x * p.x + p.y * p.y))) {
  63251. var c = 2 * Math.atan2(rho, this.R2);
  63252. sinc = Math.sin(c);
  63253. cosc = Math.cos(c);
  63254. lat = Math.asin(cosc * this.sinc0 + p.y * sinc * this.cosc0 / rho);
  63255. lon = Math.atan2(p.x * sinc, rho * this.cosc0 * cosc - p.y * this.sinc0 * sinc);
  63256. }
  63257. else {
  63258. lat = this.phic0;
  63259. lon = 0;
  63260. }
  63261. p.x = lon;
  63262. p.y = lat;
  63263. gauss.inverse.apply(this, [p]);
  63264. p.x = adjust_lon(p.x + this.long0);
  63265. return p;
  63266. }
  63267. var sterea_names = ["Stereographic_North_Pole", "Oblique_Stereographic", "Polar_Stereographic", "sterea","Oblique Stereographic Alternative","Double_Stereographic"];
  63268. /* harmony default export */ const sterea = ({
  63269. init: sterea_init,
  63270. forward: sterea_forward,
  63271. inverse: sterea_inverse,
  63272. names: sterea_names
  63273. });
  63274. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/stere.js
  63275. function ssfn_(phit, sinphi, eccen) {
  63276. sinphi *= eccen;
  63277. return (Math.tan(0.5 * (HALF_PI + phit)) * Math.pow((1 - sinphi) / (1 + sinphi), 0.5 * eccen));
  63278. }
  63279. function stere_init() {
  63280. this.coslat0 = Math.cos(this.lat0);
  63281. this.sinlat0 = Math.sin(this.lat0);
  63282. if (this.sphere) {
  63283. if (this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= EPSLN) {
  63284. this.k0 = 0.5 * (1 + sign(this.lat0) * Math.sin(this.lat_ts));
  63285. }
  63286. }
  63287. else {
  63288. if (Math.abs(this.coslat0) <= EPSLN) {
  63289. if (this.lat0 > 0) {
  63290. //North pole
  63291. //trace('stere:north pole');
  63292. this.con = 1;
  63293. }
  63294. else {
  63295. //South pole
  63296. //trace('stere:south pole');
  63297. this.con = -1;
  63298. }
  63299. }
  63300. this.cons = Math.sqrt(Math.pow(1 + this.e, 1 + this.e) * Math.pow(1 - this.e, 1 - this.e));
  63301. if (this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= EPSLN) {
  63302. this.k0 = 0.5 * this.cons * msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts)) / tsfnz(this.e, this.con * this.lat_ts, this.con * Math.sin(this.lat_ts));
  63303. }
  63304. this.ms1 = msfnz(this.e, this.sinlat0, this.coslat0);
  63305. this.X0 = 2 * Math.atan(this.ssfn_(this.lat0, this.sinlat0, this.e)) - HALF_PI;
  63306. this.cosX0 = Math.cos(this.X0);
  63307. this.sinX0 = Math.sin(this.X0);
  63308. }
  63309. }
  63310. // Stereographic forward equations--mapping lat,long to x,y
  63311. function stere_forward(p) {
  63312. var lon = p.x;
  63313. var lat = p.y;
  63314. var sinlat = Math.sin(lat);
  63315. var coslat = Math.cos(lat);
  63316. var A, X, sinX, cosX, ts, rh;
  63317. var dlon = adjust_lon(lon - this.long0);
  63318. if (Math.abs(Math.abs(lon - this.long0) - Math.PI) <= EPSLN && Math.abs(lat + this.lat0) <= EPSLN) {
  63319. //case of the origine point
  63320. //trace('stere:this is the origin point');
  63321. p.x = NaN;
  63322. p.y = NaN;
  63323. return p;
  63324. }
  63325. if (this.sphere) {
  63326. //trace('stere:sphere case');
  63327. A = 2 * this.k0 / (1 + this.sinlat0 * sinlat + this.coslat0 * coslat * Math.cos(dlon));
  63328. p.x = this.a * A * coslat * Math.sin(dlon) + this.x0;
  63329. p.y = this.a * A * (this.coslat0 * sinlat - this.sinlat0 * coslat * Math.cos(dlon)) + this.y0;
  63330. return p;
  63331. }
  63332. else {
  63333. X = 2 * Math.atan(this.ssfn_(lat, sinlat, this.e)) - HALF_PI;
  63334. cosX = Math.cos(X);
  63335. sinX = Math.sin(X);
  63336. if (Math.abs(this.coslat0) <= EPSLN) {
  63337. ts = tsfnz(this.e, lat * this.con, this.con * sinlat);
  63338. rh = 2 * this.a * this.k0 * ts / this.cons;
  63339. p.x = this.x0 + rh * Math.sin(lon - this.long0);
  63340. p.y = this.y0 - this.con * rh * Math.cos(lon - this.long0);
  63341. //trace(p.toString());
  63342. return p;
  63343. }
  63344. else if (Math.abs(this.sinlat0) < EPSLN) {
  63345. //Eq
  63346. //trace('stere:equateur');
  63347. A = 2 * this.a * this.k0 / (1 + cosX * Math.cos(dlon));
  63348. p.y = A * sinX;
  63349. }
  63350. else {
  63351. //other case
  63352. //trace('stere:normal case');
  63353. A = 2 * this.a * this.k0 * this.ms1 / (this.cosX0 * (1 + this.sinX0 * sinX + this.cosX0 * cosX * Math.cos(dlon)));
  63354. p.y = A * (this.cosX0 * sinX - this.sinX0 * cosX * Math.cos(dlon)) + this.y0;
  63355. }
  63356. p.x = A * cosX * Math.sin(dlon) + this.x0;
  63357. }
  63358. //trace(p.toString());
  63359. return p;
  63360. }
  63361. //* Stereographic inverse equations--mapping x,y to lat/long
  63362. function stere_inverse(p) {
  63363. p.x -= this.x0;
  63364. p.y -= this.y0;
  63365. var lon, lat, ts, ce, Chi;
  63366. var rh = Math.sqrt(p.x * p.x + p.y * p.y);
  63367. if (this.sphere) {
  63368. var c = 2 * Math.atan(rh / (2 * this.a * this.k0));
  63369. lon = this.long0;
  63370. lat = this.lat0;
  63371. if (rh <= EPSLN) {
  63372. p.x = lon;
  63373. p.y = lat;
  63374. return p;
  63375. }
  63376. lat = Math.asin(Math.cos(c) * this.sinlat0 + p.y * Math.sin(c) * this.coslat0 / rh);
  63377. if (Math.abs(this.coslat0) < EPSLN) {
  63378. if (this.lat0 > 0) {
  63379. lon = adjust_lon(this.long0 + Math.atan2(p.x, - 1 * p.y));
  63380. }
  63381. else {
  63382. lon = adjust_lon(this.long0 + Math.atan2(p.x, p.y));
  63383. }
  63384. }
  63385. else {
  63386. lon = adjust_lon(this.long0 + Math.atan2(p.x * Math.sin(c), rh * this.coslat0 * Math.cos(c) - p.y * this.sinlat0 * Math.sin(c)));
  63387. }
  63388. p.x = lon;
  63389. p.y = lat;
  63390. return p;
  63391. }
  63392. else {
  63393. if (Math.abs(this.coslat0) <= EPSLN) {
  63394. if (rh <= EPSLN) {
  63395. lat = this.lat0;
  63396. lon = this.long0;
  63397. p.x = lon;
  63398. p.y = lat;
  63399. //trace(p.toString());
  63400. return p;
  63401. }
  63402. p.x *= this.con;
  63403. p.y *= this.con;
  63404. ts = rh * this.cons / (2 * this.a * this.k0);
  63405. lat = this.con * phi2z(this.e, ts);
  63406. lon = this.con * adjust_lon(this.con * this.long0 + Math.atan2(p.x, - 1 * p.y));
  63407. }
  63408. else {
  63409. ce = 2 * Math.atan(rh * this.cosX0 / (2 * this.a * this.k0 * this.ms1));
  63410. lon = this.long0;
  63411. if (rh <= EPSLN) {
  63412. Chi = this.X0;
  63413. }
  63414. else {
  63415. Chi = Math.asin(Math.cos(ce) * this.sinX0 + p.y * Math.sin(ce) * this.cosX0 / rh);
  63416. lon = adjust_lon(this.long0 + Math.atan2(p.x * Math.sin(ce), rh * this.cosX0 * Math.cos(ce) - p.y * this.sinX0 * Math.sin(ce)));
  63417. }
  63418. lat = -1 * phi2z(this.e, Math.tan(0.5 * (HALF_PI + Chi)));
  63419. }
  63420. }
  63421. p.x = lon;
  63422. p.y = lat;
  63423. //trace(p.toString());
  63424. return p;
  63425. }
  63426. var stere_names = ["stere", "Stereographic_South_Pole", "Polar Stereographic (variant B)"];
  63427. /* harmony default export */ const stere = ({
  63428. init: stere_init,
  63429. forward: stere_forward,
  63430. inverse: stere_inverse,
  63431. names: stere_names,
  63432. ssfn_: ssfn_
  63433. });
  63434. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/somerc.js
  63435. /*
  63436. references:
  63437. Formules et constantes pour le Calcul pour la
  63438. projection cylindrique conforme à axe oblique et pour la transformation entre
  63439. des systèmes de référence.
  63440. http://www.swisstopo.admin.ch/internet/swisstopo/fr/home/topics/survey/sys/refsys/switzerland.parsysrelated1.31216.downloadList.77004.DownloadFile.tmp/swissprojectionfr.pdf
  63441. */
  63442. function somerc_init() {
  63443. var phy0 = this.lat0;
  63444. this.lambda0 = this.long0;
  63445. var sinPhy0 = Math.sin(phy0);
  63446. var semiMajorAxis = this.a;
  63447. var invF = this.rf;
  63448. var flattening = 1 / invF;
  63449. var e2 = 2 * flattening - Math.pow(flattening, 2);
  63450. var e = this.e = Math.sqrt(e2);
  63451. this.R = this.k0 * semiMajorAxis * Math.sqrt(1 - e2) / (1 - e2 * Math.pow(sinPhy0, 2));
  63452. this.alpha = Math.sqrt(1 + e2 / (1 - e2) * Math.pow(Math.cos(phy0), 4));
  63453. this.b0 = Math.asin(sinPhy0 / this.alpha);
  63454. var k1 = Math.log(Math.tan(Math.PI / 4 + this.b0 / 2));
  63455. var k2 = Math.log(Math.tan(Math.PI / 4 + phy0 / 2));
  63456. var k3 = Math.log((1 + e * sinPhy0) / (1 - e * sinPhy0));
  63457. this.K = k1 - this.alpha * k2 + this.alpha * e / 2 * k3;
  63458. }
  63459. function somerc_forward(p) {
  63460. var Sa1 = Math.log(Math.tan(Math.PI / 4 - p.y / 2));
  63461. var Sa2 = this.e / 2 * Math.log((1 + this.e * Math.sin(p.y)) / (1 - this.e * Math.sin(p.y)));
  63462. var S = -this.alpha * (Sa1 + Sa2) + this.K;
  63463. // spheric latitude
  63464. var b = 2 * (Math.atan(Math.exp(S)) - Math.PI / 4);
  63465. // spheric longitude
  63466. var I = this.alpha * (p.x - this.lambda0);
  63467. // psoeudo equatorial rotation
  63468. var rotI = Math.atan(Math.sin(I) / (Math.sin(this.b0) * Math.tan(b) + Math.cos(this.b0) * Math.cos(I)));
  63469. var rotB = Math.asin(Math.cos(this.b0) * Math.sin(b) - Math.sin(this.b0) * Math.cos(b) * Math.cos(I));
  63470. p.y = this.R / 2 * Math.log((1 + Math.sin(rotB)) / (1 - Math.sin(rotB))) + this.y0;
  63471. p.x = this.R * rotI + this.x0;
  63472. return p;
  63473. }
  63474. function somerc_inverse(p) {
  63475. var Y = p.x - this.x0;
  63476. var X = p.y - this.y0;
  63477. var rotI = Y / this.R;
  63478. var rotB = 2 * (Math.atan(Math.exp(X / this.R)) - Math.PI / 4);
  63479. var b = Math.asin(Math.cos(this.b0) * Math.sin(rotB) + Math.sin(this.b0) * Math.cos(rotB) * Math.cos(rotI));
  63480. var I = Math.atan(Math.sin(rotI) / (Math.cos(this.b0) * Math.cos(rotI) - Math.sin(this.b0) * Math.tan(rotB)));
  63481. var lambda = this.lambda0 + I / this.alpha;
  63482. var S = 0;
  63483. var phy = b;
  63484. var prevPhy = -1000;
  63485. var iteration = 0;
  63486. while (Math.abs(phy - prevPhy) > 0.0000001) {
  63487. if (++iteration > 20) {
  63488. //...reportError("omercFwdInfinity");
  63489. return;
  63490. }
  63491. //S = Math.log(Math.tan(Math.PI / 4 + phy / 2));
  63492. S = 1 / this.alpha * (Math.log(Math.tan(Math.PI / 4 + b / 2)) - this.K) + this.e * Math.log(Math.tan(Math.PI / 4 + Math.asin(this.e * Math.sin(phy)) / 2));
  63493. prevPhy = phy;
  63494. phy = 2 * Math.atan(Math.exp(S)) - Math.PI / 2;
  63495. }
  63496. p.x = lambda;
  63497. p.y = phy;
  63498. return p;
  63499. }
  63500. var somerc_names = ["somerc"];
  63501. /* harmony default export */ const somerc = ({
  63502. init: somerc_init,
  63503. forward: somerc_forward,
  63504. inverse: somerc_inverse,
  63505. names: somerc_names
  63506. });
  63507. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/omerc.js
  63508. /* Initialize the Oblique Mercator projection
  63509. ------------------------------------------*/
  63510. function omerc_init() {
  63511. this.no_off = this.no_off || false;
  63512. this.no_rot = this.no_rot || false;
  63513. if (isNaN(this.k0)) {
  63514. this.k0 = 1;
  63515. }
  63516. var sinlat = Math.sin(this.lat0);
  63517. var coslat = Math.cos(this.lat0);
  63518. var con = this.e * sinlat;
  63519. this.bl = Math.sqrt(1 + this.es / (1 - this.es) * Math.pow(coslat, 4));
  63520. this.al = this.a * this.bl * this.k0 * Math.sqrt(1 - this.es) / (1 - con * con);
  63521. var t0 = tsfnz(this.e, this.lat0, sinlat);
  63522. var dl = this.bl / coslat * Math.sqrt((1 - this.es) / (1 - con * con));
  63523. if (dl * dl < 1) {
  63524. dl = 1;
  63525. }
  63526. var fl;
  63527. var gl;
  63528. if (!isNaN(this.longc)) {
  63529. //Central point and azimuth method
  63530. if (this.lat0 >= 0) {
  63531. fl = dl + Math.sqrt(dl * dl - 1);
  63532. }
  63533. else {
  63534. fl = dl - Math.sqrt(dl * dl - 1);
  63535. }
  63536. this.el = fl * Math.pow(t0, this.bl);
  63537. gl = 0.5 * (fl - 1 / fl);
  63538. this.gamma0 = Math.asin(Math.sin(this.alpha) / dl);
  63539. this.long0 = this.longc - Math.asin(gl * Math.tan(this.gamma0)) / this.bl;
  63540. }
  63541. else {
  63542. //2 points method
  63543. var t1 = tsfnz(this.e, this.lat1, Math.sin(this.lat1));
  63544. var t2 = tsfnz(this.e, this.lat2, Math.sin(this.lat2));
  63545. if (this.lat0 >= 0) {
  63546. this.el = (dl + Math.sqrt(dl * dl - 1)) * Math.pow(t0, this.bl);
  63547. }
  63548. else {
  63549. this.el = (dl - Math.sqrt(dl * dl - 1)) * Math.pow(t0, this.bl);
  63550. }
  63551. var hl = Math.pow(t1, this.bl);
  63552. var ll = Math.pow(t2, this.bl);
  63553. fl = this.el / hl;
  63554. gl = 0.5 * (fl - 1 / fl);
  63555. var jl = (this.el * this.el - ll * hl) / (this.el * this.el + ll * hl);
  63556. var pl = (ll - hl) / (ll + hl);
  63557. var dlon12 = adjust_lon(this.long1 - this.long2);
  63558. this.long0 = 0.5 * (this.long1 + this.long2) - Math.atan(jl * Math.tan(0.5 * this.bl * (dlon12)) / pl) / this.bl;
  63559. this.long0 = adjust_lon(this.long0);
  63560. var dlon10 = adjust_lon(this.long1 - this.long0);
  63561. this.gamma0 = Math.atan(Math.sin(this.bl * (dlon10)) / gl);
  63562. this.alpha = Math.asin(dl * Math.sin(this.gamma0));
  63563. }
  63564. if (this.no_off) {
  63565. this.uc = 0;
  63566. }
  63567. else {
  63568. if (this.lat0 >= 0) {
  63569. this.uc = this.al / this.bl * Math.atan2(Math.sqrt(dl * dl - 1), Math.cos(this.alpha));
  63570. }
  63571. else {
  63572. this.uc = -1 * this.al / this.bl * Math.atan2(Math.sqrt(dl * dl - 1), Math.cos(this.alpha));
  63573. }
  63574. }
  63575. }
  63576. /* Oblique Mercator forward equations--mapping lat,long to x,y
  63577. ----------------------------------------------------------*/
  63578. function omerc_forward(p) {
  63579. var lon = p.x;
  63580. var lat = p.y;
  63581. var dlon = adjust_lon(lon - this.long0);
  63582. var us, vs;
  63583. var con;
  63584. if (Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN) {
  63585. if (lat > 0) {
  63586. con = -1;
  63587. }
  63588. else {
  63589. con = 1;
  63590. }
  63591. vs = this.al / this.bl * Math.log(Math.tan(FORTPI + con * this.gamma0 * 0.5));
  63592. us = -1 * con * HALF_PI * this.al / this.bl;
  63593. }
  63594. else {
  63595. var t = tsfnz(this.e, lat, Math.sin(lat));
  63596. var ql = this.el / Math.pow(t, this.bl);
  63597. var sl = 0.5 * (ql - 1 / ql);
  63598. var tl = 0.5 * (ql + 1 / ql);
  63599. var vl = Math.sin(this.bl * (dlon));
  63600. var ul = (sl * Math.sin(this.gamma0) - vl * Math.cos(this.gamma0)) / tl;
  63601. if (Math.abs(Math.abs(ul) - 1) <= EPSLN) {
  63602. vs = Number.POSITIVE_INFINITY;
  63603. }
  63604. else {
  63605. vs = 0.5 * this.al * Math.log((1 - ul) / (1 + ul)) / this.bl;
  63606. }
  63607. if (Math.abs(Math.cos(this.bl * (dlon))) <= EPSLN) {
  63608. us = this.al * this.bl * (dlon);
  63609. }
  63610. else {
  63611. us = this.al * Math.atan2(sl * Math.cos(this.gamma0) + vl * Math.sin(this.gamma0), Math.cos(this.bl * dlon)) / this.bl;
  63612. }
  63613. }
  63614. if (this.no_rot) {
  63615. p.x = this.x0 + us;
  63616. p.y = this.y0 + vs;
  63617. }
  63618. else {
  63619. us -= this.uc;
  63620. p.x = this.x0 + vs * Math.cos(this.alpha) + us * Math.sin(this.alpha);
  63621. p.y = this.y0 + us * Math.cos(this.alpha) - vs * Math.sin(this.alpha);
  63622. }
  63623. return p;
  63624. }
  63625. function omerc_inverse(p) {
  63626. var us, vs;
  63627. if (this.no_rot) {
  63628. vs = p.y - this.y0;
  63629. us = p.x - this.x0;
  63630. }
  63631. else {
  63632. vs = (p.x - this.x0) * Math.cos(this.alpha) - (p.y - this.y0) * Math.sin(this.alpha);
  63633. us = (p.y - this.y0) * Math.cos(this.alpha) + (p.x - this.x0) * Math.sin(this.alpha);
  63634. us += this.uc;
  63635. }
  63636. var qp = Math.exp(-1 * this.bl * vs / this.al);
  63637. var sp = 0.5 * (qp - 1 / qp);
  63638. var tp = 0.5 * (qp + 1 / qp);
  63639. var vp = Math.sin(this.bl * us / this.al);
  63640. var up = (vp * Math.cos(this.gamma0) + sp * Math.sin(this.gamma0)) / tp;
  63641. var ts = Math.pow(this.el / Math.sqrt((1 + up) / (1 - up)), 1 / this.bl);
  63642. if (Math.abs(up - 1) < EPSLN) {
  63643. p.x = this.long0;
  63644. p.y = HALF_PI;
  63645. }
  63646. else if (Math.abs(up + 1) < EPSLN) {
  63647. p.x = this.long0;
  63648. p.y = -1 * HALF_PI;
  63649. }
  63650. else {
  63651. p.y = phi2z(this.e, ts);
  63652. p.x = adjust_lon(this.long0 - Math.atan2(sp * Math.cos(this.gamma0) - vp * Math.sin(this.gamma0), Math.cos(this.bl * us / this.al)) / this.bl);
  63653. }
  63654. return p;
  63655. }
  63656. var omerc_names = ["Hotine_Oblique_Mercator", "Hotine Oblique Mercator", "Hotine_Oblique_Mercator_Azimuth_Natural_Origin", "Hotine_Oblique_Mercator_Azimuth_Center", "omerc"];
  63657. /* harmony default export */ const omerc = ({
  63658. init: omerc_init,
  63659. forward: omerc_forward,
  63660. inverse: omerc_inverse,
  63661. names: omerc_names
  63662. });
  63663. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/lcc.js
  63664. function lcc_init() {
  63665. // array of: r_maj,r_min,lat1,lat2,c_lon,c_lat,false_east,false_north
  63666. //double c_lat; /* center latitude */
  63667. //double c_lon; /* center longitude */
  63668. //double lat1; /* first standard parallel */
  63669. //double lat2; /* second standard parallel */
  63670. //double r_maj; /* major axis */
  63671. //double r_min; /* minor axis */
  63672. //double false_east; /* x offset in meters */
  63673. //double false_north; /* y offset in meters */
  63674. if (!this.lat2) {
  63675. this.lat2 = this.lat1;
  63676. } //if lat2 is not defined
  63677. if (!this.k0) {
  63678. this.k0 = 1;
  63679. }
  63680. this.x0 = this.x0 || 0;
  63681. this.y0 = this.y0 || 0;
  63682. // Standard Parallels cannot be equal and on opposite sides of the equator
  63683. if (Math.abs(this.lat1 + this.lat2) < EPSLN) {
  63684. return;
  63685. }
  63686. var temp = this.b / this.a;
  63687. this.e = Math.sqrt(1 - temp * temp);
  63688. var sin1 = Math.sin(this.lat1);
  63689. var cos1 = Math.cos(this.lat1);
  63690. var ms1 = msfnz(this.e, sin1, cos1);
  63691. var ts1 = tsfnz(this.e, this.lat1, sin1);
  63692. var sin2 = Math.sin(this.lat2);
  63693. var cos2 = Math.cos(this.lat2);
  63694. var ms2 = msfnz(this.e, sin2, cos2);
  63695. var ts2 = tsfnz(this.e, this.lat2, sin2);
  63696. var ts0 = tsfnz(this.e, this.lat0, Math.sin(this.lat0));
  63697. if (Math.abs(this.lat1 - this.lat2) > EPSLN) {
  63698. this.ns = Math.log(ms1 / ms2) / Math.log(ts1 / ts2);
  63699. }
  63700. else {
  63701. this.ns = sin1;
  63702. }
  63703. if (isNaN(this.ns)) {
  63704. this.ns = sin1;
  63705. }
  63706. this.f0 = ms1 / (this.ns * Math.pow(ts1, this.ns));
  63707. this.rh = this.a * this.f0 * Math.pow(ts0, this.ns);
  63708. if (!this.title) {
  63709. this.title = "Lambert Conformal Conic";
  63710. }
  63711. }
  63712. // Lambert Conformal conic forward equations--mapping lat,long to x,y
  63713. // -----------------------------------------------------------------
  63714. function lcc_forward(p) {
  63715. var lon = p.x;
  63716. var lat = p.y;
  63717. // singular cases :
  63718. if (Math.abs(2 * Math.abs(lat) - Math.PI) <= EPSLN) {
  63719. lat = sign(lat) * (HALF_PI - 2 * EPSLN);
  63720. }
  63721. var con = Math.abs(Math.abs(lat) - HALF_PI);
  63722. var ts, rh1;
  63723. if (con > EPSLN) {
  63724. ts = tsfnz(this.e, lat, Math.sin(lat));
  63725. rh1 = this.a * this.f0 * Math.pow(ts, this.ns);
  63726. }
  63727. else {
  63728. con = lat * this.ns;
  63729. if (con <= 0) {
  63730. return null;
  63731. }
  63732. rh1 = 0;
  63733. }
  63734. var theta = this.ns * adjust_lon(lon - this.long0);
  63735. p.x = this.k0 * (rh1 * Math.sin(theta)) + this.x0;
  63736. p.y = this.k0 * (this.rh - rh1 * Math.cos(theta)) + this.y0;
  63737. return p;
  63738. }
  63739. // Lambert Conformal Conic inverse equations--mapping x,y to lat/long
  63740. // -----------------------------------------------------------------
  63741. function lcc_inverse(p) {
  63742. var rh1, con, ts;
  63743. var lat, lon;
  63744. var x = (p.x - this.x0) / this.k0;
  63745. var y = (this.rh - (p.y - this.y0) / this.k0);
  63746. if (this.ns > 0) {
  63747. rh1 = Math.sqrt(x * x + y * y);
  63748. con = 1;
  63749. }
  63750. else {
  63751. rh1 = -Math.sqrt(x * x + y * y);
  63752. con = -1;
  63753. }
  63754. var theta = 0;
  63755. if (rh1 !== 0) {
  63756. theta = Math.atan2((con * x), (con * y));
  63757. }
  63758. if ((rh1 !== 0) || (this.ns > 0)) {
  63759. con = 1 / this.ns;
  63760. ts = Math.pow((rh1 / (this.a * this.f0)), con);
  63761. lat = phi2z(this.e, ts);
  63762. if (lat === -9999) {
  63763. return null;
  63764. }
  63765. }
  63766. else {
  63767. lat = -HALF_PI;
  63768. }
  63769. lon = adjust_lon(theta / this.ns + this.long0);
  63770. p.x = lon;
  63771. p.y = lat;
  63772. return p;
  63773. }
  63774. var lcc_names = ["Lambert Tangential Conformal Conic Projection", "Lambert_Conformal_Conic", "Lambert_Conformal_Conic_2SP", "lcc"];
  63775. /* harmony default export */ const lcc = ({
  63776. init: lcc_init,
  63777. forward: lcc_forward,
  63778. inverse: lcc_inverse,
  63779. names: lcc_names
  63780. });
  63781. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/krovak.js
  63782. function krovak_init() {
  63783. this.a = 6377397.155;
  63784. this.es = 0.006674372230614;
  63785. this.e = Math.sqrt(this.es);
  63786. if (!this.lat0) {
  63787. this.lat0 = 0.863937979737193;
  63788. }
  63789. if (!this.long0) {
  63790. this.long0 = 0.7417649320975901 - 0.308341501185665;
  63791. }
  63792. /* if scale not set default to 0.9999 */
  63793. if (!this.k0) {
  63794. this.k0 = 0.9999;
  63795. }
  63796. this.s45 = 0.785398163397448; /* 45 */
  63797. this.s90 = 2 * this.s45;
  63798. this.fi0 = this.lat0;
  63799. this.e2 = this.es;
  63800. this.e = Math.sqrt(this.e2);
  63801. this.alfa = Math.sqrt(1 + (this.e2 * Math.pow(Math.cos(this.fi0), 4)) / (1 - this.e2));
  63802. this.uq = 1.04216856380474;
  63803. this.u0 = Math.asin(Math.sin(this.fi0) / this.alfa);
  63804. this.g = Math.pow((1 + this.e * Math.sin(this.fi0)) / (1 - this.e * Math.sin(this.fi0)), this.alfa * this.e / 2);
  63805. this.k = Math.tan(this.u0 / 2 + this.s45) / Math.pow(Math.tan(this.fi0 / 2 + this.s45), this.alfa) * this.g;
  63806. this.k1 = this.k0;
  63807. this.n0 = this.a * Math.sqrt(1 - this.e2) / (1 - this.e2 * Math.pow(Math.sin(this.fi0), 2));
  63808. this.s0 = 1.37008346281555;
  63809. this.n = Math.sin(this.s0);
  63810. this.ro0 = this.k1 * this.n0 / Math.tan(this.s0);
  63811. this.ad = this.s90 - this.uq;
  63812. }
  63813. /* ellipsoid */
  63814. /* calculate xy from lat/lon */
  63815. /* Constants, identical to inverse transform function */
  63816. function krovak_forward(p) {
  63817. var gfi, u, deltav, s, d, eps, ro;
  63818. var lon = p.x;
  63819. var lat = p.y;
  63820. var delta_lon = adjust_lon(lon - this.long0);
  63821. /* Transformation */
  63822. gfi = Math.pow(((1 + this.e * Math.sin(lat)) / (1 - this.e * Math.sin(lat))), (this.alfa * this.e / 2));
  63823. u = 2 * (Math.atan(this.k * Math.pow(Math.tan(lat / 2 + this.s45), this.alfa) / gfi) - this.s45);
  63824. deltav = -delta_lon * this.alfa;
  63825. s = Math.asin(Math.cos(this.ad) * Math.sin(u) + Math.sin(this.ad) * Math.cos(u) * Math.cos(deltav));
  63826. d = Math.asin(Math.cos(u) * Math.sin(deltav) / Math.cos(s));
  63827. eps = this.n * d;
  63828. ro = this.ro0 * Math.pow(Math.tan(this.s0 / 2 + this.s45), this.n) / Math.pow(Math.tan(s / 2 + this.s45), this.n);
  63829. p.y = ro * Math.cos(eps) / 1;
  63830. p.x = ro * Math.sin(eps) / 1;
  63831. if (!this.czech) {
  63832. p.y *= -1;
  63833. p.x *= -1;
  63834. }
  63835. return (p);
  63836. }
  63837. /* calculate lat/lon from xy */
  63838. function krovak_inverse(p) {
  63839. var u, deltav, s, d, eps, ro, fi1;
  63840. var ok;
  63841. /* Transformation */
  63842. /* revert y, x*/
  63843. var tmp = p.x;
  63844. p.x = p.y;
  63845. p.y = tmp;
  63846. if (!this.czech) {
  63847. p.y *= -1;
  63848. p.x *= -1;
  63849. }
  63850. ro = Math.sqrt(p.x * p.x + p.y * p.y);
  63851. eps = Math.atan2(p.y, p.x);
  63852. d = eps / Math.sin(this.s0);
  63853. s = 2 * (Math.atan(Math.pow(this.ro0 / ro, 1 / this.n) * Math.tan(this.s0 / 2 + this.s45)) - this.s45);
  63854. u = Math.asin(Math.cos(this.ad) * Math.sin(s) - Math.sin(this.ad) * Math.cos(s) * Math.cos(d));
  63855. deltav = Math.asin(Math.cos(s) * Math.sin(d) / Math.cos(u));
  63856. p.x = this.long0 - deltav / this.alfa;
  63857. fi1 = u;
  63858. ok = 0;
  63859. var iter = 0;
  63860. do {
  63861. p.y = 2 * (Math.atan(Math.pow(this.k, - 1 / this.alfa) * Math.pow(Math.tan(u / 2 + this.s45), 1 / this.alfa) * Math.pow((1 + this.e * Math.sin(fi1)) / (1 - this.e * Math.sin(fi1)), this.e / 2)) - this.s45);
  63862. if (Math.abs(fi1 - p.y) < 0.0000000001) {
  63863. ok = 1;
  63864. }
  63865. fi1 = p.y;
  63866. iter += 1;
  63867. } while (ok === 0 && iter < 15);
  63868. if (iter >= 15) {
  63869. return null;
  63870. }
  63871. return (p);
  63872. }
  63873. var krovak_names = ["Krovak", "krovak"];
  63874. /* harmony default export */ const krovak = ({
  63875. init: krovak_init,
  63876. forward: krovak_forward,
  63877. inverse: krovak_inverse,
  63878. names: krovak_names
  63879. });
  63880. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/mlfn.js
  63881. /* harmony default export */ function mlfn(e0, e1, e2, e3, phi) {
  63882. return (e0 * phi - e1 * Math.sin(2 * phi) + e2 * Math.sin(4 * phi) - e3 * Math.sin(6 * phi));
  63883. }
  63884. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/e0fn.js
  63885. /* harmony default export */ function e0fn(x) {
  63886. return (1 - 0.25 * x * (1 + x / 16 * (3 + 1.25 * x)));
  63887. }
  63888. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/e1fn.js
  63889. /* harmony default export */ function e1fn(x) {
  63890. return (0.375 * x * (1 + 0.25 * x * (1 + 0.46875 * x)));
  63891. }
  63892. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/e2fn.js
  63893. /* harmony default export */ function e2fn(x) {
  63894. return (0.05859375 * x * x * (1 + 0.75 * x));
  63895. }
  63896. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/e3fn.js
  63897. /* harmony default export */ function e3fn(x) {
  63898. return (x * x * x * (35 / 3072));
  63899. }
  63900. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/gN.js
  63901. /* harmony default export */ function gN(a, e, sinphi) {
  63902. var temp = e * sinphi;
  63903. return a / Math.sqrt(1 - temp * temp);
  63904. }
  63905. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/adjust_lat.js
  63906. /* harmony default export */ function adjust_lat(x) {
  63907. return (Math.abs(x) < HALF_PI) ? x : (x - (sign(x) * Math.PI));
  63908. }
  63909. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/imlfn.js
  63910. /* harmony default export */ function imlfn(ml, e0, e1, e2, e3) {
  63911. var phi;
  63912. var dphi;
  63913. phi = ml / e0;
  63914. for (var i = 0; i < 15; i++) {
  63915. dphi = (ml - (e0 * phi - e1 * Math.sin(2 * phi) + e2 * Math.sin(4 * phi) - e3 * Math.sin(6 * phi))) / (e0 - 2 * e1 * Math.cos(2 * phi) + 4 * e2 * Math.cos(4 * phi) - 6 * e3 * Math.cos(6 * phi));
  63916. phi += dphi;
  63917. if (Math.abs(dphi) <= 0.0000000001) {
  63918. return phi;
  63919. }
  63920. }
  63921. //..reportError("IMLFN-CONV:Latitude failed to converge after 15 iterations");
  63922. return NaN;
  63923. }
  63924. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/cass.js
  63925. function cass_init() {
  63926. if (!this.sphere) {
  63927. this.e0 = e0fn(this.es);
  63928. this.e1 = e1fn(this.es);
  63929. this.e2 = e2fn(this.es);
  63930. this.e3 = e3fn(this.es);
  63931. this.ml0 = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0);
  63932. }
  63933. }
  63934. /* Cassini forward equations--mapping lat,long to x,y
  63935. -----------------------------------------------------------------------*/
  63936. function cass_forward(p) {
  63937. /* Forward equations
  63938. -----------------*/
  63939. var x, y;
  63940. var lam = p.x;
  63941. var phi = p.y;
  63942. lam = adjust_lon(lam - this.long0);
  63943. if (this.sphere) {
  63944. x = this.a * Math.asin(Math.cos(phi) * Math.sin(lam));
  63945. y = this.a * (Math.atan2(Math.tan(phi), Math.cos(lam)) - this.lat0);
  63946. }
  63947. else {
  63948. //ellipsoid
  63949. var sinphi = Math.sin(phi);
  63950. var cosphi = Math.cos(phi);
  63951. var nl = gN(this.a, this.e, sinphi);
  63952. var tl = Math.tan(phi) * Math.tan(phi);
  63953. var al = lam * Math.cos(phi);
  63954. var asq = al * al;
  63955. var cl = this.es * cosphi * cosphi / (1 - this.es);
  63956. var ml = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, phi);
  63957. x = nl * al * (1 - asq * tl * (1 / 6 - (8 - tl + 8 * cl) * asq / 120));
  63958. y = ml - this.ml0 + nl * sinphi / cosphi * asq * (0.5 + (5 - tl + 6 * cl) * asq / 24);
  63959. }
  63960. p.x = x + this.x0;
  63961. p.y = y + this.y0;
  63962. return p;
  63963. }
  63964. /* Inverse equations
  63965. -----------------*/
  63966. function cass_inverse(p) {
  63967. p.x -= this.x0;
  63968. p.y -= this.y0;
  63969. var x = p.x / this.a;
  63970. var y = p.y / this.a;
  63971. var phi, lam;
  63972. if (this.sphere) {
  63973. var dd = y + this.lat0;
  63974. phi = Math.asin(Math.sin(dd) * Math.cos(x));
  63975. lam = Math.atan2(Math.tan(x), Math.cos(dd));
  63976. }
  63977. else {
  63978. /* ellipsoid */
  63979. var ml1 = this.ml0 / this.a + y;
  63980. var phi1 = imlfn(ml1, this.e0, this.e1, this.e2, this.e3);
  63981. if (Math.abs(Math.abs(phi1) - HALF_PI) <= EPSLN) {
  63982. p.x = this.long0;
  63983. p.y = HALF_PI;
  63984. if (y < 0) {
  63985. p.y *= -1;
  63986. }
  63987. return p;
  63988. }
  63989. var nl1 = gN(this.a, this.e, Math.sin(phi1));
  63990. var rl1 = nl1 * nl1 * nl1 / this.a / this.a * (1 - this.es);
  63991. var tl1 = Math.pow(Math.tan(phi1), 2);
  63992. var dl = x * this.a / nl1;
  63993. var dsq = dl * dl;
  63994. phi = phi1 - nl1 * Math.tan(phi1) / rl1 * dl * dl * (0.5 - (1 + 3 * tl1) * dl * dl / 24);
  63995. lam = dl * (1 - dsq * (tl1 / 3 + (1 + 3 * tl1) * tl1 * dsq / 15)) / Math.cos(phi1);
  63996. }
  63997. p.x = adjust_lon(lam + this.long0);
  63998. p.y = adjust_lat(phi);
  63999. return p;
  64000. }
  64001. var cass_names = ["Cassini", "Cassini_Soldner", "cass"];
  64002. /* harmony default export */ const cass = ({
  64003. init: cass_init,
  64004. forward: cass_forward,
  64005. inverse: cass_inverse,
  64006. names: cass_names
  64007. });
  64008. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/qsfnz.js
  64009. /* harmony default export */ function qsfnz(eccent, sinphi) {
  64010. var con;
  64011. if (eccent > 1.0e-7) {
  64012. con = eccent * sinphi;
  64013. return ((1 - eccent * eccent) * (sinphi / (1 - con * con) - (0.5 / eccent) * Math.log((1 - con) / (1 + con))));
  64014. }
  64015. else {
  64016. return (2 * sinphi);
  64017. }
  64018. }
  64019. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/laea.js
  64020. /*
  64021. reference
  64022. "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder,
  64023. The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355.
  64024. */
  64025. var S_POLE = 1;
  64026. var N_POLE = 2;
  64027. var EQUIT = 3;
  64028. var OBLIQ = 4;
  64029. /* Initialize the Lambert Azimuthal Equal Area projection
  64030. ------------------------------------------------------*/
  64031. function laea_init() {
  64032. var t = Math.abs(this.lat0);
  64033. if (Math.abs(t - HALF_PI) < EPSLN) {
  64034. this.mode = this.lat0 < 0 ? this.S_POLE : this.N_POLE;
  64035. }
  64036. else if (Math.abs(t) < EPSLN) {
  64037. this.mode = this.EQUIT;
  64038. }
  64039. else {
  64040. this.mode = this.OBLIQ;
  64041. }
  64042. if (this.es > 0) {
  64043. var sinphi;
  64044. this.qp = qsfnz(this.e, 1);
  64045. this.mmf = 0.5 / (1 - this.es);
  64046. this.apa = authset(this.es);
  64047. switch (this.mode) {
  64048. case this.N_POLE:
  64049. this.dd = 1;
  64050. break;
  64051. case this.S_POLE:
  64052. this.dd = 1;
  64053. break;
  64054. case this.EQUIT:
  64055. this.rq = Math.sqrt(0.5 * this.qp);
  64056. this.dd = 1 / this.rq;
  64057. this.xmf = 1;
  64058. this.ymf = 0.5 * this.qp;
  64059. break;
  64060. case this.OBLIQ:
  64061. this.rq = Math.sqrt(0.5 * this.qp);
  64062. sinphi = Math.sin(this.lat0);
  64063. this.sinb1 = qsfnz(this.e, sinphi) / this.qp;
  64064. this.cosb1 = Math.sqrt(1 - this.sinb1 * this.sinb1);
  64065. this.dd = Math.cos(this.lat0) / (Math.sqrt(1 - this.es * sinphi * sinphi) * this.rq * this.cosb1);
  64066. this.ymf = (this.xmf = this.rq) / this.dd;
  64067. this.xmf *= this.dd;
  64068. break;
  64069. }
  64070. }
  64071. else {
  64072. if (this.mode === this.OBLIQ) {
  64073. this.sinph0 = Math.sin(this.lat0);
  64074. this.cosph0 = Math.cos(this.lat0);
  64075. }
  64076. }
  64077. }
  64078. /* Lambert Azimuthal Equal Area forward equations--mapping lat,long to x,y
  64079. -----------------------------------------------------------------------*/
  64080. function laea_forward(p) {
  64081. /* Forward equations
  64082. -----------------*/
  64083. var x, y, coslam, sinlam, sinphi, q, sinb, cosb, b, cosphi;
  64084. var lam = p.x;
  64085. var phi = p.y;
  64086. lam = adjust_lon(lam - this.long0);
  64087. if (this.sphere) {
  64088. sinphi = Math.sin(phi);
  64089. cosphi = Math.cos(phi);
  64090. coslam = Math.cos(lam);
  64091. if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
  64092. y = (this.mode === this.EQUIT) ? 1 + cosphi * coslam : 1 + this.sinph0 * sinphi + this.cosph0 * cosphi * coslam;
  64093. if (y <= EPSLN) {
  64094. return null;
  64095. }
  64096. y = Math.sqrt(2 / y);
  64097. x = y * cosphi * Math.sin(lam);
  64098. y *= (this.mode === this.EQUIT) ? sinphi : this.cosph0 * sinphi - this.sinph0 * cosphi * coslam;
  64099. }
  64100. else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {
  64101. if (this.mode === this.N_POLE) {
  64102. coslam = -coslam;
  64103. }
  64104. if (Math.abs(phi + this.lat0) < EPSLN) {
  64105. return null;
  64106. }
  64107. y = FORTPI - phi * 0.5;
  64108. y = 2 * ((this.mode === this.S_POLE) ? Math.cos(y) : Math.sin(y));
  64109. x = y * Math.sin(lam);
  64110. y *= coslam;
  64111. }
  64112. }
  64113. else {
  64114. sinb = 0;
  64115. cosb = 0;
  64116. b = 0;
  64117. coslam = Math.cos(lam);
  64118. sinlam = Math.sin(lam);
  64119. sinphi = Math.sin(phi);
  64120. q = qsfnz(this.e, sinphi);
  64121. if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
  64122. sinb = q / this.qp;
  64123. cosb = Math.sqrt(1 - sinb * sinb);
  64124. }
  64125. switch (this.mode) {
  64126. case this.OBLIQ:
  64127. b = 1 + this.sinb1 * sinb + this.cosb1 * cosb * coslam;
  64128. break;
  64129. case this.EQUIT:
  64130. b = 1 + cosb * coslam;
  64131. break;
  64132. case this.N_POLE:
  64133. b = HALF_PI + phi;
  64134. q = this.qp - q;
  64135. break;
  64136. case this.S_POLE:
  64137. b = phi - HALF_PI;
  64138. q = this.qp + q;
  64139. break;
  64140. }
  64141. if (Math.abs(b) < EPSLN) {
  64142. return null;
  64143. }
  64144. switch (this.mode) {
  64145. case this.OBLIQ:
  64146. case this.EQUIT:
  64147. b = Math.sqrt(2 / b);
  64148. if (this.mode === this.OBLIQ) {
  64149. y = this.ymf * b * (this.cosb1 * sinb - this.sinb1 * cosb * coslam);
  64150. }
  64151. else {
  64152. y = (b = Math.sqrt(2 / (1 + cosb * coslam))) * sinb * this.ymf;
  64153. }
  64154. x = this.xmf * b * cosb * sinlam;
  64155. break;
  64156. case this.N_POLE:
  64157. case this.S_POLE:
  64158. if (q >= 0) {
  64159. x = (b = Math.sqrt(q)) * sinlam;
  64160. y = coslam * ((this.mode === this.S_POLE) ? b : -b);
  64161. }
  64162. else {
  64163. x = y = 0;
  64164. }
  64165. break;
  64166. }
  64167. }
  64168. p.x = this.a * x + this.x0;
  64169. p.y = this.a * y + this.y0;
  64170. return p;
  64171. }
  64172. /* Inverse equations
  64173. -----------------*/
  64174. function laea_inverse(p) {
  64175. p.x -= this.x0;
  64176. p.y -= this.y0;
  64177. var x = p.x / this.a;
  64178. var y = p.y / this.a;
  64179. var lam, phi, cCe, sCe, q, rho, ab;
  64180. if (this.sphere) {
  64181. var cosz = 0,
  64182. rh, sinz = 0;
  64183. rh = Math.sqrt(x * x + y * y);
  64184. phi = rh * 0.5;
  64185. if (phi > 1) {
  64186. return null;
  64187. }
  64188. phi = 2 * Math.asin(phi);
  64189. if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
  64190. sinz = Math.sin(phi);
  64191. cosz = Math.cos(phi);
  64192. }
  64193. switch (this.mode) {
  64194. case this.EQUIT:
  64195. phi = (Math.abs(rh) <= EPSLN) ? 0 : Math.asin(y * sinz / rh);
  64196. x *= sinz;
  64197. y = cosz * rh;
  64198. break;
  64199. case this.OBLIQ:
  64200. phi = (Math.abs(rh) <= EPSLN) ? this.lat0 : Math.asin(cosz * this.sinph0 + y * sinz * this.cosph0 / rh);
  64201. x *= sinz * this.cosph0;
  64202. y = (cosz - Math.sin(phi) * this.sinph0) * rh;
  64203. break;
  64204. case this.N_POLE:
  64205. y = -y;
  64206. phi = HALF_PI - phi;
  64207. break;
  64208. case this.S_POLE:
  64209. phi -= HALF_PI;
  64210. break;
  64211. }
  64212. lam = (y === 0 && (this.mode === this.EQUIT || this.mode === this.OBLIQ)) ? 0 : Math.atan2(x, y);
  64213. }
  64214. else {
  64215. ab = 0;
  64216. if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
  64217. x /= this.dd;
  64218. y *= this.dd;
  64219. rho = Math.sqrt(x * x + y * y);
  64220. if (rho < EPSLN) {
  64221. p.x = this.long0;
  64222. p.y = this.lat0;
  64223. return p;
  64224. }
  64225. sCe = 2 * Math.asin(0.5 * rho / this.rq);
  64226. cCe = Math.cos(sCe);
  64227. x *= (sCe = Math.sin(sCe));
  64228. if (this.mode === this.OBLIQ) {
  64229. ab = cCe * this.sinb1 + y * sCe * this.cosb1 / rho;
  64230. q = this.qp * ab;
  64231. y = rho * this.cosb1 * cCe - y * this.sinb1 * sCe;
  64232. }
  64233. else {
  64234. ab = y * sCe / rho;
  64235. q = this.qp * ab;
  64236. y = rho * cCe;
  64237. }
  64238. }
  64239. else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {
  64240. if (this.mode === this.N_POLE) {
  64241. y = -y;
  64242. }
  64243. q = (x * x + y * y);
  64244. if (!q) {
  64245. p.x = this.long0;
  64246. p.y = this.lat0;
  64247. return p;
  64248. }
  64249. ab = 1 - q / this.qp;
  64250. if (this.mode === this.S_POLE) {
  64251. ab = -ab;
  64252. }
  64253. }
  64254. lam = Math.atan2(x, y);
  64255. phi = authlat(Math.asin(ab), this.apa);
  64256. }
  64257. p.x = adjust_lon(this.long0 + lam);
  64258. p.y = phi;
  64259. return p;
  64260. }
  64261. /* determine latitude from authalic latitude */
  64262. var P00 = 0.33333333333333333333;
  64263. var P01 = 0.17222222222222222222;
  64264. var P02 = 0.10257936507936507936;
  64265. var P10 = 0.06388888888888888888;
  64266. var P11 = 0.06640211640211640211;
  64267. var P20 = 0.01641501294219154443;
  64268. function authset(es) {
  64269. var t;
  64270. var APA = [];
  64271. APA[0] = es * P00;
  64272. t = es * es;
  64273. APA[0] += t * P01;
  64274. APA[1] = t * P10;
  64275. t *= es;
  64276. APA[0] += t * P02;
  64277. APA[1] += t * P11;
  64278. APA[2] = t * P20;
  64279. return APA;
  64280. }
  64281. function authlat(beta, APA) {
  64282. var t = beta + beta;
  64283. return (beta + APA[0] * Math.sin(t) + APA[1] * Math.sin(t + t) + APA[2] * Math.sin(t + t + t));
  64284. }
  64285. var laea_names = ["Lambert Azimuthal Equal Area", "Lambert_Azimuthal_Equal_Area", "laea"];
  64286. /* harmony default export */ const laea = ({
  64287. init: laea_init,
  64288. forward: laea_forward,
  64289. inverse: laea_inverse,
  64290. names: laea_names,
  64291. S_POLE: S_POLE,
  64292. N_POLE: N_POLE,
  64293. EQUIT: EQUIT,
  64294. OBLIQ: OBLIQ
  64295. });
  64296. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/asinz.js
  64297. /* harmony default export */ function asinz(x) {
  64298. if (Math.abs(x) > 1) {
  64299. x = (x > 1) ? 1 : -1;
  64300. }
  64301. return Math.asin(x);
  64302. }
  64303. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/aea.js
  64304. function aea_init() {
  64305. if (Math.abs(this.lat1 + this.lat2) < EPSLN) {
  64306. return;
  64307. }
  64308. this.temp = this.b / this.a;
  64309. this.es = 1 - Math.pow(this.temp, 2);
  64310. this.e3 = Math.sqrt(this.es);
  64311. this.sin_po = Math.sin(this.lat1);
  64312. this.cos_po = Math.cos(this.lat1);
  64313. this.t1 = this.sin_po;
  64314. this.con = this.sin_po;
  64315. this.ms1 = msfnz(this.e3, this.sin_po, this.cos_po);
  64316. this.qs1 = qsfnz(this.e3, this.sin_po, this.cos_po);
  64317. this.sin_po = Math.sin(this.lat2);
  64318. this.cos_po = Math.cos(this.lat2);
  64319. this.t2 = this.sin_po;
  64320. this.ms2 = msfnz(this.e3, this.sin_po, this.cos_po);
  64321. this.qs2 = qsfnz(this.e3, this.sin_po, this.cos_po);
  64322. this.sin_po = Math.sin(this.lat0);
  64323. this.cos_po = Math.cos(this.lat0);
  64324. this.t3 = this.sin_po;
  64325. this.qs0 = qsfnz(this.e3, this.sin_po, this.cos_po);
  64326. if (Math.abs(this.lat1 - this.lat2) > EPSLN) {
  64327. this.ns0 = (this.ms1 * this.ms1 - this.ms2 * this.ms2) / (this.qs2 - this.qs1);
  64328. }
  64329. else {
  64330. this.ns0 = this.con;
  64331. }
  64332. this.c = this.ms1 * this.ms1 + this.ns0 * this.qs1;
  64333. this.rh = this.a * Math.sqrt(this.c - this.ns0 * this.qs0) / this.ns0;
  64334. }
  64335. /* Albers Conical Equal Area forward equations--mapping lat,long to x,y
  64336. -------------------------------------------------------------------*/
  64337. function aea_forward(p) {
  64338. var lon = p.x;
  64339. var lat = p.y;
  64340. this.sin_phi = Math.sin(lat);
  64341. this.cos_phi = Math.cos(lat);
  64342. var qs = qsfnz(this.e3, this.sin_phi, this.cos_phi);
  64343. var rh1 = this.a * Math.sqrt(this.c - this.ns0 * qs) / this.ns0;
  64344. var theta = this.ns0 * adjust_lon(lon - this.long0);
  64345. var x = rh1 * Math.sin(theta) + this.x0;
  64346. var y = this.rh - rh1 * Math.cos(theta) + this.y0;
  64347. p.x = x;
  64348. p.y = y;
  64349. return p;
  64350. }
  64351. function aea_inverse(p) {
  64352. var rh1, qs, con, theta, lon, lat;
  64353. p.x -= this.x0;
  64354. p.y = this.rh - p.y + this.y0;
  64355. if (this.ns0 >= 0) {
  64356. rh1 = Math.sqrt(p.x * p.x + p.y * p.y);
  64357. con = 1;
  64358. }
  64359. else {
  64360. rh1 = -Math.sqrt(p.x * p.x + p.y * p.y);
  64361. con = -1;
  64362. }
  64363. theta = 0;
  64364. if (rh1 !== 0) {
  64365. theta = Math.atan2(con * p.x, con * p.y);
  64366. }
  64367. con = rh1 * this.ns0 / this.a;
  64368. if (this.sphere) {
  64369. lat = Math.asin((this.c - con * con) / (2 * this.ns0));
  64370. }
  64371. else {
  64372. qs = (this.c - con * con) / this.ns0;
  64373. lat = this.phi1z(this.e3, qs);
  64374. }
  64375. lon = adjust_lon(theta / this.ns0 + this.long0);
  64376. p.x = lon;
  64377. p.y = lat;
  64378. return p;
  64379. }
  64380. /* Function to compute phi1, the latitude for the inverse of the
  64381. Albers Conical Equal-Area projection.
  64382. -------------------------------------------*/
  64383. function phi1z(eccent, qs) {
  64384. var sinphi, cosphi, con, com, dphi;
  64385. var phi = asinz(0.5 * qs);
  64386. if (eccent < EPSLN) {
  64387. return phi;
  64388. }
  64389. var eccnts = eccent * eccent;
  64390. for (var i = 1; i <= 25; i++) {
  64391. sinphi = Math.sin(phi);
  64392. cosphi = Math.cos(phi);
  64393. con = eccent * sinphi;
  64394. com = 1 - con * con;
  64395. dphi = 0.5 * com * com / cosphi * (qs / (1 - eccnts) - sinphi / com + 0.5 / eccent * Math.log((1 - con) / (1 + con)));
  64396. phi = phi + dphi;
  64397. if (Math.abs(dphi) <= 1e-7) {
  64398. return phi;
  64399. }
  64400. }
  64401. return null;
  64402. }
  64403. var aea_names = ["Albers_Conic_Equal_Area", "Albers", "aea"];
  64404. /* harmony default export */ const aea = ({
  64405. init: aea_init,
  64406. forward: aea_forward,
  64407. inverse: aea_inverse,
  64408. names: aea_names,
  64409. phi1z: phi1z
  64410. });
  64411. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/gnom.js
  64412. /*
  64413. reference:
  64414. Wolfram Mathworld "Gnomonic Projection"
  64415. http://mathworld.wolfram.com/GnomonicProjection.html
  64416. Accessed: 12th November 2009
  64417. */
  64418. function gnom_init() {
  64419. /* Place parameters in static storage for common use
  64420. -------------------------------------------------*/
  64421. this.sin_p14 = Math.sin(this.lat0);
  64422. this.cos_p14 = Math.cos(this.lat0);
  64423. // Approximation for projecting points to the horizon (infinity)
  64424. this.infinity_dist = 1000 * this.a;
  64425. this.rc = 1;
  64426. }
  64427. /* Gnomonic forward equations--mapping lat,long to x,y
  64428. ---------------------------------------------------*/
  64429. function gnom_forward(p) {
  64430. var sinphi, cosphi; /* sin and cos value */
  64431. var dlon; /* delta longitude value */
  64432. var coslon; /* cos of longitude */
  64433. var ksp; /* scale factor */
  64434. var g;
  64435. var x, y;
  64436. var lon = p.x;
  64437. var lat = p.y;
  64438. /* Forward equations
  64439. -----------------*/
  64440. dlon = adjust_lon(lon - this.long0);
  64441. sinphi = Math.sin(lat);
  64442. cosphi = Math.cos(lat);
  64443. coslon = Math.cos(dlon);
  64444. g = this.sin_p14 * sinphi + this.cos_p14 * cosphi * coslon;
  64445. ksp = 1;
  64446. if ((g > 0) || (Math.abs(g) <= EPSLN)) {
  64447. x = this.x0 + this.a * ksp * cosphi * Math.sin(dlon) / g;
  64448. y = this.y0 + this.a * ksp * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon) / g;
  64449. }
  64450. else {
  64451. // Point is in the opposing hemisphere and is unprojectable
  64452. // We still need to return a reasonable point, so we project
  64453. // to infinity, on a bearing
  64454. // equivalent to the northern hemisphere equivalent
  64455. // This is a reasonable approximation for short shapes and lines that
  64456. // straddle the horizon.
  64457. x = this.x0 + this.infinity_dist * cosphi * Math.sin(dlon);
  64458. y = this.y0 + this.infinity_dist * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon);
  64459. }
  64460. p.x = x;
  64461. p.y = y;
  64462. return p;
  64463. }
  64464. function gnom_inverse(p) {
  64465. var rh; /* Rho */
  64466. var sinc, cosc;
  64467. var c;
  64468. var lon, lat;
  64469. /* Inverse equations
  64470. -----------------*/
  64471. p.x = (p.x - this.x0) / this.a;
  64472. p.y = (p.y - this.y0) / this.a;
  64473. p.x /= this.k0;
  64474. p.y /= this.k0;
  64475. if ((rh = Math.sqrt(p.x * p.x + p.y * p.y))) {
  64476. c = Math.atan2(rh, this.rc);
  64477. sinc = Math.sin(c);
  64478. cosc = Math.cos(c);
  64479. lat = asinz(cosc * this.sin_p14 + (p.y * sinc * this.cos_p14) / rh);
  64480. lon = Math.atan2(p.x * sinc, rh * this.cos_p14 * cosc - p.y * this.sin_p14 * sinc);
  64481. lon = adjust_lon(this.long0 + lon);
  64482. }
  64483. else {
  64484. lat = this.phic0;
  64485. lon = 0;
  64486. }
  64487. p.x = lon;
  64488. p.y = lat;
  64489. return p;
  64490. }
  64491. var gnom_names = ["gnom"];
  64492. /* harmony default export */ const gnom = ({
  64493. init: gnom_init,
  64494. forward: gnom_forward,
  64495. inverse: gnom_inverse,
  64496. names: gnom_names
  64497. });
  64498. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/iqsfnz.js
  64499. /* harmony default export */ function iqsfnz(eccent, q) {
  64500. var temp = 1 - (1 - eccent * eccent) / (2 * eccent) * Math.log((1 - eccent) / (1 + eccent));
  64501. if (Math.abs(Math.abs(q) - temp) < 1.0E-6) {
  64502. if (q < 0) {
  64503. return (-1 * HALF_PI);
  64504. }
  64505. else {
  64506. return HALF_PI;
  64507. }
  64508. }
  64509. //var phi = 0.5* q/(1-eccent*eccent);
  64510. var phi = Math.asin(0.5 * q);
  64511. var dphi;
  64512. var sin_phi;
  64513. var cos_phi;
  64514. var con;
  64515. for (var i = 0; i < 30; i++) {
  64516. sin_phi = Math.sin(phi);
  64517. cos_phi = Math.cos(phi);
  64518. con = eccent * sin_phi;
  64519. dphi = Math.pow(1 - con * con, 2) / (2 * cos_phi) * (q / (1 - eccent * eccent) - sin_phi / (1 - con * con) + 0.5 / eccent * Math.log((1 - con) / (1 + con)));
  64520. phi += dphi;
  64521. if (Math.abs(dphi) <= 0.0000000001) {
  64522. return phi;
  64523. }
  64524. }
  64525. //console.log("IQSFN-CONV:Latitude failed to converge after 30 iterations");
  64526. return NaN;
  64527. }
  64528. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/cea.js
  64529. /*
  64530. reference:
  64531. "Cartographic Projection Procedures for the UNIX Environment-
  64532. A User's Manual" by Gerald I. Evenden,
  64533. USGS Open File Report 90-284and Release 4 Interim Reports (2003)
  64534. */
  64535. function cea_init() {
  64536. //no-op
  64537. if (!this.sphere) {
  64538. this.k0 = msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts));
  64539. }
  64540. }
  64541. /* Cylindrical Equal Area forward equations--mapping lat,long to x,y
  64542. ------------------------------------------------------------*/
  64543. function cea_forward(p) {
  64544. var lon = p.x;
  64545. var lat = p.y;
  64546. var x, y;
  64547. /* Forward equations
  64548. -----------------*/
  64549. var dlon = adjust_lon(lon - this.long0);
  64550. if (this.sphere) {
  64551. x = this.x0 + this.a * dlon * Math.cos(this.lat_ts);
  64552. y = this.y0 + this.a * Math.sin(lat) / Math.cos(this.lat_ts);
  64553. }
  64554. else {
  64555. var qs = qsfnz(this.e, Math.sin(lat));
  64556. x = this.x0 + this.a * this.k0 * dlon;
  64557. y = this.y0 + this.a * qs * 0.5 / this.k0;
  64558. }
  64559. p.x = x;
  64560. p.y = y;
  64561. return p;
  64562. }
  64563. /* Cylindrical Equal Area inverse equations--mapping x,y to lat/long
  64564. ------------------------------------------------------------*/
  64565. function cea_inverse(p) {
  64566. p.x -= this.x0;
  64567. p.y -= this.y0;
  64568. var lon, lat;
  64569. if (this.sphere) {
  64570. lon = adjust_lon(this.long0 + (p.x / this.a) / Math.cos(this.lat_ts));
  64571. lat = Math.asin((p.y / this.a) * Math.cos(this.lat_ts));
  64572. }
  64573. else {
  64574. lat = iqsfnz(this.e, 2 * p.y * this.k0 / this.a);
  64575. lon = adjust_lon(this.long0 + p.x / (this.a * this.k0));
  64576. }
  64577. p.x = lon;
  64578. p.y = lat;
  64579. return p;
  64580. }
  64581. var cea_names = ["cea"];
  64582. /* harmony default export */ const cea = ({
  64583. init: cea_init,
  64584. forward: cea_forward,
  64585. inverse: cea_inverse,
  64586. names: cea_names
  64587. });
  64588. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/eqc.js
  64589. function eqc_init() {
  64590. this.x0 = this.x0 || 0;
  64591. this.y0 = this.y0 || 0;
  64592. this.lat0 = this.lat0 || 0;
  64593. this.long0 = this.long0 || 0;
  64594. this.lat_ts = this.lat_ts || 0;
  64595. this.title = this.title || "Equidistant Cylindrical (Plate Carre)";
  64596. this.rc = Math.cos(this.lat_ts);
  64597. }
  64598. // forward equations--mapping lat,long to x,y
  64599. // -----------------------------------------------------------------
  64600. function eqc_forward(p) {
  64601. var lon = p.x;
  64602. var lat = p.y;
  64603. var dlon = adjust_lon(lon - this.long0);
  64604. var dlat = adjust_lat(lat - this.lat0);
  64605. p.x = this.x0 + (this.a * dlon * this.rc);
  64606. p.y = this.y0 + (this.a * dlat);
  64607. return p;
  64608. }
  64609. // inverse equations--mapping x,y to lat/long
  64610. // -----------------------------------------------------------------
  64611. function eqc_inverse(p) {
  64612. var x = p.x;
  64613. var y = p.y;
  64614. p.x = adjust_lon(this.long0 + ((x - this.x0) / (this.a * this.rc)));
  64615. p.y = adjust_lat(this.lat0 + ((y - this.y0) / (this.a)));
  64616. return p;
  64617. }
  64618. var eqc_names = ["Equirectangular", "Equidistant_Cylindrical", "eqc"];
  64619. /* harmony default export */ const eqc = ({
  64620. init: eqc_init,
  64621. forward: eqc_forward,
  64622. inverse: eqc_inverse,
  64623. names: eqc_names
  64624. });
  64625. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/poly.js
  64626. var poly_MAX_ITER = 20;
  64627. function poly_init() {
  64628. /* Place parameters in static storage for common use
  64629. -------------------------------------------------*/
  64630. this.temp = this.b / this.a;
  64631. this.es = 1 - Math.pow(this.temp, 2); // devait etre dans tmerc.js mais n y est pas donc je commente sinon retour de valeurs nulles
  64632. this.e = Math.sqrt(this.es);
  64633. this.e0 = e0fn(this.es);
  64634. this.e1 = e1fn(this.es);
  64635. this.e2 = e2fn(this.es);
  64636. this.e3 = e3fn(this.es);
  64637. this.ml0 = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0); //si que des zeros le calcul ne se fait pas
  64638. }
  64639. /* Polyconic forward equations--mapping lat,long to x,y
  64640. ---------------------------------------------------*/
  64641. function poly_forward(p) {
  64642. var lon = p.x;
  64643. var lat = p.y;
  64644. var x, y, el;
  64645. var dlon = adjust_lon(lon - this.long0);
  64646. el = dlon * Math.sin(lat);
  64647. if (this.sphere) {
  64648. if (Math.abs(lat) <= EPSLN) {
  64649. x = this.a * dlon;
  64650. y = -1 * this.a * this.lat0;
  64651. }
  64652. else {
  64653. x = this.a * Math.sin(el) / Math.tan(lat);
  64654. y = this.a * (adjust_lat(lat - this.lat0) + (1 - Math.cos(el)) / Math.tan(lat));
  64655. }
  64656. }
  64657. else {
  64658. if (Math.abs(lat) <= EPSLN) {
  64659. x = this.a * dlon;
  64660. y = -1 * this.ml0;
  64661. }
  64662. else {
  64663. var nl = gN(this.a, this.e, Math.sin(lat)) / Math.tan(lat);
  64664. x = nl * Math.sin(el);
  64665. y = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, lat) - this.ml0 + nl * (1 - Math.cos(el));
  64666. }
  64667. }
  64668. p.x = x + this.x0;
  64669. p.y = y + this.y0;
  64670. return p;
  64671. }
  64672. /* Inverse equations
  64673. -----------------*/
  64674. function poly_inverse(p) {
  64675. var lon, lat, x, y, i;
  64676. var al, bl;
  64677. var phi, dphi;
  64678. x = p.x - this.x0;
  64679. y = p.y - this.y0;
  64680. if (this.sphere) {
  64681. if (Math.abs(y + this.a * this.lat0) <= EPSLN) {
  64682. lon = adjust_lon(x / this.a + this.long0);
  64683. lat = 0;
  64684. }
  64685. else {
  64686. al = this.lat0 + y / this.a;
  64687. bl = x * x / this.a / this.a + al * al;
  64688. phi = al;
  64689. var tanphi;
  64690. for (i = poly_MAX_ITER; i; --i) {
  64691. tanphi = Math.tan(phi);
  64692. dphi = -1 * (al * (phi * tanphi + 1) - phi - 0.5 * (phi * phi + bl) * tanphi) / ((phi - al) / tanphi - 1);
  64693. phi += dphi;
  64694. if (Math.abs(dphi) <= EPSLN) {
  64695. lat = phi;
  64696. break;
  64697. }
  64698. }
  64699. lon = adjust_lon(this.long0 + (Math.asin(x * Math.tan(phi) / this.a)) / Math.sin(lat));
  64700. }
  64701. }
  64702. else {
  64703. if (Math.abs(y + this.ml0) <= EPSLN) {
  64704. lat = 0;
  64705. lon = adjust_lon(this.long0 + x / this.a);
  64706. }
  64707. else {
  64708. al = (this.ml0 + y) / this.a;
  64709. bl = x * x / this.a / this.a + al * al;
  64710. phi = al;
  64711. var cl, mln, mlnp, ma;
  64712. var con;
  64713. for (i = poly_MAX_ITER; i; --i) {
  64714. con = this.e * Math.sin(phi);
  64715. cl = Math.sqrt(1 - con * con) * Math.tan(phi);
  64716. mln = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, phi);
  64717. mlnp = this.e0 - 2 * this.e1 * Math.cos(2 * phi) + 4 * this.e2 * Math.cos(4 * phi) - 6 * this.e3 * Math.cos(6 * phi);
  64718. ma = mln / this.a;
  64719. dphi = (al * (cl * ma + 1) - ma - 0.5 * cl * (ma * ma + bl)) / (this.es * Math.sin(2 * phi) * (ma * ma + bl - 2 * al * ma) / (4 * cl) + (al - ma) * (cl * mlnp - 2 / Math.sin(2 * phi)) - mlnp);
  64720. phi -= dphi;
  64721. if (Math.abs(dphi) <= EPSLN) {
  64722. lat = phi;
  64723. break;
  64724. }
  64725. }
  64726. //lat=phi4z(this.e,this.e0,this.e1,this.e2,this.e3,al,bl,0,0);
  64727. cl = Math.sqrt(1 - this.es * Math.pow(Math.sin(lat), 2)) * Math.tan(lat);
  64728. lon = adjust_lon(this.long0 + Math.asin(x * cl / this.a) / Math.sin(lat));
  64729. }
  64730. }
  64731. p.x = lon;
  64732. p.y = lat;
  64733. return p;
  64734. }
  64735. var poly_names = ["Polyconic", "poly"];
  64736. /* harmony default export */ const poly = ({
  64737. init: poly_init,
  64738. forward: poly_forward,
  64739. inverse: poly_inverse,
  64740. names: poly_names
  64741. });
  64742. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/nzmg.js
  64743. /*
  64744. reference
  64745. Department of Land and Survey Technical Circular 1973/32
  64746. http://www.linz.govt.nz/docs/miscellaneous/nz-map-definition.pdf
  64747. OSG Technical Report 4.1
  64748. http://www.linz.govt.nz/docs/miscellaneous/nzmg.pdf
  64749. */
  64750. /**
  64751. * iterations: Number of iterations to refine inverse transform.
  64752. * 0 -> km accuracy
  64753. * 1 -> m accuracy -- suitable for most mapping applications
  64754. * 2 -> mm accuracy
  64755. */
  64756. var iterations = 1;
  64757. function nzmg_init() {
  64758. this.A = [];
  64759. this.A[1] = 0.6399175073;
  64760. this.A[2] = -0.1358797613;
  64761. this.A[3] = 0.063294409;
  64762. this.A[4] = -0.02526853;
  64763. this.A[5] = 0.0117879;
  64764. this.A[6] = -0.0055161;
  64765. this.A[7] = 0.0026906;
  64766. this.A[8] = -0.001333;
  64767. this.A[9] = 0.00067;
  64768. this.A[10] = -0.00034;
  64769. this.B_re = [];
  64770. this.B_im = [];
  64771. this.B_re[1] = 0.7557853228;
  64772. this.B_im[1] = 0;
  64773. this.B_re[2] = 0.249204646;
  64774. this.B_im[2] = 0.003371507;
  64775. this.B_re[3] = -0.001541739;
  64776. this.B_im[3] = 0.041058560;
  64777. this.B_re[4] = -0.10162907;
  64778. this.B_im[4] = 0.01727609;
  64779. this.B_re[5] = -0.26623489;
  64780. this.B_im[5] = -0.36249218;
  64781. this.B_re[6] = -0.6870983;
  64782. this.B_im[6] = -1.1651967;
  64783. this.C_re = [];
  64784. this.C_im = [];
  64785. this.C_re[1] = 1.3231270439;
  64786. this.C_im[1] = 0;
  64787. this.C_re[2] = -0.577245789;
  64788. this.C_im[2] = -0.007809598;
  64789. this.C_re[3] = 0.508307513;
  64790. this.C_im[3] = -0.112208952;
  64791. this.C_re[4] = -0.15094762;
  64792. this.C_im[4] = 0.18200602;
  64793. this.C_re[5] = 1.01418179;
  64794. this.C_im[5] = 1.64497696;
  64795. this.C_re[6] = 1.9660549;
  64796. this.C_im[6] = 2.5127645;
  64797. this.D = [];
  64798. this.D[1] = 1.5627014243;
  64799. this.D[2] = 0.5185406398;
  64800. this.D[3] = -0.03333098;
  64801. this.D[4] = -0.1052906;
  64802. this.D[5] = -0.0368594;
  64803. this.D[6] = 0.007317;
  64804. this.D[7] = 0.01220;
  64805. this.D[8] = 0.00394;
  64806. this.D[9] = -0.0013;
  64807. }
  64808. /**
  64809. New Zealand Map Grid Forward - long/lat to x/y
  64810. long/lat in radians
  64811. */
  64812. function nzmg_forward(p) {
  64813. var n;
  64814. var lon = p.x;
  64815. var lat = p.y;
  64816. var delta_lat = lat - this.lat0;
  64817. var delta_lon = lon - this.long0;
  64818. // 1. Calculate d_phi and d_psi ... // and d_lambda
  64819. // For this algorithm, delta_latitude is in seconds of arc x 10-5, so we need to scale to those units. Longitude is radians.
  64820. var d_phi = delta_lat / SEC_TO_RAD * 1E-5;
  64821. var d_lambda = delta_lon;
  64822. var d_phi_n = 1; // d_phi^0
  64823. var d_psi = 0;
  64824. for (n = 1; n <= 10; n++) {
  64825. d_phi_n = d_phi_n * d_phi;
  64826. d_psi = d_psi + this.A[n] * d_phi_n;
  64827. }
  64828. // 2. Calculate theta
  64829. var th_re = d_psi;
  64830. var th_im = d_lambda;
  64831. // 3. Calculate z
  64832. var th_n_re = 1;
  64833. var th_n_im = 0; // theta^0
  64834. var th_n_re1;
  64835. var th_n_im1;
  64836. var z_re = 0;
  64837. var z_im = 0;
  64838. for (n = 1; n <= 6; n++) {
  64839. th_n_re1 = th_n_re * th_re - th_n_im * th_im;
  64840. th_n_im1 = th_n_im * th_re + th_n_re * th_im;
  64841. th_n_re = th_n_re1;
  64842. th_n_im = th_n_im1;
  64843. z_re = z_re + this.B_re[n] * th_n_re - this.B_im[n] * th_n_im;
  64844. z_im = z_im + this.B_im[n] * th_n_re + this.B_re[n] * th_n_im;
  64845. }
  64846. // 4. Calculate easting and northing
  64847. p.x = (z_im * this.a) + this.x0;
  64848. p.y = (z_re * this.a) + this.y0;
  64849. return p;
  64850. }
  64851. /**
  64852. New Zealand Map Grid Inverse - x/y to long/lat
  64853. */
  64854. function nzmg_inverse(p) {
  64855. var n;
  64856. var x = p.x;
  64857. var y = p.y;
  64858. var delta_x = x - this.x0;
  64859. var delta_y = y - this.y0;
  64860. // 1. Calculate z
  64861. var z_re = delta_y / this.a;
  64862. var z_im = delta_x / this.a;
  64863. // 2a. Calculate theta - first approximation gives km accuracy
  64864. var z_n_re = 1;
  64865. var z_n_im = 0; // z^0
  64866. var z_n_re1;
  64867. var z_n_im1;
  64868. var th_re = 0;
  64869. var th_im = 0;
  64870. for (n = 1; n <= 6; n++) {
  64871. z_n_re1 = z_n_re * z_re - z_n_im * z_im;
  64872. z_n_im1 = z_n_im * z_re + z_n_re * z_im;
  64873. z_n_re = z_n_re1;
  64874. z_n_im = z_n_im1;
  64875. th_re = th_re + this.C_re[n] * z_n_re - this.C_im[n] * z_n_im;
  64876. th_im = th_im + this.C_im[n] * z_n_re + this.C_re[n] * z_n_im;
  64877. }
  64878. // 2b. Iterate to refine the accuracy of the calculation
  64879. // 0 iterations gives km accuracy
  64880. // 1 iteration gives m accuracy -- good enough for most mapping applications
  64881. // 2 iterations bives mm accuracy
  64882. for (var i = 0; i < this.iterations; i++) {
  64883. var th_n_re = th_re;
  64884. var th_n_im = th_im;
  64885. var th_n_re1;
  64886. var th_n_im1;
  64887. var num_re = z_re;
  64888. var num_im = z_im;
  64889. for (n = 2; n <= 6; n++) {
  64890. th_n_re1 = th_n_re * th_re - th_n_im * th_im;
  64891. th_n_im1 = th_n_im * th_re + th_n_re * th_im;
  64892. th_n_re = th_n_re1;
  64893. th_n_im = th_n_im1;
  64894. num_re = num_re + (n - 1) * (this.B_re[n] * th_n_re - this.B_im[n] * th_n_im);
  64895. num_im = num_im + (n - 1) * (this.B_im[n] * th_n_re + this.B_re[n] * th_n_im);
  64896. }
  64897. th_n_re = 1;
  64898. th_n_im = 0;
  64899. var den_re = this.B_re[1];
  64900. var den_im = this.B_im[1];
  64901. for (n = 2; n <= 6; n++) {
  64902. th_n_re1 = th_n_re * th_re - th_n_im * th_im;
  64903. th_n_im1 = th_n_im * th_re + th_n_re * th_im;
  64904. th_n_re = th_n_re1;
  64905. th_n_im = th_n_im1;
  64906. den_re = den_re + n * (this.B_re[n] * th_n_re - this.B_im[n] * th_n_im);
  64907. den_im = den_im + n * (this.B_im[n] * th_n_re + this.B_re[n] * th_n_im);
  64908. }
  64909. // Complex division
  64910. var den2 = den_re * den_re + den_im * den_im;
  64911. th_re = (num_re * den_re + num_im * den_im) / den2;
  64912. th_im = (num_im * den_re - num_re * den_im) / den2;
  64913. }
  64914. // 3. Calculate d_phi ... // and d_lambda
  64915. var d_psi = th_re;
  64916. var d_lambda = th_im;
  64917. var d_psi_n = 1; // d_psi^0
  64918. var d_phi = 0;
  64919. for (n = 1; n <= 9; n++) {
  64920. d_psi_n = d_psi_n * d_psi;
  64921. d_phi = d_phi + this.D[n] * d_psi_n;
  64922. }
  64923. // 4. Calculate latitude and longitude
  64924. // d_phi is calcuated in second of arc * 10^-5, so we need to scale back to radians. d_lambda is in radians.
  64925. var lat = this.lat0 + (d_phi * SEC_TO_RAD * 1E5);
  64926. var lon = this.long0 + d_lambda;
  64927. p.x = lon;
  64928. p.y = lat;
  64929. return p;
  64930. }
  64931. var nzmg_names = ["New_Zealand_Map_Grid", "nzmg"];
  64932. /* harmony default export */ const nzmg = ({
  64933. init: nzmg_init,
  64934. forward: nzmg_forward,
  64935. inverse: nzmg_inverse,
  64936. names: nzmg_names
  64937. });
  64938. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/mill.js
  64939. /*
  64940. reference
  64941. "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder,
  64942. The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355.
  64943. */
  64944. /* Initialize the Miller Cylindrical projection
  64945. -------------------------------------------*/
  64946. function mill_init() {
  64947. //no-op
  64948. }
  64949. /* Miller Cylindrical forward equations--mapping lat,long to x,y
  64950. ------------------------------------------------------------*/
  64951. function mill_forward(p) {
  64952. var lon = p.x;
  64953. var lat = p.y;
  64954. /* Forward equations
  64955. -----------------*/
  64956. var dlon = adjust_lon(lon - this.long0);
  64957. var x = this.x0 + this.a * dlon;
  64958. var y = this.y0 + this.a * Math.log(Math.tan((Math.PI / 4) + (lat / 2.5))) * 1.25;
  64959. p.x = x;
  64960. p.y = y;
  64961. return p;
  64962. }
  64963. /* Miller Cylindrical inverse equations--mapping x,y to lat/long
  64964. ------------------------------------------------------------*/
  64965. function mill_inverse(p) {
  64966. p.x -= this.x0;
  64967. p.y -= this.y0;
  64968. var lon = adjust_lon(this.long0 + p.x / this.a);
  64969. var lat = 2.5 * (Math.atan(Math.exp(0.8 * p.y / this.a)) - Math.PI / 4);
  64970. p.x = lon;
  64971. p.y = lat;
  64972. return p;
  64973. }
  64974. var mill_names = ["Miller_Cylindrical", "mill"];
  64975. /* harmony default export */ const mill = ({
  64976. init: mill_init,
  64977. forward: mill_forward,
  64978. inverse: mill_inverse,
  64979. names: mill_names
  64980. });
  64981. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/sinu.js
  64982. var sinu_MAX_ITER = 20;
  64983. function sinu_init() {
  64984. /* Place parameters in static storage for common use
  64985. -------------------------------------------------*/
  64986. if (!this.sphere) {
  64987. this.en = pj_enfn(this.es);
  64988. }
  64989. else {
  64990. this.n = 1;
  64991. this.m = 0;
  64992. this.es = 0;
  64993. this.C_y = Math.sqrt((this.m + 1) / this.n);
  64994. this.C_x = this.C_y / (this.m + 1);
  64995. }
  64996. }
  64997. /* Sinusoidal forward equations--mapping lat,long to x,y
  64998. -----------------------------------------------------*/
  64999. function sinu_forward(p) {
  65000. var x, y;
  65001. var lon = p.x;
  65002. var lat = p.y;
  65003. /* Forward equations
  65004. -----------------*/
  65005. lon = adjust_lon(lon - this.long0);
  65006. if (this.sphere) {
  65007. if (!this.m) {
  65008. lat = this.n !== 1 ? Math.asin(this.n * Math.sin(lat)) : lat;
  65009. }
  65010. else {
  65011. var k = this.n * Math.sin(lat);
  65012. for (var i = sinu_MAX_ITER; i; --i) {
  65013. var V = (this.m * lat + Math.sin(lat) - k) / (this.m + Math.cos(lat));
  65014. lat -= V;
  65015. if (Math.abs(V) < EPSLN) {
  65016. break;
  65017. }
  65018. }
  65019. }
  65020. x = this.a * this.C_x * lon * (this.m + Math.cos(lat));
  65021. y = this.a * this.C_y * lat;
  65022. }
  65023. else {
  65024. var s = Math.sin(lat);
  65025. var c = Math.cos(lat);
  65026. y = this.a * pj_mlfn(lat, s, c, this.en);
  65027. x = this.a * lon * c / Math.sqrt(1 - this.es * s * s);
  65028. }
  65029. p.x = x;
  65030. p.y = y;
  65031. return p;
  65032. }
  65033. function sinu_inverse(p) {
  65034. var lat, temp, lon, s;
  65035. p.x -= this.x0;
  65036. lon = p.x / this.a;
  65037. p.y -= this.y0;
  65038. lat = p.y / this.a;
  65039. if (this.sphere) {
  65040. lat /= this.C_y;
  65041. lon = lon / (this.C_x * (this.m + Math.cos(lat)));
  65042. if (this.m) {
  65043. lat = asinz((this.m * lat + Math.sin(lat)) / this.n);
  65044. }
  65045. else if (this.n !== 1) {
  65046. lat = asinz(Math.sin(lat) / this.n);
  65047. }
  65048. lon = adjust_lon(lon + this.long0);
  65049. lat = adjust_lat(lat);
  65050. }
  65051. else {
  65052. lat = pj_inv_mlfn(p.y / this.a, this.es, this.en);
  65053. s = Math.abs(lat);
  65054. if (s < HALF_PI) {
  65055. s = Math.sin(lat);
  65056. temp = this.long0 + p.x * Math.sqrt(1 - this.es * s * s) / (this.a * Math.cos(lat));
  65057. //temp = this.long0 + p.x / (this.a * Math.cos(lat));
  65058. lon = adjust_lon(temp);
  65059. }
  65060. else if ((s - EPSLN) < HALF_PI) {
  65061. lon = this.long0;
  65062. }
  65063. }
  65064. p.x = lon;
  65065. p.y = lat;
  65066. return p;
  65067. }
  65068. var sinu_names = ["Sinusoidal", "sinu"];
  65069. /* harmony default export */ const sinu = ({
  65070. init: sinu_init,
  65071. forward: sinu_forward,
  65072. inverse: sinu_inverse,
  65073. names: sinu_names
  65074. });
  65075. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/moll.js
  65076. function moll_init() {}
  65077. /* Mollweide forward equations--mapping lat,long to x,y
  65078. ----------------------------------------------------*/
  65079. function moll_forward(p) {
  65080. /* Forward equations
  65081. -----------------*/
  65082. var lon = p.x;
  65083. var lat = p.y;
  65084. var delta_lon = adjust_lon(lon - this.long0);
  65085. var theta = lat;
  65086. var con = Math.PI * Math.sin(lat);
  65087. /* Iterate using the Newton-Raphson method to find theta
  65088. -----------------------------------------------------*/
  65089. while (true) {
  65090. var delta_theta = -(theta + Math.sin(theta) - con) / (1 + Math.cos(theta));
  65091. theta += delta_theta;
  65092. if (Math.abs(delta_theta) < EPSLN) {
  65093. break;
  65094. }
  65095. }
  65096. theta /= 2;
  65097. /* If the latitude is 90 deg, force the x coordinate to be "0 + false easting"
  65098. this is done here because of precision problems with "cos(theta)"
  65099. --------------------------------------------------------------------------*/
  65100. if (Math.PI / 2 - Math.abs(lat) < EPSLN) {
  65101. delta_lon = 0;
  65102. }
  65103. var x = 0.900316316158 * this.a * delta_lon * Math.cos(theta) + this.x0;
  65104. var y = 1.4142135623731 * this.a * Math.sin(theta) + this.y0;
  65105. p.x = x;
  65106. p.y = y;
  65107. return p;
  65108. }
  65109. function moll_inverse(p) {
  65110. var theta;
  65111. var arg;
  65112. /* Inverse equations
  65113. -----------------*/
  65114. p.x -= this.x0;
  65115. p.y -= this.y0;
  65116. arg = p.y / (1.4142135623731 * this.a);
  65117. /* Because of division by zero problems, 'arg' can not be 1. Therefore
  65118. a number very close to one is used instead.
  65119. -------------------------------------------------------------------*/
  65120. if (Math.abs(arg) > 0.999999999999) {
  65121. arg = 0.999999999999;
  65122. }
  65123. theta = Math.asin(arg);
  65124. var lon = adjust_lon(this.long0 + (p.x / (0.900316316158 * this.a * Math.cos(theta))));
  65125. if (lon < (-Math.PI)) {
  65126. lon = -Math.PI;
  65127. }
  65128. if (lon > Math.PI) {
  65129. lon = Math.PI;
  65130. }
  65131. arg = (2 * theta + Math.sin(2 * theta)) / Math.PI;
  65132. if (Math.abs(arg) > 1) {
  65133. arg = 1;
  65134. }
  65135. var lat = Math.asin(arg);
  65136. p.x = lon;
  65137. p.y = lat;
  65138. return p;
  65139. }
  65140. var moll_names = ["Mollweide", "moll"];
  65141. /* harmony default export */ const moll = ({
  65142. init: moll_init,
  65143. forward: moll_forward,
  65144. inverse: moll_inverse,
  65145. names: moll_names
  65146. });
  65147. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/eqdc.js
  65148. function eqdc_init() {
  65149. /* Place parameters in static storage for common use
  65150. -------------------------------------------------*/
  65151. // Standard Parallels cannot be equal and on opposite sides of the equator
  65152. if (Math.abs(this.lat1 + this.lat2) < EPSLN) {
  65153. return;
  65154. }
  65155. this.lat2 = this.lat2 || this.lat1;
  65156. this.temp = this.b / this.a;
  65157. this.es = 1 - Math.pow(this.temp, 2);
  65158. this.e = Math.sqrt(this.es);
  65159. this.e0 = e0fn(this.es);
  65160. this.e1 = e1fn(this.es);
  65161. this.e2 = e2fn(this.es);
  65162. this.e3 = e3fn(this.es);
  65163. this.sinphi = Math.sin(this.lat1);
  65164. this.cosphi = Math.cos(this.lat1);
  65165. this.ms1 = msfnz(this.e, this.sinphi, this.cosphi);
  65166. this.ml1 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat1);
  65167. if (Math.abs(this.lat1 - this.lat2) < EPSLN) {
  65168. this.ns = this.sinphi;
  65169. }
  65170. else {
  65171. this.sinphi = Math.sin(this.lat2);
  65172. this.cosphi = Math.cos(this.lat2);
  65173. this.ms2 = msfnz(this.e, this.sinphi, this.cosphi);
  65174. this.ml2 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat2);
  65175. this.ns = (this.ms1 - this.ms2) / (this.ml2 - this.ml1);
  65176. }
  65177. this.g = this.ml1 + this.ms1 / this.ns;
  65178. this.ml0 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0);
  65179. this.rh = this.a * (this.g - this.ml0);
  65180. }
  65181. /* Equidistant Conic forward equations--mapping lat,long to x,y
  65182. -----------------------------------------------------------*/
  65183. function eqdc_forward(p) {
  65184. var lon = p.x;
  65185. var lat = p.y;
  65186. var rh1;
  65187. /* Forward equations
  65188. -----------------*/
  65189. if (this.sphere) {
  65190. rh1 = this.a * (this.g - lat);
  65191. }
  65192. else {
  65193. var ml = mlfn(this.e0, this.e1, this.e2, this.e3, lat);
  65194. rh1 = this.a * (this.g - ml);
  65195. }
  65196. var theta = this.ns * adjust_lon(lon - this.long0);
  65197. var x = this.x0 + rh1 * Math.sin(theta);
  65198. var y = this.y0 + this.rh - rh1 * Math.cos(theta);
  65199. p.x = x;
  65200. p.y = y;
  65201. return p;
  65202. }
  65203. /* Inverse equations
  65204. -----------------*/
  65205. function eqdc_inverse(p) {
  65206. p.x -= this.x0;
  65207. p.y = this.rh - p.y + this.y0;
  65208. var con, rh1, lat, lon;
  65209. if (this.ns >= 0) {
  65210. rh1 = Math.sqrt(p.x * p.x + p.y * p.y);
  65211. con = 1;
  65212. }
  65213. else {
  65214. rh1 = -Math.sqrt(p.x * p.x + p.y * p.y);
  65215. con = -1;
  65216. }
  65217. var theta = 0;
  65218. if (rh1 !== 0) {
  65219. theta = Math.atan2(con * p.x, con * p.y);
  65220. }
  65221. if (this.sphere) {
  65222. lon = adjust_lon(this.long0 + theta / this.ns);
  65223. lat = adjust_lat(this.g - rh1 / this.a);
  65224. p.x = lon;
  65225. p.y = lat;
  65226. return p;
  65227. }
  65228. else {
  65229. var ml = this.g - rh1 / this.a;
  65230. lat = imlfn(ml, this.e0, this.e1, this.e2, this.e3);
  65231. lon = adjust_lon(this.long0 + theta / this.ns);
  65232. p.x = lon;
  65233. p.y = lat;
  65234. return p;
  65235. }
  65236. }
  65237. var eqdc_names = ["Equidistant_Conic", "eqdc"];
  65238. /* harmony default export */ const eqdc = ({
  65239. init: eqdc_init,
  65240. forward: eqdc_forward,
  65241. inverse: eqdc_inverse,
  65242. names: eqdc_names
  65243. });
  65244. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/vandg.js
  65245. /* Initialize the Van Der Grinten projection
  65246. ----------------------------------------*/
  65247. function vandg_init() {
  65248. //this.R = 6370997; //Radius of earth
  65249. this.R = this.a;
  65250. }
  65251. function vandg_forward(p) {
  65252. var lon = p.x;
  65253. var lat = p.y;
  65254. /* Forward equations
  65255. -----------------*/
  65256. var dlon = adjust_lon(lon - this.long0);
  65257. var x, y;
  65258. if (Math.abs(lat) <= EPSLN) {
  65259. x = this.x0 + this.R * dlon;
  65260. y = this.y0;
  65261. }
  65262. var theta = asinz(2 * Math.abs(lat / Math.PI));
  65263. if ((Math.abs(dlon) <= EPSLN) || (Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN)) {
  65264. x = this.x0;
  65265. if (lat >= 0) {
  65266. y = this.y0 + Math.PI * this.R * Math.tan(0.5 * theta);
  65267. }
  65268. else {
  65269. y = this.y0 + Math.PI * this.R * -Math.tan(0.5 * theta);
  65270. }
  65271. // return(OK);
  65272. }
  65273. var al = 0.5 * Math.abs((Math.PI / dlon) - (dlon / Math.PI));
  65274. var asq = al * al;
  65275. var sinth = Math.sin(theta);
  65276. var costh = Math.cos(theta);
  65277. var g = costh / (sinth + costh - 1);
  65278. var gsq = g * g;
  65279. var m = g * (2 / sinth - 1);
  65280. var msq = m * m;
  65281. var con = Math.PI * this.R * (al * (g - msq) + Math.sqrt(asq * (g - msq) * (g - msq) - (msq + asq) * (gsq - msq))) / (msq + asq);
  65282. if (dlon < 0) {
  65283. con = -con;
  65284. }
  65285. x = this.x0 + con;
  65286. //con = Math.abs(con / (Math.PI * this.R));
  65287. var q = asq + g;
  65288. con = Math.PI * this.R * (m * q - al * Math.sqrt((msq + asq) * (asq + 1) - q * q)) / (msq + asq);
  65289. if (lat >= 0) {
  65290. //y = this.y0 + Math.PI * this.R * Math.sqrt(1 - con * con - 2 * al * con);
  65291. y = this.y0 + con;
  65292. }
  65293. else {
  65294. //y = this.y0 - Math.PI * this.R * Math.sqrt(1 - con * con - 2 * al * con);
  65295. y = this.y0 - con;
  65296. }
  65297. p.x = x;
  65298. p.y = y;
  65299. return p;
  65300. }
  65301. /* Van Der Grinten inverse equations--mapping x,y to lat/long
  65302. ---------------------------------------------------------*/
  65303. function vandg_inverse(p) {
  65304. var lon, lat;
  65305. var xx, yy, xys, c1, c2, c3;
  65306. var a1;
  65307. var m1;
  65308. var con;
  65309. var th1;
  65310. var d;
  65311. /* inverse equations
  65312. -----------------*/
  65313. p.x -= this.x0;
  65314. p.y -= this.y0;
  65315. con = Math.PI * this.R;
  65316. xx = p.x / con;
  65317. yy = p.y / con;
  65318. xys = xx * xx + yy * yy;
  65319. c1 = -Math.abs(yy) * (1 + xys);
  65320. c2 = c1 - 2 * yy * yy + xx * xx;
  65321. c3 = -2 * c1 + 1 + 2 * yy * yy + xys * xys;
  65322. d = yy * yy / c3 + (2 * c2 * c2 * c2 / c3 / c3 / c3 - 9 * c1 * c2 / c3 / c3) / 27;
  65323. a1 = (c1 - c2 * c2 / 3 / c3) / c3;
  65324. m1 = 2 * Math.sqrt(-a1 / 3);
  65325. con = ((3 * d) / a1) / m1;
  65326. if (Math.abs(con) > 1) {
  65327. if (con >= 0) {
  65328. con = 1;
  65329. }
  65330. else {
  65331. con = -1;
  65332. }
  65333. }
  65334. th1 = Math.acos(con) / 3;
  65335. if (p.y >= 0) {
  65336. lat = (-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;
  65337. }
  65338. else {
  65339. lat = -(-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;
  65340. }
  65341. if (Math.abs(xx) < EPSLN) {
  65342. lon = this.long0;
  65343. }
  65344. else {
  65345. lon = adjust_lon(this.long0 + Math.PI * (xys - 1 + Math.sqrt(1 + 2 * (xx * xx - yy * yy) + xys * xys)) / 2 / xx);
  65346. }
  65347. p.x = lon;
  65348. p.y = lat;
  65349. return p;
  65350. }
  65351. var vandg_names = ["Van_der_Grinten_I", "VanDerGrinten", "vandg"];
  65352. /* harmony default export */ const vandg = ({
  65353. init: vandg_init,
  65354. forward: vandg_forward,
  65355. inverse: vandg_inverse,
  65356. names: vandg_names
  65357. });
  65358. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/aeqd.js
  65359. function aeqd_init() {
  65360. this.sin_p12 = Math.sin(this.lat0);
  65361. this.cos_p12 = Math.cos(this.lat0);
  65362. }
  65363. function aeqd_forward(p) {
  65364. var lon = p.x;
  65365. var lat = p.y;
  65366. var sinphi = Math.sin(p.y);
  65367. var cosphi = Math.cos(p.y);
  65368. var dlon = adjust_lon(lon - this.long0);
  65369. var e0, e1, e2, e3, Mlp, Ml, tanphi, Nl1, Nl, psi, Az, G, H, GH, Hs, c, kp, cos_c, s, s2, s3, s4, s5;
  65370. if (this.sphere) {
  65371. if (Math.abs(this.sin_p12 - 1) <= EPSLN) {
  65372. //North Pole case
  65373. p.x = this.x0 + this.a * (HALF_PI - lat) * Math.sin(dlon);
  65374. p.y = this.y0 - this.a * (HALF_PI - lat) * Math.cos(dlon);
  65375. return p;
  65376. }
  65377. else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {
  65378. //South Pole case
  65379. p.x = this.x0 + this.a * (HALF_PI + lat) * Math.sin(dlon);
  65380. p.y = this.y0 + this.a * (HALF_PI + lat) * Math.cos(dlon);
  65381. return p;
  65382. }
  65383. else {
  65384. //default case
  65385. cos_c = this.sin_p12 * sinphi + this.cos_p12 * cosphi * Math.cos(dlon);
  65386. c = Math.acos(cos_c);
  65387. kp = c ? c / Math.sin(c) : 1;
  65388. p.x = this.x0 + this.a * kp * cosphi * Math.sin(dlon);
  65389. p.y = this.y0 + this.a * kp * (this.cos_p12 * sinphi - this.sin_p12 * cosphi * Math.cos(dlon));
  65390. return p;
  65391. }
  65392. }
  65393. else {
  65394. e0 = e0fn(this.es);
  65395. e1 = e1fn(this.es);
  65396. e2 = e2fn(this.es);
  65397. e3 = e3fn(this.es);
  65398. if (Math.abs(this.sin_p12 - 1) <= EPSLN) {
  65399. //North Pole case
  65400. Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);
  65401. Ml = this.a * mlfn(e0, e1, e2, e3, lat);
  65402. p.x = this.x0 + (Mlp - Ml) * Math.sin(dlon);
  65403. p.y = this.y0 - (Mlp - Ml) * Math.cos(dlon);
  65404. return p;
  65405. }
  65406. else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {
  65407. //South Pole case
  65408. Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);
  65409. Ml = this.a * mlfn(e0, e1, e2, e3, lat);
  65410. p.x = this.x0 + (Mlp + Ml) * Math.sin(dlon);
  65411. p.y = this.y0 + (Mlp + Ml) * Math.cos(dlon);
  65412. return p;
  65413. }
  65414. else {
  65415. //Default case
  65416. tanphi = sinphi / cosphi;
  65417. Nl1 = gN(this.a, this.e, this.sin_p12);
  65418. Nl = gN(this.a, this.e, sinphi);
  65419. psi = Math.atan((1 - this.es) * tanphi + this.es * Nl1 * this.sin_p12 / (Nl * cosphi));
  65420. Az = Math.atan2(Math.sin(dlon), this.cos_p12 * Math.tan(psi) - this.sin_p12 * Math.cos(dlon));
  65421. if (Az === 0) {
  65422. s = Math.asin(this.cos_p12 * Math.sin(psi) - this.sin_p12 * Math.cos(psi));
  65423. }
  65424. else if (Math.abs(Math.abs(Az) - Math.PI) <= EPSLN) {
  65425. s = -Math.asin(this.cos_p12 * Math.sin(psi) - this.sin_p12 * Math.cos(psi));
  65426. }
  65427. else {
  65428. s = Math.asin(Math.sin(dlon) * Math.cos(psi) / Math.sin(Az));
  65429. }
  65430. G = this.e * this.sin_p12 / Math.sqrt(1 - this.es);
  65431. H = this.e * this.cos_p12 * Math.cos(Az) / Math.sqrt(1 - this.es);
  65432. GH = G * H;
  65433. Hs = H * H;
  65434. s2 = s * s;
  65435. s3 = s2 * s;
  65436. s4 = s3 * s;
  65437. s5 = s4 * s;
  65438. c = Nl1 * s * (1 - s2 * Hs * (1 - Hs) / 6 + s3 / 8 * GH * (1 - 2 * Hs) + s4 / 120 * (Hs * (4 - 7 * Hs) - 3 * G * G * (1 - 7 * Hs)) - s5 / 48 * GH);
  65439. p.x = this.x0 + c * Math.sin(Az);
  65440. p.y = this.y0 + c * Math.cos(Az);
  65441. return p;
  65442. }
  65443. }
  65444. }
  65445. function aeqd_inverse(p) {
  65446. p.x -= this.x0;
  65447. p.y -= this.y0;
  65448. var rh, z, sinz, cosz, lon, lat, con, e0, e1, e2, e3, Mlp, M, N1, psi, Az, cosAz, tmp, A, B, D, Ee, F, sinpsi;
  65449. if (this.sphere) {
  65450. rh = Math.sqrt(p.x * p.x + p.y * p.y);
  65451. if (rh > (2 * HALF_PI * this.a)) {
  65452. return;
  65453. }
  65454. z = rh / this.a;
  65455. sinz = Math.sin(z);
  65456. cosz = Math.cos(z);
  65457. lon = this.long0;
  65458. if (Math.abs(rh) <= EPSLN) {
  65459. lat = this.lat0;
  65460. }
  65461. else {
  65462. lat = asinz(cosz * this.sin_p12 + (p.y * sinz * this.cos_p12) / rh);
  65463. con = Math.abs(this.lat0) - HALF_PI;
  65464. if (Math.abs(con) <= EPSLN) {
  65465. if (this.lat0 >= 0) {
  65466. lon = adjust_lon(this.long0 + Math.atan2(p.x, - p.y));
  65467. }
  65468. else {
  65469. lon = adjust_lon(this.long0 - Math.atan2(-p.x, p.y));
  65470. }
  65471. }
  65472. else {
  65473. /*con = cosz - this.sin_p12 * Math.sin(lat);
  65474. if ((Math.abs(con) < EPSLN) && (Math.abs(p.x) < EPSLN)) {
  65475. //no-op, just keep the lon value as is
  65476. } else {
  65477. var temp = Math.atan2((p.x * sinz * this.cos_p12), (con * rh));
  65478. lon = adjust_lon(this.long0 + Math.atan2((p.x * sinz * this.cos_p12), (con * rh)));
  65479. }*/
  65480. lon = adjust_lon(this.long0 + Math.atan2(p.x * sinz, rh * this.cos_p12 * cosz - p.y * this.sin_p12 * sinz));
  65481. }
  65482. }
  65483. p.x = lon;
  65484. p.y = lat;
  65485. return p;
  65486. }
  65487. else {
  65488. e0 = e0fn(this.es);
  65489. e1 = e1fn(this.es);
  65490. e2 = e2fn(this.es);
  65491. e3 = e3fn(this.es);
  65492. if (Math.abs(this.sin_p12 - 1) <= EPSLN) {
  65493. //North pole case
  65494. Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);
  65495. rh = Math.sqrt(p.x * p.x + p.y * p.y);
  65496. M = Mlp - rh;
  65497. lat = imlfn(M / this.a, e0, e1, e2, e3);
  65498. lon = adjust_lon(this.long0 + Math.atan2(p.x, - 1 * p.y));
  65499. p.x = lon;
  65500. p.y = lat;
  65501. return p;
  65502. }
  65503. else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {
  65504. //South pole case
  65505. Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);
  65506. rh = Math.sqrt(p.x * p.x + p.y * p.y);
  65507. M = rh - Mlp;
  65508. lat = imlfn(M / this.a, e0, e1, e2, e3);
  65509. lon = adjust_lon(this.long0 + Math.atan2(p.x, p.y));
  65510. p.x = lon;
  65511. p.y = lat;
  65512. return p;
  65513. }
  65514. else {
  65515. //default case
  65516. rh = Math.sqrt(p.x * p.x + p.y * p.y);
  65517. Az = Math.atan2(p.x, p.y);
  65518. N1 = gN(this.a, this.e, this.sin_p12);
  65519. cosAz = Math.cos(Az);
  65520. tmp = this.e * this.cos_p12 * cosAz;
  65521. A = -tmp * tmp / (1 - this.es);
  65522. B = 3 * this.es * (1 - A) * this.sin_p12 * this.cos_p12 * cosAz / (1 - this.es);
  65523. D = rh / N1;
  65524. Ee = D - A * (1 + A) * Math.pow(D, 3) / 6 - B * (1 + 3 * A) * Math.pow(D, 4) / 24;
  65525. F = 1 - A * Ee * Ee / 2 - D * Ee * Ee * Ee / 6;
  65526. psi = Math.asin(this.sin_p12 * Math.cos(Ee) + this.cos_p12 * Math.sin(Ee) * cosAz);
  65527. lon = adjust_lon(this.long0 + Math.asin(Math.sin(Az) * Math.sin(Ee) / Math.cos(psi)));
  65528. sinpsi = Math.sin(psi);
  65529. lat = Math.atan2((sinpsi - this.es * F * this.sin_p12) * Math.tan(psi), sinpsi * (1 - this.es));
  65530. p.x = lon;
  65531. p.y = lat;
  65532. return p;
  65533. }
  65534. }
  65535. }
  65536. var aeqd_names = ["Azimuthal_Equidistant", "aeqd"];
  65537. /* harmony default export */ const aeqd = ({
  65538. init: aeqd_init,
  65539. forward: aeqd_forward,
  65540. inverse: aeqd_inverse,
  65541. names: aeqd_names
  65542. });
  65543. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/ortho.js
  65544. function ortho_init() {
  65545. //double temp; /* temporary variable */
  65546. /* Place parameters in static storage for common use
  65547. -------------------------------------------------*/
  65548. this.sin_p14 = Math.sin(this.lat0);
  65549. this.cos_p14 = Math.cos(this.lat0);
  65550. }
  65551. /* Orthographic forward equations--mapping lat,long to x,y
  65552. ---------------------------------------------------*/
  65553. function ortho_forward(p) {
  65554. var sinphi, cosphi; /* sin and cos value */
  65555. var dlon; /* delta longitude value */
  65556. var coslon; /* cos of longitude */
  65557. var ksp; /* scale factor */
  65558. var g, x, y;
  65559. var lon = p.x;
  65560. var lat = p.y;
  65561. /* Forward equations
  65562. -----------------*/
  65563. dlon = adjust_lon(lon - this.long0);
  65564. sinphi = Math.sin(lat);
  65565. cosphi = Math.cos(lat);
  65566. coslon = Math.cos(dlon);
  65567. g = this.sin_p14 * sinphi + this.cos_p14 * cosphi * coslon;
  65568. ksp = 1;
  65569. if ((g > 0) || (Math.abs(g) <= EPSLN)) {
  65570. x = this.a * ksp * cosphi * Math.sin(dlon);
  65571. y = this.y0 + this.a * ksp * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon);
  65572. }
  65573. p.x = x;
  65574. p.y = y;
  65575. return p;
  65576. }
  65577. function ortho_inverse(p) {
  65578. var rh; /* height above ellipsoid */
  65579. var z; /* angle */
  65580. var sinz, cosz; /* sin of z and cos of z */
  65581. var con;
  65582. var lon, lat;
  65583. /* Inverse equations
  65584. -----------------*/
  65585. p.x -= this.x0;
  65586. p.y -= this.y0;
  65587. rh = Math.sqrt(p.x * p.x + p.y * p.y);
  65588. z = asinz(rh / this.a);
  65589. sinz = Math.sin(z);
  65590. cosz = Math.cos(z);
  65591. lon = this.long0;
  65592. if (Math.abs(rh) <= EPSLN) {
  65593. lat = this.lat0;
  65594. p.x = lon;
  65595. p.y = lat;
  65596. return p;
  65597. }
  65598. lat = asinz(cosz * this.sin_p14 + (p.y * sinz * this.cos_p14) / rh);
  65599. con = Math.abs(this.lat0) - HALF_PI;
  65600. if (Math.abs(con) <= EPSLN) {
  65601. if (this.lat0 >= 0) {
  65602. lon = adjust_lon(this.long0 + Math.atan2(p.x, - p.y));
  65603. }
  65604. else {
  65605. lon = adjust_lon(this.long0 - Math.atan2(-p.x, p.y));
  65606. }
  65607. p.x = lon;
  65608. p.y = lat;
  65609. return p;
  65610. }
  65611. lon = adjust_lon(this.long0 + Math.atan2((p.x * sinz), rh * this.cos_p14 * cosz - p.y * this.sin_p14 * sinz));
  65612. p.x = lon;
  65613. p.y = lat;
  65614. return p;
  65615. }
  65616. var ortho_names = ["ortho"];
  65617. /* harmony default export */ const ortho = ({
  65618. init: ortho_init,
  65619. forward: ortho_forward,
  65620. inverse: ortho_inverse,
  65621. names: ortho_names
  65622. });
  65623. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/qsc.js
  65624. // QSC projection rewritten from the original PROJ4
  65625. // https://github.com/OSGeo/proj.4/blob/master/src/PJ_qsc.c
  65626. /* constants */
  65627. var FACE_ENUM = {
  65628. FRONT: 1,
  65629. RIGHT: 2,
  65630. BACK: 3,
  65631. LEFT: 4,
  65632. TOP: 5,
  65633. BOTTOM: 6
  65634. };
  65635. var AREA_ENUM = {
  65636. AREA_0: 1,
  65637. AREA_1: 2,
  65638. AREA_2: 3,
  65639. AREA_3: 4
  65640. };
  65641. function qsc_init() {
  65642. this.x0 = this.x0 || 0;
  65643. this.y0 = this.y0 || 0;
  65644. this.lat0 = this.lat0 || 0;
  65645. this.long0 = this.long0 || 0;
  65646. this.lat_ts = this.lat_ts || 0;
  65647. this.title = this.title || "Quadrilateralized Spherical Cube";
  65648. /* Determine the cube face from the center of projection. */
  65649. if (this.lat0 >= HALF_PI - FORTPI / 2.0) {
  65650. this.face = FACE_ENUM.TOP;
  65651. } else if (this.lat0 <= -(HALF_PI - FORTPI / 2.0)) {
  65652. this.face = FACE_ENUM.BOTTOM;
  65653. } else if (Math.abs(this.long0) <= FORTPI) {
  65654. this.face = FACE_ENUM.FRONT;
  65655. } else if (Math.abs(this.long0) <= HALF_PI + FORTPI) {
  65656. this.face = this.long0 > 0.0 ? FACE_ENUM.RIGHT : FACE_ENUM.LEFT;
  65657. } else {
  65658. this.face = FACE_ENUM.BACK;
  65659. }
  65660. /* Fill in useful values for the ellipsoid <-> sphere shift
  65661. * described in [LK12]. */
  65662. if (this.es !== 0) {
  65663. this.one_minus_f = 1 - (this.a - this.b) / this.a;
  65664. this.one_minus_f_squared = this.one_minus_f * this.one_minus_f;
  65665. }
  65666. }
  65667. // QSC forward equations--mapping lat,long to x,y
  65668. // -----------------------------------------------------------------
  65669. function qsc_forward(p) {
  65670. var xy = {x: 0, y: 0};
  65671. var lat, lon;
  65672. var theta, phi;
  65673. var t, mu;
  65674. /* nu; */
  65675. var area = {value: 0};
  65676. // move lon according to projection's lon
  65677. p.x -= this.long0;
  65678. /* Convert the geodetic latitude to a geocentric latitude.
  65679. * This corresponds to the shift from the ellipsoid to the sphere
  65680. * described in [LK12]. */
  65681. if (this.es !== 0) {//if (P->es != 0) {
  65682. lat = Math.atan(this.one_minus_f_squared * Math.tan(p.y));
  65683. } else {
  65684. lat = p.y;
  65685. }
  65686. /* Convert the input lat, lon into theta, phi as used by QSC.
  65687. * This depends on the cube face and the area on it.
  65688. * For the top and bottom face, we can compute theta and phi
  65689. * directly from phi, lam. For the other faces, we must use
  65690. * unit sphere cartesian coordinates as an intermediate step. */
  65691. lon = p.x; //lon = lp.lam;
  65692. if (this.face === FACE_ENUM.TOP) {
  65693. phi = HALF_PI - lat;
  65694. if (lon >= FORTPI && lon <= HALF_PI + FORTPI) {
  65695. area.value = AREA_ENUM.AREA_0;
  65696. theta = lon - HALF_PI;
  65697. } else if (lon > HALF_PI + FORTPI || lon <= -(HALF_PI + FORTPI)) {
  65698. area.value = AREA_ENUM.AREA_1;
  65699. theta = (lon > 0.0 ? lon - SPI : lon + SPI);
  65700. } else if (lon > -(HALF_PI + FORTPI) && lon <= -FORTPI) {
  65701. area.value = AREA_ENUM.AREA_2;
  65702. theta = lon + HALF_PI;
  65703. } else {
  65704. area.value = AREA_ENUM.AREA_3;
  65705. theta = lon;
  65706. }
  65707. } else if (this.face === FACE_ENUM.BOTTOM) {
  65708. phi = HALF_PI + lat;
  65709. if (lon >= FORTPI && lon <= HALF_PI + FORTPI) {
  65710. area.value = AREA_ENUM.AREA_0;
  65711. theta = -lon + HALF_PI;
  65712. } else if (lon < FORTPI && lon >= -FORTPI) {
  65713. area.value = AREA_ENUM.AREA_1;
  65714. theta = -lon;
  65715. } else if (lon < -FORTPI && lon >= -(HALF_PI + FORTPI)) {
  65716. area.value = AREA_ENUM.AREA_2;
  65717. theta = -lon - HALF_PI;
  65718. } else {
  65719. area.value = AREA_ENUM.AREA_3;
  65720. theta = (lon > 0.0 ? -lon + SPI : -lon - SPI);
  65721. }
  65722. } else {
  65723. var q, r, s;
  65724. var sinlat, coslat;
  65725. var sinlon, coslon;
  65726. if (this.face === FACE_ENUM.RIGHT) {
  65727. lon = qsc_shift_lon_origin(lon, +HALF_PI);
  65728. } else if (this.face === FACE_ENUM.BACK) {
  65729. lon = qsc_shift_lon_origin(lon, +SPI);
  65730. } else if (this.face === FACE_ENUM.LEFT) {
  65731. lon = qsc_shift_lon_origin(lon, -HALF_PI);
  65732. }
  65733. sinlat = Math.sin(lat);
  65734. coslat = Math.cos(lat);
  65735. sinlon = Math.sin(lon);
  65736. coslon = Math.cos(lon);
  65737. q = coslat * coslon;
  65738. r = coslat * sinlon;
  65739. s = sinlat;
  65740. if (this.face === FACE_ENUM.FRONT) {
  65741. phi = Math.acos(q);
  65742. theta = qsc_fwd_equat_face_theta(phi, s, r, area);
  65743. } else if (this.face === FACE_ENUM.RIGHT) {
  65744. phi = Math.acos(r);
  65745. theta = qsc_fwd_equat_face_theta(phi, s, -q, area);
  65746. } else if (this.face === FACE_ENUM.BACK) {
  65747. phi = Math.acos(-q);
  65748. theta = qsc_fwd_equat_face_theta(phi, s, -r, area);
  65749. } else if (this.face === FACE_ENUM.LEFT) {
  65750. phi = Math.acos(-r);
  65751. theta = qsc_fwd_equat_face_theta(phi, s, q, area);
  65752. } else {
  65753. /* Impossible */
  65754. phi = theta = 0;
  65755. area.value = AREA_ENUM.AREA_0;
  65756. }
  65757. }
  65758. /* Compute mu and nu for the area of definition.
  65759. * For mu, see Eq. (3-21) in [OL76], but note the typos:
  65760. * compare with Eq. (3-14). For nu, see Eq. (3-38). */
  65761. mu = Math.atan((12 / SPI) * (theta + Math.acos(Math.sin(theta) * Math.cos(FORTPI)) - HALF_PI));
  65762. t = Math.sqrt((1 - Math.cos(phi)) / (Math.cos(mu) * Math.cos(mu)) / (1 - Math.cos(Math.atan(1 / Math.cos(theta)))));
  65763. /* Apply the result to the real area. */
  65764. if (area.value === AREA_ENUM.AREA_1) {
  65765. mu += HALF_PI;
  65766. } else if (area.value === AREA_ENUM.AREA_2) {
  65767. mu += SPI;
  65768. } else if (area.value === AREA_ENUM.AREA_3) {
  65769. mu += 1.5 * SPI;
  65770. }
  65771. /* Now compute x, y from mu and nu */
  65772. xy.x = t * Math.cos(mu);
  65773. xy.y = t * Math.sin(mu);
  65774. xy.x = xy.x * this.a + this.x0;
  65775. xy.y = xy.y * this.a + this.y0;
  65776. p.x = xy.x;
  65777. p.y = xy.y;
  65778. return p;
  65779. }
  65780. // QSC inverse equations--mapping x,y to lat/long
  65781. // -----------------------------------------------------------------
  65782. function qsc_inverse(p) {
  65783. var lp = {lam: 0, phi: 0};
  65784. var mu, nu, cosmu, tannu;
  65785. var tantheta, theta, cosphi, phi;
  65786. var t;
  65787. var area = {value: 0};
  65788. /* de-offset */
  65789. p.x = (p.x - this.x0) / this.a;
  65790. p.y = (p.y - this.y0) / this.a;
  65791. /* Convert the input x, y to the mu and nu angles as used by QSC.
  65792. * This depends on the area of the cube face. */
  65793. nu = Math.atan(Math.sqrt(p.x * p.x + p.y * p.y));
  65794. mu = Math.atan2(p.y, p.x);
  65795. if (p.x >= 0.0 && p.x >= Math.abs(p.y)) {
  65796. area.value = AREA_ENUM.AREA_0;
  65797. } else if (p.y >= 0.0 && p.y >= Math.abs(p.x)) {
  65798. area.value = AREA_ENUM.AREA_1;
  65799. mu -= HALF_PI;
  65800. } else if (p.x < 0.0 && -p.x >= Math.abs(p.y)) {
  65801. area.value = AREA_ENUM.AREA_2;
  65802. mu = (mu < 0.0 ? mu + SPI : mu - SPI);
  65803. } else {
  65804. area.value = AREA_ENUM.AREA_3;
  65805. mu += HALF_PI;
  65806. }
  65807. /* Compute phi and theta for the area of definition.
  65808. * The inverse projection is not described in the original paper, but some
  65809. * good hints can be found here (as of 2011-12-14):
  65810. * http://fits.gsfc.nasa.gov/fitsbits/saf.93/saf.9302
  65811. * (search for "Message-Id: <9302181759.AA25477 at fits.cv.nrao.edu>") */
  65812. t = (SPI / 12) * Math.tan(mu);
  65813. tantheta = Math.sin(t) / (Math.cos(t) - (1 / Math.sqrt(2)));
  65814. theta = Math.atan(tantheta);
  65815. cosmu = Math.cos(mu);
  65816. tannu = Math.tan(nu);
  65817. cosphi = 1 - cosmu * cosmu * tannu * tannu * (1 - Math.cos(Math.atan(1 / Math.cos(theta))));
  65818. if (cosphi < -1) {
  65819. cosphi = -1;
  65820. } else if (cosphi > +1) {
  65821. cosphi = +1;
  65822. }
  65823. /* Apply the result to the real area on the cube face.
  65824. * For the top and bottom face, we can compute phi and lam directly.
  65825. * For the other faces, we must use unit sphere cartesian coordinates
  65826. * as an intermediate step. */
  65827. if (this.face === FACE_ENUM.TOP) {
  65828. phi = Math.acos(cosphi);
  65829. lp.phi = HALF_PI - phi;
  65830. if (area.value === AREA_ENUM.AREA_0) {
  65831. lp.lam = theta + HALF_PI;
  65832. } else if (area.value === AREA_ENUM.AREA_1) {
  65833. lp.lam = (theta < 0.0 ? theta + SPI : theta - SPI);
  65834. } else if (area.value === AREA_ENUM.AREA_2) {
  65835. lp.lam = theta - HALF_PI;
  65836. } else /* area.value == AREA_ENUM.AREA_3 */ {
  65837. lp.lam = theta;
  65838. }
  65839. } else if (this.face === FACE_ENUM.BOTTOM) {
  65840. phi = Math.acos(cosphi);
  65841. lp.phi = phi - HALF_PI;
  65842. if (area.value === AREA_ENUM.AREA_0) {
  65843. lp.lam = -theta + HALF_PI;
  65844. } else if (area.value === AREA_ENUM.AREA_1) {
  65845. lp.lam = -theta;
  65846. } else if (area.value === AREA_ENUM.AREA_2) {
  65847. lp.lam = -theta - HALF_PI;
  65848. } else /* area.value == AREA_ENUM.AREA_3 */ {
  65849. lp.lam = (theta < 0.0 ? -theta - SPI : -theta + SPI);
  65850. }
  65851. } else {
  65852. /* Compute phi and lam via cartesian unit sphere coordinates. */
  65853. var q, r, s;
  65854. q = cosphi;
  65855. t = q * q;
  65856. if (t >= 1) {
  65857. s = 0;
  65858. } else {
  65859. s = Math.sqrt(1 - t) * Math.sin(theta);
  65860. }
  65861. t += s * s;
  65862. if (t >= 1) {
  65863. r = 0;
  65864. } else {
  65865. r = Math.sqrt(1 - t);
  65866. }
  65867. /* Rotate q,r,s into the correct area. */
  65868. if (area.value === AREA_ENUM.AREA_1) {
  65869. t = r;
  65870. r = -s;
  65871. s = t;
  65872. } else if (area.value === AREA_ENUM.AREA_2) {
  65873. r = -r;
  65874. s = -s;
  65875. } else if (area.value === AREA_ENUM.AREA_3) {
  65876. t = r;
  65877. r = s;
  65878. s = -t;
  65879. }
  65880. /* Rotate q,r,s into the correct cube face. */
  65881. if (this.face === FACE_ENUM.RIGHT) {
  65882. t = q;
  65883. q = -r;
  65884. r = t;
  65885. } else if (this.face === FACE_ENUM.BACK) {
  65886. q = -q;
  65887. r = -r;
  65888. } else if (this.face === FACE_ENUM.LEFT) {
  65889. t = q;
  65890. q = r;
  65891. r = -t;
  65892. }
  65893. /* Now compute phi and lam from the unit sphere coordinates. */
  65894. lp.phi = Math.acos(-s) - HALF_PI;
  65895. lp.lam = Math.atan2(r, q);
  65896. if (this.face === FACE_ENUM.RIGHT) {
  65897. lp.lam = qsc_shift_lon_origin(lp.lam, -HALF_PI);
  65898. } else if (this.face === FACE_ENUM.BACK) {
  65899. lp.lam = qsc_shift_lon_origin(lp.lam, -SPI);
  65900. } else if (this.face === FACE_ENUM.LEFT) {
  65901. lp.lam = qsc_shift_lon_origin(lp.lam, +HALF_PI);
  65902. }
  65903. }
  65904. /* Apply the shift from the sphere to the ellipsoid as described
  65905. * in [LK12]. */
  65906. if (this.es !== 0) {
  65907. var invert_sign;
  65908. var tanphi, xa;
  65909. invert_sign = (lp.phi < 0 ? 1 : 0);
  65910. tanphi = Math.tan(lp.phi);
  65911. xa = this.b / Math.sqrt(tanphi * tanphi + this.one_minus_f_squared);
  65912. lp.phi = Math.atan(Math.sqrt(this.a * this.a - xa * xa) / (this.one_minus_f * xa));
  65913. if (invert_sign) {
  65914. lp.phi = -lp.phi;
  65915. }
  65916. }
  65917. lp.lam += this.long0;
  65918. p.x = lp.lam;
  65919. p.y = lp.phi;
  65920. return p;
  65921. }
  65922. /* Helper function for forward projection: compute the theta angle
  65923. * and determine the area number. */
  65924. function qsc_fwd_equat_face_theta(phi, y, x, area) {
  65925. var theta;
  65926. if (phi < EPSLN) {
  65927. area.value = AREA_ENUM.AREA_0;
  65928. theta = 0.0;
  65929. } else {
  65930. theta = Math.atan2(y, x);
  65931. if (Math.abs(theta) <= FORTPI) {
  65932. area.value = AREA_ENUM.AREA_0;
  65933. } else if (theta > FORTPI && theta <= HALF_PI + FORTPI) {
  65934. area.value = AREA_ENUM.AREA_1;
  65935. theta -= HALF_PI;
  65936. } else if (theta > HALF_PI + FORTPI || theta <= -(HALF_PI + FORTPI)) {
  65937. area.value = AREA_ENUM.AREA_2;
  65938. theta = (theta >= 0.0 ? theta - SPI : theta + SPI);
  65939. } else {
  65940. area.value = AREA_ENUM.AREA_3;
  65941. theta += HALF_PI;
  65942. }
  65943. }
  65944. return theta;
  65945. }
  65946. /* Helper function: shift the longitude. */
  65947. function qsc_shift_lon_origin(lon, offset) {
  65948. var slon = lon + offset;
  65949. if (slon < -SPI) {
  65950. slon += TWO_PI;
  65951. } else if (slon > +SPI) {
  65952. slon -= TWO_PI;
  65953. }
  65954. return slon;
  65955. }
  65956. var qsc_names = ["Quadrilateralized Spherical Cube", "Quadrilateralized_Spherical_Cube", "qsc"];
  65957. /* harmony default export */ const qsc = ({
  65958. init: qsc_init,
  65959. forward: qsc_forward,
  65960. inverse: qsc_inverse,
  65961. names: qsc_names
  65962. });
  65963. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/robin.js
  65964. // Robinson projection
  65965. // Based on https://github.com/OSGeo/proj.4/blob/master/src/PJ_robin.c
  65966. // Polynomial coeficients from http://article.gmane.org/gmane.comp.gis.proj-4.devel/6039
  65967. var COEFS_X = [
  65968. [1.0000, 2.2199e-17, -7.15515e-05, 3.1103e-06],
  65969. [0.9986, -0.000482243, -2.4897e-05, -1.3309e-06],
  65970. [0.9954, -0.00083103, -4.48605e-05, -9.86701e-07],
  65971. [0.9900, -0.00135364, -5.9661e-05, 3.6777e-06],
  65972. [0.9822, -0.00167442, -4.49547e-06, -5.72411e-06],
  65973. [0.9730, -0.00214868, -9.03571e-05, 1.8736e-08],
  65974. [0.9600, -0.00305085, -9.00761e-05, 1.64917e-06],
  65975. [0.9427, -0.00382792, -6.53386e-05, -2.6154e-06],
  65976. [0.9216, -0.00467746, -0.00010457, 4.81243e-06],
  65977. [0.8962, -0.00536223, -3.23831e-05, -5.43432e-06],
  65978. [0.8679, -0.00609363, -0.000113898, 3.32484e-06],
  65979. [0.8350, -0.00698325, -6.40253e-05, 9.34959e-07],
  65980. [0.7986, -0.00755338, -5.00009e-05, 9.35324e-07],
  65981. [0.7597, -0.00798324, -3.5971e-05, -2.27626e-06],
  65982. [0.7186, -0.00851367, -7.01149e-05, -8.6303e-06],
  65983. [0.6732, -0.00986209, -0.000199569, 1.91974e-05],
  65984. [0.6213, -0.010418, 8.83923e-05, 6.24051e-06],
  65985. [0.5722, -0.00906601, 0.000182, 6.24051e-06],
  65986. [0.5322, -0.00677797, 0.000275608, 6.24051e-06]
  65987. ];
  65988. var COEFS_Y = [
  65989. [-5.20417e-18, 0.0124, 1.21431e-18, -8.45284e-11],
  65990. [0.0620, 0.0124, -1.26793e-09, 4.22642e-10],
  65991. [0.1240, 0.0124, 5.07171e-09, -1.60604e-09],
  65992. [0.1860, 0.0123999, -1.90189e-08, 6.00152e-09],
  65993. [0.2480, 0.0124002, 7.10039e-08, -2.24e-08],
  65994. [0.3100, 0.0123992, -2.64997e-07, 8.35986e-08],
  65995. [0.3720, 0.0124029, 9.88983e-07, -3.11994e-07],
  65996. [0.4340, 0.0123893, -3.69093e-06, -4.35621e-07],
  65997. [0.4958, 0.0123198, -1.02252e-05, -3.45523e-07],
  65998. [0.5571, 0.0121916, -1.54081e-05, -5.82288e-07],
  65999. [0.6176, 0.0119938, -2.41424e-05, -5.25327e-07],
  66000. [0.6769, 0.011713, -3.20223e-05, -5.16405e-07],
  66001. [0.7346, 0.0113541, -3.97684e-05, -6.09052e-07],
  66002. [0.7903, 0.0109107, -4.89042e-05, -1.04739e-06],
  66003. [0.8435, 0.0103431, -6.4615e-05, -1.40374e-09],
  66004. [0.8936, 0.00969686, -6.4636e-05, -8.547e-06],
  66005. [0.9394, 0.00840947, -0.000192841, -4.2106e-06],
  66006. [0.9761, 0.00616527, -0.000256, -4.2106e-06],
  66007. [1.0000, 0.00328947, -0.000319159, -4.2106e-06]
  66008. ];
  66009. var FXC = 0.8487;
  66010. var FYC = 1.3523;
  66011. var C1 = R2D/5; // rad to 5-degree interval
  66012. var RC1 = 1/C1;
  66013. var NODES = 18;
  66014. var poly3_val = function(coefs, x) {
  66015. return coefs[0] + x * (coefs[1] + x * (coefs[2] + x * coefs[3]));
  66016. };
  66017. var poly3_der = function(coefs, x) {
  66018. return coefs[1] + x * (2 * coefs[2] + x * 3 * coefs[3]);
  66019. };
  66020. function newton_rapshon(f_df, start, max_err, iters) {
  66021. var x = start;
  66022. for (; iters; --iters) {
  66023. var upd = f_df(x);
  66024. x -= upd;
  66025. if (Math.abs(upd) < max_err) {
  66026. break;
  66027. }
  66028. }
  66029. return x;
  66030. }
  66031. function robin_init() {
  66032. this.x0 = this.x0 || 0;
  66033. this.y0 = this.y0 || 0;
  66034. this.long0 = this.long0 || 0;
  66035. this.es = 0;
  66036. this.title = this.title || "Robinson";
  66037. }
  66038. function robin_forward(ll) {
  66039. var lon = adjust_lon(ll.x - this.long0);
  66040. var dphi = Math.abs(ll.y);
  66041. var i = Math.floor(dphi * C1);
  66042. if (i < 0) {
  66043. i = 0;
  66044. } else if (i >= NODES) {
  66045. i = NODES - 1;
  66046. }
  66047. dphi = R2D * (dphi - RC1 * i);
  66048. var xy = {
  66049. x: poly3_val(COEFS_X[i], dphi) * lon,
  66050. y: poly3_val(COEFS_Y[i], dphi)
  66051. };
  66052. if (ll.y < 0) {
  66053. xy.y = -xy.y;
  66054. }
  66055. xy.x = xy.x * this.a * FXC + this.x0;
  66056. xy.y = xy.y * this.a * FYC + this.y0;
  66057. return xy;
  66058. }
  66059. function robin_inverse(xy) {
  66060. var ll = {
  66061. x: (xy.x - this.x0) / (this.a * FXC),
  66062. y: Math.abs(xy.y - this.y0) / (this.a * FYC)
  66063. };
  66064. if (ll.y >= 1) { // pathologic case
  66065. ll.x /= COEFS_X[NODES][0];
  66066. ll.y = xy.y < 0 ? -HALF_PI : HALF_PI;
  66067. } else {
  66068. // find table interval
  66069. var i = Math.floor(ll.y * NODES);
  66070. if (i < 0) {
  66071. i = 0;
  66072. } else if (i >= NODES) {
  66073. i = NODES - 1;
  66074. }
  66075. for (;;) {
  66076. if (COEFS_Y[i][0] > ll.y) {
  66077. --i;
  66078. } else if (COEFS_Y[i+1][0] <= ll.y) {
  66079. ++i;
  66080. } else {
  66081. break;
  66082. }
  66083. }
  66084. // linear interpolation in 5 degree interval
  66085. var coefs = COEFS_Y[i];
  66086. var t = 5 * (ll.y - coefs[0]) / (COEFS_Y[i+1][0] - coefs[0]);
  66087. // find t so that poly3_val(coefs, t) = ll.y
  66088. t = newton_rapshon(function(x) {
  66089. return (poly3_val(coefs, x) - ll.y) / poly3_der(coefs, x);
  66090. }, t, EPSLN, 100);
  66091. ll.x /= poly3_val(COEFS_X[i], t);
  66092. ll.y = (5 * i + t) * D2R;
  66093. if (xy.y < 0) {
  66094. ll.y = -ll.y;
  66095. }
  66096. }
  66097. ll.x = adjust_lon(ll.x + this.long0);
  66098. return ll;
  66099. }
  66100. var robin_names = ["Robinson", "robin"];
  66101. /* harmony default export */ const robin = ({
  66102. init: robin_init,
  66103. forward: robin_forward,
  66104. inverse: robin_inverse,
  66105. names: robin_names
  66106. });
  66107. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/geocent.js
  66108. function geocent_init() {
  66109. this.name = 'geocent';
  66110. }
  66111. function geocent_forward(p) {
  66112. var point = geodeticToGeocentric(p, this.es, this.a);
  66113. return point;
  66114. }
  66115. function geocent_inverse(p) {
  66116. var point = geocentricToGeodetic(p, this.es, this.a, this.b);
  66117. return point;
  66118. }
  66119. var geocent_names = ["Geocentric", 'geocentric', "geocent", "Geocent"];
  66120. /* harmony default export */ const geocent = ({
  66121. init: geocent_init,
  66122. forward: geocent_forward,
  66123. inverse: geocent_inverse,
  66124. names: geocent_names
  66125. });
  66126. ;// CONCATENATED MODULE: ./node_modules/proj4/projs.js
  66127. /* harmony default export */ function proj4_projs(proj4){
  66128. proj4.Proj.projections.add(tmerc);
  66129. proj4.Proj.projections.add(etmerc);
  66130. proj4.Proj.projections.add(utm);
  66131. proj4.Proj.projections.add(sterea);
  66132. proj4.Proj.projections.add(stere);
  66133. proj4.Proj.projections.add(somerc);
  66134. proj4.Proj.projections.add(omerc);
  66135. proj4.Proj.projections.add(lcc);
  66136. proj4.Proj.projections.add(krovak);
  66137. proj4.Proj.projections.add(cass);
  66138. proj4.Proj.projections.add(laea);
  66139. proj4.Proj.projections.add(aea);
  66140. proj4.Proj.projections.add(gnom);
  66141. proj4.Proj.projections.add(cea);
  66142. proj4.Proj.projections.add(eqc);
  66143. proj4.Proj.projections.add(poly);
  66144. proj4.Proj.projections.add(nzmg);
  66145. proj4.Proj.projections.add(mill);
  66146. proj4.Proj.projections.add(sinu);
  66147. proj4.Proj.projections.add(moll);
  66148. proj4.Proj.projections.add(eqdc);
  66149. proj4.Proj.projections.add(vandg);
  66150. proj4.Proj.projections.add(aeqd);
  66151. proj4.Proj.projections.add(ortho);
  66152. proj4.Proj.projections.add(qsc);
  66153. proj4.Proj.projections.add(robin);
  66154. proj4.Proj.projections.add(geocent);
  66155. }
  66156. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/index.js
  66157. core.defaultDatum = 'WGS84'; //default datum
  66158. core.Proj = Proj;
  66159. core.WGS84 = new core.Proj('WGS84');
  66160. core.Point = lib_Point;
  66161. core.toPoint = toPoint;
  66162. core.defs = lib_defs;
  66163. core.transform = transform;
  66164. core.mgrs = mgrs;
  66165. core.version = '__VERSION__';
  66166. proj4_projs(core);
  66167. /* harmony default export */ const lib = (core);
  66168. ;// CONCATENATED MODULE: ./src/leaflet/core/Proj4Leaflet.js
  66169. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  66170. * This program are made available under the terms of the Apache License, Version 2.0
  66171. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66172. /**
  66173. * Inspired by https://github.com/kartena/Proj4Leaflet
  66174. */
  66175. window.proj4 = lib;
  66176. window.Proj4js = lib;
  66177. (external_L_default()).Proj = {};
  66178. (external_L_default()).Proj._isProj4Obj = function(a) {
  66179. return typeof a.inverse !== 'undefined' && typeof a.forward !== 'undefined';
  66180. };
  66181. /**
  66182. * @class L.Proj.Projection
  66183. * @private
  66184. * @classdesc Proj 投影定义类。
  66185. * @category BaseTypes Projection
  66186. * @extends {L.Class}
  66187. * @param {string} code - proj srsCode
  66188. * @param {string} def - 投影的 proj4 定义。{@link [详细]{https://iclient.supermap.io/web/introduction/leafletDevelop.html#projection}}
  66189. * @param {L.bounds} bounds - 投影范围参数
  66190. */
  66191. (external_L_default()).Proj.Projection = external_L_default().Class.extend({
  66192. initialize: function(code, def, bounds, wrapLng) {
  66193. var isP4 = external_L_default().Proj._isProj4Obj(code);
  66194. this._proj = isP4 ? code : this._projFromCodeDef(code, def);
  66195. var boundsOption = bounds;
  66196. if (external_L_default().Util.isArray(bounds)) {
  66197. boundsOption = external_L_default().bounds(bounds);
  66198. }
  66199. this.bounds = isP4 ? def : boundsOption;
  66200. this.wrapLng = wrapLng;
  66201. },
  66202. /**
  66203. * @function L.Proj.Projection.prototype.project
  66204. * @description 通过地理坐标得到投影坐标。
  66205. * @param {L.Latlng} latlng - 经纬度坐标。
  66206. * @returns {L.Point} 返回投影坐标点。
  66207. */
  66208. project: function(latlng) {
  66209. var point = this._proj.forward([latlng.lng, latlng.lat]);
  66210. return new (external_L_default()).Point(point[0], point[1]);
  66211. },
  66212. /**
  66213. * @function L.Proj.Projection.prototype.unproject
  66214. * @description 通过投影坐标得到地理坐标。
  66215. * @param {L.Point} point - 坐标点。
  66216. * @param {number} unbounded - 坐标点高程值等。
  66217. * @returns {L.LatLng} 返回经纬度坐标
  66218. */
  66219. unproject: function(point, zoom) {
  66220. if (this.bounds && !this.wrapLng) {
  66221. point.x =
  66222. point.x < this.bounds.min.x
  66223. ? this.bounds.min.x
  66224. : point.x > this.bounds.max.x
  66225. ? this.bounds.max.x
  66226. : point.x;
  66227. point.y =
  66228. point.y < this.bounds.min.y
  66229. ? this.bounds.min.y
  66230. : point.y > this.bounds.max.y
  66231. ? this.bounds.max.y
  66232. : point.y;
  66233. }
  66234. var point2 = this._proj.inverse([point.x, point.y]);
  66235. return new (external_L_default()).LatLng(point2[1], point2[0], zoom);
  66236. },
  66237. _projFromCodeDef: function(code, def) {
  66238. if (def) {
  66239. lib.defs(code, def);
  66240. } else if (lib.defs[code] === undefined) {
  66241. var urn = code.split(':');
  66242. if (urn.length > 3) {
  66243. code = urn[urn.length - 3] + ':' + urn[urn.length - 1];
  66244. }
  66245. if (lib.defs[code] === undefined) {
  66246. throw 'No projection definition for code ' + code;
  66247. }
  66248. }
  66249. return lib(code);
  66250. },
  66251. getUnits: function() {
  66252. return this._proj.oProj.units || 'degrees';
  66253. }
  66254. });
  66255. /**
  66256. * @class L.Proj.CRS
  66257. * @classdesc 基于 Proj4 坐标系统扩展类。
  66258. * 为计算级别,`options.scales` `options.scaleDenominators` `options.resolutions` `options.bounds` 必须指定一个,先后顺序已按优先级排列。
  66259. * 当指定`options.bounds` 时,第 0 级为一张 256 切片包含整个 bounds,即`Math.max(bounds.getSize().x, bounds.getSize().y)/256` 。
  66260. * 为保证切片行列号正确,`options.origin` `options.bounds` 必须指定一个。
  66261. * 当指定`options.bounds` 时,切片原点为bounds的左上角。
  66262. * @category BaseTypes Projection
  66263. * @extends {L.Class}
  66264. * @param {string} srsCode - proj srsCode。
  66265. * @param {Object} options - 参数。
  66266. * @param {string} options.def - 投影的proj4定义。[详细]{@link https://iclient.supermap.io/web/introduction/leafletDevelop.html#multiProjection}
  66267. * @param {(Array.<number>|L.Point)} [options.origin] - 原点。
  66268. * @param {Array.<number>} [options.scales] - 比例尺数组。
  66269. * @param {Array.<number>} [options.scaleDenominators] - 比例尺分母数组。
  66270. * @param {Array.<number>} [options.resolutions] - 分辨率数组。
  66271. * @param {(Array.<number>|L.Bounds)} [options.bounds] - 范围。
  66272. * @param {number} [options.dpi=96] - dpi。
  66273. * @param {number} [options.wrapLng] - 定义经度(水平)坐标轴是否在给定范围内环绕。大多数情况下默认为[-180,180]。
  66274. * @example
  66275. * var crs =L.Proj.CRS("EPSG:4326",{
  66276. * origin: [-180,90],
  66277. * scaleDenominators: [2000,1000,500,200,100,50,20,10],
  66278. * });
  66279. * var map=L.map('map', {
  66280. * crs: crs
  66281. * ...
  66282. * })
  66283. */
  66284. var CRS = external_L_default().Class.extend({
  66285. includes: (external_L_default()).CRS,
  66286. options: {
  66287. transformation: new (external_L_default()).Transformation(1, 0, -1, 0)
  66288. },
  66289. initialize: function(srsCode, options) {
  66290. var code, proj, def;
  66291. if (external_L_default().Proj._isProj4Obj(srsCode)) {
  66292. proj = srsCode;
  66293. code = proj.srsCode;
  66294. options = options || {};
  66295. this.projection = new (external_L_default()).Proj.Projection(proj, options.bounds,options.wrapLng);
  66296. } else {
  66297. code = srsCode;
  66298. options = options || {};
  66299. def = options.def || '';
  66300. this.projection = new (external_L_default()).Proj.Projection(code, def, options.bounds,options.wrapLng);
  66301. }
  66302. external_L_default().Util.setOptions(this, options);
  66303. if (this.options.wrapLng) {
  66304. this.wrapLng = this.options.wrapLng;
  66305. }
  66306. this.code = code;
  66307. this.transformation = this.options.transformation;
  66308. this.options.dpi = this.options.dpi || 96;
  66309. if (this.options.bounds) {
  66310. this.options.bounds = external_L_default().bounds(this.options.bounds);
  66311. }
  66312. if (!this.options.origin && this.options.bounds) {
  66313. this.options.origin = [this.options.bounds.min.x, this.options.bounds.max.y];
  66314. }
  66315. if (this.options.origin) {
  66316. if (this.options.origin instanceof (external_L_default()).Point) {
  66317. this.options.origin = [this.options.origin.x, this.options.origin.y];
  66318. }
  66319. this.transformation = new (external_L_default()).Transformation(1, -this.options.origin[0], -1, this.options.origin[1]);
  66320. }
  66321. if (this.options.scales && this.options.scales.length > 0) {
  66322. this.scales = this.options.scales;
  66323. this._scales = this._toProj4Scales(this.options.scales, this.options.dpi);
  66324. } else if (this.options.scaleDenominators && this.options.scaleDenominators.length > 0) {
  66325. this.scales = [];
  66326. for (let i = 0; i < this.options.scaleDenominators.length; i++) {
  66327. this.scales[i] = 1 / this.options.scaleDenominators[i];
  66328. }
  66329. this._scales = this._toProj4Scales(this.scales, this.options.dpi);
  66330. } else if (this.options.resolutions && this.options.resolutions.length > 0) {
  66331. this._scales = [];
  66332. for (let i = this.options.resolutions.length - 1; i >= 0; i--) {
  66333. if (this.options.resolutions[i]) {
  66334. this._scales[i] = 1 / this.options.resolutions[i];
  66335. }
  66336. }
  66337. } else if (this.options.bounds) {
  66338. this._scales = this._getDefaultProj4ScalesByBounds(this.options.bounds);
  66339. }
  66340. this._rectify();
  66341. this.infinite = !this.options.bounds;
  66342. },
  66343. _rectify: function() {
  66344. if (this._scales) {
  66345. if (!this.resolutions) {
  66346. this.resolutions = [];
  66347. this.resolutions = this._proj4ScalesToResolutions(this._scales);
  66348. }
  66349. if (!this.scales) {
  66350. this.scales = [];
  66351. for (let i = 0; i < this.resolutions.length; i++) {
  66352. var scaleD =
  66353. this.resolutions[i] *
  66354. this.options.dpi *
  66355. (1 / 0.0254) *
  66356. this._getMeterPerMapUnit(this.projection.getUnits());
  66357. this.scales[i] = 1.0 / scaleD;
  66358. }
  66359. }
  66360. }
  66361. },
  66362. /**
  66363. * @function L.Proj.CRS.prototype.scale
  66364. * @description 通过缩放级别获取比例尺值。
  66365. * @param {number} zoom - 缩放级别。
  66366. * @returns 比例尺值。
  66367. */
  66368. scale: function(zoom) {
  66369. var iZoom = Math.floor(zoom),
  66370. baseScale,
  66371. nextScale,
  66372. scaleDiff,
  66373. zDiff;
  66374. if (zoom === iZoom) {
  66375. return this._scales[zoom];
  66376. } else {
  66377. // Non-integer zoom, interpolate
  66378. baseScale = this._scales[iZoom];
  66379. nextScale = this._scales[iZoom + 1];
  66380. scaleDiff = nextScale - baseScale;
  66381. zDiff = zoom - iZoom;
  66382. return baseScale + scaleDiff * zDiff;
  66383. }
  66384. },
  66385. /**
  66386. * @function L.Proj.CRS.prototype.zoom
  66387. * @description 根据比例尺返回缩放级别。
  66388. * @param {number} scale - 比例尺。
  66389. * @returns {number} 缩放级别。
  66390. */
  66391. zoom: function(scale) {
  66392. // Find closest number in this._scales, down
  66393. var downScale = this._closestElement(this._scales, scale),
  66394. downZoom = this._scales.indexOf(downScale),
  66395. nextScale,
  66396. nextZoom,
  66397. scaleDiff;
  66398. // Check if scale is downScale => return array index
  66399. if (!downScale) {
  66400. return 0;
  66401. }
  66402. if (scale === downScale) {
  66403. return downZoom;
  66404. }
  66405. // Interpolate
  66406. nextZoom = downZoom + 1;
  66407. nextScale = this._scales[nextZoom];
  66408. if (nextScale === undefined) {
  66409. return downZoom;
  66410. }
  66411. scaleDiff = nextScale - downScale;
  66412. return (scale - downScale) / scaleDiff + downZoom;
  66413. },
  66414. distance: (external_L_default()).CRS.Earth.distance,
  66415. R: (external_L_default()).CRS.Earth.R,
  66416. /* Get the closest lowest element in an array */
  66417. _closestElement: function(array, element) {
  66418. var low;
  66419. for (var i = array.length; i--; ) {
  66420. if (array[i] <= element && (low === undefined || low < array[i])) {
  66421. low = array[i];
  66422. }
  66423. }
  66424. return low;
  66425. },
  66426. _proj4ScalesToResolutions(_scales) {
  66427. var resolutions = [];
  66428. if (!_scales) {
  66429. return resolutions;
  66430. }
  66431. for (var i = 0; i < _scales.length; i++) {
  66432. resolutions[i] = 1.0 / _scales[i];
  66433. }
  66434. return resolutions;
  66435. },
  66436. _toProj4Scales: function(scales, dpi) {
  66437. var proj4Scales = [];
  66438. if (!scales) {
  66439. return proj4Scales;
  66440. }
  66441. for (var i = 0; i < scales.length; i++) {
  66442. var a = this.projection ? this._getMeterPerMapUnit(this.projection.getUnits()) : 1;
  66443. proj4Scales[i] = 1 / (0.0254 / ((dpi || 96) * scales[i]) / a);
  66444. }
  66445. return proj4Scales;
  66446. },
  66447. _getMeterPerMapUnit: function(mapUnit) {
  66448. var earchRadiusInMeters = 6378137;
  66449. var meterPerMapUnit = 1;
  66450. if (mapUnit === 'meter') {
  66451. meterPerMapUnit = 1;
  66452. } else if (mapUnit === 'degrees') {
  66453. // 每度表示多少米。
  66454. meterPerMapUnit = (Math.PI * 2 * earchRadiusInMeters) / 360;
  66455. } else if (mapUnit === 'kilometer') {
  66456. meterPerMapUnit = 1.0e-3;
  66457. } else if (mapUnit === 'inch') {
  66458. meterPerMapUnit = 1 / 2.5399999918e-2;
  66459. } else if (mapUnit === 'feet') {
  66460. meterPerMapUnit = 0.3048;
  66461. }
  66462. return meterPerMapUnit;
  66463. },
  66464. _getDefaultProj4ScalesByBounds: function(bounds) {
  66465. if (!bounds) {
  66466. return [];
  66467. }
  66468. var boundsSize = bounds.getSize();
  66469. var extendsSize = Math.max(boundsSize.x, boundsSize.y);
  66470. var resolution = extendsSize / 256;
  66471. var scales = [];
  66472. var maxZoom = 23;
  66473. for (var i = 0; i < maxZoom; i++) {
  66474. scales[i] = Math.pow(2, i) / resolution;
  66475. }
  66476. return scales;
  66477. }
  66478. });
  66479. var crs = function(srsCode, options) {
  66480. return new CRS(srsCode, options);
  66481. };
  66482. (external_L_default()).Proj.CRS = crs;
  66483. ;// CONCATENATED MODULE: ./src/leaflet/core/ExtendsCRS.js
  66484. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  66485. * This program are made available under the terms of the Apache License, Version 2.0
  66486. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66487. /**
  66488. * @name L.CRS.BaiduCRS
  66489. * @description 百度的坐标对象。
  66490. * @namespace
  66491. * @category BaseTypes Projection
  66492. */
  66493. var BaiduCRS = (external_L_default()).CRS.Baidu = external_L_default().extend({}, (external_L_default()).CRS.EPSG3857, {
  66494. code: 'Baidu',
  66495. scale: function (zoom) {
  66496. return (6378137 * Math.PI * 2) / Math.pow(2, 18 - zoom)
  66497. },
  66498. transformation: (function () {
  66499. var scale = 0.5 / (Math.PI * 6378137);
  66500. return new (external_L_default()).Transformation(scale, 0, -scale, 0);
  66501. }())
  66502. });
  66503. var tdt_WGS84_resolutions = [];
  66504. for (let i = 1; i < 19; i++) {
  66505. tdt_WGS84_resolutions.push(0.703125 * 2 / (Math.pow(2, i)));
  66506. }
  66507. /**
  66508. * @name L.CRS.TianDiTu_WGS84CRS
  66509. * @description 天地图 WGS84 坐标对象。
  66510. * @namespace
  66511. * @category BaseTypes Projection
  66512. */
  66513. var TianDiTu_WGS84CRS = (external_L_default()).CRS.TianDiTu_WGS84 = external_L_default().Proj.CRS("EPSG:4326",{
  66514. origin: [-180, 90],
  66515. resolutions: tdt_WGS84_resolutions,
  66516. bounds: external_L_default().bounds([-180, -90], [180, 90]),
  66517. wrapLng: [-180, 180]
  66518. });
  66519. const c = Math.PI * 2 * 6378137;
  66520. const halfC = c / 2;
  66521. var tdt_Mercator_resolutions = [];
  66522. for (let i = 1; i < 19; i++) {
  66523. tdt_Mercator_resolutions.push(c / 256 / Math.pow(2, i));
  66524. }
  66525. /**
  66526. * @name L.CRS.TianDiTu_MercatorCRS
  66527. * @description 天地图墨卡托坐标对象。
  66528. * @category BaseTypes Projection
  66529. * @namespace
  66530. */
  66531. var TianDiTu_MercatorCRS = ((external_L_default()).CRS.TianDiTu_Mercator = external_L_default().Proj.CRS('EPSG:3857', {
  66532. origin: [-halfC, halfC],
  66533. resolutions: tdt_Mercator_resolutions,
  66534. bounds: external_L_default().bounds([-halfC, -halfC], [halfC, halfC]),
  66535. wrapLng: [-180, 180]
  66536. }));
  66537. (external_L_default()).CRS.BaiduCRS = BaiduCRS;
  66538. (external_L_default()).CRS.TianDiTu_WGS84CRS = TianDiTu_WGS84CRS;
  66539. (external_L_default()).CRS.TianDiTu_MercatorCRS = TianDiTu_MercatorCRS;
  66540. ;// CONCATENATED MODULE: ./src/leaflet/core/Attributions.js
  66541. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  66542. * This program are made available under the terms of the Apache License, Version 2.0
  66543. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66544. /**
  66545. * attribution版权相关配置
  66546. */
  66547. let Attributions = {
  66548. Prefix: `<a href='https://leafletjs.com' title='A JS library for interactive maps'>Leaflet</a>
  66549. with <span>© <a href='https://iclient.supermap.io' title='SuperMap iClient' target='_blank'>SuperMap iClient</a></span>`,
  66550. Common: {
  66551. attribution: `Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>`
  66552. },
  66553. Online: {
  66554. attribution: `Map Data <span>© <a href='https://www.supermapol.com' title='SuperMap Online' target='_blank'>SuperMap Online</a></span>`
  66555. },
  66556. ECharts: {
  66557. attribution: `© 2018 百度 ECharts`
  66558. },
  66559. MapV: {
  66560. attribution: `© 2018 百度 MapV `
  66561. },
  66562. Turf: {
  66563. attribution: `<span>© <a href='https://turfjs.org/' title='turfjs' target='_blank'>turfjs</a></span>`
  66564. },
  66565. Baidu: {
  66566. attribution: `Map Data © 2018 Baidu - GS(2016)2089号 - Data © 长地万方`
  66567. },
  66568. Cloud: {
  66569. attribution: `Map Data ©2014 SuperMap - GS(2014)6070号-data©Navinfo`
  66570. },
  66571. Tianditu: {
  66572. attribution: `Map Data <a href='https://www.tianditu.gov.cn' target='_blank'><img style='background-color:transparent;bottom:2px;opacity:1;' src='https://api.tianditu.gov.cn/img/map/logo.png' width='53px' height='22px' opacity='0'></a>`
  66573. }
  66574. };
  66575. /* harmony default export */ const core_Attributions = (Attributions);
  66576. ;// CONCATENATED MODULE: ./src/leaflet/core/Base.js
  66577. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  66578. * This program are made available under the terms of the Apache License, Version 2.0
  66579. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66580. /**
  66581. * @namespace L
  66582. * @category BaseTypes Namespace
  66583. */
  66584. /**
  66585. * @namespace L.supermap
  66586. * @category BaseTypes Namespace
  66587. */
  66588. /**
  66589. * SuperMap Leaflet基类
  66590. * 定义命名空间
  66591. * 提供公共模块
  66592. */
  66593. (external_L_default()).supermap = (external_L_default()).supermap || {};
  66594. (external_L_default()).supermap.control = (external_L_default()).supermap.control || {};
  66595. (external_L_default()).supermap.components = (external_L_default()).supermap.components || {};
  66596. external_L_default().Control.Attribution.include({
  66597. options: {
  66598. position: 'bottomright',
  66599. prefix: core_Attributions.Prefix
  66600. }
  66601. });
  66602. external_L_default().Map.include({
  66603. /*
  66604. * 获取精确的像素坐标.
  66605. * 当需要绘制比较平滑的曲线的时候可调用此方法代替latLngToContainerPoint
  66606. * @param latlng
  66607. */
  66608. latLngToAccurateContainerPoint: function (latlng) {
  66609. var projectedPoint = this.project(external_L_default().latLng(latlng));
  66610. var layerPoint = projectedPoint._subtract(this.getPixelOrigin());
  66611. return external_L_default().point(layerPoint).add(this._getMapPanePos());
  66612. }
  66613. });
  66614. wrapToGeoJSON([(external_L_default()).Polyline, (external_L_default()).Polygon, (external_L_default()).Marker, (external_L_default()).CircleMarker, (external_L_default()).Circle, (external_L_default()).LayerGroup]);
  66615. function wrapToGeoJSON(objClassArray) {
  66616. objClassArray.map((objClass) => {
  66617. objClass.defaultFunction = objClass.prototype.toGeoJSON;
  66618. objClass.include({
  66619. toGeoJSON: function (precision) {
  66620. return objClass.defaultFunction.call(this, precision || 10);
  66621. }
  66622. })
  66623. return objClass;
  66624. })
  66625. }
  66626. ;// CONCATENATED MODULE: ./src/leaflet/services/ServiceBase.js
  66627. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  66628. * This program are made available under the terms of the Apache License, Version 2.0
  66629. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66630. /**
  66631. * @class L.supermap.ServiceBase
  66632. * @classdesc L.supermap 服务基类。
  66633. * @category iServer
  66634. * @param {string} url - 与客户端交互的服务地址。
  66635. * @param {Object} options - 参数。
  66636. * @param {string} [options.proxy] - 服务代理地址。
  66637. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  66638. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  66639. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  66640. * @param {Object} [options.headers] - 请求头。
  66641. * @fires L.supermap.ServiceBase#initialized
  66642. * @fires L.supermap.ServiceBase#destroy
  66643. * @extends {L.Evented}
  66644. */
  66645. var ServiceBase = external_L_default().Evented.extend({
  66646. options: {
  66647. url: null,
  66648. proxy: null,
  66649. //服务来源 ISERVER|IPORTAL|ONLINE
  66650. serverType: null,
  66651. withCredentials: false,
  66652. crossOrigin: null
  66653. },
  66654. initialize: function (url, options) {
  66655. if (url) {
  66656. url = (url.indexOf("/") !== url.length - 1) ?
  66657. url : url.substr(0, url.length - 1);
  66658. }
  66659. this.url = url;
  66660. external_L_default().setOptions(this, options);
  66661. /**
  66662. * @event L.supermap.ServiceBase#initialized
  66663. * @description 构造函数构造成功后触发。
  66664. * @property {L.supermap.ServiceBase} this - this 对象。
  66665. */
  66666. this.fire("initialized", this);
  66667. },
  66668. /**
  66669. * @function L.supermap.ServiceBase.prototype.destroy
  66670. * @description 释放资源,将引用的资源属性置空。
  66671. */
  66672. destroy: function () {
  66673. /**
  66674. * @event L.supermap.ServiceBase#destroy
  66675. * @description 资源释放成功后触发。
  66676. * @property {L.supermap.ServiceBase} this - this 对象。
  66677. */
  66678. this.fire("destroy", this);
  66679. }
  66680. });
  66681. (external_L_default()).supermap.ServiceBase = ServiceBase;
  66682. ;// CONCATENATED MODULE: ./src/leaflet/services/MapService.js
  66683. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  66684. * This program are made available under the terms of the Apache License, Version 2.0
  66685. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66686. /**
  66687. * @class L.supermap.mapService
  66688. * @classdesc 地图信息服务类。
  66689. * @category iServer Map
  66690. * @extends {L.supermap.ServiceBase}
  66691. * @param {string} url - 地图服务地址。
  66692. * @param {Object} options - 参数。
  66693. * @param {string} [options.proxy] - 服务代理地址。
  66694. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  66695. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  66696. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  66697. * @param {Object} [options.headers] - 请求头。
  66698. * @example
  66699. * L.supermap.mapService(url)
  66700. * .getMapInfo(function(result){
  66701. * //doSomething
  66702. * })
  66703. */
  66704. var MapService_MapService = ServiceBase.extend({
  66705. options: {
  66706. projection: null
  66707. },
  66708. initialize: function (url, options) {
  66709. options = options || {};
  66710. external_L_default().setOptions(this, options);
  66711. if (options.projection) {
  66712. this.options.projection = options.projection;
  66713. }
  66714. ServiceBase.prototype.initialize.call(this, url, options);
  66715. },
  66716. /**
  66717. * @function L.supermap.mapService.prototype.getMapInfo
  66718. * @description 获取地图信息。
  66719. * @param {RequestCallback} callback - 回调函数。
  66720. */
  66721. getMapInfo: function (callback) {
  66722. var me = this;
  66723. var getMapStatusService = new MapService(me.url, {
  66724. proxy: me.options.proxy,
  66725. withCredentials: me.options.withCredentials,
  66726. crossOrigin: me.options.crossOrigin,
  66727. headers: me.options.headers,
  66728. serverType: me.options.serverType,
  66729. eventListeners: {
  66730. scope: me,
  66731. processCompleted: callback,
  66732. processFailed: callback
  66733. },
  66734. projection: me.options.projection
  66735. });
  66736. getMapStatusService.processAsync();
  66737. },
  66738. /**
  66739. * @function L.supermap.mapService.prototype.getTilesets
  66740. * @description 获取切片列表信息。
  66741. * @param {RequestCallback} callback - 回调函数。
  66742. */
  66743. getTilesets: function (callback) {
  66744. var me = this;
  66745. var tilesetsService = new TilesetsService(me.url, {
  66746. proxy: me.options.proxy,
  66747. withCredentials: me.options.withCredentials,
  66748. crossOrigin: me.options.crossOrigin,
  66749. headers: me.options.headers,
  66750. serverType: me.options.serverType,
  66751. eventListeners: {
  66752. scope: me,
  66753. processCompleted: callback,
  66754. processFailed: callback
  66755. }
  66756. });
  66757. tilesetsService.processAsync();
  66758. }
  66759. });
  66760. var mapService = function (url, options) {
  66761. return new MapService_MapService(url, options);
  66762. };
  66763. (external_L_default()).supermap.mapService = mapService;
  66764. ;// CONCATENATED MODULE: ./src/leaflet/control/ChangeTileVersion.js
  66765. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  66766. * This program are made available under the terms of the Apache License, Version 2.0
  66767. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  66768. /**
  66769. * @class L.supermap.control.changeTileVersion
  66770. * @classdesc 版本切换控件,支持 IE10 及以上。
  66771. * @category Control
  66772. * @extends {L.Control}
  66773. * @example
  66774. * L.supermap.control.changeTileVersion({
  66775. * layer: baseLayer,
  66776. * position: "topleft",
  66777. * orientation: "horizontal"
  66778. * }).addTo(map);
  66779. * @param {Object} options - logo 控件配置项。
  66780. * @param {L.Layer} options.layer - 绑定的底图图层。
  66781. * @param {string} [options.position='topleft'] - 控件位置继承自 leaflet control。
  66782. * @param {string} [options.title='switch tile version'] - 鼠标滑过时提示。
  66783. * @param {string} [options.tooltip='top'] - tooltip 提示显示位置 top | right | bottom | left。
  66784. * @param {boolean} [options.collapsed=true] - 是否折叠。
  66785. * @param {string} [options.nextText='+'] - 下一个版本的按钮布局。
  66786. * @param {string} [options.lastText='-'] - 上一个版本的按钮布局。
  66787. * @param {string} [options.ico='v'] - 控件显示的 logo。
  66788. * @param {string} [options.orientation='horizontal'] - 方向 horizontal|vertical。
  66789. * @param {boolean} [options.switch=true] - 是否显示上/下一个版本切换控件。
  66790. */
  66791. var ChangeTileVersion = external_L_default().Control.extend({
  66792. options: {
  66793. //绑定的底图图层
  66794. layer: null,
  66795. //控件位置 继承自leaflet control
  66796. position: 'topleft',
  66797. //鼠标滑过时提示
  66798. title: 'switch tile version',
  66799. //tooltip提示显示位置 top | right | bottom | left
  66800. tooltip: "top",
  66801. //是否折叠
  66802. collapsed: true,
  66803. //下一个版本的按钮布局
  66804. nextText: "+",
  66805. //上一个版本的按钮布局
  66806. lastText: "-",
  66807. //控件显示的logo
  66808. ico: 'V',
  66809. //方向horizontal|vertical
  66810. orientation: 'horizontal',
  66811. //是否显示上/下一个版本切换控件
  66812. switch: true
  66813. },
  66814. /**
  66815. * @private
  66816. * @function L.supermap.control.changeTileVersion.prototype.onAdd
  66817. * @description 添加控件。
  66818. */
  66819. onAdd: function () {
  66820. if (this.options.orientation !== 'vertical') {
  66821. this.options.orientation = 'horizontal';
  66822. }
  66823. var layout = this._initLayout();
  66824. if (this.options.layer) {
  66825. this.setLayer(this.options.layer);
  66826. }
  66827. return layout;
  66828. },
  66829. /**
  66830. * @function L.supermap.control.changeTileVersion.prototype.setContent
  66831. * @description 设置版本相关信息。
  66832. * @param {Object} version - 版本信息。
  66833. */
  66834. setContent: function (version) {
  66835. var content = external_L_default().Util.extend({}, version);
  66836. this.setVersionName(content.desc).setToolTip(content.desc);
  66837. },
  66838. /**
  66839. * @function L.supermap.control.changeTileVersion.prototype.setVersionName
  66840. * @description 设置版本号。
  66841. * @param {string} content - 版本信息。
  66842. * @returns {this} this
  66843. */
  66844. setVersionName: function (content) {
  66845. var value = content;
  66846. if (!content) {
  66847. value = this.getValue();
  66848. }
  66849. this._sliderValue.innerHTML = value;
  66850. return this;
  66851. },
  66852. /**
  66853. * @function L.supermap.control.changeTileVersion.prototype.setToolTip
  66854. * @description 设置提示信息。
  66855. * @param {(HTMLElement|String)} tooltip - 要需要设置的提示信息。
  66856. * @returns {this} this
  66857. */
  66858. setToolTip: function (tooltip) {
  66859. this.tooltip.innerHTML = tooltip;
  66860. return this;
  66861. },
  66862. /**
  66863. * @function L.supermap.control.changeTileVersion.prototype.updateLength
  66864. * @description 更新进度条长度。
  66865. * @param {number} length - 进度长度参数。
  66866. */
  66867. updateLength: function (length) {
  66868. if (length > 0) {
  66869. this.length = length;
  66870. this.max = this.length - 1;
  66871. this.slider.setAttribute("max", this.max);
  66872. }
  66873. },
  66874. /**
  66875. * @function L.supermap.control.changeTileVersion.prototype.setLayer
  66876. * @description 绑定图层。
  66877. * @param {L.supermap.tiledMapLayer} layer - 绑定的图层。
  66878. */
  66879. setLayer: function (layer) {
  66880. if (layer) {
  66881. this.options.layer = layer;
  66882. }
  66883. var me = this;
  66884. var tileLayer = me.options.layer;
  66885. tileLayer.on("tilesetsinfoloaded", function (result) {
  66886. var tileVersions = result && result.tileVersions;
  66887. me.update(tileVersions);
  66888. });
  66889. tileLayer.on("tileversionschanged", function (result) {
  66890. var tileVersions = result && result.tileVersion;
  66891. me.setContent(tileVersions);
  66892. });
  66893. me.getTileSetsInfo();
  66894. },
  66895. /**
  66896. * @function L.supermap.control.changeTileVersion.prototype.update
  66897. * @description 更新缓存切片集及进度条长度。
  66898. * @param {number} tileVersions - 待更新的切片版本号。
  66899. */
  66900. update: function (tileVersions) {
  66901. this.tileVersions = tileVersions;
  66902. this.updateLength(this.tileVersions.length);
  66903. },
  66904. /**
  66905. * @function L.supermap.control.changeTileVersion.prototype.getTileSetsInfo
  66906. * @description 请求获取切片集信息。
  66907. */
  66908. getTileSetsInfo: function () {
  66909. var me = this;
  66910. if (me.options.layer) {
  66911. new MapService_MapService(me.options.layer._url).getTilesets(function getTilesInfoSucceed(info) {
  66912. me.options.layer.setTileSetsInfo(info.result);
  66913. });
  66914. }
  66915. },
  66916. /**
  66917. * @function L.supermap.control.changeTileVersion.prototype.removeLayer
  66918. * @description 移除绑定的地图图层。
  66919. */
  66920. removeLayer: function () {
  66921. this.options.layer = null;
  66922. },
  66923. /**
  66924. * @function L.supermap.control.changeTileVersion.prototype.nextTilesVersion
  66925. * @description 下一个版本,第一次不进行加减,是无版本的状态。
  66926. * @returns {this} this
  66927. */
  66928. nextTilesVersion: function () {
  66929. if (this.firstLoad) {
  66930. this.options.layer.nextTilesVersion();
  66931. this.firstLoad = !!0;
  66932. return this;
  66933. }
  66934. if (parseInt(this.slider.value) > this.max-1) {
  66935. return this;
  66936. }
  66937. this.slider.value = parseInt(this.slider.value) + 1;
  66938. this.options.layer.nextTilesVersion();
  66939. return this;
  66940. },
  66941. /**
  66942. * @function L.supermap.control.changeTileVersion.prototype.lastTilesVersion
  66943. * @description 上一个版本。
  66944. */
  66945. lastTilesVersion: function () {
  66946. if (parseInt(this.slider.value) < this.min + 1) {
  66947. return this;
  66948. }
  66949. this.slider.value = parseInt(this.slider.value) - 1;
  66950. this.options.layer.lastTilesVersion();
  66951. return this;
  66952. },
  66953. /**
  66954. * @function L.supermap.control.changeTileVersion.prototype.tilesVersion
  66955. * @description 根据指定版本号请求版本。
  66956. * @param {string} version - 版本号参数。
  66957. */
  66958. tilesVersion: function (version) {
  66959. var layer = this.options.layer,
  66960. tileVersions = this.tileVersions;
  66961. var len = tileVersions.length;
  66962. for (var i = 0; i < len; i++) {
  66963. if (tileVersions[i].name == version) {
  66964. layer.updateCurrentTileSetsIndex(i);
  66965. layer.changeTilesVersion();
  66966. break;
  66967. }
  66968. }
  66969. },
  66970. /**
  66971. * @function L.supermap.control.changeTileVersion.prototype.getValue
  66972. * @description 获取进度条的值。注:(进度条的值并不是版本号)。
  66973. */
  66974. getValue: function () {
  66975. return this.slider.value;
  66976. },
  66977. /**
  66978. * @function L.supermap.control.changeTileVersion.prototype.getVersion
  66979. * @description 获取当前进度条值对应的版本号。
  66980. */
  66981. getVersion: function () {
  66982. var version = this.tileVersions[this.getValue()];
  66983. return version && version.name;
  66984. },
  66985. _initLayout: function () {
  66986. var className = 'leaflet-control-ctv';
  66987. this._container = external_L_default().DomUtil.create('div', className + ' ' + className + '-' + this.options.orientation);
  66988. //正常情况下显示btn
  66989. this._sliderBtn = external_L_default().DomUtil.create('a', className + '-toggle', this._container);
  66990. this._sliderBtn.setAttribute("title", this.options.title);
  66991. this._sliderBtn.innerHTML = this.options.ico;
  66992. //滑块拖动时值显示区域
  66993. this._sliderValue = external_L_default().DomUtil.create('p', className + '-value', this._container);
  66994. this._sliderValue.innerHTML = this.options.ico;
  66995. var sliderClassName = "leaflet-ctv-slider";
  66996. this._sliderContent = external_L_default().DomUtil.create('div', sliderClassName + "-main" + " tooltip", this._container);
  66997. //tooltip提示框
  66998. this.tooltip = external_L_default().DomUtil.create("span", "tooltip-text" + " " + "tooltip-" + this.options.tooltip, this._sliderContent);
  66999. this.tooltip.innerHTML = this.options.ico;
  67000. //加控件
  67001. if (this.options.switch) {
  67002. this._next = external_L_default().DomUtil.create('a', sliderClassName + "-incdec" + " " + sliderClassName + '-next', this._sliderContent);
  67003. this._next.innerHTML = this.options.nextText;
  67004. external_L_default().DomEvent.on(this._next, 'click', this.nextTilesVersion, this);
  67005. external_L_default().DomUtil.addClass(this._container, className + '-incdec');
  67006. }
  67007. //滑块
  67008. this._sliderContainer = external_L_default().DomUtil.create('div', sliderClassName + '-container', this._sliderContent);
  67009. this.slider = external_L_default().DomUtil.create('input', sliderClassName, this._sliderContainer);
  67010. this.min = this.min == null || isNaN(this.min) ? 0 : parseInt(this.min);
  67011. this.slider.setAttribute("title", this.options.title);
  67012. this.slider.setAttribute("id", "slider");
  67013. this.slider.setAttribute("type", "range");
  67014. this.slider.setAttribute("min", this.min);
  67015. this.slider.setAttribute("max", 0);
  67016. this.slider.setAttribute("step", 1);
  67017. this.slider.setAttribute("value", 0);
  67018. // //判断浏览器是否支持Range滑动条
  67019. // if (this.slider.type == "text") {
  67020. // console.error("抱歉,您的浏览器不支持HTML5 range滑动条,请使用高版本浏览器");
  67021. // }
  67022. this.firstLoad = true;
  67023. if ('oninput' in this.slider || 'onchange' in this.slider) {
  67024. external_L_default().DomEvent.on(this.slider, "change", this._tilesVersion, this);
  67025. } else {
  67026. this.slider.onpropertychange = this._tilesVersion;
  67027. }
  67028. //减控件
  67029. if (this.options.switch) {
  67030. this._last = external_L_default().DomUtil.create('a', sliderClassName + "-incdec" + " " + sliderClassName + '-last', this._sliderContent);
  67031. this._last.innerHTML = this.options.lastText;
  67032. external_L_default().DomEvent.on(this._last, 'click', this.lastTilesVersion, this);
  67033. }
  67034. //if (window.matchMedia("screen and (-webkit-min-device-pixel-ratio:0)").matches && this.options.orientation == 'vertical') {
  67035. if (this.options.orientation === 'vertical') {
  67036. this.slider.style.width = 170 + 'px';
  67037. this._sliderContainer.style.height = 170 + 'px';
  67038. } else {
  67039. this._sliderContainer.style.width = 150 + 'px';
  67040. }
  67041. external_L_default().DomEvent.disableClickPropagation(this._container);
  67042. if (this.options.collapsed) {
  67043. if (!(external_L_default()).Browser.android) {
  67044. external_L_default().DomEvent.on(this._container, 'mouseenter', this._expand, this)
  67045. .on(this._container, 'mouseleave', this._collapse, this);
  67046. }
  67047. if ((external_L_default()).Browser.touch) {
  67048. external_L_default().DomEvent.on(this._sliderBtn, 'click', (external_L_default()).DomEvent.stop)
  67049. .on(this._sliderBtn, 'click', this._expand, this);
  67050. } else {
  67051. external_L_default().DomEvent.on(this._sliderBtn, 'focus', this._expand, this);
  67052. }
  67053. } else {
  67054. this._expand();
  67055. }
  67056. return this._container;
  67057. },
  67058. _expand: function () {
  67059. external_L_default().DomUtil.addClass(this._container, 'leaflet-control-ctv-expanded');
  67060. },
  67061. _collapse: function () {
  67062. external_L_default().DomUtil.removeClass(this._container, 'leaflet-control-ctv-expanded');
  67063. },
  67064. _tilesVersion: function () {
  67065. var version = this.getVersion();
  67066. this.tilesVersion(version);
  67067. }
  67068. });
  67069. external_L_default().Map.mergeOptions({
  67070. changeTileVersionControl: false
  67071. });
  67072. external_L_default().Map.addInitHook(function () {
  67073. if (this.options.changeTileVersionControl) {
  67074. this.changeTileVersionControl = new ChangeTileVersion();
  67075. this.addControl(this.changeTileVersionControl);
  67076. }
  67077. });
  67078. var changeTileVersion = function (options) {
  67079. return new ChangeTileVersion(options);
  67080. };
  67081. (external_L_default()).supermap.control.changeTileVersion = changeTileVersion;
  67082. ;// CONCATENATED MODULE: ./src/common/control/img/Logo.js
  67083. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  67084. * This program are made available under the terms of the Apache License, Version 2.0
  67085. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67086. 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=";
  67087. ;// CONCATENATED MODULE: ./src/leaflet/control/Logo.js
  67088. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  67089. * This program are made available under the terms of the Apache License, Version 2.0
  67090. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67091. /**
  67092. * @class L.supermap.control.logo
  67093. * @classdesc Logo 控件。
  67094. * @category Control
  67095. * @description map 初始化的配置项为 logoControl,如果为 true,则显示控件;否则不显示该控件。目前默认显示。
  67096. * @extends {L.Control}
  67097. * @example
  67098. * L.supermap.control.Logo({
  67099. * imageUrl: xxx,//非必填项
  67100. * }).addTo(map);
  67101. * @param {Object} options - logo 控件配置项。
  67102. * @param {string} [options.position='bottomright'] - 控件位置继承自 leaflet control。
  67103. * @param {string} [options.imageUrl] - logo 图片地址。
  67104. * @param {string} [options.width] - logo 图片宽。
  67105. * @param {string} [options.height] - logo 图片高。
  67106. * @param {string} [options.link] - 跳转链接。
  67107. * @param {string} [options.alt='SuperMap iClient'] - logo 图片失效时显示文本。
  67108. */
  67109. var Logo = external_L_default().Control.extend({
  67110. options: {
  67111. position: 'bottomright',
  67112. //logo图片地址
  67113. imageUrl: null,
  67114. //跳转链接
  67115. link: null,
  67116. //logo图片宽
  67117. width: null,
  67118. //logo图片高
  67119. height: null,
  67120. //logo图片失效时显示文本
  67121. alt: "SuperMap iClient"
  67122. },
  67123. /**
  67124. * @private
  67125. * @function L.supermap.control.logo.prototype.onAdd
  67126. * @override
  67127. * @description 添加一个 logo。
  67128. * @returns {HTMLElement} 返回创建 logo 的 div。
  67129. */
  67130. onAdd: function () {
  67131. var div = external_L_default().DomUtil.create('div', 'iclient-leaflet-logo');
  67132. div.style.marginTop = 0;
  67133. div.style.marginBottom = 0;
  67134. div.style.marginLeft = 0;
  67135. div.style.marginRight = 0;
  67136. //iClient.png base64
  67137. var imgSrc = LogoBase64;
  67138. if (this.options.imageUrl) {
  67139. imgSrc = this.options.imageUrl;
  67140. }
  67141. var alt = this.options.alt;
  67142. var imageWidth = "94px";
  67143. var imageHeight = "29px";
  67144. var styleSize = "width:" + imageWidth + ";height:" + imageHeight + ";";
  67145. if (this.options.imageUrl) {
  67146. imageWidth = this.options.width;
  67147. imageHeight = this.options.height;
  67148. styleSize = "width:" + imageWidth + ";height:" + imageHeight + ";";
  67149. if (!imageWidth || !imageHeight) {
  67150. styleSize = "";
  67151. }
  67152. }
  67153. var link = this.options.link || "https://iclient.supermap.io";
  67154. div.innerHTML = "<a href='" + link + "' target='_blank' style='border: none;display: block;'>" +
  67155. "<img src=" + imgSrc + " alt='" + alt + "' style='border: none;" + styleSize + "margin-right:5px;margin-bottom:2px;white-space: nowrap'></a>";
  67156. return div;
  67157. }
  67158. });
  67159. //map默认开启logoControl
  67160. external_L_default().Map.mergeOptions({
  67161. logoControl: true
  67162. });
  67163. //map默认开启logoControl
  67164. external_L_default().Map.addInitHook(function () {
  67165. if (!this._logoAdded && this.options.logoControl) {
  67166. if (this.options.logoControl === true) {
  67167. this.logoControl = new Logo();
  67168. } else if (this.options.logoControl instanceof (external_L_default()).Control) {
  67169. this.logoControl = this.options.logoControl;
  67170. }
  67171. if (this.logoControl) {
  67172. this.addControl(this.logoControl);
  67173. this._logoAdded = true;
  67174. }
  67175. }
  67176. });
  67177. var logo = function (options) {
  67178. return new Logo(options);
  67179. };
  67180. (external_L_default()).supermap.control.logo = logo;
  67181. ;// CONCATENATED MODULE: ./src/leaflet/control/index.js
  67182. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  67183. * This program are made available under the terms of the Apache License, Version 2.0
  67184. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67185. ;// CONCATENATED MODULE: ./src/leaflet/core/CommontypesConversion.js
  67186. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  67187. * This program are made available under the terms of the Apache License, Version 2.0
  67188. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67189. /**
  67190. * @class L.supermap.CommontypesConversion
  67191. * @category BaseTypes Util
  67192. * @namespace
  67193. * @classdesc Leaflet 对象和 SuperMap 对象转换工具。
  67194. */
  67195. class CommontypesConversion {
  67196. /**
  67197. * @function L.supermap.CommontypesConversion.toSuperMapBounds
  67198. * @description 将 Leaflet 对象的 bounds 转成 SuperMap 的 bounds对象。
  67199. * @param {(L.Bounds|L.LatLngBounds)} bounds - 图层显示范围。
  67200. * @returns {SuperMap.Bounds} SuperMap 的 bounds 对象。
  67201. */
  67202. static toSuperMapBounds(bounds) {
  67203. if (bounds && ["FeatureCollection", "Feature"].indexOf(bounds.type) !== -1) {
  67204. bounds = external_L_default().geoJSON(bounds).getBounds();
  67205. }
  67206. if (bounds instanceof (external_L_default()).LatLngBounds) {
  67207. return new Bounds(
  67208. bounds.getSouthWest().lng,
  67209. bounds.getSouthWest().lat,
  67210. bounds.getNorthEast().lng,
  67211. bounds.getNorthEast().lat
  67212. );
  67213. }
  67214. if (bounds instanceof (external_L_default()).Bounds) {
  67215. return new Bounds(
  67216. bounds.min.x,
  67217. bounds.min.y,
  67218. bounds.max.x,
  67219. bounds.max.y
  67220. );
  67221. }
  67222. if (this.isArray(bounds)) {
  67223. return new Bounds(
  67224. bounds[0],
  67225. bounds[1],
  67226. bounds[2],
  67227. bounds[3]
  67228. );
  67229. }
  67230. return new Bounds();
  67231. }
  67232. /**
  67233. * @function L.supermap.Util.isArray
  67234. * @description 判断是否为数组格式。
  67235. * @param {Object} obj - 待判断对象。
  67236. * @returns {boolean} 是否是数组。
  67237. */
  67238. static isArray(obj) {
  67239. return Object.prototype.toString.call(obj) == '[object Array]';
  67240. }
  67241. /**
  67242. * @function L.supermap.CommontypesConversion.toProcessingParam
  67243. * @description 将 Region 节点数组转为 Processing 服务需要的分析参数。
  67244. * @param {Array} points - Region 各个节点数组。
  67245. * @returns processing 服务裁剪、查询分析的分析参数。
  67246. */
  67247. static toProcessingParam(points) {
  67248. var geometryParam = {};
  67249. if (points.length < 1) {
  67250. geometryParam = "";
  67251. } else {
  67252. var results = [];
  67253. for (var i = 0; i < points.length; i++) {
  67254. var point = {};
  67255. point.x = points[i][0];
  67256. point.y = points[i][1];
  67257. results.push(point);
  67258. }
  67259. geometryParam.type = "REGION";
  67260. geometryParam.points = results;
  67261. }
  67262. return geometryParam;
  67263. }
  67264. }
  67265. (external_L_default()).supermap.CommontypesConversion = CommontypesConversion;
  67266. ;// CONCATENATED MODULE: ./src/leaflet/core/Util.js
  67267. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  67268. * This program are made available under the terms of the Apache License, Version 2.0
  67269. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67270. /**
  67271. * @namespace L.Util
  67272. * @category BaseTypes Util
  67273. */
  67274. var supermap_callbacks = {};
  67275. (external_L_default()).Util.supermap_callbacks = supermap_callbacks;
  67276. var toGeoJSON = function(feature) {
  67277. if (!feature) {
  67278. return feature;
  67279. }
  67280. return new GeoJSON().toGeoJSON(feature);
  67281. };
  67282. var toSuperMapGeometry = function(geometry) {
  67283. if (!geometry) {
  67284. return geometry;
  67285. }
  67286. var result,
  67287. format = new GeoJSON();
  67288. if (['FeatureCollection', 'Feature', 'Geometry'].indexOf(geometry.type) != -1) {
  67289. result = format.read(geometry, geometry.type);
  67290. } else if (typeof geometry.toGeoJSON === 'function') {
  67291. var geojson = geometry.toGeoJSON();
  67292. result = geojson ? format.read(geojson, geojson.type) : geometry;
  67293. }
  67294. var serverResult = result;
  67295. if (external_L_default().Util.isArray(result)) {
  67296. if (result.length === 1) {
  67297. serverResult = result[0];
  67298. } else if (result.length > 1) {
  67299. serverResult = [];
  67300. result.map(function(item) {
  67301. serverResult.push(item.geometry);
  67302. return item;
  67303. });
  67304. }
  67305. }
  67306. return serverResult && serverResult.geometry ? serverResult.geometry : serverResult;
  67307. };
  67308. var Util_getMeterPerMapUnit = getMeterPerMapUnit;
  67309. var resolutionToScale = function(resolution, dpi, mapUnit) {
  67310. var inchPerMeter = 1 / 0.0254;
  67311. // 地球半径。
  67312. var meterPerMapUnit = Util_getMeterPerMapUnit(mapUnit);
  67313. var scale = resolution * dpi * inchPerMeter * meterPerMapUnit;
  67314. scale = 1 / scale;
  67315. return scale;
  67316. };
  67317. var scaleToResolution = function(scale, dpi, mapUnit) {
  67318. var inchPerMeter = 1 / 0.0254;
  67319. var meterPerMapUnitValue = Util_getMeterPerMapUnit(mapUnit);
  67320. var resolution = scale * dpi * inchPerMeter * meterPerMapUnitValue;
  67321. resolution = 1 / resolution;
  67322. return resolution;
  67323. };
  67324. var GetResolutionFromScaleDpi = function(scale, dpi, coordUnit, datumAxis) {
  67325. var resolution = null,
  67326. ratio = 10000;
  67327. //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
  67328. datumAxis = datumAxis || 6378137;
  67329. coordUnit = coordUnit || '';
  67330. if (scale > 0 && dpi > 0) {
  67331. scale = external_L_default().Util.NormalizeScale(scale);
  67332. if (
  67333. coordUnit.toLowerCase() === 'degree' ||
  67334. coordUnit.toLowerCase() === 'degrees' ||
  67335. coordUnit.toLowerCase() === 'dd'
  67336. ) {
  67337. //scale = SuperMap.Util.normalizeScale(scale);
  67338. resolution = (0.0254 * ratio) / dpi / scale / ((Math.PI * 2 * datumAxis) / 360) / ratio;
  67339. return resolution;
  67340. } else {
  67341. resolution = (0.0254 * ratio) / dpi / scale / ratio;
  67342. return resolution;
  67343. }
  67344. }
  67345. return -1;
  67346. };
  67347. var NormalizeScale = function(scale) {
  67348. return scale > 1.0 ? 1.0 / scale : scale;
  67349. };
  67350. (external_L_default()).Util.toGeoJSON = toGeoJSON;
  67351. (external_L_default()).Util.toSuperMapGeometry = toSuperMapGeometry;
  67352. (external_L_default()).Util.resolutionToScale = resolutionToScale;
  67353. (external_L_default()).Util.scaleToResolution = scaleToResolution;
  67354. (external_L_default()).Util.getMeterPerMapUnit = Util_getMeterPerMapUnit;
  67355. (external_L_default()).Util.GetResolutionFromScaleDpi = GetResolutionFromScaleDpi;
  67356. (external_L_default()).Util.NormalizeScale = NormalizeScale;
  67357. ;// CONCATENATED MODULE: ./src/leaflet/core/Transform.js
  67358. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  67359. * This program are made available under the terms of the Apache License, Version 2.0
  67360. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67361. /**
  67362. * @function L.Util.transform
  67363. * @description 将要素转换为指定坐标。
  67364. * @param {(L.Marker|L.CircleMarker|L.Polyline|L.Polygon|L.Rectangle|L.LatLngBounds|L.Bounds|Object)} feature - 待转要素包括 Leaflet Vector Layers
  67365. * 的 {@link L.Marker}|{@link L.CircleMarker}|{@link L.Polyline}|{@link L.Polygon}|{@link L.Rectangle}|{@link L.LatLngBounds}|{@link L.Bounds}|{@link GeoJSONObject} 类型。
  67366. * @param {L.Proj.CRS} [sourceCRS=L.CRS.EPSG4326] - 要素转换源坐标系。
  67367. * @param {L.Proj.CRS} targetCRS - 要素转换目标坐标系。
  67368. * @returns {GeoJSONObject} 返回 GeoJSON 规范数据类型。
  67369. */
  67370. var Transform_transform = function (feature, sourceCRS = (external_L_default()).CRS.EPSG4326, targetCRS) {
  67371. let selfFeatures = null;
  67372. let selfCallback = null;
  67373. //将数据统一为 geojson 格式处理:
  67374. if (["FeatureCollection", "Feature", "Geometry"].indexOf(feature.type) === -1) {
  67375. if (feature.toGeoJSON) {
  67376. feature = feature.toGeoJSON();
  67377. } else if (feature instanceof (external_L_default()).LatLngBounds) {
  67378. feature = external_L_default().rectangle(feature).toGeoJSON();
  67379. } else if (feature instanceof (external_L_default()).Bounds) {
  67380. feature = external_L_default().rectangle([[feature.getTopLeft().x, feature.getTopLeft().y],
  67381. [feature.getBottomRight().x, feature.getBottomRight().y]]).toGeoJSON();
  67382. } else {
  67383. throw new Error("This tool only supports data conversion in geojson format or Vector Layers of Leaflet.")
  67384. }
  67385. }
  67386. //geojson 几种数据类型及处理形式
  67387. const parseCoords = {
  67388. "point": function (array) {
  67389. return selfCallback(array);
  67390. },
  67391. "multipoint": function (array) {
  67392. return parseCoords["linestring"].apply(this, [array])
  67393. },
  67394. "linestring": function (array) {
  67395. let points = [];
  67396. let p = null;
  67397. for (let i = 0, len = array.length; i < len; ++i) {
  67398. try {
  67399. p = parseCoords["point"].apply(this, [array[i]]);
  67400. } catch (err) {
  67401. throw err;
  67402. }
  67403. points.push(p);
  67404. }
  67405. return points;
  67406. },
  67407. "multilinestring": function (array) {
  67408. return parseCoords["polygon"].apply(this, [array]);
  67409. },
  67410. "polygon": function (array) {
  67411. let rings = [];
  67412. let l;
  67413. for (let i = 0, len = array.length; i < len; ++i) {
  67414. try {
  67415. l = parseCoords["linestring"].apply(this, [array[i]]);
  67416. } catch (err) {
  67417. throw err;
  67418. }
  67419. rings.push(l);
  67420. }
  67421. return rings;
  67422. },
  67423. "multipolygon": function (array) {
  67424. let polys = [];
  67425. let p = null;
  67426. for (let i = 0, len = array.length; i < len; ++i) {
  67427. try {
  67428. p = parseCoords["polygon"].apply(this, [array[i]]);
  67429. } catch (err) {
  67430. throw err;
  67431. }
  67432. polys.push(p);
  67433. }
  67434. return polys;
  67435. }
  67436. };
  67437. //返回结果:
  67438. return featureTransform(feature, _transformCoordinates);
  67439. function featureTransform(feature, callback) {
  67440. selfFeatures = feature;
  67441. selfCallback = callback;
  67442. //分离处理:
  67443. if (feature.type === "Feature") {
  67444. selfFeatures = _prepareFeatuers(feature);
  67445. } else if (feature.type === "FeatureCollection") {
  67446. let featureResults = [];
  67447. for (let i = 0; i < feature.features.length; ++i) {
  67448. try {
  67449. featureResults.push(_prepareFeatuers(feature.features[i]));
  67450. } catch (err) {
  67451. featureResults = null;
  67452. }
  67453. }
  67454. selfFeatures.features = featureResults;
  67455. }
  67456. return selfFeatures;
  67457. }
  67458. function _prepareFeatuers(feature) {
  67459. const geometry = feature.geometry;
  67460. if (!(Util.isArray(geometry.coordinates))) {
  67461. throw "Geometry must have coordinates array: " + geometry;
  67462. }
  67463. if (!parseCoords[geometry.type.toLowerCase()]) {
  67464. throw "Unsupported geometry type: " + geometry.type;
  67465. }
  67466. try {
  67467. geometry.coordinates = parseCoords[geometry.type.toLowerCase()].apply(
  67468. this, [geometry.coordinates]
  67469. );
  67470. } catch (err) {
  67471. throw err;
  67472. }
  67473. feature.geometry = geometry;
  67474. return feature;
  67475. }
  67476. function _transformCoordinates(coordinates) {
  67477. //判断code 是投影坐标还是地理坐标
  67478. var point = sourceCRS.unproject({x: coordinates[0], y: coordinates[1]});
  67479. const transform = targetCRS.project(point);
  67480. return [transform.x, transform.y];
  67481. }
  67482. };
  67483. (external_L_default()).Util.transform = Transform_transform;
  67484. ;// CONCATENATED MODULE: ./src/leaflet/core/index.js
  67485. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  67486. * This program are made available under the terms of the Apache License, Version 2.0
  67487. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67488. ;// CONCATENATED MODULE: ./src/leaflet/mapping/BaiduTileLayer.js
  67489. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  67490. * This program are made available under the terms of the Apache License, Version 2.0
  67491. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67492. /**
  67493. * @class L.supermap.baiduTileLayer
  67494. * @classdesc 百度地图图层。
  67495. * @category ThirdPartyMap
  67496. * @extends {L.TileLayer}
  67497. * @param {string} [url='https://online{num}.map.bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles={styles}&udt=20150815&scaler=1'] - 切片地址。
  67498. * @param {Object} options - 切片参数。
  67499. * @param {number} [options.minZoom=3] - 最小缩放级别。
  67500. * @param {number} [options.maxZoom=19] - 最大缩放级别。
  67501. * @param {L.LatLngBounds} [options.bounds=L.latLngBounds([-85.0511287798, -180],[85.0511287798, 180])] - 显示范围。
  67502. * @param {L.Browser} [options.retina=L.Browser.retina] - 浏览器显示分辨率。
  67503. * @param {string} [options.tileProxy] - 代理地址。
  67504. * @param {string} [options.attribution='Map Data © 2018 Baidu - GS(2016)2089号 - Data © 长地万方'] - 版权信息。
  67505. */
  67506. var BaiduTileLayer = external_L_default().TileLayer.extend({
  67507. /**
  67508. * @member {string} L.supermap.baiduTileLayer.prototype.url
  67509. * @description 切片地址。
  67510. */
  67511. url: "http://online{num}.map.bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles={styles}&udt=20150815&scaler=1",
  67512. options: {
  67513. minZoom: 3,
  67514. maxZoom: 19,
  67515. bounds: external_L_default().latLngBounds(external_L_default().latLng(-85.0511287798, -180), external_L_default().latLng(85.0511287798, 180)),
  67516. retina: (external_L_default()).Browser.retina,
  67517. attribution: core_Attributions.Baidu.attribution
  67518. },
  67519. initialize: function (url, options) {
  67520. if (url) {
  67521. this.url = url;
  67522. }
  67523. external_L_default().setOptions(this, options);
  67524. if (this.options.retina) {
  67525. this.options.maxZoom = 18;
  67526. }
  67527. external_L_default().stamp(this);
  67528. },
  67529. /**
  67530. * @function L.supermap.baiduTileLayer.prototype.getTileUrl
  67531. * @description 获取切片地址。
  67532. * @param {Object} coords - 行列号。
  67533. * @returns {string} 切片地址。
  67534. */
  67535. getTileUrl: function (coords) {
  67536. var url = external_L_default().Util.template(this.url, {
  67537. num: Math.abs((coords.x + coords.y) % 8) + 1,
  67538. x: coords.x,
  67539. y: -coords.y - 1,
  67540. z: this._getZoomForUrl(),
  67541. styles: this.options.retina ? 'ph' : 'pl'
  67542. });
  67543. //支持代理
  67544. if (this.options.tileProxy) {
  67545. url = this.options.tileProxy + encodeURIComponent(url);
  67546. }
  67547. return url;
  67548. }
  67549. });
  67550. var baiduTileLayer = function (url, options) {
  67551. return new BaiduTileLayer(url, options);
  67552. };
  67553. (external_L_default()).supermap.baiduTileLayer = baiduTileLayer;
  67554. ;// CONCATENATED MODULE: ./src/leaflet/mapping/CloudTileLayer.js
  67555. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  67556. * This program are made available under the terms of the Apache License, Version 2.0
  67557. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67558. /**
  67559. * @class L.supermap.cloudTileLayer
  67560. * @classdesc 超图云服务图层。
  67561. * @category ThirdPartyMap
  67562. * @extends {L.TileLayer}
  67563. * @param {string} [url='http://t2.dituhui.com/FileService/image?map={mapName}&type={type}&x={x}&y={y}&z={z}'] - 服务地址。
  67564. * @param {Object} options - 图层可选参数。
  67565. * @param {string} [options.type='web'] - type。
  67566. * @param {number} [options.minZoom=3] - 最小缩放级别。
  67567. * @param {number} [options.maxZoom=18] - 最大缩放级别。
  67568. * @param {string} [options.mapName='quanguo'] - 地图名称。
  67569. * @param {string} [options.attribution='Map Data ©2014 SuperMap - GS(2014)6070号-data©Navinfo'] - 版权信息。
  67570. */
  67571. var CloudTileLayer = external_L_default().TileLayer.extend({
  67572. defaultURL: 'http://t2.dituhui.com/FileService/image',
  67573. options: {
  67574. /**
  67575. * @member {string} [L.supermap.cloudTileLayer.prototype.options='quanguo']
  67576. * @description 地图名称。
  67577. */
  67578. mapName: "quanguo",
  67579. /**
  67580. * @member {string} L.supermap.cloudTileLayer.prototype.type
  67581. * @description 地图投影。
  67582. */
  67583. type: "web",
  67584. minZoom: 3,
  67585. maxZoom: 18,
  67586. attribution: core_Attributions.Cloud.attribution
  67587. },
  67588. initialize: function (url, options) {
  67589. external_L_default().setOptions(this, options);
  67590. var cloudURL = url || this.defaultURL;
  67591. this._url = cloudURL + "?map=" + this.options.mapName + "&type=" + this.options.type;
  67592. external_L_default().stamp(this);
  67593. },
  67594. /**
  67595. * @function L.supermap.cloudTileLayer.prototype.getTileUrl
  67596. * @description 获取切片地址。
  67597. * @param {Object} coords - 行列号。
  67598. * @returns {string} 切片地址。
  67599. */
  67600. getTileUrl: function (coords) {
  67601. var layerUrl = this._url;
  67602. var tileUrl = layerUrl + "&x=" + coords.x + "&y=" + coords.y + "&z=" + coords.z;
  67603. //支持代理
  67604. if (this.options.tileProxy) {
  67605. tileUrl = this.options.tileProxy + encodeURIComponent(tileUrl);
  67606. }
  67607. return tileUrl;
  67608. }
  67609. });
  67610. var cloudTileLayer = function (url, options) {
  67611. return new CloudTileLayer(url, options);
  67612. };
  67613. (external_L_default()).supermap.cloudTileLayer = cloudTileLayer;
  67614. ;// CONCATENATED MODULE: ./src/leaflet/mapping/ImageMapLayer.js
  67615. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  67616. * This program are made available under the terms of the Apache License, Version 2.0
  67617. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  67618. /**
  67619. * @class L.supermap.imageMapLayer
  67620. * @classdesc SuperMap iServer 的 REST 地图服务的图层(SuperMap iServer Java 6R 及以上分块动态 REST 图层)。使用 Image 资源出图。
  67621. * @category iServer Map
  67622. * @extends {L.Layer}
  67623. * @example
  67624. * L.supermap.imageMapLayer(url).addTo(map);
  67625. * @param {string} url - 地图服务地址,如:http://{ip}:{port}/iserver/services/map-china400/rest/maps/China
  67626. * @param {Object} options - 图层可选参数。
  67627. * @param {string} [options.layersID] - 获取进行切片的地图图层 ID,即指定进行地图切片的图层,可以是临时图层集,也可以是当前地图中图层的组合
  67628. * @param {boolean} [options.redirect=false] - 如果为 true,则将请求重定向到瓦片的真实地址;如果为 false,则响应体中是瓦片的字节流。
  67629. * @param {boolean} [options.transparent=true] - 地图瓦片是否透明。
  67630. * @param {boolean} [options.cacheEnabled=true] - 是否使用服务器缓存出图。
  67631. * @param {boolean} [options.clipRegionEnabled=false] - 地图显示裁剪的区域是否有效。
  67632. * @param {L.Path} [options.clipRegion] - 地图显示裁剪的区域。是一个面对象,当 clipRegionEnabled = true 时有效,即地图只显示该区域覆盖的部分。
  67633. * @param {Object} [options.prjCoordSys] - 请求的地图的坐标参考系统。 如:prjCoordSys={"epsgCode":3857}。
  67634. * @param {boolean} [options.overlapDisplayed=false] - 地图对象在同一范围内时,是否重叠显示。
  67635. * @param {string} [options.overlapDisplayedOptions] - 避免地图对象压盖显示的过滤选项。
  67636. * @param {number} [options.opacity=1] - 图层不透明度。
  67637. * @param {string} [options.alt] - 无法显示图像时显示替代的文本。
  67638. * @param {string} [options.pane='tilePane'] - 图层所归属的 map DOM 的分组。
  67639. * @param {boolean} [options.interactive=false] - 是否响应鼠标点击或悬停交互事件。
  67640. * @param {boolean} [options.crossOrigin=false] - 是否设置跨域属性。
  67641. * @param {string} [options.errorOverlayUrl] - 图层未能加载时代替显示的瓦片地址。
  67642. * @param {number} [options.zIndex=1] - 设置图层的层级。
  67643. * @param {string} [options.className] - 自定义 dom 元素的 className。
  67644. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 iServer|iPortal|online。
  67645. * @param {number} [options.updateInterval=150] - 平移时图层延迟刷新间隔时间。
  67646. * @param {string} [options.tileProxy] - 代理地址。
  67647. * @param {string} [options.format='png'] - 瓦片表述类型,支持 "png" 、"webp"、"bmp" 、"jpg"、 "gif" 等图片格式。
  67648. * @param {(SuperMap.NDVIParameter|SuperMap.HillshadeParameter)} [options.rasterfunction] - 栅格分析参数。
  67649. * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权信息。
  67650. * @fires L.supermap.imageMapLayer#load
  67651. * @fires L.supermap.imageMapLayer#error
  67652. * @fires L.supermap.imageMapLayer#loading
  67653. */
  67654. var ImageMapLayer = external_L_namespaceObject.Layer.extend({
  67655. options: {
  67656. //如果有layersID,则是在使用专题图
  67657. layersID: null,
  67658. //如果为 true,则将请求重定向到图片的真实地址;如果为 false,则响应体中是图片的字节流
  67659. redirect: false,
  67660. //地图图片是否透明
  67661. transparent: true,
  67662. //是否启用服务器缓存
  67663. cacheEnabled: true,
  67664. //地图显示裁剪的区域是否有效
  67665. clipRegionEnabled: false,
  67666. //地图显示裁剪的区域
  67667. clipRegion: null,
  67668. //请求的地图的坐标参考系统。 如:prjCoordSys= {"epsgCode":3857}。
  67669. prjCoordSys: null,
  67670. //地图对象在同一范围内时,是否重叠显示
  67671. overlapDisplayed: false,
  67672. //避免地图对象压盖显示的过滤选项
  67673. overlapDisplayedOptions: null,
  67674. //图层不透明度
  67675. opacity: 1,
  67676. //无法显示图像时显示替代的文本
  67677. alt: '',
  67678. //图层所归属的map DOM的分组。默认为:"tilePane"
  67679. pane: 'tilePane',
  67680. //是否响应鼠标点击或悬停交互事件
  67681. interactive: false,
  67682. //是否设置跨域属性
  67683. crossOrigin: false,
  67684. //图层未能加载时代替显示的瓦片地址
  67685. errorOverlayUrl: '',
  67686. //设置图层的显示层级
  67687. zIndex: 1,
  67688. //自定义的html class name
  67689. className: '',
  67690. //服务来源 iServer|iPortal|online。
  67691. serverType: ServerType.ISERVER,
  67692. //版权信息
  67693. attribution: core_Attributions.Common.attribution,
  67694. //平移时图层延迟刷新间隔时间。
  67695. updateInterval: 150,
  67696. //启用托管地址。
  67697. tileProxy: null,
  67698. format: 'png'
  67699. },
  67700. initialize: function(url, options) {
  67701. this._url = url;
  67702. external_L_namespaceObject.Util.setOptions(this, options);
  67703. },
  67704. /**
  67705. * @private
  67706. * @function L.supermap.imageMapLayer.prototype.onAdd
  67707. * @description 添加到地图。
  67708. * @param {L.Map} map - 待添加到的地图对象。
  67709. */
  67710. onAdd: function(map) {
  67711. this.update = external_L_namespaceObject.Util.throttle(this.update, this.options.updateInterval, this);
  67712. map.on('moveend', this.update, this);
  67713. if (this._currentImage && this._currentImage._bounds.equals(this._map.getBounds())) {
  67714. map.addLayer(this._currentImage);
  67715. } else if (this._currentImage) {
  67716. this._map.removeLayer(this._currentImage);
  67717. this._currentImage = null;
  67718. }
  67719. this.update();
  67720. },
  67721. /**
  67722. * @private
  67723. * @function L.supermap.imageMapLayer.prototype.onRemove
  67724. * @description 从地图上移除。
  67725. */
  67726. onRemove: function() {
  67727. // eslint-disable-line no-unused-vars
  67728. if (this._currentImage) {
  67729. this._map.removeLayer(this._currentImage);
  67730. }
  67731. this._map.off('moveend', this.update, this);
  67732. },
  67733. /**
  67734. * @function L.supermap.imageMapLayer.prototype.bringToFront
  67735. * @description 将当前图层置顶
  67736. */
  67737. bringToFront: function() {
  67738. this.options.position = 'front';
  67739. if (this._currentImage) {
  67740. this._currentImage.bringToFront();
  67741. }
  67742. return this;
  67743. },
  67744. /**
  67745. * @function L.supermap.imageMapLayer.prototype.bringToFront
  67746. * @description 将当前图层置底。
  67747. */
  67748. bringToBack: function() {
  67749. this.options.position = 'back';
  67750. if (this._currentImage) {
  67751. this._currentImage.bringToBack();
  67752. }
  67753. return this;
  67754. },
  67755. /**
  67756. * @function L.supermap.imageMapLayer.prototype.getOpacity
  67757. * @description 获取图层透明度。
  67758. * @returns {number} 图层的透明度。
  67759. */
  67760. getOpacity: function() {
  67761. return this.options.opacity;
  67762. },
  67763. /**
  67764. * @function L.supermap.imageMapLayer.prototype.setOpacity
  67765. * @description 设置透明度。
  67766. */
  67767. setOpacity: function(opacity) {
  67768. this.options.opacity = opacity;
  67769. if (this._currentImage) {
  67770. this._currentImage.setOpacity(opacity);
  67771. }
  67772. return this;
  67773. },
  67774. /**
  67775. * @function L.supermap.imageMapLayer.prototype.getImageUrl
  67776. * @description 获取 image 图层请求地址,子类可重写实现。
  67777. * @returns {string} 请求瓦片地址。
  67778. */
  67779. getImageUrl: function(params) {
  67780. let serviceUrl = Util.urlPathAppend(this._url, `image.${this.options.format}`);
  67781. let imageUrl =
  67782. serviceUrl + external_L_namespaceObject.Util.getParamString(Object.assign({}, this._initAllRequestParams(), params), serviceUrl);
  67783. imageUrl = this._appendCredential(imageUrl);
  67784. //支持代理
  67785. if (this.options.tileProxy) {
  67786. imageUrl = this.options.tileProxy + encodeURIComponent(imageUrl);
  67787. }
  67788. if (!this.options.cacheEnabled) {
  67789. imageUrl += '&_t=' + new Date().getTime();
  67790. }
  67791. return imageUrl;
  67792. },
  67793. //获取请求瓦片宽高以及请求范围参数
  67794. _getImageParams: function() {
  67795. var size = this._calculateImageSize();
  67796. return {
  67797. viewBounds: this._compriseBounds(this._calculateBounds()),
  67798. width: size.x,
  67799. height: size.y
  67800. };
  67801. },
  67802. //初始化服务请求参数
  67803. _initAllRequestParams: function() {
  67804. var me = this,
  67805. options = me.options || {},
  67806. params = {};
  67807. var redirect = options.redirect === true ? options.redirect : false;
  67808. params['redirect'] = redirect;
  67809. var transparent = options.transparent === true ? options.transparent : false;
  67810. params['transparent'] = transparent;
  67811. var cacheEnabled = options.cacheEnabled === false ? options.cacheEnabled : true;
  67812. params['cacheEnabled'] = cacheEnabled;
  67813. if (options.prjCoordSys) {
  67814. params['prjCoordSys'] = JSON.stringify(options.prjCoordSys);
  67815. }
  67816. if (options.layersID) {
  67817. params['layersID'] = options.layersID;
  67818. }
  67819. if (options.rasterfunction) {
  67820. params['rasterfunction'] = JSON.stringify(options.rasterfunction);
  67821. }
  67822. if (options.clipRegionEnabled && options.clipRegion) {
  67823. params['clipRegionEnabled'] = options.clipRegionEnabled;
  67824. params['clipRegion'] = JSON.stringify(ServerGeometry.fromGeometry(toSuperMapGeometry(options.clipRegion)));
  67825. }
  67826. if (options.overlapDisplayed === false) {
  67827. params['overlapDisplayed'] = false;
  67828. if (options.overlapDisplayedOptions) {
  67829. params['overlapDisplayedOptions'] = me.overlapDisplayedOptions.toString();
  67830. }
  67831. } else {
  67832. params['overlapDisplayed'] = true;
  67833. }
  67834. return params;
  67835. },
  67836. //初始化请求链接
  67837. _requestImage: function(params, bounds) {
  67838. var imageUrl = this.getImageUrl(params);
  67839. this._loadImage(imageUrl, bounds);
  67840. },
  67841. //加载请求图层
  67842. _loadImage: function(url, bounds) {
  67843. if (!this._map) {
  67844. return;
  67845. }
  67846. var image = new external_L_namespaceObject.ImageOverlay(url, bounds, {
  67847. opacity: 0,
  67848. alt: this.options.alt,
  67849. zIndex: this.options.zIndex,
  67850. className: this.options.className,
  67851. errorOverlayUrl: this.options.error,
  67852. crossOrigin: this.options.crossOrigin,
  67853. pane: this.options.pane || this.getPane(),
  67854. interactive: this.options.interactive
  67855. }).addTo(this._map);
  67856. var onLoad = function(e) {
  67857. image.off('error', onLoad, this);
  67858. var map = this._map;
  67859. if (!map) {
  67860. return;
  67861. }
  67862. var newImage = e.target;
  67863. var oldImage = this._currentImage;
  67864. if (newImage._bounds && newImage._bounds.equals(bounds) && newImage._bounds.equals(map.getBounds())) {
  67865. this._currentImage = newImage;
  67866. if (this.options.position === 'front') {
  67867. this.bringToFront();
  67868. }
  67869. if (this.options.position === 'back') {
  67870. this.bringToBack();
  67871. }
  67872. if (this._currentImage._map) {
  67873. this._currentImage.setOpacity(this.options.opacity);
  67874. }
  67875. oldImage && map.removeLayer(oldImage);
  67876. oldImage && oldImage._map && oldImage._map.removeLayer(oldImage);
  67877. } else {
  67878. map.removeLayer(newImage);
  67879. }
  67880. /**
  67881. * @event L.supermap.imageMapLayer#load
  67882. * @description 请求图层加载完成后触发。
  67883. * @property {L.bounds} bounds - 图层 bounds。
  67884. */
  67885. this.fire('load', { bounds: bounds });
  67886. };
  67887. image.once('load', onLoad, this);
  67888. image.once(
  67889. 'error',
  67890. function() {
  67891. this._map.removeLayer(image);
  67892. /**
  67893. * @event L.supermap.imageMapLayer#error
  67894. * @description 请求图层加载失败后触发。
  67895. */
  67896. this.fire('error');
  67897. image.off('load', onLoad, this);
  67898. },
  67899. this
  67900. );
  67901. /**
  67902. * @event L.supermap.imageMapLayer#loading
  67903. * @description 请求图层加载中触发。
  67904. * @property {L.bounds} bounds - 图层 bounds。
  67905. */
  67906. this.fire('loading', { bounds: bounds });
  67907. },
  67908. /**
  67909. * @function L.supermap.imageMapLayer.prototype.update
  67910. * @description 更新图层。
  67911. */
  67912. update: function() {
  67913. if (!this._map) {
  67914. return;
  67915. }
  67916. var zoom = this._map.getZoom();
  67917. var bounds = this._map.getBounds();
  67918. if (zoom > (this._map.options.maxZoom|| 18) || zoom < (this._map.options.minZoom || 0)) {
  67919. if (this._currentImage) {
  67920. this._currentImage._map.removeLayer(this._currentImage);
  67921. this._currentImage = null;
  67922. }
  67923. return;
  67924. }
  67925. var params = this._getImageParams();
  67926. if (params) {
  67927. this._requestImage(params, bounds);
  67928. } else if (this._currentImage) {
  67929. this._currentImage._map.removeLayer(this._currentImage);
  67930. this._currentImage = null;
  67931. }
  67932. },
  67933. //将像素坐标转成点坐标
  67934. _calculateBounds: function() {
  67935. var pixelBounds = this._map.getPixelBounds();
  67936. var sw = this._map.unproject(pixelBounds.getBottomLeft());
  67937. var ne = this._map.unproject(pixelBounds.getTopRight());
  67938. var neProjected = this._map.options.crs.project(ne);
  67939. var swProjected = this._map.options.crs.project(sw);
  67940. return external_L_default().bounds(neProjected, swProjected);
  67941. },
  67942. //转换viewBounds为JSON字符串
  67943. _compriseBounds: function(boundsProjected) {
  67944. var projBounds = {
  67945. leftBottom: {
  67946. x: boundsProjected.getBottomLeft().x,
  67947. y: boundsProjected.getTopRight().y
  67948. },
  67949. rightTop: {
  67950. x: boundsProjected.getTopRight().x,
  67951. y: boundsProjected.getBottomLeft().y
  67952. }
  67953. };
  67954. return JSON.stringify(projBounds);
  67955. },
  67956. //计算图层的宽高
  67957. _calculateImageSize: function() {
  67958. var map = this._map;
  67959. var bounds = map.getPixelBounds();
  67960. var size = map.getSize();
  67961. var sw = map.unproject(bounds.getBottomLeft());
  67962. var ne = map.unproject(bounds.getTopRight());
  67963. var top = map.latLngToLayerPoint(ne).y;
  67964. var bottom = map.latLngToLayerPoint(sw).y;
  67965. if (top > 0 || bottom < size.y) {
  67966. size.y = bottom - top;
  67967. }
  67968. return size;
  67969. },
  67970. //追加token或key
  67971. _appendCredential: function(url) {
  67972. var newUrl = url,
  67973. credential,
  67974. value;
  67975. switch (this.options.serverType) {
  67976. case ServerType.IPORTAL:
  67977. value = SecurityManager.getToken(this._url);
  67978. credential = value ? new Credential(value, 'token') : null;
  67979. if (!credential) {
  67980. value = SecurityManager.getKey(this._url);
  67981. credential = value ? new Credential(value, 'key') : null;
  67982. }
  67983. break;
  67984. case ServerType.ONLINE:
  67985. value = SecurityManager.getKey(this._url);
  67986. credential = value ? new Credential(value, 'key') : null;
  67987. break;
  67988. default:
  67989. //iserver or others
  67990. value = SecurityManager.getToken(this._url);
  67991. credential = value ? new Credential(value, 'token') : null;
  67992. break;
  67993. }
  67994. if (credential) {
  67995. newUrl = Util.urlAppend(newUrl,credential.getUrlParameters());
  67996. }
  67997. return newUrl;
  67998. }
  67999. });
  68000. var imageMapLayer = function(url, options) {
  68001. return new ImageMapLayer(url, options);
  68002. };
  68003. (external_L_default()).supermap.imageMapLayer = imageMapLayer;
  68004. ;// CONCATENATED MODULE: ./src/leaflet/mapping/TileLayer.WMTS.js
  68005. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  68006. * This program are made available under the terms of the Apache License, Version 2.0
  68007. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68008. /**
  68009. * @class L.supermap.wmtsLayer
  68010. * @classdesc wmts 图层类。
  68011. * @category OGC
  68012. * @extends {L.TileLayer}
  68013. * @param {string} url - wmts 图层地址。
  68014. * @param {Object} options - wmts 图层可选参数。
  68015. * @param {string} options.layer - 需要显示的图层。
  68016. * @param {string} [options.tileProxy] - 代理地址。
  68017. * @param {Object} [options.style] - 图层样式。
  68018. * @param {string} [options.format='image/png'] - wmts 图像格式('image/png'用于具有透明度的图层)。
  68019. * @param {(number|L.Point)} [options.tileSize='256'] - 瓦片大小。
  68020. * @param {string} [options.requestEncoding='KVP'] - KVP 或者 REST 的请求方式。
  68021. * @param {string} [options.tilematrixSet] - 瓦片矩阵集。
  68022. * @param {Array.<L.supermap.wmtsLayer.matrix>} [options.matrixIds] - 瓦片矩阵对象。不设置时,默认为获取当前级别为tilematrix参数。
  68023. * @param {string} [options.version='1.0.0'] - 版本。
  68024. * @param {string} [options.attribution] - 版权信息。
  68025. * @param {string} [options.noWrap=true] - 图层是否X方向平铺。
  68026. */
  68027. /**
  68028. * @typedef {Object} L.supermap.wmtsLayer.matrix
  68029. * @description 瓦片矩阵。
  68030. * @property {string} identifier - 瓦片矩阵标识符。
  68031. */
  68032. var WMTSLayer = external_L_default().TileLayer.extend({
  68033. options: {
  68034. version: '1.0.0',
  68035. style: '',
  68036. tilematrixSet: '',
  68037. format: 'image/png',
  68038. tileSize: 256,
  68039. matrixIds: null,
  68040. layer: '',
  68041. requestEncoding: 'KVP',
  68042. attribution: '',
  68043. noWrap: true
  68044. },
  68045. //todo 自动获取Capabilities
  68046. initialize: function (url, options) { // (String, Object)
  68047. this._url = url;
  68048. external_L_default().setOptions(this, options);
  68049. var opt = this.options;
  68050. if (opt.requestEncoding === "REST") {
  68051. var formatSuffixMap = {
  68052. "image/png": "png",
  68053. "image/png8": "png",
  68054. "image/png24": "png",
  68055. "image/png32": "png",
  68056. "png": "png",
  68057. "image/jpeg": "jpg",
  68058. "image/jpg": "jpg",
  68059. "jpeg": "jpg",
  68060. "jpg": "jpg"
  68061. };
  68062. this.formatSuffix = "." + (formatSuffixMap[opt.format] || opt.format.split("/").pop() || "png");
  68063. } else {
  68064. opt.requestEncoding = "KVP";
  68065. }
  68066. },
  68067. /**
  68068. * @function L.supermap.wmtsLayer.prototype.getTileUrl
  68069. * @description 根据行列号获取切片地址。
  68070. * @param {Object} coords - 行列号。
  68071. * @returns {string} 切片地址。
  68072. */
  68073. getTileUrl: function (coords) { // (Point, Number) -> String
  68074. var zoom = this._getZoomForUrl();
  68075. var ident = this.options.matrixIds ? this.options.matrixIds[zoom].identifier : zoom;
  68076. var url = external_L_default().Util.template(this._url, {s: this._getSubdomain(coords)});
  68077. var obj = {
  68078. service: 'WMTS',
  68079. request: 'GetTile',
  68080. version: this.options.version,
  68081. style: this.options.style,
  68082. tilematrixSet: this.options.tilematrixSet,
  68083. format: this.options.format,
  68084. width: this.options.tileSize,
  68085. height: this.options.tileSize,
  68086. layer: this.options.layer,
  68087. tilematrix: ident,
  68088. tilerow: coords.y,
  68089. tilecol: coords.x
  68090. };
  68091. if (this.options.tileProxy) {
  68092. url = this.options.tileProxy + url;
  68093. }
  68094. if (this.options.requestEncoding === 'KVP') {
  68095. url += external_L_default().Util.getParamString(obj, url);
  68096. } else if (this.options.requestEncoding === 'REST') {
  68097. var params = "/" + obj.layer + "/" + obj.style + "/" + obj.tilematrixSet + "/" + obj.tilematrix + "/" + obj.tilerow + "/" + obj.tilecol + this.formatSuffix;
  68098. url += params;
  68099. }
  68100. return url;
  68101. }
  68102. });
  68103. var wmtsLayer = function (url, options) {
  68104. return new WMTSLayer(url, options);
  68105. };
  68106. (external_L_default()).supermap.wmtsLayer = wmtsLayer;
  68107. ;// CONCATENATED MODULE: ./src/leaflet/mapping/TiandituTileLayer.js
  68108. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  68109. * This program are made available under the terms of the Apache License, Version 2.0
  68110. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68111. /**
  68112. * @class L.supermap.tiandituTileLayer
  68113. * @classdesc 天地图图层类。
  68114. * @category ThirdPartyMap
  68115. * @extends L.supermap.wmtsLayer
  68116. * @param {Object} options - 切片图层参数。
  68117. * @param {string} [options.url='https://t{s}.tianditu.gov.cn/{layer}_{proj}/wmts?'] - 地图地址。
  68118. * @param {string} options.key - 天地图服务密钥。详见{@link https://lbs.tianditu.gov.cn/server/MapService.html}
  68119. * @param {string} [options.layerType='vec'] - 图层类型。(vec:矢量图层,img:影像图层,ter:地形图层)
  68120. * @param {string} [options.style='default'] - 图层风格。
  68121. * @param {string} [options.format='tiles'] - 格式。
  68122. * @param {boolean} [options.isLabel=false] - 是否是标注图层。
  68123. * @param {Array.<number>} [options.subdomains=[0, 1, 2, 3, 4, 5, 6, 7]] - 子域名数组。
  68124. * @param {string} [options.attribution='Map Data <a href='https://www.tianditu.gov.cn' target='_blank'><img style='background-color:transparent;bottom:2px;opacity:1;' src='https://api.tianditu.gov.cn/img/map/logo.png' width='53px' height='22px' opacity='0'></a>'] - 版权信息
  68125. * @param {string} [options.noWrap=true] - 图层是否X方向平铺。
  68126. */
  68127. var TiandituTileLayer = WMTSLayer.extend({
  68128. layerLabelMap: {
  68129. vec: 'cva',
  68130. ter: 'cta',
  68131. img: 'cia'
  68132. },
  68133. layerZoomMap: {
  68134. vec: 18,
  68135. ter: 14,
  68136. img: 18
  68137. },
  68138. options: {
  68139. layerType: 'vec', //(vec:矢量图层,vec:矢量标签图层,img:影像图层,cia:影像标签图层,ter:地形,cta:地形标签图层)
  68140. isLabel: false,
  68141. attribution: core_Attributions.Tianditu.attribution,
  68142. url: 'https://t{s}.tianditu.gov.cn/{layer}_{proj}/wmts?',
  68143. zoomOffset: 1,
  68144. key: '',
  68145. dpi: 96,
  68146. style: 'default',
  68147. format: 'tiles',
  68148. subdomains: [0, 1, 2, 3, 4, 5, 6, 7],
  68149. bounds: [
  68150. [-90, -180],
  68151. [90, 180]
  68152. ],
  68153. noWrap: true
  68154. },
  68155. initialize: function (options) {
  68156. options = options || {};
  68157. external_L_default().setOptions(this, options);
  68158. this.options.layer = this.options.isLabel ? this.layerLabelMap[this.options.layerType] : this.options.layerType;
  68159. this.options.maxZoom = this.layerZoomMap[this.options.layerType] - 1;
  68160. WMTSLayer.prototype.initialize.call(this, this.options.url, this.options);
  68161. external_L_default().stamp(this);
  68162. if (this.options.key) {
  68163. this._url = `${this._url}tk=${this.options.key}`;
  68164. }
  68165. },
  68166. onAdd: function (map) {
  68167. this.options.tilematrixSet = map.options.crs.code === "EPSG:4326" ? "c" : "w";
  68168. this._url = this._url.replace("{layer}", this.options.layer).replace("{proj}", this.options.tilematrixSet);
  68169. WMTSLayer.prototype.onAdd.call(this, map);
  68170. },
  68171. _isValidTile: function (coords) {
  68172. const crs = this._map.options.crs;
  68173. if (!crs.infinite) {
  68174. const bounds = this._globalTileRange;
  68175. if (
  68176. ((!crs.wrapLng || this.options.noWrap) && (coords.x < bounds.min.x || coords.x > bounds.max.x)) ||
  68177. (!crs.wrapLat && (coords.y < bounds.min.y || coords.y > bounds.max.y))
  68178. ) {
  68179. return false;
  68180. }
  68181. }
  68182. if (!this.options.bounds) {
  68183. return true;
  68184. }
  68185. const tileBounds = this._tileCoordsToBounds(coords);
  68186. return external_L_default().latLngBounds(this.options.bounds).overlaps(tileBounds);
  68187. }
  68188. });
  68189. var tiandituTileLayer = function (options) {
  68190. return new TiandituTileLayer(options);
  68191. };
  68192. (external_L_default()).supermap.tiandituTileLayer = tiandituTileLayer;
  68193. ;// CONCATENATED MODULE: ./src/leaflet/mapping/TiledMapLayer.js
  68194. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  68195. * This program are made available under the terms of the Apache License, Version 2.0
  68196. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68197. /**
  68198. * @class L.supermap.tiledMapLayer
  68199. * @classdesc SuperMap iServer 的 REST 地图服务的图层(SuperMap iServer Java 6R 及以上分块动态 REST 图层)。使用 TileImage 资源出图。
  68200. * @category iServer Map
  68201. * @extends {L.TileLayer}
  68202. * @example
  68203. * L.supermap.tiledMapLayer(url).addTo(map);
  68204. * @param {string} url - 地图服务地址,例如: http://{ip}:{port}/iserver/services/map-world/rest/maps/World。
  68205. * @param {Object} options - 参数。
  68206. * @param {string} [options.layersID] - 获取进行切片的地图图层 ID,即指定进行地图切片的图层,可以是临时图层集,也可以是当前地图中图层的组合
  68207. * @param {boolean} [options.redirect=false] - 是否重定向,如果为 true,则将请求重定向到瓦片的真实地址;如果为 false,则响应体中是瓦片的字节流。
  68208. * @param {boolean} [options.transparent=true] - 是否背景透明。
  68209. * @param {boolean} [options.cacheEnabled=true] - 启用缓存。
  68210. * @param {boolean} [options.clipRegionEnabled=false] - 是否启用地图裁剪。
  68211. * @param {L.Path} [options.clipRegion] - 地图显示裁剪的区域。是一个面对象,当 clipRegionEnabled = true 时有效,即地图只显示该区域覆盖的部分。
  68212. * @param {Object} [options.prjCoordSys] - 请求的地图的坐标参考系统。 如:prjCoordSys={"epsgCode":3857}。
  68213. * @param {boolean} [options.overlapDisplayed=false] - 地图对象在同一范围内时,是否重叠显示。
  68214. * @param {string} [options.overlapDisplayedOptions] - 避免地图对象压盖显示的过滤选项。
  68215. * @param {string} [options.tileversion] - 切片版本名称,cacheEnabled 为 true 时有效。如果没有设置 tileversion 参数,而且当前地图的切片集中存在多个版本,则默认使用最后一个更新版本。
  68216. * @param {L.Proj.CRS} [options.crs] - 坐标系统类。
  68217. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  68218. * @param {string} [options.tileProxy] - 代理地址。
  68219. * @param {string} [options.format='png'] - 瓦片表述类型,支持 "png" 、"webp"、"bmp" 、"jpg"、 "gif" 等图片格式。
  68220. * @param {(number|L.Point)} [options.tileSize=256] - 瓦片大小。
  68221. * @param {(SuperMap.NDVIParameter|SuperMap.HillshadeParameter)} [options.rasterfunction] - 栅格分析参数。
  68222. * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权信息。
  68223. * @param {Array.<number>} [options.subdomains] - 子域名数组。
  68224. * @fires L.supermap.tiledMapLayer#tilesetsinfoloaded
  68225. * @fires L.supermap.tiledMapLayer#tileversionschanged
  68226. */
  68227. var TiledMapLayer = external_L_default().TileLayer.extend({
  68228. options: {
  68229. //如果有layersID,则是在使用专题图
  68230. layersID: null,
  68231. //如果为 true,则将请求重定向到瓦片的真实地址;如果为 false,则响应体中是瓦片的字节流
  68232. redirect: false,
  68233. transparent: true,
  68234. cacheEnabled: true,
  68235. clipRegionEnabled: false,
  68236. //地图显示裁剪的区域
  68237. clipRegion: null,
  68238. //请求的地图的坐标参考系统。 如:prjCoordSys={"epsgCode":3857}
  68239. prjCoordSys: null,
  68240. //地图对象在同一范围内时,是否重叠显示
  68241. overlapDisplayed: false,
  68242. //避免地图对象压盖显示的过滤选项
  68243. overlapDisplayedOptions: null,
  68244. //切片版本名称,cacheEnabled 为 true 时有效。
  68245. tileversion: null,
  68246. crs: null,
  68247. serverType: ServerType.ISERVER,
  68248. format: 'png',
  68249. //启用托管地址。
  68250. tileProxy:null,
  68251. attribution: core_Attributions.Common.attribution,
  68252. subdomains: null
  68253. },
  68254. initialize: function (url, options) {
  68255. this._url = url;
  68256. external_L_default().TileLayer.prototype.initialize.apply(this, arguments);
  68257. external_L_default().setOptions(this, options);
  68258. external_L_default().stamp(this);
  68259. //当前切片在切片集中的index
  68260. this.tileSetsIndex = -1;
  68261. this.tempIndex = -1;
  68262. },
  68263. /**
  68264. * @private
  68265. * @function L.supermap.tiledMapLayer.prototype.onAdd
  68266. * @description 添加地图。
  68267. * @param {L.Map} map - 待添加的影像地图参数。
  68268. */
  68269. onAdd: function (map) {
  68270. this._crs = this.options.crs || map.options.crs;
  68271. external_L_default().TileLayer.prototype.onAdd.call(this, map);
  68272. },
  68273. /**
  68274. * @function L.supermap.tiledMapLayer.prototype.getTileUrl
  68275. * @description 根据行列号获取瓦片地址。
  68276. * @param {Object} coords - 行列号。
  68277. * @returns {string} 瓦片地址。
  68278. */
  68279. getTileUrl: function (coords) {
  68280. var scale = this.getScaleFromCoords(coords);
  68281. var layerUrl = this._getLayerUrl();
  68282. var tileUrl = layerUrl + "&scale=" + scale + "&x=" + coords.x + "&y=" + coords.y;
  68283. //支持代理
  68284. if (this.options.tileProxy) {
  68285. tileUrl = this.options.tileProxy + encodeURIComponent(tileUrl);
  68286. }
  68287. if (!this.options.cacheEnabled) {
  68288. tileUrl += "&_t=" + new Date().getTime();
  68289. }
  68290. if (this.options.subdomains) {
  68291. tileUrl = external_L_default().Util.template(tileUrl, {s: this._getSubdomain(coords)});
  68292. }
  68293. return tileUrl;
  68294. },
  68295. /**
  68296. * @function L.supermap.tiledMapLayer.prototype.getScale
  68297. * @description 根据缩放级别获取比例尺。
  68298. * @param {number} zoom - 缩放级别。
  68299. * @returns {number} 比例尺。
  68300. */
  68301. getScale: function (zoom) {
  68302. var me = this;
  68303. //返回当前比例尺
  68304. var z = zoom || me._map.getZoom();
  68305. return me.scales[z];
  68306. },
  68307. /**
  68308. * @function L.supermap.tiledMapLayer.prototype.getScaleFromCoords
  68309. * @description 通过行列号获取比例尺。
  68310. * @param {Object} coords - 行列号。
  68311. * @returns {number} 比例尺。
  68312. */
  68313. getScaleFromCoords: function (coords) {
  68314. var me = this,
  68315. scale;
  68316. if (me.scales && me.scales[coords.z]) {
  68317. return me.scales[coords.z];
  68318. }
  68319. me.scales = me.scales || {};
  68320. scale = me.getDefaultScale(coords);
  68321. me.scales[coords.z] = scale;
  68322. return scale;
  68323. },
  68324. /**
  68325. * @private
  68326. * @function L.supermap.tiledMapLayer.prototype.getDefaultScale
  68327. * @description 获取默认比例尺信息。
  68328. * @param {Object} coords - 坐标对象参数。
  68329. */
  68330. getDefaultScale: function (coords) {
  68331. var me = this,
  68332. crs = me._crs;
  68333. if (crs.scales) {
  68334. return crs.scales[coords.z];
  68335. } else {
  68336. var tileBounds = me._tileCoordsToBounds(coords);
  68337. var ne = crs.project(tileBounds.getNorthEast());
  68338. var sw = crs.project(tileBounds.getSouthWest());
  68339. var tileSize = me.options.tileSize;
  68340. var resolution = Math.max(
  68341. Math.abs(ne.x - sw.x) / tileSize,
  68342. Math.abs(ne.y - sw.y) / tileSize
  68343. );
  68344. var mapUnit = Unit.METER;
  68345. if (crs.code) {
  68346. var array = crs.code.split(':');
  68347. if (array && array.length > 1) {
  68348. var code = parseInt(array[1]);
  68349. mapUnit = code && code >= 4000 && code <= 5000 ? Unit.DEGREE : Unit.METER;
  68350. }
  68351. }
  68352. return resolutionToScale(resolution, 96, mapUnit);
  68353. }
  68354. },
  68355. /**
  68356. * @function L.supermap.tiledMapLayer.prototype.setTileSetsInfo
  68357. * @description 设置瓦片集信息。
  68358. * @param {Object} tileSets - 瓦片对象集。
  68359. */
  68360. setTileSetsInfo: function (tileSets) {
  68361. this.tileSets = tileSets;
  68362. if (external_L_default().Util.isArray(this.tileSets)) {
  68363. this.tileSets = this.tileSets[0];
  68364. }
  68365. if (!this.tileSets) {
  68366. return;
  68367. }
  68368. /**
  68369. * @event L.supermap.tiledMapLayer#tilesetsinfoloaded
  68370. * @description 瓦片集信息设置完成后触发。
  68371. * @property {Array.<Object>} tileVersions - 瓦片集信息。
  68372. */
  68373. this.fire('tilesetsinfoloaded', {
  68374. tileVersions: this.tileSets.tileVersions
  68375. });
  68376. this.changeTilesVersion();
  68377. },
  68378. /**
  68379. * @function L.supermap.tiledMapLayer.prototype.lastTilesVersion
  68380. * @description 请求上一个版本切片,并重新绘制。
  68381. */
  68382. lastTilesVersion: function () {
  68383. this.tempIndex = this.tileSetsIndex - 1;
  68384. this.changeTilesVersion();
  68385. },
  68386. /**
  68387. * @function L.supermap.tiledMapLayer.prototype.nextTilesVersion
  68388. * @description 请求下一个版本切片,并重新绘制。
  68389. */
  68390. nextTilesVersion: function () {
  68391. this.tempIndex = this.tileSetsIndex + 1;
  68392. this.changeTilesVersion();
  68393. },
  68394. /**
  68395. * @function L.supermap.tiledMapLayer.prototype.changeTilesVersion
  68396. * @description 切换到某一版本的切片,并重绘。通过 this.tempIndex 保存需要切换的版本索引
  68397. */
  68398. changeTilesVersion: function () {
  68399. var me = this;
  68400. //切片版本集信息是否存在
  68401. if (me.tileSets == null) {
  68402. //版本信息为空,重新查询,查询成功继续跳转到相应的版本
  68403. //me.getTileSetsInfo();
  68404. return;
  68405. }
  68406. if (me.tempIndex === me.tileSetsIndex || this.tempIndex < 0) {
  68407. return;
  68408. }
  68409. //检测index是否可用
  68410. var tileVersions = me.tileSets.tileVersions;
  68411. if (tileVersions && me.tempIndex < tileVersions.length && me.tempIndex >= 0) {
  68412. var name = tileVersions[me.tempIndex].name;
  68413. var result = me.mergeTileVersionParam(name);
  68414. if (result) {
  68415. me.tileSetsIndex = me.tempIndex;
  68416. /**
  68417. * @event L.supermap.tiledMapLayer#tileversionschanged
  68418. * @description 切片的版本切换和重绘成功之后触发。
  68419. * @property {Object} tileVersion - 该版本的切片。
  68420. */
  68421. me.fire('tileversionschanged', {
  68422. tileVersion: tileVersions[me.tempIndex]
  68423. });
  68424. }
  68425. }
  68426. },
  68427. /**
  68428. * @function L.supermap.tiledMapLayer.prototype.updateCurrentTileSetsIndex
  68429. * @description 手动设置当前切片集索引,目前主要提供给控件使用。
  68430. * @param {number} index - 索引值。
  68431. */
  68432. updateCurrentTileSetsIndex: function (index) {
  68433. this.tempIndex = index;
  68434. },
  68435. /**
  68436. * @function L.supermap.tiledMapLayer.prototype.mergeTileVersionParam
  68437. * @description 更改URL请求参数中的切片版本号,并重绘。
  68438. * @param {string} version - 切片版本号。
  68439. * @returns {boolean} 是否成功。
  68440. */
  68441. mergeTileVersionParam: function (version) {
  68442. if (version) {
  68443. this.requestParams["tileversion"] = version;
  68444. this._paramsChanged = true;
  68445. this.redraw();
  68446. this._paramsChanged = false;
  68447. return true;
  68448. }
  68449. return false;
  68450. },
  68451. _getLayerUrl: function () {
  68452. if (this._paramsChanged) {
  68453. this._layerUrl = this._createLayerUrl();
  68454. }
  68455. return this._layerUrl || this._createLayerUrl();
  68456. },
  68457. _createLayerUrl: function () {
  68458. let layerUrl = Util.urlPathAppend(this._url, `tileImage.${this.options.format}`);
  68459. this.requestParams = this.requestParams || this._getAllRequestParams();
  68460. layerUrl = Util.urlAppend(layerUrl, external_L_namespaceObject.Util.getParamString(this.requestParams));
  68461. layerUrl = this._appendCredential(layerUrl);
  68462. this._layerUrl = layerUrl;
  68463. return layerUrl;
  68464. },
  68465. _getAllRequestParams: function () {
  68466. var me = this,
  68467. options = me.options || {},
  68468. params = {};
  68469. var tileSize = this.options.tileSize;
  68470. if (!(tileSize instanceof (external_L_default()).Point)) {
  68471. tileSize = external_L_default().point(tileSize, tileSize);
  68472. }
  68473. params["width"] = tileSize.x;
  68474. params["height"] = tileSize.y;
  68475. params["redirect"] = options.redirect === true;
  68476. params["transparent"] = options.transparent === true;
  68477. params["cacheEnabled"] = !(options.cacheEnabled === false);
  68478. if (options.prjCoordSys) {
  68479. params["prjCoordSys"] = JSON.stringify(options.prjCoordSys);
  68480. }
  68481. if (options.layersID) {
  68482. params["layersID"] = options.layersID.toString();
  68483. }
  68484. if (options.clipRegionEnabled && options.clipRegion) {
  68485. options.clipRegion = ServerGeometry.fromGeometry(toSuperMapGeometry(options.clipRegion));
  68486. params["clipRegionEnabled"] = options.clipRegionEnabled;
  68487. params["clipRegion"] = JSON.stringify(options.clipRegion);
  68488. }
  68489. //切片的起始参考点,默认为地图范围的左上角。
  68490. var crs = me._crs;
  68491. if (crs.options && crs.options.origin) {
  68492. params["origin"] = JSON.stringify({
  68493. x: crs.options.origin[0],
  68494. y: crs.options.origin[1]
  68495. });
  68496. } else if (crs.projection && crs.projection.bounds) {
  68497. var bounds = crs.projection.bounds;
  68498. var tileOrigin = external_L_default().point(bounds.min.x, bounds.max.y);
  68499. params["origin"] = JSON.stringify({
  68500. x: tileOrigin.x,
  68501. y: tileOrigin.y
  68502. });
  68503. }
  68504. if (options.overlapDisplayed === false) {
  68505. params["overlapDisplayed"] = false;
  68506. if (options.overlapDisplayedOptions) {
  68507. params["overlapDisplayedOptions"] = me.overlapDisplayedOptions.toString();
  68508. }
  68509. } else {
  68510. params["overlapDisplayed"] = true;
  68511. }
  68512. if (params.cacheEnabled === true && options.tileversion) {
  68513. params["tileversion"] = options.tileversion.toString();
  68514. }
  68515. if (options.rasterfunction) {
  68516. params["rasterfunction"] = JSON.stringify(options.rasterfunction);
  68517. }
  68518. return params;
  68519. },
  68520. //追加token或key
  68521. _appendCredential: function (url) {
  68522. var newUrl = url,
  68523. credential, value;
  68524. switch (this.options.serverType) {
  68525. case ServerType.IPORTAL:
  68526. value = SecurityManager.getToken(this._url);
  68527. credential = value ? new Credential(value, "token") : null;
  68528. if (!credential) {
  68529. value = SecurityManager.getKey(this._url);
  68530. credential = value ? new Credential(value, "key") : null;
  68531. }
  68532. break;
  68533. case ServerType.ONLINE:
  68534. value = SecurityManager.getKey(this._url);
  68535. credential = value ? new Credential(value, "key") : null;
  68536. break;
  68537. default:
  68538. //iserver or others
  68539. value = SecurityManager.getToken(this._url);
  68540. credential = value ? new Credential(value, "token") : null;
  68541. break;
  68542. }
  68543. if (credential) {
  68544. newUrl = Util.urlAppend(newUrl,credential.getUrlParameters());
  68545. }
  68546. return newUrl;
  68547. }
  68548. });
  68549. var tiledMapLayer = function (url, options) {
  68550. return new TiledMapLayer(url, options);
  68551. };
  68552. (external_L_default()).supermap.tiledMapLayer = tiledMapLayer;
  68553. // EXTERNAL MODULE: ./node_modules/jsonsql/index.js
  68554. var jsonsql = __webpack_require__(545);
  68555. var jsonsql_default = /*#__PURE__*/__webpack_require__.n(jsonsql);
  68556. ;// CONCATENATED MODULE: ./src/leaflet/overlay/carto/CartoDefaultStyle.js
  68557. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  68558. * This program are made available under the terms of the Apache License, Version 2.0
  68559. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68560. /**
  68561. * @constant L.supermap.DefaultStyle
  68562. * @description 这个 style 对应的是默认设置。
  68563. * @category BaseTypes Style
  68564. * @private
  68565. */
  68566. var DefaultStyle = {
  68567. /**
  68568. * @constant L.supermap.DefaultStyle.prototype.TEXT
  68569. * @description 默认文本样式。
  68570. */
  68571. "TEXT": {
  68572. fontSize: "14px",
  68573. fontFamily: "Arial Unicode MS Regular,Microsoft YaHei",
  68574. textAlign: "left",
  68575. color: "rgba(255,255,255,0)",
  68576. fillColor: "rgba(80,80,80,1)",
  68577. weight: 1,
  68578. globalAlpha: 1
  68579. },
  68580. /**
  68581. * @constant L.supermap.DefaultStyle.prototype.POINT
  68582. * @description 默认点样式。
  68583. */
  68584. "POINT": {
  68585. fillColor: "#ffcc00",
  68586. color: "#cc3333",
  68587. weight: 1,
  68588. radius: 3,
  68589. opacity: 1
  68590. },
  68591. /**
  68592. * @constant L.supermap.DefaultStyle.prototype.LINE
  68593. * @description 默认线样式。
  68594. */
  68595. "LINE": {
  68596. color: "rgba(0,0,0,0)",
  68597. weight: 1,
  68598. lineCap: "butt",
  68599. lineJoin: "round",
  68600. dashOffset: 0,
  68601. dashArray: [],
  68602. opacity: 1
  68603. },
  68604. /**
  68605. * @constant L.supermap.DefaultStyle.prototype.REGION
  68606. * @description 默认多边形样式。
  68607. */
  68608. "REGION": {
  68609. color: "rgba(0,0,0,0)",
  68610. fillColor: "rgba(0,0,0,0)",
  68611. weight: 1,
  68612. lineCap: "butt",
  68613. lineJoin: "round",
  68614. dashOffset: 0,
  68615. opacity: 1,
  68616. fillOpacity: 1,
  68617. dashArray: []
  68618. }
  68619. };
  68620. (external_L_default()).supermap.DefaultStyle = DefaultStyle
  68621. ;// CONCATENATED MODULE: ./src/leaflet/overlay/carto/CartoStyleMap.js
  68622. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  68623. * This program are made available under the terms of the Apache License, Version 2.0
  68624. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68625. /**
  68626. * @constant L.supermap.CartoStyleMap
  68627. * @description CartoCSS 中的 style 属性名与 leaflet 的 style 属性名的对应表。
  68628. * @category BaseTypes Style
  68629. * @private
  68630. */
  68631. var CartoStyleMap = {
  68632. /*
  68633. * @constant L.supermap.CartoStyleMap.prototype.TEXT
  68634. * @description 默认文本样式。
  68635. */
  68636. "TEXT": {
  68637. "text-size": "fontSize",
  68638. "text-face-name": "fontFamily",
  68639. "text-align": "textAlign",
  68640. "text-name": "textName",
  68641. 'text-weight': 'fontWeight',
  68642. "text-halo-color": "color",
  68643. "text-fill": "fillColor",
  68644. "text-comp-op": "globalCompositeOperation"
  68645. },
  68646. /*
  68647. * @constant L.supermap.CartoStyleMap.prototype.POINT
  68648. * @description 默认点样式。
  68649. */
  68650. "POINT": {
  68651. "point-file": "iconUrl",
  68652. "point-fill": "fillColor",
  68653. "point-radius": "radius",
  68654. "point-halo-color": "color",
  68655. "point-comp-op": "globalCompositeOperation"
  68656. },
  68657. /*
  68658. * @constant L.supermap.CartoStyleMap.prototype.LINE
  68659. * @description 默认线样式。
  68660. */
  68661. "LINE": {
  68662. "line-color": "color",
  68663. "line-width": "weight",
  68664. "line-cap": "lineCap",
  68665. "line-join": "lineJoin",
  68666. "line-dash-offset": "dashOffset",
  68667. "line-opacity": "opacity",
  68668. "line-dasharray": "dashArray",
  68669. "line-comp-op": "globalCompositeOperation"
  68670. },
  68671. /*
  68672. * @constant L.supermap.CartoStyleMap.prototype.REGION
  68673. * @description 默认多边形样式。
  68674. */
  68675. "REGION": {
  68676. "line-color": "color",
  68677. "line-width": "weight",
  68678. "line-cap": "lineCap",
  68679. "line-join": "lineJoin",
  68680. "line-dash-offset": "dashOffset",
  68681. "line-opacity": "opacity",
  68682. "line-dasharray": "dashArray",
  68683. "polygon-fill": "fillColor",
  68684. "polygon-opacity": "fillOpacity",
  68685. "polygon-comp-op": "globalCompositeOperation"
  68686. }
  68687. };
  68688. /**
  68689. * @constant L.supermap.ServerStyleMap
  68690. * @description 服务端传过来的 style 属性名与 leaflet 的 style 属性名的对应表。
  68691. * @private
  68692. */
  68693. var ServerStyleMap = {
  68694. /**
  68695. * @member L.supermap.ServerStyleMap.prototype.lineWidth
  68696. * @description 线宽。
  68697. */
  68698. lineWidth: {
  68699. leafletStyle: "weight",
  68700. type: "number",
  68701. unit: "mm",
  68702. defaultValue: 0.1
  68703. },
  68704. /**
  68705. * @member L.supermap.ServerStyleMap.prototype.fillForeColor
  68706. * @description 填充前景色。
  68707. */
  68708. fillForeColor: {
  68709. leafletStyle: "fillColor",
  68710. type: "color",
  68711. defaultValue: "rgba(0,0,0,0)"
  68712. },
  68713. /**
  68714. * @member L.supermap.ServerStyleMap.prototype.foreColor
  68715. * @description 前景色。
  68716. */
  68717. foreColor: {
  68718. leafletStyle: "color",
  68719. type: "color",
  68720. defaultValue: "rgba(0,0,0,0)"
  68721. },
  68722. /**
  68723. * @member L.supermap.ServerStyleMap.prototype.markerSize
  68724. * @description 图标大小。
  68725. */
  68726. markerSize: {
  68727. leafletStyle: "markerSize",
  68728. type: "number",
  68729. unit: "mm",
  68730. defaultValue: 2.4
  68731. },
  68732. /**
  68733. * @member L.supermap.ServerStyleMap.prototype.lineColor
  68734. * @description 线要素颜色。
  68735. */
  68736. lineColor: {
  68737. leafletStyle: "color",
  68738. type: "color",
  68739. defaultValue: "#000000"
  68740. }
  68741. };
  68742. /**
  68743. * @constant L.supermap.CompOpMap
  68744. * @description Canvas 中的 globalCompositeOperation 属性值与 CartoCSS 中的 CompOp 属性值对照表。
  68745. * @private
  68746. */
  68747. var CompOpMap = {
  68748. "clear": "",
  68749. "src": "",
  68750. "dst": "",
  68751. "src-over": "source-over",
  68752. "dst-over": "destination-over",
  68753. "src-in": "source-in",
  68754. "dst-in": "destination-in",
  68755. "src-out": "source-out",
  68756. "dst-out": "destination-out",
  68757. "src-atop": "source-atop",
  68758. "dst-atop": "destination-atop",
  68759. "xor": "xor",
  68760. "plus": "lighter",
  68761. "minus": "",
  68762. "multiply": "",
  68763. "screen": "",
  68764. "overlay": "",
  68765. "darken": "",
  68766. "lighten": "lighter",
  68767. "color-dodge": "",
  68768. "color-burn": "",
  68769. "hard-light": "",
  68770. "soft-light": "",
  68771. "difference": "",
  68772. "exclusion": "",
  68773. "contrast": "",
  68774. "invert": "",
  68775. "invert-rgb": "",
  68776. "grain-merge": "",
  68777. "grain-extract": "",
  68778. "hue": "",
  68779. "saturation": "",
  68780. "color": "",
  68781. "value": ""
  68782. };
  68783. (external_L_default()).supermap.CartoStyleMap = CartoStyleMap;
  68784. (external_L_default()).supermap.ServerStyleMap = ServerStyleMap;
  68785. (external_L_default()).supermap.CompOpMap = CompOpMap;
  68786. ;// CONCATENATED MODULE: ./src/leaflet/overlay/carto/CartoCSSToLeaflet.js
  68787. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  68788. * This program are made available under the terms of the Apache License, Version 2.0
  68789. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  68790. /**
  68791. * @class L.supermap.CartoCSSToLeaflet
  68792. * @classdesc CartoCSS 样式转 Leaflet 样式类。
  68793. * @category BaseTypes Style
  68794. * @param {string} url - 地图服务地址。
  68795. * @private
  68796. */
  68797. class CartoCSSToLeaflet {
  68798. constructor(url) {
  68799. /**
  68800. * @member L.supermap.CartoCSSToLeaflet.prototype.cartoCSS
  68801. * @description CartoCSS 样式。
  68802. */
  68803. this.cartoCSS = null;
  68804. /**
  68805. * @member L.supermap.CartoCSSToLeaflet.prototype.mapUrl
  68806. * @description 地图服务地址。
  68807. */
  68808. this.mapUrl = url;
  68809. }
  68810. /**
  68811. * @function L.supermap.CartoCSSToLeaflet.prototype.pretreatedCartoCSS
  68812. * @description CartoCSS 样式预处理。
  68813. * @param {string} cartoStr - Carto 信息。
  68814. * @param {Object} processCharacters - 需要处理的特征对象。
  68815. */
  68816. pretreatedCartoCSS(cartoStr, processCharacters) {
  68817. if (processCharacters) {
  68818. cartoStr = this.processCharacters(cartoStr);
  68819. }
  68820. this.cartoCSS = this.cartoCSS || {};
  68821. var shaders = new CartoCSS(cartoStr).getShaders();
  68822. if (!shaders) {
  68823. return;
  68824. }
  68825. for (var i = 0; i < shaders.length; i++) {
  68826. var element = shaders[i].elements[0];
  68827. var attachment = shaders[i].attachment;
  68828. this.cartoCSS[element.clean] = this.cartoCSS[element.clean] || {};
  68829. this.cartoCSS[element.clean][attachment] = this.cartoCSS[element.clean][attachment] || [];
  68830. this.cartoCSS[element.clean][attachment].push(shaders[i]);
  68831. }
  68832. }
  68833. /**
  68834. * @function L.supermap.CartoCSSToLeaflet.prototype.processCharacters
  68835. * @description 替换一些关键符号。
  68836. * @param {string} cartoCSSStr - cartoCSSS信息。
  68837. */
  68838. processCharacters(cartoCSSStr) {
  68839. var style = cartoCSSStr;
  68840. if (!style) {
  68841. return;
  68842. }
  68843. var me = this;
  68844. style = style.replace(/[@]/gi, "___");
  68845. style = style.replace(/\\#/gi, "\#");
  68846. var cachedLayer = {};
  68847. me.layersInfo && Object.keys(me.layersInfo).sort().forEach(function (attr) {
  68848. var newAttr = attr.replace(/[@#\s]/gi, "___");
  68849. var to = attr;
  68850. var keys = Object.keys(cachedLayer);
  68851. for (let index = keys.length; index > -1; index--) {
  68852. if (attr.indexOf(keys[index]) > -1) {
  68853. to = attr.replace(keys[index], cachedLayer[keys[index]]);
  68854. break;
  68855. }
  68856. }
  68857. to = to.replace(/[#]/gi, "\#");
  68858. cachedLayer[attr] = newAttr;
  68859. style = style.replace(new RegExp(to, "g"), newAttr);
  68860. })
  68861. style = style.replace(/[#]/gi, "\n#");
  68862. //将zoom转化为scale,以免引起混淆
  68863. style = style.replace(/\[zoom/gi, "[scale");
  68864. return style;
  68865. }
  68866. /**
  68867. * @function L.supermap.CartoCSSToLeaflet.prototype.pickShader
  68868. * @description 拾取着色对象。
  68869. * @param {string} layerName - 图层名称。
  68870. */
  68871. pickShader(layerName) {
  68872. if (!this.cartoCSS) {
  68873. return null;
  68874. }
  68875. var name = layerName.replace(/[@#\s]/gi, "___");
  68876. return this.cartoCSS[name];
  68877. }
  68878. /**
  68879. * @function L.supermap.CartoCSSToLeaflet.prototype.getDefaultStyle
  68880. * @description 获取默认风格。
  68881. * @param {string} type - 默认风格类型。
  68882. */
  68883. getDefaultStyle(type) {
  68884. var style = {};
  68885. //设置默认值
  68886. var expandStyle = DefaultStyle[type];
  68887. for (var prop in expandStyle) {
  68888. var val = expandStyle[prop];
  68889. style[prop] = val;
  68890. }
  68891. return style;
  68892. }
  68893. /**
  68894. * @function L.supermap.CartoCSSToLeaflet.prototype.getStyleFromiPortalMarker
  68895. * @description 从 iPortalMarker 中获取样式。
  68896. * @param {string} icon - iPortal 图标。
  68897. */
  68898. getStyleFromiPortalMarker(icon) {
  68899. if (icon.indexOf("./") == 0) {
  68900. return null;
  68901. }
  68902. //兼容iportal示例的问题
  68903. if (icon.indexOf("http://support.supermap.com.cn:8092/static/portal") == 0) {
  68904. icon = icon.replace("http://support.supermap.com.cn:8092/static/portal", "http://support.supermap.com.cn:8092/apps/viewer/static");
  68905. }
  68906. return external_L_default().icon({
  68907. iconUrl: icon,
  68908. iconSize: external_L_default().point(48, 43),
  68909. iconAnchor: external_L_default().point(24, 43),
  68910. popupAnchor: external_L_default().point(0, -43)
  68911. });
  68912. }
  68913. /**
  68914. * @function L.supermap.CartoCSSToLeaflet.prototype.getStyleFromiPortalStyle
  68915. * @description 从 iPortal 的风格中获取样式。
  68916. * @param {Object} iPortalStyle - iPortal 的样式对象。
  68917. * @param {string} type - 样式类型。
  68918. * @param {Object} [fStyle] - 图标参数。
  68919. */
  68920. getStyleFromiPortalStyle(iPortalStyle, type, fStyle) {
  68921. var featureStyle = fStyle ? JSON.parse(fStyle) : null;
  68922. var style = {};
  68923. if (type === 'Point' || type === 'MultiPoint') {
  68924. var pointStyle = featureStyle || iPortalStyle.pointStyle;
  68925. if (pointStyle.externalGraphic) {
  68926. if (pointStyle.externalGraphic.indexOf("./") == 0) {
  68927. return null;
  68928. }
  68929. //兼容iportal示例的问题
  68930. if (pointStyle.externalGraphic.indexOf("http://support.supermap.com.cn:8092/static/portal") == 0) {
  68931. pointStyle.externalGraphic = pointStyle.externalGraphic.replace("http://support.supermap.com.cn:8092/static/portal", "http://support.supermap.com.cn:8092/apps/viewer/static");
  68932. }
  68933. return external_L_default().icon({
  68934. iconUrl: pointStyle.externalGraphic,
  68935. iconSize: external_L_default().point(pointStyle.graphicWidth, pointStyle.graphicHeight),
  68936. iconAnchor: external_L_default().point(-pointStyle.graphicXOffset, -pointStyle.graphicYOffset),
  68937. popupAnchor: external_L_default().point(0, -pointStyle.graphicHeight)
  68938. });
  68939. }
  68940. style.radius = pointStyle.pointRadius;
  68941. style.color = pointStyle.strokeColor;
  68942. style.opacity = pointStyle.strokeOpacity;
  68943. style.lineCap = pointStyle.strokeLineCap;
  68944. style.weight = pointStyle.strokeWidth;
  68945. style.fillColor = pointStyle.fillColor;
  68946. style.fillOpacity = pointStyle.fillOpacity;
  68947. style.dashArray = this.dashStyle(pointStyle, 1);
  68948. return style;
  68949. }
  68950. if (type === 'LineString' || type === 'MultiLineString' || type === 'Box') {
  68951. var lineStyle = featureStyle || iPortalStyle.lineStyle;
  68952. style.color = lineStyle.strokeColor;
  68953. style.opacity = lineStyle.strokeOpacity;
  68954. style.fillOpacity = lineStyle.fillOpacity;
  68955. style.lineCap = lineStyle.strokeLineCap;
  68956. style.weight = lineStyle.strokeWidth;
  68957. style.dashArray = this.dashStyle(lineStyle, 1);
  68958. return style;
  68959. }
  68960. if (type === 'Polygon' || type === 'MultiPolygon') {
  68961. var polygonStyle = featureStyle || iPortalStyle.polygonStyle;
  68962. style.color = polygonStyle.strokeColor;
  68963. style.opacity = polygonStyle.strokeOpacity;
  68964. style.lineCap = polygonStyle.strokeLineCap;
  68965. style.weight = polygonStyle.strokeWidth;
  68966. style.fillColor = polygonStyle.fillColor;
  68967. style.fillOpacity = polygonStyle.fillOpacity;
  68968. style.dashArray = this.dashStyle(polygonStyle, 1);
  68969. return style;
  68970. }
  68971. }
  68972. /**
  68973. * @function L.supermap.CartoCSSToLeaflet.prototype.dashStyle
  68974. * @description 符号样式。
  68975. * @param {Object} style - 样式参数。
  68976. * @param {number} widthFactor - 宽度系数。
  68977. */
  68978. dashStyle(style, widthFactor) {
  68979. if (!style) {
  68980. return [];
  68981. }
  68982. var w = style.strokeWidth * widthFactor;
  68983. var str = style.strokeDashstyle;
  68984. switch (str) {
  68985. case 'solid':
  68986. return [];
  68987. case 'dot':
  68988. return [1, 4 * w];
  68989. case 'dash':
  68990. return [4 * w, 4 * w];
  68991. case 'dashdot':
  68992. return [4 * w, 4 * w, 1, 4 * w];
  68993. case 'longdash':
  68994. return [8 * w, 4 * w];
  68995. case 'longdashdot':
  68996. return [8 * w, 4 * w, 1, 4 * w];
  68997. default:
  68998. if (!str) {
  68999. return [];
  69000. }
  69001. if (Util.isArray(str)) {
  69002. return str;
  69003. }
  69004. str = StringExt.trim(str).replace(/\s+/g, ",");
  69005. return str.replace(/\[|\]/gi, "").split(",");
  69006. }
  69007. }
  69008. /**
  69009. * @function L.supermap.CartoCSSToLeaflet.prototype.getValidStyleFromCarto
  69010. * @description 从 Carto 中获取有效的样式。
  69011. * @param {number} zoom - 缩放级别。
  69012. * @param {number} scale - 比例尺。
  69013. * @param {Array.<Object>} shader - 渲染器对象数组。
  69014. * @param {Object} feature - 要素。
  69015. * @param {string} [fromServer] - 服务源。
  69016. */
  69017. getValidStyleFromCarto(zoom, scale, shader, feature, fromServer) {
  69018. if (!shader) {
  69019. return null;
  69020. }
  69021. var type = feature.type,
  69022. attributes = feature.properties.attributes || {},
  69023. style = this.getDefaultStyle(type);
  69024. fromServer = (fromServer === undefined) ? true : fromServer;
  69025. attributes.FEATUREID = feature.properties.id;
  69026. attributes.SCALE = scale;
  69027. var cartoStyleMap = CartoStyleMap[type];
  69028. var fontSize, fontName;
  69029. for (var i = 0, len = shader.length; i < len; i++) {
  69030. var _shader = shader[i];
  69031. var prop = cartoStyleMap[_shader.property];
  69032. var value = _shader.getValue(attributes, zoom, true);
  69033. if ((value !== null) && prop) {
  69034. if (prop === "fontSize") {
  69035. if (fromServer) {
  69036. value *= 0.8
  69037. }
  69038. fontSize = value + "px";
  69039. style.fontSize = fontSize;
  69040. } else if (prop === "fontName") {
  69041. fontName = value;
  69042. style.fontName = fontName;
  69043. } else {
  69044. if (prop === "globalCompositeOperation") {
  69045. value = CompOpMap[value];
  69046. if (!value) {
  69047. continue;
  69048. }
  69049. } else if (fromServer && prop === 'iconUrl') {
  69050. value = this.mapUrl + '/tileFeature/symbols/' + value.replace(/(___)/gi, '@');
  69051. value = value.replace(/(__0__0__)/gi, '__8__8__');
  69052. style["iconUrl"] = value;
  69053. continue;
  69054. }
  69055. if (prop === 'weight' && value < 1) {
  69056. value = Math.ceil(value);
  69057. }
  69058. style[prop] = value;
  69059. }
  69060. }
  69061. }
  69062. return style;
  69063. }
  69064. /**
  69065. * @function L.supermap.CartoCSSToLeaflet.prototype.getValidStyleFromLayerInfo
  69066. * @description 通过图层信息获取有效的样式。
  69067. * @param {SuperMap.Feature} feature - 要素。
  69068. * @param {Object} layerInfo - 图层信息。
  69069. */
  69070. getValidStyleFromLayerInfo(feature, layerInfo) {
  69071. var type = feature.type,
  69072. style = this.getDefaultStyle(type),
  69073. shader = layerInfo && layerInfo.layerStyle;
  69074. if (!shader) {
  69075. return style;
  69076. }
  69077. if (type === "POINT") {
  69078. var size = Math.ceil(shader.markerSize * SuperMap.DOTS_PER_INCH * SuperMap.INCHES_PER_UNIT.mm) || 8;
  69079. var symbolParameters = {
  69080. "transparent": true,
  69081. "resourceType": "SYMBOLMARKER",
  69082. "picWidth": size,
  69083. "picHeight": size,
  69084. "style": JSON.stringify(shader)
  69085. };
  69086. style.iconUrl = Util.urlAppend(this.mapUrl + "/symbol.png", Util.getParameterString(symbolParameters));
  69087. style.iconSize = [size, size];
  69088. return style;
  69089. }
  69090. if (type === "TEXT") {
  69091. shader = feature.properties.textStyle || layerInfo.layerStyle;
  69092. //设置文本是否使用粗体
  69093. style.fontWeight = shader.bold ? shader.fontWeight : "normal";
  69094. //设置文本的尺寸(对应fontHeight属性)和行高,行高iserver不支持,默认5像素
  69095. //固定大小的时候单位是毫米
  69096. if (shader.fontHeight) {
  69097. var text_h = shader.fontHeight * SuperMap.DOTS_PER_INCH * SuperMap.INCHES_PER_UNIT.mm * 0.85; //毫米转像素,服务端的字体貌似要稍微小一点
  69098. style.fontSize = text_h + "px";
  69099. style.textHeight = text_h;
  69100. }
  69101. //设置文本字体类型
  69102. //在桌面字体钱加@时为了解决对联那种形式,但是在canvas不支持,并且添加了@会导致
  69103. //字体大小被固定,这里需要去掉
  69104. if (shader.fontName) {
  69105. style.fontFamily = (shader.fontName.indexOf("@")) ?
  69106. shader.fontName.replace(/@/g, "") : shader.fontName;
  69107. }
  69108. //设置对齐方式
  69109. if (shader.align) {
  69110. var alignStr = shader.align.replace(/TOP|MIDDLE|BASELINE|BOTTOM/, "");
  69111. style.textAlign = alignStr.toLowerCase();
  69112. }
  69113. style.weight = shader.outline ? shader.outlineWidth : 0;
  69114. if (shader.backColor) {
  69115. style.color = "rgba(" + shader.backColor.red + "," +
  69116. shader.backColor.green + "," +
  69117. shader.backColor.blue +
  69118. ",1)";
  69119. }
  69120. if (shader.foreColor) {
  69121. style.fillColor = "rgba(" + shader.foreColor.red + "," +
  69122. shader.foreColor.green + "," +
  69123. shader.foreColor.blue +
  69124. ",1)";
  69125. }
  69126. style.rotation = shader.rotation || 0;
  69127. return style;
  69128. }
  69129. //目前只实现桌面系统默认的几种symbolID,非系统默认的面用颜色填充替代,线则用实线来替代
  69130. var fillSymbolID = shader["fillSymbolID"] > 7 ? 0 : shader["fillSymbolID"];
  69131. var lineSymbolID = shader["lineSymbolID"] > 5 ? 0 : shader["lineSymbolID"];
  69132. for (var attr in shader) {
  69133. var obj = ServerStyleMap[attr];
  69134. if (!obj) {
  69135. continue;
  69136. }
  69137. var leafletStyle = obj.leafletStyle;
  69138. switch (obj.type) {
  69139. case "number":
  69140. {
  69141. let value = shader[attr];
  69142. if (obj.unit) {
  69143. value = value * SuperMap.DOTS_PER_INCH * SuperMap.INCHES_PER_UNIT[obj.unit] * 2.5;
  69144. }
  69145. style[leafletStyle] = value;
  69146. break;
  69147. }
  69148. case "color":
  69149. {
  69150. var color = shader[attr];
  69151. let value, alpha = 1;
  69152. if (leafletStyle === "fillColor") {
  69153. if (fillSymbolID === 0 || fillSymbolID === 1) {
  69154. //当fillSymbolID为0时,用颜色填充,为1是无填充,即为透明填充,alpha通道为0
  69155. alpha = 1 - fillSymbolID;
  69156. value = "rgba(" + color.red + "," + color.green + "," + color.blue + "," + alpha + ")";
  69157. }
  69158. } else if (leafletStyle === "color") {
  69159. if (lineSymbolID === 0 || lineSymbolID === 5) {
  69160. //对于lineSymbolID为0时,线为实线,为lineSymbolID为5时,为无线模式,即线为透明,即alpha通道为0
  69161. alpha = lineSymbolID === 0 ? 1 : 0;
  69162. } else {
  69163. //以下几种linePattern分别模拟了桌面的SymbolID为1~4几种符号的linePattern
  69164. var linePattern = [1, 0];
  69165. switch (lineSymbolID) {
  69166. case 1:
  69167. linePattern = [9.7, 3.7];
  69168. break;
  69169. case 2:
  69170. linePattern = [3.7, 3.7];
  69171. break;
  69172. case 3:
  69173. linePattern = [9.7, 3.7, 2.3, 3.7];
  69174. break;
  69175. case 4:
  69176. linePattern = [9.7, 3.7, 2.3, 3.7, 2.3, 3.7];
  69177. break;
  69178. default:
  69179. break
  69180. }
  69181. style.lineDasharray = linePattern;
  69182. }
  69183. value = "rgba(" + color.red + "," + color.green + "," + color.blue + "," + alpha + ")";
  69184. }
  69185. style[leafletStyle] = value;
  69186. break;
  69187. }
  69188. default:
  69189. break;
  69190. }
  69191. }
  69192. //处理标签文本的情况
  69193. if (layerInfo.textField) {
  69194. style.textAlign = "LEFT";
  69195. }
  69196. return style;
  69197. }
  69198. }
  69199. (external_L_default()).supermap.CartoCSSToLeaflet = CartoCSSToLeaflet;
  69200. ;// CONCATENATED MODULE: ./src/leaflet/overlay/graphic/Graphic.js
  69201. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  69202. * This program are made available under the terms of the Apache License, Version 2.0
  69203. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  69204. /**
  69205. * @class L.supermap.graphic
  69206. * @classdesc 高效率点图层要素类。
  69207. * @category Visualization Graphic
  69208. * @extends {L.Class}
  69209. * @param {Object} options - 图形参数。
  69210. * @param {L.LatLng} options.latLng - 经纬度。
  69211. * @param {number} options.id - 要素id。
  69212. * @param {(L.supermap.circleStyle|L.supermap.cloverStyle|L.supermap.imageStyle)} [options.style] - 点样式。
  69213. * @param {Object} [options.attributes] - 要素属性。
  69214. */
  69215. var Graphic = external_L_default().Class.extend({
  69216. initialize: function (options) {
  69217. options = options || {};
  69218. var latLng = options.latLng || options._latLng;
  69219. this._latLng = external_L_default().latLng(latLng.lat, latLng.lng);
  69220. this._style = options.style || options._canvas;
  69221. this.attributes = options.attributes;
  69222. this.id = options.id ? options.id : null;
  69223. },
  69224. /**
  69225. * @function L.supermap.graphic.prototype.getId
  69226. * @description 获取当前 ID。
  69227. * @returns {string} id
  69228. */
  69229. getId() {
  69230. return this.id;
  69231. },
  69232. /**
  69233. * @function L.supermap.graphic.prototype.setId
  69234. * @description 设置当前要素 ID。
  69235. * @param {string} id - 要素 ID。
  69236. */
  69237. setId(id) {
  69238. this.id = id;
  69239. },
  69240. /**
  69241. * @function L.supermap.graphic.prototype.setLatLng
  69242. * @description 设置经纬度。
  69243. * @param {L.LatLng} latLng - 经纬度参数。
  69244. */
  69245. setLatLng: function (latLng) {
  69246. this._latLng = latLng;
  69247. },
  69248. /**
  69249. * @deprecated
  69250. * @function L.supermap.graphic.prototype.setCanvas
  69251. * @description 设置画布,已弃用该设置,请使用 setStyle 接口。
  69252. * @param {HTMLCanvasElement} canvas - 传入需要设置的画布。
  69253. */
  69254. setCanvas: function (canvas) {
  69255. this._style = canvas;
  69256. },
  69257. /**
  69258. * @function L.supermap.graphic.prototype.setAttributes
  69259. * @description 设置要素属性。
  69260. * @param {Object} attributes - 属性对象。
  69261. */
  69262. setAttributes: function (attributes) {
  69263. this.attributes = attributes;
  69264. },
  69265. /**
  69266. * @function L.supermap.graphic.prototype.getLatLng
  69267. * @description 获取经纬度。
  69268. * @returns {L.LatLng} 经纬度。
  69269. */
  69270. getLatLng: function () {
  69271. return this._latLng;
  69272. },
  69273. /**
  69274. * @deprecated
  69275. * @function L.supermap.graphic.prototype.getCanvas
  69276. * @description 获取画布,已弃用该设置,请使用 getStyle 接口
  69277. * @returns {HTMLCanvasElement} 画布。
  69278. */
  69279. getCanvas: function () {
  69280. return this._style;
  69281. },
  69282. /**
  69283. * @function L.supermap.graphic.prototype.getAttributes
  69284. * @description 获取要素属性。
  69285. * @returns {Object} 要素属性。
  69286. */
  69287. getAttributes: function () {
  69288. return this.attributes;
  69289. },
  69290. /**
  69291. * @function L.supermap.graphic.prototype.setStyle
  69292. * @description 设置样式。
  69293. * @param {(L.supermap.circleStyle|L.supermap.imageStyle|L.supermap.cloverStyle)} style - 样式。
  69294. */
  69295. setStyle: function (style) {
  69296. this._style = style;
  69297. },
  69298. /**
  69299. * @function L.supermap.graphic.prototype.getStyle
  69300. * @description 获取样式。
  69301. * @returns {(L.supermap.circleStyle|L.supermap.imageStyle|L.supermap.cloverStyle)} 样式。
  69302. */
  69303. getStyle: function () {
  69304. return this._style;
  69305. }
  69306. });
  69307. var graphic = function (options) {
  69308. return new Graphic(options);
  69309. };
  69310. (external_L_default()).supermap.graphic = graphic;
  69311. ;// CONCATENATED MODULE: ./src/leaflet/overlay/theme/ThemeFeature.js
  69312. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  69313. * This program are made available under the terms of the Apache License, Version 2.0
  69314. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  69315. /**
  69316. * @class L.supermap.themeFeature
  69317. * @classdesc 客户端专题图要素类。
  69318. * 支持的 geometry 参数类型为 {@link L.Point},{@link L.LatLng},{@link L.Polyline},{@link L.Polygon}。
  69319. * @category Visualization Theme
  69320. * @extends {L.Class}
  69321. * @param {(L.Path|L.Point|L.LatLng)} geometry - 要素图形。
  69322. * @param {Object} attributes - 要素属性。
  69323. */
  69324. var ThemeFeature = external_L_default().Class.extend({
  69325. initialize: function (geometry, attributes) {
  69326. this.geometry = geometry;
  69327. this.attributes = attributes;
  69328. },
  69329. /**
  69330. * @function L.supermap.themeFeature.prototype.toFeature
  69331. * @description 转为内部矢量要素。
  69332. * @returns {SuperMap.Feature.Vector} 内部矢量要素。
  69333. */
  69334. toFeature: function () {
  69335. let geometry = this.geometry;
  69336. if (geometry.toGeoJSON) {
  69337. const geojsonObject = geometry.toGeoJSON();
  69338. geojsonObject.properties = this.attributes;
  69339. return new GeoJSON().read(geojsonObject)[0];
  69340. }
  69341. if (geometry.length === 3) {
  69342. geometry = new GeoText(geometry[1], geometry[0], geometry[2]);
  69343. } else if (geometry.length === 2) {
  69344. geometry = new Point(geometry[0], geometry[1]);
  69345. } else if (geometry instanceof (external_L_default()).LatLng) {
  69346. geometry = new Point(geometry.lng, geometry.lat);
  69347. } else if (geometry instanceof (external_L_default()).Point) {
  69348. geometry = new Point(geometry.x, geometry.y);
  69349. } else if (geometry instanceof (external_L_default()).CircleMarker) {
  69350. var latLng = geometry.getLatLng();
  69351. geometry = new Point(latLng.lng, latLng.lat);
  69352. }
  69353. return new Vector(geometry, this.attributes);
  69354. },
  69355. /**
  69356. * @function L.supermap.themeFeature.prototype.reverseLatLngs
  69357. * @description 坐标反转。
  69358. * @param {L.Latlng} latlngs - 坐标值。
  69359. */
  69360. reverseLatLngs: function (latlngs) {
  69361. if (!external_L_default().Util.isArray(latlngs)) {
  69362. latlngs = [latlngs];
  69363. }
  69364. for (var i = 0; i < latlngs.length; i++) {
  69365. latlngs[i] = [latlngs[i].lng, latlngs[i].lat];
  69366. }
  69367. return latlngs;
  69368. }
  69369. });
  69370. var themeFeature = function (geometry, attributes) {
  69371. return new ThemeFeature(geometry, attributes);
  69372. };
  69373. (external_L_default()).supermap.themeFeature = themeFeature;
  69374. ;// CONCATENATED MODULE: ./src/leaflet/overlay/theme/ThemeLayer.js
  69375. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  69376. * This program are made available under the terms of the Apache License, Version 2.0
  69377. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  69378. /**
  69379. * @class L.supermap.ThemeLayer
  69380. * @classdesc 专题图层基类,调用建议使用其子类实现类。
  69381. * @category Visualization Theme
  69382. * @extends {L.Layer}
  69383. * @param {string} name - 专题图图层名称。
  69384. * @param {Object} options - 可选参数。
  69385. * @param {string} [options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  69386. * @param {number} [options.opacity=1] - 图层透明度。
  69387. * @param {boolean} [options.alwaysMapCRS=false] - 要素坐标是否和地图坐标系一致,要素默认是经纬度坐标。
  69388. * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权描述信息。
  69389. * @param {Array} [options.TFEvents] - 专题要素事件临时存储。
  69390. * @fires L.supermap.ThemeLayer#featuresremoved
  69391. */
  69392. var ThemeLayer = external_L_default().Layer.extend({
  69393. options: {
  69394. //要素坐标是否和地图坐标系一致,默认为false,要素默认是经纬度坐标。
  69395. alwaysMapCRS: false,
  69396. id: Util.createUniqueID("themeLayer_"),
  69397. opacity: 1,
  69398. // {Array} 专题要素事件临时存储,临时保存图层未添加到 map 前用户添加的事件监听,待图层添加到 map 后把这些事件监听添加到图层上,清空此图层。
  69399. //这是一个二维数组,组成二维数组的每个一维数组长度为 2,分别是 event, callback。
  69400. TFEvents: [],
  69401. attribution: core_Attributions.Common.attribution
  69402. },
  69403. initialize: function (name, options) {
  69404. external_L_default().Util.setOptions(this, options);
  69405. this.name = name;
  69406. this.features = [];
  69407. this.TFEvents = this.options.TFEvents;
  69408. this.levelRenderer = new LevelRenderer();
  69409. this.movingOffset = [0, 0];
  69410. },
  69411. /**
  69412. * @function L.supermap.ThemeLayer.prototype.getEvents
  69413. * @description 获取图层事件。
  69414. * @returns {Object} 返回图层支持的事件。
  69415. */
  69416. getEvents: function () {
  69417. var me = this;
  69418. var events = {
  69419. zoomend: me._reset,
  69420. moveend: me._reset,
  69421. resize: me._resize
  69422. };
  69423. if (this._map._zoomAnimated) {
  69424. events.zoomanim = me._zoomAnim;
  69425. }
  69426. return events;
  69427. },
  69428. /**
  69429. * @function L.supermap.ThemeLayer.prototype.onRemove
  69430. * @description 删除某个地图。
  69431. * @param {L.Map} map - 要删除的地图。
  69432. */
  69433. onRemove: function (map) {
  69434. var me = this;
  69435. external_L_default().DomUtil.remove(me.container);
  69436. map.off("mousemove", me.mouseMoveHandler);
  69437. },
  69438. /**
  69439. * @function L.supermap.ThemeLayer.prototype.onAdd
  69440. * @description 添加专题图。
  69441. * @param {L.Map} map - 要添加的地图。
  69442. * @private
  69443. */
  69444. onAdd: function (map) {
  69445. var me = this;
  69446. me.map = me._map = map;
  69447. me._initContainer();
  69448. if (!me.levelRenderer) {
  69449. map.removeLayer(me);
  69450. return;
  69451. }
  69452. //初始化渲染器
  69453. var size = map.getSize();
  69454. me.container.style.width = size.x + "px";
  69455. me.container.style.height = size.y + "px";
  69456. me._updateOpacity();
  69457. me.renderer = me.levelRenderer.init(me.container);
  69458. me.renderer.clear();
  69459. if (me.features && me.features.length > 0) {
  69460. me._reset();
  69461. }
  69462. //处理用户预先(在图层添加到 map 前)监听的事件
  69463. me.addTFEvents();
  69464. me.mouseMoveHandler = function (e) {
  69465. var xy = e.layerPoint;
  69466. me.currentMousePosition = external_L_default().point(xy.x + me.movingOffset[0], xy.y + me.movingOffset[1]);
  69467. };
  69468. map.on("mousemove", me.mouseMoveHandler);
  69469. me.update(map.getBounds());
  69470. },
  69471. /**
  69472. * @function L.supermap.ThemeLayer.prototype.addFeatures
  69473. * @description 向专题图图层中添加数据。
  69474. * @param {(SuperMap.ServerFeature|L.supermap.themeFeature|GeoJSONObject)} features - 待转要素。
  69475. */
  69476. addFeatures: function (features) { // eslint-disable-line no-unused-vars
  69477. //子类实现此方法
  69478. },
  69479. /**
  69480. * @function L.supermap.ThemeLayer.prototype.redrawThematicFeatures
  69481. * @description 抽象方法,可实例化子类必须实现此方法。
  69482. * @param {L.bounds} bounds - 重绘专题要素范围。
  69483. */
  69484. redrawThematicFeatures: function (bounds) { // eslint-disable-line no-unused-vars
  69485. //子类必须实现此方法
  69486. },
  69487. /**
  69488. * @function L.supermap.ThemeLayer.prototype.destroyFeatures
  69489. * @description 销毁要素。
  69490. * @param {Array.<SuperMap.Feature.Vector>} features - 将被销毁的要素。
  69491. */
  69492. destroyFeatures: function (features) {
  69493. if (features === undefined) {
  69494. features = this.features;
  69495. }
  69496. if (!features) {
  69497. return;
  69498. }
  69499. this.removeFeatures(features);
  69500. for (var i = features.length - 1; i >= 0; i--) {
  69501. features[i].destroy();
  69502. }
  69503. },
  69504. /**
  69505. * @function L.supermap.ThemeLayer.prototype.removeFeatures
  69506. * @description 从专题图中删除 feature。这个函数删除所有传递进来的矢量要素。
  69507. * @param {Array.<SuperMap.Feature.Vector>} features - 将被删除的要素。
  69508. */
  69509. removeFeatures: function (features) {
  69510. var me = this;
  69511. if (!features || features.length === 0) {
  69512. return;
  69513. }
  69514. if (features === me.features) {
  69515. return me.removeAllFeatures();
  69516. }
  69517. if (!(external_L_default().Util.isArray(features))) {
  69518. features = [features];
  69519. }
  69520. var featuresFailRemoved = [];
  69521. for (var i = features.length - 1; i >= 0; i--) {
  69522. var feature = features[i];
  69523. //如果我们传入的feature在features数组中没有的话,则不进行删除,
  69524. //并将其放入未删除的数组中。
  69525. var findex = external_L_default().Util.indexOf(me.features, feature);
  69526. if (findex === -1) {
  69527. featuresFailRemoved.push(feature);
  69528. continue;
  69529. }
  69530. me.features.splice(findex, 1);
  69531. }
  69532. var drawFeatures = [];
  69533. for (var hex = 0, len = me.features.length; hex < len; hex++) {
  69534. feature = me.features[hex];
  69535. drawFeatures.push(feature);
  69536. }
  69537. me.features = [];
  69538. me.addFeatures(drawFeatures);
  69539. //绘制专题要素
  69540. if (me.renderer) {
  69541. if (me._map) {
  69542. me.redrawThematicFeatures(me._map.getBounds());
  69543. } else {
  69544. me.redrawThematicFeatures();
  69545. }
  69546. }
  69547. var succeed = featuresFailRemoved.length == 0;
  69548. /**
  69549. * @event L.supermap.ThemeLayer#featuresremoved
  69550. * @description 删除的要素成功之后触发。
  69551. * @property {Array.<SuperMap.Feature.Vector>} features - 事件对象。
  69552. * @property {boolean} succeed - 要输是否删除成功,true 为删除成功,false 为删除失败。
  69553. */
  69554. me.fire("featuresremoved", {
  69555. features: featuresFailRemoved,
  69556. succeed: succeed
  69557. });
  69558. },
  69559. /**
  69560. * @function L.supermap.ThemeLayer.prototype.removeAllFeatures
  69561. * @description 清除当前图层所有的矢量要素。
  69562. */
  69563. removeAllFeatures: function () {
  69564. var me = this;
  69565. if (me.renderer) {
  69566. me.renderer.clear();
  69567. }
  69568. me.features = [];
  69569. me.fire("featuresremoved", {
  69570. features: [],
  69571. succeed: true
  69572. });
  69573. },
  69574. /**
  69575. * @function L.supermap.ThemeLayer.prototype.getFeatures
  69576. * @description 查看当前图层中的有效数据。
  69577. * @returns {Array} 返回图层中的有效数据。
  69578. */
  69579. getFeatures: function () {
  69580. var me = this;
  69581. var len = me.features.length;
  69582. var clonedFeatures = new Array(len);
  69583. for (var i = 0; i < len; ++i) {
  69584. clonedFeatures[i] = me.features[i];
  69585. }
  69586. return clonedFeatures;
  69587. },
  69588. /**
  69589. * @function L.supermap.ThemeLayer.prototype.getFeatureBy
  69590. * @description 在专题图的要素数组 features 里面遍历每一个 feature,当 feature[property] === value 时,返回此 feature(并且只返回第一个)。
  69591. * @param {string} property - 要的某个属性名。
  69592. * @param {string} value - 对应属性名得值。
  69593. */
  69594. getFeatureBy: function (property, value) {
  69595. var me = this;
  69596. var feature = null;
  69597. for (var id in me.features) {
  69598. if (me.features[id][property] !== value) {
  69599. continue;
  69600. }
  69601. feature = me.features[id];
  69602. break;
  69603. }
  69604. return feature;
  69605. },
  69606. /**
  69607. * @function L.supermap.ThemeLayer.prototype.getFeatureById
  69608. * @description 通过给定一个 ID,返回对应的矢量要素,如果不存在则返回 null。
  69609. * @param {number} featureId - 要素 ID。
  69610. */
  69611. getFeatureById: function (featureId) {
  69612. return this.getFeatureBy('id', featureId);
  69613. },
  69614. /**
  69615. * @function L.supermap.ThemeLayer.prototype.getFeaturesByAttribute
  69616. * @description 通过给定一个属性的 key 值和 value 值,返回所有匹配的要素数组。
  69617. * @param {string} attrName - key 值。
  69618. * @param {string} attrValue - value 值。
  69619. * @returns {Array} 返回所有匹配的要素数组。
  69620. */
  69621. getFeaturesByAttribute: function (attrName, attrValue) {
  69622. var me = this,
  69623. feature,
  69624. foundFeatures = [];
  69625. for (var id in me.features) {
  69626. feature = me.features[id];
  69627. if (feature && feature.attributes && (feature.attributes[attrName] === attrValue)) {
  69628. foundFeatures.push(feature);
  69629. }
  69630. }
  69631. return foundFeatures;
  69632. },
  69633. /**
  69634. * @function L.supermap.ThemeLayer.prototype.update
  69635. * @description 更新图层。
  69636. * @param {L.bounds} bounds - 图层范围。
  69637. */
  69638. update: function (bounds) {
  69639. var mapOffset = this._map.containerPointToLayerPoint([0, 0]);
  69640. external_L_default().DomUtil.setPosition(this.container, mapOffset);
  69641. var me = this;
  69642. // var bounds = me._map.getBounds();
  69643. // var topLeft = me._map.latLngToLayerPoint(bounds.getNorthWest());
  69644. // var mapOffset = [parseInt(topLeft.x, 10) || 0, parseInt(topLeft.y, 10) || 0]
  69645. // // var offsetLeft = parseInt(me._map.getContainer().style.left, 10);
  69646. // // offsetLeft = -Math.round(offsetLeft);
  69647. // //var offsetTop = parseInt(me._map.getContainer().style.top, 10);
  69648. // //offsetTop = -Math.round(offsetTop);
  69649. // me.container.style.left = mapOffset[0] + 'px';
  69650. // me.container.style.top = mapOffset[1] + 'px';
  69651. //绘制专题要素
  69652. if (me.renderer) {
  69653. me.redrawThematicFeatures(bounds);
  69654. }
  69655. if (me.currentMousePosition) {
  69656. me.currentMousePosition = external_L_default().point(
  69657. me.currentMousePosition.x - me.movingOffset[0],
  69658. me.currentMousePosition.y - me.movingOffset[1]);
  69659. }
  69660. me.movingOffset = [0, 0];
  69661. me._zoom = me._map.getZoom();
  69662. me._center = me._map.getCenter();
  69663. },
  69664. /**
  69665. * @function L.supermap.ThemeLayer.prototype.setOpacity
  69666. * @description 设置图层的不透明度,取值 [0-1] 之间。
  69667. * @param {number} opacity - 不透明度。
  69668. */
  69669. setOpacity: function (opacity) {
  69670. var me = this;
  69671. if (opacity === me.options.opacity) {
  69672. return;
  69673. }
  69674. if (!isNaN(opacity)) {
  69675. me.options.opacity = opacity;
  69676. me._updateOpacity();
  69677. }
  69678. },
  69679. /**
  69680. * @function L.supermap.ThemeLayer.prototype.redraw
  69681. * @description 重绘该图层。
  69682. * @returns {boolean} 返回是否重绘成功。
  69683. */
  69684. redraw: function () {
  69685. var me = this;
  69686. if (!me.renderer) {
  69687. return false;
  69688. }
  69689. if (me._map) {
  69690. me.redrawThematicFeatures(me._map.getBounds());
  69691. } else {
  69692. me.redrawThematicFeatures();
  69693. }
  69694. return true;
  69695. },
  69696. /**
  69697. * @function L.supermap.ThemeLayer.prototype.on
  69698. * @description 添加专题要素事件监听。添加专题要素事件监听。
  69699. * @param {Event} event - 监听事件。
  69700. * @param {Function} callback - 回调函数。
  69701. * @param {string} context - 信息。
  69702. */
  69703. on: function (event, callback, context) { // eslint-disable-line no-unused-vars
  69704. if (this.renderer) {
  69705. this.renderer.on(event, callback);
  69706. } else {
  69707. external_L_default().Layer.prototype.on.call(this, event, callback);
  69708. }
  69709. return this;
  69710. },
  69711. /**
  69712. * @function L.supermap.ThemeLayer.prototype.off
  69713. * @description 移除专题要素事件监听。
  69714. * @param {Event} event - 监听事件。
  69715. * @param {Function} callback - 回调函数。
  69716. * @param {string} context - 信息。
  69717. */
  69718. off: function (event, callback, context) { // eslint-disable-line no-unused-vars
  69719. var me = this;
  69720. if (me.renderer) {
  69721. me.renderer.un(event, callback);
  69722. } else {
  69723. external_L_default().Layer.prototype.off.call(this, event, callback);
  69724. }
  69725. return this;
  69726. },
  69727. fire: function (type, data, propagate) { // eslint-disable-line no-unused-vars
  69728. if (this.renderer) {
  69729. this.renderer.trigger(type, data);
  69730. }
  69731. external_L_default().Layer.prototype.fire.call(this, type, data, propagate);
  69732. return this;
  69733. },
  69734. /**
  69735. * @function L.supermap.ThemeLayer.prototype.addTFEvents
  69736. * @description 将图层添加到地图上之前用户要求添加的事件监听添加到图层。
  69737. * @private
  69738. */
  69739. addTFEvents: function () {
  69740. var me = this;
  69741. var tfEs = me.TFEvents;
  69742. var len = tfEs.length;
  69743. for (var i = 0; i < len; i++) {
  69744. me.renderer.on(tfEs[i][0], tfEs[i][1]);
  69745. }
  69746. },
  69747. /**
  69748. * @function L.supermap.ThemeLayer.prototype.getLocalXY
  69749. * @description 地理坐标转为像素坐标。
  69750. * @param {Array} coordinate
  69751. */
  69752. getLocalXY: function (coordinate) {
  69753. if (!this._map) {
  69754. return coordinate;
  69755. }
  69756. var coor = coordinate;
  69757. if (external_L_default().Util.isArray(coordinate)) {
  69758. coor = external_L_default().point(coordinate[0], coordinate[1]);
  69759. }
  69760. if (!(coordinate instanceof (external_L_default()).Point)) {
  69761. if (coordinate instanceof Point || coordinate instanceof GeoText) {
  69762. coor = external_L_default().point(coordinate.x, coordinate.y);
  69763. } else {
  69764. coor = external_L_default().point(coordinate.lon, coordinate.lat);
  69765. }
  69766. }
  69767. var point = this._map.latLngToAccurateContainerPoint(!this.options.alwaysMapCRS ? external_L_default().latLng(coor.y, coor.x) : this._map.options.crs.unproject(coor));
  69768. return [point.x, point.y];
  69769. },
  69770. /**
  69771. * @function L.supermap.ThemeLayer.prototype.toiClientFeature
  69772. * @description 转为 iClient 要素。
  69773. * @param {(SuperMap.ServerFeature|L.supermap.themeFeature|GeoJSONObject)} features - 待转要素。
  69774. * @returns {Array.<SuperMap.Feature.Vector>} 转换后的 iClient 要素。
  69775. */
  69776. toiClientFeature: function (features) {
  69777. //若 features 非数组形式 feature 则先做以下处理:
  69778. if (!Util.isArray(features)) {
  69779. features = [features];
  69780. }
  69781. let featuresTemp = [];
  69782. for (let i = 0; i < features.length; i++) {
  69783. //L.supermap.themeFeature 数据类型
  69784. if (features[i] instanceof ThemeFeature) {
  69785. featuresTemp.push(features[i].toFeature());
  69786. } else if (features[i] instanceof Vector) {
  69787. // 若是 GeometryVector 类型直接返回
  69788. featuresTemp.push(features[i]);
  69789. } else if (["FeatureCollection", "Feature", "Geometry"].indexOf(features[i].type) != -1) {
  69790. //GeoJSON 规范数据类型
  69791. const format = new GeoJSON();
  69792. featuresTemp = featuresTemp.concat(format.read(features[i]));
  69793. } else if (features[i].geometry && features[i].geometry.parts) {
  69794. //iServer服务器返回数据格式 todo 暂未找到更好的参数判断,暂用 geometry.parts 试用
  69795. featuresTemp.push(ServerFeature.fromJson(features[i]).toFeature());
  69796. } else {
  69797. throw new Error(`features[${i}]'s type is not be supported.`);
  69798. }
  69799. }
  69800. return featuresTemp;
  69801. },
  69802. /**
  69803. * @function L.supermap.ThemeLayer.prototype.toFeature
  69804. * @deprecated
  69805. * @description 转为 iClient 要素,该方法将被弃用,由 {@link L.supermap.ThemeLayer#toiClientFeature} 代替。
  69806. * @param {(SuperMap.ServerFeature|L.supermap.themeFeature|GeoJSONObject)} features - 待转要素。
  69807. * @returns {SuperMap.Feature.Vector} 转换后的 iClient 要素。
  69808. */
  69809. toFeature: function (features) {
  69810. return this.toiClientFeature(features);
  69811. },
  69812. _initContainer: function () {
  69813. var parentContainer = this.getPane();
  69814. var animated = this._map.options.zoomAnimation && (external_L_default()).Browser.any3d;
  69815. var className = 'themeLayer leaflet-layer leaflet-zoom-' + (animated ? 'animated' : 'hide');
  69816. this.container = external_L_default().DomUtil.create("div", className, parentContainer);
  69817. var originProp = external_L_default().DomUtil.testProp(['transformOrigin', 'WebkitTransformOrigin', 'msTransformOrigin']);
  69818. this.container.id = this.options.id;
  69819. this.container.style[originProp] = '50% 50%';
  69820. this.container.style.position = "absolute";
  69821. this.container.style.zIndex = 200;
  69822. },
  69823. _zoomAnim: function (e) {
  69824. var scale = this._map.getZoomScale(e.zoom),
  69825. offset = this._map._getCenterOffset(e.center)._multiplyBy(-scale).subtract(this._map._getMapPanePos());
  69826. if ((external_L_default()).DomUtil.setTransform) {
  69827. external_L_default().DomUtil.setTransform(this.container, offset, scale);
  69828. } else {
  69829. this.container.style[(external_L_default()).DomUtil.TRANSFORM] = external_L_default().DomUtil.getTranslateString(offset) + ' scale(' + scale + ')';
  69830. }
  69831. },
  69832. _updateOpacity: function () {
  69833. var me = this;
  69834. Util.modifyDOMElement(me.container, null, null, null, null, null, null, me.options.opacity);
  69835. if (me._map !== null) {
  69836. /**
  69837. * @event L.supermap.ThemeLayer#changelayer
  69838. * @description 图层属性改变之后触发。
  69839. * @property {Object} layer - 图层。
  69840. * @property {string} property - 图层属性。
  69841. */
  69842. me._map.fire("changelayer", {
  69843. layer: me,
  69844. property: "opacity"
  69845. });
  69846. }
  69847. },
  69848. //缩放移动重绘
  69849. _reset: function () {
  69850. var me = this;
  69851. var latLngBounds = me._map.getBounds();
  69852. me.update(latLngBounds);
  69853. var size = me._map.getSize();
  69854. // var bounds = me._map.getBounds();
  69855. // var topLeft = me._map.latLngToLayerPoint(bounds.getNorthWest());
  69856. // var mapOffset = [parseInt(topLeft.x, 10) || 0, parseInt(topLeft.y, 10) || 0]
  69857. // var offsetLeft = parseInt(me._map.getContainer().style.left, 10);
  69858. // offsetLeft = -Math.round(offsetLeft);
  69859. //var offsetTop = parseInt(me._map.getContainer().style.top, 10);
  69860. //offsetTop = -Math.round(offsetTop);
  69861. //me.container.style.left = mapOffset[0] + 'px';
  69862. //me.container.style.top = mapOffset[1] + 'px';
  69863. var mapOffset = this._map.containerPointToLayerPoint([0, 0]);
  69864. external_L_default().DomUtil.setPosition(this.container, mapOffset);
  69865. if (parseFloat(me.container.width) !== parseFloat(size.x)) {
  69866. me.container.width = size.x + 'px';
  69867. }
  69868. if (parseFloat(me.container.height) !== parseFloat(size.y)) {
  69869. me.container.height = size.y + 'px';
  69870. }
  69871. me.redraw();
  69872. },
  69873. //通知渲染器的尺寸变化
  69874. _resize: function () {
  69875. var me = this;
  69876. var newSize = me._map.getSize();
  69877. me.container.style.width = newSize.x + "px";
  69878. me.container.style.height = newSize.y + "px";
  69879. me.renderer.resize();
  69880. }
  69881. });
  69882. ;// CONCATENATED MODULE: ./src/leaflet/overlay/theme/GeoFeatureThemeLayer.js
  69883. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  69884. * This program are made available under the terms of the Apache License, Version 2.0
  69885. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  69886. /**
  69887. * @class L.supermap.GeoFeatureThemeLayer
  69888. * @classdesc 地理几何专题要素型专题图层基类。此类型专题图的专题要素形状就是由 feature.geometry 决定。此类不建议直接实例化调用。
  69889. * @category Visualization Theme
  69890. * @extends L.supermap.ThemeLayer
  69891. * @category Visualization Graphic
  69892. * @param {string} name - 专题图名。
  69893. * @param {Object} options - 需要设置的参数对象。
  69894. * @param {string} [options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  69895. * @param {number} [options.opacity=1] - 图层透明度。
  69896. * @param {boolean} [options.alwaysMapCRS=false] - 要素坐标是否和地图坐标系一致,要素默认是经纬度坐标。
  69897. * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权描述信息。
  69898. * @param {Array} [options.TFEvents] - 专题要素事件临时存储。
  69899. * @param {number} [options.nodesClipPixel=2] - 节点抽稀像素距离。
  69900. * @param {boolean} [options.isHoverAble=false] - 图形是否在 hover 时高亮。
  69901. * @param {boolean} [options.isMultiHover=false] - 是否多图形同时高亮,用于高亮同一个数据对应的所有图形(如:多面)。
  69902. * @param {boolean} [options.isClickAble=true] - 图形是否可点击。
  69903. * @param {boolean} [options.isAllowFeatureStyle=false] - 是否允许 feature 样式(style) 中的有效属性应用到专题图层。
  69904. * 禁止对专题要素使用数据(feature)的 style。
  69905. * 此属性可强制将数据 feature 的 style 中有效属性应用到专题要素上,且拥有比图层 style 和 styleGroups 更高的优先级,使专题要素
  69906. * 的样式脱离专题图层的控制。可以通过此方式实现对特殊数据(feature) 对应专题要素赋予独立 style。
  69907. * @fires L.supermap.GeoFeatureThemeLayer#beforefeaturesadded
  69908. */
  69909. var GeoFeatureThemeLayer = ThemeLayer.extend({
  69910. options: {
  69911. // {number} 节点抽稀像素距离,默认值 2。
  69912. nodesClipPixel: 2,
  69913. //{boolean} 图形是否在 hover 时高亮 ,默认值:false。
  69914. isHoverAble: false,
  69915. //{boolean} 是否多图形同时高亮,用于高亮同一个数据对应的所有图形(如:多面),默认值:false。
  69916. isMultiHover: false,
  69917. // {boolean} 图形是否可点击,默认 true
  69918. isClickAble: true,
  69919. //是否允许 feature 样式(style) 中的有效属性应用到专题图层。
  69920. //默认值为: false,禁止对专题要素使用数据(feature)的 style。
  69921. //此属性可强制将数据 feature 的 style 中有效属性应用到专题要素上,且拥有比图层 style 和 styleGroups 更高的优先级,使专题要素
  69922. //的样式脱离专题图层的控制。可以通过此方式实现对特殊数据(feature) 对应专题要素赋予独立 style。
  69923. isAllowFeatureStyle: false
  69924. },
  69925. initialize: function (name, options) {
  69926. ThemeLayer.prototype.initialize.call(this, name, options);
  69927. external_L_default().Util.setOptions(this, options);
  69928. var me = this;
  69929. me.cache = {};
  69930. me.cacheFields = [];
  69931. me.style = {};
  69932. me.highlightStyle = {};
  69933. },
  69934. /**
  69935. * @function L.supermap.GeoFeatureThemeLayer.prototype.addFeatures
  69936. * @description 向专题图图层中添加数据。
  69937. * @param {(SuperMap.ServerFeature|L.supermap.themeFeature|GeoJSONObject)} features - 待填加的要素。
  69938. */
  69939. addFeatures: function (features) {
  69940. var me = this;
  69941. /**
  69942. * @event L.supermap.GeoFeatureThemeLayer#beforefeaturesadded
  69943. * @description 向专题图图层中添加数据之前触发。
  69944. * @property {(SuperMap.ServerFeature|L.supermap.themeFeature|GeoJSONObject)} features - 事件对象。
  69945. */
  69946. me.fire("beforefeaturesadded", {features: features});
  69947. //转换 features 形式
  69948. this.features = this.toiClientFeature(features);
  69949. if (!me.isCustomSetMaxCacheCount) {
  69950. me.maxCacheCount = me.features.length * 5;
  69951. }
  69952. if (!me.renderer) {
  69953. return;
  69954. }
  69955. //绘制专题要素
  69956. if (me._map) {
  69957. me.redrawThematicFeatures(me._map.getBounds());
  69958. } else {
  69959. me.redrawThematicFeatures();
  69960. }
  69961. },
  69962. /**
  69963. * @function L.supermap.GeoFeatureThemeLayer.prototype.removeFeatures
  69964. * @description 从专题图中删除 feature。这个函数删除所有传递进来的矢量要素。参数中的 features 数组中的每一项,必须是已经添加到当前图层中的 feature。
  69965. * @param {SuperMap.Feature.Vector} features - 要删除的要素。
  69966. */
  69967. removeFeatures: function (features) { // eslint-disable-line no-unused-vars
  69968. this.clearCache();
  69969. ThemeLayer.prototype.removeFeatures.call(this, arguments);
  69970. },
  69971. /**
  69972. * @function L.supermap.GeoFeatureThemeLayer.prototype.removeAllFeatures
  69973. * @description 清除当前图层所有的矢量要素。
  69974. */
  69975. removeAllFeatures: function () {
  69976. this.clearCache();
  69977. ThemeLayer.prototype.removeAllFeatures.call(this, arguments);
  69978. },
  69979. /**
  69980. * @function L.supermap.GeoFeatureThemeLayer.prototype.redrawThematicFeatures
  69981. * @description 重绘所有专题要素。
  69982. * 此方法包含绘制专题要素的所有步骤,包含用户数据到专题要素的转换,抽稀,缓存等步骤。
  69983. * 地图漫游时调用此方法进行图层刷新。
  69984. * @param {L.bounds} bounds - 重绘的范围。
  69985. */
  69986. redrawThematicFeatures: function (bounds) {
  69987. var me = this;
  69988. //获取高亮专题要素对应的用户 id
  69989. var hoverone = me.renderer.getHoverOne();
  69990. var hoverFid = null;
  69991. if (hoverone && hoverone.refDataID) {
  69992. hoverFid = hoverone.refDataID;
  69993. }
  69994. if (this.options.alwaysMapCRS && bounds && bounds instanceof (external_L_default()).LatLngBounds) {
  69995. var crs = this._map.options.crs;
  69996. bounds = external_L_default().bounds(crs.project(bounds.getSouthWest()), crs.project(bounds.getNorthEast()));
  69997. }
  69998. bounds = CommontypesConversion.toSuperMapBounds(bounds);
  69999. //清除当前所有可视元素
  70000. me.renderer.clearAll();
  70001. var features = me.features;
  70002. var cache = me.cache;
  70003. var cacheFields = me.cacheFields;
  70004. var cmZoom = me._map.getZoom();
  70005. var maxCC = me.maxCacheCount;
  70006. for (var i = 0, len = features.length; i < len; i++) {
  70007. var feature = features[i];
  70008. var feaBounds = feature.geometry.getBounds();
  70009. //剔除当前视图(地理)范围以外的数据
  70010. if (bounds && !bounds.intersectsBounds(feaBounds)) {
  70011. continue;
  70012. }
  70013. //缓存字段
  70014. var fields = feature.id + "_zoom_" + cmZoom.toString();
  70015. if (cache[fields]) {
  70016. cache[fields].updateAndAddShapes();
  70017. continue;
  70018. }
  70019. var thematicFeature = me.createThematicFeature(features[i]);
  70020. //检查 thematicFeature 是否有可视化图形
  70021. if (thematicFeature.getShapesCount() < 1) {
  70022. continue;
  70023. }
  70024. //加入缓存
  70025. cache[fields] = thematicFeature;
  70026. cacheFields.push(fields);
  70027. //缓存数量限制
  70028. if (cacheFields.length > maxCC) {
  70029. var fieldsTemp = cacheFields[0];
  70030. cacheFields.splice(0, 1);
  70031. delete cache[fieldsTemp];
  70032. }
  70033. }
  70034. me.renderer.render();
  70035. //地图漫游后,重新高亮图形
  70036. if (hoverFid && me.options.isHoverAble && me.options.isMultiHover) {
  70037. var hShapes = this.getShapesByFeatureID(hoverFid);
  70038. this.renderer.updateHoverShapes(hShapes);
  70039. }
  70040. },
  70041. /**
  70042. * @function L.supermap.GeoFeatureThemeLayer.prototype.createThematicFeature
  70043. * @description 创建专题要素。
  70044. * @param {SuperMap.Feature.Vector} feature - 要创建的要素。
  70045. */
  70046. createThematicFeature: function (feature) {
  70047. var me = this;
  70048. var style = me.getStyleByData(feature);
  70049. if (feature.style && me.isAllowFeatureStyle) {
  70050. style = Util.copyAttributesWithClip(feature.style);
  70051. }
  70052. //创建专题要素时的可选参数
  70053. var options = {};
  70054. options.nodesClipPixel = me.options.nodesClipPixel;
  70055. options.isHoverAble = me.options.isHoverAble;
  70056. options.isMultiHover = me.options.isMultiHover;
  70057. options.isClickAble = me.options.isClickAble;
  70058. options.highlightStyle = ShapeFactory.transformStyle(me.highlightStyle);
  70059. //将数据转为专题要素(Vector)
  70060. var thematicFeature = new ThemeVector(feature, me, ShapeFactory.transformStyle(style), options);
  70061. //直接添加图形到渲染器
  70062. for (var m = 0; m < thematicFeature.shapes.length; m++) {
  70063. me.renderer.addShape(thematicFeature.shapes[m]);
  70064. }
  70065. return thematicFeature;
  70066. },
  70067. /**
  70068. * @function L.supermap.GeoFeatureThemeLayer.prototype.redraw
  70069. * @description 重绘该图层。
  70070. */
  70071. redraw: function () {
  70072. this.clearCache();
  70073. return ThemeLayer.prototype.redraw.apply(this, arguments);
  70074. },
  70075. /**
  70076. * @function L.supermap.GeoFeatureThemeLayer.prototype.clearCache
  70077. * @description 清除缓存数据。
  70078. */
  70079. clearCache: function () {
  70080. this.cache = {};
  70081. this.cacheFields = [];
  70082. },
  70083. /**
  70084. * @function L.supermap.GeoFeatureThemeLayer.prototype.clear
  70085. * @description 清除的内容包括数据(features) 、专题要素、缓存。
  70086. */
  70087. clear: function () {
  70088. var me = this;
  70089. me.renderer.clearAll();
  70090. me.renderer.refresh();
  70091. me.removeAllFeatures();
  70092. me.clearCache();
  70093. },
  70094. /**
  70095. * @function L.supermap.GeoFeatureThemeLayer.prototype.getCacheCount
  70096. * @description 获取当前缓存数量。
  70097. * @returns {number} 返回当前缓存数量。
  70098. */
  70099. getCacheCount: function () {
  70100. return this.cacheFields.length;
  70101. },
  70102. /**
  70103. * @function L.supermap.GeoFeatureThemeLayer.prototype.setMaxCacheCount
  70104. * @description 设置最大缓存数量。
  70105. * @param {number} cacheCount - 最大缓存量。
  70106. */
  70107. setMaxCacheCount: function (cacheCount) {
  70108. if (isNaN(cacheCount)) {
  70109. return;
  70110. }
  70111. this.maxCacheCount = cacheCount;
  70112. this.isCustomSetMaxCacheCount = true;
  70113. },
  70114. /**
  70115. * @function L.supermap.GeoFeatureThemeLayer.prototype.getShapesByFeatureID
  70116. * @description 通过 FeatureID 获取 feature 关联的所有图形。如果不传入此参数,函数将返回所有图形。
  70117. * @param {number} featureID - 要素 ID。
  70118. */
  70119. getShapesByFeatureID: function (featureID) {
  70120. var me = this,
  70121. list = [],
  70122. shapeList = me.renderer.getAllShapes();
  70123. if (!featureID) {
  70124. return shapeList
  70125. }
  70126. for (var i = 0, len = shapeList.length; i < len; i++) {
  70127. var si = shapeList[i];
  70128. if (si.refDataID && featureID === si.refDataID) {
  70129. list.push(si);
  70130. }
  70131. }
  70132. return list;
  70133. }
  70134. });
  70135. ;// CONCATENATED MODULE: ./src/leaflet/overlay/UniqueThemeLayer.js
  70136. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  70137. * This program are made available under the terms of the Apache License, Version 2.0
  70138. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  70139. /**
  70140. * @class L.supermap.uniqueThemeLayer
  70141. * @classdesc 客户端单值专题图。
  70142. * @category Visualization Theme
  70143. * @description 单值专题图是利用不同的颜色或符号(线型、填充)表示图层中某一属性信息的不同属性值,属性值相同的要素具有相同的渲染风格。
  70144. * 比如土壤类型分布图、土地利用图、行政区划图等。单值专题图着重表示现象质的差别,一般不表示数量的特征。
  70145. * @extends L.supermap.GeoFeatureThemeLayer
  70146. * @param {string} name - 专题图层名。
  70147. * @param {Object} options - 可选参数。
  70148. * @param {string} [options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  70149. * @param {number} [options.opacity=1] - 图层透明度。
  70150. * @param {boolean} [options.alwaysMapCRS=false] - 要素坐标是否和地图坐标系一致,要素默认是经纬度坐标。
  70151. * @param {Array} [options.TFEvents] - 专题要素事件临时存储。
  70152. * @param {number} [options.nodesClipPixel=2] - 节点抽稀像素距离。
  70153. * @param {boolean} [options.isHoverAble=false] - 图形是否在 hover 时高亮。
  70154. * @param {boolean} [options.isMultiHover=false] - 是否多图形同时高亮,用于高亮同一个数据对应的所有图形(如:多面)。
  70155. * @param {boolean} [options.isClickAble=true] - 图形是否可点击。
  70156. * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权描述信息。
  70157. * @param {boolean} [options.isAllowFeatureStyle=false] - 是否允许 feature 样式(style) 中的有效属性应用到专题图层。
  70158. * 禁止对专题要素使用数据(feature)的 style。
  70159. * 此属性可强制将数据 feature 的 style 中有效属性应用到专题要素上,且拥有比图层 style 和 styleGroups 更高的优先级,使专题要素
  70160. * 的样式脱离专题图层的控制。可以通过此方式实现对特殊数据(feature) 对应专题要素赋予独立 style。
  70161. */
  70162. var UniqueThemeLayer = GeoFeatureThemeLayer.extend({
  70163. /**
  70164. * @member {Object} L.supermap.uniqueThemeLayer.prototype.style
  70165. * @description 专题图样式。
  70166. */
  70167. /**
  70168. * @member {Object} L.supermap.uniqueThemeLayer.prototype.styleGroups
  70169. * @description 各专题类型样式组。
  70170. */
  70171. /**
  70172. * @member {Object} L.supermap.uniqueThemeLayer.prototype.highlightStyle
  70173. * @description 开启 hover 事件后,触发的样式风格。
  70174. */
  70175. initialize: function (name, options) {
  70176. GeoFeatureThemeLayer.prototype.initialize.call(this, name, options);
  70177. //{Array.<SuperMap.ThemeStyle>} 图层中专题要素的样式
  70178. this.style = [];
  70179. //{string} 用于指定专题要素样式的属性字段名称。
  70180. // 此属性字段是要用户数据(feature) attributes 中包含的字段,且字段对应的值的类型必须是数值型。使用标签分组显示还需要设置 styleGroups 属性。
  70181. this.themeField = null;
  70182. //使用此属性需要设置 themeField 属性。
  70183. //1.没有同时设置 themeField 和 styleGroups,则所有专题要素都使用本图层的 style 进行渲染;
  70184. //2.同时设置 themeField 和 styleGroups,则按照 themeField 指定的字段名称获取用户数据(feature)attributes 中对应的属性值;
  70185. // a.如果属性值等于 styleGroups 数组里某个元素定义的 value 值,则此专题要素取 styleGroups 数组中该元素定义的 style 进行渲染。
  70186. // b.如果属性值不等于 styleGroups 数组里任何元素定义的 value 值,则此专题要素按照本图层的 style 进行渲染。
  70187. //此数组每个元素对象必须有两个属性:value : 与字段 themeField 相对应的属性值;style:专题要素 style。
  70188. this.styleGroups = [];
  70189. },
  70190. /**
  70191. * @private
  70192. * @function L.supermap.uniqueThemeLayer.prototype.getStyleByData
  70193. * @description 根据用户数据(feature)设置专题要素的 Style。
  70194. * @param {SuperMap.Feature.Vector} feat - 用户要素数据。
  70195. * @returns {Array.<SuperMap.ThemeStyle>} 返回包含专题要素 style 的对象。
  70196. */
  70197. getStyleByData: function (feat) {
  70198. var me = this,
  70199. feature = feat,
  70200. style = Util.copyAttributesWithClip({}, me.style);
  70201. var groups = me.styleGroups,
  70202. isSfInAttributes = false,//指定的 themeField 是否是 feature 的属性字段之一
  70203. attribute = null; //属性值
  70204. var isValidStyleGroup = me.styleGroups && me.styleGroups.length > 0;
  70205. if (me.themeField && isValidStyleGroup && feature.attributes) {
  70206. var tf = me.themeField,
  70207. attributes = feature.attributes;
  70208. for (var property in attributes) {
  70209. if (tf !== property) {
  70210. continue;
  70211. }
  70212. isSfInAttributes = true;
  70213. attribute = attributes[property];
  70214. break;
  70215. }
  70216. }
  70217. //判断属性值是否属于styleGroups的某一个范围,以便对获取分组 style
  70218. if (isSfInAttributes) {
  70219. for (var i = 0, len = groups.length; i < len; i++) {
  70220. if ((attribute).toString() === ( groups[i].value).toString()) {
  70221. var sty1 = groups[i].style;
  70222. style = Util.copyAttributesWithClip(style, sty1);
  70223. }
  70224. }
  70225. }
  70226. return style;
  70227. }
  70228. });
  70229. var uniqueThemeLayer = function (name, options) {
  70230. return new UniqueThemeLayer(name, options);
  70231. };
  70232. (external_L_default()).supermap.uniqueThemeLayer = uniqueThemeLayer;
  70233. ;// CONCATENATED MODULE: ./src/leaflet/overlay/RangeThemeLayer.js
  70234. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  70235. * This program are made available under the terms of the Apache License, Version 2.0
  70236. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  70237. /**
  70238. * @class L.supermap.rangeThemeLayer
  70239. * @classdesc 范围分段专题图。
  70240. * @category Visualization Theme
  70241. * @description 范围分段专题图对数据(<{@link SuperMap.Feature.Vector}>)属性字段(attributes)的属性值进行分段,使用不同的颜色或符号(线型、填充)渲染不同范围段的属性值。
  70242. * 分段专题图一般用来反映连续分布现象的数量或程度特征,如降水量的分布,土壤侵蚀强度的分布等。
  70243. * @extends L.supermap.GeoFeatureThemeLayer
  70244. * @param {string} name - 图层名
  70245. * @param {Object} options - 图层参数。
  70246. * @param {string} [options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  70247. * @param {number} [options.opacity=1] - 图层透明度。
  70248. * @param {boolean} [options.alwaysMapCRS=false] - 要素坐标是否和地图坐标系一致,要素默认是经纬度坐标。
  70249. * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权描述信息。
  70250. * @param {Array} [options.TFEvents] - 专题要素事件临时存储。
  70251. * @param {number} [options.nodesClipPixel=2] - 节点抽稀像素距离。
  70252. * @param {boolean} [options.isHoverAble=false] - 图形是否在 hover 时高亮。
  70253. * @param {boolean} [options.isMultiHover=false] - 是否多图形同时高亮,用于高亮同一个数据对应的所有图形(如:多面)。
  70254. * @param {boolean} [options.isClickAble=true] - 图形是否可点击。
  70255. * @param {boolean} [options.isAllowFeatureStyle=false] - 是否允许 feature 样式(style) 中的有效属性应用到专题图层。
  70256. * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权描述信息。
  70257. * 禁止对专题要素使用数据(feature)的 style。
  70258. * 此属性可强制将数据 feature 的 style 中有效属性应用到专题要素上,且拥有比图层 style 和 styleGroups 更高的优先级,使专题要素
  70259. * 的样式脱离专题图层的控制。可以通过此方式实现对特殊数据(feature) 对应专题要素赋予独立 style。
  70260. */
  70261. var RangeThemeLayer = GeoFeatureThemeLayer.extend({
  70262. /**
  70263. * @member {Object} L.supermap.rangeThemeLayer.prototype.style
  70264. * @description 专题图样式。
  70265. */
  70266. /**
  70267. * @member {Object} L.supermap.rangeThemeLayer.prototype.styleGroups
  70268. * @description 各专题类型样式组。
  70269. */
  70270. /**
  70271. * @member {Object} L.supermap.rangeThemeLayer.prototype.highlightStyle
  70272. * @description 开启 hover 事件后,触发的样式风格。
  70273. */
  70274. initialize: function (name, options) {
  70275. GeoFeatureThemeLayer.prototype.initialize.call(this, name, options);
  70276. //{Array.<SuperMap.ThemeStyle>} 图层中专题要素的样式
  70277. this.style = [];
  70278. //{string} 用于指定专题要素样式的属性字段名称。
  70279. // 此属性字段是要用户数据(feature) attributes 中包含的字段,且字段对应的值的类型必须是数值型。使用标签分组显示还需要设置 styleGroups 属性。
  70280. this.themeField = null;
  70281. //使用此属性需要设置 themeField 属性。
  70282. //1.没有同时设置 themeField 和 styleGroups,则所有专题要素都使用本图层的 style 进行渲染;
  70283. //2.同时设置 themeField 和 styleGroups,则按照 themeField 指定的字段名称获取用户数据(feature)attributes 中对应的属性值;
  70284. // a.如果属性值等于 styleGroups 数组里某个元素定义的 value 值,则此专题要素取 styleGroups 数组中该元素定义的 style 进行渲染。
  70285. // b.如果属性值不等于 styleGroups 数组里任何元素定义的 value 值,则此专题要素按照本图层的 style 进行渲染。
  70286. //此数组每个元素对象必须有两个属性:value : 与字段 themeField 相对应的属性值;style:专题要素 style。
  70287. this.styleGroups = [];
  70288. },
  70289. /**
  70290. * @function L.supermap.rangeThemeLayer.prototype.getStyleByData
  70291. * @description 根据用户数据(feature)设置专题要素的 Style。
  70292. * @param {SuperMap.Feature.Vector} feat - 矢量要素对象。
  70293. * @returns {Array.<SuperMap.ThemeStyle>} 专题要素的 Style。
  70294. */
  70295. getStyleByData: function (feat) {
  70296. var me = this,
  70297. feature = feat,
  70298. style = Util.copyAttributesWithClip({}, me.style);
  70299. var groups = me.styleGroups,
  70300. isSfInAttributes = false,//指定的 themeField 是否是 feature 的属性字段之一
  70301. attribute = null; //属性值
  70302. var isValidStyleGroup = me.styleGroups && me.styleGroups.length > 0;
  70303. if (me.themeField && isValidStyleGroup && feature.attributes) {
  70304. var Sf = me.themeField,
  70305. attributes = feature.attributes;
  70306. for (var property in attributes) {
  70307. if (Sf !== property) {
  70308. continue;
  70309. }
  70310. isSfInAttributes = true;
  70311. attribute = attributes[property];
  70312. break;
  70313. }
  70314. }
  70315. //判断属性值是否属于styleGroups的某一个范围,以便对获取分组 style
  70316. if (isSfInAttributes) {
  70317. for (var i = 0, len = groups.length; i < len; i++) {
  70318. var isContianed = i === len-1 ? ((attribute >= groups[i].start) && (attribute <= groups[i].end)) : ((attribute >= groups[i].start) && (attribute < groups[i].end));
  70319. if (isContianed) {
  70320. var sty1 = groups[i].style;
  70321. style = Util.copyAttributesWithClip(style, sty1);
  70322. }
  70323. }
  70324. }
  70325. return style;
  70326. }
  70327. });
  70328. var rangeThemeLayer = function (name, options) {
  70329. return new RangeThemeLayer(name, options);
  70330. };
  70331. (external_L_default()).supermap.rangeThemeLayer = rangeThemeLayer;
  70332. ;// CONCATENATED MODULE: ./src/leaflet/overlay/LabelThemeLayer.js
  70333. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  70334. * This program are made available under the terms of the Apache License, Version 2.0
  70335. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  70336. /**
  70337. * @class L.supermap.labelThemeLayer
  70338. * @classdesc 标签专题图。
  70339. * @category Visualization Theme
  70340. * @extends L.supermap.GeoFeatureThemeLayer
  70341. * @param {string} name - 图层名。
  70342. * @param {Object} options - 图层参数。
  70343. * @param {string} options.themeFields - 指定创建专题图字段。
  70344. * @param {string} [options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  70345. * @param {boolean} [options.isAvoid=true] - 是否进行地图边缘的避让处理。
  70346. * @param {boolean} [options.alwaysMapCRS=false] - 要素坐标是否和地图坐标系一致,要素默认是经纬度坐标。
  70347. * @param {boolean} [options.isOverLay=true] - 是否进行压盖处理,如果设为 true,图表绘制过程中将隐藏对已在图层中绘制的图表产生压盖的图表。
  70348. * @param {number} [options.opacity=1] - 图层透明度。
  70349. * @param {Array} [options.TFEvents] - 专题要素事件临时存储。
  70350. * @param {number} [options.nodesClipPixel=2] - 节点抽稀像素距离。
  70351. * @param {boolean} [options.isHoverAble=false] - 图形是否在 hover 时高亮。
  70352. * @param {boolean} [options.isMultiHover=false] - 是否多图形同时高亮,用于高亮同一个数据对应的所有图形(如:多面)。
  70353. * @param {boolean} [options.isClickAble=true] - 图形是否可点击。
  70354. * @param {boolean} [options.isAllowFeatureStyle=false] - 是否允许 feature 样式(style) 中的有效属性应用到专题图层。
  70355. * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权描述信息。
  70356. * 禁止对专题要素使用数据(feature)的 style。
  70357. * 此属性可强制将数据 feature 的 style 中有效属性应用到专题要素上,且拥有比图层 style 和 styleGroups 更高的优先级,使专题要素
  70358. * 的样式脱离专题图层的控制。可以通过此方式实现对特殊数据(feature) 对应专题要素赋予独立 style。
  70359. */
  70360. var LabelThemeLayer = GeoFeatureThemeLayer.extend({
  70361. /**
  70362. * @member {Object} L.supermap.labelThemeLayer.prototype.style
  70363. * @description 专题图样式。
  70364. */
  70365. /**
  70366. * @member {Object} L.supermap.labelThemeLayer.prototype.styleGroups
  70367. * @description 各专题类型样式组。
  70368. */
  70369. /**
  70370. * @member {Object} L.supermap.labelThemeLayer.prototype.highlightStyle
  70371. * @description 开启 hover 事件后,触发的样式风格。
  70372. */
  70373. options: {
  70374. //是否进行压盖处理,如果设为true,将隐藏被压盖的标签,默认为true。
  70375. isOverLay: true,
  70376. //是否进行地图边缘的避让处理,如果设为true,将把与地图边缘相交的标签移到地图范围内,默认为 true,在地图边缘处做避让处理。
  70377. isAvoid: true
  70378. },
  70379. initialize: function (name, options) {
  70380. GeoFeatureThemeLayer.prototype.initialize.call(this, name, options);
  70381. external_L_default().Util.setOptions(this, options);
  70382. //图层中专题要素的样式
  70383. this.style = [];
  70384. //用于指定专题要素样式的属性字段名称。
  70385. // 此属性字段是要用户数据(feature) attributes 中包含的字段,且字段对应的值的类型必须是数值型。使用标签分组显示还需要设置 styleGroups 属性。
  70386. this.themeField = null;
  70387. //使用此属性需要设置 themeField 属性。
  70388. //1.没有同时设置 themeField 和 styleGroups,则所有专题要素都使用本图层的 style 进行渲染;
  70389. //2.同时设置 themeField 和 styleGroups,则按照 themeField 指定的字段名称获取用户数据(feature)attributes 中对应的属性值;
  70390. // a.如果属性值等于 styleGroups 数组里某个元素定义的 value 值,则此专题要素取 styleGroups 数组中该元素定义的 style 进行渲染。
  70391. // b.如果属性值不等于 styleGroups 数组里任何元素定义的 value 值,则此专题要素按照本图层的 style 进行渲染。
  70392. //此数组每个元素对象必须有两个属性:value : 与字段 themeField 相对应的属性值;style:专题要素 style。
  70393. this.styleGroups = [];
  70394. this.defaultStyle = {
  70395. //默认文本样式
  70396. fontColor: "#000000",
  70397. fontOpacity: 1,
  70398. fontSize: "12px",
  70399. fontStyle: "normal",
  70400. fontWeight: "normal",
  70401. labelAlign: "cm",
  70402. labelXOffset: 0,
  70403. labelYOffset: 0,
  70404. labelRotation: 0,
  70405. //默认样式
  70406. fill: false,
  70407. fillColor: "#ee9900",
  70408. fillOpacity: 0.4,
  70409. stroke: false,
  70410. strokeColor: "#ee9900",
  70411. strokeOpacity: 1,
  70412. strokeWidth: 1,
  70413. strokeLinecap: "round",
  70414. strokeDashstyle: "solid",
  70415. //默认显示背景框
  70416. labelRect: true,
  70417. //对用户隐藏但必须保持此值的属性
  70418. //cursor: "pointer",
  70419. labelSelect: true,
  70420. //用 _isGeoTextStrategyStyle 标记此style,携带此类style的要素特指GeoText策略中的标签要素
  70421. _isGeoTextStrategyStyle: true
  70422. };
  70423. //获取标签像素 bounds 的方式。0 - 表示通过文本类容和文本风格计算获取像素范围,现在支持中文、英文; 1 - 表示通过绘制的文本标签获取像素范围,支持各个语种的文字范围获取,但性能消耗较大(尤其是采用SVG渲染)。默认值为0。
  70424. this.getPxBoundsMode = 0;
  70425. this.labelFeatures = [];
  70426. },
  70427. /**
  70428. * @function L.supermap.LabelThemeLayer.prototype.onAdd
  70429. * @description 添加专题图。
  70430. * @param {L.Map} map - 要添加的地图。
  70431. * @private
  70432. */
  70433. onAdd: function (map) {
  70434. GeoFeatureThemeLayer.prototype.onAdd.call(this, map);
  70435. this.container.style.zIndex = 200;
  70436. },
  70437. /**
  70438. * @function L.supermap.LabelThemeLayer.prototype.redrawThematicFeatures
  70439. * @description 重绘所有专题要素。
  70440. * 此方法包含绘制专题要素的所有步骤,包含用户数据到专题要素的转换,抽稀,缓存等步骤。
  70441. * 地图漫游时调用此方法进行图层刷新。
  70442. * @param {L.bounds} bounds - 重绘范围。
  70443. */
  70444. redrawThematicFeatures: function (bounds) {
  70445. if (this.features.length > 0 && this.labelFeatures.length == 0) {
  70446. var feats = this.setLabelsStyle(this.features);
  70447. for (var i = 0, len = feats.length; i < len; i++) {
  70448. this.labelFeatures.push(feats[i]);
  70449. }
  70450. }
  70451. this.features = this.getDrawnLabels(this.labelFeatures);
  70452. GeoFeatureThemeLayer.prototype.redrawThematicFeatures.call(this, bounds);
  70453. },
  70454. /**
  70455. * @function L.supermap.LabelThemeLayer.prototype.removeFeatures
  70456. * @description 从专题图中删除 feature。这个函数删除所有传递进来的矢量要素。参数中的 features 数组中的每一项,必须是已经添加到当前图层中的 feature。
  70457. * @param {Array.<SuperMap.Feature.Vector>} features - 要删除的要素。
  70458. */
  70459. removeFeatures: function (features) { // eslint-disable-line no-unused-vars
  70460. this.labelFeatures = [];
  70461. GeoFeatureThemeLayer.prototype.removeFeatures.call(this, arguments);
  70462. },
  70463. /**
  70464. * @function L.supermap.LabelThemeLayer.prototype.removeAllFeatures
  70465. * @description 清除当前图层所有的矢量要素。
  70466. */
  70467. removeAllFeatures: function () {
  70468. this.labelFeatures = [];
  70469. GeoFeatureThemeLayer.prototype.removeAllFeatures.call(this, arguments);
  70470. },
  70471. /**
  70472. * @function L.supermap.LabelThemeLayer.prototype.getDrawnLabels
  70473. * @description 获取经(压盖)处理后将要绘制在图层上的标签要素。
  70474. * @param {Array.<SuperMap.Feature.Vector>} labelFeatures - 所有标签要素的数组。
  70475. * @returns {Array.<SuperMap.Feature.Vector>} 最终要绘制的标签要素数组。
  70476. */
  70477. getDrawnLabels: function (labelFeatures) {
  70478. var feas = [], //最终要绘制的标签要素集
  70479. fea, //最终要绘制的标签要素
  70480. fi, //临时标签要素,用户的第i个标签
  70481. labelsB = [], //不产生压盖的标签要素范围集
  70482. styTmp, //用于临时存储要素style的变量
  70483. feaSty, //标签要素最终的style
  70484. // styleTemp用于屏蔽文本style中带有偏移性质style属性,偏移已经在计算bounds的过程中参与了运算,
  70485. // 所以在最终按照bounds来绘制标签时,需屏蔽style中带有偏移性质属性,否则文本的偏移量将扩大一倍。
  70486. styleTemp = {
  70487. labelAlign: "cm",
  70488. labelXOffset: 0,
  70489. labelYOffset: 0
  70490. };
  70491. var map = this._map;
  70492. var mapSize = map.getSize();
  70493. var zoom = map.getZoom();
  70494. //对用户的每个标签要素进行处理与判断
  70495. for (var i = 0, len = labelFeatures.length; i < len; i++) {
  70496. fi = labelFeatures[i];
  70497. //检查fi的style在避让中是否被改变,如果改变,重新设置要素的style
  70498. if (fi.isStyleChange || fi.isStyleChange === undefined) {
  70499. fi = this.setStyle(fi);
  70500. }
  70501. //标签最终的中心点像素位置 (偏移后)
  70502. var loc = this.getLabelPxLocation(fi);
  70503. //过滤掉地图范围外的标签 (偏移后)
  70504. if ((loc.x >= 0 && loc.x <= mapSize.x) && (loc.y >= 0 && loc.y <= mapSize.y)) {
  70505. //根据当前地图缩放级别过滤标签
  70506. if (fi.style.minZoomLevel > -1) {
  70507. if (zoom <= fi.style.minZoomLevel) {
  70508. continue;
  70509. }
  70510. }
  70511. if (fi.style.maxZoomLevel > -1) {
  70512. if (zoom > fi.style.maxZoomLevel) {
  70513. continue;
  70514. }
  70515. }
  70516. //计算标签bounds
  70517. var boundsQuad = null;
  70518. if (fi.isStyleChange) {
  70519. fi.isStyleChange = null;
  70520. boundsQuad = this.calculateLabelBounds(fi, loc);
  70521. } else {
  70522. if (fi.geometry.bsInfo.w && fi.geometry.bsInfo.h) {
  70523. //使用calculateLabelBounds2可以提高bounds的计算效率,尤其是在getPxBoundsMode = 1时
  70524. boundsQuad = this.calculateLabelBounds2(fi, loc);
  70525. } else {
  70526. boundsQuad = this.calculateLabelBounds(fi, loc);
  70527. }
  70528. }
  70529. //避让处理 -start
  70530. var mapViewBounds = new Bounds(0, mapSize.y, mapSize.x, 0), //地图像素范围
  70531. quadlen = boundsQuad.length;
  70532. if (this.options.isAvoid) {
  70533. var avoidInfo = this.getAvoidInfo(mapViewBounds, boundsQuad); //避让信息
  70534. if (avoidInfo) {
  70535. //横向(x方向)上的避让
  70536. if (avoidInfo.aspectW === "left") {
  70537. fi.style.labelXOffset += avoidInfo.offsetX;
  70538. for (let j = 0; j < quadlen; j++) {
  70539. boundsQuad[j].x += avoidInfo.offsetX;
  70540. }
  70541. } else if (avoidInfo.aspectW === "right") {
  70542. fi.style.labelXOffset += (-avoidInfo.offsetX);
  70543. for (let j = 0; j < quadlen; j++) {
  70544. boundsQuad[j].x += (-avoidInfo.offsetX);
  70545. }
  70546. }
  70547. //纵向(y方向)上的避让
  70548. if (avoidInfo.aspectH === "top") {
  70549. fi.style.labelYOffset += avoidInfo.offsetY;
  70550. for (let j = 0; j < quadlen; j++) {
  70551. boundsQuad[j].y += avoidInfo.offsetY;
  70552. }
  70553. } else if (avoidInfo.aspectH === "bottom") {
  70554. fi.style.labelYOffset += (-avoidInfo.offsetY);
  70555. for (let j = 0; j < quadlen; j++) {
  70556. boundsQuad[j].y += (-avoidInfo.offsetY);
  70557. }
  70558. }
  70559. //如果style发生变化,记录下来
  70560. fi.isStyleChange = true;
  70561. }
  70562. }
  70563. //避让处理 -end
  70564. //压盖处理 -start
  70565. if (this.options.isOverLay) {
  70566. //是否压盖
  70567. var isOL = false;
  70568. if (i != 0) {
  70569. for (let j = 0; j < labelsB.length; j++) {
  70570. //压盖判断
  70571. if (this.isQuadrilateralOverLap(boundsQuad, labelsB[j])) {
  70572. isOL = true;
  70573. break;
  70574. }
  70575. }
  70576. }
  70577. if (isOL) {
  70578. continue;
  70579. } else {
  70580. labelsB.push(boundsQuad);
  70581. }
  70582. }
  70583. //压盖处理 -end
  70584. //背景(事件)-start
  70585. //将标签像素范围转为地理范围
  70586. var geoBs = [];
  70587. for (let j = 0; j < quadlen - 1; j++) {
  70588. geoBs.push(map.containerPointToLatLng(boundsQuad[j]));
  70589. }
  70590. //屏蔽有偏移性质的style属性,偏移量在算bounds时已经加入计算
  70591. var leftBottom = geoBs[3];
  70592. var rightTop = geoBs[1];
  70593. var bounds = new Bounds(leftBottom.lng, leftBottom.lat, rightTop.lng, rightTop.lat);
  70594. var center = bounds.getCenterLonLat();
  70595. var label = new GeoText(center.lon, center.lat, fi.attributes[this.themeField]);
  70596. label.calculateBounds();
  70597. styTmp = Util.cloneObject(fi.style);
  70598. feaSty = Util.cloneObject(Util.copyAttributes(styTmp, styleTemp));
  70599. fea = new Vector(label, fi.attributes, feaSty);
  70600. //赋予id
  70601. fea.id = fi.id;
  70602. fea.fid = fi.fid;
  70603. feas.push(fea);
  70604. }
  70605. }
  70606. //返回最终要绘制的标签要素
  70607. return feas;
  70608. },
  70609. /**
  70610. * @function L.supermap.LabelThemeLayer.prototype.getStyleByData
  70611. * @description 根据用户数据(feature)设置专题要素的 Style。
  70612. * @param {SuperMap.Feature.Vector} feat - 矢量要素对象。
  70613. * @returns {Array.<SuperMap.ThemeStyle>} 专题要素的 Style。
  70614. */
  70615. getStyleByData: function (feat) {
  70616. var feature = feat;
  70617. feature.style = Util.copyAttributes(feature.style, this.defaultStyle);
  70618. //将style赋给标签
  70619. if (this.style && this.style.fontSize && parseFloat(this.style.fontSize) < 12) {
  70620. this.style.fontSize = "12px";
  70621. }
  70622. feature.style = Util.copyAttributes(feature.style, this.style);
  70623. if (this.themeField && this.styleGroups && feature.attributes) {
  70624. var Sf = this.themeField;
  70625. var attributes = feature.attributes;
  70626. var groups = this.styleGroups;
  70627. var isSfInAttrs = false; //指定的 groupField 是否是geotext的属性字段之一
  70628. var attr = null; //属性值
  70629. for (var property in attributes) {
  70630. if (Sf === property) {
  70631. isSfInAttrs = true;
  70632. attr = attributes[property];
  70633. break;
  70634. }
  70635. }
  70636. //判断属性值是否属于styleGroups的某一个范围,以便对标签分组
  70637. if (isSfInAttrs) {
  70638. for (var i = 0, len = groups.length; i < len; i++) {
  70639. if ((attr >= groups[i].start) && (attr < groups[i].end)) {
  70640. var sty1 = groups[i].style;
  70641. if (sty1 && sty1.fontSize && parseFloat(sty1.fontSize) < 12) {
  70642. sty1.fontSize = "12px";
  70643. }
  70644. feature.style = Util.copyAttributes(feature.style, sty1);
  70645. }
  70646. }
  70647. }
  70648. feature.style.label = feature.attributes[this.themeField]
  70649. }
  70650. return feature.style;
  70651. },
  70652. /**
  70653. * @function L.supermap.LabelThemeLayer.prototype.setLabelsStyle
  70654. * @description 设置标签要素的 Style。
  70655. * @param {Array.<SuperMap.Feature.Vector>} labelFeatures - 需要设置 Style 的标签要素数组。
  70656. * @returns {Array.<SuperMap.Feature.Vector>} 赋予 Style 后的标签要素数组。
  70657. */
  70658. setLabelsStyle: function (labelFeatures) {
  70659. var fea, labelFeas = [];
  70660. for (var i = 0, len = labelFeatures.length; i < len; i++) {
  70661. var feature = labelFeatures[i];
  70662. if (feature.geometry.CLASS_NAME === "SuperMap.Geometry.GeoText") {
  70663. //设置标签的Style
  70664. if (feature.geometry.bsInfo.w || feature.geometry.bsInfo.h) {
  70665. feature.geometry.bsInfo.w = null;
  70666. feature.geometry.bsInfo.h = null;
  70667. feature.geometry.labelWTmp = null;
  70668. }
  70669. fea = this.setStyle(feature);
  70670. //为标签要素指定图层
  70671. fea.layer = this.layer;
  70672. labelFeas.push(fea);
  70673. } else {
  70674. return labelFeatures;
  70675. }
  70676. }
  70677. return labelFeas;
  70678. },
  70679. /**
  70680. * @function L.supermap.LabelThemeLayer.prototype.setStyle
  70681. * @description 设置标签要素的 Style。
  70682. * @param {SuperMap.Feature.Vector} feat - 需要赋予 style 的要素。
  70683. */
  70684. setStyle: function (feat) {
  70685. var feature = feat;
  70686. feature.style = Util.copyAttributes(feature.style, this.defaultStyle);
  70687. //将style赋给标签
  70688. if (this.style && this.style.fontSize && parseFloat(this.style.fontSize) < 12) {
  70689. this.style.fontSize = "12px";
  70690. }
  70691. feature.style = Util.copyAttributes(feature.style, this.style);
  70692. if (this.groupField && this.styleGroups && feature.attributes) {
  70693. var Sf = this.groupField;
  70694. var Attrs = feature.attributes;
  70695. var Gro = this.styleGroups;
  70696. var isSfInAttrs = false; //指定的 groupField 是否是geotext的属性字段之一
  70697. var attr = null; //属性值
  70698. for (var property in Attrs) {
  70699. if (Sf === property) {
  70700. isSfInAttrs = true;
  70701. attr = Attrs[property];
  70702. break;
  70703. }
  70704. }
  70705. //判断属性值是否属于styleGroups的某一个范围,以便对标签分组
  70706. if (isSfInAttrs) {
  70707. for (var i = 0, len = Gro.length; i < len; i++) {
  70708. if ((attr >= Gro[i].start) && (attr < Gro[i].end)) {
  70709. //feature.style = Util.copyAttributes(feature.style, this.defaultStyle);
  70710. var sty1 = Gro[i].style;
  70711. if (sty1 && sty1.fontSize && parseFloat(sty1.fontSize) < 12) {
  70712. sty1.fontSize = "12px";
  70713. }
  70714. feature.style = Util.copyAttributes(feature.style, sty1);
  70715. }
  70716. }
  70717. }
  70718. }
  70719. //将文本内容赋到标签要素的style上
  70720. feature.style.label = feature.geometry.text;
  70721. return feature;
  70722. },
  70723. /**
  70724. * @function L.supermap.LabelThemeLayer.prototype.getLabelPxLocation
  70725. * @description 获取标签要素的像素坐标。
  70726. * @param {SuperMap.Feature.Vector} feature - 标签要素。
  70727. * @returns {L.point} 标签位置。
  70728. */
  70729. getLabelPxLocation: function (feature) {
  70730. var geoText = feature.geometry;
  70731. var styleTmp = feature.style;
  70732. //将标签的地理位置转为像素位置
  70733. var locationTmp = geoText.getCentroid();
  70734. var locTmp = this._map.latLngToContainerPoint(!this.options.alwaysMapCRS ? external_L_default().latLng(locationTmp.y, locationTmp.x) : this._map.options.crs.unproject(external_L_default().point(locationTmp.x, locationTmp.y)));
  70735. var loc = external_L_default().point(locTmp.x, locTmp.y);
  70736. //偏移处理
  70737. if (styleTmp.labelXOffset || styleTmp.labelYOffset) {
  70738. var xOffset = isNaN(styleTmp.labelXOffset) ? 0 : styleTmp.labelXOffset;
  70739. var yOffset = isNaN(styleTmp.labelYOffset) ? 0 : styleTmp.labelYOffset;
  70740. var point = loc.add(external_L_default().point(xOffset, -yOffset));
  70741. return external_L_default().point(point.x, point.y);
  70742. } else {
  70743. return external_L_default().point(loc.x, loc.y);
  70744. }
  70745. },
  70746. /**
  70747. * @function L.supermap.LabelThemeLayer.prototype.calculateLabelBounds
  70748. * @description 获得标签要素的最终范围。
  70749. *
  70750. * @param {SuperMap.Feature.Vector} feature - 需要计算 bounds 的标签要素数。
  70751. * @param {L.point} loc - 标签位置。
  70752. *
  70753. * @returns {Array.<Object>} 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  70754. */
  70755. calculateLabelBounds: function (feature, loc) {
  70756. var geoText = feature.geometry;
  70757. //标签范围(未旋转前)
  70758. var labB = null;
  70759. var labelInfo = null;
  70760. //获取bounds的方式
  70761. if (this.getPxBoundsMode == 0) {
  70762. labB = geoText.getLabelPxBoundsByText(loc, feature.style);
  70763. } else if (this.getPxBoundsMode === 1) {
  70764. //canvas
  70765. labelInfo = this.getLabelInfo(feature.geometry.getCentroid(), feature.style);
  70766. labB = geoText.getLabelPxBoundsByLabel(loc, labelInfo.w, labelInfo.h, feature.style);
  70767. } else {
  70768. return null;
  70769. }
  70770. //旋转Bounds
  70771. var boundsQuad = [];
  70772. if ((feature.style.labelRotation % 180) == 0) {
  70773. boundsQuad = [{
  70774. "x": labB.left,
  70775. "y": labB.top
  70776. },
  70777. {
  70778. "x": labB.right,
  70779. "y": labB.top
  70780. },
  70781. {
  70782. "x": labB.right,
  70783. "y": labB.bottom
  70784. },
  70785. {
  70786. "x": labB.left,
  70787. "y": labB.bottom
  70788. },
  70789. {
  70790. "x": labB.left,
  70791. "y": labB.top
  70792. }
  70793. ];
  70794. } else {
  70795. boundsQuad = this.rotationBounds(labB, loc, feature.style.labelRotation);
  70796. }
  70797. //重置GeoText的bounds
  70798. geoText.bounds = new Bounds(boundsQuad[1].x, boundsQuad[3].y, boundsQuad[2].x, boundsQuad[4].y);
  70799. return boundsQuad;
  70800. },
  70801. /**
  70802. * @function L.supermap.LabelThemeLayer.prototype.calculateLabelBounds2
  70803. * @description 获得标签要素的最终范围的另一种算法(通过记录下的标签宽高),提高计算 bounds 的效率。
  70804. *
  70805. * @param {SuperMap.Feature.Vector} feature - 需要计算 bounds 的标签要素数。
  70806. * @param {L.point} loc - 标签位置。
  70807. *
  70808. * @returns {Array.<Object>} 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  70809. */
  70810. calculateLabelBounds2: function (feature, loc) {
  70811. var labB, left, bottom, top, right;
  70812. var labelSize = feature.geometry.bsInfo;
  70813. var style = feature.style;
  70814. var locationPx = Util.cloneObject(loc);
  70815. //处理文字对齐
  70816. if (style.labelAlign && style.labelAlign !== "cm") {
  70817. switch (style.labelAlign) {
  70818. case "lt":
  70819. locationPx.x += labelSize.w / 2;
  70820. locationPx.y += labelSize.h / 2;
  70821. break;
  70822. case "lm":
  70823. locationPx.x += labelSize.w / 2;
  70824. break;
  70825. case "lb":
  70826. locationPx.x += labelSize.w / 2;
  70827. locationPx.y -= labelSize.h / 2;
  70828. break;
  70829. case "ct":
  70830. locationPx.y += labelSize.h / 2;
  70831. break;
  70832. case "cb":
  70833. locationPx.y -= labelSize.h / 2;
  70834. break;
  70835. case "rt":
  70836. locationPx.x -= labelSize.w / 2;
  70837. locationPx.y += labelSize.h / 2;
  70838. break;
  70839. case "rm":
  70840. locationPx.x -= labelSize.w / 2;
  70841. break;
  70842. case "rb":
  70843. locationPx.x -= labelSize.w / 2;
  70844. locationPx.y -= labelSize.h / 2;
  70845. break;
  70846. default:
  70847. break;
  70848. }
  70849. }
  70850. left = locationPx.x - labelSize.w / 2;
  70851. bottom = locationPx.y + labelSize.h / 2;
  70852. //处理斜体字
  70853. if (style.fontStyle && style.fontStyle === "italic") {
  70854. right = locationPx.x + labelSize.w / 2 + parseInt(parseFloat(style.fontSize) / 2);
  70855. } else {
  70856. right = locationPx.x + labelSize.w / 2;
  70857. }
  70858. top = locationPx.y - labelSize.h / 2;
  70859. labB = new Bounds(left, bottom, right, top);
  70860. //旋转Bounds
  70861. var boundsQuad = [];
  70862. if ((style.labelRotation % 180) == 0) {
  70863. boundsQuad = [{
  70864. "x": labB.left,
  70865. "y": labB.top
  70866. },
  70867. {
  70868. "x": labB.right,
  70869. "y": labB.top
  70870. },
  70871. {
  70872. "x": labB.right,
  70873. "y": labB.bottom
  70874. },
  70875. {
  70876. "x": labB.left,
  70877. "y": labB.bottom
  70878. },
  70879. {
  70880. "x": labB.left,
  70881. "y": labB.top
  70882. }
  70883. ];
  70884. } else {
  70885. boundsQuad = this.rotationBounds(labB, loc, style.labelRotation);
  70886. }
  70887. //重置GeoText的bounds
  70888. feature.geometry.bounds = new Bounds(boundsQuad[1].x, boundsQuad[3].y, boundsQuad[2].x, boundsQuad[4].y);
  70889. return boundsQuad;
  70890. },
  70891. /**
  70892. * @function L.supermap.LabelThemeLayer.prototype.getLabelInfo
  70893. * @description 根据当前位置获取绘制后的标签信息,包括标签的宽,高和行数等。
  70894. * @returns {Object} 绘制后的标签信息。
  70895. */
  70896. getLabelInfo: function (location, style) {
  70897. var LABEL_ALIGN = {
  70898. "l": "left",
  70899. "r": "right",
  70900. "t": "top",
  70901. "b": "bottom"
  70902. },
  70903. LABEL_FACTOR = {
  70904. "l": 0,
  70905. "r": -1,
  70906. "t": 0,
  70907. "b": -1
  70908. };
  70909. style = Util.extend({
  70910. fontColor: "#000000",
  70911. labelAlign: "cm"
  70912. }, style);
  70913. var pt = this.getLocalXY(location);
  70914. var labelWidth = 0;
  70915. if (style.labelXOffset || style.labelYOffset) {
  70916. var xOffset = isNaN(style.labelXOffset) ? 0 : style.labelXOffset;
  70917. var yOffset = isNaN(style.labelYOffset) ? 0 : style.labelYOffset;
  70918. pt[0] += xOffset;
  70919. pt[1] -= yOffset;
  70920. }
  70921. var canvas = document.createElement('canvas');
  70922. canvas.globalAlpha = 0;
  70923. canvas.lineWidth = 1;
  70924. var ctx = canvas.getContext("2d");
  70925. ctx.fillStyle = style.fontColor;
  70926. ctx.globalAlpha = style.fontOpacity || 1.0;
  70927. var fontStyle = [style.fontStyle ? style.fontStyle : "normal",
  70928. "normal",
  70929. style.fontWeight ? style.fontWeight : "normal",
  70930. style.fontSize ? style.fontSize : "1em",
  70931. style.fontFamily ? style.fontFamily : "sans-serif"
  70932. ].join(" ");
  70933. var labelRows = style.label.split('\n');
  70934. var numRows = labelRows.length;
  70935. var vfactor, lineHeight, labelWidthTmp;
  70936. if (ctx.fillText) {
  70937. // HTML5
  70938. ctx.font = fontStyle;
  70939. ctx.textAlign = LABEL_ALIGN[style.labelAlign[0]] ||
  70940. "center";
  70941. ctx.textBaseline = LABEL_ALIGN[style.labelAlign[1]] ||
  70942. "middle";
  70943. vfactor = LABEL_FACTOR[style.labelAlign[1]];
  70944. if (vfactor == null) {
  70945. vfactor = -.5;
  70946. }
  70947. lineHeight = ctx.measureText('Mg').height ||
  70948. ctx.measureText('xx').width;
  70949. pt[1] += lineHeight * vfactor * (numRows - 1);
  70950. for (let i = 0; i < numRows; i++) {
  70951. labelWidthTmp = ctx.measureText(labelRows[i]).width;
  70952. if (labelWidth < labelWidthTmp) {
  70953. labelWidth = labelWidthTmp;
  70954. }
  70955. }
  70956. } else if (ctx.mozDrawText) {
  70957. // Mozilla pre-Gecko1.9.1 (<FF3.1)
  70958. ctx.mozTextStyle = fontStyle;
  70959. vfactor = LABEL_FACTOR[style.labelAlign[1]];
  70960. if (vfactor == null) {
  70961. vfactor = -.5;
  70962. }
  70963. lineHeight = ctx.mozMeasureText('xx');
  70964. pt[1] += lineHeight * (1 + (vfactor * numRows));
  70965. for (let i = 0; i < numRows; i++) {
  70966. labelWidthTmp = ctx.measureText(labelRows[i]).width;
  70967. if (labelWidth < labelWidthTmp) {
  70968. labelWidth = labelWidthTmp;
  70969. }
  70970. }
  70971. }
  70972. var labelInfo = {}; //标签信息
  70973. if (labelWidth) {
  70974. labelInfo.w = labelWidth; //标签的宽
  70975. } else {
  70976. return null;
  70977. }
  70978. labelInfo.h = style.fontSize; //一行标签的高
  70979. labelInfo.rows = labelRows.length; //标签的行数
  70980. return labelInfo;
  70981. },
  70982. /**
  70983. * @function L.supermap.LabelThemeLayer.prototype.rotationBounds
  70984. * @description 旋转 bounds。
  70985. *
  70986. * @param {SuperMap.Bounds} bounds - 要旋转的 bounds。
  70987. * @param {Object} rotationCenterPoi - 旋转中心点对象,此对象含有属性x(横坐标),属性y(纵坐标)。
  70988. * @param {number} angle - 旋转角度(顺时针)。
  70989. *
  70990. * @returns {Array.<Object>} bounds旋转后形成的多边形节点数组。是一个四边形,形如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  70991. */
  70992. rotationBounds: function (bounds, rotationCenterPoi, angle) {
  70993. var ltPoi = external_L_default().point(bounds.left, bounds.top);
  70994. var rtPoi = external_L_default().point(bounds.right, bounds.top);
  70995. var rbPoi = external_L_default().point(bounds.right, bounds.bottom);
  70996. var lbPoi = external_L_default().point(bounds.left, bounds.bottom);
  70997. var ver = [];
  70998. ver.push(this.getRotatedLocation(ltPoi.x, ltPoi.y, rotationCenterPoi.x, rotationCenterPoi.y, angle));
  70999. ver.push(this.getRotatedLocation(rtPoi.x, rtPoi.y, rotationCenterPoi.x, rotationCenterPoi.y, angle));
  71000. ver.push(this.getRotatedLocation(rbPoi.x, rbPoi.y, rotationCenterPoi.x, rotationCenterPoi.y, angle));
  71001. ver.push(this.getRotatedLocation(lbPoi.x, lbPoi.y, rotationCenterPoi.x, rotationCenterPoi.y, angle));
  71002. //bounds旋转后形成的多边形节点数组
  71003. var quad = [];
  71004. for (var i = 0; i < ver.length; i++) {
  71005. quad.push({
  71006. "x": ver[i].x,
  71007. "y": ver[i].y
  71008. });
  71009. }
  71010. quad.push({
  71011. "x": ver[0].x,
  71012. "y": ver[0].y
  71013. });
  71014. return quad;
  71015. },
  71016. /**
  71017. * @function L.supermap.LabelThemeLayer.prototype.getRotatedLocation
  71018. * @description 获取一个点绕旋转中心顺时针旋转后的位置。(此方法用于屏幕坐标)。
  71019. *
  71020. * @param {number} x - 旋转点横坐标。
  71021. * @param {number} y - 旋转点纵坐标。
  71022. * @param {number} rx - 旋转中心点横坐标。
  71023. * @param {number} ry - 旋转中心点纵坐标。
  71024. * @param {number} angle - 旋转角度。
  71025. *
  71026. * @returns {Object} 旋转后的坐标位置对象,该对象含有属性 x(横坐标),属性 y(纵坐标)。
  71027. */
  71028. getRotatedLocation: function (x, y, rx, ry, angle) {
  71029. var loc = {},
  71030. x0, y0;
  71031. y = -y;
  71032. ry = -ry;
  71033. angle = -angle; //顺时针旋转
  71034. x0 = (x - rx) * Math.cos((angle / 180) * Math.PI) - (y - ry) * Math.sin((angle / 180) * Math.PI) + rx;
  71035. y0 = (x - rx) * Math.sin((angle / 180) * Math.PI) + (y - ry) * Math.cos((angle / 180) * Math.PI) + ry;
  71036. loc.x = x0;
  71037. loc.y = -y0;
  71038. return loc;
  71039. },
  71040. /**
  71041. * @function L.supermap.LabelThemeLayer.prototype.getAvoidInfo
  71042. * @description 获取避让的信息。
  71043. *
  71044. * @param {SuperMap.Bounds} bounds - 地图像素范围。
  71045. * @param {Array.<Object>} quadrilateral - 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  71046. *
  71047. * @returns {Object} 避让的信息。
  71048. */
  71049. getAvoidInfo: function (bounds, quadrilateral) {
  71050. if (quadrilateral.length !== 5) {
  71051. return null;
  71052. } //不是四边形
  71053. //将bound序列化为点数组形式
  71054. var bounddQuad = [{
  71055. "x": bounds.left,
  71056. "y": bounds.top
  71057. },
  71058. {
  71059. "x": bounds.right,
  71060. "y": bounds.top
  71061. },
  71062. {
  71063. "x": bounds.right,
  71064. "y": bounds.bottom
  71065. },
  71066. {
  71067. "x": bounds.left,
  71068. "y": bounds.bottom
  71069. },
  71070. {
  71071. "x": bounds.left,
  71072. "y": bounds.top
  71073. }
  71074. ];
  71075. var isIntersection = false,
  71076. bqLen = bounddQuad.length,
  71077. quadLen = quadrilateral.length;
  71078. var offsetX = 0,
  71079. offsetY = 0,
  71080. aspectH = "",
  71081. aspectW = "";
  71082. for (var i = 0; i < bqLen - 1; i++) {
  71083. for (var j = 0; j < quadLen - 1; j++) {
  71084. var isLineIn = Util.lineIntersection(bounddQuad[i], bounddQuad[i + 1], quadrilateral[j], quadrilateral[j + 1]);
  71085. if (isLineIn.CLASS_NAME === "SuperMap.Geometry.Point") {
  71086. //设置避让信息
  71087. setInfo(quadrilateral[j]);
  71088. setInfo(quadrilateral[j + 1]);
  71089. isIntersection = true;
  71090. }
  71091. }
  71092. }
  71093. if (isIntersection) {
  71094. //组织避让操作所需的信息
  71095. return {
  71096. "aspectW": aspectW,
  71097. "aspectH": aspectH,
  71098. "offsetX": offsetX,
  71099. "offsetY": offsetY
  71100. };
  71101. } else {
  71102. return null;
  71103. }
  71104. //内部函数:设置避让信息
  71105. //参数:vec-{Object} quadrilateral四边形单个节点。如:{"x":1,"y":1}。
  71106. function setInfo(vec) {
  71107. //四边形不在bounds内的节点
  71108. if (!bounds.contains(vec.x, vec.y)) {
  71109. //bounds的Top边
  71110. if (vec.y < bounds.top) {
  71111. let oY = Math.abs(bounds.top - vec.y);
  71112. if (oY > offsetY) {
  71113. offsetY = oY;
  71114. aspectH = "top";
  71115. }
  71116. }
  71117. //bounds的Bottom边
  71118. if (vec.y > bounds.bottom) {
  71119. let oY = Math.abs(vec.y - bounds.bottom);
  71120. if (oY > offsetY) {
  71121. offsetY = oY;
  71122. aspectH = "bottom";
  71123. }
  71124. }
  71125. //bounds的left边
  71126. if (vec.x < bounds.left) {
  71127. let oX = Math.abs(bounds.left - vec.x);
  71128. if (oX > offsetX) {
  71129. offsetX = oX;
  71130. aspectW = "left";
  71131. }
  71132. }
  71133. //bounds的right边
  71134. if (vec.x > bounds.right) {
  71135. let oX = Math.abs(vec.x - bounds.right);
  71136. if (oX > offsetX) {
  71137. offsetX = oX;
  71138. aspectW = "right";
  71139. }
  71140. }
  71141. }
  71142. }
  71143. },
  71144. /**
  71145. * @function L.supermap.LabelThemeLayer.prototype.isQuadrilateralOverLap
  71146. * @description 判断两个四边形是否有压盖。
  71147. *
  71148. * @param {Array.<Object>} quadrilateral - 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  71149. * @param {Array.<Object>} quadrilateral2 - 第二个四边形节点数组。
  71150. *
  71151. * @returns {boolean} 是否压盖,true表示压盖。
  71152. */
  71153. isQuadrilateralOverLap: function (quadrilateral, quadrilateral2) {
  71154. var quadLen = quadrilateral.length,
  71155. quad2Len = quadrilateral2.length;
  71156. if (quadLen !== 5 || quad2Len !== 5) {
  71157. return null;
  71158. } //不是四边形
  71159. var OverLap = false;
  71160. //如果两四边形互不包含对方的节点,则两个四边形不相交
  71161. for (let i = 0; i < quadLen; i++) {
  71162. if (this.isPointInPoly(quadrilateral[i], quadrilateral2)) {
  71163. OverLap = true;
  71164. break;
  71165. }
  71166. }
  71167. for (let i = 0; i < quad2Len; i++) {
  71168. if (this.isPointInPoly(quadrilateral2[i], quadrilateral)) {
  71169. OverLap = true;
  71170. break;
  71171. }
  71172. }
  71173. //加上两矩形十字相交的情况
  71174. for (let i = 0; i < quadLen - 1; i++) {
  71175. if (OverLap) {
  71176. break;
  71177. }
  71178. for (var j = 0; j < quad2Len - 1; j++) {
  71179. var isLineIn = Util.lineIntersection(quadrilateral[i], quadrilateral[i + 1], quadrilateral2[j], quadrilateral2[j + 1]);
  71180. if (isLineIn.CLASS_NAME === "SuperMap.Geometry.Point") {
  71181. OverLap = true;
  71182. break;
  71183. }
  71184. }
  71185. }
  71186. return OverLap;
  71187. },
  71188. /**
  71189. * @function L.supermap.LabelThemeLayer.prototype.isPointInPoly
  71190. * @description 判断一个点是否在多边形里面。(射线法)。
  71191. *
  71192. * @param {Object} pt - 需要判定的点对象,该对象含有属性 x(横坐标),属性 y(纵坐标)。
  71193. * @param {Array.<Object>} poly - 多边形节点数组。例如一个四边形:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  71194. * @returns {boolean} 点是否在多边形内。
  71195. */
  71196. isPointInPoly: function (pt, poly) {
  71197. for (var isIn = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i) {
  71198. ((poly[i].y <= pt.y && pt.y < poly[j].y) || (poly[j].y <= pt.y && pt.y < poly[i].y)) &&
  71199. (pt.x < (poly[j].x - poly[i].x) * (pt.y - poly[i].y) / (poly[j].y - poly[i].y) + poly[i].x) &&
  71200. (isIn = !isIn);
  71201. }
  71202. return isIn;
  71203. }
  71204. });
  71205. var labelThemeLayer = function (name, options) {
  71206. return new LabelThemeLayer(name, options);
  71207. };
  71208. (external_L_default()).supermap.labelThemeLayer = labelThemeLayer;
  71209. ;// CONCATENATED MODULE: ./src/leaflet/services/FeatureService.js
  71210. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  71211. * This program are made available under the terms of the Apache License, Version 2.0
  71212. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71213. /**
  71214. * @class L.supermap.featureService
  71215. * @classdesc 要素数据集类。提供:ID 查询,范围查询,SQL 查询,几何查询,bounds 查询,缓冲区查询,地物编辑。
  71216. * @category iServer Data Feature
  71217. * @example
  71218. * L.supermap.featureService(url)
  71219. * .getFeaturesByIDs(param,function(result){
  71220. * //doSomething
  71221. * })
  71222. * @extends {L.supermap.ServiceBase}
  71223. * @param {string} url - 要素数据集服务地址。
  71224. * @param {Object} options - 参数。
  71225. * @param {string} [options.proxy] - 服务代理地址。
  71226. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  71227. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  71228. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  71229. * @param {Object} [options.headers] - 请求头。
  71230. */
  71231. var FeatureService = ServiceBase.extend({
  71232. initialize: function (url, options) {
  71233. ServiceBase.prototype.initialize.call(this, url, options);
  71234. },
  71235. /**
  71236. * @function L.supermap.featureService.prototype.getFeaturesByIDs
  71237. * @description 数据集 ID 查询服务。
  71238. * @param {SuperMap.GetFeaturesByIDsParameters} params - ID 查询参数类。
  71239. * @param {RequestCallback} callback - 回调函数。
  71240. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  71241. */
  71242. getFeaturesByIDs: function (params, callback, resultFormat) {
  71243. var me = this;
  71244. var getFeaturesByIDsService = new GetFeaturesByIDsService(me.url, {
  71245. proxy: me.options.proxy,
  71246. withCredentials: me.options.withCredentials,
  71247. crossOrigin:me.options.crossOrigin,
  71248. headers:me.options.headers,
  71249. serverType: me.options.serverType,
  71250. eventListeners: {
  71251. processCompleted: callback,
  71252. processFailed: callback
  71253. },
  71254. format: me._processFormat(resultFormat)
  71255. });
  71256. getFeaturesByIDsService.processAsync(me._processParams(params));
  71257. },
  71258. /**
  71259. * @function L.supermap.featureService.prototype.getFeaturesByBounds
  71260. * @description 数据集 bounds 查询服务。
  71261. * @param {SuperMap.GetFeaturesByBoundsParameters} params - 数据集范围查询参数类。
  71262. * @param {RequestCallback} callback - 回调函数。
  71263. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  71264. */
  71265. getFeaturesByBounds: function (params, callback, resultFormat) {
  71266. var me = this;
  71267. var getFeaturesByBoundsService = new GetFeaturesByBoundsService(me.url, {
  71268. proxy: me.options.proxy,
  71269. withCredentials: me.options.withCredentials,
  71270. crossOrigin:me.options.crossOrigin,
  71271. headers:me.options.headers,
  71272. serverType: me.options.serverType,
  71273. eventListeners: {
  71274. processCompleted: callback,
  71275. processFailed: callback
  71276. },
  71277. format: me._processFormat(resultFormat)
  71278. });
  71279. getFeaturesByBoundsService.processAsync(me._processParams(params));
  71280. },
  71281. /**
  71282. * @function L.supermap.featureService.prototype.getFeaturesByBuffer
  71283. * @description 数据集 buffer 查询服务。
  71284. * @param {SuperMap.GetFeaturesByBufferParameters} params - 数据服务中数据集缓冲区查询参数类。
  71285. * @param {RequestCallback} callback - 回调函数。
  71286. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  71287. */
  71288. getFeaturesByBuffer: function (params, callback, resultFormat) {
  71289. var me = this;
  71290. var getFeatureService = new GetFeaturesByBufferService(me.url, {
  71291. proxy: me.options.proxy,
  71292. withCredentials: me.options.withCredentials,
  71293. crossOrigin:me.options.crossOrigin,
  71294. headers:me.options.headers,
  71295. serverType: me.options.serverType,
  71296. eventListeners: {
  71297. processCompleted: callback,
  71298. processFailed: callback
  71299. },
  71300. format: me._processFormat(resultFormat)
  71301. });
  71302. getFeatureService.processAsync(me._processParams(params));
  71303. },
  71304. /**
  71305. * @function L.supermap.featureService.prototype.getFeaturesBySQL
  71306. * @description 数据集 SQL 查询服务。
  71307. * @param {SuperMap.GetFeaturesBySQLParameters} params - 数据服务中数据集 SQL 查询参数类。
  71308. * @param {RequestCallback} callback - 回调函数。
  71309. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  71310. */
  71311. getFeaturesBySQL: function (params, callback, resultFormat) {
  71312. var me = this;
  71313. var getFeatureBySQLService = new GetFeaturesBySQLService(me.url, {
  71314. proxy: me.options.proxy,
  71315. withCredentials: me.options.withCredentials,
  71316. crossOrigin:me.options.crossOrigin,
  71317. headers:me.options.headers,
  71318. serverType: me.options.serverType,
  71319. eventListeners: {
  71320. processCompleted: callback,
  71321. processFailed: callback
  71322. },
  71323. format: me._processFormat(resultFormat)
  71324. });
  71325. getFeatureBySQLService.processAsync(me._processParams(params));
  71326. },
  71327. /**
  71328. * @function L.supermap.featureService.prototype.getFeaturesByGeometry
  71329. * @description 数据集几何查询服务类。
  71330. * @param {SuperMap.GetFeaturesByGeometryParameters} params - 数据集几何查询参数类。
  71331. * @param {RequestCallback} callback - 回调函数。
  71332. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  71333. */
  71334. getFeaturesByGeometry: function (params, callback, resultFormat) {
  71335. var me = this;
  71336. var getFeaturesByGeometryService = new GetFeaturesByGeometryService(me.url, {
  71337. proxy: me.options.proxy,
  71338. withCredentials: me.options.withCredentials,
  71339. crossOrigin:me.options.crossOrigin,
  71340. headers:me.options.headers,
  71341. serverType: me.options.serverType,
  71342. eventListeners: {
  71343. processCompleted: callback,
  71344. processFailed: callback
  71345. },
  71346. format: me._processFormat(resultFormat)
  71347. });
  71348. getFeaturesByGeometryService.processAsync(me._processParams(params));
  71349. },
  71350. /**
  71351. * @function L.supermap.featureService.prototype.editFeatures
  71352. * @description 地物编辑服务。
  71353. * @param {SuperMap.EditFeaturesParameters} params - 数据服务中数据集添加、修改、删除参数类。
  71354. * @param {RequestCallback} callback - 回调函数。
  71355. */
  71356. editFeatures: function (params, callback) {
  71357. if (!params || !params.dataSourceName || !params.dataSetName) {
  71358. return;
  71359. }
  71360. var me = this,
  71361. url = me.url,
  71362. dataSourceName = params.dataSourceName,
  71363. dataSetName = params.dataSetName;
  71364. url = Util.urlPathAppend(url, "datasources/" + dataSourceName + "/datasets/" + dataSetName);
  71365. var editFeatureService = new EditFeaturesService(url, {
  71366. proxy: me.options.proxy,
  71367. withCredentials: me.options.withCredentials,
  71368. crossOrigin:me.options.crossOrigin,
  71369. headers:me.options.headers,
  71370. serverType: me.options.serverType,
  71371. eventListeners: {
  71372. processCompleted: callback,
  71373. processFailed: callback
  71374. }
  71375. });
  71376. editFeatureService.processAsync(me._processParams(params));
  71377. },
  71378. _processParams: function (params) {
  71379. if (!params) {
  71380. return {};
  71381. }
  71382. params.returnContent = (params.returnContent == null) ? true : params.returnContent;
  71383. params.fromIndex = params.fromIndex ? params.fromIndex : 0;
  71384. params.toIndex = params.toIndex ? params.toIndex : -1;
  71385. params.isUseBatch = (params.isUseBatch == null) ? false : params.isUseBatch;
  71386. if (params.bounds) {
  71387. params.bounds = CommontypesConversion.toSuperMapBounds(params.bounds);
  71388. }
  71389. if (params.geometry) {
  71390. params.geometry = toSuperMapGeometry(params.geometry);
  71391. }
  71392. if (params.editType) {
  71393. params.editType = params.editType.toLowerCase();
  71394. }
  71395. var me = this;
  71396. if (params.features) {
  71397. var features = [];
  71398. if (external_L_default().Util.isArray(params.features)) {
  71399. params.features.map(function (feature) {
  71400. features.push(me._createServerFeature(feature));
  71401. return feature;
  71402. });
  71403. } else {
  71404. features.push(me._createServerFeature(params.features));
  71405. }
  71406. params.features = features;
  71407. }
  71408. return params;
  71409. },
  71410. _createServerFeature: function (geoFeature) {
  71411. var geoJSONFeature, feature = {}, fieldNames = [], fieldValues = [];
  71412. geoJSONFeature = geoFeature || {};
  71413. for (var key in geoJSONFeature.properties) {
  71414. fieldNames.push(key);
  71415. fieldValues.push(geoJSONFeature.properties[key]);
  71416. }
  71417. feature.fieldNames = fieldNames;
  71418. feature.fieldValues = fieldValues;
  71419. if (geoJSONFeature.id) {
  71420. feature.id = geoJSONFeature.id;
  71421. }
  71422. feature.geometry = toSuperMapGeometry(geoJSONFeature);
  71423. return feature;
  71424. },
  71425. _processFormat: function (resultFormat) {
  71426. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  71427. }
  71428. });
  71429. var featureService = function (url, options) {
  71430. return new FeatureService(url, options);
  71431. };
  71432. (external_L_default()).supermap.featureService = featureService;
  71433. ;// CONCATENATED MODULE: ./src/leaflet/overlay/UnicodeMarker.js
  71434. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  71435. * This program are made available under the terms of the Apache License, Version 2.0
  71436. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71437. /**
  71438. * @class L.supermap.unicodeMarker
  71439. * @classdesc Unicode 字符图标。
  71440. * @category Visualization Marker
  71441. * @extends {L.Path}
  71442. * @param {L.LatLngBounds} latlng - 经纬度坐标。
  71443. * @param {Object} options - 符号参数。
  71444. * @param {string} options.label - 符号 Unicode 值。
  71445. * @param {string} [options.labelRotation='0'] - 符号旋转角度。
  71446. * @param {string} [options.globalAlpha='1'] - 符号的透明值。
  71447. * @param {string} [options.fontStyle='normal'] - 符号的风格。
  71448. * @param {string} [options.fontWeight='normal'] - 符号的粗细。
  71449. * @param {string} [options.fontSize='1em'] - 符号的尺寸。
  71450. * @param {string} [options.fontFamily='sans-serif'] - 符号的字体。
  71451. * @param {string} [options.textAlign='center'] - 符号内容的对齐方式。
  71452. * @param {string} [options.textBaseline='middle'] - 绘制符号时使用的基线。
  71453. * @fires L.supermap.unicodeMarker#move
  71454. */
  71455. var UnicodeMarker = external_L_default().Path.extend({
  71456. // @section
  71457. // @aka CircleMarker options
  71458. options: {
  71459. fontStyle: "normal",
  71460. fontWeight: "normal",
  71461. fontSize: "1em",
  71462. fontFamily: "sans-serif",
  71463. textAlign: "center",
  71464. textBaseline: "middle",
  71465. vfactor: -.5,
  71466. labelRotation: 0,
  71467. globalAlpha: 1,
  71468. label: ""
  71469. },
  71470. initialize: function (latlng, options) {
  71471. external_L_default().Util.setOptions(this, options);
  71472. this._latlng = latlng;
  71473. },
  71474. /**
  71475. * @function L.supermap.unicodeMarker.prototype.setLatLng
  71476. * @description 设置 marker 新坐标。
  71477. * @param {L.LatLng} setLatLng - 需要设置的新坐标。
  71478. */
  71479. setLatLng: function (latlng) {
  71480. this._latlng = latlng;
  71481. this.redraw();
  71482. /**
  71483. * @event L.supermap.unicodeMarker#move
  71484. * @description circle marker 重设坐标之后触发。
  71485. * @property {L.LatLng} latlng - 当前 marker 坐标。
  71486. */
  71487. return this.fire('move', {latlng: this._latlng});
  71488. },
  71489. /**
  71490. * @function L.supermap.unicodeMarker.prototype.getLatLng
  71491. * @description 获取 marker 坐标。
  71492. * @returns {L.LatLng} 返回当前 marker 坐标。
  71493. */
  71494. getLatLng: function () {
  71495. return this._latlng;
  71496. },
  71497. _project: function () {
  71498. this._point = this._map.latLngToLayerPoint(this._latlng);
  71499. this._updateBounds();
  71500. },
  71501. _updateBounds: function () {
  71502. var w = this._clickTolerance(),
  71503. p = [w, w];
  71504. this._pxBounds = new (external_L_default()).Bounds(this._point.subtract(p), this._point.add(p));
  71505. },
  71506. _update: function () {
  71507. if (this._map) {
  71508. this._updatePath();
  71509. }
  71510. },
  71511. _updatePath: function () {
  71512. this._renderer._updateUnicode(this);
  71513. },
  71514. // Needed by the `Canvas` renderer for interactivity
  71515. _containsPoint: function (p) {
  71516. return p.distanceTo(this._point) <= this._clickTolerance();
  71517. }
  71518. })
  71519. var unicodeMarker = function (latlng, options) {
  71520. return new UnicodeMarker(latlng, options);
  71521. };
  71522. external_L_default().Canvas.include({
  71523. _updateUnicode: function (layer) {
  71524. if (!this._drawing) {
  71525. return;
  71526. }
  71527. let pt = {x: layer._point.x, y: layer._point.y},
  71528. ctx = this._ctx,
  71529. fontStyle = [layer.options.fontStyle,
  71530. "normal", layer.options.fontWeight,
  71531. layer.options.fontSize,
  71532. layer.options.fontFamily].join(" ");
  71533. let label = layer.options.label.replace(/^&#x/, '');
  71534. label = String.fromCharCode(parseInt(label, 16));
  71535. let labelRows = label.split('\n');
  71536. let numRows = labelRows.length;
  71537. // if (layer.options.labelXOffset || layer.options.labelYOffset) {
  71538. // let xOffset = isNaN(layer.options.labelXOffset) ? 0 : layer.options.labelXOffset;
  71539. // let yOffset = isNaN(layer.options.labelYOffset) ? 0 : layer.options.labelYOffset;
  71540. // pt.x += xOffset;
  71541. // pt.y -= yOffset;
  71542. // }
  71543. ctx.fillStyle = layer.options.fontColor;
  71544. ctx.globalAlpha = 1.0;
  71545. if (layer.options.fontOpacity >= 0 && layer.options.fontOpacity < 1) {
  71546. ctx.globalAlpha = layer.options.fontOpacity;
  71547. }
  71548. if (ctx.fillText) {
  71549. // HTML5
  71550. ctx.font = fontStyle;
  71551. ctx.textAlign = layer.options.textAlign;
  71552. ctx.textBaseline = layer.options.textBaseline;
  71553. let vfactor = layer.options.vfactor;
  71554. let lineHeight =
  71555. ctx.measureText('Mg').height ||
  71556. ctx.measureText('xx').width;
  71557. pt.y += lineHeight * vfactor * (numRows - 1);
  71558. for (let i = 0; i < numRows; i++) {
  71559. if (layer.options.labelRotation != 0) {
  71560. ctx.save();
  71561. ctx.translate(pt.x, pt.y);
  71562. ctx.rotate(layer.options.labelRotation * Math.PI / 180);
  71563. ctx.fillText(labelRows[i], 0, (lineHeight * i));
  71564. ctx.restore();
  71565. } else {
  71566. ctx.fillText(labelRows[i], pt.x, pt.y);
  71567. }
  71568. }
  71569. } else if (ctx.mozDrawText) {
  71570. // Mozilla pre-Gecko1.9.1 (<FF3.1)
  71571. ctx.mozTextStyle = fontStyle;
  71572. // No built-in text alignment, so we measure and adjust the position
  71573. let hfactor = layer.options.textAlign;
  71574. let vfactor = layer.options.vfactor;
  71575. let lineHeight = ctx.mozMeasureText('xx');
  71576. pt.y += lineHeight * (1 + (vfactor * numRows));
  71577. for (let i = 0; i < numRows; i++) {
  71578. let x = pt.x + (hfactor * ctx.mozMeasureText(labelRows[i]));
  71579. let y = pt.y + (i * lineHeight);
  71580. ctx.translate(x, y);
  71581. ctx.mozDrawText(labelRows[i]);
  71582. ctx.translate(-x, -y);
  71583. }
  71584. }
  71585. }
  71586. });
  71587. (external_L_default()).supermap.unicodeMarker = unicodeMarker;
  71588. ;// CONCATENATED MODULE: ./src/leaflet/mapping/WebMap.js
  71589. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  71590. * This program are made available under the terms of the Apache License, Version 2.0
  71591. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71592. /**
  71593. * @class L.supermap.webmap
  71594. * @classdesc 对接 iPortal/Online 地图类。
  71595. * @category iPortal/Online
  71596. * @extends {L.LayerGroup}
  71597. * @param {number} id - iPortal/Online 地图 id。
  71598. * @param {Object} options - 可选参数。
  71599. * @param {string} [options.map='map'] - 地图容器id。
  71600. * @param {string} [options.server='https://www.supermapol.com'] - iPortal/Online 服务地址。
  71601. * @param {boolean} [options.featureLayerPopupEnable=true] - 是否启动要素图层提示框。
  71602. * @param {string} [options.featureLayerPopup] - 提示框提示信息。
  71603. * @param {string} [options.credentialValue] - 证书值。
  71604. * @param {string} [options.credentialKey='key'] - 证书密钥。
  71605. * @param {string} [options.attribution='Map Data <span>© <a href='https://www.supermapol.com' title='SuperMap Online' target='_blank'>SuperMap Online</a></span>'] - 版权信息。
  71606. * @fires L.supermap.webmap#mapLoaded
  71607. * @fires L.supermap.webmap#coordconvertsuccess
  71608. * @fires L.supermap.webmap#coordconvertfailed
  71609. * @fires L.supermap.webmap#featureunselected
  71610. * @fires L.supermap.webmap#featureselected
  71611. * @fires L.supermap.webmap#featuremousemove
  71612. */
  71613. var WebMap = external_L_default().LayerGroup.extend({
  71614. options: {
  71615. map: 'map',
  71616. server: 'https://www.supermapol.com',
  71617. featureLayerPopupEnable: true,
  71618. featureLayerPopup: null,
  71619. credentialValue: null,
  71620. credentialKey: 'key',
  71621. attribution: core_Attributions.Online.attribution
  71622. },
  71623. /**
  71624. * @private
  71625. * @function L.supermap.webmap.prototype.defaultFeatureLayerPopup
  71626. * @description 默认图层弹出框。
  71627. * @param {L.Layer} layer - 指定图层。
  71628. * @returns {string} 图层弹出框内容。
  71629. */
  71630. defaultFeatureLayerPopup: function (layer) {
  71631. return layer.feature.properties.attributes.title + ":" + layer.feature.properties.attributes.description;
  71632. },
  71633. initialize: function (id, options) {
  71634. if (!id && !options) {
  71635. return;
  71636. }
  71637. this._layers = {};
  71638. external_L_default().setOptions(this, options);
  71639. this.id = id;
  71640. this.load();
  71641. this.cartoCSSToLeaflet = new CartoCSSToLeaflet();
  71642. },
  71643. /**
  71644. * @private
  71645. * @function L.supermap.webmap.prototype.load
  71646. * @description 登陆后添加地图图层。
  71647. */
  71648. load: function () {
  71649. if (this.options.server.indexOf('http://') < 0 && this.options.server.indexOf('https://') < 0) {
  71650. this.options.server = "http://" + this.options.server;
  71651. }
  71652. var mapUrl = this.options.server + '/web/maps/' + this.id + '.json';
  71653. if (this.options.credentialValue) {
  71654. mapUrl += ('?' + this.options.credentialKey + '=' + this.options.credentialValue);
  71655. }
  71656. var me = this;
  71657. FetchRequest.get(mapUrl).then(function (response) {
  71658. return response.json()
  71659. }).then(function (jsonObj) {
  71660. if (!jsonObj) {
  71661. return;
  71662. }
  71663. var layers = jsonObj.layers;
  71664. me.mapInfo = jsonObj;
  71665. me.createLayersByJson(layers);
  71666. });
  71667. },
  71668. /**
  71669. * @private
  71670. * @function L.supermap.webmap.prototype.addLayerWrapper
  71671. * @description 添加图层容器。
  71672. * @param {L.Layer} layer - 待添加的图层。
  71673. * @param {boolean} [isBaseLayer] - 是否为底图层。
  71674. * @param {Object} options - 创建地图的可选参数。
  71675. * @returns {this} this
  71676. */
  71677. addLayerWrapper: function (layer, isBaseLayer, options) {
  71678. if (isBaseLayer) {
  71679. this.createMap(options);
  71680. }
  71681. this.addLayer(layer);
  71682. if (layer.labelLayer) {
  71683. this.addLayer(layer.labelLayer);
  71684. }
  71685. return this;
  71686. },
  71687. /**
  71688. * @private
  71689. * @function L.supermap.webmap.prototype.createLayersByJson
  71690. * @description 通过 JSON 创建图层。
  71691. * @param {JSON} layersJson - 图层的 JSON 信息。
  71692. */
  71693. createLayersByJson: function (layersJson) {
  71694. if (!external_L_default().Util.isArray(layersJson)) {
  71695. return;
  71696. }
  71697. if (layersJson.length === 0) {
  71698. return;
  71699. }
  71700. this.layers = [];
  71701. var layerQueue = [];
  71702. for (var i = 0; i < layersJson.length; i++) {
  71703. var layerJson = layersJson[i];
  71704. layerJson["_originIndex"] = i;
  71705. var layerJsonType = layerJson.layerType = layerJson.layerType || "BASE_LAYER";
  71706. if (layerJsonType !== "BASE_LAYER") {
  71707. //如果图层不是底图,则先加到图层队列里面等待底图完成后再处理
  71708. layerQueue.unshift(layerJson);
  71709. continue;
  71710. } else {
  71711. layerJson.isBaseLayer = true;
  71712. this.createLayer(layerJson.type, layerJson);
  71713. }
  71714. }
  71715. //底图加载完成后开始处理图层队列里的图层
  71716. while (layerQueue.length > 0) {
  71717. var layerInfo = layerQueue.pop();
  71718. var type = layerInfo.type;
  71719. var layerType = layerInfo.layerType = layerInfo.layerType || "BASE_LAYER";
  71720. if (layerType !== "OVERLAY_LAYER") {
  71721. type = layerType;
  71722. }
  71723. this.createLayer(type, layerInfo);
  71724. }
  71725. /**
  71726. * @event L.supermap.webmap#maploaded
  71727. * @description 底图加载完成后触发。
  71728. * @property {L.Map} map - Leaflet Map 对象。
  71729. */
  71730. this.fire('maploaded', {
  71731. map: this._map
  71732. });
  71733. },
  71734. /**
  71735. * @private
  71736. * @function L.supermap.webmap.prototype.createCRS
  71737. * @description 创建坐标对象。
  71738. * @param {number} epsgCode - epsg 编码。
  71739. * @param {string} type - 坐标类型。
  71740. * @param {number} resolutions - 分辨率。
  71741. * @param {L.Point} origin - 切片原点。
  71742. * @param {L.Bounds} bounds - 地图范围。
  71743. */
  71744. createCRS: function (epsgCode, type, resolutions, origin, bounds) {
  71745. if (epsgCode < 0) {
  71746. return new NonEarthCRS({
  71747. bounds: bounds,
  71748. origin: origin,
  71749. resolutions: resolutions
  71750. })
  71751. }
  71752. if (epsgCode === 910112 || epsgCode === 910102) {
  71753. return (external_L_default()).CRS.BaiduCRS;
  71754. }
  71755. if (epsgCode === 910111) {
  71756. epsgCode = 3857
  71757. //todo 火星mercator
  71758. }
  71759. if (epsgCode === 910101) {
  71760. epsgCode = 4326
  71761. //todo 火星
  71762. }
  71763. return external_L_default().Proj.CRS("EPSG:" + epsgCode, {
  71764. origin: origin,
  71765. resolutions: resolutions,
  71766. bounds: bounds
  71767. })
  71768. },
  71769. /**
  71770. * @private
  71771. * @function L.supermap.webmap.prototype.createMap
  71772. * @description 创建地图。
  71773. * @param {Object} options - 创建地图所需参数。
  71774. */
  71775. createMap: function (options) {
  71776. var crs = options.crs || (external_L_default()).CRS.EPSG3857;
  71777. var bounds = external_L_default().latLngBounds(crs.unproject(options.bounds.min), crs.unproject(options.bounds.max));
  71778. this._map = external_L_default().map(this.options.map, {
  71779. center: bounds.getCenter(),
  71780. maxZoom: options.maxZoom || 22,
  71781. minZoom: options.minZoom || 0,
  71782. zoom: options.zoom || 0,
  71783. crs: crs,
  71784. renderer: external_L_default().canvas()
  71785. });
  71786. if (crs instanceof NonEarthCRS) {
  71787. this._map.setZoom(options.zoom ? options.zoom + 2 : 2, {
  71788. maxZoom: options.maxZoom || 22
  71789. });
  71790. } else {
  71791. this._map.fitBounds(bounds, {
  71792. maxZoom: options.maxZoom || 22
  71793. });
  71794. }
  71795. },
  71796. /**
  71797. * @private
  71798. * @function L.supermap.webmap.prototype.getResolutionsFromScales
  71799. * @description 通过比例尺获取分辨率。
  71800. * @param {Array.<number>} scales - 排序比例尺数组。
  71801. * @param {number} dpi - 屏幕分辨率。
  71802. * @param {string} units - 地图的单位。
  71803. * @param {SuperMap.Datum} datum - 大地参照系类。
  71804. * @returns {Array.<number>} 返回给定比例尺所对应的分辨率。
  71805. */
  71806. getResolutionsFromScales: function (scales, dpi, units, datum) {
  71807. var resolutions = [];
  71808. for (var i = 0; i < scales.length; i++) {
  71809. resolutions.push(external_L_default().Util.GetResolutionFromScaleDpi(scales[i], dpi, units, datum))
  71810. }
  71811. return resolutions;
  71812. },
  71813. /**
  71814. * @private
  71815. * @function L.supermap.webmap.prototype.createLayer
  71816. * @description 创建图层。
  71817. * @param {string} type - 图层类型。
  71818. * @param {Object} layerInfo - 图层信息。
  71819. */
  71820. createLayer: function (type, layerInfo) {
  71821. var prjCoordSys = layerInfo.prjCoordSys,
  71822. epsgCode = prjCoordSys && prjCoordSys.epsgCode || this.mapInfo.epsgCode,
  71823. center = this.mapInfo.center || layerInfo.center,
  71824. level = this.mapInfo.level || layerInfo.level,
  71825. bounds = this.mapInfo.extent || layerInfo.bounds,
  71826. scales = layerInfo.scales,
  71827. isBaseLayer = layerInfo.isBaseLayer,
  71828. opacity = layerInfo.opacity;
  71829. var mapBounds = external_L_default().bounds([bounds.leftBottom.x, bounds.leftBottom.y], [bounds.rightTop.x, bounds.rightTop.y]);
  71830. var layerBounds = layerInfo.bounds ? external_L_default().bounds([layerInfo.bounds.leftBottom.x, layerInfo.bounds.leftBottom.y], [layerInfo.bounds.rightTop.x, layerInfo.bounds.rightTop.y]) : mapBounds;
  71831. if (!center) {
  71832. center = layerBounds.getCenter();
  71833. }
  71834. var origin = external_L_default().point(layerBounds.min.x, layerBounds.max.y);
  71835. var resolutions = !scales ? null : this.getResolutionsFromScales(scales, 96, layerInfo.units);
  71836. var crs = this.createCRS(epsgCode, prjCoordSys ? prjCoordSys.type : '', resolutions, origin, layerBounds);
  71837. var mapOptions = {
  71838. bounds: mapBounds,
  71839. center: external_L_default().point(center.x, center.y),
  71840. crs: crs,
  71841. zoom: level
  71842. };
  71843. var layer;
  71844. switch (type) {
  71845. case "SUPERMAP_REST":
  71846. layer = tiledMapLayer(layerInfo.url, {
  71847. transparent: true,
  71848. opacity: opacity
  71849. });
  71850. break;
  71851. case "SUPERMAP_REST_VECTOR":
  71852. //ToDO
  71853. break;
  71854. case "TIANDITU_VEC":
  71855. case "TIANDITU_IMG":
  71856. case "TIANDITU_TER":
  71857. mapOptions.crs = epsgCode === 4326 ? (external_L_default()).CRS.TianDiTu_WGS84 : (external_L_default()).CRS.TianDiTu_Mercator;
  71858. mapOptions.minZoom = 1;
  71859. mapOptions.zoom = 1 + mapOptions.zoom;
  71860. layer = this.createTiandituLayer(layerInfo);
  71861. break;
  71862. case "BAIDU":
  71863. mapOptions.crs = (external_L_default()).CRS.BaiduCRS;
  71864. mapOptions.zoom = 3 + mapOptions.zoom;
  71865. mapOptions.minZoom = 3;
  71866. layer = baiduTileLayer();
  71867. break;
  71868. case 'BING':
  71869. //todo
  71870. break;
  71871. case "WMS":
  71872. layer = this.createWmsLayer(layerInfo);
  71873. break;
  71874. case "WMTS":
  71875. mapOptions.resolutions = this.getResolutionsFromScales(scales, 90.71446714322, layerInfo.units);
  71876. var identifier = layerInfo.identifier;
  71877. var layerName = identifier.substring(identifier.indexOf("_") + 1);
  71878. layer = wmtsLayer(layerInfo.url, {
  71879. layer: layerName,
  71880. style: "default",
  71881. tilematrixSet: identifier,
  71882. format: "image/png"
  71883. });
  71884. break;
  71885. case "CLOUD":
  71886. mapOptions.crs = (external_L_default()).CRS.EPSG3857;
  71887. mapOptions.zoom = 3 + mapOptions.zoom;
  71888. mapOptions.minZoom = 3;
  71889. layer = cloudTileLayer(layerInfo.url, {
  71890. opacity: opacity
  71891. });
  71892. break;
  71893. case "MARKER_LAYER":
  71894. layer = this.createMarkersLayer(layerInfo, crs);
  71895. break;
  71896. case "FEATURE_LAYER":
  71897. if (layerInfo.identifier == "ANIMATORVECTOR") {
  71898. //todo
  71899. } else if (layerInfo.identifier == "THEME") {
  71900. layer = this.createThemeLayer(layerInfo);
  71901. } else {
  71902. layer = this.createVectorLayer(layerInfo, crs);
  71903. }
  71904. break;
  71905. default:
  71906. throw new Error('unSupported Layer Type');
  71907. }
  71908. if (layer && layerInfo.isVisible) {
  71909. this.addLayerWrapper(layer, isBaseLayer, mapOptions);
  71910. }
  71911. },
  71912. /**
  71913. * @private
  71914. * @function L.supermap.webmap.prototype.createTiandituLayer
  71915. * @description 创建天地图图层。
  71916. * @param {Object} layerInfo - 图层信息。
  71917. * @returns {L.supermap.tiandituTileLayer} 返回天地图图层对象。
  71918. */
  71919. createTiandituLayer: function (layerInfo) {
  71920. var type = layerInfo.type.split('_')[1].toLowerCase();
  71921. var isLabel = layerInfo.layerType === 'OVERLAY_LAYER';
  71922. var layer = new TiandituTileLayer({
  71923. layerType: type,
  71924. isLabel: isLabel
  71925. });
  71926. return layer;
  71927. },
  71928. /**
  71929. * @private
  71930. * @function L.supermap.webmap.prototype.createMarkersLayer
  71931. * @description 创建图标图层。
  71932. * @param {Object} layerInfo - 图层信息。
  71933. * @param {Object} crs - 坐标对象。
  71934. * @returns {L.Layer} 返回 marker 图层。
  71935. */
  71936. createMarkersLayer: function (layerInfo, crs) {
  71937. var that = this;
  71938. var markers = layerInfo.markers || [];
  71939. //style = layerInfo.style,
  71940. //opacity = layerInfo.opacity,
  71941. //marker, point, size, offset, icon, that = this;
  71942. //todo offset
  71943. var coordsToLatLng = function (coords) {
  71944. var ll = crs.unproject(external_L_default().point(coords[0], coords[1]));
  71945. return new (external_L_default()).LatLng(ll.lat, ll.lng, coords[2]);
  71946. };
  71947. var layer = external_L_default().geoJSON(external_L_default().Util.toGeoJSON(markers), {
  71948. pointToLayer: function (geojson, latlng) {
  71949. var m = new (external_L_default()).Marker(latlng);
  71950. m.setStyle = function (style) {
  71951. if (style) {
  71952. m.setIcon(style);
  71953. }
  71954. };
  71955. return m;
  71956. },
  71957. coordsToLatLng: coordsToLatLng,
  71958. style: function (geoJsonFeature) {
  71959. return that.cartoCSSToLeaflet.getStyleFromiPortalMarker(geoJsonFeature.properties.icon);
  71960. }
  71961. });
  71962. if (this.options.featureLayerPopupEnable) {
  71963. layer.bindPopup(this.options.featureLayerPopup || this.defaultFeatureLayerPopup)
  71964. }
  71965. return layer;
  71966. },
  71967. /**
  71968. * @private
  71969. * @function L.supermap.webmap.prototype.createWmsLayer
  71970. * @description 创建 Wms 图层。
  71971. * @param {Object} layerInfo - 图层信息。
  71972. * @returns {L.Layer} 返回 Wms 图层对象。
  71973. */
  71974. createWmsLayer: function (layerInfo) {
  71975. var url = layerInfo.url,
  71976. opacity = layerInfo.opacity,
  71977. subLayers = layerInfo.subLayers;
  71978. if (!subLayers || subLayers === "undefined" || subLayers === "null") {
  71979. subLayers = "0";
  71980. }
  71981. return external_L_default().tileLayer.wms(url, {
  71982. layers: subLayers,
  71983. format: 'image/png',
  71984. transparent: true,
  71985. noWrap: true,
  71986. opacity: opacity
  71987. })
  71988. },
  71989. /**
  71990. * @private
  71991. * @function L.supermap.webmap.prototype.createVectorLayer
  71992. * @description 创建矢量要素图层。
  71993. * @param {Object} layerInfo - 图层信息。
  71994. * @param {Object} crs - 坐标对象。
  71995. * @returns {L.Layer} 返回矢量要素图层对象。
  71996. */
  71997. createVectorLayer: function (layerInfo, crs) {
  71998. var style = layerInfo.style,
  71999. opacity = layerInfo.opacity,
  72000. me = this;
  72001. //todo readonly = layerInfo.readonly;
  72002. var coordsToLatLng = function (coords) {
  72003. var ll = crs.unproject(external_L_default().point(coords[0], coords[1]));
  72004. return new (external_L_default()).LatLng(ll.lat, ll.lng, coords[2]);
  72005. };
  72006. if (!layerInfo.url) {
  72007. var layer = external_L_default().geoJSON(external_L_default().Util.toGeoJSON(layerInfo.features), {
  72008. pointToLayer: function (geojson, latlng) {
  72009. var m = new (external_L_default()).Marker(latlng);
  72010. m.setStyle = function (style) {
  72011. if (style) {
  72012. m.setIcon(style);
  72013. }
  72014. }
  72015. return m;
  72016. },
  72017. coordsToLatLng: coordsToLatLng,
  72018. style: function (geoJsonFeature) {
  72019. let lStyle = me.cartoCSSToLeaflet.getStyleFromiPortalStyle(style ? style : {}, geoJsonFeature.geometry.type, geoJsonFeature.properties.style);
  72020. if (lStyle && lStyle.dashArray && lStyle.dashArray.length == 0) {
  72021. lStyle.dashArray = null;
  72022. }
  72023. return lStyle;
  72024. },
  72025. opacity: opacity
  72026. });
  72027. if (this.options.featureLayerPopupEnable) {
  72028. layer.bindPopup(this.options.featureLayerPopup || this.defaultFeatureLayerPopup)
  72029. }
  72030. return layer;
  72031. } else {
  72032. var url = layerInfo.url,
  72033. datasourceName = layerInfo.name,
  72034. datasets = layerInfo.features;
  72035. for (var setNameIndex = 0; setNameIndex < datasets.length; setNameIndex++) {
  72036. var dataset = datasets[setNameIndex];
  72037. if (dataset.visible) {
  72038. this.getFeaturesBySQL(url, datasourceName, dataset.name, "", DataFormat.GEOJSON, (serviceResult) => {
  72039. var layer = external_L_default().geoJSON(serviceResult.result, {
  72040. pointToLayer: function (geojson, latlng) {
  72041. var m = new (external_L_default()).Marker(latlng);
  72042. m.setStyle = function (style) {
  72043. if (style) {
  72044. m.setIcon(style);
  72045. }
  72046. };
  72047. return m;
  72048. },
  72049. coordsToLatLng: coordsToLatLng,
  72050. style: function (geoJsonFeature) {
  72051. return this.cartoCSSToLeaflet.getStyleFromiPortalStyle(style ? style : {}, geoJsonFeature.geometry.type, geoJsonFeature.properties.style);
  72052. },
  72053. opacity: opacity
  72054. });
  72055. if (this.options.featureLayerPopupEnable) {
  72056. layer.bindPopup(me.options.featureLayerPopup || me.defaultFeatureLayerPopup)
  72057. }
  72058. this.addLayer(layer);
  72059. })
  72060. }
  72061. }
  72062. }
  72063. },
  72064. getFeaturesBySQL: function (url, datasourceName, datasetName, filter, format, callback) {
  72065. filter = filter || "SMID > 0";
  72066. var sqlParam = new GetFeaturesBySQLParameters({
  72067. queryParameter: {
  72068. name: datasetName + "@" + datasourceName,
  72069. attributeFilter: filter
  72070. },
  72071. datasetNames: [datasourceName + ":" + datasetName],
  72072. fromIndex: 0,
  72073. toIndex: 100000
  72074. });
  72075. featureService(url).getFeaturesBySQL(sqlParam, callback, format);
  72076. },
  72077. /**
  72078. * @private
  72079. * @function L.supermap.webmap.prototype.createThemeLayer
  72080. * @description 创建专题图图层。
  72081. * @param {Object} layerInfo - 图层信息。
  72082. * @returns {L.Layer} 返回专题图图层对象。
  72083. */
  72084. createThemeLayer: function (layerInfo) {
  72085. var themeSettings = layerInfo.themeSettings && JSON.parse(layerInfo.themeSettings);
  72086. var layer;
  72087. var type = themeSettings.type;
  72088. layerInfo.themeSettings = themeSettings;
  72089. if (type === "HEAT") {
  72090. layer = this.createHeatLayer(layerInfo, themeSettings);
  72091. } else if (type === "UNIQUE") {
  72092. layer = this.createUniqueLayer(layerInfo, themeSettings);
  72093. } else if (type === "RANGE") {
  72094. layer = this.createRangeLayer(layerInfo, themeSettings);
  72095. } else {
  72096. layer = this.createBaseThemeLayer(layerInfo, themeSettings);
  72097. }
  72098. if (layer) {
  72099. this.addFeature2ThemeLayer(layerInfo, layer);
  72100. layer.on('add', (e) => {
  72101. this.registerThemeEvent(e.target);
  72102. })
  72103. }
  72104. if (themeSettings && themeSettings.labelField) {
  72105. var labelLayer = this.createLabelLayer(layerInfo, themeSettings);
  72106. labelLayer.on('add', (e) => {
  72107. this.registerThemeEvent(e.target);
  72108. });
  72109. layer.labelLayer = labelLayer;
  72110. }
  72111. return layer;
  72112. },
  72113. createBaseThemeLayer: function (layerInfo, themeSettings) {
  72114. let style = layerInfo.style,
  72115. opacity = layerInfo.opacity,
  72116. vectorType = themeSettings.vectorType,
  72117. featureStyle = style.pointStyle;
  72118. if (vectorType === "LINE") {
  72119. featureStyle.fill = false;
  72120. } else {
  72121. featureStyle.fill = true;
  72122. }
  72123. var pointStyle = {};
  72124. pointStyle.radius = featureStyle.pointRadius;
  72125. pointStyle.color = featureStyle.strokeColor;
  72126. pointStyle.opacity = featureStyle.strokeOpacity;
  72127. pointStyle.lineCap = featureStyle.strokeLineCap;
  72128. pointStyle.weight = featureStyle.strokeWidth;
  72129. pointStyle.fillColor = featureStyle.fillColor;
  72130. pointStyle.fillOpacity = featureStyle.fillOpacity;
  72131. var pointToLayer = (geojson, latlng) => {
  72132. return external_L_default().circleMarker(latlng, pointStyle);
  72133. };
  72134. if (featureStyle.unicode) {
  72135. pointToLayer = (geojson, latlng) => {
  72136. return new UnicodeMarker(latlng, featureStyle)
  72137. }
  72138. }
  72139. return external_L_default().geoJSON({
  72140. type: "GeometryCollection",
  72141. geometries: []
  72142. }, {
  72143. pointToLayer: pointToLayer,
  72144. opacity: opacity
  72145. });
  72146. //this.registerVectorEvent(vector);
  72147. },
  72148. createUniqueLayer: function (layerInfo, themeSettings) {
  72149. var title = layerInfo.title;
  72150. var themeField = themeSettings.field,
  72151. styleGroups = [],
  72152. settings = themeSettings.settings,
  72153. isVisible = layerInfo.isVisible,
  72154. opacity = layerInfo.opacity,
  72155. vectorType = themeSettings.vectorType;
  72156. //组成styleGroup
  72157. for (var i = 0; i < settings.length; i++) {
  72158. var object = {};
  72159. object.value = settings[i].value;
  72160. object.style = settings[i].style;
  72161. styleGroups.push(object);
  72162. }
  72163. var unique = new UniqueThemeLayer(title, {
  72164. opacity: opacity,
  72165. visibility: isVisible
  72166. });
  72167. this.registerThemeEvent(unique);
  72168. unique.style = layerInfo.style.pointStyle;
  72169. if (vectorType === "LINE") {
  72170. unique.style.fill = false;
  72171. } else {
  72172. unique.style.fill = true;
  72173. }
  72174. unique.style.stroke = true;
  72175. unique.themeField = themeField;
  72176. unique.styleGroups = styleGroups;
  72177. var that = this;
  72178. unique.on('click', function (event) {
  72179. if (event.target && event.target.refDataID) {
  72180. var currenFeature = unique.getFeatureById(event.target.refDataID);
  72181. that.events.triggerEvent("uniquefeatureclicked", currenFeature, unique);
  72182. }
  72183. });
  72184. return unique;
  72185. },
  72186. createRangeLayer: function (layerInfo, themeSettings) {
  72187. var title = layerInfo.title;
  72188. var themeField = themeSettings.field,
  72189. styleGroups = [],
  72190. settings = themeSettings.settings,
  72191. isVisible = layerInfo.isVisible,
  72192. opacity = layerInfo.opacity,
  72193. vectorType = themeSettings.vectorType,
  72194. featureStyle = layerInfo.style.pointStyle;
  72195. if (vectorType === "LINE") {
  72196. featureStyle.fill = false;
  72197. } else {
  72198. featureStyle.fill = true;
  72199. }
  72200. //组成styleGroup
  72201. for (var i = 0; i < settings.length; i++) {
  72202. var object = {};
  72203. object.start = settings[i].start;
  72204. object.end = settings[i].end;
  72205. object.style = settings[i].style;
  72206. styleGroups.push(object);
  72207. }
  72208. var range = new RangeThemeLayer(title, {
  72209. visibility: isVisible,
  72210. opacity: opacity
  72211. });
  72212. this.registerThemeEvent(range);
  72213. range.style = layerInfo.style.pointStyle;
  72214. range.style.stroke = true;
  72215. range.themeField = themeField;
  72216. range.styleGroups = styleGroups;
  72217. return range;
  72218. },
  72219. createLabelLayer: function (layerInfo, themeSettings) {
  72220. var title = layerInfo.title;
  72221. var labelField = themeSettings.labelField,
  72222. settings = themeSettings.settings,
  72223. isVisible = layerInfo.isVisible;
  72224. //目前只是同一样式
  72225. var style;
  72226. if (!settings || settings.length > 0) {
  72227. style = {
  72228. "fillColor": "#ffffff"
  72229. };
  72230. } else {
  72231. style = settings[0].style;
  72232. }
  72233. var layerStyle = external_L_default().Util.extend(new ThemeStyle(), style);
  72234. layerStyle.fontWeight = "bold";
  72235. layerStyle.fontSize = "14px";
  72236. //默认显示标签边框背景
  72237. layerStyle.labelRect = true;
  72238. layerStyle.strokeColor = layerStyle.fillColor;
  72239. layerStyle.fontColor = themeSettings.labelColor;
  72240. if (themeSettings.labelFont) {
  72241. layerStyle.fontFamily = themeSettings.labelFont;
  72242. }
  72243. var label = new LabelThemeLayer(title, {
  72244. visibility: isVisible,
  72245. opacity: 0.7
  72246. });
  72247. this.registerThemeEvent(label);
  72248. label.style = layerStyle;
  72249. label.themeField = labelField;
  72250. //styleGroup, 目前只是同一样式
  72251. label.styleGroups = [];
  72252. return label;
  72253. },
  72254. createHeatLayer: function (layerInfo, themeSettings) {
  72255. let colors = themeSettings.colors || ['blue', 'cyan', 'lime', 'yellow', 'red'];
  72256. let gradient = {},
  72257. featureWeight;
  72258. for (let i = 0, len = colors.length, index = 1; i < len; i++) {
  72259. gradient[index / len] = colors[i];
  72260. index++;
  72261. }
  72262. let radius = themeSettings.settings[0].radius;
  72263. //判断单位
  72264. if (themeSettings.heatUnit === "千米" || themeSettings.heatUnit === "km") {
  72265. radius = themeSettings.heatRadius * 1000
  72266. }
  72267. //权重
  72268. if (themeSettings.settings[0] && themeSettings.settings[0].featureWeight) {
  72269. featureWeight = themeSettings.settings[0].featureWeight;
  72270. }
  72271. return external_L_default().heatLayer([], {
  72272. radius: radius / 2,
  72273. minOpacity: layerInfo.opacity,
  72274. gradient: gradient,
  72275. blur: radius / 2,
  72276. featureWeight: featureWeight
  72277. })
  72278. },
  72279. addFeature2ThemeLayer: function (layerInfo, layer) {
  72280. if (layerInfo.layerType !== "FEATURE_LAYER" || layerInfo.identifier !== "THEME") {
  72281. return;
  72282. }
  72283. var me = this;
  72284. var isRestData = !!layerInfo.datasourceName;
  72285. var cartoCSS = layerInfo.cartoCSS;
  72286. if (cartoCSS) {
  72287. var needTransform = this.getCartoCSS2Obj(cartoCSS).needTransform;
  72288. var isAddFile = this.getCartoCSS2Obj(cartoCSS).isAddFile;
  72289. }
  72290. var url = layerInfo.url,
  72291. subLayers, subLayer, layerName, credential = layerInfo.credential,
  72292. themeSettings = layerInfo.themeSettings,
  72293. filter = themeSettings.filter;
  72294. if (isAddFile) {
  72295. var position = JSON.parse(layerInfo.datasourceName);
  72296. var sql = this.getSQLFromFilter(filter);
  72297. if (url) {
  72298. this.getFeatureFromFileAdded(layerInfo, function (data) {
  72299. var sFeaturesArr = [],
  72300. features, result;
  72301. if (data.type === 'EXCEL' || data.type === 'CSV') {
  72302. features = me.parseFeatureFromEXCEL.apply(me, [data.content.rows, data.content.colTitles, false, position]);
  72303. for (var x = 0, len = features.length; x < len; x++) {
  72304. result = jsonsql_default()({
  72305. attr: features[x].attributes
  72306. }, sql);
  72307. if (result.length > 0) {
  72308. sFeaturesArr.push(features[x])
  72309. }
  72310. }
  72311. } else {
  72312. features = me.parseFeatureFromJson(data.content);
  72313. for (var i = 0, length = features.length; i < length; i++) {
  72314. result = jsonsql_default()({
  72315. attr: features[i].attributes
  72316. }, sql);
  72317. if (result.length > 0) {
  72318. sFeaturesArr.push(features[i]);
  72319. }
  72320. }
  72321. }
  72322. var newEpsgCode = '4326',
  72323. oldEpsgCode = layerInfo.prjCoordSys && layerInfo.prjCoordSys.epsgCode;
  72324. if (needTransform) {
  72325. me.changeFeatureLayerEpsgCode(oldEpsgCode, newEpsgCode, layer, sFeaturesArr, function (features) {
  72326. addFeatures(features);
  72327. });
  72328. } else {
  72329. addFeatures(sFeaturesArr);
  72330. }
  72331. }, function () {});
  72332. } else {
  72333. var newFeautures = [],
  72334. features = layerInfo.features;
  72335. for (var i = 0, len = features.length; i < len; i++) {
  72336. var feature = features[i];
  72337. var sqlResult = jsonsql_default()({
  72338. attr: feature.attributes
  72339. }, sql);
  72340. if (sqlResult.length > 0) {
  72341. var lon = feature.geometry.points[0].x,
  72342. lat = feature.geometry.points[0].y;
  72343. var point = new Point(lon, lat);
  72344. var vector = new Vector(point, feature.attributes, feature.style);
  72345. newFeautures.push(vector);
  72346. }
  72347. }
  72348. addFeatures(newFeautures);
  72349. }
  72350. } else if (isRestData) {
  72351. var dataSourceName = layerInfo.datasourceName;
  72352. subLayers = layerInfo.subLayers && JSON.parse(layerInfo.subLayers);
  72353. if (subLayers.length && subLayers.length > 0) {
  72354. subLayer = subLayers[0];
  72355. } else {
  72356. subLayer = subLayers;
  72357. }
  72358. layerName = subLayer && subLayer.name;
  72359. this.getFeaturesBySQL(layerInfo.url, dataSourceName, layerName, themeSettings.filter, DataFormat.ISERVER, (getFeaturesEventArgs) => {
  72360. var features, feature, result = getFeaturesEventArgs.result,
  72361. addedFeatures = [];
  72362. if (result && result.features) {
  72363. features = result.features;
  72364. for (var fi = 0, felen = features.length; fi < felen; fi++) {
  72365. feature = ServerFeature.fromJson(features[fi]).toFeature();
  72366. addedFeatures.push(feature);
  72367. }
  72368. var newEpsgCode = '4326',
  72369. oldEpsgCode = layerInfo.prjCoordSys && layerInfo.prjCoordSys.epsgCode;
  72370. if (needTransform) {
  72371. this.changeFeatureLayerEpsgCode(oldEpsgCode, newEpsgCode, layer, addedFeatures, function (features) {
  72372. addFeatures(features);
  72373. });
  72374. } else {
  72375. addFeatures(features);
  72376. }
  72377. }
  72378. })
  72379. } else {
  72380. subLayers = layerInfo.subLayers && JSON.parse(layerInfo.subLayers);
  72381. if (subLayers.length && subLayers.length > 0) {
  72382. subLayer = subLayers[0];
  72383. } else {
  72384. subLayer = subLayers;
  72385. }
  72386. layerName = subLayer && subLayer.name;
  72387. var oldEpsgCode = layerInfo.prjCoordSys && layerInfo.prjCoordSys.epsgCode;
  72388. this.getFeaturesBySQL(url, credential, layerName, filter, DataFormat.ISERVER, function (features) {
  72389. var newEpsgCode = '4326';
  72390. if (needTransform) {
  72391. me.changeFeatureLayerEpsgCode(oldEpsgCode, newEpsgCode, layer, features, function (features) {
  72392. addFeatures(features);
  72393. });
  72394. } else {
  72395. addFeatures(features);
  72396. }
  72397. });
  72398. }
  72399. function addFeatures(features) {
  72400. if (layer && layer.labelLayer instanceof LabelThemeLayer) {
  72401. me.addFeature2LabelLayer(layer.labelLayer, features, layerInfo);
  72402. }
  72403. if ((external_L_default()).HeatLayer && layer instanceof (external_L_default()).HeatLayer) {
  72404. var heatPoints = [];
  72405. for (let i = 0, len = features.length; i < len; i++) {
  72406. let geometry = features[i].geometry;
  72407. heatPoints[i] = external_L_default().latLng(geometry.y, geometry.x);
  72408. if (layer.options.featureWeight) {
  72409. heatPoints[i] = [heatPoints[i].lat, heatPoints[i].lng, parseFloat(features[i].attributes[layer.options.featureWeight])];
  72410. }
  72411. }
  72412. layer.setLatLngs(heatPoints);
  72413. } else if (layer instanceof (external_L_default()).GeoJSON) {
  72414. layer.addData(new GeoJSON().toGeoJSON(features));
  72415. } else {
  72416. layer.addFeatures(features);
  72417. }
  72418. }
  72419. },
  72420. addFeature2LabelLayer: function (layer, features, layerInfo) {
  72421. if (!features) {
  72422. return;
  72423. }
  72424. var feature, geoTextFeature;
  72425. var themeSettings = layerInfo.themeSettings;
  72426. themeSettings = typeof themeSettings === "string" ? JSON.parse(layerInfo.themeSettings) : layerInfo.themeSettings;
  72427. var themeField = themeSettings.labelField;
  72428. var style = layer.style;
  72429. var labelFeatures = [],
  72430. lngLat;
  72431. var styleInfo = layerInfo.styleString && JSON.parse(layerInfo.styleString);
  72432. for (var i = 0; i < features.length; i++) {
  72433. lngLat = this.getLabelLngLat(themeSettings.vectorType, features[i]);
  72434. //设置标签的偏移量
  72435. this.setLabelOffset(themeSettings.vectorType, styleInfo, features[i], style);
  72436. feature = features[i];
  72437. var attributes = feature.attributes;
  72438. geoTextFeature = new ThemeFeature([lngLat.lat, lngLat.lng, attributes[themeField]], attributes);
  72439. labelFeatures.push(geoTextFeature);
  72440. }
  72441. layer.style = style;
  72442. layer.addFeatures(labelFeatures);
  72443. },
  72444. setLabelOffset: function (vectorType, styleInfo, feature, layerStyle) {
  72445. if (vectorType === 'POINT') {
  72446. var pointRadius = styleInfo.pointStyle.pointRadius || 0;
  72447. var strokeWidth = styleInfo.pointStyle.strokeWidth || 0;
  72448. var fontSize = parseInt(styleInfo.pointStyle.fontSize) || 0;
  72449. layerStyle.labelXOffset = 0;
  72450. layerStyle.labelYOffset = styleInfo.pointStyle.unicode ? 20 + fontSize : 25 + (pointRadius + strokeWidth);
  72451. } else {
  72452. return;
  72453. }
  72454. },
  72455. getLabelLngLat: function (vectorType, feature) {
  72456. var lngLat = {};
  72457. if (vectorType === 'POINT') {
  72458. var geometry = feature.geometry;
  72459. lngLat.lng = geometry.x;
  72460. lngLat.lat = geometry.y;
  72461. } else if (vectorType === 'LINE') {
  72462. //一条线所有顶点的数量
  72463. var length, index;
  72464. var components = feature.geometry.components;
  72465. if (components[0].x) {
  72466. //说明是lineString类型
  72467. length = components.length;
  72468. //线取中间点下一个显示标签
  72469. index = parseInt(length / 2);
  72470. lngLat.lng = components[index].x;
  72471. lngLat.lat = components[index].y;
  72472. } else {
  72473. //说明是MultiLineString类型,取第一条线
  72474. var lineOne = components[0].components;
  72475. length = lineOne.length;
  72476. index = parseInt(length / 2);
  72477. lngLat.lng = lineOne[index].x;
  72478. lngLat.lat = lineOne[index].y;
  72479. }
  72480. } else {
  72481. var centroid = feature.geometry.getCentroid();
  72482. lngLat.lng = centroid.x;
  72483. lngLat.lat = centroid.y;
  72484. }
  72485. return lngLat;
  72486. },
  72487. changeFeatureLayerEpsgCode: function (oldEpsgCode, newEpsgCode, layer, features, success) {
  72488. var me = this,
  72489. i, len;
  72490. var points = [];
  72491. if (!oldEpsgCode || !newEpsgCode) {
  72492. return;
  72493. }
  72494. if (features && features.length > 0) {
  72495. for (i = 0, len = features.length; i < len; i++) {
  72496. var feature = features[i];
  72497. var geometry = feature.geometry;
  72498. var vertices = geometry.getVertices();
  72499. points = points.concat(vertices);
  72500. }
  72501. oldEpsgCode = 'EPSG:' + oldEpsgCode;
  72502. newEpsgCode = 'EPSG:' + newEpsgCode;
  72503. me.coordsTransform(oldEpsgCode, newEpsgCode, points, function (layer, features) {
  72504. return function (newCoors) {
  72505. var start = 0,
  72506. len = newCoors.length;
  72507. for (i = start; i < len; i++) {
  72508. var point = points[i],
  72509. coor = newCoors[i];
  72510. point.x = coor.x;
  72511. point.y = coor.y;
  72512. point.calculateBounds();
  72513. }
  72514. for (i = 0, len = features.length; i < len; i++) {
  72515. var feature = features[i];
  72516. var geometry = feature.geometry;
  72517. if (geometry.components) {
  72518. me.calculateComponents(geometry.components);
  72519. }
  72520. geometry.calculateBounds();
  72521. }
  72522. success && success.call(me, features);
  72523. }
  72524. }(layer, features));
  72525. }
  72526. return true;
  72527. },
  72528. calculateComponents: function (components) {
  72529. if (components) {
  72530. if (components.components) {
  72531. this.calculateComponents(components.components);
  72532. } else {
  72533. for (var i = 0, len = components.length; i < len; i++) {
  72534. var component = components[i];
  72535. if (component.components) {
  72536. this.calculateComponents(component.components)
  72537. }
  72538. component.calculateBounds();
  72539. }
  72540. }
  72541. }
  72542. },
  72543. coordsTransform: function (fromEpsg, toEpsg, point, success) {
  72544. var newCoord;
  72545. var from = this.SERVER_TYPE_MAP[fromEpsg],
  72546. to = this.SERVER_TYPE_MAP[toEpsg];
  72547. if (fromEpsg === toEpsg || !from || !to) {
  72548. if (point && point.length !== undefined) {
  72549. newCoord = [];
  72550. for (var i = 0, len = point.length; i < len; i++) {
  72551. var coor = {
  72552. x: point[i].x,
  72553. y: point[i].y
  72554. };
  72555. newCoord.push(coor);
  72556. }
  72557. } else {
  72558. newCoord = {
  72559. x: point.x,
  72560. y: point.y
  72561. };
  72562. }
  72563. if (success) {
  72564. success.call(this, newCoord);
  72565. }
  72566. } else {
  72567. var mercator = this.SERVER_TYPE_MAP['EPSG:3857'],
  72568. wgs84 = this.SERVER_TYPE_MAP['EPSG:4326'];
  72569. if ((from === mercator || from === wgs84) && (to === mercator || to === wgs84)) {
  72570. this.projTransform(fromEpsg, toEpsg, point, success);
  72571. } else {
  72572. var convertType = from + '_' + to;
  72573. this.postTransform(convertType, point, success);
  72574. }
  72575. }
  72576. },
  72577. projTransform: function (fromEpsg, toEpsg, point, success) {
  72578. var newCoor, me = this;
  72579. if (!lib) {
  72580. return;
  72581. }
  72582. if (point && point.length !== undefined) {
  72583. newCoor = [];
  72584. for (var i = 0, len = point.length; i < len; i++) {
  72585. var coor = lib(fromEpsg, toEpsg, [point[i].x, point[i].y]);
  72586. newCoor.push({
  72587. x: coor[0],
  72588. y: coor[1]
  72589. });
  72590. }
  72591. } else {
  72592. newCoor = lib(fromEpsg, toEpsg, [point.x, point.y]);
  72593. newCoor = {
  72594. x: newCoor[0],
  72595. y: newCoor[1]
  72596. };
  72597. }
  72598. if (success) {
  72599. /**
  72600. * @event L.supermap.webmap#coordconvertsuccess
  72601. * @description 坐标转换成功后触发。
  72602. * @property {L.latLng} newCoor - 转换成功后的坐标。
  72603. */
  72604. me.fire('coordconvertsuccess', {
  72605. newCoor: newCoor
  72606. });
  72607. success.call(me, newCoor);
  72608. }
  72609. },
  72610. postTransform: function (convertType, point, success) {
  72611. var me = this,
  72612. epsgArray = [];
  72613. if (!convertType) {
  72614. return success.call(me, null);
  72615. }
  72616. if (point && point.length !== undefined) {
  72617. for (var i = 0, len = point.length; i < len; i++) {
  72618. epsgArray.push({
  72619. x: point[i].x,
  72620. y: point[i].y
  72621. });
  72622. }
  72623. } else {
  72624. epsgArray = [{
  72625. x: point.x,
  72626. y: point.y
  72627. }];
  72628. }
  72629. if (epsgArray.length === 0) {
  72630. return success.call(me, null);
  72631. }
  72632. var postData = {
  72633. "convertType": convertType,
  72634. "points": epsgArray
  72635. };
  72636. var url = this.server + "/apps/viewer/coordconvert.json";
  72637. postData = JSON.stringify(postData);
  72638. var options = {};
  72639. if (!Util.isInTheSameDomain(url) && this.proxy) {
  72640. options.proxy = this.proxy;
  72641. }
  72642. FetchRequest.post(url, postData, options).then((response) => {
  72643. return response.json()
  72644. }).then((jsonObj) => {
  72645. var newCoors = jsonObj;
  72646. if (!point && point.length !== undefined) {
  72647. newCoors = newCoors[0];
  72648. }
  72649. this.fire('coordconvertsuccess', {
  72650. newCoors: newCoors
  72651. });
  72652. success.call(this, newCoors);
  72653. }).catch((err) => {
  72654. if (!this.actived) {
  72655. return;
  72656. }
  72657. /**
  72658. * @event L.supermap.webmap#coordconvertfailed
  72659. * @description 坐标转换失败后触发。
  72660. * @property {Object} err - error 对象。
  72661. */
  72662. this.fire('coordconvertfailed', {
  72663. err: err
  72664. });
  72665. })
  72666. },
  72667. getSQLFromFilter: function (filter) {
  72668. if (!filter) {
  72669. return ' * where (1==1||1>=0)'
  72670. } else {
  72671. filter = filter.replace(/=/g, '==').replace(/and|AND/g, '&&').replace(/or|OR/g, '||').replace(/>==/g, '>=').replace(/<==/g, '<=');
  72672. return ' * where (' + filter + ')';
  72673. }
  72674. },
  72675. getAttributesObjFromTable: function (cols, colTitles) {
  72676. if (cols.length === 0 || colTitles.length === 0) {
  72677. return;
  72678. }
  72679. var attrArr = [];
  72680. for (var i = 0; i < cols.length; i++) {
  72681. var obj = {};
  72682. for (var j = 0; j < colTitles.length; j++) {
  72683. obj[colTitles[j]] = cols[i][j]
  72684. }
  72685. attrArr.push(obj);
  72686. }
  72687. return attrArr;
  72688. },
  72689. parseFeatureFromEXCEL: function (rows, colTitles, isGraphic, position) {
  72690. var attrArr = this.getAttributesObjFromTable(rows, colTitles);
  72691. var features = [];
  72692. for (var i = 0, len = attrArr.length; i < len; i++) {
  72693. var lon = attrArr[i][position["lon"]];
  72694. var lat = attrArr[i][position["lat"]];
  72695. if (!lon || !lat) {
  72696. continue;
  72697. }
  72698. lon = parseFloat(lon);
  72699. lat = parseFloat(lat);
  72700. var geometry = new Point(lon, lat);
  72701. var pointGraphic;
  72702. if (isGraphic) {
  72703. pointGraphic = new Graphic(geometry, attrArr[i], null);
  72704. } else {
  72705. pointGraphic = new Vector(geometry, attrArr[i], null);
  72706. }
  72707. features.push(pointGraphic);
  72708. }
  72709. return features;
  72710. },
  72711. parseFeatureFromJson: function (feature) {
  72712. var format = new GeoJSON();
  72713. var features = format.read(feature);
  72714. //兼容insights数据格式
  72715. if (features == null) {
  72716. var content = JSON.parse(feature.replace(/'/, '"'));
  72717. if (content.isAnalyseResult || content.type === 'MapEditor' || content.type === 'DataInsights' || content.type === 'ISERVER') {
  72718. content = content.data.recordsets[0].features;
  72719. }
  72720. format = new GeoJSON();
  72721. features = format.read(content);
  72722. }
  72723. for (var i = 0, len = features.length; i < len; i++) {
  72724. features[i].attributes = features[i].attributes.properties || features[i].attributes;
  72725. }
  72726. return features;
  72727. },
  72728. getFeatureFromFileAdded: function (layerInfo, success, failed, isGraphic) {
  72729. var url = isGraphic ? layerInfo.url + '?currentPage=1&&pageSize=9999999' : layerInfo.url;
  72730. FetchRequest.get(url).then(response => response.json()).then(data => {
  72731. success && success(data);
  72732. }).catch(err => failed && failed(err));
  72733. },
  72734. getCartoCSS2Obj: function (cartoCSS) {
  72735. var isAddFile, needTransform = false;
  72736. if (cartoCSS.indexOf('}') > -1) {
  72737. cartoCSS = JSON.parse(cartoCSS);
  72738. needTransform = cartoCSS.needTransform;
  72739. isAddFile = cartoCSS.isAddFile;
  72740. } else {
  72741. if (cartoCSS === 'needTransform') {
  72742. needTransform = true;
  72743. //layerInfo.needTransform = true;
  72744. isAddFile = false;
  72745. } else {
  72746. isAddFile = cartoCSS === 'true';
  72747. }
  72748. }
  72749. return {
  72750. isAddFile: isAddFile,
  72751. needTransform: needTransform
  72752. }
  72753. },
  72754. registerThemeEvent: function (themeLayer) {
  72755. themeLayer.on('click', evt => {
  72756. if (!themeLayer.map) {
  72757. return;
  72758. }
  72759. if (this.selectedFeature) {
  72760. /**
  72761. * @event L.supermap.webmap#featureunselected
  72762. * @description 重置选中的要素为空。
  72763. * @property {SuperMap.Feature.Vector} feature - 在重置之前选中的要素。
  72764. */
  72765. this.fire('featureunselected', {
  72766. feature: this.selectedFeature
  72767. });
  72768. this.selectedFeature = null;
  72769. }
  72770. let feature;
  72771. if (evt.target && evt.target.refDataID) {
  72772. feature = themeLayer.getFeatureById(evt.target.refDataID);
  72773. }
  72774. if (feature) {
  72775. this.selectedFeature = feature;
  72776. /**
  72777. * @event L.supermap.webmap#featureselected
  72778. * @description 点击要素,要素存在之后触发。设置选中的要素。
  72779. * @property {SuperMap.Feature.Vector} feature - 点击的要素。
  72780. */
  72781. this.fire('featureselected', {
  72782. feature: feature
  72783. });
  72784. }
  72785. });
  72786. themeLayer.on('mousemove', evt => {
  72787. if (!themeLayer.map) {
  72788. return;
  72789. }
  72790. if (evt.target && evt.target.refDataID) {
  72791. let feature;
  72792. if (evt.target && evt.target.refDataID) {
  72793. feature = themeLayer.getFeatureById(evt.target.refDataID);
  72794. }
  72795. if (feature) {
  72796. /**
  72797. * @event L.supermap.webmap#featuremousemove
  72798. * @description 鼠标移动到要素上之后触发。
  72799. * @property {SuperMap.Feature.Vector} feature - 当前被移动到的要素。
  72800. */
  72801. this.fire('featuremousemove', {
  72802. feature: feature
  72803. });
  72804. }
  72805. }
  72806. });
  72807. },
  72808. SERVER_TYPE_MAP: {
  72809. "EPSG:4326": "WGS84",
  72810. "EPSG:3857": "MERCATOR",
  72811. "EPSG:900913": "MERCATOR",
  72812. "EPSG:102113": "MERCATOR",
  72813. "EPSG:910101": "GCJ02",
  72814. "EPSG:910111": "GCJ02MERCATOR",
  72815. "EPSG:910102": "BD",
  72816. "EPSG:910112": "BDMERCATOR"
  72817. }
  72818. });
  72819. var webMap = function (id, options) {
  72820. return new WebMap(id, options);
  72821. };
  72822. (external_L_default()).supermap.webmap = webMap;
  72823. ;// CONCATENATED MODULE: ./src/leaflet/mapping/index.js
  72824. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  72825. * This program are made available under the terms of the Apache License, Version 2.0
  72826. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72827. ;// CONCATENATED MODULE: ./src/leaflet/services/DataFlowService.js
  72828. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  72829. * This program are made available under the terms of the Apache License, Version 2.0
  72830. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72831. /**
  72832. * @class L.supermap.dataFlowService
  72833. * @classdesc 数据流服务类。
  72834. * @category iServer DataFlow
  72835. * @extends {L.supermap.ServiceBase}
  72836. * @param {string} url - 数据流服务地址。
  72837. * @param {Object} options - 参数。
  72838. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  72839. * @param {Function} [options.style] - 设置数据加载样式。
  72840. * @param {Function} [options.onEachFeature] - 设置每个数据加载 popup 等。
  72841. * @param {GeoJSONObject} [options.geometry] - 指定几何范围,该范围内的要素才能被订阅。
  72842. * @param {Object} [options.excludeField] - 排除字段。
  72843. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  72844. * @param {Object} [options.headers] - 请求头。
  72845. * @fires L.supermap.dataFlowService#broadcastSocketConnected
  72846. * @fires L.supermap.dataFlowService#broadcastSocketError
  72847. * @fires L.supermap.dataFlowService#broadcastFailed
  72848. * @fires L.supermap.dataFlowService#broadcastSucceeded
  72849. * @fires L.supermap.dataFlowService#subscribeSocketError
  72850. * @fires L.supermap.dataFlowService#messageSucceeded
  72851. * @fires L.supermap.dataFlowService#setFilterParamSucceeded
  72852. */
  72853. var DataFlowService_DataFlowService = ServiceBase.extend({
  72854. options: {
  72855. geometry: null,
  72856. prjCoordSys: null,
  72857. excludeField: null
  72858. },
  72859. initialize: function (url, options) {
  72860. options = options || {};
  72861. external_L_default().setOptions(this, options);
  72862. if (options.projection) {
  72863. this.options.prjCoordSys = options.projection;
  72864. }
  72865. ServiceBase.prototype.initialize.call(this, url, options);
  72866. this.dataFlow = new DataFlowService(url, options);
  72867. /**
  72868. * @event L.supermap.dataFlowService#broadcastSocketConnected
  72869. * @description broadcast Socket 连接成功。
  72870. */
  72871. /**
  72872. * @event L.supermap.dataFlowService#broadcastSocketError
  72873. * @description broadcast Socket 连接失败。
  72874. */
  72875. /**
  72876. * @event L.supermap.dataFlowService#broadcastFailed
  72877. * @description 广播失败。
  72878. */
  72879. /**
  72880. * @event L.supermap.dataFlowService#broadcastSucceeded
  72881. * @description 广播成功。
  72882. */
  72883. /**
  72884. * @event L.supermap.dataFlowService#subscribeSocketConnected
  72885. * @description 订阅数据连接成功。
  72886. */
  72887. /**
  72888. * @event L.supermap.dataFlowService#subscribeSocketError
  72889. * @description 订阅数据连接失败。
  72890. */
  72891. /**
  72892. * @event L.supermap.dataFlowService#messageSucceeded
  72893. * @description 获取信息成功。
  72894. */
  72895. /**
  72896. * @event L.supermap.dataFlowService#setFilterParamSucceeded
  72897. * @description 设置过滤参数成功。
  72898. */
  72899. this.dataFlow.events.on({
  72900. "broadcastSocketConnected": this._defaultEvent,
  72901. "broadcastSocketError": this._defaultEvent,
  72902. "broadcastFailed": this._defaultEvent,
  72903. "broadcastSucceeded": this._defaultEvent,
  72904. "subscribeSocketConnected": this._defaultEvent,
  72905. "subscribeSocketError": this._defaultEvent,
  72906. "messageSucceeded": this._defaultEvent,
  72907. "setFilterParamSucceeded": this._defaultEvent,
  72908. scope: this
  72909. })
  72910. },
  72911. /**
  72912. * @function L.supermap.dataFlowService.prototype.initBroadcast
  72913. * @description 初始化广播。
  72914. */
  72915. initBroadcast: function () {
  72916. this.dataFlow.initBroadcast();
  72917. return this;
  72918. },
  72919. /**
  72920. * @function L.supermap.dataFlowService.prototype.broadcast
  72921. * @description 加载广播数据。
  72922. * @param {JSONObject} obj - JSON 格式的要素数据。
  72923. */
  72924. broadcast: function (obj) {
  72925. this.dataFlow.broadcast(obj);
  72926. },
  72927. /**
  72928. * @function L.supermap.dataFlowService.prototype.initSubscribe
  72929. * @description 初始化订阅数据。
  72930. */
  72931. initSubscribe: function () {
  72932. this.dataFlow.initSubscribe();
  72933. return this;
  72934. },
  72935. /**
  72936. * @function L.supermap.dataFlowService.prototype.setExcludeField
  72937. * @description 设置排除字段。
  72938. * @param {Object} excludeField - 排除字段。
  72939. */
  72940. setExcludeField: function (excludeField) {
  72941. this.dataFlow.setExcludeField(excludeField);
  72942. this.options.excludeField = excludeField;
  72943. return this;
  72944. },
  72945. /**
  72946. * @function L.supermap.dataFlowService.prototype.setGeometry
  72947. * @description 设置添加的 GeoJSON 几何要素数据。
  72948. * @param {GeoJSONObject} geometry - 指定几何范围,该范围内的要素才能被订阅。
  72949. */
  72950. setGeometry: function (geometry) {
  72951. this.dataFlow.setGeometry(geometry);
  72952. this.options.geometry = geometry;
  72953. return this;
  72954. },
  72955. /**
  72956. * @function L.supermap.dataFlowService.prototype.unSubscribe
  72957. * @description 结束订阅数据。
  72958. */
  72959. unSubscribe: function () {
  72960. this.dataFlow.unSubscribe();
  72961. },
  72962. /**
  72963. * @function L.supermap.dataFlowService.prototype.unBroadcast
  72964. * @description 结束加载广播。
  72965. */
  72966. unBroadcast: function () {
  72967. this.dataFlow.unBroadcast();
  72968. },
  72969. _defaultEvent: function (e) {
  72970. this.fire(e.eventType || e.type, e);
  72971. }
  72972. });
  72973. var dataFlowService = function (url, options) {
  72974. return new DataFlowService_DataFlowService(url, options);
  72975. };
  72976. (external_L_default()).supermap.dataFlowService = dataFlowService;
  72977. ;// CONCATENATED MODULE: external "function(){try{return mapv}catch(e){return {}}}()"
  72978. const external_function_try_return_mapv_catch_e_return_namespaceObject = function(){try{return mapv}catch(e){return {}}}();
  72979. ;// CONCATENATED MODULE: ./src/leaflet/overlay/mapv/MapVRenderer.js
  72980. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  72981. * This program are made available under the terms of the Apache License, Version 2.0
  72982. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72983. var BaseLayer = external_function_try_return_mapv_catch_e_return_namespaceObject.baiduMapLayer ? external_function_try_return_mapv_catch_e_return_namespaceObject.baiduMapLayer.__proto__ : Function;
  72984. /**
  72985. * @class L.supermap.MapVRenderer
  72986. * @classdesc 地图渲染类。
  72987. * @category Visualization MapV
  72988. * @private
  72989. * @extends mapv.BaseLayer
  72990. * @param {L.Map} map - 待渲染的地图。
  72991. * @param {L.Layer} layer - 待渲染的图层。
  72992. * @param {DataSet} dataSet - 待渲染的数据集。
  72993. * @param {Object} options - 渲染的参数。
  72994. */
  72995. class MapVRenderer extends BaseLayer {
  72996. constructor(map, layer, dataSet, options) {
  72997. super(map, dataSet, options);
  72998. if (!BaseLayer) {
  72999. return;
  73000. }
  73001. var self = this;
  73002. options = options || {};
  73003. self.init(options);
  73004. self.argCheck(options);
  73005. this.canvasLayer = layer;
  73006. this.clickEvent = this.clickEvent.bind(this);
  73007. this.mousemoveEvent = this.mousemoveEvent.bind(this);
  73008. this._moveStartEvent = this.moveStartEvent.bind(this);
  73009. this._moveEndEvent = this.moveEndEvent.bind(this);
  73010. this._zoomStartEvent = this.zoomStartEvent.bind(this);
  73011. this.bindEvent();
  73012. }
  73013. /**
  73014. * @function L.supermap.MapVRenderer.prototype.clickEvent
  73015. * @description 点击事件。
  73016. * @param {Object} e - 触发对象。
  73017. */
  73018. clickEvent(e) {
  73019. var offset = this.map.containerPointToLayerPoint([0, 0]);
  73020. var devicePixelRatio = this.devicePixelRatio = this.canvasLayer.devicePixelRatio = window.devicePixelRatio || 1 ;
  73021. var pixel = e.layerPoint;
  73022. super.clickEvent(external_L_default().point((pixel.x - offset.x) / devicePixelRatio, (pixel.y - offset.y) / devicePixelRatio), e);
  73023. }
  73024. /**
  73025. * @function L.supermap.MapVRenderer.prototype.mousemoveEvent
  73026. * @description 鼠标移动事件。
  73027. * @param {Object} e - 触发对象。
  73028. */
  73029. mousemoveEvent(e) {
  73030. var pixel = e.layerPoint;
  73031. super.mousemoveEvent(pixel, e);
  73032. }
  73033. /**
  73034. * @function L.supermap.MapVRenderer.prototype.bindEvent
  73035. * @description 绑定鼠标移动和鼠标点击事件。
  73036. * @param {Object} e - 触发对象。
  73037. */
  73038. bindEvent() {
  73039. var map = this.map;
  73040. if (this.options.methods) {
  73041. if (this.options.methods.click) {
  73042. map.on('click', this.clickEvent);
  73043. }
  73044. if (this.options.methods.mousemove) {
  73045. map.on('mousemove', this.mousemoveEvent);
  73046. }
  73047. }
  73048. this.map.on('movestart', this._moveStartEvent);
  73049. this.map.on('moveend', this._moveEndEvent);
  73050. this.map.on('zoomstart', this._zoomStartEvent);
  73051. }
  73052. /**
  73053. * @function L.supermap.MapVRenderer.prototype.destroy
  73054. * @description 释放资源。
  73055. */
  73056. destroy() {
  73057. this.unbindEvent();
  73058. this.clearData();
  73059. this.animator && this.animator.stop();
  73060. this.animator = null;
  73061. this.canvasLayer = null;
  73062. }
  73063. /**
  73064. * @function L.supermap.MapVRenderer.prototype.unbindEvent
  73065. * @description 解绑鼠标移动和鼠标滑动触发的事件。
  73066. * @param {Object} e - 触发对象。
  73067. */
  73068. unbindEvent() {
  73069. var map = this.map;
  73070. if (this.options.methods) {
  73071. if (this.options.methods.click) {
  73072. map.off('click', this.clickEvent);
  73073. }
  73074. if (this.options.methods.mousemove) {
  73075. map.off('mousemove', this.mousemoveEvent);
  73076. }
  73077. }
  73078. this.map.off('movestart', this._moveStartEvent);
  73079. this.map.off('moveend', this._moveEndEvent);
  73080. this.map.off('zoomstart', this._zoomStartEvent);
  73081. }
  73082. /**
  73083. * @function L.supermap.MapVRenderer.prototype.getContext
  73084. * @description 获取信息。
  73085. */
  73086. getContext() {
  73087. return this.canvasLayer.getCanvas().getContext(this.context);
  73088. }
  73089. /**
  73090. * @function L.supermap.MapVRenderer.prototype.addData
  73091. * @description 添加数据。
  73092. * @param {Object} data - 待添加的数据。
  73093. * @param {Object} options - 待添加的数据信息。
  73094. */
  73095. addData(data, options) {
  73096. var _data = data;
  73097. if (data && data.get) {
  73098. _data = data.get();
  73099. }
  73100. this.dataSet.add(_data);
  73101. this.update({
  73102. options: options
  73103. });
  73104. }
  73105. /**
  73106. * @function L.supermap.MapVRenderer.prototype.update
  73107. * @description 更新图层。
  73108. * @param {Object} opt - 待更新的数据。
  73109. * @param {Object} opt.data - mapv数据集。
  73110. * @param {Object} opt.options - mapv绘制参数。
  73111. */
  73112. update(opt) {
  73113. var update = opt || {};
  73114. var _data = update.data;
  73115. if (_data && _data.get) {
  73116. _data = _data.get();
  73117. }
  73118. if (_data != undefined) {
  73119. this.dataSet.set(_data);
  73120. }
  73121. super.update({
  73122. options: update.options
  73123. });
  73124. }
  73125. /**
  73126. * @function L.supermap.MapVRenderer.prototype.getData
  73127. * @description 获取数据
  73128. */
  73129. getData() {
  73130. return this.dataSet;
  73131. }
  73132. /**
  73133. * @function L.supermap.MapVRenderer.prototype.removeData
  73134. * @description 删除符合过滤条件的数据。
  73135. * @param {Function} filter - 过滤条件。条件参数为数据项,返回值为 true,表示删除该元素;否则表示不删除。
  73136. */
  73137. removeData(filter) {
  73138. if (!this.dataSet) {
  73139. return;
  73140. }
  73141. var newData = this.dataSet.get({
  73142. filter: function (data) {
  73143. return (filter != null && typeof filter === "function") ? !filter(data) : true;
  73144. }
  73145. });
  73146. this.dataSet.set(newData);
  73147. this.update({
  73148. options: null
  73149. });
  73150. }
  73151. /**
  73152. * @function L.supermap.MapVRenderer.prototype.clearData
  73153. * @description 清除数据
  73154. */
  73155. clearData() {
  73156. this.dataSet && this.dataSet.clear();
  73157. this.update({
  73158. options: null
  73159. });
  73160. }
  73161. _canvasUpdate(time) {
  73162. if (!this.canvasLayer) {
  73163. return;
  73164. }
  73165. var self = this;
  73166. var animationOptions = self.options.animation;
  73167. var context = this.getContext();
  73168. var map = this.map;
  73169. if (self.isEnabledTime()) {
  73170. if (time === undefined) {
  73171. this.clear(context);
  73172. return;
  73173. }
  73174. if (this.context === '2d') {
  73175. context.save();
  73176. context.globalCompositeOperation = 'destination-out';
  73177. context.fillStyle = 'rgba(0, 0, 0, .1)';
  73178. context.fillRect(0, 0, context.canvas.width, context.canvas.height);
  73179. context.restore();
  73180. }
  73181. } else {
  73182. this.clear(context);
  73183. }
  73184. if (this.context === '2d') {
  73185. for (var key in self.options) {
  73186. context[key] = self.options[key];
  73187. }
  73188. } else {
  73189. context.clear(context.COLOR_BUFFER_BIT);
  73190. }
  73191. if (self.options.minZoom && map.getZoom() < self.options.minZoom || self.options.maxZoom && map.getZoom() > self.options.maxZoom) {
  73192. return;
  73193. }
  73194. var bounds = map.getBounds();
  73195. //获取当前像素下的地理范围
  73196. var dw = bounds.getEast() - bounds.getWest();
  73197. var dh = bounds.getNorth() - bounds.getSouth();
  73198. var mapCanvas = map.getSize();
  73199. var resolutionX = dw / mapCanvas.x,
  73200. resolutionY = dh / mapCanvas.y;
  73201. // 一个像素是多少米
  73202. var zoomUnit = Util_getMeterPerMapUnit('DEGREE') * resolutionX;
  73203. //var centerPx = map.latLngToLayerPoint(map.getCenter());
  73204. //获取屏幕左上角的地理坐标坐标
  73205. //左上角屏幕坐标为0,0
  73206. var topLeft = this.canvasLayer.getTopLeft();
  73207. var topLeftPX = map.latLngToAccurateContainerPoint(topLeft);
  73208. // var lopLeft = map.containerPointToLatLng([0, 0]);
  73209. var dataGetOptions = {
  73210. transferCoordinate: function (coordinate) {
  73211. var offset;
  73212. if (self.context === '2d') {
  73213. offset = map.latLngToAccurateContainerPoint(external_L_default().latLng(coordinate[1], coordinate[0]));
  73214. } else {
  73215. offset = {
  73216. 'x': (coordinate[0] - topLeft.lng) / resolutionX,
  73217. 'y': (topLeft.lat - coordinate[1]) / resolutionY
  73218. };
  73219. }
  73220. var pixel = {
  73221. x: offset.x - topLeftPX.x,
  73222. y: offset.y - topLeftPX.y
  73223. };
  73224. return [pixel.x, pixel.y];
  73225. }
  73226. };
  73227. if (time !== undefined) {
  73228. dataGetOptions.filter = function (item) {
  73229. var trails = animationOptions.trails || 10;
  73230. return (time && item.time > (time - trails) && item.time < time);
  73231. }
  73232. }
  73233. var data = self.dataSet.get(dataGetOptions);
  73234. this.processData(data);
  73235. var worldPoint = map.latLngToContainerPoint(external_L_default().latLng(0, 0));
  73236. var pixel = {
  73237. x: worldPoint.x - topLeftPX.x,
  73238. y: worldPoint.y - topLeftPX.y
  73239. };
  73240. // 兼容unit为'm'的情况
  73241. if (self.options.unit === 'm') {
  73242. if (self.options.size) {
  73243. self.options._size = self.options.size / zoomUnit;
  73244. }
  73245. if (self.options.width) {
  73246. self.options._width = self.options.width / zoomUnit;
  73247. }
  73248. if (self.options.height) {
  73249. self.options._height = self.options.height / zoomUnit;
  73250. }
  73251. } else {
  73252. self.options._size = self.options.size;
  73253. self.options._height = self.options.height;
  73254. self.options._width = self.options.width;
  73255. }
  73256. this.drawContext(context, data, self.options, pixel);
  73257. self.options.updateCallback && self.options.updateCallback(time);
  73258. }
  73259. init(options) {
  73260. var self = this;
  73261. self.options = options;
  73262. this.initDataRange(options);
  73263. this.context = self.options.context || '2d';
  73264. if (self.options.zIndex) {
  73265. this.canvasLayer && this.canvasLayer.setZIndex(self.options.zIndex);
  73266. }
  73267. this.initAnimator();
  73268. }
  73269. addAnimatorEvent() {}
  73270. /**
  73271. * @function L.supermap.MapVRenderer.prototype.moveStartEvent
  73272. * @description 开始移动事件。
  73273. */
  73274. moveStartEvent() {
  73275. var animationOptions = this.options.animation;
  73276. if (this.isEnabledTime() && this.animator) {
  73277. this.steps.step = animationOptions.stepsRange.start;
  73278. this._hide();
  73279. }
  73280. }
  73281. /**
  73282. * @function L.supermap.MapVRenderer.prototype.moveEndEvent
  73283. * @description 结束移动事件。
  73284. */
  73285. moveEndEvent() {
  73286. this.canvasLayer.draw();
  73287. this._show();
  73288. }
  73289. /**
  73290. * @function L.supermap.MapVRenderer.prototype.zoomStartEvent
  73291. * @description 隐藏渲染样式。
  73292. */
  73293. zoomStartEvent() {
  73294. this._hide();
  73295. }
  73296. /**
  73297. * @function L.supermap.MapVRenderer.prototype.clear
  73298. * @description 清除信息。
  73299. * @param {string} context - 指定要清除的信息。
  73300. */
  73301. clear(context) {
  73302. context && context.clearRect && context.clearRect(0, 0, context.canvas.width, context.canvas.height);
  73303. }
  73304. _hide() {
  73305. this.canvasLayer.canvas.style.display = 'none';
  73306. }
  73307. _show() {
  73308. this.canvasLayer.canvas.style.display = 'block';
  73309. }
  73310. /**
  73311. * @function L.supermap.MapVRenderer.prototype.draw
  73312. * @description 绘制渲染
  73313. */
  73314. draw() {
  73315. this.canvasLayer.draw();
  73316. }
  73317. }
  73318. ;// CONCATENATED MODULE: ./src/leaflet/overlay/MapVLayer.js
  73319. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  73320. * This program are made available under the terms of the Apache License, Version 2.0
  73321. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73322. /**
  73323. * @class L.supermap.mapVLayer
  73324. * @classdesc MapV 图层。
  73325. * @category Visualization MapV
  73326. * @extends {L.Layer}
  73327. * @param {mapv.DataSet} dataSet - MapV 图层数据集。
  73328. * @param {Object} mapVOptions - MapV 图层参数。
  73329. * @param {Object} options - 参数。
  73330. * @param {string} [options.attributionPrefix] - 版权信息前缀。
  73331. * @param {string} [options.attribution='© 2018 百度 MapV'] - 版权信息。
  73332. * @fires L.supermap.mapVLayer#loaded
  73333. */
  73334. var MapVLayer = external_L_default().Layer.extend({
  73335. options: {
  73336. attributionPrefix: null,
  73337. attribution: core_Attributions.MapV.attribution
  73338. },
  73339. initialize: function (dataSet, mapVOptions, options) {
  73340. options = options || {};
  73341. this.dataSet = dataSet || {};
  73342. this.mapVOptions = mapVOptions || {};
  73343. this.render = this.render.bind(this);
  73344. external_L_default().Util.setOptions(this, options);
  73345. if (this.options.attributionPrefix) {
  73346. this.options.attribution = this.options.attributionPrefix + this.options.attribution;
  73347. }
  73348. this.canvas = this._createCanvas();
  73349. external_L_default().stamp(this);
  73350. },
  73351. /**
  73352. * @private
  73353. * @function L.supermap.mapVLayer.prototype.onAdd
  73354. * @description 添加地图图层。
  73355. * @param {L.Map} map - 要添加的地图。
  73356. */
  73357. onAdd: function (map) {
  73358. this._map = map;
  73359. var overlayPane = this.getPane();
  73360. var container = this.container = external_L_default().DomUtil.create("div", "leaflet-layer leaflet-zoom-animated", overlayPane);
  73361. container.appendChild(this.canvas);
  73362. var size = map.getSize();
  73363. container.style.width = size.x + "px";
  73364. container.style.height = size.y + "px";
  73365. this.renderer = new MapVRenderer(map, this, this.dataSet, this.mapVOptions);
  73366. this.draw();
  73367. /**
  73368. * @event L.supermap.mapVLayer#loaded
  73369. * @description 图层添加完成之后触发。
  73370. */
  73371. this.fire("loaded");
  73372. },
  73373. // _hide: function () {
  73374. // this.canvas.style.display = 'none';
  73375. // },
  73376. // _show: function () {
  73377. // this.canvas.style.display = 'block';
  73378. // },
  73379. /**
  73380. * @private
  73381. * @function L.supermap.mapVLayer.prototype.onRemove
  73382. * @description 删除地图图层。
  73383. */
  73384. onRemove: function () {
  73385. external_L_default().DomUtil.remove(this.container);
  73386. this.renderer.destroy();
  73387. },
  73388. /**
  73389. * @function L.supermap.mapVLayer.prototype.addData
  73390. * @description 追加数据。
  73391. * @param {Object} data - 要追加的数据。
  73392. * @param {Object} options - 要追加的值。
  73393. */
  73394. addData: function (data, options) {
  73395. this.renderer.addData(data, options);
  73396. },
  73397. /**
  73398. * @function L.supermap.mapVLayer.prototype.update
  73399. * @description 更新图层。
  73400. * @param {Object} opt - 待更新的数据。
  73401. * @param {Object} data - mapv 数据集。
  73402. * @param {Object} options - mapv 绘制参数。
  73403. */
  73404. update: function (opt) {
  73405. this.renderer.update(opt);
  73406. },
  73407. /**
  73408. * @function L.supermap.mapVLayer.prototype.getData
  73409. * @description 获取数据。
  73410. * @returns {mapv.DataSet} mapv 数据集。
  73411. */
  73412. getData: function () {
  73413. if (this.renderer) {
  73414. this.dataSet = this.renderer.getData();
  73415. }
  73416. return this.dataSet;
  73417. },
  73418. /**
  73419. * @function L.supermap.mapVLayer.prototype.removeData
  73420. * @description 删除符合过滤条件的数据。
  73421. * @param {Function} filter - 过滤条件。条件参数为数据项,返回值为 true,表示删除该元素;否则表示不删除。
  73422. * @example
  73423. * filter=function(data){
  73424. * if(data.id=="1"){
  73425. * return true
  73426. * }
  73427. * return false;
  73428. * }
  73429. */
  73430. removeData: function (filter) {
  73431. this.renderer && this.renderer.removeData(filter);
  73432. },
  73433. /**
  73434. * @function L.supermap.mapVLayer.prototype.clearData
  73435. * @description 清除数据。
  73436. */
  73437. clearData: function () {
  73438. this.renderer.clearData();
  73439. },
  73440. /**
  73441. * @function L.supermap.mapVLayer.prototype.draw
  73442. * @description 绘制图层。
  73443. */
  73444. draw: function () {
  73445. return this._reset();
  73446. },
  73447. /**
  73448. * @function L.supermap.mapVLayer.prototype.setZIndex
  73449. * @description 设置 canvas 层级。
  73450. * @param {number} zIndex - canvas 层级。
  73451. */
  73452. setZIndex: function (zIndex) {
  73453. this.canvas.style.zIndex = zIndex;
  73454. },
  73455. /**
  73456. * @function L.supermap.mapVLayer.prototype.render
  73457. * @description 渲染。
  73458. */
  73459. render: function () {
  73460. this.renderer._canvasUpdate();
  73461. },
  73462. /**
  73463. * @function L.supermap.mapVLayer.prototype.getCanvas
  73464. * @description 获取 canvas。
  73465. * @returns {HTMLElement} 返回 mapV 图层包含的 canvas 对象。
  73466. */
  73467. getCanvas: function () {
  73468. return this.canvas;
  73469. },
  73470. /**
  73471. * @function L.supermap.mapVLayer.prototype.getContainer
  73472. * @description 获取容器。
  73473. * @returns {HTMLElement} 返回包含 mapV 图层的 dom 对象。
  73474. */
  73475. getContainer: function () {
  73476. return this.container;
  73477. },
  73478. /**
  73479. * @function L.supermap.mapVLayer.prototype.getTopLeft
  73480. * @description 获取左上角坐标。
  73481. * @returns {L.Bounds} 返回左上角坐标。
  73482. */
  73483. getTopLeft: function () {
  73484. var map = this._map;
  73485. var topLeft;
  73486. if (map) {
  73487. var bounds = map.getBounds();
  73488. topLeft = bounds.getNorthWest();
  73489. }
  73490. return topLeft;
  73491. },
  73492. _createCanvas: function () {
  73493. var canvas = document.createElement('canvas');
  73494. canvas.style.position = 'absolute';
  73495. canvas.style.top = 0 + "px";
  73496. canvas.style.left = 0 + "px";
  73497. canvas.style.pointerEvents = "none";
  73498. canvas.style.zIndex = this.options.zIndex || 600;
  73499. var global$2 = typeof window === 'undefined' ? {} : window;
  73500. var devicePixelRatio = this.devicePixelRatio = global$2.devicePixelRatio || 1;
  73501. if (!this.mapVOptions.context || this.mapVOptions.context === '2d') {
  73502. canvas.getContext('2d').scale(devicePixelRatio, devicePixelRatio);
  73503. }
  73504. return canvas;
  73505. },
  73506. _resize: function () {
  73507. var canvas = this.canvas;
  73508. if (!canvas) {
  73509. return;
  73510. }
  73511. var map = this._map;
  73512. var size = map.getSize();
  73513. canvas.width = size.x;
  73514. canvas.height = size.y;
  73515. canvas.style.width = size.x + 'px';
  73516. canvas.style.height = size.y + 'px';
  73517. var bounds = map.getBounds();
  73518. var topLeft = map.latLngToLayerPoint(bounds.getNorthWest());
  73519. external_L_default().DomUtil.setPosition(canvas, topLeft);
  73520. },
  73521. _reset: function () {
  73522. this._resize();
  73523. this._render()
  73524. },
  73525. redraw: function () {
  73526. this._resize();
  73527. this._render()
  73528. },
  73529. _render: function () {
  73530. this.render();
  73531. }
  73532. });
  73533. var mapVLayer = function (dataSet, mapVOptions, options) {
  73534. return new MapVLayer(dataSet, mapVOptions, options);
  73535. };
  73536. (external_L_default()).supermap.mapVLayer = mapVLayer;
  73537. ;// CONCATENATED MODULE: ./src/leaflet/overlay/dataflow/MapvRenderer.js
  73538. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  73539. * This program are made available under the terms of the Apache License, Version 2.0
  73540. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73541. /**
  73542. *
  73543. * @class MapvRenderer
  73544. * @classdesc 数据流图层 MapV 渲染器。
  73545. * @category iServer DataFlow
  73546. * @extends {L.supermap.MapVLayer}
  73547. * @param {string} url - 数据流图层服务地址
  73548. * @param {Object} options - 设置图层参数。
  73549. * @param {Object} [options.geometry] - GeoJSON 几何对象。
  73550. * @param {Object} [options.prjCoordSys] - 投影坐标对象。
  73551. * @param {string} [options.excludeField] - 排除字段。
  73552. * @param {string} [options.idField='id'] - 要素属性中表示唯一标识的字段。
  73553. */
  73554. var MapvRenderer = MapVLayer.extend({
  73555. initialize: function (url, options) {
  73556. options = options || {};
  73557. external_L_default().Util.setOptions(this, options);
  73558. this.data = [];
  73559. this.mapVOptions = {
  73560. draw: 'simple'
  73561. };
  73562. MapVLayer.prototype.initialize.call(this, new window.mapv.DataSet([]), this.mapVOptions, options)
  73563. this.idCache = {};
  73564. this.url = url;
  73565. this._last = new Date();
  73566. this._imageCache = {};
  73567. },
  73568. onMessageSuccessed: function (msg) {
  73569. const geoID = msg.featureResult.properties['id'];
  73570. const geometry = msg.featureResult.geometry;
  73571. //设置每个点的经纬度和图片的样式
  73572. const item = {
  73573. geometry: msg.featureResult.geometry
  73574. }
  73575. if (geometry.type === 'Point' && this.options.pointToLayer) {
  73576. //const pointStyle = this.options.pointToLayer ? this.options.pointToLayer(msg.featureResult, L.latLng(geometry.coordinates[1],geometry.coordinates[0])) : new L.marker(L.latLng(geometry.coordinates[1],geometry.coordinates[0]));
  73577. const pointStyle = this.options.pointToLayer(msg.featureResult, external_L_default().latLng(geometry.coordinates[1], geometry.coordinates[0]));
  73578. if (pointStyle instanceof (external_L_default()).Marker) {
  73579. this.mapVOptions.draw = 'icon';
  73580. let icon = pointStyle.options.icon;
  73581. const imgUrl = icon._getIconUrl('icon');
  73582. const imgWidth = icon.options.iconSize ? icon.options.iconSize[0] : null;
  73583. const imgHeight = icon.options.iconSize ? icon.options.iconSize[1] : null;
  73584. const iconKey = `${imgUrl}_${imgWidth}_${imgHeight}`;
  73585. let img = this._imageCache[iconKey];
  73586. if (!img) {
  73587. img = icon.createIcon();
  73588. this._imageCache[iconKey] = img;
  73589. img.onload = () => {
  73590. this.update({
  73591. data: this.data,
  73592. options: this.mapVOptions
  73593. });
  73594. }
  73595. }
  73596. item.icon = img;
  73597. if (icon.options.iconSize || img.style.height) {
  73598. this.mapVOptions.offset = {
  73599. x: 0,
  73600. y: -(icon.options.iconSize[1] || img.style.height) / 2
  73601. };
  73602. }
  73603. if (this.options.deg) {
  73604. item.deg = this.options.deg
  73605. if (typeof item.deg === 'function') {
  73606. if(this.idCache[geoID]&&this.data[this.idCache[geoID]]){
  73607. item.deg = item.deg(msg.featureResult, external_L_default().latLng(geometry.coordinates[1], geometry.coordinates[0]),this.data[this.idCache[geoID]]);
  73608. }
  73609. }
  73610. }
  73611. }
  73612. if (pointStyle instanceof (external_L_default()).CircleMarker) {
  73613. this.mapVOptions.draw = 'simple';
  73614. const sty = this._toMapvStyle(pointStyle);
  73615. for (const key in sty) {
  73616. if (sty.hasOwnProperty(key)) {
  73617. item[key] = sty[key];
  73618. }
  73619. }
  73620. }
  73621. } else if (this.options.style) {
  73622. const sty = this._toMapvStyle(this.options.style(msg.featureResult));
  73623. for (const key in sty) {
  73624. if (sty.hasOwnProperty(key)) {
  73625. item[key] = sty[key];
  73626. }
  73627. }
  73628. }
  73629. if (this.idCache[geoID] == undefined) {
  73630. this.data.push(item);
  73631. this.idCache[geoID] = this.data.length - 1;
  73632. } else {
  73633. this.data[this.idCache[geoID]] = item;
  73634. }
  73635. //绘制图层
  73636. if (new Date() - this._last > 200) {
  73637. this._last = new Date();
  73638. this.update({
  73639. data: this.data,
  73640. options: this.mapVOptions
  73641. });
  73642. }
  73643. },
  73644. _toMapvStyle: function (options) {
  73645. const mapvOps = {
  73646. draw: 'simple'
  73647. };
  73648. mapvOps.strokeStyle = options.color;
  73649. mapvOps.lineWidth = options.width;
  73650. mapvOps.globalAlpha = options.fillOpacity || options.opacity;
  73651. mapvOps.lineCap = options.lineCap;
  73652. mapvOps.lineJoin = options.lineJoin;
  73653. mapvOps.fillStyle = options.fillColor;
  73654. mapvOps.size = options.radius;
  73655. return mapvOps;
  73656. }
  73657. });
  73658. ;// CONCATENATED MODULE: ./src/leaflet/overlay/dataflow/NormalRenderer.js
  73659. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  73660. * This program are made available under the terms of the Apache License, Version 2.0
  73661. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73662. /**
  73663. * @class NormalRenderer
  73664. * @classdesc 数据流图层普通渲染器。
  73665. * @category iServer DataFlow
  73666. * @extends {L.GeoJSON}
  73667. * @param {string} url - 数据流图层服务地址
  73668. * @param {Object} options - 设置图层参数。
  73669. * @param {GeoJSONObject} [options.geometry] - GeoJSON 几何对象。
  73670. * @param {Object} [options.prjCoordSys] - 投影坐标对象。
  73671. * @param {string} [options.excludeField] - 排除字段。
  73672. * @param {string} [options.idField='id'] - 要素属性中表示唯一标识的字段。
  73673. */
  73674. var NormalRenderer = external_L_default().GeoJSON.extend({
  73675. initialize: function (url, options) {
  73676. options = options || {};
  73677. if (options.style && !options.pointToLayer) {
  73678. options.pointToLayer = function (geojson, latlng) {
  73679. return external_L_default().circleMarker(latlng, options.style());
  73680. }
  73681. }
  73682. external_L_default().Util.setOptions(this, options);
  73683. this._layers = {};
  73684. external_L_default().stamp(this);
  73685. this.url = url;
  73686. this.idCache = {};
  73687. },
  73688. onMessageSuccessed: function (msg) {
  73689. const geojson = msg.featureResult;
  73690. const geoID = msg.featureResult.properties[this.options.idField];
  73691. let layer = null;
  73692. if (geoID !== undefined && this.idCache[geoID]) {
  73693. layer = this.getLayer(this.idCache[geoID]);
  73694. this._updateLayerData(layer, geojson);
  73695. } else {
  73696. layer = external_L_default().GeoJSON.geometryToLayer(geojson, this.options);
  73697. layer.feature = external_L_default().GeoJSON.asFeature(geojson);
  73698. this.addLayer(layer);
  73699. if (geoID !== undefined) {
  73700. this.idCache[geoID] = this.getLayerId(layer);
  73701. }
  73702. }
  73703. if (this.options.onEachFeature) {
  73704. this.options.onEachFeature(geojson, layer);
  73705. }
  73706. },
  73707. _updateLayerData: function (layer, geojson) {
  73708. if (geojson.properties) {
  73709. layer.feature.properties = geojson.properties;
  73710. }
  73711. var latlngs = [];
  73712. switch (geojson.geometry.type) {
  73713. case 'Point':
  73714. latlngs = external_L_default().GeoJSON.coordsToLatLng(geojson.geometry.coordinates);
  73715. layer.setLatLng(latlngs);
  73716. break;
  73717. case 'LineString':
  73718. latlngs = external_L_default().GeoJSON.coordsToLatLngs(geojson.geometry.coordinates, 0);
  73719. layer.setLatLngs(latlngs);
  73720. break;
  73721. case 'MultiLineString':
  73722. case 'Polygon':
  73723. latlngs = external_L_default().GeoJSON.coordsToLatLngs(geojson.geometry.coordinates, 1);
  73724. layer.setLatLngs(latlngs);
  73725. break;
  73726. case 'MultiPolygon':
  73727. latlngs = external_L_default().GeoJSON.coordsToLatLngs(geojson.geometry.coordinates, 2);
  73728. layer.setLatLngs(latlngs);
  73729. break;
  73730. }
  73731. }
  73732. });
  73733. ;// CONCATENATED MODULE: ./src/leaflet/overlay/DataFlowLayer.js
  73734. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  73735. * This program are made available under the terms of the Apache License, Version 2.0
  73736. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73737. /**
  73738. * @class L.supermap.dataFlowLayer
  73739. * @classdesc 数据流图层源。订阅SuperMap iServer 数据流服务并上图。订阅得到的数据会根据 `options.idField` 自动更新。
  73740. * @category iServer DataFlow
  73741. * @extends {L.LayerGroup}
  73742. * @param {string} url - SuperMap iServer 数据流服务地址,例如:http://localhost:8090/iserver/services/dataflowTest/dataflow。
  73743. * @param {Object} options - 设置图层参数。
  73744. * @param {Object} [options.render='normal'] - 绘制方式。可选值为'normal','mapv'。
  73745. 'normal' 表示以 {( {@link L.LatLng}|{@link L.Polyline}|{@link L.Polygon}|{@link L.Marker} )} 方式绘制数据流。'mapv' 表示以 {@link L.supermap.mapVLayer} 方式绘制实时数据。
  73746. * @param {GeoJSONObject} [options.geometry] - 指定几何范围,该范围内的要素才能被订阅。
  73747. * @param {Object} [options.prjCoordSys] - 投影坐标对象。
  73748. * @param {string} [options.excludeField] - 排除字段。
  73749. * @param {string} [options.idField='id'] - 要素属性中表示唯一标识的字段。
  73750. * @param {Function} [options.pointToLayer] - 定义点要素如何绘制在地图上。
  73751. `function(geoJsonPoint, latlng) {
  73752. return L.marker(latlng);
  73753. }`
  73754. * @param {Function} [options.style] - 定义点、线、面要素样式。参数为{@link L.Path-option}。</br>
  73755. `function (feature) {
  73756. return {
  73757. fillColor: "red",
  73758. fillOpacity: 1,
  73759. radius: 6,
  73760. weight: 0
  73761. };
  73762. }`
  73763. * @param {function|number} [options.deg] - 定义图标的旋转角度。`options.render` 为 `mapv` 时有效。</br>
  73764. `function (feature,latlng) {
  73765. return feature.properties['rotate'];
  73766. }`
  73767. * @fires L.supermap.dataFlowLayer#subscribesucceeded
  73768. * @fires L.supermap.dataFlowLayer#subscribefailed
  73769. * @fires L.supermap.dataFlowLayer#setfilterparamsucceeded
  73770. * @fires L.supermap.dataFlowLayer#dataupdated
  73771. */
  73772. var DataFlowLayer = external_L_default().LayerGroup.extend({
  73773. options: {
  73774. geometry: null,
  73775. prjCoordSys: null,
  73776. excludeField: null,
  73777. idField: "id",
  73778. render: 'normal'
  73779. },
  73780. initialize: function (url, options) {
  73781. options = options || {};
  73782. external_L_default().Util.setOptions(this, options);
  73783. this.url = url;
  73784. this._layers = {};
  73785. this.dataService = new DataFlowService_DataFlowService(this.url, {
  73786. geometry: this.options.geometry,
  73787. prjCoordSys: this.options.prjCoordSys,
  73788. excludeField: this.options.excludeField
  73789. })
  73790. },
  73791. /**
  73792. * @private
  73793. * @function L.supermap.dataFlowLayer.prototype.onAdd
  73794. * @description 添加地图。
  73795. * @param {L.Map} map - 待添加的地图。
  73796. */
  73797. onAdd: function (map) { // eslint-disable-line no-unused-vars
  73798. this.dataService.initSubscribe();
  73799. /**
  73800. * @event L.supermap.dataFlowLayer#subscribesucceeded
  73801. * @description 初始化成功后触发。
  73802. * @property {Object} e - 事件对象。
  73803. */
  73804. this.dataService.on('subscribeSocketConnected', (e) => this.fire("subscribesucceeded", e));
  73805. /**
  73806. * @event L.supermap.dataFlowLayer#subscribefailed
  73807. * @description 初始化失败后触发。
  73808. * @property {Object} e - 事件对象。
  73809. */
  73810. this.dataService.on('subscribeSocketError', (e) => this.fire("subscribefailed", e))
  73811. this.dataService.on('messageSucceeded', (msg) => this._onMessageSuccessed(msg));
  73812. /**
  73813. * @event L.supermap.dataFlowLayer#setfilterparamsucceeded
  73814. * @description 过滤参数设置成功后触发。
  73815. * @property {Object} e - 事件对象。
  73816. */
  73817. this.dataService.on('setFilterParamSucceeded', (msg) => this.fire("setfilterparamsucceeded", msg));
  73818. if (this.options.render === 'mapv') {
  73819. this.addLayer(new MapvRenderer(this.url, this.options));
  73820. } else {
  73821. this.addLayer(new NormalRenderer(this.url, this.options));
  73822. }
  73823. external_L_default().LayerGroup.prototype.onAdd.call(this, map);
  73824. },
  73825. /**
  73826. * @private
  73827. * @function L.supermap.dataFlowLayer.prototype.onRemove
  73828. * @description 删除指定地图。
  73829. * @param {L.Map} map - 待删除的地图。
  73830. */
  73831. onRemove: function (map) { // eslint-disable-line no-unused-vars
  73832. external_L_default().LayerGroup.prototype.onRemove.call(this, map);
  73833. this.dataService && this.dataService.unSubscribe();
  73834. },
  73835. /**
  73836. * @function L.supermap.dataFlowLayer.prototype.setExcludeField
  73837. * @description 设置唯一字段。
  73838. * @param {string} excludeField - 唯一字段。
  73839. */
  73840. setExcludeField: function (excludeField) {
  73841. this.dataService.setExcludeField(excludeField);
  73842. this.options.excludeField = excludeField;
  73843. return this;
  73844. },
  73845. /**
  73846. * @function L.supermap.dataFlowLayer.prototype.setGeometry
  73847. * @description 设置集合要素。
  73848. * @param {GeoJSONObject} geometry - 待设置的 GeoJSON 几何要素对象。
  73849. */
  73850. setGeometry: function (geometry) {
  73851. this.dataService.setGeometry(geometry);
  73852. this.options.geometry = geometry;
  73853. return this;
  73854. },
  73855. _onMessageSuccessed: function (msg) {
  73856. this.getLayers().map((layer) => {
  73857. if (layer.onMessageSuccessed) {
  73858. layer.onMessageSuccessed(msg);
  73859. /**
  73860. * @description 图层数据更新成功后触发。
  73861. * @event L.supermap.dataFlowLayer#dataupdated
  73862. * @property {Object} layer - 更新数据成功的图层。
  73863. * @property {Object} data - 更新的要素。
  73864. */
  73865. this.fire("dataupdated", {
  73866. layer: layer,
  73867. data: msg.featureResult
  73868. });
  73869. }
  73870. return layer;
  73871. })
  73872. }
  73873. });
  73874. var dataFlowLayer = function (url, options) {
  73875. return new DataFlowLayer(url, options);
  73876. };
  73877. (external_L_default()).supermap.dataFlowLayer = dataFlowLayer;
  73878. ;// CONCATENATED MODULE: ./src/leaflet/overlay/EChartsLayer.js
  73879. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  73880. * This program are made available under the terms of the Apache License, Version 2.0
  73881. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73882. /**
  73883. * @class L.supermap.echartsLayer
  73884. * @classdesc 百度 ECharts 图层类。
  73885. * @category Visualization ECharts
  73886. * @extends {L.Layer}
  73887. * @param {Object} echartsOptions - 图表参数。
  73888. * @param {Object} options - 可选图层参数。
  73889. * @param {boolean} [options.loadWhileAnimating=false] - 是否在移动时实时绘制。
  73890. * @param {string} [options.attribution='© 2018 百度 ECharts'] - 版权信息。
  73891. */
  73892. const EchartsLayer = external_L_default().Layer.extend({
  73893. includes: [],
  73894. _echartsContainer: null,
  73895. _map: null,
  73896. _ec: null,
  73897. _echartsOptions: null,
  73898. options: {
  73899. attribution: core_Attributions.ECharts.attribution,
  73900. loadWhileAnimating: false
  73901. },
  73902. initialize: function (echartsOptions, options) {
  73903. external_L_default().Util.setOptions(this, options);
  73904. this.setOption(echartsOptions);
  73905. },
  73906. /**
  73907. * @function L.supermap.echartsLayer.prototype.setOption
  73908. * @description 设置图表地图参数。
  73909. * @param {Object} echartsOptions - 图表参数。
  73910. * @param {string} lazyUpdate - 后台自动更新。
  73911. * @param {boolean} [notMerge] - 是否合并参数。
  73912. */
  73913. setOption: function (echartsOptions, notMerge, lazyUpdate) {
  73914. const baseOption = echartsOptions.baseOption || echartsOptions;
  73915. baseOption.LeafletMap = baseOption.LeafletMap || {
  73916. roam: true
  73917. };
  73918. baseOption.animation = baseOption.animation === true;
  73919. this._echartsOptions = echartsOptions;
  73920. this._ec && this._ec.setOption(echartsOptions, notMerge, lazyUpdate);
  73921. },
  73922. getEcharts: function () {
  73923. return this._ec;
  73924. },
  73925. _disableEchartsContainer: function () {
  73926. this._echartsContainer.style.visibility = "hidden";
  73927. },
  73928. _enableEchartsContainer: function () {
  73929. this._echartsContainer.style.visibility = "visible";
  73930. },
  73931. /**
  73932. * @private
  73933. * @function L.supermap.echartsLayer.prototype.onAdd
  73934. * @description 添加地图。
  73935. * @param {L.Map} map - 待添加的地图。
  73936. */
  73937. onAdd: function (map) {
  73938. this._map = map;
  73939. this._initEchartsContainer();
  73940. this._ec = external_function_try_return_echarts_catch_e_return_default().init(this._echartsContainer);
  73941. this._ec.leafletMap= map;
  73942. const me = this;
  73943. map.on("zoomstart", function () {
  73944. me._disableEchartsContainer();
  73945. });
  73946. !me.options.loadWhileAnimating && map.on("movestart", function () {
  73947. me._disableEchartsContainer();
  73948. });
  73949. external_function_try_return_echarts_catch_e_return_default().registerAction({
  73950. type: 'LeafletMapLayout',
  73951. event: 'LeafletMapLayout',
  73952. update: 'updateLayout'
  73953. }, function (payload ) { // eslint-disable-line no-unused-vars
  73954. });
  73955. external_function_try_return_echarts_catch_e_return_default().registerCoordinateSystem(
  73956. 'leaflet', LeafletMapCoordSys
  73957. );
  73958. external_function_try_return_echarts_catch_e_return_default().extendComponentModel({
  73959. type: 'LeafletMap',
  73960. getBMap: function () {
  73961. return this.__LeafletMap;
  73962. },
  73963. defaultOption: {
  73964. roam: false
  73965. }
  73966. });
  73967. external_function_try_return_echarts_catch_e_return_default().extendComponentView({
  73968. type: 'LeafletMap',
  73969. render: function (LeafletMapModel, ecModel, api) {
  73970. let rendering = true;
  73971. let leafletMap = ecModel.scheduler.ecInstance.leafletMap;
  73972. const viewportRoot = api.getZr().painter.getViewportRoot();
  73973. const animated = leafletMap.options.zoomAnimation && (external_L_default()).Browser.any3d;
  73974. viewportRoot.className = ' leaflet-layer leaflet-zoom-' + (animated ? 'animated' : 'hide') + ' echarts-layer';
  73975. const originProp = external_L_default().DomUtil.testProp(['transformOrigin', 'WebkitTransformOrigin', 'msTransformOrigin']);
  73976. viewportRoot.style[originProp] = '50% 50%';
  73977. const coordSys = LeafletMapModel.coordinateSystem;
  73978. const ecLayers = api.getZr().painter.getLayers();
  73979. const moveHandler = function () {
  73980. if (rendering) {
  73981. return;
  73982. }
  73983. const offset = me._map.containerPointToLayerPoint([0, 0]);
  73984. const mapOffset = [offset.x || 0, offset.y || 0];
  73985. viewportRoot.style.left = mapOffset[0] + 'px';
  73986. viewportRoot.style.top = mapOffset[1] + 'px';
  73987. if (!me.options.loadWhileAnimating) {
  73988. for (let item in ecLayers) {
  73989. if (!ecLayers.hasOwnProperty(item)) {
  73990. continue;
  73991. }
  73992. ecLayers[item] && clearContext(ecLayers[item].ctx);
  73993. }
  73994. me._enableEchartsContainer();
  73995. }
  73996. coordSys.setMapOffset(mapOffset);
  73997. LeafletMapModel.__mapOffset = mapOffset;
  73998. api.dispatchAction({
  73999. type: 'LeafletMapLayout'
  74000. });
  74001. };
  74002. function clearContext(context) {
  74003. context && context.clearRect && context.clearRect(0, 0, context.canvas.width, context.canvas.height);
  74004. }
  74005. function zoomEndHandler() {
  74006. if (rendering) {
  74007. return;
  74008. }
  74009. api.dispatchAction({
  74010. type: 'LeafletMapLayout'
  74011. });
  74012. me._enableEchartsContainer();
  74013. }
  74014. if (me._oldMoveHandler) {
  74015. leafletMap.off(me.options.loadWhileAnimating ? 'move' : 'moveend', me._oldMoveHandler);
  74016. }
  74017. if (me._oldZoomEndHandler) {
  74018. leafletMap.off('zoomend', me._oldZoomEndHandler);
  74019. }
  74020. leafletMap.on(me.options.loadWhileAnimating ? 'move' : 'moveend', moveHandler);
  74021. leafletMap.on('zoomend', zoomEndHandler);
  74022. me._oldMoveHandler = moveHandler;
  74023. me._oldZoomEndHandler = zoomEndHandler;
  74024. rendering = false;
  74025. }
  74026. });
  74027. this._ec.setOption(this._echartsOptions);
  74028. },
  74029. onRemove: function () {
  74030. // 销毁echarts实例
  74031. this._ec.clear();
  74032. this._ec.dispose();
  74033. delete this._ec;
  74034. external_L_default().DomUtil.remove(this._echartsContainer);
  74035. if (this._oldZoomEndHandler) {
  74036. this._map.off("zoomend", this._oldZoomEndHandler);
  74037. this._oldZoomEndHandler = null;
  74038. }
  74039. if (this._oldMoveHandler) {
  74040. this._map.off(this.options.loadWhileAnimating ? 'move' : 'moveend', this._oldMoveHandler);
  74041. this._oldMoveHandler = null;
  74042. }
  74043. if (this._resizeHandler) {
  74044. this._map.off('resize', this._resizeHandler);
  74045. this._resizeHandler = null;
  74046. }
  74047. delete this._map;
  74048. },
  74049. _initEchartsContainer: function () {
  74050. const size = this._map.getSize();
  74051. const _div = document.createElement('div');
  74052. _div.style.position = 'absolute';
  74053. _div.style.height = size.y + 'px';
  74054. _div.style.width = size.x + 'px';
  74055. _div.style.zIndex = 10;
  74056. this._echartsContainer = _div;
  74057. this.getPane().appendChild(this._echartsContainer);
  74058. const me = this;
  74059. function _resizeHandler(e) {
  74060. let size = e.newSize;
  74061. me._echartsContainer.style.width = size.x + 'px';
  74062. me._echartsContainer.style.height = size.y + 'px';
  74063. me._ec.resize()
  74064. }
  74065. this._map.on('resize', _resizeHandler);
  74066. this._resizeHandler = _resizeHandler
  74067. }
  74068. });
  74069. /**
  74070. * @class L.supermap.LeafletMapCoordSys
  74071. * @private
  74072. * @classdesc 地图坐标系统类。
  74073. * @param {L.Map} leafletMap - 地图。
  74074. */
  74075. function LeafletMapCoordSys(leafletMap) {
  74076. this._LeafletMap = leafletMap;
  74077. this.dimensions = ['lng', 'lat'];
  74078. this._mapOffset = [0, 0];
  74079. }
  74080. LeafletMapCoordSys.prototype.dimensions = ['lng', 'lat'];
  74081. LeafletMapCoordSys.prototype.setMapOffset = function (mapOffset) {
  74082. this._mapOffset = mapOffset
  74083. };
  74084. LeafletMapCoordSys.prototype.getBMap = function () {
  74085. return this._LeafletMap
  74086. };
  74087. LeafletMapCoordSys.prototype.prepareCustoms = function () {
  74088. const zrUtil = (external_function_try_return_echarts_catch_e_return_default()).util;
  74089. const rect = this.getViewRect();
  74090. return {
  74091. coordSys: {
  74092. // The name exposed to user is always 'cartesian2d' but not 'grid'.
  74093. type: 'leaflet',
  74094. x: rect.x,
  74095. y: rect.y,
  74096. width: rect.width,
  74097. height: rect.height
  74098. },
  74099. api: {
  74100. coord: zrUtil.bind(this.dataToPoint, this),
  74101. size: zrUtil.bind(dataToCoordSize, this)
  74102. }
  74103. };
  74104. function dataToCoordSize(dataSize, dataItem) {
  74105. dataItem = dataItem || [0, 0];
  74106. return zrUtil.map([0, 1], function (dimIdx) {
  74107. const val = dataItem[dimIdx];
  74108. const halfSize = dataSize[dimIdx] / 2;
  74109. const p1 = [];
  74110. const p2 = [];
  74111. p1[dimIdx] = val - halfSize;
  74112. p2[dimIdx] = val + halfSize;
  74113. p1[1 - dimIdx] = p2[1 - dimIdx] = dataItem[1 - dimIdx];
  74114. return Math.abs(this.dataToPoint(p1)[dimIdx] - this.dataToPoint(p2)[dimIdx]);
  74115. }, this);
  74116. }
  74117. };
  74118. LeafletMapCoordSys.prototype.dataToPoint = function (data) {
  74119. //处理数据中的null值
  74120. if (data[1] === null) {
  74121. data[1] = (external_L_default()).CRS.EPSG3857.projection.MAX_LATITUDE;
  74122. }
  74123. //平面坐标系不能这么处理
  74124. //data[1] = this.fixLat(data[1]);
  74125. const px = this._LeafletMap.latLngToLayerPoint([data[1], data[0]]);
  74126. const mapOffset = this._mapOffset;
  74127. return [px.x - mapOffset[0], px.y - mapOffset[1]];
  74128. };
  74129. LeafletMapCoordSys.prototype.fixLat = function (lat) {
  74130. if (lat >= 90) {
  74131. return 89.99999999999999;
  74132. }
  74133. if (lat <= -90) {
  74134. return -89.99999999999999;
  74135. }
  74136. return lat;
  74137. };
  74138. LeafletMapCoordSys.prototype.pointToData = function (pt) {
  74139. let mapOffset = this._mapOffset;
  74140. let point = this._LeafletMap.layerPointToLatLng([pt[0] + mapOffset[0], pt[1] + mapOffset[1]]);
  74141. return [point.lng, point.lat];
  74142. };
  74143. LeafletMapCoordSys.prototype.getViewRect = function () {
  74144. const size = this._LeafletMap.getSize();
  74145. return new (external_function_try_return_echarts_catch_e_return_default()).graphic.BoundingRect(0, 0, size.x, size.y);
  74146. };
  74147. LeafletMapCoordSys.prototype.getRoamTransform = function () {
  74148. return external_function_try_return_echarts_catch_e_return_default().matrix.create();
  74149. };
  74150. LeafletMapCoordSys.dimensions = LeafletMapCoordSys.prototype.dimensions;
  74151. LeafletMapCoordSys.create = function (ecModel) {
  74152. let coordSys;
  74153. let leafletMap = ecModel.scheduler.ecInstance.leafletMap;
  74154. ecModel.eachComponent('LeafletMap', function (leafletMapModel) {
  74155. if (!coordSys) {
  74156. coordSys = new LeafletMapCoordSys(leafletMap);
  74157. }
  74158. leafletMapModel.coordinateSystem = coordSys;
  74159. leafletMapModel.coordinateSystem.setMapOffset(leafletMapModel.__mapOffset || [0, 0]);
  74160. });
  74161. ecModel.eachSeries(function (seriesModel) {
  74162. if (!seriesModel.get('coordinateSystem') || seriesModel.get('coordinateSystem') === 'leaflet') {
  74163. if (!coordSys) {
  74164. coordSys = new LeafletMapCoordSys(leafletMap);
  74165. }
  74166. seriesModel.coordinateSystem = coordSys;
  74167. seriesModel.animation = seriesModel.animation === true;
  74168. }
  74169. })
  74170. };
  74171. const echartsLayer = function (echartsOptions, options) {
  74172. return new EchartsLayer(echartsOptions, options);
  74173. };
  74174. (external_L_default()).supermap.echartsLayer = echartsLayer;
  74175. ;// CONCATENATED MODULE: ./src/leaflet/core/Detector.js
  74176. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  74177. * This program are made available under the terms of the Apache License, Version 2.0
  74178. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74179. class Detector {
  74180. static supportWebGL() {
  74181. return getContext('webgl');
  74182. }
  74183. static supportWebGL2() {
  74184. return getContext('webgl2');
  74185. }
  74186. static supportCanvas() {
  74187. return getContext('2d');
  74188. }
  74189. }
  74190. function getContext(context) {
  74191. var canvas = document.createElement('canvas');
  74192. return canvas && canvas.getContext(context);
  74193. }
  74194. ;// CONCATENATED MODULE: ./src/leaflet/overlay/graphic/CloverStyle.js
  74195. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  74196. * This program are made available under the terms of the Apache License, Version 2.0
  74197. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74198. /**
  74199. * @class L.supermap.cloverStyle
  74200. * @classdesc 三叶草要素风格。
  74201. * @category Visualization Graphic
  74202. * @extends {L.Class}
  74203. * @param {Object} options - 三叶草形要素风格参数。
  74204. * @param {number} [options.angle=60] - 三叶草每个扇叶的圆心角,单位弧度。
  74205. * @param {number} [options.spaceAngle=0] - 扇叶间隔角度,通过计算获取。
  74206. * @param {number} [options.count=3] - 扇叶数量。
  74207. * @param {boolean} [options.stroke=true] - 是否描边。
  74208. * @param {number} [options.strokeWidth=1] - 边框宽度。
  74209. * @param {string} [options.color='#3388ff'] - 颜色。
  74210. * @param {number} [options.weight=1] - 线宽。
  74211. * @param {number} [options.opacity=1] - 透明度。
  74212. * @param {string} [options.lineCap='round'] - 线帽形状。
  74213. * @param {string} [options.lineJoin='round'] - 线条交汇边角形状。
  74214. * @param {boolean} [options.fill=false] - 是否填充。
  74215. * @param {string} [options.fillColor='#66ccff'] - 填充色。
  74216. * @param {number} [options.fillOpacity=0.2] - 填充透明度。
  74217. * @param {string} [options.fillRule='evenodd'] - 填充形状。
  74218. * @param {number} [options.radius=10] - 半径。
  74219. */
  74220. var CloverStyle = external_L_default().Class.extend({
  74221. options: {
  74222. radius: 10,
  74223. angele: 60,
  74224. spaceAngle: 0,
  74225. count: 3,
  74226. fill: false,
  74227. stroke: true,
  74228. color: '#3388ff',
  74229. weight: 1,
  74230. lineCap: 'round',
  74231. lineJoin: 'round',
  74232. fillColor: '#66ccff',
  74233. fillOpacity: 0.2,
  74234. fillRule: 'evenodd',
  74235. opacity: 1,
  74236. strokeWidth:1
  74237. },
  74238. initialize: function (options) {
  74239. options = options || {};
  74240. external_L_default().Util.setOptions(this, options);
  74241. this._canvas = document.createElement('canvas');
  74242. this._canvas.width = 2 * (this.options.radius + this.options.weight);
  74243. this._canvas.height = 2 * (this.options.radius + this.options.weight);
  74244. this._ctx = this._canvas.getContext('2d');
  74245. var strokeWidth = this.options.strokeWidth === undefined ? 1 : this.options.strokeWidth;
  74246. this.options.width = 2 * (this.options.radius + strokeWidth) + 1;
  74247. this._initStyle();
  74248. },
  74249. /**
  74250. * @function L.supermap.cloverStyle.prototype.getStyle
  74251. * @description 获取画布。
  74252. */
  74253. getStyle: function () {
  74254. return this._canvas;
  74255. },
  74256. /**
  74257. * @function L.supermap.cloverStyle.prototype.drawSector
  74258. * @description 绘制扇形。
  74259. * @param {CanvasRenderingContext2D} ctx - context 对象。
  74260. * @param {number} x - 中心点 x。
  74261. * @param {number} y - 中心点 y。
  74262. * @param {number} r - 中心点 r。
  74263. * @param {number} sAngle - 扇叶起始角度。
  74264. * @param {number} eAngle - 扇叶终止角度。
  74265. */
  74266. drawSector: function (ctx, x, y, r, sAngle, eAngle) {
  74267. //角度转换
  74268. sAngle = sAngle / 180 * Math.PI;
  74269. eAngle = eAngle / 180 * Math.PI;
  74270. ctx.moveTo(x, y);
  74271. ctx.lineTo(x + r * Math.cos(sAngle), y + r * Math.sin(sAngle));
  74272. ctx.arc(x, y, r, sAngle, eAngle);
  74273. ctx.lineTo(x, y);
  74274. },
  74275. _initStyle: function () {
  74276. //起始角度
  74277. var sAngle = 0;
  74278. var options = this.options;
  74279. var eAngle = options.angle;
  74280. options.spaceAngle = 360 / options.count - options.angle;
  74281. if (options.spaceAngle < 0) {
  74282. return;
  74283. }
  74284. this._ctx.beginPath();
  74285. this.anchor = [options.width / 2, options.width / 2];
  74286. for (var i = 0; i < options.count; i++) {
  74287. this.drawSector(this._ctx, this.anchor[0], this.anchor[1], options.radius, sAngle, eAngle);
  74288. sAngle = eAngle + options.spaceAngle;
  74289. eAngle = sAngle + options.angle;
  74290. }
  74291. this._fillStroke();
  74292. },
  74293. _fillStroke: function () {
  74294. var options = this.options;
  74295. if (options.fill) {
  74296. this._ctx.globalAlpha = options.fillOpacity;
  74297. this._ctx.fillStyle = options.fillColor || options.color;
  74298. this._ctx.fill(options.fillRule || 'evenodd');
  74299. }
  74300. if (options.stroke && options.weight !== 0) {
  74301. this._ctx.globalAlpha = options.opacity;
  74302. this._ctx.lineWidth = options.weight;
  74303. this._ctx.strokeStyle = options.color;
  74304. this._ctx.lineCap = options.lineCap;
  74305. this._ctx.lineJoin = options.lineJoin;
  74306. this._ctx.stroke();
  74307. }
  74308. }
  74309. });
  74310. var cloverStyle = function (options) {
  74311. return new CloverStyle(options);
  74312. };
  74313. (external_L_default()).supermap.cloverStyle = cloverStyle;
  74314. ;// CONCATENATED MODULE: ./src/leaflet/overlay/graphic/CircleStyle.js
  74315. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  74316. * This program are made available under the terms of the Apache License, Version 2.0
  74317. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74318. /**
  74319. * @class L.supermap.circleStyle
  74320. * @classdesc 圆形要素风格。
  74321. * @category Visualization Graphic
  74322. * @extends {L.Class}
  74323. * @param {Object} options - 圆形要素风格参数。
  74324. * @param {boolean} [options.stroke=true] - 是否描边。
  74325. * @param {string} [options.color='#3388ff'] - 颜色。
  74326. * @param {number} [options.weight=1] - 线宽。
  74327. * @param {number} [options.opacity=1] - 透明度。
  74328. * @param {string} [options.lineCap='round'] - 线帽形状。
  74329. * @param {string} [options.lineJoin='round'] - 线条交汇边角形状。
  74330. * @param {boolean} [options.fill=false] - 是否填充。
  74331. * @param {string} [options.fillColor] - 填充色。
  74332. * @param {number} [options.fillOpacity=0.2] - 填充透明度。
  74333. * @param {string} [options.fillRule='evenodd'] - 填充形状。
  74334. * @param {number} [options.radius=3] - 半径。
  74335. */
  74336. var CircleStyle = external_L_default().Class.extend({
  74337. options: {
  74338. stroke: true,
  74339. color: '#3388ff',
  74340. weight: 1,
  74341. opacity: 1,
  74342. lineCap: 'round',
  74343. lineJoin: 'round',
  74344. fill: false,
  74345. fillColor: null,
  74346. fillOpacity: 0.2,
  74347. fillRule: 'evenodd',
  74348. radius: 3
  74349. },
  74350. initialize: function (options) {
  74351. options = options || {};
  74352. external_L_default().Util.setOptions(this, options);
  74353. this._canvas = document.createElement('canvas');
  74354. this._canvas.width = 2 * (this.options.radius + this.options.weight);
  74355. this._canvas.height = 2 * (this.options.radius + this.options.weight);
  74356. this._ctx = this._canvas.getContext('2d');
  74357. this._initStyle();
  74358. },
  74359. /**
  74360. * @deprecated
  74361. * @function L.supermap.circleStyle.prototype.getCanvas
  74362. * @description 获取画布,已弃用该设置,请使用 getStyle 接口。
  74363. */
  74364. getCanvas: function () {
  74365. return this._canvas;
  74366. },
  74367. /**
  74368. * @function L.supermap.circleStyle.prototype.getStyle
  74369. * @description 获取画布。
  74370. */
  74371. getStyle: function () {
  74372. return this._canvas;
  74373. },
  74374. _initStyle: function () {
  74375. this._ctx.beginPath();
  74376. this._ctx.arc(this._canvas.width / 2, this._canvas.height / 2, this.options.radius, 0, Math.PI * 2);
  74377. this._fillStroke();
  74378. },
  74379. _fillStroke: function () {
  74380. var options = this.options;
  74381. if (options.fill) {
  74382. this._ctx.globalAlpha = options.fillOpacity;
  74383. this._ctx.fillStyle = options.fillColor || options.color;
  74384. this._ctx.fill(options.fillRule || 'evenodd');
  74385. }
  74386. if (options.stroke && options.weight !== 0) {
  74387. this._ctx.globalAlpha = options.opacity;
  74388. this._ctx.lineWidth = options.weight;
  74389. this._ctx.strokeStyle = options.color;
  74390. this._ctx.lineCap = options.lineCap;
  74391. this._ctx.lineJoin = options.lineJoin;
  74392. this._ctx.stroke();
  74393. }
  74394. }
  74395. });
  74396. var circleStyle = function (options) {
  74397. return new CircleStyle(options);
  74398. };
  74399. (external_L_default()).supermap.circleStyle = circleStyle;
  74400. ;// CONCATENATED MODULE: ./src/leaflet/overlay/graphic/ImageStyle.js
  74401. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  74402. * This program are made available under the terms of the Apache License, Version 2.0
  74403. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74404. /**
  74405. * @class L.supermap.imageStyle
  74406. * @classdesc 自定义图形要素风格。
  74407. * @category Visualization Graphic
  74408. * @extends {L.Class}
  74409. * @param {Object} options - 图形要素风格参数。
  74410. * @param {HTMLImageElement} options.img - image 对象。
  74411. * @param {Array} [options.origin=[0.0]] - 中心点。
  74412. * @param {Array} [options.anchor] - 偏移量。
  74413. * @param {Array} [options.size] - 图形大小,即高度和宽度[width,height]。
  74414. * @param {Array} [options.radius] - 半径。
  74415. * @param {Array} [options.weight] - 宽度。
  74416. */
  74417. var ImageStyle = external_L_default().Class.extend({
  74418. options: {
  74419. img: null,
  74420. origin: [0, 0],
  74421. anchor: null,
  74422. size: null
  74423. },
  74424. initialize: function (options) {
  74425. options = options || {};
  74426. external_L_default().Util.setOptions(this, options);
  74427. this._canvas = document.createElement('canvas');
  74428. this._canvas.width = 2 * (this.options.radius + this.options.weight);
  74429. this._canvas.height = 2 * (this.options.radius + this.options.weight);
  74430. this._ctx = this._canvas.getContext('2d');
  74431. },
  74432. /**
  74433. * @function L.supermap.imageStyle.prototype.getStyle
  74434. * @description 获取样式。
  74435. */
  74436. getStyle: function () {
  74437. return this.options;
  74438. }
  74439. });
  74440. var imageStyle = function (options) {
  74441. return new ImageStyle(options);
  74442. };
  74443. (external_L_default()).supermap.imageStyle = imageStyle;
  74444. ;// CONCATENATED MODULE: ./src/leaflet/overlay/graphic/CanvasRenderer.js
  74445. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  74446. * This program are made available under the terms of the Apache License, Version 2.0
  74447. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74448. const emptyFunc = (external_L_default()).Util.falseFn;
  74449. var GraphicCanvasRenderer = external_L_default().Class.extend({
  74450. initialize: function (layer, options) {
  74451. this.layer = layer;
  74452. options = options || {};
  74453. external_L_default().Util.setOptions(this, options);
  74454. },
  74455. /**
  74456. * @private
  74457. * @function GraphicCanvasRenderer.prototype.getRenderer
  74458. * @description 返回渲染器给图层,提供图层后续的数据增删改。
  74459. * @returns {L.Canvas}
  74460. */
  74461. getRenderer: function () {
  74462. return this.options.renderer;
  74463. },
  74464. /**
  74465. * @private
  74466. * @function GraphicCanvasRenderer.prototype.update
  74467. * @description 更新图层,数据或者样式改变后调用。
  74468. */
  74469. update: function () {
  74470. this.getRenderer()._clear();
  74471. this.getRenderer()._draw();
  74472. },
  74473. _getGraphicAtPoint: function (p) {
  74474. const layer = this.layer;
  74475. const map = layer._map;
  74476. let graphics = layer._getGraphicsInBounds();
  74477. for (let i = graphics.length - 1; i >= 0; i--) {
  74478. let p1, p2, bounds;
  74479. const center = map.latLngToLayerPoint(graphics[i].getLatLng());
  74480. let style = graphics[i].getStyle();
  74481. if (!style && this.defaultStyle) {
  74482. style = this.defaultStyle;
  74483. }
  74484. if (style.img) {
  74485. let imgWidth = style.img.width;
  74486. let imgHeight = style.img.height;
  74487. if (style.size && style.size[0] && style.size[1]) {
  74488. imgWidth = style.size[0];
  74489. imgHeight = style.size[1];
  74490. }
  74491. const anchor = style.anchor || [imgWidth / 2, imgHeight / 2];
  74492. p1 = external_L_default().point(center.x - anchor[0], center.y - anchor[1]);
  74493. p2 = external_L_default().point(p1.x + imgWidth, p1.y + imgHeight);
  74494. } else {
  74495. p1 = external_L_default().point(center.x - style.width / 2, center.y - style.height / 2);
  74496. p2 = external_L_default().point(center.x + style.width / 2, center.y + style.height / 2);
  74497. }
  74498. bounds = external_L_default().bounds(p1, p2);
  74499. if (bounds.contains(p)) {
  74500. return graphics[i];
  74501. }
  74502. }
  74503. return null;
  74504. },
  74505. containsPoint: function (p) {
  74506. return !!this._getGraphicAtPoint(p);
  74507. },
  74508. _handleClick: function (evt) {
  74509. evt.target = null;
  74510. const layer = this.layer;
  74511. const map = layer._map;
  74512. const graphic = this._getGraphicAtPoint(map.latLngToLayerPoint(evt.latlng));
  74513. if (graphic) {
  74514. this.layer._renderer._ctx.canvas.style.cursor = 'pointer';
  74515. evt.target = graphic;
  74516. if (evt.type === 'click' && layer.options.onClick) {
  74517. layer.options.onClick.call(layer, graphic, evt);
  74518. }
  74519. return;
  74520. }
  74521. this.layer._renderer._ctx.canvas.style.cursor = 'auto';
  74522. },
  74523. //跟GraphicWebGLRenderer保持一致
  74524. _clearBuffer: emptyFunc
  74525. });
  74526. external_L_default().Canvas.include({
  74527. drawGraphics: function (graphics, defaultStyle) {
  74528. var me = this;
  74529. if (!me._drawing) {
  74530. return;
  74531. }
  74532. //this._ctx.clearRect(0, 0, this._ctx.canvas.width, me._ctx.canvas.height);
  74533. graphics.forEach(function (graphic) {
  74534. var style = graphic.getStyle();
  74535. if (!style && defaultStyle) {
  74536. style = defaultStyle;
  74537. }
  74538. if (style.img) {
  74539. //绘制图片
  74540. me._drawImage.call(me, me._ctx, style, graphic.getLatLng());
  74541. } else {
  74542. //绘制canvas
  74543. me._drawCanvas.call(me, me._ctx, style, graphic.getLatLng());
  74544. }
  74545. });
  74546. },
  74547. _drawCanvas: function (ctx, style, latLng) {
  74548. var canvas = style;
  74549. var pt = this._map.latLngToLayerPoint(latLng);
  74550. var p0 = pt.x - canvas.width / 2;
  74551. var p1 = pt.y - canvas.height / 2;
  74552. var width = canvas.width;
  74553. var height = canvas.height;
  74554. ctx.drawImage(canvas, p0, p1, width, height);
  74555. },
  74556. _drawImage: function (ctx, style, latLng) {
  74557. //设置图片的大小
  74558. var width, height;
  74559. if (style.size) {
  74560. var size = style.size;
  74561. width = size[0];
  74562. height = size[1];
  74563. } else {
  74564. width = style.img.width;
  74565. height = style.img.height;
  74566. }
  74567. //设置偏移
  74568. var point = this._coordinateToPoint(latLng);
  74569. var pt = external_L_default().point(point),
  74570. ac = external_L_default().point(style.anchor || [width / 2, height / 2]);
  74571. point = [pt.x - ac.x, pt.y - ac.y];
  74572. //参数分别为:图片,图片裁剪下x,y位置,裁剪长宽,放置在画布的位置x,y, 占取画布长宽
  74573. //ctx.drawImage(style.img, 0, 0, width, height, point[0], point[1], width, height);
  74574. ctx.drawImage(style.img, point[0], point[1], width, height);
  74575. },
  74576. _coordinateToPoint: function (coordinate) {
  74577. if (!this._map) {
  74578. return coordinate;
  74579. }
  74580. var latLng = coordinate;
  74581. if (external_L_default().Util.isArray(coordinate)) {
  74582. latLng = external_L_default().latLng(coordinate[0], coordinate[1]);
  74583. } else if (coordinate instanceof (external_L_default()).LatLng) {
  74584. latLng = external_L_default().latLng(coordinate.lat, coordinate.lng);
  74585. }
  74586. var point = this._map.latLngToLayerPoint(latLng);
  74587. return [point.x, point.y];
  74588. }
  74589. });
  74590. ;// CONCATENATED MODULE: ./src/leaflet/overlay/graphic/WebGLRenderer.js
  74591. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  74592. * This program are made available under the terms of the Apache License, Version 2.0
  74593. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74594. const WebGLRenderer_emptyFunc = (external_L_default()).Util.falseFn;
  74595. /**
  74596. * @private
  74597. * @class GraphicWebGLRenderer
  74598. * @classdesc 高效率点图层 webgl 渲染器。
  74599. * @category Visualization Graphic
  74600. * @extends {L.Layer}
  74601. * @param {Array.<L.supermap.graphicLayer>} layer - 高效率点图层。
  74602. * @param {Object} options - 图层参数。
  74603. * @param {number} options.width - 地图宽度。
  74604. * @param {number} options.height - 地图高度。
  74605. * @param {HTMLElement} options.container - 放置渲染器的父元素。
  74606. * @param {Array.<number>} [options.color=[0, 0, 0, 255]] - 颜色,目前只支持 rgba 数组。
  74607. * @param {number} [options.radius=10] - 半径。
  74608. * @param {number} [options.opacity=0.8] - 不透明度。
  74609. * @param {Array} [options.highlightColor] - 高亮颜色,目前只支持 rgba 数组。
  74610. * @param {number} [options.radiusScale=1] - 点放大倍数。
  74611. * @param {number} [options.radiusMinPixels=0] - 半径最小值(像素)。
  74612. * @param {number} [options.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - 半径最大值(像素)。
  74613. * @param {number} [options.strokeWidth=1] - 边框大小。
  74614. * @param {boolean} [options.outline=false] - 是否显示边框。
  74615. * @param {Function} [options.onClick] - 点击事件。
  74616. * @param {Function} [options.onHover] - 悬停事件。
  74617. */
  74618. const CSS_TRANSFORM = (function () {
  74619. let div = document.createElement('div');
  74620. let props = [
  74621. 'transform',
  74622. 'WebkitTransform',
  74623. 'MozTransform',
  74624. 'OTransform',
  74625. 'msTransform'
  74626. ];
  74627. for (let i = 0; i < props.length; i++) {
  74628. let prop = props[i];
  74629. if (div.style[prop] !== undefined) {
  74630. return prop;
  74631. }
  74632. }
  74633. return props[0];
  74634. })();
  74635. var GraphicWebGLRenderer = external_L_default().Class.extend({
  74636. initialize: function (layer, options) {
  74637. this.layer = layer;
  74638. let opt = options || {};
  74639. external_L_default().Util.setOptions(this, opt);
  74640. this.options.radius = this._pixelToMeter(this.options.radius);
  74641. this._initContainer();
  74642. },
  74643. /**
  74644. * @private
  74645. * @function GraphicWebGLRenderer.prototype.getRenderer
  74646. * @description 返回渲染器本身给图层,提供图层后续的数据增删改。
  74647. * @returns {GraphicWebGLRenderer}
  74648. */
  74649. getRenderer: function () {
  74650. return this;
  74651. },
  74652. /**
  74653. * @private
  74654. * @function GraphicWebGLRenderer.prototype.update
  74655. * @description 更新图层,数据或者样式改变后调用。
  74656. */
  74657. update: function (graphics) {
  74658. if (graphics && graphics.length > -1) {
  74659. this._data = graphics;
  74660. }
  74661. this._renderLayer.setChangeFlags({
  74662. dataChanged: true,
  74663. propsChanged: true,
  74664. viewportChanged: true,
  74665. updateTriggersChanged: true
  74666. });
  74667. this._refreshData();
  74668. let state = this._getLayerState();
  74669. state.data = this._data || [];
  74670. this._layerDefaultStyleCache = null;
  74671. this._renderLayer.setNeedsRedraw(true);
  74672. this._renderLayer.setState(state);
  74673. },
  74674. /**
  74675. * @private
  74676. * @function GraphicWebGLRenderer.prototype.drawGraphics
  74677. * @description 绘制点要素。
  74678. */
  74679. drawGraphics: function (graphics) {
  74680. this._clearBuffer();
  74681. let size = this.layer._map.getSize();
  74682. if (this._container.width !== size.x) {
  74683. this._container.width = size.x;
  74684. }
  74685. if (this._container.height !== size.y) {
  74686. this._container.height = size.y;
  74687. }
  74688. let mapPane = this.layer._map.getPanes().mapPane;
  74689. let point = mapPane._leaflet_pos;
  74690. this._container.style[CSS_TRANSFORM] = 'translate(' +
  74691. -Math.round(point.x) + 'px,' +
  74692. -Math.round(point.y) + 'px)';
  74693. this._data = graphics || [];
  74694. if (!this._renderLayer) {
  74695. this._createInnerRender();
  74696. }
  74697. this._draw();
  74698. },
  74699. _initContainer: function () {
  74700. this._container = this._createCanvas(this.options.width, this.options.height);
  74701. this._layerContainer = this.options.container;
  74702. this._wrapper = external_L_default().DomUtil.create('div', "deck-wrapper", this._layerContainer);
  74703. this._wrapper.appendChild(this._container);
  74704. },
  74705. _createCanvas: function (width, height) {
  74706. //leaflet-layer 对应的css会自动设置position
  74707. let canvas = external_L_default().DomUtil.create('canvas', 'graphicLayer leaflet-layer leaflet-zoom-hide');
  74708. canvas.oncontextmenu = (external_L_default()).Util.falseFn;
  74709. canvas.width = width;
  74710. canvas.height = height;
  74711. canvas.style.width = width + "px";
  74712. canvas.style.height = height + "px";
  74713. return canvas;
  74714. },
  74715. _pixelToMeter: function (pixel) {
  74716. const bounds = this.layer._map.getBounds();
  74717. const latlngRes = (bounds.getEast() - bounds.getWest()) / this.layer._map.getSize().x
  74718. const meterRes = latlngRes * (Math.PI * 6378137 / 180);
  74719. return pixel * meterRes;
  74720. },
  74721. _createInnerRender: function () {
  74722. let me = this;
  74723. let state = this._getLayerState();
  74724. let {
  74725. color,
  74726. radius,
  74727. opacity,
  74728. highlightColor,
  74729. radiusScale,
  74730. radiusMinPixels,
  74731. radiusMaxPixels,
  74732. strokeWidth,
  74733. outline
  74734. } = state;
  74735. let innerLayerOptions = {
  74736. id: 'scatter-plot',
  74737. data: me._data,
  74738. pickable: Boolean(this.options.onClick) || Boolean(this.options.onHover),
  74739. autoHighlight: true,
  74740. color: color,
  74741. opacity: opacity,
  74742. radius: radius,
  74743. radiusScale: radiusScale,
  74744. highlightColor: highlightColor,
  74745. radiusMinPixels: radiusMinPixels,
  74746. radiusMaxPixels: radiusMaxPixels,
  74747. strokeWidth: strokeWidth,
  74748. outline: outline,
  74749. getPosition: function (point) {
  74750. if (!point) {
  74751. return [0, 0, 0];
  74752. }
  74753. let lngLat = point.getLatLng();
  74754. return lngLat && [lngLat.lng, lngLat.lat, 0];
  74755. },
  74756. getColor: function (point) {
  74757. let defaultStyle = me._getLayerDefaultStyle();
  74758. let style = point && point.options;
  74759. return style && style.color || defaultStyle.color
  74760. },
  74761. getRadius: function (point) {
  74762. let defaultStyle = me._getLayerDefaultStyle();
  74763. let style = point && point.getStyle();
  74764. return style && style.radius || defaultStyle.radius
  74765. },
  74766. updateTriggers: {
  74767. getColor: [color],
  74768. getRadius: [radius]
  74769. }
  74770. };
  74771. let _self = this;
  74772. if (this.options.onClick) {
  74773. innerLayerOptions.onClick = function () {
  74774. _self._container.style.cursor = "pointer";
  74775. _self.options.onClick.apply(_self, arguments)
  74776. };
  74777. }
  74778. if (this.options.onHover) {
  74779. innerLayerOptions.onHover = function () {
  74780. _self._container.style.cursor = "pointer";
  74781. _self.options.onHover.apply(_self, arguments)
  74782. };
  74783. }
  74784. me._renderLayer = new window.DeckGL.ScatterplotLayer(innerLayerOptions);
  74785. },
  74786. _getLayerDefaultStyle: function () {
  74787. if (this._layerDefaultStyleCache) {
  74788. return this._layerDefaultStyleCache;
  74789. }
  74790. let {
  74791. color,
  74792. opacity,
  74793. radius,
  74794. radiusScale,
  74795. radiusMinPixels,
  74796. radiusMaxPixels,
  74797. strokeWidth,
  74798. outline
  74799. } = this.layer.options;
  74800. radius = this._pixelToMeter(radius);
  74801. this._layerDefaultStyleCache = {
  74802. color,
  74803. opacity,
  74804. radius,
  74805. radiusScale,
  74806. radiusMinPixels,
  74807. radiusMaxPixels,
  74808. strokeWidth,
  74809. outline
  74810. }
  74811. return this._layerDefaultStyleCache
  74812. },
  74813. _getLayerState: function () {
  74814. let state = this.layer.getState();
  74815. state.zoom = state.zoom - 1;
  74816. return state;
  74817. },
  74818. _draw: function () {
  74819. let state = this._getLayerState();
  74820. this._refreshData();
  74821. state.data = this._data || [];
  74822. let deckOptions = {};
  74823. for (let key in state) {
  74824. deckOptions[key] = state[key];
  74825. }
  74826. this._layerDefaultStyleCache = null;
  74827. this._renderLayer.setNeedsRedraw(true);
  74828. deckOptions.layers = [this._renderLayer];
  74829. deckOptions.canvas = this._container;
  74830. deckOptions.onBeforeRender = this._onBeforeRender.bind(this);
  74831. deckOptions.onAfterRender = this._onAfterRender.bind(this);
  74832. if (!this.deckGL) {
  74833. this.deckGL = new window.DeckGL.experimental.DeckGLJS(deckOptions);
  74834. } else {
  74835. this.deckGL.setProps(deckOptions);
  74836. }
  74837. },
  74838. _clearBuffer: function () {
  74839. if (this.deckGL) {
  74840. let lm = this.deckGL.layerManager;
  74841. lm && lm.context.gl.clear(lm.context.gl.COLOR_BUFFER_BIT);
  74842. }
  74843. return this;
  74844. },
  74845. _refreshData: function () {
  74846. let graphics = this._data || [];
  74847. let sGraphics = !external_L_default().Util.isArray(graphics) ? [graphics] : [].concat(graphics);
  74848. //this.layer.props.data不能被重新赋值,只能在原数组上进行操作
  74849. if (!this._renderLayer.props.data) {
  74850. this._renderLayer.props.data = [];
  74851. }
  74852. this._renderLayer.props.data.length = 0;
  74853. for (let i = 0; i < sGraphics.length; i++) {
  74854. this._renderLayer.props.data.push(sGraphics[i]);
  74855. }
  74856. this._data = this._renderLayer.props.data;
  74857. },
  74858. _handleClick: WebGLRenderer_emptyFunc,
  74859. //deck渲染开始前调用,可以重写
  74860. _onBeforeRender: WebGLRenderer_emptyFunc,
  74861. //deck渲染结束后调用,可以重写
  74862. _onAfterRender: WebGLRenderer_emptyFunc,
  74863. //以下为leaflet再带的renderer的方法,为了保持接口正常调用,故增加这几个方法
  74864. _removePath: function () {
  74865. this._wrapper.parentElement.removeChild(this._wrapper);
  74866. this._container = null;
  74867. this._wrapper = null;
  74868. return this;
  74869. },
  74870. _initPath: WebGLRenderer_emptyFunc,
  74871. _addPath: WebGLRenderer_emptyFunc,
  74872. containsPoint: WebGLRenderer_emptyFunc
  74873. });
  74874. ;// CONCATENATED MODULE: ./src/leaflet/overlay/graphic/index.js
  74875. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  74876. * This program are made available under the terms of the Apache License, Version 2.0
  74877. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74878. ;// CONCATENATED MODULE: ./src/leaflet/overlay/GraphicLayer.js
  74879. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  74880. * This program are made available under the terms of the Apache License, Version 2.0
  74881. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74882. const Renderer = ['canvas', 'webgl'];
  74883. const defaultProps = {
  74884. color: [0, 0, 0, 255],
  74885. opacity: 0.8,
  74886. radius: 10,
  74887. radiusScale: 1,
  74888. radiusMinPixels: 0,
  74889. radiusMaxPixels: Number.MAX_SAFE_INTEGER,
  74890. strokeWidth: 1,
  74891. outline: false
  74892. };
  74893. /**
  74894. * @class L.supermap.graphicLayer
  74895. * @classdesc 高效率点图层类。
  74896. * @category Visualization Graphic
  74897. * @extends {L.Path}
  74898. * @param {Array.<L.supermap.graphic>} graphics - 要素对象。
  74899. * @param {Object} options - 图层参数。
  74900. * @param {string} [options.render='canvas'] - 指定使用的渲染器。可选值:“webgl”,“canvas”(webgl 渲染目前只支持散点)。
  74901. * @param {Array.<number>} [options.color=[0, 0, 0, 255]] - 要素颜色。
  74902. * @param {Array.<number>} [options.highlightColor] - webgl 渲染时要素高亮颜色。
  74903. * @param {number} [options.opacity=0.8] - 要素透明度。
  74904. * @param {number} [options.radius=10] - 要素半径,单位像素。
  74905. * @param {number} [options.radiusScale=1] - webgl 渲染时的要素放大倍数。
  74906. * @param {number} [options.radiusMinPixels=0] - webgl 渲染时的要素半径最小值(像素)。
  74907. * @param {number} [options.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - webgl 渲染时的要素半径最大值(像素)。
  74908. * @param {number} [options.strokeWidth=1] - 边框大小。
  74909. * @param {boolean} [options.outline=false] - 是否显示边框。
  74910. * @param {Function} [options.onClick] - 图层鼠标点击响应事件(webgl、canvas 渲染时都有用)。
  74911. * @param {Function} [options.onHover] - 图层鼠标悬停响应事件(只有 webgl 渲染时有用)。
  74912. */
  74913. var GraphicLayer = external_L_default().Path.extend({
  74914. initialize: function (graphics, options) {
  74915. this.graphics = [].concat(graphics);
  74916. let opt = options || {};
  74917. // 由于是canvas实现所以不能更改pane
  74918. opt.pane = 'overlayPane';
  74919. external_L_default().Util.setOptions(this, opt);
  74920. //因为跟基类的renderer冲突,所以采用render这个名字
  74921. this.options.render = this.options.render || Renderer[0];
  74922. //浏览器支持webgl并且指定使用webgl渲染才使用webgl渲染
  74923. if (!Detector.supportWebGL2()) {
  74924. this.options.render = Renderer[0];
  74925. }
  74926. if (this.options.interactive) {
  74927. this.on('click mousemove dblclick mousedown mouseup mouseout contextmenu', this._handleClick, this);
  74928. }
  74929. },
  74930. /**
  74931. * @private
  74932. * @function L.supermap.graphicLayer.prototype.getEvents
  74933. * @description 获取事件。
  74934. * @returns {Object} 返回该图层支持的事件对象。
  74935. */
  74936. getEvents: function () {
  74937. const events = {
  74938. resize: this._resize.bind(this),
  74939. moveend: this._moveEnd.bind(this)
  74940. };
  74941. return events;
  74942. },
  74943. /**
  74944. * @private
  74945. * @function L.supermap.graphicLayer.prototype.onAdd
  74946. * @description 添加图形。
  74947. */
  74948. onAdd: function (map) {
  74949. this._map = map;
  74950. this.defaultStyle = this._getDefaultStyle(this.options);
  74951. this._renderer = this._createRenderer();
  74952. this._container = this._renderer._container;
  74953. // this.addInteractiveTarget(this._container);
  74954. external_L_default().Path.prototype.onAdd.call(this);
  74955. },
  74956. /**
  74957. * @private
  74958. * @override
  74959. * @function L.supermap.graphicLayer.prototype.onRemove
  74960. * @description 移除图层。
  74961. */
  74962. onRemove: function () {
  74963. this.off('click mousemove dblclick mousedown mouseup contextmenu', this._handleClick, this);
  74964. this._renderer._removePath(this);
  74965. },
  74966. /**
  74967. * @function L.supermap.graphicLayer.prototype.setGraphics
  74968. * @description 设置绘制的点要素数据,会覆盖之前的所有要素。
  74969. * @param {Array.<L.supermap.graphic>} graphics - 点要素对象数组。
  74970. */
  74971. setGraphics: function (graphics) {
  74972. this.graphics = this.graphics || [];
  74973. this.graphics.length = 0;
  74974. let sGraphics = !external_L_default().Util.isArray(graphics) ? [graphics] : [].concat(graphics);
  74975. this.graphics = [].concat(sGraphics);
  74976. this.update();
  74977. },
  74978. /**
  74979. * @function L.supermap.graphicLayer.prototype.addGraphics
  74980. * @description 追加点要素,不会覆盖之前的要素。
  74981. * @param {Array.<L.supermap.graphic>} graphics - 点要素对象数组。
  74982. */
  74983. addGraphics: function (graphics) {
  74984. this.graphics = this.graphics || [];
  74985. let sGraphics = !external_L_default().Util.isArray(graphics) ? [graphics] : [].concat(graphics);
  74986. this.graphics = this.graphics.concat(sGraphics);
  74987. this.update();
  74988. },
  74989. /**
  74990. * @function L.supermap.graphicLayer.prototype.getGraphicBy
  74991. * @description 在 Vector 的要素数组 graphics 里面遍历每一个 graphic,当 graphic[property]===value 时,返回此 graphic(并且只返回第一个)。
  74992. * @param {string} property - graphic 的某个属性名称。
  74993. * @param {string} value - property 所对应的值。
  74994. * @returns {ol.Graphic} 一个匹配的 graphic。
  74995. */
  74996. getGraphicBy(property, value) {
  74997. let graphic = null;
  74998. for (let index in this.graphics) {
  74999. if (this.graphics[index][property] === value) {
  75000. graphic = this.graphics[index];
  75001. break;
  75002. }
  75003. }
  75004. return graphic;
  75005. },
  75006. /**
  75007. * @function L.supermap.graphicLayer.prototype.getGraphicById
  75008. * @description 通过给定一个 id,返回对应的矢量要素。
  75009. * @param {string} graphicId - 矢量要素的属性 id。
  75010. * @returns {ol.Graphic} 一个匹配的 graphic。
  75011. */
  75012. getGraphicById(graphicId) {
  75013. return this.getGraphicBy('id', graphicId);
  75014. },
  75015. /**
  75016. * @function L.supermap.graphicLayer.prototype.getGraphicsByAttribute
  75017. * @description 通过给定一个属性的 key 值和 value 值,返回所有匹配的要素数组。
  75018. * @param {string} attrName - graphic 的某个属性名称。
  75019. * @param {string} attrValue - property 所对应的值。
  75020. * @returns {Array.<ol.Graphic>} 一个匹配的 graphic 数组。
  75021. */
  75022. getGraphicsByAttribute(attrName, attrValue) {
  75023. var graphic,
  75024. foundgraphics = [];
  75025. for (let index in this.graphics) {
  75026. graphic = this.graphics[index];
  75027. if (graphic && graphic.attributes) {
  75028. if (graphic.attributes[attrName] === attrValue) {
  75029. foundgraphics.push(graphic);
  75030. }
  75031. }
  75032. }
  75033. return foundgraphics;
  75034. },
  75035. /**
  75036. * @function L.supermap.graphicLayer.prototype.removeGraphics
  75037. * @description 删除要素数组,默认将删除所有要素。
  75038. * @param {Array.<ol.Graphic>} [graphics=null] - 删除的 graphics 数组。
  75039. */
  75040. removeGraphics(graphics = null) {
  75041. //当 graphics 为 null 、为空数组,或 === this.graphics,则清除所有要素
  75042. if (!graphics || graphics.length === 0 || graphics === this.graphics) {
  75043. this.graphics.length = 0;
  75044. this.update();
  75045. return;
  75046. }
  75047. if (!Util.isArray(graphics)) {
  75048. graphics = [graphics];
  75049. }
  75050. for (let i = graphics.length - 1; i >= 0; i--) {
  75051. let graphic = graphics[i];
  75052. //如果我们传入的grapchic在graphics数组中没有的话,则不进行删除,
  75053. //并将其放入未删除的数组中。
  75054. let findex = Util.indexOf(this.graphics, graphic);
  75055. if (findex === -1) {
  75056. continue;
  75057. }
  75058. this.graphics.splice(findex, 1);
  75059. }
  75060. //删除完成后重新设置 setGraphics,以更新
  75061. this.update();
  75062. },
  75063. /**
  75064. * @function L.supermap.graphicLayer.prototype.setStyle
  75065. * @description 设置图层要素整体样式。
  75066. * @param {Object} styleOptions - 样式对象。
  75067. * @param {Array.<number>} [styleOptions.color=[0, 0, 0, 255]] - 点颜色。
  75068. * @param {number} [styleOptions.radius=10] - 点半径。
  75069. * @param {number} [styleOptions.opacity=0.8] - 不透明度。
  75070. * @param {Array} [styleOptions.highlightColor] - 高亮颜色,目前只支持 rgba 数组。
  75071. * @param {number} [styleOptions.radiusScale=1] - 点放大倍数。
  75072. * @param {number} [styleOptions.radiusMinPixels=0] - 半径最小值(像素)。
  75073. * @param {number} [styleOptions.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - 半径最大值(像素)。
  75074. * @param {number} [styleOptions.strokeWidth=1] - 边框大小。
  75075. * @param {boolean} [styleOptions.outline=false] - 是否显示边框。
  75076. */
  75077. setStyle: function (styleOptions) {
  75078. let _opt = this.options;
  75079. let styleOpt = {
  75080. color: _opt.color,
  75081. radius: _opt.radius,
  75082. opacity: _opt.opacity,
  75083. highlightColor: _opt.highlightColor,
  75084. radiusScale: _opt.radiusScale,
  75085. radiusMinPixels: _opt.radiusMinPixels,
  75086. radiusMaxPixels: _opt.radiusMaxPixels,
  75087. strokeWidth: _opt.strokeWidth,
  75088. outline: _opt.outline
  75089. };
  75090. this.options = external_L_default().Util.extend(this.options, styleOpt, styleOptions);
  75091. this.defaultStyle = this._getDefaultStyle(this.options);
  75092. this.update();
  75093. },
  75094. /**
  75095. * @function L.supermap.graphicLayer.prototype.update
  75096. * @description 更新图层,数据或者样式改变后调用。
  75097. */
  75098. update: function () {
  75099. this._layerRenderer.update(this.graphics);
  75100. },
  75101. /**
  75102. * @function L.supermap.graphicLayer.prototype.clear
  75103. * @description 释放图层资源。
  75104. */
  75105. clear: function () {
  75106. this.removeGraphics();
  75107. },
  75108. /**
  75109. * @function L.supermap.graphicLayer.prototype.getRenderer
  75110. * @description 获取渲染器。
  75111. * @returns {Object} 内部渲染器。
  75112. */
  75113. getRenderer: function () {
  75114. return this._renderer;
  75115. },
  75116. /**
  75117. * @function L.supermap.graphicLayer.prototype.getState
  75118. * @description 获取当前地图及图层状态。
  75119. * @returns {Object} 地图及图层状态,包含地图状态信息和本图层相关状态。
  75120. */
  75121. getState: function () {
  75122. let map = this._map;
  75123. let width = map.getSize().x;
  75124. let height = map.getSize().y;
  75125. let center = map.getCenter();
  75126. let longitude = center.lng;
  75127. let latitude = center.lat;
  75128. let zoom = map.getZoom();
  75129. let maxZoom = map.getMaxZoom();
  75130. let mapViewport = {
  75131. longitude: longitude,
  75132. latitude: latitude,
  75133. zoom: zoom,
  75134. maxZoom: maxZoom,
  75135. pitch: 0,
  75136. bearing: 0
  75137. };
  75138. let state = {};
  75139. for (let key in mapViewport) {
  75140. state[key] = mapViewport[key];
  75141. }
  75142. state.width = width;
  75143. state.height = height;
  75144. let options = this.options;
  75145. state.color = options.color;
  75146. state.radius = options.radius;
  75147. state.opacity = options.opacity;
  75148. state.highlightColor = options.highlightColor;
  75149. state.radiusScale = options.radiusScale;
  75150. state.radiusMinPixels = options.radiusMinPixels;
  75151. state.radiusMaxPixels = options.radiusMaxPixels;
  75152. state.strokeWidth = options.strokeWidth;
  75153. state.outline = options.outline;
  75154. return state;
  75155. },
  75156. _resize: function () {
  75157. let size = this._map.getSize();
  75158. this._container.width = size.x;
  75159. this._container.height = size.y;
  75160. this._container.style.width = size.x + 'px';
  75161. this._container.style.height = size.y + 'px';
  75162. let mapOffset = this._map.containerPointToLayerPoint([0, 0]);
  75163. external_L_default().DomUtil.setPosition(this._container, mapOffset);
  75164. this._update();
  75165. },
  75166. _moveEnd: function () {
  75167. if (this._layerRenderer instanceof GraphicWebGLRenderer) {
  75168. this._update();
  75169. }
  75170. },
  75171. //使用canvas渲染或webgl渲染
  75172. _createRenderer: function () {
  75173. let map = this._map;
  75174. let width = map.getSize().x;
  75175. let height = map.getSize().y;
  75176. let _renderer;
  75177. if (this.options.render === Renderer[0]) {
  75178. _renderer = new GraphicCanvasRenderer(this, {
  75179. width: width,
  75180. height: height,
  75181. renderer: map.getRenderer(this)
  75182. });
  75183. } else {
  75184. let optDefault = external_L_default().Util.setOptions({}, defaultProps);
  75185. let opt = external_L_default().Util.setOptions(
  75186. {
  75187. options: optDefault
  75188. },
  75189. this.options
  75190. );
  75191. opt = external_L_default().Util.setOptions(this, opt);
  75192. opt.container = map.getPane('overlayPane');
  75193. opt.width = width;
  75194. opt.height = height;
  75195. _renderer = new GraphicWebGLRenderer(this, opt);
  75196. }
  75197. _renderer.defaultStyle = this.defaultStyle;
  75198. this._layerRenderer = _renderer;
  75199. return this._layerRenderer.getRenderer();
  75200. },
  75201. /**
  75202. * @private
  75203. * @override
  75204. */
  75205. _update: function () {
  75206. if (this._map) {
  75207. this._updatePath();
  75208. }
  75209. },
  75210. /**
  75211. * @private
  75212. * @override
  75213. */
  75214. _updatePath: function () {
  75215. let graphics = this._getGraphicsInBounds();
  75216. this._renderer.drawGraphics(graphics, this.defaultStyle);
  75217. },
  75218. /**
  75219. * @private
  75220. * @override
  75221. */
  75222. _project: function () {
  75223. let me = this;
  75224. me._getGraphicsInBounds().map(function (graphic) {
  75225. let point = me._map.latLngToLayerPoint(graphic.getLatLng());
  75226. let w = me._clickTolerance();
  75227. let p = [graphic._anchor + w, graphic._anchor + w];
  75228. graphic._pxBounds = new (external_L_default()).Bounds(point.subtract(p), point.add(p));
  75229. return graphic;
  75230. });
  75231. me._pxBounds = external_L_default().bounds(external_L_default().point(0, 0), external_L_default().point(this._container.width, this._container.height));
  75232. },
  75233. _getDefaultStyle: function (options) {
  75234. const target = {};
  75235. if (options.color) {
  75236. target.fill = true;
  75237. const color = this.toRGBA(options.color);
  75238. target.color = color;
  75239. target.fillColor = color;
  75240. }
  75241. if (options.opacity) {
  75242. target.opacity = options.opacity;
  75243. target.fillOpacity = options.opacity;
  75244. }
  75245. if (options.radius) {
  75246. target.radius = options.radius;
  75247. }
  75248. if (options.strokeWidth) {
  75249. target.weight = options.strokeWidth;
  75250. }
  75251. if (options.outline) {
  75252. target.stroke = options.outline;
  75253. }
  75254. return new CircleStyle(target).getStyle();
  75255. },
  75256. toRGBA(colorArray) {
  75257. return `rgba(${colorArray[0]},${colorArray[1]},${colorArray[2]},${(colorArray[3] || 255) / 255})`;
  75258. },
  75259. _getGraphicsInBounds: function () {
  75260. let me = this;
  75261. let graphicsInBounds = [];
  75262. let viewBounds = me._map.getBounds();
  75263. this.graphics.map(function (graphic) {
  75264. if (viewBounds.contains(graphic.getLatLng())) {
  75265. graphicsInBounds.push(graphic);
  75266. }
  75267. return graphic;
  75268. });
  75269. return graphicsInBounds;
  75270. },
  75271. _handleClick: function (evt) {
  75272. this._layerRenderer._handleClick(evt);
  75273. },
  75274. /**
  75275. * @private
  75276. * @override
  75277. */
  75278. beforeAdd: (external_L_default()).Util.falseFn,
  75279. /**
  75280. * @private
  75281. * @override
  75282. */
  75283. _containsPoint: function (p) {
  75284. return this._layerRenderer.containsPoint(p);
  75285. }
  75286. });
  75287. let graphicLayer = function (graphics, options) {
  75288. return new GraphicLayer(graphics, options);
  75289. };
  75290. (external_L_default()).supermap.graphicLayer = graphicLayer;
  75291. ;// CONCATENATED MODULE: ./src/leaflet/overlay/GraphThemeLayer.js
  75292. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  75293. * This program are made available under the terms of the Apache License, Version 2.0
  75294. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75295. /**
  75296. * @class L.supermap.graphThemeLayer
  75297. * @classdesc 统计专题图图层。
  75298. * @category Visualization Theme
  75299. * @extends L.supermap.ThemeLayer
  75300. * @description 统计专题图通过为每个要素绘制统计图表来反映其对应的专题值的大小。它可同时表示多个字段属性信息,在区域本身与各区域之间形成横向和纵向的对比。
  75301. * 统计专题图多用于具有相关数量特征的地图上,比如表示不同地区多年的粮食产量、GDP、人口等,不同时段客运量、地铁流量等。
  75302. * 目前提供的统计图类型有:柱状图(Bar),折线图(Line),饼图(Pie),三维柱状图(Bar3D),点状图(Point),环状图(Ring)。
  75303. * @param {string} name - 专题图表名称。
  75304. * @param {string} chartsType - 图表类型。目前可用:"Bar","Bar3D","Line","Point","Pie","Ring"。
  75305. * @param {Object} options - 待设置的参数。
  75306. * @param {boolean} [options.isOverLay=true] - 是否进行压盖处理,如果设为 true,图表绘制过程中将隐藏对已在图层中绘制的图表产生压盖的图表。
  75307. * @param {string} options.themeFields - 指定创建专题图字段。
  75308. * @param {boolean} [options.alwaysMapCRS=false] - 要素坐标是否和地图坐标系一致,要素默认是经纬度坐标。
  75309. * @param {Object} [options.cache] - 缓存。
  75310. * @param {Object} [options.charts] - 图表。
  75311. * @param {string} [options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  75312. * @param {number} [options.opacity=1] - 图层透明度。
  75313. * @param {Array} [options.TFEvents] - 专题要素事件临时存储。专题要素事件临时存储。
  75314. * @param {Object} options.chartsSetting - 各类型图表的 chartsSetting 对象可设属性请参考具体图表模型类的注释中对 chartsSetting 对象可设属性的描述。chartsSetting 对象通常都具有以下 5 个基础可设属性:</br>
  75315. * @param {number} options.chartsSetting.width - 专题要素(图表)宽度。
  75316. * @param {number} options.chartsSetting.height - 专题要素(图表)高度。
  75317. * @param {Array.<number>} options.chartsSetting.codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  75318. * @param {number} [options.chartsSetting.XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  75319. * @param {number} [options.chartsSetting.YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  75320. * @param {Array.<number>} [options.chartsSetting.dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值,长度为 4 的一维数组。
  75321. * @param {number} [options.chartsSetting.decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  75322. * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权描述信息。
  75323. */
  75324. var GraphThemeLayer = ThemeLayer.extend({
  75325. options: {
  75326. //是否进行压盖处理,如果设为 true,图表绘制过程中将隐藏对已在图层中绘制的图表产生压盖的图表,默认值:true。
  75327. isOverLay: true
  75328. },
  75329. initialize: function (name, chartsType, options) {
  75330. var newArgs = [];
  75331. newArgs.push(name);
  75332. newArgs.push(options);
  75333. ThemeLayer.prototype.initialize.apply(this, newArgs);
  75334. this.chartsType = chartsType;
  75335. this.themeFields = options && options.themeFields ? options.themeFields : null;
  75336. this.charts = options && options.charts ? options.charts : [];
  75337. this.cache = options && options.cache ? options.cache : {};
  75338. this.chartsSetting = options && options.chartsSetting ? options.chartsSetting : {};
  75339. },
  75340. /**
  75341. * @function L.supermap.GraphThemeLayer.prototype.setChartsType
  75342. * @description 设置图表类型,此函数可动态改变图表类型。在调用此函数前请通过 chartsSetting 为新类型的图表做相关配置。图表类型,目前支持:"Bar", "Bar3D", "Line","Point","Pie","Ring"。
  75343. * @param {string} chartsType - 图表类型。目前可用:"Bar", "Bar3D", "Line","Point","Pie","Ring"。
  75344. */
  75345. setChartsType: function (chartsType) {
  75346. this.chartsType = chartsType;
  75347. this.redraw();
  75348. },
  75349. /**
  75350. * @function L.supermap.GraphThemeLayer.prototype.addFeatures
  75351. * @description 向专题图图层中添加数据。
  75352. * @param {(SuperMap.ServerFeature|L.supermap.themeFeature|GeoJSONObject)} features - 待添加的要素。
  75353. */
  75354. addFeatures: function (features) {
  75355. var me = this;
  75356. /**
  75357. * @event L.supermap.GraphThemeLayer#beforefeaturesadded
  75358. * @description 向专题图图层中添加数据之前触发。
  75359. * @property {(SuperMap.ServerFeature|L.supermap.themeFeature|GeoJSONObject)} features - 待添加的要素。
  75360. */
  75361. me.fire("beforefeaturesadded", {features: features});
  75362. //转换 features 形式
  75363. this.features = this.toiClientFeature(features);
  75364. //绘制专题要素
  75365. if (!me.renderer) {
  75366. return;
  75367. }
  75368. if (me._map) {
  75369. me.redrawThematicFeatures(me._map.getBounds());
  75370. } else {
  75371. me.redrawThematicFeatures();
  75372. }
  75373. },
  75374. /**
  75375. * @function L.supermap.GraphThemeLayer.prototype.redrawThematicFeatures
  75376. * @description 重绘所有专题要素 此方法包含绘制专题要素的所有步骤,包含用户数据到专题要素的转换,压盖处理,缓存等步骤。地图漫游时调用此方法进行图层刷新。
  75377. * @param {L.bounds} bounds - 重绘的范围。
  75378. */
  75379. redrawThematicFeatures: function (bounds) {
  75380. var me = this;
  75381. //清除当前所有可视元素
  75382. me.renderer.clearAll();
  75383. var features = me.features;
  75384. if (this.options.alwaysMapCRS && bounds && bounds instanceof (external_L_default()).LatLngBounds) {
  75385. var crs = this._map.options.crs;
  75386. bounds = external_L_default().bounds(crs.project(bounds.getSouthWest()), crs.project(bounds.getNorthEast()));
  75387. }
  75388. bounds = CommontypesConversion.toSuperMapBounds(bounds);
  75389. for (var i = 0, len = features.length; i < len; i++) {
  75390. var feature = features[i];
  75391. // 要素范围判断
  75392. var feaBounds = feature.geometry.getBounds();
  75393. //剔除当前视图(地理)范围以外的数据
  75394. if (bounds && !bounds.intersectsBounds(feaBounds)) {
  75395. continue;
  75396. }
  75397. var cache = me.cache;
  75398. // 用feature id 做缓存标识
  75399. var cacheField = feature.id;
  75400. // 数据对应的图表是否已缓存,没缓存则重新创建图表
  75401. if (!cache[cacheField]) {
  75402. cache[cacheField] = cacheField;
  75403. var chart = me.createThematicFeature(feature);
  75404. // 压盖处理权重值
  75405. var isValidOverlayWeightField = me.overlayWeightField
  75406. && feature.attributes[me.overlayWeightField]
  75407. && !isNaN(feature.attributes[me.overlayWeightField]);
  75408. if (chart && isValidOverlayWeightField) {
  75409. chart["__overlayWeight"] = feature.attributes[me.overlayWeightField];
  75410. }
  75411. if (chart) {
  75412. me.charts.push(chart);
  75413. }
  75414. }
  75415. }
  75416. me.drawCharts();
  75417. },
  75418. /**
  75419. * @function L.supermap.GraphThemeLayer.prototype.createThematicFeature
  75420. * @description 创建专题要素(图表)。
  75421. * @param {Object} feature - 待创建的要素。
  75422. */
  75423. createThematicFeature: function (feature) {
  75424. var me = this;
  75425. var thematicFeature;
  75426. // 检查图表创建条件并创建图形
  75427. if (Theme_Theme[me.chartsType] && me.themeFields && me.chartsSetting) {
  75428. thematicFeature = new Theme_Theme[me.chartsType](feature, me, me.themeFields, me.chartsSetting);
  75429. }
  75430. // thematicFeature 是否创建成功
  75431. if (!thematicFeature) {
  75432. return false
  75433. }
  75434. // 对专题要素执行图形装载
  75435. thematicFeature.assembleShapes();
  75436. return thematicFeature;
  75437. },
  75438. /**
  75439. * @function L.supermap.GraphThemeLayer.prototype.drawCharts
  75440. * @description 绘制图表。包含压盖处理。
  75441. */
  75442. drawCharts: function () {
  75443. var me = this;
  75444. if (!me.renderer) {
  75445. return;
  75446. }
  75447. // 图表权重值处理
  75448. if (me.overlayWeightField) {
  75449. me._sortChart();
  75450. }
  75451. if (me.options && !me.options.isOverLay) {
  75452. // 不进行避让
  75453. me._addOverlayShape();
  75454. } else {
  75455. //进行避让
  75456. me._addNoOverlayShape();
  75457. }
  75458. // 绘制图形
  75459. me.renderer.render();
  75460. },
  75461. /**
  75462. * @function L.supermap.GraphThemeLayer.prototype.getShapesByFeatureID
  75463. * @description 通过 FeatureID 获取 feature 关联的所有图形。如果不传入此参数,函数将返回所有图形。
  75464. * @param {number} featureID - 要素 ID。
  75465. */
  75466. getShapesByFeatureID: function (featureID) {
  75467. var me = this, list = [];
  75468. var shapeList = me.renderer.getAllShapes();
  75469. if (!featureID) {
  75470. return shapeList;
  75471. }
  75472. for (var i = 0, len = shapeList.length; i < len; i++) {
  75473. var si = shapeList[i];
  75474. if (si.refDataID && featureID === si.refDataID) {
  75475. list.push(si);
  75476. }
  75477. }
  75478. return list;
  75479. },
  75480. /**
  75481. * @function L.supermap.GraphThemeLayer.prototype.isQuadrilateralOverLap
  75482. * @description 判断两个四边形是否有压盖。
  75483. * @param {Array.<Object>} quadrilateral - 四边形节点数组。
  75484. * @example
  75485. * [{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}];
  75486. * @param {Array.<Object>} quadrilateral2 - 第二个四边形节点数组。
  75487. */
  75488. isQuadrilateralOverLap: function (quadrilateral, quadrilateral2) {
  75489. var me = this;
  75490. var quadLen = quadrilateral.length,
  75491. quad2Len = quadrilateral2.length;
  75492. if (quadLen !== 5 || quad2Len !== 5) {
  75493. return null;
  75494. }//不是四边形
  75495. var OverLap = false;
  75496. //如果两四边形互不包含对方的节点,则两个四边形不相交
  75497. for (var i = 0; i < quadLen; i++) {
  75498. if (me.isPointInPoly(quadrilateral[i], quadrilateral2)) {
  75499. OverLap = true;
  75500. break;
  75501. }
  75502. }
  75503. for (let i = 0; i < quad2Len; i++) {
  75504. if (me.isPointInPoly(quadrilateral2[i], quadrilateral)) {
  75505. OverLap = true;
  75506. break;
  75507. }
  75508. }
  75509. //加上两矩形十字相交的情况
  75510. for (let i = 0; i < quadLen - 1; i++) {
  75511. if (OverLap) {
  75512. break;
  75513. }
  75514. for (let j = 0; j < quad2Len - 1; j++) {
  75515. var isLineIn = Util.lineIntersection(quadrilateral[i], quadrilateral[i + 1], quadrilateral2[j], quadrilateral2[j + 1]);
  75516. if (isLineIn.CLASS_NAME === "SuperMap.Geometry.Point") {
  75517. OverLap = true;
  75518. break;
  75519. }
  75520. }
  75521. }
  75522. return OverLap;
  75523. },
  75524. /**
  75525. * @function L.supermap.GraphThemeLayer.prototype.isPointInPoly
  75526. * @description 判断一个点是否在多边形里面(射线法)。
  75527. * @param {Object} pt - 需要判定的点对象,该对象含有属性 x(横坐标),属性 y(纵坐标)。
  75528. * @param {Array.<Object>} poly - 多边形节点数组。
  75529. * 例如一个四边形:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  75530. */
  75531. isPointInPoly: function (pt, poly) {
  75532. for (var isIn = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i) {
  75533. ((poly[i].y <= pt.y && pt.y < poly[j].y) || (poly[j].y <= pt.y && pt.y < poly[i].y))
  75534. && (pt.x < (poly[j].x - poly[i].x) * (pt.y - poly[i].y) / (poly[j].y - poly[i].y) + poly[i].x)
  75535. && (isIn = !isIn);
  75536. }
  75537. return isIn;
  75538. },
  75539. /**
  75540. * @function L.supermap.GraphThemeLayer.prototype.isChartInMap
  75541. * @description 判断图表是否在地图里。
  75542. * @param {SuperMap.Bounds} mapPxBounds - 地图像素范围。
  75543. * @param {Array.<Object>} chartPxBounds - 图表范围的四边形节点数组。
  75544. * 例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  75545. */
  75546. isChartInMap: function (mapPxBounds, chartPxBounds) {
  75547. var mb = mapPxBounds;
  75548. var isIn = false;
  75549. for (var i = 0, len = chartPxBounds.length; i < len; i++) {
  75550. var cb = chartPxBounds[i];
  75551. if (cb.x >= mb.left && cb.x <= mb.right && cb.y >= mb.top && cb.y <= mb.bottom) {
  75552. isIn = true;
  75553. break;
  75554. }
  75555. }
  75556. return isIn;
  75557. },
  75558. /**
  75559. * @function L.supermap.GraphThemeLayer.prototype.clearCache
  75560. * @description 清除缓存数据。
  75561. */
  75562. clearCache: function () {
  75563. this.cache = {};
  75564. this.charts = [];
  75565. },
  75566. /**
  75567. * @function L.supermap.GraphThemeLayer.prototype.removeFeatures
  75568. * @description 从专题图中删除 feature。这个函数删除所有传递进来的矢量要素(数据)。
  75569. * @param {Array.<SuperMap.Feature.Vector>} features - 待删除的要素。
  75570. */
  75571. removeFeatures: function (features) { // eslint-disable-line no-unused-vars
  75572. var me = this;
  75573. me.clearCache();
  75574. ThemeLayer.prototype.removeFeatures.apply(me, arguments);
  75575. },
  75576. /**
  75577. * @function L.supermap.GraphThemeLayer.prototype.removeAllFeatures
  75578. * @description 清除当前图层所有的矢量要素。
  75579. */
  75580. removeAllFeatures: function () {
  75581. var me = this;
  75582. me.clearCache();
  75583. ThemeLayer.prototype.removeAllFeatures.apply(me, arguments);
  75584. },
  75585. /**
  75586. * @function L.supermap.GraphThemeLayer.prototype.redraw
  75587. * @description 重绘该图层,成功则返回 true,否则返回 false。
  75588. */
  75589. redraw: function () {
  75590. var me = this;
  75591. me.clearCache();
  75592. return ThemeLayer.prototype.redraw.apply(me, arguments);
  75593. },
  75594. /**
  75595. * @function L.supermap.GraphThemeLayer.prototype.clear
  75596. * @description 清除图层。清除的内容包括数据(features) 、专题要素、缓存。
  75597. */
  75598. clear: function () {
  75599. var me = this;
  75600. if (me.renderer) {
  75601. me.renderer.clearAll();
  75602. me.renderer.refresh();
  75603. }
  75604. me.removeAllFeatures();
  75605. me.clearCache();
  75606. },
  75607. /**
  75608. * @function L.supermap.GraphThemeLayer.prototype.getWeightFieldValue
  75609. * @description 获取权重字段的值。
  75610. * @param {SuperMap.Feature.Vector} feature - 矢量要素。
  75611. * @param {Array.<string>} weightField - 字段名数组。
  75612. * @param {number} defaultValue - 当通过 weightField 获取不到权重值时,使用 defaultValue 作为权重值。
  75613. */
  75614. getWeightFieldValue: function (feature, weightField, defaultValue) {
  75615. if (typeof(defaultValue) === "undefined" || isNaN(defaultValue)) {
  75616. defaultValue = 0;
  75617. }
  75618. if (!feature.attributes) {
  75619. return defaultValue;
  75620. }
  75621. var fieldValue = feature.attributes[weightField];
  75622. if (typeof(fieldValue) === "undefined" || isNaN(fieldValue)) {
  75623. fieldValue = defaultValue
  75624. }
  75625. return fieldValue;
  75626. },
  75627. _sortChart: function () {
  75628. var me = this;
  75629. if (!me.charts) {
  75630. return;
  75631. }
  75632. me.charts.sort(function (cs, ce) {
  75633. if (typeof(cs["__overlayWeight"]) === "undefined" && typeof(ce["__overlayWeight"]) === "undefined") {
  75634. return 0;
  75635. } else if (typeof(cs["__overlayWeight"]) !== "undefined" && typeof(ce["__overlayWeight"]) === "undefined") {
  75636. return -1;
  75637. } else if (typeof(cs["__overlayWeight"]) === "undefined" && typeof(ce["__overlayWeight"]) !== "undefined") {
  75638. return 1;
  75639. } else if (typeof(cs["__overlayWeight"]) !== "undefined" && typeof(ce["__overlayWeight"]) !== "undefined") {
  75640. return (parseFloat(cs["__overlayWeight"]) < parseFloat(ce["__overlayWeight"])) ? 1 : -1;
  75641. }
  75642. return 0;
  75643. });
  75644. },
  75645. _addOverlayShape: function () {
  75646. var me = this;
  75647. var charts = me.charts;
  75648. for (var m = 0, len_m = charts.length; m < len_m; m++) {
  75649. var chart_m = charts[m];
  75650. // 图形参考位置 (reSetLocation 会更新 chartBounds)
  75651. var shapeROP_m = chart_m.resetLocation();
  75652. // 添加图形
  75653. var shapes_m = chart_m.shapes;
  75654. for (var n = 0, slen_n = shapes_m.length; n < slen_n; n++) {
  75655. shapes_m[n].refOriginalPosition = shapeROP_m;
  75656. me.renderer.addShape(shapes_m[n]);
  75657. }
  75658. }
  75659. },
  75660. _addNoOverlayShape: function () {
  75661. var me = this;
  75662. // 压盖判断所需 chartsBounds 集合
  75663. var mapBounds = me._map.getBounds();
  75664. var crs = this._map.options.crs;
  75665. if (this.options.alwaysMapCRS) {
  75666. mapBounds = external_L_default().bounds(crs.project(mapBounds.getSouthWest()), crs.project(mapBounds.getNorthEast()));
  75667. }
  75668. mapBounds = CommontypesConversion.toSuperMapBounds(mapBounds);
  75669. var charts = me.charts;
  75670. var chartsBounds = [];
  75671. // 获取地图像素 bounds
  75672. var mapPxLT = me.getLocalXY(new LonLat(mapBounds.left, mapBounds.top));
  75673. var mapPxRB = me.getLocalXY(new LonLat(mapBounds.right, mapBounds.bottom));
  75674. var mBounds = new Bounds(mapPxLT[0], mapPxRB[1], mapPxRB[0], mapPxLT[1]);
  75675. // 压盖处理 & 添加图形
  75676. for (var i = 0, len = charts.length; i < len; i++) {
  75677. var chart = charts[i];
  75678. // 图形参考位置 (reSetLocation 会更新 chartBounds)
  75679. var shapeROP = chart.resetLocation();
  75680. // 图表框
  75681. var cbs = chart.chartBounds;
  75682. var cBounds = [
  75683. {"x": cbs.left, "y": cbs.top},
  75684. {"x": cbs.left, "y": cbs.bottom},
  75685. {"x": cbs.right, "y": cbs.bottom},
  75686. {"x": cbs.right, "y": cbs.top},
  75687. {"x": cbs.left, "y": cbs.top}
  75688. ];
  75689. // 地图范围外不绘制
  75690. if (mBounds && !me.isChartInMap(mBounds, cBounds)) {
  75691. continue;
  75692. }
  75693. // 是否压盖
  75694. var isOverlay = false;
  75695. for (let j = 0; j < chartsBounds.length; j++) {
  75696. //压盖判断
  75697. if (me.isQuadrilateralOverLap(cBounds, chartsBounds[j])) {
  75698. isOverlay = true;
  75699. break;
  75700. }
  75701. }
  75702. if (isOverlay) {
  75703. continue;
  75704. } else {
  75705. chartsBounds.push(cBounds);
  75706. }
  75707. // 添加图形
  75708. var shapes = chart.shapes;
  75709. for (let j = 0, slen = shapes.length; j < slen; j++) {
  75710. shapes[j].refOriginalPosition = shapeROP;
  75711. me.renderer.addShape(shapes[j]);
  75712. }
  75713. }
  75714. }
  75715. });
  75716. var graphThemeLayer = function (name, chartsType, options) {
  75717. return new GraphThemeLayer(name, chartsType, options);
  75718. };
  75719. (external_L_default()).supermap.graphThemeLayer = graphThemeLayer;
  75720. ;// CONCATENATED MODULE: ./src/leaflet/overlay/RankSymbolThemeLayer.js
  75721. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  75722. * This program are made available under the terms of the Apache License, Version 2.0
  75723. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75724. /**
  75725. * @class L.supermap.rankSymbolThemeLayer
  75726. * @classdesc 符号专题图图层。
  75727. * @category Visualization Theme
  75728. * @description 符号专题图通过为每个要素绘制符号大小来反映其对应的专题值的大小;它只能表示单个个字段属性信息。
  75729. * 符号专题图多用于具有相关数量特征的地图上,比如表示不同地区粮食产量、GDP、人口等。
  75730. * 即通过制作一个符号专题图,就可以清晰展示各个区域相关 Value 的分布差异等。
  75731. * 目前提供的符号图形有:圆形(后续进行扩展、心形、五角星、多角心、图片等)。
  75732. * @extends {L.supermap.GraphThemeLayer}
  75733. * @param {string} name - 专题图层名。
  75734. * @param {SuperMap.ChartType} symbolType - 符号类型。目前支持:"Circle"。
  75735. * @param {Object} options - 参数。
  75736. * @param {boolean} [options.isOverLay=true] - 是否进行压盖处理,如果设为 true,图表绘制过程中将隐藏对已在图层中绘制的图表产生压盖的图表。
  75737. * @param {string} options.themeFields - 指定创建专题图字段。
  75738. * @param {boolean} [options.alwaysMapCRS=false] - 要素坐标是否和地图坐标系一致,要素默认是经纬度坐标。
  75739. * @param {string} [options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  75740. * @param {number} [options.opacity=1] - 图层透明度。
  75741. * @param {Array} [options.TFEvents] - 专题要素事件临时存储。
  75742. * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权描述信息。
  75743. */
  75744. var RankSymbolThemeLayer = GraphThemeLayer.extend({
  75745. /**
  75746. * @member {Object} L.supermap.rankSymbolThemeLayer.prototype.symbolSetting
  75747. * @description 符号 Circle 配置对象。
  75748. * @property {Array} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  75749. * @property {number} [maxR] - 圆形的最大半径。
  75750. * @property {number} [minR] - 圆形的最小半径。
  75751. * @property {string} [fillColor] - 圆形的填充色,如:fillColor: "#FFB980"。
  75752. * @property {Object} [circleStyle] - 圆形的基础 style,此参数控制圆形基础样式,优先级低于 circleStyleByFields 和 circleStyleByCodomain。
  75753. * @property {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  75754. * @property {Object} [circleHoverStyle] - 圆形 hover 状态时的样式,circleHoverAble 为 true 时有效。
  75755. * @property {boolean} [circleHoverAble=true] - 是否允许圆形使用 hover 状态。同时设置 circleHoverAble 和 circleClickAble 为 false,可以直接屏蔽图形对专题图层事件的响应。
  75756. * @property {boolean} [circleClickAble=true] - 是否允许圆形被点击。同时设置 circleHoverAble 和 circleClickAble 为 false,可以直接屏蔽图形对专题图层事件的响应。
  75757. */
  75758. initialize: function (name, symbolType, options) { // eslint-disable-line no-unused-vars
  75759. GraphThemeLayer.prototype.initialize.apply(this, arguments);
  75760. this.symbolType = symbolType;
  75761. this.symbolSetting = {};
  75762. },
  75763. /**
  75764. * @function L.supermap.rankSymbolThemeLayer.prototype.setSymbolType
  75765. * @description 设置符号类型,此函数可动态改变图表类型。在调用此函数前请通过 symbolSetting 为新类型的图表做相关配置。
  75766. * @param {SuperMap.ChartType} symbolType - 目前支持:"Circle"。
  75767. *
  75768. */
  75769. //todo 这里怎么又是supermap的类型
  75770. setSymbolType: function (symbolType) {
  75771. this.symbolType = symbolType;
  75772. this.redraw();
  75773. },
  75774. /**
  75775. * @function L.supermap.rankSymbolThemeLayer.prototype.createThematicFeature
  75776. * @description 创建专题要素(图形)。
  75777. * @param {SuperMap.Feature.Vector} feature - 要创建的专题图形要素。
  75778. * @returns {SuperMap.Feature.Theme} 专题图形。
  75779. */
  75780. createThematicFeature: function (feature) {
  75781. var me = this;
  75782. var thematicFeature;
  75783. // 检查图形创建条件并创建图形
  75784. if (Theme_Theme[me.symbolType] && me.themeField && me.symbolSetting) {
  75785. thematicFeature = new Theme_Theme[me.symbolType](feature, me, [me.themeField], me.symbolSetting);
  75786. }
  75787. // thematicFeature 是否创建成功
  75788. if (!thematicFeature) {
  75789. return false;
  75790. }
  75791. // 对专题要素执行图形装载
  75792. thematicFeature.assembleShapes();
  75793. return thematicFeature;
  75794. }
  75795. });
  75796. var rankSymbolThemeLayer = function (name, symbolType, options) {
  75797. return new RankSymbolThemeLayer(name, symbolType, options);
  75798. };
  75799. (external_L_default()).supermap.rankSymbolThemeLayer = rankSymbolThemeLayer;
  75800. ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/SVGRenderer.js
  75801. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  75802. * This program are made available under the terms of the Apache License, Version 2.0
  75803. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75804. /**
  75805. * @class L.supermap.SVGRenderer
  75806. * @classdesc 矢量图层缩放渲染器类。
  75807. * @category Visualization VectorTile
  75808. * @private
  75809. * @extends {L.SVG}
  75810. * @param {Object} tileCoord - 切片坐标系。
  75811. * @param {number} tileSize - 切片大小。
  75812. * @param {Object} options - 渲染参数。
  75813. */
  75814. var SVGRenderer = external_L_default().SVG.extend({
  75815. initialize: function (tileCoord, tileSize, options) {
  75816. external_L_default().SVG.prototype.initialize.call(this, options);
  75817. this._tileCoord = tileCoord;
  75818. this._size = tileSize;
  75819. this._initContainer();
  75820. this._container.setAttribute('width', this._size.x);
  75821. this._container.setAttribute('height', this._size.y);
  75822. this._container.setAttribute('viewBox', [0, 0, this._size.x, this._size.y].join(' '));
  75823. this._layers = {};
  75824. },
  75825. /**
  75826. * @function L.supermap.SVGRenderer.prototype.getCoord
  75827. * @description 获取坐标。
  75828. */
  75829. getCoord: function () {
  75830. return this._tileCoord;
  75831. },
  75832. /**
  75833. * @function L.supermap.SVGRenderer.prototype.getContainer
  75834. * @description 获取容器。
  75835. */
  75836. getContainer: function () {
  75837. return this._container;
  75838. },
  75839. onAdd: (external_L_default()).Util.falseFn,
  75840. /**
  75841. * @function L.supermap.SVGRenderer.prototype.addTo
  75842. * @description 添加到地图。
  75843. * @param {L.Map} map - map 对象。
  75844. */
  75845. addTo: function (map) {
  75846. this._map = map;
  75847. if (this.options.interactive) {
  75848. for (var i in this._layers) {
  75849. var layer = this._layers[i];
  75850. layer._path.style.pointerEvents = 'auto';
  75851. this._map._targets[external_L_default().stamp(layer._path)] = layer;
  75852. }
  75853. }
  75854. },
  75855. /**
  75856. * @function L.supermap.SVGRenderer.prototype.removeFrom
  75857. * @description 从地图移除。
  75858. * @param {L.Map} map - map 对象。
  75859. */
  75860. removeFrom: function (map) {
  75861. var _map = map || this._map;
  75862. if (this.options.interactive) {
  75863. for (var i in this._layers) {
  75864. var layer = this._layers[i];
  75865. delete _map._targets[external_L_default().stamp(layer._path)];
  75866. }
  75867. }
  75868. delete this._map;
  75869. },
  75870. _addPath: function (layer) {
  75871. if (!this._rootGroup) {
  75872. this._initContainer();
  75873. }
  75874. if (!this._rootGroup) {
  75875. this._rootGroup = this._container;
  75876. }
  75877. this._rootGroup.appendChild(layer._path);
  75878. this._layers[external_L_default().stamp(layer)] = layer;
  75879. },
  75880. _updateIcon: function (layer) {
  75881. var path = layer._path = external_L_default().SVG.create('image'),
  75882. options = layer.options,
  75883. iconUrl = options.iconUrl;
  75884. if (options.iconSize) {
  75885. var size = external_L_default().point(options.iconSize),
  75886. anchor = size && size.divideBy(2, true),
  75887. p = layer._point.subtract(anchor);
  75888. path.setAttribute('x', p.x);
  75889. path.setAttribute('y', p.y);
  75890. path.setAttribute('width', size.x + 'px');
  75891. path.setAttribute('height', size.y + 'px');
  75892. } else {
  75893. var img = new Image();
  75894. img.src = iconUrl;
  75895. external_L_default().DomEvent.on(img, 'load', function () {
  75896. var size = external_L_default().point([img.width, img.height]),
  75897. anchor = size && size.divideBy(2, true),
  75898. p = layer._point.subtract(anchor);
  75899. path.setAttribute('x', p.x);
  75900. path.setAttribute('y', p.y);
  75901. path.setAttribute('width', size.x + 'px');
  75902. path.setAttribute('height', size.y + 'px');
  75903. });
  75904. }
  75905. path.setAttribute('href', iconUrl);
  75906. }
  75907. });
  75908. ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/CanvasRenderer.js
  75909. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  75910. * This program are made available under the terms of the Apache License, Version 2.0
  75911. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75912. /**
  75913. * @class L.supermap.CanvasRenderer
  75914. * @private
  75915. * @classdesc 画布渲染器。
  75916. * @category Visualization VectorTile
  75917. * @extends {L.Canvas}
  75918. * @param {Object} tileCoord - 切片坐标系
  75919. * @param {number} tileSize - 切片大小
  75920. * @param {Object} options - 渲染器参数
  75921. */
  75922. var CanvasRenderer = external_L_default().Canvas.extend({
  75923. initialize: function (tileCoord, tileSize, options) {
  75924. external_L_default().Canvas.prototype.initialize.call(this, options);
  75925. this._tileCoord = tileCoord;
  75926. this._size = tileSize;
  75927. this._initContainer();
  75928. this._container.setAttribute('width', this._size.x);
  75929. this._container.setAttribute('height', this._size.y);
  75930. this._layers = {};
  75931. this._drawnLayers = {};
  75932. this._drawing = true;
  75933. if (options.interactive) {
  75934. this._container.style.pointerEvents = 'auto';
  75935. }
  75936. },
  75937. /**
  75938. * @function L.supermap.CanvasRenderer.prototype.getCoord
  75939. * @description 获取坐标。
  75940. */
  75941. getCoord: function () {
  75942. return this._tileCoord;
  75943. },
  75944. /**
  75945. * @function L.supermap.CanvasRenderer.prototype.getContainer
  75946. * @description 获取容器。
  75947. */
  75948. getContainer: function () {
  75949. return this._container;
  75950. },
  75951. /**
  75952. * @function L.supermap.CanvasRenderer.prototype.getOffset
  75953. * @description 停止渲染。
  75954. */
  75955. getOffset: function () {
  75956. return this._tileCoord.scaleBy(this._size).subtract(this._map.getPixelOrigin());
  75957. },
  75958. onAdd: (external_L_default()).Util.falseFn,
  75959. /**
  75960. * @function L.supermap.CanvasRenderer.prototype.addTo
  75961. * @description 添加到地图。
  75962. * @param {L.Map} map - map 对象。
  75963. */
  75964. addTo: function (map) {
  75965. this._map = map;
  75966. },
  75967. /**
  75968. * @function L.supermap.CanvasRenderer.prototype.removeFrom
  75969. * @description 从地图移除。
  75970. * @param {L.Map} map - map 对象。
  75971. */
  75972. removeFrom: function (map) { // eslint-disable-line no-unused-vars
  75973. delete this._map;
  75974. },
  75975. _updateDashArray: function (layer) {
  75976. var array = layer.options.dashArray;
  75977. if (array && typeof array === "string") {
  75978. var parts = array.split(','),
  75979. dashArray = [],
  75980. i;
  75981. for (i = 0; i < parts.length; i++) {
  75982. dashArray.push(Number(parts[i]));
  75983. }
  75984. layer.options._dashArray = dashArray;
  75985. } else {
  75986. layer.options._dashArray = array;
  75987. }
  75988. },
  75989. _onClick: function (e) {
  75990. var point = this._map.mouseEventToLayerPoint(e).subtract(this.getOffset()), layer, clickedLayer;
  75991. for (var id in this._layers) {
  75992. layer = this._layers[id];
  75993. if (layer.options.interactive && layer._containsPoint(point) && !this._map._draggableMoved(layer)) {
  75994. clickedLayer = layer;
  75995. }
  75996. }
  75997. if (clickedLayer) {
  75998. external_L_default().DomEvent.stop(e);
  75999. this._fireEvent([clickedLayer], e);
  76000. }
  76001. },
  76002. _onMouseMove: function (e) {
  76003. if (!this._map || this._map.dragging.moving() || this._map._animatingZoom) {
  76004. return;
  76005. }
  76006. var point = this._map.mouseEventToLayerPoint(e).subtract(this.getOffset());
  76007. this._handleMouseHover(e, point);
  76008. },
  76009. _updateIcon: function (layer) {
  76010. if (!this._drawing) {
  76011. return;
  76012. }
  76013. var options = layer.options,
  76014. ctx = this._ctx,
  76015. img = layer._getImage();
  76016. if (options.iconSize && img.complete) {
  76017. var size = external_L_default().point(options.iconSize),
  76018. anchor = size && size.divideBy(2, true),
  76019. p = layer._point.subtract(anchor);
  76020. ctx.drawImage(img, p.x, p.y, size.x, size.y);
  76021. } else {
  76022. external_L_default().DomEvent.on(img, 'load', function () {
  76023. var size = external_L_default().point([img.width, img.height]),
  76024. anchor = size && size.divideBy(2, true),
  76025. p = layer._point.subtract(anchor);
  76026. ctx.drawImage(img, p.x, p.y, size.x, size.y);
  76027. });
  76028. }
  76029. this._drawnLayers[layer._leaflet_id] = layer;
  76030. }
  76031. });
  76032. ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/VectorFeatureType.js
  76033. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  76034. * This program are made available under the terms of the Apache License, Version 2.0
  76035. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76036. /**
  76037. * @constant L.supermap.VectorFeatureType
  76038. * @description 矢量图层要素类型,和 SuperMap.CartoStyleMap 中的类型相对应。
  76039. * @category Visualization VectorTile
  76040. * @private
  76041. */
  76042. var VectorFeatureType = {
  76043. LABEL: "LABEL",//label实际处理成TEXT
  76044. TEXT: "TEXT",
  76045. POINT: "POINT",
  76046. LINE: "LINE",
  76047. REGION: "REGION"
  76048. };
  76049. ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/Symbolizer.js
  76050. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  76051. * This program are made available under the terms of the Apache License, Version 2.0
  76052. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76053. /**
  76054. * @class L.supermap.Symbolizer
  76055. * @description 符号类。
  76056. * @category Visualization VectorTile
  76057. * @private
  76058. * @extends {L.Class}
  76059. * @param {Object} feature — 要素。
  76060. */
  76061. var Symbolizer = external_L_default().Class.extend({
  76062. initialize: function (feature) {
  76063. this.properties = feature.properties;
  76064. this.type = feature.type;
  76065. this.layerName = feature.layerName;
  76066. },
  76067. /**
  76068. * @function L.supermap.Symbolizer.prototype.render
  76069. * @description 绘制线符号。
  76070. * @param {Object} renderer - 渲染器。
  76071. * @param {string} style - 符号样式。
  76072. */
  76073. render: function (renderer, style) {
  76074. this._renderer = renderer;
  76075. this._container = renderer._container;
  76076. this.options = style;
  76077. renderer._initPath(this);
  76078. renderer._updateStyle(this);
  76079. var elem = this.getElement();
  76080. if (elem && this.layerName) {
  76081. external_L_default().DomUtil.addClass(elem, this.layerName);
  76082. }
  76083. },
  76084. /**
  76085. * @function L.supermap.Symbolizer.prototype.updateStyle
  76086. * @description 更新替换符号样式。
  76087. * @param {Object} renderer - 渲染器。
  76088. * @param {string} style - 符号样式。
  76089. */
  76090. updateStyle: function (renderer, style) {
  76091. this.options = style;
  76092. renderer._updateStyle(this);
  76093. },
  76094. /**
  76095. * @function L.supermap.Symbolizer.prototype.getElement
  76096. * @description 获取文本信息。
  76097. */
  76098. getElement: function () {
  76099. return this._path || this._renderer._container;
  76100. },
  76101. _getPixelBounds: function () {
  76102. var parts = this._parts;
  76103. var bounds = external_L_default().bounds([]);
  76104. for (var i = 0; i < parts.length; i++) {
  76105. var part = parts[i];
  76106. for (var j = 0; j < part.length; j++) {
  76107. bounds.extend(part[j]);
  76108. }
  76109. }
  76110. var w = this._clickTolerance(),
  76111. p = new (external_L_default()).Point(w, w);
  76112. bounds.min._subtract(p);
  76113. bounds.max._add(p);
  76114. return bounds;
  76115. },
  76116. _clickTolerance: (external_L_default()).Path.prototype._clickTolerance
  76117. });
  76118. ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/TextSymbolizer.js
  76119. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  76120. * This program are made available under the terms of the Apache License, Version 2.0
  76121. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76122. /**
  76123. * @class L.supermap.TextSymbolizer
  76124. * @classdesc 文本符号类。
  76125. * @category Visualization VectorTile
  76126. * @private
  76127. * @extends {L.Path}
  76128. * @param {Object} feature - 要素。
  76129. * @param {number} pxPerExtent - 文本符号大小。
  76130. */
  76131. var TextSymbolizer = external_L_default().Path.extend({
  76132. /**
  76133. * @member L.supermap.TextSymbolizer.prototype.includes
  76134. * @description 包含符号。
  76135. */
  76136. includes: Symbolizer.prototype,
  76137. options: {
  76138. color: 'white',
  76139. fillColor: 'black',
  76140. fill: true,
  76141. fillOpacity: 1,
  76142. opacity: 0.6,
  76143. weight: 1,
  76144. rotation: 0.0,
  76145. stroke: true,
  76146. fontFamily: "Arial Unicode MS Regular",
  76147. fontSize: 14,
  76148. fontWeight: 'normal',
  76149. textAlign: 'center',
  76150. offsetX: 1,
  76151. offsetY: 1
  76152. },
  76153. initialize: function (feature, pxPerExtent) {
  76154. Symbolizer.prototype.initialize.call(this, feature);
  76155. this._makeFeatureParts(feature, pxPerExtent);
  76156. this.options.offsetX = pxPerExtent || 1;
  76157. this.options.offsetY = pxPerExtent || 1;
  76158. },
  76159. /**
  76160. * @function L.supermap.TextSymbolizer.prototype.render
  76161. * @description 绘制点符号。
  76162. * @param {Object} renderer - 渲染器。
  76163. * @param {string} style - 符号样式。
  76164. */
  76165. render: function (renderer, style) {
  76166. //原本类型就是text的情况
  76167. if (this.properties.texts) {
  76168. this._text = this.properties.texts[0];
  76169. }
  76170. //类型是label的情况
  76171. if (!this._text) {
  76172. var attributes = this.properties.attributes;
  76173. this._text = (attributes && this.properties.textField) ?
  76174. attributes[this.properties.textField] || "" : "";
  76175. }
  76176. var options = this.options;
  76177. this._pxBounds = external_L_default().bounds(this._point, this._point);
  76178. Symbolizer.prototype.render.apply(this, [renderer, style]);
  76179. this.options = external_L_default().Util.extend(options, style);
  76180. this._updatePath();
  76181. },
  76182. _makeFeatureParts: function (feat, pxPerExtent) {
  76183. pxPerExtent = pxPerExtent || {x: 1, y: 1};
  76184. var coord = feat.geometry[0];
  76185. if (typeof coord[0] === 'object' && 'x' in coord[0]) {
  76186. this._point = external_L_default().point(coord[0]).scaleBy(pxPerExtent);
  76187. this._empty = (external_L_default()).Util.falseFn;
  76188. } else {
  76189. this._point = external_L_default().point(coord).scaleBy(pxPerExtent);
  76190. this._empty = (external_L_default()).Util.falseFn;
  76191. }
  76192. },
  76193. /**
  76194. * @function L.supermap.TextSymbolizer.prototype.makeInteractive
  76195. * @description 设置交互。
  76196. */
  76197. makeInteractive: function () {
  76198. this._updateBounds();
  76199. },
  76200. /**
  76201. * @function L.supermap.TextSymbolizer.prototype.updateStyle
  76202. * @description 更新替换符号样式。
  76203. * @param {Object} renderer - 渲染器。
  76204. * @param {string} style - 符号样式。
  76205. */
  76206. updateStyle: function (renderer, style) {
  76207. this._updateBounds();
  76208. return Symbolizer.prototype.updateStyle.call(this, renderer, style);
  76209. },
  76210. _updateBounds: function () {
  76211. var w = this._renderer._getTextWidth(this);
  76212. var p = [w / 2, w / 2];
  76213. this._pxBounds = external_L_default().bounds(this._point.subtract(p), this._point.add(p));
  76214. },
  76215. _updatePath: function () {
  76216. this._renderer._updateText(this);
  76217. },
  76218. _containsPoint: function (point) { // eslint-disable-line no-unused-vars
  76219. return false;
  76220. }
  76221. });
  76222. CanvasRenderer.include({
  76223. _getTextWidth: function (layer) {
  76224. return this._ctx.measureText(layer._text).width;
  76225. },
  76226. _updateText: function (layer) {
  76227. if (!this._drawing || layer._empty()) {
  76228. return;
  76229. }
  76230. var container = this.getContainer();
  76231. var size = this._map.getSize();
  76232. container.width = size.x;
  76233. container.height = size.y;
  76234. container.style.width = size.x + 'px';
  76235. container.style.height = size.y + 'px';
  76236. var ctx = this._ctx,
  76237. options = layer.options,
  76238. offsetX = options.offsetX || 1,
  76239. offsetY = options.offsetY || 1,
  76240. p = layer._point.subtract(external_L_default().point(offsetX, offsetY));
  76241. if (!options.fill) {
  76242. return;
  76243. }
  76244. this._drawnLayers[layer._leaflet_id] = layer;
  76245. ctx.fillRect(0, 0, size.x, size.y);
  76246. ctx.font = [
  76247. options.fontWeight ? options.fontWeight : "normal",
  76248. options.fontSize ? options.fontSize : "14px",
  76249. options.fontFamily ? options.fontFamily : "Arial Unicode MS Regular,Microsoft Yahei"
  76250. ].join(" ");
  76251. ctx.textAlign = options.textAlign;
  76252. ctx.lineWidth = options.weight;
  76253. ctx.fillStyle = options.fillColor;
  76254. ctx.fillText(layer._text, p.x, p.y);
  76255. ctx.strokeStyle = options.color;
  76256. ctx.strokeText(layer._text, p.x, p.y);
  76257. ctx.rotate(options.rotation);
  76258. }
  76259. });
  76260. SVGRenderer.include({
  76261. _getTextWidth: function (layer) {
  76262. return layer._path.getComputedTextLength() || 0;
  76263. },
  76264. _initPath: function (layer) {
  76265. var path;
  76266. if (TextSymbolizer && layer instanceof TextSymbolizer) {
  76267. path = layer._path = external_L_default().SVG.create("text");
  76268. path.textContent = layer._text;
  76269. } else {
  76270. path = layer._path = external_L_default().SVG.create("path");
  76271. }
  76272. if (layer.options.className) {
  76273. external_L_default().DomUtil.addClass(path, layer.options.className);
  76274. }
  76275. if (layer.options.interactive) {
  76276. external_L_default().DomUtil.addClass(path, 'leaflet-interactive');
  76277. }
  76278. this._updateStyle(layer);
  76279. this._layers[external_L_default().stamp(layer)] = layer;
  76280. },
  76281. _updateText: function (layer) {
  76282. var path = layer._path,
  76283. options = layer.options,
  76284. offsetX = options.offsetX || 1,
  76285. offsetY = options.offsetY || 1,
  76286. p = layer._point.subtract(external_L_default().point(offsetX, offsetY));
  76287. path.setAttribute('x', p.x);
  76288. path.setAttribute('y', p.y);
  76289. options.rotation = options.rotation || 0;
  76290. path.setAttribute('transform', 'rotate(' + options.rotation / Math.PI * 180 + ' ' + p.x + ' ' + p.y + ')');
  76291. path.setAttribute('text-anchor', options.textAlign === 'center' ? 'middle' : options.textAlign);
  76292. path.style.fontSize = options.fontSize;
  76293. path.style.fontFamily = options.fontFamily;
  76294. path.style.fontWeight = options.fontWeight || "normal";
  76295. path.style.glyphOrientationVertical = options.rotation||'';
  76296. if (options.stroke) {
  76297. path.setAttribute('stroke', options.color);
  76298. path.setAttribute('stroke-linecap', 'round');
  76299. path.setAttribute('stroke-linejoin', 'round');
  76300. path.setAttribute('stroke-opacity', options.opacity);
  76301. path.setAttribute('stroke-width', options.weight > 1 ? options.weight / 10 : options.weight);
  76302. } else {
  76303. path.setAttribute('stroke', 'none');
  76304. }
  76305. if (options.fill) {
  76306. path.setAttribute('fill', options.fillColor || options.color);
  76307. path.setAttribute('fill-opacity', options.fillOpacity);
  76308. } else {
  76309. path.setAttribute('fill', 'none');
  76310. }
  76311. }
  76312. });
  76313. ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/PointSymbolizer.js
  76314. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  76315. * This program are made available under the terms of the Apache License, Version 2.0
  76316. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76317. /**
  76318. * @class L.supermap.PointSymbolizer
  76319. * @classdesc 点符号类。
  76320. * @category Visualization VectorTile
  76321. * @private
  76322. * @extends {L.CircleMarker}
  76323. * @param {Object} feature - 点要素。
  76324. * @param {number} pxPerExtent - 点符号大小。
  76325. */
  76326. var PointSymbolizer = external_L_default().CircleMarker.extend({
  76327. /**
  76328. * @member L.supermap.PointSymbolizer.prototype.includes
  76329. * @description 包含符号。
  76330. */
  76331. includes: Symbolizer.prototype,
  76332. statics: {
  76333. iconCache: {}
  76334. },
  76335. initialize: function (feature, pxPerExtent) {
  76336. Symbolizer.prototype.initialize.call(this, feature);
  76337. this._makeFeatureParts(feature, pxPerExtent);
  76338. },
  76339. getLatLng: undefined,
  76340. /**
  76341. * @function L.supermap.PointSymbolizer.prototype.render
  76342. * @description 绘制点符号。
  76343. * @param {Object} renderer - 渲染器。
  76344. * @param {string} style - 符号样式。
  76345. */
  76346. render: function (renderer, style) {
  76347. Symbolizer.prototype.render.call(this, renderer, style);
  76348. this._radius = style.radius || (external_L_default()).CircleMarker.prototype.options.radius;
  76349. this._updatePath();
  76350. },
  76351. _makeFeatureParts: function (feat, pxPerExtent) {
  76352. pxPerExtent = pxPerExtent || {x: 1, y: 1};
  76353. var coord = feat.geometry[0];
  76354. if (typeof coord[0] === 'object' && 'x' in coord[0]) {
  76355. this._point = external_L_default().point(coord[0]).scaleBy(pxPerExtent);
  76356. this._empty = (external_L_default()).Util.falseFn;
  76357. } else {
  76358. this._point = external_L_default().point(coord).scaleBy(pxPerExtent);
  76359. this._empty = (external_L_default()).Util.falseFn;
  76360. }
  76361. },
  76362. /**
  76363. * @function L.supermap.PointSymbolizer.prototype.makeInteractive
  76364. * @description 设置交互。
  76365. */
  76366. makeInteractive: function () {
  76367. this._updateBounds();
  76368. },
  76369. /**
  76370. * @function L.supermap.PointSymbolizer.prototype.updateStyle
  76371. * @description 更新替换符号样式。
  76372. * @param {Object} renderer - 渲染器。
  76373. * @param {string} style - 符号样式。
  76374. */
  76375. updateStyle: function (renderer, style) {
  76376. this._radius = style.radius || this._radius;
  76377. this._updateBounds();
  76378. return Symbolizer.prototype.updateStyle.call(this, renderer, style);
  76379. },
  76380. _updateBounds: function () {
  76381. var icon = this.options.iconUrl;
  76382. if (icon && this.options.iconSize) {
  76383. var size = external_L_default().point(this.options.iconSize),
  76384. anchor = size && size.divideBy(2, true),
  76385. p = this._point.subtract(anchor);
  76386. this._pxBounds = new (external_L_default()).Bounds(p, p.add(size));
  76387. } else {
  76388. external_L_default().CircleMarker.prototype._updateBounds.call(this);
  76389. }
  76390. },
  76391. _updatePath: function () {
  76392. if (this.options.iconUrl) {
  76393. this._renderer._updateIcon(this)
  76394. } else {
  76395. external_L_default().CircleMarker.prototype._updatePath.call(this);
  76396. }
  76397. },
  76398. _getImage: function () {
  76399. if (!this.options.iconUrl) {
  76400. return null;
  76401. }
  76402. var url = this.options.iconUrl,
  76403. img = PointSymbolizer.iconCache[url];
  76404. if (!img) {
  76405. var iconSize = this.options.iconSize || [50, 50];
  76406. img = PointSymbolizer.iconCache[url] = this._createIcon(url, iconSize);
  76407. }
  76408. return img;
  76409. },
  76410. _createIcon: function (url, iconSize) {
  76411. var src = url;
  76412. if (!src) {
  76413. throw new Error('iconUrl not set in Icon options (see the docs).');
  76414. }
  76415. var img = document.createElement('img'), name = "icon";
  76416. img.src = src;
  76417. img.className = 'leaflet-marker-' + name + ' ' + (this.layerName || '');
  76418. // var options = this.options;
  76419. var sizeOption = iconSize;
  76420. if (typeof sizeOption === 'number') {
  76421. sizeOption = [sizeOption, sizeOption];
  76422. }
  76423. if (sizeOption) {
  76424. var size = external_L_default().point(sizeOption),
  76425. anchor = external_L_default().point(size && size.divideBy(2, true));
  76426. if (size) {
  76427. img.style.width = size.x + 'px';
  76428. img.style.height = size.y + 'px';
  76429. }
  76430. if (anchor) {
  76431. img.style.marginLeft = (-anchor.x) + 'px';
  76432. img.style.marginTop = (-anchor.y) + 'px';
  76433. }
  76434. }
  76435. img.onload = function () {
  76436. if (!sizeOption) {
  76437. img.style.width = this.width + 'px';
  76438. img.style.height = this.height + 'px';
  76439. }
  76440. };
  76441. return img;
  76442. },
  76443. _containsPoint: function (p) {
  76444. var icon = this.options.iconUrl;
  76445. if (icon) {
  76446. return this._pxBounds.contains(p);
  76447. } else {
  76448. return external_L_default().CircleMarker.prototype._containsPoint.call(this, p);
  76449. }
  76450. }
  76451. });
  76452. ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/SymbolizerPolyBase.js
  76453. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  76454. * This program are made available under the terms of the Apache License, Version 2.0
  76455. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76456. /**
  76457. * @class L.supermap.PolyBase
  76458. * @classdesc 多边形基类。
  76459. * @category Visualization VectorTile
  76460. * @private
  76461. */
  76462. //@type {{_makeFeatureParts: PolyBase._makeFeatureParts, makeInteractive: PolyBase.makeInteractive}}
  76463. var PolyBase = {
  76464. _makeFeatureParts: function (feat, pxPerExtent) {
  76465. pxPerExtent = pxPerExtent || {x: 1, y: 1};
  76466. var rings = feat.geometry;
  76467. var coord;
  76468. this._parts = [];
  76469. for (var i = 0; i < rings.length; i++) {
  76470. var ring = rings[i];
  76471. var part = [];
  76472. for (var j = 0; j < ring.length; j++) {
  76473. coord = ring[j];
  76474. part.push(external_L_default().point(coord).scaleBy(pxPerExtent));
  76475. }
  76476. this._parts.push(part);
  76477. }
  76478. },
  76479. /**
  76480. * @function L.supermap.PolyBase.prototype.makeInteractive
  76481. * @description 设置交互。
  76482. */
  76483. makeInteractive: function () {
  76484. this._pxBounds = this._getPixelBounds();
  76485. }
  76486. };
  76487. ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/LineSymbolizer.js
  76488. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  76489. * This program are made available under the terms of the Apache License, Version 2.0
  76490. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76491. /**
  76492. * @class L.supermap.LineSymbolizer
  76493. * @classdesc 线符号类。
  76494. * @category Visualization VectorTile
  76495. * @private
  76496. * @extends {L.Polyline}
  76497. * @param {Object} feature - 线要素。
  76498. * @param {number} pxPerExtent - 线长。
  76499. */
  76500. var LineSymbolizer = external_L_default().Polyline.extend({
  76501. /**
  76502. * @member L.supermap.LineSymbolizer.prototype.includes
  76503. * @description 包含符号。
  76504. */
  76505. includes: [Symbolizer.prototype, PolyBase],
  76506. initialize: function (feature, pxPerExtent) {
  76507. Symbolizer.prototype.initialize.call(this, feature);
  76508. this._makeFeatureParts(feature, pxPerExtent);
  76509. },
  76510. /**
  76511. * @function L.supermap.LineSymbolizer.prototype.render
  76512. * @description 绘制线符号。
  76513. * @param {Object} renderer - 渲染器。
  76514. * @param {string} style - 符号样式。
  76515. */
  76516. render: function (renderer, style) {
  76517. style.fill = false;
  76518. Symbolizer.prototype.render.call(this, renderer, style);
  76519. this._updatePath();
  76520. },
  76521. /**
  76522. * @function L.supermap.LineSymbolizer.prototype.updateStyle
  76523. * @description 更新替换符号样式。
  76524. * @param {Object} renderer - 渲染器。
  76525. * @param {string} style - 符号样式。
  76526. */
  76527. updateStyle: function (renderer, style) {
  76528. style.fill = false;
  76529. Symbolizer.prototype.updateStyle.call(this, renderer, style);
  76530. }
  76531. });
  76532. ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/RegionSymbolizer.js
  76533. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  76534. * This program are made available under the terms of the Apache License, Version 2.0
  76535. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76536. /**
  76537. * @class L.supermap.RegionSymbolizer
  76538. * @classdesc 面符号类。
  76539. * @category Visualization VectorTile
  76540. * @private
  76541. * @extends {L.Polygon}
  76542. * @param {Object} feature - 面要素。
  76543. * @param {number} pxPerExtent - 面积像素大小。
  76544. */
  76545. var RegionSymbolizer = external_L_default().Polygon.extend({
  76546. /**
  76547. * @member L.supermap.RegionSymbolizer.prototype.includes
  76548. * @description 包含符号。
  76549. */
  76550. includes: [Symbolizer.prototype, PolyBase],
  76551. initialize: function (feature, pxPerExtent) {
  76552. Symbolizer.prototype.initialize.call(this, feature);
  76553. this._makeFeatureParts(feature, pxPerExtent);
  76554. },
  76555. /**
  76556. * @function L.supermap.RegionSymbolizer.prototype.render
  76557. * @description 绘制面符号。
  76558. * @param {Object} renderer - 渲染器。
  76559. * @param {string} style - 符号样式。
  76560. */
  76561. render: function (renderer, style) {
  76562. Symbolizer.prototype.render.call(this, renderer, style);
  76563. this._updatePath();
  76564. }
  76565. });
  76566. // EXTERNAL MODULE: ./node_modules/pbf/index.js
  76567. var node_modules_pbf = __webpack_require__(614);
  76568. var pbf_default = /*#__PURE__*/__webpack_require__.n(node_modules_pbf);
  76569. // EXTERNAL MODULE: ./node_modules/@mapbox/vector-tile/index.js
  76570. var vector_tile = __webpack_require__(929);
  76571. ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/VectorTilePBF.js
  76572. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  76573. * This program are made available under the terms of the Apache License, Version 2.0
  76574. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76575. /**
  76576. * @class L.supermap.VectorTilePBF
  76577. * @classdesc 矢量瓦片 PBF(MVT) 表述出图。
  76578. * @category Visualization VectorTile
  76579. * @private
  76580. * @extends {L.Class}
  76581. * @param {string} url - 矢量瓦片 PBF(MVT) 表述出图服务地址。
  76582. */
  76583. var VectorTilePBF = external_L_default().Class.extend({
  76584. initialize: function (url) {
  76585. this.url = url;
  76586. },
  76587. /**
  76588. * @function L.supermap.VectorTilePBF.prototype.getTile
  76589. * @description 获取瓦片 PBF(MVT)。
  76590. * @returns {Promise} 返回包含矢量瓦片信息的 Promise 对象。
  76591. */
  76592. getTile: function () {
  76593. var me = this;
  76594. return FetchRequest.get(me.url, null, {
  76595. timeout: 10000
  76596. }).then(function (response) {
  76597. if (!response.ok) {
  76598. return {layers: []};
  76599. }
  76600. return response.blob().then(function (blob) {
  76601. var reader = new FileReader();
  76602. return new Promise(function (resolve) {
  76603. reader.addEventListener("loadend", function () {
  76604. var pbf = new (pbf_default())(reader.result);
  76605. return resolve(new vector_tile.VectorTile(pbf));
  76606. });
  76607. reader.readAsArrayBuffer(blob);
  76608. });
  76609. });
  76610. }).then(function (json) {
  76611. return me._processVectorTileSpec(json);
  76612. });
  76613. },
  76614. _processVectorTileSpec: function (vectorTile) {
  76615. var layers = [];
  76616. for (var layerName in vectorTile.layers) {
  76617. var feats = [];
  76618. for (var i = 0; i < vectorTile.layers[layerName].length; i++) {
  76619. var feat = vectorTile.layers[layerName].feature(i);
  76620. feat.geometry = feat.loadGeometry();
  76621. feat.layerName = layerName;
  76622. feat.properties = {attributes: external_L_default().Util.extend({}, feat.properties), id: feat.id};
  76623. switch (feat.type) {
  76624. case 1:
  76625. feat.type = VectorFeatureType.POINT;
  76626. break;
  76627. case 2:
  76628. feat.type = VectorFeatureType.LINE;
  76629. break;
  76630. case 3:
  76631. feat.type = VectorFeatureType.REGION;
  76632. break;
  76633. default:
  76634. break;
  76635. }
  76636. feats.push(feat);
  76637. }
  76638. var layer = {};
  76639. layer.features = feats;
  76640. layer.layerName = layerName;
  76641. layer.extent = vectorTile.layers[layerName].extent;
  76642. layers.push(layer);
  76643. }
  76644. return layers;
  76645. }
  76646. });
  76647. ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/VectorTileJSON.js
  76648. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  76649. * This program are made available under the terms of the Apache License, Version 2.0
  76650. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76651. /**
  76652. * @class L.supermap.VectorTileJSON
  76653. * @classdesc iServer 矢量瓦片 JSON 表述出图。
  76654. * @category Visualization VectorTile
  76655. * @private
  76656. * @extends {L.Class}
  76657. * @param {string} url - 矢量瓦片 JSON 表述服务地址。
  76658. */
  76659. var VectorTileJSON = external_L_default().Class.extend({
  76660. initialize: function (url) {
  76661. this.url = url;
  76662. },
  76663. /**
  76664. * @function L.supermap.VectorTileJSON.prototype.getTile
  76665. * @description 获取瓦片。
  76666. * @returns {Promise} 返回包含矢量瓦片信息的 Promise 对象。
  76667. */
  76668. getTile: function () {
  76669. var me = this;
  76670. return FetchRequest.get(me.url, null, {
  76671. timeout: 10000
  76672. }).then(function (response) {
  76673. return response.json()
  76674. }).then(function (json) {
  76675. return me._processRecordSets(json, me);
  76676. });
  76677. },
  76678. _processRecordSets: function (records, scope) {
  76679. var recordsets = records.recordsets;
  76680. // 如果iServer支持了tileFeature geojson表述则不需要此步骤
  76681. recordsets = scope._convertToGeoJSON(recordsets);
  76682. if (!recordsets) {
  76683. return null;
  76684. }
  76685. //类似VT标准的数据格式,并为每个要素添加一个layerName字段
  76686. for (var i = 0; i < recordsets.length; i++) {
  76687. var recordset = recordsets[i];
  76688. for (var j = 0; j < recordset.features.length; j++) {
  76689. var feature = recordset.features[j];
  76690. feature = scope._convertToVectorLayerFeature(feature, scope);
  76691. feature.layerName = recordset.layerName;
  76692. recordset.features[j] = feature;
  76693. }
  76694. recordset.extent = 256;
  76695. delete recordset.fieldTypes;
  76696. delete recordset.fields;
  76697. }
  76698. return recordsets;
  76699. },
  76700. _convertToVectorLayerFeature: function (feature, scope) {
  76701. if (!feature.geometry) {
  76702. return;
  76703. }
  76704. var newFeature = {};
  76705. var geom = feature.geometry,
  76706. type = geom.type,
  76707. coords = geom.coordinates,
  76708. tags = feature.properties,
  76709. id = tags.id,
  76710. i, j, rings, projectedRing;
  76711. if (type === 'Point') {
  76712. newFeature = (tags && tags.texts) ?
  76713. scope._createFeature(id, VectorFeatureType.TEXT, [coords], tags) :
  76714. scope._createFeature(id, VectorFeatureType.POINT, [coords], tags);
  76715. } else if (type === 'MultiPoint') {
  76716. newFeature = scope._createFeature(id, VectorFeatureType.POINT, coords, tags);
  76717. } else if (type === 'LineString') {
  76718. newFeature = scope._createFeature(id, VectorFeatureType.LINE, [coords], tags);
  76719. } else if (type === 'MultiLineString' || type === 'Polygon') {
  76720. rings = [];
  76721. for (i = 0; i < coords.length; i++) {
  76722. projectedRing = coords[i];
  76723. if (type === 'Polygon') {
  76724. projectedRing.outer = (i === 0);
  76725. }
  76726. rings.push(projectedRing);
  76727. }
  76728. var featureType = (type === 'Polygon') ?
  76729. VectorFeatureType.REGION :
  76730. VectorFeatureType.LINE;
  76731. newFeature = scope._createFeature(id, featureType, rings, tags);
  76732. } else if (type === 'MultiPolygon') {
  76733. rings = [];
  76734. for (i = 0; i < coords.length; i++) {
  76735. for (j = 0; j < coords[i].length; j++) {
  76736. projectedRing = coords[i][j];
  76737. projectedRing.outer = (j === 0);
  76738. rings.push(projectedRing);
  76739. }
  76740. }
  76741. newFeature = scope._createFeature(id, VectorFeatureType.REGION, rings, tags);
  76742. } else {
  76743. throw new Error('Illegal GeoJSON object');
  76744. }
  76745. return newFeature;
  76746. },
  76747. _convertToGeoJSON: function (recordsets) {
  76748. if (!recordsets) {
  76749. return;
  76750. }
  76751. for (var i = 0; i < recordsets.length; i++) {
  76752. var recordset = recordsets[i];
  76753. for (var j = 0; j < recordset.features.length; j++) {
  76754. var feature = recordset.features[j];
  76755. var points = [];
  76756. var startIndex = 0;
  76757. for (var k = 0; k < feature.geometry.parts.length; k++) {
  76758. var partPointsLength = feature.geometry.parts[k] * 2;
  76759. for (var l = 0, index = startIndex; l < partPointsLength; l += 2, index += 2) {
  76760. var x = feature.geometry.points[index];
  76761. var y = feature.geometry.points[index + 1];
  76762. points.push({x: x, y: y});
  76763. }
  76764. startIndex += partPointsLength;
  76765. }
  76766. feature.geometry.points = points;
  76767. }
  76768. recordset.features = toGeoJSON(recordset.features).features;
  76769. }
  76770. return recordsets;
  76771. },
  76772. _createFeature: function (id, type, geometry, properties) {
  76773. return {
  76774. id: id,
  76775. type: type,
  76776. geometry: geometry,
  76777. properties: properties
  76778. }
  76779. }
  76780. });
  76781. ;// CONCATENATED MODULE: ./src/leaflet/overlay/VectorTileFormat.js
  76782. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  76783. * This program are made available under the terms of the Apache License, Version 2.0
  76784. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76785. /**
  76786. * @constant L.supermap.vectorTileFormat
  76787. * @category Visualization TileVector
  76788. * @classdesc 矢量瓦片格式。
  76789. */
  76790. var VectorTileFormat = {
  76791. JSON: "JSON",
  76792. MVT: "MVT",
  76793. PBF: "PBF"
  76794. };
  76795. (external_L_default()).supermap.VectorTileFormat = VectorTileFormat;
  76796. ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/VectorTile.js
  76797. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  76798. * This program are made available under the terms of the Apache License, Version 2.0
  76799. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76800. /**
  76801. * @class L.supermap.VectorTile
  76802. * @classdesc 矢量瓦片图层基类。
  76803. * @category Visualization VectorTile
  76804. * @private
  76805. * @extends {L.Class}
  76806. * @param {Object} options - 矢量瓦片类构造可选参数。
  76807. * @param {string} [options.layer] - 图层名称。
  76808. * @param {(number|L.Point)} [options.tileSize=256] - 瓦片大小。
  76809. * @param {string} [options.format] - 返回值类型。
  76810. * @param {Object} [options.coords] - 坐标系统对象。
  76811. * @param {Object} [options.renderer] - 渲染器对象。
  76812. * @param {Function} done - 回调函数。
  76813. */
  76814. var VectorTile = external_L_default().Class.extend({
  76815. initialize: function (options, done) {
  76816. this.layer = options.layer;
  76817. this.tileSize = options.layer.getTileSize();
  76818. this.format = options.format;
  76819. this.coords = options.coords;
  76820. this.renderer = options.renderer;
  76821. this.done = done;
  76822. this.layer._textVectorTiles = {};
  76823. },
  76824. /**
  76825. * @function L.supermap.VectorTile.prototype.renderTile
  76826. * @description 渲染切片。
  76827. */
  76828. renderTile: function () {
  76829. var me = this, layer = me.layer, coords = me.coords;
  76830. var tileFeatureUrl = layer._getTileUrl(coords);
  76831. var format = [VectorTileFormat.MVT, VectorTileFormat.PBF];
  76832. var tileFeaturePromise;
  76833. if (format.indexOf(me.format.toUpperCase()) > -1) {
  76834. tileFeaturePromise = new VectorTilePBF(tileFeatureUrl);
  76835. } else {
  76836. tileFeaturePromise = new VectorTileJSON(tileFeatureUrl)
  76837. }
  76838. tileFeaturePromise.getTile().then(function (tileFeature) {
  76839. me.render(tileFeature, coords);
  76840. })
  76841. },
  76842. /**
  76843. * @function L.supermap.VectorTile.prototype.render
  76844. * @description 渲染切片要素。
  76845. * @param {Object} tileFeature - 要渲染的切片要素。
  76846. * @param {Object} coords - 切片坐标参数对象。
  76847. */
  76848. render: function (tileFeature, coords) {
  76849. if (!tileFeature) {
  76850. return;
  76851. }
  76852. var me = this,
  76853. renderer = me.renderer,
  76854. tileLayer = me.layer;
  76855. for (var k = 0; k < tileFeature.length; k++) {
  76856. var layer = tileFeature[k], layerName = layer.layerName;
  76857. tileLayer._dataLayerNames[layerName] = true;
  76858. var pxPerExtent = me.tileSize.divideBy(layer.extent);
  76859. var layerStyleInfo = tileLayer.getLayerStyleInfo(layer.layerName);
  76860. for (var i = 0; i < layer.features.length; i++) {
  76861. var feat = layer.features[i];
  76862. if (!feat) {
  76863. continue;
  76864. }
  76865. //标签图层处理为文本
  76866. if (layerStyleInfo && layerStyleInfo.type === VectorFeatureType.LABEL
  76867. && feat.type === VectorFeatureType.POINT
  76868. && feat.properties.attributes) {
  76869. feat.type = VectorFeatureType.TEXT;
  76870. }
  76871. var styleOptions = me._getStyleOptions(coords, feat, layerName, me);
  76872. if (!styleOptions.length) {
  76873. continue;
  76874. }
  76875. var featureLayer = me._createFeatureLayer(feat, pxPerExtent);
  76876. if (!featureLayer) {
  76877. continue;
  76878. }
  76879. // 保存文本图层单独绘制,避免被压盖
  76880. var param = {scope: me, coords: coords, renderer: renderer};
  76881. if (me._extractTextLayer(feat, featureLayer, styleOptions, param)) {
  76882. continue;
  76883. }
  76884. for (var j = 0; j < styleOptions.length; j++) {
  76885. var style = me._validateStyle(styleOptions[j], feat.type);
  76886. featureLayer.render(renderer, style);
  76887. renderer._addPath(featureLayer);
  76888. }
  76889. if (tileLayer.options.interactive) {
  76890. featureLayer.makeInteractive();
  76891. }
  76892. var featureKey = tileLayer._getFeatureKey(feat.id, layerName);
  76893. renderer._features[featureKey] = {
  76894. layerName: layerName,
  76895. feature: featureLayer
  76896. };
  76897. }
  76898. }
  76899. if (tileLayer._map) {
  76900. renderer.addTo(tileLayer._map);
  76901. }
  76902. external_L_default().Util.requestAnimFrame(me.done.bind(coords, null, me.layer._vectorTiles[me.layer._tileCoordsToKey(coords)]));
  76903. },
  76904. // 保存文本图层单独绘制,避免被压盖
  76905. _extractTextLayer: function (feat, featureLayer, style, param) {
  76906. if (feat.type !== VectorFeatureType.TEXT) {
  76907. return false;
  76908. }
  76909. var me = param.scope,
  76910. coords = param.coords,
  76911. tileLayer = me.layer,
  76912. key = tileLayer._tileCoordsToKey(coords);
  76913. var id = feat.id,
  76914. layerName = feat.layerName;
  76915. var textTileLayers = tileLayer._textVectorTiles[key];
  76916. if (!textTileLayers) {
  76917. textTileLayers = {
  76918. layers: {},
  76919. coords: coords,
  76920. renderer: param.renderer
  76921. };
  76922. }
  76923. // 不同瓦片可能请求到同一个文本图层,为避免重复绘制,只保存绘制最后一个
  76924. textTileLayers.layers[id] = {
  76925. layer: featureLayer,
  76926. style: style,
  76927. layerName: layerName
  76928. };
  76929. tileLayer._textVectorTiles[key] = textTileLayers;
  76930. return true;
  76931. },
  76932. _getStyleOptions: function (coords, feature, layerName, scope) {
  76933. var me = scope;
  76934. var tileLayer = me.layer;
  76935. var styleOptions = tileLayer.getVectorTileLayerStyle(coords, feature) || me._defaultStyle(feature.type);
  76936. //根据id和layerName识别唯一要素
  76937. var id = feature.id,
  76938. styleKey = tileLayer._getFeatureKey(id, layerName),
  76939. styleOverride = tileLayer._overriddenStyles[styleKey];
  76940. styleOptions = styleOverride ? styleOverride : styleOptions;
  76941. styleOptions = (styleOptions instanceof Function) ? styleOptions(feature.properties, coords.z) : styleOptions;
  76942. styleOptions = !(styleOptions instanceof Array) ? [styleOptions] : styleOptions;
  76943. return styleOptions;
  76944. },
  76945. _createFeatureLayer: function (feat, pxPerExtent) {
  76946. var layer;
  76947. switch (feat.type) {
  76948. case VectorFeatureType.POINT:
  76949. layer = new PointSymbolizer(feat, pxPerExtent);
  76950. break;
  76951. case VectorFeatureType.LINE:
  76952. layer = new LineSymbolizer(feat, pxPerExtent);
  76953. break;
  76954. case VectorFeatureType.REGION:
  76955. layer = new RegionSymbolizer(feat, pxPerExtent);
  76956. break;
  76957. case VectorFeatureType.TEXT:
  76958. layer = new TextSymbolizer(feat, pxPerExtent);
  76959. break;
  76960. default:
  76961. break;
  76962. }
  76963. var vectorLayer = this.layer;
  76964. if (layer && vectorLayer.options.interactive) {
  76965. layer.addEventParent(vectorLayer);
  76966. }
  76967. return layer;
  76968. },
  76969. //矫正一些参数
  76970. _validateStyle: function (style, type) {
  76971. //默认leaflet path的边宽为3,矩形颜色填充透明度为0.2,跟iClient不一样,故作调整
  76972. (external_L_default()).Path.prototype.options.weight = 1;
  76973. (external_L_default()).Path.prototype.options.fillOpacity = 1;
  76974. switch (type) {
  76975. case VectorFeatureType.POINT:
  76976. return external_L_default().extend({}, (external_L_default()).CircleMarker.prototype.options, style);
  76977. case VectorFeatureType.LINE:
  76978. return external_L_default().extend({}, (external_L_default()).Polyline.prototype.options, style);
  76979. case VectorFeatureType.REGION:
  76980. return external_L_default().extend({}, (external_L_default()).Polygon.prototype.options, style);
  76981. case VectorFeatureType.TEXT:
  76982. return external_L_default().extend({}, TextSymbolizer.prototype.options, style);
  76983. default:
  76984. break;
  76985. }
  76986. },
  76987. //如果cartoCSS和layerInfo都没有得到样式,则使用该默认样式
  76988. _defaultStyle: function (type) {
  76989. var defaultOptions = (external_L_default()).Path.prototype.options;
  76990. defaultOptions.weight = 1;
  76991. defaultOptions.fillOpacity = 1;
  76992. defaultOptions.radius = 3;
  76993. switch (type) {
  76994. case VectorFeatureType.POINT:
  76995. return external_L_default().extend({}, defaultOptions, (external_L_default()).CircleMarker.prototype.options);
  76996. case VectorFeatureType.LINE:
  76997. return external_L_default().extend({}, defaultOptions, (external_L_default()).Polyline.prototype.options);
  76998. case VectorFeatureType.REGION:
  76999. return external_L_default().extend({}, defaultOptions, (external_L_default()).Polygon.prototype.options);
  77000. case VectorFeatureType.TEXT:
  77001. return external_L_default().extend({}, defaultOptions, TextSymbolizer.prototype.options);
  77002. default:
  77003. break;
  77004. }
  77005. }
  77006. });
  77007. ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/VectorGrid.js
  77008. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  77009. * This program are made available under the terms of the Apache License, Version 2.0
  77010. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  77011. /**
  77012. * Inspired by https://github.com/Leaflet/Leaflet.VectorGrid
  77013. */
  77014. /**
  77015. * @class L.supermap.VectorGrid
  77016. * @classdesc 矢量瓦片图层基类。
  77017. * @category Visualization VectorTile
  77018. * @extends {L.GridLayer}
  77019. * @param {Object} options - 矢量瓦片图层基类参数。
  77020. * @param {Object} [options.vectorTileLayerStyles] - 矢量网片图层风格。
  77021. * @param {string} [options.renderer='SVG'] - 渲染器类型。
  77022. * @param {L.supermap.VectorTileFormat} [options.format=VectorTileFormat.JSON] - 矢量瓦片格式。
  77023. * @param {boolean} [options.interactive=true] - 是否可交互。
  77024. * @param {number} [options.maxZoom=23] - 最大缩放级别。
  77025. */
  77026. var VectorGrid = external_L_default().GridLayer.extend({
  77027. options: {
  77028. vectorTileLayerStyles: null,
  77029. //SVG or Canvas
  77030. renderer: "SVG",
  77031. format: VectorTileFormat.JSON,
  77032. interactive: true,
  77033. maxZoom:23
  77034. },
  77035. initialize: function (options) {
  77036. var me = this;
  77037. external_L_default().setOptions(me, options);
  77038. external_L_default().GridLayer.prototype.initialize.call(me, options);
  77039. me._vectorTiles = {};
  77040. //交互事件使用,键值为id_layerName
  77041. me._overriddenStyles = {};
  77042. me.vectorTileLayerStyles = me.options.vectorTileLayerStyles;
  77043. me.on('tileunload', function (e) {
  77044. var key = me._tileCoordsToKey(e.coords),
  77045. tile = me._vectorTiles[key];
  77046. if (tile && me._map) {
  77047. tile.removeFrom(me._map);
  77048. }
  77049. delete me._vectorTiles[key];
  77050. }, me);
  77051. me.on('tileerror ', me._renderText, me);
  77052. me.on('load', me._renderText, me);
  77053. me._dataLayerNames = {};
  77054. },
  77055. /**
  77056. * @private
  77057. * @function L.supermap.VectorGrid.prototype.createTile
  77058. * @description 创建切片图层。
  77059. * @param {Object} coords - 切片坐标参数对象。
  77060. * @param {Function} done - todo。
  77061. */
  77062. createTile: function (coords, done) {
  77063. var me = this;
  77064. var tileSize = me.getTileSize();
  77065. var renderer = null;
  77066. if (me.options.renderer === "Canvas") {
  77067. renderer = new CanvasRenderer(coords, tileSize, me.options);
  77068. } else {
  77069. renderer = new SVGRenderer(coords, tileSize, me.options);
  77070. }
  77071. me._vectorTiles[me._tileCoordsToKey(coords)] = renderer;
  77072. renderer._features = {};
  77073. new VectorTile({
  77074. layer: me,
  77075. format: me.options.format,
  77076. coords: coords,
  77077. renderer: renderer
  77078. }, done).renderTile();
  77079. return renderer.getContainer();
  77080. },
  77081. /**
  77082. * @function L.supermap.VectorGrid.prototype.getStyles
  77083. * @description 获取图层样式。
  77084. * @returns {Object} 所有图层的样式。
  77085. */
  77086. getStyles: function () {
  77087. return this.vectorTileLayerStyles;
  77088. },
  77089. /**
  77090. * @function L.supermap.VectorGrid.prototype.getStyle
  77091. * @description 获取指定图层样式。
  77092. * @param {string} layerName - 图层名称。
  77093. * @returns {Object} 指定图层的样式。
  77094. */
  77095. getStyle: function (layerName) {
  77096. return this.vectorTileLayerStyles && this.vectorTileLayerStyles[layerName];
  77097. },
  77098. /**
  77099. * @function L.supermap.VectorGrid.prototype.setFeatureStyle
  77100. * @description 设置要素风格,需要 ID 和 layerName 才能确定一个要素。
  77101. * @param {number} id - 要素 ID。
  77102. * @param {string} layerName - 图层名称。
  77103. * @param {(Array|Function)} layerStyle - 图层样式。
  77104. * @returns {this} this
  77105. */
  77106. setFeatureStyle: function (id, layerName, layerStyle) {
  77107. var featureKey = this._getFeatureKey(id, layerName);
  77108. this._overriddenStyles[featureKey] = layerStyle;
  77109. for (var tileKey in this._vectorTiles) {
  77110. var tile = this._vectorTiles[tileKey];
  77111. var features = tile._features;
  77112. var data = features[featureKey];
  77113. if (data) {
  77114. var feat = data.feature;
  77115. this._updateStyles(feat, tile, layerStyle);
  77116. }
  77117. }
  77118. return this;
  77119. },
  77120. /**
  77121. * @function L.supermap.VectorGrid.prototype.resetFeatureStyle
  77122. * @description 重绘要素风格,需要 ID 和 layerName 才能确定一个要素。
  77123. * @param {number} id - 要素 ID。
  77124. * @param {string} layerName - 图层名称。
  77125. * @returns {this} this
  77126. */
  77127. resetFeatureStyle: function (id, layerName) {
  77128. var featureKey = this._getFeatureKey(id, layerName);
  77129. delete this._overriddenStyles[featureKey];
  77130. for (var tileKey in this._vectorTiles) {
  77131. var tile = this._vectorTiles[tileKey];
  77132. var data = tile._features[featureKey];
  77133. if (data) {
  77134. var feat = data.feature;
  77135. var styleOptions = this.vectorTileLayerStyles[data.layerName];
  77136. this._updateStyles(feat, tile, styleOptions);
  77137. }
  77138. }
  77139. return this;
  77140. },
  77141. /**
  77142. * @function L.supermap.VectorGrid.prototype.getDataLayerNames
  77143. * @description 获取数据图层名字。
  77144. * @returns {Array} 返回数据图层名数组。
  77145. */
  77146. getDataLayerNames: function () {
  77147. return Object.keys(this._dataLayerNames);
  77148. },
  77149. _removeAllTiles: function () {
  77150. external_L_default().GridLayer.prototype._removeAllTiles.call(this);
  77151. this._textVectorTiles = {};
  77152. },
  77153. _renderText: function () {
  77154. var textVectorTiles = this._textVectorTiles;
  77155. for (var key in textVectorTiles) {
  77156. var textTiles = textVectorTiles[key];
  77157. var renderer = textTiles.renderer;
  77158. for (var layerId in textTiles.layers) {
  77159. var tile = textTiles.layers[layerId];
  77160. var styleOptions = tile.style,
  77161. featureLayer = tile.layer;
  77162. for (var j = 0; j < styleOptions.length; j++) {
  77163. featureLayer.render(renderer, styleOptions[j]);
  77164. renderer._addPath(featureLayer);
  77165. }
  77166. if (this.options.interactive) {
  77167. featureLayer.makeInteractive();
  77168. }
  77169. }
  77170. }
  77171. },
  77172. _getFeatureKey: function (id, layerName) {
  77173. id = id || 0;
  77174. layerName = layerName || "null";
  77175. return id + "_" + layerName;
  77176. },
  77177. _updateStyles: function (feat, renderer, styleOptions) {
  77178. styleOptions = (styleOptions instanceof Function) ?
  77179. styleOptions(feat.properties, renderer.getCoord().z) :
  77180. styleOptions;
  77181. if (!(styleOptions instanceof Array)) {
  77182. styleOptions = [styleOptions];
  77183. }
  77184. for (var j = 0; j < styleOptions.length; j++) {
  77185. var style = this._extendStyle(styleOptions[j], feat.type);
  77186. feat.updateStyle(renderer, style);
  77187. }
  77188. },
  77189. //矫正一些参数
  77190. _extendStyle: function (style, type) {
  77191. switch (type) {
  77192. case VectorFeatureType.POINT:
  77193. return external_L_default().extend({}, (external_L_default()).CircleMarker.prototype.options, style);
  77194. case VectorFeatureType.LINE:
  77195. return external_L_default().extend({}, (external_L_default()).Polyline.prototype.options, style);
  77196. case VectorFeatureType.REGION:
  77197. return external_L_default().extend({}, (external_L_default()).Polygon.prototype.options, style);
  77198. case VectorFeatureType.TEXT:
  77199. return external_L_default().extend({}, TextSymbolizer.prototype.options, style);
  77200. default:
  77201. break;
  77202. }
  77203. }
  77204. });
  77205. ;// CONCATENATED MODULE: ./src/leaflet/overlay/TileVectorLayer.js
  77206. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  77207. * This program are made available under the terms of the Apache License, Version 2.0
  77208. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  77209. /**
  77210. * @class L.supermap.tiledVectorLayer
  77211. * @classdesc SuperMap iServer 的矢量瓦片图层。
  77212. * @category Visualization VectorTile
  77213. * @extends L.supermap.VectorGrid
  77214. * @example
  77215. * L.supermap.tiledVectorLayer(url).addTo(map);
  77216. * @param {string} url - 图层数据服务地址。
  77217. * @param {Object} options - 图层参数。
  77218. * @param {string} options.layerNames - 指定图层的名称列表,支持的类型为矢量图层。
  77219. * @param {string} options.layersID - 获取进行切片的地图图层 ID。
  77220. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型。
  77221. * @param {string} [options.cartoCSS] - 客户端 CartoCSS 样式字符串。
  77222. * @param {boolean} [options.serverCartoCSSStyle=true] - 是否使用服务端 CartoCSS 样式。
  77223. * @param {boolean} [options.processCharacters=false] - 设置客户端 CartoCSS 样式时是否进行特定字符转换。
  77224. * @param {L.Proj.CRS} [options.crs] - 坐标系统类。
  77225. * @param {boolean} [options.returnAttributes=false] - 是否返回 attributes。
  77226. * @param {string} [options.expands] - expands。
  77227. * @param {boolean} [options.cacheEnabled=true] - 是否使用服务器缓存出图。
  77228. * @param {Object} [options.tileTemplate] - 瓦片模板,如果设置了此参数,则按此模板出图,URL 无效(对接第三方瓦片)。
  77229. * @param {string} [options.subdomains] - 子域名。
  77230. * @param {num} [options.timeout=10000] - timeout。
  77231. * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>`] - 版权信息。
  77232. */
  77233. var TileVectorLayer = VectorGrid.extend({
  77234. options: {
  77235. //服务器类型<SuperMap.ServerType>iServer|iPortal|Online
  77236. serverType: null,
  77237. crs: null,
  77238. //客户端cartocss样式
  77239. cartoCSS: null,
  77240. // 指定图层的名称列表。支持的类型为矢量图层
  77241. layerNames: null,
  77242. //获取进行切片的地图图层 ID
  77243. layersID: null,
  77244. //是否服务端CartoCSS样式,默认使用
  77245. serverCartoCSSStyle: true,
  77246. //设置客户端CartoCSS样式时是否进行特定字符转换
  77247. processCharacters: false,
  77248. returnAttributes: false,
  77249. /*各图层扩展的像素值。
  77250. *例如:
  77251. * 0_15:0_5,1_10:表示顶级0图层的0、1子图层扩展的像素分别为5、10像素;顶级0图层下,除0、1图层外的子图层的扩展像素都为15像素。
  77252. * 0:0_5,1_10:表示顶级0图层的0、1子图层扩展的像素分别为5、10像素;顶级0图层下,其他除0、1图层外的子图层的扩展像素为根据该图层默认样式计算得出的默认值。
  77253. */
  77254. expands: null,
  77255. cacheEnabled: false,
  77256. //瓦片模板,如果设置了此参数,则按此模板出图,url无效(对接第三方瓦片)
  77257. tileTemplate: null,
  77258. subdomains: 'abc',
  77259. timeout: 10000,
  77260. attribution: core_Attributions.Common.attribution
  77261. },
  77262. initialize: function (url, options) {
  77263. options = options || {};
  77264. options.noWrap = (options.noWrap == null) ? true : options.noWrap;
  77265. external_L_default().setOptions(this, options);
  77266. VectorGrid.prototype.initialize.call(this, options);
  77267. external_L_default().stamp(this);
  77268. var me = this;
  77269. if (!url || url.indexOf("http") < 0) {
  77270. url = "";
  77271. return this;
  77272. }
  77273. me.url = url;
  77274. if (url.indexOf("/") === (url.length - 1)) {
  77275. url = url.substr(0, url.length - 1);
  77276. me.url = url;
  77277. }
  77278. this.cartoCSSToLeaflet = new CartoCSSToLeaflet(me.url);
  77279. me.initLayersInfo();
  77280. if (!me.options.serverCartoCSSStyle && me.options.cartoCSS) {
  77281. me.setClientCartoCSS(me.options.cartoCSS);
  77282. }
  77283. },
  77284. /**
  77285. * @private
  77286. * @function L.supermap.tiledVectorLayer.prototype.onAdd
  77287. * @description 添加地图。
  77288. * @param {L.Map} map - 待添加的地图。
  77289. */
  77290. onAdd: function (map) {
  77291. this._crs = this.options.crs || map.options.crs;
  77292. this._map = map;
  77293. this._initLayerUrl();
  77294. if (this.options.tileTemplate || !this.options.serverCartoCSSStyle) {
  77295. this._initGrid();
  77296. }
  77297. },
  77298. /**
  77299. * @private
  77300. * @function L.supermap.tiledVectorLayer.prototype.initLayersInfo
  77301. * @description 获取服务器 layers 资源下的风格信息(当 CartoCSS 中不存在相应图层渲染信息时使用)。
  77302. */
  77303. initLayersInfo: function () {
  77304. var me = this;
  77305. var layersUrl = Util.urlPathAppend(me.url, "layers");
  77306. FetchRequest.get(layersUrl, null, {
  77307. timeout: me.options.timeout
  77308. }).then(function (response) {
  77309. return response.json();
  77310. }).then(function (json) {
  77311. me.layersInfoInitialized = true;
  77312. me.layersInfo = json;
  77313. if (!me.layersInfo) {
  77314. return;
  77315. }
  77316. var layersInfo = {};
  77317. for (var i = 0, len = me.layersInfo.length; i < len; i++) {
  77318. var layers = me.layersInfo[i].subLayers.layers;
  77319. for (var j = 0, len1 = layers.length; j < len1; j++) {
  77320. layers[j].layerIndex = len1 - j;
  77321. layersInfo[layers[j].name] = layers[j];
  77322. }
  77323. }
  77324. me.layersInfo = layersInfo;
  77325. me.cartoCSSToLeaflet.layersInfo = layersInfo;
  77326. if (me.options.serverCartoCSSStyle) {
  77327. me.getVectorStylesFromServer();
  77328. }
  77329. }).catch(function (ex) {
  77330. console.error('error', ex)
  77331. });
  77332. },
  77333. /**
  77334. * @function L.supermap.tiledVectorLayer.prototype.getLayerStyleInfo
  77335. * @description 获取图层样式信息。
  77336. * @param {string} layerName - 图层名称。
  77337. */
  77338. getLayerStyleInfo: function (layerName) {
  77339. var me = this,
  77340. layerInfo_simple;
  77341. me.layersStyles = me.layersStyles || {};
  77342. layerInfo_simple = me.layersStyles[layerName];
  77343. if (layerInfo_simple) {
  77344. return layerInfo_simple;
  77345. }
  77346. if (!me.layersInfo) {
  77347. return {};
  77348. }
  77349. var layerInfo = me.layersInfo[layerName];
  77350. if (!layerInfo) {
  77351. return null;
  77352. }
  77353. layerInfo_simple = {
  77354. layerIndex: layerInfo.layerIndex,
  77355. ugcLayerType: layerInfo.ugcLayerType
  77356. };
  77357. switch (layerInfo.ugcLayerType) {
  77358. case "VECTOR":
  77359. layerInfo_simple.layerStyle = layerInfo.style ? layerInfo.style : null;
  77360. break;
  77361. case "THEME":
  77362. var theme = layerInfo.theme;
  77363. //标注图层特别标明
  77364. layerInfo_simple.layerStyle = theme ? theme.defaultStyle : null;
  77365. if (theme && theme.type === "LABEL") {
  77366. layerInfo_simple.type = theme.type;
  77367. layerInfo_simple.textField = theme.labelExpression;
  77368. }
  77369. break;
  77370. default:
  77371. //SVTile发布出来的地图没有ugcLayerType属性
  77372. if (layerInfo.style) {
  77373. layerInfo_simple.layerStyle = layerInfo.style;
  77374. }
  77375. break;
  77376. }
  77377. me.layersStyles[layerName] = layerInfo_simple;
  77378. return layerInfo_simple;
  77379. },
  77380. /*
  77381. * @function L.supermap.tiledVectorLayer.prototype.getVectorStylesFromServer
  77382. * @description 等待服务器的 carto 返回之后拼接本地配置的 cartoCSS,并调用 onAdd 出图。
  77383. */
  77384. getVectorStylesFromServer: function () {
  77385. var me = this;
  77386. var vectorStyleUrl = Util.urlPathAppend(me.url, "tileFeature/vectorstyles");
  77387. FetchRequest.get(vectorStyleUrl, null, {
  77388. timeout: me.options.timeout
  77389. }).then(function (response) {
  77390. return response.json()
  77391. }).then(function (styles) {
  77392. if (!styles || !styles.style) {
  77393. return null;
  77394. }
  77395. if (styles.style && styles.type === 'cartoCSS') {
  77396. me.setServerCartoCSS(styles.style);
  77397. }
  77398. if (me.options) {
  77399. me.setClientCartoCSS(me.options.cartoCSS);
  77400. }
  77401. me._initGrid();
  77402. }).catch(function (ex) {
  77403. console.error('error', ex)
  77404. });
  77405. },
  77406. /**
  77407. * @private
  77408. * @function L.supermap.tiledVectorLayer.prototype.setServerCartoCSS
  77409. * @description 设置服务端获取到的 cartoCSS 样式,cartoCSS 请求回来之后自动调用。
  77410. */
  77411. setServerCartoCSS: function (cartoCSSStr) {
  77412. this.cartoCSSToLeaflet.pretreatedCartoCSS(cartoCSSStr, true);
  77413. },
  77414. /**
  77415. * @function L.supermap.tiledVectorLayer.prototype.setClientCartoCSS
  77416. * @description 客户端设置 cartoCSS 样式。
  77417. */
  77418. setClientCartoCSS: function (cartoCSSStr) {
  77419. let processCharacters = false;
  77420. if (this.options.processCharacters) {
  77421. processCharacters = this.options.processCharacters;
  77422. }
  77423. this.cartoCSSToLeaflet.pretreatedCartoCSS(cartoCSSStr, processCharacters);
  77424. },
  77425. /**
  77426. * @private
  77427. * @function L.supermap.tiledVectorLayer.prototype.getVectorTileLayerStyle
  77428. * @description 获取图层风格信息,当 CartoCSS 中包含有对该图层的渲染信息时,优先获取,否则获取 layers 资源下 layerSytle 的渲染信息。
  77429. * @param {Object} coords - 图层坐标参数对象。
  77430. * @param {Object} feature - 要获取的要素。
  77431. */
  77432. getVectorTileLayerStyle: function (coords, feature) {
  77433. if (!feature) {
  77434. return null;
  77435. }
  77436. var me = this,
  77437. layerName = feature.layerName,
  77438. layerStyleInfo = me.getLayerStyleInfo(layerName);
  77439. //处理标签图层
  77440. if (layerStyleInfo && layerStyleInfo.textField) {
  77441. var textField = layerStyleInfo.textField;
  77442. if (textField && textField.indexOf('.')) {
  77443. var arr = textField.split('.');
  77444. textField = arr && arr.length > 0 && arr[arr.length - 1];
  77445. }
  77446. feature.properties.textField = textField;
  77447. }
  77448. me.vectorTileLayerStyles = me.vectorTileLayerStyles || {};
  77449. var style = me.vectorTileLayerStyles[layerName];
  77450. if (style) {
  77451. feature = this._mergeFeatureTextField(feature, style);
  77452. return style;
  77453. }
  77454. // SuperMap.CartoCSSToLeaflet内部做了客户端配置的cartoCSS和服务端cartoCSS的拼接处理
  77455. // 客户端配置的cartoCSS会覆盖相应图层的服务端cartoCSS
  77456. var scale = this.getScaleFromCoords(coords);
  77457. var shaders = this.cartoCSSToLeaflet.pickShader(layerName) || [];
  77458. style = [];
  77459. for (var itemKey in shaders) {
  77460. var shader = shaders[itemKey];
  77461. for (var j = 0; j < shader.length; j++) {
  77462. var serverStyle = this.cartoCSSToLeaflet.getValidStyleFromCarto(coords.z, scale, shader[j], feature,this.options.serverCartoCSSStyle);
  77463. if (serverStyle) {
  77464. style.push(serverStyle);
  77465. }
  77466. }
  77467. }
  77468. feature = this._mergeFeatureTextField(feature, style);
  77469. //次优先级是layers资源的默认的样式,最低优先级是CartoDefaultStyle的样式
  77470. if (feature.type === "TEXT" || style.length === 0) {
  77471. style = this.cartoCSSToLeaflet.getValidStyleFromLayerInfo(feature, layerStyleInfo);
  77472. if (feature.type === "TEXT") {
  77473. style.textName = "[" + feature.properties.textField + "]";
  77474. }
  77475. }
  77476. me.vectorTileLayerStyles[layerName] = style;
  77477. return style;
  77478. },
  77479. /**
  77480. * @function L.supermap.tiledVectorLayer.prototype.getScale
  77481. * @description 通过缩放级别获取比例尺。
  77482. * @param {number} zoom - 缩放级别。
  77483. * @returns {number} 比例尺。
  77484. */
  77485. getScale: function (zoom) {
  77486. var me = this;
  77487. //返回当前比例尺
  77488. var z = zoom || me._map.getZoom();
  77489. return me.scales[z];
  77490. },
  77491. /**
  77492. * @function L.supermap.tiledVectorLayer.prototype.getScaleFromCoords
  77493. * @description 通过行列号获取比例尺。
  77494. * @param {Object} coords - 行列号。
  77495. * @returns {number} 比例尺。
  77496. */
  77497. getScaleFromCoords: function (coords) {
  77498. var me = this,
  77499. scale;
  77500. if (me.scales && me.scales[coords.z]) {
  77501. return me.scales[coords.z];
  77502. }
  77503. me.scales = me.scales || {};
  77504. scale = me.getDefaultScale(coords);
  77505. me.scales[coords.z] = scale;
  77506. return scale;
  77507. },
  77508. /**
  77509. * @private
  77510. * @function L.supermap.tiledVectorLayer.prototype.getDefaultScale
  77511. * @description 根据行列号获取默认比例尺。
  77512. * @param {Object} coords - 行列号。
  77513. * @returns {number} 默认比例尺。
  77514. */
  77515. getDefaultScale: function (coords) {
  77516. var me = this,
  77517. crs = me._crs;
  77518. if (crs.scales) {
  77519. return crs.scales[coords.z];
  77520. } else {
  77521. var tileBounds = me._tileCoordsToBounds(coords);
  77522. var ne = crs.project(tileBounds.getNorthEast());
  77523. var sw = crs.project(tileBounds.getSouthWest());
  77524. var tileSize = me.options.tileSize;
  77525. var resolution = Math.max(
  77526. Math.abs(ne.x - sw.x) / tileSize,
  77527. Math.abs(ne.y - sw.y) / tileSize
  77528. );
  77529. var mapUnit = Unit.METER;
  77530. if (crs.code) {
  77531. var array = crs.code.split(':');
  77532. if (array && array.length > 1) {
  77533. var code = parseInt(array[1]);
  77534. mapUnit = code && code >= 4000 && code <= 5000 ? Unit.DEGREE : Unit.METER;
  77535. }
  77536. }
  77537. return resolutionToScale(resolution, 96, mapUnit);
  77538. }
  77539. },
  77540. _mergeFeatureTextField: function (feature, style) {
  77541. //如果设置了使用服务端cartocss样式,则文本专题图图层优先从carto中读取文本字段的key
  77542. if (!this.options.serverCartoCSSStyle || !style || feature.type !== "TEXT") {
  77543. return feature;
  77544. }
  77545. var tempStyle = style;
  77546. if (!external_L_default().Util.isArray(style)) {
  77547. tempStyle = [style];
  77548. }
  77549. for (var i = 0; i < tempStyle.length; i++) {
  77550. var textName = tempStyle[i].textName;
  77551. if (textName && feature.properties) {
  77552. feature.properties.textField = textName.substring(1, textName.length - 1);
  77553. }
  77554. }
  77555. return feature;
  77556. },
  77557. _getTileUrl: function (coords) {
  77558. var me = this,
  77559. tileTemplate = me.options.tileTemplate;
  77560. if (!tileTemplate) {
  77561. return me._getDefaultTileUrl(coords);
  77562. }
  77563. return me._getTileTemplateUrl(coords)
  77564. },
  77565. _getTileTemplateUrl: function (coords) {
  77566. var me = this,
  77567. tileTemplate = me.options.tileTemplate;
  77568. var data = {
  77569. s: me._getSubdomain(coords),
  77570. x: coords.x,
  77571. y: coords.y,
  77572. z: coords.z
  77573. };
  77574. if (me._map && !me._map.options.crs.infinite) {
  77575. var invertedY = me._globalTileRange.max.y - coords.y;
  77576. if (me.options.tms) {
  77577. data['y'] = invertedY;
  77578. }
  77579. data['-y'] = invertedY;
  77580. }
  77581. var tileUrl = external_L_default().Util.template(tileTemplate, external_L_default().extend(data, me.options));
  77582. return tileUrl;
  77583. },
  77584. _initGrid: function () {
  77585. VectorGrid.prototype.onAdd.call(this, this._map);
  77586. },
  77587. _getSubdomain: (external_L_default()).TileLayer.prototype._getSubdomain,
  77588. _getDefaultTileUrl: function (coords) {
  77589. var x = coords.x,
  77590. y = coords.y;
  77591. var tileUrl = this._tileUrl + "&x=" + x + "&y=" + y;
  77592. var scale = this.getScaleFromCoords(coords);
  77593. tileUrl += "&scale=" + scale;
  77594. return tileUrl;
  77595. },
  77596. _initLayerUrl: function () {
  77597. var options = this.options;
  77598. if (!this.url) {
  77599. return;
  77600. }
  77601. var format = options.format.toString().toLowerCase();
  77602. this._tileUrl = Util.urlPathAppend(this.url, "tileFeature." + format );
  77603. this._tileUrl = Util.urlAppend(this._tileUrl, encodeURI(this._createURLParam(options)));
  77604. },
  77605. _createURLParam: function (options) {
  77606. var params = [];
  77607. //添加安全认证信息
  77608. var credential = this._getCredential();
  77609. if (credential) {
  77610. params.push(credential);
  77611. }
  77612. if (options.layersID) {
  77613. params.push("layersID=" + options.layersID);
  77614. }
  77615. if (options.layerNames) {
  77616. if (!external_L_default().Util.isArray(options.layerNames)) {
  77617. options.layerNames = [options.layerNames];
  77618. }
  77619. var layerNamesString = '[' + options.layerNames.join(',') + ']';
  77620. params.push("layerNames=" + layerNamesString);
  77621. }
  77622. //切片的起始参考点,默认为地图范围的左上角。
  77623. var crs = this._crs;
  77624. if (crs.options && crs.options.origin) {
  77625. params.push("origin=" + JSON.stringify({
  77626. x: crs.options.origin[0],
  77627. y: crs.options.origin[1]
  77628. }));
  77629. } else if (crs.projection && crs.projection.bounds) {
  77630. var bounds = crs.projection.bounds;
  77631. var tileOrigin = external_L_default().point(bounds.min.x, bounds.max.y);
  77632. params.push("origin=" + JSON.stringify({
  77633. x: tileOrigin.x,
  77634. y: tileOrigin.y
  77635. }));
  77636. }
  77637. if (options.expands) {
  77638. params.push("expands=" + options.expands);
  77639. }
  77640. params.push("returnAttributes=" + options.returnAttributes);
  77641. params.push("cacheEnabled=" + options.cacheEnabled);
  77642. var tileSize = this.options.tileSize;
  77643. params.push("width=" + tileSize);
  77644. params.push("height=" + tileSize);
  77645. return params.join("&");
  77646. },
  77647. //获取token或key表达式
  77648. _getCredential: function (url) {
  77649. var credential, value;
  77650. switch (this.options.serverType) {
  77651. case ServerType.IPORTAL:
  77652. value = SecurityManager.getToken(url);
  77653. credential = value ? new Credential(value, "token") : null;
  77654. if (!credential) {
  77655. value = SecurityManager.getKey(url);
  77656. credential = value ? new Credential(value, "key") : null;
  77657. }
  77658. break;
  77659. case ServerType.ONLINE:
  77660. value = SecurityManager.getKey(url);
  77661. credential = value ? new Credential(value, "key") : null;
  77662. break;
  77663. default:
  77664. //iserver or others
  77665. value = SecurityManager.getToken(url);
  77666. credential = value ? new Credential(value, "token") : null;
  77667. break;
  77668. }
  77669. if (credential) {
  77670. return credential.getUrlParameters();
  77671. }
  77672. return null;
  77673. }
  77674. });
  77675. var tiledVectorLayer = function (url, options) {
  77676. return new TileVectorLayer(url, options);
  77677. };
  77678. (external_L_default()).supermap.tiledVectorLayer = tiledVectorLayer;
  77679. ;// CONCATENATED MODULE: external "function(){try{return turf}catch(e){return {}}}()"
  77680. const external_function_try_return_turf_catch_e_return_namespaceObject = function(){try{return turf}catch(e){return {}}}();
  77681. ;// CONCATENATED MODULE: ./src/leaflet/overlay/TurfLayer.js
  77682. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  77683. * This program are made available under the terms of the Apache License, Version 2.0
  77684. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  77685. /**
  77686. * @class L.supermap.turfLayer
  77687. * @classdesc Turf 图层。
  77688. * @category Visualization Turf
  77689. * @extends {L.Layer}
  77690. * @param {Object} options - 可选参数。
  77691. * @param {string} [options.attribution='<span>© <a href='https://turfjs.org/' title='turfjs' target='_blank'>turfjs</a></span>'] - 版权信息。
  77692. */
  77693. var TurfLayer = external_L_default().GeoJSON.extend({
  77694. turfMap: {
  77695. "Measurement.along": ["line", "distance", "units"],
  77696. "Measurement.area": ["geojson"],
  77697. "Measurement.bbox": ["geojson"],
  77698. "Measurement.bboxPolygon": ["bbox"],
  77699. "Measurement.bearing": ["start", "end", "final"],
  77700. "Measurement.center": ["geojson", "properties"],
  77701. "Measurement.centerOfMass": ["geojson", "properties"],
  77702. "Measurement.centroid": ["geojson", "properties"],
  77703. "Measurement.destination": ["origin", "distance", "bearing", "units"],
  77704. "Measurement.distance": ["from", "to", "units"],
  77705. "Measurement.envelope": ["geojson"],
  77706. "Measurement.length": ["geojson", "units"],
  77707. "Measurement.midpoint": ["point1", "point2"],
  77708. "Measurement.pointOnFeature": ["geojson"],
  77709. "Measurement.polygonTangents": ["point", "polygon"],
  77710. "Measurement.rhumbBearing": ["start", "end", "final"],
  77711. "Measurement.rhumbDestination": ["origin", "distance", "bearing", "units"],
  77712. "Measurement.rhumbDistance": ["from", "to", "units"],
  77713. "Measurement.square": ["bbox"],
  77714. "Measurement.greatCircle": ["start", "end", "properties", "npoints", "offset"],
  77715. "CoordinateMutation.cleanCoords": ["geojson", "mutate"],
  77716. "CoordinateMutation.flip": ["geojson", "mutate"],
  77717. "CoordinateMutation.rewind": ["geojson", "reverse", "mutate"],
  77718. "CoordinateMutation.round": ["num", "precision"],
  77719. "CoordinateMutation.truncate": ["geojson", "precision", "coordinates", "mutate"],
  77720. "Transformation.bboxClip": ["feature", "bbox"],
  77721. "Transformation.bezierSpline": ["line", "resolution", "sharpness"],
  77722. "Transformation.buffer": ["geojson", "radius", "units", "steps"],
  77723. "Transformation.circle": ["center", "radius", "steps", "units", "properties"],
  77724. "Transformation.clone": ["geojson"],
  77725. "Transformation.concave": ["points", "maxEdge", "units"],
  77726. "Transformation.convex": ["geojson", "concavity"],
  77727. "Transformation.difference": ["polygon1", "polygon2"],
  77728. "Transformation.dissolve": ["featureCollection", "propertyName"],
  77729. "Transformation.intersect": ["poly1", "poly2"],
  77730. "Transformation.lineOffset": ["geojson", "distance", "units"],
  77731. "Transformation.simplify": ["feature", "tolerance", "highQuality"],
  77732. "Transformation.tesselate": ["poly"],
  77733. "Transformation.transformRotate": ["geojson", "angle", "pivot", "mutate"],
  77734. "Transformation.transformTranslate": ["geojson", "distance", "direction", "units", "zTranslation", "mutate"],
  77735. "Transformation.transformScale": ["geojson", "factor", "origin", "mutate"],
  77736. "Transformation.union": ["A"],
  77737. "Transformation.voronoi": ["points", "bbox"],
  77738. "featureConversion.combine": ["fc"],
  77739. "featureConversion.explode": ["geojson"],
  77740. "featureConversion.flatten": ["geojson"],
  77741. "featureConversion.lineStringToPolygon": ["lines", "properties", "autoComplete", "orderCoords"],
  77742. "featureConversion.polygonize": ["geojson"],
  77743. "featureConversion.polygonToLineString": ["polygon", "properties"],
  77744. "Misc.kinks": ["featureIn"],
  77745. "Misc.lineArc": ["center", "radius", "bearing1", "bearing2", "steps", "units"],
  77746. "Misc.lineChunk": ["geojson", "segmentLength", "units", "reverse"],
  77747. "Misc.lineIntersect": ["line1", "line2"],
  77748. "Misc.lineOverlap": ["line1", "line2"],
  77749. "Misc.lineSegment": ["geojson"],
  77750. "Misc.lineSlice": ["startPt", "stopPt", "line"],
  77751. "Misc.lineSliceAlong": ["line", "startDist", "stopDist", "units"],
  77752. "Misc.lineSplit": ["line", "splitter"],
  77753. "Misc.mask": ["polygon", "mask"],
  77754. "Misc.pointOnLine": ["lines", "pt", "units"],
  77755. "Misc.sector": ["center", "radius", "bearing1", "bearing2", "steps", "units"],
  77756. "Misc.shortestPath": ["start", "end", "obstacles", "units", "resolution"],
  77757. "Misc.unkinkPolygon": ["geojson"],
  77758. "Helper.featureCollection": ["features", "bbox", "id"],
  77759. "Helper.feature": ["geometry", "properties", "bbox", "id"],
  77760. "Helper.geometryCollection": ["geometries", "properties", "bbox", "id"],
  77761. "Helper.lineString": ["coordinates", "properties", "bbox", "id"],
  77762. "Helper.multiLineString": ["coordinates", "properties", "bbox", "id"],
  77763. "Helper.multiPoint": ["coordinates", "properties", "bbox", "id"],
  77764. "Helper.multiPolygon": ["coordinates", "properties", "bbox", "id"],
  77765. "Helper.point": ["coordinates", "properties", "bbox", "id"],
  77766. "Helper.polygon": ["coordinates", "properties", "bbox", "id"],
  77767. "Data.sample": ["featurecollection", "num"],
  77768. "Interpolation.interpolate": ["points", "cellSize", "gridType", "property", "units", "weight"],
  77769. "Interpolation.isobands": ["pointGrid", "breaks", "zProperty", "commonProperties", "breaksProperties"],
  77770. "Interpolation.isolines": ["pointGrid", "breaks", "zProperty", "commonProperties", "breaksProperties"],
  77771. "Interpolation.planepoint": ["point", "triangle"],
  77772. "Interpolation.tin": ["points", "z"],
  77773. "Joins.pointsWithinPolygon": ["points", "polygons"],
  77774. "Joins.tag": ["points", "polygons", "field", "outField", "mask", "properties"],
  77775. "Grids.hexGrid": ["bbox", "cellSide", "units", "triangles"],
  77776. "Grids.pointGrid": ["bbox", "cellSide", "units", "mask", "properties"],
  77777. "Grids.squareGrid": ["bbox", "cellSide", "units", "mask", "properties"],
  77778. "Grids.triangleGrid": ["bbox", "cellSide", "units", "mask", "properties"],
  77779. "Classification.nearestPoint": ["targetPoint", "points"],
  77780. "Aggregation.collect": ["polygons", "points", "inProperty", "outProperty"],
  77781. "Aggregation.clustersDbscan": ["points", "maxDistance", "units", "minPoints", "mutate"],
  77782. "Aggregation.clustersKmeans": ["points", "numberOfClusters", "mutate"],
  77783. "Meta.coordAll": ["geojson"],
  77784. "Meta.coordEach": ["geojson", "callback", "excludeWrapCoord"],
  77785. "Meta.coordReduce": ["geojson", "callback", "initialValue", "excludeWrapCoord"],
  77786. "Meta.featureEach": ["geojson", "callback"],
  77787. "Meta.featureReduce": ["geojson", "callback", "initialValue"],
  77788. "Meta.flattenEach": ["geojson", "callback"],
  77789. "Meta.flattenReduce": ["geojson", "callback", "initialValue"],
  77790. "Meta.getCoord": ["coord"],
  77791. "Meta.getCoords": ["coords"],
  77792. "Meta.getGeom": ["geojson"],
  77793. "Meta.getGeomType": ["geojson", "name"],
  77794. "Meta.geomEach": ["geojson", "callback"],
  77795. "Meta.geomReduce": ["geojson", "callback", "initialValue"],
  77796. "Meta.propEach": ["geojson", "callback"],
  77797. "Meta.propReduce": ["geojson", "callback", "initialValue"],
  77798. "Meta.segmentEach": ["geojson", "callback"],
  77799. "Meta.segmentReduce": ["geojson", "callback", "initialValue"],
  77800. "Meta.getCluster": ["geojson", "filter"],
  77801. "Meta.clusterEach": ["geojson", "property", "callback"],
  77802. "Meta.clusterReduce": ["geojson", "property", "callback", "initialValue"],
  77803. "Assertions.collectionOf": ["featureCollection", "type", "name"],
  77804. "Assertions.containsNumber": ["coordinates"],
  77805. "Assertions.geojsonType": ["value", "type", "name"],
  77806. "Assertions.featureOf": ["feature", "type", "name"],
  77807. "Booleans.booleanClockwise": ["line"],
  77808. "Booleans.booleanContains": ["feature1", "feature2"],
  77809. "Booleans.booleanCrosses": ["feature1", "feature2"],
  77810. "Booleans.booleanDisjoint": ["feature1", "feature2"],
  77811. "Booleans.booleanEqual": ["feature1", "feature2"],
  77812. "Booleans.booleanOverlap": ["feature1", "feature2"],
  77813. "Booleans.booleanParallel": ["feature1", "feature2"],
  77814. "Booleans.booleanPointInPolygon": ["point", "polygon", "ignoreBoundary"],
  77815. "Booleans.booleanPointOnLine": ["point", "linestring", "ignoreEndVertices"],
  77816. "UnitConversion.bearingToAngle": ["bearing"],
  77817. "UnitConversion.convertArea": ["area", "originalUnit", "finalUnit"],
  77818. "UnitConversion.convertLength": ["length", "originalUnit", "finalUnit"],
  77819. "UnitConversion.degreesToradians": ["degrees"],
  77820. "UnitConversion.lengthToRadians": ["distance", "units"],
  77821. "UnitConversion.lengthToDegrees": ["distance", "units"],
  77822. "UnitConversion.radiansToLength": ["radians", "units"],
  77823. "UnitConversion.radiansToDegrees": ["radians"],
  77824. "UnitConversion.toMercator": ["geojson", "mutate"],
  77825. "UnitConversion.toWgs84": ["geojson", "mutate"]
  77826. },
  77827. options: {
  77828. attribution: core_Attributions.Turf.attribution
  77829. },
  77830. initialize: function (options) {
  77831. options = options || {};
  77832. external_L_default().Util.setOptions(this, options);
  77833. external_L_default().stamp(this);
  77834. this._layers = {};
  77835. },
  77836. // 5.0.0 及以上版本参数配置
  77837. turfOptionMap: {
  77838. "Measurement.along": ["line", "distance", {units: ""}],
  77839. "Measurement.bboxPolygon": ["bbox", {properties: "", id: ""}],
  77840. "Measurement.bearing": ["start", "end", {final: ""}],
  77841. "Measurement.center": ["geojson", {properties: ""}],
  77842. "Measurement.destination": ["origin", "distance", "bearing", {units: "", properties: ""}],
  77843. "Measurement.distance": ["from", "to", {units: ""}],
  77844. "Measurement.length": ["geojson", {units: ""}],
  77845. "Measurement.rhumbBearing": ["start", "end", {final: ""}],
  77846. "Measurement.rhumbDestination": ["origin", "distance", "bearing", {units: "", properties: ""}],
  77847. "Measurement.rhumbDistance": ["from", "to", {units: ""}],
  77848. "Measurement.greatCircle": ["start", "end", {properties: "", npoints: "", offset: ""}],
  77849. "CoordinateMutation.cleanCoords": ["geojson", {mutate: ""}],
  77850. "CoordinateMutation.flip": ["geojson", {mutate: ""}],
  77851. "CoordinateMutation.rewind": ["geojson", {mutate: "", reverse: ""}],
  77852. "CoordinateMutation.truncate": ["geojson", {precision: "", coordinates: "", mutate: ""}],
  77853. "Transformation.bezierSpline": ["line", {resolution: "", sharpness: ""}],
  77854. "Transformation.buffer": ["geojson", "radius", {units: "", steps: ""}],
  77855. "Transformation.circle": ["center", "radius", {units: "", steps: "", properties: ""}],
  77856. "Transformation.concave": ["points", {maxEdge: "", units: ""}],
  77857. "Transformation.convex": ["geojson", {concavity: ""}],
  77858. "Transformation.dissolve": ["featureCollection", {propertyName: ""}],
  77859. "Transformation.lineOffset": ["geojson", "distance", {units: ""}],
  77860. "Transformation.simplify": ["geojson", {tolerance: "", highQuality: ""}],
  77861. "Transformation.transformRotate": ["geojson", "angle", {pivot: "", mutate: ""}],
  77862. "Transformation.transformTranslate": ["geojson", "distance", "direction", {
  77863. units: "",
  77864. zTranslation: "",
  77865. mutate: ""
  77866. }],
  77867. "Transformation.transformScale": ["geojson", "factor", {origin: "", mutate: ""}],
  77868. "Transformation.voronoi": ["points", {bbox: ""}],
  77869. "featureConversion.lineStringToPolygon": ["lines", {properties: "", autoComplete: "", orderCoords: ""}],
  77870. "featureConversion.polygonToLineString": ["polygon", {properties: ""}],
  77871. "Misc.lineArc": ["center", "radius", "bearing1", "bearing2", {steps: "", units: ""}],
  77872. "Misc.lineChunk": ["geojson", "segmentLength", {units: "", reverse: ""}],
  77873. "Misc.lineOverlap": ["line1", "line2", {tolerance: ""}],
  77874. "Misc.lineSliceAlong": ["line", "startDist", "stopDist", {units: ""}],
  77875. "Misc.pointOnLine": ["lines", "pt", {units: ""}],
  77876. "Misc.sector": ["center", "radius", "bearing1", "bearing2", {units: "", steps: "", properties: ""}],
  77877. "Misc.shortestPath": ["start", "end", {obstacles: "", units: "", resolution: ""}],
  77878. "Helper.feature": ["geometry", "properties", {bbox: "", id: ""}],
  77879. "Helper.geometryCollection": ["geometries", "properties", {bbox: "", id: ""}],
  77880. "Helper.lineString": ["coordinates", "properties", {bbox: "", id: ""}],
  77881. "Helper.multiLineString": ["coordinates", "properties", {bbox: "", id: ""}],
  77882. "Helper.multiPoint": ["coordinates", "properties", {bbox: "", id: ""}],
  77883. "Helper.multiPolygon": ["coordinates", "properties", {bbox: "", id: ""}],
  77884. "Helper.point": ["coordinates", "properties", {bbox: "", id: ""}],
  77885. "Helper.polygon": ["coordinates", "properties", {bbox: "", id: ""}],
  77886. "Interpolation.interpolate": ["points", "cellSize", {gridType: "", property: "", units: "", weight: ""}],
  77887. "Interpolation.isobands": ["pointGrid", "breaks", {zProperty: "", commonProperties: "", breaksProperties: ""}],
  77888. "Interpolation.isolines": ["pointGrid", "breaks", {zProperty: "", commonProperties: "", breaksProperties: ""}],
  77889. "Grids.hexGrid": ["bbox", "cellSide", {units: "", triangles: "", properties: "", mask: ""}],
  77890. "Grids.pointGrid": ["bbox", "cellSide", {units: "", mask: "", properties: ""}],
  77891. "Grids.squareGrid": ["bbox", "cellSide", {units: "", mask: "", properties: ""}],
  77892. "Grids.triangleGrid": ["bbox", "cellSide", {units: "", mask: "", properties: ""}],
  77893. "Aggregation.clustersDbscan": ["points", "maxDistance", {units: "", minPoints: "", mutate: ""}],
  77894. "Aggregation.clustersKmeans": ["points", {numberOfClusters: "", mutate: ""}],
  77895. "Booleans.booleanPointInPolygon": ["point", "polygon", {ignoreBoundary: ""}],
  77896. "Booleans.booleanPointOnLine": ["point", "linestring", {ignoreEndVertices: ""}],
  77897. "UnitConversion.toMercator": ["geojson", {mutate: ""}],
  77898. "UnitConversion.toWgs84": ["geojson", {mutate: ""}]
  77899. },
  77900. /**
  77901. * @function L.supermap.turfLayer.prototype.process
  77902. * @description 执行 Turf.js 提供的相关空间分析方法。
  77903. * @param {string} type - Turf.js 提供的空间分析方法名。
  77904. * @param {Object} args - Turf.js 提供的空间分析方法对应的参数对象。
  77905. * @param {Function} callback - 空间分析完成执行的回调函数,返回执行的结果。
  77906. * @param {boolean} [addFeaturesToMap=true] - 是否添加到 map。
  77907. */
  77908. process: function (type, args, callback, addFeaturesToMap) {
  77909. // 兼容版本4到5
  77910. var result;
  77911. try {
  77912. result = external_function_try_return_turf_catch_e_return_namespaceObject[type.split('.')[1]].apply(this, this.parse(type, args));
  77913. } catch (e) {
  77914. result = external_function_try_return_turf_catch_e_return_namespaceObject[type.split('.')[1]].apply(this, this.parseOption(type, args));
  77915. }
  77916. addFeaturesToMap = addFeaturesToMap == null ? true : addFeaturesToMap;
  77917. if (addFeaturesToMap) {
  77918. this.addData([result]);
  77919. }
  77920. if (callback) {
  77921. callback(result);
  77922. }
  77923. },
  77924. parse: function (type, args) {
  77925. if (type === 'Transformation.union') {
  77926. return args['A'];
  77927. }
  77928. var result = [];
  77929. var tempArgs = this.turfMap[type];
  77930. if (tempArgs) {
  77931. tempArgs.map(function (key) {
  77932. result.push(args[key]);
  77933. return args[key];
  77934. });
  77935. }
  77936. return result;
  77937. },
  77938. parseOption(type, args) {
  77939. var result = [];
  77940. var tempArgs = this.turfOptionMap[type];
  77941. tempArgs.map(function (key) {
  77942. if (key instanceof Object) {
  77943. var options = key;
  77944. Object.keys(options).forEach(function (k) {
  77945. options[k] = args[k]
  77946. })
  77947. result.push(options);
  77948. } else {
  77949. result.push(args[key])
  77950. }
  77951. return args;
  77952. })
  77953. return result;
  77954. }
  77955. });
  77956. var turfLayer = function (options) {
  77957. return new TurfLayer(options);
  77958. };
  77959. (external_L_default()).supermap.turfLayer = turfLayer;
  77960. ;// CONCATENATED MODULE: ./src/leaflet/overlay/HeatMapLayer.js
  77961. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  77962. * This program are made available under the terms of the Apache License, Version 2.0
  77963. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  77964. /**
  77965. * @class L.supermap.heatMapFeature
  77966. * @category Visualization HeatMap
  77967. * @classdesc 客户端专题图要素类。
  77968. * 支持的 geometry 参数类型为 {@link L.Point}、{@link L.LatLng}、{@link L.CircleMarker}。
  77969. * @extends {L.Class}
  77970. * @param {(L.Point|L.LatLng|L.CircleMarker)} geometry - 要素图形。
  77971. * @param {Object} attributes - 要素属性。
  77972. */
  77973. var HeatMapFeature = external_L_default().Class.extend({
  77974. initialize: function (geometry, attributes) {
  77975. this.geometry = geometry;
  77976. this.attributes = attributes;
  77977. },
  77978. /**
  77979. * @function L.supermap.themeFeature.prototype.toFeature
  77980. * @description 转为内部矢量要素。
  77981. * @returns {SuperMap.Feature.Vector} 内部矢量要素。
  77982. */
  77983. toFeature: function () {
  77984. var geometry = this.geometry;
  77985. var points = [];
  77986. if (geometry instanceof (external_L_default()).LatLng) {
  77987. points = [geometry.lng, geometry.lat];
  77988. } else if (geometry instanceof (external_L_default()).Point) {
  77989. points = [geometry.x, geometry.y];
  77990. } else if (geometry instanceof (external_L_default()).CircleMarker) {
  77991. var latLng = geometry.getLatLng();
  77992. points = [latLng.lng, latLng.lat];
  77993. } else {
  77994. points = geometry;
  77995. }
  77996. if (points.length === 2) {
  77997. geometry = new Point(points[0], points[1]);
  77998. }
  77999. return new Vector(geometry, this.attributes);
  78000. }
  78001. });
  78002. var heatMapFeature = function (geometry, attributes) {
  78003. return new HeatMapFeature(geometry, attributes);
  78004. };
  78005. (external_L_default()).supermap.heatMapFeature = heatMapFeature;
  78006. /**
  78007. * @class L.supermap.heatMapLayer
  78008. * @classdesc 热力图层类。
  78009. * @category Visualization HeatMap
  78010. * @param {string} name - 图层名称。
  78011. * @param {boolean} [loadWhileAnimating=true] - 是否实时重绘。(当绘制大数据量要素的情况下会出现卡顿,建议把该参数设为 false)。
  78012. * @param {Array.<string>} [colors=['blue', 'cyan', 'lime', 'yellow', 'red']] - 颜色线性渐变数组,颜色值必须为 canvas 所支持的。
  78013. * @param {Object} options - 构造参数。
  78014. * @param {L.Map} options.map - leaflet 的 map 对象。
  78015. * @param {string} [options.id] - 专题图层 ID,默认使用 CommonUtil.createUniqueID("heatMapLayer_") 创建专题图层 ID。
  78016. * @param {boolean} [options.alwaysMapCRS=false] - 要素坐标是否和地图坐标系一致,要素默认是经纬度坐标。
  78017. * @param {string} [options.featureWeight] - 对应 feature 属性中的热点权重字段名称,权重值类型为 float。
  78018. * @param {number} [options.radius=50] - 热点渲染的最大半径(热点像素半径),单位为 px,当 useGeoUnit 参数 为 true 时,单位使用当前图层地理坐标单位。热点显示的时候以精确点为中心点开始往四周辐射衰减,其衰减半径和权重值成比列。
  78019. * @param {number} [options.opacity=1] - 图层透明度。
  78020. * @param {boolean} [options.useGeoUnit=false] - 使用地理单位,即默认热点半径默认使用像素单位。 当设置为 true 时,热点半径和图层地理坐标保持一致。
  78021. * @param {number} [options.blur] - 模糊量,,单位为 px。默认值为半径的二分之一。
  78022. * @param {string} [options.attribution='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' title='SuperMap iServer' target='_blank'>SuperMap iServer</a></span>'] - 版权信息。
  78023. *
  78024. * @extends {L.Layer}
  78025. * @fires L.supermap.heatMapLayer#featuresremoved
  78026. * @fires L.supermap.heatMapLayer#changelayer
  78027. */
  78028. var HeatMapLayer = external_L_default().Layer.extend({
  78029. options: {
  78030. //要素坐标是否和地图坐标系一致,默认为false,要素默认是经纬度坐标。
  78031. alwaysMapCRS: false,
  78032. //热力图默认参数:
  78033. id: Util.createUniqueID("heatMapLayer_"),
  78034. featureWeight: null,
  78035. opacity: 1,
  78036. colors: ['blue', 'cyan', 'lime', 'yellow', 'red'],
  78037. useGeoUnit: false,
  78038. radius: 50,
  78039. attribution: core_Attributions.Common.attribution
  78040. },
  78041. initialize: function (name, options) {
  78042. external_L_default().Util.setOptions(this, options);
  78043. this.name = name;
  78044. this.features = [];
  78045. this.maxWeight = null;
  78046. this.minWeight = null;
  78047. this.rootCanvas = null;
  78048. this.canvasContext = null;
  78049. this.maxWidth = null;
  78050. this.maxHeight = null;
  78051. //热力图参数:
  78052. this.id = this.options.id;
  78053. /*
  78054. * options.featureWeight对应 feature 属性中的热点权重字段名称,权重值类型为float
  78055. * //例如:
  78056. * //feature.attributes中表示权重的字段为height,则在HeatMapLayer的featureWeight参数赋值为"height"
  78057. * feature1.attributes.height = 7.0;
  78058. * feature2.attributes.height = 6.0;
  78059. * var heatMapLayer = new L.supermap.HeatMapLayer("heatmaplayer",{"featureWeight":"height"});
  78060. * heatMapLayer.addFeatures([feature1,feature2]);
  78061. * @type {null}
  78062. */
  78063. this.featureWeight = this.options.featureWeight;
  78064. this.colors = this.options.colors;
  78065. this.useGeoUnit = this.options.useGeoUnit;
  78066. this.opacity = this.options.opacity;
  78067. this.radius = this.options.radius;
  78068. this.blur = this.options.blur;
  78069. this.movingOffset = [0, 0];
  78070. },
  78071. /**
  78072. * @function L.supermap.heatMapLayer.prototype.onRemove
  78073. * @description 删除某个地图。
  78074. * @param {L.Map} map - 要删除的地图。
  78075. * @private
  78076. */
  78077. onRemove: function (map) {
  78078. var me = this;
  78079. external_L_default().DomUtil.remove(me.rootCanvas);
  78080. map.off("mousemove", me.mouseMoveHandler);
  78081. },
  78082. /**
  78083. * @function L.supermap.heatMapLayer.prototype.onAdd
  78084. * @description 添加专题图。
  78085. * @param {L.Map} map - 要添加的地图。
  78086. * @private
  78087. */
  78088. onAdd: function (map) {
  78089. var me = this;
  78090. me._map = map;
  78091. me._createCanvasContainer();
  78092. if (!me.rootCanvas) {
  78093. map.removeLayer(me);
  78094. return;
  78095. }
  78096. //初始化渲染器
  78097. var size = map.getSize();
  78098. me.rootCanvas.width = me.maxWidth = size.x;
  78099. me.rootCanvas.height = me.maxHeight = size.y;
  78100. me._updateOpacity();
  78101. me.mouseMoveHandler = function (e) {
  78102. var xy = e.layerPoint;
  78103. me.currentMousePosition = external_L_default().point(xy.x + me.movingOffset[0], xy.y + me.movingOffset[1]);
  78104. };
  78105. map.on("mousemove", me.mouseMoveHandler);
  78106. me.update();
  78107. },
  78108. /**
  78109. * @function L.supermap.heatMapLayer.prototype.addFeatures
  78110. * @description 添加热点信息。
  78111. * @param {(GeoJSONObject|L.supermap.heatMapFeature)} features - 待添加的要素数组。
  78112. *
  78113. * @example
  78114. * var geojson = {
  78115. * "type": "FeatureCollection",
  78116. * "features": [
  78117. * {
  78118. * "type": "feature",
  78119. * "geometry": {
  78120. * "type": "Point", //只支持point类型
  78121. * "coordinates": [0, 0]
  78122. * },
  78123. * "properties": {
  78124. * "height": Math.random()*9,
  78125. * "geoRadius": useGeoRadius?radius:null
  78126. * }
  78127. * }
  78128. * ]
  78129. * };
  78130. * var heatMapLayer = new L.supermap.heatMapLayer("heatmaplayer",{"id":"heatmap"});
  78131. * heatMapLayer.addFeatures(geojson);
  78132. */
  78133. addFeatures: function (features) {
  78134. this.features = this.toiClientFeature(features);
  78135. this.refresh();
  78136. },
  78137. /**
  78138. * @function L.supermap.heatMapLayer.prototype.refresh
  78139. * @description 强制刷新当前热点显示,在图层热点数组发生变化后调用,更新显示。
  78140. */
  78141. refresh: function () {
  78142. if (this.features.length === 0) {
  78143. return;
  78144. }
  78145. if (this._map) {
  78146. var extent = this._map.getBounds();
  78147. this.updateHeatPoints(extent);
  78148. }
  78149. },
  78150. /**
  78151. * @function L.supermap.heatMapLayer.prototype.updateHeatPoints
  78152. * @description 刷新热点图显示。
  78153. * @param {L.LngLatBounds} bounds - 当前显示范围。
  78154. */
  78155. updateHeatPoints: function (bounds) {
  78156. if (this.features && this.features.length > 0) {
  78157. this.convertFastToPixelPoints(bounds);
  78158. } else {
  78159. this.canvasContext.clearRect(0, 0, this.maxWidth, this.maxWidth);
  78160. }
  78161. },
  78162. /**
  78163. * @function L.supermap.heatMapLayer.prototype.convertFastToPixelPoints
  78164. * @description 过滤位于当前显示范围内的热点,并转换其为当前分辨率下的像素坐标。
  78165. * @param {L.LngLatBounds} bounds - 当前显示范围。
  78166. * @private
  78167. */
  78168. convertFastToPixelPoints: function (bounds) {
  78169. var data = [], x, y, k, resolution, maxTemp, minTemp, maxWeightTemp;
  78170. //获取当前像素下的地理范围
  78171. var dw = bounds.getEast() - bounds.getWest();
  78172. var dh = bounds.getNorth() - bounds.getSouth();
  78173. var mapCanvas = this._map.getSize();
  78174. if (dw / mapCanvas.x > dh / mapCanvas.y) {
  78175. resolution = dw / mapCanvas.x;
  78176. } else {
  78177. resolution = dh / mapCanvas.y;
  78178. }
  78179. //热点半径
  78180. this.useRadius = this.useGeoUnit ? parseInt(this.radius / resolution) : this.radius;
  78181. for (var i = 0; i < this.features.length; i++) {
  78182. var feature = this.features[i];
  78183. var point = feature.geometry;
  78184. var pixelPoint = this.getLocalXY(new LonLat(point.x, point.y));
  78185. if (this.featureWeight) {
  78186. pixelPoint.weight = feature.attributes[this.featureWeight];//point.value;
  78187. if (!this.maxWeight) {
  78188. //找出最大最小权重值
  78189. maxTemp = maxTemp ? maxTemp : pixelPoint.weight;
  78190. minTemp = minTemp ? minTemp : pixelPoint.weight;
  78191. maxTemp = Math.max(maxTemp, pixelPoint.weight);
  78192. minTemp = Math.min(minTemp, pixelPoint.weight);
  78193. }
  78194. } else {
  78195. pixelPoint.weight = 1;
  78196. }
  78197. x = Math.floor(pixelPoint[0]);
  78198. y = Math.floor(pixelPoint[1]);
  78199. k = pixelPoint.weight;
  78200. data.push([x, y, k]);
  78201. }
  78202. //无最大权重设置
  78203. if (!this.maxWeight) {
  78204. if (maxTemp && minTemp) {
  78205. maxWeightTemp = (maxTemp + minTemp) / 2;
  78206. } else {
  78207. maxWeightTemp = 1;
  78208. }
  78209. this.draw(data, maxWeightTemp);
  78210. } else {
  78211. this.draw(data, this.maxWeight);
  78212. }
  78213. },
  78214. /**
  78215. * @function L.supermap.heatMapLayer.prototype.draw
  78216. * @description 绘制热点图。
  78217. * @param {Array} data - convertToPixelPoints 方法计算出的点。
  78218. * @param {number} maxWeight - 最大权重。
  78219. * @private
  78220. */
  78221. draw: function (data, maxWeight) {
  78222. if (this.maxHeight > 0 && this.maxWidth > 0) {
  78223. var ctx = this.canvasContext;
  78224. //清空
  78225. this.canvasContext.clearRect(0, 0, this.maxWidth, this.maxHeight);
  78226. this.drawCircle(this.useRadius);
  78227. this.createGradient();
  78228. for (var i = 0; i < data.length; i++) {
  78229. var p = data[i];
  78230. this.canvasContext.globalAlpha = Math.max(p[2] / maxWeight, 0.05);
  78231. this.canvasContext.drawImage(this.circle, p[0] - this.useRadius, p[1] - this.useRadius);
  78232. }
  78233. var colored = ctx.getImageData(0, 0, this.maxWidth, this.maxHeight);
  78234. this.colorize(colored.data, this.grad);
  78235. ctx.putImageData(colored, 0, 0);
  78236. } else {
  78237. return false;
  78238. }
  78239. },
  78240. /**
  78241. * @function L.supermap.heatMapLayer.prototype.colorize
  78242. * @description 根据渐变色重置热点图 rgb 值。
  78243. * @param {Array} pixels 像素 RGBA 值。
  78244. * @param {Array} gradient 渐变 canvas.getImageData.data。
  78245. * @private
  78246. */
  78247. colorize: function (pixels, gradient) {
  78248. for (var i = 0, j; i < pixels.length; i += 4) {
  78249. j = pixels[i + 3] * 4;
  78250. if (j) {
  78251. pixels[i] = gradient[j];
  78252. pixels[i + 1] = gradient[j + 1];
  78253. pixels[i + 2] = gradient[j + 2];
  78254. }
  78255. }
  78256. },
  78257. /**
  78258. * @function L.supermap.heatMapLayer.drawCircle
  78259. * @description 绘制热点半径圆。
  78260. * @param {number} r - 热点半径。
  78261. * @private
  78262. */
  78263. drawCircle: function (r) {
  78264. var blur = this.blur || r / 2;
  78265. var circle = this.circle = document.createElement('canvas'),
  78266. ctx = circle.getContext("2d");
  78267. circle.height = 2 * r;
  78268. circle.width = 2 * r;
  78269. ctx.shadowOffsetX = ctx.shadowOffsetY = 2 * r;
  78270. ctx.shadowBlur = blur;
  78271. ctx.shadowColor = "#000000";
  78272. ctx.beginPath();
  78273. ctx.arc(-r, -r, r / 2, 0, Math.PI * 2, true);
  78274. ctx.closePath();
  78275. ctx.fill();
  78276. },
  78277. /**
  78278. * @function L.supermap.heatMapLayer.createGradient
  78279. * @description 根据 this.canvasColors 设置渐变并 getImageData。
  78280. * @private
  78281. */
  78282. createGradient: function () {
  78283. var colors = this.colors;
  78284. var canvas = document.createElement('canvas'),
  78285. ctx = canvas.getContext("2d"),
  78286. gradient = ctx.createLinearGradient(0, 0, 0, 256);
  78287. canvas.height = 256;
  78288. canvas.width = 1;
  78289. var index = 1;
  78290. for (var i = 0, len = colors.length; i < len; i++) {
  78291. gradient.addColorStop(index / len, colors[i]);
  78292. index++;
  78293. }
  78294. ctx.fillStyle = gradient;
  78295. ctx.fillRect(0, 0, 1, 256);
  78296. this.grad = ctx.getImageData(0, 0, 1, 256).data;
  78297. },
  78298. /**
  78299. * @function L.supermap.heatMapLayer.prototype.update
  78300. * @description 更新图层。
  78301. */
  78302. update: function () {
  78303. var mapOffset = this._map.containerPointToLayerPoint([0, 0]);
  78304. external_L_default().DomUtil.setPosition(this.rootCanvas, mapOffset);
  78305. var me = this;
  78306. me.refresh();
  78307. if (me.currentMousePosition) {
  78308. me.currentMousePosition = external_L_default().point(
  78309. me.currentMousePosition.x - me.movingOffset[0],
  78310. me.currentMousePosition.y - me.movingOffset[1]);
  78311. }
  78312. me.movingOffset = [0, 0];
  78313. me._zoom = me._map.getZoom();
  78314. me._center = me._map.getCenter();
  78315. },
  78316. /**
  78317. * @function L.supermap.heatMapLayer.prototype.getLocalXY
  78318. * @description 地理坐标转为像素坐标。
  78319. * @param {Array} coordinate - 地理坐标。
  78320. */
  78321. getLocalXY: function (coordinate) {
  78322. if (!this._map) {
  78323. return coordinate;
  78324. }
  78325. var coor = coordinate;
  78326. if (external_L_default().Util.isArray(coordinate)) {
  78327. coor = external_L_default().point(coordinate[0], coordinate[1]);
  78328. }
  78329. if (!(coordinate instanceof (external_L_default()).Point)) {
  78330. if (coordinate instanceof Point || coordinate instanceof GeoText) {
  78331. coor = external_L_default().point(coordinate.x, coordinate.y);
  78332. } else {
  78333. coor = external_L_default().point(coordinate.lon, coordinate.lat);
  78334. }
  78335. }
  78336. var point = this._map.latLngToContainerPoint(!this.options.alwaysMapCRS ? external_L_default().latLng(coor.y, coor.x) : this._map.options.crs.unproject(coor));
  78337. return [point.x, point.y];
  78338. },
  78339. /**
  78340. * @function L.supermap.heatMapLayer.prototype.setOpacity
  78341. * @description 设置图层的不透明度,取值 [0-1] 之间。
  78342. * @param {number} opacity - 不透明度。
  78343. */
  78344. setOpacity: function (opacity) {
  78345. var me = this;
  78346. if (opacity === me.options.opacity) {
  78347. return;
  78348. }
  78349. if (opacity) {
  78350. me.options.opacity = opacity;
  78351. }
  78352. me._updateOpacity();
  78353. },
  78354. /**
  78355. * @function L.supermap.heatMapLayer.prototype.removeFeatures
  78356. * @description 移除指定的热点信息。
  78357. * @param {Array.<SuperMap.Feature.Vector>} features - 热点信息数组。
  78358. */
  78359. removeFeatures: function (features) {
  78360. if (!features || features.length === 0 || !this.features || this.features.length === 0) {
  78361. return;
  78362. }
  78363. if (features === this.features) {
  78364. return this.removeAllFeatures();
  78365. }
  78366. if (!(Util.isArray(features))) {
  78367. features = [features];
  78368. }
  78369. var heatPoint, index, heatPointsFailedRemoved = [];
  78370. for (var i = 0, len = features.length; i < len; i++) {
  78371. heatPoint = features[i];
  78372. index = Util.indexOf(this.features, heatPoint);
  78373. //找不到视为删除失败
  78374. if (index === -1) {
  78375. heatPointsFailedRemoved.push(heatPoint);
  78376. continue;
  78377. }
  78378. //删除热点
  78379. this.features.splice(index, 1);
  78380. }
  78381. var succeed = heatPointsFailedRemoved.length == 0 ? true : false;
  78382. //派发删除features成功的事件
  78383. /**
  78384. * @event L.supermap.heatMapLayer#featuresremoved
  78385. * @description 删除features成功后触发。
  78386. * @property {Array.<SuperMap.Feature.Vector>} features - 事件对象。
  78387. * @property {boolean} succeed - 删除是否成功,false 为失败,true 为成功。
  78388. */
  78389. this._map.fire("featuresremoved", {features: heatPointsFailedRemoved, succeed: succeed});
  78390. this.refresh();
  78391. },
  78392. /**
  78393. * @function L.supermap.heatMapLayer.prototype.removeAllFeatures
  78394. * @description 移除全部的热点信息。
  78395. */
  78396. removeAllFeatures: function () {
  78397. this.features = [];
  78398. this.refresh();
  78399. },
  78400. /**
  78401. * @function L.supermap.heatMapLayer.prototype._createCanvasContainer
  78402. * @description 创建热力图绘制容器。
  78403. * @private
  78404. */
  78405. _createCanvasContainer: function () {
  78406. //构建绘图面板
  78407. var parentContainer = this.getPane();
  78408. var animated = this._map.options.zoomAnimation && (external_L_default()).Browser.any3d;
  78409. var className = 'heatMapLayer leaflet-layer leaflet-zoom-' + (animated ? 'animated' : 'hide');
  78410. this.rootCanvas = external_L_default().DomUtil.create("canvas", className, parentContainer);
  78411. var originProp = external_L_default().DomUtil.testProp(['transformOrigin', 'WebkitTransformOrigin', 'msTransformOrigin']);
  78412. this.rootCanvas.id = this.id;
  78413. this.rootCanvas.style[originProp] = '50% 50%';
  78414. this.rootCanvas.style.position = "absolute";
  78415. this.rootCanvas.style.zIndex = 200;
  78416. Util.modifyDOMElement(this.rootCanvas, null, null, null,
  78417. null, null, null, this.opacity);
  78418. this.canvasContext = this.rootCanvas.getContext('2d');
  78419. },
  78420. _updateOpacity: function () {
  78421. var me = this;
  78422. Util.modifyDOMElement(me.rootCanvas, null, null, null, null, null, null, me.options.opacity);
  78423. if (me._map !== null) {
  78424. /**
  78425. * @event L.supermap.heatMapLayer#changelayer
  78426. * @description 图层透明度更新成功之后触发。
  78427. * @property {L.supermap.heatMapLayer} layer - 图层。
  78428. * @property {string} property - 改变的图层属性。
  78429. */
  78430. me._map.fire("changelayer", {layer: me, property: "opacity"});
  78431. }
  78432. },
  78433. /**
  78434. * @function L.supermap.heatMapLayer.prototype.getEvents
  78435. * @description 获取图层事件。
  78436. * @returns {Object} 返回图层支持的事件。
  78437. * @private
  78438. */
  78439. getEvents: function () {
  78440. var me = this;
  78441. var events = {
  78442. zoomend: me._reset,
  78443. moveend: me._reset,
  78444. resize: me._resize
  78445. };
  78446. if (this._map._zoomAnimated) {
  78447. events.zoomanim = me._zoomAnim;
  78448. }
  78449. return events;
  78450. },
  78451. /**
  78452. * @function L.supermap.heatMapLayer.prototype.toiClientFeature
  78453. * @description 转为 iClient 要素。
  78454. * @param {(GeoJSONObject|L.supermap.heatMapFeature)} features - 待添加的要素数组。
  78455. * @returns {SuperMap.Feature.Vector} 转换后的 iClient 要素。
  78456. */
  78457. toiClientFeature: function (features) {
  78458. if (!external_L_default().Util.isArray(features)) {
  78459. features = [features];
  78460. }
  78461. let featuresTemp = [];
  78462. for (let i = 0, len = features.length; i < len; i++) {
  78463. //支持ThemeFeature类型的feature
  78464. //支持传入ThemeFeature类型,ThemeFeature.geometry instanceof L.LatLng | ThemeFeature.geometry instanceof L.Point
  78465. if (features[i] instanceof HeatMapFeature) {
  78466. featuresTemp.push(features[i].toFeature());
  78467. } else if (["FeatureCollection", "Feature", "Geometry"].indexOf(features[i].type) != -1) {
  78468. const format = new GeoJSON();
  78469. featuresTemp = featuresTemp.concat(format.read(features[i]));
  78470. } else if (features[i].geometry && features[i].geometry.parts) {
  78471. //iServer服务器返回数据格式 todo 暂未找到更好的参数判断,暂用 geometry.parts 试用
  78472. featuresTemp.push(ServerFeature.fromJson(features[i]).toFeature());
  78473. } else {
  78474. throw new Error("Features's type does not match, please check.");
  78475. }
  78476. }
  78477. return featuresTemp;
  78478. },
  78479. _zoomAnim: function (e) {
  78480. var scale = this._map.getZoomScale(e.zoom),
  78481. offset = this._map._getCenterOffset(e.center)._multiplyBy(-scale).subtract(this._map._getMapPanePos());
  78482. if ((external_L_default()).DomUtil.setTransform) {
  78483. external_L_default().DomUtil.setTransform(this.rootCanvas, offset, scale);
  78484. } else {
  78485. this.rootCanvas.style[(external_L_default()).DomUtil.TRANSFORM] = external_L_default().DomUtil.getTranslateString(offset) + ' scale(' + scale + ')';
  78486. }
  78487. },
  78488. //缩放移动重绘
  78489. _reset: function () {
  78490. var me = this;
  78491. me.update();
  78492. var size = me._map.getSize();
  78493. var mapOffset = this._map.containerPointToLayerPoint([0, 0]);
  78494. external_L_default().DomUtil.setPosition(this.rootCanvas, mapOffset);
  78495. if (parseFloat(me.rootCanvas.width) !== parseFloat(size.x)) {
  78496. me.rootCanvas.width = size.x;
  78497. }
  78498. if (parseFloat(me.rootCanvas.height) !== parseFloat(size.y)) {
  78499. me.rootCanvas.height = size.y;
  78500. }
  78501. me.refresh();
  78502. },
  78503. //通知渲染器的尺寸变化
  78504. _resize: function () {
  78505. var me = this;
  78506. var newSize = me._map.getSize();
  78507. me.maxWidth = newSize.x;
  78508. me.maxHeight = newSize.y;
  78509. }
  78510. });
  78511. var heatMapLayer = function (name, options) {
  78512. return new HeatMapLayer(name, options);
  78513. };
  78514. (external_L_default()).supermap.heatMapLayer = heatMapLayer;
  78515. ;// CONCATENATED MODULE: ./src/leaflet/overlay/carto/index.js
  78516. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  78517. * This program are made available under the terms of the Apache License, Version 2.0
  78518. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  78519. ;// CONCATENATED MODULE: ./src/leaflet/overlay/mapv/index.js
  78520. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  78521. * This program are made available under the terms of the Apache License, Version 2.0
  78522. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  78523. ;// CONCATENATED MODULE: ./src/leaflet/overlay/theme/index.js
  78524. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  78525. * This program are made available under the terms of the Apache License, Version 2.0
  78526. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  78527. ;// CONCATENATED MODULE: ./src/leaflet/overlay/vectortile/index.js
  78528. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  78529. * This program are made available under the terms of the Apache License, Version 2.0
  78530. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  78531. ;// CONCATENATED MODULE: ./src/leaflet/overlay/index.js
  78532. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  78533. * This program are made available under the terms of the Apache License, Version 2.0
  78534. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  78535. ;// CONCATENATED MODULE: ./src/leaflet/services/AddressMatchService.js
  78536. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  78537. * This program are made available under the terms of the Apache License, Version 2.0
  78538. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  78539. /**
  78540. * @class L.supermap.addressMatchService
  78541. * @constructs L.supermap.addressMatchService
  78542. * @classdesc 地址匹配服务。
  78543. * @category iServer AddressMatch
  78544. * @extends {L.supermap.ServiceBase}
  78545. * @example
  78546. * L.supermap.addressMatchService(url,options)
  78547. * .code(function(result){
  78548. * //doSomething
  78549. * })
  78550. * @param {string} url - 地址匹配服务地址。
  78551. * @param {Object} options - 参数。
  78552. * @param {string} [options.proxy] - 服务代理地址。
  78553. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  78554. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  78555. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  78556. * @param {Object} [options.headers] - 请求头。
  78557. */
  78558. var AddressMatchService_AddressMatchService = ServiceBase.extend({
  78559. initialize: function (url, options) {
  78560. ServiceBase.prototype.initialize.call(this, url, options);
  78561. },
  78562. /**
  78563. * @function L.supermap.addressMatchService.prototype.code
  78564. * @description 获取正向地址匹配结果。
  78565. * @param {SuperMap.GeoCodingParameter} params - 正向匹配参数。
  78566. * @param {RequestCallback} callback - 请求结果的回调函数。
  78567. */
  78568. code: function (params, callback) {
  78569. var me = this;
  78570. var addressMatchService = new AddressMatchService(this.url, {
  78571. proxy: me.options.proxy,
  78572. withCredentials: me.options.withCredentials,
  78573. crossOrigin: me.options.crossOrigin,
  78574. headers: me.options.headers,
  78575. serverType: me.options.serverType,
  78576. eventListeners: {
  78577. scope: me,
  78578. processCompleted: callback,
  78579. processFailed: callback
  78580. }
  78581. });
  78582. addressMatchService.code(Util.urlPathAppend(me.url, 'geocoding'), params);
  78583. },
  78584. /**
  78585. * @function L.supermap.addressMatchService.prototype.decode
  78586. * @description 获取反向地址匹配结果。
  78587. * @param {SuperMap.GeoDecodingParameter} params - 反向匹配参数。
  78588. * @param {RequestCallback} callback - 请求结果的回调函数。
  78589. */
  78590. decode: function (params, callback) {
  78591. var me = this;
  78592. var addressMatchService = new AddressMatchService(me.url, {
  78593. proxy: me.options.proxy,
  78594. withCredentials: me.options.withCredentials,
  78595. crossOrigin: me.options.crossOrigin,
  78596. headers: me.options.headers,
  78597. serverType: me.options.serverType,
  78598. eventListeners: {
  78599. scope: me,
  78600. processCompleted: callback,
  78601. processFailed: callback
  78602. }
  78603. });
  78604. addressMatchService.decode(Util.urlPathAppend(me.url, 'geodecoding'), params);
  78605. }
  78606. });
  78607. var addressMatchService = function (url, options) {
  78608. return new AddressMatchService_AddressMatchService(url, options);
  78609. };
  78610. (external_L_default()).supermap.addressMatchService = addressMatchService;
  78611. ;// CONCATENATED MODULE: ./src/leaflet/services/ChartService.js
  78612. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  78613. * This program are made available under the terms of the Apache License, Version 2.0
  78614. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  78615. /**
  78616. * @class L.supermap.chartService
  78617. * @classdesc 海图服务。
  78618. * @category iServer Map Chart
  78619. * @extends {L.supermap.ServiceBase}
  78620. * @example
  78621. * L.supermap.chartService(url)
  78622. * .queryChart(param,function(result){
  78623. * //doSomething
  78624. * })
  78625. * @param {string} url - 与客户端交互的海图服务地址。
  78626. * @param {Object} options - 参数。
  78627. * @param {string} [options.proxy] - 服务代理地址。
  78628. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  78629. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  78630. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  78631. * @param {Object} [options.headers] - 请求头。
  78632. */
  78633. var ChartService = ServiceBase.extend({
  78634. initialize: function (url, options) {
  78635. ServiceBase.prototype.initialize.call(this, url, options);
  78636. },
  78637. /**
  78638. * @function L.supermap.chartService.prototype.queryChart
  78639. * @description 查询海图。
  78640. * @param {SuperMap.ChartQueryParameters} params - 海图查询所需参数类。
  78641. * @param {RequestCallback} callback - 回调函数。
  78642. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果格式类型。
  78643. */
  78644. queryChart: function (params, callback, resultFormat) {
  78645. var me = this,
  78646. param = me._processParams(params),
  78647. format = me._processFormat(resultFormat);
  78648. var chartQueryService = new ChartQueryService(me.url, {
  78649. proxy: me.options.proxy,
  78650. withCredentials: me.options.withCredentials,
  78651. crossOrigin:me.options.crossOrigin,
  78652. headers:me.options.headers,
  78653. serverType: me.options.serverType,
  78654. eventListeners: {
  78655. scope: me,
  78656. processCompleted: callback,
  78657. processFailed: callback
  78658. },
  78659. format: format
  78660. });
  78661. chartQueryService.processAsync(param);
  78662. },
  78663. /**
  78664. * @function L.supermap.chartService.prototype.getChartFeatureInfo
  78665. * @description 获取海图物标信息。
  78666. * @param {RequestCallback} callback 回调函数。
  78667. */
  78668. getChartFeatureInfo: function (callback) {
  78669. var me = this, url = me.url.concat();
  78670. url = Util.urlPathAppend(url, 'chartFeatureInfoSpecs');
  78671. var chartFeatureInfoSpecsService = new ChartFeatureInfoSpecsService(url, {
  78672. proxy: me.options.proxy,
  78673. withCredentials: me.options.withCredentials,
  78674. crossOrigin:me.options.crossOrigin,
  78675. headers:me.options.headers,
  78676. serverType: me.options.serverType,
  78677. eventListeners: {
  78678. scope: me,
  78679. processCompleted: callback,
  78680. processFailed: callback
  78681. }
  78682. });
  78683. chartFeatureInfoSpecsService.processAsync();
  78684. },
  78685. _processParams: function (params) {
  78686. if (!params) {
  78687. return {};
  78688. }
  78689. params.returnContent = (params.returnContent == null) ? true : params.returnContent;
  78690. if (params.chartQueryFilterParameters && !external_L_default().Util.isArray(params.chartQueryFilterParameters)) {
  78691. params.chartQueryFilterParameters = [params.chartQueryFilterParameters];
  78692. }
  78693. if (params.bounds) {
  78694. params.bounds = CommontypesConversion.toSuperMapBounds(params.bounds);
  78695. }
  78696. },
  78697. _processFormat: function (resultFormat) {
  78698. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  78699. }
  78700. });
  78701. var chartService = function (url, options) {
  78702. return new ChartService(url, options);
  78703. };
  78704. (external_L_default()).supermap.chartService = chartService;
  78705. ;// CONCATENATED MODULE: ./src/leaflet/services/FieldService.js
  78706. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  78707. * This program are made available under the terms of the Apache License, Version 2.0
  78708. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  78709. /**
  78710. * @class L.supermap.fieldService
  78711. * @classdesc 字段服务类。
  78712. * @category iServer Data Field
  78713. * @extends {L.supermap.ServiceBase}
  78714. * @example
  78715. * L.supermap.fieldService(url).getFields(function(result){
  78716. * //doSomething
  78717. * });
  78718. * @param {string} url - 字段服务地址。
  78719. * @param {Object} options - 参数。
  78720. * @param {string} [options.proxy] - 服务代理地址。
  78721. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  78722. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  78723. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  78724. * @param {Object} [options.headers] - 请求头。
  78725. */
  78726. var FieldService = ServiceBase.extend({
  78727. initialize: function (url,options) {
  78728. ServiceBase.prototype.initialize.call(this, url,options);
  78729. },
  78730. /**
  78731. * @function L.supermap.fieldService.prototype.getFields
  78732. * @description 字段查询服务。
  78733. * @param {SuperMap.FieldParameters} params - 字段信息查询参数类。
  78734. * @param {RequestCallback} callback - 回调函数。
  78735. */
  78736. getFields: function (params, callback) {
  78737. var me = this;
  78738. var getFieldsService = new GetFieldsService(me.url, {
  78739. proxy: me.options.proxy,
  78740. withCredentials: me.options.withCredentials,
  78741. crossOrigin:me.options.crossOrigin,
  78742. headers: me.options.headers,
  78743. serverType: me.options.serverType,
  78744. eventListeners: {
  78745. scope: me,
  78746. processCompleted: callback,
  78747. processFailed: callback
  78748. },
  78749. datasource: params.datasource,
  78750. dataset: params.dataset
  78751. });
  78752. getFieldsService.processAsync();
  78753. },
  78754. /**
  78755. * @function L.supermap.fieldService.prototype.getFieldStatisticsInfo
  78756. * @description 字段统计服务。
  78757. * @param {SuperMap.FieldStatisticsParameters} params - 字段统计信息查询参数类。
  78758. * @param {RequestCallback} callback - 回调函数。
  78759. */
  78760. getFieldStatisticsInfo: function (params, callback) {
  78761. if (!(params instanceof FieldStatisticsParameters)) {
  78762. return;
  78763. }
  78764. var me = this,
  78765. fieldName = params.fieldName,
  78766. modes = params.statisticMode;
  78767. if (modes && !external_L_default().Util.isArray(modes)) {
  78768. modes = [modes];
  78769. }
  78770. me.currentStatisticResult = {fieldName: fieldName};
  78771. me._statisticsCallback = callback;
  78772. //针对每种统计方式分别进行请求
  78773. modes.forEach(mode => {
  78774. me.currentStatisticResult[mode] = null;
  78775. me._fieldStatisticRequest(params.datasource, params.dataset, fieldName, mode);
  78776. });
  78777. },
  78778. _fieldStatisticRequest: function (dataSourceName, dataSetName, fieldName, statisticMode) {
  78779. var me = this;
  78780. var statisticService = new FieldStatisticService(me.url, {
  78781. eventListeners: {
  78782. scope: me,
  78783. processCompleted: me._processCompleted,
  78784. processFailed: me._statisticsCallback
  78785. },
  78786. datasource: dataSourceName,
  78787. dataset: dataSetName,
  78788. field: fieldName,
  78789. statisticMode: statisticMode,
  78790. withCredentials: me.options.withCredentials,
  78791. crossOrigin: me.options.crossOrigin,
  78792. headers: me.options.headers
  78793. });
  78794. statisticService.processAsync();
  78795. },
  78796. _processCompleted: function (fieldStatisticResult) {
  78797. var me = this;
  78798. var getAll = true,
  78799. result = fieldStatisticResult.result;
  78800. if (this.currentStatisticResult) {
  78801. if (null == me.currentStatisticResult[result.mode]) {
  78802. this.currentStatisticResult[result.mode] = result.result;
  78803. }
  78804. }
  78805. for (var mode in me.currentStatisticResult) {
  78806. if (null == me.currentStatisticResult[mode]) {
  78807. getAll = false;
  78808. break;
  78809. }
  78810. }
  78811. if (getAll) {
  78812. me._statisticsCallback({result: me.currentStatisticResult});
  78813. }
  78814. }
  78815. });
  78816. var fieldService = function (url, options) {
  78817. return new FieldService(url, options);
  78818. };
  78819. (external_L_default()).supermap.fieldService = fieldService;
  78820. ;// CONCATENATED MODULE: ./src/leaflet/services/GridCellInfosService.js
  78821. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  78822. * This program are made available under the terms of the Apache License, Version 2.0
  78823. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  78824. /**
  78825. * @class L.supermap.gridCellInfosService
  78826. * @classdesc 数据栅格查询服务。
  78827. * @category iServer Data Grid
  78828. * @extends {L.supermap.ServiceBase}
  78829. * @example
  78830. * L.supermap.gridCellInfosService(url)
  78831. * .getGridCellInfos(param,function(result){
  78832. * //doSomething
  78833. * })
  78834. * @param {string} url - 数据栅格查询服务地址。
  78835. * @param {Object} options - 参数。
  78836. * @param {string} [options.proxy] - 服务代理地址。
  78837. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  78838. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  78839. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  78840. * @param {Object} [options.headers] - 请求头。
  78841. */
  78842. var GridCellInfosService = ServiceBase.extend({
  78843. initialize: function (url, options) {
  78844. ServiceBase.prototype.initialize.call(this, url, options);
  78845. },
  78846. /**
  78847. * @function L.supermap.gridCellInfosService.prototype.getGridCellInfos
  78848. * @param {SuperMap.GetGridCellInfosParameters} params - 数据服务栅格查询参数类。
  78849. * @param {RequestCallback} callback - 回调函数。
  78850. */
  78851. getGridCellInfos: function (params, callback) {
  78852. if (!(params instanceof GetGridCellInfosParameters)) {
  78853. return;
  78854. }
  78855. var me = this;
  78856. var gridCellQueryService = new GetGridCellInfosService(me.url, {
  78857. proxy: me.options.proxy,
  78858. withCredentials: me.options.withCredentials,
  78859. crossOrigin: me.options.crossOrigin,
  78860. headers:me.options.headers,
  78861. serverType: me.options.serverType,
  78862. eventListeners: {
  78863. scope: me,
  78864. processCompleted: callback,
  78865. processFailed: callback
  78866. }
  78867. });
  78868. gridCellQueryService.processAsync(params);
  78869. }
  78870. });
  78871. var gridCellInfosService = function (url, options) {
  78872. return new GridCellInfosService(url, options);
  78873. };
  78874. (external_L_default()).supermap.gridCellInfosService = gridCellInfosService;
  78875. ;// CONCATENATED MODULE: ./src/leaflet/services/GeoprocessingService.js
  78876. /**
  78877. * @class L.supermap.geoprocessingService
  78878. * @classdesc 地理处理服务接口类。
  78879. * @version 10.1.0
  78880. * @category iServer GeoprocessingService
  78881. * @extends L.supermap.ServiceBase
  78882. * @example
  78883. * //为了安全访问受保护的地理处理服务,必须通过传递iserver令牌(token),才能正确访问相关资源。
  78884. * SuperMap.SecurityManager.registerToken(serviceUrl, token);
  78885. * var geoprocessingService = new L.supermap.geoprocessingService("http://localhost:8090/iserver/services/geoprocessing/restjsr/gp/v2")
  78886. geoprocessingService.submitJob(identifier,params, environments, function(serverResult) {
  78887. console.log(serverResult.result);
  78888. var jobID = serverResult.result.jobID;
  78889. var options = {
  78890. interval: 5000,
  78891. statusCallback: function(state) {
  78892. console.log("Job Status: ", state);
  78893. }
  78894. };
  78895. geoprocessingService.waitForJobCompletion(jobID, identifier, options, function(serverResult) {
  78896. console.log(serverResult);
  78897. })
  78898. })
  78899. *
  78900. * @param {string} url - 服务地址。
  78901. * @param {Object} options - 参数。
  78902. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 iServer|iPortal|online。
  78903. */
  78904. const GeoprocessingService_GeoprocessingService = ServiceBase.extend({
  78905. initialize: function (url, options) {
  78906. options = options || {};
  78907. external_L_default().setOptions(this, options);
  78908. ServiceBase.prototype.initialize.call(this, url, options);
  78909. this.headers = {};
  78910. this.crossOrigin = true;
  78911. this.withCredentials = true;
  78912. this.proxy = true;
  78913. },
  78914. /**
  78915. * @function L.supermap.geoprocessingService.prototype.getTools
  78916. * @description 获取地理处理工具列表。
  78917. * @param {RequestCallback} callback 请求结果的回调函数。
  78918. */
  78919. getTools: function (callback) {
  78920. const geoprocessingJobsService = new GeoprocessingService(this.url, {
  78921. proxy: this.options.proxy,
  78922. withCredentials: this.options.withCredentials,
  78923. crossOrigin: this.options.crossOrigin,
  78924. headers: this.options.headers,
  78925. serverType: this.options.serverType,
  78926. eventListeners: {
  78927. scope: this,
  78928. processCompleted: callback,
  78929. processFailed: callback
  78930. }
  78931. });
  78932. geoprocessingJobsService.getTools();
  78933. },
  78934. /**
  78935. * @function L.supermap.geoprocessingService.prototype.getTool
  78936. * @description 获取工具的ID、名称、描述、输入参数、环境参数和输出结果等相关参数。
  78937. * @param {string} identifier - 地理处理工具ID。
  78938. * @param {RequestCallback} callback 请求结果的回调函数。
  78939. */
  78940. getTool: function (identifier, callback) {
  78941. const geoprocessingJobsService = new GeoprocessingService(this.url, {
  78942. proxy: this.options.proxy,
  78943. withCredentials: this.options.withCredentials,
  78944. crossOrigin: this.options.crossOrigin,
  78945. headers: this.options.headers,
  78946. serverType: this.options.serverType,
  78947. eventListeners: {
  78948. scope: this,
  78949. processCompleted: callback,
  78950. processFailed: callback
  78951. }
  78952. });
  78953. geoprocessingJobsService.getTool(identifier);
  78954. },
  78955. /**
  78956. * @function L.supermap.geoprocessingService.prototype.execute
  78957. * @description 同步执行地理处理工具。
  78958. * @param {string} identifier - 地理处理工具ID。
  78959. * @param {Object} parameter - 地理处理工具的输入参数。
  78960. * @param {Object} environment - 地理处理工具的环境参数。
  78961. * @param {RequestCallback} callback 回调函数。
  78962. */
  78963. execute: function (identifier, parameter, environment, callback) {
  78964. const geoprocessingJobsService = new GeoprocessingService(this.url, {
  78965. proxy: this.options.proxy,
  78966. withCredentials: this.options.withCredentials,
  78967. crossOrigin: this.options.crossOrigin,
  78968. headers: this.options.headers,
  78969. serverType: this.options.serverType,
  78970. eventListeners: {
  78971. scope: this,
  78972. processCompleted: callback,
  78973. processFailed: callback
  78974. }
  78975. });
  78976. geoprocessingJobsService.execute(identifier, parameter, environment);
  78977. },
  78978. /**
  78979. * @function L.supermap.geoprocessingService.prototype.submitJob
  78980. * @description 异步执行地理处理工具。
  78981. * @param {string} identifier - 地理处理工具ID。
  78982. * @param {Object} parameter - 地理处理工具的输入参数。
  78983. * @param {Object} environment - 地理处理工具的环境参数。
  78984. * @param {RequestCallback} callback 回调函数。
  78985. */
  78986. submitJob: function (identifier, parameter, environment, callback) {
  78987. const geoprocessingJobsService = new GeoprocessingService(this.url, {
  78988. proxy: this.options.proxy,
  78989. withCredentials: this.options.withCredentials,
  78990. crossOrigin: this.options.crossOrigin,
  78991. headers: this.options.headers,
  78992. serverType: this.options.serverType,
  78993. eventListeners: {
  78994. scope: this,
  78995. processCompleted: callback,
  78996. processFailed: callback
  78997. }
  78998. });
  78999. geoprocessingJobsService.submitJob(identifier, parameter, environment);
  79000. },
  79001. /**
  79002. * @function L.supermap.geoprocessingService.prototype.waitForJobCompletion
  79003. * @description 获取地理处理异步执行状态信息。
  79004. * @param {string} jobId - 地理处理任务ID。
  79005. * @param {string} identifier - 地理处理工具ID。
  79006. * @param {Object} options - 状态信息参数。
  79007. * @param {number} options.interval - 定时器时间间隔。
  79008. * @param {RequestCallback} options.statusCallback - 任务状态的回调函数。
  79009. * @param {Callback} callback 回调函数。
  79010. */
  79011. waitForJobCompletion: function (jobId, identifier, options, callback) {
  79012. const geoprocessingJobsService = new GeoprocessingService(this.url, {
  79013. proxy: this.options.proxy,
  79014. withCredentials: this.options.withCredentials,
  79015. crossOrigin: this.options.crossOrigin,
  79016. headers: this.options.headers,
  79017. serverType: this.options.serverType,
  79018. eventListeners: {
  79019. scope: this,
  79020. processCompleted: callback,
  79021. processFailed: callback
  79022. }
  79023. });
  79024. geoprocessingJobsService.waitForJobCompletion(jobId, identifier, options);
  79025. },
  79026. /**
  79027. * @function L.supermap.geoprocessingService.prototype.getJobInfo
  79028. * @description 获取地理处理任务的执行信息。
  79029. * @param {string} identifier - 地理处理工具ID。
  79030. * @param {string} jobId - 地理处理任务ID。
  79031. * @param {RequestCallback} callback 回调函数。
  79032. */
  79033. getJobInfo: function (identifier, jobId, callback) {
  79034. const geoprocessingJobsService = new GeoprocessingService(this.url, {
  79035. proxy: this.options.proxy,
  79036. withCredentials: this.options.withCredentials,
  79037. crossOrigin: this.options.crossOrigin,
  79038. headers: this.options.headers,
  79039. serverType: this.options.serverType,
  79040. eventListeners: {
  79041. scope: this,
  79042. processCompleted: callback,
  79043. processFailed: callback
  79044. }
  79045. });
  79046. geoprocessingJobsService.getJobInfo(identifier, jobId);
  79047. },
  79048. /**
  79049. * @function L.supermap.geoprocessingService.prototype.cancelJob
  79050. * @description 取消地理处理任务的异步执行。
  79051. * @param {string} identifier - 地理处理工具ID。
  79052. * @param {string} jobId - 地理处理任务ID。
  79053. * @param {RequestCallback} callback 回调函数。
  79054. */
  79055. cancelJob: function (identifier, jobId, callback) {
  79056. const geoprocessingJobsService = new GeoprocessingService(this.url, {
  79057. proxy: this.options.proxy,
  79058. withCredentials: this.options.withCredentials,
  79059. crossOrigin: this.options.crossOrigin,
  79060. headers: this.options.headers,
  79061. serverType: this.options.serverType,
  79062. eventListeners: {
  79063. scope: this,
  79064. processCompleted: callback,
  79065. processFailed: callback
  79066. }
  79067. });
  79068. geoprocessingJobsService.cancelJob(identifier, jobId);
  79069. },
  79070. /**
  79071. * @function L.supermap.geoprocessingService.prototype.getJobs
  79072. * @description 获取地理处理服务任务列表。
  79073. * @param {string} identifier - 地理处理工具ID。(传参代表identifier算子的任务列表,不传参代表所有任务的列表)
  79074. * @param {RequestCallback} callback 回调函数。
  79075. */
  79076. getJobs: function (identifier, callback) {
  79077. const geoprocessingJobsService = new GeoprocessingService(this.url, {
  79078. proxy: this.options.proxy,
  79079. withCredentials: this.options.withCredentials,
  79080. crossOrigin: this.options.crossOrigin,
  79081. headers: this.options.headers,
  79082. serverType: this.options.serverType,
  79083. eventListeners: {
  79084. scope: this,
  79085. processCompleted: callback,
  79086. processFailed: callback
  79087. }
  79088. });
  79089. geoprocessingJobsService.getJobs(identifier);
  79090. },
  79091. /**
  79092. * @function L.supermap.geoprocessingService.prototype.getResults
  79093. * @description 地理处理工具异步执行的结果,支持结果过滤。
  79094. * @param {string} identifier - 地理处理工具ID。
  79095. * @param {string} jobId - 地理处理任务ID。
  79096. * @param {string} filter - 输出异步结果的id。(可选,传入filter参数时对该地理处理工具执行的结果进行过滤获取,不填参时显示所有的执行结果)
  79097. * @param {RequestCallback} callback 请求结果的回调函数。
  79098. */
  79099. getResults: function (identifier, jobId, filter, callback) {
  79100. const geoprocessingJobsService = new GeoprocessingService(this.url, {
  79101. proxy: this.options.proxy,
  79102. withCredentials: this.options.withCredentials,
  79103. crossOrigin: this.options.crossOrigin,
  79104. headers: this.options.headers,
  79105. serverType: this.options.serverType,
  79106. eventListeners: {
  79107. scope: this,
  79108. processCompleted: callback,
  79109. processFailed: callback
  79110. }
  79111. });
  79112. geoprocessingJobsService.getResults(identifier, jobId, filter);
  79113. }
  79114. });
  79115. const geoprocessingService = function (url, options) {
  79116. return new GeoprocessingService_GeoprocessingService(url, options);
  79117. };
  79118. (external_L_default()).supermap.geoprocessingService = geoprocessingService;
  79119. ;// CONCATENATED MODULE: ./src/leaflet/services/LayerInfoService.js
  79120. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  79121. * This program are made available under the terms of the Apache License, Version 2.0
  79122. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  79123. /**
  79124. * @class L.supermap.layerInfoService
  79125. * @classdesc 图层信息类。
  79126. * @category iServer Map Layer
  79127. * @extends {L.supermap.ServiceBase}
  79128. * @example
  79129. * L.supermap.layerInfoService(url).getLayersInfo(function(result){
  79130. * //doSomething
  79131. * })
  79132. * @param {string} url - 与服务端交互的地图服务地址。请求地图服务 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名}"。
  79133. * @param {Object} options - 参数。
  79134. * @param {string} [options.proxy] - 服务代理地址。
  79135. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  79136. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  79137. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  79138. * @param {Object} [options.headers] - 请求头。
  79139. */
  79140. var LayerInfoService = ServiceBase.extend({
  79141. initialize: function (url, options) {
  79142. ServiceBase.prototype.initialize.call(this, url, options);
  79143. },
  79144. /**
  79145. * @function L.supermap.layerInfoService.prototype.getLayersInfo
  79146. * @description 获取图层信息。
  79147. * @param {RequestCallback} callback - 获取信息完成后的回调函数。
  79148. */
  79149. getLayersInfo: function (callback) {
  79150. var me = this;
  79151. var getLayersInfoService = new GetLayersInfoService(me.url, {
  79152. proxy: me.options.proxy,
  79153. withCredentials: me.options.withCredentials,
  79154. crossOrigin: me.options.crossOrigin,
  79155. headers: me.options.headers,
  79156. serverType: me.options.serverType,
  79157. eventListeners: {
  79158. processCompleted: callback,
  79159. processFailed: callback
  79160. }
  79161. });
  79162. getLayersInfoService.processAsync();
  79163. },
  79164. /**
  79165. * @function L.supermap.layerInfoService.prototype.setLayerInfo
  79166. * @description 设置图层信息服务。可以实现临时图层中子图层的修改。
  79167. * @param {SuperMap.SetLayerInfoParameters} params - 图层信息相关参数。
  79168. * @param {RequestCallback} callback - 回调函数。
  79169. */
  79170. setLayerInfo: function (params, callback) {
  79171. if (!(params instanceof SetLayerInfoParameters)) {
  79172. return;
  79173. }
  79174. var me = this,
  79175. resourceID = params.resourceID,
  79176. tempLayerName = params.tempLayerName,
  79177. layerInfoParams = params.layerInfo;
  79178. if (!resourceID || !tempLayerName) {
  79179. return;
  79180. }
  79181. var url = Util.urlPathAppend(me.url,`tempLayersSet/${resourceID}/${tempLayerName}`);
  79182. var setLayerInfoService = new SetLayerInfoService(url, {
  79183. proxy: me.options.proxy,
  79184. withCredentials: me.options.withCredentials,
  79185. crossOrigin: me.options.crossOrigin,
  79186. headers: me.options.headers,
  79187. serverType: me.options.serverType,
  79188. eventListeners: {
  79189. processCompleted: callback,
  79190. processFailed: callback
  79191. }
  79192. });
  79193. setLayerInfoService.processAsync(layerInfoParams);
  79194. },
  79195. /**
  79196. * @function L.supermap.layerInfoService.prototype.setLayersInfo
  79197. * @description 设置图层信息。可以实现创建新的临时图层和对现有临时图层的修改。
  79198. * @param {SuperMap.SetLayersInfoParameters} params - 图层信息设置参数,包括临时图层。
  79199. * @param {RequestCallback} callback - 回调函数。
  79200. */
  79201. setLayersInfo: function (params, callback) {
  79202. if (!(params instanceof SetLayersInfoParameters)) {
  79203. return;
  79204. }
  79205. var me = this,
  79206. resourceID = params.resourceID,
  79207. isTempLayers = params.isTempLayers ? params.isTempLayers : false,
  79208. layersInfo = params.layersInfo;
  79209. if ((isTempLayers && !resourceID) || !layersInfo) {
  79210. return;
  79211. }
  79212. var setLayersInfoService = new SetLayersInfoService(me.url, {
  79213. proxy: me.options.proxy,
  79214. withCredentials: me.options.withCredentials,
  79215. crossOrigin: me.options.crossOrigin,
  79216. headers: me.options.headers,
  79217. serverType: me.options.serverType,
  79218. eventListeners: {
  79219. processCompleted: callback,
  79220. processFailed: callback
  79221. },
  79222. resourceID: resourceID,
  79223. isTempLayers: isTempLayers
  79224. });
  79225. setLayersInfoService.processAsync(layersInfo);
  79226. },
  79227. /**
  79228. * @function L.supermap.layerInfoService.prototype.setLayerStatus
  79229. * @description 负责将子图层显示控制参数传递到服务端,并获取服务端返回的图层显示状态。
  79230. * @param {SuperMap.SetLayerStatusParameters} params - 图层信息显示控制参数。
  79231. * @param {RequestCallback} callback - 回调函数。
  79232. */
  79233. setLayerStatus: function (params, callback) {
  79234. if (!(params instanceof SetLayerStatusParameters)) {
  79235. return;
  79236. }
  79237. var me = this;
  79238. var setLayerStatusService = new SetLayerStatusService(me.url, {
  79239. proxy: me.options.proxy,
  79240. withCredentials: me.options.withCredentials,
  79241. crossOrigin: me.options.crossOrigin,
  79242. headers: me.options.headers,
  79243. serverType: me.options.serverType,
  79244. eventListeners: {
  79245. processCompleted: callback,
  79246. processFailed: callback
  79247. }
  79248. });
  79249. setLayerStatusService.processAsync(params);
  79250. }
  79251. });
  79252. var layerInfoService = function (url, options) {
  79253. return new LayerInfoService(url, options);
  79254. };
  79255. (external_L_default()).supermap.layerInfoService = layerInfoService;
  79256. ;// CONCATENATED MODULE: ./src/leaflet/services/MeasureService.js
  79257. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  79258. * This program are made available under the terms of the Apache License, Version 2.0
  79259. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  79260. /**
  79261. * @class L.supermap.measureService
  79262. * @classdesc 量算服务类。
  79263. * @category iServer Map Measure
  79264. * @augments {L.supermap.ServiceBase}
  79265. * @example
  79266. * 用法:
  79267. * L.supermap.measureService(url).measureDistance({
  79268. * geometry:xxx
  79269. * },function(result){
  79270. * //doSomething
  79271. * })
  79272. * @param {string} url - 服务访问的地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World。
  79273. * @param {Object} options - 参数。
  79274. * @param {string} [options.proxy] - 服务代理地址。
  79275. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  79276. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  79277. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  79278. * @param {Object} [options.headers] - 请求头。
  79279. * @extends {L.supermap.ServiceBase}
  79280. */
  79281. var MeasureService_MeasureService = ServiceBase.extend({
  79282. initialize: function (url, options) {
  79283. ServiceBase.prototype.initialize.call(this, url, options);
  79284. },
  79285. /**
  79286. * @function L.supermap.measureService.prototype.measureDistance
  79287. * @description 测距。
  79288. * @param {SuperMap.MeasureParameters} params - 测量相关参数类。
  79289. * @param {RequestCallback} callback - 回调函数。
  79290. */
  79291. measureDistance: function (params, callback) {
  79292. this.measure(MeasureMode.DISTANCE, params, callback);
  79293. return this;
  79294. },
  79295. /**
  79296. * @function L.supermap.measureService.prototype.measureArea
  79297. * @description 测面积。
  79298. * @param {SuperMap.MeasureParameters} params - 测量相关参数类。
  79299. * @param {RequestCallback} callback - 回调函数。
  79300. */
  79301. measureArea: function (params, callback) {
  79302. this.measure(MeasureMode.AREA, params, callback);
  79303. return this;
  79304. },
  79305. /**
  79306. * @function L.supermap.measureService.measure
  79307. * @param {SuperMap.MeasureMode} [type=SuperMap.MeasureMode.DISTANCE] - 量算模式。
  79308. * @param {SuperMap.MeasureParameters} params - 测量相关参数类。
  79309. * @param {RequestCallback} callback - 回调函数。
  79310. */
  79311. measure: function (type, params, callback) {
  79312. if (!(params instanceof MeasureParameters)) {
  79313. return;
  79314. }
  79315. var me = this;
  79316. if (params.geometry) {
  79317. params.geometry = toSuperMapGeometry(params.geometry);
  79318. }
  79319. var measureService = new MeasureService(me.url, {
  79320. proxy: me.options.proxy,
  79321. withCredentials: me.options.withCredentials,
  79322. crossOrigin: me.options.crossOrigin,
  79323. headers: me.options.headers,
  79324. serverType: me.options.serverType,
  79325. measureMode: type,
  79326. eventListeners: {
  79327. scope: me,
  79328. processCompleted: callback,
  79329. processFailed: callback
  79330. }
  79331. });
  79332. measureService.processAsync(params);
  79333. }
  79334. });
  79335. var measureService = function (url, options) {
  79336. return new MeasureService_MeasureService(url, options);
  79337. };
  79338. (external_L_default()).supermap.measureService = measureService;
  79339. ;// CONCATENATED MODULE: ./src/leaflet/services/NetworkAnalyst3DService.js
  79340. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  79341. * This program are made available under the terms of the Apache License, Version 2.0
  79342. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  79343. /**
  79344. * @class L.supermap.networkAnalyst3DService
  79345. * @classdesc 3D 网络分析服务类。
  79346. * @category iServer FacilityAnalyst3D
  79347. * @extends {L.supermap.ServiceBase}
  79348. * @example
  79349. * L.supermap.networkAnalyst3DService(url)
  79350. * .sinksFacilityAnalyst(params,function(result){
  79351. * //doSomething
  79352. * })
  79353. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  79354. * "http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  79355. * @param {Object} options - 参数。
  79356. * @param {string} [options.proxy] - 服务代理地址。
  79357. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  79358. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  79359. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  79360. * @param {Object} [options.headers] - 请求头。
  79361. */
  79362. var NetworkAnalyst3DService = ServiceBase.extend({
  79363. initialize: function (url, options) {
  79364. ServiceBase.prototype.initialize.call(this, url, options);
  79365. },
  79366. /**
  79367. * @function L.supermap.networkAnalyst3DService.prototype.sinksFacilityAnalyst
  79368. * @description 汇查找服务。
  79369. * @param {SuperMap.FacilityAnalystSinks3DParameters} params - 最近设施分析参数类(汇查找资源)。
  79370. * @param {RequestCallback} callback - 回调函数。
  79371. */
  79372. sinksFacilityAnalyst: function (params, callback) {
  79373. var me = this;
  79374. var facilityAnalystSinks3DService = new FacilityAnalystSinks3DService(me.url, {
  79375. proxy: me.options.proxy,
  79376. withCredentials: me.options.withCredentials,
  79377. crossOrigin: me.options.crossOrigin,
  79378. headers: me.options.headers,
  79379. serverType: me.options.serverType,
  79380. eventListeners: {
  79381. scope: me,
  79382. processCompleted: callback,
  79383. processFailed: callback
  79384. }
  79385. });
  79386. facilityAnalystSinks3DService.processAsync(params);
  79387. },
  79388. /**
  79389. * @function L.supermap.networkAnalyst3DService.prototype.sourcesFacilityAnalyst
  79390. * @description 源查找服务。
  79391. * @param {SuperMap.FacilityAnalystSources3DParameters} params - 最近设施分析参数类(源查找服务)。
  79392. * @param {RequestCallback} callback - 回调函数。
  79393. * @returns {this} this
  79394. */
  79395. sourcesFacilityAnalyst: function (params, callback) {
  79396. var me = this;
  79397. var facilityAnalystSources3DService = new FacilityAnalystSources3DService(me.url, {
  79398. proxy: me.options.proxy,
  79399. withCredentials: me.options.withCredentials,
  79400. crossOrigin: me.options.crossOrigin,
  79401. headers: me.options.headers,
  79402. serverType: me.options.serverType,
  79403. eventListeners: {
  79404. scope: me,
  79405. processCompleted: callback,
  79406. processFailed: callback
  79407. }
  79408. });
  79409. facilityAnalystSources3DService.processAsync(params);
  79410. },
  79411. /**
  79412. * @function L.supermap.networkAnalyst3DService.prototype.traceUpFacilityAnalyst
  79413. * @description 上游追踪资源服务。
  79414. * @param {SuperMap.FacilityAnalystTraceup3DParameters} params - 上游追踪资源参数类。
  79415. * @param {RequestCallback} callback - 回调函数。
  79416. * @returns {this} this
  79417. */
  79418. traceUpFacilityAnalyst: function (params, callback) {
  79419. var me = this;
  79420. var facilityAnalystTraceup3DService = new FacilityAnalystTraceup3DService(me.url, {
  79421. proxy: me.options.proxy,
  79422. withCredentials: me.options.withCredentials,
  79423. crossOrigin: me.options.crossOrigin,
  79424. headers: me.options.headers,
  79425. serverType: me.options.serverType,
  79426. eventListeners: {
  79427. scope: me,
  79428. processCompleted: callback,
  79429. processFailed: callback
  79430. }
  79431. });
  79432. facilityAnalystTraceup3DService.processAsync(params);
  79433. },
  79434. /**
  79435. * @function L.supermap.networkAnalyst3DService.prototype.traceDownFacilityAnalyst
  79436. * @description 下游追踪资源服务。
  79437. * @param {SuperMap.FacilityAnalystTracedown3DParameters} params - 下游追踪资源服务参数类。
  79438. * @param {RequestCallback} callback - 回调函数。
  79439. */
  79440. traceDownFacilityAnalyst: function (params, callback) {
  79441. var me = this;
  79442. var facilityAnalystTracedown3DService = new FacilityAnalystTracedown3DService(me.url, {
  79443. proxy: me.options.proxy,
  79444. withCredentials: me.options.withCredentials,
  79445. crossOrigin: me.options.crossOrigin,
  79446. headers: me.options.headers,
  79447. serverType: me.options.serverType,
  79448. eventListeners: {
  79449. scope: me,
  79450. processCompleted: callback,
  79451. processFailed: callback
  79452. }
  79453. });
  79454. facilityAnalystTracedown3DService.processAsync(params);
  79455. },
  79456. /**
  79457. * @function L.supermap.networkAnalyst3DService.prototype.upstreamFacilityAnalyst
  79458. * @description 上游关键设施查找服务。
  79459. * @param {SuperMap.FacilityAnalystUpstream3DParameters} params - 上游关键设施查找服务参数类。
  79460. * @param {RequestCallback} callback - 回调函数。
  79461. */
  79462. upstreamFacilityAnalyst: function (params, callback) {
  79463. var me = this;
  79464. var facilityAnalystUpstream3DService = new FacilityAnalystUpstream3DService(me.url, {
  79465. proxy: me.options.proxy,
  79466. withCredentials: me.options.withCredentials,
  79467. crossOrigin: me.options.crossOrigin,
  79468. headers: me.options.headers,
  79469. serverType: me.options.serverType,
  79470. eventListeners: {
  79471. scope: me,
  79472. processCompleted: callback,
  79473. processFailed: callback
  79474. }
  79475. });
  79476. facilityAnalystUpstream3DService.processAsync(params);
  79477. }
  79478. });
  79479. var networkAnalyst3DService = function (url, options) {
  79480. return new NetworkAnalyst3DService(url, options);
  79481. };
  79482. (external_L_default()).supermap.networkAnalyst3DService = networkAnalyst3DService;
  79483. ;// CONCATENATED MODULE: ./src/leaflet/services/NetworkAnalystService.js
  79484. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  79485. * This program are made available under the terms of the Apache License, Version 2.0
  79486. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  79487. /**
  79488. * @class L.supermap.networkAnalystService
  79489. * @classdesc 网络分析服务类。
  79490. * @category iServer NetworkAnalyst
  79491. * @augments L.supermap.ServiceBase
  79492. * @example
  79493. * L.supermap.networkAnalystService(url)
  79494. * .findPath(params,function(result){
  79495. * //doSomething
  79496. * })
  79497. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  79498. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源}。<br>
  79499. * 例如: "http://localhost:8090/iserver/services/test/rest/networkanalyst/WaterNet@FacilityNet"。
  79500. * @param {Object} options - 参数。
  79501. * @param {string} [options.proxy] - 服务代理地址。
  79502. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  79503. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  79504. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  79505. * @param {Object} [options.headers] - 请求头。
  79506. * @extends {L.supermap.ServiceBase}
  79507. */
  79508. var NetworkAnalystService = ServiceBase.extend({
  79509. initialize: function (url, options) {
  79510. ServiceBase.prototype.initialize.call(this, url, options);
  79511. },
  79512. /**
  79513. * @function L.supermap.networkAnalystService.prototype.burstPipelineAnalyst
  79514. * @description 爆管分析服务:即将给定弧段或节点作为爆管点来进行分析,返回关键结点 ID 数组,普通结点 ID 数组及其上下游弧段 ID 数组。
  79515. * @param {SuperMap.BurstPipelineAnalystParameters} params - 爆管分析服务参数类。
  79516. * @param {RequestCallback} callback - 回调函数。
  79517. */
  79518. burstPipelineAnalyst: function (params, callback) {
  79519. var me = this;
  79520. var burstPipelineAnalystService = new BurstPipelineAnalystService(me.url, {
  79521. proxy: me.options.proxy,
  79522. withCredentials: me.options.withCredentials,
  79523. crossOrigin: me.options.crossOrigin,
  79524. headers: me.options.headers,
  79525. serverType: me.options.serverType,
  79526. eventListeners: {
  79527. scope: me,
  79528. processCompleted: callback,
  79529. processFailed: callback
  79530. }
  79531. });
  79532. burstPipelineAnalystService.processAsync(me._processParams(params));
  79533. },
  79534. /**
  79535. * @function L.supermap.networkAnalystService.prototype.computeWeightMatrix
  79536. * @description 耗费矩阵分析服务:根据交通网络分析参数中的耗费字段返回一个耗费矩阵。该矩阵是一个二维数组,用来存储任意两点间的资源消耗。
  79537. * @param {SuperMap.ComputeWeightMatrixParameters} params - 耗费矩阵分析服务参数类。
  79538. * @param {RequestCallback} callback - 回调函数。
  79539. */
  79540. computeWeightMatrix: function (params, callback) {
  79541. var me = this;
  79542. var computeWeightMatrixService = new ComputeWeightMatrixService(me.url, {
  79543. proxy: me.options.proxy,
  79544. withCredentials: me.options.withCredentials,
  79545. crossOrigin: me.options.crossOrigin,
  79546. headers: me.options.headers,
  79547. serverType: me.options.serverType,
  79548. eventListeners: {
  79549. scope: me,
  79550. processCompleted: callback,
  79551. processFailed: callback
  79552. }
  79553. });
  79554. computeWeightMatrixService.processAsync(me._processParams(params));
  79555. },
  79556. /**
  79557. * @function L.supermap.networkAnalystService.prototype.findClosestFacilities
  79558. * @description 最近设施分析服务:指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  79559. * @param {SuperMap.FindClosestFacilitiesParameters} params - 最近设施分析服务参数类。
  79560. * @param {RequestCallback} callback - 回调函数。
  79561. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79562. */
  79563. findClosestFacilities: function (params, callback, resultFormat) {
  79564. var me = this;
  79565. var findClosestFacilitiesService = new FindClosestFacilitiesService(me.url, {
  79566. proxy: me.options.proxy,
  79567. withCredentials: me.options.withCredentials,
  79568. crossOrigin: me.options.crossOrigin,
  79569. headers: me.options.headers,
  79570. serverType: me.options.serverType,
  79571. eventListeners: {
  79572. scope: me,
  79573. processCompleted: callback,
  79574. processFailed: callback
  79575. },
  79576. format: me._processFormat(resultFormat)
  79577. });
  79578. findClosestFacilitiesService.processAsync(me._processParams(params));
  79579. },
  79580. /**
  79581. * @function L.supermap.networkAnalystService.prototype.streamFacilityAnalyst
  79582. * @description 上游/下游 关键设施查找资源服务:查找给定弧段或节点的上游/下游中的关键设施结点,返回关键结点 ID 数组及其下游弧段 ID 数组。
  79583. * @param {SuperMap.FacilityAnalystStreamParameters} params - 上游/下游 关键设施查找资源服务参数类。
  79584. * @param {RequestCallback} callback - 回调函数。
  79585. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79586. */
  79587. streamFacilityAnalyst: function (params, callback, resultFormat) {
  79588. var me = this;
  79589. var facilityAnalystStreamService = new FacilityAnalystStreamService(me.url, {
  79590. proxy: me.options.proxy,
  79591. withCredentials: me.options.withCredentials,
  79592. crossOrigin: me.options.crossOrigin,
  79593. headers: me.options.headers,
  79594. serverType: me.options.serverType,
  79595. eventListeners: {
  79596. scope: me,
  79597. processCompleted: callback,
  79598. processFailed: callback
  79599. },
  79600. format: me._processFormat(resultFormat)
  79601. });
  79602. facilityAnalystStreamService.processAsync(me._processParams(params));
  79603. },
  79604. /**
  79605. * @function L.supermap.networkAnalystService.prototype.findLocation
  79606. * @description 选址分区分析服务:确定一个或多个待建设施的最佳或最优位置。
  79607. * @param {SuperMap.FindLocationParameters} params - 选址分区分析服务参数类。
  79608. * @param {RequestCallback} callback - 回调函数。
  79609. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79610. */
  79611. findLocation: function (params, callback, resultFormat) {
  79612. var me = this;
  79613. var findLocationService = new FindLocationService(me.url, {
  79614. proxy: me.options.proxy,
  79615. withCredentials: me.options.withCredentials,
  79616. crossOrigin: me.options.crossOrigin,
  79617. headers: me.options.headers,
  79618. serverType: me.options.serverType,
  79619. eventListeners: {
  79620. scope: me,
  79621. processCompleted: callback,
  79622. processFailed: callback
  79623. },
  79624. format: me._processFormat(resultFormat)
  79625. });
  79626. findLocationService.processAsync(me._processParams(params));
  79627. },
  79628. /**
  79629. * @function L.supermap.networkAnalystService.prototype.findPath
  79630. * @description 最佳路径分析服务:在网络数据集中指定一些节点,按照节点的选择顺序,顺序访问这些节点从而求解起止点之间阻抗最小的路经。
  79631. * @param {SuperMap.FindPathParameters} params - 最佳路径分析服务参数类。
  79632. * @param {RequestCallback} callback - 回调函数。
  79633. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79634. */
  79635. findPath: function (params, callback, resultFormat) {
  79636. var me = this;
  79637. var findPathService = new FindPathService(me.url, {
  79638. proxy: me.options.proxy,
  79639. withCredentials: me.options.withCredentials,
  79640. crossOrigin: me.options.crossOrigin,
  79641. headers: me.options.headers,
  79642. serverType: me.options.serverType,
  79643. eventListeners: {
  79644. scope: me,
  79645. processCompleted: callback,
  79646. processFailed: callback
  79647. },
  79648. format: me._processFormat(resultFormat)
  79649. });
  79650. findPathService.processAsync(me._processParams(params));
  79651. },
  79652. /**
  79653. * @function L.supermap.networkAnalystService.prototype.findTSPPaths
  79654. * @description 旅行商分析服务:路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。
  79655. * @param {SuperMap.FindTSPPathsParameters} params - 旅行商分析服务参数类。
  79656. * @param {RequestCallback} callback - 回调函数。
  79657. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79658. */
  79659. findTSPPaths: function (params, callback, resultFormat) {
  79660. var me = this;
  79661. var findTSPPathsService = new FindTSPPathsService(me.url, {
  79662. proxy: me.options.proxy,
  79663. withCredentials: me.options.withCredentials,
  79664. crossOrigin: me.options.crossOrigin,
  79665. headers: me.options.headers,
  79666. serverType: me.options.serverType,
  79667. eventListeners: {
  79668. scope: me,
  79669. processCompleted: callback,
  79670. processFailed: callback
  79671. },
  79672. format: me._processFormat(resultFormat)
  79673. });
  79674. findTSPPathsService.processAsync(me._processParams(params));
  79675. },
  79676. /**
  79677. * @function l.supermap.networkAnalystService.prototype.findMTSPPaths
  79678. * @description 多旅行商分析服务:也称为物流配送,是指在网络数据集中,给定 M 个配送中心点和 N 个配送目的地(M,N 为大于零的整数)。查找经济有效的配送路径,并给出相应的行走路线。
  79679. * @param {SuperMap.FindMTSPPathsParameters} params - 多旅行商分析服务参数类。
  79680. * @param {RequestCallback} callback - 回调函数。
  79681. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79682. */
  79683. findMTSPPaths: function (params, callback, resultFormat) {
  79684. var me = this;
  79685. var findMTSPPathsService = new FindMTSPPathsService(me.url, {
  79686. proxy: me.options.proxy,
  79687. withCredentials: me.options.withCredentials,
  79688. crossOrigin: me.options.crossOrigin,
  79689. headers: me.options.headers,
  79690. serverType: me.options.serverType,
  79691. eventListeners: {
  79692. scope: me,
  79693. processCompleted: callback,
  79694. processFailed: callback
  79695. },
  79696. format: me._processFormat(resultFormat)
  79697. });
  79698. findMTSPPathsService.processAsync(me._processParams(params));
  79699. },
  79700. /**
  79701. * @function L.supermap.networkAnalystService.prototype.findServiceAreas
  79702. * @description 服务区分析服务:以指定服务站点为中心,在一定服务范围内查找网络上服务站点能够提供服务的区域范围。
  79703. * @param {SuperMap.FindServiceAreasParameters} params - 服务区分析服务参数类。
  79704. * @param {RequestCallback} callback - 回调函数。
  79705. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79706. */
  79707. findServiceAreas: function (params, callback, resultFormat) {
  79708. var me = this;
  79709. var findServiceAreasService = new FindServiceAreasService(me.url, {
  79710. proxy: me.options.proxy,
  79711. withCredentials: me.options.withCredentials,
  79712. crossOrigin: me.options.crossOrigin,
  79713. headers: me.options.headers,
  79714. serverType: me.options.serverType,
  79715. eventListeners: {
  79716. scope: me,
  79717. processCompleted: callback,
  79718. processFailed: callback
  79719. },
  79720. format: me._processFormat(resultFormat)
  79721. });
  79722. findServiceAreasService.processAsync(me._processParams(params));
  79723. },
  79724. /**
  79725. * @function L.supermap.networkAnalystService.prototype.updateEdgeWeight
  79726. * @description 更新边的耗费权重服务。
  79727. * @param {SuperMap.UpdateEdgeWeightParameters} params - 更新边的耗费权重服务参数类。
  79728. * @param {RequestCallback} callback -回调函数。
  79729. */
  79730. updateEdgeWeight: function (params, callback) {
  79731. var me = this;
  79732. var updateEdgeWeightService = new UpdateEdgeWeightService(me.url, {
  79733. proxy: me.options.proxy,
  79734. withCredentials: me.options.withCredentials,
  79735. crossOrigin: me.options.crossOrigin,
  79736. headers: me.options.headers,
  79737. serverType: me.options.serverType,
  79738. eventListeners: {
  79739. scope: me,
  79740. processCompleted: callback,
  79741. processFailed: callback
  79742. }
  79743. });
  79744. updateEdgeWeightService.processAsync(params);
  79745. },
  79746. /**
  79747. * @function L.supermap.networkAnalystService.prototype.updateTurnNodeWeight
  79748. * @description 转向耗费权重更新服务。
  79749. * @param {SuperMap.UpdateTurnNodeWeightParameters} params - 转向耗费权重更新服务参数类。
  79750. * @param {RequestCallback} callback - 回调函数。
  79751. */
  79752. updateTurnNodeWeight: function (params, callback) {
  79753. var me = this;
  79754. var updateTurnNodeWeightService = new UpdateTurnNodeWeightService(me.url, {
  79755. proxy: me.options.proxy,
  79756. withCredentials: me.options.withCredentials,
  79757. crossOrigin: me.options.crossOrigin,
  79758. headers: me.options.headers,
  79759. serverType: me.options.serverType,
  79760. eventListeners: {
  79761. scope: me,
  79762. processCompleted: callback,
  79763. processFailed: callback
  79764. }
  79765. });
  79766. updateTurnNodeWeightService.processAsync(params);
  79767. },
  79768. _processParams: function (params) {
  79769. if (!params) {
  79770. return {};
  79771. }
  79772. if (params.centers && external_L_default().Util.isArray(params.centers)) {
  79773. params.centers.map(function (point, key) {
  79774. params.centers[key] = (point instanceof (external_L_default()).LatLng) ? {x: point.lng, y: point.lat} : point;
  79775. return params.centers[key];
  79776. });
  79777. }
  79778. if (params.nodes && external_L_default().Util.isArray(params.nodes)) {
  79779. params.nodes.map(function (point, key) {
  79780. params.nodes[key] = (point instanceof (external_L_default()).LatLng) ? {x: point.lng, y: point.lat} : point;
  79781. return params.nodes[key];
  79782. });
  79783. }
  79784. if (params.event && params.event instanceof (external_L_default()).LatLng) {
  79785. params.event = {x: params.event.lng, y: params.event.lat};
  79786. }
  79787. if (params.facilities && external_L_default().Util.isArray(params.facilities)) {
  79788. params.facilities.map(function (point, key) {
  79789. params.facilities[key] = (point instanceof (external_L_default()).LatLng) ? {x: point.lng, y: point.lat} : point;
  79790. return params.facilities[key];
  79791. });
  79792. }
  79793. if (params.parameter && params.parameter.barrierPoints) {
  79794. var barrierPoints = params.parameter.barrierPoints;
  79795. if (external_L_default().Util.isArray(barrierPoints)) {
  79796. barrierPoints.map(function (point, key) {
  79797. params.parameter.barrierPoints[key] = (point instanceof (external_L_default()).LatLng) ? {
  79798. x: point.lng,
  79799. y: point.lat
  79800. } : point;
  79801. return params.parameter.barrierPoints[key];
  79802. });
  79803. } else {
  79804. params.parameter.barrierPoints = [(barrierPoints instanceof (external_L_default()).LatLng) ? {
  79805. x: barrierPoints.lng,
  79806. y: barrierPoints.lat
  79807. } : barrierPoints];
  79808. }
  79809. }
  79810. return params;
  79811. },
  79812. _processFormat: function (resultFormat) {
  79813. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  79814. }
  79815. });
  79816. var networkAnalystService = function (url, options) {
  79817. return new NetworkAnalystService(url, options);
  79818. };
  79819. (external_L_default()).supermap.networkAnalystService = networkAnalystService;
  79820. ;// CONCATENATED MODULE: ./src/leaflet/services/ProcessingService.js
  79821. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  79822. * This program are made available under the terms of the Apache License, Version 2.0
  79823. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  79824. /**
  79825. * @class L.supermap.processingService
  79826. * @classdesc 分布式分析服务类。
  79827. * @category iServer ProcessingService
  79828. * @extends L.supermap.ServiceBase
  79829. * @example
  79830. * L.supermap.processingService(url)
  79831. * .getKernelDensityJobs(function(result){
  79832. * //doSomething
  79833. * })
  79834. * @param {string} url - 分布式分析服务地址。
  79835. * @param {Object} options - 参数。
  79836. * @param {string} [options.proxy] - 服务代理地址。
  79837. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  79838. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  79839. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  79840. * @param {Object} [options.headers] - 请求头。
  79841. */
  79842. var ProcessingService = ServiceBase.extend({
  79843. initialize: function (url, options) {
  79844. options = options || {};
  79845. external_L_default().setOptions(this, options);
  79846. ServiceBase.prototype.initialize.call(this, url, options);
  79847. this.kernelDensityJobs = {};
  79848. this.summaryMeshJobs = {};
  79849. this.queryJobs = {};
  79850. this.summaryRegionJobs = {};
  79851. this.vectorClipJobs = {};
  79852. this.overlayGeoJobs = {};
  79853. this.buffersJobs = {};
  79854. this.topologyValidatorJobs = {};
  79855. this.summaryAttributesJobs = {};
  79856. },
  79857. /**
  79858. * @function L.supermap.processingService.prototype.getKernelDensityJobs
  79859. * @description 获取密度分析的列表。
  79860. * @param {RequestCallback} callback 请求结果的回调函数。
  79861. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79862. */
  79863. getKernelDensityJobs: function (callback, resultFormat) {
  79864. var me = this,
  79865. format = me._processFormat(resultFormat);
  79866. var kernelDensityJobsService = new KernelDensityJobsService(me.url, {
  79867. proxy: me.options.proxy,
  79868. withCredentials: me.options.withCredentials,
  79869. crossOrigin: me.options.crossOrigin,
  79870. headers: me.options.headers,
  79871. serverType: me.options.serverType,
  79872. eventListeners: {
  79873. scope: me,
  79874. processCompleted: callback,
  79875. processFailed: callback
  79876. },
  79877. format: format
  79878. });
  79879. kernelDensityJobsService.getKernelDensityJobs();
  79880. },
  79881. /**
  79882. * @function L.supermap.processingService.prototype.getKernelDensityJob
  79883. * @description 获取某一个密度分析。
  79884. * @param {string} id - 空间分析的 ID。
  79885. * @param {RequestCallback} callback 请求结果的回调函数。
  79886. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79887. */
  79888. getKernelDensityJob: function (id, callback, resultFormat) {
  79889. var me = this,
  79890. format = me._processFormat(resultFormat);
  79891. var kernelDensityJobsService = new KernelDensityJobsService(me.url, {
  79892. proxy: me.options.proxy,
  79893. withCredentials: me.options.withCredentials,
  79894. crossOrigin: me.options.crossOrigin,
  79895. headers: me.options.headers,
  79896. serverType: me.options.serverType,
  79897. eventListeners: {
  79898. scope: me,
  79899. processCompleted: callback,
  79900. processFailed: callback
  79901. },
  79902. format: format
  79903. });
  79904. kernelDensityJobsService.getKernelDensityJob(id);
  79905. },
  79906. /**
  79907. * @function L.supermap.processingService.prototype.addKernelDensityJob
  79908. * @description 新建一个密度分析。
  79909. * @param {SuperMap.KernelDensityJobParameter} params - 创建一个空间分析的请求参数。
  79910. * @param {RequestCallback} callback 请求结果的回调函数。
  79911. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  79912. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79913. */
  79914. addKernelDensityJob: function (params, callback, seconds, resultFormat) {
  79915. var me = this,
  79916. param = me._processParams(params),
  79917. format = me._processFormat(resultFormat);
  79918. var kernelDensityJobsService = new KernelDensityJobsService(me.url, {
  79919. proxy: me.options.proxy,
  79920. withCredentials: me.options.withCredentials,
  79921. crossOrigin: me.options.crossOrigin,
  79922. headers: me.options.headers,
  79923. serverType: me.options.serverType,
  79924. eventListeners: {
  79925. scope: me,
  79926. processCompleted: callback,
  79927. processFailed: callback,
  79928. processRunning: function (job) {
  79929. me.kernelDensityJobs[job.id] = job.state;
  79930. }
  79931. },
  79932. format: format
  79933. });
  79934. kernelDensityJobsService.addKernelDensityJob(param, seconds);
  79935. },
  79936. /**
  79937. * @function L.supermap.processingService.prototype.getKernelDensityJobState
  79938. * @description 获取密度分析的状态。
  79939. * @param {string} id - 密度分析 ID。
  79940. * @returns {Object} 密度分析的状态。
  79941. */
  79942. getKernelDensityJobState: function (id) {
  79943. return this.kernelDensityJobs[id];
  79944. },
  79945. /**
  79946. * @function L.supermap.processingService.prototype.getSummaryMeshJobs
  79947. * @description 获取点聚合分析的列表。
  79948. * @param {RequestCallback} callback - 请求结果的回调函数。
  79949. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79950. */
  79951. getSummaryMeshJobs: function (callback, resultFormat) {
  79952. var me = this,
  79953. format = me._processFormat(resultFormat);
  79954. var summaryMeshJobsService = new SummaryMeshJobsService(me.url, {
  79955. proxy: me.options.proxy,
  79956. withCredentials: me.options.withCredentials,
  79957. crossOrigin: me.options.crossOrigin,
  79958. headers: me.options.headers,
  79959. serverType: me.options.serverType,
  79960. eventListeners: {
  79961. scope: me,
  79962. processCompleted: callback,
  79963. processFailed: callback
  79964. },
  79965. format: format
  79966. });
  79967. summaryMeshJobsService.getSummaryMeshJobs();
  79968. },
  79969. /**
  79970. * @function L.supermap.processingService.prototype.getSummaryMeshJob
  79971. * @description 获取某一个点聚合分析。
  79972. * @param {string} id - 空间分析的 ID。
  79973. * @param {RequestCallback} callback 请求结果的回调函数。
  79974. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79975. */
  79976. getSummaryMeshJob: function (id, callback, resultFormat) {
  79977. var me = this,
  79978. format = me._processFormat(resultFormat);
  79979. var summaryMeshJobsService = new SummaryMeshJobsService(me.url, {
  79980. proxy: me.options.proxy,
  79981. withCredentials: me.options.withCredentials,
  79982. crossOrigin: me.options.crossOrigin,
  79983. headers: me.options.headers,
  79984. serverType: me.options.serverType,
  79985. eventListeners: {
  79986. scope: me,
  79987. processCompleted: callback,
  79988. processFailed: callback
  79989. },
  79990. format: format
  79991. });
  79992. summaryMeshJobsService.getSummaryMeshJob(id);
  79993. },
  79994. /**
  79995. * @function L.supermap.processingService.prototype.addSummaryMeshJob
  79996. * @description 新建一个点聚合分析。
  79997. * @param {SuperMap.SummaryMeshJobParameter} params - 点聚合分析任务参数类。
  79998. * @param {RequestCallback} callback 请求结果的回调函数。
  79999. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  80000. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80001. */
  80002. addSummaryMeshJob: function (params, callback, seconds, resultFormat) {
  80003. var me = this,
  80004. param = me._processParams(params),
  80005. format = me._processFormat(resultFormat);
  80006. var summaryMeshJobsService = new SummaryMeshJobsService(me.url, {
  80007. proxy: me.options.proxy,
  80008. withCredentials: me.options.withCredentials,
  80009. crossOrigin: me.options.crossOrigin,
  80010. headers: me.options.headers,
  80011. serverType: me.options.serverType,
  80012. eventListeners: {
  80013. scope: me,
  80014. processCompleted: callback,
  80015. processFailed: callback,
  80016. processRunning: function (job) {
  80017. me.summaryMeshJobs[job.id] = job.state;
  80018. }
  80019. },
  80020. format: format
  80021. });
  80022. summaryMeshJobsService.addSummaryMeshJob(param, seconds);
  80023. },
  80024. /**
  80025. * @function L.supermap.processingService.prototype.getSummaryMeshJobState
  80026. * @description 获取点聚合分析的状态。
  80027. * @param {string} id - 点聚合分析的 ID。
  80028. * @returns {Object} 点聚合分析的状态。
  80029. */
  80030. getSummaryMeshJobState: function (id) {
  80031. return this.summaryMeshJobs[id];
  80032. },
  80033. /**
  80034. * @function L.supermap.processingService.prototype.getQueryJobs
  80035. * @description 获取单对象查询分析的列表。
  80036. * @param {RequestCallback} callback 请求结果的回调函数。
  80037. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80038. */
  80039. getQueryJobs: function (callback, resultFormat) {
  80040. var me = this,
  80041. format = me._processFormat(resultFormat);
  80042. var singleObjectQueryJobsService = new SingleObjectQueryJobsService(me.url, {
  80043. proxy: me.options.proxy,
  80044. withCredentials: me.options.withCredentials,
  80045. crossOrigin: me.options.crossOrigin,
  80046. headers: me.options.headers,
  80047. serverType: me.options.serverType,
  80048. eventListeners: {
  80049. scope: me,
  80050. processCompleted: callback,
  80051. processFailed: callback
  80052. },
  80053. format: format
  80054. });
  80055. singleObjectQueryJobsService.getQueryJobs();
  80056. },
  80057. /**
  80058. * @function L.supermap.processingService.prototype.getQueryJob
  80059. * @description 获取某一个单对象查询分析。
  80060. * @param {string} id - 空间分析的 ID。
  80061. * @param {RequestCallback} callback 请求结果的回调函数。
  80062. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80063. */
  80064. getQueryJob: function (id, callback, resultFormat) {
  80065. var me = this,
  80066. format = me._processFormat(resultFormat);
  80067. var singleObjectQueryJobsService = new SingleObjectQueryJobsService(me.url, {
  80068. proxy: me.options.proxy,
  80069. withCredentials: me.options.withCredentials,
  80070. crossOrigin: me.options.crossOrigin,
  80071. headers: me.options.headers,
  80072. serverType: me.options.serverType,
  80073. eventListeners: {
  80074. scope: me,
  80075. processCompleted: callback,
  80076. processFailed: callback
  80077. },
  80078. format: format
  80079. });
  80080. singleObjectQueryJobsService.getQueryJob(id);
  80081. },
  80082. /**
  80083. * @function L.supermap.processingService.prototype.addQueryJob
  80084. * @description 新建一个单对象查询分析。
  80085. * @param {SuperMap.SingleObjectQueryJobsParameter} params - 创建一个空间分析的请求参数。
  80086. * @param {RequestCallback} callback 请求结果的回调函数。
  80087. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  80088. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80089. */
  80090. addQueryJob: function (params, callback, seconds, resultFormat) {
  80091. var me = this,
  80092. param = me._processParams(params),
  80093. format = me._processFormat(resultFormat);
  80094. var singleObjectQueryJobsService = new SingleObjectQueryJobsService(me.url, {
  80095. proxy: me.options.proxy,
  80096. withCredentials: me.options.withCredentials,
  80097. crossOrigin: me.options.crossOrigin,
  80098. headers: me.options.headers,
  80099. serverType: me.options.serverType,
  80100. eventListeners: {
  80101. scope: me,
  80102. processCompleted: callback,
  80103. processFailed: callback,
  80104. processRunning: function (job) {
  80105. me.queryJobs[job.id] = job.state;
  80106. }
  80107. },
  80108. format: format
  80109. });
  80110. singleObjectQueryJobsService.addQueryJob(param, seconds);
  80111. },
  80112. /**
  80113. * @function L.supermap.processingService.prototype.getQueryJobState
  80114. * @description 获取单对象查询分析的状态。
  80115. * @param {string} id - 单对象查询分析的 ID。
  80116. * @returns {Object} 单对象查询分析的状态。
  80117. */
  80118. getQueryJobState: function (id) {
  80119. return this.queryJobs[id];
  80120. },
  80121. /**
  80122. * @function L.supermap.processingService.prototype.getSummaryRegionJobs
  80123. * @description 获取区域汇总分析的列表。
  80124. * @param {RequestCallback} callback 请求结果的回调函数。
  80125. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80126. */
  80127. getSummaryRegionJobs: function (callback, resultFormat) {
  80128. var me = this,
  80129. format = me._processFormat(resultFormat);
  80130. var summaryRegionJobsService = new SummaryRegionJobsService(me.url, {
  80131. proxy: me.options.proxy,
  80132. withCredentials: me.options.withCredentials,
  80133. crossOrigin: me.options.crossOrigin,
  80134. headers: me.options.headers,
  80135. serverType: me.options.serverType,
  80136. eventListeners: {
  80137. scope: me,
  80138. processCompleted: callback,
  80139. processFailed: callback
  80140. },
  80141. format: format
  80142. });
  80143. summaryRegionJobsService.getSummaryRegionJobs();
  80144. },
  80145. /**
  80146. * @function L.supermap.processingService.prototype.getSummaryRegionJob
  80147. * @description 获取某一个区域汇总分析。
  80148. * @param {string} id - 区域汇总分析的 ID。
  80149. * @param {RequestCallback} callback 请求结果的回调函数。
  80150. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80151. */
  80152. getSummaryRegionJob: function (id, callback, resultFormat) {
  80153. var me = this,
  80154. format = me._processFormat(resultFormat);
  80155. var summaryRegionJobsService = new SummaryRegionJobsService(me.url, {
  80156. proxy: me.options.proxy,
  80157. withCredentials: me.options.withCredentials,
  80158. crossOrigin: me.options.crossOrigin,
  80159. headers: me.options.headers,
  80160. serverType: me.options.serverType,
  80161. eventListeners: {
  80162. scope: me,
  80163. processCompleted: callback,
  80164. processFailed: callback
  80165. },
  80166. format: format
  80167. });
  80168. summaryRegionJobsService.getSummaryRegionJob(id);
  80169. },
  80170. /**
  80171. * @function L.supermap.processingService.prototype.addSummaryRegionJob
  80172. * @description 新建一个区域汇总分析。
  80173. * @param {SuperMap.SummaryRegionJobParameter} params - 创建一个区域汇总分析的请求参数。
  80174. * @param {RequestCallback} callback 请求结果的回调函数。
  80175. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  80176. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80177. */
  80178. addSummaryRegionJob: function (params, callback, seconds, resultFormat) {
  80179. var me = this,
  80180. param = me._processParams(params),
  80181. format = me._processFormat(resultFormat);
  80182. var summaryRegionJobsService = new SummaryRegionJobsService(me.url, {
  80183. proxy: me.options.proxy,
  80184. withCredentials: me.options.withCredentials,
  80185. crossOrigin: me.options.crossOrigin,
  80186. headers: me.options.headers,
  80187. serverType: me.options.serverType,
  80188. eventListeners: {
  80189. scope: me,
  80190. processCompleted: callback,
  80191. processFailed: callback,
  80192. processRunning: function (job) {
  80193. me.summaryRegionJobs[job.id] = job.state;
  80194. }
  80195. },
  80196. format: format
  80197. });
  80198. summaryRegionJobsService.addSummaryRegionJob(param, seconds);
  80199. },
  80200. /**
  80201. * @function L.supermap.processingService.prototype.getSummaryRegionJobState
  80202. * @description 获取区域汇总分析的状态。
  80203. * @param {string} id - 区域汇总分析的 ID。
  80204. * @returns {Object} 区域汇总分析的状态。
  80205. */
  80206. getSummaryRegionJobState: function (id) {
  80207. return this.summaryRegionJobs[id];
  80208. },
  80209. /**
  80210. * @function L.supermap.processingService.prototype.getVectorClipJobs
  80211. * @description 获取矢量裁剪分析的列表。
  80212. * @param {RequestCallback} callback 请求结果的回调函数。
  80213. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80214. */
  80215. getVectorClipJobs: function (callback, resultFormat) {
  80216. var me = this,
  80217. format = me._processFormat(resultFormat);
  80218. var vectorClipJobsService = new VectorClipJobsService(me.url, {
  80219. proxy: me.options.proxy,
  80220. withCredentials: me.options.withCredentials,
  80221. crossOrigin: me.options.crossOrigin,
  80222. headers: me.options.headers,
  80223. serverType: me.options.serverType,
  80224. eventListeners: {
  80225. scope: me,
  80226. processCompleted: callback,
  80227. processFailed: callback
  80228. },
  80229. format: format
  80230. });
  80231. vectorClipJobsService.getVectorClipJobs();
  80232. },
  80233. /**
  80234. * @function L.supermap.processingService.prototype.getVectorClipJob
  80235. * @description 获取某一个矢量裁剪分析。
  80236. * @param {string} id - 空间分析的 ID。
  80237. * @param {RequestCallback} callback 请求结果的回调函数。
  80238. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80239. */
  80240. getVectorClipJob: function (id, callback, resultFormat) {
  80241. var me = this,
  80242. format = me._processFormat(resultFormat);
  80243. var vectorClipJobsService = new VectorClipJobsService(me.url, {
  80244. proxy: me.options.proxy,
  80245. withCredentials: me.options.withCredentials,
  80246. crossOrigin: me.options.crossOrigin,
  80247. headers: me.options.headers,
  80248. serverType: me.options.serverType,
  80249. eventListeners: {
  80250. scope: me,
  80251. processCompleted: callback,
  80252. processFailed: callback
  80253. },
  80254. format: format
  80255. });
  80256. vectorClipJobsService.getVectorClipJob(id);
  80257. },
  80258. /**
  80259. * @function L.supermap.processingService.prototype.addVectorClipJob
  80260. * @description 新建一个矢量裁剪分析。
  80261. * @param {SuperMap.VectorClipJobsParameter} params - 创建一个空间分析的请求参数。
  80262. * @param {RequestCallback} callback 请求结果的回调函数。
  80263. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  80264. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80265. */
  80266. addVectorClipJob: function (params, callback, seconds, resultFormat) {
  80267. var me = this,
  80268. param = me._processParams(params),
  80269. format = me._processFormat(resultFormat);
  80270. var vectorClipJobsService = new VectorClipJobsService(me.url, {
  80271. proxy: me.options.proxy,
  80272. withCredentials: me.options.withCredentials,
  80273. crossOrigin: me.options.crossOrigin,
  80274. headers: me.options.headers,
  80275. serverType: me.options.serverType,
  80276. eventListeners: {
  80277. scope: me,
  80278. processCompleted: callback,
  80279. processFailed: callback,
  80280. processRunning: function (job) {
  80281. me.vectorClipJobs[job.id] = job.state;
  80282. }
  80283. },
  80284. format: format
  80285. });
  80286. vectorClipJobsService.addVectorClipJob(param, seconds);
  80287. },
  80288. /**
  80289. * @function L.supermap.processingService.prototype.getVectorClipJobState
  80290. * @description 获取矢量裁剪分析的状态。
  80291. * @param {string} id - 矢量裁剪分析的 ID。
  80292. * @returns {Object} 矢量裁剪分析的状态。
  80293. */
  80294. getVectorClipJobState: function (id) {
  80295. return this.vectorClipJobs[id];
  80296. },
  80297. /**
  80298. * @function L.supermap.processingService.prototype.getOverlayGeoJobs
  80299. * @description 获取叠加分析的列表。
  80300. * @param {RequestCallback} callback 请求结果的回调函数。
  80301. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80302. */
  80303. getOverlayGeoJobs: function (callback, resultFormat) {
  80304. var me = this,
  80305. format = me._processFormat(resultFormat);
  80306. var overlayGeoJobsService = new OverlayGeoJobsService(me.url, {
  80307. proxy: me.options.proxy,
  80308. withCredentials: me.options.withCredentials,
  80309. crossOrigin: me.options.crossOrigin,
  80310. headers: me.options.headers,
  80311. serverType: me.options.serverType,
  80312. eventListeners: {
  80313. scope: me,
  80314. processCompleted: callback,
  80315. processFailed: callback
  80316. },
  80317. format: format
  80318. });
  80319. overlayGeoJobsService.getOverlayGeoJobs();
  80320. },
  80321. /**
  80322. * @function L.supermap.processingService.prototype.getOverlayGeoJob
  80323. * @description 获取某一个叠加分析。
  80324. * @param {string} id - 空间分析的 ID。
  80325. * @param {RequestCallback} callback 请求结果的回调函数。
  80326. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80327. */
  80328. getOverlayGeoJob: function (id, callback, resultFormat) {
  80329. var me = this,
  80330. format = me._processFormat(resultFormat);
  80331. var overlayGeoJobsService = new OverlayGeoJobsService(me.url, {
  80332. proxy: me.options.proxy,
  80333. withCredentials: me.options.withCredentials,
  80334. crossOrigin: me.options.crossOrigin,
  80335. headers: me.options.headers,
  80336. serverType: me.options.serverType,
  80337. eventListeners: {
  80338. scope: me,
  80339. processCompleted: callback,
  80340. processFailed: callback
  80341. },
  80342. format: format
  80343. });
  80344. overlayGeoJobsService.getOverlayGeoJob(id);
  80345. },
  80346. /**
  80347. * @function L.supermap.processingService.prototype.addOverlayGeoJob
  80348. * @description 新建一个叠加分析。
  80349. * @param {SuperMap.OverlayGeoJobParameter} params - 创建一个空间分析的请求参数。
  80350. * @param {RequestCallback} callback 请求结果的回调函数。
  80351. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  80352. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80353. */
  80354. addOverlayGeoJob: function (params, callback, seconds, resultFormat) {
  80355. var me = this,
  80356. param = me._processParams(params),
  80357. format = me._processFormat(resultFormat);
  80358. var overlayGeoJobsService = new OverlayGeoJobsService(me.url, {
  80359. proxy: me.options.proxy,
  80360. withCredentials: me.options.withCredentials,
  80361. crossOrigin: me.options.crossOrigin,
  80362. headers: me.options.headers,
  80363. serverType: me.options.serverType,
  80364. eventListeners: {
  80365. scope: me,
  80366. processCompleted: callback,
  80367. processFailed: callback,
  80368. processRunning: function (job) {
  80369. me.overlayGeoJobs[job.id] = job.state;
  80370. }
  80371. },
  80372. format: format
  80373. });
  80374. overlayGeoJobsService.addOverlayGeoJob(param, seconds);
  80375. },
  80376. /**
  80377. * @function L.supermap.processingService.prototype.getoverlayGeoJobState
  80378. * @description 获取叠加分析的状态。
  80379. * @param {string} id - 叠加分析的 ID。
  80380. * @returns {Object} 叠加分析的状态
  80381. */
  80382. getoverlayGeoJobState: function (id) {
  80383. return this.overlayGeoJobs[id];
  80384. },
  80385. /**
  80386. * @function L.supermap.processingService.prototype.getBuffersJobs
  80387. * @description 获取缓冲区分析的列表。
  80388. * @param {RequestCallback} callback 请求结果的回调函数。
  80389. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80390. */
  80391. getBuffersJobs: function (callback, resultFormat) {
  80392. var me = this,
  80393. format = me._processFormat(resultFormat);
  80394. var buffersAnalystJobsService = new BuffersAnalystJobsService(me.url, {
  80395. proxy: me.options.proxy,
  80396. withCredentials: me.options.withCredentials,
  80397. crossOrigin: me.options.crossOrigin,
  80398. headers: me.options.headers,
  80399. serverType: me.options.serverType,
  80400. eventListeners: {
  80401. scope: me,
  80402. processCompleted: callback,
  80403. processFailed: callback
  80404. },
  80405. format: format
  80406. });
  80407. buffersAnalystJobsService.getBuffersJobs();
  80408. },
  80409. /**
  80410. * @function L.supermap.processingService.prototype.getBuffersJob
  80411. * @description 获取某一个缓冲区分析。
  80412. * @param {string} id - 空间分析的id。
  80413. * @param {RequestCallback} callback 请求结果的回调函数。
  80414. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80415. */
  80416. getBuffersJob: function (id, callback, resultFormat) {
  80417. var me = this,
  80418. format = me._processFormat(resultFormat);
  80419. var buffersAnalystJobsService = new BuffersAnalystJobsService(me.url, {
  80420. proxy: me.options.proxy,
  80421. withCredentials: me.options.withCredentials,
  80422. crossOrigin: me.options.crossOrigin,
  80423. headers: me.options.headers,
  80424. serverType: me.options.serverType,
  80425. eventListeners: {
  80426. scope: me,
  80427. processCompleted: callback,
  80428. processFailed: callback
  80429. },
  80430. format: format
  80431. });
  80432. buffersAnalystJobsService.getBuffersJob(id);
  80433. },
  80434. /**
  80435. * @function L.supermap.processingService.prototype.addBuffersJob
  80436. * @description 新建一个缓冲区分析。
  80437. * @param {SuperMap.CreateBufferAnalystJobsParameter} params - 创建一个空间分析的请求参数。
  80438. * @param {RequestCallback} callback 请求结果的回调函数。
  80439. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  80440. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80441. */
  80442. addBuffersJob: function (params, callback, seconds, resultFormat) {
  80443. var me = this,
  80444. param = me._processParams(params),
  80445. format = me._processFormat(resultFormat);
  80446. var buffersAnalystJobsService = new BuffersAnalystJobsService(me.url, {
  80447. proxy: me.options.proxy,
  80448. withCredentials: me.options.withCredentials,
  80449. crossOrigin: me.options.crossOrigin,
  80450. headers: me.options.headers,
  80451. serverType: me.options.serverType,
  80452. eventListeners: {
  80453. scope: me,
  80454. processCompleted: callback,
  80455. processFailed: callback,
  80456. processRunning: function (job) {
  80457. me.buffersJobs[job.id] = job.state;
  80458. }
  80459. },
  80460. format: format
  80461. });
  80462. buffersAnalystJobsService.addBuffersJob(param, seconds);
  80463. },
  80464. /**
  80465. * @function L.supermap.processingService.prototype.getBuffersJobState
  80466. * @description 获取缓冲区分析的状态。
  80467. * @param {string} id - 缓冲区分析的 ID。
  80468. * @returns {Object} 缓冲区分析的状态
  80469. */
  80470. getBuffersJobState: function (id) {
  80471. return this.buffersJobs[id];
  80472. },
  80473. /**
  80474. * @function L.supermap.processingService.prototype.getTopologyValidatorJobs
  80475. * @description 获取拓扑检查分析的列表。
  80476. * @param {RequestCallback} callback 请求结果的回调函数。
  80477. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80478. */
  80479. getTopologyValidatorJobs: function (callback, resultFormat) {
  80480. var me = this,
  80481. format = me._processFormat(resultFormat);
  80482. var topologyValidatorJobsService = new TopologyValidatorJobsService(me.url, {
  80483. proxy: me.options.proxy,
  80484. withCredentials: me.options.withCredentials,
  80485. crossOrigin: me.options.crossOrigin,
  80486. headers: me.options.headers,
  80487. serverType: me.options.serverType,
  80488. eventListeners: {
  80489. scope: me,
  80490. processCompleted: callback,
  80491. processFailed: callback
  80492. },
  80493. format: format
  80494. });
  80495. topologyValidatorJobsService.getTopologyValidatorJobs();
  80496. },
  80497. /**
  80498. * @function L.supermap.processingService.prototype.getTopologyValidatorJob
  80499. * @description 获取某一个拓扑检查分析。
  80500. * @param {string} id - 空间分析的 ID。
  80501. * @param {RequestCallback} callback 请求结果的回调函数。
  80502. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80503. */
  80504. getTopologyValidatorJob: function (id, callback, resultFormat) {
  80505. var me = this,
  80506. format = me._processFormat(resultFormat);
  80507. var topologyValidatorJobsService = new TopologyValidatorJobsService(me.url, {
  80508. proxy: me.options.proxy,
  80509. withCredentials: me.options.withCredentials,
  80510. crossOrigin: me.options.crossOrigin,
  80511. headers: me.options.headers,
  80512. serverType: me.options.serverType,
  80513. eventListeners: {
  80514. scope: me,
  80515. processCompleted: callback,
  80516. processFailed: callback
  80517. },
  80518. format: format
  80519. });
  80520. topologyValidatorJobsService.getTopologyValidatorJob(id);
  80521. },
  80522. /**
  80523. * @function L.supermap.processingService.prototype.addTopologyValidatorJob
  80524. * @description 新建一个拓扑检查分析。
  80525. * @param {SuperMap.TopologyValidatorJobsParameter} params - 创建一个空间分析的请求参数。
  80526. * @param {RequestCallback} callback 请求结果的回调函数。
  80527. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  80528. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80529. */
  80530. addTopologyValidatorJob: function (params, callback, seconds, resultFormat) {
  80531. var me = this,
  80532. param = me._processParams(params),
  80533. format = me._processFormat(resultFormat);
  80534. var topologyValidatorJobsService = new TopologyValidatorJobsService(me.url, {
  80535. proxy: me.options.proxy,
  80536. withCredentials: me.options.withCredentials,
  80537. crossOrigin: me.options.crossOrigin,
  80538. headers: me.options.headers,
  80539. serverType: me.options.serverType,
  80540. eventListeners: {
  80541. scope: me,
  80542. processCompleted: callback,
  80543. processFailed: callback,
  80544. processRunning: function (job) {
  80545. me.topologyValidatorJobs[job.id] = job.state;
  80546. }
  80547. },
  80548. format: format
  80549. });
  80550. topologyValidatorJobsService.addTopologyValidatorJob(param, seconds);
  80551. },
  80552. /**
  80553. * @function L.supermap.processingService.prototype.getTopologyValidatorJobState
  80554. * @description 获取拓扑检查分析的状态。
  80555. * @param {string} id - 拓扑检查分析的 ID。
  80556. * @returns {Object} 拓扑检查分析的状态。
  80557. */
  80558. getTopologyValidatorJobState: function (id) {
  80559. return this.topologyValidatorJobs[id];
  80560. },
  80561. /**
  80562. * @function L.supermap.processingService.prototype.getSummaryAttributesJobs
  80563. * @description 获取属性汇总分析的列表。
  80564. * @param {RequestCallback} callback 请求结果的回调函数。
  80565. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80566. */
  80567. getSummaryAttributesJobs: function (callback, resultFormat) {
  80568. var me = this,
  80569. format = me._processFormat(resultFormat);
  80570. var summaryAttributesJobsService = new SummaryAttributesJobsService(me.url, {
  80571. proxy: me.options.proxy,
  80572. withCredentials: me.options.withCredentials,
  80573. crossOrigin: me.options.crossOrigin,
  80574. headers: me.options.headers,
  80575. serverType: me.options.serverType,
  80576. eventListeners: {
  80577. scope: me,
  80578. processCompleted: callback,
  80579. processFailed: callback
  80580. },
  80581. format: format
  80582. });
  80583. summaryAttributesJobsService.getSummaryAttributesJobs();
  80584. },
  80585. /**
  80586. * @function L.supermap.processingService.prototype.getSummaryAttributesJob
  80587. * @description 获取某一个属性汇总分析。
  80588. * @param {string} id - 空间分析的 ID。
  80589. * @param {RequestCallback} callback 请求结果的回调函数。
  80590. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80591. */
  80592. getSummaryAttributesJob: function (id, callback, resultFormat) {
  80593. var me = this,
  80594. format = me._processFormat(resultFormat);
  80595. var summaryAttributesJobsService = new SummaryAttributesJobsService(me.url, {
  80596. proxy: me.options.proxy,
  80597. withCredentials: me.options.withCredentials,
  80598. crossOrigin: me.options.crossOrigin,
  80599. headers: me.options.headers,
  80600. serverType: me.options.serverType,
  80601. eventListeners: {
  80602. scope: me,
  80603. processCompleted: callback,
  80604. processFailed: callback
  80605. },
  80606. format: format
  80607. });
  80608. summaryAttributesJobsService.getSummaryAttributesJob(id);
  80609. },
  80610. /**
  80611. * @function L.supermap.processingService.prototype.addSummaryAttributesJob
  80612. * @description 新建一个属性汇总分析。
  80613. * @param {SuperMap.SummaryAttributesJobsParameter} params - 创建一个空间分析的请求参数。
  80614. * @param {RequestCallback} callback 请求结果的回调函数。
  80615. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  80616. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80617. */
  80618. addSummaryAttributesJob: function (params, callback, seconds, resultFormat) {
  80619. var me = this,
  80620. param = me._processParams(params),
  80621. format = me._processFormat(resultFormat);
  80622. var summaryAttributesJobsService = new SummaryAttributesJobsService(me.url, {
  80623. proxy: me.options.proxy,
  80624. withCredentials: me.options.withCredentials,
  80625. crossOrigin: me.options.crossOrigin,
  80626. headers: me.options.headers,
  80627. serverType: me.options.serverType,
  80628. eventListeners: {
  80629. scope: me,
  80630. processCompleted: callback,
  80631. processFailed: callback,
  80632. processRunning: function (job) {
  80633. me.summaryAttributesJobs[job.id] = job.state;
  80634. }
  80635. },
  80636. format: format
  80637. });
  80638. summaryAttributesJobsService.addSummaryAttributesJob(param, seconds);
  80639. },
  80640. /**
  80641. * @function L.supermap.processingService.prototype.getSummaryAttributesJobState
  80642. * @description 获取属性汇总分析的状态。
  80643. * @param {string} id - 属性汇总分析的 ID。
  80644. * @returns {Object} 属性汇总分析的状态。
  80645. */
  80646. getSummaryAttributesJobState: function (id) {
  80647. return this.summaryAttributesJobs[id];
  80648. },
  80649. _processFormat: function (resultFormat) {
  80650. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  80651. },
  80652. _processParams: function (params) {
  80653. if (!params) {
  80654. return {};
  80655. }
  80656. if (params.bounds) {
  80657. params.bounds = CommontypesConversion.toSuperMapBounds(params.bounds);
  80658. }
  80659. if (params.query) {
  80660. params.query = CommontypesConversion.toSuperMapBounds(params.query);
  80661. }
  80662. if (params.geometryQuery) {
  80663. params.geometryQuery = CommontypesConversion.toProcessingParam(params.geometryQuery);
  80664. }
  80665. if (params.geometryClip) {
  80666. params.geometryClip = CommontypesConversion.toProcessingParam(params.geometryClip);
  80667. }
  80668. return params;
  80669. }
  80670. });
  80671. var processingService = function (url, options) {
  80672. return new ProcessingService(url, options);
  80673. };
  80674. (external_L_default()).supermap.processingService = processingService;
  80675. ;// CONCATENATED MODULE: ./src/leaflet/services/QueryService.js
  80676. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  80677. * This program are made available under the terms of the Apache License, Version 2.0
  80678. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  80679. /**
  80680. * @class L.supermap.queryService
  80681. * @classdesc 地图查询服务类。
  80682. * @category iServer Map QueryResults
  80683. * @extends {L.supermap.ServiceBase}
  80684. * @param {string} url - 地图查询服务访问地址。
  80685. * @param {Object} options - 参数。
  80686. * @param {string} [options.proxy] - 服务代理地址。
  80687. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  80688. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  80689. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  80690. * @param {Object} [options.headers] - 请求头。
  80691. * @example
  80692. * L.supermap.queryService(url).queryByBounds(param,function(result){
  80693. * //doSomething
  80694. * })
  80695. */
  80696. var QueryService_QueryService = ServiceBase.extend({
  80697. initialize: function (url, options) {
  80698. ServiceBase.prototype.initialize.call(this, url, options);
  80699. },
  80700. /**
  80701. * @function L.supermap.queryService.prototype.queryByBounds
  80702. * @description bounds 查询地图服务。
  80703. * @param {SuperMap.QueryByBoundsParameters} params - 通过 Bounds 查询的相关参数类。
  80704. * @param {RequestCallback} callback - 回调函数。
  80705. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  80706. */
  80707. queryByBounds: function (params, callback, resultFormat) {
  80708. var me = this;
  80709. var queryService = new QueryByBoundsService(me.url, {
  80710. proxy: me.options.proxy,
  80711. withCredentials: me.options.withCredentials,
  80712. crossOrigin: me.options.crossOrigin,
  80713. headers:me.options.headers,
  80714. serverType: me.options.serverType,
  80715. eventListeners: {
  80716. scope: me,
  80717. processCompleted: callback,
  80718. processFailed: callback
  80719. },
  80720. format: me._processFormat(resultFormat)
  80721. });
  80722. queryService.processAsync(me._processParams(params));
  80723. },
  80724. /**
  80725. * @function L.supermap.queryService.prototype.queryByDistance
  80726. * @description 地图距离查询服务。
  80727. * @param {SuperMap.QueryByDistanceParameters} params - Distance 查询相关参数类。
  80728. * @param {RequestCallback} callback 回调函数。
  80729. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  80730. */
  80731. queryByDistance: function (params, callback, resultFormat) {
  80732. var me = this;
  80733. var queryByDistanceService = new QueryByDistanceService(me.url, {
  80734. proxy: me.options.proxy,
  80735. withCredentials: me.options.withCredentials,
  80736. crossOrigin: me.options.crossOrigin,
  80737. headers:me.options.headers,
  80738. serverType: me.options.serverType,
  80739. eventListeners: {
  80740. scope: me,
  80741. processCompleted: callback,
  80742. processFailed: callback
  80743. },
  80744. format: me._processFormat(resultFormat)
  80745. });
  80746. queryByDistanceService.processAsync(me._processParams(params));
  80747. },
  80748. /**
  80749. * @function L.supermap.queryService.prototype.queryBySQL
  80750. * @description 地图 SQL 查询服务。
  80751. * @param {SuperMap.QueryBySQLParameters} params - SQL 查询相关参数类。
  80752. * @param {RequestCallback} callback 回调函数。
  80753. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  80754. */
  80755. queryBySQL: function (params, callback, resultFormat) {
  80756. var me = this;
  80757. var queryBySQLService = new QueryBySQLService(me.url, {
  80758. proxy: me.options.proxy,
  80759. withCredentials: me.options.withCredentials,
  80760. crossOrigin: me.options.crossOrigin,
  80761. headers:me.options.headers,
  80762. serverType: me.options.serverType,
  80763. eventListeners: {
  80764. scope: me,
  80765. processCompleted: callback,
  80766. processFailed: callback
  80767. },
  80768. format: me._processFormat(resultFormat)
  80769. });
  80770. queryBySQLService.processAsync(me._processParams(params));
  80771. },
  80772. /**
  80773. * @function L.supermap.queryService.prototype.queryByGeometry
  80774. * @description 地图几何查询服务。
  80775. * @param {SuperMap.QueryByGeometryParameters} params - Geometry 查询相关参数类。
  80776. * @param {RequestCallback} callback 回调函数。
  80777. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  80778. */
  80779. queryByGeometry: function (params, callback, resultFormat) {
  80780. var me = this;
  80781. var queryByGeometryService = new QueryByGeometryService(me.url, {
  80782. proxy: me.options.proxy,
  80783. withCredentials: me.options.withCredentials,
  80784. crossOrigin: me.options.crossOrigin,
  80785. headers:me.options.headers,
  80786. serverType: me.options.serverType,
  80787. eventListeners: {
  80788. scope: me,
  80789. processCompleted: callback,
  80790. processFailed: callback
  80791. },
  80792. format: me._processFormat(resultFormat)
  80793. });
  80794. queryByGeometryService.processAsync(me._processParams(params));
  80795. },
  80796. _processParams: function (params) {
  80797. if (!params) {
  80798. return {};
  80799. }
  80800. params.returnContent = (params.returnContent == null) ? true : params.returnContent;
  80801. if (params.queryParams && !external_L_default().Util.isArray(params.queryParams)) {
  80802. params.queryParams = [params.queryParams];
  80803. }
  80804. if (params.bounds) {
  80805. params.bounds = CommontypesConversion.toSuperMapBounds(params.bounds);
  80806. }
  80807. if (params.geometry) {
  80808. if (params.geometry instanceof (external_L_default()).Point) {
  80809. params.geometry = new Point(params.geometry.x, params.geometry.y);
  80810. } else {
  80811. params.geometry = toSuperMapGeometry(params.geometry);
  80812. }
  80813. }
  80814. return params;
  80815. },
  80816. _processFormat: function (resultFormat) {
  80817. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  80818. }
  80819. });
  80820. var queryService = function (url, options) {
  80821. return new QueryService_QueryService(url, options);
  80822. };
  80823. (external_L_default()).supermap.queryService = queryService;
  80824. ;// CONCATENATED MODULE: ./src/leaflet/services/SpatialAnalystService.js
  80825. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  80826. * This program are made available under the terms of the Apache License, Version 2.0
  80827. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  80828. /**
  80829. * @class L.supermap.spatialAnalystService
  80830. * @classdesc 空间分析服务类。
  80831. * @category iServer SpatialAnalyst
  80832. * @description 提供:地区太阳辐射、缓冲区分析、点密度分析、动态分段分析、空间关系分析、插值分析、栅格代数运算、叠加分析、路由定位、路由测量计算、表面分析、地形曲率计算、泰森多边形分析。
  80833. * @extends L.supermap.ServiceBase
  80834. * @example
  80835. * L.supermap.spatialAnalystService(url)
  80836. * .bufferAnalysis(params,function(result){
  80837. * //doSomething
  80838. * })
  80839. * @param {string} url - 空间分析服务地址。
  80840. * @param {Object} options - 参数。
  80841. * @param {string} [options.proxy] - 服务代理地址。
  80842. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  80843. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  80844. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  80845. * @param {Object} [options.headers] - 请求头。
  80846. * @extends {L.supermap.ServiceBase}
  80847. */
  80848. var SpatialAnalystService = ServiceBase.extend({
  80849. initialize: function (url, options) {
  80850. ServiceBase.prototype.initialize.call(this, url, options);
  80851. },
  80852. /**
  80853. * @function L.supermap.spatialAnalystService.prototype.getAreaSolarRadiationResult
  80854. * @description 地区太阳辐射。
  80855. * @param {SuperMap.AreaSolarRadiationParameters} params - 地区太阳辐射参数类
  80856. * @param {RequestCallback} callback 回调函数。
  80857. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80858. */
  80859. getAreaSolarRadiationResult: function (params, callback, resultFormat) {
  80860. var me = this;
  80861. var areaSolarRadiationService = new AreaSolarRadiationService(me.url, {
  80862. proxy: me.options.proxy,
  80863. withCredentials: me.options.withCredentials,
  80864. crossOrigin: me.options.crossOrigin,
  80865. headers:me.options.headers,
  80866. serverType: me.options.serverType,
  80867. eventListeners: {
  80868. scope: me,
  80869. processCompleted: callback,
  80870. processFailed: callback
  80871. },
  80872. format: me._processFormat(resultFormat)
  80873. });
  80874. areaSolarRadiationService.processAsync(params);
  80875. },
  80876. /**
  80877. * @function L.supermap.spatialAnalystService.prototype.bufferAnalysis
  80878. * @description 缓冲区分析。
  80879. * @param {SuperMap.DatasetBufferAnalystParameters} params - 数据集缓冲区分析参数类。
  80880. * @param {RequestCallback} callback 回调函数。
  80881. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80882. */
  80883. bufferAnalysis: function (params, callback, resultFormat) {
  80884. var me = this;
  80885. var bufferAnalystService = new BufferAnalystService(me.url, {
  80886. proxy: me.options.proxy,
  80887. withCredentials: me.options.withCredentials,
  80888. crossOrigin: me.options.crossOrigin,
  80889. headers:me.options.headers,
  80890. serverType: me.options.serverType,
  80891. eventListeners: {
  80892. scope: me,
  80893. processCompleted: callback,
  80894. processFailed: callback
  80895. },
  80896. format: me._processFormat(resultFormat)
  80897. });
  80898. bufferAnalystService.processAsync(me._processParams(params));
  80899. },
  80900. /**
  80901. * @function L.supermap.spatialAnalystService.prototype.densityAnalysis
  80902. * @description 点密度分析。
  80903. * @param {SuperMap.DensityKernelAnalystParameters} params - 核密度分析参数类。
  80904. * @param {RequestCallback} callback 回调函数。
  80905. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80906. */
  80907. densityAnalysis: function (params, callback, resultFormat) {
  80908. var me = this;
  80909. var densityAnalystService = new DensityAnalystService(me.url, {
  80910. proxy: me.options.proxy,
  80911. withCredentials: me.options.withCredentials,
  80912. crossOrigin: me.options.crossOrigin,
  80913. headers:me.options.headers,
  80914. serverType: me.options.serverType,
  80915. eventListeners: {
  80916. scope: me,
  80917. processCompleted: callback,
  80918. processFailed: callback
  80919. },
  80920. format: me._processFormat(resultFormat)
  80921. });
  80922. densityAnalystService.processAsync(me._processParams(params));
  80923. },
  80924. /**
  80925. * @function L.supermap.spatialAnalystService.prototype.generateSpatialData
  80926. * @description 动态分段分析。
  80927. * @param {SuperMap.GenerateSpatialDataParameters} params - 动态分段操作参数类。
  80928. * @param {RequestCallback} callback 回调函数。
  80929. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80930. */
  80931. generateSpatialData: function (params, callback, resultFormat) {
  80932. var me = this;
  80933. var generateSpatialDataService = new GenerateSpatialDataService(me.url, {
  80934. proxy: me.options.proxy,
  80935. withCredentials: me.options.withCredentials,
  80936. crossOrigin: me.options.crossOrigin,
  80937. headers:me.options.headers,
  80938. serverType: me.options.serverType,
  80939. eventListeners: {
  80940. scope: me,
  80941. processCompleted: callback,
  80942. processFailed: callback
  80943. },
  80944. format: me._processFormat(resultFormat)
  80945. });
  80946. generateSpatialDataService.processAsync(params);
  80947. },
  80948. /**
  80949. * @function L.supermap.spatialAnalystService.prototype.geoRelationAnalysis
  80950. * @description 空间关系分析。
  80951. * @param {SuperMap.GeoRelationAnalystParameters} params - 空间关系分析服务参数类。
  80952. * @param {RequestCallback} callback 回调函数。
  80953. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80954. */
  80955. geoRelationAnalysis: function (params, callback, resultFormat) {
  80956. var me = this;
  80957. var geoRelationAnalystService = new GeoRelationAnalystService(me.url, {
  80958. proxy: me.options.proxy,
  80959. withCredentials: me.options.withCredentials,
  80960. crossOrigin: me.options.crossOrigin,
  80961. headers:me.options.headers,
  80962. serverType: me.options.serverType,
  80963. eventListeners: {
  80964. scope: me,
  80965. processCompleted: callback,
  80966. processFailed: callback
  80967. },
  80968. format: me._processFormat(resultFormat)
  80969. });
  80970. geoRelationAnalystService.processAsync(params);
  80971. },
  80972. /**
  80973. * @function L.supermap.spatialAnalystService.prototype.interpolationAnalysis
  80974. * @description 插值分析。
  80975. * @param {SuperMap.InterpolationRBFAnalystParameters} params - 样条插值(径向基函数插值法)分析参数类。
  80976. * @param {RequestCallback} callback 回调函数。
  80977. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80978. */
  80979. interpolationAnalysis: function (params, callback, resultFormat) {
  80980. var me = this;
  80981. var interpolationAnalystService = new InterpolationAnalystService(me.url, {
  80982. proxy: me.options.proxy,
  80983. withCredentials: me.options.withCredentials,
  80984. crossOrigin: me.options.crossOrigin,
  80985. headers:me.options.headers,
  80986. serverType: me.options.serverType,
  80987. eventListeners: {
  80988. scope: me,
  80989. processCompleted: callback,
  80990. processFailed: callback
  80991. },
  80992. format: me._processFormat(resultFormat)
  80993. });
  80994. interpolationAnalystService.processAsync(me._processParams(params));
  80995. },
  80996. /**
  80997. * @function L.supermap.spatialAnalystService.prototype.mathExpressionAnalysis
  80998. * @description 栅格代数运算。
  80999. * @param {SuperMap.MathExpressionAnalysisParameters} params - 栅格代数运算参数类。
  81000. * @param {RequestCallback} callback 回调函数。
  81001. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  81002. */
  81003. mathExpressionAnalysis: function (params, callback, resultFormat) {
  81004. var me = this;
  81005. var mathExpressionAnalysisService = new MathExpressionAnalysisService(me.url, {
  81006. proxy: me.options.proxy,
  81007. withCredentials: me.options.withCredentials,
  81008. crossOrigin: me.options.crossOrigin,
  81009. headers:me.options.headers,
  81010. serverType: me.options.serverType,
  81011. eventListeners: {
  81012. scope: me,
  81013. processCompleted: callback,
  81014. processFailed: callback
  81015. },
  81016. format: me._processFormat(resultFormat)
  81017. });
  81018. mathExpressionAnalysisService.processAsync(me._processParams(params));
  81019. },
  81020. /**
  81021. * @function L.supermap.spatialAnalystService.prototype.overlayAnalysis
  81022. * @description 叠加分析。
  81023. * @param {SuperMap.DatasetOverlayAnalystParameters|SuperMap.GeometryOverlayAnalystParameters} params - 叠加分析参数类,支持批量几何要素叠加分析。
  81024. * @param {RequestCallback} callback 回调函数。
  81025. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  81026. */
  81027. overlayAnalysis: function (params, callback, resultFormat) {
  81028. var me = this;
  81029. var overlayAnalystService = new OverlayAnalystService(me.url, {
  81030. proxy: me.options.proxy,
  81031. withCredentials: me.options.withCredentials,
  81032. crossOrigin: me.options.crossOrigin,
  81033. headers:me.options.headers,
  81034. serverType: me.options.serverType,
  81035. eventListeners: {
  81036. scope: me,
  81037. processCompleted: callback,
  81038. processFailed: callback
  81039. },
  81040. format: me._processFormat(resultFormat)
  81041. });
  81042. overlayAnalystService.processAsync(me._processParams(params));
  81043. },
  81044. /**
  81045. * @function L.supermap.spatialAnalystService.prototype.routeCalculateMeasure
  81046. * @description 路由测量计算。
  81047. * @param {SuperMap.RouteCalculateMeasureParameters} params - 基于路由对象计算指定点 M 值操作的参数类。
  81048. * @param {RequestCallback} callback 回调函数。
  81049. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  81050. */
  81051. routeCalculateMeasure: function (params, callback, resultFormat) {
  81052. var me = this;
  81053. var routeCalculateMeasureService = new RouteCalculateMeasureService(me.url, {
  81054. proxy: me.options.proxy,
  81055. withCredentials: me.options.withCredentials,
  81056. crossOrigin: me.options.crossOrigin,
  81057. headers:me.options.headers,
  81058. serverType: me.options.serverType,
  81059. eventListeners: {
  81060. scope: me,
  81061. processCompleted: callback,
  81062. processFailed: callback
  81063. },
  81064. format: me._processFormat(resultFormat)
  81065. });
  81066. routeCalculateMeasureService.processAsync(me._processParams(params));
  81067. },
  81068. /**
  81069. * @function L.supermap.spatialAnalystService.prototype.routeLocate
  81070. * @description 路由定位。
  81071. * @param {SuperMap.RouteLocatorParameters} params - 路由对象定位空间对象的参数类。
  81072. * @param {RequestCallback} callback 回调函数。
  81073. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  81074. */
  81075. routeLocate: function (params, callback, resultFormat) {
  81076. var me = this;
  81077. var routeLocatorService = new RouteLocatorService(me.url, {
  81078. proxy: me.options.proxy,
  81079. withCredentials: me.options.withCredentials,
  81080. crossOrigin: me.options.crossOrigin,
  81081. headers:me.options.headers,
  81082. serverType: me.options.serverType,
  81083. eventListeners: {
  81084. scope: me,
  81085. processCompleted: callback,
  81086. processFailed: callback
  81087. },
  81088. format: me._processFormat(resultFormat)
  81089. });
  81090. routeLocatorService.processAsync(me._processParams(params));
  81091. },
  81092. /**
  81093. * @function L.supermap.spatialAnalystService.prototype.surfaceAnalysis
  81094. * @description 表面分析。
  81095. * @param {SuperMap.SurfaceAnalystParameters} params - 表面分析参数类。
  81096. * @param {RequestCallback} callback 回调函数。
  81097. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  81098. */
  81099. surfaceAnalysis: function (params, callback, resultFormat) {
  81100. var me = this;
  81101. var surfaceAnalystService = new SurfaceAnalystService(me.url, {
  81102. proxy: me.options.proxy,
  81103. withCredentials: me.options.withCredentials,
  81104. crossOrigin: me.options.crossOrigin,
  81105. headers:me.options.headers,
  81106. serverType: me.options.serverType,
  81107. eventListeners: {
  81108. scope: me,
  81109. processCompleted: callback,
  81110. processFailed: callback
  81111. },
  81112. format: me._processFormat(resultFormat)
  81113. });
  81114. surfaceAnalystService.processAsync(me._processParams(params));
  81115. },
  81116. /**
  81117. * @function L.supermap.spatialAnalystService.prototype.terrainCurvatureCalculate
  81118. * @description 地形曲率计算。
  81119. * @param {SuperMap.TerrainCurvatureCalculationParameters} params - 地形曲率计算参数类。
  81120. * @param {RequestCallback} callback 回调函数。
  81121. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  81122. */
  81123. terrainCurvatureCalculate: function (params, callback, resultFormat) {
  81124. var me = this;
  81125. var terrainCurvatureCalculationService = new TerrainCurvatureCalculationService(me.url, {
  81126. proxy: me.options.proxy,
  81127. withCredentials: me.options.withCredentials,
  81128. crossOrigin: me.options.crossOrigin,
  81129. headers:me.options.headers,
  81130. serverType: me.options.serverType,
  81131. eventListeners: {
  81132. scope: me,
  81133. processCompleted: callback,
  81134. processFailed: callback
  81135. },
  81136. format: me._processFormat(resultFormat)
  81137. });
  81138. terrainCurvatureCalculationService.processAsync(params);
  81139. },
  81140. /**
  81141. * @function L.supermap.spatialAnalystService.prototype.thiessenAnalysis
  81142. * @description 泰森多边形分析。
  81143. * @param {SuperMap.DatasetThiessenAnalystParameters} params - 数据集泰森多边形分析参数类。
  81144. * @param {RequestCallback} callback 回调函数。
  81145. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  81146. */
  81147. thiessenAnalysis: function (params, callback, resultFormat) {
  81148. var me = this;
  81149. var thiessenAnalystService = new ThiessenAnalystService(me.url, {
  81150. proxy: me.options.proxy,
  81151. withCredentials: me.options.withCredentials,
  81152. crossOrigin: me.options.crossOrigin,
  81153. headers:me.options.headers,
  81154. serverType: me.options.serverType,
  81155. eventListeners: {
  81156. scope: me,
  81157. processCompleted: callback,
  81158. processFailed: callback
  81159. },
  81160. format: me._processFormat(resultFormat)
  81161. });
  81162. thiessenAnalystService.processAsync(me._processParams(params));
  81163. },
  81164. /**
  81165. * @function L.supermap.spatialAnalystService.prototype.geometrybatchAnalysis
  81166. * @description 批量空间分析。
  81167. * @param {Array} params -批量分析参数对象数组;包括:</br>
  81168. * @param {string} params.analystName - 空间分析方法的名称。包括:</br>
  81169. * "buffer","overlay","interpolationDensity","interpolationidw","interpolationRBF","interpolationKriging","isoregion","isoline"
  81170. * @param {Object} param - 空间分析类型对应的请求参数,包括:</br>
  81171. * {SuperMap.GeometryBufferAnalystParameters} 缓冲区分析参数类。</br>
  81172. * {SuperMap.GeometryOverlayAnalystParameters} 叠加分析参数类。</br>
  81173. * {SuperMap.InterpolationAnalystParameters} 插值分析参数类。</br>
  81174. * {SuperMap.SurfaceAnalystParameters} 表面分析参数类。</br>
  81175. * @param {RequestCallback} callback - 回调函数。
  81176. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  81177. */
  81178. geometrybatchAnalysis: function (params, callback, resultFormat) {
  81179. var me = this;
  81180. var geometryBatchAnalystService = new GeometryBatchAnalystService(me.url, {
  81181. serverType: me.options.serverType,
  81182. eventListeners: {
  81183. scope: me,
  81184. processCompleted: callback,
  81185. processFailed: callback
  81186. },
  81187. format: me._processFormat(resultFormat)
  81188. });
  81189. //处理批量分析中各个分类类型的参数:
  81190. var analystParameters = [];
  81191. for (var i = 0; i < params.length; i++) {
  81192. var tempParameter = params[i];
  81193. analystParameters.push({
  81194. analystName: tempParameter.analystName,
  81195. param: me._processParams(tempParameter.param)
  81196. })
  81197. }
  81198. geometryBatchAnalystService.processAsync(analystParameters);
  81199. },
  81200. _processParams: function (params) {
  81201. if (!params) {
  81202. return {};
  81203. }
  81204. if (params.bounds) {
  81205. params.bounds = CommontypesConversion.toSuperMapBounds(params.bounds);
  81206. }
  81207. if (params.inputPoints) {
  81208. for (let i = 0; i < params.inputPoints.length; i++) {
  81209. let inputPoint = params.inputPoints[i];
  81210. if (external_L_default().Util.isArray(inputPoint)) {
  81211. params.inputPoints[i] = {x: inputPoint[0], y: inputPoint[1], tag: inputPoint[2]};
  81212. }
  81213. }
  81214. }
  81215. if (params.points) {
  81216. for (let i = 0; i < params.points.length; i++) {
  81217. let point = params.points[i];
  81218. if (external_L_default().Util.isArray(point)) {
  81219. params.points[i] = {x: point[0], y: point[1]};
  81220. } else if (point instanceof (external_L_default()).LatLng) {
  81221. params.points[i] = {x: point.lng, y: point.lat};
  81222. } else {
  81223. params.points[i] = {x: point.x, y: point.y};
  81224. }
  81225. }
  81226. }
  81227. if (params.point) {
  81228. if (external_L_default().Util.isArray(params.point)) {
  81229. params.point = {x: params.point[0], y: params.point[1]};
  81230. } else if (params.point instanceof (external_L_default()).LatLng) {
  81231. params.point = {x: params.point.lng, y: params.point.lat};
  81232. } else {
  81233. params.point = {x: params.point.x, y: params.point.y};
  81234. }
  81235. }
  81236. if (params.extractRegion) {
  81237. params.extractRegion = toSuperMapGeometry(params.extractRegion);
  81238. }
  81239. if (params.extractParameter && params.extractParameter.clipRegion) {
  81240. params.extractParameter.clipRegion = toSuperMapGeometry(params.extractParameter.clipRegion);
  81241. }
  81242. if (params.clipParam && params.clipParam.clipRegion) {
  81243. params.clipParam.clipRegion = toSuperMapGeometry(params.clipParam.clipRegion);
  81244. }
  81245. //支持格式:Vector Layers; GeoJson
  81246. if (params.sourceGeometry) {
  81247. var SRID = null;
  81248. if (params.sourceGeometrySRID) {
  81249. SRID = params.sourceGeometrySRID;
  81250. }
  81251. params.sourceGeometry = toSuperMapGeometry(params.sourceGeometry);
  81252. if (SRID) {
  81253. params.sourceGeometry.SRID = SRID;
  81254. }
  81255. delete params.sourceGeometry.sourceGeometrySRID;
  81256. }
  81257. if (params.operateGeometry) {
  81258. params.operateGeometry = toSuperMapGeometry(params.operateGeometry);
  81259. }
  81260. //支持传入多个几何要素进行叠加分析:
  81261. if (params.sourceGeometries) {
  81262. var sourceGeometries = [];
  81263. for (var k = 0; k < params.sourceGeometries.length; k++) {
  81264. sourceGeometries.push(toSuperMapGeometry(params.sourceGeometries[k]));
  81265. }
  81266. params.sourceGeometries = sourceGeometries;
  81267. }
  81268. //支持传入多个几何要素进行叠加分析:
  81269. if (params.operateGeometries) {
  81270. var operateGeometries = [];
  81271. for (var j = 0; j < params.operateGeometries.length; j++) {
  81272. operateGeometries.push(toSuperMapGeometry(params.operateGeometries[j]));
  81273. }
  81274. params.operateGeometries = operateGeometries;
  81275. }
  81276. if (params.sourceRoute) {
  81277. if (params.sourceRoute instanceof (external_L_default()).Polyline) {
  81278. var target = {};
  81279. target.type = "LINEM"
  81280. target.parts = [params.sourceRoute.getLatLngs().length];
  81281. target.points = [];
  81282. for (let i = 0; i < params.sourceRoute.getLatLngs().length; i++) {
  81283. let point = params.sourceRoute.getLatLngs()[i];
  81284. target.points = target.points.concat({x: point.lng, y: point.lat, measure: point.alt})
  81285. }
  81286. params.sourceRoute = target;
  81287. }
  81288. }
  81289. if (params.operateRegions && external_L_default().Util.isArray(params.operateRegions)) {
  81290. params.operateRegions.map(function (geometry, key) {
  81291. params.operateRegions[key] = toSuperMapGeometry(geometry);
  81292. return params.operateRegions[key];
  81293. });
  81294. }
  81295. // if (params.sourceRoute && params.sourceRoute.components && L.Util.isArray(params.sourceRoute.components)) {
  81296. // params.sourceRoute.components.map(function (geometry, key) {
  81297. // params.sourceRoute.components[key] = Util.toSuperMapGeometry(geometry);
  81298. // });
  81299. // }
  81300. return params;
  81301. },
  81302. _processFormat: function (resultFormat) {
  81303. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  81304. }
  81305. });
  81306. var spatialAnalystService = function (url, options) {
  81307. return new SpatialAnalystService(url, options);
  81308. };
  81309. (external_L_default()).supermap.spatialAnalystService = spatialAnalystService;
  81310. ;// CONCATENATED MODULE: ./src/leaflet/services/ThemeService.js
  81311. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  81312. * This program are made available under the terms of the Apache License, Version 2.0
  81313. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  81314. /**
  81315. * @class L.supermap.themeService
  81316. * @classdesc 专题图服务类。
  81317. * @category iServer Map Theme
  81318. * @extends {L.supermap.ServiceBase}
  81319. * @example
  81320. * L.supermap.themeService(url,{
  81321. * projection:projection
  81322. * }).getThemeInfo(params,function(result){
  81323. * //doSomething
  81324. * });
  81325. * @param {string} url - 服务的访问地址。
  81326. * @param {Object} options - 参数。
  81327. * @param {string} [options.proxy] - 服务代理地址。
  81328. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  81329. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  81330. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  81331. * @param {Object} [options.headers] - 请求头。
  81332. */
  81333. var ThemeService_ThemeService = ServiceBase.extend({
  81334. initialize: function (url, options) {
  81335. ServiceBase.prototype.initialize.call(this, url, options);
  81336. },
  81337. /**
  81338. * @function L.supermap.themeService.prototype.getThemeInfo
  81339. * @description 获取专题图信息。
  81340. * @param {SuperMap.ThemeParameters} params - 专题图参数类。
  81341. * @param {RequestCallback} callback 回调函数。
  81342. */
  81343. getThemeInfo: function (params, callback) {
  81344. var me = this;
  81345. var themeService = new ThemeService(me.url, {
  81346. proxy: me.options.proxy,
  81347. withCredentials: me.options.withCredentials,
  81348. crossOrigin: me.options.crossOrigin,
  81349. headers:me.options.headers,
  81350. serverType: me.options.serverType,
  81351. eventListeners: {
  81352. scope: me,
  81353. processCompleted: callback,
  81354. processFailed: callback
  81355. }
  81356. });
  81357. themeService.processAsync(params);
  81358. }
  81359. });
  81360. var themeService = function (url, options) {
  81361. return new ThemeService_ThemeService(url, options);
  81362. };
  81363. (external_L_default()).supermap.themeService = themeService;
  81364. ;// CONCATENATED MODULE: ./src/leaflet/services/TrafficTransferAnalystService.js
  81365. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  81366. * This program are made available under the terms of the Apache License, Version 2.0
  81367. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  81368. /**
  81369. * @class L.supermap.trafficTransferAnalystService
  81370. * @classdesc 交通换乘分析服务类。
  81371. * @category iServer TrafficTransferAnalyst
  81372. * @example
  81373. * L.supermap.trafficTransferAnalystService(url).queryStop(params,function(result){
  81374. * //doSomething
  81375. * })
  81376. * @extends {L.supermap.ServiceBase}
  81377. * @param {string} url - 服务地址。
  81378. * @param {Object} options - 参数。
  81379. * @param {string} [options.proxy] - 服务代理地址。
  81380. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  81381. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  81382. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  81383. * @param {Object} [options.headers] - 请求头。
  81384. */
  81385. var TrafficTransferAnalystService = ServiceBase.extend({
  81386. initialize: function (url, options) {
  81387. ServiceBase.prototype.initialize.call(this, url, options);
  81388. },
  81389. /**
  81390. * @function L.supermap.trafficTransferAnalystService.prototype.queryStop
  81391. * @description 站点查询服务。
  81392. * @param {SuperMap.StopQueryParameters} params - 站点查询参数类。
  81393. * @param {RequestCallback} callback 回调函数。
  81394. */
  81395. queryStop: function (params, callback) {
  81396. var me = this;
  81397. var stopQueryService = new StopQueryService(me.url, {
  81398. proxy: me.options.proxy,
  81399. withCredentials: me.options.withCredentials,
  81400. crossOrigin: me.options.crossOrigin,
  81401. headers: me.options.headers,
  81402. serverType: me.options.serverType,
  81403. eventListeners: {
  81404. scope: me,
  81405. processCompleted: callback,
  81406. processFailed: callback
  81407. }
  81408. });
  81409. stopQueryService.processAsync(params);
  81410. },
  81411. /**
  81412. * @function L.supermap.trafficTransferAnalystService.prototype.analysisTransferPath
  81413. * @description 交通换乘线路查询服务。
  81414. * @param {SuperMap.TransferPathParameters} params - 交通换乘线路查询参数类。
  81415. * @param {RequestCallback} callback 回调函数。
  81416. */
  81417. analysisTransferPath: function (params, callback) {
  81418. var me = this;
  81419. var transferPathService = new TransferPathService(me.url, {
  81420. proxy: me.options.proxy,
  81421. withCredentials: me.options.withCredentials,
  81422. crossOrigin: me.options.crossOrigin,
  81423. headers: me.options.headers,
  81424. serverType: me.options.serverType,
  81425. eventListeners: {
  81426. scope: me,
  81427. processCompleted: callback,
  81428. processFailed: callback
  81429. }
  81430. });
  81431. transferPathService.processAsync(me._processParams(params));
  81432. },
  81433. /**
  81434. * @function L.supermap.trafficTransferAnalystService.prototype.analysisTransferSolution
  81435. * @description 交通换乘方案查询服务。
  81436. * @param {SuperMap.TransferSolutionParameters} params - 交通换乘方案查询参数类。
  81437. * @param {RequestCallback} callback 回调函数。
  81438. */
  81439. analysisTransferSolution: function (params, callback) {
  81440. var me = this;
  81441. var transferSolutionService = new TransferSolutionService(me.url, {
  81442. proxy: me.options.proxy,
  81443. withCredentials: me.options.withCredentials,
  81444. crossOrigin: me.options.crossOrigin,
  81445. headers: me.options.headers,
  81446. serverType: me.options.serverType,
  81447. eventListeners: {
  81448. scope: me,
  81449. processCompleted: callback,
  81450. processFailed: callback
  81451. }
  81452. });
  81453. transferSolutionService.processAsync(me._processParams(params));
  81454. },
  81455. _processParams: function (params) {
  81456. if (!params) {
  81457. return {};
  81458. }
  81459. if (params.points && external_L_default().Util.isArray(params.points)) {
  81460. params.points.map(function (point, key) {
  81461. params.points[key] = (point instanceof (external_L_default()).LatLng) ? {x: point.lng, y: point.lat} : point;
  81462. return params.points[key];
  81463. });
  81464. }
  81465. return params;
  81466. }
  81467. });
  81468. var trafficTransferAnalystService = function (url, options) {
  81469. return new TrafficTransferAnalystService(url, options);
  81470. };
  81471. (external_L_default()).supermap.trafficTransferAnalystService = trafficTransferAnalystService;
  81472. ;// CONCATENATED MODULE: ./src/leaflet/services/WebPrintingJobService.js
  81473. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  81474. * This program are made available under the terms of the Apache License, Version 2.0
  81475. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  81476. /**
  81477. * @class L.supermap.WebPrintingJobService
  81478. * @classdesc Web 打印服务类。
  81479. * 提供:创建 Web 打印任务,获取 Web 打印任务内容,获取 Web 打印输出文档流,获取 Web 打印服务的布局模板信息。
  81480. * @category iServer WebPrintingJob
  81481. * @example
  81482. * L.supermap.webPrintingJobService(url)
  81483. * .createWebPrintingJob(param,function(result){
  81484. * //doSomething
  81485. * })
  81486. * @extends {L.supermap.ServiceBase}
  81487. * @version 10.1.0
  81488. * @param {string} url - 资源根地址。请求打印地图服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/webprinting/rest/webprinting/v1。
  81489. * @param {Object} options - 服务交互时所需的可选参数。
  81490. * @param {string} [options.proxy] - 服务代理地址。
  81491. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  81492. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  81493. * @param {Object} [options.headers] - 请求头。
  81494. */
  81495. var WebPrintingJobService = ServiceBase.extend({
  81496. initialize: function (url, options) {
  81497. ServiceBase.prototype.initialize.call(this, url, options);
  81498. },
  81499. /**
  81500. * @function L.supermap.webPrintingJobService.prototype.createWebPrintingJob
  81501. * @description 创建 Web 打印任务。
  81502. * @param {SuperMap.WebPrintingJobParameters} params - 打印的相关参数类。
  81503. * @param {RequestCallback} callback - 回调函数。
  81504. */
  81505. createWebPrintingJob(params, callback) {
  81506. if (!params) {
  81507. return;
  81508. }
  81509. var me = this;
  81510. console.log(me.url);
  81511. var webPrintingService = new WebPrintingService(me.url, {
  81512. proxy: me.options.proxy,
  81513. withCredentials: me.options.withCredentials,
  81514. crossOrigin: me.options.crossOrigin,
  81515. headers: me.options.headers,
  81516. serverType: me.options.serverType,
  81517. eventListeners: {
  81518. scope: me,
  81519. processCompleted: callback,
  81520. processFailed: callback
  81521. }
  81522. });
  81523. webPrintingService.createWebPrintingJob(me._processParams(params));
  81524. },
  81525. /**
  81526. * @function L.supermap.webPrintingJobService.prototype.getPrintingJob
  81527. * @description 获取 Web 打印输出文档任务。
  81528. * @param {String} jobId - Web 打印输入文档任务 Id。
  81529. * @param {RequestCallback} callback - 回调函数。
  81530. */
  81531. getPrintingJob: function (jobId, callback) {
  81532. var me = this;
  81533. var webPrintingService = new WebPrintingService(me.url, {
  81534. proxy: me.options.proxy,
  81535. withCredentials: me.options.withCredentials,
  81536. crossOrigin: me.options.crossOrigin,
  81537. headers: me.options.headers,
  81538. serverType: me.options.serverType,
  81539. eventListeners: {
  81540. scope: me,
  81541. processCompleted: callback,
  81542. processFailed: callback
  81543. }
  81544. });
  81545. webPrintingService.getPrintingJob(jobId);
  81546. },
  81547. /**
  81548. * @function L.supermap.webPrintingJobService.prototype.getPrintingJobResult
  81549. * @description 获取 Web 打印任务的输出文档。
  81550. * @param {String} jobId - Web 打印输入文档任务 Id。
  81551. * @param {RequestCallback} callback - 回调函数。
  81552. */
  81553. getPrintingJobResult: function (jobId, callback) {
  81554. var me = this;
  81555. var webPrintingService = new WebPrintingService(me.url, {
  81556. proxy: me.options.proxy,
  81557. withCredentials: me.options.withCredentials,
  81558. crossOrigin: me.options.crossOrigin,
  81559. headers: me.options.headers,
  81560. serverType: me.options.serverType,
  81561. eventListeners: {
  81562. scope: me,
  81563. processCompleted: callback,
  81564. processFailed: callback
  81565. }
  81566. });
  81567. webPrintingService.getPrintingJobResult(jobId);
  81568. },
  81569. /**
  81570. * @function L.supermap.webPrintingJobService.prototype.getLayoutTemplates
  81571. * @description 查询 Web 打印服务所有可用的模板信息。
  81572. * @param {RequestCallback} callback - 回调函数。
  81573. */
  81574. getLayoutTemplates: function (callback) {
  81575. var me = this;
  81576. var webPrintingService = new WebPrintingService(me.url, {
  81577. proxy: me.options.proxy,
  81578. withCredentials: me.options.withCredentials,
  81579. crossOrigin: me.options.crossOrigin,
  81580. headers: me.options.headers,
  81581. serverType: me.options.serverType,
  81582. eventListeners: {
  81583. scope: me,
  81584. processCompleted: callback,
  81585. processFailed: callback
  81586. }
  81587. });
  81588. webPrintingService.getLayoutTemplates();
  81589. },
  81590. _processParams(params) {
  81591. if (params.layoutOptions && params.layoutOptions.littleMapOptions) {
  81592. params.layoutOptions.littleMapOptions.center = this._toPointObject(
  81593. params.layoutOptions.littleMapOptions.center
  81594. );
  81595. }
  81596. if (params.exportOptions) {
  81597. params.exportOptions.center = this._toPointObject(params.exportOptions.center);
  81598. }
  81599. return params;
  81600. },
  81601. _toPointObject(point) {
  81602. if (external_L_default().Util.isArray(point)) {
  81603. return {
  81604. x: point[0],
  81605. y: point[1]
  81606. };
  81607. } else if (point instanceof SuperMap.Geometry.Point || point instanceof (external_L_default()).Point) {
  81608. return {
  81609. x: point.x,
  81610. y: point.y
  81611. };
  81612. } else if (point instanceof (external_L_default()).LatLng) {
  81613. return {
  81614. x: point.lng,
  81615. y: point.lat
  81616. };
  81617. }
  81618. return point;
  81619. }
  81620. });
  81621. var webPrintingJobService = function (url, options) {
  81622. return new WebPrintingJobService(url, options);
  81623. };
  81624. (external_L_default()).supermap.webPrintingJobService = webPrintingJobService;
  81625. ;// CONCATENATED MODULE: ./src/leaflet/services/index.js
  81626. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  81627. * This program are made available under the terms of the Apache License, Version 2.0
  81628. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  81629. ;// CONCATENATED MODULE: ./src/leaflet/components/ComponentsViewBase.js
  81630. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  81631. * This program are made available under the terms of the Apache License, Version 2.0
  81632. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  81633. /**
  81634. * @class L.supermap.components.componentsViewBase
  81635. * @classdesc Lealfet 组件基类。
  81636. * @category Components Common
  81637. * @version 9.1.1
  81638. * @param {Object} options - 参数。
  81639. * @param {string} [options.position='topright'] - 组件在地图中显示的位置,包括:'topleft','topright','bottomleft' 和 'bottomright',继承自 leaflet control。
  81640. * @param {function} [options.style] - 设置图层点线面默认样式,点样式返回 maker 或者 circleMaker;线和面返回 L.path 样式。
  81641. * @param {function} [options.onEachFeature] - 在创建和设置样式后,将为每个创建的要素调用一次的函数。用于将事件和弹出窗口附加到要素。默认情况下,对新创建的图层不执行任何操作。
  81642. * @extends {L.Control}
  81643. */
  81644. var ComponentsViewBase = external_L_default().Control.extend({
  81645. options: {
  81646. //控件位置 继承自leaflet control
  81647. position: 'topright',
  81648. //默认样式,以支持组件设置图层基本样式
  81649. style: (feature, latLng) => {
  81650. if (latLng /*&& feature instanceof L.latLng || feature.geometry.type.toLowerCase() === "point"*/) {
  81651. return external_L_default().circleMarker(latLng, {
  81652. fillColor: 'blue',
  81653. weight: 1,
  81654. opacity: 1,
  81655. color: 'blue',
  81656. fillOpacity: 0.6
  81657. });
  81658. } else {
  81659. return {
  81660. fillColor: 'blue',
  81661. weight: 1,
  81662. opacity: 1,
  81663. color: 'blue',
  81664. fillOpacity: 0.6
  81665. }
  81666. }
  81667. },
  81668. onEachFeature: null
  81669. },
  81670. initialize(options) {
  81671. external_L_default().setOptions(this, options);
  81672. //组件事件处理对象://todo 确认一些公开或私有的成员变量
  81673. this._event = new (external_L_default()).Evented();
  81674. //组件根 dom 元素:
  81675. this.rootContainer = null;
  81676. //图层参数,主要配置组件返回数据图层的样式和事件等
  81677. },
  81678. /**
  81679. * @function L.supermap.components.componentsViewBase.prototype.onAdd
  81680. * @description 向地图添加组件。
  81681. */
  81682. onAdd(map) {
  81683. //子类实现此方法
  81684. this.map = map;
  81685. this.rootContainer = this._initView();
  81686. return this.rootContainer;
  81687. },
  81688. /**
  81689. * @function L.supermap.components.componentsViewBase.prototype.on
  81690. * @param {string} eventType - 监听的事件类型。
  81691. * @param {Function} callback - 监听事件的回调函数。
  81692. */
  81693. on(eventType, callback) {
  81694. this._event.on(eventType, callback);
  81695. },
  81696. /**
  81697. * @function L.supermap.components.componentsViewBase.prototype.off
  81698. * @description 事件关闭。
  81699. * @param {string} eventType - 监听的事件名。
  81700. * @param {Function} callback - 监听事件的回调函数。
  81701. */
  81702. off(eventType, callback) {
  81703. this._event.off(eventType, callback);
  81704. },
  81705. /**
  81706. * @function L.supermap.components.componentsViewBase.prototype._initView
  81707. * @description 初始化组件 UI。
  81708. * @private
  81709. */
  81710. _initView() {
  81711. //子类实现此方法
  81712. },
  81713. /**
  81714. * @function L.supermap.components.componentsViewBase.prototype._preventMapEvent
  81715. * @description 阻止 map 默认事件。
  81716. * @private
  81717. */
  81718. _preventMapEvent(div, map) {
  81719. if (!div || !map) {
  81720. return;
  81721. }
  81722. div.addEventListener('mouseover', function () {
  81723. map.dragging.disable();
  81724. map.scrollWheelZoom.disable();
  81725. map.doubleClickZoom.disable();
  81726. });
  81727. div.addEventListener('mouseout', function () {
  81728. map.dragging.enable();
  81729. map.scrollWheelZoom.enable();
  81730. map.doubleClickZoom.enable();
  81731. });
  81732. }
  81733. });
  81734. var componentsViewBase = function (options) {
  81735. return new ComponentsViewBase(options);
  81736. };
  81737. (external_L_default()).supermap.components.componentsViewBase = componentsViewBase;
  81738. ;// CONCATENATED MODULE: ./src/leaflet/components/openfile/OpenFileViewModel.js
  81739. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  81740. * This program are made available under the terms of the Apache License, Version 2.0
  81741. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  81742. /**
  81743. * @class L.supermap.components.openFileViewModel
  81744. * @classdesc 打开本地文件组件功能类,目前只支持WGS84经纬度坐标。
  81745. * @version 9.1.1
  81746. * @category Components OpenFile
  81747. * @param {L.Map} map - leaflet map 对象。
  81748. * @fires L.supermap.components.openFileViewModel#filesizeexceed
  81749. * @fires L.supermap.components.openFileViewModel#errorfileformat
  81750. * @fires L.supermap.components.openFileViewModel#openfilesucceeded
  81751. * @fires L.supermap.components.openFileViewModel#openfilefailed
  81752. * @extends {L.Evented}
  81753. */
  81754. var OpenFileViewModel = external_L_default().Evented.extend({
  81755. initialize() {
  81756. this.fileModel = new FileModel();
  81757. },
  81758. /**
  81759. * @function L.supermap.components.openFileViewModel.prototype.readFile
  81760. * @description 选中文件并加载到底图。
  81761. * @param {Object} fileEventObject - 通过文件选择框打开的本地文件对象。
  81762. */
  81763. readFile(fileEventObject) {
  81764. let inputDom = fileEventObject.target;
  81765. let file = inputDom.files[0];
  81766. //文件大小限制
  81767. if (file.size > this.fileModel.FileConfig.fileMaxSize) {
  81768. // document.alert("File supports up to 10M.");
  81769. /**
  81770. * @event L.supermap.components.openFileViewModel#filesizeexceed
  81771. * @description 超出文件大小限制后触发。
  81772. * @property {string} messageType - 警告类型。
  81773. * @property {string} message - 警告内容。
  81774. */
  81775. this.fire("filesizeexceed", {messageType: "warring", message: Lang.i18n('msg_fileSizeExceeded')});
  81776. return false;
  81777. }
  81778. let filePath = inputDom.value;
  81779. let fileName = file.name;
  81780. let fileType = ComponentsUtil.getFileType(fileName);
  81781. //文件格式不支持
  81782. if (!fileType) {
  81783. // document.alert("Unsupported data type.");
  81784. /**
  81785. * @event L.supermap.components.openFileViewModel#errorfileformat
  81786. * @description 文件格式不支持时触发。
  81787. * @property {string} messageType - 警告类型。
  81788. * @property {string} message - 警告内容。
  81789. */
  81790. this.fire("errorfileformat", {messageType: "failure", message: Lang.i18n('msg_fileTypeUnsupported')});
  81791. return false;
  81792. }
  81793. //文件类型限制
  81794. if (fileName !== "") {
  81795. //给control 一份数据
  81796. //todo MVVM模式 应该是数据变化触发数据变化的事件
  81797. this.fileModel.set(
  81798. "loadFileObject", {
  81799. file: file,
  81800. filePath: filePath,
  81801. fileName: fileName,
  81802. fileType: fileType
  81803. });
  81804. //响应选中文件添加到地图
  81805. this._readData();
  81806. }
  81807. },
  81808. /**
  81809. * @function L.supermap.components.openFileViewModel.prototype._readData
  81810. * @description 数据文件中的数据。
  81811. * @private
  81812. */
  81813. _readData() {
  81814. //todo 需要测试另外两个
  81815. const me = this;
  81816. const type = this.fileModel.loadFileObject.fileType;
  81817. FileReaderUtil.readFile(type, {
  81818. file: this.fileModel.loadFileObject.file,
  81819. path: this.fileModel.loadFileObject.filePath
  81820. }, (data) => {
  81821. //将数据统一转换为 geoJson 格式加载到底图
  81822. FileReaderUtil.processDataToGeoJson(type, data, (geojson) => {
  81823. if (geojson) {
  81824. /**
  81825. * @event L.supermap.components.openFileViewModel#openfilesucceeded
  81826. * @description 打开文件成功。
  81827. * @property {GeoJSONObject} result - GeoJSON 格式数据。
  81828. * @property {string} layerName - 图层名。
  81829. */
  81830. this.fire("openfilesucceeded", {
  81831. result: geojson,
  81832. layerName: this.fileModel.loadFileObject.fileName.split('.')[0]
  81833. });
  81834. }
  81835. }, (e) => {
  81836. me.fire("openfilefailed", {messageType: "failure", message: e});
  81837. }, this);
  81838. }, () => {
  81839. /**
  81840. * @event L.supermap.components.openFileViewModel#openfilefailed
  81841. * @description 打开文件失败。
  81842. * @property {string} messageType - 警告类型。
  81843. * @property {string} message - 警告内容。
  81844. */
  81845. me.fire("openfilefailed", {messageType: "failure", message: Lang.i18n('msg_openFileFail')});
  81846. }, this);
  81847. }
  81848. });
  81849. var openFileViewModel = function (options) {
  81850. return new OpenFileViewModel(options);
  81851. };
  81852. (external_L_default()).supermap.components.openFileViewModel = openFileViewModel;
  81853. (external_L_default()).supermap.components.util = ComponentsUtil;
  81854. ;// CONCATENATED MODULE: ./src/leaflet/components/openfile/OpenFileView.js
  81855. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  81856. * This program are made available under the terms of the Apache License, Version 2.0
  81857. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  81858. /**
  81859. * @class L.supermap.components.openFile
  81860. * @classdesc 打开文件组件,用于打开本地数据文件并加载到地图,目前支持打开 .csv|.xls|.xlsx|.geojson|.json 格式文件,只支持WGS84经纬度坐标。
  81861. * @version 9.1.1
  81862. * @param {Object} options - 可选参数。
  81863. * @param {string} [options.position='topright'] - 组件在地图中显示的位置,包括:'topleft','topright','bottomleft' 和 'bottomright',继承自 leaflet control。
  81864. * @param {function} [options.style] - 设置图层点线面默认样式,点样式返回 maker 或者 circleMaker;线和面返回 L.path 样式。
  81865. * @param {function} [options.onEachFeature] - 在创建和设置样式后,将为每个创建的要素调用一次的函数。用于将事件和弹出窗口附加到要素。默认情况下,对新创建的图层不执行任何操作。
  81866. * @fires L.supermap.components.openFile#openfilesucceeded
  81867. * @fires L.supermap.components.openFile#openfilefailed
  81868. * @extends {L.supermap.components.componentsViewBase}
  81869. * @category Components OpenFile
  81870. */
  81871. var OpenFileView = ComponentsViewBase.extend({
  81872. options: {
  81873. //绑定的底图图层
  81874. layer: null
  81875. },
  81876. initialize(options) {
  81877. ComponentsViewBase.prototype.initialize.apply(this, [options]);
  81878. //初始化 ViewModel:
  81879. this.viewModel = new OpenFileViewModel();
  81880. },
  81881. /**
  81882. * @function L.supermap.components.openFile.prototype.setViewStyle
  81883. * @description 改变组件样式。
  81884. * @param {string} styleName - css 样式名。
  81885. * @param {string} value - css 样式值。
  81886. */
  81887. setViewStyle(styleName, value) {
  81888. this.rootContainer.style[styleName] = value;
  81889. },
  81890. /**
  81891. * @function L.supermap.components.openFile.prototype._initView
  81892. * @description 创建打开本地文件数据组件。
  81893. * @returns {HTMLElement}
  81894. * @private
  81895. * @override
  81896. */
  81897. _initView() {
  81898. //初始化 view
  81899. const uploadContent = external_L_default().DomUtil.create('div', 'component-openfile');
  81900. uploadContent.id = 'openFile';
  81901. this.fileSelect = external_L_default().DomUtil.create('div', '', uploadContent);
  81902. this.label = external_L_default().DomUtil.create('label', 'component-openfile__span--select', this.fileSelect);
  81903. this.label.htmlFor = "input_file";
  81904. external_L_default().DomUtil.create('div', 'supermapol-icons-upload', this.label);
  81905. const fileSpan = external_L_default().DomUtil.create('span', 'component-openfile__span', this.label);
  81906. fileSpan.appendChild(document.createTextNode(Lang.i18n('text_chooseFile')));
  81907. this.fileInput = external_L_default().DomUtil.create('input', 'component-openfile__input', this.fileSelect);
  81908. this.fileInput.id = "input_file";
  81909. this.fileInput.type = "file";
  81910. this.fileInput.accept = ".json,.geojson,.csv,.xls,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
  81911. this.fileInput.onchange = (fileEventObject) => {
  81912. this.messageBox.closeView();
  81913. this.viewModel.readFile(fileEventObject);
  81914. };
  81915. //增加提示框:
  81916. this.messageBox = new MessageBox();
  81917. //添加监听
  81918. this.viewModel.on("filesizeexceed", (e) => {
  81919. this.messageBox.showView(e.message, e.messageType);
  81920. });
  81921. this.viewModel.on("errorfileformat", (e) => {
  81922. this.messageBox.showView(e.message, e.messageType);
  81923. });
  81924. this.viewModel.on("openfilefailed", (e) => {
  81925. this.messageBox.showView(e.message, e.messageType);
  81926. /**
  81927. * @event L.supermap.components.openFile#openfilefailed
  81928. * @description 打开文件失败。
  81929. * @property {Object} e - 事件对象。
  81930. */
  81931. this._event.fire("openfilefailed", e);
  81932. });
  81933. this.viewModel.on("readdatafail", (e) => {
  81934. this.messageBox.showView(e.message, e.messageType);
  81935. });
  81936. this.viewModel.on("openfilesucceeded", (e) => {
  81937. /**
  81938. * @event L.supermap.components.openFile#openfilesucceeded
  81939. * @description 打开文件成功。
  81940. * @property {Object} e - 事件对象。
  81941. */
  81942. this._event.fire("openfilesucceeded", e);
  81943. });
  81944. // 阻止 map 默认事件
  81945. this._preventMapEvent(uploadContent, this.map);
  81946. return uploadContent;
  81947. }
  81948. });
  81949. var openFileView = function (options) {
  81950. return new OpenFileView(options);
  81951. };
  81952. (external_L_default()).supermap.components.openFile = openFileView;
  81953. ;// CONCATENATED MODULE: ./src/leaflet/components/search/CityConfig.js
  81954. const config = {
  81955. HOT: {
  81956. HOT: ["北京市", "上海市", "广州市", "深圳市", "南京市", "杭州市", "天津市", "重庆市", "成都市", "青岛市", "苏州市", "无锡市", "常州市", "温州市", "武汉市", "长沙市", "南昌市", "三亚市", "合肥市", "石家庄市"]
  81957. },
  81958. AB: {
  81959. A: ["阿拉善盟", "鞍山市", "安庆市", "安阳市", "阿坝藏族羌族自治州", "安顺市", "阿里地区", "安康市", "阿克苏地区", "阿勒泰地区", "阿拉尔市"],
  81960. B: ["北京市", "保定市", "包头市", "巴彦淖尔市", "本溪市", "白山市", "白城市", "蚌埠市", "亳州市", "滨州市", "北海市", "百色市", "白沙黎族自治县", "保亭黎族苗族自治县", "巴中市", "毕节地区", "保山市", "宝鸡市", "白银市", "博尔塔拉蒙古自治州", "巴音郭楞蒙古自治州", "北区"]
  81961. },
  81962. CD: {
  81963. C: ["重庆市", "成都市", "常州市", "长沙市", "承德市", "沧州市", "长治市", "赤峰市", "朝阳市", "长春市", "滁州市", "巢湖市", "池州市", "常德市", "郴州市", "潮州市", "崇左市", "澄迈县", "昌江黎族自治县", "楚雄彝族自治州", "昌都地区", "昌吉回族自治州"],
  81964. D: ["大同市", "大连市", "丹东市", "大庆市", "大兴安岭地区", "东营市", "德州市", "东莞市", "儋州市", "东方市", "定安县", "德阳市", "达州市", "大理白族自治州", "德宏傣族景颇族自治州", "迪庆藏族自治州", "定西市", "东区", "大埔区", "大堂区"]
  81965. },
  81966. EFG: {
  81967. E: ["鄂尔多斯市", "鄂州市", "恩施土家族苗族自治州"],
  81968. F: ["抚顺市", "阜新市", "阜阳市", "福州市", "抚州市", "佛山市", "防城港市"],
  81969. G: ["广州市", "赣州市", "桂林市", "贵港市", "广元市", "广安市", "贵阳市", "固原市", "高雄市", "高雄县", "甘南藏族自治州", "甘孜藏族自治州"]
  81970. },
  81971. H: {
  81972. H: ["杭州市", "合肥市", "邯郸市", "衡水市", "呼和浩特市", "呼伦贝尔市", "葫芦岛市", "哈尔滨市", "鹤岗市", "黑河市", "淮安市", "湖州市", "淮南市", "淮北市", "黄山市", "菏泽市", "鹤壁市", "黄石市", "黄冈市", "衡阳市", "怀化市", "惠州市", "河源市", "贺州市", "河池市", "海口市", "红河哈尼族彝族自治州", "汉中市", "海东地区", "海北藏族自治州", "黄南藏族自治州", "海南藏族自治州", "果洛藏族自治州", "海西蒙古族藏族自治州", "哈密地区", "和田地区", "花莲县", "黄大仙区", "花地玛堂区"]
  81973. },
  81974. J: {
  81975. J: ["晋城市", "晋中市", "锦州市", "吉林市", "鸡西市", "佳木斯市", "嘉兴市", "金华市", "景德镇市", "九江市", "吉安市", "济南市", "济宁市", "焦作市", "济源市", "荆门市", "荆州市", "江门市", "湛江市", "揭阳市", "嘉峪关市", "金昌市", "酒泉市", "基隆市", "嘉义市", "嘉义县", "九龙城区", "嘉模堂区"]
  81976. },
  81977. KL: {
  81978. K: ["开封市", "昆明市", "克拉玛依市", "克孜勒苏柯尔克孜自治州", "喀什地区"],
  81979. L: ["廊坊市", "临汾市", "吕梁市", "辽阳市", "辽源市", "连云港市", "丽水市", "六安市", "龙岩市", "莱芜市", "临沂市", "聊城市", "洛阳市", "漯河市", "娄底市", "柳州市", "来宾市", "临高县", "乐东黎族自治县", "陵水黎族自治县", "泸州市", "乐山市", "凉山彝族自治州", "六盘水市", "丽江市", "临沧市", "拉萨市", "林芝地区", "兰州市", "陇南市", "临夏回族自治州"]
  81980. },
  81981. MNP: {
  81982. M: ["牡丹江市", "马鞍山市", "茂名市", "梅州市", "绵阳市", "眉山市", "苗栗县"],
  81983. N: ["南京市", "南昌市", "南通市", "宁波市", "南平市", "宁德市", "南阳市", "南宁市", "南沙群岛", "内江市", "南充市", "怒江傈傈族自治州", "那曲地区", "南投县"],
  81984. P: ["盘锦市", "莆田市", "萍乡市", "平顶山市", "濮阳市", "攀枝花市", "平凉市", "屏东县", "澎湖县"]
  81985. },
  81986. QR: {
  81987. Q: ["青岛市", "秦皇岛市", "齐齐哈尔市", "黔西南布依族苗族自治州", "七台河市", "衢州市", "泉州市", "潜江市", "清远市", "钦州市", "琼海市", "曲靖市", "庆阳市", "荃湾区", "黔东南苗族侗族自治州", "黔南布依族苗族自治州", "琼中黎族苗族自治县"],
  81988. R: ["日照市", "日喀则地区"]
  81989. },
  81990. S: {
  81991. S: ["上海市", "深圳市", "苏州市", "石家庄市", "三亚市", "朔州市", "沈阳市", "四平市", "松原市", "双鸭山市", "绥化市", "宿迁市", "绍兴市", "宿州市", "三明市", "上饶市", "三门峡市", "商丘市", "十堰市", "随州市", "邵阳市", "韶关市", "汕头市", "汕尾市", "三亚市", "遂宁市", "思茅市", "山南地区", "商洛市", "石嘴山市", "石河子市", "深水埗区", "沙田区", "神农架林区", "圣安多尼堂区", "圣方济各堂区"]
  81992. },
  81993. T: {
  81994. T: ["天津市", "唐山市", "太原市", "通辽市", "铁岭市", "通化市", "泰州市", "台州市", "铜陵市", "泰安市", "天门市", "屯昌县", "铜仁地区", "铜川市", "天水市", "吐鲁番地区", "塔城地区", "图木舒克市", "台北市", "台中市", "台南市", "台北县", "桃园县", "台中县", "台南县", "台东县", "屯门区"]
  81995. },
  81996. W: {
  81997. W: ["无锡市", "温州市", "武汉市", "乌海市", "乌兰察布市", "芜湖市", "潍坊市", "威海市", "梧州市", "五指山市", "文昌市", "万宁市", "文山壮族苗族自治州", "渭南市", "武威市", "吴忠市", "乌鲁木齐市", "五家渠市", "湾仔区", "望德堂区"]
  81998. },
  81999. X: {
  82000. X: ["邢台市", "忻州市", "兴安盟", "徐州市", "宣城市", "厦门市", "新余市", "新乡市", "许昌市", "信阳市", "襄樊市", "孝感市", "咸宁市", "仙桃市", "湘潭市", "西安市", "咸阳市", "西宁市", "新竹市", "新竹县", "西贡区", "锡林郭勒盟", "西沙群岛", "湘西土家族苗族自治州", "西双版纳傣族自治州"]
  82001. },
  82002. Y: {
  82003. Y: ["阳泉市", "运城市", "营口市", "延边朝鲜族自治州", "伊春市", "盐城市", "扬州市", "鹰潭市", "宜春市", "烟台市", "宜昌市", "岳阳市", "益阳市", "永州市", "阳江市", "云浮市", "玉林市", "宜宾市", "雅安市", "玉溪市", "延安市", "榆林市", "玉树藏族自治州", "银川市", "伊犁哈萨克自治州", "宜兰县", "云林县", "油尖旺区", "元朗区"]
  82004. },
  82005. Z: {
  82006. Z: ["郑州市", "张家口市", "镇江市", "舟山市", "漳州市", "淄博市", "枣庄市", "周口市", "驻马店市", "株洲市", "张家界市", "珠海市", "肇庆市", "中山市", "自贡市", "资阳市", "遵义市", "昭通市", "张掖市", "中卫市", "彰化县", "中西区", "中沙群岛的岛礁及其海域"]
  82007. }
  82008. };
  82009. ;// CONCATENATED MODULE: ./src/leaflet/components/commonmodels/GeoJsonLayersModel.js
  82010. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  82011. * This program are made available under the terms of the Apache License, Version 2.0
  82012. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  82013. // import {
  82014. // CommonUtil
  82015. // } from '@supermap/iclient-common';
  82016. /**
  82017. * @class L.supermap.components.GeoJsonLayersDataModel
  82018. * @description 多图层数据模型 todo 看看如何完善
  82019. * @category Components Common
  82020. * @private
  82021. * @param {Array.<Object>} layers - 图层数组。
  82022. * @param {L.supermap.components.geoJSONLayerWithName} layers.layerObject - 含有 layerName 与 GeoJSON 图层的对象。
  82023. * @fires L.supermap.components.GeoJsonLayersDataModel#newlayeradded
  82024. */
  82025. class GeoJsonLayersDataModel {
  82026. constructor(layers) {
  82027. this.layers = [];
  82028. if (layers && layers.length > 0) {
  82029. this.addLayers(layers);
  82030. }
  82031. this.currentLayerDataModel = null;
  82032. }
  82033. addLayers(layers, success, failed, context) {
  82034. for (let i = 0; i < layers.length; i++) {
  82035. let layerName = layers[i].layerName;
  82036. if (layers[i].layer instanceof (external_L_default()).GeoJSON) {
  82037. let geoJsonLayerDataModel = new GeoJsonLayerDataModel(layers[i].layer);
  82038. //赋给 GeoJsonLayersDataModel 对象 layerName 属性,每个图层名对应一个 layerDataModel 对象
  82039. this.layers[layerName] = geoJsonLayerDataModel;
  82040. success && success.call(context, {layerName: layerName, layer: geoJsonLayerDataModel});
  82041. } else {
  82042. failed && failed.call(context, "")
  82043. }
  82044. }
  82045. }
  82046. /**
  82047. * @function L.supermap.components.GeoJsonLayersDataModel.prototype.setCurrentLayerDataModel
  82048. * @description 设置当前选中的图层。
  82049. * @param {string} layerName - 选中的图层名。
  82050. */
  82051. setCurrentLayerDataModel(layerName) {
  82052. if (this.layers[layerName]) {
  82053. this.currentLayerDataModel = this.layers[layerName];
  82054. }
  82055. }
  82056. }
  82057. (external_L_default()).supermap.components.GeoJsonLayersDataModel = GeoJsonLayersDataModel;
  82058. /**
  82059. * @class L.supermap.components.GeoJsonLayerDataModel
  82060. * @classdesc 图层数据模型,用于图层要素数据及属性管理等。
  82061. * @param {L.GeoJSON} layer - GeoJSON 图层。
  82062. * 注:leaflet没有 feature 的概念
  82063. */
  82064. class GeoJsonLayerDataModel {
  82065. constructor(layer) {
  82066. //图层对象
  82067. this.layer = layer;
  82068. //要素图层数组
  82069. this.features = layer.getLayers();
  82070. //图层属性字段
  82071. this.attributeNames = [];
  82072. //这里一个图层默认共用一套属性字段
  82073. if (this.features[0].feature.properties) {
  82074. for (let field in this.features[0].feature.properties) {
  82075. this.attributeNames.push(field);
  82076. }
  82077. }
  82078. //指定图层操作属性字段
  82079. this.operatingAttributeNames = [];
  82080. //图层属性对象
  82081. this.attributes = {};
  82082. }
  82083. /**
  82084. * @function GeoJsonLayerDataModel.prototype.setOperatingAttributeNames
  82085. * @description 指定操作字段。
  82086. * @param {Array.<string>} operatingAttr - 查询属性字段数组,该数组为 this.attributeNames 的子集。
  82087. */
  82088. setOperatingAttributeNames(operatingAttr) {
  82089. this.operatingAttributeNames = operatingAttr;
  82090. }
  82091. /**
  82092. * @function GeoJsonLayerDataModel.prototype.getAllAttributeNames
  82093. * @description 获取图层所有属性字段。
  82094. * @returns {Array.<string>} - 返回图层所有属性字段。
  82095. */
  82096. getAllAttributeNames() {
  82097. return this.attributeNames;
  82098. }
  82099. /**
  82100. * @function GeoJsonLayerDataModel.prototype.getAttributeNamesByType
  82101. * @description 获取指定类型的图层属性字段。
  82102. * @param {string} [type] - 需要获取的图层属性字段的类型。目前可选 "Num",若不传此参数,则默认返回所有字段。
  82103. * @returns {Array.<string>} - 返回指定类型的图层属性字段。
  82104. */
  82105. getAttributeNamesByType(type) {
  82106. //图层属性字段
  82107. if (this.features[0].feature.properties) {
  82108. let properties = this.features[0].feature.properties;
  82109. let attributeNames = [];
  82110. if (type === 'Num') {
  82111. for (let field in properties) {
  82112. if (!isNaN(properties[field])) {
  82113. attributeNames.push(field);
  82114. }
  82115. }
  82116. } else {
  82117. attributeNames = this.attributeNames;
  82118. }
  82119. return attributeNames;
  82120. }
  82121. }
  82122. /**
  82123. * @function GeoJsonLayerDataModel.prototype.getAllFeatures
  82124. * @description 获取图层所有要素
  82125. * @returns {Array.<Object>} - 返回图层要素
  82126. */
  82127. getAllFeatures() {
  82128. return this.features;
  82129. }
  82130. /**
  82131. * @function GeoJsonLayerDataModel.prototype.getAttributeValueByAttributeName
  82132. * @description 通过属性字段名获取属性值
  82133. * @param {string} attributeName - 图层要素属性字段名
  82134. * @returns {Object} - 图层要素属性值对象
  82135. */
  82136. getAttributeValueByAttributeName(attributeName) {
  82137. //如果图层属性对象中已存在该属性,则直接返回
  82138. if (this.attributes[attributeName]) {
  82139. return this.attributes[attributeName];
  82140. }
  82141. //若图层属性对象还未存储该属性,则遍历每个feature 读取其属性值,并存储到图层属性对象中
  82142. this.attributes[attributeName] = [];
  82143. for (let i = 0; i < this.features.length; i++) {
  82144. this.attributes[attributeName].push([this.features[i].feature.properties[attributeName]]);
  82145. }
  82146. return this.attributes[attributeName];
  82147. }
  82148. //getAttributeValueByAttributeName(feature,attributeName)
  82149. //getAllFeatures()
  82150. //todo getFeatureByID()
  82151. //getFeaturesByKeywords(keyword,searchAttributeNames)
  82152. //getAllAttributeValues(attributeName) ??
  82153. //getAllAttributeNames()
  82154. /**
  82155. * @function GeoJsonLayerDataModel.prototype.getFeaturesByKeyWord
  82156. * @description 通过关键字查找要素对象
  82157. * @param {string} keyWord - 查询关键字
  82158. * @returns {Array.<Object>} - 返回要素对象数组
  82159. */
  82160. getFeaturesByKeyWord(keyWord) {
  82161. let features = [], keyReg = new RegExp(keyWord.toLowerCase());
  82162. const self = this;
  82163. this.features.forEach(function (feature) {
  82164. if (!feature.feature.properties) {
  82165. return null;
  82166. }
  82167. let fAttr = feature.feature.properties;
  82168. let operatingAttributeNames;
  82169. //若设置了过滤字段,则按过滤字段查询
  82170. if (self.operatingAttributeNames.length > 0) {
  82171. operatingAttributeNames = self.operatingAttributeNames;
  82172. } else {
  82173. //若未设置了过滤字段,则按图层字段查询
  82174. operatingAttributeNames = self.attributeNames;
  82175. }
  82176. //遍历要素,查询符合条件的要素
  82177. for (let i = 0, len = operatingAttributeNames.length; i < len; i++) {
  82178. if (fAttr[operatingAttributeNames[i]] && keyReg.test(fAttr[operatingAttributeNames[i]].toString().toLowerCase())) {
  82179. let filterAttributeName = operatingAttributeNames[i];
  82180. let filterAttributeValue = fAttr[operatingAttributeNames[i]];
  82181. //将查询出的属性字段及属性值赋给 feature 并返回
  82182. feature.filterAttribute = {
  82183. filterAttributeName: filterAttributeName,
  82184. filterAttributeValue: filterAttributeValue
  82185. };
  82186. features.push(feature);
  82187. break;
  82188. }
  82189. }
  82190. });
  82191. return features;
  82192. }
  82193. }
  82194. ;// CONCATENATED MODULE: ./src/leaflet/components/search/SearchViewModel.js
  82195. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  82196. * This program are made available under the terms of the Apache License, Version 2.0
  82197. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  82198. /**
  82199. * @class L.supermap.components.searchViewModel
  82200. * @classdesc 图层查询组件功能类。
  82201. * @version 9.1.1
  82202. * @category Components Search
  82203. * @param {L.Map} map - Leaflet Map 对象。
  82204. * @param {Object} options - 可选参
  82205. * @param {Object} [options.cityGeoCodingConfig] - 城市地址匹配服务配置,包括:{addressUrl:"",key:""},默认为 online 本地搜索服务。
  82206. * @fires L.supermap.components.searchViewModel#newlayeradded
  82207. * @fires L.supermap.components.searchViewModel#searchlayersucceeded
  82208. * @fires L.supermap.components.searchViewModel#searchfailed
  82209. * @fires L.supermap.components.searchViewModel#geocodesucceeded
  82210. * @extends {L.Evented}
  82211. */
  82212. var SearchViewModel = external_L_default().Evented.extend({
  82213. options: {
  82214. cityGeoCodingConfig: {
  82215. addressUrl: "https://www.supermapol.com/iserver/services/localsearch/rest/searchdatas/China/poiinfos",
  82216. key: "fvV2osxwuZWlY0wJb8FEb2i5"
  82217. }
  82218. },
  82219. initialize(map, options) {
  82220. if (map) {
  82221. /**
  82222. * @member {L.Map} L.supermap.components.searchViewModel.prototype.map
  82223. * @description 当前组件所在的地图。
  82224. */
  82225. this.map = map;
  82226. } else {
  82227. return new Error(`Cannot find map, fileModel.map cannot be null.`);
  82228. }
  82229. external_L_default().Util.setOptions(this, options);
  82230. //初始化Model
  82231. this.dataModel = new GeoJsonLayersDataModel();
  82232. //初始话地址匹配服务
  82233. this.geoCodeParam = {
  82234. keyWords: '北京市',
  82235. city: "北京市",
  82236. pageSize: this.options.pageSize,
  82237. pageNum: this.options.pageNum
  82238. };
  82239. //查询缓存
  82240. this.searchCache = {};
  82241. },
  82242. /**
  82243. * @function L.supermap.components.searchViewModel.prototype.search
  82244. * @description 查询。
  82245. * @param {string} keyWords - 查询的关键字。
  82246. * @param {string} [searchLayerName] - 执行的查询类型,支执行矢量图层属性查询,当为 "geocode" 则执行地址匹配。
  82247. */
  82248. search(keyWord, searchLayerName) {
  82249. if (!searchLayerName) {
  82250. this.searchFromCityLocalSearchService(keyWord);
  82251. } else {
  82252. this.searchFromLayer(keyWord, searchLayerName);
  82253. }
  82254. },
  82255. /**
  82256. * @function L.supermap.components.searchViewModel.prototype.searchFromLayer
  82257. * @description 图层属性查询。
  82258. * @param {string} searchLayerName - 查询的图层名。
  82259. * @param {string} keyWord - 图层属性搜索关键字。
  82260. */
  82261. searchFromLayer(keyWord, searchLayerName) {
  82262. if (this.dataModel.layers[searchLayerName]) {
  82263. let resultFeatures = this.dataModel.layers[searchLayerName].getFeaturesByKeyWord(keyWord);
  82264. if (resultFeatures && resultFeatures.length > 0) {
  82265. /**
  82266. * @event L.supermap.components.searchViewModel#searchlayersucceeded
  82267. * @description 图层属性查询成功后触发。
  82268. * @property {Object} result - 图层数据。
  82269. */
  82270. this.fire("searchlayersucceeded", {
  82271. result: resultFeatures
  82272. });
  82273. } else {
  82274. /**
  82275. * @event L.supermap.components.searchViewModel#searchfailed
  82276. * @description 图层属性查询失败后触发。
  82277. * @property {string} searchType - 图层属性查询状态。
  82278. */
  82279. this.fire("searchfailed", {
  82280. searchType: "searchLayersField"
  82281. });
  82282. }
  82283. }
  82284. },
  82285. /**
  82286. * @function L.supermap.components.searchViewModel.prototype.searchFromCityLocalSearchService
  82287. * @description 城市地址匹配查询。
  82288. * @param {string} keyWords - 城市地址匹配查询关键字。
  82289. */
  82290. searchFromCityLocalSearchService(keyWords) {
  82291. //todo 是否保留缓存?请求过的数据保留一份缓存?
  82292. if (this.searchCache[keyWords]) {
  82293. /**
  82294. * @event L.supermap.components.searchViewModel#geocodesucceeded
  82295. * @description 城市地址匹配成功后触发。
  82296. * @property {Object} result - 城市匹配成功后返回的数据。
  82297. */
  82298. this.fire("geocodesucceeded", {
  82299. result: this.searchCache[keyWords]
  82300. });
  82301. } else {
  82302. this.geoCodeParam.keyWords = keyWords || this.geoCodeParam.city;
  82303. const self = this;
  82304. let url = this._getSearchUrl(this.geoCodeParam);
  82305. FetchRequest.get(url).then((response) => {
  82306. return response.json();
  82307. }).then((geocodingResult) => {
  82308. if (geocodingResult.error || geocodingResult.poiInfos.length === 0) {
  82309. self.fire("searchfailed", {
  82310. searchType: "searchGeocodeField"
  82311. });
  82312. return;
  82313. }
  82314. if (geocodingResult.poiInfos) {
  82315. const geoJsonResult = self._dataToGeoJson(geocodingResult.poiInfos, self.geoCodeParam);
  82316. self.fire("geocodesucceeded", {
  82317. result: geoJsonResult
  82318. });
  82319. }
  82320. })
  82321. }
  82322. },
  82323. /**
  82324. * @function L.supermap.components.searchViewModel.prototype.addSearchLayers
  82325. * @description 添加新的可查询图层。
  82326. * @param {Array.<L.GeoJSON>} layers - 新添加的图层对象。
  82327. */
  82328. addSearchLayers(layers) {
  82329. this.dataModel.addLayers(layers, (e) => {
  82330. /**
  82331. * @event L.supermap.components.searchViewModel#newlayeradded
  82332. * @description 添加查询图层事件。
  82333. * @property {Object} result - 事件返回的新的查询图层对象。
  82334. * @property {string} layerName - 事件返回的新的查询图层对象名。
  82335. */
  82336. this.fire("newlayeradded", {
  82337. layerName: e.layerName
  82338. });
  82339. }, null, this);
  82340. },
  82341. /**
  82342. * @function L.supermap.components.searchViewModel.prototype.panToLayer
  82343. * @description 缩放到指定图层。
  82344. * @param {string} layerName - 指定缩放的图层名。
  82345. */
  82346. panToLayer(layerName) {
  82347. if (this.dataModel.layers[layerName]) {
  82348. this.map.flyToBounds(this.dataModel.layers[layerName].layer.getBounds());
  82349. }
  82350. },
  82351. /**
  82352. * @function L.supermap.components.searchViewModel.prototype.panToCity
  82353. * @description 缩放到指定城市。
  82354. * @param {string} city - 指定缩放的城市名。
  82355. */
  82356. panToCity(city) {
  82357. this.geoCodeParam.keyWords = city;
  82358. this.geoCodeParam.city = city;
  82359. const self = this;
  82360. let url = this._getSearchUrl(this.geoCodeParam);
  82361. FetchRequest.get(url).then((response) => {
  82362. return response.json();
  82363. }).then((geocodingResult) => {
  82364. if (geocodingResult.poiInfos.length > 0) {
  82365. //缩放至城市
  82366. const center = external_L_default().latLng(geocodingResult.poiInfos[0].location.y, geocodingResult.poiInfos[0].location.x);
  82367. self.map.setView(center, 8);
  82368. } else {
  82369. self.fire("searchfailed", {
  82370. searchType: "cityGeocodeField"
  82371. });
  82372. }
  82373. })
  82374. },
  82375. /**
  82376. * @description 将地址匹配返回的数据转为 GeoJSON 格式数据。
  82377. * @param data
  82378. * @private
  82379. */
  82380. _dataToGeoJson(data, geoCodeParam) {
  82381. let features = [];
  82382. for (let i = 0; i < data.length; i++) {
  82383. let feature = {
  82384. type: "Feature",
  82385. geometry: {
  82386. type: "Point",
  82387. coordinates: [data[i].location.x, data[i].location.y]
  82388. },
  82389. properties: {
  82390. name: data[i].name || geoCodeParam.keyWords,
  82391. address: data[i].formatedAddress || data[i].address
  82392. }
  82393. };
  82394. features.push(feature);
  82395. }
  82396. return features;
  82397. },
  82398. /**
  82399. * @function L.supermap.components.searchViewModel.prototype._getSearchUrl
  82400. * @description 获取地理编码查询地址。
  82401. * @param {Object} geoCodeParam - 地理编码查询参数。
  82402. * @private
  82403. */
  82404. _getSearchUrl(geoCodeParam) {
  82405. let url = this.options.cityGeoCodingConfig.addressUrl + `.json?keywords=${geoCodeParam.keyWords}&city=${geoCodeParam.city}&pageSize=${geoCodeParam.pageSize}&pageNum=${geoCodeParam.pageNum}&key=${this.options.cityGeoCodingConfig.key}`;
  82406. return url;
  82407. }
  82408. });
  82409. var searchViewModel = function (options) {
  82410. return new SearchViewModel(options);
  82411. };
  82412. (external_L_default()).supermap.components.searchViewModel = searchViewModel;
  82413. ;// CONCATENATED MODULE: ./src/leaflet/components/search/SearchView.js
  82414. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  82415. * This program are made available under the terms of the Apache License, Version 2.0
  82416. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  82417. /**
  82418. * @class L.supermap.components.search
  82419. * @classdesc 图层查询组件。
  82420. * @category Components Search
  82421. * @version 9.1.1
  82422. * @param {Object} options - 可选参数。
  82423. * @param {Object|Array.<string>} [options.cityConfig] - 城市地址匹配配置,默认为全国城市,与 options.cityGeoCodingConfig 支持匹配的服务对应;
  82424. * 配置两种格式:{key1:{A:[],B:[]}, key2:{C:[],D:[]}} 或 ["成都市","北京市"],用户可根据自己的项目需求进行配置
  82425. * @param {Object} [options.cityGeoCodingConfig] - 城市地址匹配服务配置,包括:{addressUrl:"",key:""} 默认为 online 地址匹配服务,与 options.cityConfig 对应
  82426. * @param {boolean} [options.isGeoCoding=true] - 是否支持城市地址匹配功能。
  82427. * @param {number} [options.pageSize=10] - 地址匹配查询返回记录结果数,最大设置为 20。
  82428. * @param {number} [options.pageNum=1] - 地址匹配查询分页页码,默认 1 代表第一页。
  82429. * @param {number} [options.perPageDataNum=8] - 每页显示个数,最大值为 8。
  82430. * @param {string} [options.position='topright'] - 组件在地图中显示的位置,包括:'topleft','topright','bottomleft' 和 'bottomright',继承自 leaflet control。
  82431. * @param {function} [options.style] - 设置图层点线面默认样式,点样式返回 maker 或者 circleMaker;线和面返回 L.path 样式。
  82432. * @param {function} [options.onEachFeature] - 在创建和设置样式后,将为每个创建的要素调用一次的函数。用于将事件和弹出窗口附加到要素。默认情况下,对新创建的图层不执行任何操作。
  82433. * @extends {L.supermap.components.componentsViewBase}
  82434. * @fires L.supermap.components.search#searchlayersucceeded
  82435. * @fires L.supermap.components.search#searchfailed
  82436. * @fires L.supermap.components.search#geocodesucceeded
  82437. */
  82438. var SearchView = ComponentsViewBase.extend({
  82439. options: {
  82440. cityConfig: config,
  82441. cityGeoCodingConfig: {
  82442. addressUrl: "https://www.supermapol.com/iserver/services/localsearch/rest/searchdatas/China/poiinfos",
  82443. key: "fvV2osxwuZWlY0wJb8FEb2i5"
  82444. },
  82445. isGeoCoding: true,
  82446. pageSize: 10,
  82447. pageNum: 1,
  82448. perPageDataNum: 8
  82449. },
  82450. initialize(options) {
  82451. ComponentsViewBase.prototype.initialize.apply(this, [options]);
  82452. //当前选中查询的图层名:
  82453. this.currentSearchLayerName = "";
  82454. this.isSearchLayer = false;
  82455. this.perPageDataNum = this.options.perPageDataNum;
  82456. },
  82457. /*------以下是一些接口-----*/
  82458. /**
  82459. * @function L.supermap.components.search.prototype.onAdd
  82460. * @description 向底图添加组件。
  82461. * @private
  82462. * @override
  82463. */
  82464. onAdd: function (map) {
  82465. //初始化组件业务逻辑执行对象 viewModel
  82466. this.viewModel = new SearchViewModel(map, this.options);
  82467. return ComponentsViewBase.prototype.onAdd.apply(this, [map]);
  82468. },
  82469. /**
  82470. * @function L.supermap.components.search.prototype.addSearchLayer
  82471. * @description 添加可查询的图层。
  82472. * @param {Array.<L.GeoJSON>|L.GeoJSON} layers - 可查询的图层。
  82473. */
  82474. addSearchLayer(layers) {
  82475. //将可查询图层数据传入vm处理
  82476. this.viewModel.addSearchLayers(layers);
  82477. },
  82478. /*----------以下是创建 dom 元素的方法---------*/
  82479. /**
  82480. * @function L.supermap.components.search.prototype._initView
  82481. * @description 创建地址匹配或图层要素查询组件。
  82482. * @override
  82483. * @returns {HTMLElement}
  82484. * @private
  82485. */
  82486. _initView() {
  82487. // self 便于 this 对象的使用
  82488. const self = this;
  82489. const div = document.createElement("div");
  82490. div.setAttribute("class", "component-search-container");
  82491. //外框
  82492. const poiContainer = document.createElement("div");
  82493. poiContainer.setAttribute("class", "component-search");
  82494. //主体
  82495. //---------下拉框:
  82496. const poiSettings = document.createElement("div");
  82497. poiSettings.setAttribute("class", "component-search__settings");
  82498. //下拉框
  82499. const poiSearchName = document.createElement("div");
  82500. //由View 维护,进行交互操作
  82501. poiSearchName.setAttribute("class", "component-search__settings__name");
  82502. //poiSettings.innerHTML 通过下拉框选项改变
  82503. poiSettings.appendChild(poiSearchName);
  82504. //下拉标记
  82505. const triangleIcon = document.createElement("span");
  82506. triangleIcon.setAttribute("class", "supermapol-icons-solid-down-triangle");
  82507. poiSettings.appendChild(triangleIcon);
  82508. //城市地址匹配页面, 以及图层查询页面
  82509. //城市地址匹配页面:
  82510. let citySelect = null;
  82511. if (this.options.isGeoCoding) {
  82512. const cityTabsPageObj = new CityTabsPage({
  82513. config: this.options.cityConfig
  82514. });
  82515. citySelect = cityTabsPageObj.getElement();
  82516. //点选城市名,修改显示,并执行定位城市查询【城市列表列表点击事件】
  82517. cityTabsPageObj.content.onclick = (e) => {
  82518. if (e.target.nodeName === "SPAN" && e.target.innerText) {
  82519. this.viewModel.panToCity(e.target.innerHTML);
  82520. this.messageBox.closeView();
  82521. poiSearchName.removeChild(poiSearchName.firstChild);
  82522. poiSearchName.insertBefore(document.createTextNode(e.target.innerHTML), poiSearchName.firstChild);
  82523. this.isSearchLayer = false;
  82524. }
  82525. };
  82526. //支持城市地址匹配,则初始化显示配置的第一个城市名:
  82527. poiSearchName.appendChild(document.createTextNode(cityTabsPageObj.content.getElementsByTagName("span")[0].innerText));
  82528. }
  82529. //图层查询页面:写法是为了为了代码可读性
  82530. const layersSelect = function () {
  82531. const layersSelect = document.createElement("div");
  82532. layersSelect.setAttribute("class", "component-search__layers");
  82533. const layersContent = document.createElement("div");
  82534. layersContent.setAttribute("class", "component-search-layers-content");
  82535. layersSelect.appendChild(layersContent);
  82536. //header todo 两个选项的功能暂没用到,先关闭,后续用到再打开
  82537. const layersHeader = document.createElement("div");
  82538. layersHeader.setAttribute("class", "component-search__layers__header");
  82539. //加载搜索条件
  82540. const loadBtn = document.createElement("div");
  82541. loadBtn.setAttribute("class", "load-btn");
  82542. layersHeader.appendChild(loadBtn);
  82543. const loadIcon = document.createElement("span");
  82544. loadIcon.setAttribute("class", "supermapol-icons-poi-load");
  82545. loadBtn.appendChild(loadIcon);
  82546. const loadBtnText = document.createElement("span");
  82547. loadBtnText.appendChild(document.createTextNode(Lang.i18n("text_loadSearchCriteria")));
  82548. loadBtn.appendChild(loadBtnText);
  82549. //保存搜索条件
  82550. const saveBtn = document.createElement("div");
  82551. saveBtn.setAttribute("class", "save-btn");
  82552. layersHeader.appendChild(saveBtn);
  82553. const icon = document.createElement("span");
  82554. icon.setAttribute("class", "supermapol-icons-poi-save");
  82555. saveBtn.appendChild(icon);
  82556. const saveBtnText = document.createElement("span");
  82557. saveBtnText.appendChild(document.createTextNode(Lang.i18n("text_saveSearchCriteria")));
  82558. saveBtn.appendChild(saveBtnText);
  82559. //body
  82560. const layerSelectOptions = document.createElement("div");
  82561. layerSelectOptions.setAttribute("class", "component-search__layers__body");
  82562. //选中查询图层监听
  82563. //选择查询图层【图层列表点击事件】
  82564. layerSelectOptions.onclick = (e) => {
  82565. //先进行清除操作
  82566. self.clearSearchResult();
  82567. let selectLayerOption = null;
  82568. if (e.target.classList[0] === "component-search__layers__itme__singleselect") {
  82569. selectLayerOption = e.target;
  82570. } else if (e.target.classList[0] === "component-single-default-img" || e.target.classList[0] === "single-label") {
  82571. selectLayerOption = e.target.parentNode;
  82572. } else {
  82573. return;
  82574. }
  82575. if (document.getElementsByClassName("component-single-checked-img").length > 0) {
  82576. document.getElementsByClassName("component-single-checked-img")[0].setAttribute("class", "component-single-default-img");
  82577. }
  82578. selectLayerOption.firstChild.setAttribute("class", "component-single-checked-img");
  82579. self.currentSearchLayerName = selectLayerOption.lastChild.innerText;
  82580. self.isSearchLayer = true;
  82581. poiSearchName.removeChild(poiSearchName.firstChild);
  82582. poiSearchName.insertBefore(document.createTextNode(self.currentSearchLayerName), poiSearchName.firstChild);
  82583. self.viewModel.panToLayer(self.currentSearchLayerName);
  82584. self.messageBox.closeView();
  82585. };
  82586. layersContent.appendChild(layerSelectOptions);
  82587. //读取当前图层数据,并展现
  82588. //只有调用添加查询图层接口才能添加图层选项
  82589. return layersSelect;
  82590. }();
  82591. //配置开启 城市匹配功能则添加
  82592. let navTabs = [];
  82593. if (citySelect) {
  82594. navTabs.push({
  82595. title: Lang.i18n("title_searchCity"),
  82596. content: citySelect
  82597. })
  82598. }
  82599. navTabs.push({
  82600. title: Lang.i18n("title_searchLayer"),
  82601. content: layersSelect
  82602. });
  82603. const navTabsPageObject = new NavTabsPage({
  82604. tabs: navTabs
  82605. });
  82606. const navTabsPage = navTabsPageObject.getElement();
  82607. navTabsPageObject.closeView();
  82608. poiContainer.appendChild(navTabsPage);
  82609. poiSettings.onclick = () => {
  82610. if (navTabsPage.hidden) {
  82611. navTabsPageObject.showView();
  82612. } else {
  82613. navTabsPageObject.closeView();
  82614. }
  82615. };
  82616. poiContainer.appendChild(poiSettings);
  82617. //初始时,下拉框若没赋值显示信息,则再次赋值:
  82618. if (!poiSearchName.innerText) {
  82619. poiSearchName.appendChild(document.createTextNode(Lang.i18n("text_label_chooseSearchLayers")));
  82620. }
  82621. //---------下拉框 END
  82622. //---------搜索输入框:
  82623. const poiInputContainer = document.createElement("div");
  82624. poiInputContainer.setAttribute("class", "component-search__input");
  82625. const poiInput = document.createElement("input");
  82626. poiInput.type = "text";
  82627. poiInput.placeholder = Lang.i18n("text_label_searchTips");
  82628. poiInputContainer.appendChild(poiInput);
  82629. //由View 维护,进行交互操作
  82630. this.poiInput = poiInput;
  82631. //清除输入内容按钮:
  82632. const poiInputClose = document.createElement("span");
  82633. poiInputClose.setAttribute("class", "supermapol-icons-close");
  82634. poiInputClose.hidden = true;
  82635. poiInputContainer.appendChild(poiInputClose);
  82636. poiContainer.appendChild(poiInputContainer);
  82637. //---------搜索输入框 END
  82638. //--------搜索按钮:
  82639. const searchBtn = document.createElement("div");
  82640. searchBtn.setAttribute("class", "component-search-icon supermapol-icons-search");
  82641. //查询结果页面
  82642. const resultDomObj = new PaginationContainer();
  82643. this._resultDomObj = resultDomObj;
  82644. //查询要素或匹配要素【搜索按钮点击事件】
  82645. searchBtn.onclick = () => {
  82646. //若是遮挡结果显示,则关闭
  82647. resultDomObj.closeView();
  82648. this.clearSearchResult();
  82649. this.messageBox.closeView();
  82650. navTabsPageObject.closeView();
  82651. const keyWord = this.poiInput.value.trim();
  82652. if (keyWord === "") {
  82653. this.messageBox.showView(Lang.i18n('msg_searchKeywords'));
  82654. return;
  82655. }
  82656. if (this.isSearchLayer) {
  82657. this.viewModel.search(keyWord, this.currentSearchLayerName);
  82658. } else {
  82659. this.viewModel.search(keyWord);
  82660. }
  82661. };
  82662. //【输入框输入内容回车事件】
  82663. poiInput.onkeypress = (e) => {
  82664. //.which属性判断按下的是哪个键,回车键的键位序号为13
  82665. if (e.which == 13) {
  82666. //手动触发 searchBtn 得点击事件,执行查询操作
  82667. var evt = document.createEvent("HTMLEvents");
  82668. evt.initEvent("click", false, true);
  82669. searchBtn.dispatchEvent(evt);
  82670. }
  82671. };
  82672. poiContainer.appendChild(searchBtn);
  82673. //--------搜索按钮 END
  82674. const resultContainer = function createResultPage() {
  82675. const resultContainer = resultDomObj.getElement();
  82676. resultContainer.style.position = "absolute";
  82677. resultContainer.style.top = "44px";
  82678. resultContainer.style.right = "0";
  82679. //先关闭结果界面,当有数据时再打开
  82680. resultDomObj.closeView();
  82681. //【结果列表点击事件】,以支持联动map上对应要素:
  82682. resultDomObj.content.onclick = (e) => {
  82683. let selectFeatureOption = null;
  82684. if (e.target.parentNode.className === "component-search-result-info") {
  82685. selectFeatureOption = e.target.parentNode.parentNode;
  82686. } else if (e.target.parentNode.className === "component-search__resultitme") {
  82687. selectFeatureOption = e.target.parentNode;
  82688. } else if (e.target.className === "component-search__resultitme") {
  82689. selectFeatureOption = e.target;
  82690. } else {
  82691. return;
  82692. }
  82693. //修改
  82694. if (document.getElementsByClassName("component-search__resultitme-selected").length > 0) {
  82695. document.getElementsByClassName("component-search__resultitme-selected")[0].classList.remove("component-search__resultitme-selected");
  82696. }
  82697. selectFeatureOption.firstChild.classList.add("component-search__resultitme-selected");
  82698. let filter = selectFeatureOption.children[1].firstChild.innerText;
  82699. //联动地图上要素响应
  82700. self._linkageFeature(filter);
  82701. };
  82702. return resultContainer;
  82703. }();
  82704. poiContainer.appendChild(resultContainer);
  82705. //清除输入框内容【输入框删除按钮点击事件】
  82706. poiInputClose.onclick = (e) => {
  82707. this.clearSearchResult();
  82708. poiInput.value = "";
  82709. e.target.hidden = true;
  82710. resultDomObj.closeView();
  82711. };
  82712. //【输入框输入内容事件】
  82713. poiInput.oninput = () => {
  82714. poiInputClose.hidden = false;
  82715. };
  82716. //添加提示框
  82717. this.messageBox = new MessageBox();
  82718. //绑定 VM 的监听
  82719. this._addViewModelListener();
  82720. div.appendChild(poiContainer);
  82721. //阻止 map 默认事件
  82722. this._preventMapEvent(div, this.map);
  82723. return div;
  82724. },
  82725. /**
  82726. * @function L.supermap.components.search.prototype._createSearchLayerItem
  82727. * @description 创建查询图层选项。
  82728. * @private
  82729. */
  82730. _createSearchLayerItem(layerName) {
  82731. const layerOption = document.createElement("div");
  82732. layerOption.setAttribute("class", "component-search__layers__itme");
  82733. // 创建圆形单选框
  82734. const singleSelect = document.createElement("div");
  82735. singleSelect.setAttribute("class", "component-search__layers__itme__singleselect");
  82736. const singleIcon = document.createElement("div");
  82737. singleIcon.setAttribute("class", "component-single-default-img");
  82738. singleSelect.appendChild(singleIcon);
  82739. const singleLabel = document.createElement("span");
  82740. singleLabel.setAttribute("class", "single-label");
  82741. singleLabel.innerHTML = layerName;
  82742. singleSelect.appendChild(singleLabel);
  82743. layerOption.appendChild(singleSelect);
  82744. //attributes-select todo 暂不支持该功能
  82745. // const attributesSelect = (new ComponentSelect(layer.layer.attributeNames)).getElement();
  82746. //选择查询的字段 todo 限制图层查找属性功能待属性选择框优化后完善
  82747. /*attributesSelect.onchange = (e) => {
  82748. this.searchAttributes = e.target.value;
  82749. };*/
  82750. // layerOption.appendChild(attributesSelect);
  82751. document.getElementsByClassName("component-search__layers__body")[0].appendChild(layerOption);
  82752. },
  82753. /**
  82754. * @function L.supermap.components.search.prototype._createResultItem
  82755. * @description 创建查询结果列表。
  82756. * @private
  82757. */
  82758. _createResultItem(featureType, properties) {
  82759. const item = document.createElement("div");
  82760. item.setAttribute("class", "component-search__resultitme");
  82761. let icon = document.createElement("div");
  82762. if (featureType === "Point" || featureType === "MultiPoint") {
  82763. icon.setAttribute("class", "supermapol-icons-marker-layer component-search-result-icon");
  82764. } else if (featureType === "LineString" || featureType === "MultiLineString ") {
  82765. icon.setAttribute("class", "supermapol-icons-line-layer component-search-result-icon");
  82766. } else if (featureType === "Polygon" || featureType === "MultiPolygon") {
  82767. icon.setAttribute("class", "supermapol-icons-polygon-layer component-search-result-icon");
  82768. } else {
  82769. icon.setAttribute("class", "supermapol-icons-point-layer component-search-result-icon");
  82770. }
  82771. item.appendChild(icon);
  82772. const info = document.createElement("div");
  82773. info.setAttribute("class", "component-search-result-info");
  82774. const info1 = document.createElement("div");
  82775. info.appendChild(info1);
  82776. const info2 = document.createElement("div");
  82777. //分地址匹配和图层搜索的两种数据展现形式:
  82778. if (properties.name) {
  82779. info1.innerHTML = properties.name;
  82780. info2.innerHTML = properties.address;
  82781. info.appendChild(info2);
  82782. } else {
  82783. info1.innerHTML = properties.filterAttributeName + ": " + properties.filterAttributeValue;
  82784. }
  82785. item.appendChild(info);
  82786. //暂时删除复选框UI
  82787. const check = document.createElement("div");
  82788. check.setAttribute("class", "component-checkbox component-checkbox-default-img");
  82789. // item.appendChild(check);
  82790. return item;
  82791. },
  82792. /*----------对 VM 的一些事件监听 ----------*/
  82793. /**
  82794. * @function L.supermap.components.search.prototype._addViewModelListener
  82795. * @description 绑定对 VM 的事件监听。
  82796. * @private
  82797. */
  82798. _addViewModelListener() {
  82799. //----可查询图层变化监听
  82800. this.viewModel.on("searchlayerschanged", (layers) => {
  82801. for (let i = 0; i < layers.length; i++) {
  82802. this._createSearchLayerItem(layers[i]);
  82803. }
  82804. });
  82805. //----可查询图层变化监听
  82806. this.viewModel.on("newlayeradded", (e) => {
  82807. this._createSearchLayerItem(e.layerName);
  82808. });
  82809. //----图层查询结果监听
  82810. this.viewModel.on("searchlayersucceeded", (e) => {
  82811. const data = e.result;
  82812. this.clearSearchResult();
  82813. this.searchResultLayer = external_L_default().featureGroup(data, {
  82814. pointToLayer: this.options.style,
  82815. style: this.options.style
  82816. }).bindPopup(function (layer) {
  82817. if (layer.feature.properties) {
  82818. return (new AttributesPopContainer({
  82819. attributes: layer.feature.properties
  82820. })).getElement();
  82821. }
  82822. }).addTo(this.map);
  82823. this.searchResultLayer.eachLayer((layer) => {
  82824. this.options.onEachFeature ? this.options.onEachFeature(layer.toGeoJSON(), layer) :
  82825. this._featureOnclickEvent.bind(this)(layer.toGeoJSON(), layer);
  82826. });
  82827. this.searchLayersData = data;
  82828. //查询结果列表:
  82829. this._prepareResultData(data);
  82830. /**
  82831. * @event L.supermap.components.search#searchlayersucceeded
  82832. * @description 图层查询成功后触发。
  82833. * @property {Object} result - 事件返回的 GeoJSON 格式数据对象。
  82834. */
  82835. this._event.fire("searchlayersucceeded", {
  82836. result: this.searchResultLayer.toGeoJSON()
  82837. });
  82838. });
  82839. //----地址匹配服务监听
  82840. this.viewModel.on("geocodesucceeded", (e) => {
  82841. const data = e.result;
  82842. //先清空当前有的地址匹配图层
  82843. this.clearSearchResult();
  82844. this.searchResultLayer = external_L_default().geoJSON(data, {
  82845. pointToLayer: this.options.style,
  82846. style: this.options.style,
  82847. onEachFeature: this.options.onEachFeature || this._featureOnclickEvent.bind(this)
  82848. }).bindPopup(function (layer) {
  82849. if (layer.feature.properties) {
  82850. return (new AttributesPopContainer({
  82851. attributes: layer.feature.properties
  82852. })).getElement();
  82853. }
  82854. }).addTo(this.map);
  82855. this.searchLayersData = data
  82856. //查询结果列表:
  82857. this._prepareResultData(data);
  82858. /**
  82859. * @event L.supermap.components.search#geocodesucceeded
  82860. * @description 地址匹配服务成功后触发。
  82861. * @property {Object} result - 事件返回的 GeoJSON 格式数据对象。
  82862. */
  82863. this._event.fire("geocodesucceeded", {
  82864. result: data
  82865. });
  82866. });
  82867. //----地址匹配或图层查询失败监听
  82868. this.viewModel.on("searchfailed", (e) => {
  82869. let message = "";
  82870. if (e.searchType === "searchGeocodeField") {
  82871. message = Lang.i18n("msg_searchGeocodeField");
  82872. } else if (e.searchType === "cityGeocodeField") {
  82873. message = Lang.i18n("msg_cityGeocodeField");
  82874. } else {
  82875. message = Lang.i18n("msg_getFeatureField");
  82876. }
  82877. this.messageBox.showView(message)
  82878. /**
  82879. * @event L.supermap.components.search#searchfailed
  82880. * @description 图层属性查询失败后触发。
  82881. * @property {string} message - 失败原因。
  82882. */
  82883. this._event.fire("searchfailed", {
  82884. message: message
  82885. });
  82886. });
  82887. },
  82888. /*-------以下是一些辅助性功能函数 -------*/
  82889. /**
  82890. * @function L.supermap.components.search.prototype._prepareResultData
  82891. * @description 准备需要填入结果展示页面里的数据。
  82892. * @param {Array.<Feature>} data - 图层查询或地址匹配返回的要素数据数组。
  82893. * @private
  82894. */
  82895. _prepareResultData(data) {
  82896. this.currentResult = data;
  82897. //向下取舍,这只页码
  82898. let pageCounts = Math.ceil(data.length / this.perPageDataNum);
  82899. this._resultDomObj.setPageLink(pageCounts);
  82900. //初始结果页面内容:
  82901. this._createResultListByPageNum(1, data);
  82902. this._resultDomObj.showView();
  82903. //给页面模板设置联动事件
  82904. this._resultDomObj.setLinkageEvent(_linkageEvent);
  82905. const self = this;
  82906. function _linkageEvent(page) {
  82907. self._createResultListByPageNum(page, self.currentResult);
  82908. }
  82909. },
  82910. /**
  82911. * @function L.supermap.components.search.prototype._createResultListByPageNum
  82912. * @description 根据页面值填充内容。
  82913. * @param {number} page - 页数。
  82914. * @param {Array.<Feature>} data - 图层查询或地址匹配返回的要素数据数组。
  82915. * @private
  82916. */
  82917. _createResultListByPageNum(page, data) {
  82918. let start = 0,
  82919. end;
  82920. if (page === 1 && data.length < this.perPageDataNum) {
  82921. //data数据不满8个时:
  82922. end = data.length - 1;
  82923. } else if (page * this.perPageDataNum > data.length) {
  82924. //最后一页且数据不满8个时
  82925. start = this.perPageDataNum * (page - 1);
  82926. end = data.length - 1
  82927. } else {
  82928. //中间页面的情况
  82929. start = this.perPageDataNum * (page - 1);
  82930. end = page * this.perPageDataNum - 1
  82931. }
  82932. const content = document.createElement("div");
  82933. for (let i = start; i <= end; i++) {
  82934. let properties, featureType = "Point";
  82935. if (data[i].filterAttribute) {
  82936. featureType = data[i].feature.geometry.type;
  82937. properties = data[i].filterAttribute;
  82938. } else {
  82939. properties = data[i].properties;
  82940. }
  82941. content.appendChild(this._createResultItem(featureType, properties))
  82942. }
  82943. this._resultDomObj.setContent(content);
  82944. this._resultDomObj.showView();
  82945. //查询完成默认选中第一个结果:
  82946. content.firstChild.getElementsByClassName("component-search-result-icon")[0].classList.add("component-search__resultitme-selected");
  82947. const filter = content.firstChild.getElementsByClassName("component-search-result-info")[0].firstChild.innerText;
  82948. !this._selectMarkerFeature && this._linkageFeature(filter);
  82949. },
  82950. /**
  82951. * @function L.supermap.components.search.prototype._flyToBounds
  82952. * @param {L.Bounds} bounds - 当前图层范围。
  82953. * @description 移动到图层。
  82954. * @private
  82955. */
  82956. _flyToBounds(bounds) {
  82957. const sw = bounds.getSouthWest();
  82958. const ne = bounds.getNorthEast();
  82959. if (sw.lat === ne.lat && sw.lng === ne.lng) {
  82960. this.map.flyTo(sw);
  82961. } else {
  82962. // this.map.fitBounds(this.searchResultLayer.getBounds());
  82963. this.map.fitBounds(bounds);
  82964. }
  82965. },
  82966. /**
  82967. * @function L.supermap.components.search.prototype._linkageFeature
  82968. * @description 点击结果列表联动地图上要素响应。
  82969. * @private
  82970. */
  82971. _linkageFeature(filter) {
  82972. let filterValue = "";
  82973. if (this.isSearchLayer) {
  82974. filterValue = filter.split(":")[1].trim();
  82975. } else {
  82976. filterValue = filter;
  82977. }
  82978. this._selectFeature && this._selectFeature.addTo(this.map);
  82979. this.searchResultLayer.eachLayer((layer) => {
  82980. // this._resetLayerStyleToDefault(layer);
  82981. if (!filterValue || layer.filterAttribute && layer.filterAttribute.filterAttributeValue === filterValue ||
  82982. layer.feature.properties && layer.feature.properties.name === filterValue) {
  82983. layer.remove();
  82984. this._setSelectedLayerStyle(layer);
  82985. /*layer.bindPopup(function () {
  82986. return (new AttributesPopContainer(layer.feature.properties)).getElement()
  82987. }, {closeOnClick: false}).openPopup().addTo(this.map);*/
  82988. //若这个图层只有一个点的话,则直接 flyTo 到点:
  82989. }
  82990. });
  82991. },
  82992. /**
  82993. * @function L.supermap.components.search.prototype.clearSearchResult
  82994. * @description 清空当前查询的结果等。
  82995. */
  82996. clearSearchResult() {
  82997. if (this.searchResultLayer) {
  82998. this.map.closePopup();
  82999. //若当前是查询图层的结果,则不删除图层,只修改样式
  83000. !this.isSearchLayer && this.map.removeLayer(this.searchResultLayer);
  83001. this._selectMarkerFeature && this.map.removeLayer(this._selectMarkerFeature);
  83002. this._selectFeaturethis && this.map.removeLayer(this._selectFeature);
  83003. this._selectMarkerFeature = null;
  83004. this._selectFeature = null;
  83005. this.searchResultLayer = null;
  83006. this.currentResult = null;
  83007. }
  83008. },
  83009. /**
  83010. * @function L.supermap.components.search.prototype._featureOnclickEvent
  83011. * @description 要素点击事件
  83012. * @param {L.layer} layer - 需要设置选中样式的图层。
  83013. * @private
  83014. */
  83015. _featureOnclickEvent(feature, layer) {
  83016. layer.on('click', () => {
  83017. let pageEles1 = document.getElementsByClassName('component-pagination__link')[0];
  83018. this._resultDomObj._changePageEvent({
  83019. target: pageEles1.children[0].children[0]
  83020. });
  83021. this._selectFeature && this._selectFeature.addTo(this.map);
  83022. layer.remove();
  83023. let page, dataIndex;
  83024. for (let i = 0; i < this.searchLayersData.length; i++) {
  83025. let item = this.searchLayersData[i]
  83026. if ((item.properties && (item.properties.name === feature.properties.name)) || (item.filterAttribute && (item.filterAttribute.filterAttributeName + ": " + item.filterAttribute.filterAttributeValue) === (layer.filterAttribute.filterAttributeName + ": " + layer.filterAttribute.filterAttributeValue))) {
  83027. dataIndex = i % this.perPageDataNum;
  83028. page = parseInt(i / this.perPageDataNum) + 1;
  83029. break;
  83030. }
  83031. }
  83032. if (page > 1) {
  83033. for (let i = 1; i < page; i++) {
  83034. let pageEles;
  83035. pageEles = document.getElementsByClassName('component-pagination__link')[0];
  83036. this._resultDomObj._changePageEvent({
  83037. target: pageEles.children[pageEles.children.length - 2].children[0]
  83038. });
  83039. }
  83040. }
  83041. let pageList = document.getElementsByClassName('component-search-result-info')
  83042. let target = pageList[dataIndex].children[0];
  83043. if (target.innerHTML === feature.properties.name || target.innerHTML === (layer.filterAttribute.filterAttributeName + ": " + layer.filterAttribute.filterAttributeValue)) {
  83044. let selectFeatureOption = pageList[dataIndex].parentNode;
  83045. //修改
  83046. if (document.getElementsByClassName("component-search__resultitme-selected").length > 0) {
  83047. document.getElementsByClassName("component-search__resultitme-selected")[0].classList.remove("component-search__resultitme-selected");
  83048. }
  83049. selectFeatureOption.firstChild.classList.add("component-search__resultitme-selected");
  83050. this._setSelectedLayerStyle(layer);
  83051. }
  83052. }, this)
  83053. },
  83054. /**
  83055. * @function L.supermap.components.search.prototype._setSelectedLayerStyle
  83056. * @description 设置图层选中样式。
  83057. * @param {L.layer} layer - 需要设置选中样式的图层。
  83058. * @private
  83059. */
  83060. _setSelectedLayerStyle(layer) {
  83061. this._selectMarkerFeature && this._selectMarkerFeature.remove();
  83062. this._selectMarkerFeature = null;
  83063. this._selectFeature = layer;
  83064. //circleMarker 需要变成 marker 的样式:
  83065. this._selectMarkerFeature = external_L_default().geoJSON(layer.toGeoJSON(), {
  83066. //点选中样式, todo marker 显示位置需要调整
  83067. pointToLayer: (geoJsonPoint, latlng) => {
  83068. return external_L_default().marker(latlng, {
  83069. icon: external_L_default().divIcon({
  83070. className: 'component-select-marker-icon',
  83071. iconAnchor: [15, 0]
  83072. })
  83073. })
  83074. },
  83075. //线和面选中样式:
  83076. style: {
  83077. fillColor: 'red',
  83078. weight: 1,
  83079. opacity: 1,
  83080. color: 'red',
  83081. fillOpacity: 0.2
  83082. }
  83083. }).addTo(this.map);
  83084. this._selectMarkerFeature.bindPopup(function () {
  83085. return (new AttributesPopContainer({
  83086. attributes: layer.feature.properties
  83087. })).getElement()
  83088. }, {
  83089. closeOnClick: false
  83090. }).openPopup().addTo(this.map);
  83091. this._flyToBounds(this.searchResultLayer.getBounds());
  83092. let center;
  83093. if (layer.getLatLng) {
  83094. center = layer.getLatLng();
  83095. } else if (layer.getCenter) {
  83096. center = layer.getCenter();
  83097. }
  83098. this.map.setView(center);
  83099. }
  83100. });
  83101. var searchView = function (options) {
  83102. return new SearchView(options);
  83103. };
  83104. (external_L_default()).supermap.components.search = searchView;
  83105. ;// CONCATENATED MODULE: ./src/leaflet/components/dataflow/DataFlowViewModel.js
  83106. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  83107. * This program are made available under the terms of the Apache License, Version 2.0
  83108. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  83109. /**
  83110. * @class L.supermap.components.dataFlowViewModel
  83111. * @classdesc 数据流组件功能类。
  83112. * @version 9.1.1
  83113. * @category Components DataFlow
  83114. * @param {L.Map} map - 当前组件所在的地图。
  83115. * @param {Object} [dataFlowLayerOptions] - 数据流服务返回数据数据展示样式,默认采用 ViewModel 默认样式。
  83116. * @param {Object} options - 可选参数。
  83117. * @param {Function} [options.style] - 定义点、线、面要素样式。参数为{@link L.Path-option}。</br>
  83118. `function (feature) {
  83119. return {
  83120. fillColor: "red",
  83121. fillOpacity: 1,
  83122. radius: 6,
  83123. weight: 0
  83124. };
  83125. }`
  83126. * @param {Function} [options.onEachFeature] - 在创建和设置样式后,将为每个创建的要素调用一次的函数。 用于将事件和弹出窗口附加到要素。 默认情况下,对新创建的图层不执行任何操作。
  83127. * @fires L.supermap.components.dataFlowViewModel#dataflowservicesubscribed
  83128. * @fires L.supermap.components.dataFlowViewModel#subscribesucceeded
  83129. * @fires L.supermap.components.dataFlowViewModel#subscribefailed
  83130. * @fires L.supermap.components.dataFlowViewModel#dataupdated
  83131. * @extends {L.Evented}
  83132. */
  83133. var DataFlowViewModel = external_L_default().Evented.extend({
  83134. options: {
  83135. _defaultLayerOptions: {
  83136. //style 返回 marker样式或者 L.path 样式
  83137. style: null,
  83138. onEachFeature: function (feature, layer) {
  83139. let content = "属性信息如下:<br>";
  83140. for (let key in feature.properties) {
  83141. content += key + ": " + feature.properties[key] + "<br>"
  83142. }
  83143. layer.bindPopup(content);
  83144. }
  83145. }
  83146. },
  83147. initialize(map, dataFlowLayerOptions = null) {
  83148. if (map) {
  83149. /**
  83150. * @member {L.Map} L.supermap.components.dataFlowViewModel.prototype.map
  83151. * @description 当前组件所在的地图。
  83152. */
  83153. this.map = map;
  83154. } else {
  83155. return new Error(`Cannot find map, fileModel.map cannot be null.`);
  83156. }
  83157. //合并用户的 dataFlowLayerOptions
  83158. external_L_default().Util.extend(this.options._defaultLayerOptions, dataFlowLayerOptions);
  83159. //点样式也存储在style里
  83160. this.options._defaultLayerOptions.pointToLayer = this.options._defaultLayerOptions.style;
  83161. /**
  83162. * @member {boolean} [L.supermap.components.dataFlowViewModel.prototype.popupsStatus=true]
  83163. * @description 图层 popup 打开 "true" 或关闭 "false" 的状态。
  83164. */
  83165. this.popupsStatus = true;
  83166. /**
  83167. * @member {boolean} [L.supermap.components.dataFlowViewModel.prototype.dataFlowStatus=false]
  83168. * @description 数据流服务当前状态,订阅 "true" 或未订阅 "false" 的状态。
  83169. */
  83170. this.dataFlowStatus = false;
  83171. /**
  83172. * @member {string} [L.supermap.components.dataFlowViewModel.prototype.dataFlowUrl=""]
  83173. * @description 数据流地址。
  83174. */
  83175. this.dataFlowUrl = "";
  83176. /**
  83177. * @member {Array.<Object>} [L.supermap.components.dataFlowViewModel.prototype.currentFeatures]
  83178. * @description 当前订阅数据流返回的要素数组。
  83179. */
  83180. this.currentFeatures = [];
  83181. /**
  83182. * @member {L.supermap.dataFlowLayer} [L.supermap.components.dataFlowViewModel.prototype.dataFlowLayer=null]
  83183. * @description 当前 dataFlowLayer 图层对象。
  83184. */
  83185. this.dataFlowLayer = null;
  83186. },
  83187. /**
  83188. * @function L.supermap.components.dataFlowViewModel.prototype.subscribe
  83189. * @description 订阅数据流。
  83190. * @param {string} dataFlowUrl - 数据流服务地址。
  83191. */
  83192. subscribe(dataFlowUrl) {
  83193. //若当前数据流服务没变,则不进行重新订阅 todo 或者没点击暂停
  83194. if (this.dataFlowUrl === dataFlowUrl) {
  83195. if (this.dataFlowStatus) {
  83196. /**
  83197. * @event L.supermap.components.dataFlowViewModel#dataflowservicesubscribed
  83198. * @description 数据流订阅成功后触发。
  83199. */
  83200. this.fire("dataflowservicesubscribed");
  83201. return;
  83202. }
  83203. } else {
  83204. this.dataFlowUrl = dataFlowUrl
  83205. }
  83206. this.dataFlowStatus = true;
  83207. //移除已有图层
  83208. if (this.dataFlowLayer) {
  83209. this.dataFlowLayer.remove();
  83210. this.dataFlowLayer = null;
  83211. }
  83212. //创建DataFlowLayer,创建DataFlowLayer订阅iServer dataflow服务并将结果加载到地图上
  83213. const dataFlowLayer = new DataFlowLayer(dataFlowUrl, this.options._defaultLayerOptions);
  83214. dataFlowLayer.on('subscribesucceeded', (result) => {
  83215. /**
  83216. * @event L.supermap.components.dataFlowViewModel#subscribesucceeded
  83217. * @description 数据流订阅成功后触发。
  83218. * @property {Object} result - 返回的数据。
  83219. */
  83220. this.fire("subscribesucceeded", {result: result});
  83221. });
  83222. dataFlowLayer.on('subscribefailed', (result) => {
  83223. /**
  83224. * @event L.supermap.components.dataFlowViewModel#subscribefailed
  83225. * @description 数据流订阅失败后触发。
  83226. * @property {Object} result - 返回的数据。
  83227. */
  83228. this.fire("subscribefailed", {result: result});
  83229. });
  83230. dataFlowLayer.on('dataupdated', (result) => {
  83231. //派发出订阅返回的数据:
  83232. /**
  83233. * @event L.supermap.components.dataFlowViewModel#dataupdated
  83234. * @description 数据返回成功之后触发。
  83235. * @property {Object} result - 返回的数据。
  83236. */
  83237. this.fire("dataupdated", {result: result});
  83238. //若数据超出当前视图范围,则移动到数据所在视图范围:
  83239. let layerBounds = result.layer.getBounds(),
  83240. mapBounds = CommontypesConversion.toSuperMapBounds(this.map.getBounds()),
  83241. layerBoundsSuperMap = CommontypesConversion.toSuperMapBounds(layerBounds);
  83242. if (!mapBounds.intersectsBounds(layerBoundsSuperMap)) {
  83243. if (layerBoundsSuperMap.left === layerBoundsSuperMap.right && layerBoundsSuperMap.top === layerBoundsSuperMap.bottom) {
  83244. this.map.setView(layerBounds.getCenter())
  83245. } else {
  83246. this.map.flyToBounds(layerBounds);
  83247. }
  83248. }
  83249. if (this.popupsStatus) {
  83250. this.openPopups();
  83251. }
  83252. });
  83253. dataFlowLayer.addTo(this.map);
  83254. this.dataFlowLayer = dataFlowLayer;
  83255. },
  83256. /**
  83257. * @function L.supermap.components.dataFlowViewModel.prototype.cancelSubscribe
  83258. * @description 取消订阅的数据流。
  83259. */
  83260. cancelSubscribe() {
  83261. if (this.dataFlowLayer) {
  83262. this.dataFlowStatus = false;
  83263. this.dataFlowLayer.dataService.unSubscribe();
  83264. this.dataFlowLayer.remove();
  83265. this.dataFlowLayer = null;
  83266. }
  83267. },
  83268. /**
  83269. * @function L.supermap.components.dataFlowViewModel.prototype.openPopups
  83270. * @description 打开图层要素弹窗。
  83271. */
  83272. openPopups() {
  83273. this.popupsStatus = true;
  83274. if (this.dataFlowLayer) {
  83275. const layers = this.dataFlowLayer.getLayers();
  83276. for (let i = 0; i < layers.length; i++) {
  83277. for (let j = 0; j < layers[i].getLayers().length; j++) {
  83278. layers[i].getLayers()[j].openPopup();
  83279. }
  83280. }
  83281. }
  83282. },
  83283. /**
  83284. * @function L.supermap.components.dataFlowViewModel.prototype.closePopups
  83285. * @description 关闭图层要素弹窗。
  83286. */
  83287. closePopups() {
  83288. this.popupsStatus = false;
  83289. if (this.dataFlowLayer) {
  83290. const layers = this.dataFlowLayer.getLayers();
  83291. for (let i = 0; i < layers.length; i++) {
  83292. for (let j = 0; j < layers[i].getLayers().length; j++) {
  83293. layers[i].getLayers()[j].closePopup();
  83294. }
  83295. }
  83296. }
  83297. }
  83298. });
  83299. var dataFlowViewModel = function (options) {
  83300. return new DataFlowViewModel(options);
  83301. };
  83302. (external_L_default()).supermap.components.dataFlowViewModel = dataFlowViewModel;
  83303. ;// CONCATENATED MODULE: ./src/leaflet/components/dataflow/DataFlowView.js
  83304. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  83305. * This program are made available under the terms of the Apache License, Version 2.0
  83306. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  83307. /**
  83308. * @class L.supermap.components.dataFlow
  83309. * @classdesc 数据流组件。
  83310. * @version 9.1.1
  83311. * @category Components DataFlow
  83312. * @param {Object} options - 可选参数。
  83313. * @param {string} [options.position='topright'] - 组件在地图中显示的位置,包括:'topleft','topright','bottomleft' 和 'bottomright',继承自 leaflet control。
  83314. * @param {Function} [options.style] - 设置图层点线面默认样式,点样式返回 maker 或者 circleMaker;线和面返回 L.path 样式。<br>
  83315. `function (feature) {
  83316. return {
  83317. fillColor: "red",
  83318. fillOpacity: 1,
  83319. radius: 6,
  83320. weight: 0
  83321. };
  83322. }`
  83323. * @param {function} [options.onEachFeature] - 在创建和设置样式后,将为每个创建的要素调用一次的函数。用于将事件和弹出窗口附加到要素。默认情况下,对新创建的图层不执行任何操作。
  83324. * @fires L.supermap.components.dataFlow#dataupdated
  83325. * @extends {L.supermap.components.componentsViewBase}
  83326. */
  83327. var DataFlowView = ComponentsViewBase.extend({
  83328. initialize(options) {
  83329. ComponentsViewBase.prototype.initialize.apply(this, [options]);
  83330. },
  83331. /**
  83332. * @function L.supermap.components.dataFlow.prototype.onAdd
  83333. * @description 向底图添加组件
  83334. * @override
  83335. * @private
  83336. */
  83337. onAdd(map) {
  83338. //为了避免空对象为复写默认配置的现象,先判断参数是否为空
  83339. let options = {};
  83340. if (this.options.style) {
  83341. options.style = this.options.style;
  83342. }
  83343. if (this.options.onEachFeature) {
  83344. options.style = this.options.onEachFeature;
  83345. }
  83346. this.viewModel = new DataFlowViewModel(map, options);
  83347. return ComponentsViewBase.prototype.onAdd.apply(this, [map]);
  83348. },
  83349. /**
  83350. * @function L.supermap.components.dataFlow.prototype._initView
  83351. * @description 创建打开本地文件数据组件
  83352. * @returns {HTMLElement}
  83353. * @private
  83354. * @override
  83355. */
  83356. _initView() {
  83357. const containerObj = new CommonContainer({title: Lang.i18n("title_dataFlowService")});
  83358. const container = containerObj.getElement();
  83359. const componentContent = containerObj.getContentElement();
  83360. componentContent.style.padding = "10px 18px";
  83361. const dataFlowContainer1 = document.createElement("div");
  83362. dataFlowContainer1.setAttribute("class", "component-dataflow__container");
  83363. //输入框
  83364. const dataFlowInputContainer = document.createElement("div");
  83365. dataFlowInputContainer.setAttribute("class", "component-input-default");
  83366. const dataFlowInput = document.createElement("input");
  83367. dataFlowInput.setAttribute("class", "component-input-default");
  83368. dataFlowInput.type = "text";
  83369. dataFlowInput.placeholder = Lang.i18n('text_input_value_inputDataFlowUrl');
  83370. dataFlowInput.title = Lang.i18n('text_input_value_inputDataFlowUrl');
  83371. dataFlowInputContainer.appendChild(dataFlowInput);
  83372. //删除输入值按钮:
  83373. const inputClearBtn = document.createElement("span");
  83374. inputClearBtn.setAttribute("class", "supermapol-icons-close");
  83375. inputClearBtn.hidden = true;
  83376. //---清除输入值【清除按钮点击事件】
  83377. inputClearBtn.onclick = (e) => {
  83378. dataFlowInput.value = "";
  83379. e.target.hidden = true;
  83380. };
  83381. //---输入框值改变,打开清除按钮【输入框内容改变事件】
  83382. dataFlowInput.oninput = () => {
  83383. inputClearBtn.hidden = false;
  83384. };
  83385. dataFlowInputContainer.appendChild(inputClearBtn);
  83386. dataFlowContainer1.appendChild(dataFlowInputContainer);
  83387. componentContent.appendChild(dataFlowContainer1);
  83388. //复选框条件
  83389. const dataFlowContainer2 = document.createElement("div");
  83390. dataFlowContainer2.setAttribute("class", "component-dataflow__container");
  83391. const checkboxContainer = document.createElement("div");
  83392. checkboxContainer.setAttribute("class", "component-checkbox-container");
  83393. const attributesCheckbox = document.createElement("div");
  83394. attributesCheckbox.setAttribute("class", "component-checkbox-default component-checkbox-selected-img");
  83395. attributesCheckbox.checked = true;
  83396. checkboxContainer.appendChild(attributesCheckbox);
  83397. const checkboxLabel = document.createElement("div");
  83398. checkboxLabel.setAttribute("class", "component-label component-label-selected");
  83399. checkboxLabel.innerHTML = Lang.i18n('text_displayFeaturesInfo');
  83400. checkboxContainer.appendChild(checkboxLabel);
  83401. //----是否显示属性框【属性框复选框点击事件】
  83402. attributesCheckbox.onclick = (e) => {
  83403. e.target.checked = !e.target.checked;
  83404. if (e.target.checked) {
  83405. checkboxLabel.setAttribute("class", "component-label component-label-selected");
  83406. e.target.setAttribute("class", "component-checkbox-default component-checkbox-selected-img");
  83407. this.viewModel.openPopups();
  83408. } else {
  83409. checkboxLabel.setAttribute("class", "component-label");
  83410. e.target.setAttribute("class", "component-checkbox-default component-checkbox-default-img");
  83411. this.viewModel.closePopups();
  83412. }
  83413. };
  83414. dataFlowContainer2.appendChild(checkboxContainer);
  83415. componentContent.appendChild(dataFlowContainer2);
  83416. //订阅按钮,取消按钮:
  83417. const dataFlowContainer3 = document.createElement("div");
  83418. dataFlowContainer3.setAttribute("class", "component-dataflow__container component-init-center");
  83419. const subscribe = document.createElement("button");
  83420. subscribe.setAttribute("class", "component-button-default");
  83421. subscribe.innerHTML = Lang.i18n('text_subscribe');
  83422. //----订阅服务【订阅按钮点击事件】
  83423. subscribe.onclick = () => {
  83424. const urlDataFlow = dataFlowInput.value;
  83425. if (urlDataFlow === "") {
  83426. this.messageBox.showView(Lang.i18n('msg_inputDataFlowUrlFirst'));
  83427. return;
  83428. }
  83429. this.viewModel.subscribe(urlDataFlow);
  83430. };
  83431. dataFlowContainer3.appendChild(subscribe);
  83432. const cancelSubscribe = document.createElement("button");
  83433. cancelSubscribe.setAttribute("class", "component-button-default");
  83434. cancelSubscribe.innerHTML = Lang.i18n('text_cancelSubscribe');
  83435. //----取消订阅服务【取消订阅按钮点击事件】
  83436. cancelSubscribe.onclick = () => {
  83437. this.viewModel.cancelSubscribe();
  83438. };
  83439. dataFlowContainer3.appendChild(cancelSubscribe);
  83440. componentContent.appendChild(dataFlowContainer3);
  83441. //增加提示框:
  83442. this.messageBox = new MessageBox();
  83443. this.viewModel.on("dataflowservicesubscribed", () => {
  83444. this.messageBox.showView(Lang.i18n("msg_dataflowservicesubscribed"));
  83445. });
  83446. this.viewModel.on("subscribesucceeded", () => {
  83447. this.messageBox.showView(Lang.i18n("msg_subscribesucceeded"));
  83448. });
  83449. /**
  83450. * @event L.supermap.components.dataFlow#dataupdated
  83451. * @description 数据流服务成功返回数据后触发。
  83452. * @property {Object} result - 事件返回的数据对象。
  83453. */
  83454. this.viewModel.on("dataupdated", (result) => {
  83455. this.messageBox.closeView();
  83456. this._event.fire("dataupdated", result);
  83457. });
  83458. //关闭在控件上触发地图的事件响应:
  83459. //阻止 map 默认事件
  83460. this._preventMapEvent(container, this.map);
  83461. return container;
  83462. }
  83463. });
  83464. var dataFlowView = function (options) {
  83465. return new DataFlowView(options);
  83466. };
  83467. (external_L_default()).supermap.components.dataFlow = dataFlowView;
  83468. ;// CONCATENATED MODULE: ./src/leaflet/components/commonmodels/GeoJSONLayerWithName.js
  83469. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  83470. * This program are made available under the terms of the Apache License, Version 2.0
  83471. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  83472. /**
  83473. * @class L.supermap.components.geoJSONLayerWithName
  83474. * @classdesc 含有 layerName 与 GeoJSON 图层的对象。
  83475. * @private
  83476. * @param {Object} layerObject - 图层对象。
  83477. * @param {string} layerName - 图层名。
  83478. * @param {L.GeoJSON} layer - 图层。
  83479. * @category Components Common
  83480. */
  83481. class GeoJSONLayerWithName {
  83482. constructor(layerName, layer) {
  83483. this.layerName = layerName;
  83484. this.layer = layer;
  83485. }
  83486. }
  83487. var geoJSONLayerWithName = function (layerName, layer) {
  83488. return new GeoJSONLayerWithName(layerName, layer);
  83489. };
  83490. (external_L_default()).supermap.components.geoJSONLayerWithName = geoJSONLayerWithName;
  83491. ;// CONCATENATED MODULE: ./src/leaflet/components/clientcomputation/ClientComputationViewModel.js
  83492. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  83493. * This program are made available under the terms of the Apache License, Version 2.0
  83494. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  83495. /**
  83496. * @class L.supermap.components.clientComputationViewModel
  83497. * @classdesc 客户端计算组件功能类。
  83498. * @version 9.1.1
  83499. * @category Components ClientComputation
  83500. * @param {string} workerUrl - worker 地址,原始位置为 dist/leaflet/workers/TurfWorker.js。
  83501. * @fires L.supermap.components.clientComputationViewModel#analysisfailed
  83502. * @fires L.supermap.components.clientComputationViewModel#analysissucceeded
  83503. * @fires L.supermap.components.clientComputationViewModel#layerloaded
  83504. * @fires L.supermap.components.clientComputationViewModel#layersremoved
  83505. * @extends {L.Evented}
  83506. */
  83507. class ClientComputationViewModel extends (external_L_default()).Evented {
  83508. initialize(workerUrl) {
  83509. this.workerUrl = workerUrl;
  83510. this.turfLayers = [];
  83511. }
  83512. /**
  83513. * @function L.supermap.components.clientComputationViewModel.prototype.getLayersData
  83514. * @description 获取填充到 view 的数据。
  83515. * @param {Array.<L.GeoJSON>} layersArr - 图层数组。
  83516. * @returns {Object} layers 数据。
  83517. */
  83518. getLayersData(layersArr) {
  83519. let result = {};
  83520. let pointData = {}, lineData = {}, polygonData = {};
  83521. for (let i = 0; i < layersArr; i++) {
  83522. layersArr[i] = new GeoJSONLayerWithName(layersArr[i].layerName, layersArr[i].layer)
  83523. }
  83524. this.geoJsonLayersDataModel = new GeoJsonLayersDataModel(layersArr);
  83525. // 把 layersArr 转成 key = layername 对象,方便获取 fields 时遍历
  83526. let dataObj = [];
  83527. for (let i = 0; i < layersArr.length; i++) {
  83528. dataObj[layersArr[i].layerName] = {
  83529. fields: layersArr[i].fields,
  83530. layer: layersArr[i].layer.toGeoJSON()
  83531. }
  83532. }
  83533. for (let key in this.geoJsonLayersDataModel.layers) {
  83534. let fields;
  83535. if (dataObj[key].fields) {
  83536. fields = dataObj[key].fields;
  83537. } else {
  83538. fields = this.geoJsonLayersDataModel.layers[key].getAttributeNamesByType("Num");
  83539. }
  83540. let fieldsValue = [];
  83541. for (let i = 0; i < fields.length; i++) {
  83542. fieldsValue[fields[i]] = this.geoJsonLayersDataModel.layers[key].getAttributeValueByAttributeName(fields[i]);
  83543. // 去空 & 去重 & 转 number
  83544. let arr = fieldsValue[fields[i]];
  83545. for (var j = 0; j < arr.length; j++) {
  83546. if (arr[j] == "" || typeof (arr[j]) == "undefined") {
  83547. arr.splice(j, 1);
  83548. j = j - 1;
  83549. }
  83550. arr[j] = parseFloat(arr[j])
  83551. }
  83552. fieldsValue[fields[i]] = Array.from(new Set(arr.sort(function (a, b) {
  83553. return a - b;
  83554. })));
  83555. }
  83556. let obj = {
  83557. layerName: key,
  83558. fields: fields,
  83559. fieldsValue: fieldsValue,
  83560. features: dataObj[key].layer
  83561. }
  83562. let layersType = dataObj[key].layer.features[0].geometry.type;
  83563. if (layersType === "Point") {
  83564. pointData[key] = obj;
  83565. } else if (layersType === "LineString") {
  83566. lineData[key] = obj;
  83567. } else if (layersType === "Polygon") {
  83568. polygonData[key] = obj;
  83569. }
  83570. }
  83571. result['point'] = pointData;
  83572. result['lineString'] = lineData;
  83573. result['polygon'] = polygonData;
  83574. return result;
  83575. }
  83576. /**
  83577. * @function L.supermap.components.clientComputationViewModel.prototype.analysis
  83578. * @description 进行客户端计算。
  83579. * @param {Object} params - 客户端计算参数。
  83580. * @param {L.Map} map - Leaflet Map 对象。
  83581. */
  83582. analysis(params, map) {
  83583. this.geoJsonLayersDataModel.setCurrentLayerDataModel(params.analysisLayers);
  83584. this.worker = new Worker(this.workerUrl);
  83585. let resultData = this.geoJsonLayersDataModel.currentLayerDataModel.layer.toGeoJSON();
  83586. if (params.analysisMethod === "isolines") {
  83587. let fieldsValue = params.analysisFieldsValue.split(",");
  83588. let pointGrid = resultData;
  83589. for (let j = 0; j < fieldsValue.length; j++) {
  83590. fieldsValue[j] = parseFloat(fieldsValue[j])
  83591. }
  83592. let me = this;
  83593. let analysisParams = {
  83594. "pointGrid": pointGrid,
  83595. "analysisMethod": params.analysisMethod,
  83596. "breaks": fieldsValue,
  83597. "zProperty": params.analysisFields,
  83598. "analysisCellSize": params.analysisCellSize,
  83599. "options": {gridType: "point", property: params.analysisFields, weight: Number(params.analysisBreaks)}
  83600. };
  83601. this.worker.postMessage(analysisParams);
  83602. this.worker.onmessage = (e) => {
  83603. if (e.data.features.length === 0) {
  83604. /**
  83605. * @event L.supermap.components.clientComputationViewModel#analysisfailed
  83606. * @description 事件分析失败后触发,返回结果为空。
  83607. */
  83608. me.fire('analysisfailed');
  83609. } else {
  83610. /**
  83611. * @event L.supermap.components.clientComputationViewModel#analysissucceeded
  83612. * @description 事件分析成功后触发。
  83613. * @property {Object} data - 分析成功后的数据。
  83614. */
  83615. me.fire('analysissucceeded', {'data': e.data});
  83616. let turfLayer = external_L_default().geoJSON(e.data, {
  83617. style: {
  83618. color: '#1060C2', weight: 3
  83619. },
  83620. onEachFeature: function (feature, layer) {
  83621. if (feature.properties) {
  83622. layer.bindPopup((new AttributesPopContainer(feature.properties)).getElement())
  83623. }
  83624. layer.on({
  83625. 'mouseover': function () {
  83626. layer.setStyle({color: "#ffffff", weight: 5})
  83627. },
  83628. 'mouseout': function () {
  83629. layer.setStyle({color: '#1060C2', weight: 3})
  83630. },
  83631. "click": function () {
  83632. layer.setStyle({color: "#ffffff", weight: 5})
  83633. }
  83634. });
  83635. }
  83636. }).addTo(map);
  83637. me.turfLayers.push(turfLayer);
  83638. /**
  83639. * @event L.supermap.components.clientComputationViewModel#layerloaded
  83640. * @description 结果图层加载完成后触发。
  83641. * @property {L.GeoJSON} layer - 加载完成后的结果图层。
  83642. * @property {string} name - 加载完成后的结果图层名称。
  83643. */
  83644. me.fire('layerloaded', {"layer": turfLayer, "name": params.resultLayersName});
  83645. me.worker.terminate();
  83646. }
  83647. };
  83648. } else if (params.analysisMethod === "buffer") {
  83649. let me = this;
  83650. let analysisParams = {
  83651. "analysisMethod": "buffer",
  83652. "radius": params.radius,
  83653. "unit": params.unit,
  83654. "isSave": params.isSaveStatus,
  83655. "isUnion": params.isUnion,
  83656. 'geoJson': resultData
  83657. };
  83658. this.worker.postMessage(analysisParams);
  83659. this.worker.onmessage = (e) => {
  83660. let turfLayer = external_L_default().geoJSON(e.data, {
  83661. style: {
  83662. color: "#ffffff", fillColor: '#1060C2', fillOpacity: .5, weight: 1.5
  83663. },
  83664. onEachFeature: function (feature, layer) {
  83665. if (feature.properties) {
  83666. layer.bindPopup((new AttributesPopContainer(feature.properties)).getElement())
  83667. }
  83668. layer.on({
  83669. 'mouseover': function () {
  83670. layer.setStyle({
  83671. color: "#ffffff",
  83672. fillColor: "rgb(46,40,79)",
  83673. fillOpacity: .5,
  83674. weight: 5
  83675. })
  83676. },
  83677. 'mouseout': function () {
  83678. layer.setStyle({color: "#ffffff", fillColor: '#1060C2', fillOpacity: .5, weight: 1.5})
  83679. },
  83680. "click": function () {
  83681. layer.setStyle({
  83682. color: "#ffffff",
  83683. fillColor: "rgb(46,40,79)",
  83684. fillOpacity: .5,
  83685. weight: 2
  83686. })
  83687. }
  83688. });
  83689. }
  83690. }).addTo(map);
  83691. me.turfLayers.push(turfLayer);
  83692. me.fire('layerloaded', {"layer": turfLayer, "name": params.resultLayersName});
  83693. me.worker.terminate();
  83694. };
  83695. }
  83696. }
  83697. /**
  83698. * @function L.supermap.components.clientComputationViewModel.prototype.clearLayers
  83699. * @description 清空分析图层。
  83700. */
  83701. clearLayers() {
  83702. for (let i in this.turfLayers) {
  83703. this.turfLayers[i].clearLayers()
  83704. }
  83705. /**
  83706. * @event L.supermap.components.clientComputationViewModel#layersremoved
  83707. * @description 图层删除之后触发。
  83708. * @property {Array.<L.GeoJSON>} layer - 需要删除的图层数组。
  83709. */
  83710. this.fire('layersremoved', {layers: this.turfLayers});
  83711. }
  83712. /**
  83713. * @function L.supermap.components.clientComputationViewModel.prototype.cancelAnalysis
  83714. * @description 取消分析。
  83715. */
  83716. cancelAnalysis() {
  83717. this.worker.terminate();
  83718. }
  83719. }
  83720. var clientComputationViewModel = function (options) {
  83721. return new ClientComputationViewModel(options);
  83722. };
  83723. (external_L_default()).supermap.components.clientComputationViewModel = clientComputationViewModel;
  83724. ;// CONCATENATED MODULE: ./src/leaflet/components/clientcomputation/ClientComputationView.js
  83725. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  83726. * This program are made available under the terms of the Apache License, Version 2.0
  83727. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  83728. /**
  83729. * @class L.supermap.components.clientComputation
  83730. * @classdesc 客户端计算组件,用于进行叠加图层的客户端计算。
  83731. * @version 9.1.1
  83732. * @param {string} workerUrl - worker 地址,原始位置为 dist/leaflet/workers/TurfWorker.js。
  83733. * @param {Object} options - 可选参数。
  83734. * @param {string} [options.position='topright'] - 组件在地图中显示的位置,包括:'topleft','topright','bottomleft' 和 'bottomright',继承自 leaflet control。
  83735. * @param {function} [options.style] - 设置图层点线面默认样式,点样式返回 maker 或者 circleMaker;线和面返回 L.path 样式。
  83736. * @param {function} [options.onEachFeature] - 在创建和设置样式后,将为每个创建的要素调用一次的函数。用于将事件和弹出窗口附加到要素。默认情况下,对新创建的图层不执行任何操作。
  83737. * @fires L.supermap.components.clientComputation#analysissucceeded
  83738. * @fires L.supermap.components.clientComputation#analysisfailed
  83739. * @fires L.supermap.components.clientComputation#layersremoved
  83740. * @category Components ClientComputation
  83741. * @extends {L.supermap.components.componentsViewBase}
  83742. */
  83743. var ClientComputationView = ComponentsViewBase.extend({
  83744. initialize: function (workerUrl, options) {
  83745. if (!workerUrl) {
  83746. throw new Error('workerUrl is required');
  83747. }
  83748. this.workerUrl = workerUrl;
  83749. ComponentsViewBase.prototype.initialize.apply(this, [options]);
  83750. },
  83751. /**
  83752. * @function L.supermap.components.clientComputation.prototype.onAdd
  83753. * @description 添加控件。
  83754. * @private
  83755. * @override
  83756. */
  83757. onAdd: function (map) {
  83758. this.map = map;
  83759. return ComponentsViewBase.prototype.onAdd.apply(this, [map]);
  83760. },
  83761. /**
  83762. * @function L.supermap.components.clientComputation.prototype.addLayer
  83763. * @description 添加叠加图层。
  83764. */
  83765. addLayer: function (layer) {
  83766. this.layers = this.layers || [];
  83767. this.layers.push(layer);
  83768. let fillData = this.viewModel.getLayersData(this.layers);
  83769. this.fillDataToView(fillData);
  83770. },
  83771. /**
  83772. * @function L.supermap.components.clientComputation.prototype.fillDataToView
  83773. * @private
  83774. * @description 填充数据到 view。
  83775. * @param {Object} fillData - 待填充的数据。
  83776. */
  83777. fillDataToView: function (fillData) {
  83778. if (!fillData) {
  83779. return;
  83780. }
  83781. this.fillData = fillData;
  83782. let analysisMethod = document.getElementById('dropDownTop').getAttribute('data-value');
  83783. let currentFillData = {};
  83784. switch (analysisMethod) {
  83785. case 'isolines':
  83786. currentFillData = fillData['point'];
  83787. break;
  83788. case 'buffer':
  83789. currentFillData = fillData['point'];
  83790. break;
  83791. }
  83792. if (JSON.stringify(currentFillData) == '{}') {
  83793. return;
  83794. }
  83795. // 填充分析图层下拉框
  83796. let layserArr = [];
  83797. for (let layerName in currentFillData) {
  83798. layserArr.push(layerName);
  83799. }
  83800. let layersSelect = document.getElementById('layersSelect');
  83801. let layerSelectName = document.getElementById('layerSelectName');
  83802. // 清空 layersSelect;
  83803. layersSelect.innerHTML = '';
  83804. layerSelectName.title = layserArr[0];
  83805. layerSelectName.innerHTML = layserArr[0];
  83806. this._createOptions(layersSelect, layserArr);
  83807. // 设置 layer select option 点击事件
  83808. this.layerSelectObj.optionClickEvent(layersSelect, layerSelectName, this.layersSelectOnchange);
  83809. // 当前选中图层数据
  83810. let currentData = currentFillData[layerSelectName.title];
  83811. let fieldsArr = currentData.fields;
  83812. let textAreaData = currentData.fieldsValue;
  83813. // 设置当前数据
  83814. this.currentData = currentData;
  83815. this.currentFillData = currentFillData;
  83816. // 填充字段下拉框
  83817. let fieldsSelect = document.getElementById('fieldsSelect');
  83818. // 清空 fieldsSelect
  83819. fieldsSelect.innerHTML = '';
  83820. let fieldsSelectNameDiv = document.getElementById('fieldsSelectName');
  83821. fieldsSelectNameDiv.innerHTML = fieldsArr[0];
  83822. fieldsSelectNameDiv.title = fieldsArr[0];
  83823. this._createOptions(fieldsSelect, fieldsArr);
  83824. this.fieldsSelectObj.optionClickEvent(fieldsSelect, fieldsSelectNameDiv, this.fieldsSelectOnchange);
  83825. // 当前选中字段
  83826. let fieldsSelectName = fieldsSelectNameDiv.title;
  83827. // 通过当前选中字段 填充 TextArea 初始值
  83828. let getValueTextArea = document.getElementById('getValueTextArea');
  83829. getValueTextArea.value = textAreaData[fieldsSelectName].toString().replace(/,/g, ",\r\n");
  83830. getValueTextArea.setAttribute('data-value', textAreaData[fieldsSelectName]);
  83831. // 结果图层
  83832. let resultLayersName = document.getElementById('resultLayersName');
  83833. let analysisType = document.getElementById('dropDownTop').getAttribute('data-value');
  83834. switch (analysisType) {
  83835. case 'isolines':
  83836. resultLayersName.value = Lang.i18n('text_label_isolines') + layerSelectName.title;
  83837. break;
  83838. case 'buffer':
  83839. resultLayersName.value = Lang.i18n('text_label_buffer') + layerSelectName.title;
  83840. break;
  83841. }
  83842. },
  83843. /**
  83844. * @function L.supermap.components.clientComputation.prototype._initView
  83845. * @description 创建客户端计算组件。
  83846. * @returns {HTMLElement}
  83847. * @private
  83848. */
  83849. _initView: function () {
  83850. //初始化 ViewModel
  83851. this.workerUrl && (this.viewModel = new ClientComputationViewModel(this.workerUrl));
  83852. //初始化 view
  83853. // Container
  83854. let container = (new CommonContainer({ title: Lang.i18n('title_clientComputing') })).getElement();
  83855. container.classList.add('component-analysis');
  83856. container.children[0].style.fontSize = '12px';
  83857. let analysisOptionsArr = [{
  83858. 'title': Lang.i18n('text_isoline'),
  83859. 'dataValue': 'isolines',
  83860. 'remark': Lang.i18n('text_extractDiscreteValue'),
  83861. 'icon': {
  83862. 'className': 'component-analyst-isoline-img'
  83863. }
  83864. }, {
  83865. 'title': Lang.i18n('text_buffer'),
  83866. 'dataValue': 'buffer',
  83867. 'remark': Lang.i18n('text_specifyTheDistance'),
  83868. 'icon': {
  83869. 'className': 'component-analyst-buffer-img'
  83870. }
  83871. }];
  83872. let componentContentContainer = container.children[1];
  83873. componentContentContainer.classList.add('component-content--scroll');
  83874. componentContentContainer.classList.add('component-content--analysis');
  83875. // 下拉框
  83876. let dropDownBox = (new DropDownBox(analysisOptionsArr)).getElement();
  83877. componentContentContainer.appendChild(dropDownBox);
  83878. let dropDownTopContainer = dropDownBox.children[0].children[0];
  83879. let dropDownItems = dropDownBox.children[0].children[2].children[0];
  83880. dropDownTopContainer.children[0].id = 'dropDownTop';
  83881. // analysisContainer
  83882. let analysisTypeContainer = external_L_default().DomUtil.create('div', 'component-analysis__container', componentContentContainer);
  83883. // 分析图层
  83884. let analysisLayer = external_L_default().DomUtil.create('div', 'component-analysis__container__analysisLayer', analysisTypeContainer);
  83885. let layerSelectControl = external_L_default().DomUtil.create('div', 'component-analysis__selecttool', analysisLayer);
  83886. layerSelectControl.id = 'layerSelectControl';
  83887. let layerOptions = {
  83888. 'optionsArr': [''],
  83889. 'labelName': Lang.i18n('text_label_analysisLayer')
  83890. };
  83891. let layerSelectObj = new Select(layerOptions);
  83892. let layerSelectTool = layerSelectObj.getElement();
  83893. this.layerSelectObj = layerSelectObj;
  83894. layerSelectControl.appendChild(layerSelectTool);
  83895. // 图层选中div
  83896. let layerSelectName = layerSelectTool.children[1].children[0];
  83897. layerSelectName.id = 'layerSelectName';
  83898. // 图层下拉框select
  83899. let layersSelect = layerSelectTool.children[1].children[2].children[0].children[0];
  83900. layersSelect.id = 'layersSelect';
  83901. // ISOLINE
  83902. // 提取字段
  83903. let div = external_L_default().DomUtil.create('div', 'component-analysis__container__analysistype', analysisTypeContainer);
  83904. let isolineDiv = external_L_default().DomUtil.create('div', 'component-clientcomputation__isoline', div);
  83905. let fieldsOptions = {
  83906. 'optionsArr': [''],
  83907. 'labelName': Lang.i18n('text_label_extractField'),
  83908. 'optionsClickCb': this.fieldsSelectOnchange
  83909. };
  83910. let fieldsSelectControl = external_L_default().DomUtil.create('div', 'component-analysis__selecttool', isolineDiv);
  83911. let fieldsSelectObj = new Select(fieldsOptions);
  83912. let fieldsSelectTool = fieldsSelectObj.getElement();
  83913. this.fieldsSelectObj = fieldsSelectObj;
  83914. let fieldsSelectName = fieldsSelectTool.children[1].children[0];
  83915. fieldsSelectName.id = 'fieldsSelectName';
  83916. let fieldsSelect = fieldsSelectTool.children[1].children[2].children[0].children[0];
  83917. fieldsSelect.id = 'fieldsSelect';
  83918. fieldsSelectControl.appendChild(fieldsSelectTool);
  83919. // 提取值
  83920. let textareaContainer = external_L_default().DomUtil.create('div', 'component-analysis__container', isolineDiv);
  83921. let textareaSpan = external_L_default().DomUtil.create('span', 'component-textarea__name', textareaContainer);
  83922. textareaSpan.innerHTML = Lang.i18n('text_label_extractedValue');
  83923. let textareaControl = external_L_default().DomUtil.create('div', 'component-textarea', textareaContainer);
  83924. textareaControl.id = 'getValueText';
  83925. let scrollarea = external_L_default().DomUtil.create('div', '', textareaControl);
  83926. let scrollareaContent = external_L_default().DomUtil.create('div', 'component-scrollarea-content', scrollarea);
  83927. scrollareaContent.setAttribute('tabindex', '1');
  83928. let getValueTextArea = external_L_default().DomUtil.create('textarea', 'component-textarea__content', scrollareaContent);
  83929. getValueTextArea.id = 'getValueTextArea';
  83930. getValueTextArea.setAttribute('rows', '20');
  83931. // 距离衰减
  83932. let breaksDiv = external_L_default().DomUtil.create('div', '', isolineDiv);
  83933. let breaksSpan = external_L_default().DomUtil.create('span', '', breaksDiv);
  83934. breaksSpan.innerHTML = Lang.i18n('text_label_distanceAttenuation');
  83935. let breaks = external_L_default().DomUtil.create('input', '', breaksDiv);
  83936. breaks.value = '3';
  83937. // 栅格大小
  83938. let cellSizeDiv = external_L_default().DomUtil.create('div', '', isolineDiv);
  83939. let cellSizeSpan = external_L_default().DomUtil.create('span', '', cellSizeDiv);
  83940. cellSizeSpan.innerHTML = Lang.i18n('text_label_gridSize');
  83941. let cellSize = external_L_default().DomUtil.create('input', '', cellSizeDiv);
  83942. cellSize.value = '30';
  83943. // BUFFER
  83944. // 缓冲半径
  83945. let bufferDiv = external_L_default().DomUtil.create('div', 'component-clientcomputation__buffer hidden', div);
  83946. let bufferRadius = external_L_default().DomUtil.create('div', 'component-clientcomputation__buffer--radius', bufferDiv);
  83947. let bufferRadiusSpan = external_L_default().DomUtil.create('span', '', bufferRadius);
  83948. bufferRadiusSpan.innerHTML = Lang.i18n('text_label_bufferRadius');
  83949. let bufferRadiusDiv = external_L_default().DomUtil.create('div', '', bufferRadius);
  83950. let bufferRadiusInput = external_L_default().DomUtil.create('input', 'buffer-radius-input', bufferRadiusDiv);
  83951. bufferRadiusInput.id = 'bufferRadiusInput';
  83952. bufferRadiusInput.value = '10';
  83953. bufferRadiusInput.setAttribute('placeholder', Lang.i18n('text_label_defaultkilometers'));
  83954. let bufferUnit = external_L_default().DomUtil.create('div', 'component-clientcomputation__buffer--unit', bufferRadiusDiv);
  83955. bufferUnit.id = 'bufferUnit';
  83956. // 半径单位选择下拉框
  83957. let bufferUnitOptions = {
  83958. 'optionsArr': [Lang.i18n('text_option_kilometer')],
  83959. 'labelName': Lang.i18n('text_label_unit')
  83960. };
  83961. let bufferUnitSelectTool = (new Select(bufferUnitOptions)).getElement();
  83962. let bufferUnitSelectName = bufferUnitSelectTool.children[1].children[0];
  83963. bufferUnitSelectName.id = 'bufferUnitSelectName';
  83964. let bufferUnitSelect = bufferUnitSelectTool.children[1].children[2].children[0].children[0];
  83965. bufferUnitSelect.id = 'bufferUnitSelect';
  83966. bufferUnitSelectTool.children[0].style.display = 'none';
  83967. bufferUnit.appendChild(bufferUnitSelectTool);
  83968. // 保留原对象字段属性
  83969. let saveFieldDiv = external_L_default().DomUtil.create('div', '', bufferRadius);
  83970. let saveAttrsContainer = external_L_default().DomUtil.create('div', 'component-clientcomputation__buffer--issaveattrs', saveFieldDiv);
  83971. saveAttrsContainer.id = 'saveAttrsContainer';
  83972. let saveAttrsCheckbox = external_L_default().DomUtil.create('div', 'checkbox checkbox-fault', saveAttrsContainer);
  83973. saveAttrsCheckbox.id = 'saveAttrsCheckbox';
  83974. let saveAttrsLabel = external_L_default().DomUtil.create('div', 'lable', saveAttrsContainer);
  83975. saveAttrsLabel.id = 'saveAttrsLabel';
  83976. saveAttrsLabel.innerHTML = Lang.i18n('text_retainOriginal');
  83977. // 合并缓冲区
  83978. let isUnionContainer = external_L_default().DomUtil.create('div', 'component-clientcomputation__buffer--isunion', saveFieldDiv);
  83979. isUnionContainer.id = 'isUnionContainer';
  83980. let isUnionCheckbox = external_L_default().DomUtil.create('div', 'checkbox checkbox-fault', isUnionContainer);
  83981. isUnionCheckbox.id = 'isUnionCheckbox';
  83982. let isUnionLabel = external_L_default().DomUtil.create('div', 'lable', isUnionContainer);
  83983. isUnionLabel.innerHTML = Lang.i18n('text_mergeBuffer');
  83984. isUnionLabel.id = 'isUnionLabel';
  83985. // 结果图层
  83986. let resultLayerDiv = external_L_default().DomUtil.create('div', 'component-analysis__container__resultLayersName', analysisTypeContainer);
  83987. let resultLayerSpan = external_L_default().DomUtil.create('span', '', resultLayerDiv);
  83988. resultLayerSpan.innerHTML = Lang.i18n('text_label_resultLayerName');
  83989. let resultLayersName = external_L_default().DomUtil.create('input', '', resultLayerDiv);
  83990. resultLayersName.id = 'resultLayersName';
  83991. // 分析按钮
  83992. let runBtnContainer = external_L_default().DomUtil.create('div', 'component-analysis__container__analysisbtn', analysisTypeContainer);
  83993. let runBtn = external_L_default().DomUtil.create('div', 'component-analysis__analysisbtn', runBtnContainer);
  83994. let analysisBtn = external_L_default().DomUtil.create('button', 'component-analysis__analysisbtn--analysis', runBtn);
  83995. analysisBtn.innerHTML = Lang.i18n('btn_analyze');
  83996. let analysingContainer = external_L_default().DomUtil.create('div', 'component-analysis__analysisbtn--analysing-container hidden', runBtn);
  83997. let analysisingBtn = external_L_default().DomUtil.create('div', 'component-analysis__analysisbtn--analysising', analysingContainer);
  83998. let svgContainer = external_L_default().DomUtil.create('div', 'component-analysis__svg-container', analysisingBtn);
  83999. svgContainer.id = 'analyse_background';
  84000. svgContainer.innerHTML = `<svg class="component-analysis__svg-rotate" width="16px" height="16px" version="1.1" xmlns="http://www.w3.org/2000/svg">
  84001. <path id="ring" fill="#FFF" transform="translate(8,8)" d="M 0 0 v -8 A 8 8 0 1 1 -8.00 0 z"></path>
  84002. <circle cx="8" cy="8" r="6" fill="#38ADF5"></circle>
  84003. <rect class="svg-top" x="8" y="0" rx="2" ry="2" width="2" height="2" style="fill: rgb(255, 255, 255); stroke-width: 0;"></rect>
  84004. <rect class="svg-left" x="0" y="8" rx="2" ry="2" width="2" height="2" style="fill: rgb(255, 255, 255); stroke-width: 0;"></rect>
  84005. </svg>`;
  84006. external_L_default().DomUtil.create('span', '', analysisingBtn).innerHTML = Lang.i18n('btn_analyzing');
  84007. let analysisCancelBtn = external_L_default().DomUtil.create('button', 'component-analysis__analysisbtn--cancel', analysingContainer);
  84008. analysisCancelBtn.innerHTML = Lang.i18n('btn_cancelAnalysis');
  84009. let deleteLayersBtn = external_L_default().DomUtil.create('button', 'component-analysis__analysisbtn--analysis component-analysis__analysisbtn--deletelayers', runBtn);
  84010. deleteLayersBtn.innerHTML = Lang.i18n('btn_emptyTheAnalysisLayer');
  84011. for (let i = 0; i < dropDownItems.children.length; i++) {
  84012. // 点击何种分析类型 判断使用图层数据
  84013. dropDownItems.children[i].onclick = () => {
  84014. dropDownTopContainer.innerHTML = dropDownItems.children[i].outerHTML;
  84015. dropDownTopContainer.children[0].id = 'dropDownTop';
  84016. let layersSelect = document.getElementById('layersSelect');
  84017. let layerSelectName = document.getElementById('layerSelectName');
  84018. let analysisMethod = dropDownItems.children[i].getAttribute('data-value');
  84019. let currentFillData = {};
  84020. switch (analysisMethod) {
  84021. case 'buffer':
  84022. isolineDiv.classList.add('hidden');
  84023. bufferDiv.classList.remove('hidden');
  84024. componentContentContainer.style.height = '422px';
  84025. resultLayersName.value = Lang.i18n('text_label_buffer') + layerSelectName.title;
  84026. currentFillData = this.fillData['point'];
  84027. break;
  84028. case 'isolines':
  84029. isolineDiv.classList.remove('hidden');
  84030. bufferDiv.classList.add('hidden');
  84031. componentContentContainer.style.height = '712px';
  84032. resultLayersName.value = Lang.i18n('text_label_isolines') + layerSelectName.title;
  84033. currentFillData = this.fillData['point'];
  84034. break;
  84035. }
  84036. // 清空 layersSelect;
  84037. // 清空 layersSelect;
  84038. if (this.currentFillData === currentFillData) {
  84039. return;
  84040. }
  84041. layersSelect.innerHTML = '';
  84042. if (JSON.stringify(currentFillData) == '{}') {
  84043. resultLayersName.value = '';
  84044. layerSelectName.title = '';
  84045. layerSelectName.innerHTML = '';
  84046. return;
  84047. }
  84048. let layserArr = [];
  84049. for (let layerName in currentFillData) {
  84050. layserArr.push(layerName);
  84051. }
  84052. layerSelectName.title = layserArr[0];
  84053. layerSelectName.innerHTML = layserArr[0];
  84054. this._createOptions(layersSelect, layserArr);
  84055. // 设置 layer select option 点击事件
  84056. this.layerSelectObj.optionClickEvent(layersSelect, layerSelectName, this.layersSelectOnchange);
  84057. if (analysisMethod === 'buffer') {
  84058. resultLayersName.value = Lang.i18n('text_label_buffer') + layserArr[0];
  84059. } else if (analysisMethod === 'isolines') {
  84060. resultLayersName.value = Lang.i18n('text_label_isolines') + layserArr[0];
  84061. }
  84062. // 当前选中图层数据
  84063. this.currentData = currentFillData[layerSelectName.title];
  84064. this.currentFillData = currentFillData;
  84065. }
  84066. }
  84067. // 字段下拉框 onchange 事件
  84068. this.fieldsSelectOnchange = fieldsSelectOnchange.bind(this);
  84069. function fieldsSelectOnchange(option) {
  84070. if (this.currentData) {
  84071. let displayData = this.currentData;
  84072. let fieldsSelectName = option.title;
  84073. getValueTextArea.value = displayData.fieldsValue[fieldsSelectName].toString().replace(/,/g, ",\r\n");
  84074. getValueTextArea.setAttribute('data-value', displayData.fieldsValue[fieldsSelectName]);
  84075. }
  84076. }
  84077. // 选中图层实时改变事件
  84078. this.layersSelectOnchange = layersSelectOnchange.bind(this);
  84079. function layersSelectOnchange(option) {
  84080. if (this.currentData) {
  84081. let layerSelectName = option.title;
  84082. let displayData = this.currentFillData[layerSelectName];
  84083. this.currentData = displayData;
  84084. fieldsSelect.innerHTML = '';
  84085. this._createOptions(fieldsSelect, displayData.fields);
  84086. let fieldsSelectNameDiv = document.getElementById('fieldsSelectName');
  84087. let field = displayData.fields[0];
  84088. fieldsSelectNameDiv.title = field;
  84089. fieldsSelectNameDiv.innerHTML = field;
  84090. let fieldsSelectName = field;
  84091. this.fieldsSelectObj.optionClickEvent(fieldsSelect, fieldsSelectNameDiv, this.fieldsSelectOnchange);
  84092. getValueTextArea.value = displayData.fieldsValue[fieldsSelectName].toString().replace(/,/g, ",\r\n");
  84093. getValueTextArea.setAttribute('data-value', displayData.fieldsValue[fieldsSelectName]);
  84094. let analysisMethod = document.getElementById('dropDownTop').getAttribute('data-value');
  84095. switch (analysisMethod) {
  84096. case 'buffer':
  84097. resultLayersName.value = Lang.i18n('text_label_buffer') + layerSelectName;
  84098. break;
  84099. case 'isolines':
  84100. resultLayersName.value = Lang.i18n('text_label_isolines') + layerSelectName;
  84101. break;
  84102. }
  84103. }
  84104. }
  84105. //复选框事件
  84106. let isSaveStatus = true;
  84107. //合并缓冲区
  84108. //合并缓冲区,默认不选中,即为false
  84109. let isUnion = false;
  84110. //选中select
  84111. saveAttrsLabel.classList.add("selected");
  84112. saveAttrsCheckbox.classList.add("checkbox-active");
  84113. saveAttrsContainer.onclick = () => {
  84114. if (isSaveStatus) {
  84115. //将当前状态和样式->不选中的样式和状态
  84116. saveAttrsCheckbox.classList.add("checkbox-fault");
  84117. saveAttrsCheckbox.classList.remove("checkbox-active");
  84118. saveAttrsLabel.classList.remove("selected");
  84119. isSaveStatus = false;
  84120. } else {
  84121. //将当前样式和状态改为选中
  84122. saveAttrsCheckbox.classList.add("checkbox-active");
  84123. saveAttrsCheckbox.classList.remove("checkbox-fault");
  84124. saveAttrsLabel.classList.add("selected");
  84125. isSaveStatus = true;
  84126. //如果当前状态为选中的状态,则将上一个复选框的样式和状态由选中-不选中
  84127. if (isUnion) {
  84128. //移除dom样式和复选框的状态改变
  84129. isUnionCheckbox.classList.add("checkbox-fault");
  84130. isUnionCheckbox.classList.remove("checkbox-active");
  84131. isUnion = false;
  84132. }
  84133. }
  84134. }
  84135. isUnionContainer.onclick = () => {
  84136. if (isUnion) {
  84137. //将选中状态 由选中->不选中,修改其样式和状态
  84138. isUnionCheckbox.classList.add("checkbox-fault");
  84139. isUnionCheckbox.classList.remove("checkbox-active");
  84140. isUnionLabel.classList.remove("selected");
  84141. isUnion = false;
  84142. } else {
  84143. //将状态由不选中->选中,修改其样式和状态
  84144. isUnionCheckbox.classList.add("checkbox-active");
  84145. isUnionCheckbox.classList.remove("checkbox-fault");
  84146. isUnionLabel.classList.add("selected");
  84147. isUnion = true;
  84148. //如果当前状态为选中的,将上一个复选框改为不选中的状态
  84149. if (isSaveStatus) {
  84150. //修改当前样式和状态
  84151. saveAttrsCheckbox.classList.add("checkbox-fault");
  84152. saveAttrsCheckbox.classList.remove("checkbox-active");
  84153. isSaveStatus = false;
  84154. }
  84155. }
  84156. }
  84157. // 提示框
  84158. this.messageBox = new MessageBox();
  84159. // 分析按钮点击事件
  84160. analysisBtn.onclick = () => {
  84161. analysingContainer.style.display = 'block';
  84162. analysisBtn.style.display = 'none';
  84163. let dropDownTop = document.getElementById('dropDownTop');
  84164. let analysisMethod = dropDownTop.getAttribute('data-value');
  84165. let params;
  84166. switch (analysisMethod) {
  84167. case 'isolines':
  84168. params = getIsolinesAnalysisParams();
  84169. break;
  84170. case 'buffer':
  84171. params = getBufferAnalysisParams();
  84172. break;
  84173. }
  84174. this.viewModel.analysis(params, this.map);
  84175. this.viewModel.on('layerloaded', (e)=> {
  84176. analysingContainer.style.display = 'none';
  84177. analysisBtn.style.display = 'block';
  84178. /**
  84179. * @event L.supermap.components.clientComputation#analysissucceeded
  84180. * @description 分析完成之后触发。
  84181. * @property {L.GeoJSON} layer - 加载完成后的结果图层。
  84182. * @property {string} name - 加载完成后的结果图层名称。
  84183. */
  84184. this._event.fire('analysissucceeded', { "layer": e.layer, "name": e.name })
  84185. });
  84186. // 若分析的结果为空
  84187. this.viewModel.on('analysisfailed', ()=> {
  84188. analysingContainer.style.display = 'none';
  84189. analysisBtn.style.display = 'block';
  84190. this.messageBox.showView(Lang.i18n('msg_resultIsEmpty'), "failure");
  84191. /**
  84192. * @event L.supermap.components.clientComputation#analysisfailed
  84193. * @description 分析失败之后触发。
  84194. */
  84195. this._event.fire('analysisfailed')
  84196. })
  84197. }
  84198. // 取消按钮点击事件
  84199. analysisCancelBtn.onclick = () => {
  84200. analysingContainer.style.display = 'none';
  84201. analysisBtn.style.display = 'block';
  84202. this.viewModel.cancelAnalysis()
  84203. }
  84204. // 删除按钮点击事件
  84205. deleteLayersBtn.onclick = () => {
  84206. /**
  84207. * @event L.supermap.components.clientComputation#layersremoved
  84208. * @description 结果图层删除后触发。
  84209. * @property {Array.<L.GeoJSON>} layers - 被删除的结果图层。
  84210. */
  84211. this.viewModel.on('layersremoved', (e) => {
  84212. this._event.fire('layersremoved', { 'layers': e.layers });
  84213. })
  84214. this.viewModel.clearLayers();
  84215. }
  84216. // 获取分析数据
  84217. function getIsolinesAnalysisParams() {
  84218. let dropDownTop = document.getElementById('dropDownTop');
  84219. let analysisMethod = dropDownTop.getAttribute('data-value');
  84220. let resultLayersName = document.getElementById('resultLayersName').value;
  84221. let analysisLayers = layerSelectName.title;
  84222. let analysisFields = fieldsSelectName.title;
  84223. let analysisFieldsValue = getValueTextArea.value.replace(/[\r\n]/g, "").split(',').toString();
  84224. let analysisBreaks = breaks.value;
  84225. let analysisCellSize = cellSize.value;
  84226. let param = {
  84227. 'analysisMethod': analysisMethod,
  84228. 'analysisLayers': analysisLayers,
  84229. 'analysisFields': analysisFields,
  84230. 'analysisFieldsValue': analysisFieldsValue,
  84231. 'analysisBreaks': analysisBreaks,
  84232. 'analysisCellSize': analysisCellSize,
  84233. 'resultLayersName': resultLayersName
  84234. }
  84235. return param;
  84236. }
  84237. function getBufferAnalysisParams() {
  84238. let dropDownTop = document.getElementById('dropDownTop');
  84239. let resultLayersName = document.getElementById('resultLayersName').value;
  84240. let analysisLayers = layerSelectName.title;
  84241. let analysisMethod = dropDownTop.getAttribute('data-value');
  84242. let radius = bufferRadiusInput.value;
  84243. let unit = bufferUnitSelectName.title;
  84244. let param = {
  84245. 'analysisMethod': analysisMethod,
  84246. 'analysisLayers': analysisLayers,
  84247. 'radius': radius,
  84248. 'unit': unit,
  84249. 'resultLayersName': resultLayersName,
  84250. 'isSaveStatus': isSaveStatus,
  84251. 'isUnion': isUnion
  84252. };
  84253. return param;
  84254. }
  84255. // 阻止 map 默认事件
  84256. this._preventMapEvent(container, this.map);
  84257. return container;
  84258. },
  84259. /**
  84260. * @function L.supermap.components.clientComputation.prototype._createOptions
  84261. * @description 创建 select 下拉框的 options。
  84262. * @private
  84263. */
  84264. _createOptions(container, optionsArr) {
  84265. for (let i in optionsArr) {
  84266. let option = document.createElement('div');
  84267. let optData = optionsArr[i];
  84268. option.className = 'component-selecttool__option';
  84269. option.title = optData;
  84270. option.innerHTML = optData;
  84271. option.setAttribute('data-value', optData);
  84272. container.appendChild(option);
  84273. }
  84274. }
  84275. });
  84276. var clientComputationView = function (options) {
  84277. return new ClientComputationView(options);
  84278. };
  84279. (external_L_default()).supermap.components.clientComputation = clientComputationView;
  84280. ;// CONCATENATED MODULE: ./src/leaflet/components/clientcomputation/ClientComputationLayer.js
  84281. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  84282. * This program are made available under the terms of the Apache License, Version 2.0
  84283. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  84284. /**
  84285. * @class L.supermap.components.clientComputationLayer
  84286. * @classdesc 客户端计算图层对象。
  84287. * @version 9.1.1
  84288. * @param {Object} layerObject - 图层对象。
  84289. * @param {string} layerObject.layerName - 图层名。
  84290. * @param {L.GeoJSON} layerObject.layer - 图层。
  84291. * @param {Array.<string>} [layerObject.fields] - 字段数组。
  84292. * @category Components ClientComputation
  84293. */
  84294. class ClientComputationLayer{
  84295. constructor(layerObject){
  84296. this.layerName = layerObject.layerName;
  84297. this.layer = layerObject.layer;
  84298. this.fields = layerObject.fields || null;
  84299. }
  84300. }
  84301. var clientComputationLayer = function(layerObject){
  84302. return new ClientComputationLayer(layerObject)
  84303. }
  84304. ;(external_L_default()).supermap.components.clientComputationLayer = clientComputationLayer;
  84305. ;// CONCATENATED MODULE: ./src/leaflet/components/distributedanalysis/DistributedAnalysisModel.js
  84306. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  84307. * This program are made available under the terms of the Apache License, Version 2.0
  84308. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  84309. /**
  84310. * @class L.supermap.components.DistributedAnalysisModel
  84311. * @classdesc 分布式分析组件数据模型。
  84312. * @private
  84313. * @category Components DistributedAnalysis
  84314. * @param {string} processingUrl - 分布式分析地址。
  84315. * @fires L.supermap.components.DistributedAnalysisModel#datasetsloaded
  84316. * @fires L.supermap.components.DistributedAnalysisModel#datasetinfoloaded
  84317. * @extends {L.Evented}
  84318. */
  84319. class DistributedAnalysisModel extends (external_L_default()).Evented {
  84320. initialize(processingUrl) {
  84321. this.processingUrl = processingUrl
  84322. }
  84323. /**
  84324. * @function L.supermap.components.DistributedAnalysisModel.prototype.getDatasetsName
  84325. * @description 获取所有可进行分布式分析的数据集。
  84326. * @param {string} url - 分布式分析服务地址。
  84327. */
  84328. getDatasetsName() {
  84329. let url = this.processingUrl;
  84330. this.dataset = [];
  84331. this.dataset['datasetNames'] = [];
  84332. this.dataset['childUrl'] = [];
  84333. let host = 'http://' + url.split('/')[2];
  84334. let sharefileUrl = host + '/iserver/services/datacatalog/rest/datacatalog/sharefile.json';
  84335. let datasetsUrl = host + '/iserver/services/datacatalog/rest/datacatalog/relationship/datasets.json';
  84336. let me = this;
  84337. FetchRequest.get(sharefileUrl).then(function (response) {
  84338. return response.json();
  84339. }).then(function (result) {
  84340. me.dataset['datasetNames'] = me.dataset['datasetNames'].concat(result.datasetNames);
  84341. me.dataset['childUrl'] = me.dataset['childUrl'].concat(result.childUriList);
  84342. let _me = me;
  84343. FetchRequest.get(datasetsUrl).then(function (response) {
  84344. return response.json();
  84345. }).then(function (result) {
  84346. _me.dataset['datasetNames'] = _me.dataset['datasetNames'].concat(result.datasetNames);
  84347. _me.dataset['childUrl'] = _me.dataset['childUrl'].concat(result.childUriList);
  84348. let datasetHash = [];
  84349. for (let i in _me.dataset['datasetNames']) {
  84350. datasetHash[_me.dataset.datasetNames[i]] = _me.dataset.childUrl[i]
  84351. }
  84352. /**
  84353. * @event L.supermap.components.DistributedAnalysisModel#datasetsloaded
  84354. * @description 数据集获取完成之后触发。
  84355. * @property {Object} result - 数据集数据。
  84356. * @property {Array.<string>} result.dataset - 数据集名称数组。
  84357. * @property {Object} result.datasetHash - 数据集名称数组与数据集 URL 一一对应的对象。
  84358. */
  84359. _me.fire('datasetsloaded', { 'result': { 'dataset': _me.dataset, 'datasetHash': datasetHash } });
  84360. });
  84361. });
  84362. }
  84363. /**
  84364. * @function L.supermap.components.DistributedAnalysisModel.prototype.getDatasetInfo
  84365. * @description 获得数据集类型与 fields。
  84366. * @param {string} datasetUrl - 数据集资源地址。
  84367. */
  84368. getDatasetInfo(datasetUrl) {
  84369. let type;
  84370. let me = this;
  84371. FetchRequest.get(datasetUrl).then(function (response) {
  84372. return response.json();
  84373. }).then(function (data) {
  84374. let datasetInfo = data.datasetInfo
  84375. if (datasetInfo.datasetType === 'LINE' || datasetInfo.type === 'LINE') {
  84376. type = 'LINE';
  84377. } else if (datasetInfo.datasetType === 'POINT' || datasetInfo.type === 'POINT' || datasetInfo.type === 'CSV') {
  84378. type = 'POINT';
  84379. } else if (datasetInfo.datasetType === 'REGION' || datasetInfo.type === 'REGION') {
  84380. type = 'REGION';
  84381. }
  84382. let fields = [];
  84383. let fieldInfos = datasetInfo.fieldInfos || datasetInfo.fieldInfo || null;
  84384. if (fieldInfos) {
  84385. for (let i in fieldInfos) {
  84386. fields.push(fieldInfos[i].name)
  84387. }
  84388. /**
  84389. * @event L.supermap.components.DistributedAnalysisModel#datasetinfoloaded
  84390. * @description 数据集查询完成之后触发。
  84391. * @property {Object} result - 数据集数据。
  84392. * @property {string} result.type - 数据集类型。
  84393. * @property {Array.<string>} result.fields - 数据集字段。
  84394. */
  84395. me.fire('datasetinfoloaded', { 'result': { 'type': type, 'fields': fields } })
  84396. } else {
  84397. let fieldsUrl = data.childUriList[0].replace('//fields', '/fields');
  84398. FetchRequest.get(fieldsUrl).then(function (response) {
  84399. return response.json();
  84400. }).then(function (data) {
  84401. let fieldNames = data.fieldNames;
  84402. let fields = [];
  84403. for (let i in fieldNames) {
  84404. fields.push(fieldNames[i])
  84405. }
  84406. me.fire('datasetinfoloaded', { 'result': { 'type': type, 'fields': fields } })
  84407. })
  84408. }
  84409. })
  84410. }
  84411. }
  84412. (external_L_default()).supermap.components.DistributedAnalysisModel = DistributedAnalysisModel;
  84413. ;// CONCATENATED MODULE: ./src/leaflet/components/distributedanalysis/DistributedAnalysisViewModel.js
  84414. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  84415. * This program are made available under the terms of the Apache License, Version 2.0
  84416. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  84417. /**
  84418. * @class L.supermap.components.distributedAnalysisViewModel
  84419. * @classdesc 分布式分析组件功能类。
  84420. * @version 9.1.1
  84421. * @category Components DistributedAnalysis
  84422. * @param {string} processingUrl - 分布式分析地址。
  84423. * @fires L.supermap.components.distributedAnalysisViewModel#datasetsloaded
  84424. * @fires L.supermap.components.distributedAnalysisViewModel#datasetinfoloaded
  84425. * @fires L.supermap.components.distributedAnalysisViewModel#analysisfailed
  84426. * @fires L.supermap.components.distributedAnalysisViewModel#analysissucceeded
  84427. * @fires L.supermap.components.distributedAnalysisViewModel#layerloaded
  84428. * @fires L.supermap.components.distributedAnalysisViewModel#layersremoved
  84429. * @extends {L.Evented}
  84430. */
  84431. class DistributedAnalysisViewModel extends (external_L_default()).Evented {
  84432. initialize(processingUrl) {
  84433. this.processingUrl = processingUrl
  84434. }
  84435. /**
  84436. * @function L.supermap.components.distributedAnalysisViewModel.prototype.getDatasetsName
  84437. * @description 获取所有数据集名称。
  84438. * @param {string} url - 分布式分析服务地址。
  84439. */
  84440. getDatasetsName() {
  84441. let processingUrl = this.processingUrl;
  84442. this.resultLayers = [];
  84443. this.datasetNames = [];
  84444. this.distributedAnalysisModel = new DistributedAnalysisModel(processingUrl);
  84445. this.distributedAnalysisModel.getDatasetsName();
  84446. let me = this;
  84447. this.distributedAnalysisModel.on('datasetsloaded', function (e) {
  84448. /**
  84449. * @event L.supermap.components.distributedAnalysisViewModel#datasetsloaded
  84450. * @description 数据集获取完成之后触发。
  84451. * @property {Object} result - 数据集数据。
  84452. */
  84453. me.fire('datasetsloaded', { 'result': e.result });
  84454. })
  84455. }
  84456. /**
  84457. * @function L.supermap.components.distributedAnalysisViewModel.prototype.getDatasetInfo
  84458. * @description 获得数据集类型与 fields。
  84459. * @param {string} datasetUrl - 数据集资源地址。
  84460. */
  84461. getDatasetInfo(datasetUrl) {
  84462. // 判断数据集类型
  84463. this.distributedAnalysisModel.getDatasetInfo(datasetUrl);
  84464. let me = this;
  84465. this.distributedAnalysisModel.on('datasetinfoloaded', function (e) {
  84466. let type = e.result.type;
  84467. let fields = e.result.fields;
  84468. /**
  84469. * @event L.supermap.components.distributedAnalysisViewModel#datasetinfoloaded
  84470. * @description 数据集类型与字段获取完成之后触发。
  84471. * @property {Object} result - 数据集数据。
  84472. * @property {string} result.type - 数据集类型。
  84473. * @property {Array.<string>} result.fields - 数据集所含有的字段。
  84474. */
  84475. me.fire('datasetinfoloaded', { 'result': { 'type': type, 'fields': fields } })
  84476. })
  84477. }
  84478. /**
  84479. * @function L.supermap.components.distributedAnalysisViewModel.prototype.analysis
  84480. * @description 进行分布式分析。
  84481. * @param {Object.<SuperMap.KernelDensityJobParameter|string>} params - 参数。
  84482. * @param {SuperMap.KernelDensityJobParameter} params.analysisParam - 分布式分析参数。
  84483. * @param {string} [params.resultLayerName] - 结果图层名称。
  84484. * @param {L.Map} map - leaflet Map 对象。
  84485. */
  84486. analysis(params, map) {
  84487. let processingService = new ProcessingService(this.processingUrl);
  84488. if (params.analysisParam instanceof KernelDensityJobParameter) {
  84489. let kernelDensityJobParameter = params.analysisParam
  84490. let me = this;
  84491. processingService.addKernelDensityJob(kernelDensityJobParameter, function (serviceResult) {
  84492. if (serviceResult.error) {
  84493. /**
  84494. * @event L.supermap.components.distributedAnalysisViewModel#analysisfailed
  84495. * @description 分析失败后触发。
  84496. */
  84497. me.fire('analysisfailed', { 'error': serviceResult.error });
  84498. return;
  84499. }
  84500. serviceResult.result.setting.serviceInfo.targetServiceInfos.map(function (info) {
  84501. if (info.serviceType === 'RESTMAP') {
  84502. FetchRequest.get(info.serviceAddress + '/maps').then(function (response) {
  84503. return response.json();
  84504. }).then(function (result) {
  84505. let mapUrl = result[0].path;
  84506. /**
  84507. * @event L.supermap.components.distributedAnalysisViewModel#analysissucceeded
  84508. * @description 分析成功后服务器返回的数据。
  84509. */
  84510. me.fire('analysissucceed', { 'result': result });
  84511. let layer = external_L_default().supermap.tiledMapLayer(mapUrl, { noWrap: true, transparent: true });
  84512. me.resultLayers.push(layer);
  84513. layer.addTo(map);
  84514. /**
  84515. * @event L.supermap.components.distributedAnalysisViewModel#layerloaded
  84516. * @description 分析结果图层加载完成后触发。
  84517. * @property {L.GeoJSON} layer - 结果图层。
  84518. * @property {string} name - 结果图层名称。
  84519. */
  84520. let date = new Date();
  84521. let resultLayerName = params.resultLayerName || date.getTime();
  84522. me.fire('layerloaded', { 'layer': layer, 'name': resultLayerName })
  84523. });
  84524. }
  84525. return info;
  84526. });
  84527. })
  84528. }
  84529. }
  84530. /**
  84531. * @function L.supermap.components.distributedAnalysisViewModel.prototype.clearLayers
  84532. * @description 清空分析图层。
  84533. */
  84534. clearLayers() {
  84535. for (let i in this.resultLayers) {
  84536. this.resultLayers[i].remove();
  84537. }
  84538. /**
  84539. * @event L.supermap.components.distributedAnalysisViewModel#layersremoved
  84540. * @description 图层删除后触发。
  84541. * @property {Array.<L.GeoJSON>} layers - 结果图层数组。
  84542. */
  84543. this.fire('layersremoved', { 'layers': this.resultLayers });
  84544. this.resultLayers = [];
  84545. }
  84546. }
  84547. var distributedAnalysisViewModel = function (options) {
  84548. return new DistributedAnalysisViewModel(options);
  84549. };
  84550. (external_L_default()).supermap.components.distributedAnalysisViewModel = distributedAnalysisViewModel;
  84551. ;// CONCATENATED MODULE: ./src/leaflet/components/distributedanalysis/DistributedAnalysisView.js
  84552. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  84553. * This program are made available under the terms of the Apache License, Version 2.0
  84554. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  84555. /**
  84556. * @class L.supermap.components.distributedAnalysis
  84557. * @classdesc 分布式分析组件。
  84558. * @version 9.1.1
  84559. * @param {string} processingUrl - 分布式分析服务地址。
  84560. * @param {Object} options - 可选参数。
  84561. * @param {string} [options.position='topright'] - 组件在地图中显示的位置,包括:'topleft','topright','bottomleft' 和 'bottomright',继承自 leaflet control。
  84562. * @param {function} [options.style] - 设置图层点线面默认样式,点样式返回 maker 或者 circleMaker;线和面返回 L.path 样式。
  84563. * @param {function} [options.onEachFeature] - 在创建和设置样式后,将为每个创建的要素调用一次的函数。用于将事件和弹出窗口附加到要素。默认情况下,对新创建的图层不执行任何操作。
  84564. * @fires L.supermap.components.distributedAnalysis#analysissucceeded
  84565. * @fires L.supermap.components.distributedAnalysis#analysisfailed
  84566. * @fires L.supermap.components.distributedAnalysis#layersremoved
  84567. * @extends {L.supermap.components.componentsViewBase}
  84568. * @category Components DistributedAnalysis
  84569. */
  84570. var DistributedAnalysisView = ComponentsViewBase.extend({
  84571. initialize: function (processingUrl, options) {
  84572. ComponentsViewBase.prototype.initialize.apply(this, [options]);
  84573. //初始化 ViewModel:
  84574. this.viewModel = new DistributedAnalysisViewModel(processingUrl);
  84575. },
  84576. /**
  84577. * @function L.supermap.components.distributedAnalysis.prototype.onAdd
  84578. * @description 添加控件。
  84579. * @private
  84580. * @override
  84581. */
  84582. onAdd: function (map) {
  84583. this._fillDataToView();
  84584. return ComponentsViewBase.prototype.onAdd.apply(this, [map]);
  84585. },
  84586. /**
  84587. * @function L.supermap.components.distributedAnalysis.prototype._fillDataToView
  84588. * @description 填充数据到 view。
  84589. * @private
  84590. */
  84591. _fillDataToView: function () {
  84592. // 获取数据集
  84593. this.viewModel.on('datasetsloaded', (e) => {
  84594. let datasetOptionsArr = e.result.dataset.datasetNames;
  84595. this.datasetSelect.innerHTML = '';
  84596. this._createOptions(this.datasetSelect, datasetOptionsArr);
  84597. this.datasetSelectObj.optionClickEvent(this.datasetSelect, this.datasetSelectName, this.datasetSelectOnchange);
  84598. this.dataHash = e.result.datasetHash;
  84599. });
  84600. this.viewModel.getDatasetsName();
  84601. },
  84602. /**
  84603. * @function L.supermap.components.distributedAnalysis.prototype._initView
  84604. * @description 创建分布式分析组件。
  84605. * @returns {HTMLElement}
  84606. * @private
  84607. * @override
  84608. */
  84609. _initView: function () {
  84610. // 组件 container
  84611. let container = (new CommonContainer({title: Lang.i18n('title_distributedAnalysis')})).getElement();
  84612. container.classList.add('component-analysis');
  84613. container.children[0].style.fontSize = '12px';
  84614. // 组件内容 container
  84615. let componentContentContainer = external_L_default().DomUtil.create('div', 'component-content component-content--scroll component-content--analysis', container);
  84616. // 分析方式下拉框
  84617. let analysisOptionsArr = [{
  84618. 'title': Lang.i18n('text_densityAnalysis'),
  84619. 'dataValue': 'density',
  84620. 'remark': Lang.i18n('text_CalculateTheValuePerUnitArea'),
  84621. 'icon': {
  84622. 'className': 'component-analyst-density-img'
  84623. }
  84624. }];
  84625. let dropDownBox = (new DropDownBox(analysisOptionsArr)).getElement();
  84626. componentContentContainer.appendChild(dropDownBox);
  84627. // 选中的 dropDownItem
  84628. let dropDownTop = dropDownBox.children[0].children[0].children[0];
  84629. // 各分析参数 container
  84630. let analysisTypeContainer = external_L_default().DomUtil.create('div', 'component-analysis__container', componentContentContainer);
  84631. let analysisType = external_L_default().DomUtil.create('div', 'analysistype', analysisTypeContainer);
  84632. let analysisLayer = external_L_default().DomUtil.create('div', 'component-analysis__container__analysisLayer', analysisType);
  84633. // 数据集下拉框
  84634. let datasetSelectControl = external_L_default().DomUtil.create('div', 'component-analysis__selecttool', analysisLayer);
  84635. let datasetOptions = {
  84636. 'optionsArr': [Lang.i18n('text_option_selectDataset')],
  84637. 'labelName': Lang.i18n('text_label_dataset'),
  84638. "optionsClickCb": datasetSelectOnchange.bind(this)
  84639. };
  84640. let datasetSelectObj = new Select(datasetOptions);
  84641. let datasetSelectTool = datasetSelectObj.getElement();
  84642. this.datasetSelectObj = datasetSelectObj;
  84643. datasetSelectControl.appendChild(datasetSelectTool);
  84644. // 选中的 dataset
  84645. let datasetSelectName = datasetSelectTool.children[1].children[0];
  84646. this.datasetSelectName = datasetSelectName;
  84647. // dataset select container
  84648. let datasetSelect = datasetSelectTool.children[1].children[2].children[0].children[0];
  84649. datasetSelect.children[0].style.display = 'none';
  84650. this.datasetSelect = datasetSelect;
  84651. // 分析方法下拉框 & 网格面类型下拉框
  84652. let analyseIDW = external_L_default().DomUtil.create('div', 'component-analysis__idw', analysisLayer);
  84653. let analysisOptions = [{
  84654. 'optionsArr': [Lang.i18n('text_option_simplePointDensityAnalysis'), Lang.i18n('text_option_nuclearDensityAnalysis')],
  84655. 'labelName': Lang.i18n('text_label_analyticalMethod')
  84656. // 'optionsClickCb': analysisMethodSelectOnchange.bind(this)
  84657. }, {
  84658. 'optionsArr': [Lang.i18n('text_option_quadrilateral'), Lang.i18n('text_option_hexagon')],
  84659. 'labelName': Lang.i18n('text_label_meshType')
  84660. }];
  84661. // 分析参数 select control
  84662. let analysisSelectControl = external_L_default().DomUtil.create('div', 'component-analysis__idw__selecttool', analyseIDW);
  84663. for (let i in analysisOptions) {
  84664. let selectTool = (new Select(analysisOptions[i])).getElement();
  84665. analysisSelectControl.appendChild(selectTool);
  84666. }
  84667. // 权重选择下拉框
  84668. let weightFieldsSelectOptions = {
  84669. 'optionsArr': [Lang.i18n('text_option_notSet')],
  84670. 'labelName': Lang.i18n('text_label_weightField')
  84671. };
  84672. let weightFieldsSelectObj = new Select(weightFieldsSelectOptions);
  84673. let weightFieldsSelectTool = weightFieldsSelectObj.getElement();
  84674. analysisSelectControl.appendChild(weightFieldsSelectTool);
  84675. this.weightFieldsSelectObj = weightFieldsSelectObj;
  84676. // 分析方法选中值 & option attr设置
  84677. let analysisMethodSelectName = analysisSelectControl.children[0].children[1].children[0];
  84678. analysisMethodSelectName.setAttribute('data-value', '0');
  84679. let analysisMethodSelect = analysisSelectControl.children[0].children[1].children[2].children[0].children[0];
  84680. let analysisMethodDV = ['0', '1'];
  84681. this._setEleAtribute(analysisMethodDV, 'data-value', analysisMethodSelect.children);
  84682. // 网格面类型选中值 & option attr设置
  84683. let gridTypeSelectName = analysisSelectControl.children[1].children[1].children[0];
  84684. gridTypeSelectName.setAttribute('data-value', '0');
  84685. let gridTypeSelect = analysisSelectControl.children[1].children[1].children[2].children[0].children[0];
  84686. let gridTypeDV = ['0', '1'];
  84687. this._setEleAtribute(gridTypeDV, 'data-value', gridTypeSelect.children);
  84688. // 权重值选中值
  84689. let weightFieldsSelectName = analysisSelectControl.children[2].children[1].children[0];
  84690. let weightFieldsSelect = analysisSelectControl.children[2].children[1].children[2].children[0].children[0];
  84691. // 分析范围 & 网格大小 & 搜索半径 & 面积单位
  84692. // 分析范围
  84693. let inputOptions = [{
  84694. 'spanName': Lang.i18n('text_label_queryRange'),
  84695. 'value': ''
  84696. }];
  84697. for (let i in inputOptions) {
  84698. this._creatInputBox(inputOptions[i], analysisSelectControl)
  84699. }
  84700. let queryRangeInput = analysisSelectControl.children[3].children[1];
  84701. queryRangeInput.setAttribute('placeholder', Lang.i18n('text_label_queryRangeTips'));
  84702. queryRangeInput.title = Lang.i18n('text_label_queryRangeTips');
  84703. // 网格大小
  84704. let gridSizeUnitSelectOptions = {
  84705. 'optionsArr': ['Meter', 'Kilometer', 'Yard', 'Foot', 'Mile']
  84706. };
  84707. let gridSizeOptions = {
  84708. 'labelName': Lang.i18n('text_label_gridSizeInMeters'),
  84709. 'selectOptions': gridSizeUnitSelectOptions
  84710. };
  84711. let gridSizeContainer = this._creatUnitSelectBox(gridSizeOptions, analysisSelectControl);
  84712. let gridSizeInput = gridSizeContainer.children[1].children[0];
  84713. gridSizeInput.value = '1000';
  84714. let gridSizeUnitSelectName = gridSizeContainer.children[1].children[1].children[0].children[0].children[0];
  84715. // 搜索半径
  84716. let searchRadiusUnitSelectOptions = {
  84717. 'optionsArr': ['Meter', 'Kilometer', 'Yard', 'Foot', 'Mile']
  84718. };
  84719. let searchRadiusOptions = {
  84720. 'labelName': Lang.i18n('text_label_searchRadius'),
  84721. 'selectOptions': searchRadiusUnitSelectOptions
  84722. };
  84723. let searchRadiusContainer = this._creatUnitSelectBox(searchRadiusOptions, analysisSelectControl);
  84724. let searchRadiusInput = searchRadiusContainer.children[1].children[0];
  84725. searchRadiusInput.value = '300';
  84726. let searchRadiusSelectName = searchRadiusContainer.children[1].children[1].children[0].children[0].children[0];
  84727. // 面积单位
  84728. let areaUnitSelectOptions = {
  84729. 'labelName': Lang.i18n('text_label_areaUnit'),
  84730. 'optionsArr': ['SquareMile', 'SquareMeter', 'Hectare', 'Acre', 'SquareFoot', 'SquareYard']
  84731. };
  84732. let areaUnitSelectTool = (new Select(areaUnitSelectOptions)).getElement();
  84733. analysisSelectControl.appendChild(areaUnitSelectTool);
  84734. let areaUnitSelectName = areaUnitSelectTool.children[1].children[0];
  84735. // 专题图分段
  84736. let rangeContent = external_L_default().DomUtil.create('div', 'range-content', analysisType);
  84737. let rangeContentOptions = {
  84738. 'optionsArr': [Lang.i18n('text_option_notSet'), Lang.i18n('text_option_equidistantSegmentation'), Lang.i18n('text_option_logarithm'), Lang.i18n('text_option_equalCountingSegment'), Lang.i18n('text_option_squareRootSegmentation')],
  84739. 'labelName': Lang.i18n('text_label_thematicMapSegmentationMode'),
  84740. "optionsClickCb": themeModelSelectOnchange
  84741. };
  84742. rangeContent.appendChild((new Select(rangeContentOptions)).getElement());
  84743. let themeModelSelectName = rangeContent.children[0].children[1].children[0];
  84744. themeModelSelectName.setAttribute('data-value', 'NOTSET');
  84745. let themeModelSelect = rangeContent.children[0].children[1].children[2].children[0].children[0];
  84746. let themeModelDataValue = ['NOTSET', 'EQUALINTERVAL', 'LOGARITHM', 'QUANTILE', 'SQUAREROOT'];
  84747. this._setEleAtribute(themeModelDataValue, 'data-value', themeModelSelect.children);
  84748. let rangeContentParamInput = this._creatInputBox({
  84749. 'spanName': Lang.i18n('text_label_thematicMapSegmentationParameters'),
  84750. 'value': '20'
  84751. }, rangeContent);
  84752. rangeContentParamInput.classList.add('hidden');
  84753. let rangeContentModelSelectTool = (new Select({
  84754. 'optionsArr': [
  84755. Lang.i18n('text_option_greenOrangePurpleGradient'),
  84756. Lang.i18n('text_option_greenOrangeRedGradient'),
  84757. Lang.i18n('text_option_rainbowGradient'),
  84758. Lang.i18n('text_option_spectralGradient'),
  84759. Lang.i18n('text_option_terrainGradient')],
  84760. 'labelName': Lang.i18n('text_label_thematicMapColorGradientMode')
  84761. })).getElement();
  84762. rangeContent.appendChild(rangeContentModelSelectTool);
  84763. rangeContentModelSelectTool.classList.add('hidden');
  84764. let rangeContentModelSelect = rangeContentModelSelectTool.children[1].children[2].children[0].children[0];
  84765. let rangeContentModelSelectName = rangeContentModelSelectTool.children[1].children[0];
  84766. rangeContentModelSelectName.setAttribute('data-value', 'GREENORANGEVIOLET');
  84767. let rangeContentModelDV = ['GREENORANGEVIOLET', 'GREENORANGERED', 'RAINBOW', 'SPECTRUM', 'TERRAIN'];
  84768. this._setEleAtribute(rangeContentModelDV, 'data-value', rangeContentModelSelect.children);
  84769. // 专题图分段模式下拉框 onchange 事件
  84770. function themeModelSelectOnchange(option) {
  84771. if (option.getAttribute('data-value') !== 'NOTSET') {
  84772. rangeContentParamInput.classList.remove('hidden');
  84773. rangeContentModelSelectTool.classList.remove('hidden');
  84774. } else {
  84775. rangeContentParamInput.classList.add('hidden');
  84776. rangeContentModelSelectTool.classList.add('hidden');
  84777. }
  84778. }
  84779. // 结果图层
  84780. let resultLayerContainer = external_L_default().DomUtil.create('div', '', analysisType);
  84781. let resultLayerSpan = external_L_default().DomUtil.create('span', '', resultLayerContainer);
  84782. resultLayerSpan.innerHTML = Lang.i18n('text_label_resultLayerName');
  84783. let resultLayerInput = external_L_default().DomUtil.create('input', 'component-distributeanalysis__input', resultLayerContainer);
  84784. // 分析 & 分析中 & 取消 按钮
  84785. let runBtnContainer = external_L_default().DomUtil.create('div', 'component-analysis__container__analysisbtn', analysisTypeContainer);
  84786. let runBtn = external_L_default().DomUtil.create('div', 'component-analysis__analysisbtn', runBtnContainer);
  84787. let analysisBtn = external_L_default().DomUtil.create('button', 'component-analysis__analysisbtn--analysis', runBtn);
  84788. analysisBtn.innerHTML = Lang.i18n('btn_analyze');
  84789. let analysingContainer = external_L_default().DomUtil.create('div', 'component-analysis__analysisbtn--analysing-container hidden', runBtn);
  84790. let analysisingBtn = external_L_default().DomUtil.create('div', 'component-analysis__analysisbtn--analysising', analysingContainer);
  84791. analysisingBtn.style.width = '200px';
  84792. let svgContainer = external_L_default().DomUtil.create('div', 'component-analysis__svg-container', analysisingBtn);
  84793. svgContainer.innerHTML = `<svg class="component-analysis__svg-rotate" width="16px" height="16px" version="1.1" xmlns="http://www.w3.org/2000/svg">
  84794. <path id="ring" fill="#FFF" transform="translate(8,8)" d="M 0 0 v -8 A 8 8 0 1 1 -8.00 0 z"></path>
  84795. <circle cx="8" cy="8" r="6" fill="#38ADF5"></circle>
  84796. <rect class="svg-top" x="8" y="0" rx="2" ry="2" width="2" height="2" style="fill: rgb(255, 255, 255); stroke-width: 0;"></rect>
  84797. <rect class="svg-left" x="0" y="8" rx="2" ry="2" width="2" height="2" style="fill: rgb(255, 255, 255); stroke-width: 0;"></rect>
  84798. </svg>`;
  84799. external_L_default().DomUtil.create('span', '', analysisingBtn).innerHTML = Lang.i18n('btn_analyzing');
  84800. // 删除按钮
  84801. let deleteLayersBtn = external_L_default().DomUtil.create('button', 'component-analysis__analysisbtn--analysis component-analysis__analysisbtn--deletelayers', runBtn);
  84802. deleteLayersBtn.id = 'deleteLayersBtn';
  84803. deleteLayersBtn.innerHTML = Lang.i18n('btn_emptyTheAnalysisLayer');
  84804. // 交互
  84805. // 弹框
  84806. this.messageBox = new MessageBox();
  84807. // 数据集下拉框 onchange 事件
  84808. this.datasetSelectOnchange = datasetSelectOnchange.bind(this);
  84809. function datasetSelectOnchange(option) {
  84810. this.messageBox.closeView();
  84811. if (this.dataHash) {
  84812. weightFieldsSelect.innerHTML = '';
  84813. // 获取当前选中数据集类型
  84814. let datasetUrl = this.dataHash[option.title];
  84815. // 判断当前选中数据集是否支持该选中分析类,并填充分析权重字段
  84816. let _me = this;
  84817. this.viewModel.on('datasetinfoloaded', function (e) {
  84818. weightFieldsSelectName.title = Lang.i18n('text_option_notSet');
  84819. weightFieldsSelectName.innerHTML = Lang.i18n('text_option_notSet');
  84820. weightFieldsSelect.innerHTML = '';
  84821. let analyseType = dropDownTop.getAttribute('data-value');
  84822. let type = e.result.type;
  84823. let fields = e.result.fields;
  84824. if (analyseType === 'density') {
  84825. if (type === 'REGION' || type === 'LINE') {
  84826. _me.messageBox.showView(Lang.i18n('msg_datasetOrMethodUnsupport'), "failure");
  84827. } else {
  84828. _me.messageBox.closeView();
  84829. _me._createOptions(weightFieldsSelect, fields);
  84830. _me.weightFieldsSelectObj.optionClickEvent(weightFieldsSelect, weightFieldsSelectName);
  84831. }
  84832. }
  84833. });
  84834. this.viewModel.getDatasetInfo(datasetUrl);
  84835. }
  84836. }
  84837. // 分析按钮点击事件
  84838. analysisBtn.onclick = () => {
  84839. this.messageBox.closeView();
  84840. let params = getAnalysisParam();
  84841. if (datasetSelectName.title === Lang.i18n('text_option_selectDataset')) {
  84842. this.messageBox.showView(Lang.i18n('msg_selectDataset'), "failure");
  84843. } else if ( weightFieldsSelectName.title === Lang.i18n('text_option_notSet')) {
  84844. this.messageBox.showView(Lang.i18n('msg_setTheWeightField'), "failure");
  84845. } else {
  84846. this.messageBox.closeView();
  84847. analysingContainer.style.display = 'block';
  84848. analysisBtn.style.display = 'none';
  84849. this.viewModel.on('layerloaded', (e) => {
  84850. analysingContainer.style.display = 'none';
  84851. analysisBtn.style.display = 'block';
  84852. /**
  84853. * @event L.supermap.components.distributedAnalysis#analysissucceeded
  84854. * @description 分析完成后触发。
  84855. * @property {L.GeoJSON} layer - 结果图层。
  84856. * @property {string} name - 结果图层名称。
  84857. */
  84858. this._event.fire('analysissucceeded', {'layer': e.layer, 'name': e.name})
  84859. });
  84860. this.viewModel.on('analysisfailed', (e) => {
  84861. this.messageBox.showView(Lang.i18n('msg_theFieldNotSupportAnalysis'), "failure");
  84862. analysingContainer.style.display = 'none';
  84863. analysisBtn.style.display = 'block';
  84864. /**
  84865. * @event L.supermap.components.distributedAnalysis#analysisfailed
  84866. * @description 分析失败后触发。
  84867. * @property {string} error - 服务器返回的错误。
  84868. */
  84869. this._event.fire('analysisfailed', {'error': e.error})
  84870. });
  84871. this.viewModel.analysis(params, this.map);
  84872. }
  84873. };
  84874. // 删除按钮点击事件
  84875. deleteLayersBtn.onclick = () => {
  84876. /**
  84877. * @event L.supermap.components.distributedAnalysis#layersremoved
  84878. * @description 结果图层删除后触发。
  84879. * @property {Array.<L.GeoJSON>} layers - 被删除的结果图层。
  84880. */
  84881. this.viewModel.on('layersremoved', (e) => {
  84882. this._event.fire('layersremoved', { 'layers': e.layers });
  84883. });
  84884. this.viewModel.clearLayers();
  84885. };
  84886. // 获取分析参数
  84887. function getAnalysisParam() {
  84888. let analysisType = dropDownTop.getAttribute('data-value');
  84889. let analysisMethod = analysisMethodSelectName.getAttribute('data-value');
  84890. let gridType = gridTypeSelectName.getAttribute('data-value');
  84891. let queryRange = queryRangeInput.value;
  84892. let gridSizeUnit = gridSizeUnitSelectName.title;
  84893. let searchRadiusUnit = searchRadiusSelectName.title;
  84894. let areaUnit = areaUnitSelectName.title;
  84895. let colorGradientType = rangeContentModelSelectName.getAttribute('data-value');
  84896. let themeModel = themeModelSelectName.getAttribute('data-value');
  84897. let date = new Date();
  84898. let resultLayerName = resultLayerInput.value || date.getTime();
  84899. let mappingParameter;
  84900. if (themeModel === 'NOTSET') {
  84901. mappingParameter = '';
  84902. } else {
  84903. mappingParameter = {
  84904. 'rangeMode': themeModel,
  84905. 'rangeCount': rangeContentParamInput.value,
  84906. 'colorGradientType': colorGradientType
  84907. }
  84908. }
  84909. let analysisParam;
  84910. if (analysisType === 'density') {
  84911. analysisParam = new KernelDensityJobParameter({
  84912. 'datasetName': datasetSelectName.title,
  84913. 'method': analysisMethod,
  84914. 'meshType': gridType,
  84915. 'resolution': gridSizeInput.value,
  84916. 'fields': weightFieldsSelectName.title,
  84917. 'radius': searchRadiusInput.value,
  84918. 'meshSizeUnit': gridSizeUnit,
  84919. 'radiusUnit': searchRadiusUnit,
  84920. 'areaUnit': areaUnit,
  84921. 'query': queryRange,
  84922. 'mappingParameters': new MappingParameters({
  84923. 'rangeMode': mappingParameter.rangeMode,
  84924. 'rangeCount': mappingParameter.rangeCount,
  84925. 'colorGradientType': mappingParameter.colorGradientType
  84926. })
  84927. })
  84928. }
  84929. let params = {
  84930. 'analysisParam': analysisParam,
  84931. 'resultLayerName': resultLayerName
  84932. };
  84933. return params;
  84934. }
  84935. //阻止 map 默认事件
  84936. this._preventMapEvent(container, this.map);
  84937. return container;
  84938. },
  84939. /**
  84940. * @function L.supermap.components.distributedAnalysis.prototype._createOptions
  84941. * @description 创建下拉框 options。
  84942. * @private
  84943. */
  84944. _createOptions(container, optionsArr) {
  84945. for (let i in optionsArr) {
  84946. let option = document.createElement('div');
  84947. option.className = 'component-selecttool__option';
  84948. option.title = optionsArr[i];
  84949. option.innerHTML = optionsArr[i];
  84950. option.setAttribute('data-value', optionsArr[i]);
  84951. container.appendChild(option);
  84952. }
  84953. },
  84954. /**
  84955. * @function L.supermap.components.distributedAnalysis.prototype._creatInputBox
  84956. * @description 创建含有 span 的 input 框。
  84957. * @private
  84958. */
  84959. _creatInputBox(inputOptions, parentEle) {
  84960. let div = external_L_default().DomUtil.create('div', '', parentEle);
  84961. let span = external_L_default().DomUtil.create('span', '', div);
  84962. span.innerHTML = inputOptions.spanName;
  84963. let input = external_L_default().DomUtil.create('input', '', div);
  84964. input.value = inputOptions.value;
  84965. input.className = 'component-distributeanalysis__input';
  84966. return div;
  84967. },
  84968. /**
  84969. * @function L.supermap.components.distributedAnalysis.prototype._creatUnitSelectBox
  84970. * @description 创建含有 span 的 input 框。
  84971. * @private
  84972. */
  84973. _creatUnitSelectBox(options, parentEle) {
  84974. let unitSelectBoxContainer = external_L_default().DomUtil.create('div', 'component-clientcomputation__buffer--radius', parentEle);
  84975. let unitSelectSpan = external_L_default().DomUtil.create('span', '', unitSelectBoxContainer);
  84976. unitSelectSpan.innerHTML = options.labelName;
  84977. let unitSelectInputContainer = external_L_default().DomUtil.create('div', '', unitSelectBoxContainer);
  84978. external_L_default().DomUtil.create('input', 'buffer-radius-input', unitSelectInputContainer);
  84979. let unitSelectUnitContainer = external_L_default().DomUtil.create('div', 'component-clientcomputation__buffer--unit', unitSelectInputContainer);
  84980. let unitSelectOptions = options.selectOptions;
  84981. let unitSelectTool = (new Select(unitSelectOptions)).getElement();
  84982. unitSelectUnitContainer.appendChild(unitSelectTool);
  84983. return unitSelectBoxContainer;
  84984. },
  84985. /**
  84986. * @function L.supermap.components.distributedAnalysis.prototype._setEleAtribute
  84987. * @description 设置元素的属性名和属性值。
  84988. * @private
  84989. */
  84990. _setEleAtribute(daraValueArr, attributeName, eleArr) {
  84991. for (let i = 0; i < eleArr.length; i++) {
  84992. eleArr[i].setAttribute(attributeName, daraValueArr[i])
  84993. }
  84994. }
  84995. });
  84996. var distributedAnalysisView = function (options) {
  84997. return new DistributedAnalysisView(options);
  84998. };
  84999. (external_L_default()).supermap.components.distributedAnalysis = distributedAnalysisView;
  85000. ;// CONCATENATED MODULE: ./src/leaflet/components/dataservicequery/DataServiceQueryViewModel.js
  85001. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  85002. * This program are made available under the terms of the Apache License, Version 2.0
  85003. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  85004. /**
  85005. * @class L.supermap.components.dataServiceQueryViewModel
  85006. * @classdesc 数据服务查询组件功能类。
  85007. * @version 9.1.1
  85008. * @category Components DataServiceQuery
  85009. * @param {string} dataserviceUrl - 数据服务地址。
  85010. * @fires L.supermap.components.dataServiceQueryViewModel#getfeaturessucceeded
  85011. * @fires L.supermap.components.dataServiceQueryViewModel#getfeaturesfailed
  85012. * @extends {L.Evented}
  85013. */
  85014. class DataServiceQueryViewModel extends (external_L_default()).Evented {
  85015. initialize(dataserviceUrl) {
  85016. this.dataserviceUrl = dataserviceUrl;
  85017. this.resultLayers = [];
  85018. }
  85019. /**
  85020. * @function L.supermap.components.dataServiceQueryViewModel.prototype.getFeatures
  85021. * @description 获取 features。
  85022. * @param {(SuperMap.GetFeaturesByIDsParameters|SuperMap.GetFeaturesByBufferParameters|SuperMap.GetFeaturesByBoundsParameters|SuperMap.GetFeaturesBySQLParameters|SuperMap.GetFeaturesByGeometryParameters)} queryParam - 查询参数。
  85023. * @param {L.Map} map - Leaflet Map 对象。
  85024. */
  85025. getFeatures(queryParam, map) {
  85026. let dataserviceUrl = this.dataserviceUrl;
  85027. let me = this;
  85028. let featureService = external_L_default().supermap.featureService(dataserviceUrl);
  85029. if (queryParam instanceof GetFeaturesByIDsParameters) {
  85030. featureService.getFeaturesByIDs(queryParam, function (serviceResult) {
  85031. me._getQureyResult(serviceResult, map);
  85032. });
  85033. } else if (queryParam instanceof GetFeaturesBySQLParameters) {
  85034. featureService.getFeaturesBySQL(queryParam, function (serviceResult) {
  85035. me._getQureyResult(serviceResult, map);
  85036. });
  85037. } else if (queryParam instanceof GetFeaturesByBoundsParameters) {
  85038. featureService.getFeaturesByBounds(queryParam, function (serviceResult) {
  85039. me._getQureyResult(serviceResult, map);
  85040. });
  85041. } else if (queryParam instanceof GetFeaturesByBufferParameters) {
  85042. featureService.getFeaturesByBuffer(queryParam, function (serviceResult) {
  85043. me._getQureyResult(serviceResult, map);
  85044. });
  85045. } else if (queryParam instanceof GetFeaturesByGeometryParameters) {
  85046. featureService.getFeaturesByGeometry(queryParam, function (serviceResult) {
  85047. me._getQureyResult(serviceResult, map);
  85048. });
  85049. }
  85050. }
  85051. /**
  85052. * @function L.supermap.components.dataServiceQueryViewModel.prototype._getQureyResult
  85053. * @description 获取查询结果。
  85054. * @private
  85055. * @param {Object} serviceResult - 服务器返回结果。
  85056. * @param {L.Map} map - Leaflet Map 对象。
  85057. */
  85058. _getQureyResult(serviceResult, map) {
  85059. if (serviceResult.error) {
  85060. /**
  85061. * @event L.supermap.components.dataServiceQueryViewModel#getfeaturesfailed
  85062. * @description features 获取失败时触发。
  85063. * @property {string} error - 服务器返回的错误。
  85064. */
  85065. this.fire('getfeaturesfailed', { 'error': serviceResult.error });
  85066. return;
  85067. }
  85068. let resultLayer = external_L_default().geoJSON(serviceResult.result.features, {
  85069. onEachFeature: function (feature, layer) {
  85070. layer.bindPopup("ID: " + feature.properties.SMID);
  85071. },
  85072. pointToLayer: function (geoJsonPoint, latLng) {
  85073. return external_L_default().circleMarker(latLng, { radius: 6})
  85074. }
  85075. }).addTo(map);
  85076. this.resultLayers.push(resultLayer);
  85077. /**
  85078. * @event L.supermap.components.dataServiceQueryViewModel#getfeaturessucceeded
  85079. * @description features 获取成功时触发。
  85080. * @property {Object} result - 服务器返回的结果。
  85081. */
  85082. this.fire('getfeaturessucceeded', { 'result': serviceResult.result.features })
  85083. }
  85084. /**
  85085. * @function L.supermap.components.dataServiceQueryViewModel.prototype.clearLayers
  85086. * @description 清除所有结果图层。
  85087. */
  85088. clearLayers() {
  85089. for (let i in this.resultLayers) {
  85090. this.resultLayers[i].remove();
  85091. }
  85092. this.resultLayers = [];
  85093. }
  85094. }
  85095. var dataServiceQueryViewModel = function (dataserviceUrl) {
  85096. return new dataServiceQueryViewModel(dataserviceUrl);
  85097. };
  85098. (external_L_default()).supermap.components.dataServiceQueryViewModel = dataServiceQueryViewModel;
  85099. ;// CONCATENATED MODULE: ./src/leaflet/components/dataservicequery/DataServiceQueryView.js
  85100. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  85101. * This program are made available under the terms of the Apache License, Version 2.0
  85102. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  85103. /**
  85104. * @class L.supermap.components.dataServiceQuery
  85105. * @classdesc 数据服务查询组件。
  85106. * @version 9.1.1
  85107. * @param {string} dataServiceUrl - 数据服务地址。
  85108. * @param {(Array.<string>|string)} dataSetNames - 配置查询方式和查询的数据集数组。格式:" 数据源名:数据集名 ",例:"World: Countries"。
  85109. * @param {Object} options - 可选参数。
  85110. * @param {(Array.<SuperMap.GetFeatureMode>|SuperMap.GetFeatureMode)} [options.getFeatureMode] - 查询方式。
  85111. * @param {string} [options.position='topright'] - 组件在地图中显示的位置,包括:'topleft','topright','bottomleft' 和 'bottomright',继承自 leaflet control。
  85112. * @param {function} [options.style] - 设置图层点线面默认样式,点样式返回 maker 或者 circleMaker;线和面返回 L.path 样式。
  85113. * @param {function} [options.onEachFeature] - 在创建和设置样式后,将为每个创建的要素调用一次的函数。用于将事件和弹出窗口附加到要素。默认情况下,对新创建的图层不执行任何操作。
  85114. * @fires L.supermap.components.dataServiceQuery#getfeaturessucceeded
  85115. * @fires L.supermap.components.dataServiceQuery#getfeaturesfailed
  85116. * @category Components DataServiceQuery
  85117. * @extends {L.supermap.components.componentsViewBase}
  85118. */
  85119. var DataServiceQueryView = ComponentsViewBase.extend({
  85120. initialize: function (dataServiceUrl, dataSetNames, options) {
  85121. ComponentsViewBase.prototype.initialize.apply(this, [options]);
  85122. this.dataServiceUrl = dataServiceUrl;
  85123. if (!dataSetNames || dataSetNames.length === 0) {
  85124. throw new Error('Please configure the dataset of the query!')
  85125. }
  85126. if (dataSetNames instanceof Array) {
  85127. this.dataSetNames = dataSetNames;
  85128. } else {
  85129. this.dataSetNames = dataSetNames.split(" ");
  85130. }
  85131. },
  85132. /**
  85133. * @function L.supermap.components.dataServiceQuery.prototype.onAdd
  85134. * @description 添加控件。
  85135. * @private
  85136. * @override
  85137. */
  85138. onAdd: function (map) {
  85139. return ComponentsViewBase.prototype.onAdd.apply(this, [map]);
  85140. },
  85141. /**
  85142. * @function L.supermap.components.dataServiceQuery.prototype.onRemove
  85143. * @description 移除控件。
  85144. * @private
  85145. */
  85146. onRemove: function () {
  85147. this.map.off('pm:create');
  85148. },
  85149. /**
  85150. * @function L.supermap.components.dataServiceQuery.prototype.setDataSetNames
  85151. * @description 设置查询的数据集名。
  85152. * @param {(Array.<string>|string)} dataSetNames - 配置查询方式和查询的数据集数组。格式:" 数据源名:数据集名 ",例:"World: Countries";
  85153. */
  85154. setDataSetNames(dataSetNames) {
  85155. if (dataSetNames instanceof Array) {
  85156. this.dataSetNames = dataSetNames;
  85157. } else {
  85158. this.dataSetNames = dataSetNames.split(" ");
  85159. }
  85160. },
  85161. /**
  85162. * @function L.supermap.components.dataServiceQuery.prototype.setGetFeatureMode
  85163. * @description 设置查询方式。
  85164. * @param {(Array.<SuperMap.GetFeatureMode>|SuperMap.GetFeatureMode)} getFeatureMode - 查询方式。
  85165. */
  85166. setGetFeatureMode(getFeatureMode) {
  85167. this.getFeatureMode = getFeatureMode;
  85168. this._getFeatureModeOnchange(this.getFeatureMode);
  85169. },
  85170. /**
  85171. * @function L.supermap.components.dataServiceQuery.prototype.setDataServiceUrl
  85172. * @description 设置查询的数据服务地址。
  85173. * @param {string} dataServiceUrl - 数据服务地址。
  85174. */
  85175. setDataServiceUrl(dataServiceUrl) {
  85176. this.dataServiceUrl = dataServiceUrl;
  85177. this.viewModel = new DataServiceQueryViewModel(this.dataServiceUrl);
  85178. },
  85179. /**
  85180. * @function L.supermap.components.dataServiceQuery.prototype._getFeatureModeOnchange
  85181. * @private
  85182. * @description 查询方式改变时改变 UI。
  85183. * @param {string} getFeatureMode - 查询方式。
  85184. */
  85185. _getFeatureModeOnchange(getFeatureMode) {
  85186. let queryModelOptionsArr;
  85187. if (!getFeatureMode || JSON.stringify(getFeatureMode) == '{}') {
  85188. queryModelOptionsArr = ['ID', 'SQL', 'BOUNDS', 'BUFFER', 'SPATIAL'];
  85189. } else {
  85190. queryModelOptionsArr = getFeatureMode;
  85191. }
  85192. let queryModelControl = document.getElementById('queryModelControl');
  85193. queryModelControl.innerHTML = '';
  85194. this.creatQueryModeSelect(queryModelOptionsArr, queryModelControl)
  85195. },
  85196. /**
  85197. * @function L.supermap.components.dataServiceQuery.prototype._initView
  85198. * @description 创建数据服务查询组件。
  85199. * @returns {HTMLElement}
  85200. * @private
  85201. */
  85202. _initView: function () {
  85203. // 初始化 ViewModel:
  85204. this.viewModel = new DataServiceQueryViewModel(this.dataServiceUrl);
  85205. this.messageBox = new MessageBox();
  85206. // 组件 container
  85207. let container = (new CommonContainer({title: Lang.i18n('title_dataServiceQuery')})).getElement();
  85208. container.classList.add('component-servicequery__container');
  85209. container.children[0].classList.add('component-servicequery__title');
  85210. let componentContentContainer = container.children[1];
  85211. componentContentContainer.classList.add('component-content--scroll');
  85212. componentContentContainer.classList.add('data-services');
  85213. // 组件内容 container
  85214. let analyusisTypeContainer = external_L_default().DomUtil.create('div', 'component-analysis__container', componentContentContainer);
  85215. let analysisType = external_L_default().DomUtil.create('div', 'component-servicequery__analysistype', analyusisTypeContainer);
  85216. let analysisLayer = external_L_default().DomUtil.create('div', 'component-analysis__container__analysisLayer', analysisType);
  85217. let queryModelOptionsArr, getFeatureModeArr = this.options.getFeatureMode;
  85218. // 获取查询模式
  85219. if (!getFeatureModeArr || JSON.stringify(getFeatureModeArr) == '{}') {
  85220. queryModelOptionsArr = ['ID', 'SQL', 'BOUNDS', 'BUFFER', 'SPATIAL'];
  85221. } else {
  85222. queryModelOptionsArr = getFeatureModeArr;
  85223. }
  85224. // 查询模式
  85225. let queryModelContainer = external_L_default().DomUtil.create('div', '', analysisLayer);
  85226. queryModelContainer.id = 'queryModelContainer';
  85227. let queryModelControl = external_L_default().DomUtil.create('div', 'component-analysis__selecttool', queryModelContainer);
  85228. queryModelControl.id = 'queryModelControl';
  85229. this.creatQueryModeSelect = creatQueryModeSelect.bind(this);
  85230. this.queryModeltOnchange = queryModeltOnchange.bind(this);
  85231. this.creatQueryModeSelect(queryModelOptionsArr, queryModelControl);
  85232. // 要素 ID 数组
  85233. let featuresIdArrContainer = external_L_default().DomUtil.create('div', 'component-analysis__container component-textarea--dataservice__container', analysisLayer);
  85234. let textareaSpan = external_L_default().DomUtil.create('span', 'textarea-name', featuresIdArrContainer);
  85235. textareaSpan.innerHTML = Lang.i18n('text_label_IDArrayOfFeatures');
  85236. let textareaControl = external_L_default().DomUtil.create('div', 'component-textarea component-textarea--dataservice', featuresIdArrContainer);
  85237. textareaControl.id = 'getfeaturesIdArr';
  85238. let scrollarea = external_L_default().DomUtil.create('div', 'scrollarea', textareaControl);
  85239. let scrollareaContent = external_L_default().DomUtil.create('div', 'component-scrollarea-content', scrollarea);
  85240. scrollareaContent.setAttribute('tabindex', '1');
  85241. let getValueTextArea = external_L_default().DomUtil.create('textarea', 'component-textarea__content', scrollareaContent);
  85242. getValueTextArea.value = '[1,2,3]';
  85243. getValueTextArea.id = 'getValueTextArea';
  85244. // SQL 最多可返回的要素数量
  85245. let maxFeaturesContainer = external_L_default().DomUtil.create('div', 'component-servicequery__maxfeatures-container hidden', analysisLayer);
  85246. let maxFeaturesOtions = {
  85247. 'spanName': Lang.i18n('text_label_maxFeatures'),
  85248. 'value': '1000'
  85249. };
  85250. let maxFeaturesInputBox = this._creatInputBox(maxFeaturesOtions, maxFeaturesContainer);
  85251. let maxFeaturesInput = maxFeaturesInputBox.children[1];
  85252. maxFeaturesInput.classList.add('max-features-input');
  85253. // Buffer 缓冲区距离
  85254. let bufferDistanceContainer = external_L_default().DomUtil.create('div', 'component-servicequery__distance-container hidden', analysisLayer);
  85255. let bufferDistanceOtions = {
  85256. 'spanName': Lang.i18n('text_label_bufferDistance'),
  85257. 'value': '10'
  85258. };
  85259. let bufferDistanceInputBox = this._creatInputBox(bufferDistanceOtions, bufferDistanceContainer);
  85260. let bufferDistanceInput = bufferDistanceInputBox.children[1];
  85261. // Bounds 查询范围;
  85262. let queryRangeContainer = external_L_default().DomUtil.create('div', 'component-analysis__container component-textarea--dataservice__container hidden', analysisLayer);
  85263. let queryRangetextareaSpan = external_L_default().DomUtil.create('span', 'textarea-name', queryRangeContainer);
  85264. let queryRangeMainContent = external_L_default().DomUtil.create('div', '', queryRangeContainer);
  85265. let queryRangeIconContainer = external_L_default().DomUtil.create('div', 'component-servicequery__rangeicon-container', queryRangeMainContent);
  85266. queryRangetextareaSpan.innerHTML = Lang.i18n('text_label_queryRange1');
  85267. let queryRangeRecIcon = external_L_default().DomUtil.create('div', 'component-servicequery__rangeicon supermapol-icons-polygon-layer bounds', queryRangeIconContainer);
  85268. let queryRangeLineIcon = external_L_default().DomUtil.create('div', 'component-servicequery__rangeicon supermapol-icons-line-layer hidden', queryRangeIconContainer);
  85269. let queryRangePointIcon = external_L_default().DomUtil.create('div', 'component-servicequery__rangeicon supermapol-icons-point-layer hidden', queryRangeIconContainer);
  85270. let queryRangetextareaControl = external_L_default().DomUtil.create('div', 'component-textarea component-textarea--rangequery', queryRangeMainContent);
  85271. queryRangetextareaControl.id = 'getfeaturesIdArr';
  85272. let queryRangescrollarea = external_L_default().DomUtil.create('div', '', queryRangetextareaControl);
  85273. let queryRangescrollareaContent = external_L_default().DomUtil.create('div', 'component-scrollarea-content', queryRangescrollarea);
  85274. queryRangescrollareaContent.setAttribute('tabindex', '1');
  85275. let queryRangeTextArea = external_L_default().DomUtil.create('textarea', 'component-textarea__content component-textarea--rangequery__content', queryRangescrollareaContent);
  85276. queryRangeTextArea.value = '{"leftBottom":{"x":-5,"y":-5},"rightTop":{"x":5,"y":5}}';
  85277. // geometry 空间查询模式
  85278. let spatialQueryModeContainer = external_L_default().DomUtil.create('div', 'component-servicequery__spatialquerymode-container hidden', analysisLayer);
  85279. let spatialQueryModeOptions = {
  85280. 'optionsArr': ['CONTAIN', 'CROSS', 'DISJOINT', 'IDENTITY', 'INTERSECT', 'NONE', 'OVERLAP', 'TOUCH', 'WITHIN'],
  85281. 'labelName': Lang.i18n('text_label_spatialQueryMode')
  85282. };
  85283. let spatialQueryModeControl = external_L_default().DomUtil.create('div', 'component-analysis__selecttool', spatialQueryModeContainer);
  85284. let spatialQueryModeSelectTool = (new Select(spatialQueryModeOptions)).getElement();
  85285. spatialQueryModeSelectTool.children[1].classList.add('dataservice-select');
  85286. spatialQueryModeControl.appendChild(spatialQueryModeSelectTool);
  85287. let spatialQueryModeSelectName = spatialQueryModeSelectTool.children[1].children[0];
  85288. spatialQueryModeSelectName.id = 'spatialQueryModeSelectName';
  85289. let spatialQueryModeSelectContent = spatialQueryModeSelectTool.children[1].children[2];
  85290. spatialQueryModeSelectContent.classList.add('component-servicequery__spatialquerymode__selectcontent');
  85291. // 分析按钮
  85292. let runBtnContainer = external_L_default().DomUtil.create('div', 'component-analysis__container__analysisbtn', analysisLayer);
  85293. let runBtn = external_L_default().DomUtil.create('div', 'component-analysis__analysisbtn', runBtnContainer);
  85294. let analysisBtn = external_L_default().DomUtil.create('button', 'component-analysis__analysisbtn--analysis', runBtn);
  85295. analysisBtn.innerHTML = Lang.i18n('btn_query');
  85296. let analysingContainer = external_L_default().DomUtil.create('div', 'component-analysis__analysisbtn--analysing-container hidden', runBtn);
  85297. let analysisingBtn = external_L_default().DomUtil.create('div', 'component-analysis__analysisbtn--analysising component-servicequery__querybtn--querying', analysingContainer);
  85298. let svgContainer = external_L_default().DomUtil.create('div', 'component-analysis__svg-container', analysisingBtn);
  85299. svgContainer.innerHTML = `<svg class="component-analysis__svg-rotate" width="16px" height="16px" version="1.1" xmlns="http://www.w3.org/2000/svg">
  85300. <path id="ring" fill="#FFF" transform="translate(8,8)" d="M 0 0 v -8 A 8 8 0 1 1 -8.00 0 z"></path>
  85301. <circle cx="8" cy="8" r="6" fill="#38ADF5"></circle>
  85302. <rect class="svg-top" x="8" y="0" rx="2" ry="2" width="2" height="2" style="fill: rgb(255, 255, 255); stroke-width: 0;"></rect>
  85303. <rect class="svg-left" x="0" y="8" rx="2" ry="2" width="2" height="2" style="fill: rgb(255, 255, 255); stroke-width: 0;"></rect>
  85304. </svg>`;
  85305. external_L_default().DomUtil.create('span', '', analysisingBtn).innerHTML = Lang.i18n('btn_querying');
  85306. // 删除按钮
  85307. let deleteLayersBtn = external_L_default().DomUtil.create('button', 'component-analysis__analysisbtn--analysis component-analysis__analysisbtn--deletelayers', runBtn);
  85308. deleteLayersBtn.innerHTML = Lang.i18n('btn_emptyTheRresultLayer');
  85309. // 设置当前显示参数
  85310. queryModeltOnchange(queryModelOptionsArr[0]);
  85311. // 分析按钮点击事件
  85312. let me = this;
  85313. analysisBtn.onclick = () => {
  85314. this.messageBox.closeView();
  85315. analysingContainer.style.display = 'block';
  85316. analysisBtn.style.display = 'none';
  85317. let queryParams = getQueryParams();
  85318. this.viewModel.on('getfeaturessucceeded', (e) => {
  85319. analysingContainer.style.display = 'none';
  85320. analysisBtn.style.display = 'block';
  85321. if (e.result.features.length === 0) {
  85322. this.messageBox.showView(Lang.i18n('msg_dataReturnedIsEmpty'), "success");
  85323. }
  85324. /**
  85325. * @event L.supermap.components.dataServiceQuery#getfeaturessucceeded
  85326. * @description features 获取成功时触发。
  85327. * @property {Object} result - 服务器返回的结果。
  85328. */
  85329. this._event.fire('getfeaturessucceeded', {'result': e.result})
  85330. });
  85331. this.viewModel.on('getfeaturesfailed', (e) => {
  85332. analysingContainer.style.display = 'none';
  85333. analysisBtn.style.display = 'block';
  85334. this.messageBox.showView(e.error.errorMsg, "failure");
  85335. /**
  85336. * @event L.supermap.components.dataServiceQuery#getfeaturesfailed
  85337. * @description features 获取失败时触发。
  85338. * @property {string} error - 服务器返回的错误。
  85339. */
  85340. this._event.fire('getfeaturesfailed', {'error': e.error})
  85341. });
  85342. this.viewModel.getFeatures(queryParams, this.map);
  85343. };
  85344. let bounds, resultLayer;
  85345. // 矩形 & 多边形绘制
  85346. queryRangeRecIcon.onclick = (e) => {
  85347. let queryModelSelectName = document.getElementById('queryModelSelectName');
  85348. let getFeatureMode = queryModelSelectName.title;
  85349. if (resultLayer) {
  85350. resultLayer.remove();
  85351. }
  85352. // 矩形
  85353. if (getFeatureMode === 'BOUNDS') {
  85354. this.map.pm.enableDraw('Rectangle');
  85355. // 多边形
  85356. } else {
  85357. this.map.pm.enableDraw('Poly');
  85358. }
  85359. e.stopPropagation();
  85360. e.preventDefault();
  85361. };
  85362. // 线绘制
  85363. queryRangeLineIcon.onclick = (e) => {
  85364. if (resultLayer) {
  85365. resultLayer.remove();
  85366. }
  85367. this.map.pm.enableDraw('Line');
  85368. e.stopPropagation();
  85369. e.preventDefault();
  85370. };
  85371. // 点绘制
  85372. queryRangePointIcon.onclick = (e) => {
  85373. if (resultLayer) {
  85374. resultLayer.remove();
  85375. }
  85376. this.map.pm.enableDraw('Marker');
  85377. e.stopPropagation();
  85378. e.preventDefault();
  85379. };
  85380. this.map.on('pm:create', (e) => {
  85381. if (e.shape === 'Rectangle') {
  85382. resultLayer = e.layer;
  85383. let boundsT = resultLayer.getBounds();
  85384. bounds = external_L_default().bounds([boundsT._southWest.lng, boundsT._southWest.lat], [boundsT._northEast.lng, boundsT._northEast.lat]);
  85385. let geo = {
  85386. 'leftBottom': {'x': boundsT._southWest.lng, 'y': boundsT._southWest.lat},
  85387. 'rightTop': {'x': boundsT._northEast.lng, 'y': boundsT._northEast.lat}
  85388. };
  85389. queryRangeTextArea.value = JSON.stringify(geo);
  85390. }
  85391. if (e.shape === 'Marker') {
  85392. resultLayer = e.layer;
  85393. queryRangeTextArea.value = JSON.stringify(e.layer.toGeoJSON());
  85394. this.map.pm.disableDraw("Marker");
  85395. }
  85396. if (e.shape === 'Line') {
  85397. resultLayer = e.layer;
  85398. queryRangeTextArea.value = JSON.stringify(e.layer.toGeoJSON());
  85399. }
  85400. if (e.shape === 'Polygon') {
  85401. resultLayer = e.layer;
  85402. queryRangeTextArea.value = JSON.stringify(e.layer.toGeoJSON());
  85403. }
  85404. });
  85405. // 删除按钮点击事件
  85406. deleteLayersBtn.onclick = () => {
  85407. this.viewModel.clearLayers();
  85408. };
  85409. function creatQueryModeSelect(queryModelOptionsArr, queryModelControl) {
  85410. // 查询模式
  85411. let queryModelSelectName;
  85412. if (queryModelOptionsArr instanceof Array && queryModelOptionsArr.length > 1) {
  85413. let queryModelOptions = {
  85414. 'optionsArr': queryModelOptionsArr,
  85415. 'labelName': Lang.i18n('text_label_queryMode'),
  85416. 'optionsClickCb': this.queryModeltOnchange
  85417. };
  85418. let queryModelSelectTool = (new Select(queryModelOptions)).getElement();
  85419. queryModelControl.appendChild(queryModelSelectTool);
  85420. queryModelSelectName = queryModelSelectTool.children[1].children[0];
  85421. queryModelSelectTool.children[1].classList.add('dataservice-select');
  85422. let queryModelSelect = queryModelSelectTool.children[1];
  85423. queryModelSelect.classList.add('dataservice-select');
  85424. queryModelSelect.classList.add('querymodel-select');
  85425. } else {
  85426. let span = external_L_default().DomUtil.create('span', '', queryModelContainer);
  85427. span.innerHTML = Lang.i18n('text_label_queryMode');
  85428. queryModelSelectName = external_L_default().DomUtil.create('div', 'component-servicequery__querymode-selectname', queryModelContainer);
  85429. let text = external_L_default().DomUtil.create('span', '', queryModelSelectName);
  85430. if (queryModelOptionsArr instanceof Array) {
  85431. text.innerHTML = queryModelOptionsArr[0];
  85432. } else {
  85433. text.innerHTML = queryModelOptionsArr;
  85434. }
  85435. queryModelSelectName.title = text.innerHTML;
  85436. this.queryModeltOnchange(queryModelSelectName);
  85437. }
  85438. queryModelSelectName.id = 'queryModelSelectName';
  85439. return queryModelSelectName;
  85440. }
  85441. // 查询模式下拉框 onchange 事件
  85442. function queryModeltOnchange(option) {
  85443. // 获取当前选中查询模式
  85444. let queryModelSelectName;
  85445. if (option.title) {
  85446. queryModelSelectName = option.title;
  85447. } else {
  85448. queryModelSelectName = option;
  85449. }
  85450. // 控制部分查询参数元素隐藏和显示
  85451. maxFeaturesContainer.classList.add('hidden');
  85452. queryRangeContainer.classList.add('hidden');
  85453. bufferDistanceContainer.classList.add('hidden');
  85454. queryRangeLineIcon.classList.add('hidden');
  85455. queryRangePointIcon.classList.add('hidden');
  85456. queryRangeRecIcon.classList.remove('bounds');
  85457. spatialQueryModeContainer.classList.add('hidden');
  85458. textareaSpan.innerHTML = Lang.i18n('text_label_featureFilter');
  85459. getValueTextArea.value = 'SMID<10';
  85460. if (queryModelSelectName === 'BUFFER' || queryModelSelectName === 'SPATIAL') {
  85461. queryRangeContainer.classList.remove('hidden');
  85462. queryRangetextareaSpan.innerHTML = Lang.i18n('text_label_geometricObject');
  85463. queryRangeTextArea.value = '{"type":"Feature","properties":{},"geometry":{"type":"Point","coordinates":[84.90234375,40.25390625]}}';
  85464. queryRangeLineIcon.classList.remove('hidden');
  85465. queryRangePointIcon.classList.remove('hidden');
  85466. }
  85467. switch (queryModelSelectName) {
  85468. case 'ID':
  85469. textareaSpan.innerHTML = Lang.i18n('text_label_IDArrayOfFeatures');
  85470. getValueTextArea.value = '[1,2,3]';
  85471. break;
  85472. case 'SQL':
  85473. maxFeaturesContainer.classList.remove('hidden');
  85474. break;
  85475. case 'BOUNDS':
  85476. queryRangeContainer.classList.remove('hidden');
  85477. queryRangetextareaSpan.innerHTML = Lang.i18n('text_label_queryRange');
  85478. queryRangeTextArea.value = '{"leftBottom":{"x":-5,"y":-5},"rightTop":{"x":5,"y":5}}';
  85479. queryRangeRecIcon.classList.add('bounds');
  85480. break;
  85481. case 'BUFFER':
  85482. bufferDistanceContainer.classList.remove('hidden');
  85483. break;
  85484. case 'SPATIAL':
  85485. spatialQueryModeContainer.classList.remove('hidden');
  85486. break;
  85487. }
  85488. }
  85489. // 获取查询参数
  85490. function getQueryParams() {
  85491. // 数据集数组
  85492. let datasetArr = me.dataSetNames;
  85493. let queryModelSelectName = document.getElementById('queryModelSelectName');
  85494. let getFeatureMode = queryModelSelectName.title;
  85495. // 过滤条件
  85496. let attributeFilter = getValueTextArea.value;
  85497. let queryParam;
  85498. if (getFeatureMode === 'ID') {
  85499. let value = getValueTextArea.value;
  85500. let ids = value.substring(1, value.length - 1).split(',');
  85501. queryParam = new GetFeaturesByIDsParameters({
  85502. IDs: ids,
  85503. datasetNames: datasetArr
  85504. });
  85505. } else if (getFeatureMode === 'SQL') {
  85506. let maxFeatures = maxFeaturesInput.value;
  85507. queryParam = new GetFeaturesBySQLParameters({
  85508. queryParameter: {
  85509. attributeFilter: attributeFilter
  85510. },
  85511. datasetNames: datasetArr,
  85512. maxFeatures: maxFeatures
  85513. });
  85514. } else if (getFeatureMode === 'BOUNDS') {
  85515. if (!bounds) {
  85516. let value = JSON.parse(queryRangeTextArea.value);
  85517. bounds = external_L_default().bounds([value.leftBottom.x, value.leftBottom.y], [value.rightTop.x, value.rightTop.y])
  85518. }
  85519. queryParam = new GetFeaturesByBoundsParameters({
  85520. attributeFilter: attributeFilter,
  85521. datasetNames: datasetArr,
  85522. bounds: bounds
  85523. });
  85524. } else if (getFeatureMode === 'BUFFER') {
  85525. let bufferDistance = bufferDistanceInput.value;
  85526. let defaultGeometryValue = JSON.parse(queryRangeTextArea.value);
  85527. let geometryLayer = resultLayer || defaultGeometryValue;
  85528. queryParam = new GetFeaturesByBufferParameters({
  85529. attributeFilter: attributeFilter,
  85530. datasetNames: datasetArr,
  85531. bufferDistance: bufferDistance,
  85532. geometry: geometryLayer
  85533. });
  85534. } else if (getFeatureMode === 'SPATIAL') {
  85535. let spatialQueryMode = spatialQueryModeSelectName.title;
  85536. let defaultGeometryValue = JSON.parse(queryRangeTextArea.value);
  85537. let geometryLayer = resultLayer || defaultGeometryValue;
  85538. queryParam = new GetFeaturesByGeometryParameters({
  85539. attributeFilter: attributeFilter,
  85540. datasetNames: datasetArr,
  85541. spatialQueryMode: spatialQueryMode,
  85542. geometry: geometryLayer
  85543. });
  85544. }
  85545. return queryParam;
  85546. }
  85547. //阻止 map 默认事件
  85548. this._preventMapEvent(container, this.map);
  85549. return container;
  85550. },
  85551. /**
  85552. * @function L.supermap.components.dataServiceQuery.prototype._creatInputBox
  85553. * @description 创建含有 span 的 input 框。
  85554. * @private
  85555. */
  85556. _creatInputBox(inputOptions, parentEle) {
  85557. let div = external_L_default().DomUtil.create('div', '', parentEle);
  85558. let span = external_L_default().DomUtil.create('span', '', div);
  85559. span.innerHTML = inputOptions.spanName;
  85560. let input = external_L_default().DomUtil.create('input', '', div);
  85561. input.value = inputOptions.value;
  85562. // input.className = 'distributeInput'
  85563. return div;
  85564. }
  85565. });
  85566. var dataServiceQueryView = function (dataServiceUrl, dataSetNames, options) {
  85567. return new DataServiceQueryView(dataServiceUrl, dataSetNames, options);
  85568. };
  85569. (external_L_default()).supermap.components.dataServiceQuery = dataServiceQueryView;
  85570. ;// CONCATENATED MODULE: ./src/leaflet/components/index.js
  85571. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  85572. * This program are made available under the terms of the Apache License, Version 2.0
  85573. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  85574. ;// CONCATENATED MODULE: ./src/leaflet/index.js
  85575. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  85576. * This program are made available under the terms of the Apache License, Version 2.0
  85577. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  85578. })();
  85579. (() => {
  85580. "use strict";
  85581. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  85582. * This program are made available under the terms of the Apache License, Version 2.0
  85583. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  85584. })();
  85585. /******/ })()
  85586. ;